public void postTask(final DebugContextRunnable task) { executor.execute(task); }
public void postFlow(final TypeFlow<?> operation) { if (operation.inQueue) { return; } operation.inQueue = true; executor.execute(new TypeFlowRunnable() { @Override public void run(DebugContext ignored) { PointsToStats.registerTypeFlowQueuedUpdate(BigBang.this, operation); operation.inQueue = false; operation.update(BigBang.this); } @Override public String toString() { return "Operation: " + operation.toString(); } @Override public TypeFlow<?> getTypeFlow() { return operation; } @Override public DebugContext getDebug(OptionValues opts, List<DebugHandlersFactory> factories) { return DebugContext.DISABLED; } }); }
protected void ensureParsed(HostedMethod method, CompileReason reason) { if (!method.compilationInfo.inParseQueue.getAndSet(true)) { executor.execute(new ParseTask(method, reason)); } }
@SuppressWarnings("try") private void inlineTrivialMethods(DebugContext debug) throws InterruptedException { for (HostedMethod method : universe.getMethods()) { try (DebugContext.Scope s = debug.scope("InlineTrivial", method.compilationInfo.getGraph(), method, this)) { if (method.compilationInfo.getGraph() != null) { checkTrivial(method); } } catch (Throwable e) { throw debug.handle(e); } } int round = 0; do { inliningProgress = false; round++; try (Indent ignored = debug.logAndIndent("==== Trivial Inlining round %d\n", round)) { executor.init(); universe.getMethods().stream().filter(method -> method.compilationInfo.getGraph() != null).forEach(method -> executor.execute(new TrivialInlineTask(method))); universe.getMethods().stream().map(method -> method.compilationInfo.getDeoptTargetMethod()).filter(Objects::nonNull).forEach( deoptTargetMethod -> executor.execute(new TrivialInlineTask(deoptTargetMethod))); executor.start(); executor.complete(); executor.shutdown(); } } while (inliningProgress); }
protected void ensureCompiled(HostedMethod method, CompileReason reason) { CompileTask task = new CompileTask(method, reason); CompileTask oldTask = compilations.putIfAbsent(method, task); if (oldTask != null) { // Method is already scheduled for compilation. if (oldTask.allReasons != null) { oldTask.allReasons.add(reason); } return; } if (method.compilationInfo.specializedArguments != null) { // Do the specialization: replace the argument locals with the constant arguments. StructuredGraph graph = method.compilationInfo.graph; int idx = 0; for (ConstantNode argument : method.compilationInfo.specializedArguments) { ParameterNode local = graph.getParameter(idx++); if (local != null) { local.replaceAndDelete(ConstantNode.forConstant(argument.asJavaConstant(), runtimeConfig.getProviders().getMetaAccess(), graph)); } } } executor.execute(task); method.setCompiled(); }