Skip to content

Commit b1de378

Browse files
committed
erts: Fix 8815c05 for emu and non-native stack
1 parent 8815c05 commit b1de378

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
@@ -545,7 +545,7 @@ void process_main(ErtsSchedulerData *esdp)
545545
Goto(*I);
546546
}
547547

548-
I = handle_error(c_p, I, reg, mfa);
548+
I = handle_error(c_p, cp_val(*E), reg, mfa);
549549
goto post_error_handling;
550550
}
551551
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
@@ -208,6 +208,14 @@ void BeamGlobalAssembler::emit_export_trampoline() {
208208

209209
a.bind(error_handler);
210210
{
211+
Label error;
212+
213+
#ifdef NATIVE_ERLANG_STACK
214+
error = labels[raise_exception];
215+
#else
216+
error = a.newLabel();
217+
#endif
218+
211219
a.lea(ARG2, x86::qword_ptr(RET, offsetof(Export, info.mfa)));
212220
a.mov(TMP_MEM1q, ARG2);
213221

@@ -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)