Skip to content

Commit d6c3173

Browse files
committed
Merge branch 'john/erts/fix-call_error_handler-crash/OTP-19577/ERIERL-1220' into john/erts/fix-call_error_handler-crash-26/OTP-19577/ERIERL-1220
* john/erts/fix-call_error_handler-crash/OTP-19577/ERIERL-1220: erts: Fix 8815c05 for emu and non-native stack
2 parents 2a38cd6 + b1de378 commit d6c3173

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

erts/emulator/beam/emu/beam_emu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ void process_main(ErtsSchedulerData *esdp)
547547
Goto(*I);
548548
}
549549

550-
I = handle_error(c_p, I, reg, mfa);
550+
I = handle_error(c_p, cp_val(*E), reg, mfa);
551551
goto post_error_handling;
552552
}
553553
OpCase(error_action_code): {

erts/emulator/beam/jit/x86/beam_asm_global.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ void BeamGlobalAssembler::emit_export_trampoline() {
210210

211211
a.bind(error_handler);
212212
{
213+
Label error;
214+
215+
#ifdef NATIVE_ERLANG_STACK
216+
error = labels[raise_exception];
217+
#else
218+
error = a.newLabel();
219+
#endif
220+
213221
a.lea(ARG2, x86::qword_ptr(RET, offsetof(Export, info.mfa)));
214222
a.mov(TMP_MEM1q, ARG2);
215223

@@ -227,8 +235,17 @@ void BeamGlobalAssembler::emit_export_trampoline() {
227235

228236
a.mov(ARG4, TMP_MEM1q);
229237
a.test(RET, RET);
230-
a.je(labels[raise_exception]);
238+
a.je(error);
231239
a.jmp(emit_setup_dispatchable_call(RET));
240+
241+
#ifndef NATIVE_ERLANG_STACK
242+
a.bind(error);
243+
{
244+
a.push(getCPRef());
245+
a.mov(getCPRef(), imm(NIL));
246+
a.jmp(labels[raise_exception]);
247+
}
248+
#endif
232249
}
233250
}
234251

0 commit comments

Comments
 (0)