Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEpilogueOp.java @ 21556:48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 27 May 2015 00:36:16 +0200 |
parents | 8fc336a04d77 |
children | 47a3d4b3ccb3 |
rev | line source |
---|---|
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:
diff
changeset
|
1 /* |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
15104
diff
changeset
|
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
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:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
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:
diff
changeset
|
4 * |
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:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
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:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
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:
diff
changeset
|
7 * published by the Free Software Foundation. |
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:
diff
changeset
|
8 * |
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:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
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:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
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:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
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:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
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:
diff
changeset
|
13 * accompanied this code). |
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:
diff
changeset
|
14 * |
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:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
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:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
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:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
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:
diff
changeset
|
18 * |
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:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
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:
diff
changeset
|
21 * questions. |
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:
diff
changeset
|
22 */ |
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:
diff
changeset
|
23 package com.oracle.graal.hotspot.amd64; |
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:
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:
19529
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:
19529
diff
changeset
|
26 import com.oracle.jvmci.meta.LIRKind; |
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:
19529
diff
changeset
|
27 import com.oracle.jvmci.meta.AllocatableValue; |
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:
19529
diff
changeset
|
28 import com.oracle.jvmci.meta.Kind; |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
29 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:
19529
diff
changeset
|
30 import static com.oracle.jvmci.code.ValueUtil.*; |
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:
diff
changeset
|
31 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; |
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:
diff
changeset
|
32 |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
33 import com.oracle.graal.asm.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:
diff
changeset
|
34 import com.oracle.graal.lir.*; |
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:
diff
changeset
|
35 import com.oracle.graal.lir.amd64.*; |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
36 import com.oracle.graal.lir.asm.*; |
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:
diff
changeset
|
37 |
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:
diff
changeset
|
38 /** |
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:
diff
changeset
|
39 * Superclass for operations that use the value of RBP saved in a method's prologue. |
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:
diff
changeset
|
40 */ |
15104 | 41 abstract class AMD64HotSpotEpilogueOp extends AMD64LIRInstruction { |
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:
diff
changeset
|
42 |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16094
diff
changeset
|
43 protected AMD64HotSpotEpilogueOp(LIRInstructionClass<? extends AMD64HotSpotEpilogueOp> c) { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16094
diff
changeset
|
44 super(c); |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16094
diff
changeset
|
45 } |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16094
diff
changeset
|
46 |
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:
diff
changeset
|
47 /** |
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:
diff
changeset
|
48 * The type of location (i.e., stack or register) in which RBP is saved is not known until |
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:
diff
changeset
|
49 * initial LIR generation is finished. Until then, we use a placeholder variable so that LIR |
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:
diff
changeset
|
50 * verification is successful. |
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:
diff
changeset
|
51 */ |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
15104
diff
changeset
|
52 private static final Variable PLACEHOLDER = new Variable(LIRKind.value(Kind.Long), Integer.MAX_VALUE); |
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:
diff
changeset
|
53 |
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:
diff
changeset
|
54 @Use({REG, STACK}) protected AllocatableValue savedRbp = PLACEHOLDER; |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
55 |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
9791
diff
changeset
|
56 protected void leaveFrameAndRestoreRbp(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
57 if (isStackSlot(savedRbp)) { |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
58 // Restoring RBP from the stack must be done before the frame is removed |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
9791
diff
changeset
|
59 masm.movq(rbp, (AMD64Address) crb.asAddress(savedRbp)); |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
60 } else { |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
61 Register framePointer = asRegister(savedRbp); |
9791
e92fdf3e1558
Register: replace usages of object identity with equals()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9560
diff
changeset
|
62 if (!framePointer.equals(rbp)) { |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
63 masm.movq(rbp, framePointer); |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
64 } |
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
65 } |
13234
7e237378923d
made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents:
13227
diff
changeset
|
66 crb.frameContext.leave(crb); |
9560
08d1414ac62d
refactored common code in subclasses into AMD64HotSpotEpilogueOp
Doug Simon <doug.simon@oracle.com>
parents:
9425
diff
changeset
|
67 } |
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:
diff
changeset
|
68 } |