Search in sources :

Example 1 with RuntimeClassInitializationSupport

use of org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport in project graal by oracle.

the class ClassInitializationTracking method reportObjectInstantiated.

/**
 * This method is called from the instrumented class initialization methods.
 */
@SuppressWarnings({ "unused" })
public static void reportObjectInstantiated(Object o, StackTraceElement[] stackTrace) {
    if (ImageSingletonsSupport.isInstalled() && ImageSingletons.contains(RuntimeClassInitializationSupport.class)) {
        RuntimeClassInitializationSupport runtimeClassInitialization = ImageSingletons.lookup(RuntimeClassInitializationSupport.class);
        runtimeClassInitialization.reportObjectInstantiated(o, stackTrace);
    }
}
Also used : RuntimeClassInitializationSupport(org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport)

Example 2 with RuntimeClassInitializationSupport

use of org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport in project graal by oracle.

the class JDKInitializationFeature method afterRegistration.

@Override
public void afterRegistration(AfterRegistrationAccess access) {
    RuntimeClassInitializationSupport rci = ImageSingletons.lookup(RuntimeClassInitializationSupport.class);
    rci.initializeAtBuildTime("com.sun.java.util.jar.pack", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.management", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.naming.internal", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.net.ssl", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.nio.file", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.nio.sctp", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.nio.zipfs", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.io", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.lang", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.math", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.net", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.nio", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.text", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.time", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.util", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.annotation.processing", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.lang.model", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.management", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.naming", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.net", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.tools", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("jdk.internal", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("jdk.jfr", "Needed for Native Image substitutions");
    rci.initializeAtBuildTime("jdk.net", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("jdk.nio", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("jdk.vm.ci", "Native Image classes are always initialized at build time");
    rci.initializeAtBuildTime("sun.invoke", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.launcher", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.management", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.misc", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.net", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.nio", "Core JDK classes are initialized at build time");
    if (Platform.includedIn(Platform.WINDOWS.class)) {
        rci.rerunInitialization("sun.nio.ch.PipeImpl", "Contains SecureRandom reference, therefore can't be included in the image heap");
    }
    rci.rerunInitialization("sun.net.PortConfig", "Calls PortConfig.getLower0() and PortConfig.getUpper0()");
    rci.rerunInitialization("sun.nio.ch.DevPollArrayWrapper", "Calls IOUtil.fdLimit()");
    rci.rerunInitialization("sun.nio.ch.EPoll", "Calls EPoll.eventSize(), EPoll.eventsOffset() and EPoll.dataOffset()");
    rci.rerunInitialization("sun.nio.ch.EPollSelectorImpl", "Calls IOUtil.fdLimit()");
    rci.rerunInitialization("sun.nio.ch.EventPortSelectorImpl", "Calls IOUtil.fdLimit()");
    rci.rerunInitialization("sun.nio.fs.LinuxWatchService$Poller", "LinuxWatchService.eventSize() and LinuxWatchService.eventOffsets()");
    rci.initializeAtBuildTime("sun.reflect", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.mscapi", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.text", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.util", "Core JDK classes are initialized at build time");
    /* Minor fixes to make the list work */
    rci.initializeAtRunTime("com.sun.naming.internal.ResourceManager$AppletParameter", "Initializes AWT");
    rci.initializeAtBuildTime("java.awt.font.TextAttribute", "Required for sun.text.bidi.BidiBase.NumericShapings");
    rci.initializeAtBuildTime("java.awt.font.NumericShaper", "Required for sun.text.bidi.BidiBase.NumericShapings");
    /* Security services */
    rci.initializeAtBuildTime("com.sun.crypto.provider", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.security.auth", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.security.jgss", "Core JDK classes are initialized at build time for better performance");
    rci.initializeAtBuildTime("com.sun.security.cert.internal.x509", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.security.ntlm", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("com.sun.security.sasl", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("java.security", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.crypto", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.security.auth", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.security.cert", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("javax.security.sasl", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.action", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.ec", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.internal.interfaces", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.internal.spec", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.jca", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.jgss", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("org.ietf.jgss.GSSException", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("org.ietf.jgss.GSSName", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.krb5", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.pkcs", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.pkcs10", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.pkcs11", "Core JDK classes are initialized at build time for better performance");
    rci.initializeAtBuildTime("sun.security.pkcs12", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.provider", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.rsa", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.ssl", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.timestamp", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.tools", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.util", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.validator", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.x509", "Core JDK classes are initialized at build time");
    rci.initializeAtBuildTime("sun.security.smartcardio", "Core JDK classes are initialized at build time");
    rci.rerunInitialization("com.sun.jndi.dns.DnsClient", "Contains Random references, therefore can't be included in the image heap.");
    rci.rerunInitialization("sun.net.www.protocol.http.DigestAuthentication$Parameters", "Contains Random references, therefore can't be included in the image heap.");
    rci.rerunInitialization("sun.security.krb5.KrbServiceLocator", "Contains Random references, therefore can't be included in the image heap.");
    rci.rerunInitialization("com.sun.jndi.ldap.ServiceLocator", "Contains Random references, therefore can't be included in the image heap.");
    // The random number provider classes should be reinitialized at runtime to reset their
    // values properly. Otherwise the numbers generated will be fixed for each generated image.
    rci.rerunInitialization("java.lang.Math$RandomNumberGeneratorHolder", "Contains random seeds");
    rci.rerunInitialization("java.lang.StrictMath$RandomNumberGeneratorHolder", "Contains random seeds");
    rci.rerunInitialization("jdk.internal.misc.InnocuousThread", "Contains a thread group INNOCUOUSTHREADGROUP.");
}
Also used : Platform(org.graalvm.nativeimage.Platform) RuntimeClassInitializationSupport(org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport)

Example 3 with RuntimeClassInitializationSupport

use of org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport in project graal by oracle.

the class ContainersFeature method duringSetup.

@Override
public void duringSetup(DuringSetupAccess access) {
    RuntimeClassInitializationSupport classInitSupport = ImageSingletons.lookup(RuntimeClassInitializationSupport.class);
    classInitSupport.initializeAtRunTime("com.oracle.svm.core.containers.cgroupv1.CgroupV1Subsystem", "for cgroup support");
    classInitSupport.initializeAtRunTime("com.oracle.svm.core.containers.cgroupv2.CgroupV2Subsystem", "for cgroup support");
}
Also used : RuntimeClassInitializationSupport(org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport)

Example 4 with RuntimeClassInitializationSupport

use of org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport in project graal by oracle.

the class ClassInitializationTracking method reportClassInitialized.

/**
 * This method is called from the instrumented class initialization methods.
 */
@SuppressWarnings({ "unused", "ConstantConditions" })
public static void reportClassInitialized(Class<?> c, StackTraceElement[] stackTrace) {
    if (ImageSingletonsSupport.isInstalled() && ImageSingletons.contains(RuntimeClassInitializationSupport.class)) {
        RuntimeClassInitializationSupport runtimeClassInitialization = ImageSingletons.lookup(RuntimeClassInitializationSupport.class);
        runtimeClassInitialization.reportClassInitialized(c, stackTrace);
    }
}
Also used : RuntimeClassInitializationSupport(org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport)

Example 5 with RuntimeClassInitializationSupport

use of org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport in project graal by oracle.

the class JfrFeature method afterRegistration.

@Override
public void afterRegistration(AfterRegistrationAccess access) {
    ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.jfr", false);
    ModuleSupport.exportAndOpenAllPackagesToUnnamed("java.base", false);
    ModuleSupport.exportAndOpenPackageToClass("jdk.jfr", "jdk.jfr.events", false, JfrFeature.class);
    ModuleSupport.exportAndOpenPackageToClass("jdk.internal.vm.ci", "jdk.vm.ci.hotspot", false, JfrEventSubstitution.class);
    // Initialize some parts of JFR/JFC at image build time.
    List<Configuration> knownConfigurations = JFC.getConfigurations();
    JVM.getJVM().createNativeJFR();
    ImageSingletons.add(JfrManager.class, new JfrManager(HOSTED_ENABLED));
    ImageSingletons.add(SubstrateJVM.class, new SubstrateJVM(knownConfigurations));
    ImageSingletons.add(JfrSerializerSupport.class, new JfrSerializerSupport());
    ImageSingletons.add(JfrTraceIdMap.class, new JfrTraceIdMap());
    ImageSingletons.add(JfrTraceIdEpoch.class, new JfrTraceIdEpoch());
    ImageSingletons.add(JfrGCNames.class, new JfrGCNames());
    JfrSerializerSupport.get().register(new JfrFrameTypeSerializer());
    JfrSerializerSupport.get().register(new JfrThreadStateSerializer());
    ThreadListenerSupport.get().register(SubstrateJVM.getThreadLocal());
    if (HOSTED_ENABLED) {
        RuntimeClassInitializationSupport rci = ImageSingletons.lookup(RuntimeClassInitializationSupport.class);
        rci.initializeAtBuildTime("jdk.management.jfr", "Allow FlightRecorder to be used at image build time");
        rci.initializeAtBuildTime("com.sun.jmx.mbeanserver", "Allow FlightRecorder to be used at image build time");
        rci.initializeAtBuildTime("com.sun.jmx.defaults", "Allow FlightRecorder to be used at image build time");
        rci.initializeAtBuildTime("java.beans", "Allow FlightRecorder to be used at image build time");
    }
}
Also used : JfrManager(com.oracle.svm.core.jfr.JfrManager) Configuration(jdk.jfr.Configuration) JfrSerializerSupport(com.oracle.svm.core.jfr.JfrSerializerSupport) JfrThreadStateSerializer(com.oracle.svm.core.jfr.JfrThreadStateSerializer) JfrFrameTypeSerializer(com.oracle.svm.core.jfr.JfrFrameTypeSerializer) RuntimeClassInitializationSupport(org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport) JfrGCNames(com.oracle.svm.core.jfr.JfrGCNames) JfrTraceIdMap(com.oracle.svm.core.jfr.traceid.JfrTraceIdMap) JfrTraceIdEpoch(com.oracle.svm.core.jfr.traceid.JfrTraceIdEpoch) SubstrateJVM(com.oracle.svm.core.jfr.SubstrateJVM)

Aggregations

RuntimeClassInitializationSupport (org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport)7 JfrFrameTypeSerializer (com.oracle.svm.core.jfr.JfrFrameTypeSerializer)1 JfrGCNames (com.oracle.svm.core.jfr.JfrGCNames)1 JfrManager (com.oracle.svm.core.jfr.JfrManager)1 JfrSerializerSupport (com.oracle.svm.core.jfr.JfrSerializerSupport)1 JfrThreadStateSerializer (com.oracle.svm.core.jfr.JfrThreadStateSerializer)1 SubstrateJVM (com.oracle.svm.core.jfr.SubstrateJVM)1 JfrTraceIdEpoch (com.oracle.svm.core.jfr.traceid.JfrTraceIdEpoch)1 JfrTraceIdMap (com.oracle.svm.core.jfr.traceid.JfrTraceIdMap)1 DuringSetupAccessImpl (com.oracle.svm.hosted.FeatureImpl.DuringSetupAccessImpl)1 KeyStore (java.security.KeyStore)1 Service (java.security.Provider.Service)1 X509Certificate (java.security.cert.X509Certificate)1 Set (java.util.Set)1 TransformService (javax.xml.crypto.dsig.TransformService)1 Configuration (jdk.jfr.Configuration)1 Platform (org.graalvm.nativeimage.Platform)1 NativePRNG (sun.security.provider.NativePRNG)1 OIDMap (sun.security.x509.OIDMap)1