Skip to content

Commit

Permalink
[GR-47922] Improve list of experimental options.
Browse files Browse the repository at this point in the history
PullRequest: graal/15966
  • Loading branch information
fniephaus committed Nov 6, 2023
2 parents 9c62730 + 6b9173a commit 04f57e0
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public static void setOptimizeValueUpdateHandler(ValueUpdateHandler<Optimization
@Option(help = "Path passed to the linker as the -rpath (list of comma-separated directories)")//
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> LinkerRPath = new HostedOptionKey<>(LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

@Option(help = "Directory of the image file to be generated", type = OptionType.User)//
@Option(help = {"Directory of the image file to be generated", "Use the '-o' option instead."}, type = OptionType.User)//
public static final HostedOptionKey<String> Path = new HostedOptionKey<>(null);

public static final class GCGroup implements APIOptionGroup {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,22 @@ public static final class Options {
@Option(help = "file:doc-files/ReflectionConfigurationFilesHelp.txt", type = OptionType.User)//
@BundleMember(role = BundleMember.Role.Input)//
public static final HostedOptionKey<LocatableMultiOptionValue.Paths> ReflectionConfigurationFiles = new HostedOptionKey<>(LocatableMultiOptionValue.Paths.buildWithCommaDelimiter());
@Option(help = "Resources describing program elements to be made available for reflection (see ReflectionConfigurationFiles).", type = OptionType.User)//
@Option(help = {"Resources describing program elements to be made available for reflection (see ReflectionConfigurationFiles).",
"Use a reflect-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> ReflectionConfigurationResources = new HostedOptionKey<>(LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

@Option(help = "file:doc-files/ProxyConfigurationFilesHelp.txt", type = OptionType.User)//
@BundleMember(role = BundleMember.Role.Input)//
public static final HostedOptionKey<LocatableMultiOptionValue.Paths> DynamicProxyConfigurationFiles = new HostedOptionKey<>(LocatableMultiOptionValue.Paths.buildWithCommaDelimiter());
@Option(help = "Resources describing program elements to be made available for reflection (see ProxyConfigurationFiles).", type = OptionType.User)//
@Option(help = {"Resources describing program elements to be made available for reflection (see ProxyConfigurationFiles).",
"Use a proxy-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> DynamicProxyConfigurationResources = new HostedOptionKey<>(LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

@Option(help = "file:doc-files/SerializationConfigurationFilesHelp.txt", type = OptionType.User)//
@BundleMember(role = BundleMember.Role.Input)//
public static final HostedOptionKey<LocatableMultiOptionValue.Paths> SerializationConfigurationFiles = new HostedOptionKey<>(LocatableMultiOptionValue.Paths.buildWithCommaDelimiter());
@Option(help = "Resources describing program elements to be made available for serialization (see SerializationConfigurationFiles).", type = OptionType.User)//
@Option(help = {"Resources describing program elements to be made available for serialization (see SerializationConfigurationFiles).",
"Use a serialization-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> SerializationConfigurationResources = new HostedOptionKey<>(LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

@Option(help = "file:doc-files/SerializationConfigurationFilesHelp.txt", type = OptionType.User)//
Expand All @@ -82,18 +85,22 @@ public static final class Options {
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> SerializationDenyConfigurationResources = new HostedOptionKey<>(
LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

@Option(help = "Files describing Java resources to be included in the image according to the schema at " +
"https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/resource-config-schema-v1.0.0.json", type = OptionType.User)//
@Option(help = {"Files describing Java resources to be included in the image according to the schema at " +
"https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/resource-config-schema-v1.0.0.json",
"Use a resource-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
@BundleMember(role = BundleMember.Role.Input)//
public static final HostedOptionKey<LocatableMultiOptionValue.Paths> ResourceConfigurationFiles = new HostedOptionKey<>(LocatableMultiOptionValue.Paths.buildWithCommaDelimiter());
@Option(help = "Resources describing Java resources to be included in the image according to the schema at " +
"https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/resource-config-schema-v1.0.0.json", type = OptionType.User)//
@Option(help = {"Resources describing Java resources to be included in the image according to the schema at " +
"https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/resource-config-schema-v1.0.0.json",
"Use a resource-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> ResourceConfigurationResources = new HostedOptionKey<>(LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

@Option(help = "Files describing program elements to be made accessible via JNI (for syntax, see ReflectionConfigurationFiles)", type = OptionType.User)//
@Option(help = {"Files describing program elements to be made accessible via JNI (for syntax, see ReflectionConfigurationFiles)",
"Use a jni-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
@BundleMember(role = BundleMember.Role.Input)//
public static final HostedOptionKey<LocatableMultiOptionValue.Paths> JNIConfigurationFiles = new HostedOptionKey<>(LocatableMultiOptionValue.Paths.buildWithCommaDelimiter());
@Option(help = "Resources describing program elements to be made accessible via JNI (see JNIConfigurationFiles).", type = OptionType.User)//
@Option(help = {"Resources describing program elements to be made accessible via JNI (see JNIConfigurationFiles).",
"Use a jni-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> JNIConfigurationResources = new HostedOptionKey<>(LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

@Option(help = "Files describing stubs allowing foreign calls.", type = OptionType.User)//
Expand All @@ -102,12 +109,14 @@ public static final class Options {
@Option(help = "Resources describing stubs allowing foreign calls.", type = OptionType.User)//
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> ForeignResources = new HostedOptionKey<>(LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

@Option(help = "Files describing predefined classes that can be loaded at runtime according to the schema at " +
"https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/predefined-classes-config-schema-v1.0.0.json", type = OptionType.User)//
@Option(help = {"Files describing predefined classes that can be loaded at runtime according to the schema at " +
"https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/predefined-classes-config-schema-v1.0.0.json",
"Use a predefined-classes-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
@BundleMember(role = BundleMember.Role.Input)//
public static final HostedOptionKey<LocatableMultiOptionValue.Paths> PredefinedClassesConfigurationFiles = new HostedOptionKey<>(LocatableMultiOptionValue.Paths.buildWithCommaDelimiter());
@Option(help = "Resources describing predefined classes that can be loaded at runtime according to the schema at " +
"https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/predefined-classes-config-schema-v1.0.0.json", type = OptionType.User)//
@Option(help = {"Resources describing predefined classes that can be loaded at runtime according to the schema at " +
"https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/predefined-classes-config-schema-v1.0.0.json",
"Use a predefined-classes-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead."}, type = OptionType.User)//
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> PredefinedClassesConfigurationResources = new HostedOptionKey<>(
LocatableMultiOptionValue.Strings.buildWithCommaDelimiter());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
One or several (comma-separated) paths to JSON files that specify lists of interfaces that define Java proxy classes.
Use a proxy-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead.

The JSON structure is described in the following schema:

https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/proxy-config-schema-v1.0.0.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
One or several (comma-separated) paths to JSON files that specify which program elements should be made available via reflection.
Use a reflect-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead.

The JSON object schema is described at:

https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/reflect-config-schema-v1.0.0.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
One or several (comma-separated) paths to JSON files that specify lists of serialization configurations.
Use a serialization-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead.

The structure is described in the following schema:

https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/serialization-config-schema-v1.0.0.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
import java.util.function.Predicate;

import org.graalvm.collections.EconomicMap;
import jdk.graal.compiler.options.OptionDescriptor;
import jdk.graal.compiler.options.OptionDescriptors;
import jdk.graal.compiler.options.OptionKey;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;

Expand All @@ -47,6 +44,10 @@
import com.oracle.svm.core.util.VMError;
import com.oracle.svm.util.LogUtils;

import jdk.graal.compiler.options.OptionDescriptor;
import jdk.graal.compiler.options.OptionDescriptors;
import jdk.graal.compiler.options.OptionKey;

/**
* This class contains methods for parsing options and matching them against
* {@link OptionDescriptor}s.
Expand Down Expand Up @@ -178,14 +179,18 @@ public static String commandArgument(OptionKey<?> option, String value, String a
/* Ensure descriptor is loaded */
OptionDescriptor optionDescriptor = option.loadDescriptor();
Field field;
APIOption[] apiOptions;
try {
field = optionDescriptor.getDeclaringClass().getDeclaredField(optionDescriptor.getFieldName());
apiOptions = field.getAnnotationsByType(APIOption.class);
} catch (ReflectiveOperationException ex) {
throw VMError.shouldNotReachHere(ex);
/*
* Options whose fields cannot be looked up (e.g., due to stripped sources) cannot be
* API options by definition.
*/
apiOptions = new APIOption[0];
}

APIOption[] apiOptions = field.getAnnotationsByType(APIOption.class);

if (optionDescriptor.getOptionValueType() == Boolean.class) {
VMError.guarantee(value.equals("+") || value.equals("-"), "Boolean option value can be only + or -");
for (APIOption apiOption : apiOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private boolean consume(ArgumentQueue args, String headArg) {
/* Using agentlib to allow interoperability with other agents */
nativeImage.addImageBuilderJavaArgs("-agentlib:jdwp=transport=dt_socket,server=y,address=" + address + ",suspend=y");
/* Disable watchdog mechanism */
nativeImage.addPlainImageBuilderArg(nativeImage.oHDeadlockWatchdogInterval + "0");
nativeImage.addPlainImageBuilderArg(NativeImage.injectHostedOptionOrigin(nativeImage.oHDeadlockWatchdogInterval + "0", OptionOrigin.originDriver));
return true;
}

Expand Down
Loading

0 comments on commit 04f57e0

Please sign in to comment.