aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2014-01-28 15:53:03 +0100
committerRickard Green <[email protected]>2014-01-28 15:53:03 +0100
commit3c112fbde20a21db0cafc140aa72346f60315b90 (patch)
tree9355dc94fae68ce2b1d9d08ca0a23484c8c59dfe /erts/emulator/beam/beam_emu.c
parentf65764907faba7ea6ca1a6bb266b6c6612e06b7b (diff)
parentc1c03ae4ee50e58b7669ea88ec4d29c6b2b67c7b (diff)
downloadotp-3c112fbde20a21db0cafc140aa72346f60315b90.tar.gz
otp-3c112fbde20a21db0cafc140aa72346f60315b90.tar.bz2
otp-3c112fbde20a21db0cafc140aa72346f60315b90.zip
Merge branch 'vinoski/ds'
* vinoski/ds: initial support for dirty schedulers and dirty NIFs
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r--erts/emulator/beam/beam_emu.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index b413f0e859..7fecdd5c5f 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -217,6 +217,7 @@ BeamInstr beam_continue_exit[1];
BeamInstr* em_call_error_handler;
BeamInstr* em_apply_bif;
+BeamInstr* em_call_nif;
/* NOTE These should be the only variables containing trace instructions.
@@ -3323,6 +3324,13 @@ void process_main(void)
reg[0] = r(0);
nif_bif_result = (*fp)(&env, bif_nif_arity, reg);
erts_post_nif(&env);
+#ifdef ERTS_DIRTY_SCHEDULERS
+ if (is_non_value(nif_bif_result) && c_p->freason == TRAP) {
+ Export* ep = (Export*) c_p->psd->data[ERTS_PSD_DIRTY_SCHED_TRAP_EXPORT];
+ ep->code[0] = I[-3];
+ ep->code[1] = I[-2];
+ }
+#endif
}
ASSERT(!ERTS_PROC_IS_EXITING(c_p) || is_non_value(nif_bif_result));
PROCESS_MAIN_CHK_LOCKS(c_p);
@@ -4964,6 +4972,7 @@ void process_main(void)
em_call_error_handler = OpCode(call_error_handler);
em_apply_bif = OpCode(apply_bif);
+ em_call_nif = OpCode(call_nif);
beam_apply[0] = (BeamInstr) OpCode(i_apply);
beam_apply[1] = (BeamInstr) OpCode(normal_exit);