annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java @ 10055:9469034773b2

Fixed an issue concerning statistics for OSR compilations.
author Christian Haeubl <haeubl@ssw.jku.at>
date Fri, 14 Jun 2013 15:52:59 +0200
parents b5c87b5c6e9c
children 9c7d9e2c8326
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.*;
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
41 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
42 import com.oracle.graal.nodes.util.*;
9849
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9833
diff changeset
43 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
44 import com.oracle.graal.phases.*;
6650
ea38da80dd29 refactor PEA into separate classes
Lukas Stadler <lukas.stadler@jku.at>
parents: 6587
diff changeset
45 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
46 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
47 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
48 import com.oracle.graal.phases.schedule.*;
9001
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents: 8983
diff changeset
49 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
50 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
51 import com.oracle.graal.virtual.phases.ea.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52
9615
1089d63ef168 removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents: 9614
diff changeset
53 /**
1089d63ef168 removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents: 9614
diff changeset
54 * 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
55 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 public class GraalCompiler {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57
9849
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9833
diff changeset
58 // @formatter:off
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9833
diff changeset
59 @Option(help = "")
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
60 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
61 @Option(help = "Enable inlining")
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
62 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
63 // @formatter:on
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9833
diff changeset
64
9615
1089d63ef168 removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents: 9614
diff changeset
65 /**
1089d63ef168 removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents: 9614
diff changeset
66 * 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
67 *
1089d63ef168 removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents: 9614
diff changeset
68 * @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
69 * @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
70 * @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
71 * {@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
72 * 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
73 * @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
74 */
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
75 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
76 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
77 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
78 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
79 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
80
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
81 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
82 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
83 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
84
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
85 public LIR call() {
9968
3df534c97af1 Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9967
diff changeset
86 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
87 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
88 });
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
89 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
90
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
91 public LIRGenerator call() {
9614
59ec6eb8612e removed LinearScan.method field
Doug Simon <doug.simon@oracle.com>
parents: 9613
diff changeset
92 return emitLIR(backend, target, lir, graph, cc);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
93 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
94 });
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
95 Debug.scope("CodeGen", lirGen, new Runnable() {
6316
2e25b9c14b84 Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5891
diff changeset
96
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
97 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
98 emitCode(backend, getLeafGraphIdArray(graph), assumptions, lirGen, compilationResult, installedCodeOwner);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
99 }
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
100
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
101 });
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
103 });
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
104
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 return compilationResult;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
108 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
109 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
110 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
111 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
112 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
113 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
114 }
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
115 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
116 }
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
117
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
118 /**
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
119 * Builds the graph, optimizes it.
7835
72971ec0d7ae Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7827
diff changeset
120 *
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
121 * @param runtime
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
122 *
7835
72971ec0d7ae Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7827
diff changeset
123 * @param target
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
124 */
9234
b9cf7d0b598e removal of FixedNode.probability (draft)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9186
diff changeset
125 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
126 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
127
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
128 if (speculationLog != null) {
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
129 speculationLog.snapshot();
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
130 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
131
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
132 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
133 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
134 new DeadCodeEliminationPhase().apply(graph);
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
135 } else {
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
136 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
137 }
9849
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9833
diff changeset
138 if (VerifyUsageWithEquals.getValue()) {
9833
716664350f87 Flag to disable VerifyUsageWithEquals phase
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9788
diff changeset
139 new VerifyUsageWithEquals(runtime, Value.class).apply(graph);
716664350f87 Flag to disable VerifyUsageWithEquals phase
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9788
diff changeset
140 new VerifyUsageWithEquals(runtime, Register.class).apply(graph);
716664350f87 Flag to disable VerifyUsageWithEquals phase
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9788
diff changeset
141 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142
10009
b5c87b5c6e9c add option to enable ahead of time compilation for hotspot (GRAAL-290)
Bernhard Urban <bernhard.urban@jku.at>
parents: 9969
diff changeset
143 CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.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
144 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
145
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9855
diff changeset
146 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
147 canonicalizer.apply(graph, highTierContext);
5099
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
148 }
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
149
9855
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9849
diff changeset
150 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
151 if (IterativeInlining.getValue()) {
9967
6b6d34f83eb1 IterativeInliningPhase: obtain replacements from context
Bernhard Urban <bernhard.urban@jku.at>
parents: 9956
diff changeset
152 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
153 } 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
154 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
155 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
156
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9855
diff changeset
157 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
158 canonicalizer.apply(graph, highTierContext);
9136
2cfdde003076 Make IterativeConditionalEliminationPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents: 9122
diff changeset
159 new IterativeConditionalEliminationPhase().apply(graph, highTierContext);
8559
af0c1352f969 more work on read elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 8548
diff changeset
160 }
5204
0a53ed842cb8 Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5177
diff changeset
161 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
162 }
9530
2777aafe689b TypeProfileProxy: remove profile proxies after inlining logic
Bernhard Urban <bernhard.urban@jku.at>
parents: 9511
diff changeset
163 TypeProfileProxyNode.cleanFromGraph(graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
164
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
165 plan.runPhases(PhasePosition.HIGH_LEVEL, graph);
9968
3df534c97af1 Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents: 9967
diff changeset
166 suites.getHighTier().apply(graph, highTierContext);
8600
c423a5fd8ac7 Cull frame states before lowering.
Roland Schatz <roland.schatz@oracle.com>
parents: 8560
diff changeset
167
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
168 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
169 suites.getMidTier().apply(graph, midTierContext);
8534
4f33d1871dca pipeline: canonicalize after ConditionalElimination and EliminatePartiallyRedundantGuards
Bernhard Urban <bernhard.urban@jku.at>
parents: 8506
diff changeset
170
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
171 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
172 suites.getLowTier().apply(graph, lowTierContext);
9954
fd0e5587a07d Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9916
diff changeset
173
fd0e5587a07d Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9916
diff changeset
174 // we do not want to store statistics about OSR compilations because it may prevent inlining
10055
9469034773b2 Fixed an issue concerning statistics for OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 10009
diff changeset
175 if (!graph.isOSR()) {
9954
fd0e5587a07d Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9916
diff changeset
176 InliningPhase.storeStatisticsAfterLowTier(graph);
fd0e5587a07d Avoid storing statistics about OSR compilations.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9916
diff changeset
177 }
9264
3df022b2eebe LowTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents: 9251
diff changeset
178
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
179 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
180 schedule.apply(graph);
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4477
diff changeset
181 Debug.dump(schedule, "final schedule");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
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 Block[] blocks = schedule.getCFG().getBlocks();
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
184 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
185 assert startBlock != null;
7497
0f8c6dbf68be Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7493
diff changeset
186 assert startBlock.getPredecessorCount() == 0;
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
187
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
188 return Debug.scope("ComputeLinearScanOrder", new Callable<LIR>() {
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
189
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
190 @Override
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
191 public LIR call() {
9238
8f01fe16e473 refactorings and cleanups for the removal of FixedNode.probability
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9234
diff changeset
192 NodesToDoubles nodeProbabilities = new ComputeProbabilityClosure(graph).apply();
9234
b9cf7d0b598e removal of FixedNode.probability (draft)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9186
diff changeset
193 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
194 List<Block> linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.length, startBlock, nodeProbabilities);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
195
8217
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
196 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
197 Debug.dump(lir, "After linear scan order");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
198 return lir;
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
199
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
200 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
201 });
7307
dc3e86fd3be1 Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7246
diff changeset
202
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
203 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
204
9614
59ec6eb8612e removed LinearScan.method field
Doug Simon <doug.simon@oracle.com>
parents: 9613
diff changeset
205 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
206 final FrameMap frameMap = backend.newFrameMap();
9613
0c17815817a4 removed LIRGenerator.method field
Doug Simon <doug.simon@oracle.com>
parents: 9612
diff changeset
207 final LIRGenerator lirGen = backend.newLIRGenerator(graph, frameMap, cc, lir);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
208
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
209 Debug.scope("LIRGen", lirGen, new Runnable() {
6316
2e25b9c14b84 Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5891
diff changeset
210
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
211 public void run() {
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
212 for (Block b : lir.linearScanOrder()) {
7370
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
213 emitBlock(b);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
214 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
215
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4477
diff changeset
216 Debug.dump(lir, "After LIR generation");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
217 }
7370
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
218
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
219 private void emitBlock(Block b) {
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
220 if (lir.lir(b) == null) {
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
221 for (Block pred : b.getPredecessors()) {
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
222 if (!b.isLoopHeader() || !pred.isLoopEnd()) {
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
223 emitBlock(pred);
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
224 }
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
225 }
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
226 lirGen.doBlock(b);
7370
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
227 }
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
228 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
229 });
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
230
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
231 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
232
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
233 Debug.scope("Allocator", new Runnable() {
6316
2e25b9c14b84 Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5891
diff changeset
234
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
235 public void run() {
9614
59ec6eb8612e removed LinearScan.method field
Doug Simon <doug.simon@oracle.com>
parents: 9613
diff changeset
236 new LinearScan(target, lir, lirGen, frameMap).allocate();
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
237 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
238 });
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
239 return lirGen;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
241
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
242 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
243 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
244 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
245 CompilationResult result = tasm.finishTargetMethod(lirGen.getGraph());
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7063
diff changeset
246 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
247 result.setAssumptions(assumptions);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
248 }
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
249 result.setLeafGraphIds(leafGraphIds);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250
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 Debug.dump(result, "After code generation");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
252 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 }