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
1 change: 0 additions & 1 deletion java-benchmarks/mx.java-benchmarks/mx_java_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ def extra_image_build_argument(self, benchmark, args):
'-H:+AddAllCharsets',
'-H:+ReportExceptionStackTraces',
] + mx_sdk_vm_impl.svm_experimental_options([
'-H:-ParseOnce',
'-H:+AllowFoldMethods',
'-H:-UseServiceLoaderFeature',
'-H:+AllowDeprecatedBuilderClassesOnImageClasspath', # needs to be removed once GR-41746 is fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected void scanField(AnalysisField field, JavaConstant receiver, ScanReason
System.lineSeparator() + backtrace);
}

if (fieldValue.getJavaKind() == JavaKind.Object && bb.getHostVM().isRelocatedPointer(bb.getMetaAccess(), fieldValue)) {
if (fieldValue.getJavaKind() == JavaKind.Object && bb.getHostVM().isRelocatedPointer(fieldValue)) {
scanningObserver.forRelocatedPointerFieldValue(receiver, field, fieldValue, reason);
} else if (fieldValue.isNull()) {
scanningObserver.forNullFieldValue(receiver, field, reason);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,11 @@
import java.util.function.BiConsumer;
import java.util.function.Function;

import jdk.graal.compiler.core.common.spi.ForeignCallDescriptor;
import jdk.graal.compiler.core.common.spi.ForeignCallsProvider;
import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.java.GraphBuilderPhase.Instance;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
import jdk.graal.compiler.nodes.graphbuilderconf.IntrinsicContext;
import jdk.graal.compiler.options.OptionValues;
import jdk.graal.compiler.phases.OptimisticOptimizations;
import org.graalvm.nativeimage.hosted.Feature.DuringAnalysisAccess;

import com.oracle.graal.pointsto.BigBang;
import com.oracle.graal.pointsto.PointsToAnalysis;
import com.oracle.graal.pointsto.flow.InvokeTypeFlow;
import com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess;
import com.oracle.graal.pointsto.meta.AnalysisField;
import com.oracle.graal.pointsto.meta.AnalysisMethod;
import com.oracle.graal.pointsto.meta.AnalysisType;
Expand All @@ -62,6 +52,15 @@
import com.oracle.graal.pointsto.util.AnalysisError;
import com.oracle.svm.common.meta.MultiMethod;

import jdk.graal.compiler.core.common.spi.ForeignCallDescriptor;
import jdk.graal.compiler.core.common.spi.ForeignCallsProvider;
import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.java.GraphBuilderPhase.Instance;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
import jdk.graal.compiler.nodes.graphbuilderconf.IntrinsicContext;
import jdk.graal.compiler.options.OptionValues;
import jdk.graal.compiler.phases.OptimisticOptimizations;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;
Expand Down Expand Up @@ -94,7 +93,7 @@ public OptionValues options() {
* @param metaAccess the meta-access provider
* @param constant the constant to check
*/
public boolean isRelocatedPointer(UniverseMetaAccess metaAccess, JavaConstant constant) {
public boolean isRelocatedPointer(JavaConstant constant) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ private void notifyAnalysis(AnalysisField field, ImageHeapInstance receiver, Jav

private boolean doNotifyAnalysis(AnalysisField field, JavaConstant receiver, JavaConstant fieldValue, ScanReason reason) {
boolean analysisModified = false;
if (fieldValue.getJavaKind() == JavaKind.Object && hostVM.isRelocatedPointer(metaAccess, fieldValue)) {
if (fieldValue.getJavaKind() == JavaKind.Object && hostVM.isRelocatedPointer(fieldValue)) {
/* Ensure the relocatable pointer type is analysed. */
((AnalysisType) ((TypedConstant) fieldValue).getType(metaAccess)).registerAsReachable(reason);
analysisModified = scanningObserver.forRelocatedPointerFieldValue(receiver, field, fieldValue, reason);
Expand Down Expand Up @@ -450,15 +450,15 @@ private void notifyAnalysis(ImageHeapArray array, AnalysisType arrayType, int el
}

private boolean isNonNullObjectConstant(JavaConstant constant) {
return constant.getJavaKind() == JavaKind.Object && constant.isNonNull() && !universe.hostVM().isRelocatedPointer(metaAccess, constant);
return constant.getJavaKind() == JavaKind.Object && constant.isNonNull() && !universe.hostVM().isRelocatedPointer(constant);
}

private boolean notifyAnalysis(JavaConstant array, AnalysisType arrayType, JavaConstant elementValue, int elementIndex, ScanReason reason) {
boolean analysisModified;
if (elementValue.isNull()) {
analysisModified = scanningObserver.forNullArrayElement(array, arrayType, elementIndex, reason);
} else {
if (universe.hostVM().isRelocatedPointer(metaAccess, elementValue)) {
if (universe.hostVM().isRelocatedPointer(elementValue)) {
return false;
}
AnalysisType elementType = metaAccess.lookupJavaType(elementValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@
*/
package com.oracle.graal.pointsto.infrastructure;

import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.nodes.StructuredGraph;

import com.oracle.graal.pointsto.meta.HostedProviders;

import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.vm.ci.meta.ResolvedJavaMethod;

public interface GraphProvider {
enum Purpose {
ANALYSIS,
AOT_COMPILATION,
PREPARE_RUNTIME_COMPILATION,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public boolean isForHosted() {
}

public boolean duringAnalysis() {
return this == PointsToAnalysis || (SubstrateOptions.parseOnce() && this == JITCompilation);
return this == PointsToAnalysis || this == JITCompilation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
public class SubstrateOptions {

@Option(help = "Deprecated, option no longer has any effect.", deprecated = true, deprecationMessage = "It no longer has any effect, and no replacement is available")//
public static final HostedOptionKey<Boolean> ParseOnce = new HostedOptionKey<>(true);
static final HostedOptionKey<Boolean> ParseOnce = new HostedOptionKey<>(true);
@Option(help = "Deprecated, option no longer has any effect.", deprecated = true, deprecationMessage = "It no longer has any effect, and no replacement is available")//
static final HostedOptionKey<Boolean> ParseOnceJIT = new HostedOptionKey<>(true);
@Option(help = "Preserve the local variable information for every Java source line to allow line-by-line stepping in the debugger. Allow the lookup of Java-level method information, e.g., in stack traces.")//
Expand All @@ -86,14 +86,6 @@ public class SubstrateOptions {
@Option(help = "Image Build ID is a 128-bit UUID string generated randomly, once per bundle or digest of input args when bundles are not used.")//
public static final HostedOptionKey<String> ImageBuildID = new HostedOptionKey<>("");

public static boolean parseOnce() {
/*
* GR-48579: Old code only reachable when this method would return false will be deleted
* later.
*/
return true;
}

@Option(help = "Module containing the class that contains the main entry point. Optional if --shared is used.", type = OptionType.User)//
public static final HostedOptionKey<String> Module = new HostedOptionKey<>("");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/
package com.oracle.svm.core.graal.nodes;

import com.oracle.svm.common.meta.MultiMethod;

import jdk.graal.compiler.core.common.type.StampFactory;
import jdk.graal.compiler.graph.Node;
import jdk.graal.compiler.graph.NodeClass;
Expand All @@ -34,14 +36,8 @@
import jdk.graal.compiler.nodes.FixedWithNextNode;
import jdk.graal.compiler.nodes.spi.Canonicalizable;
import jdk.graal.compiler.nodes.spi.CanonicalizerTool;

import com.oracle.svm.common.meta.MultiMethod;
import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.meta.SharedMethod;

import jdk.vm.ci.meta.DeoptimizationAction;
import jdk.vm.ci.meta.DeoptimizationReason;
import jdk.vm.ci.meta.ResolvedJavaMethod;

/**
* For deoptimzation testing. The node performs a deoptimization in a normally compiled method, but
Expand All @@ -57,28 +53,12 @@ public TestDeoptimizeNode() {

@Override
public Node canonical(CanonicalizerTool tool) {
ResolvedJavaMethod method = graph().method();

if (SubstrateOptions.parseOnce()) {
if (MultiMethod.isDeoptTarget(method)) {
/* no-op for deoptimization target methods. */
return null;
} else {
/* deoptimization for all other methods. */
return new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.TransferToInterpreter);
}
if (MultiMethod.isDeoptTarget(graph().method())) {
/* no-op for deoptimization target methods. */
return null;
} else {
if (method instanceof SharedMethod) {
if (MultiMethod.isDeoptTarget(method)) {
/* no-op for deoptimization target methods. */
return null;
} else {
/* deoptimization for all other methods. */
return new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.TransferToInterpreter);
}
}
/* deoptimization for all other methods. */
return new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.TransferToInterpreter);
}

return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import org.graalvm.word.WordBase;

import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.graal.code.SubstrateCallingConventionKind;
import com.oracle.svm.core.graal.meta.SubstrateLoweringProvider;
import com.oracle.svm.core.graal.nodes.DeoptEntryNode;
Expand Down Expand Up @@ -100,14 +99,10 @@ public class SubstrateGraphKit extends GraphKit {
private final FrameStateBuilder frameState;
private int nextBCI;

private static boolean trackNodeSourcePosition(boolean forceTrackNodeSourcePosition) {
return forceTrackNodeSourcePosition || SubstrateOptions.parseOnce();
}

@SuppressWarnings("this-escape")
public SubstrateGraphKit(DebugContext debug, ResolvedJavaMethod stubMethod, Providers providers, WordTypes wordTypes,
GraphBuilderConfiguration.Plugins graphBuilderPlugins, CompilationIdentifier compilationId, boolean forceTrackNodeSourcePosition, boolean recordInlinedMethods) {
super(debug, stubMethod, providers, wordTypes, graphBuilderPlugins, compilationId, null, trackNodeSourcePosition(forceTrackNodeSourcePosition), recordInlinedMethods);
GraphBuilderConfiguration.Plugins graphBuilderPlugins, CompilationIdentifier compilationId, boolean recordInlinedMethods) {
super(debug, stubMethod, providers, wordTypes, graphBuilderPlugins, compilationId, null, true, recordInlinedMethods);
assert wordTypes != null : "Support for Word types is mandatory";
frameState = new FrameStateBuilder(this, stubMethod, graph);
frameState.disableKindVerification();
Expand All @@ -117,8 +112,8 @@ public SubstrateGraphKit(DebugContext debug, ResolvedJavaMethod stubMethod, Prov
}

public SubstrateGraphKit(DebugContext debug, ResolvedJavaMethod stubMethod, Providers providers, WordTypes wordTypes,
GraphBuilderConfiguration.Plugins graphBuilderPlugins, CompilationIdentifier compilationId, boolean forceTrackNodeSourcePosition) {
this(debug, stubMethod, providers, wordTypes, graphBuilderPlugins, compilationId, forceTrackNodeSourcePosition, false);
GraphBuilderConfiguration.Plugins graphBuilderPlugins, CompilationIdentifier compilationId) {
this(debug, stubMethod, providers, wordTypes, graphBuilderPlugins, compilationId, false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ private void installRuntimeConfig(BeforeAnalysisAccessImpl config) {
FeatureHandler featureHandler = config.getFeatureHandler();
final boolean supportsStubBasedPlugins = !SubstrateOptions.useLLVMBackend();

NativeImageGenerator.registerGraphBuilderPlugins(featureHandler, runtimeConfig, hostedProviders, config.getMetaAccess(), config.getUniverse(), null, null, config.getNativeLibraries(),
NativeImageGenerator.registerGraphBuilderPlugins(featureHandler, runtimeConfig, hostedProviders, config.getMetaAccess(), config.getUniverse(), null, config.getNativeLibraries(),
config.getImageClassLoader(), ParsingReason.JITCompilation, ((Inflation) config.getBigBang()).getAnnotationSubstitutionProcessor(),
new SubstrateClassInitializationPlugin(config.getHostVM()), ConfigurationValues.getTarget(), supportsStubBasedPlugins);

Expand Down Expand Up @@ -512,15 +512,11 @@ public void initializeRuntimeCompilationConfiguration(HostedProviders newHostedP
initialized = true;

hostedProviders = newHostedProviders;
graphBuilderConfig = newGraphBuilderConfig;
graphBuilderConfig = newGraphBuilderConfig.withNodeSourcePosition(true);
assert !runtimeCompilationCandidatePredicateUpdated : "Updated compilation predicate multiple times";
runtimeCompilationCandidatePredicate = newRuntimeCompilationCandidatePredicate;
runtimeCompilationCandidatePredicateUpdated = true;
deoptimizeOnExceptionPredicate = newDeoptimizeOnExceptionPredicate;

if (SubstrateOptions.IncludeNodeSourcePositions.getValue() || SubstrateOptions.parseOnce()) {
graphBuilderConfig = graphBuilderConfig.withNodeSourcePosition(true);
}
}

public SubstrateMethod requireFrameInformationForMethod(ResolvedJavaMethod method, BeforeAnalysisAccessImpl config, boolean registerAsRoot) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
import java.util.List;

import org.graalvm.collections.Pair;
import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.nodes.ValueNode;

import com.oracle.graal.pointsto.infrastructure.GraphProvider;
import com.oracle.graal.pointsto.meta.HostedProviders;
import com.oracle.svm.hosted.phases.HostedGraphKit;

import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.nodes.ValueNode;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaMethod;

class ForeignGraphKit extends HostedGraphKit {
ForeignGraphKit(DebugContext debug, HostedProviders providers, ResolvedJavaMethod method, GraphProvider.Purpose purpose) {
super(debug, providers, method, purpose);
super(debug, providers, method);
}

Pair<List<ValueNode>, ValueNode> unpackArgumentsAndExtractNEP(ValueNode argumentsArray, MethodType methodType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ protected void doRun(Map<Method, CEntryPointData> entryPoints, JavaMainSupport j
classInitializationSupport, GraalAccess.getOriginalProviders().getLoopsDataProvider(), platformConfig).build();

registerGraphBuilderPlugins(featureHandler, runtimeConfiguration, (HostedProviders) runtimeConfiguration.getProviders(), bb.getMetaAccess(), aUniverse,
hMetaAccess, hUniverse,
hUniverse,
nativeLibraries, loader, ParsingReason.AOTCompilation, bb.getAnnotationSubstitutionProcessor(),
new SubstrateClassInitializationPlugin((SVMHost) aUniverse.hostVM()),
ConfigurationValues.getTarget(), this.isStubBasedPluginsSupported());
Expand Down Expand Up @@ -1134,7 +1134,7 @@ public static void initializeBigBang(Inflation bb, OptionValues options, Feature
*/
bb.getMetaAccess().lookupJavaType(com.oracle.svm.core.graal.stackvalue.StackValueNode.StackSlotIdentity.class).registerAsReachable("root class");

NativeImageGenerator.registerGraphBuilderPlugins(featureHandler, null, aProviders, aMetaAccess, aUniverse, null, null, nativeLibraries, loader, ParsingReason.PointsToAnalysis,
NativeImageGenerator.registerGraphBuilderPlugins(featureHandler, null, aProviders, aMetaAccess, aUniverse, null, nativeLibraries, loader, ParsingReason.PointsToAnalysis,
bb.getAnnotationSubstitutionProcessor(), classInitializationPlugin, ConfigurationValues.getTarget(), supportsStubBasedPlugins);
registerReplacements(debug, featureHandler, null, aProviders, true, initForeignCalls);

Expand Down Expand Up @@ -1339,7 +1339,7 @@ public void notifyNoPlugin(ResolvedJavaMethod targetMethod, OptionValues options
}

public static void registerGraphBuilderPlugins(FeatureHandler featureHandler, RuntimeConfiguration runtimeConfig, HostedProviders providers, AnalysisMetaAccess aMetaAccess,
AnalysisUniverse aUniverse, HostedMetaAccess hMetaAccess, HostedUniverse hUniverse, NativeLibraries nativeLibs, ImageClassLoader loader, ParsingReason reason,
AnalysisUniverse aUniverse, HostedUniverse hUniverse, NativeLibraries nativeLibs, ImageClassLoader loader, ParsingReason reason,
AnnotationSubstitutionProcessor annotationSubstitutionProcessor, ClassInitializationPlugin classInitializationPlugin,
TargetDescription target, boolean supportsStubBasedPlugins) {
GraphBuilderConfiguration.Plugins plugins = new GraphBuilderConfiguration.Plugins(new SubstitutionInvocationPlugins(annotationSubstitutionProcessor));
Expand Down Expand Up @@ -1418,22 +1418,8 @@ public <T> T getInjectedArgument(Class<T> type) {
ImageSingletons.lookup(TargetGraphBuilderPlugins.class).register(plugins, replacements, architecture,
/* registerForeignCallMath */ false, options);

/*
* When the context is hosted, i.e., ahead-of-time compilation, and after the analysis we
* need the hosted meta access.
*/
MetaAccessProvider pluginsMetaAccess;
if (reason == ParsingReason.PointsToAnalysis || reason == ParsingReason.JITCompilation) {
pluginsMetaAccess = aMetaAccess;
} else {
VMError.guarantee(reason == ParsingReason.AOTCompilation);
pluginsMetaAccess = hMetaAccess;
}

assert pluginsMetaAccess != null;
SubstrateGraphBuilderPlugins.registerInvocationPlugins(annotationSubstitutionProcessor,
loader,
pluginsMetaAccess,
hostedSnippetReflection,
plugins.getInvocationPlugins(),
replacements,
Expand Down
Loading