Skip to content

Commit 3fae06c

Browse files
author
Christian Wimmer
committed
[GR-39406] Fixes for new class initialization strategy.
PullRequest: graal/14996
2 parents eb40f4b + baf612c commit 3fae06c

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

java-benchmarks/mx.java-benchmarks/mx_java_benchmarks.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ def extra_image_build_argument(self, benchmark, args):
374374
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jni=ALL-UNNAMED',
375375
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.threadlocal=ALL-UNNAMED',
376376
'--initialize-at-run-time=io.netty.internal.tcnative.SSL,io.netty.handler.codec.compression.ZstdOptions',
377-
'--initialize-at-build-time=org.apache.pdfbox.rendering.ImageType',
378377
'-H:+StackTrace'] + super(BaseQuarkusBenchmarkSuite, self).extra_image_build_argument(benchmark, args)
379378

380379

@@ -397,7 +396,10 @@ def extra_image_build_argument(self, benchmark, args):
397396
if mx.get_jdk().version < expectedJdkVersion:
398397
mx.abort(benchmark + " needs at least JDK version " + str(expectedJdkVersion))
399398

400-
return super(BaseTikaBenchmarkSuite, self).extra_image_build_argument(benchmark, args)
399+
return [
400+
# Workaround for wrong class initialization configuration in Quarkus Tika
401+
'--initialize-at-build-time=org.apache.pdfbox.rendering.ImageType,org.apache.pdfbox.rendering.ImageType$1,org.apache.pdfbox.rendering.ImageType$2,org.apache.pdfbox.rendering.ImageType$3,org.apache.pdfbox.rendering.ImageType$4',
402+
] + super(BaseTikaBenchmarkSuite, self).extra_image_build_argument(benchmark, args)
401403

402404

403405
class TikaWrkBenchmarkSuite(BaseTikaBenchmarkSuite, mx_sdk_benchmark.BaseWrkBenchmarkSuite):
@@ -467,6 +469,9 @@ def build_assertions(self, benchmark, is_gate):
467469
def extra_image_build_argument(self, benchmark, args):
468470
return [
469471
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED',
472+
# Workaround for wrong class initialization configuration in Micronaut 3.9
473+
'--initialize-at-build-time=io.netty.handler.codec.http.cookie.ServerCookieEncoder',
474+
'--initialize-at-build-time=org.xml.sax.helpers.AttributesImpl,org.xml.sax.helpers.LocatorImpl',
470475
] + super(BaseMicronautBenchmarkSuite, self).extra_image_build_argument(benchmark, args)
471476

472477
def default_stages(self):

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ServiceLoaderFeature.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public static class Options {
113113
private static final Set<String> SKIPPED_PROVIDERS = Set.of(
114114
/* Graal hotspot-specific service-providers */
115115
"org.graalvm.compiler.hotspot.meta.HotSpotDisassemblerProvider",
116-
/* Skip jline console provider until GR-44085 is fixed */
117-
"jdk.internal.org.jline.JdkConsoleProviderImpl");
116+
/* Skip console providers until GR-44085 is fixed */
117+
"jdk.internal.org.jline.JdkConsoleProviderImpl", "jdk.jshell.execution.impl.ConsoleImpl$ConsoleProviderImpl");
118118

119119
private final Set<String> serviceProvidersToSkip = new HashSet<>(SKIPPED_PROVIDERS);
120120

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/ClassInitializationFeature.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,18 @@ public void afterAnalysis(AfterAnalysisAccess a) {
193193
}
194194

195195
if (ClassInitializationOptions.AssertInitializationSpecifiedForAllClasses.getValue()) {
196+
/*
197+
* This option enables a check that all application classes have an explicitly
198+
* specified initialization status. This is useful to ensure that most classes (all
199+
* classes for which it is feasible) are marked as "initialize at image build time"
200+
* to avoid the overhead of class initialization checks at run time.
201+
*
202+
* We exclude JDK classes from the check: the application should not interfere with
203+
* the class initialization status of the JDK because the application cannot know
204+
* which JDK classes are safe for initialization at image build time.
205+
*/
196206
List<String> unspecifiedClasses = classInitializationSupport.classesWithKind(RUN_TIME).stream()
207+
.filter(c -> c.getClassLoader() != null && c.getClassLoader() != ClassLoader.getPlatformClassLoader())
197208
.filter(c -> classInitializationSupport.specifiedInitKindFor(c) == null)
198209
.map(Class::getTypeName)
199210
.collect(Collectors.toList());

0 commit comments

Comments
 (0)