Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java @ 9507:3df71c132731
Make register saving extensible.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Thu, 02 May 2013 14:13:54 +0200 |
parents | 6703dca691d7 |
children | 08d1414ac62d |
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 |
9507
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
189 protected AMD64SaveRegistersOp emitSaveRegisters(Register[] savedRegisters, StackSlot[] savedRegisterLocations) { |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
190 AMD64SaveRegistersOp save = new AMD64SaveRegistersOp(savedRegisters, savedRegisterLocations); |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
191 append(save); |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
192 return save; |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
193 } |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
194 |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
195 protected void emitRestoreRegisters(AMD64SaveRegistersOp save) { |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
196 append(new AMD64RestoreRegistersOp(save.getSlots().clone(), save)); |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
197 } |
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
198 |
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
|
199 @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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 |
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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 savedRegisterLocations[i] = 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
|
216 } |
9507
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
217 save = emitSaveRegisters(savedRegisters, savedRegisterLocations); |
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
|
218 } |
9471
5fa54bf57f8c
replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9433
diff
changeset
|
219 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
|
220 } |
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
|
221 |
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
|
222 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
|
223 |
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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 |
9507
3df71c132731
Make register saving extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
9506
diff
changeset
|
230 emitRestoreRegisters(save); |
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
|
231 } 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
|
232 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
|
233 } |
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
|
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 |
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
|
236 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
|
237 } |
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
|
238 |
9506
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
239 protected AMD64ZapRegistersOp emitZapRegisters(Register[] zappedRegisters, Constant[] zapValues) { |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
240 AMD64ZapRegistersOp zap = new AMD64ZapRegistersOp(zappedRegisters, zapValues); |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
241 append(zap); |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
242 return zap; |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
243 } |
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
244 |
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
|
245 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
|
246 Register[] zappedRegisters = frameMap.registerConfig.getAllocatableRegisters(); |
9506
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
247 Constant[] zapValues = new Constant[zappedRegisters.length]; |
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
|
248 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
|
249 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
|
250 assert kind != Kind.Illegal; |
9506
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
251 zapValues[i] = zapValueForKind(kind); |
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
|
252 } |
9506
6703dca691d7
Restructure register zapping.
Roland Schatz <roland.schatz@oracle.com>
parents:
9505
diff
changeset
|
253 calleeSaveInfo.put(currentRuntimeCallInfo, emitZapRegisters(zappedRegisters, zapValues)); |
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
|
254 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
|
255 } |
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
|
256 |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
257 @Override |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
258 protected CallingConvention createCallingConvention() { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
259 Stub stub = runtime().asStub(method); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
260 if (stub != null) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
261 return stub.getLinkage().getCallingConvention(); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
262 } |
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 if (graph.getEntryBCI() == StructuredGraph.INVOCATION_ENTRY_BCI) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
265 return super.createCallingConvention(); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
266 } else { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
267 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
|
268 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
269 } |
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 @Override |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
272 public void visitSafepointNode(SafepointNode i) { |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8643
diff
changeset
|
273 LIRFrameState info = state(i); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
274 append(new AMD64SafepointOp(info, runtime().config, this)); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
275 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
276 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
277 @SuppressWarnings("hiding") |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
278 @Override |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
279 public void visitDirectCompareAndSwap(DirectCompareAndSwapNode x) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
280 Kind kind = x.newValue().kind(); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
281 assert kind == x.expectedValue().kind(); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
282 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
283 Value expected = loadNonConst(operand(x.expectedValue())); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
284 Variable newVal = load(operand(x.newValue())); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
285 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
286 int disp = 0; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
287 AMD64AddressValue address; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
288 Value index = operand(x.offset()); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
289 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
|
290 assert !runtime.needsDataPatch(asConstant(index)); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
291 disp += (int) ValueUtil.asConstant(index).asLong(); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
292 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
|
293 } else { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
294 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
|
295 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
296 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
297 RegisterValue rax = AMD64.rax.asValue(kind); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
298 emitMove(rax, expected); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
299 append(new CompareAndSwapOp(rax, address, rax, newVal)); |
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 Variable result = newVariable(x.kind()); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
302 emitMove(result, rax); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
303 setResult(x, result); |
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 public void emitTailcall(Value[] args, Value address) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
308 append(new AMD64TailcallOp(args, address)); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
309 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
310 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
311 @Override |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
312 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
|
313 InvokeKind invokeKind = ((HotSpotDirectCallTargetNode) callTarget).invokeKind(); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
314 if (invokeKind == InvokeKind.Interface || invokeKind == InvokeKind.Virtual) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
315 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
|
316 } else { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
317 assert invokeKind == InvokeKind.Static || invokeKind == InvokeKind.Special; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
318 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
|
319 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
|
320 Constant metaspaceMethod = resolvedMethod.getMetaspaceMethodConstant(); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
321 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
|
322 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
323 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
324 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
325 @Override |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
326 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
|
327 AllocatableValue metaspaceMethod = AMD64.rbx.asValue(); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
328 emitMove(metaspaceMethod, operand(((HotSpotIndirectCallTargetNode) callTarget).metaspaceMethod())); |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9247
diff
changeset
|
329 AllocatableValue targetAddress = AMD64.rax.asValue(); |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
330 emitMove(targetAddress, operand(callTarget.computedAddress())); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
331 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
|
332 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
333 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
334 @Override |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
335 public void emitUnwind(Value exception) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
336 RegisterValue exceptionParameter = EXCEPTION.asValue(); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
337 emitMove(exceptionParameter, exception); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
338 AMD64HotSpotUnwindOp op = new AMD64HotSpotUnwindOp(exceptionParameter); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
339 epilogueOps.add(op); |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
340 append(op); |
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 |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8643
diff
changeset
|
344 public void emitDeoptimize(DeoptimizationAction action, DeoptimizingNode deopting) { |
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8643
diff
changeset
|
345 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
|
346 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
347 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
348 @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
|
349 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
|
350 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
|
351 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
|
352 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
|
353 } |
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
|
354 |
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
|
355 @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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 } |
5fa54bf57f8c
replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9433
diff
changeset
|
361 |
5fa54bf57f8c
replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9433
diff
changeset
|
362 @Override |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
363 public void beforeRegisterAllocation() { |
9247
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
364 boolean hasDebugInfo = lir.hasDebugInfo(); |
27c75e4016db
clarified code for emitting LIR code to save RBP
Doug Simon <doug.simon@oracle.com>
parents:
8892
diff
changeset
|
365 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
|
366 if (hasDebugInfo) { |
8303
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
367 deoptimizationRescueSlot = frameMap.allocateSpillSlot(Kind.Long); |
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 |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
370 for (AMD64HotSpotEpilogueOp op : epilogueOps) { |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
371 op.savedRbp = savedRbp; |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
372 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
373 } |
bb9fba66b6ef
refactored HotSpotAMD64LIRGenerator into its own file
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
374 } |