annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java @ 5169:20f8a3215fa8

fixed regex in MethodFilter
author Doug Simon <doug.simon@oracle.com>
date Wed, 28 Mar 2012 22:17:10 +0200
parents 4d8ebb0fc484
children a26b6248d398
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
4281
62cb0e636094 Copyright fixes
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4278
diff changeset
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.compiler;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5068
6e7c1fb1980f enabled wrappers for native method calls
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5061
diff changeset
25 import java.lang.reflect.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26 import java.util.*;
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
27 import java.util.concurrent.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 import com.oracle.graal.alloc.simple.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
30 import com.oracle.graal.compiler.alloc.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
31 import com.oracle.graal.compiler.gen.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
32 import com.oracle.graal.compiler.phases.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
33 import com.oracle.graal.compiler.phases.PhasePlan.PhasePosition;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
34 import com.oracle.graal.compiler.schedule.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
35 import com.oracle.graal.compiler.target.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
36 import com.oracle.graal.compiler.types.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
37 import com.oracle.graal.cri.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
38 import com.oracle.graal.debug.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
39 import com.oracle.graal.lir.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
40 import com.oracle.graal.lir.asm.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
41 import com.oracle.graal.lir.cfg.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
42 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
43 import com.oracle.max.asm.*;
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5109
diff changeset
44 import com.oracle.max.cri.ci.*;
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.ri.*;
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5109
diff changeset
46 import com.oracle.max.cri.xir.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 public class GraalCompiler {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 * 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
52 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 public final CiTarget target;
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 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 * 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
57 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 public final GraalRuntime runtime;
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 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 * 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
62 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 public final RiXirGenerator xir;
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 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 * 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
67 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 public final Backend backend;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
70 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
71 this.runtime = runtime;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 this.target = target;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 this.xir = xirGen;
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
74 this.backend = backend;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5109
diff changeset
77 public CiTargetMethod compileMethod(final RiResolvedMethod method, final StructuredGraph graph, int osrBCI, 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) {
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
80 throw new CiBailout("No OSR supported");
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
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5099
diff changeset
83 return Debug.scope("GraalCompiler", new Object[] {graph, method, this}, new Callable<CiTargetMethod>() {
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
84 public CiTargetMethod call() {
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
85 final CiAssumptions assumptions = GraalOptions.OptAssumptions ? new CiAssumptions() : 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() {
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5109
diff changeset
88 return emitHIR(graph, assumptions, 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() {
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
93 return emitLIR(lir, graph, method);
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 });
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
96 return Debug.scope("CodeGen", frameMap, new Callable<CiTargetMethod>() {
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
97 public CiTargetMethod 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 */
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5109
diff changeset
108 public LIR emitHIR(StructuredGraph graph, CiAssumptions assumptions, 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
5099
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
119 if (GraalOptions.OptCanonicalizer) {
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
120 new CanonicalizerPhase(target, runtime, assumptions).apply(graph);
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
121 }
e35e2aa5ebad Run the canonicalizer early
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5085
diff changeset
122
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
123 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
124 new ComputeProbabilityPhase().apply(graph);
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
125 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
126
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
127 if (GraalOptions.Intrinsify) {
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
128 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
129 }
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
130
4648
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
131 if (GraalOptions.PropagateTypes) {
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
132 if (GraalOptions.OptCanonicalizer) {
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
133 new CanonicalizerPhase(target, runtime, assumptions).apply(graph);
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
134 }
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
135
5085
5bdaa08ba96b add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
136 new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph);
4648
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
137 }
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
138
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
139 if (GraalOptions.Inline && !plan.isPhaseDisabled(InliningPhase.class)) {
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5109
diff changeset
140 new InliningPhase(target, runtime, null, assumptions, 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
141 new DeadCodeEliminationPhase().apply(graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
142 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
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.OptCanonicalizer) {
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
146 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
147 }
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
148
4648
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
149 if (GraalOptions.PropagateTypes) {
5085
5bdaa08ba96b add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
150 new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph);
4648
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
151 }
83b4cc4df77a experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4618
diff changeset
152
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
153 plan.runPhases(PhasePosition.HIGH_LEVEL, graph);
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 if (GraalOptions.OptLoops) {
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
156 new SafepointPollingEliminationPhase().apply(graph);
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
157 }
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
158
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
159 if (GraalOptions.EscapeAnalysis && !plan.isPhaseDisabled(EscapeAnalysisPhase.class)) {
5114
dad1ac9dba7d finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5109
diff changeset
160 new EscapeAnalysisPhase(target, runtime, assumptions, 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
161 new PhiStampPhase().apply(graph);
4589
c148bec9398a Fixed computation of exact type information in PhiStampPhase.
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4525
diff changeset
162 if (GraalOptions.OptCanonicalizer) {
c148bec9398a Fixed computation of exact type information in PhiStampPhase.
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4525
diff changeset
163 new CanonicalizerPhase(target, runtime, assumptions).apply(graph);
c148bec9398a Fixed computation of exact type information in PhiStampPhase.
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4525
diff changeset
164 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
165 }
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
166
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
167 if (GraalOptions.OptGVN) {
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
168 new GlobalValueNumberingPhase().apply(graph);
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
169 }
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
170
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
171 graph.mark();
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
172 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
173 new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
174
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
175 if (GraalOptions.Lower) {
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
176 new FloatingReadPhase().apply(graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
177 if (GraalOptions.OptGVN) {
4359
c66ddad845a4 Merge fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
178 new GlobalValueNumberingPhase().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.OptReadElimination) {
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
181 new ReadEliminationPhase().apply(graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
182 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
183 }
5085
5bdaa08ba96b add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
184
5bdaa08ba96b add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
185 if (GraalOptions.PropagateTypes) {
5bdaa08ba96b add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
186 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
187 }
5bdaa08ba96b add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
188 if (GraalOptions.OptGVN) {
5bdaa08ba96b add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
189 new GlobalValueNumberingPhase().apply(graph);
5bdaa08ba96b add and enable new PropagateTypeCachePhase, add type system tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
190 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
191 new DeadCodeEliminationPhase().apply(graph);
4303
dd67881406c2 add GVN after FloatingReadPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4281
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 plan.runPhases(PhasePosition.MID_LEVEL, graph);
4303
dd67881406c2 add GVN after FloatingReadPhase
Lukas Stadler <lukas.stadler@jku.at>
parents: 4281
diff changeset
194
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
195 plan.runPhases(PhasePosition.LOW_LEVEL, graph);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
196
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
197 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
198 schedule.apply(graph);
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4477
diff changeset
199 Debug.dump(schedule, "final schedule");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
200
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
201 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
202 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
203 assert startBlock != null;
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
204 assert startBlock.numberOfPreds() == 0;
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
205
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
206 return Debug.scope("ComputeLinearScanOrder", new Callable<LIR>() {
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
207
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
208 @Override
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
209 public LIR call() {
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
210 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
211 List<Block> linearScanOrder = clso.linearScanOrder();
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
212 List<Block> codeEmittingOrder = clso.codeEmittingOrder();
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
213
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
214 int z = 0;
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
215 for (Block b : linearScanOrder) {
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
216 b.linearScanNumber = z++;
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
217 }
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
218
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
219 LIR lir = new LIR(schedule.getCFG(), schedule.getNodesFor(), linearScanOrder, codeEmittingOrder);
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
220 Debug.dump(lir, "After linear scan order");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
221 return lir;
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
222
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
223 }
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
224 });
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
227 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
228 final FrameMap frameMap = backend.newFrameMap(runtime.getRegisterConfig(method));
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
229 final LIRGenerator lirGenerator = backend.newLIRGenerator(graph, frameMap, method, lir, xir);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
230
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
231 Debug.scope("LIRGen", lirGenerator, new Runnable() {
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
232 public void run() {
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4421
diff changeset
233 for (Block b : lir.linearScanOrder()) {
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
234 lirGenerator.doBlock(b);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
235 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4477
diff changeset
237 Debug.dump(lir, "After LIR generation");
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
238 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
239 });
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
240
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
241 Debug.scope("Allocator", new Runnable() {
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
242 public void run() {
4360
d203d8b25721 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4359
diff changeset
243 if (GraalOptions.AllocSSA) {
d203d8b25721 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4359
diff changeset
244 new LinearScanAllocator(lir, frameMap).execute();
d203d8b25721 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4359
diff changeset
245 // new SpillAllAllocator(context, lir, frameMap).execute();
d203d8b25721 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4359
diff changeset
246 } else {
d203d8b25721 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4359
diff changeset
247 new LinearScan(target, method, lir, lirGenerator, frameMap).allocate();
d203d8b25721 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4359
diff changeset
248 }
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
249 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
250 });
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
251 return frameMap;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
252 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
254 private TargetMethodAssembler createAssembler(FrameMap frameMap, LIR lir) {
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
255 AbstractAssembler masm = backend.newAssembler(frameMap.registerConfig);
4352
5a84f5548fc4 More work on new debug infrastructure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4351
diff changeset
256 TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime, frameMap, lir.slowPaths, masm);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
257 tasm.setFrameSize(frameMap.frameSize());
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
258 tasm.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea());
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
259 return tasm;
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
260 }
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
261
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
262 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
263 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
264 lir.emitCode(tasm);
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4263
diff changeset
265
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
266 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
267 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
268 targetMethod.setAssumptions(assumptions);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
269 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
270
4522
cf13124efdd9 Restructure phi functions in LIR; Re-enabled C1Visualizer output
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4477
diff changeset
271 Debug.dump(lir, "After code generation");
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4352
diff changeset
272 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
273 return targetMethod;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
275 }