Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java @ 21657:137068704691
Remove obsoleted TODOs.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Fri, 29 May 2015 15:44:36 +0200 |
parents | 47a3d4b3ccb3 |
children | 5024c80224c7 |
rev | line source |
---|---|
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
15104 | 2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.amd64; |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.amd64.AMD64.*; |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
26 import static com.oracle.graal.hotspot.HotSpotBackend.*; |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; |
21596
47a3d4b3ccb3
AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents:
21556
diff
changeset
|
28 import static com.oracle.jvmci.code.ValueUtil.*; |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.asm.amd64.*; |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
31 import com.oracle.graal.hotspot.stubs.*; |
9856
fbeda9df497d
implemented workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=409824
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
32 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
|
33 import com.oracle.graal.lir.StandardOp.BlockEndOp; |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.graal.lir.amd64.*; |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.lir.asm.*; |
21596
47a3d4b3ccb3
AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents:
21556
diff
changeset
|
36 import com.oracle.jvmci.code.*; |
47a3d4b3ccb3
AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents:
21556
diff
changeset
|
37 import com.oracle.jvmci.meta.*; |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 /** |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
40 * Removes the current frame and jumps to the {@link UnwindExceptionToCallerStub}. |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 */ |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8225
diff
changeset
|
42 @Opcode("UNWIND") |
15104 | 43 final class AMD64HotSpotUnwindOp extends AMD64HotSpotEpilogueOp implements BlockEndOp { |
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<AMD64HotSpotUnwindOp> TYPE = LIRInstructionClass.create(AMD64HotSpotUnwindOp.class); |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
46 @Use({REG}) protected RegisterValue exception; |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 |
21596
47a3d4b3ccb3
AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents:
21556
diff
changeset
|
48 AMD64HotSpotUnwindOp(RegisterValue exception, AllocatableValue savedRbp) { |
47a3d4b3ccb3
AMD64HotSpotEpilogueOp: set rbp rescue location on construction.
Josef Eisl <josef.eisl@jku.at>
parents:
21556
diff
changeset
|
49 super(TYPE, savedRbp); |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 this.exception = exception; |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 } |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
54 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
55 leaveFrameAndRestoreRbp(crb, masm); |
8290
9882af5c8504
AMD64 HotSpot backend now models RBP as an incoming parameter that must be preserved until the end of the method. For non-leaf methods, the value is preserved in the special stack slot required by the HotSpot runtime for walking/inspecting frames of such methods.
Doug Simon <doug.simon@oracle.com>
parents:
8225
diff
changeset
|
56 |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
57 ForeignCallLinkage linkage = crb.foreignCalls.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER); |
10870
886c2df7a7e4
Stubs need both an outgoing and incoming calling convention.
twisti
parents:
10853
diff
changeset
|
58 CallingConvention cc = linkage.getOutgoingCallingConvention(); |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
59 assert cc.getArgumentCount() == 2; |
9638
c455c86138ba
Value: more occurrences of object equality replaced
Bernhard Urban <bernhard.urban@jku.at>
parents:
9562
diff
changeset
|
60 assert exception.equals(cc.getArgument(0)); |
9562
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
61 |
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
62 // Get return address (is on top of stack after leave). |
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
63 Register returnAddress = asRegister(cc.getArgument(1)); |
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
64 masm.movq(returnAddress, new AMD64Address(rsp, 0)); |
99ef9bcb3f32
replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9294
diff
changeset
|
65 |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
66 AMD64Call.directJmp(crb, masm, linkage); |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 } |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 } |