comparison graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java @ 21780:3d15183f3c93

Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Wed, 03 Jun 2015 15:47:54 +0200
parents 4c00096fc415
children 217b681df88f
comparison
equal deleted inserted replaced
21779:20ace3139510 21780:3d15183f3c93
236 } 236 }
237 237
238 LIRGenerationResult lirGen = null; 238 LIRGenerationResult lirGen = null;
239 lirGen = emitLIR(backend, target, schedule, graph, stub, cc, registerConfig, lirSuites); 239 lirGen = emitLIR(backend, target, schedule, graph, stub, cc, registerConfig, lirSuites);
240 try (Scope s2 = Debug.scope("CodeGen", lirGen, lirGen.getLIR())) { 240 try (Scope s2 = Debug.scope("CodeGen", lirGen, lirGen.getLIR())) {
241 emitCode(backend, graph.getAssumptions(), graph.method(), graph.getInlinedMethods(), lirGen, compilationResult, installedCodeOwner, factory); 241 int bytecodeSize = graph.method() == null ? 0 : graph.getBytecodeSize();
242 emitCode(backend, graph.getAssumptions(), graph.method(), graph.getInlinedMethods(), bytecodeSize, lirGen, compilationResult, installedCodeOwner, factory);
242 } catch (Throwable e) { 243 } catch (Throwable e) {
243 throw Debug.handle(e); 244 throw Debug.handle(e);
244 } 245 }
245 } catch (Throwable e) { 246 } catch (Throwable e) {
246 throw Debug.handle(e); 247 throw Debug.handle(e);
325 lirSuites.getPostAllocationOptimizationStage().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, postAllocOptContext); 326 lirSuites.getPostAllocationOptimizationStage().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, postAllocOptContext);
326 327
327 return lirGenRes; 328 return lirGenRes;
328 } 329 }
329 330
330 public static void emitCode(Backend backend, Assumptions assumptions, ResolvedJavaMethod rootMethod, Set<ResolvedJavaMethod> inlinedMethods, LIRGenerationResult lirGenRes, 331 public static void emitCode(Backend backend, Assumptions assumptions, ResolvedJavaMethod rootMethod, Set<ResolvedJavaMethod> inlinedMethods, int bytecodeSize, LIRGenerationResult lirGenRes,
331 CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, CompilationResultBuilderFactory factory) { 332 CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, CompilationResultBuilderFactory factory) {
332 try (DebugCloseable a = EmitCode.start()) { 333 try (DebugCloseable a = EmitCode.start()) {
333 FrameMap frameMap = lirGenRes.getFrameMap(); 334 FrameMap frameMap = lirGenRes.getFrameMap();
334 CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGenRes, frameMap, compilationResult, factory); 335 CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGenRes, frameMap, compilationResult, factory);
335 backend.emitCode(crb, lirGenRes.getLIR(), installedCodeOwner); 336 backend.emitCode(crb, lirGenRes.getLIR(), installedCodeOwner);
337 if (assumptions != null && !assumptions.isEmpty()) { 338 if (assumptions != null && !assumptions.isEmpty()) {
338 compilationResult.setAssumptions(assumptions.toArray()); 339 compilationResult.setAssumptions(assumptions.toArray());
339 } 340 }
340 if (inlinedMethods != null) { 341 if (inlinedMethods != null) {
341 compilationResult.setMethods(rootMethod, inlinedMethods); 342 compilationResult.setMethods(rootMethod, inlinedMethods);
343 compilationResult.setBytecodeSize(bytecodeSize);
342 } 344 }
343 345
344 if (Debug.isMeterEnabled()) { 346 if (Debug.isMeterEnabled()) {
345 List<DataPatch> ldp = compilationResult.getDataPatches(); 347 List<DataPatch> ldp = compilationResult.getDataPatches();
346 Kind[] kindValues = Kind.values(); 348 Kind[] kindValues = Kind.values();