summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/jit/x86/beam_asm_global.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam/jit/x86/beam_asm_global.cpp')
-rw-r--r--erts/emulator/beam/jit/x86/beam_asm_global.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/erts/emulator/beam/jit/x86/beam_asm_global.cpp b/erts/emulator/beam/jit/x86/beam_asm_global.cpp
index a65b254bea..a9a1da7621 100644
--- a/erts/emulator/beam/jit/x86/beam_asm_global.cpp
+++ b/erts/emulator/beam/jit/x86/beam_asm_global.cpp
@@ -120,6 +120,8 @@ void BeamGlobalAssembler::emit_handle_error() {
/* ARG3 = (HTOP + bytes needed) !!
* ARG4 = Live registers */
void BeamGlobalAssembler::emit_garbage_collect() {
+ Label exiting = a.newLabel();
+
/* Convert ARG3 to words needed and move it to the correct argument slot */
a.sub(ARG3, HTOP);
a.shr(ARG3, imm(3));
@@ -140,7 +142,19 @@ void BeamGlobalAssembler::emit_garbage_collect() {
emit_leave_runtime<Update::eStack | Update::eHeap>();
+#ifdef WIN32
+ a.mov(ARG1d, x86::dword_ptr(c_p, offsetof(Process, state.value)));
+#else
+ a.mov(ARG1d, x86::dword_ptr(c_p, offsetof(Process, state.counter)));
+#endif
+ a.test(ARG1d, imm(ERTS_PSFLG_EXITING));
+ a.short_().jne(exiting);
+
a.ret();
+
+ a.bind(exiting);
+ emit_discard_cp();
+ a.jmp(labels[do_schedule]);
}
/* Handles trapping to exports from C code, setting registers up in the same