diff --git a/erts/emulator/beam/jit/arm/beam_asm.hpp b/erts/emulator/beam/jit/arm/beam_asm.hpp index 03d811d44053..68d93c1d9ddb 100644 --- a/erts/emulator/beam/jit/arm/beam_asm.hpp +++ b/erts/emulator/beam/jit/arm/beam_asm.hpp @@ -461,10 +461,24 @@ struct BeamAssembler : public BeamAssemblerCommon { /* Store HTOP and E in one go. */ ERTS_CT_ASSERT_FIELD_PAIR(Process, htop, stop); a.stp(HTOP, E, arm::Mem(c_p, offsetof(Process, htop))); - } else if (Spec & Update::eStack) { - a.str(E, arm::Mem(c_p, offsetof(Process, stop))); - } else if (Spec & Update::eHeap) { - a.str(HTOP, arm::Mem(c_p, offsetof(Process, htop))); + } else { + if (Spec & Update::eStack) { + a.str(E, arm::Mem(c_p, offsetof(Process, stop))); + } else { +#ifdef DEBUG + /* Store some garbage in the process structure to catch missing + * updates. */ + a.str(active_code_ix, arm::Mem(c_p, offsetof(Process, stop))); +#endif + } + + if (Spec & Update::eHeap) { + a.str(HTOP, arm::Mem(c_p, offsetof(Process, htop))); + } else { +#ifdef DEBUG + a.str(active_code_ix, arm::Mem(c_p, offsetof(Process, htop))); +#endif + } } if (Spec & Update::eReductions) { diff --git a/erts/emulator/beam/jit/arm/beam_asm_global.cpp b/erts/emulator/beam/jit/arm/beam_asm_global.cpp index 6347aac1a7fc..5fdd8bbea62a 100644 --- a/erts/emulator/beam/jit/arm/beam_asm_global.cpp +++ b/erts/emulator/beam/jit/arm/beam_asm_global.cpp @@ -255,7 +255,7 @@ void BeamModuleAssembler::emit_raise_exception(Label I, } void BeamGlobalAssembler::emit_process_exit() { - emit_enter_runtime(); + emit_enter_runtime(); a.mov(ARG1, c_p); mov_imm(ARG2, 0); @@ -263,7 +263,7 @@ void BeamGlobalAssembler::emit_process_exit() { load_x_reg_array(ARG3); runtime_call<4>(handle_error); - emit_leave_runtime(); + emit_leave_runtime(); a.cbz(ARG1, labels[do_schedule]); a.udf(0xdead); diff --git a/erts/emulator/beam/jit/x86/beam_asm.hpp b/erts/emulator/beam/jit/x86/beam_asm.hpp index ff955cfe2645..4a2c965b2196 100644 --- a/erts/emulator/beam/jit/x86/beam_asm.hpp +++ b/erts/emulator/beam/jit/x86/beam_asm.hpp @@ -652,10 +652,26 @@ struct BeamAssembler : public BeamAssemblerCommon { a.movups(x86::xmmword_ptr(c_p, offsetof(Process, htop)), x86::xmm0); } - } else if (Spec & Update::eHeap) { - a.mov(x86::qword_ptr(c_p, offsetof(Process, htop)), HTOP); - } else if (Spec & Update::eStack) { - a.mov(x86::qword_ptr(c_p, offsetof(Process, stop)), E); + } else { + if (Spec & Update::eHeap) { + a.mov(x86::qword_ptr(c_p, offsetof(Process, htop)), HTOP); + } else { +#ifdef DEBUG + /* Store some garbage in the process structure to catch + * missing updates. */ + a.mov(x86::qword_ptr(c_p, offsetof(Process, htop)), + active_code_ix); +#endif + } + + if (Spec & Update::eStack) { + a.mov(x86::qword_ptr(c_p, offsetof(Process, stop)), E); + } else { +#ifdef DEBUG + a.mov(x86::qword_ptr(c_p, offsetof(Process, stop)), + active_code_ix); +#endif + } } #ifdef NATIVE_ERLANG_STACK diff --git a/erts/emulator/beam/jit/x86/beam_asm_global.cpp b/erts/emulator/beam/jit/x86/beam_asm_global.cpp index d25c4584b50d..5586166fde1c 100644 --- a/erts/emulator/beam/jit/x86/beam_asm_global.cpp +++ b/erts/emulator/beam/jit/x86/beam_asm_global.cpp @@ -275,7 +275,7 @@ void BeamModuleAssembler::emit_raise_exception(x86::Gp I, } void BeamGlobalAssembler::emit_process_exit() { - emit_enter_runtime(); + emit_enter_runtime(); a.mov(ARG1, c_p); mov_imm(ARG2, 0); @@ -283,7 +283,7 @@ void BeamGlobalAssembler::emit_process_exit() { load_x_reg_array(ARG3); runtime_call<4>(handle_error); - emit_leave_runtime(); + emit_leave_runtime(); a.test(RET, RET); a.je(labels[do_schedule]); diff --git a/erts/emulator/test/long_timers_test.erl b/erts/emulator/test/long_timers_test.erl index de1a6e6d322f..899818fe2a6a 100644 --- a/erts/emulator/test/long_timers_test.erl +++ b/erts/emulator/test/long_timers_test.erl @@ -462,7 +462,7 @@ start_node(Name) -> stop_node(Node) -> monitor_node(Node, true), - spawn(Node, fun () -> halt() end), + spawn(Node, fun erlang:halt/0), receive {nodedown, Node} -> ok end. load_driver(Dir, Driver) ->