< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompiler.java

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.core;
  26 
  27 import java.util.Collection;
  28 import java.util.List;
  29 
  30 import jdk.internal.vm.compiler.collections.EconomicSet;
  31 import org.graalvm.compiler.code.CompilationResult;
  32 import org.graalvm.compiler.core.LIRGenerationPhase.LIRGenerationContext;
  33 import org.graalvm.compiler.core.common.GraalOptions;
  34 import org.graalvm.compiler.core.common.PermanentBailoutException;
  35 import org.graalvm.compiler.core.common.RetryableBailoutException;
  36 import org.graalvm.compiler.core.common.alloc.ComputeBlockOrder;
  37 import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
  38 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
  39 import org.graalvm.compiler.core.common.util.CompilationAlarm;
  40 import org.graalvm.compiler.core.target.Backend;
  41 import org.graalvm.compiler.debug.CounterKey;
  42 import org.graalvm.compiler.debug.DebugCloseable;
  43 import org.graalvm.compiler.debug.DebugContext;
  44 import org.graalvm.compiler.debug.GraalError;
  45 import org.graalvm.compiler.debug.MethodFilter;
  46 import org.graalvm.compiler.debug.TimerKey;
  47 import org.graalvm.compiler.lir.LIR;
  48 import org.graalvm.compiler.lir.alloc.OutOfRegistersException;
  49 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
  50 import org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory;
  51 import org.graalvm.compiler.lir.framemap.FrameMap;
  52 import org.graalvm.compiler.lir.framemap.FrameMapBuilder;
  53 import org.graalvm.compiler.lir.gen.LIRGenerationResult;
  54 import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
  55 import org.graalvm.compiler.lir.phases.AllocationPhase.AllocationContext;
  56 import org.graalvm.compiler.lir.phases.LIRSuites;
  57 import org.graalvm.compiler.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext;
  58 import org.graalvm.compiler.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext;
  59 import org.graalvm.compiler.nodes.StructuredGraph;
  60 import org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult;
  61 import org.graalvm.compiler.nodes.cfg.Block;
  62 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
  63 import org.graalvm.compiler.phases.OptimisticOptimizations;
  64 import org.graalvm.compiler.phases.PhaseSuite;
  65 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
  66 import org.graalvm.compiler.phases.tiers.HighTierContext;
  67 import org.graalvm.compiler.phases.tiers.LowTierContext;
  68 import org.graalvm.compiler.phases.tiers.MidTierContext;
  69 import org.graalvm.compiler.phases.tiers.Suites;
  70 import org.graalvm.compiler.phases.tiers.TargetProvider;
  71 import org.graalvm.compiler.phases.util.Providers;
  72 
  73 import jdk.vm.ci.code.RegisterConfig;
  74 import jdk.vm.ci.code.TargetDescription;
  75 import jdk.vm.ci.code.site.ConstantReference;
  76 import jdk.vm.ci.code.site.DataPatch;
  77 import jdk.vm.ci.meta.Assumptions;
  78 import jdk.vm.ci.meta.JavaConstant;
  79 import jdk.vm.ci.meta.JavaKind;
  80 import jdk.vm.ci.meta.ProfilingInfo;
  81 import jdk.vm.ci.meta.ResolvedJavaField;
  82 import jdk.vm.ci.meta.ResolvedJavaMethod;
  83 import jdk.vm.ci.meta.VMConstant;
  84 
  85 /**
  86  * Static methods for orchestrating the compilation of a {@linkplain StructuredGraph graph}.
  87  */
  88 public class GraalCompiler {
  89 
  90     private static final TimerKey CompilerTimer = DebugContext.timer("GraalCompiler").doc("Time spent in compilation (excludes code installation).");
  91     private static final TimerKey FrontEnd = DebugContext.timer("FrontEnd").doc("Time spent processing HIR.");
  92     private static final TimerKey EmitLIR = DebugContext.timer("EmitLIR").doc("Time spent generating LIR from HIR.");
  93     private static final TimerKey EmitCode = DebugContext.timer("EmitCode").doc("Time spent generating machine code from LIR.");
  94     private static final TimerKey BackEnd = DebugContext.timer("BackEnd").doc("Time spent in EmitLIR and EmitCode.");
  95 
  96     /**
  97      * Encapsulates all the inputs to a {@linkplain GraalCompiler#compile(Request) compilation}.
  98      */
  99     public static class Request<T extends CompilationResult> {
 100         public final StructuredGraph graph;
 101         public final ResolvedJavaMethod installedCodeOwner;
 102         public final Providers providers;
 103         public final Backend backend;
 104         public final PhaseSuite<HighTierContext> graphBuilderSuite;
 105         public final OptimisticOptimizations optimisticOpts;
 106         public final ProfilingInfo profilingInfo;
 107         public final Suites suites;
 108         public final LIRSuites lirSuites;
 109         public final T compilationResult;
 110         public final CompilationResultBuilderFactory factory;
 111         public final boolean verifySourcePositions;
 112 
 113         /**
 114          * @param graph the graph to be compiled


 161      */
 162     public static <T extends CompilationResult> T compileGraph(StructuredGraph graph, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend,
 163                     PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, Suites suites, LIRSuites lirSuites, T compilationResult,
 164                     CompilationResultBuilderFactory factory, boolean verifySourcePositions) {
 165         return compile(new Request<>(graph, installedCodeOwner, providers, backend, graphBuilderSuite, optimisticOpts, profilingInfo, suites, lirSuites, compilationResult, factory,
 166                         verifySourcePositions));
 167     }
 168 
 169     /**
 170      * Services a given compilation request.
 171      *
 172      * @return the result of the compilation
 173      */
 174     @SuppressWarnings("try")
 175     public static <T extends CompilationResult> T compile(Request<T> r) {
 176         DebugContext debug = r.graph.getDebug();
 177         try (CompilationAlarm alarm = CompilationAlarm.trackCompilationPeriod(r.graph.getOptions())) {
 178             assert !r.graph.isFrozen();
 179             try (DebugContext.Scope s0 = debug.scope("GraalCompiler", r.graph, r.providers.getCodeCache()); DebugCloseable a = CompilerTimer.start(debug)) {
 180                 emitFrontEnd(r.providers, r.backend, r.graph, r.graphBuilderSuite, r.optimisticOpts, r.profilingInfo, r.suites);
 181                 emitBackEnd(r.graph, null, r.installedCodeOwner, r.backend, r.compilationResult, r.factory, null, r.lirSuites);
 182                 if (r.verifySourcePositions) {
 183                     assert r.graph.verifySourcePositions(true);
 184                 }
 185             } catch (Throwable e) {
 186                 throw debug.handle(e);
 187             }
 188             checkForRequestedCrash(r.graph);
 189             return r.compilationResult;
 190         }
 191     }
 192 
 193     /**
 194      * Checks whether the {@link GraalCompilerOptions#CrashAt} option indicates that the compilation
 195      * of {@code graph} should result in an exception.
 196      *
 197      * @param graph a graph currently being compiled
 198      * @throws RuntimeException if the value of {@link GraalCompilerOptions#CrashAt} matches
 199      *             {@code graph.method()} or {@code graph.name}
 200      */
 201     private static void checkForRequestedCrash(StructuredGraph graph) {


 258             debug.dump(DebugContext.BASIC_LEVEL, graph, "After high tier");
 259 
 260             MidTierContext midTierContext = new MidTierContext(providers, target, optimisticOpts, profilingInfo);
 261             suites.getMidTier().apply(graph, midTierContext);
 262             graph.maybeCompress();
 263             debug.dump(DebugContext.BASIC_LEVEL, graph, "After mid tier");
 264 
 265             LowTierContext lowTierContext = new LowTierContext(providers, target);
 266             suites.getLowTier().apply(graph, lowTierContext);
 267             debug.dump(DebugContext.BASIC_LEVEL, graph, "After low tier");
 268 
 269             debug.dump(DebugContext.BASIC_LEVEL, graph.getLastSchedule(), "Final HIR schedule");
 270             graph.logInliningTree();
 271         } catch (Throwable e) {
 272             throw debug.handle(e);
 273         } finally {
 274             graph.checkCancellation();
 275         }
 276     }
 277 
 278     @SuppressWarnings("try")
 279     public static <T extends CompilationResult> void emitBackEnd(StructuredGraph graph, Object stub, ResolvedJavaMethod installedCodeOwner, Backend backend, T compilationResult,
 280                     CompilationResultBuilderFactory factory, RegisterConfig registerConfig, LIRSuites lirSuites) {
 281         DebugContext debug = graph.getDebug();
 282         try (DebugContext.Scope s = debug.scope("BackEnd", graph.getLastSchedule()); DebugCloseable a = BackEnd.start(debug)) {
 283             LIRGenerationResult lirGen = null;
 284             lirGen = emitLIR(backend, graph, stub, registerConfig, lirSuites);
 285             try (DebugContext.Scope s2 = debug.scope("CodeGen", lirGen, lirGen.getLIR())) {
 286                 int bytecodeSize = graph.method() == null ? 0 : graph.getBytecodeSize();
 287                 compilationResult.setHasUnsafeAccess(graph.hasUnsafeAccess());
 288                 emitCode(backend, graph.getAssumptions(), graph.method(), graph.getMethods(), graph.getFields(), bytecodeSize, lirGen, compilationResult, installedCodeOwner, factory);
 289             } catch (Throwable e) {
 290                 throw debug.handle(e);
 291             }
 292         } catch (Throwable e) {
 293             throw debug.handle(e);
 294         } finally {
 295             graph.checkCancellation();
 296         }
 297     }
 298 
 299     @SuppressWarnings("try")
 300     public static LIRGenerationResult emitLIR(Backend backend, StructuredGraph graph, Object stub, RegisterConfig registerConfig, LIRSuites lirSuites) {
 301         String registerPressure = GraalOptions.RegisterPressure.getValue(graph.getOptions());
 302         String[] allocationRestrictedTo = registerPressure == null ? null : registerPressure.split(",");
 303         try {
 304             return emitLIR0(backend, graph, stub, registerConfig, lirSuites, allocationRestrictedTo);
 305         } catch (OutOfRegistersException e) {
 306             if (allocationRestrictedTo != null) {
 307                 allocationRestrictedTo = null;
 308                 return emitLIR0(backend, graph, stub, registerConfig, lirSuites, allocationRestrictedTo);
 309             }
 310             /* If the re-execution fails we convert the exception into a "hard" failure */
 311             throw new GraalError(e);
 312         } finally {
 313             graph.checkCancellation();
 314         }
 315     }
 316 
 317     @SuppressWarnings("try")
 318     private static LIRGenerationResult emitLIR0(Backend backend, StructuredGraph graph, Object stub, RegisterConfig registerConfig, LIRSuites lirSuites,
 319                     String[] allocationRestrictedTo) {
 320         DebugContext debug = graph.getDebug();
 321         try (DebugContext.Scope ds = debug.scope("EmitLIR"); DebugCloseable a = EmitLIR.start(debug)) {
 322             assert !graph.hasValueProxies();
 323             ScheduleResult schedule = graph.getLastSchedule();
 324             Block[] blocks = schedule.getCFG().getBlocks();
 325             Block startBlock = schedule.getCFG().getStartBlock();
 326             assert startBlock != null;
 327             assert startBlock.getPredecessorCount() == 0;
 328 
 329             AbstractBlockBase<?>[] codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blocks.length, startBlock);
 330             AbstractBlockBase<?>[] linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.length, startBlock);
 331             LIR lir = new LIR(schedule.getCFG(), linearScanOrder, codeEmittingOrder, graph.getOptions(), graph.getDebug());
 332 
 333             FrameMapBuilder frameMapBuilder = backend.newFrameMapBuilder(registerConfig);
 334             LIRGenerationResult lirGenRes = backend.newLIRGenerationResult(graph.compilationId(), lir, frameMapBuilder, graph, stub);
 335             LIRGeneratorTool lirGen = backend.newLIRGenerator(lirGenRes);
 336             NodeLIRBuilderTool nodeLirGen = backend.newNodeLIRBuilder(graph, lirGen);
 337 
 338             // LIR generation
 339             LIRGenerationContext context = new LIRGenerationContext(lirGen, nodeLirGen, graph, schedule);
 340             new LIRGenerationPhase().apply(backend.getTarget(), lirGenRes, context);
 341 
 342             try (DebugContext.Scope s = debug.scope("LIRStages", nodeLirGen, lirGenRes, lir)) {
 343                 // Dump LIR along with HIR (the LIR is looked up from context)
 344                 debug.dump(DebugContext.BASIC_LEVEL, graph.getLastSchedule(), "After LIR generation");
 345                 LIRGenerationResult result = emitLowLevel(backend.getTarget(), lirGenRes, lirGen, lirSuites, backend.newRegisterAllocationConfig(registerConfig, allocationRestrictedTo));
 346                 return result;
 347             } catch (Throwable e) {
 348                 throw debug.handle(e);
 349             }
 350         } catch (Throwable e) {
 351             throw debug.handle(e);
 352         } finally {
 353             graph.checkCancellation();
 354         }
 355     }
 356 
 357     protected static <T extends CompilationResult> String getCompilationUnitName(StructuredGraph graph, T compilationResult) {
 358         if (compilationResult != null && compilationResult.getName() != null) {
 359             return compilationResult.getName();
 360         }
 361         ResolvedJavaMethod method = graph.method();
 362         if (method == null) {
 363             return "<unknown>";
 364         }
 365         return method.format("%H.%n(%p)");
 366     }
 367 
 368     public static LIRGenerationResult emitLowLevel(TargetDescription target, LIRGenerationResult lirGenRes, LIRGeneratorTool lirGen, LIRSuites lirSuites,
 369                     RegisterAllocationConfig registerAllocationConfig) {
 370         DebugContext debug = lirGenRes.getLIR().getDebug();
 371         PreAllocationOptimizationContext preAllocOptContext = new PreAllocationOptimizationContext(lirGen);
 372         lirSuites.getPreAllocationOptimizationStage().apply(target, lirGenRes, preAllocOptContext);
 373         debug.dump(DebugContext.BASIC_LEVEL, lirGenRes.getLIR(), "After PreAllocationOptimizationStage");
 374 
 375         AllocationContext allocContext = new AllocationContext(lirGen.getSpillMoveFactory(), registerAllocationConfig);
 376         lirSuites.getAllocationStage().apply(target, lirGenRes, allocContext);
 377         debug.dump(DebugContext.BASIC_LEVEL, lirGenRes.getLIR(), "After AllocationStage");
 378 
 379         PostAllocationOptimizationContext postAllocOptContext = new PostAllocationOptimizationContext(lirGen);
 380         lirSuites.getPostAllocationOptimizationStage().apply(target, lirGenRes, postAllocOptContext);
 381         debug.dump(DebugContext.BASIC_LEVEL, lirGenRes.getLIR(), "After PostAllocationOptimizationStage");
 382 
 383         return lirGenRes;
 384     }
 385 
 386     @SuppressWarnings("try")
 387     public static void emitCode(Backend backend, Assumptions assumptions, ResolvedJavaMethod rootMethod, Collection<ResolvedJavaMethod> inlinedMethods, EconomicSet<ResolvedJavaField> accessedFields,
 388                     int bytecodeSize, LIRGenerationResult lirGenRes,
 389                     CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, CompilationResultBuilderFactory factory) {
 390         DebugContext debug = lirGenRes.getLIR().getDebug();
 391         try (DebugCloseable a = EmitCode.start(debug)) {
 392             FrameMap frameMap = lirGenRes.getFrameMap();
 393             CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGenRes, frameMap, compilationResult, factory);
 394             backend.emitCode(crb, lirGenRes.getLIR(), installedCodeOwner);
 395             if (assumptions != null && !assumptions.isEmpty()) {
 396                 compilationResult.setAssumptions(assumptions.toArray());
 397             }
 398             if (rootMethod != null) {
 399                 compilationResult.setMethods(rootMethod, inlinedMethods);
 400                 compilationResult.setFields(accessedFields);
 401                 compilationResult.setBytecodeSize(bytecodeSize);
 402             }
 403             crb.finish();
 404             if (debug.isCountEnabled()) {
 405                 List<DataPatch> ldp = compilationResult.getDataPatches();
 406                 JavaKind[] kindValues = JavaKind.values();
 407                 CounterKey[] dms = new CounterKey[kindValues.length];
 408                 for (int i = 0; i < dms.length; i++) {
 409                     dms[i] = DebugContext.counter("DataPatches-%s", kindValues[i]);
 410                 }
 411 
 412                 for (DataPatch dp : ldp) {
 413                     JavaKind kind = JavaKind.Illegal;
 414                     if (dp.reference instanceof ConstantReference) {
 415                         VMConstant constant = ((ConstantReference) dp.reference).getConstant();
 416                         if (constant instanceof JavaConstant) {
 417                             kind = ((JavaConstant) constant).getJavaKind();
 418                         }
 419                     }
 420                     dms[kind.ordinal()].add(debug, 1);
 421                 }
 422 
 423                 DebugContext.counter("CompilationResults").increment(debug);
 424                 DebugContext.counter("CodeBytesEmitted").add(debug, compilationResult.getTargetCodeSize());
 425                 DebugContext.counter("InfopointsEmitted").add(debug, compilationResult.getInfopoints().size());
 426                 DebugContext.counter("DataPatches").add(debug, ldp.size());
 427                 DebugContext.counter("ExceptionHandlersEmitted").add(debug, compilationResult.getExceptionHandlers().size());
 428             }
 429 
 430             debug.dump(DebugContext.BASIC_LEVEL, compilationResult, "After code generation");
 431         }
 432     }
 433 }


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.core;
  26 




  27 import org.graalvm.compiler.code.CompilationResult;


  28 import org.graalvm.compiler.core.common.PermanentBailoutException;
  29 import org.graalvm.compiler.core.common.RetryableBailoutException;



  30 import org.graalvm.compiler.core.common.util.CompilationAlarm;
  31 import org.graalvm.compiler.core.target.Backend;

  32 import org.graalvm.compiler.debug.DebugCloseable;
  33 import org.graalvm.compiler.debug.DebugContext;

  34 import org.graalvm.compiler.debug.MethodFilter;
  35 import org.graalvm.compiler.debug.TimerKey;



  36 import org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory;





  37 import org.graalvm.compiler.lir.phases.LIRSuites;


  38 import org.graalvm.compiler.nodes.StructuredGraph;



  39 import org.graalvm.compiler.phases.OptimisticOptimizations;
  40 import org.graalvm.compiler.phases.PhaseSuite;
  41 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
  42 import org.graalvm.compiler.phases.tiers.HighTierContext;
  43 import org.graalvm.compiler.phases.tiers.LowTierContext;
  44 import org.graalvm.compiler.phases.tiers.MidTierContext;
  45 import org.graalvm.compiler.phases.tiers.Suites;
  46 import org.graalvm.compiler.phases.tiers.TargetProvider;
  47 import org.graalvm.compiler.phases.util.Providers;
  48 







  49 import jdk.vm.ci.meta.ProfilingInfo;

  50 import jdk.vm.ci.meta.ResolvedJavaMethod;

  51 
  52 /**
  53  * Static methods for orchestrating the compilation of a {@linkplain StructuredGraph graph}.
  54  */
  55 public class GraalCompiler {
  56 
  57     private static final TimerKey CompilerTimer = DebugContext.timer("GraalCompiler").doc("Time spent in compilation (excludes code installation).");
  58     private static final TimerKey FrontEnd = DebugContext.timer("FrontEnd").doc("Time spent processing HIR.");



  59 
  60     /**
  61      * Encapsulates all the inputs to a {@linkplain GraalCompiler#compile(Request) compilation}.
  62      */
  63     public static class Request<T extends CompilationResult> {
  64         public final StructuredGraph graph;
  65         public final ResolvedJavaMethod installedCodeOwner;
  66         public final Providers providers;
  67         public final Backend backend;
  68         public final PhaseSuite<HighTierContext> graphBuilderSuite;
  69         public final OptimisticOptimizations optimisticOpts;
  70         public final ProfilingInfo profilingInfo;
  71         public final Suites suites;
  72         public final LIRSuites lirSuites;
  73         public final T compilationResult;
  74         public final CompilationResultBuilderFactory factory;
  75         public final boolean verifySourcePositions;
  76 
  77         /**
  78          * @param graph the graph to be compiled


 125      */
 126     public static <T extends CompilationResult> T compileGraph(StructuredGraph graph, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend,
 127                     PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, Suites suites, LIRSuites lirSuites, T compilationResult,
 128                     CompilationResultBuilderFactory factory, boolean verifySourcePositions) {
 129         return compile(new Request<>(graph, installedCodeOwner, providers, backend, graphBuilderSuite, optimisticOpts, profilingInfo, suites, lirSuites, compilationResult, factory,
 130                         verifySourcePositions));
 131     }
 132 
 133     /**
 134      * Services a given compilation request.
 135      *
 136      * @return the result of the compilation
 137      */
 138     @SuppressWarnings("try")
 139     public static <T extends CompilationResult> T compile(Request<T> r) {
 140         DebugContext debug = r.graph.getDebug();
 141         try (CompilationAlarm alarm = CompilationAlarm.trackCompilationPeriod(r.graph.getOptions())) {
 142             assert !r.graph.isFrozen();
 143             try (DebugContext.Scope s0 = debug.scope("GraalCompiler", r.graph, r.providers.getCodeCache()); DebugCloseable a = CompilerTimer.start(debug)) {
 144                 emitFrontEnd(r.providers, r.backend, r.graph, r.graphBuilderSuite, r.optimisticOpts, r.profilingInfo, r.suites);
 145                 r.backend.emitBackEnd(r.graph, null, r.installedCodeOwner, r.compilationResult, r.factory, null, r.lirSuites);
 146                 if (r.verifySourcePositions) {
 147                     assert r.graph.verifySourcePositions(true);
 148                 }
 149             } catch (Throwable e) {
 150                 throw debug.handle(e);
 151             }
 152             checkForRequestedCrash(r.graph);
 153             return r.compilationResult;
 154         }
 155     }
 156 
 157     /**
 158      * Checks whether the {@link GraalCompilerOptions#CrashAt} option indicates that the compilation
 159      * of {@code graph} should result in an exception.
 160      *
 161      * @param graph a graph currently being compiled
 162      * @throws RuntimeException if the value of {@link GraalCompilerOptions#CrashAt} matches
 163      *             {@code graph.method()} or {@code graph.name}
 164      */
 165     private static void checkForRequestedCrash(StructuredGraph graph) {


 222             debug.dump(DebugContext.BASIC_LEVEL, graph, "After high tier");
 223 
 224             MidTierContext midTierContext = new MidTierContext(providers, target, optimisticOpts, profilingInfo);
 225             suites.getMidTier().apply(graph, midTierContext);
 226             graph.maybeCompress();
 227             debug.dump(DebugContext.BASIC_LEVEL, graph, "After mid tier");
 228 
 229             LowTierContext lowTierContext = new LowTierContext(providers, target);
 230             suites.getLowTier().apply(graph, lowTierContext);
 231             debug.dump(DebugContext.BASIC_LEVEL, graph, "After low tier");
 232 
 233             debug.dump(DebugContext.BASIC_LEVEL, graph.getLastSchedule(), "Final HIR schedule");
 234             graph.logInliningTree();
 235         } catch (Throwable e) {
 236             throw debug.handle(e);
 237         } finally {
 238             graph.checkCancellation();
 239         }
 240     }
 241 















































































 242     protected static <T extends CompilationResult> String getCompilationUnitName(StructuredGraph graph, T compilationResult) {
 243         if (compilationResult != null && compilationResult.getName() != null) {
 244             return compilationResult.getName();
 245         }
 246         ResolvedJavaMethod method = graph.method();
 247         if (method == null) {
 248             return "<unknown>";
 249         }
 250         return method.format("%H.%n(%p)");


































































 251     }
 252 }
< prev index next >