Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java @ 9968:3df534c97af1
Create Suites instance in runtime.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 10 Jun 2013 16:06:09 +0200 |
parents | 6b6d34f83eb1 |
children | b8b4d7f3e4aa |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4281
62cb0e636094
Copyright fixes
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4278
diff
changeset
|
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.compiler; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
25 import static com.oracle.graal.phases.GraalOptions.*; |
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
26 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import java.util.*; |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
28 import java.util.concurrent.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
6317
3ee3eb48e683
Clean up ComputeLinearScanOrder. Rename to ComputeBlockOrder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6316
diff
changeset
|
30 import com.oracle.graal.alloc.*; |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
31 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
|
32 import com.oracle.graal.api.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
33 import com.oracle.graal.compiler.alloc.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
34 import com.oracle.graal.compiler.gen.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
35 import com.oracle.graal.compiler.target.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
36 import com.oracle.graal.debug.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
37 import com.oracle.graal.lir.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.lir.asm.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 import com.oracle.graal.nodes.*; |
6529
2e96dc4eb8e2
renamed package: com.oracle.graal.lir.cfg -> com.oracle.graal.nodes.cfg
Doug Simon <doug.simon@oracle.com>
parents:
6526
diff
changeset
|
40 import com.oracle.graal.nodes.cfg.*; |
9954
fd0e5587a07d
Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9916
diff
changeset
|
41 import com.oracle.graal.nodes.extended.*; |
5720
46ad94a0574a
moved everything from com.oracle.graal.nodes.cri into com.oracle.graal.nodes.spi
Doug Simon <doug.simon@oracle.com>
parents:
5718
diff
changeset
|
42 import com.oracle.graal.nodes.spi.*; |
9238
8f01fe16e473
refactorings and cleanups for the removal of FixedNode.probability
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9234
diff
changeset
|
43 import com.oracle.graal.nodes.util.*; |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9833
diff
changeset
|
44 import com.oracle.graal.options.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6524
diff
changeset
|
45 import com.oracle.graal.phases.*; |
6650
ea38da80dd29
refactor PEA into separate classes
Lukas Stadler <lukas.stadler@jku.at>
parents:
6587
diff
changeset
|
46 import com.oracle.graal.phases.PhasePlan.PhasePosition; |
6526
ee651c726397
split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
47 import com.oracle.graal.phases.common.*; |
9238
8f01fe16e473
refactorings and cleanups for the removal of FixedNode.probability
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9234
diff
changeset
|
48 import com.oracle.graal.phases.graph.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6524
diff
changeset
|
49 import com.oracle.graal.phases.schedule.*; |
9001
94583d9eead8
HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
8983
diff
changeset
|
50 import com.oracle.graal.phases.tiers.*; |
9641
5e8299154973
verification: add VerifyPhase. check if a `Value' object is used in an ObjectEqualsNode
Bernhard Urban <bernhard.urban@jku.at>
parents:
9621
diff
changeset
|
51 import com.oracle.graal.phases.verify.*; |
6524
a206e077ffc8
rename packages in graal.virtual to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6523
diff
changeset
|
52 import com.oracle.graal.virtual.phases.ea.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
54 /** |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
55 * Static methods for orchestrating the compilation of a {@linkplain StructuredGraph graph}. |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
56 */ |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 public class GraalCompiler { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9833
diff
changeset
|
59 // @formatter:off |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9833
diff
changeset
|
60 @Option(help = "") |
9914
84890660eefb
cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents:
9912
diff
changeset
|
61 public static final OptionValue<Boolean> VerifyUsageWithEquals = new OptionValue<>(true); |
9855
6898d8995866
converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9849
diff
changeset
|
62 @Option(help = "Enable inlining") |
9914
84890660eefb
cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents:
9912
diff
changeset
|
63 public static final OptionValue<Boolean> Inline = new OptionValue<>(true); |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9833
diff
changeset
|
64 // @formatter:on |
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9833
diff
changeset
|
65 |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
66 /** |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
67 * Requests compilation of a given graph. |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
68 * |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
69 * @param graph the graph to be compiled |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
70 * @param cc the calling convention for calls to the code compiled for {@code graph} |
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
|
71 * @param installedCodeOwner the method the compiled code will be |
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
|
72 * {@linkplain InstalledCode#getMethod() associated} with once installed. This |
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
|
73 * argument can be null. |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
74 * @return the result of the compilation |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
75 */ |
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
|
76 public static CompilationResult compileGraph(final StructuredGraph graph, final CallingConvention cc, final ResolvedJavaMethod installedCodeOwner, final GraalCodeCacheProvider runtime, |
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
|
77 final Replacements replacements, final Backend backend, final TargetDescription target, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts, |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9967
diff
changeset
|
78 final SpeculationLog speculationLog, final Suites suites) { |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
79 final CompilationResult compilationResult = new CompilationResult(); |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
80 Debug.scope("GraalCompiler", new Object[]{graph, runtime}, new Runnable() { |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5891
diff
changeset
|
81 |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
82 public void run() { |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
83 final Assumptions assumptions = new Assumptions(OptAssumptions.getValue()); |
4613
09402dddc51e
Make the graph object always available in context (helps debugging problems during LIRGen)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4525
diff
changeset
|
84 final LIR lir = Debug.scope("FrontEnd", new Callable<LIR>() { |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5891
diff
changeset
|
85 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
86 public LIR call() { |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9967
diff
changeset
|
87 return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog, suites); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
88 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
89 }); |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
90 final LIRGenerator lirGen = Debug.scope("BackEnd", lir, new Callable<LIRGenerator>() { |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5891
diff
changeset
|
91 |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
92 public LIRGenerator call() { |
9614
59ec6eb8612e
removed LinearScan.method field
Doug Simon <doug.simon@oracle.com>
parents:
9613
diff
changeset
|
93 return emitLIR(backend, target, lir, graph, cc); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
94 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
95 }); |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
96 Debug.scope("CodeGen", lirGen, new Runnable() { |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5891
diff
changeset
|
97 |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
98 public void run() { |
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
|
99 emitCode(backend, getLeafGraphIdArray(graph), assumptions, lirGen, compilationResult, installedCodeOwner); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
100 } |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
101 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
102 }); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
104 }); |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
105 |
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
106 return compilationResult; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
108 |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
109 private static long[] getLeafGraphIdArray(StructuredGraph graph) { |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
110 long[] leafGraphIdArray = new long[graph.getLeafGraphIds().size() + 1]; |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
111 int i = 0; |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
112 leafGraphIdArray[i++] = graph.graphId(); |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
113 for (long id : graph.getLeafGraphIds()) { |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
114 leafGraphIdArray[i++] = id; |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
115 } |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
116 return leafGraphIdArray; |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
117 } |
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
118 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
119 /** |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
120 * Builds the graph, optimizes it. |
7835
72971ec0d7ae
Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7827
diff
changeset
|
121 * |
7836
a202f72872a4
Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
122 * @param runtime |
a202f72872a4
Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
123 * |
7835
72971ec0d7ae
Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7827
diff
changeset
|
124 * @param target |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
125 */ |
9234
b9cf7d0b598e
removal of FixedNode.probability (draft)
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9186
diff
changeset
|
126 public static LIR emitHIR(GraalCodeCacheProvider runtime, TargetDescription target, final StructuredGraph graph, Replacements replacements, Assumptions assumptions, GraphCache cache, |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9967
diff
changeset
|
127 PhasePlan plan, OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog, final Suites suites) { |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8207
diff
changeset
|
128 |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8207
diff
changeset
|
129 if (speculationLog != null) { |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8207
diff
changeset
|
130 speculationLog.snapshot(); |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8207
diff
changeset
|
131 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
132 |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
133 if (graph.start().next() == null) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
134 plan.runPhases(PhasePosition.AFTER_PARSING, graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
135 new DeadCodeEliminationPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
136 } else { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
137 Debug.dump(graph, "initial state"); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
138 } |
9849
e876c2a6954f
extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9833
diff
changeset
|
139 if (VerifyUsageWithEquals.getValue()) { |
9833
716664350f87
Flag to disable VerifyUsageWithEquals phase
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9788
diff
changeset
|
140 new VerifyUsageWithEquals(runtime, Value.class).apply(graph); |
716664350f87
Flag to disable VerifyUsageWithEquals phase
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9788
diff
changeset
|
141 new VerifyUsageWithEquals(runtime, Register.class).apply(graph); |
716664350f87
Flag to disable VerifyUsageWithEquals phase
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9788
diff
changeset
|
142 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 |
9908
91295caf53b6
CanonicalizerPhase: add OptCanonicalizeReads option (GRAAL-290)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9906
diff
changeset
|
144 CanonicalizerPhase canonicalizer = new CanonicalizerPhase(OptCanonicalizeReads.getValue()); |
9916
491cd7d69539
CanonicalizerPhase: remove it from context, add it to tiers instead and configure/pass it there (GRAAL-309)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9914
diff
changeset
|
145 HighTierContext highTierContext = new HighTierContext(runtime, assumptions, replacements); |
9906
fc93d919f896
PhaseContext: add an instance of CanonicalizerPhase to context
Bernhard Urban <bernhard.urban@jku.at>
parents:
9864
diff
changeset
|
146 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
147 if (OptCanonicalizer.getValue()) { |
9916
491cd7d69539
CanonicalizerPhase: remove it from context, add it to tiers instead and configure/pass it there (GRAAL-309)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9914
diff
changeset
|
148 canonicalizer.apply(graph, highTierContext); |
5099
e35e2aa5ebad
Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5085
diff
changeset
|
149 } |
e35e2aa5ebad
Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5085
diff
changeset
|
150 |
9855
6898d8995866
converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9849
diff
changeset
|
151 if (Inline.getValue() && !plan.isPhaseDisabled(InliningPhase.class)) { |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
152 if (IterativeInlining.getValue()) { |
9967
6b6d34f83eb1
IterativeInliningPhase: obtain replacements from context
Bernhard Urban <bernhard.urban@jku.at>
parents:
9956
diff
changeset
|
153 new IterativeInliningPhase(cache, plan, optimisticOpts, canonicalizer).apply(graph, highTierContext); |
8548
51d5999900e2
simple iterative inlining, simple read elimination in PEA
Lukas Stadler <lukas.stadler@jku.at>
parents:
8506
diff
changeset
|
154 } else { |
8636
ac4dbfecec8f
passed a Replacements object to inlining utility methods that need one instead of the GraalRuntime API
Doug Simon <doug.simon@oracle.com>
parents:
8622
diff
changeset
|
155 new InliningPhase(runtime, null, replacements, assumptions, cache, plan, optimisticOpts).apply(graph); |
8559
af0c1352f969
more work on read elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
8548
diff
changeset
|
156 new DeadCodeEliminationPhase().apply(graph); |
5864
59f209dd356b
Be more precise on the set of node that are canonicalized in IterativeCheckCastElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5859
diff
changeset
|
157 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
158 if (ConditionalElimination.getValue() && OptCanonicalizer.getValue()) { |
9916
491cd7d69539
CanonicalizerPhase: remove it from context, add it to tiers instead and configure/pass it there (GRAAL-309)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9914
diff
changeset
|
159 canonicalizer.apply(graph, highTierContext); |
9136
2cfdde003076
Make IterativeConditionalEliminationPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9122
diff
changeset
|
160 new IterativeConditionalEliminationPhase().apply(graph, highTierContext); |
8559
af0c1352f969
more work on read elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
8548
diff
changeset
|
161 } |
5204
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
162 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
163 } |
9530
2777aafe689b
TypeProfileProxy: remove profile proxies after inlining logic
Bernhard Urban <bernhard.urban@jku.at>
parents:
9511
diff
changeset
|
164 TypeProfileProxyNode.cleanFromGraph(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
165 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
166 plan.runPhases(PhasePosition.HIGH_LEVEL, graph); |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9967
diff
changeset
|
167 suites.getHighTier().apply(graph, highTierContext); |
8600
c423a5fd8ac7
Cull frame states before lowering.
Roland Schatz <roland.schatz@oracle.com>
parents:
8560
diff
changeset
|
168 |
9916
491cd7d69539
CanonicalizerPhase: remove it from context, add it to tiers instead and configure/pass it there (GRAAL-309)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9914
diff
changeset
|
169 MidTierContext midTierContext = new MidTierContext(runtime, assumptions, replacements, target, optimisticOpts); |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9967
diff
changeset
|
170 suites.getMidTier().apply(graph, midTierContext); |
8534
4f33d1871dca
pipeline: canonicalize after ConditionalElimination and EliminatePartiallyRedundantGuards
Bernhard Urban <bernhard.urban@jku.at>
parents:
8506
diff
changeset
|
171 |
8935
81ef56feff1b
Move write barriers' addition to a separate stage after lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8896
diff
changeset
|
172 plan.runPhases(PhasePosition.LOW_LEVEL, graph); |
81ef56feff1b
Move write barriers' addition to a separate stage after lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8896
diff
changeset
|
173 |
9916
491cd7d69539
CanonicalizerPhase: remove it from context, add it to tiers instead and configure/pass it there (GRAAL-309)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9914
diff
changeset
|
174 LowTierContext lowTierContext = new LowTierContext(runtime, assumptions, replacements, target); |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9967
diff
changeset
|
175 suites.getLowTier().apply(graph, lowTierContext); |
9954
fd0e5587a07d
Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9916
diff
changeset
|
176 |
fd0e5587a07d
Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9916
diff
changeset
|
177 // we do not want to store statistics about OSR compilations because it may prevent inlining |
fd0e5587a07d
Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9916
diff
changeset
|
178 boolean isOSRCompilation = graph.start() instanceof OSRStartNode; |
fd0e5587a07d
Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9916
diff
changeset
|
179 if (!isOSRCompilation) { |
fd0e5587a07d
Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9916
diff
changeset
|
180 InliningPhase.storeStatisticsAfterLowTier(graph); |
fd0e5587a07d
Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9916
diff
changeset
|
181 } |
9264
3df022b2eebe
LowTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
9251
diff
changeset
|
182 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
183 final SchedulePhase schedule = new SchedulePhase(); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
184 schedule.apply(graph); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4477
diff
changeset
|
185 Debug.dump(schedule, "final schedule"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
186 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
187 final Block[] blocks = schedule.getCFG().getBlocks(); |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
188 final Block startBlock = schedule.getCFG().getStartBlock(); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
189 assert startBlock != null; |
7497
0f8c6dbf68be
Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7493
diff
changeset
|
190 assert startBlock.getPredecessorCount() == 0; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
191 |
5013
25a46490146e
Use context instead of individual dump calls to pass helper objects to CFG printer
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4648
diff
changeset
|
192 return Debug.scope("ComputeLinearScanOrder", new Callable<LIR>() { |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
193 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
194 @Override |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
195 public LIR call() { |
9238
8f01fe16e473
refactorings and cleanups for the removal of FixedNode.probability
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9234
diff
changeset
|
196 NodesToDoubles nodeProbabilities = new ComputeProbabilityClosure(graph).apply(); |
9234
b9cf7d0b598e
removal of FixedNode.probability (draft)
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9186
diff
changeset
|
197 List<Block> codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blocks.length, startBlock, nodeProbabilities); |
b9cf7d0b598e
removal of FixedNode.probability (draft)
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9186
diff
changeset
|
198 List<Block> linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.length, startBlock, nodeProbabilities); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
199 |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8207
diff
changeset
|
200 LIR lir = new LIR(schedule.getCFG(), schedule.getBlockToNodesMap(), linearScanOrder, codeEmittingOrder, speculationLog); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
201 Debug.dump(lir, "After linear scan order"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
202 return lir; |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
203 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
205 }); |
7307
dc3e86fd3be1
Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7246
diff
changeset
|
206 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 |
9614
59ec6eb8612e
removed LinearScan.method field
Doug Simon <doug.simon@oracle.com>
parents:
9613
diff
changeset
|
209 public static LIRGenerator emitLIR(Backend backend, final TargetDescription target, final LIR lir, StructuredGraph graph, CallingConvention cc) { |
7838
a063308816d9
Complete first PTX unit test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7837
diff
changeset
|
210 final FrameMap frameMap = backend.newFrameMap(); |
9613
0c17815817a4
removed LIRGenerator.method field
Doug Simon <doug.simon@oracle.com>
parents:
9612
diff
changeset
|
211 final LIRGenerator lirGen = backend.newLIRGenerator(graph, frameMap, cc, lir); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
212 |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
213 Debug.scope("LIRGen", lirGen, new Runnable() { |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5891
diff
changeset
|
214 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
215 public void run() { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
216 for (Block b : lir.linearScanOrder()) { |
7370
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
217 emitBlock(b); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
218 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4477
diff
changeset
|
220 Debug.dump(lir, "After LIR generation"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
221 } |
7370
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
222 |
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
223 private void emitBlock(Block b) { |
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
224 if (lir.lir(b) == null) { |
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
225 for (Block pred : b.getPredecessors()) { |
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
226 if (!b.isLoopHeader() || !pred.isLoopEnd()) { |
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
227 emitBlock(pred); |
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
228 } |
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
229 } |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
230 lirGen.doBlock(b); |
7370
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
231 } |
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
232 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
233 }); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
234 |
8282
59744882ddeb
moved logic for reserving a special area/slot in a frame (e.g., for use during deoptimization) out of FrameMap and into platform specific backend class
Doug Simon <doug.simon@oracle.com>
parents:
8281
diff
changeset
|
235 lirGen.beforeRegisterAllocation(); |
59744882ddeb
moved logic for reserving a special area/slot in a frame (e.g., for use during deoptimization) out of FrameMap and into platform specific backend class
Doug Simon <doug.simon@oracle.com>
parents:
8281
diff
changeset
|
236 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
237 Debug.scope("Allocator", new Runnable() { |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5891
diff
changeset
|
238 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
239 public void run() { |
9614
59ec6eb8612e
removed LinearScan.method field
Doug Simon <doug.simon@oracle.com>
parents:
9613
diff
changeset
|
240 new LinearScan(target, lir, lirGen, frameMap).allocate(); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
241 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
242 }); |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
243 return lirGen; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 |
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
|
246 public static void emitCode(Backend backend, long[] leafGraphIds, Assumptions assumptions, LIRGenerator lirGen, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner) { |
8281
8fde1be81b2d
LIRGenerator is transmitted across backend passes instead of just the LIR so that backend-specific, per-compilation information can be attached to the backend-specific LIRGenerator object
Doug Simon <doug.simon@oracle.com>
parents:
8271
diff
changeset
|
247 TargetMethodAssembler tasm = backend.newAssembler(lirGen, compilationResult); |
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
|
248 backend.emitCode(tasm, lirGen, installedCodeOwner); |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
249 CompilationResult result = tasm.finishTargetMethod(lirGen.getGraph()); |
7064
8d16b9b2c51e
first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7063
diff
changeset
|
250 if (!assumptions.isEmpty()) { |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
251 result.setAssumptions(assumptions); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 } |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
253 result.setLeafGraphIds(leafGraphIds); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 |
7660
0b646334c5f7
keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents:
7539
diff
changeset
|
255 Debug.dump(result, "After code generation"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 } |