comparison graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java @ 12544:c69d0a705553

improved debug scope context when compiling Truffle IR graphs by making a Truffle compilable masquerade as a JavaMethod
author Doug Simon <doug.simon@oracle.com>
date Wed, 23 Oct 2013 18:45:05 +0200
parents b2882f4ab612
children 2d11b9128e01
comparison
equal deleted inserted replaced
12543:37207d7e9056 12544:c69d0a705553
135 return compileMethodHelper(graph, config, null, assumptions); 135 return compileMethodHelper(graph, config, null, assumptions);
136 } 136 }
137 137
138 public InstalledCode compileMethodHelper(final StructuredGraph graph, final GraphBuilderConfiguration config, final OptimizedCallTarget compilable, final Assumptions assumptions) { 138 public InstalledCode compileMethodHelper(final StructuredGraph graph, final GraphBuilderConfiguration config, final OptimizedCallTarget compilable, final Assumptions assumptions) {
139 final PhasePlan plan = createPhasePlan(config); 139 final PhasePlan plan = createPhasePlan(config);
140 final TruffleIRJavaMethod truffleJavaMethod = new TruffleIRJavaMethod(providers.getMetaAccess(), compilable);
140 141
141 Debug.scope("TruffleFinal", graph, new Runnable() { 142 Debug.scope("TruffleFinal", graph, new Runnable() {
142 143
143 @Override 144 @Override
144 public void run() { 145 public void run() {
149 final CompilationResult result = Debug.scope("TruffleGraal", new Callable<CompilationResult>() { 150 final CompilationResult result = Debug.scope("TruffleGraal", new Callable<CompilationResult>() {
150 151
151 @Override 152 @Override
152 public CompilationResult call() { 153 public CompilationResult call() {
153 try (TimerCloseable a = CompilationTime.start()) { 154 try (TimerCloseable a = CompilationTime.start()) {
154 CodeCacheProvider codeCache = providers.getCodeCache(); 155 return Debug.scope("GraalCompiler", new Object[]{truffleJavaMethod, providers.getCodeCache()}, new Callable<CompilationResult>() {
155 CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false); 156 public CompilationResult call() {
156 return GraalCompiler.compileGraph(graph, cc, graph.method(), providers, backend, codeCache.getTarget(), null, plan, OptimisticOptimizations.ALL, new SpeculationLog(), suites, 157 CodeCacheProvider codeCache = providers.getCodeCache();
157 new CompilationResult(compilable.toString())); 158 CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false);
159 CompilationResult compilationResult = new CompilationResult(compilable.toString());
160 return GraalCompiler.compileGraphNoScope(graph, cc, graph.method(), providers, backend, codeCache.getTarget(), null, plan, OptimisticOptimizations.ALL,
161 new SpeculationLog(), suites, compilationResult);
162 }
163 });
158 } 164 }
159 } 165 }
160 }); 166 });
161 167
162 List<AssumptionValidAssumption> validAssumptions = new ArrayList<>(); 168 List<AssumptionValidAssumption> validAssumptions = new ArrayList<>();
173 } 179 }
174 } 180 }
175 181
176 result.setAssumptions(newAssumptions); 182 result.setAssumptions(newAssumptions);
177 183
178 InstalledCode compiledMethod = Debug.scope("CodeInstall", new Object[]{graph.method()}, new Callable<InstalledCode>() { 184 InstalledCode compiledMethod = Debug.scope("CodeInstall", new Object[]{truffleJavaMethod, providers.getCodeCache()}, new Callable<InstalledCode>() {
179 185
180 @Override 186 @Override
181 public InstalledCode call() throws Exception { 187 public InstalledCode call() throws Exception {
182 try (TimerCloseable a = CodeInstallationTime.start()) { 188 try (TimerCloseable a = CodeInstallationTime.start()) {
183 InstalledCode installedCode = providers.getCodeCache().addMethod(graph.method(), result); 189 InstalledCode installedCode = providers.getCodeCache().addMethod(graph.method(), result);