/**
* Change execution context by calling a new function from current context
- *
+ * Pushing 0x0 specifies a marker for a signal handler entry
*/
void CLG_(push_cxt)(fn_node* fn)
{
cs->entry[cs->sp].cxt = CLG_(current_state).cxt;
cs->entry[cs->sp].fn_sp = CLG_(current_fn_stack).top - CLG_(current_fn_stack).bottom;
- if (*(CLG_(current_fn_stack).top) == fn) return;
+ if (fn && (*(CLG_(current_fn_stack).top) == fn)) return;
if (fn && (fn->group>0) &&
((*(CLG_(current_fn_stack).top))->group == fn->group)) return;
CLG_(current_fn_stack).size = new_size;
}
- if (*(CLG_(current_fn_stack).top) == 0) {
+ if (fn && (*(CLG_(current_fn_stack).top) == 0)) {
UInt *pactive;
/* this is first function: increment its active count */
- CLG_ASSERT(fn != 0);
pactive = CLG_(get_fn_entry)(fn->number);
(*pactive)++;
}
/* save current execution state */
exec_state_save();
- /* setup current state for a spontaneous call */
- CLG_(init_exec_state)( &CLG_(current_state) );
- CLG_(push_cxt)(0);
-
/* setup new cxtinfo struct for this signal handler */
es = push_exec_state(sigNum);
- CLG_(init_cost)( CLG_(sets).full, es->cost);
+ // because of this, below call to init_exec_state will zero es->cost
CLG_(current_state).cost = es->cost;
es->call_stack_bottom = CLG_(current_call_stack).sp;
+ /* setup current state for a spontaneous call */
+ CLG_(init_exec_state)( &CLG_(current_state) );
CLG_(current_state).sig = sigNum;
+ CLG_(push_cxt)(0);
}
/* Run post-signal if the stackpointer for call stack is at
es->jmps_passed = CLG_(current_state).jmps_passed;
es->bbcc = CLG_(current_state).bbcc;
es->nonskipped = CLG_(current_state).nonskipped;
+ CLG_ASSERT(es->cost == CLG_(current_state).cost);
CLG_DEBUGIF(1) {
CLG_DEBUG(1, " cxtinfo_save(sig %d): collect %s, jmps_passed %d\n",