Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2022, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand All @@ -26,12 +26,22 @@

package com.oracle.svm.core.jdk;

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.heap.Heap;

/**
* Note that sun.rmi.transport.GC is initialized at build-time to avoid including the rmi library,
* which is not needed as it only implements the native maxObjectInspectionAge() method, which in
* turn is {@link Target_sun_rmi_transport_GC#maxObjectInspectionAge substituted in here}.
*/
@TargetClass(className = "sun.rmi.transport.GC")
final class Target_sun_rmi_transport_GC {
@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset)//
private static Thread daemon = null;

@Substitute
public static long maxObjectInspectionAge() {
return Heap.getHeap().getMillisSinceLastWholeHeapExamined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ public void afterRegistration(AfterRegistrationAccess access) {
rci.initializeAtBuildTime("apple.security", JDK_CLASS_REASON);
}

rci.initializeAtBuildTime("sun.rmi.transport.GC", "Loaded an unneeded library (rmi) in static initializer.");

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.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2022, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand All @@ -25,18 +25,14 @@
*/
package com.oracle.svm.hosted.jdk;

import com.oracle.svm.core.feature.InternalFeature;
import org.graalvm.nativeimage.hosted.RuntimeReflection;

import com.oracle.svm.core.VMInspectionOptions;
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.core.jdk.JNIRegistrationUtil;
import com.oracle.svm.core.util.VMError;

import com.oracle.svm.core.jdk.NativeLibrarySupport;
import com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl;
import com.oracle.svm.core.jdk.PlatformNativeLibrarySupport;
import com.oracle.svm.core.jni.JNIRuntimeAccess;
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.VMInspectionOptions;
import com.oracle.svm.core.util.VMError;
import com.oracle.svm.util.ReflectionUtil;

@AutomaticallyRegisteredFeature
Expand All @@ -46,22 +42,11 @@ public boolean isInConfiguration(IsInConfigurationAccess access) {
return VMInspectionOptions.hasJmxClientSupport();
}

private static void handleNativeLibraries(BeforeAnalysisAccess access) {
BeforeAnalysisAccessImpl a = (BeforeAnalysisAccessImpl) access;
NativeLibrarySupport.singleton().preregisterUninitializedBuiltinLibrary("rmi");
a.getNativeLibraries().addStaticJniLibrary("rmi");

// Resolve calls to sun_rmi_transport* as builtIn. For calls to native method
// maxObjectInspectionAge()
PlatformNativeLibrarySupport.singleton().addBuiltinPkgNativePrefix("sun_rmi_transport");
}

@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
try {
configureJNI();
configureReflection(access);
handleNativeLibraries(access);
} catch (Exception e) {
throw VMError.shouldNotReachHere("ManagementClientFeature configuration failed: " + e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public void afterRegistration(AfterRegistrationAccess access) {
rci.initializeAtRunTime("com.sun.jmx.remote.security.JMXPluggableAuthenticator$FileLoginConfig", "JMX support");
rci.initializeAtRunTime("sun.rmi.transport.DGCImpl", "JMX support");
rci.initializeAtRunTime("sun.rmi.transport.DGCAckHandler", "JMX support");
rci.initializeAtRunTime("sun.rmi.transport.GC", "JMX support");
rci.initializeAtRunTime("sun.rmi.transport.DGCClient", "JMX support");
rci.initializeAtRunTime("sun.rmi.transport.ObjectTable", "JMX support");
rci.initializeAtRunTime("sun.rmi.transport.tcp.TCPEndpoint", "JMX support");
Expand Down