static word creg_get( young_heap_t *heap ) { int room = stk_size_for_top_stack_frame( DATA(heap)->globals ); word p; collect_if_no_room( heap, room ); assert( free_space( heap ) >= room ); flush_stack( heap ); p = DATA(heap)->globals[ G_CONT ]; must_create_stack( heap ); must_restore_frame( heap ); return p; }
static void before_collection( young_heap_t *heap ) { young_data_t *data = DATA(heap); word *globals = data->globals; flush_stack( heap ); heap->maximum = data->heapsize; heap->allocated = heap->maximum - free_space( heap ); if (!data->havestats) { data->havestats = TRUE; data->los_live = bytes2words(los_bytes_used( heap->collector->los, data->gen_no )); data->stack_live = bytes2words(globals[G_STKBOT] - globals[G_STKP]); data->not_used = bytes2words(globals[G_STKP] - globals[G_ETOP]); } }
NIL_type Stack_Reset(NIL_type) { flush_stack(); }
NIL_type Stack_Initialize_M(NIL_type) { slipken_persist_init(Stack_vector, make_VEC_M(Initial_stack_size)); slipken_persist(Top_of_stack); flush_stack(); MAIN_REGISTER(Stack_vector); }
static void do_trace_hist(struct tracecmd_input *handle) { struct pevent *pevent = tracecmd_get_pevent(handle); struct event_format *event; struct pevent_record *record; int cpus; int cpu; int ret; ret = tracecmd_init_data(handle); if (ret < 0) die("failed to init data"); if (ret > 0) die("trace-cmd hist does not work with latency traces\n"); cpus = tracecmd_cpus(handle); /* Need to get any event */ for (cpu = 0; cpu < cpus; cpu++) { record = tracecmd_peek_data(handle, cpu); if (record) break; } if (!record) die("No records found in file"); ret = pevent_data_type(pevent, record); event = pevent_data_event_from_type(pevent, ret); long_size = tracecmd_long_size(handle); common_type_field = pevent_find_common_field(event, "common_type"); if (!common_type_field) die("Can't find a 'type' field?"); common_pid_field = pevent_find_common_field(event, "common_pid"); if (!common_pid_field) die("Can't find a 'pid' field?"); update_sched_wakeup(pevent); update_sched_wakeup_new(pevent); update_sched_switch(pevent); update_function(pevent); update_function_graph_entry(pevent); update_function_graph_exit(pevent); update_kernel_stack(pevent); for (cpu = 0; cpu < cpus; cpu++) { for (;;) { struct pevent_record *record; record = tracecmd_read_data(handle, cpu); if (!record) break; /* If we missed events, just flush out the current stack */ if (record->missed_events) flush_stack(); process_record(pevent, record); free_record(record); } } if (current_pid >= 0) save_call_chain(current_pid, ips, ips_idx, 0); if (pending_pid >= 0) save_call_chain(pending_pid, pending_ips, pending_ips_idx, 1); save_stored_stacks(); sort_chains(); print_chains(pevent); }