From 17241c30f56ba6bc31518f1c905f6178784fb4fa Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 14 Oct 2011 19:23:26 +0200 Subject: erts-hipe: Fix new trap conventions for x86, amd64 and ppc --- erts/emulator/hipe/hipe_risc_glue.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'erts/emulator/hipe/hipe_risc_glue.h') diff --git a/erts/emulator/hipe/hipe_risc_glue.h b/erts/emulator/hipe/hipe_risc_glue.h index e74023e3e9..cc2671c016 100644 --- a/erts/emulator/hipe/hipe_risc_glue.h +++ b/erts/emulator/hipe/hipe_risc_glue.h @@ -199,6 +199,22 @@ hipe_call_from_native_is_recursive(Process *p, Eterm reg[]) return 0; } +/* BEAM called native, which called BIF that returned trap + * Discard bif parameters. + * If tailcall, also clean up native stub continuation. */ +static __inline__ int +hipe_trap_from_native_is_recursive(Process *p) +{ + if (p->hipe.narity > NR_ARG_REGS) { + p->hipe.nsp += (p->hipe.narity - NR_ARG_REGS); + } + if (p->hipe.nra != (void(*)(void))&nbif_return) + return 1; + hipe_pop_risc_nra_frame(p); + return 0; +} + + /* Native makes a call which needs to unload the parameters. This differs from hipe_call_from_native_is_recursive() in that it doesn't check for or pop the BEAM-calls-native frame. -- cgit v1.2.3