From 1c36f036f604048320fc4393eb3e16d81575bbee Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 20 Jun 2019 10:53:12 +0200 Subject: [PATCH] push/pop of link register does not affect stack size on x86 * lightening/x86-cpu.c (pop_link_register, push_link_register): Don't record stack size changes here. --- lightening/x86-cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lightening/x86-cpu.c b/lightening/x86-cpu.c index d737f2625..7757dc054 100644 --- a/lightening/x86-cpu.c +++ b/lightening/x86-cpu.c @@ -2561,13 +2561,22 @@ jmpi_with_link(jit_state_t *_jit, jit_word_t i0) static void pop_link_register(jit_state_t *_jit) { + /* Treat this instruction as having no effect on the stack size; its + * effect is non-local (across functions) and handled manually. */ + + int saved_frame_size = _jit->frame_size; popr(_jit, jit_gpr_regno (JIT_LR)); + _jit->frame_size = saved_frame_size; } static void push_link_register(jit_state_t *_jit) { + /* See comment in pop_link_register. */ + + int saved_frame_size = _jit->frame_size; pushr(_jit, jit_gpr_regno (JIT_LR)); + _jit->frame_size = saved_frame_size; } static void