aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_mode_switch.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-04-25 23:02:26 +0200
committerSverker Eriksson <[email protected]>2014-04-29 16:17:56 +0200
commitc4cdb1847e09d1153a6044d7a6aac05db4fad515 (patch)
tree6bbb66be7b53e2532caee29ee0ff455416e9b2af /erts/emulator/hipe/hipe_mode_switch.c
parent23246d73bbd3188e2c0a45408b9bd29fd034ccaf (diff)
downloadotp-c4cdb1847e09d1153a6044d7a6aac05db4fad515.tar.gz
otp-c4cdb1847e09d1153a6044d7a6aac05db4fad515.tar.bz2
otp-c4cdb1847e09d1153a6044d7a6aac05db4fad515.zip
erts: Fix global tracing of beam function when called from hipe code
Make hipe to beam calls use export entry. Makes it a lot easier to handle global tracing correctly (breakpoints in export entry). A beam function should now be traced correctly regardless how it is called. This will also fix a SEGV crash when a hipe stub is made pointing into a traced export entry and tracing is then stopped which clears the export entry causing the hipe stub to execute beam instruction NULL. This commit assumes that hipe code never calls local beam functions, which should be the case nowadays as we only hipe compile entire modules.
Diffstat (limited to 'erts/emulator/hipe/hipe_mode_switch.c')
-rw-r--r--erts/emulator/hipe/hipe_mode_switch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/erts/emulator/hipe/hipe_mode_switch.c b/erts/emulator/hipe/hipe_mode_switch.c
index 7b9f2b5350..4dbba9da61 100644
--- a/erts/emulator/hipe/hipe_mode_switch.c
+++ b/erts/emulator/hipe/hipe_mode_switch.c
@@ -396,13 +396,13 @@ Process *hipe_mode_switch(Process *p, unsigned cmd, Eterm reg[])
if (is_recursive)
hipe_push_beam_trap_frame(p, reg, p->arity);
- result = HIPE_MODE_SWITCH_RES_CALL;
+ result = HIPE_MODE_SWITCH_RES_CALL_BEAM;
break;
}
- case HIPE_MODE_SWITCH_RES_CALL: {
+ case HIPE_MODE_SWITCH_RES_CALL_EXPORTED: {
/* Native code calls or tailcalls BEAM.
*
- * p->i is the callee's BEAM code
+ * p->hipe.u.callee_exp is the callee's export entry
* p->arity is the callee's arity
* p->def_arg_reg[] contains the register parameters
* p->hipe.nsp[] contains the stacked parameters
@@ -460,7 +460,7 @@ Process *hipe_mode_switch(Process *p, unsigned cmd, Eterm reg[])
p->i = closure->fe->address;
/* Change result code to the faster plain CALL type. */
- result = HIPE_MODE_SWITCH_RES_CALL;
+ result = HIPE_MODE_SWITCH_RES_CALL_BEAM;
}
/* Append the closure as the last parameter. Don't increment arity. */
reg[arity] = p->hipe.u.closure;
@@ -541,7 +541,7 @@ Process *hipe_mode_switch(Process *p, unsigned cmd, Eterm reg[])
}
}
HIPE_CHECK_PCB(p);
- result = HIPE_MODE_SWITCH_RES_CALL;
+ result = HIPE_MODE_SWITCH_RES_CALL_BEAM;
p->def_arg_reg[3] = result;
return p;
}