summaryrefslogtreecommitdiff
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/beam_bif_load.c2
-rw-r--r--erts/emulator/beam/beam_common.c4
-rw-r--r--erts/emulator/beam/beam_common.h2
-rw-r--r--erts/emulator/beam/beam_debug.c2
-rw-r--r--erts/emulator/beam/beam_load.c2
-rw-r--r--erts/emulator/beam/bif.c2
-rw-r--r--erts/emulator/beam/bif.h2
-rw-r--r--erts/emulator/beam/dist.c2
-rw-r--r--erts/emulator/beam/emu/beam_emu.c2
-rw-r--r--erts/emulator/beam/emu/emu_load.c6
-rw-r--r--erts/emulator/beam/emu/instrs.tab4
-rw-r--r--erts/emulator/beam/emu/macros.tab2
-rw-r--r--erts/emulator/beam/emu/trace_instrs.tab2
-rw-r--r--erts/emulator/beam/erl_bif_trace.c4
-rw-r--r--erts/emulator/beam/export.c6
-rw-r--r--erts/emulator/beam/export.h21
-rw-r--r--erts/emulator/beam/jit/asm_load.c2
-rw-r--r--erts/emulator/beam/jit/beam_asm.hpp2
-rw-r--r--erts/emulator/hipe/hipe_instrs.tab2
19 files changed, 38 insertions, 33 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 18aa034ce4..85c66f05e0 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -952,7 +952,7 @@ BIF_RETTYPE finish_after_on_load_2(BIF_ALIST_2)
DBG_CHECK_EXPORT(ep, code_ix);
if (ep->trampoline.not_loaded.deferred != 0) {
- ep->addressv[code_ix] = (void*)ep->trampoline.not_loaded.deferred;
+ ep->addresses[code_ix] = (void*)ep->trampoline.not_loaded.deferred;
ep->trampoline.not_loaded.deferred = 0;
} else {
if (ep->bif_number != -1) {
diff --git a/erts/emulator/beam/beam_common.c b/erts/emulator/beam/beam_common.c
index 6827aeb8b2..8bcb137f4b 100644
--- a/erts/emulator/beam/beam_common.c
+++ b/erts/emulator/beam/beam_common.c
@@ -1657,7 +1657,7 @@ call_fun(Process* p, /* Current process. */
reg[2] = args;
reg[3] = NIL;
*epp = ep;
- return ep->addressv[code_ix];
+ return ep->addresses[code_ix];
}
}
} else if (is_export_header(hdr)) {
@@ -1670,7 +1670,7 @@ call_fun(Process* p, /* Current process. */
if (arity == actual_arity) {
DTRACE_GLOBAL_CALL(p, &ep->info.mfa);
*epp = ep;
- return ep->addressv[erts_active_code_ix()];
+ return ep->addresses[erts_active_code_ix()];
} else {
/*
* Wrong arity. First build a list of the arguments.
diff --git a/erts/emulator/beam/beam_common.h b/erts/emulator/beam/beam_common.h
index bb2d2f32bc..1f93fbaf61 100644
--- a/erts/emulator/beam/beam_common.h
+++ b/erts/emulator/beam/beam_common.h
@@ -215,7 +215,7 @@ do { \
#define DTRACE_GLOBAL_CALL_FROM_EXPORT(p,e) \
do { \
if (DTRACE_ENABLED(global_function_entry)) { \
- BeamInstr* fp = (BeamInstr *) (((Export *) (e))->addressv[erts_active_code_ix()]); \
+ BeamInstr* fp = (BeamInstr *) (((Export *) (e))->addresses[erts_active_code_ix()]); \
DTRACE_GLOBAL_CALL((p), erts_code_to_codemfa(fp)); \
} \
} while(0)
diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c
index 9cde9612b3..e80c746a6b 100644
--- a/erts/emulator/beam/beam_debug.c
+++ b/erts/emulator/beam/beam_debug.c
@@ -299,7 +299,7 @@ erts_debug_disassemble_1(BIF_ALIST_1)
* But this code_ptr will point to the start of the Export,
* not the function's func_info instruction. BOOM !?
*/
- cmfa = erts_code_to_codemfa(ep->addressv[code_ix]);
+ cmfa = erts_code_to_codemfa(ep->addresses[code_ix]);
} else if (modp == NULL || (code_hdr = modp->curr.code_hdr) == NULL) {
BIF_RET(am_undef);
} else {
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 00a1dd6868..0972a9b369 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -237,7 +237,7 @@ erts_finish_loading(Binary* magic, Process* c_p,
erts_clear_export_break(mod_tab_p, ep);
- ep->addressv[code_ix] =
+ ep->addresses[code_ix] =
(BeamInstr*)ep->trampoline.breakpoint.address;
ep->trampoline.breakpoint.address = 0;
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index f76c4374af..b4cccb4565 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -5031,7 +5031,7 @@ void erts_init_trap_export(Export** epp, Eterm m, Eterm f, Uint a,
ep->info.mfa.arity = a;
#ifdef BEAMASM
- ep->addressv[ERTS_SAVE_CALLS_CODE_IX] = beam_save_calls;
+ ep->addresses[ERTS_SAVE_CALLS_CODE_IX] = beam_save_calls;
#endif
ep->trampoline.common.op = BeamOpCodeAddr(op_call_bif_W);
diff --git a/erts/emulator/beam/bif.h b/erts/emulator/beam/bif.h
index b75f7913be..65c6cd8e3f 100644
--- a/erts/emulator/beam/bif.h
+++ b/erts/emulator/beam/bif.h
@@ -327,7 +327,7 @@ extern BeamInstr *beam_bif_export_trap;
#define ERTS_BIF_PREP_TRAP(Export, Proc, Arity) \
do { \
- (Proc)->i = (BeamInstr*)((Export)->addressv[erts_active_code_ix()]); \
+ (Proc)->i = (BeamInstr*)((Export)->addresses[erts_active_code_ix()]); \
(Proc)->arity = (Arity); \
(Proc)->freason = TRAP; \
} while(0);
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index ab04241e8e..323133782e 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -4516,7 +4516,7 @@ BIF_RETTYPE setnode_2(BIF_ALIST_2)
goto error;
/* Check that all trap functions are defined !! */
- if (dmonitor_node_trap->addressv[0] == NULL) {
+ if (dmonitor_node_trap->addresses[0] == NULL) {
goto error;
}
diff --git a/erts/emulator/beam/emu/beam_emu.c b/erts/emulator/beam/emu/beam_emu.c
index f2969aca5d..cf6d5f5dce 100644
--- a/erts/emulator/beam/emu/beam_emu.c
+++ b/erts/emulator/beam/emu/beam_emu.c
@@ -529,7 +529,7 @@ void process_main(ErtsSchedulerData *esdp)
HEAVY_SWAPIN;
if (error_handler) {
- I = error_handler->addressv[erts_active_code_ix()];
+ I = error_handler->addresses[erts_active_code_ix()];
Goto(*I);
}
}
diff --git a/erts/emulator/beam/emu/emu_load.c b/erts/emulator/beam/emu/emu_load.c
index 2cc5565829..c2031761f7 100644
--- a/erts/emulator/beam/emu/emu_load.c
+++ b/erts/emulator/beam/emu/emu_load.c
@@ -684,7 +684,7 @@ void beam_load_finalize_code(LoaderState* stp, struct erl_module_instance* inst_
*/
ep->trampoline.not_loaded.deferred = (BeamInstr) address;
} else {
- ep->addressv[erts_staging_code_ix()] = address;
+ ep->addresses[erts_staging_code_ix()] = address;
}
}
@@ -697,7 +697,7 @@ void beam_load_finalize_code(LoaderState* stp, struct erl_module_instance* inst_
Export *ep = erts_export_put(entry->module,
entry->name,
entry->arity);
- const BeamInstr *addr = ep->addressv[erts_staging_code_ix()];
+ const BeamInstr *addr = ep->addresses[erts_staging_code_ix()];
if (!ErtsInArea(addr, stp->codev, stp->ci * sizeof(BeamInstr))) {
erts_exit(ERTS_ABORT_EXIT,
@@ -1563,7 +1563,7 @@ stub_beam_load_finalize_code(LoaderState* stp, ErtsCodeInfo* ci)
Export* ep = erts_export_put(ci->mfa.module,
ci->mfa.function,
ci->mfa.arity);
- ep->addressv[erts_staging_code_ix()] = erts_codeinfo_to_code(ci);
+ ep->addresses[erts_staging_code_ix()] = erts_codeinfo_to_code(ci);
DBG_TRACE_MFA_P(&ci->mfa,"set beam stub at %p in export at %p (code_ix=%d)",
erts_codeinfo_to_code(ci), ep, erts_staging_code_ix());
return;
diff --git a/erts/emulator/beam/emu/instrs.tab b/erts/emulator/beam/emu/instrs.tab
index ce38a7d610..b05533c830 100644
--- a/erts/emulator/beam/emu/instrs.tab
+++ b/erts/emulator/beam/emu/instrs.tab
@@ -243,7 +243,7 @@ APPLY(I, Deallocate, Next) {
save_calls(c_p, ep);
}
- $Next = ep->addressv[erts_active_code_ix()];
+ $Next = ep->addresses[erts_active_code_ix()];
}
HANDLE_APPLY_ERROR() {
@@ -290,7 +290,7 @@ FIXED_APPLY(Arity, I, Deallocate, Next) {
save_calls(c_p, ep);
}
- $Next = ep->addressv[erts_active_code_ix()];
+ $Next = ep->addresses[erts_active_code_ix()];
}
apply(Arity) {
diff --git a/erts/emulator/beam/emu/macros.tab b/erts/emulator/beam/emu/macros.tab
index 3d64c1ec0b..7164c0a407 100644
--- a/erts/emulator/beam/emu/macros.tab
+++ b/erts/emulator/beam/emu/macros.tab
@@ -170,7 +170,7 @@ DISPATCH_EXPORT(Export) {
DTRACE_GLOBAL_CALL_FROM_EXPORT(c_p, ep);
- SET_I(ep->addressv[erts_active_code_ix()]);
+ SET_I(ep->addresses[erts_active_code_ix()]);
CHECK_ARGS(I);
dis_next = *I;
diff --git a/erts/emulator/beam/emu/trace_instrs.tab b/erts/emulator/beam/emu/trace_instrs.tab
index 8416b30cc3..52512c8490 100644
--- a/erts/emulator/beam/emu/trace_instrs.tab
+++ b/erts/emulator/beam/emu/trace_instrs.tab
@@ -165,7 +165,7 @@ i_debug_breakpoint() {
HEAVY_SWAPIN;
if (breakpoint_handler) {
- I = breakpoint_handler->addressv[erts_active_code_ix()];
+ I = breakpoint_handler->addresses[erts_active_code_ix()];
Goto(*I);
}
diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c
index c3247a104a..48d867721c 100644
--- a/erts/emulator/beam/erl_bif_trace.c
+++ b/erts/emulator/beam/erl_bif_trace.c
@@ -1443,7 +1443,7 @@ erts_set_trace_pattern(Process*p, ErtsCodeMFA *mfa, int specified,
ep->info.op = BeamOpCodeAddr(op_i_func_info_IaaI);
#endif
ep->trampoline.common.op = BeamOpCodeAddr(op_trace_jump_W);
- ep->trampoline.trace.address = (BeamInstr) ep->addressv[code_ix];
+ ep->trampoline.trace.address = (BeamInstr) ep->addresses[code_ix];
}
erts_set_export_trace(ci, match_prog_set, 0);
@@ -1671,7 +1671,7 @@ uninstall_exp_breakpoints(BpFunctions* f)
if (erts_is_export_trampoline_active(ep, code_ix)) {
ASSERT(BeamIsOpCode(ep->trampoline.common.op, op_trace_jump_W));
- ep->addressv[code_ix] = (BeamInstr *) ep->trampoline.trace.address;
+ ep->addresses[code_ix] = (BeamInstr *) ep->trampoline.trace.address;
}
}
}
diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c
index 458041ebdf..9c101743b6 100644
--- a/erts/emulator/beam/export.c
+++ b/erts/emulator/beam/export.c
@@ -295,7 +295,7 @@ erts_export_put(Eterm mod, Eterm func, unsigned int arity)
res = ee->ep;
#ifdef BEAMASM
- res->addressv[ERTS_SAVE_CALLS_CODE_IX] = beam_save_calls;
+ res->addresses[ERTS_SAVE_CALLS_CODE_IX] = beam_save_calls;
#endif
return res;
@@ -338,7 +338,7 @@ erts_export_get_or_make_stub(Eterm mod, Eterm func, unsigned int arity)
ep = entry->ep;
#ifdef BEAMASM
- ep->addressv[ERTS_SAVE_CALLS_CODE_IX] = beam_save_calls;
+ ep->addresses[ERTS_SAVE_CALLS_CODE_IX] = beam_save_calls;
#endif
ASSERT(ep);
@@ -412,7 +412,7 @@ void export_start_staging(void)
*/
for (i = 0; i < src->entries; i++) {
src_entry = (struct export_entry*) erts_index_lookup(src, i);
- src_entry->ep->addressv[dst_ix] = src_entry->ep->addressv[src_ix];
+ src_entry->ep->addresses[dst_ix] = src_entry->ep->addresses[src_ix];
#ifdef DEBUG
dst_entry = (struct export_entry*)
#endif
diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h
index 73e621ce1b..a53623752e 100644
--- a/erts/emulator/beam/export.h
+++ b/erts/emulator/beam/export.h
@@ -44,13 +44,18 @@ typedef struct export_
{
/* Pointer to code for function.
*
- * Be _very_ careful when accessing this directly. The JIT has a special
- * calling convention for export entries, assuming the entry itself is in
- * a certain register, so blindly calling the pointers herein will result
- * in weird crashes.
+ * !! THIS WAS DELIBERATELY RENAMED TO CAUSE ERRORS WHEN MERGING !!
+ *
+ * The JIT has a special calling convention for export entries, assuming
+ * the entry itself is in a certain register. Blindly setting `c_p->i` to
+ * one of these addresses will crash the emulator when the entry is traced,
+ * which is unlikely to be caught in our tests.
+ *
+ * Use the `BIF_TRAP` macros if at all possible, and be _very_ careful when
+ * accessing these directly.
*
* See `BeamAssembler::emit_setup_export_call` for details. */
- const void* addressv[ERTS_ADDRESSV_SIZE];
+ const void *addresses[ERTS_ADDRESSV_SIZE];
/* Index into bif_table[], or -1 if not a BIF. */
int bif_number;
@@ -59,7 +64,7 @@ typedef struct export_
/* This is a small trampoline function that can be used for lazy code
* loading, global call tracing, and so on. It's only valid when
- * addressv points to it and should otherwise be left zeroed.
+ * addresses points to it and should otherwise be left zeroed.
*
* Needless to say, the order of the fields below is significant. */
ErtsCodeInfo info;
@@ -163,7 +168,7 @@ ERTS_GLB_INLINE void erts_activate_export_trampoline(Export *ep, int code_ix) {
trampoline_address = &ep->trampoline.raw[0];
#endif
- ep->addressv[code_ix] = trampoline_address;
+ ep->addresses[code_ix] = trampoline_address;
}
ERTS_GLB_INLINE int erts_is_export_trampoline_active(Export *ep, int code_ix) {
@@ -175,7 +180,7 @@ ERTS_GLB_INLINE int erts_is_export_trampoline_active(Export *ep, int code_ix) {
trampoline_address = &ep->trampoline.raw[0];
#endif
- return ep->addressv[code_ix] == trampoline_address;
+ return ep->addresses[code_ix] == trampoline_address;
}
ERTS_GLB_INLINE Export*
diff --git a/erts/emulator/beam/jit/asm_load.c b/erts/emulator/beam/jit/asm_load.c
index a59cd23346..c99390cb02 100644
--- a/erts/emulator/beam/jit/asm_load.c
+++ b/erts/emulator/beam/jit/asm_load.c
@@ -858,7 +858,7 @@ void beam_load_finalize_code(LoaderState *stp,
* code callable. */
ep->trampoline.not_loaded.deferred = (BeamInstr)address;
} else {
- ep->addressv[staging_ix] = address;
+ ep->addresses[staging_ix] = address;
}
}
diff --git a/erts/emulator/beam/jit/beam_asm.hpp b/erts/emulator/beam/jit/beam_asm.hpp
index d75ac0d7c9..f438ef0b4e 100644
--- a/erts/emulator/beam/jit/beam_asm.hpp
+++ b/erts/emulator/beam/jit/beam_asm.hpp
@@ -665,7 +665,7 @@ protected:
a.mov(RET, Src);
}
- return x86::qword_ptr(RET, CodeIndex, 3, offsetof(Export, addressv));
+ return x86::qword_ptr(RET, CodeIndex, 3, offsetof(Export, addresses));
}
/* Discards a continuation pointer, including the frame pointer if
diff --git a/erts/emulator/hipe/hipe_instrs.tab b/erts/emulator/hipe/hipe_instrs.tab
index 9ccde74582..745ab8850f 100644
--- a/erts/emulator/hipe/hipe_instrs.tab
+++ b/erts/emulator/hipe/hipe_instrs.tab
@@ -89,7 +89,7 @@ hipe_trap.post() {
$RETURN();
Goto(*I);
case HIPE_MODE_SWITCH_RES_CALL_EXPORTED:
- c_p->i = c_p->hipe.u.callee_exp->addressv[erts_active_code_ix()];
+ c_p->i = c_p->hipe.u.callee_exp->addresses[erts_active_code_ix()];
/*fall through*/
case HIPE_MODE_SWITCH_RES_CALL_BEAM:
SET_I(c_p->i);