aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-09-04 15:25:58 +0200
committerBjörn Gustavsson <[email protected]>2017-09-11 15:22:42 +0200
commitbffbd4fb504e9551fc7feb9177ef0a2394c00cae (patch)
tree5be0ecd25f043cfa7d7fd39391105c8d25f3a522 /erts/emulator
parent9674613dd9d1c5ac026c9bff05ea19df2886a2c3 (diff)
downloadotp-bffbd4fb504e9551fc7feb9177ef0a2394c00cae.tar.gz
otp-bffbd4fb504e9551fc7feb9177ef0a2394c00cae.tar.bz2
otp-bffbd4fb504e9551fc7feb9177ef0a2394c00cae.zip
Introduce a new trace_jump/1 instruction for tracing
As a preparation for introducing relative jumps, introduce "trace_jump W" that can be used for tracing. This instruction will continue to have an absolute address for the jump target. (Note: This instruction is never created during loading; it is only created in stubs when tracing is active.)
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/erl_bif_trace.c8
-rw-r--r--erts/emulator/beam/ops.tab1
-rw-r--r--erts/emulator/beam/trace_instrs.tab13
3 files changed, 18 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_bif_trace.c b/erts/emulator/beam/erl_bif_trace.c
index b02f966558..2859cdb0f1 100644
--- a/erts/emulator/beam/erl_bif_trace.c
+++ b/erts/emulator/beam/erl_bif_trace.c
@@ -1367,7 +1367,7 @@ erts_set_trace_pattern(Process*p, ErtsCodeMFA *mfa, int specified,
#ifdef DEBUG
ep->info.op = (BeamInstr) BeamOp(op_i_func_info_IaaI);
#endif
- ep->beam[0] = (BeamInstr) BeamOp(op_jump_f);
+ ep->beam[0] = (BeamInstr) BeamOp(op_trace_jump_W);
ep->beam[1] = (BeamInstr) ep->addressv[code_ix];
}
erts_set_call_trace_bif(ci, match_prog_set, 0);
@@ -1383,7 +1383,7 @@ erts_set_trace_pattern(Process*p, ErtsCodeMFA *mfa, int specified,
*/
erts_clear_call_trace_bif(ci, 0);
if (ep->beam[0] == (BeamInstr) BeamOp(op_i_generic_breakpoint)) {
- ep->beam[0] = (BeamInstr) BeamOp(op_jump_f);
+ ep->beam[0] = (BeamInstr) BeamOp(op_trace_jump_W);
}
}
}
@@ -1675,7 +1675,7 @@ uninstall_exp_breakpoints(BpFunctions* f)
if (ep->addressv[code_ix] != ep->beam) {
continue;
}
- ASSERT(ep->beam[0] == (BeamInstr) BeamOp(op_jump_f));
+ ASSERT(ep->beam[0] == (BeamInstr) BeamOp(op_trace_jump_W));
ep->addressv[code_ix] = (BeamInstr *) ep->beam[1];
}
}
@@ -1694,7 +1694,7 @@ clean_export_entries(BpFunctions* f)
if (ep->addressv[code_ix] == ep->beam) {
continue;
}
- if (ep->beam[0] == (BeamInstr) BeamOp(op_jump_f)) {
+ if (ep->beam[0] == (BeamInstr) BeamOp(op_trace_jump_W)) {
ep->beam[0] = (BeamInstr) 0;
ep->beam[1] = (BeamInstr) 0;
}
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index d64f6f2cfc..4152e0ced5 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -69,6 +69,7 @@ i_debug_breakpoint
i_return_time_trace
i_return_to_trace
i_yield
+trace_jump W
%hot
return
diff --git a/erts/emulator/beam/trace_instrs.tab b/erts/emulator/beam/trace_instrs.tab
index c71f2ef003..c28bc8ebcb 100644
--- a/erts/emulator/beam/trace_instrs.tab
+++ b/erts/emulator/beam/trace_instrs.tab
@@ -153,3 +153,16 @@ i_debug_breakpoint() {
goto handle_error;
//| -no_next
}
+
+
+
+//
+// Special jump instruction used for tracing. Takes an absolute
+// failure address.
+//
+
+trace_jump(Fail) {
+ //| -no_next
+ SET_I((BeamInstr *) $Fail);
+ Goto(*I);
+}