- GraalVM Updater
- Native Image
- Substrate VM Project
- Native Image Configuration
- Native Image Compatibility and Optimization Guide
- Native Image Code Style
- Class Initialization in Native Image
- Static Native Images
- Native Image Options
- Native Image Hosted and Runtime Options
- Native Image C API
- Implementing Native Methods in Java with Native Image
- LLVM Backend for Native Image
- Debug Info Feature
- Points-to Analysis Reports
- Using System Properties in Native Images
- Profile-Guided Optimizations
- Low Latency Garbage Collection
- Generating Heap Dumps from Native Images
- Memory Management
- JCA Security Services on Native Image
- Native Image Maven Plugin
- Dynamic Proxy on Native Image
- Java Native Interface (JNI) on Native Image
- Reflection on Native Image
- Accessing Resources in Native Images
- Logging on Native Image
- URL Protocols on Native Image
- Polyglot Programming
- Embedding Reference
- JVM Languages Reference
- LLVM Languages Reference
- Python Reference
- R Reference Manual
- Ruby Reference
- WebAssembly Reference
Native Image Hosted and Runtime Options
Besides options to the native image builder listed in the Options guide, Native Image also distinguishes hosted and runtime options.
Hosted options: configure the image generation, i.e., influence what is put into the image and how the image is built. They are set using the prefix
-H:on the command line.
Runtime options: get their initial value during image generation, using the prefix
-R:on the command line of the image generator. At runtime, the default prefix is
-XX:(but this is application specific and not mandated by Substrate VM).
For developer documentation on how to define and use options, read the documentation of the
List of Useful Options #
Graph Dumping #
Native Image re-used the GraalVM options for graph dumping, logging, counters and everything else of the GraalVM debug environment. These GraalVM options can be used both as hosted options (if you want to dump graphs of the image generator) and runtime options (if you want to dump graphs during dynamic compilation at runtime).
The GraalVM compiler options that work as expected include
MethodFilter and the options to specify file names and ports for the dump
Example that dumps Graal graphs of the image generator:
Example that dumps Graal graphs at run time: specify the dump flags at runtime with
Debug Options #
These options enable additional checks in the generated executable to help with debugging.
Enables Java assert (and system assertion) statements in the image generator.
Enable or disable Java assert statements in the generated image. With the packagename argument ending in
..., the option disables/enables assertions in the specified package and any subpackages. If the argument is simply
..., then the option disables/enables assertions in the unnamed package.
Directory for temporary files generated during image generation. If this option is specified, the temporary files are not deleted so that you can inspect them after image generation.
Garbage Collection Options #
-Xmn=Set the size of the young generation (the amount of memory that can be allocated without triggering a GC). Value is specified in bytes, suffix
gcan be used for scaling.
-Xmx=Set the maximum heap size in bytes. Value is specified in bytes, suffix
gcan be used for scaling. Note that this is not the maximum amount of consumed memory, because during GC the system can request more temporary memory.
-Xms=Set the minimum heap size in bytes. Value is specified in bytes, suffix
gcan be used for scaling. Heap space that is unused will be retained for future heap usage, rather than being returned to the operating system.
-R:[+|-]PrintGCPrint summary GC information after each collection.
-R:[+|-]VerboseGCPrint more information about the heap before and after each collection.
Control the Main Entry Points #
-H:Kind=[EXECUTABLE | SHARED_LIBRARY]Generate a executable with a main entry point, or a shared library with all entry points that are marked via
-H:Class=ClassNameClass containing the default entry point method. Ignored if
Kind == SHARED_LIBRARY.
-H:Projects=Project1,Project2The project that contains the application (and transitively all projects that it depends on).
-H:Name=FileNameName of the executable file that is generated.
-H:Path=FileSystemPathDirectory where the generated executable is placed.