annotate graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java @ 22054:0e095e2c24e2

Rename com.oracle.jvmci to jdk.internal.jvmci
author twisti
date Mon, 22 Jun 2015 12:12:53 -0700
parents 5352b2437a2d
children d9f3acb4a9a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
21720
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
25 import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*;
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
26 import static com.oracle.graal.asm.sparc.SPARCAssembler.BranchPredict.*;
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
27 import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*;
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
28 import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*;
15259
d90e5c22ba55 Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
29 import static com.oracle.graal.compiler.common.GraalOptions.*;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22050
diff changeset
30 import static jdk.internal.jvmci.code.CallingConvention.Type.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22050
diff changeset
31 import static jdk.internal.jvmci.code.ValueUtil.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22050
diff changeset
32 import static jdk.internal.jvmci.common.UnsafeAccess.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22050
diff changeset
33 import static jdk.internal.jvmci.sparc.SPARC.*;
15838
15771ff797b4 Pass the compiled method to LIR factory
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15456
diff changeset
34
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
35 import java.util.*;
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
36
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22050
diff changeset
37 import jdk.internal.jvmci.code.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22050
diff changeset
38 import jdk.internal.jvmci.hotspot.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22050
diff changeset
39 import jdk.internal.jvmci.meta.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22050
diff changeset
40
21720
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
41 import com.oracle.graal.asm.*;
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
42 import com.oracle.graal.asm.sparc.*;
d915361cc3a1 moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21708
diff changeset
43 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.*;
21510
0ee2ed36d079 Backend: add #newRegisterAllocationConfig.
Josef Eisl <josef.eisl@jku.at>
parents: 21413
diff changeset
44 import com.oracle.graal.compiler.common.alloc.*;
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
45 import com.oracle.graal.compiler.common.cfg.*;
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 import com.oracle.graal.hotspot.*;
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 import com.oracle.graal.hotspot.meta.*;
14799
01afd501f127 Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents: 14796
diff changeset
48 import com.oracle.graal.hotspot.stubs.*;
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 import com.oracle.graal.lir.*;
14799
01afd501f127 Updated getStartBlock() in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents: 14796
diff changeset
50 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
51 import com.oracle.graal.lir.asm.*;
18443
1c92d437179b FrameMapBuilder: move into package.
Josef Eisl <josef.eisl@jku.at>
parents: 18432
diff changeset
52 import com.oracle.graal.lir.framemap.*;
15292
a38d791982e1 Move LIRGenerationResult* to graal.lir.
Josef Eisl <josef.eisl@jku.at>
parents: 15259
diff changeset
53 import com.oracle.graal.lir.gen.*;
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
54 import com.oracle.graal.lir.sparc.*;
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 import com.oracle.graal.nodes.*;
15337
c4be3c1b2d6d Use NodeLIRBuilderTool instead of NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 15333
diff changeset
56 import com.oracle.graal.nodes.spi.*;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
57
7740
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 * HotSpot SPARC specific backend.
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60 */
12580
7876c59a7a2f refactored all deferred initialization of backends into HotSpotBackend
Doug Simon <doug.simon@oracle.com>
parents: 12431
diff changeset
61 public class SPARCHotSpotBackend extends HotSpotHostBackend {
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62
18524
c538c2c6b7e2 changed most references to HotSpotGraalRuntime to use HotSpotGraalRuntimeProvider instead
Doug Simon <doug.simon@oracle.com>
parents: 18468
diff changeset
63 public SPARCHotSpotBackend(HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
64 super(runtime, providers);
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 }
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 @Override
18155
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
68 public FrameMapBuilder newFrameMapBuilder(RegisterConfig registerConfig) {
18458
ff3f0bf30b2e DelayedFrameMapBuilder: require non null register config.
Josef Eisl <josef.eisl@jku.at>
parents: 18457
diff changeset
69 RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig;
18468
6014e40b07f8 SPARC: fix deoptimization rescue slot handling.
Josef Eisl <josef.eisl@jku.at>
parents: 18461
diff changeset
70 return new SPARCFrameMapBuilder(newFrameMap(registerConfigNonNull), getCodeCache(), registerConfigNonNull);
18155
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
71 }
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
72
448be95baef8 Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18152
diff changeset
73 @Override
18432
6b58802e45b2 Revert Backend.frameMap(FrameMapBuilder) to Backend.frameMap(RegisterConfig).
Josef Eisl <josef.eisl@jku.at>
parents: 18429
diff changeset
74 public FrameMap newFrameMap(RegisterConfig registerConfig) {
6b58802e45b2 Revert Backend.frameMap(FrameMapBuilder) to Backend.frameMap(RegisterConfig).
Josef Eisl <josef.eisl@jku.at>
parents: 18429
diff changeset
75 return new SPARCFrameMap(getCodeCache(), registerConfig);
10956
563c6d1994c0 added architecture specific frame maps
twisti
parents: 10854
diff changeset
76 }
563c6d1994c0 added architecture specific frame maps
twisti
parents: 10854
diff changeset
77
563c6d1994c0 added architecture specific frame maps
twisti
parents: 10854
diff changeset
78 @Override
15333
06ecedffb109 Use LIRGeneratorTool in Backend.
Josef Eisl <josef.eisl@jku.at>
parents: 15311
diff changeset
79 public LIRGeneratorTool newLIRGenerator(CallingConvention cc, LIRGenerationResult lirGenRes) {
14847
c132602c640e Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
80 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
81 }
c132602c640e Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
82
c132602c640e Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
83 @Override
20003
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19942
diff changeset
84 public LIRGenerationResult newLIRGenerationResult(String compilationUnitName, LIR lir, FrameMapBuilder frameMapBuilder, ResolvedJavaMethod method, Object stub) {
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19942
diff changeset
85 return new SPARCHotSpotLIRGenerationResult(compilationUnitName, lir, frameMapBuilder, stub);
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15338
diff changeset
86 }
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15338
diff changeset
87
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15338
diff changeset
88 @Override
15338
5e544920ad9f Rename Backend.newNodeLIRGenerator to Backend.newNodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 15337
diff changeset
89 public NodeLIRBuilderTool newNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool lirGen) {
18529
ab86fa952750 removed static access to HotSpotGraalRuntime from some SPARC HotSpot classes
Doug Simon <doug.simon@oracle.com>
parents: 18524
diff changeset
90 return new SPARCHotSpotNodeLIRBuilder(getRuntime(), graph, lirGen);
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 }
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
93 /**
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
94 * Emits code to do stack overflow checking.
14921
88dfaf6448e0 Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
95 *
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
96 * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
97 * the current frame
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
98 */
13310
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
99 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
100 if (pagesToBang > 0) {
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
101 SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
102 final int frameSize = crb.frameMap.totalFrameSize();
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
103 if (frameSize > 0) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
104 int lastFramePage = frameSize / unsafe.pageSize();
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
105 // emit multiple stack bangs for methods with frames larger than a page
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
106 for (int i = 0; i <= lastFramePage; i++) {
13310
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
107 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
108 if (afterFrameInit) {
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
109 disp -= frameSize;
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
110 }
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
111 crb.blockComment("[stack overflow check]");
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
112 // 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
113 SPARCAddress address = new SPARCAddress(sp, -disp);
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
114 if (SPARCAssembler.isSimm13(address.getDisplacement())) {
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
115 masm.stx(g0, address);
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
116 } else {
19941
4fe66c16e942 [SPARC] (Re)move SPARCScratchRegister into the SPARCMacroAssembler to force usage only during assembly.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
117 try (ScratchRegister sc = masm.getScratchRegister()) {
17021
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
118 Register scratch = sc.getRegister();
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
119 new Setx(address.getDisplacement(), scratch).emit(masm);
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
120 masm.stx(g0, new SPARCAddress(sp, scratch));
17021
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
121 }
10694
31266ceb86ef SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents: 10686
diff changeset
122 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
123 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
124 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
125 }
9814
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
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
128 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
129
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
130 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
131
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
132 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
133 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
134 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
135
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
136 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
137 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
138 }
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
139
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
140 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
141 public void enter(CompilationResultBuilder crb) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
142 final int frameSize = crb.frameMap.totalFrameSize();
16933
f011bf910f34 [SPARC] Fix sign extension, add debug messages to assertions in Assembler, add FSMULD , Entering frame is now possible with > 2k framesize
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16929
diff changeset
143 final int stackpoinerChange = -frameSize;
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
144 SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
13310
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
145 if (!isStub && pagesToBang > 0) {
733cccc125ed added subqWide to AMD64Assembler
Doug Simon <doug.simon@oracle.com>
parents: 13252
diff changeset
146 emitStackOverflowCheck(crb, pagesToBang, false);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
147 }
16933
f011bf910f34 [SPARC] Fix sign extension, add debug messages to assertions in Assembler, add FSMULD , Entering frame is now possible with > 2k framesize
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16929
diff changeset
148
f011bf910f34 [SPARC] Fix sign extension, add debug messages to assertions in Assembler, add FSMULD , Entering frame is now possible with > 2k framesize
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16929
diff changeset
149 if (SPARCAssembler.isSimm13(stackpoinerChange)) {
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19677
diff changeset
150 masm.save(sp, stackpoinerChange, sp);
16933
f011bf910f34 [SPARC] Fix sign extension, add debug messages to assertions in Assembler, add FSMULD , Entering frame is now possible with > 2k framesize
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16929
diff changeset
151 } else {
19941
4fe66c16e942 [SPARC] (Re)move SPARCScratchRegister into the SPARCMacroAssembler to force usage only during assembly.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
152 try (ScratchRegister sc = masm.getScratchRegister()) {
17021
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
153 Register scratch = sc.getRegister();
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
154 new Setx(stackpoinerChange, scratch).emit(masm);
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19677
diff changeset
155 masm.save(sp, scratch, sp);
17021
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
156 }
16933
f011bf910f34 [SPARC] Fix sign extension, add debug messages to assertions in Assembler, add FSMULD , Entering frame is now possible with > 2k framesize
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16929
diff changeset
157 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
158
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
159 if (ZapStackOnMethodEntry.getValue()) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
160 final int slotSize = 8;
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
161 for (int i = 0; i < frameSize / slotSize; ++i) {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
162 // 0xC1C1C1C1
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
163 masm.stx(g0, new SPARCAddress(sp, i * slotSize));
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
164 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
165 }
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
166 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
167
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
168 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
169 public void leave(CompilationResultBuilder crb) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
170 SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19677
diff changeset
171 masm.restoreWindow();
9814
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
172 }
9432
6680389bd36f Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 8281
diff changeset
173 }
6680389bd36f Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 8281
diff changeset
174
6680389bd36f Make assembler creation in backend more extensible.
Roland Schatz <roland.schatz@oracle.com>
parents: 8281
diff changeset
175 @Override
14032
d1c1f103d42c renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
twisti
parents: 13839
diff changeset
176 protected Assembler createAssembler(FrameMap frameMap) {
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17295
diff changeset
177 return new SPARCMacroAssembler(getTarget(), frameMap.getRegisterConfig());
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
178 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
179
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
180 @Override
18149
aed00dc20923 Pass FrameMap to Backend.newCompilationResultBuilder().
Josef Eisl <josef.eisl@jku.at>
parents: 18148
diff changeset
181 public CompilationResultBuilder newCompilationResultBuilder(LIRGenerationResult lirGenRes, FrameMap frameMap, CompilationResult compilationResult, CompilationResultBuilderFactory factory) {
14809
73774616a6b3 Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents: 14807
diff changeset
182 SPARCHotSpotLIRGenerationResult gen = (SPARCHotSpotLIRGenerationResult) lirGenRes;
16645
8c70d65ec04a [SPARC] Fix issues when deoptimizing with floats in local scope.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16633
diff changeset
183 LIR lir = gen.getLIR();
16655
6514c67b7efa [SPARC] Fixed assertion for stackslot avalibility when deopt is possible
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16645
diff changeset
184 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
185
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
186 Stub stub = gen.getStub();
14032
d1c1f103d42c renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
twisti
parents: 13839
diff changeset
187 Assembler masm = createAssembler(frameMap);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
188 // On SPARC we always use stack frames.
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
189 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
190 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
191 crb.setTotalFrameSize(frameMap.totalFrameSize());
14807
c3242028cc44 Introduce specialized LIRGenerationResults for Targets if needed.
Josef Eisl <josef.eisl@jku.at>
parents: 14804
diff changeset
192 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
193 if (deoptimizationRescueSlot != null && stub == null) {
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
194 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
195 }
e723f9031785 re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents: 9621
diff changeset
196
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
197 if (stub != null) {
16645
8c70d65ec04a [SPARC] Fix issues when deoptimizing with floats in local scope.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16633
diff changeset
198 // Even on sparc we need to save floating point registers
8c70d65ec04a [SPARC] Fix issues when deoptimizing with floats in local scope.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16633
diff changeset
199 Set<Register> definedRegisters = gatherDefinedRegisters(lir);
8c70d65ec04a [SPARC] Fix issues when deoptimizing with floats in local scope.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16633
diff changeset
200 Map<LIRFrameState, SaveRegistersOp> calleeSaveInfo = gen.getCalleeSaveInfo();
8c70d65ec04a [SPARC] Fix issues when deoptimizing with floats in local scope.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16633
diff changeset
201 updateStub(stub, definedRegisters, calleeSaveInfo, frameMap);
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
202 }
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
203
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
204 return crb;
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
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207 @Override
14065
5dec26f3d4a4 Use LIR instead of LIRGenerator as parameter in emitCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14032
diff changeset
208 public void emitCode(CompilationResultBuilder crb, LIR lir, ResolvedJavaMethod installedCodeOwner) {
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
209 stuffDelayedControlTransfers(lir);
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
210 SPARCMacroAssembler masm = (SPARCMacroAssembler) crb.asm;
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
211 FrameMap frameMap = crb.frameMap;
18123
3c7e73362d6a Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents: 17295
diff changeset
212 RegisterConfig regConfig = frameMap.getRegisterConfig();
12431
7080a96be216 rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents: 12429
diff changeset
213 HotSpotVMConfig config = getRuntime().getConfig();
15311
820c6d353358 added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents: 15292
diff changeset
214 Label unverifiedStub = installedCodeOwner == null || installedCodeOwner.isStatic() ? null : new Label();
22050
5352b2437a2d [SPARC] Rescue CompilationResult.hasUnsafeAccess between to assembly passes.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21780
diff changeset
215 boolean hasUnsafeAccess = crb.compilationResult.hasUnsafeAccess();
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
216 int i = 0;
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
217 do {
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
218 if (i > 0) {
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
219 crb.reset();
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
220 lir.resetLabels();
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
221 resetDelayedControlTransfers(lir);
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
222 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
223
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
224 // Emit the prefix
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
225 if (unverifiedStub != null) {
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 20003
diff changeset
226 crb.recordMark(config.MARKID_UNVERIFIED_ENTRY);
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
227 // We need to use JavaCall here because we haven't entered the frame yet.
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
228 CallingConvention cc = regConfig.getCallingConvention(JavaCall, null, new JavaType[]{getProviders().getMetaAccess().lookupJavaType(Object.class)}, getTarget(), false);
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
229 Register inlineCacheKlass = g5; // see MacroAssembler::ic_call
17021
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
230
19941
4fe66c16e942 [SPARC] (Re)move SPARCScratchRegister into the SPARCMacroAssembler to force usage only during assembly.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
231 try (ScratchRegister sc = masm.getScratchRegister()) {
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
232 Register scratch = sc.getRegister();
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
233 Register receiver = asRegister(cc.getArgument(0));
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
234 SPARCAddress src = new SPARCAddress(receiver, config.hubOffset);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
235
19684
00d7b0adaf66 [SPARC] Change ld/st ops of SPARC to functions
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19682
diff changeset
236 masm.ldx(src, scratch);
19682
f1b4f2613702 [SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19677
diff changeset
237 masm.cmp(scratch, inlineCacheKlass);
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
238 }
19675
413ac504d74e [SPARC] Simplify branch instructions (No more object allocations), Tidy up SPARCControlFlow and SPARCAssembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19233
diff changeset
239 masm.bpcc(NotEqual, NOT_ANNUL, unverifiedStub, Xcc, PREDICT_NOT_TAKEN);
19677
7d3afd4356a2 [SPARC] Remove all object oriented fmt00 instructions (sethi, nop, cbcond) and use simple function calls
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19675
diff changeset
240 masm.nop(); // delay slot
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
241 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
242
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
243 masm.align(config.codeEntryAlignment);
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 20003
diff changeset
244 crb.recordMark(config.MARKID_OSR_ENTRY);
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 20003
diff changeset
245 crb.recordMark(config.MARKID_VERIFIED_ENTRY);
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
246
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
247 // Emit code for the LIR
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
248 crb.emit(lir);
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
249 } while (i++ < 1);
22050
5352b2437a2d [SPARC] Rescue CompilationResult.hasUnsafeAccess between to assembly passes.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21780
diff changeset
250 // Restore the unsafeAccess flag
5352b2437a2d [SPARC] Rescue CompilationResult.hasUnsafeAccess between to assembly passes.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21780
diff changeset
251 crb.compilationResult.setHasUnsafeAccess(hasUnsafeAccess);
20003
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19942
diff changeset
252 profileInstructions(lir, crb);
422e60a2f4b9 Implement dynamic instruction counters on assembly level
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19942
diff changeset
253
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
254 HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
255 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
256 if (!frameContext.isStub) {
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 20003
diff changeset
257 crb.recordMark(config.MARKID_EXCEPTION_HANDLER_ENTRY);
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 12610
diff changeset
258 SPARCCall.directCall(crb, masm, foreignCalls.lookupForeignCall(EXCEPTION_HANDLER), null, false, null);
21413
15a46a918fc1 removed unnecessary HotSpotCodeCache.MarkId enum (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 20003
diff changeset
259 crb.recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
15456
bb97b75d1d65 AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents: 15345
diff changeset
260 SPARCCall.directCall(crb, masm, foreignCalls.lookupForeignCall(DEOPTIMIZATION_HANDLER), null, false, null);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
261 } else {
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
262 // No need to emit the stubs for entries back into the method since
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
263 // it has no calls that can cause such "return" entries
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
264 }
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
265
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
266 if (unverifiedStub != null) {
10470
53ba9df05fa2 fixed remaining SPARC warnings using ecj
twisti
parents: 10465
diff changeset
267 masm.bind(unverifiedStub);
19941
4fe66c16e942 [SPARC] (Re)move SPARCScratchRegister into the SPARCMacroAssembler to force usage only during assembly.
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19685
diff changeset
268 try (ScratchRegister sc = masm.getScratchRegister()) {
17021
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
269 Register scratch = sc.getRegister();
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
270 SPARCCall.indirectJmp(crb, masm, scratch, foreignCalls.lookupForeignCall(IC_MISS_HANDLER));
c2437c80c253 [SPARC] Make scratch register usage safe
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16943
diff changeset
271 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents: 9864
diff changeset
272 }
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
273 }
13837
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13829
diff changeset
274
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
275 private static void resetDelayedControlTransfers(LIR lir) {
19567
4d70d150944f Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19233
diff changeset
276 for (AbstractBlockBase<?> block : lir.codeEmittingOrder()) {
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
277 for (LIRInstruction inst : lir.getLIRforBlock(block)) {
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
278 if (inst instanceof SPARCDelayedControlTransfer) {
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
279 ((SPARCDelayedControlTransfer) inst).resetState();
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
280 }
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
281 }
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
282 }
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
283 }
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
284
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
285 /**
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
286 * Fix-up over whole LIR.
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
287 *
19567
4d70d150944f Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19233
diff changeset
288 * @see #stuffDelayedControlTransfers(LIR, AbstractBlockBase)
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
289 * @param l
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
290 */
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
291 private static void stuffDelayedControlTransfers(LIR l) {
19567
4d70d150944f Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19233
diff changeset
292 for (AbstractBlockBase<?> b : l.codeEmittingOrder()) {
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
293 stuffDelayedControlTransfers(l, b);
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
294 }
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
295 }
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
296
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
297 /**
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
298 * Tries to put DelayedControlTransfer instructions and DelayableLIRInstructions together. Also
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
299 * it tries to move the DelayedLIRInstruction to the DelayedControlTransfer instruction, if
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
300 * possible.
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
301 */
19567
4d70d150944f Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19233
diff changeset
302 private static void stuffDelayedControlTransfers(LIR l, AbstractBlockBase<?> block) {
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
303 List<LIRInstruction> instructions = l.getLIRforBlock(block);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
304 if (instructions.size() >= 2) {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
305 LIRDependencyAccumulator acc = new LIRDependencyAccumulator();
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
306 SPARCDelayedControlTransfer delayedTransfer = null;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
307 int delayTransferPosition = -1;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
308 for (int i = instructions.size() - 1; i >= 0; i--) {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
309 LIRInstruction inst = instructions.get(i);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
310 boolean adjacent = delayTransferPosition - i == 1;
18701
28e46ea20c93 [SPARC] Attempt to fix the NullPointerException problem
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18529
diff changeset
311 if (!adjacent || inst.destroysCallerSavedRegisters() || leavesRegisterWindow(inst)) {
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
312 delayedTransfer = null;
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
313 }
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
314 if (inst instanceof SPARCDelayedControlTransfer) {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
315 delayedTransfer = (SPARCDelayedControlTransfer) inst;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
316 acc.start(inst);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
317 delayTransferPosition = i;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
318 } else if (delayedTransfer != null) {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
319 boolean overlap = acc.add(inst);
17207
5a7b82c1514e [SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17206
diff changeset
320 if (!overlap && inst instanceof SPARCTailDelayedLIRInstruction) {
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
321 // We have found a non overlapping LIR instruction which can be delayed
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
322 ((SPARCTailDelayedLIRInstruction) inst).setDelayedControlTransfer(delayedTransfer);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
323 delayedTransfer = null;
18701
28e46ea20c93 [SPARC] Attempt to fix the NullPointerException problem
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18529
diff changeset
324 // Removed the moving as it causes problems (Nullpointer exceptions)
28e46ea20c93 [SPARC] Attempt to fix the NullPointerException problem
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18529
diff changeset
325 // if (!adjacent) {
28e46ea20c93 [SPARC] Attempt to fix the NullPointerException problem
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18529
diff changeset
326 // // If not adjacent, we make it adjacent
28e46ea20c93 [SPARC] Attempt to fix the NullPointerException problem
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18529
diff changeset
327 // instructions.remove(i);
28e46ea20c93 [SPARC] Attempt to fix the NullPointerException problem
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18529
diff changeset
328 // instructions.add(delayTransferPosition - 1, inst);
28e46ea20c93 [SPARC] Attempt to fix the NullPointerException problem
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18529
diff changeset
329 // }
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
330 }
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
331 }
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
332 }
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
333 }
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
334 }
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
335
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
336 private static boolean leavesRegisterWindow(LIRInstruction inst) {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
337 return inst instanceof SPARCLIRInstruction && ((SPARCLIRInstruction) inst).leavesRegisterWindow();
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
338 }
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
339
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
340 /**
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
341 * Accumulates inputs/outputs/temp/alive in a set along we walk back the LIRInstructions and
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
342 * detects, if there is any overlap. In this way LIRInstructions can be detected, which can be
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
343 * moved nearer to the DelayedControlTransfer instruction.
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
344 */
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
345 private static class LIRDependencyAccumulator {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
346 private final Set<Object> inputs = new HashSet<>(10);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
347 private boolean overlap = false;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
348
17295
ae0496f76cce LIRIntrospection: use Lambdas wherever possible.
Josef Eisl <josef.eisl@jku.at>
parents: 17283
diff changeset
349 private final InstructionValueConsumer valueConsumer = (instruction, value, mode, flags) -> {
ae0496f76cce LIRIntrospection: use Lambdas wherever possible.
Josef Eisl <josef.eisl@jku.at>
parents: 17283
diff changeset
350 Object valueObject = value;
ae0496f76cce LIRIntrospection: use Lambdas wherever possible.
Josef Eisl <josef.eisl@jku.at>
parents: 17283
diff changeset
351 if (isRegister(value)) { // Canonicalize registers
ae0496f76cce LIRIntrospection: use Lambdas wherever possible.
Josef Eisl <josef.eisl@jku.at>
parents: 17283
diff changeset
352 valueObject = asRegister(value);
ae0496f76cce LIRIntrospection: use Lambdas wherever possible.
Josef Eisl <josef.eisl@jku.at>
parents: 17283
diff changeset
353 }
ae0496f76cce LIRIntrospection: use Lambdas wherever possible.
Josef Eisl <josef.eisl@jku.at>
parents: 17283
diff changeset
354 if (!inputs.add(valueObject)) {
ae0496f76cce LIRIntrospection: use Lambdas wherever possible.
Josef Eisl <josef.eisl@jku.at>
parents: 17283
diff changeset
355 overlap = true;
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
356 }
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
357 };
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
358
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
359 public void start(LIRInstruction initial) {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
360 inputs.clear();
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
361 overlap = false;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
362 initial.visitEachInput(valueConsumer);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
363 initial.visitEachTemp(valueConsumer);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
364 initial.visitEachAlive(valueConsumer);
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
365 }
17206
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
366
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
367 /**
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
368 * Adds the inputs of lir instruction to the accumulator and returns, true if there was any
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
369 * overlap of parameters.
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
370 *
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
371 * @param inst
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
372 * @return true if an overlap was found
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
373 */
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
374 public boolean add(LIRInstruction inst) {
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
375 overlap = false;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
376 inst.visitEachOutput(valueConsumer);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
377 inst.visitEachTemp(valueConsumer);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
378 inst.visitEachInput(valueConsumer);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
379 inst.visitEachAlive(valueConsumer);
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
380 return overlap;
2d401b9ca70d [SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17177
diff changeset
381 }
17177
805a26002dc7 [SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17021
diff changeset
382 }
21510
0ee2ed36d079 Backend: add #newRegisterAllocationConfig.
Josef Eisl <josef.eisl@jku.at>
parents: 21413
diff changeset
383
0ee2ed36d079 Backend: add #newRegisterAllocationConfig.
Josef Eisl <josef.eisl@jku.at>
parents: 21413
diff changeset
384 @Override
0ee2ed36d079 Backend: add #newRegisterAllocationConfig.
Josef Eisl <josef.eisl@jku.at>
parents: 21413
diff changeset
385 public RegisterAllocationConfig newRegisterAllocationConfig(RegisterConfig registerConfig) {
0ee2ed36d079 Backend: add #newRegisterAllocationConfig.
Josef Eisl <josef.eisl@jku.at>
parents: 21413
diff changeset
386 RegisterConfig registerConfigNonNull = registerConfig == null ? getCodeCache().getRegisterConfig() : registerConfig;
0ee2ed36d079 Backend: add #newRegisterAllocationConfig.
Josef Eisl <josef.eisl@jku.at>
parents: 21413
diff changeset
387 return new RegisterAllocationConfig(registerConfigNonNull);
0ee2ed36d079 Backend: add #newRegisterAllocationConfig.
Josef Eisl <josef.eisl@jku.at>
parents: 21413
diff changeset
388 }
7740
5f8101629080 Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
389 }