annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java @ 9491:789cfd153265

a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub. the ExceptionHandler stub no longer preserves registers
author Doug Simon <doug.simon@oracle.com>
date Thu, 02 May 2013 06:08:02 +0200
parents 5fa54bf57f8c
children d48b7a4b93e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.amd64;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 import static com.oracle.graal.amd64.AMD64.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 import static com.oracle.graal.api.code.CallingConvention.Type.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 import static com.oracle.graal.api.code.ValueUtil.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28 import static com.oracle.graal.hotspot.amd64.AMD64HotSpotUnwindOp.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29
9307
1e1d619487b9 Additional assertions to guard against calls to abstract methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9247
diff changeset
30 import java.lang.reflect.*;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 import java.util.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33 import com.oracle.graal.amd64.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34 import com.oracle.graal.api.code.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 import com.oracle.graal.api.meta.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 import com.oracle.graal.asm.*;
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8641
diff changeset
37 import com.oracle.graal.asm.amd64.AMD64Address.Scale;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 import com.oracle.graal.compiler.amd64.*;
8586
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
39 import com.oracle.graal.compiler.gen.*;
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
40 import com.oracle.graal.graph.*;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 import com.oracle.graal.hotspot.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 import com.oracle.graal.hotspot.meta.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
43 import com.oracle.graal.hotspot.nodes.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44 import com.oracle.graal.hotspot.stubs.*;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45 import com.oracle.graal.lir.*;
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8641
diff changeset
46 import com.oracle.graal.lir.StandardOp.ParametersOp;
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
47 import com.oracle.graal.lir.StandardOp.PlaceholderOp;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48 import com.oracle.graal.lir.amd64.*;
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8641
diff changeset
49 import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp;
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8641
diff changeset
50 import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51 import com.oracle.graal.nodes.*;
8643
3d2c2b68fe93 lower ExceptionObjectNode with a snippet (GRAAL-133)
Doug Simon <doug.simon@oracle.com>
parents: 8641
diff changeset
52 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54 /**
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
55 * LIR generator specialized for AMD64 HotSpot.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
56 */
9431
c0488f573091 Make AMD64 LIR generator extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
57 public class AMD64HotSpotLIRGenerator extends AMD64LIRGenerator implements HotSpotLIRGenerator {
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
59 private HotSpotRuntime runtime() {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
60 return (HotSpotRuntime) runtime;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
62
9431
c0488f573091 Make AMD64 LIR generator extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 9425
diff changeset
63 protected AMD64HotSpotLIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
64 super(graph, runtime, target, frameMap, method, lir);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
65 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
66
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
67 /**
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
68 * The slot reserved for storing the original return address when a frame is marked for
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
69 * deoptimization. The return address slot in the callee is overwritten with the address of a
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
70 * deoptimization stub.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
71 */
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
72 StackSlot deoptimizationRescueSlot;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
73
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
74 /**
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
75 * Utility for emitting the instruction to save RBP.
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
76 */
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
77 class SaveRbp {
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
78
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
79 final PlaceholderOp placeholder;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
80
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
81 /**
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
82 * The slot reserved for saving RBP.
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
83 */
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
84 final StackSlot reservedSlot;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
85
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
86 public SaveRbp(PlaceholderOp placeholder) {
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
87 this.placeholder = placeholder;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
88 this.reservedSlot = frameMap.allocateSpillSlot(Kind.Long);
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
89 assert reservedSlot.getRawOffset() == -16 : reservedSlot.getRawOffset();
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
90 }
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
91
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
92 /**
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
93 * Replaces this operation with the appropriate move for saving rbp.
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
94 *
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
95 * @param useStack specifies if rbp must be saved to the stack
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
96 */
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
97 public AllocatableValue finalize(boolean useStack) {
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
98 AllocatableValue dst;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
99 if (useStack) {
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
100 dst = reservedSlot;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
101 } else {
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
102 frameMap.freeSpillSlot(reservedSlot);
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
103 dst = newVariable(Kind.Long);
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
104 }
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
105
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
106 placeholder.replace(lir, new MoveFromRegOp(dst, rbp.asValue(Kind.Long)));
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
107 return dst;
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
108 }
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
109 }
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
110
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
111 private SaveRbp saveRbp;
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
112
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
113 /**
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
114 * List of epilogue operations that need to restore RBP.
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
115 */
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
116 List<AMD64HotSpotEpilogueOp> epilogueOps = new ArrayList<>(2);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
117
8586
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
118 @SuppressWarnings("hiding")
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
119 @Override
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
120 protected DebugInfoBuilder createDebugInfoBuilder(NodeMap<Value> nodeOperands) {
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
121 assert runtime().config.basicLockSize == 8;
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
122 HotSpotLockStack lockStack = new HotSpotLockStack(frameMap, Kind.Long);
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
123 return new HotSpotDebugInfoBuilder(nodeOperands, lockStack);
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
124 }
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
125
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
126 @Override
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
127 public StackSlot getLockSlot(int lockDepth) {
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
128 return ((HotSpotDebugInfoBuilder) debugInfoBuilder).lockStack().makeLockSlot(lockDepth);
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
129 }
82f6a25321b8 modeling of lock state removed from LIR and runtime specific debug info for locks moved into runtime specific classes
Doug Simon <doug.simon@oracle.com>
parents: 8367
diff changeset
130
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
131 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
132 protected void emitPrologue() {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
133
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
134 CallingConvention incomingArguments = createCallingConvention();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
135
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
136 RegisterValue rbpParam = rbp.asValue(Kind.Long);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
137 Value[] params = new Value[incomingArguments.getArgumentCount() + 1];
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
138 for (int i = 0; i < params.length - 1; i++) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
139 params[i] = toStackKind(incomingArguments.getArgument(i));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
140 if (isStackSlot(params[i])) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
141 StackSlot slot = ValueUtil.asStackSlot(params[i]);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
142 if (slot.isInCallerFrame() && !lir.hasArgInCallerFrame()) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
143 lir.setHasArgInCallerFrame();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
144 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
145 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
147 params[params.length - 1] = rbpParam;
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
148 ParametersOp paramsOp = new ParametersOp(params);
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
149
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
150 append(paramsOp);
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
151
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
152 saveRbp = new SaveRbp(new PlaceholderOp(currentBlock, lir.lir(currentBlock).size()));
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
153 append(saveRbp.placeholder);
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
155 for (LocalNode local : graph.getNodes(LocalNode.class)) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
156 Value param = params[local.index()];
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
157 assert param.getKind() == local.kind().getStackKind();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
158 setResult(local, emitMove(param));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
159 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
160 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
161
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
162 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
163 protected void emitReturn(Value input) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
164 AMD64HotSpotReturnOp op = new AMD64HotSpotReturnOp(input);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
165 epilogueOps.add(op);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
166 append(op);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
167 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
168
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
169 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
170 protected boolean needOnlyOopMaps() {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
171 // Stubs only need oop maps
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
172 return runtime().asStub(method) != null;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
173 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
174
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
175 /**
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
176 * Map from debug infos that need to be updated with callee save information to the operations
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
177 * that provide the information.
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
178 */
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
179 Map<LIRFrameState, AMD64RegistersPreservationOp> calleeSaveInfo = new HashMap<>();
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
180
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
181 private LIRFrameState currentRuntimeCallInfo;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
182
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
183 @Override
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
184 protected void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, LIRFrameState info) {
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
185 currentRuntimeCallInfo = info;
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
186 super.emitCall(callTarget, result, arguments, temps, info);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
187 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
188
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
189 @Override
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
190 public Variable emitCall(RuntimeCallTarget callTarget, CallingConvention cc, DeoptimizingNode info, Value... args) {
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
191 Stub stub = runtime().asStub(method);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
192 boolean isCRuntimeCall = ((HotSpotRuntimeCallTarget) callTarget).isCRuntimeCall();
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
193 assert !isCRuntimeCall || stub != null : "direct call to C runtime can only be made from compiled stubs, not from " + method;
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
194
9415
016523a011b7 simplified register preservation in compiled stubs to avoid the need for using ParametersOp
Doug Simon <doug.simon@oracle.com>
parents: 9352
diff changeset
195 AMD64SaveRegistersOp save = null;
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
196 StackSlot[] savedRegisterLocations = null;
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
197 if (isCRuntimeCall) {
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
198 if (stub.preservesRegisters()) {
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
199 Register[] savedRegisters = frameMap.registerConfig.getAllocatableRegisters();
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
200 savedRegisterLocations = new StackSlot[savedRegisters.length];
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
201 AMD64LIRInstruction[] savingMoves = new AMD64LIRInstruction[savedRegisters.length];
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
202 AMD64LIRInstruction[] restoringMoves = new AMD64LIRInstruction[savedRegisters.length];
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
203 for (int i = 0; i < savedRegisters.length; i++) {
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
204 PlatformKind kind = target.arch.getLargestStorableKind(savedRegisters[i].getRegisterCategory());
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
205 assert kind != Kind.Illegal;
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
206 StackSlot spillSlot = frameMap.allocateSpillSlot(kind);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
207 savedRegisterLocations[i] = spillSlot;
9433
45a73cd19baa Use the correct move instruction for register saving and restoring.
Roland Schatz <roland.schatz@oracle.com>
parents: 9431
diff changeset
208
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
209 RegisterValue register = savedRegisters[i].asValue(kind);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
210 savingMoves[i] = createMove(spillSlot, register);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
211 restoringMoves[i] = createMove(register, spillSlot);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
212 }
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
213 save = new AMD64SaveRegistersOp(savingMoves, restoringMoves, savedRegisterLocations);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
214 append(save);
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
215 }
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9433
diff changeset
216 append(new AMD64HotSpotCRuntimeCallPrologueOp());
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
217 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
218
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
219 Variable result = super.emitCall(callTarget, cc, info, args);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
220
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
221 if (isCRuntimeCall) {
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
222 append(new AMD64HotSpotCRuntimeCallEpilogueOp());
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
223 if (stub.preservesRegisters()) {
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
224 assert !calleeSaveInfo.containsKey(currentRuntimeCallInfo);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
225 calleeSaveInfo.put(currentRuntimeCallInfo, save);
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
226
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
227 append(new AMD64RestoreRegistersOp(savedRegisterLocations.clone(), save));
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
228 } else {
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
229 assert zapRegisters();
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
230 }
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
231 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
232
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
233 return result;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
234 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
235
9491
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
236 protected boolean zapRegisters() {
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
237 Register[] zappedRegisters = frameMap.registerConfig.getAllocatableRegisters();
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
238 AMD64LIRInstruction[] zappingMoves = new AMD64LIRInstruction[zappedRegisters.length];
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
239 for (int i = 0; i < zappedRegisters.length; i++) {
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
240 PlatformKind kind = target.arch.getLargestStorableKind(zappedRegisters[i].getRegisterCategory());
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
241 assert kind != Kind.Illegal;
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
242
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
243 RegisterValue register = zappedRegisters[i].asValue(kind);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
244 zappingMoves[i] = createMove(register, zapValueForKind(kind));
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
245 }
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
246 AMD64ZapRegistersOp zap = new AMD64ZapRegistersOp(zappingMoves);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
247 append(zap);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
248 calleeSaveInfo.put(currentRuntimeCallInfo, zap);
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
249 return true;
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
250 }
789cfd153265 a compiled stub can now specify whether it needs to preserve registers. If a stub does not preserve registers and assertions are enabled, then all non-temporary registers are zapped after a C runtime call from the stub.
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
251
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
252 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
253 protected CallingConvention createCallingConvention() {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
254 Stub stub = runtime().asStub(method);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
255 if (stub != null) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
256 return stub.getLinkage().getCallingConvention();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
257 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
258
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
259 if (graph.getEntryBCI() == StructuredGraph.INVOCATION_ENTRY_BCI) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
260 return super.createCallingConvention();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
261 } else {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
262 return frameMap.registerConfig.getCallingConvention(JavaCallee, method.getSignature().getReturnType(null), new JavaType[]{runtime.lookupJavaType(long.class)}, target, false);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
263 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
264 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
265
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
266 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
267 public void visitSafepointNode(SafepointNode i) {
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8643
diff changeset
268 LIRFrameState info = state(i);
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
269 append(new AMD64SafepointOp(info, runtime().config, this));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
270 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
271
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
272 @SuppressWarnings("hiding")
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
273 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
274 public void visitDirectCompareAndSwap(DirectCompareAndSwapNode x) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
275 Kind kind = x.newValue().kind();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
276 assert kind == x.expectedValue().kind();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
277
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
278 Value expected = loadNonConst(operand(x.expectedValue()));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
279 Variable newVal = load(operand(x.newValue()));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
280
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
281 int disp = 0;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
282 AMD64AddressValue address;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
283 Value index = operand(x.offset());
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
284 if (ValueUtil.isConstant(index) && NumUtil.isInt(ValueUtil.asConstant(index).asLong() + disp)) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
285 assert !runtime.needsDataPatch(asConstant(index));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
286 disp += (int) ValueUtil.asConstant(index).asLong();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
287 address = new AMD64AddressValue(kind, load(operand(x.object())), disp);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
288 } else {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
289 address = new AMD64AddressValue(kind, load(operand(x.object())), load(index), Scale.Times1, disp);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
290 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
291
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
292 RegisterValue rax = AMD64.rax.asValue(kind);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
293 emitMove(rax, expected);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
294 append(new CompareAndSwapOp(rax, address, rax, newVal));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
295
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
296 Variable result = newVariable(x.kind());
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
297 emitMove(result, rax);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
298 setResult(x, result);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
299 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
300
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
301 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
302 public void emitTailcall(Value[] args, Value address) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
303 append(new AMD64TailcallOp(args, address));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
304 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
305
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
306 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
307 protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
308 InvokeKind invokeKind = ((HotSpotDirectCallTargetNode) callTarget).invokeKind();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
309 if (invokeKind == InvokeKind.Interface || invokeKind == InvokeKind.Virtual) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
310 append(new AMD64HotspotDirectVirtualCallOp(callTarget.target(), result, parameters, temps, callState, invokeKind));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
311 } else {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
312 assert invokeKind == InvokeKind.Static || invokeKind == InvokeKind.Special;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
313 HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) callTarget.target();
9307
1e1d619487b9 Additional assertions to guard against calls to abstract methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9247
diff changeset
314 assert !Modifier.isAbstract(resolvedMethod.getModifiers()) : "Cannot make direct call to abstract method.";
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
315 Constant metaspaceMethod = resolvedMethod.getMetaspaceMethodConstant();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
316 append(new AMD64HotspotDirectStaticCallOp(callTarget.target(), result, parameters, temps, callState, invokeKind, metaspaceMethod));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
317 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
318 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
319
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
320 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
321 protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9247
diff changeset
322 AllocatableValue metaspaceMethod = AMD64.rbx.asValue();
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
323 emitMove(metaspaceMethod, operand(((HotSpotIndirectCallTargetNode) callTarget).metaspaceMethod()));
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9247
diff changeset
324 AllocatableValue targetAddress = AMD64.rax.asValue();
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
325 emitMove(targetAddress, operand(callTarget.computedAddress()));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
326 append(new AMD64IndirectCallOp(callTarget.target(), result, parameters, temps, metaspaceMethod, targetAddress, callState));
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
327 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
328
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
329 @Override
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
330 public void emitUnwind(Value exception) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
331 RegisterValue exceptionParameter = EXCEPTION.asValue();
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
332 emitMove(exceptionParameter, exception);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
333 AMD64HotSpotUnwindOp op = new AMD64HotSpotUnwindOp(exceptionParameter);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
334 epilogueOps.add(op);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
335 append(op);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
336 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
337
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
338 @Override
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8643
diff changeset
339 public void emitDeoptimize(DeoptimizationAction action, DeoptimizingNode deopting) {
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8643
diff changeset
340 append(new AMD64DeoptimizeOp(action, deopting.getDeoptimizationReason(), state(deopting)));
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
341 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
342
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
343 @Override
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
344 public void emitDeoptimizeCaller(DeoptimizationAction action, DeoptimizationReason reason) {
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
345 AMD64HotSpotDeoptimizeCallerOp op = new AMD64HotSpotDeoptimizeCallerOp(action, reason);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
346 epilogueOps.add(op);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
347 append(op);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
348 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
349
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9247
diff changeset
350 @Override
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9433
diff changeset
351 public void emitPatchReturnAddress(ValueNode address) {
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9433
diff changeset
352 load(operand(address));
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9433
diff changeset
353 AMD64HotSpotPatchReturnAddressOp op = new AMD64HotSpotPatchReturnAddressOp(load(operand(address)));
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9433
diff changeset
354 append(op);
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9433
diff changeset
355 }
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9433
diff changeset
356
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9433
diff changeset
357 @Override
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
358 public void beforeRegisterAllocation() {
9247
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
359 boolean hasDebugInfo = lir.hasDebugInfo();
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
360 AllocatableValue savedRbp = saveRbp.finalize(hasDebugInfo);
27c75e4016db clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents: 8892
diff changeset
361 if (hasDebugInfo) {
8303
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
362 deoptimizationRescueSlot = frameMap.allocateSpillSlot(Kind.Long);
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
363 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
364
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
365 for (AMD64HotSpotEpilogueOp op : epilogueOps) {
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
366 op.savedRbp = savedRbp;
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
367 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
368 }
bb9fba66b6ef refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
369 }