/** * Track methods that have a stack values. This is later used for deoptimization testing during * compilation. */ private void recordMethodsWithStackValues() { bigbang.getUniverse().getMethods().parallelStream().forEach(analysisMethod -> { if (analysisMethod.getTypeFlow() != null && analysisMethod.getTypeFlow().getGraph() != null && analysisMethod.getTypeFlow().getGraph().getNodes(StackValueNode.TYPE).isNotEmpty()) { hUniverse.recordMethodWithStackValues(analysisMethod); } }); }
public void scanBootImageHeapRoots(Comparator<AnalysisField> fieldComparator, Comparator<AnalysisMethod> methodComparator) { // scan the original roots // the original roots are all the static fields, of object type, that were accessed bb.getUniverse().getFields().stream() .filter(field -> Modifier.isStatic(field.getModifiers()) && field.getJavaKind() == JavaKind.Object && field.isAccessed()) .sorted(fieldComparator) .forEach(field -> scanField(field, null, field)); // scan the constant nodes bb.getUniverse().getMethods().stream() .filter(method -> method.getTypeFlow().getGraph() != null) .sorted(methodComparator) .forEach(this::scanMethod); finish(); }
/** Visit the callees of this method. */ VisitResult walkCallees(AnalysisMethod method, CallPathVisitor visitor) { final StructuredGraph graph = method.getTypeFlow().getGraph(); if (graph != null) { for (Invoke invoke : graph.getInvokes()) { final CallTargetNode callTarget = invoke.callTarget(); final AnalysisMethod callee = (AnalysisMethod) callTarget.targetMethod(); walkMethodAndCallees(callee, method, invoke, visitor); } } return VisitResult.CONTINUE; }
private void scanMethod(AnalysisMethod method) { try { StreamSupport.stream(method.getTypeFlow().getGraph().getNodes().spliterator(), false) .filter(n -> n instanceof ConstantNode).forEach(n -> { ConstantNode cn = (ConstantNode) n; JavaConstant c = (JavaConstant) cn.getValue(); if (c.getJavaKind() == JavaKind.Object) { scanConstant(c, method); } }); } catch (UnsupportedFeatureException ex) { bb.getUnsupportedFeatures().addMessage(method.format("%H.%n(%p)"), method, ex.getMessage(), null, ex); } }
@Override public InlineInfo shouldInlineInvoke(GraphBuilderContext builder, ResolvedJavaMethod original, ValueNode[] arguments) { if (original.getAnnotation(NeverInline.class) != null) { return InlineInfo.DO_NOT_INLINE_WITH_EXCEPTION; } else if (invocationPlugins.lookupInvocation(original) != null) { return InlineInfo.DO_NOT_INLINE_WITH_EXCEPTION; } else if (original.getAnnotation(ExplodeLoop.class) != null) { return InlineInfo.DO_NOT_INLINE_WITH_EXCEPTION; } else if (replacements.hasSubstitution(original, builder.bci())) { return InlineInfo.DO_NOT_INLINE_WITH_EXCEPTION; } for (ResolvedJavaMethod m : partialEvaluator.getNeverInlineMethods()) { if (original.equals(m)) { return InlineInfo.DO_NOT_INLINE_WITH_EXCEPTION; } } StructuredGraph graph = ((AnalysisMethod) original).getTypeFlow().getGraph(); if (graph != null && original.getCode() != null && includeMethodPredicate.test(original) && InliningUtilities.isTrivialMethod(graph) && builder.getDepth() < InlineDuringParsingMaxDepth.getValue(HostedOptionValues.singleton())) { return createStandardInlineInfo(original); } return null; } }