# HG changeset patch # User Tom Rodriguez # Date 1425352879 28800 # Node ID 6bc0c7c6f690a0deef8393281bf4d3591694a79f # Parent 16b239e422d2cf92e6aea4cf88879e649ab31b0b Add EmitLIRRepeatCount to repeat emitLIR for profiling diff -r 16b239e422d2 -r 6bc0c7c6f690 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Mar 02 19:18:31 2015 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Mar 02 19:21:19 2015 -0800 @@ -95,6 +95,9 @@ @Option(help = "Pattern for method(s) to which intrinsification will not be applied. " + "See MethodFilter class for pattern syntax.", type = OptionType.Debug) public static final OptionValue IntrinsificationsDisabled = new OptionValue<>(null); + + @Option(help = "Repeatedly run the LIR code generation pass to improve statistical profiling results.", type = OptionType.Debug) + public static final OptionValue EmitLIRRepeatCount = new OptionValue<>(0); // @formatter:on } @@ -279,6 +282,14 @@ public static void emitBackEnd(StructuredGraph graph, Object stub, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Backend backend, TargetDescription target, T compilationResult, CompilationResultBuilderFactory factory, SchedulePhase schedule, RegisterConfig registerConfig, LIRSuites lirSuites) { try (Scope s = Debug.scope("BackEnd"); TimerCloseable a = BackEnd.start()) { + // Repeatedly run the LIR code generation pass to improve statistical profiling results. + for (int i = 0; i < EmitLIRRepeatCount.getValue(); i++) { + SchedulePhase dummySchedule = new SchedulePhase(); + dummySchedule.setScheduleConstants(true); + dummySchedule.apply(graph); + emitLIR(backend, target, dummySchedule, graph, stub, cc, registerConfig, lirSuites); + } + LIRGenerationResult lirGen = null; lirGen = emitLIR(backend, target, schedule, graph, stub, cc, registerConfig, lirSuites); try (Scope s2 = Debug.scope("CodeGen", lirGen, lirGen.getLIR())) {