diff options
author | Sverker Eriksson <[email protected]> | 2012-01-17 12:16:39 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2012-02-21 12:22:58 +0100 |
commit | 90209e4d57dd9b5ff27729b582f02c3d9e383f72 (patch) | |
tree | a91c441699120f0c4fd076cd470754f30a3a9fa1 /erts/emulator/beam/beam_bif_load.c | |
parent | 41cf0cb977472a15527b6ac693883daaa84faa5a (diff) | |
download | otp-90209e4d57dd9b5ff27729b582f02c3d9e383f72.tar.gz otp-90209e4d57dd9b5ff27729b582f02c3d9e383f72.tar.bz2 otp-90209e4d57dd9b5ff27729b582f02c3d9e383f72.zip |
erts: Multiple export tab's using code_ix
Still blocking code loading
Diffstat (limited to 'erts/emulator/beam/beam_bif_load.c')
-rw-r--r-- | erts/emulator/beam/beam_bif_load.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c index a8ef198be5..4858859c2d 100644 --- a/erts/emulator/beam/beam_bif_load.c +++ b/erts/emulator/beam/beam_bif_load.c @@ -35,7 +35,7 @@ #include "erl_nif.h" #include "erl_thr_progress.h" -static void set_default_trace_pattern(Eterm module); +static void set_default_trace_pattern(Eterm module, ErtsCodeIndex); static Eterm check_process_code(Process* rp, Module* modp); static void delete_code(Process *c_p, ErtsProcLocks c_p_locks, Module* modp); static void delete_export_references(Eterm module); @@ -90,10 +90,15 @@ load_module_2(BIF_ALIST_2) reason = erts_finish_loading(stp, BIF_P, 0, &BIF_ARG_1); if (reason != NIL) { - erts_abort_loader_code_ix(); + if (reason == am_on_load) { + erts_commit_loader_code_ix(); + } + else { + erts_abort_loader_code_ix(); + } res = TUPLE2(hp, am_error, reason); } else { - set_default_trace_pattern(BIF_ARG_1); + set_default_trace_pattern(BIF_ARG_1, erts_loader_code_ix()); erts_commit_loader_code_ix(); res = TUPLE2(hp, am_module, BIF_ARG_1); } @@ -114,7 +119,7 @@ BIF_RETTYPE purge_module_1(BIF_ALIST_1) erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); erts_smp_thr_progress_block(); - erts_export_consolidate(); + erts_export_consolidate(erts_active_code_ix()); purge_res = purge_module(atom_val(BIF_ARG_1)); erts_smp_thr_progress_unblock(); @@ -148,7 +153,7 @@ BIF_RETTYPE code_make_stub_module_3(BIF_ALIST_3) erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); erts_smp_thr_progress_block(); - erts_export_consolidate(); + erts_export_consolidate(erts_active_code_ix()); res = erts_make_stub_module(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3); erts_smp_thr_progress_unblock(); @@ -331,8 +336,10 @@ BIF_RETTYPE call_on_load_function_1(BIF_ALIST_1) BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2) { + ErtsCodeIndex code_ix; Module* modp = erts_get_module(BIF_ARG_1); Eterm on_load; + code_ix = erts_active_code_ix(); if (!modp || modp->curr.code == 0) { error: @@ -354,8 +361,8 @@ BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2) /* * The on_load function succeded. Fix up export entries. */ - for (i = 0; i < export_list_size(); i++) { - Export *ep = export_list(i); + for (i = 0; i < export_list_size(code_ix); i++) { + Export *ep = export_list(i,code_ix); if (ep != NULL && ep->code[0] == BIF_ARG_1 && ep->code[4] != 0) { @@ -364,7 +371,7 @@ BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2) } } modp->curr.code[MI_ON_LOAD_FUNCTION_PTR] = 0; - set_default_trace_pattern(BIF_ARG_1); + set_default_trace_pattern(BIF_ARG_1, erts_active_code_ix ()); } else if (BIF_ARG_2 == am_false) { BeamInstr* code; BeamInstr* end; @@ -392,7 +399,7 @@ BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2) } static void -set_default_trace_pattern(Eterm module) +set_default_trace_pattern(Eterm module, ErtsCodeIndex code_ix) { int trace_pattern_is_on; Binary *match_spec; @@ -412,7 +419,8 @@ set_default_trace_pattern(Eterm module) match_spec, meta_match_spec, 1, trace_pattern_flags, - meta_tracer_pid); + meta_tracer_pid, + code_ix); } } @@ -763,12 +771,13 @@ delete_code(Process *c_p, ErtsProcLocks c_p_locks, Module* modp) static void delete_export_references(Eterm module) { + ErtsCodeIndex code_ix = erts_loader_code_ix(); int i; ASSERT(is_atom(module)); - for (i = 0; i < export_list_size(); i++) { - Export *ep = export_list(i); + for (i = 0; i < export_list_size(code_ix); i++) { + Export *ep = export_list(i, code_ix); if (ep != NULL && (ep->code[0] == module)) { if (ep->address == ep->code+3 && (ep->code[3] == (BeamInstr) em_apply_bif)) { |