< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/graphbuilderconf/GraphBuilderConfiguration.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -37,10 +37,11 @@
private ParameterPlugin[] parameterPlugins;
private TypePlugin[] typePlugins;
private InlineInvokePlugin[] inlineInvokePlugins;
private LoopExplosionPlugin loopExplosionPlugin;
private ClassInitializationPlugin classInitializationPlugin;
+ private InvokeDynamicPlugin invokeDynamicPlugin;
private ProfilingPlugin profilingPlugin;
/**
* Creates a copy of a given set of plugins. The {@link InvocationPlugins} in
* {@code copyFrom} become the {@linkplain InvocationPlugins#getParent() default}
@@ -52,10 +53,11 @@
this.parameterPlugins = copyFrom.parameterPlugins;
this.typePlugins = copyFrom.typePlugins;
this.inlineInvokePlugins = copyFrom.inlineInvokePlugins;
this.loopExplosionPlugin = copyFrom.loopExplosionPlugin;
this.classInitializationPlugin = copyFrom.classInitializationPlugin;
+ this.invokeDynamicPlugin = copyFrom.invokeDynamicPlugin;
this.profilingPlugin = copyFrom.profilingPlugin;
}
/**
* Creates a new set of plugins.
@@ -165,10 +167,18 @@
public void setClassInitializationPlugin(ClassInitializationPlugin plugin) {
this.classInitializationPlugin = plugin;
}
+ public InvokeDynamicPlugin getInvokeDynamicPlugin() {
+ return invokeDynamicPlugin;
+ }
+
+ public void setInvokeDynamicPlugin(InvokeDynamicPlugin plugin) {
+ this.invokeDynamicPlugin = plugin;
+ }
+
public ProfilingPlugin getProfilingPlugin() {
return profilingPlugin;
}
public void setProfilingPlugin(ProfilingPlugin plugin) {
@@ -187,10 +197,11 @@
}
private static final ResolvedJavaType[] EMPTY = new ResolvedJavaType[]{};
private final boolean eagerResolving;
+ private final boolean unresolvedIsError;
private final BytecodeExceptionMode bytecodeExceptionMode;
private final boolean omitAssertions;
private final ResolvedJavaType[] skippedExceptionTypes;
private final boolean insertFullInfopoints;
private final boolean trackNodeSourcePosition;
@@ -214,14 +225,15 @@
* This mode uses profiling information to decide whether to use explicit exception edges.
*/
Profile
}
- protected GraphBuilderConfiguration(boolean eagerResolving, BytecodeExceptionMode bytecodeExceptionMode, boolean omitAssertions, boolean insertFullInfopoints,
+ protected GraphBuilderConfiguration(boolean eagerResolving, boolean unresolvedIsError, BytecodeExceptionMode bytecodeExceptionMode, boolean omitAssertions, boolean insertFullInfopoints,
boolean trackNodeSourcePosition, ResolvedJavaType[] skippedExceptionTypes,
Plugins plugins) {
this.eagerResolving = eagerResolving;
+ this.unresolvedIsError = unresolvedIsError;
this.bytecodeExceptionMode = bytecodeExceptionMode;
this.omitAssertions = omitAssertions;
this.insertFullInfopoints = insertFullInfopoints;
this.trackNodeSourcePosition = trackNodeSourcePosition;
this.skippedExceptionTypes = skippedExceptionTypes;
@@ -233,39 +245,56 @@
* this configuration become the {@linkplain InvocationPlugins#getParent() parent} of the
* {@link InvocationPlugins} in the copy.
*/
public GraphBuilderConfiguration copy() {
Plugins newPlugins = new Plugins(plugins);
- GraphBuilderConfiguration result = new GraphBuilderConfiguration(eagerResolving, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition, skippedExceptionTypes,
- newPlugins);
+ GraphBuilderConfiguration result = new GraphBuilderConfiguration(eagerResolving, unresolvedIsError, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition,
+ skippedExceptionTypes, newPlugins);
return result;
}
+ /**
+ * Set the {@link #unresolvedIsError} flag. This flag can be set independently from
+ * {@link #eagerResolving}, i.e., even if eager resolving fails execution is assumed to be
+ * valid. This allows us for example to process unresolved types/methods/fields even when
+ * eagerly resolving elements.
+ */
+ public GraphBuilderConfiguration withUnresolvedIsError(boolean newUnresolvedIsError) {
+ return new GraphBuilderConfiguration(eagerResolving, newUnresolvedIsError, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition, skippedExceptionTypes,
+ plugins);
+ }
+
public GraphBuilderConfiguration withEagerResolving(boolean newEagerResolving) {
- return new GraphBuilderConfiguration(newEagerResolving, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition, skippedExceptionTypes, plugins);
+ return new GraphBuilderConfiguration(newEagerResolving, unresolvedIsError, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition, skippedExceptionTypes,
+ plugins);
}
public GraphBuilderConfiguration withSkippedExceptionTypes(ResolvedJavaType[] newSkippedExceptionTypes) {
- return new GraphBuilderConfiguration(eagerResolving, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition, newSkippedExceptionTypes, plugins);
+ return new GraphBuilderConfiguration(eagerResolving, unresolvedIsError, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition, newSkippedExceptionTypes,
+ plugins);
}
public GraphBuilderConfiguration withBytecodeExceptionMode(BytecodeExceptionMode newBytecodeExceptionMode) {
- return new GraphBuilderConfiguration(eagerResolving, newBytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition, skippedExceptionTypes, plugins);
+ return new GraphBuilderConfiguration(eagerResolving, unresolvedIsError, newBytecodeExceptionMode, omitAssertions, insertFullInfopoints, trackNodeSourcePosition, skippedExceptionTypes,
+ plugins);
}
public GraphBuilderConfiguration withOmitAssertions(boolean newOmitAssertions) {
- return new GraphBuilderConfiguration(eagerResolving, bytecodeExceptionMode, newOmitAssertions, insertFullInfopoints, trackNodeSourcePosition, skippedExceptionTypes, plugins);
+ return new GraphBuilderConfiguration(eagerResolving, unresolvedIsError, bytecodeExceptionMode, newOmitAssertions, insertFullInfopoints, trackNodeSourcePosition, skippedExceptionTypes,
+ plugins);
}
public GraphBuilderConfiguration withFullInfopoints(boolean newInsertFullInfopoints) {
ResolvedJavaType[] newSkippedExceptionTypes = skippedExceptionTypes == EMPTY ? EMPTY : Arrays.copyOf(skippedExceptionTypes, skippedExceptionTypes.length);
- return new GraphBuilderConfiguration(eagerResolving, bytecodeExceptionMode, omitAssertions, newInsertFullInfopoints, trackNodeSourcePosition, newSkippedExceptionTypes, plugins);
+ return new GraphBuilderConfiguration(eagerResolving, unresolvedIsError, bytecodeExceptionMode, omitAssertions, newInsertFullInfopoints, trackNodeSourcePosition, newSkippedExceptionTypes,
+ plugins);
}
public GraphBuilderConfiguration withNodeSourcePosition(boolean newTrackNodeSourcePosition) {
ResolvedJavaType[] newSkippedExceptionTypes = skippedExceptionTypes == EMPTY ? EMPTY : Arrays.copyOf(skippedExceptionTypes, skippedExceptionTypes.length);
- return new GraphBuilderConfiguration(eagerResolving, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, newTrackNodeSourcePosition, newSkippedExceptionTypes, plugins);
+ return new GraphBuilderConfiguration(eagerResolving, unresolvedIsError, bytecodeExceptionMode, omitAssertions, insertFullInfopoints, newTrackNodeSourcePosition, newSkippedExceptionTypes,
+ plugins);
}
public ResolvedJavaType[] getSkippedExceptionTypes() {
return skippedExceptionTypes;
}
@@ -289,24 +318,20 @@
public boolean insertFullInfopoints() {
return insertFullInfopoints;
}
public static GraphBuilderConfiguration getDefault(Plugins plugins) {
- return new GraphBuilderConfiguration(false, BytecodeExceptionMode.Profile, false, false, false, EMPTY, plugins);
+ return new GraphBuilderConfiguration(false, false, BytecodeExceptionMode.Profile, false, false, false, EMPTY, plugins);
}
public static GraphBuilderConfiguration getSnippetDefault(Plugins plugins) {
- return new GraphBuilderConfiguration(true, BytecodeExceptionMode.OmitAll, false, false, false, EMPTY, plugins);
+ return new GraphBuilderConfiguration(true, true, BytecodeExceptionMode.OmitAll, false, false, false, EMPTY, plugins);
}
- /**
- * Returns {@code true} if it is an error for a class/field/method resolution to fail. The
- * default is the same result as returned by {@link #eagerResolving()}. However, it may be
- * overridden to allow failure even when {@link #eagerResolving} is {@code true}.
- */
+ /** Returns {@code true} if it is an error for a class/field/method resolution to fail. */
public boolean unresolvedIsError() {
- return eagerResolving;
+ return unresolvedIsError;
}
public Plugins getPlugins() {
return plugins;
}
< prev index next >