Mercurial > hg > truffle
annotate graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java @ 4369:efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 26 Jan 2012 18:33:58 +0100 |
parents | 2d7544ea8ed9 |
children | 44e2e5cb37f3 |
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 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.max.graal.compiler; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import java.util.*; |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
26 import java.util.concurrent.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
28 import com.oracle.max.asm.*; |
4199
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4142
diff
changeset
|
29 import com.oracle.max.cri.ci.*; |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4142
diff
changeset
|
30 import com.oracle.max.cri.ri.*; |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4142
diff
changeset
|
31 import com.oracle.max.cri.xir.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 import com.oracle.max.criutils.*; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
33 import com.oracle.max.graal.alloc.simple.*; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
34 import com.oracle.max.graal.compiler.alloc.*; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
35 import com.oracle.max.graal.compiler.asm.*; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
36 import com.oracle.max.graal.compiler.gen.*; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
37 import com.oracle.max.graal.compiler.lir.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 import com.oracle.max.graal.compiler.phases.*; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
39 import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
40 import com.oracle.max.graal.compiler.schedule.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 import com.oracle.max.graal.compiler.target.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 import com.oracle.max.graal.cri.*; |
4345
176d60b77d31
Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4253
diff
changeset
|
43 import com.oracle.max.graal.debug.*; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
44 import com.oracle.max.graal.graph.*; |
4253
fc2f14acd5a5
Add a compileMethod overload that takes an initial graph.
Andreas Woess <andreas.woess@jku.at>
parents:
4203
diff
changeset
|
45 import com.oracle.max.graal.nodes.*; |
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 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 public final CiTarget target; |
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 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 public final GraalRuntime runtime; |
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 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
69 public GraalCompiler(GraalRuntime runtime, CiTarget 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 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
76 public CiTargetMethod compileMethod(RiResolvedMethod method, int osrBCI, PhasePlan plan) { |
4268
3e5c18a41c25
Add frameMap getter to LIRGenerator. Add compileMethod overload with input graph parameter.
Andreas Woess <andreas.woess@jku.at>
parents:
4266
diff
changeset
|
77 return compileMethod(method, new StructuredGraph(method), osrBCI, plan); |
3e5c18a41c25
Add frameMap getter to LIRGenerator. Add compileMethod overload with input graph parameter.
Andreas Woess <andreas.woess@jku.at>
parents:
4266
diff
changeset
|
78 } |
3e5c18a41c25
Add frameMap getter to LIRGenerator. Add compileMethod overload with input graph parameter.
Andreas Woess <andreas.woess@jku.at>
parents:
4266
diff
changeset
|
79 |
4351
279a43776f42
Fixed merge issues.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4350
diff
changeset
|
80 public CiTargetMethod compileMethod(final RiResolvedMethod method, final StructuredGraph graph, int osrBCI, final PhasePlan plan) { |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
81 if (osrBCI != -1) { |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
82 throw new CiBailout("No OSR supported"); |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
83 } |
4369
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
84 return Debug.scope(createScopeName(method), method, new Callable<CiTargetMethod>() { |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
85 public CiTargetMethod call() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
86 final CiAssumptions assumptions = GraalOptions.OptAssumptions ? new CiAssumptions() : null; |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
87 final LIR lir = Debug.scope("FrontEnd", graph, new Callable<LIR>() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
88 public LIR call() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
89 return emitHIR(graph, assumptions, plan); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
90 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
91 }); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
92 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
|
93 public FrameMap call() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
94 return emitLIR(lir, graph, method); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
95 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
96 }); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
97 return Debug.scope("CodeGen", frameMap, new Callable<CiTargetMethod>() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
98 public CiTargetMethod call() { |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
99 return emitCode(assumptions, method, lir, frameMap); |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
100 } |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
101 }); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
103 }); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 |
4369
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
106 private static String createScopeName(RiResolvedMethod method) { |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
107 if (Debug.isEnabled()) { |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
108 return String.format("[%s::%s]", createSimpleName(method.holder()), method.name()); |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
109 } else { |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
110 return null; |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
111 } |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
112 } |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
113 |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
114 private static String createSimpleName(RiResolvedType holder) { |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
115 String base = holder.name(); |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
116 int slashIndex = base.lastIndexOf('/'); |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
117 if (slashIndex == -1) { |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
118 slashIndex = 0; |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
119 } |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
120 return base.substring(slashIndex + 1, base.length() - 1); |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
121 } |
efc430d943c0
Drafted regexp filters. Rewrote logging statements of floating read phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4367
diff
changeset
|
122 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
123 /** |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
124 * Builds the graph, optimizes it. |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
125 */ |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
126 public LIR emitHIR(StructuredGraph graph, CiAssumptions assumptions, PhasePlan plan) { |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
127 |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
128 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
|
129 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
|
130 new DeadCodeEliminationPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
131 } else { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
132 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
|
133 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
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 new PhiStampPhase().apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
136 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
137 if (GraalOptions.ProbabilityAnalysis && graph.start().probability() == 0) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
138 new ComputeProbabilityPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
139 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
140 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
141 if (GraalOptions.Intrinsify) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
142 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
|
143 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
144 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
145 if (GraalOptions.Inline && !plan.isPhaseDisabled(InliningPhase.class)) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
146 new InliningPhase(target, runtime, null, assumptions, plan).apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
147 new DeadCodeEliminationPhase().apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
148 new PhiStampPhase().apply(graph); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
149 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
150 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
151 if (GraalOptions.OptCanonicalizer) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
152 new CanonicalizerPhase(target, runtime, assumptions).apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
153 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
154 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
155 plan.runPhases(PhasePosition.HIGH_LEVEL, graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
156 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
157 if (GraalOptions.OptLoops) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
158 graph.mark(); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
159 new FindInductionVariablesPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
160 if (GraalOptions.OptCanonicalizer) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
161 new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
162 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
163 new SafepointPollingEliminationPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
164 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
165 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
166 if (GraalOptions.EscapeAnalysis && !plan.isPhaseDisabled(EscapeAnalysisPhase.class)) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
167 new EscapeAnalysisPhase(target, runtime, assumptions, plan).apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
168 new PhiStampPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
169 new CanonicalizerPhase(target, runtime, assumptions).apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
170 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
171 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
172 if (GraalOptions.OptGVN) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
173 new GlobalValueNumberingPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
174 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
176 graph.mark(); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
177 new LoweringPhase(runtime).apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
178 new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
179 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
180 if (GraalOptions.OptLoops) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
181 graph.mark(); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
182 new RemoveInductionVariablesPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
183 if (GraalOptions.OptCanonicalizer) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
184 new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
185 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
186 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
187 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
188 if (GraalOptions.Lower) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
189 new FloatingReadPhase().apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
190 if (GraalOptions.OptGVN) { |
4359
c66ddad845a4
Merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4358
diff
changeset
|
191 new GlobalValueNumberingPhase().apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
192 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
193 if (GraalOptions.OptReadElimination) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
194 new ReadEliminationPhase().apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
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 } |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
197 new RemovePlaceholderPhase().apply(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
198 new DeadCodeEliminationPhase().apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
199 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
200 plan.runPhases(PhasePosition.MID_LEVEL, graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
201 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
202 plan.runPhases(PhasePosition.LOW_LEVEL, graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
203 |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
204 final IdentifyBlocksPhase schedule = new IdentifyBlocksPhase(true, LIRBlock.FACTORY); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
205 schedule.apply(graph); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
206 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
207 final List<Block> blocks = schedule.getBlocks(); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
208 final NodeMap<LIRBlock> valueToBlock = new NodeMap<>(graph); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
209 for (Block b : blocks) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
210 for (Node i : b.getInstructions()) { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
211 valueToBlock.set(i, (LIRBlock) b); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
212 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
213 } |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
214 final LIRBlock startBlock = valueToBlock.get(graph.start()); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
215 assert startBlock != null; |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
216 assert startBlock.numberOfPreds() == 0; |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
217 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
218 return Debug.scope("Compute Linear Scan Order", new Callable<LIR>() { |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
219 |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
220 @Override |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
221 public LIR call() { |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
222 ComputeLinearScanOrder clso = new ComputeLinearScanOrder(blocks.size(), schedule.loopCount(), startBlock); |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
223 List<LIRBlock> linearScanOrder = clso.linearScanOrder(); |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
224 List<LIRBlock> codeEmittingOrder = clso.codeEmittingOrder(); |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
225 |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
226 int z = 0; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
227 for (LIRBlock b : linearScanOrder) { |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
228 b.setLinearScanNumber(z++); |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
229 } |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
230 |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
231 LIR lir = new LIR(startBlock, linearScanOrder, codeEmittingOrder, valueToBlock, schedule.loopCount()); |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
232 Debug.dump(lir, "After linear scan order"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
233 return lir; |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
234 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
236 }); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
238 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
239 public FrameMap emitLIR(final LIR lir, StructuredGraph graph, final RiResolvedMethod method) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
240 final FrameMap frameMap = backend.newFrameMap(runtime.getRegisterConfig(method)); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
241 final LIRGenerator lirGenerator = backend.newLIRGenerator(graph, frameMap, method, lir, xir); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
242 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
243 Debug.scope("LIRGen", new Runnable() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
244 public void run() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
245 for (LIRBlock b : lir.linearScanOrder()) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
246 lirGenerator.doBlock(b); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
247 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
249 for (LIRBlock b : lir.linearScanOrder()) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
250 if (b.phis != null) { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
251 b.phis.fillInputs(lirGenerator); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
252 } |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
253 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
255 Debug.dump(lirGenerator, "After LIR generation"); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
256 if (GraalOptions.PrintLIR && !TTY.isSuppressed()) { |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
257 LIR.printLIR(lir.linearScanOrder()); |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
258 } |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
259 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
260 }); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
261 |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
262 Debug.scope("Allocator", new Runnable() { |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
263 public void run() { |
4360
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
264 if (GraalOptions.AllocSSA) { |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
265 new LinearScanAllocator(lir, frameMap).execute(); |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
266 // new SpillAllAllocator(context, lir, frameMap).execute(); |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
267 } else { |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
268 new LinearScan(target, method, lir, lirGenerator, frameMap).allocate(); |
d203d8b25721
Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4359
diff
changeset
|
269 } |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
270 } |
4357
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
271 }); |
719ac1d92a52
More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4353
diff
changeset
|
272 return frameMap; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
275 private TargetMethodAssembler createAssembler(FrameMap frameMap, LIR lir) { |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
276 AbstractAssembler masm = backend.newAssembler(frameMap.registerConfig); |
4352
5a84f5548fc4
More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4351
diff
changeset
|
277 TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime, frameMap, lir.slowPaths, masm); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
278 tasm.setFrameSize(frameMap.frameSize()); |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
279 tasm.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea()); |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
280 return tasm; |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
281 } |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
282 |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
283 public CiTargetMethod emitCode(CiAssumptions assumptions, RiResolvedMethod method, LIR lir, FrameMap frameMap) { |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
284 TargetMethodAssembler tasm = createAssembler(frameMap, lir); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
285 lir.emitCode(tasm); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
286 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
287 CiTargetMethod targetMethod = tasm.finishTargetMethod(method, false); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
288 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
|
289 targetMethod.setAssumptions(assumptions); |
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 |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
292 Debug.dump(targetMethod, "After code generation"); |
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
293 return targetMethod; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
295 } |