void factorvm::init_factor(vm_parameters *p) { /* Kilobytes */ p->ds_size = align_page(p->ds_size << 10); p->rs_size = align_page(p->rs_size << 10); /* Megabytes */ p->young_size <<= 20; p->aging_size <<= 20; p->tenured_size <<= 20; p->code_size <<= 20; /* Disable GC during init as a sanity check */ gc_off = true; /* OS-specific initialization */ early_init(); const vm_char *executable_path = vm_executable_path(); if(executable_path) p->executable_path = executable_path; if(p->image_path == NULL) p->image_path = default_image_path(); srand(current_micros()); init_ffi(); init_stacks(p->ds_size,p->rs_size); load_image(p); init_c_io(); init_inline_caching(p->max_pic_size); init_signals(); if(p->console) open_console(); init_profiler(); userenv[CPU_ENV] = allot_alien(F,(cell)FACTOR_CPU_STRING); userenv[OS_ENV] = allot_alien(F,(cell)FACTOR_OS_STRING); userenv[CELL_SIZE_ENV] = tag_fixnum(sizeof(cell)); userenv[EXECUTABLE_ENV] = allot_alien(F,(cell)p->executable_path); userenv[ARGS_ENV] = F; userenv[EMBEDDED_ENV] = F; /* We can GC now */ gc_off = false; if(userenv[STAGE2_ENV] == F) { userenv[STACK_TRACES_ENV] = tag_boolean(p->stack_traces); do_stage1_init(); } }
/* Get things started */ void init_factor(F_PARAMETERS *p) { /* Kilobytes */ p->ds_size = align_page(p->ds_size << 10); p->rs_size = align_page(p->rs_size << 10); /* Megabytes */ p->young_size <<= 20; p->aging_size <<= 20; p->tenured_size <<= 20; p->code_size <<= 20; /* Disable GC during init as a sanity check */ gc_off = true; /* OS-specific initialization */ early_init(); if(p->image == NULL) p->image = default_image_path(); srand(current_micros()); init_ffi(); init_stacks(p->ds_size,p->rs_size); load_image(p); init_c_io(); init_signals(); if(p->console) open_console(); stack_chain = NULL; profiling_p = false; performing_gc = false; last_code_heap_scan = NURSERY; collecting_aging_again = false; userenv[CPU_ENV] = tag_object(from_char_string(FACTOR_CPU_STRING)); userenv[OS_ENV] = tag_object(from_char_string(FACTOR_OS_STRING)); userenv[CELL_SIZE_ENV] = tag_fixnum(sizeof(CELL)); userenv[STACK_TRACES_ENV] = tag_boolean(p->stack_traces); /* We can GC now */ gc_off = false; if(!stage2) do_stage1_init(); }