GraalVM查看所有native编译时的专家参数

以GraalVM 24社区版为例:

命令行及参数

native-image --expert-options

运行结果

  -H:±AllowIncompleteClasspath                 Deprecated. Default: - (disabled).
  -H:±AllowVMInspection                        Enables features that allow the VM to be inspected during run time. Default: - (disabled).
  -H:±BuildOutputBreakdowns                    Show code and heap breakdowns as part of the build output. Default: + (enabled).
  -H:±BuildOutputColorful                      Color build output (enabled by default if colors are supported by terminal). Default: - (disabled).
  -H:±BuildOutputGCWarnings                    Print GC warnings as part of build output. Default: + (enabled).
  -H:BuildOutputJSONFile=<path>*               Print build output statistics as JSON to the specified file. The output conforms to the JSON schema located at:
                                               docs/reference-manual/native-image/assets/build-output-schema-v0.9.3.json.
  -H:±BuildOutputLinks                         Show links in build output (defaults to the value of BuildOutputColorful). Default: - (disabled).
  -H:±BuildOutputPrefix                        Deprecated, option no longer has any effect. Default: - (disabled).
  -H:±BuildOutputProgress                      Report progress in build output (default is adaptive). Default: - (disabled).
  -H:±BuildOutputRecommendations               Show recommendations as part of the build output. Default: + (enabled).
  -H:±BuildOutputSilent                        Silence build output. Default: - (disabled).
  -H:CCompilerOption=<string>*                 Provide custom C compiler option used for query code compilation.
  -H:CCompilerPath=...                         Provide custom path to C compiler used for query code compilation and linking. Default: None
  -H:CPUFeatures=<string>*                     Comma separated list of CPU features that will be enabled while building the target executable, irrespective of whether
                                               they are supported by the hosted environment. Note that enabling features not present within the target environment
                                               may result in application crashes. The specific options available are target platform dependent. See
                                               --list-cpu-features for feature list. These features are in addition to -march.
  -H:CStandard="C89"                           C standard to use in header files. Possible values are 'C89', 'C99', and 'C11'.
  -H:Class=""                                  Class containing the default entry point method. Optional if --shared is used.
  -H:ClassInitialization=<string>*             A comma-separated list of classes appended with their initialization strategy (':build_time' or ':run_time').
  -H:Color="auto"                              Color build output ('always', 'never', or 'auto').
  -H:CompilerBackend="lir"                     Backend used by the compiler.
  -H:ConfigurationFileDirectories=<path>*      Directories directly containing configuration files for dynamic features at runtime.
  -H:ConfigurationResourceRoots=<string>*      Resource path above configuration resources for dynamic features at runtime.
  -H:±CopyLanguageResources                    Automatically copy the necessary language resources to the resources directory next to the produced image. Default: -
                                               (disabled).
  -H:DefaultCharset="UTF-8"                    Default charset of the image, by the default it is the same as the default charset of the image builder.
  -H:DefaultLocale="zh-CN"                     Default locale of the image, by the default it is the same as the default locale of the image builder.
  -H:±DetectUserDirectoriesInImageHeap         When set to true, the image generator verifies that the image heap does not contain a home directory as a substring.
                                               Default: - (disabled).
  -H:±DumpRuntimeCompilationOnSignal           Dumps all runtime compiled methods on SIGUSR2. Default: - (disabled).
  -H:±DumpTargetInfo                           Show native-toolchain information and image-build settings. Default: - (disabled).
  -H:±DumpThreadStacksOnSignal                 Dumps all thread stacktraces on SIGQUIT/SIGBREAK. Default: - (disabled).
  -H:DynamicProxyConfigurationFiles=<path>*    One or several (comma-separated) paths to JSON files that specify lists of interfaces that define Java proxy classes.
                                               [Extra help available]
  -H:DynamicProxyConfigurationResources=<string>*
                                               Resources describing program elements to be made available for reflection (see ProxyConfigurationFiles).
  -H:EnableMonitoringFeatures=<string>*        Enable monitoring features that allow the VM to be inspected at run time. Comma-separated list can contain 'heapdump',
                                               'jfr', 'jvmstat', 'jmxserver' (experimental), 'jmxclient' (experimental), 'threaddump', 'nmt' (experimental), 'jcmd'
                                               (experimental), or 'all' (deprecated behavior: defaults to 'all' if no argument is provided). For example:
                                               '--enable-monitoring=heapdump,jfr'.
  -H:ExcludeResources=<string>*                Regexp to match names of resources to be excluded from the image.
  -H:ForeignConfigurationFiles=<path>*         Files describing stubs allowing foreign calls.
  -H:ForeignResources=<string>*                Resources describing stubs allowing foreign calls.
  -H:±GenerateBuildArtifactsFile               Create a build-artifacts.json file in the build directory. The output conforms to the JSON schema located at:
                                               docs/reference-manual/native-image/assets/build-artifacts-schema-v0.9.0.json. Default: - (disabled).
  -H:±GenerateEmbeddedResourcesFile            Create a embedded-resources.json file in the build directory. The output conforms to the JSON schema located at:
                                               docs/reference-manual/native-image/assets/embedded-resources-schema-v1.1.0.json. Default: - (disabled).
  -H:±IncludeAllLocales                        Make all hosted locales available at run time. Default: - (disabled).
  -H:±IncludeLanguageResources                 Automatically include the necessary language internal resources in the produced image. Default: + (enabled).
  -H:IncludeLocales=<string>*                  Comma separated list of locales to be included into the image. The default locale is included in the list automatically
                                               if not present.
  -H:IncludeResourceBundles=<string>*          Comma separated list of bundles to be included into the image.
  -H:IncludeResources=<string>*                Regexp to match names of resources to be included in the image.
  -H:InitialCollectionPolicy="Adaptive"        The garbage collection policy, either Adaptive (default) or BySpaceAndTime. Serial GC only.
  -H:±InstallExitHandlers                      Provide java.lang.Terminator exit handlers. Default: - (disabled).
  -H:JNIConfigurationFiles=<path>*             Files describing program elements to be made accessible via JNI according to the schema at
                                               https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/jni-config-schema-v1.1.0.json.
  -H:JNIConfigurationResources=<string>*       Resources describing program elements to be made accessible via JNI according to the schema at
                                               https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/jni-config-schema-v1.1.0.json.
  -H:±JNIEnhancedErrorCodes                    JNI functions will return more specific error codes. Default: - (disabled).
  -H:±JNIExportSymbols                         Export Invocation API symbols. Default: + (enabled).
  -H:±JNIVerboseLookupErrors                   Report information about known JNI elements when lookup fails. Default: - (disabled).
  -H:±JVMTI                                    Enable JVM Tool Interface (JVMTI) support. Default: - (disabled).
  -H:±ListCPUFeatures                          Show CPU features specific to the target platform and exit. Default: - (disabled).
  -H:LocalizationCompressBundles=<string>*     Regular expressions matching which bundles should be compressed.
  -H:±LocalizationOptimizedMode                Optimize the resource bundle lookup using a simple map. Default: - (disabled).
  -H:±LocalizationSubstituteLoadLookup         Store the resource bundle content more efficiently in the fallback mode. Default: + (enabled).
  -H:MicroArchitecture=...                     Generate instructions for a specific machine type. Defaults to 'x86-64-v3' on AMD64 and 'armv8.1-a' on AArch64. Use
                                               -march=compatibility for best compatibility, or -march=native for best performance if the native executable is
                                               deployed on the same machine or on a machine with the same CPU features. To list all available machine types, use
                                               -march=list. Default: None
  -H:Module=""                                 Module containing the class that contains the main entry point. Optional if --shared is used.
  -H:Name=""                                   Name of the output file to be generated.
  -H:±NativeArchitecture                       Uses the native architecture, i.e., the architecture of a machine that builds an image. Default: - (disabled).
  -H:Optimize="2"                              Control code optimizations: b - optimize for fastest build time, s - optimize for size, 0 - no optimizations, 1 - basic
                                               optimizations, 2 - advanced optimizations, 3 - all optimizations for best performance.
  -H:Path=...                                  Directory of the image file to be generated. Default: None
  -H:PredefinedClassesConfigurationFiles=<path>*
                                               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.
  -H:PredefinedClassesConfigurationResources=<string>*
                                               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.
  -H:ReachabilityMetadataResources=<string>*   Resources describing reachability metadata needed for the program
                                               https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/reachability-metadata-schema-v1.0.0.json.
  -H:ReflectionConfigurationFiles=<path>*      One or several (comma-separated) paths to JSON files that specify which program elements should be made available via
                                               reflection. [Extra help available]
  -H:ReflectionConfigurationResources=<string>*
                                               Resources describing program elements to be made available for reflection (see ReflectionConfigurationFiles).
  -H:ResourceConfigurationFiles=<path>*        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.
  -H:ResourceConfigurationResources=<string>*  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.
  -H:RuntimeCheckedCPUFeatures=<string>*       Comma separated list of CPU features that will be enabled for runtime checks. The native image may check at run time if
                                               such features are supported by the target CPU, and can optimize certain operations based on this information. If a
                                               feature is not supported at run time, a less optimized variant will be executed. Because of the presence of multiple
                                               code variants, enabling runtime features can result in larger executables. To completely turn off runtime checked CPU
                                               features, set this option to the empty string. The specific options available are target platform dependent. See
                                               --list-cpu-features for feature list. The default values are: AMD64: 'AVX,AVX2'; AArch64: ''.
  -H:SerializationConfigurationFiles=<path>*   One or several (comma-separated) paths to JSON files that specify lists of serialization configurations. [Extra help
                                               available]
  -H:SerializationConfigurationResources=<string>*
                                               Resources describing program elements to be made available for serialization (see SerializationConfigurationFiles).
  -H:SerializationDenyConfigurationFiles=<path>*
                                               One or several (comma-separated) paths to JSON files that specify lists of serialization configurations. [Extra help
                                               available]
  -H:SerializationDenyConfigurationResources=<string>*
                                               Resources describing program elements that must not be made available for serialization.
  -H:±StrictQueryCodeCompilation               Use strict checks when performing query code compilation. Default: + (enabled).
  -H:±TraceNativeToolUsage                     Trace all native tool invocations as part of image building. Default: - (disabled).
  -R:JVMTIAgentLib=...                         Loads the specified native agent library. After the library name, a comma-separated list of options specific to the
                                               library can be used. Default: None
  -R:JVMTIAgentPath=...                        Loads the specified native agent library specified by the absolute path name. After the library path, a comma-separated
                                               list of options specific to the library can be used. Default: None
  -R:MaxHeapFree=0                             The maximum free bytes reserved for allocations, in bytes (0 for automatic according to GC policy). Serial GC only.
  -R:MaxHeapSize=0                             The maximum heap size at run-time, in bytes.
  -R:MaxJavaStackTraceDepth=1024               The maximum number of lines in the stack trace for Java exceptions (0 means all).
  -R:MaxNewSize=0                              The maximum size of the young generation at run-time, in bytes.
  -R:MaximumHeapSizePercent=80                 The maximum heap size as percent of physical memory. Serial and epsilon GC only.
  -R:MaximumYoungGenerationSizePercent=10      The maximum size of the young generation as a percentage of the maximum heap size. Serial and epsilon GC only.
  -R:MinHeapSize=0                             The minimum heap size at run-time, in bytes.
  -R:PercentTimeInIncrementalCollection=50     Percentage of total collection time that should be spent on young generation collections. Serial GC with collection
                                               policy 'BySpaceAndTime' only.
  -R:±PrintNMTStatistics                       Print native memory tracking statistics on shutdown if native memory tracking is enabled. Default: - (disabled).
  -R:StackSize=0                               The size of each thread stack at run-time, in bytes.

更多GraalVM及讨论,可关注微信公众号“加瓦儿”

posted @ 2025-06-01 22:58  漠孤烟  阅读(58)  评论(0)    收藏  举报