Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 64b7b50

Browse files
committed
Polish documentation
1 parent b1677db commit 64b7b50

File tree

5 files changed

+10
-73
lines changed

5 files changed

+10
-73
lines changed

scripts/reflectStrip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Creates a compact diff between two reflect json files
2-
java -classpath `dirname $0`/../spring-graalvm-native-feature/target/spring-graalvm-native-feature-0.7.0-SNAPSHOT.jar org.springframework.graal.support.ReflectionJsonStrip $1 $2
2+
java -classpath `dirname $0`/../spring-graalvm-native-feature/target/spring-graalvm-native-feature-0.7.0-SNAPSHOT.jar org.springframework.graalvm.support.ReflectionJsonStrip $1 $2

spring-graalvm-native-docs/src/main/asciidoc/agent.adoc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,9 @@ GraalVM provides a https://www.graalvm.org/docs/reference-manual/native-image/#i
9696
----
9797
====
9898

99-
The important part is the `<buildArgs>..</buildArgs>` block that shows the options we pass to the `native-image` operation and the `spring-graalvm-native` feature.
99+
The important part is the `<configuration><buildArgs>..</buildArgs></configuration>` block that shows the options we pass to the `native-image` operation and the `spring-graalvm-native` feature.
100100
Those prefixed `-D` are aimed at the feature.
101101

102-
NOTE: Notice the `--no-server` option.
103-
Like a Gradle daemon, the server here is supposed to help accelerate subsequent builds.
104-
Unfortunately, there is an https://github.com/oracle/graal/issues/1952[issue] where the server causes different results to come out of the compilation.
105-
In particular, we have seen logging disappear the server is used to aid compilation.
106-
Hence, using the server to aid compilation is turned off here.
107-
108102
===== Add the repository for `spring-graalvm-native`
109103

110104
If necessary, add the repository for the `spring-graalvm-native` dependency, as follows:

spring-graalvm-native-docs/src/main/asciidoc/extension_guide.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Each of these hints specifies a set of types that need accessibility, what kind
2121

2222
These `@NativeImageHint` should be hosted in one of two places.
2323

24-
First, in the `spring-graalvm-native-configuration` module, you can see that they are hosted on types that implement the `org.springframework.graal.extension.NativeImageConfiguration` interface (defined by the feature).
25-
Implementations of this interface should be listed in a `src/main/resources/META-INF/services/org.springframework.graal.extension.NativeImageConfiguration` file, which the feature loads through regular Java service loading.
24+
First, in the `spring-graalvm-native-configuration` module, you can see that they are hosted on types that implement the `org.springframework.graalvm.extension.NativeImageConfiguration` interface (defined by the feature).
25+
Implementations of this interface should be listed in a `src/main/resources/META-INF/services/org.springframework.graalvm.extension.NativeImageConfiguration` file, which the feature loads through regular Java service loading.
2626

2727
Second, they can be put directly onto Spring configuration classes, and they are picked up by the feature.
2828

@@ -73,9 +73,9 @@ The feature also chases down references between configurations (`@Import`) and l
7373

7474
This means that, for any application, there is some 'tree' of configurations active with hints scattered across them.
7575

76-
=== Structure of the `spring-boot-graal-configuration` module
76+
=== Structure of the `spring-graalvm-native-configuration` module
7777

78-
In the `spring-boot-graal-configuration`, numerous package names look like Spring package names.
78+
In the `spring-graalvm-native-configuration`, numerous package names look like Spring package names.
7979
That is deliberate.
8080
Notice the use of direct class references in the hints rather than strings.
8181
This type safety is a little more robust.
@@ -111,7 +111,7 @@ If you are using a piece of Spring we don't have a sample for, this is likely to
111111
Usually, we do a few searches for references to the type that is missing, and those searches guide us to the configuration.
112112

113113
. If there is already a `NativeImageConfiguration` implementation for that configuration, augment it with the extra type info.
114-
If there is not, create one and attach a `@NativeImageHint` to it, to identify the triggering configuration and the classes that need to be exposed.
114+
If there is not, create one, attach a `@NativeImageHint` to it to identify the triggering configuration and the classes that need to be exposed, and add it to the `META-INF/services/org.springframework.graalvm.extension.NativeImageConfiguration` .
115115
You also need to set the accessibility in the annotation (in the `@TypeInfo`).
116116
It is possible that more dependencies may need to be added to the configuration project to allow the direct class references.
117117
That is OK, so long as you ensure that they are provided scope.

spring-graalvm-native-docs/src/main/asciidoc/hybrid_feature_agent.adoc

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,7 @@ Paste the following XML into the `pom.xml` file (we use it later to invoke the n
9191
----
9292
====
9393

94-
The important part is the `<buildArgs>..</buildArgs>` block that shows the options we are passing to the `native-image` operation and the `spring-graalvm-native` feature.
95-
Those prefixed `-D` are aimed at the feature.
96-
97-
NOTE: Notice the `--no-server` option.
98-
Like a Gradle daemon, the server here is supposed to help accelerate subsequent builds.
99-
Unfortunately, there is an https://github.com/oracle/graal/issues/1952[issue] where the server causes different results to come out of the compilation.
100-
In particular, we have seen logging disappear if the server is used to aid compilation.
101-
Hence using the server to aid compilation is turned off here.
102-
103-
We can use the `-Dspring.native.remove-unused-autoconfig=true` option to evaluate some of the Spring Boot conditions at image-build time.
104-
For example, it applies to `@ConditionalOnClass`.
105-
Because `native-image` runs at a point when the full classpath is known, we can know for certain if a class is around.
106-
If it is not around, the auto-configuration conditional on that class can be discarded and not have an impact on the image startup. More details on options are discussed <<options,here>>.
94+
You can specify additional <<options>> via a `<configuration><buildArgs>..</buildArgs></configuration>` block.
10795

10896
===== Add the repository for `spring-graalvm-native`
10997

spring-graalvm-native-docs/src/main/asciidoc/troubleshooting.adoc

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,9 @@ The image can fail for a number of reasons. We have described the most common ca
1919

2020
==== Out of memory error when building the native image
2121

22-
`native-image` consumes a lot of RAM.
23-
We have most success on 32G RAM desktop machines.
22+
`native-image` consumes a lot of RAM. We have most success on 32G RAM desktop machines.
2423
16G is possible for smaller samples but 8G machines are likely to hit problems more often.
25-
26-
==== You get a weird crash
27-
28-
If you get a "`weird crash`", check to see if you get the following error:
29-
30-
====
31-
[source,bash]
32-
----
33-
Exception during JVMCI compiler initialization:
34-
Exception in thread "main": java.lang.ExceptionInInitializerError
35-
java.lang.ExceptionInInitializerError
36-
at com.oracle.svm.core.hub.ClassInitializationInfo.initialize(ClassInitializationInfo.java:290)
37-
at java.lang.Class.ensureInitialized(DynamicHub.java:496)
38-
at java.lang.System.getenv(System.java:897)
39-
at org.graalvm.libgraal.jni.JNIUtil.traceLevel(JNIUtil.java:268)
40-
at org.graalvm.libgraal.jni.JNIUtil.trace(JNIUtil.java:292)
41-
at org.graalvm.libgraal.jni.HotSpotToSVMScope.<init>(HotSpotToSVMScope.java:114)
42-
at org.graalvm.compiler.hotspot.management.libgraal.HotSpotGraalManagement.defineClassesInHotSpot(HotSpotGraalManagement.java:170)
43-
at org.graalvm.compiler.hotspot.management.libgraal.HotSpotGraalManagement.initialize(HotSpotGraalManagement.java:115)
44-
at org.graalvm.compiler.hotspot.HotSpotGraalRuntime.<init>(HotSpotGraalRuntime.java:178)
45-
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:156)
46-
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:134)
47-
at org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory.createCompiler(HotSpotGraalCompilerFactory.java:52)
48-
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.getCompiler(HotSpotJVMCIRuntime.java:599)
49-
at jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java:667)
50-
at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST_Nonvirtual:Ljdk_vm_ci_hotspot_HotSpotJVMCIRuntime_2_0002ecompileMethod_00028Ljdk_vm_ci_hotspot_HotSpotResolvedJavaMethod_2IJI_00029Ljdk_vm_ci_hotspot_HotSpotCompilationRequestResult_2(JNIJavaCallWrappers.java:0)
51-
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 83 out of bounds for length 82
52-
at com.oracle.svm.jni.functions.JNIFunctions.SetObjectArrayElement(JNIFunctions.java:683)
53-
at java.lang.ProcessEnvironment.environ(ProcessEnvironment.java)
54-
at java.lang.ProcessEnvironment.<clinit>(ProcessEnvironment.java:70)
55-
at com.oracle.svm.core.hub.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:350)
56-
at com.oracle.svm.core.hub.ClassInitializationInfo.initialize(ClassInitializationInfo.java:270)
57-
... 14 more
58-
Error: Image build request failed with exit status 255
59-
----
60-
====
61-
62-
This has been seen with Graal 20.0.
63-
The current workaround is to re-run your application, because the problem is intermittent.
24+
You can use `-H:+RemoveSaturatedTypeFlows` `native-image` option to reduce the amount of memory required.
6425

6526
=== The built image does not run
6627

@@ -140,12 +101,6 @@ Currently it will warn about failing to specify `proxyBeanMethods=false` on comp
140101
there now to take it further than that as we observe common problems that could be more aggressively checked
141102
earlier.
142103

143-
=== Where has my logging gone?
144-
145-
In standard operation, `native-image` uses a server to optimize compilation speeds.
146-
Using the server has been known to produce native images that are missing logging.
147-
In this case, add `--no-server` to the arguments being passed to `native-image`.
148-
149104
==== No access hint found for import selector: XXX
150105

151106
The feature chases down configuration references to other configurations (`@Import` usages).

0 commit comments

Comments
 (0)