Lines Matching refs:CLG_
62 ThreadId CLG_(current_tid);
66 thread_info** CLG_(get_threads)()
71 thread_info* CLG_(get_current_thread)()
73 return thread[CLG_(current_tid)];
76 void CLG_(init_threads)()
84 CLG_(current_tid) = VG_INVALID_THREADID;
88 void CLG_(forall_threads)(void (*func)(thread_info*))
90 Int t, orig_tid = CLG_(current_tid);
94 CLG_(switch_thread)(t);
97 CLG_(switch_thread)(orig_tid);
110 CLG_(init_exec_stack)( &(t->states) );
111 CLG_(init_call_stack)( &(t->calls) );
112 CLG_(init_fn_stack) ( &(t->fns) );
113 /* t->states.entry[0]->cxt = CLG_(get_cxt)(t->fns.bottom); */
116 t->lastdump_cost = CLG_(get_eventset_cost)( CLG_(sets).full );
117 t->sighandler_cost = CLG_(get_eventset_cost)( CLG_(sets).full );
118 CLG_(init_cost)( CLG_(sets).full, t->lastdump_cost );
119 CLG_(init_cost)( CLG_(sets).full, t->sighandler_cost );
122 CLG_(init_fn_array)( &(t->fn_active) );
123 CLG_(init_bbcc_hash)( &(t->bbccs) );
124 CLG_(init_jcc_hash)( &(t->jccs) );
130 void CLG_(switch_thread)(ThreadId tid)
132 if (tid == CLG_(current_tid)) return;
134 CLG_DEBUG(0, ">> thread %u (was %u)\n", tid, CLG_(current_tid));
136 if (CLG_(current_tid) != VG_INVALID_THREADID) {
138 thread_info* t = thread[CLG_(current_tid)];
144 CLG_(copy_current_exec_stack)( &(t->states) );
145 CLG_(copy_current_call_stack)( &(t->calls) );
146 CLG_(copy_current_fn_stack) ( &(t->fns) );
148 CLG_(copy_current_fn_array) ( &(t->fn_active) );
150 if (!CLG_(clo).separate_threads) t = thread[1];
151 CLG_(copy_current_bbcc_hash)( &(t->bbccs) );
152 CLG_(copy_current_jcc_hash) ( &(t->jccs) );
155 CLG_(current_tid) = tid;
167 CLG_(set_current_exec_stack)( &(t->states) );
169 CLG_(set_current_call_stack)( &(t->calls) );
170 CLG_(set_current_fn_stack) ( &(t->fns) );
172 CLG_(set_current_fn_array) ( &(t->fn_active) );
174 if (!CLG_(clo).separate_threads) t = thread[1];
175 CLG_(set_current_bbcc_hash) ( &(t->bbccs) );
176 CLG_(set_current_jcc_hash) ( &(t->jccs) );
181 void CLG_(run_thread)(ThreadId tid)
187 if (CLG_(clo).dump_every_bb >0) {
188 if (CLG_(stat).bb_executions - bbs_done > CLG_(clo).dump_every_bb) {
189 VG_(sprintf)(buf, "--dump-every-bb=%llu", CLG_(clo).dump_every_bb);
190 CLG_(dump_profile)(buf, False);
191 bbs_done = CLG_(stat).bb_executions;
196 CLG_(switch_thread)(tid);
199 void CLG_(pre_signal)(ThreadId tid, Int sigNum, Bool alt_stack)
207 CLG_(switch_thread)(tid);
214 CLG_(zero_cost)( CLG_(sets).full, es->cost );
215 CLG_(current_state).cost = es->cost;
216 es->call_stack_bottom = CLG_(current_call_stack).sp;
219 CLG_(init_exec_state)( &CLG_(current_state) );
220 CLG_(current_state).sig = sigNum;
221 CLG_(push_cxt)(0);
227 * Called from CLG_(pop_call_stack)
229 void CLG_(run_post_signal_on_call_stack_bottom)()
233 CLG_ASSERT(CLG_(current_state).sig >0);
235 if (CLG_(current_call_stack).sp == es->call_stack_bottom)
236 CLG_(post_signal)( CLG_(current_tid), CLG_(current_state).sig );
239 void CLG_(post_signal)(ThreadId tid, Int sigNum)
248 CLG_(switch_thread)(tid);
249 CLG_ASSERT(sigNum == CLG_(current_state).sig);
256 while(CLG_(current_call_stack).sp > es->call_stack_bottom)
257 CLG_(pop_call_stack)();
259 if (CLG_(current_state).cxt) {
261 fn_number = CLG_(current_state).cxt->fn[0]->number;
262 pactive = CLG_(get_fn_entry)(fn_number);
265 CLG_(current_state).cxt->fn[0]->name, *pactive);
268 if (CLG_(current_fn_stack).top > CLG_(current_fn_stack).bottom) {
273 if (*(CLG_(current_fn_stack).top) != 0) {
274 CLG_(current_fn_stack).top--;
275 CLG_ASSERT(*(CLG_(current_fn_stack).top) == 0);
277 if (CLG_(current_fn_stack).top > CLG_(current_fn_stack).bottom)
278 CLG_(current_fn_stack).top--;
282 CLG_ASSERT(CLG_(current_state).cost == es->cost);
283 CLG_(add_and_zero_cost)( CLG_(sets).full,
284 thread[CLG_(current_tid)]->sighandler_cost,
285 CLG_(current_state).cost );
291 CLG_(current_state).sig = es->sig;
296 * CLG_(setup_bb)(), which should be the next for callgrind.
315 void CLG_(init_exec_state)(exec_state* es)
317 es->collect = CLG_(clo).collect_atstart;
333 es->cost = CLG_(get_eventset_cost)(CLG_(sets).full);
334 CLG_(zero_cost)( CLG_(sets).full, es->cost );
335 CLG_(init_exec_state)(es);
342 void CLG_(init_exec_stack)(exec_stack* es)
353 void CLG_(copy_current_exec_stack)(exec_stack* dst)
362 void CLG_(set_current_exec_stack)(exec_stack* dst)
416 es->cxt = CLG_(current_state).cxt;
417 es->collect = CLG_(current_state).collect;
418 es->jmps_passed = CLG_(current_state).jmps_passed;
419 es->bbcc = CLG_(current_state).bbcc;
420 es->nonskipped = CLG_(current_state).nonskipped;
421 CLG_ASSERT(es->cost == CLG_(current_state).cost);
426 CLG_(print_bbcc)(-9, es->bbcc);
427 CLG_(print_cost)(-9, CLG_(sets).full, es->cost);
431 CLG_ASSERT(CLG_(current_state).sig == es->sig);
441 CLG_(current_state).cxt = es->cxt;
442 CLG_(current_state).collect = es->collect;
443 CLG_(current_state).jmps_passed = es->jmps_passed;
444 CLG_(current_state).bbcc = es->bbcc;
445 CLG_(current_state).nonskipped = es->nonskipped;
446 CLG_(current_state).cost = es->cost;
447 CLG_(current_state).sig = es->sig;
452 CLG_(print_bbcc)(-9, es->bbcc);
453 CLG_(print_cxt)(-9, es->cxt, 0);
454 CLG_(print_cost)(-9, CLG_(sets).full, es->cost);