annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java @ 8892:2c0c708a0ad6

Introduce DeoptimizingNode interface
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 08 Apr 2013 09:26:06 +0200
parents 63400866de15
children aa291d601ee8
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
5068
6e7c1fb1980f enabled wrappers for native method calls
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5061
diff changeset
25 import java.lang.reflect.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26 import java.util.*;
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
27 import java.util.concurrent.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
6317
3ee3eb48e683 Clean up ComputeLinearScanOrder. Rename to ComputeBlockOrder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6316
diff changeset
29 import com.oracle.graal.alloc.*;
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
30 import com.oracle.graal.api.code.*;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5499
diff changeset
31 import com.oracle.graal.api.meta.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
32 import com.oracle.graal.compiler.alloc.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
33 import com.oracle.graal.compiler.gen.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
34 import com.oracle.graal.compiler.target.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
35 import com.oracle.graal.debug.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
36 import com.oracle.graal.lir.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
37 import com.oracle.graal.lir.asm.*;
6523
c8763a2deb0c rename packages in graal.loop to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6520
diff changeset
38 import com.oracle.graal.loop.phases.*;
5060
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.*;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6524
diff changeset
42 import com.oracle.graal.phases.*;
6650
ea38da80dd29 refactor PEA into separate classes
Lukas Stadler <lukas.stadler@jku.at>
parents: 6587
diff changeset
43 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
44 import com.oracle.graal.phases.common.*;
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.schedule.*;
6524
a206e077ffc8 rename packages in graal.virtual to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6523
diff changeset
46 import com.oracle.graal.virtual.phases.ea.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 public class GraalCompiler {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49
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
50 public static CompilationResult compileMethod(final GraalCodeCacheProvider runtime, final Replacements replacements, final Backend backend, final TargetDescription target,
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
51 final ResolvedJavaMethod method, final StructuredGraph graph, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts,
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
52 final SpeculationLog speculationLog) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6529
diff changeset
53 assert (method.getModifiers() & Modifier.NATIVE) == 0 : "compiling native methods is not supported";
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4477
diff changeset
54
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
55 final CompilationResult compilationResult = new CompilationResult();
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
56 Debug.scope("GraalCompiler", new Object[]{graph, method, runtime}, new Runnable() {
6316
2e25b9c14b84 Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5891
diff changeset
57
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
58 public void run() {
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7063
diff changeset
59 final Assumptions assumptions = new Assumptions(GraalOptions.OptAssumptions);
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
60 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
61
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
62 public LIR call() {
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
63 return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
64 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
65 });
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
66 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
67
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
68 public LIRGenerator call() {
7838
a063308816d9 Complete first PTX unit test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7837
diff changeset
69 return emitLIR(backend, target, lir, graph, method);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
70 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
71 });
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
72 Debug.scope("CodeGen", lirGen, new Runnable() {
6316
2e25b9c14b84 Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5891
diff changeset
73
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
74 public void run() {
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
75 emitCode(backend, getLeafGraphIdArray(graph), assumptions, method, lirGen, compilationResult);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
76 }
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
77
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
78 });
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
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
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 return compilationResult;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
85 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
86 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
87 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
88 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
89 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
90 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
91 }
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
92 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
93 }
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
94
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
95 /**
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
96 * Builds the graph, optimizes it.
7835
72971ec0d7ae Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7827
diff changeset
97 *
7836
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
98 * @param runtime
a202f72872a4 Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7835
diff changeset
99 *
7835
72971ec0d7ae Remove usage of GraalCompiler.target field.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7827
diff changeset
100 * @param target
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
101 */
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
102 public static LIR emitHIR(GraalCodeCacheProvider runtime, TargetDescription target, StructuredGraph graph, Replacements replacements, Assumptions assumptions, GraphCache cache, PhasePlan plan,
8217
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
103 OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog) {
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
104
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
105 if (speculationLog != null) {
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
106 speculationLog.snapshot();
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
107 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
108
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
109 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
110 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
111 new DeadCodeEliminationPhase().apply(graph);
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
112 } else {
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
113 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
114 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
115
5204
0a53ed842cb8 Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5177
diff changeset
116 if (GraalOptions.ProbabilityAnalysis && graph.start().probability() == 0) {
0a53ed842cb8 Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5177
diff changeset
117 new ComputeProbabilityPhase().apply(graph);
0a53ed842cb8 Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5177
diff changeset
118 }
0a53ed842cb8 Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5177
diff changeset
119
5099
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
120 if (GraalOptions.OptCanonicalizer) {
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
121 new CanonicalizerPhase(runtime, assumptions).apply(graph);
5099
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
122 }
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
123
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
124 if (GraalOptions.Inline && !plan.isPhaseDisabled(InliningPhase.class)) {
8548
51d5999900e2 simple iterative inlining, simple read elimination in PEA
Lukas Stadler <lukas.stadler@jku.at>
parents: 8506
diff changeset
125 if (GraalOptions.IterativeInlining) {
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
126 new IterativeInliningPhase(runtime, replacements, assumptions, cache, plan, optimisticOpts, GraalOptions.OptEarlyReadElimination).apply(graph);
8548
51d5999900e2 simple iterative inlining, simple read elimination in PEA
Lukas Stadler <lukas.stadler@jku.at>
parents: 8506
diff changeset
127 } 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
128 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
129 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
130
8559
af0c1352f969 more work on read elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 8548
diff changeset
131 if (GraalOptions.ConditionalElimination && GraalOptions.OptCanonicalizer) {
af0c1352f969 more work on read elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 8548
diff changeset
132 new CanonicalizerPhase(runtime, assumptions).apply(graph);
af0c1352f969 more work on read elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 8548
diff changeset
133 new IterativeConditionalEliminationPhase(runtime, assumptions).apply(graph);
af0c1352f969 more work on read elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 8548
diff changeset
134 }
5204
0a53ed842cb8 Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5177
diff changeset
135 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
136 }
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
137
6316
2e25b9c14b84 Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5891
diff changeset
138 // new ConvertUnreachedToGuardPhase(optimisticOpts).apply(graph);
4648
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
139
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
140 plan.runPhases(PhasePosition.HIGH_LEVEL, graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
141
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5547
diff changeset
142 if (GraalOptions.FullUnroll) {
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7063
diff changeset
143 new LoopFullUnrollPhase(runtime, assumptions).apply(graph);
5882
fdec6dbeb3a1 canonicalize after FullUnroll
Lukas Stadler <lukas.stadler@jku.at>
parents: 5864
diff changeset
144 if (GraalOptions.OptCanonicalizer) {
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
145 new CanonicalizerPhase(runtime, assumptions).apply(graph);
5882
fdec6dbeb3a1 canonicalize after FullUnroll
Lukas Stadler <lukas.stadler@jku.at>
parents: 5864
diff changeset
146 }
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5547
diff changeset
147 }
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5547
diff changeset
148
6519
feabae0d6bdc move TailDuplication to before lowering and escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6462
diff changeset
149 if (GraalOptions.OptTailDuplication) {
feabae0d6bdc move TailDuplication to before lowering and escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6462
diff changeset
150 new TailDuplicationPhase().apply(graph);
feabae0d6bdc move TailDuplication to before lowering and escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6462
diff changeset
151 if (GraalOptions.OptCanonicalizer) {
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
152 new CanonicalizerPhase(runtime, assumptions).apply(graph);
6519
feabae0d6bdc move TailDuplication to before lowering and escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6462
diff changeset
153 }
feabae0d6bdc move TailDuplication to before lowering and escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6462
diff changeset
154 }
feabae0d6bdc move TailDuplication to before lowering and escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6462
diff changeset
155
6360
e5203e5843fc first prototype of new PartialEscapeAnalysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6356
diff changeset
156 if (GraalOptions.PartialEscapeAnalysis && !plan.isPhaseDisabled(PartialEscapeAnalysisPhase.class)) {
8622
d8f28e2e2b49 make read elimination configurable (for tests)
Lukas Stadler <lukas.stadler@jku.at>
parents: 8600
diff changeset
157 new PartialEscapeAnalysisPhase(runtime, assumptions, true, GraalOptions.OptEarlyReadElimination).apply(graph);
6360
e5203e5843fc first prototype of new PartialEscapeAnalysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6356
diff changeset
158 }
7493
741ceb12ff7d Implement basic lock elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7370
diff changeset
159
8271
f5e26f69f164 Create option for convert deoptimize to guard phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8217
diff changeset
160 if (GraalOptions.OptConvertDeoptsToGuards) {
f5e26f69f164 Create option for convert deoptimize to guard phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8217
diff changeset
161 new ConvertDeoptimizeToGuardPhase().apply(graph);
f5e26f69f164 Create option for convert deoptimize to guard phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8217
diff changeset
162 }
f5e26f69f164 Create option for convert deoptimize to guard phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8217
diff changeset
163
7493
741ceb12ff7d Implement basic lock elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7370
diff changeset
164 new LockEliminationPhase().apply(graph);
741ceb12ff7d Implement basic lock elimination phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7370
diff changeset
165
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5547
diff changeset
166 if (GraalOptions.OptLoopTransform) {
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5547
diff changeset
167 new LoopTransformHighPhase().apply(graph);
7246
cccec951cb76 Move loop unswitching before lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7099
diff changeset
168 new LoopTransformLowPhase().apply(graph);
5204
0a53ed842cb8 Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5177
diff changeset
169 }
7246
cccec951cb76 Move loop unswitching before lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7099
diff changeset
170 new RemoveValueProxyPhase().apply(graph);
cccec951cb76 Move loop unswitching before lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7099
diff changeset
171
8600
c423a5fd8ac7 Cull frame states before lowering.
Roland Schatz <roland.schatz@oracle.com>
parents: 8560
diff changeset
172 if (GraalOptions.CullFrameStates) {
c423a5fd8ac7 Cull frame states before lowering.
Roland Schatz <roland.schatz@oracle.com>
parents: 8560
diff changeset
173 new CullFrameStatesPhase().apply(graph);
c423a5fd8ac7 Cull frame states before lowering.
Roland Schatz <roland.schatz@oracle.com>
parents: 8560
diff changeset
174 }
c423a5fd8ac7 Cull frame states before lowering.
Roland Schatz <roland.schatz@oracle.com>
parents: 8560
diff changeset
175
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5204
diff changeset
176 if (GraalOptions.OptCanonicalizer) {
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
177 new CanonicalizerPhase(runtime, assumptions).apply(graph);
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5204
diff changeset
178 }
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
179
8638
8d6265614e13 added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents: 8637
diff changeset
180 new LoweringPhase(target, runtime, replacements, assumptions).apply(graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
181
8657
63400866de15 pipeline: include PushNodesThroughPi
Bernhard Urban <bernhard.urban@jku.at>
parents: 8638
diff changeset
182 if (GraalOptions.OptPushThroughPi) {
63400866de15 pipeline: include PushNodesThroughPi
Bernhard Urban <bernhard.urban@jku.at>
parents: 8638
diff changeset
183 new PushNodesThroughPi().apply(graph);
63400866de15 pipeline: include PushNodesThroughPi
Bernhard Urban <bernhard.urban@jku.at>
parents: 8638
diff changeset
184 if (GraalOptions.OptCanonicalizer) {
63400866de15 pipeline: include PushNodesThroughPi
Bernhard Urban <bernhard.urban@jku.at>
parents: 8638
diff changeset
185 new CanonicalizerPhase(runtime, assumptions).apply(graph);
63400866de15 pipeline: include PushNodesThroughPi
Bernhard Urban <bernhard.urban@jku.at>
parents: 8638
diff changeset
186 }
63400866de15 pipeline: include PushNodesThroughPi
Bernhard Urban <bernhard.urban@jku.at>
parents: 8638
diff changeset
187 }
63400866de15 pipeline: include PushNodesThroughPi
Bernhard Urban <bernhard.urban@jku.at>
parents: 8638
diff changeset
188
6670
81ad987772f6 Cleanup GraalOption : removed defunct options
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6669
diff changeset
189 if (GraalOptions.OptFloatingReads) {
5845
421e767d8038 Make FloatingRead phase respect loop closed form and use PostOrderNodeIterator
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5834
diff changeset
190 int mark = graph.getMark();
421e767d8038 Make FloatingRead phase respect loop closed form and use PostOrderNodeIterator
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5834
diff changeset
191 new FloatingReadPhase().apply(graph);
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
192 new CanonicalizerPhase(runtime, assumptions, mark, null).apply(graph);
5845
421e767d8038 Make FloatingRead phase respect loop closed form and use PostOrderNodeIterator
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5834
diff changeset
193 if (GraalOptions.OptReadElimination) {
421e767d8038 Make FloatingRead phase respect loop closed form and use PostOrderNodeIterator
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5834
diff changeset
194 new ReadEliminationPhase().apply(graph);
421e767d8038 Make FloatingRead phase respect loop closed form and use PostOrderNodeIterator
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5834
diff changeset
195 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
196 }
5845
421e767d8038 Make FloatingRead phase respect loop closed form and use PostOrderNodeIterator
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5834
diff changeset
197 new RemoveValueProxyPhase().apply(graph);
421e767d8038 Make FloatingRead phase respect loop closed form and use PostOrderNodeIterator
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5834
diff changeset
198
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
199 if (GraalOptions.OptCanonicalizer) {
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
200 new CanonicalizerPhase(runtime, assumptions).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
201 }
59f209dd356b Be more precise on the set of node that are canonicalized in IterativeCheckCastElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5859
diff changeset
202
6671
bffb038abbe6 Add option for EliminatePartiallyRedundantGuards, eliminate at splits after IterativeConditionalElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6670
diff changeset
203 if (GraalOptions.OptEliminatePartiallyRedundantGuards) {
bffb038abbe6 Add option for EliminatePartiallyRedundantGuards, eliminate at splits after IterativeConditionalElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6670
diff changeset
204 new EliminatePartiallyRedundantGuardsPhase(false, true).apply(graph);
bffb038abbe6 Add option for EliminatePartiallyRedundantGuards, eliminate at splits after IterativeConditionalElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6670
diff changeset
205 }
6669
7f6823cc5d26 Simple elimination of some partially redundant guards
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6657
diff changeset
206
7877
e56dda646972 rename CheckCastElimination option to ConditionalElimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 7838
diff changeset
207 if (GraalOptions.ConditionalElimination && GraalOptions.OptCanonicalizer) {
7827
961ad124cb21 Convert indexScalingEnabled boolean into an indexScaling integer value. This change removed the dependency on TargetDescription in large parts of the system.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7660
diff changeset
208 new IterativeConditionalEliminationPhase(runtime, assumptions).apply(graph);
5741
c84c75339af1 Work on loop unswitching, things look ok, still disabled until FloatingRead preserves loop-closed form
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5730
diff changeset
209 }
5391
5097f21f6c2b add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents: 5385
diff changeset
210
6671
bffb038abbe6 Add option for EliminatePartiallyRedundantGuards, eliminate at splits after IterativeConditionalElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6670
diff changeset
211 if (GraalOptions.OptEliminatePartiallyRedundantGuards) {
bffb038abbe6 Add option for EliminatePartiallyRedundantGuards, eliminate at splits after IterativeConditionalElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6670
diff changeset
212 new EliminatePartiallyRedundantGuardsPhase(true, true).apply(graph);
bffb038abbe6 Add option for EliminatePartiallyRedundantGuards, eliminate at splits after IterativeConditionalElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6670
diff changeset
213 }
bffb038abbe6 Add option for EliminatePartiallyRedundantGuards, eliminate at splits after IterativeConditionalElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6670
diff changeset
214
8534
4f33d1871dca pipeline: canonicalize after ConditionalElimination and EliminatePartiallyRedundantGuards
Bernhard Urban <bernhard.urban@jku.at>
parents: 8506
diff changeset
215 if (GraalOptions.OptCanonicalizer) {
4f33d1871dca pipeline: canonicalize after ConditionalElimination and EliminatePartiallyRedundantGuards
Bernhard Urban <bernhard.urban@jku.at>
parents: 8506
diff changeset
216 new CanonicalizerPhase(runtime, assumptions).apply(graph);
4f33d1871dca pipeline: canonicalize after ConditionalElimination and EliminatePartiallyRedundantGuards
Bernhard Urban <bernhard.urban@jku.at>
parents: 8506
diff changeset
217 }
4f33d1871dca pipeline: canonicalize after ConditionalElimination and EliminatePartiallyRedundantGuards
Bernhard Urban <bernhard.urban@jku.at>
parents: 8506
diff changeset
218
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
219 plan.runPhases(PhasePosition.MID_LEVEL, graph);
4303
dd67881406c2 add GVN after FloatingReadPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4281
diff changeset
220
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
221 plan.runPhases(PhasePosition.LOW_LEVEL, graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
222
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
223 // Add safepoints to loops
7937
29c2103630ef New strategy for inserting safepoints - always insert in loops but avoid in leaf methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7877
diff changeset
224 new SafepointInsertionPhase().apply(graph);
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents: 5251
diff changeset
225
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8657
diff changeset
226 new GuardLoweringPhase(target).apply(graph);
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8657
diff changeset
227
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
228 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
229 schedule.apply(graph);
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4477
diff changeset
230 Debug.dump(schedule, "final schedule");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
231
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
232 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
233 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
234 assert startBlock != null;
7497
0f8c6dbf68be Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7493
diff changeset
235 assert startBlock.getPredecessorCount() == 0;
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
236
7348
9f69799a1768 New experiment with block code emission order.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7307
diff changeset
237 new ComputeProbabilityPhase().apply(graph);
9f69799a1768 New experiment with block code emission order.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7307
diff changeset
238
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
239 return Debug.scope("ComputeLinearScanOrder", new Callable<LIR>() {
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
240
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
241 @Override
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
242 public LIR call() {
7497
0f8c6dbf68be Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7493
diff changeset
243 List<Block> codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blocks.length, startBlock);
0f8c6dbf68be Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7493
diff changeset
244 List<Block> linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.length, startBlock);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
245
8217
dce9cefed571 Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8207
diff changeset
246 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
247 Debug.dump(lir, "After linear scan order");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
248 return lir;
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
249
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
251 });
7307
dc3e86fd3be1 Introduce cutomization capability for canonicalizer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7246
diff changeset
252
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
254
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
255 public static LIRGenerator emitLIR(Backend backend, final TargetDescription target, final LIR lir, StructuredGraph graph, final ResolvedJavaMethod method) {
7838
a063308816d9 Complete first PTX unit test.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7837
diff changeset
256 final FrameMap frameMap = backend.newFrameMap();
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
257 final LIRGenerator lirGen = backend.newLIRGenerator(graph, frameMap, method, lir);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
258
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
259 Debug.scope("LIRGen", lirGen, new Runnable() {
6316
2e25b9c14b84 Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5891
diff changeset
260
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
261 public void run() {
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
262 for (Block b : lir.linearScanOrder()) {
7370
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
263 emitBlock(b);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
264 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
265
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4477
diff changeset
266 Debug.dump(lir, "After LIR generation");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
267 }
7370
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
268
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
269 private void emitBlock(Block b) {
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
270 if (lir.lir(b) == null) {
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
271 for (Block pred : b.getPredecessors()) {
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
272 if (!b.isLoopHeader() || !pred.isLoopEnd()) {
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
273 emitBlock(pred);
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
274 }
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
275 }
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
276 lirGen.doBlock(b);
7370
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
277 }
39a4192ae632 Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7348
diff changeset
278 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
279 });
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
280
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
281 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
282
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
283 Debug.scope("Allocator", new Runnable() {
6316
2e25b9c14b84 Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5891
diff changeset
284
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
285 public void run() {
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
286 new LinearScan(target, method, lir, lirGen, frameMap).allocate();
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
287 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
288 });
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
289 return lirGen;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
290 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
291
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
292 public static void emitCode(Backend backend, long[] leafGraphIds, Assumptions assumptions, ResolvedJavaMethod method, LIRGenerator lirGen, CompilationResult compilationResult) {
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
293 TargetMethodAssembler tasm = backend.newAssembler(lirGen, compilationResult);
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
294 backend.emitCode(tasm, method, lirGen);
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
295 CompilationResult result = tasm.finishTargetMethod(method, false);
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7063
diff changeset
296 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
297 result.setAssumptions(assumptions);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
298 }
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
299 result.setLeafGraphIds(leafGraphIds);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
300
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7539
diff changeset
301 Debug.dump(result, "After code generation");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
302 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
303 }