From fd97f8ebc7f22df7e3a7bf05c5d9328946cb539e Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Tue, 19 Jul 2022 11:45:46 -0400 Subject: Use frame_setup() and frame_teardown() --- yjit/src/codegen.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 17b5b09698..6d4ac72433 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -398,6 +398,8 @@ fn gen_code_for_exit_from_stub(ocb: &mut OutlinedCb) -> CodePtr { asm.cpop_into(EC); asm.cpop_into(CFP); + asm.frame_teardown(); + asm.cret(Qundef.into()); asm.compile(ocb); @@ -447,6 +449,8 @@ fn gen_exit(exit_pc: *mut VALUE, ctx: &Context, asm: &mut Assembler) { asm.cpop_into(EC); asm.cpop_into(CFP); + asm.frame_teardown(); + asm.cret(Qundef.into()); } @@ -531,6 +535,8 @@ fn gen_full_cfunc_return(ocb: &mut OutlinedCb) -> CodePtr { asm.cpop_into(EC); asm.cpop_into(CFP); + asm.frame_teardown(); + asm.cret(Qundef.into()); asm.compile(ocb); @@ -555,6 +561,8 @@ fn gen_leave_exit(ocb: &mut OutlinedCb) -> CodePtr { asm.cpop_into(EC); asm.cpop_into(CFP); + asm.frame_teardown(); + asm.cret(C_RET_OPND); asm.compile(ocb); @@ -584,6 +592,8 @@ fn gen_pc_guard(asm: &mut Assembler, iseq: IseqPtr, insn_idx: u32) { asm.cpop_into(EC); asm.cpop_into(CFP); + asm.frame_teardown(); + asm.cret(Qundef.into()); // PC should match the expected insn_idx @@ -611,20 +621,7 @@ pub fn gen_entry_prologue(cb: &mut CodeBlock, iseq: IseqPtr, insn_idx: u32) -> O let mut asm = Assembler::new(); - - - // FIXME: need to handle this properly - // Maybe add an asm.entry_prologue() insn that compiles to nothing on x86 - // stp x29, x30, [sp, -16]! - // mov x29, sp - - - // NOTE: we also need a matching asm.exit_epilogue() - // mov sp, x29 - // ldp x29, x30, [sp], 16 - - - + asm.frame_setup(); // Save the CFP, EC, SP registers to the C stack asm.cpush(CFP); -- cgit v1.2.3