Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java @ 15180:7a9531f50cd8
renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
author | twisti |
---|---|
date | Wed, 16 Apr 2014 15:04:35 -1000 |
parents | c8e575742f36 |
children | 96bb07a5d667 |
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 |
14799
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
25 import static com.oracle.graal.api.code.CallingConvention.Type.*; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
26 import static com.oracle.graal.api.code.ValueUtil.*; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
27 import static com.oracle.graal.phases.GraalOptions.*; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
28 import static com.oracle.graal.sparc.SPARC.*; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
29 import static java.lang.reflect.Modifier.*; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
30 |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
31 import java.util.*; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
32 |
10459 | 33 import sun.misc.*; |
34 | |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 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
|
36 import com.oracle.graal.api.meta.*; |
10459 | 37 import com.oracle.graal.asm.*; |
38 import com.oracle.graal.asm.sparc.*; | |
14799
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
39 import com.oracle.graal.asm.sparc.SPARCAssembler.Bpne; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
40 import com.oracle.graal.asm.sparc.SPARCAssembler.CC; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
41 import com.oracle.graal.asm.sparc.SPARCAssembler.Ldx; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
42 import com.oracle.graal.asm.sparc.SPARCAssembler.Save; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
43 import com.oracle.graal.asm.sparc.SPARCAssembler.Stx; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
44 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Cmp; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
45 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Nop; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
46 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.RestoreWindow; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
47 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx; |
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
48 import com.oracle.graal.compiler.gen.*; |
13839 | 49 import com.oracle.graal.graph.*; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 import com.oracle.graal.hotspot.*; |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14921
diff
changeset
|
51 import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 import com.oracle.graal.hotspot.meta.*; |
14799
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
53 import com.oracle.graal.hotspot.stubs.*; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 import com.oracle.graal.lir.*; |
14799
01afd501f127
Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
55 import com.oracle.graal.lir.StandardOp.SaveRegistersOp; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 import com.oracle.graal.lir.asm.*; |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
57 import com.oracle.graal.lir.sparc.*; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 import com.oracle.graal.nodes.*; |
10459 | 59 |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 /** |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 * HotSpot SPARC specific backend. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 */ |
12580
7876c59a7a2f
refactored all deferred initialization of backends into HotSpotBackend
Doug Simon <doug.simon@oracle.com>
parents:
12431
diff
changeset
|
63 public class SPARCHotSpotBackend extends HotSpotHostBackend { |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 |
10459 | 65 private static final Unsafe unsafe = Unsafe.getUnsafe(); |
66 | |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
67 public SPARCHotSpotBackend(HotSpotGraalRuntime runtime, HotSpotProviders providers) { |
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
68 super(runtime, providers); |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 } |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 @Override |
11775
b04b94b71649
Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents:
10956
diff
changeset
|
72 public boolean shouldAllocateRegisters() { |
b04b94b71649
Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents:
10956
diff
changeset
|
73 return true; |
b04b94b71649
Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents:
10956
diff
changeset
|
74 } |
b04b94b71649
Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents:
10956
diff
changeset
|
75 |
b04b94b71649
Finished PTX assembler and Register -> Variable conversion
Morris Meyer <morris.meyer@oracle.com>
parents:
10956
diff
changeset
|
76 @Override |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
77 public FrameMap newFrameMap(RegisterConfig registerConfig) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
78 return new SPARCFrameMap(getProviders().getCodeCache(), registerConfig); |
10956 | 79 } |
80 | |
81 @Override | |
14847
c132602c640e
Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
82 public LIRGenerator newLIRGenerator(CallingConvention cc, LIRGenerationResult lirGenRes) { |
c132602c640e
Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
83 return new SPARCHotSpotLIRGenerator(getProviders(), getRuntime().getConfig(), cc, lirGenRes); |
c132602c640e
Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
84 } |
c132602c640e
Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
85 |
c132602c640e
Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
86 @Override |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
87 public NodeLIRBuilder newNodeLIRGenerator(StructuredGraph graph, LIRGenerator lirGen) { |
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
88 return new SPARCHotSpotNodeLIRBuilder(graph, lirGen); |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 } |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 |
10459 | 91 /** |
92 * Emits code to do stack overflow checking. | |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
93 * |
10459 | 94 * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate |
95 * the current frame | |
96 */ | |
13310
733cccc125ed
added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents:
13252
diff
changeset
|
97 protected static void emitStackOverflowCheck(CompilationResultBuilder crb, int pagesToBang, boolean afterFrameInit) { |
733cccc125ed
added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents:
13252
diff
changeset
|
98 if (pagesToBang > 0) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
99 SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm; |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
100 final int frameSize = crb.frameMap.totalFrameSize(); |
10459 | 101 if (frameSize > 0) { |
102 int lastFramePage = frameSize / unsafe.pageSize(); | |
103 // emit multiple stack bangs for methods with frames larger than a page | |
104 for (int i = 0; i <= lastFramePage; i++) { | |
13310
733cccc125ed
added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents:
13252
diff
changeset
|
105 int disp = (i + pagesToBang) * unsafe.pageSize(); |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
106 if (afterFrameInit) { |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
107 disp -= frameSize; |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
108 } |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
109 crb.blockComment("[stack overflow check]"); |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
110 // 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
|
111 SPARCAddress address = new SPARCAddress(sp, -disp); |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
112 if (SPARCAssembler.isSimm13(address.getDisplacement())) { |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
113 new Stx(g0, address).emit(masm); |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
114 } else { |
10792 | 115 new Setx(address.getDisplacement(), g3).emit(masm); |
116 new Stx(g0, new SPARCAddress(sp, g3)).emit(masm); | |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
117 } |
10459 | 118 } |
119 } | |
120 } | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
121 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
122 |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
123 public class HotSpotFrameContext implements FrameContext { |
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 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
|
126 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
127 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
|
128 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
|
129 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
130 |
13234
7e237378923d
made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents:
13229
diff
changeset
|
131 public boolean hasFrame() { |
7e237378923d
made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents:
13229
diff
changeset
|
132 return true; |
7e237378923d
made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents:
13229
diff
changeset
|
133 } |
7e237378923d
made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents:
13229
diff
changeset
|
134 |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
135 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
136 public void enter(CompilationResultBuilder crb) { |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
137 final int frameSize = crb.frameMap.totalFrameSize(); |
10459 | 138 |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
139 SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm; |
13310
733cccc125ed
added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents:
13252
diff
changeset
|
140 if (!isStub && pagesToBang > 0) { |
733cccc125ed
added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents:
13252
diff
changeset
|
141 emitStackOverflowCheck(crb, pagesToBang, false); |
10459 | 142 } |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
143 new Save(sp, -frameSize, sp).emit(masm); |
10459 | 144 |
145 if (ZapStackOnMethodEntry.getValue()) { | |
146 final int slotSize = 8; | |
147 for (int i = 0; i < frameSize / slotSize; ++i) { | |
148 // 0xC1C1C1C1 | |
149 new Stx(g0, new SPARCAddress(sp, i * slotSize)).emit(masm); | |
150 } | |
151 } | |
9814
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 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
155 public void leave(CompilationResultBuilder crb) { |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
156 SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm; |
10459 | 157 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
|
158 } |
9432
6680389bd36f
Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
8281
diff
changeset
|
159 } |
6680389bd36f
Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
8281
diff
changeset
|
160 |
6680389bd36f
Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
8281
diff
changeset
|
161 @Override |
14032
d1c1f103d42c
renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
twisti
parents:
13839
diff
changeset
|
162 protected Assembler createAssembler(FrameMap frameMap) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
163 return new SPARCMacroAssembler(getTarget(), frameMap.registerConfig); |
10459 | 164 } |
165 | |
166 @Override | |
14809
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14807
diff
changeset
|
167 public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenRes, CompilationResult compilationResult, CompilationResultBuilderFactory factory) { |
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14807
diff
changeset
|
168 SPARCHotSpotLIRGenerationResult gen = (SPARCHotSpotLIRGenerationResult) lirGenRes; |
14796
f5b3292b4ded
Restrict access to members of LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14142
diff
changeset
|
169 FrameMap frameMap = gen.getFrameMap(); |
14807
c3242028cc44
Introduce specialized LIRGenerationResults for Targets if needed.
Josef Eisl <josef.eisl@jku.at>
parents:
14804
diff
changeset
|
170 assert gen.getDeoptimizationRescueSlot() == null || frameMap.frameNeedsAllocating() : "method that can deoptimize must have a frame"; |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
171 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
172 Stub stub = gen.getStub(); |
14032
d1c1f103d42c
renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
twisti
parents:
13839
diff
changeset
|
173 Assembler masm = createAssembler(frameMap); |
10459 | 174 // On SPARC we always use stack frames. |
175 HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null); | |
13229
325b4e4efb60
added CompilationResultBuilderFactory to support peep-hole instrumentation of methods as their code is emitted
Doug Simon <doug.simon@oracle.com>
parents:
13227
diff
changeset
|
176 CompilationResultBuilder crb = factory.createBuilder(getProviders().getCodeCache(), getProviders().getForeignCalls(), frameMap, masm, frameContext, compilationResult); |
15180
7a9531f50cd8
renamed com.oracle.graal.api.code.CompilationResult.frameSize to totalFrameSize
twisti
parents:
15011
diff
changeset
|
177 crb.setTotalFrameSize(frameMap.totalFrameSize()); |
14807
c3242028cc44
Introduce specialized LIRGenerationResults for Targets if needed.
Josef Eisl <josef.eisl@jku.at>
parents:
14804
diff
changeset
|
178 StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot(); |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
179 if (deoptimizationRescueSlot != null && stub == null) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
180 crb.compilationResult.setCustomStackAreaOffset(frameMap.offsetForStackSlot(deoptimizationRescueSlot)); |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
181 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9621
diff
changeset
|
182 |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
183 if (stub != null) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
184 // SPARC stubs always enter a frame which saves the registers. |
12610
62fb4919edc9
cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents:
12580
diff
changeset
|
185 Set<Register> destroyedRegisters = Collections.emptySet(); |
62fb4919edc9
cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents:
12580
diff
changeset
|
186 Map<LIRFrameState, SaveRegistersOp> calleeSaveInfo = Collections.emptyMap(); |
62fb4919edc9
cleaned up mechanism for saving registers and updating the callee save maps in stubs
Doug Simon <doug.simon@oracle.com>
parents:
12580
diff
changeset
|
187 updateStub(stub, destroyedRegisters, calleeSaveInfo, frameMap); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
188 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
189 |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
190 return crb; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 } |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
192 |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
193 @Override |
14809
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14807
diff
changeset
|
194 public LIRGenerationResult newLIRGenerationResult(LIR lir, FrameMap frameMap, Object stub) { |
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14807
diff
changeset
|
195 return new LIRGenerationResultBase(lir, frameMap); |
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14807
diff
changeset
|
196 } |
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14807
diff
changeset
|
197 |
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14807
diff
changeset
|
198 @Override |
14065
5dec26f3d4a4
Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14032
diff
changeset
|
199 public void emitCode(CompilationResultBuilder crb, LIR lir, ResolvedJavaMethod installedCodeOwner) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
200 SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm; |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
201 FrameMap frameMap = crb.frameMap; |
10459 | 202 RegisterConfig regConfig = frameMap.registerConfig; |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
203 HotSpotVMConfig config = getRuntime().getConfig(); |
10459 | 204 Label unverifiedStub = installedCodeOwner == null || isStatic(installedCodeOwner.getModifiers()) ? null : new Label(); |
205 | |
206 // Emit the prefix | |
207 | |
208 if (unverifiedStub != null) { | |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14142
diff
changeset
|
209 MarkId.recordMark(crb, MarkId.UNVERIFIED_ENTRY); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
210 // We need to use JavaCall here because we haven't entered the frame yet. |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
211 CallingConvention cc = regConfig.getCallingConvention(JavaCall, null, new JavaType[]{getProviders().getMetaAccess().lookupJavaType(Object.class)}, getTarget(), false); |
10459 | 212 Register inlineCacheKlass = g5; // see MacroAssembler::ic_call |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
213 Register scratch = g3; |
10459 | 214 Register receiver = asRegister(cc.getArgument(0)); |
215 SPARCAddress src = new SPARCAddress(receiver, config.hubOffset); | |
216 | |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
217 new Ldx(src, scratch).emit(masm); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
218 new Cmp(scratch, inlineCacheKlass).emit(masm); |
10470 | 219 new Bpne(CC.Xcc, unverifiedStub).emit(masm); |
220 new Nop().emit(masm); // delay slot | |
10459 | 221 } |
222 | |
10470 | 223 masm.align(config.codeEntryAlignment); |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14142
diff
changeset
|
224 MarkId.recordMark(crb, MarkId.OSR_ENTRY); |
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14142
diff
changeset
|
225 MarkId.recordMark(crb, MarkId.VERIFIED_ENTRY); |
10459 | 226 |
227 // Emit code for the LIR | |
14065
5dec26f3d4a4
Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14032
diff
changeset
|
228 crb.emit(lir); |
10459 | 229 |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
230 HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
231 HotSpotForeignCallsProvider foreignCalls = getProviders().getForeignCalls(); |
13234
7e237378923d
made the frameContext of a CompilationResultBuilder always non-null and added FrameContext.hasFrame() to determine if a frame is actually generated
Doug Simon <doug.simon@oracle.com>
parents:
13229
diff
changeset
|
232 if (!frameContext.isStub) { |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14142
diff
changeset
|
233 MarkId.recordMark(crb, MarkId.EXCEPTION_HANDLER_ENTRY); |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
234 SPARCCall.directCall(crb, masm, foreignCalls.lookupForeignCall(EXCEPTION_HANDLER), null, false, null); |
14574
6bab029d6e3a
removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents:
14142
diff
changeset
|
235 MarkId.recordMark(crb, MarkId.DEOPT_HANDLER_ENTRY); |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
236 SPARCCall.directCall(crb, masm, foreignCalls.lookupForeignCall(DEOPT_HANDLER), null, false, null); |
10459 | 237 } else { |
238 // No need to emit the stubs for entries back into the method since | |
239 // it has no calls that can cause such "return" entries | |
240 } | |
241 | |
242 if (unverifiedStub != null) { | |
10470 | 243 masm.bind(unverifiedStub); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10792
diff
changeset
|
244 Register scratch = g3; |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12610
diff
changeset
|
245 SPARCCall.indirectJmp(crb, masm, scratch, foreignCalls.lookupForeignCall(IC_MISS_HANDLER)); |
10459 | 246 } |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 } |
13837
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13829
diff
changeset
|
248 |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13829
diff
changeset
|
249 @Override |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13829
diff
changeset
|
250 public NativeFunctionInterface getNativeFunctionInterface() { |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13829
diff
changeset
|
251 throw GraalInternalError.unimplemented("No NativeFunctionInterface of SPARC"); |
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13829
diff
changeset
|
252 } |
14847
c132602c640e
Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
253 |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 } |