-
Enhancement
-
Resolution: Unresolved
-
P4
-
repo-leyden
String::intern() is called 8842 times when running pet-clinic in premain:
https://github.com/openjdk/leyden/tree/premain/test/hotspot/jtreg/premain/spring-petclinic
Test with "make runs", which creates a static CDS archive and run petclinic with it. I got some Java call stacks by setting a breakpoint at StringTable::intern and calling ps() inside gdb:
Perhaps some of these can be avoided by caching the corresponding results in CDS.
==========================
java.lang.Class.getDeclaredMethods0(java.base@23-internal/Native Method)
java.lang.Class.privateGetDeclaredMethods(java.base@23-internal/Class.java:3667)
java.lang.Class.getDeclaredMethods(java.base@23-internal/Class.java:2756)
org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465)
org.springframework.util.ReflectionUtils.findMethod(ReflectionUtils.java:238)
org.springframework.beans.factory.aot.BeanInstanceSupplier$FactoryMethodLookup.get(BeanInstanceSupplier.java:475)
org.springframework.beans.factory.aot.BeanInstanceSupplier.getFactoryMethod(BeanInstanceSupplier.java:229)
java.lang.String.intern(java.base@23-internal/Native Method)
java.util.jar.Attributes$Name.<init>(java.base@23-internal/Attributes.java:480)
java.util.jar.Attributes$Name.of(java.base@23-internal/Attributes.java:467)
java.util.jar.Attributes.putValue(java.base@23-internal/Attributes.java:177)
java.util.jar.Attributes.read(java.base@23-internal/Attributes.java:423)
java.util.jar.Manifest.read(java.base@23-internal/Manifest.java:296)
java.util.jar.Manifest.<init>(java.base@23-internal/Manifest.java:106)
java.util.jar.Manifest.<init>(java.base@23-internal/Manifest.java:81)
java.lang.String.intern(java.base@23-internal/Native Method)
java.lang.NamedPackage.<init>(java.base@23-internal/NamedPackage.java:51)
java.lang.Package.<init>(java.base@23-internal/Package.java:543)
java.lang.ClassLoader.definePackage(java.base@23-internal/ClassLoader.java:2220)
jdk.internal.loader.BuiltinClassLoader.definePackage(java.base@23-internal/BuiltinClassLoader.java:990)
jdk.internal.loader.BuiltinClassLoader.defineOrCheckPackage(java.base@23-internal/BuiltinClassLoader.java:897)
jdk.internal.loader.ClassLoaders$AppClassLoader.defineOrCheckPackage(java.base@23-internal/ClassLoaders.java:211)
java.lang.String.intern(java.base@23-internal/Native Method)
sun.util.locale.BaseLocale.<init>(java.base@23-internal/BaseLocale.java:115)
sun.util.locale.BaseLocale$Key.<init>(java.base@23-internal/BaseLocale.java:263)
sun.util.locale.BaseLocale$Key.normalize(java.base@23-internal/BaseLocale.java:337)
sun.util.locale.BaseLocale$Cache.normalizeKey(java.base@23-internal/BaseLocale.java:350)
sun.util.locale.BaseLocale$Cache.normalizeKey(java.base@23-internal/BaseLocale.java:341)
sun.util.locale.LocaleObjectCache.get(java.base@23-internal/LocaleObjectCache.java:60)
sun.util.locale.BaseLocale.getInstance(java.base@23-internal/BaseLocale.java:169)
sun.util.locale.InternalLocaleBuilder.getBaseLocale(java.base@23-internal/InternalLocaleBuilder.java:524)
java.util.Locale.forLanguageTag(java.base@23-internal/Locale.java:1939)
sun.util.locale.provider.LocaleProviderAdapter.lambda$toLocaleArray$0(java.base@23-internal/LocaleProviderAdapter.java:315)
sun.util.locale.provider.LocaleProviderAdapter$$Lambda/0x800001163.apply(java.base@23-internal/Unknown Source)
java.util.stream.ReferencePipeline$3$1.accept(java.base@23-internal/ReferencePipeline.java:212)
java.util.Iterator.forEachRemaining(java.base@23-internal/Iterator.java:133)
jdk.proxy2.$Proxy12.<clinit>(jdk.proxy2/Unknown Source)
jdk.internal.misc.Unsafe.ensureClassInitialized0(java.base@23-internal/Native Method)
jdk.internal.misc.Unsafe.ensureClassInitialized(java.base@23-internal/Unsafe.java:1161)
jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(java.base@23-internal/MethodHandleAccessorFactory.java:340)
jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(java.base@23-internal/MethodHandleAccessorFactory.java:103)
jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(java.base@23-internal/ReflectionFactory.java:173)
java.lang.reflect.Constructor.acquireConstructorAccessor(java.base@23-internal/Constructor.java:549)
java.lang.reflect.Constructor.newInstanceWithCaller(java.base@23-internal/Constructor.java:499)
java.lang.reflect.Constructor.newInstance(java.base@23-internal/Constructor.java:486)
https://github.com/openjdk/leyden/tree/premain/test/hotspot/jtreg/premain/spring-petclinic
Test with "make runs", which creates a static CDS archive and run petclinic with it. I got some Java call stacks by setting a breakpoint at StringTable::intern and calling ps() inside gdb:
Perhaps some of these can be avoided by caching the corresponding results in CDS.
==========================
java.lang.Class.getDeclaredMethods0(java.base@23-internal/Native Method)
java.lang.Class.privateGetDeclaredMethods(java.base@23-internal/Class.java:3667)
java.lang.Class.getDeclaredMethods(java.base@23-internal/Class.java:2756)
org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465)
org.springframework.util.ReflectionUtils.findMethod(ReflectionUtils.java:238)
org.springframework.beans.factory.aot.BeanInstanceSupplier$FactoryMethodLookup.get(BeanInstanceSupplier.java:475)
org.springframework.beans.factory.aot.BeanInstanceSupplier.getFactoryMethod(BeanInstanceSupplier.java:229)
java.lang.String.intern(java.base@23-internal/Native Method)
java.util.jar.Attributes$Name.<init>(java.base@23-internal/Attributes.java:480)
java.util.jar.Attributes$Name.of(java.base@23-internal/Attributes.java:467)
java.util.jar.Attributes.putValue(java.base@23-internal/Attributes.java:177)
java.util.jar.Attributes.read(java.base@23-internal/Attributes.java:423)
java.util.jar.Manifest.read(java.base@23-internal/Manifest.java:296)
java.util.jar.Manifest.<init>(java.base@23-internal/Manifest.java:106)
java.util.jar.Manifest.<init>(java.base@23-internal/Manifest.java:81)
java.lang.String.intern(java.base@23-internal/Native Method)
java.lang.NamedPackage.<init>(java.base@23-internal/NamedPackage.java:51)
java.lang.Package.<init>(java.base@23-internal/Package.java:543)
java.lang.ClassLoader.definePackage(java.base@23-internal/ClassLoader.java:2220)
jdk.internal.loader.BuiltinClassLoader.definePackage(java.base@23-internal/BuiltinClassLoader.java:990)
jdk.internal.loader.BuiltinClassLoader.defineOrCheckPackage(java.base@23-internal/BuiltinClassLoader.java:897)
jdk.internal.loader.ClassLoaders$AppClassLoader.defineOrCheckPackage(java.base@23-internal/ClassLoaders.java:211)
java.lang.String.intern(java.base@23-internal/Native Method)
sun.util.locale.BaseLocale.<init>(java.base@23-internal/BaseLocale.java:115)
sun.util.locale.BaseLocale$Key.<init>(java.base@23-internal/BaseLocale.java:263)
sun.util.locale.BaseLocale$Key.normalize(java.base@23-internal/BaseLocale.java:337)
sun.util.locale.BaseLocale$Cache.normalizeKey(java.base@23-internal/BaseLocale.java:350)
sun.util.locale.BaseLocale$Cache.normalizeKey(java.base@23-internal/BaseLocale.java:341)
sun.util.locale.LocaleObjectCache.get(java.base@23-internal/LocaleObjectCache.java:60)
sun.util.locale.BaseLocale.getInstance(java.base@23-internal/BaseLocale.java:169)
sun.util.locale.InternalLocaleBuilder.getBaseLocale(java.base@23-internal/InternalLocaleBuilder.java:524)
java.util.Locale.forLanguageTag(java.base@23-internal/Locale.java:1939)
sun.util.locale.provider.LocaleProviderAdapter.lambda$toLocaleArray$0(java.base@23-internal/LocaleProviderAdapter.java:315)
sun.util.locale.provider.LocaleProviderAdapter$$Lambda/0x800001163.apply(java.base@23-internal/Unknown Source)
java.util.stream.ReferencePipeline$3$1.accept(java.base@23-internal/ReferencePipeline.java:212)
java.util.Iterator.forEachRemaining(java.base@23-internal/Iterator.java:133)
jdk.proxy2.$Proxy12.<clinit>(jdk.proxy2/Unknown Source)
jdk.internal.misc.Unsafe.ensureClassInitialized0(java.base@23-internal/Native Method)
jdk.internal.misc.Unsafe.ensureClassInitialized(java.base@23-internal/Unsafe.java:1161)
jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(java.base@23-internal/MethodHandleAccessorFactory.java:340)
jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(java.base@23-internal/MethodHandleAccessorFactory.java:103)
jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(java.base@23-internal/ReflectionFactory.java:173)
java.lang.reflect.Constructor.acquireConstructorAccessor(java.base@23-internal/Constructor.java:549)
java.lang.reflect.Constructor.newInstanceWithCaller(java.base@23-internal/Constructor.java:499)
java.lang.reflect.Constructor.newInstance(java.base@23-internal/Constructor.java:486)