From 7848e6bfaa2848df69738e31909afa4a15dbcd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= Date: Tue, 17 Sep 2019 11:28:37 +0200 Subject: erts: Rename bif_table_index to bif_number --- erts/emulator/beam/beam_bif_load.c | 6 +++--- erts/emulator/beam/beam_emu.c | 12 ++++++------ erts/emulator/beam/beam_load.c | 19 +++++++++---------- erts/emulator/beam/bif.c | 4 ++-- erts/emulator/beam/erl_bif_trace.c | 2 +- erts/emulator/beam/export.c | 4 ++-- erts/emulator/beam/export.h | 2 +- 7 files changed, 24 insertions(+), 25 deletions(-) diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c index 312c524ab3..66cc1855e9 100644 --- a/erts/emulator/beam/beam_bif_load.c +++ b/erts/emulator/beam/beam_bif_load.c @@ -847,7 +847,7 @@ BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2) ep->addressv[code_ix] = (void*)ep->trampoline.not_loaded.deferred; ep->trampoline.not_loaded.deferred = 0; } else { - if (ep->bif_table_index != -1) { + if (ep->bif_number != -1) { continue; } @@ -876,7 +876,7 @@ BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2) if (ep == NULL || ep->info.mfa.module != BIF_ARG_1) { continue; } - if (ep->bif_table_index != -1) { + if (ep->bif_number != -1) { continue; } @@ -1903,7 +1903,7 @@ delete_code(Module* modp) } } - if (ep->bif_table_index != -1 && ep->is_bif_traced) { + if (ep->bif_number != -1 && ep->is_bif_traced) { /* Code unloading kills both global and local call tracing. */ ep->is_bif_traced = 0; } diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index 6741afc1b7..adc6593ca2 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -910,7 +910,7 @@ static void install_bifs(void) { ep->info.mfa.module = entry->module; ep->info.mfa.function = entry->name; ep->info.mfa.arity = entry->arity; - ep->bif_table_index = i; + ep->bif_number = i; memset(&ep->trampoline, 0, sizeof(ep->trampoline)); ep->trampoline.op = BeamOpCodeAddr(op_call_error_handler); @@ -2016,10 +2016,10 @@ apply_bif_error_adjustment(Process *p, Export *ep, * from the instructions i_apply_only, i_apply_last_P, * and apply_last_IP. */ - if (!(I && (ep->bif_table_index == BIF_error_1 || - ep->bif_table_index == BIF_error_2 || - ep->bif_table_index == BIF_exit_1 || - ep->bif_table_index == BIF_throw_1))) { + if (!(I && (ep->bif_number == BIF_error_1 || + ep->bif_number == BIF_error_2 || + ep->bif_number == BIF_exit_1 || + ep->bif_number == BIF_throw_1))) { return; } @@ -3119,7 +3119,7 @@ erts_is_builtin(Eterm Mod, Eterm Name, int arity) return 0; } - return ep->bif_table_index != -1; + return ep->bif_number != -1; } diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index 9a53edc5a3..13d366ef8b 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -1483,7 +1483,7 @@ load_import_table(LoaderState* stp) * If the export entry refers to a BIF, save a pointer to the BIF entry. */ if ((e = erts_active_export_entry(mod, func, arity)) != NULL) { - if (e->bif_table_index != -1) { + if (e->bif_number != -1) { stp->import[i].bif = e; if (func == am_load_nif && mod == am_erlang && arity == 2) { stp->may_load_nif = 1; @@ -1548,7 +1548,7 @@ is_bif(Eterm mod, Eterm func, unsigned arity) Export *e = erts_active_export_entry(mod, func, arity); if (e != NULL) { - return e->bif_table_index != -1; + return e->bif_number != -1; } return 0; @@ -2507,7 +2507,7 @@ load_code(LoaderState* stp) LoadError1(stp, "not a BIF: import table index %d", i); } { - int bif_index = stp->import[i].bif->bif_table_index; + int bif_index = stp->import[i].bif->bif_number; BifEntry *bif_entry = &bif_table[bif_index]; code[ci++] = (BeamInstr) bif_entry->f; } @@ -3171,17 +3171,16 @@ is_killed_by_make_fun(LoaderState* stp, GenOpArg Reg, GenOpArg idx) static int is_heavy_bif(LoaderState* stp, GenOpArg Bif) { - Export *bif_export; + Export *ep; if (Bif.type != TAG_u || Bif.val >= stp->num_imports) { return 0; } - bif_export = stp->import[Bif.val].bif; + ep = stp->import[Bif.val].bif; - if (bif_export) { - int bif_index = bif_export->bif_table_index; - return bif_table[bif_index].kind == BIF_KIND_HEAVY; + if (ep) { + return bif_table[ep->bif_number].kind == BIF_KIND_HEAVY; } return 0; @@ -5222,7 +5221,7 @@ final_touch(LoaderState* stp, struct erl_module_instance* inst_p) stp->export[i].arity); /* Fill in BIF stubs with a proper call to said BIF. */ - if (ep->bif_table_index != -1) { + if (ep->bif_number != -1) { erts_write_bif_wrapper(ep, address); } @@ -5435,7 +5434,7 @@ transform_engine(LoaderState* st) goto restart; if (bif_number != -1) { Export *bif = st->import[i].bif; - if (bif->bif_table_index != bif_number) { + if (bif->bif_number != bif_number) { goto restart; } } diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 3775bcf298..14f6c44cb8 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -4978,7 +4978,7 @@ void erts_init_trap_export(Export* ep, Eterm m, Eterm f, Uint a, ep->addressv[i] = ep->trampoline.raw; } - ep->bif_table_index = -1; + ep->bif_number = -1; ep->info.op = op_i_func_info_IaaI; ep->info.mfa.module = m; @@ -4993,7 +4993,7 @@ void erts_init_trap_export(Export* ep, Eterm m, Eterm f, Uint a, * Writes a BIF call wrapper to the given address. */ void erts_write_bif_wrapper(Export *export, BeamInstr *address) { - BifEntry *entry = &bif_table[export->bif_table_index]; + BifEntry *entry = &bif_table[export->bif_number]; address[0] = BeamOpCodeAddr(op_call_bif_W); address[1] = (BeamInstr)entry->f; diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c index a730e2d455..46f4ed7ab0 100644 --- a/erts/emulator/beam/erl_bif_trace.c +++ b/erts/emulator/beam/erl_bif_trace.c @@ -1434,7 +1434,7 @@ erts_set_trace_pattern(Process*p, ErtsCodeMFA *mfa, int specified, pc = erts_codeinfo_to_code(ci); ep = ErtsContainerStruct(ci, Export, info); - if (ep->bif_table_index != -1) { + if (ep->bif_number != -1) { ep->is_bif_traced = !!on; } diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c index ca16bfd20e..af1b1c2892 100644 --- a/erts/emulator/beam/export.c +++ b/erts/emulator/beam/export.c @@ -129,7 +129,7 @@ export_alloc(struct export_entry* tmpl_e) obj->info.mfa.module = tmpl->info.mfa.module; obj->info.mfa.function = tmpl->info.mfa.function; obj->info.mfa.arity = tmpl->info.mfa.arity; - obj->bif_table_index = -1; + obj->bif_number = -1; obj->is_bif_traced = 0; memset(&obj->trampoline, 0, sizeof(obj->trampoline)); @@ -207,7 +207,7 @@ static struct export_entry* init_template(struct export_templ* templ, templ->exp.info.mfa.module = m; templ->exp.info.mfa.function = f; templ->exp.info.mfa.arity = a; - templ->exp.bif_table_index = -1; + templ->exp.bif_number = -1; templ->exp.is_bif_traced = 0; return &templ->entry; } diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h index 0190624f79..91c4844d20 100644 --- a/erts/emulator/beam/export.h +++ b/erts/emulator/beam/export.h @@ -35,7 +35,7 @@ typedef struct export void* addressv[ERTS_NUM_CODE_IX]; /* Index into bif_table[], or -1 if not a BIF. */ - int bif_table_index; + int bif_number; /* Non-zero if this is a BIF that's traced. */ int is_bif_traced; -- cgit v1.2.1