annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java @ 10853:22baf2a69f6d

Reuse linkage.
author twisti
date Mon, 22 Jul 2013 21:43:31 -0700
parents fbeda9df497d
children 886c2df7a7e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 /*
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
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
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.*;
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
26 import static com.oracle.graal.api.code.ValueUtil.*;
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9294
diff changeset
27 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
28 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
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.api.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
31 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
32 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
33 import com.oracle.graal.lir.*;
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.*;
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
36
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
37 /**
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9294
diff changeset
38 * 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
39 */
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
40 @Opcode("UNWIND")
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
41 final class AMD64HotSpotUnwindOp extends AMD64HotSpotEpilogueOp {
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
42
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9294
diff changeset
43 @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
44
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9294
diff changeset
45 AMD64HotSpotUnwindOp(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
46 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
47 }
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
48
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
49 @Override
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 public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9294
diff changeset
51 leaveFrameAndRestoreRbp(tasm, 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
52
9739
4cd4926ec683 rename: RuntimeCallTarget -> ForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9638
diff changeset
53 ForeignCallLinkage linkage = tasm.runtime.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER);
4cd4926ec683 rename: RuntimeCallTarget -> ForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9638
diff changeset
54 CallingConvention cc = linkage.getCallingConvention();
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9294
diff changeset
55 assert cc.getArgumentCount() == 2;
9638
c455c86138ba Value: more occurrences of object equality replaced
Bernhard Urban <bernhard.urban@jku.at>
parents: 9562
diff changeset
56 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
57
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9294
diff changeset
58 // 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
59 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
60 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
61
10853
22baf2a69f6d Reuse linkage.
twisti
parents: 9856
diff changeset
62 AMD64Call.directJmp(tasm, 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
63 }
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
64 }