51 @Use(REG) private AllocatableValue handlerInCallerPc; 52 @Use(REG) private AllocatableValue exception; 53 @Use(REG) private AllocatableValue exceptionPc; 54 private final Register thread; 55 private final int isMethodHandleReturnOffset; 56 57 public AArch64HotSpotJumpToExceptionHandlerInCallerOp(AllocatableValue handlerInCallerPc, AllocatableValue exception, AllocatableValue exceptionPc, int isMethodHandleReturnOffset, 58 Register thread, GraalHotSpotVMConfig config) { 59 super(TYPE, config); 60 this.handlerInCallerPc = handlerInCallerPc; 61 this.exception = exception; 62 this.exceptionPc = exceptionPc; 63 this.isMethodHandleReturnOffset = isMethodHandleReturnOffset; 64 this.thread = thread; 65 } 66 67 @Override 68 public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) { 69 leaveFrame(crb, masm, /* emitSafepoint */false); 70 71 // Restore sp from fp if the exception PC is a method handle call site. 72 try (ScratchRegister sc = masm.getScratchRegister()) { 73 Register scratch = sc.getRegister(); 74 AArch64Address address = masm.makeAddress(thread, isMethodHandleReturnOffset, scratch, 4, /* allowOverwrite */false); 75 masm.ldr(32, scratch, address); 76 Label noRestore = new Label(); 77 masm.cbz(32, scratch, noRestore); 78 masm.mov(64, sp, fp); 79 masm.bind(noRestore); 80 } 81 masm.jmp(asRegister(handlerInCallerPc)); 82 } 83 } | 51 @Use(REG) private AllocatableValue handlerInCallerPc; 52 @Use(REG) private AllocatableValue exception; 53 @Use(REG) private AllocatableValue exceptionPc; 54 private final Register thread; 55 private final int isMethodHandleReturnOffset; 56 57 public AArch64HotSpotJumpToExceptionHandlerInCallerOp(AllocatableValue handlerInCallerPc, AllocatableValue exception, AllocatableValue exceptionPc, int isMethodHandleReturnOffset, 58 Register thread, GraalHotSpotVMConfig config) { 59 super(TYPE, config); 60 this.handlerInCallerPc = handlerInCallerPc; 61 this.exception = exception; 62 this.exceptionPc = exceptionPc; 63 this.isMethodHandleReturnOffset = isMethodHandleReturnOffset; 64 this.thread = thread; 65 } 66 67 @Override 68 public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) { 69 leaveFrame(crb, masm, /* emitSafepoint */false); 70 71 if (System.getProperty("java.specification.version").compareTo("1.8") < 0) { 72 // Restore sp from fp if the exception PC is a method handle call site. 73 try (ScratchRegister sc = masm.getScratchRegister()) { 74 Register scratch = sc.getRegister(); 75 AArch64Address address = masm.makeAddress(thread, isMethodHandleReturnOffset, scratch, 4, /* allowOverwrite */false); 76 masm.ldr(32, scratch, address); 77 Label noRestore = new Label(); 78 masm.cbz(32, scratch, noRestore); 79 masm.mov(64, sp, fp); 80 masm.bind(noRestore); 81 } 82 } 83 84 masm.jmp(asRegister(handlerInCallerPc)); 85 } 86 } |