diff options
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/beam/beam_emu.c | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index 009be37d40..b412cf8b79 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -376,6 +376,7 @@ do { \ * The following functions are called directly by process_main(). * Don't inline them. */ +static void init_emulator_finish(void) NOINLINE; static ErtsCodeMFA *ubif2mfa(void* uf) NOINLINE; static ErtsCodeMFA *gcbif2mfa(void* gcf) NOINLINE; static BeamInstr* handle_error(Process* c_p, BeamInstr* pc, @@ -957,9 +958,6 @@ void process_main(Eterm * x_reg_array, FloatDef* f_reg_array) init_emulator: { - int i; - Export* ep; - #ifndef NO_JUMP_TABLE #ifdef ERTS_OPCODE_COUNTER_SUPPORT #ifdef DEBUG @@ -972,6 +970,40 @@ void process_main(Eterm * x_reg_array, FloatDef* f_reg_array) #endif /* ERTS_OPCODE_COUNTER_SUPPORT */ #endif /* NO_JUMP_TABLE */ + init_emulator_finish(); + return; + } +#ifdef NO_JUMP_TABLE + default: + erts_exit(ERTS_ERROR_EXIT, "unexpected op code %d\n",Go); + } +#endif + return; /* Never executed */ + + save_calls1: + { + BeamInstr dis_next; + + save_calls(c_p, (Export *) Arg(0)); + + SET_I(((Export *) Arg(0))->addressv[erts_active_code_ix()]); + + dis_next = *I; + FCALLS--; + Goto(dis_next); + } +} + +/* + * One-time initialization of emulator. Does not need to be + * in process_main(). + */ +static void +init_emulator_finish(void) +{ + int i; + Export* ep; + beam_apply[0] = BeamOpCodeAddr(op_i_apply); beam_apply[1] = BeamOpCodeAddr(op_normal_exit); beam_exit[0] = BeamOpCodeAddr(op_error_action_code); @@ -994,28 +1026,6 @@ void process_main(Eterm * x_reg_array, FloatDef* f_reg_array) /* XXX: set func info for bifs */ ep->info.op = BeamOpCodeAddr(op_i_func_info_IaaI); } - - return; - } -#ifdef NO_JUMP_TABLE - default: - erts_exit(ERTS_ERROR_EXIT, "unexpected op code %d\n",Go); - } -#endif - return; /* Never executed */ - - save_calls1: - { - BeamInstr dis_next; - - save_calls(c_p, (Export *) Arg(0)); - - SET_I(((Export *) Arg(0))->addressv[erts_active_code_ix()]); - - dis_next = *I; - FCALLS--; - Goto(dis_next); - } } /* |