annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotJumpToExceptionHandlerInCallerOp.java @ 21596:47a3d4b3ccb3

AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 27 May 2015 16:26:10 +0200
parents 48c1ebd24120
children 5024c80224c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 13227
diff changeset
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.amd64;
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19526
diff changeset
25 import com.oracle.jvmci.code.Register;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19526
diff changeset
26 import com.oracle.jvmci.meta.AllocatableValue;
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 import static com.oracle.graal.amd64.AMD64.*;
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19526
diff changeset
28 import static com.oracle.jvmci.code.ValueUtil.*;
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 import com.oracle.graal.asm.amd64.*;
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
9856
fbeda9df497d implemented workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=409824
Doug Simon <doug.simon@oracle.com>
parents: 9566
diff changeset
33 import com.oracle.graal.lir.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 15104
diff changeset
34 import com.oracle.graal.lir.StandardOp.BlockEndOp;
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 import com.oracle.graal.lir.asm.*;
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 /**
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 * Sets up the arguments for an exception handler in the callers frame, removes the current frame
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39 * and jumps to the handler.
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40 */
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 @Opcode("JUMP_TO_EXCEPTION_HANDLER_IN_CALLER")
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 13227
diff changeset
42 final class AMD64HotSpotJumpToExceptionHandlerInCallerOp extends AMD64HotSpotEpilogueOp implements BlockEndOp {
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
43
19526
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 16841
diff changeset
44 public static final LIRInstructionClass<AMD64HotSpotJumpToExceptionHandlerInCallerOp> TYPE = LIRInstructionClass.create(AMD64HotSpotJumpToExceptionHandlerInCallerOp.class);
8fc336a04d77 Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 16841
diff changeset
45
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46 @Use(REG) AllocatableValue handlerInCallerPc;
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47 @Use(REG) AllocatableValue exception;
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48 @Use(REG) AllocatableValue exceptionPc;
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
49 private final Register thread;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
50 private final int isMethodHandleReturnOffset;
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51
21596
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
52 AMD64HotSpotJumpToExceptionHandlerInCallerOp(AllocatableValue handlerInCallerPc, AllocatableValue exception, AllocatableValue exceptionPc, int isMethodHandleReturnOffset, Register thread,
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
53 AllocatableValue savedRbp) {
47a3d4b3ccb3 AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents: 21556
diff changeset
54 super(TYPE, savedRbp);
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
55 this.handlerInCallerPc = handlerInCallerPc;
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
56 this.exception = exception;
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
57 this.exceptionPc = exceptionPc;
12456
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
58 this.isMethodHandleReturnOffset = isMethodHandleReturnOffset;
f87c68d79f07 improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
59 this.thread = thread;
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
60 }
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
62 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
63 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
64 leaveFrameAndRestoreRbp(crb, masm);
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
65
9566
7207028ce060 ensure frame is fully restored when unwinding to exception handler in caller's frame
Doug Simon <doug.simon@oracle.com>
parents: 9562
diff changeset
66 // Discard the return address, thus completing restoration of caller frame
7207028ce060 ensure frame is fully restored when unwinding to exception handler in caller's frame
Doug Simon <doug.simon@oracle.com>
parents: 9562
diff changeset
67 masm.incrementq(rsp, 8);
7207028ce060 ensure frame is fully restored when unwinding to exception handler in caller's frame
Doug Simon <doug.simon@oracle.com>
parents: 9562
diff changeset
68
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
69 // Restore rsp from rbp if the exception PC is a method handle call site.
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
70 AMD64Address dst = new AMD64Address(thread, isMethodHandleReturnOffset);
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
71 masm.cmpl(dst, 0);
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
72 masm.cmovq(ConditionFlag.NotEqual, rsp, rbp);
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
73
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
74 masm.jmp(asRegister(handlerInCallerPc));
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
75 }
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
76 }