You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Make line separator system-ignorant (Thanks Fabio)
- Rename -H:ThrowOnXXXReachable to -H:AbortOnXXXReachable (Thanks Doug)
- Don't hardcode option name and rename Diagnosis Report to Reachability Diagnosis Report (Thanks Fabio)
Copy file name to clipboardExpand all lines: docs/reference-manual/native-image/StaticAnalysisReports.md
+51-3Lines changed: 51 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ The points-to analysis produces two kinds of reports: an analysis call tree and
12
12
This information is produced by an intermediate step in the building process and represents the static analysis view of the call graph and heap object graph.
13
13
These graphs are further transformed in the building process before they are compiled ahead-of-time into the binary and written into the binary heap, respectively.
14
14
15
+
In addition to the comprehensive report of the whole analysis universe, the points-to analysis can also produce reachability reports on why certain type/method/field is reachable.
16
+
15
17
## Call tree
16
18
The call tree is a a breadth-first tree reduction of the call graph as seen by the points-to analysis.
17
19
The points-to analysis eliminates calls to methods that it determines cannot be reachable at runtime, based on the analyzed receiver types.
@@ -158,7 +160,46 @@ Roots suppression/expansion:
158
160
-`-H:ImageObjectTreeSuppressRoots=java.util.* -H:ImageObjectTreeExpandRoots=java.util.Locale` - suppress the expansion of all roots that start with `java.util.` but not `java.util.Locale`
159
161
-`-H:ImageObjectTreeExpandRoots=*` - force the expansion of all roots, including those suppressed by default
160
162
161
-
### Report Files
163
+
## Reachability Report
164
+
165
+
In diagnosing code size or security problems, the developer often has the need to know why certain code element (type/method/field) is reachable.
166
+
Reachability reports are designed for the purpose.
167
+
There are three options for diagnosing the reachability reasons for types, methods, and fields respectively:
168
+
169
+
-`-H:AbortOnTypeReachable=<pattern>`
170
+
-`-H:AbortOnMethodReachable=<pattern>`
171
+
-`-H:AbortOnFieldReachable=<pattern>`
172
+
173
+
For each option, the right-hand side specifies the pattern of the code element to be diagnosed.
174
+
175
+
- The syntax for specifying types and fields is the same as that of suppression/expansion (See documentation for `-H:ImageObjectTreeSuppressTypes` above).
176
+
- The syntax for specifying methods is the same as that of method filters (See documentation for `-Dgraal.MethodFilter`).
177
+
178
+
When one of the option is enabled and the corresponding code element is reachable, a reachability trace will be dumped to a TXT file and Native Image will abort.
179
+
Here is an example of the reachability report for `-H:AbortOnTypeReachable=java.io.File`:
180
+
181
+
```
182
+
Type java.io.File is marked as allocated
183
+
at virtual method com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:105), implementation invoked
184
+
├── at virtual method com.oracle.svm.core.jdk.JNIPlatformNativeLibrarySupport.loadJavaLibrary(JNIPlatformNativeLibrarySupport.java:44), implementation invoked
185
+
│ ├── at virtual method com.oracle.svm.core.posix.PosixNativeLibrarySupport.loadJavaLibrary(PosixNativeLibraryFeature.java:117), implementation invoked
186
+
│ │ ├── at virtual method com.oracle.svm.core.posix.PosixNativeLibrarySupport.initializeBuiltinLibraries(PosixNativeLibraryFeature.java:98), implementation invoked
187
+
│ │ │ ├── at static method com.oracle.svm.core.graal.snippets.CEntryPointSnippets.initializeIsolate(CEntryPointSnippets.java:346), implementation invoked
188
+
│ │ │ │ str: static root method
189
+
│ │ │ └── type com.oracle.svm.core.posix.PosixNativeLibrarySupport is marked as in-heap
190
+
│ │ │ scanning root com.oracle.svm.core.posix.PosixNativeLibrarySupport@4839bf0d: com.oracle.svm.core.posix.PosixNativeLibrarySupport@4839bf0d embedded in
at static method org.graalvm.nativeimage.ImageSingletons.lookup(Class), intrinsified
200
+
```
201
+
202
+
## Report Files
162
203
163
204
The reports are generated in the `reports` subdirectory, relative to the build directory.
164
205
When executing the `native-image` executable the build directory defaults to the working directory and can be modified using the `-H:Path=<dir>` option.
@@ -169,6 +210,13 @@ The object tree report name has the structure: `object_tree_<binary_name>_<date_
169
210
The binary name is the name of the generated binary, which can be set with the `-H:Name=<name>` option.
170
211
The `<date_time>` is in the `yyyyMMdd_HHmmss` format.
171
212
172
-
### Further Reading
213
+
The reachability reports are also located in the reports directory.
214
+
They follow the same naming convention:
215
+
216
+
- Type reachability report: `trace_types_<binary_name>_<date_time>.txt`
0 commit comments