/************************************************************************** * NAME: send_stack_variables * * ARGS: s : the connected socket * * where: level in the stack where the current feature is located * *------------------------------------------------------------------------* * Dump the arguments and the locals of the 'where-th' feature down the * * stack. where=1 means dumping the locals of the feature located on top * * of the stack * **************************************************************************/ rt_public void send_stack_variables(EIF_PSTREAM s, int where) { /* This is the main routine. It send a whole stack dump to the remote * process through the connected socket and via XDR. The end of the dump * is indicated by a positive acknowledgment. */ struct dump *dp; /* Pointer to static data where dump is */ uint32 start; /* start of the frozen operational stack */ save_stacks(); /* preserve stacks */ /* go to the specified level */ start = go_ith_stack_level(where); /* then dump the variables */ if (start != EIF_NO_ITEM) { dp = get_next_variable (start); while (dp) { /* While still some data to send */ if (dp != (struct dump *) EIF_IGNORE) { send_dump(s, dp); } dp = get_next_variable (start); } } restore_stacks(); /* restore stacks */ send_ack(s, AK_OK); /* End of list -- you got everything */ }
/************************************************************************** * NAME: send_stack * * ARGS: s : the connected socket * *------------------------------------------------------------------------* * This is the main routine. It send at most elem_nb elements to the remote* * process through the connected socket and via XDR. The end of the dump * * is indicated by a positive acknowledgment. * **************************************************************************/ rt_public void send_stack(EIF_PSTREAM s, uint32 elem_nb) { struct dump *dp; /* Pointer to static data where dump is */ uint32 sent = 0; save_stacks(); /* Initialize processing */ dp = get_next_execution_vector(); while (dp && (sent < elem_nb)) { /* While still some data to send */ if (dp != (struct dump *) EIF_IGNORE) { send_dump(s, dp); sent++; } dp = get_next_execution_vector(); } restore_stacks(); send_ack(s, AK_OK); /* End of list -- you got everything */ }
void factor_vm::gc(gc_op op, cell requested_bytes, bool trace_contexts_p) { assert(!gc_off); assert(!current_gc); save_stacks(); current_gc = new gc_state(op,this); /* Keep trying to GC higher and higher generations until we don't run out of space */ if(setjmp(current_gc->gc_unwind)) { /* We come back here if a generation is full */ start_gc_again(); } current_gc->event->op = current_gc->op; switch(current_gc->op) { case collect_nursery_op: collect_nursery(); break; case collect_aging_op: collect_aging(); if(data->high_fragmentation_p()) { current_gc->op = collect_full_op; current_gc->event->op = collect_full_op; collect_full(trace_contexts_p); } break; case collect_to_tenured_op: collect_to_tenured(); if(data->high_fragmentation_p()) { current_gc->op = collect_full_op; current_gc->event->op = collect_full_op; collect_full(trace_contexts_p); } break; case collect_full_op: collect_full(trace_contexts_p); break; case collect_compact_op: collect_compact(trace_contexts_p); break; case collect_growing_heap_op: collect_growing_heap(requested_bytes,trace_contexts_p); break; default: critical_error("Bad GC op",current_gc->op); break; } end_gc(); delete current_gc; current_gc = NULL; }