Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
import static jdk.vm.ci.meta.DeoptimizationAction.InvalidateReprofile;
import static org.graalvm.compiler.core.common.type.StampFactory.objectNonNull;

import java.util.ArrayList;
import java.util.List;

import org.graalvm.collections.Pair;
import org.graalvm.compiler.bytecode.Bytecode;
import org.graalvm.compiler.bytecode.BytecodeProvider;
import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
Expand Down Expand Up @@ -263,19 +259,6 @@ default int getDepth() {
return result;
}

default List<Pair<ResolvedJavaMethod, Integer>> getCallingContext() {
List<Pair<ResolvedJavaMethod, Integer>> callingContext = new ArrayList<>();
/*
* We always add a method which bytecode is parsed, so size of this list is minimum one.
*/
GraphBuilderContext cur = this;
while (cur != null) {
callingContext.add(Pair.create(cur.getMethod(), cur.bci()));
cur = cur.getParent();
}
return callingContext;
}

/**
* Determines if this parsing context is within the bytecode of an intrinsic or a method inlined
* by an intrinsic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.graalvm.compiler.phases.OptimisticOptimizations;

import com.oracle.graal.pointsto.BigBang;
import com.oracle.graal.pointsto.flow.AnalysisParsedGraph;
import com.oracle.graal.pointsto.meta.AnalysisMethod;
import com.oracle.graal.pointsto.meta.AnalysisType;
import com.oracle.graal.pointsto.meta.AnalysisUniverse;
Expand Down Expand Up @@ -108,10 +107,6 @@ default String getImageName() {

void methodBeforeTypeFlowCreationHook(BigBang bb, AnalysisMethod method, StructuredGraph graph);

default AnalysisParsedGraph parseBytecode(BigBang bb, AnalysisMethod analysisMethod) {
return AnalysisParsedGraph.parseBytecode(bb, analysisMethod);
}

default boolean hasNeverInlineDirective(@SuppressWarnings("unused") ResolvedJavaMethod method) {
/* No inlining by the static analysis unless explicitly overwritten by the VM. */
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ public AnalysisParsedGraph ensureGraphParsed(BigBang bb) {
continue;
}

AnalysisParsedGraph graph = bb.getHostVM().parseBytecode(bb, this);
AnalysisParsedGraph graph = AnalysisParsedGraph.parseBytecode(bb, this);

/*
* Since we still hold the parsing lock, the transition form "parsing" to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,6 @@
import com.oracle.svm.hosted.phases.CInterfaceInvocationPlugin;
import com.oracle.svm.hosted.phases.ConstantFoldLoadFieldPlugin;
import com.oracle.svm.hosted.phases.EarlyConstantFoldLoadFieldPlugin;
import com.oracle.svm.hosted.phases.ExperimentalNativeImageInlineDuringParsingPlugin;
import com.oracle.svm.hosted.phases.ExperimentalNativeImageInlineDuringParsingSupport;
import com.oracle.svm.hosted.phases.InjectedAccessorsPlugin;
import com.oracle.svm.hosted.phases.IntrinsifyMethodHandlesInvocationPlugin;
import com.oracle.svm.hosted.phases.SubstrateClassInitializationPlugin;
Expand Down Expand Up @@ -844,9 +842,6 @@ private void setupNativeImage(String imageName, OptionValues options, Map<Method
ImageSingletons.add(RuntimeClassInitializationSupport.class, classInitializationSupport);
ClassInitializationFeature.processClassInitializationOptions(classInitializationSupport);

/* Initialize the registry for the inline decisions */
ImageSingletons.add(ExperimentalNativeImageInlineDuringParsingSupport.class, new ExperimentalNativeImageInlineDuringParsingSupport());

featureHandler.registerFeatures(loader, debug);
AfterRegistrationAccessImpl access = new AfterRegistrationAccessImpl(featureHandler, loader, originalMetaAccess, mainEntryPoint, debug);
featureHandler.forEachFeature(feature -> feature.afterRegistration(access));
Expand Down Expand Up @@ -1141,10 +1136,6 @@ public static void registerGraphBuilderPlugins(FeatureHandler featureHandler, Ru
SubstrateReplacements replacements = (SubstrateReplacements) providers.getReplacements();
plugins.appendInlineInvokePlugin(replacements);

if (nativeImageInlineDuringParsingEnabled()) {
plugins.appendInlineInvokePlugin(new ExperimentalNativeImageInlineDuringParsingPlugin(reason, providers));
}

plugins.appendNodePlugin(new IntrinsifyMethodHandlesInvocationPlugin(reason, providers, aUniverse, hUniverse));
plugins.appendNodePlugin(new DeletedFieldsPlugin());
plugins.appendNodePlugin(new InjectedAccessorsPlugin());
Expand Down Expand Up @@ -1240,12 +1231,6 @@ public <T> T getInjectedArgument(Class<T> type) {
}
}

public static boolean nativeImageInlineDuringParsingEnabled() {
return ExperimentalNativeImageInlineDuringParsingPlugin.Options.OldInlineBeforeAnalysis.getValue() &&
!ImageSingletons.lookup(ExperimentalNativeImageInlineDuringParsingSupport.class).isNativeImageInlineDuringParsingDisabled() &&
!DeoptTester.Options.DeoptimizeAll.getValue();
}

@SuppressWarnings("try")
public static void registerReplacements(DebugContext debug, FeatureHandler featureHandler, RuntimeConfiguration runtimeConfig, Providers providers,
SnippetReflectionProvider snippetReflection, boolean hosted, boolean initForeignCalls) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
import com.oracle.graal.pointsto.api.HostVM;
import com.oracle.graal.pointsto.api.PointstoOptions;
import com.oracle.graal.pointsto.constraints.UnsupportedFeatureException;
import com.oracle.graal.pointsto.flow.AnalysisParsedGraph;
import com.oracle.graal.pointsto.infrastructure.OriginalClassProvider;
import com.oracle.graal.pointsto.meta.AnalysisField;
import com.oracle.graal.pointsto.meta.AnalysisMethod;
Expand Down Expand Up @@ -107,8 +106,6 @@
import com.oracle.svm.hosted.phases.AnalysisGraphBuilderPhase;
import com.oracle.svm.hosted.phases.ImplicitAssertionsPhase;
import com.oracle.svm.hosted.phases.InlineBeforeAnalysisPolicyImpl;
import com.oracle.svm.hosted.phases.IntrinsifyMethodHandlesInvocationPlugin.IntrinsificationRegistry;
import com.oracle.svm.hosted.snippets.ReflectionPlugins.ReflectionPluginRegistry;
import com.oracle.svm.hosted.substitute.UnsafeAutomaticSubstitutionProcessor;
import com.oracle.svm.util.ReflectionUtil;

Expand Down Expand Up @@ -697,21 +694,6 @@ public boolean isAnalysisTrivialMethod(AnalysisMethod method) {
return analysisTrivialMethods.containsKey(method);
}

@Override
@SuppressWarnings("try")
public AnalysisParsedGraph parseBytecode(BigBang bb, AnalysisMethod analysisMethod) {
/*
* Temporarily pause the thread local registries. The results of parsing need to be
* persistent.
*/
try (AutoCloseable ignored1 = ReflectionPluginRegistry.pauseThreadLocalRegistry();
AutoCloseable ignored2 = IntrinsificationRegistry.pauseThreadLocalRegistry()) {
return AnalysisParsedGraph.parseBytecode(bb, analysisMethod);
} catch (Throwable e) {
throw bb.getDebug().handle(e);
}
}

@Override
public boolean hasNeverInlineDirective(ResolvedJavaMethod method) {
if (GuardedAnnotationAccess.isAnnotationPresent(method, NeverInline.class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ public boolean handleInvoke(GraphBuilderContext b, ResolvedJavaMethod method, Va
Method switchTableMethod = ReflectionUtil.lookupMethod(aMethod.getDeclaringClass().getJavaClass(), method.getName());
Object switchTable = switchTableMethod.invoke(null);
if (switchTable instanceof int[]) {
ImageSingletons.lookup(ReflectionPlugins.ReflectionPluginRegistry.class).add(b.getCallingContext(), switchTable);
ImageSingletons.lookup(ReflectionPlugins.ReflectionPluginRegistry.class).add(b.getMethod(), b.bci(), switchTable);
}
} catch (ReflectiveOperationException ex) {
throw GraalError.shouldNotReachHere(ex);
}
}

Object switchTable = ImageSingletons.lookup(ReflectionPlugins.ReflectionPluginRegistry.class).get(b.getCallingContext());
Object switchTable = ImageSingletons.lookup(ReflectionPlugins.ReflectionPluginRegistry.class).get(b.getMethod(), b.bci());
if (switchTable != null) {
b.addPush(JavaKind.Object, ConstantNode.forConstant(snippetReflection.forObject(switchTable), 1, true, b.getMetaAccess()));
return true;
Expand Down
Loading