Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java @ 10694:31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
author | twisti |
---|---|
date | Wed, 10 Jul 2013 12:50:45 -0700 |
parents | 73122b5edf6a |
children | 7a8d6ba83a04 |
rev | line source |
---|---|
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.sparc; |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
10459 | 25 import sun.misc.*; |
26 | |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.api.code.*; |
9621
e97dc9bbfedc
introduced installedCodeOwner parameter of type ResolvedJavaMethod to GraalCompiler.compileGraph to properly distinguish the source method of a graph from the method under which the code compiled for the graph will be installed
Doug Simon <doug.simon@oracle.com>
parents:
9615
diff
changeset
|
28 import com.oracle.graal.api.meta.*; |
10459 | 29 import com.oracle.graal.asm.*; |
30 import com.oracle.graal.asm.sparc.*; | |
31 import com.oracle.graal.asm.sparc.SPARCAssembler.*; | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
32 import com.oracle.graal.compiler.gen.LIRGenerator; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.graal.hotspot.*; |
10459 | 34 import com.oracle.graal.hotspot.bridge.*; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.hotspot.meta.*; |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
36 import com.oracle.graal.hotspot.stubs.Stub; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 import com.oracle.graal.lir.*; |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 import com.oracle.graal.lir.asm.*; |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 import com.oracle.graal.nodes.*; |
10459 | 40 |
41 import static com.oracle.graal.sparc.SPARC.*; | |
42 import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; | |
43 import static com.oracle.graal.api.code.CallingConvention.Type.*; | |
44 import static com.oracle.graal.api.code.ValueUtil.*; | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
45 import static com.oracle.graal.phases.GraalOptions.*; |
10459 | 46 import static java.lang.reflect.Modifier.*; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 /** |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 * HotSpot SPARC specific backend. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 */ |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 public class SPARCHotSpotBackend extends HotSpotBackend { |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
10459 | 53 private static final Unsafe unsafe = Unsafe.getUnsafe(); |
54 | |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 public SPARCHotSpotBackend(HotSpotRuntime runtime, TargetDescription target) { |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 super(runtime, target); |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 } |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 @Override |
9613
0c17815817a4
removed LIRGenerator.method field
Doug Simon <doug.simon@oracle.com>
parents:
9612
diff
changeset
|
60 public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { |
10459 | 61 return new SPARCHotSpotLIRGenerator(graph, runtime(), target, frameMap, cc, lir); |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 } |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 |
10459 | 64 /** |
65 * Emits code to do stack overflow checking. | |
66 * | |
67 * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate | |
68 * the current frame | |
69 */ | |
70 protected static void emitStackOverflowCheck(TargetMethodAssembler tasm, boolean afterFrameInit) { | |
71 if (StackShadowPages.getValue() > 0) { | |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
72 SPARCMacroAssembler masm = (SPARCMacroAssembler) tasm.asm; |
10459 | 73 final int frameSize = tasm.frameMap.frameSize(); |
74 if (frameSize > 0) { | |
75 int lastFramePage = frameSize / unsafe.pageSize(); | |
76 // emit multiple stack bangs for methods with frames larger than a page | |
77 for (int i = 0; i <= lastFramePage; i++) { | |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
78 int disp = (i + StackShadowPages.getValue()) * unsafe.pageSize(); |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
79 if (afterFrameInit) { |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
80 disp -= frameSize; |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
81 } |
10459 | 82 tasm.blockComment("[stack overflow check]"); |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
83 // Use SPARCAddress to get the final displacement including the stack bias. |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
84 SPARCAddress address = new SPARCAddress(sp, -disp); |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
85 if (SPARCAssembler.isSimm13(address.getDisplacement())) { |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
86 new Stx(g0, address).emit(masm); |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
87 } else { |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
88 // TODO Can't use g3 as scratch here. |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
89 new Setx(address.getDisplacement(), g3, g3).emit(masm); |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
90 new Stx(g0, sp, g3).emit(masm); |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
91 } |
10459 | 92 } |
93 } | |
94 } | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
95 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
96 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
97 class HotSpotFrameContext implements FrameContext { |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
98 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
99 final boolean isStub; |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
100 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
101 HotSpotFrameContext(boolean isStub) { |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
102 this.isStub = isStub; |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
103 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
104 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
105 @Override |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
106 public void enter(TargetMethodAssembler tasm) { |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
107 final int alignment = target.wordSize * 2; |
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
108 final int frameSize = (tasm.frameMap.frameSize() + (alignment - 1)) & ~(alignment - 1); |
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
109 assert frameSize % alignment == 0 : "must preserve 2*wordSize alignment"; |
10459 | 110 |
111 SPARCMacroAssembler masm = (SPARCMacroAssembler) tasm.asm; | |
112 if (!isStub) { | |
113 emitStackOverflowCheck(tasm, false); | |
114 } | |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
115 new Save(sp, -frameSize, sp).emit(masm); |
10459 | 116 |
117 if (ZapStackOnMethodEntry.getValue()) { | |
118 final int slotSize = 8; | |
119 for (int i = 0; i < frameSize / slotSize; ++i) { | |
120 // 0xC1C1C1C1 | |
121 new Stx(g0, new SPARCAddress(sp, i * slotSize)).emit(masm); | |
122 } | |
123 } | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
124 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
125 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
126 @Override |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
127 public void leave(TargetMethodAssembler tasm) { |
10459 | 128 SPARCMacroAssembler masm = (SPARCMacroAssembler) tasm.asm; |
129 new RestoreWindow().emit(masm); | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
130 } |
9432
6680389bd36f
Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
8281
diff
changeset
|
131 } |
6680389bd36f
Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
8281
diff
changeset
|
132 |
6680389bd36f
Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
8281
diff
changeset
|
133 @Override |
10459 | 134 protected AbstractAssembler createAssembler(FrameMap frameMap) { |
135 return new SPARCMacroAssembler(target, frameMap.registerConfig); | |
136 } | |
137 | |
138 @Override | |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
7743
diff
changeset
|
139 public TargetMethodAssembler newAssembler(LIRGenerator lirGen, CompilationResult compilationResult) { |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
140 SPARCHotSpotLIRGenerator gen = (SPARCHotSpotLIRGenerator) lirGen; |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
141 FrameMap frameMap = gen.frameMap; |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
142 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
143 Stub stub = gen.getStub(); |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
144 AbstractAssembler masm = createAssembler(frameMap); |
10459 | 145 // On SPARC we always use stack frames. |
146 HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null); | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
147 TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime(), frameMap, masm, frameContext, compilationResult); |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
148 tasm.setFrameSize(frameMap.frameSize()); |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
149 StackSlot deoptimizationRescueSlot = gen.deoptimizationRescueSlot; |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
150 if (deoptimizationRescueSlot != null && stub == null) { |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
151 tasm.compilationResult.setCustomStackAreaOffset(frameMap.offsetForStackSlot(deoptimizationRescueSlot)); |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
152 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
153 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
154 return tasm; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 } |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 @Override |
10459 | 158 public void emitCode(TargetMethodAssembler tasm, LIRGenerator lirGen, ResolvedJavaMethod installedCodeOwner) { |
10470 | 159 SPARCMacroAssembler masm = (SPARCMacroAssembler) tasm.asm; |
10459 | 160 FrameMap frameMap = tasm.frameMap; |
161 RegisterConfig regConfig = frameMap.registerConfig; | |
162 HotSpotVMConfig config = runtime().config; | |
163 Label unverifiedStub = installedCodeOwner == null || isStatic(installedCodeOwner.getModifiers()) ? null : new Label(); | |
164 | |
165 // Emit the prefix | |
166 | |
167 if (unverifiedStub != null) { | |
168 tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY); | |
169 CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[]{runtime().lookupJavaType(Object.class)}, target, false); | |
170 Register inlineCacheKlass = g5; // see MacroAssembler::ic_call | |
171 Register receiver = asRegister(cc.getArgument(0)); | |
172 SPARCAddress src = new SPARCAddress(receiver, config.hubOffset); | |
173 | |
10470 | 174 new Ldx(src, g0).emit(masm); |
175 new Cmp(inlineCacheKlass, g0).emit(masm); | |
176 new Bpne(CC.Xcc, unverifiedStub).emit(masm); | |
177 new Nop().emit(masm); // delay slot | |
10459 | 178 } |
179 | |
10470 | 180 masm.align(config.codeEntryAlignment); |
10459 | 181 tasm.recordMark(Marks.MARK_OSR_ENTRY); |
182 tasm.recordMark(Marks.MARK_VERIFIED_ENTRY); | |
183 | |
184 // Emit code for the LIR | |
185 lirGen.lir.emitCode(tasm); | |
186 | |
187 HotSpotFrameContext frameContext = (HotSpotFrameContext) tasm.frameContext; | |
188 if (frameContext != null && !frameContext.isStub) { | |
189 tasm.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY); | |
190 // SPARCCall.directCall(tasm, asm, runtime().lookupForeignCall(EXCEPTION_HANDLER), null, false, | |
191 // null); | |
192 tasm.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY); | |
193 // SPARCCall.directCall(tasm, asm, runtime().lookupForeignCall(DEOPT_HANDLER), null, false, null); | |
194 } else { | |
195 // No need to emit the stubs for entries back into the method since | |
196 // it has no calls that can cause such "return" entries | |
197 assert !frameMap.accessesCallerFrame() : lirGen.getGraph(); | |
198 } | |
199 | |
200 if (unverifiedStub != null) { | |
10470 | 201 masm.bind(unverifiedStub); |
10459 | 202 // SPARCCall.directJmp(tasm, asm, runtime().lookupForeignCall(IC_MISS_HANDLER)); |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
203 // throw new InternalError("g0 must be scratch register"); |
10459 | 204 } |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
205 } |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
206 } |