Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java @ 5718:10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 28 Jun 2012 12:46:04 +0200 |
parents | a63ed5993987 |
children | 46ad94a0574a |
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 |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
29 import com.oracle.graal.alloc.simple.*; |
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.phases.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
35 import com.oracle.graal.compiler.phases.PhasePlan.PhasePosition; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
36 import com.oracle.graal.compiler.schedule.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
37 import com.oracle.graal.compiler.target.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.compiler.types.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 import com.oracle.graal.cri.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
40 import com.oracle.graal.debug.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
41 import com.oracle.graal.lir.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
42 import com.oracle.graal.lir.asm.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
43 import com.oracle.graal.lir.cfg.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
44 import com.oracle.graal.nodes.*; |
5114
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5109
diff
changeset
|
45 import com.oracle.max.cri.xir.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 public class GraalCompiler { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 * The target that this compiler has been configured for. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
52 public final TargetDescription target; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 * The runtime that this compiler has been configured for. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 */ |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5695
diff
changeset
|
57 public final GraalCodeCacheProvider runtime; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 * The XIR generator that lowers Java operations to machine operations. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 public final RiXirGenerator xir; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 * The backend that this compiler has been configured for. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 public final Backend backend; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5695
diff
changeset
|
69 public GraalCompiler(GraalCodeCacheProvider runtime, TargetDescription target, Backend backend, RiXirGenerator xirGen) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 this.runtime = runtime; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 this.target = target; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 this.xir = xirGen; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
73 this.backend = backend; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 |
5177
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5138
diff
changeset
|
76 |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5695
diff
changeset
|
77 public CompilationResult compileMethod(final ResolvedJavaMethod method, final StructuredGraph graph, int osrBCI, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) { |
5068
6e7c1fb1980f
enabled wrappers for native method calls
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5061
diff
changeset
|
78 assert (method.accessFlags() & Modifier.NATIVE) == 0 : "compiling native methods is not supported"; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
79 if (osrBCI != -1) { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
80 throw new BailoutException("No OSR supported"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
81 } |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4477
diff
changeset
|
82 |
5546
e42c0df7212a
Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
83 return Debug.scope("GraalCompiler", new Object[] {graph, method, this}, new Callable<CompilationResult>() { |
e42c0df7212a
Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
84 public CompilationResult call() { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
85 final Assumptions assumptions = GraalOptions.OptAssumptions ? new Assumptions() : null; |
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
|
86 final LIR lir = Debug.scope("FrontEnd", new Callable<LIR>() { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
87 public LIR call() { |
5177
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5138
diff
changeset
|
88 return emitHIR(graph, assumptions, cache, plan, optimisticOpts); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
89 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
90 }); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
91 final FrameMap frameMap = Debug.scope("BackEnd", lir, new Callable<FrameMap>() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
92 public FrameMap call() { |
5369
2e9a5365dfb0
moved conversion of type profiles into hints for type check instructions from front end to lowering phase
Doug Simon <doug.simon@oracle.com>
parents:
5357
diff
changeset
|
93 return emitLIR(lir, graph, method, assumptions); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
94 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
95 }); |
5546
e42c0df7212a
Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
96 return Debug.scope("CodeGen", frameMap, new Callable<CompilationResult>() { |
e42c0df7212a
Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
97 public CompilationResult call() { |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
98 return emitCode(assumptions, method, lir, frameMap); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
99 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
100 }); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
102 }); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
105 /** |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
106 * Builds the graph, optimizes it. |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
107 */ |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5695
diff
changeset
|
108 public LIR emitHIR(StructuredGraph graph, Assumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
109 |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
110 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
|
111 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
|
112 new DeadCodeEliminationPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
113 } else { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
114 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
|
115 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
117 new PhiStampPhase().apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
118 |
5204
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
119 if (GraalOptions.ProbabilityAnalysis && graph.start().probability() == 0) { |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
120 new ComputeProbabilityPhase().apply(graph); |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
121 } |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
122 |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
123 if (GraalOptions.PropagateTypes) { |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
124 new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph); |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
125 } |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
126 |
5099
e35e2aa5ebad
Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5085
diff
changeset
|
127 if (GraalOptions.OptCanonicalizer) { |
e35e2aa5ebad
Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5085
diff
changeset
|
128 new CanonicalizerPhase(target, runtime, assumptions).apply(graph); |
e35e2aa5ebad
Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5085
diff
changeset
|
129 } |
e35e2aa5ebad
Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5085
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 if (GraalOptions.Intrinsify) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
132 new IntrinsificationPhase(runtime).apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
133 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
134 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
135 if (GraalOptions.Inline && !plan.isPhaseDisabled(InliningPhase.class)) { |
5177
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5138
diff
changeset
|
136 new InliningPhase(target, runtime, null, assumptions, cache, plan, optimisticOpts).apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
137 new PhiStampPhase().apply(graph); |
5391
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
138 |
5204
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
139 if (GraalOptions.PropagateTypes) { |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
140 new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph); |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
141 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
142 |
5391
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
143 if (GraalOptions.CheckCastElimination) { |
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
144 new CheckCastEliminationPhase().apply(graph); |
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
145 } |
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
146 |
5204
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
147 if (GraalOptions.OptCanonicalizer) { |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
148 new CanonicalizerPhase(target, runtime, assumptions).apply(graph); |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
149 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
150 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
151 |
5695
a63ed5993987
Add leadGraphID to IfNOde so that we can convert them to deopts
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5681
diff
changeset
|
152 new ConvertUnreachedToGuardPhase(optimisticOpts).apply(graph); |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
4618
diff
changeset
|
153 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
154 plan.runPhases(PhasePosition.HIGH_LEVEL, graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
155 |
5675
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
156 if (GraalOptions.FullUnroll) { |
5681
7482f7d08455
Don't try to fold conditions when there is no runtime available
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5675
diff
changeset
|
157 new LoopFullUnrollPhase(runtime).apply(graph); |
5675
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
158 } |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
159 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
160 if (GraalOptions.EscapeAnalysis && !plan.isPhaseDisabled(EscapeAnalysisPhase.class)) { |
5177
a26b6248d398
added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents:
5138
diff
changeset
|
161 new EscapeAnalysisPhase(target, runtime, assumptions, cache, plan, optimisticOpts).apply(graph); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
162 new PhiStampPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
163 } |
5675
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
164 if (GraalOptions.OptLoopTransform) { |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
165 new LoopTransformHighPhase().apply(graph); |
5204
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
166 } |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5204
diff
changeset
|
167 if (GraalOptions.OptCanonicalizer) { |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5204
diff
changeset
|
168 new CanonicalizerPhase(target, runtime, assumptions).apply(graph); |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5204
diff
changeset
|
169 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
170 |
5379
c862951e769d
moved checkcast lowering into LoweringPhase and added -G:HIRLowerCheckcast option to enable it (disabled by default) as it is not yet stable
Doug Simon <doug.simon@oracle.com>
parents:
5369
diff
changeset
|
171 new LoweringPhase(runtime, assumptions).apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
172 |
5383
1436de7b7cab
cull unnecessary framestates at merges
Lukas Stadler <lukas.stadler@jku.at>
parents:
5357
diff
changeset
|
173 if (GraalOptions.CullFrameStates) { |
1436de7b7cab
cull unnecessary framestates at merges
Lukas Stadler <lukas.stadler@jku.at>
parents:
5357
diff
changeset
|
174 new CullFrameStatesPhase().apply(graph); |
1436de7b7cab
cull unnecessary framestates at merges
Lukas Stadler <lukas.stadler@jku.at>
parents:
5357
diff
changeset
|
175 } |
5445
645534f5e4ab
Transmit null check flag from fixed to floating read nodes
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5419
diff
changeset
|
176 new FloatingReadPhase().apply(graph); |
645534f5e4ab
Transmit null check flag from fixed to floating read nodes
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5419
diff
changeset
|
177 if (GraalOptions.OptGVN) { |
645534f5e4ab
Transmit null check flag from fixed to floating read nodes
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5419
diff
changeset
|
178 new GlobalValueNumberingPhase().apply(graph); |
645534f5e4ab
Transmit null check flag from fixed to floating read nodes
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5419
diff
changeset
|
179 } |
645534f5e4ab
Transmit null check flag from fixed to floating read nodes
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5419
diff
changeset
|
180 if (GraalOptions.OptReadElimination) { |
645534f5e4ab
Transmit null check flag from fixed to floating read nodes
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5419
diff
changeset
|
181 new ReadEliminationPhase().apply(graph); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
182 } |
5085
5bdaa08ba96b
add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
5068
diff
changeset
|
183 |
5bdaa08ba96b
add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
5068
diff
changeset
|
184 if (GraalOptions.PropagateTypes) { |
5bdaa08ba96b
add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
5068
diff
changeset
|
185 new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph); |
5bdaa08ba96b
add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
5068
diff
changeset
|
186 } |
5391
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
187 |
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
188 if (GraalOptions.CheckCastElimination) { |
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
189 new CheckCastEliminationPhase().apply(graph); |
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
190 } |
5097f21f6c2b
add a new simple CheckCast elimination phase
Lukas Stadler <lukas.stadler@jku.at>
parents:
5385
diff
changeset
|
191 |
5675
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
192 if (GraalOptions.OptLoopTransform) { |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
193 new LoopTransformLowPhase().apply(graph); |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
194 } |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
195 new RemoveValueProxyPhase().apply(graph); |
5204
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
196 if (GraalOptions.OptCanonicalizer) { |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
197 new CanonicalizerPhase(target, runtime, assumptions).apply(graph); |
0a53ed842cb8
Reordering and adjustments to phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5177
diff
changeset
|
198 } |
5675
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
199 if (GraalOptions.CheckCastElimination) { |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
200 new CheckCastEliminationPhase().apply(graph); |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
201 } |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
202 |
4303
dd67881406c2
add GVN after FloatingReadPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
4281
diff
changeset
|
203 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
204 plan.runPhases(PhasePosition.MID_LEVEL, graph); |
4303
dd67881406c2
add GVN after FloatingReadPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
4281
diff
changeset
|
205 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
206 plan.runPhases(PhasePosition.LOW_LEVEL, graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
207 |
5675
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
208 new DeadCodeEliminationPhase().apply(graph); |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
209 if (GraalOptions.OptCanonicalizer) { |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
210 new CanonicalizerPhase(target, runtime, assumptions).apply(graph); |
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5547
diff
changeset
|
211 } |
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
|
212 // Add safepoints to loops |
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
|
213 if (GraalOptions.GenLoopSafepoints) { |
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
|
214 new LoopSafepointInsertionPhase().apply(graph); |
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
|
215 } |
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
|
216 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
217 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
|
218 schedule.apply(graph); |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4477
diff
changeset
|
219 Debug.dump(schedule, "final schedule"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
220 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
221 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
|
222 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
|
223 assert startBlock != null; |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
224 assert startBlock.numberOfPreds() == 0; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
225 |
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
|
226 return Debug.scope("ComputeLinearScanOrder", new Callable<LIR>() { |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
227 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
228 @Override |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
229 public LIR call() { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
230 ComputeLinearScanOrder clso = new ComputeLinearScanOrder(blocks.length, schedule.getCFG().getLoops().length, startBlock); |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
231 List<Block> linearScanOrder = clso.linearScanOrder(); |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
232 List<Block> codeEmittingOrder = clso.codeEmittingOrder(); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
233 |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
234 int z = 0; |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
235 for (Block b : linearScanOrder) { |
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
236 b.linearScanNumber = z++; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
237 } |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
238 |
5248
066f1687ba24
rename: nodesFor -> blockToNodesMap
Doug Simon <doug.simon@oracle.com>
parents:
5233
diff
changeset
|
239 LIR lir = new LIR(schedule.getCFG(), schedule.getBlockToNodesMap(), linearScanOrder, codeEmittingOrder); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
240 Debug.dump(lir, "After linear scan order"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
241 return lir; |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
242 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
244 }); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
247 public FrameMap emitLIR(final LIR lir, StructuredGraph graph, final ResolvedJavaMethod method, Assumptions assumptions) { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
248 final FrameMap frameMap = backend.newFrameMap(runtime.getRegisterConfig(method)); |
5369
2e9a5365dfb0
moved conversion of type profiles into hints for type check instructions from front end to lowering phase
Doug Simon <doug.simon@oracle.com>
parents:
5357
diff
changeset
|
249 final LIRGenerator lirGenerator = backend.newLIRGenerator(graph, frameMap, method, lir, xir, assumptions); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
250 |
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
|
251 Debug.scope("LIRGen", lirGenerator, new Runnable() { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
252 public void run() { |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4421
diff
changeset
|
253 for (Block b : lir.linearScanOrder()) { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
254 lirGenerator.doBlock(b); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
255 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 |
4522
cf13124efdd9
Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4477
diff
changeset
|
257 Debug.dump(lir, "After LIR generation"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
258 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
259 }); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
260 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
261 Debug.scope("Allocator", new Runnable() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
262 public void run() { |
4360
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
263 if (GraalOptions.AllocSSA) { |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
264 new LinearScanAllocator(lir, frameMap).execute(); |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
265 // new SpillAllAllocator(context, lir, frameMap).execute(); |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
266 } else { |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
267 new LinearScan(target, method, lir, lirGenerator, frameMap).allocate(); |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
268 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
269 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
270 }); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
271 return frameMap; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
274 public CompilationResult emitCode(Assumptions assumptions, ResolvedJavaMethod method, LIR lir, FrameMap frameMap) { |
5233
efbb1e33e2f3
removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
5215
diff
changeset
|
275 TargetMethodAssembler tasm = backend.newAssembler(frameMap, lir); |
efbb1e33e2f3
removed XIR prologue and epilogues - architecture and runtime specific subclass of Backend is now used instead
Doug Simon <doug.simon@oracle.com>
parents:
5215
diff
changeset
|
276 backend.emitCode(tasm, method, lir); |
5546
e42c0df7212a
Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
277 CompilationResult targetMethod = tasm.finishTargetMethod(method, false); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
278 if (assumptions != null && !assumptions.isEmpty()) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
279 targetMethod.setAssumptions(assumptions); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 |
5251
467de393651a
optimization: frame prologue & epilogue ommitted for methods with no spills, no callee-saved registers, no incoming stack args and no debug info
Doug Simon <doug.simon@oracle.com>
parents:
5249
diff
changeset
|
282 Debug.dump(targetMethod, "After code generation"); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
283 return targetMethod; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 } |