Skip to content

Commit 830e38c

Browse files
committed
Bugfixes
1 parent 1872df9 commit 830e38c

File tree

25 files changed

+967
-753
lines changed

25 files changed

+967
-753
lines changed

docs/reference-manual/native-image/BuildOutput.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ To reduce overhead, please ensure that the classpath only contains entries that
9999
100100
#### <a name="glossary-reflection-registrations"></a>Reflection Registrations
101101
The number of classes, fields, and methods that are registered for reflection.
102-
Large numbers can cause significant reflection overheads, slow down the build process, and increase the size of the native image (see [method metadata](#glossary-method-metadata)).
102+
Large numbers can cause significant reflection overheads, slow down the build process, and increase the size of the native image (see [reflection metadata](#glossary-reflection-metadata)).
103103
104104
#### <a name="glossary-jni-access-registrations"></a>JNI Access Registrations
105105
The number of classes, fields, and methods that are registered for [JNI][doc_jni] access.
@@ -136,16 +136,16 @@ Therefore, reducing the number of [reachable methods](#glossary-reachability) al
136136
The image heap contains reachable objects such as static application data, metadata, and `byte[]` for different purposes.
137137
138138
##### <a name="glossary-general-heap-data"></a>General Heap Data Stored in `byte[]`
139-
The total size of all `byte[]` objects that are neither used for `java.lang.String`, nor [code metadata](#glossary-code-metadata), nor [method metadata](#glossary-method-metadata), nor [graph encodings](#glossary-graph-encodings).
139+
The total size of all `byte[]` objects that are neither used for `java.lang.String`, nor [code metadata](#glossary-code-metadata), nor [reflection metadata](#glossary-reflection-metadata), nor [graph encodings](#glossary-graph-encodings).
140140
Therefore, this can also include `byte[]` objects from application code.
141141
142142
##### <a name="glossary-code-metadata"></a>Code Metadata Stored in `byte[]`
143143
The total size of all `byte[]` objects used for metadata for the [code area](#glossary-code-area).
144144
Therefore, reducing the number of [reachable methods](#glossary-reachability) also reduces the size of this metadata.
145145
146-
##### <a name="glossary-method-metadata"></a>Method Metadata Stored in `byte[]`
147-
The total size of all `byte[]` objects used for method metadata, a type of reflection metadata.
148-
To reduce the amount of method metadata, reduce the number of [classes registered for reflection](#glossary-reflection-classes).
146+
##### <a name="glossary-reflection-metadata"></a>Reflection Metadata Stored in `byte[]`
147+
The total size of all `byte[]` objects used for reflection metadata, including class, field, method and constructor data.
148+
To reduce the amount of reflection metadata, reduce the number of [elements registered for reflection](#glossary-reflection-registrations).
149149
150150
##### <a name="glossary-graph-encodings"></a>Graph Encodings Stored in `byte[]`
151151
The total size of all `byte[]` objects used for graph encodings.

sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/c/CContext.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -47,6 +47,8 @@
4747
import java.util.Collections;
4848
import java.util.List;
4949

50+
import org.graalvm.nativeimage.Platform;
51+
import org.graalvm.nativeimage.Platforms;
5052
import org.graalvm.nativeimage.c.function.CLibrary;
5153

5254
/**
@@ -58,6 +60,7 @@
5860
*/
5961
@Retention(RetentionPolicy.RUNTIME)
6062
@Target({ElementType.TYPE})
63+
@Platforms(Platform.HOSTED_ONLY.class)
6164
public @interface CContext {
6265

6366
/**

sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/RuntimeReflectionSupport.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ public interface RuntimeReflectionSupport extends ReflectionRegistry {
6363

6464
Object[] getRecordComponents(Class<?> type);
6565

66+
void registerHeapDynamicHub(Object hub);
67+
68+
Set<?> getHeapDynamicHubs();
69+
6670
void registerHeapReflectionObject(AccessibleObject object);
6771

6872
Set<AccessibleObject> getHeapReflectionObjects();

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/ObjectScanner.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ protected final void scanField(AnalysisField field, JavaConstant receiver, ScanR
159159
throw AnalysisError.shouldNotReachHere("Could not find field " + field.format("%H.%n") +
160160
(receiver == null ? "" : " on " + constantType(bb, receiver).toJavaName()) +
161161
System.lineSeparator() + backtrace);
162+
} else if (fieldValue.getJavaKind() == JavaKind.Illegal) {
163+
/* The value is not available yet */
164+
return;
162165
}
163166

164167
if (fieldValue.getJavaKind() == JavaKind.Object && bb.getHostVM().isRelocatedPointer(constantAsObject(bb, fieldValue))) {

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,11 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, String ol
720720
}
721721
};
722722

723+
@SuppressWarnings("unused")//
724+
@APIOption(name = "configure-reflection-metadata")//
725+
@Option(help = "Enable runtime instantiation of reflection objects for non-invoked methods.", type = OptionType.Expert, deprecated = true)//
726+
public static final HostedOptionKey<Boolean> ConfigureReflectionMetadata = new HostedOptionKey<>(true);
727+
723728
@Option(help = "Include a list of methods included in the image for runtime inspection.", type = OptionType.Expert)//
724729
public static final HostedOptionKey<Boolean> IncludeMethodData = new HostedOptionKey<>(true);
725730

0 commit comments

Comments
 (0)