8145544: Move sun.misc.VM to jdk.internal.misc

Reviewed-by: alanb, mullan, weijun
This commit is contained in:
Chris Hegarty 2016-01-06 10:01:44 +00:00
parent 6739382299
commit aa0ef2e9f5
46 changed files with 86 additions and 77 deletions
jdk
make/mapfiles/libjava
src
java.base
java.logging/share/classes/java/util/logging
java.management/share/classes
java.rmi/share/classes/sun/rmi/server
java.security.jgss/share/classes/sun/security/krb5/internal
jdk.charsets/share/classes/sun/nio/cs/ext
test
java/lang/management/MemoryMXBean
jdk/internal/misc/VM
sun/security/krb5/auto

@ -274,12 +274,12 @@ SUNWprivate_1.1 {
Java_sun_reflect_Reflection_getClassAccessFlags; Java_sun_reflect_Reflection_getClassAccessFlags;
Java_sun_misc_Version_getJdkVersionInfo; Java_sun_misc_Version_getJdkVersionInfo;
Java_sun_misc_Version_getJvmVersionInfo; Java_sun_misc_Version_getJvmVersionInfo;
Java_sun_misc_VM_latestUserDefinedLoader; Java_jdk_internal_misc_VM_latestUserDefinedLoader;
Java_sun_misc_VM_getuid; Java_jdk_internal_misc_VM_getuid;
Java_sun_misc_VM_geteuid; Java_jdk_internal_misc_VM_geteuid;
Java_sun_misc_VM_getgid; Java_jdk_internal_misc_VM_getgid;
Java_sun_misc_VM_getegid; Java_jdk_internal_misc_VM_getegid;
Java_sun_misc_VM_initialize; Java_jdk_internal_misc_VM_initialize;
Java_sun_misc_VMSupport_initAgentProperties; Java_sun_misc_VMSupport_initAgentProperties;
Java_sun_misc_VMSupport_getVMTemporaryDirectory; Java_sun_misc_VMSupport_getVMTemporaryDirectory;

@ -2135,7 +2135,7 @@ public class ObjectInputStream
* corresponding modifications to the above class. * corresponding modifications to the above class.
*/ */
private static ClassLoader latestUserDefinedLoader() { private static ClassLoader latestUserDefinedLoader() {
return sun.misc.VM.latestUserDefinedLoader(); return jdk.internal.misc.VM.latestUserDefinedLoader();
} }
/** /**

@ -56,6 +56,7 @@ import java.util.HashMap;
import java.util.Objects; import java.util.Objects;
import java.util.StringJoiner; import java.util.StringJoiner;
import jdk.internal.misc.Unsafe; import jdk.internal.misc.Unsafe;
import jdk.internal.misc.VM;
import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.HotSpotIntrinsicCandidate;
import sun.reflect.CallerSensitive; import sun.reflect.CallerSensitive;
import sun.reflect.ConstantPool; import sun.reflect.ConstantPool;
@ -360,9 +361,9 @@ public final class Class<T> implements java.io.Serializable,
// Reflective call to get caller class is only needed if a security manager // Reflective call to get caller class is only needed if a security manager
// is present. Avoid the overhead of making this call otherwise. // is present. Avoid the overhead of making this call otherwise.
caller = Reflection.getCallerClass(); caller = Reflection.getCallerClass();
if (sun.misc.VM.isSystemDomainLoader(loader)) { if (VM.isSystemDomainLoader(loader)) {
ClassLoader ccl = ClassLoader.getClassLoader(caller); ClassLoader ccl = ClassLoader.getClassLoader(caller);
if (!sun.misc.VM.isSystemDomainLoader(ccl)) { if (!VM.isSystemDomainLoader(ccl)) {
sm.checkPermission( sm.checkPermission(
SecurityConstants.GET_CLASSLOADER_PERMISSION); SecurityConstants.GET_CLASSLOADER_PERMISSION);
} }

@ -28,6 +28,7 @@ package java.lang;
import java.lang.annotation.Native; import java.lang.annotation.Native;
import java.util.Objects; import java.util.Objects;
import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.VM;
import static java.lang.String.COMPACT_STRINGS; import static java.lang.String.COMPACT_STRINGS;
import static java.lang.String.LATIN1; import static java.lang.String.LATIN1;
@ -1018,7 +1019,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* may be controlled by the {@code -XX:AutoBoxCacheMax=<size>} option. * may be controlled by the {@code -XX:AutoBoxCacheMax=<size>} option.
* During VM initialization, java.lang.Integer.IntegerCache.high property * During VM initialization, java.lang.Integer.IntegerCache.high property
* may be set and saved in the private system properties in the * may be set and saved in the private system properties in the
* sun.misc.VM class. * jdk.internal.misc.VM class.
*/ */
private static class IntegerCache { private static class IntegerCache {
@ -1030,7 +1031,7 @@ public final class Integer extends Number implements Comparable<Integer> {
// high value may be configured by property // high value may be configured by property
int h = 127; int h = 127;
String integerCacheHighPropValue = String integerCacheHighPropValue =
sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high"); VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
if (integerCacheHighPropValue != null) { if (integerCacheHighPropValue != null) {
try { try {
int i = parseInt(integerCacheHighPropValue); int i = parseInt(integerCacheHighPropValue);

@ -24,7 +24,7 @@
*/ */
package java.lang; package java.lang;
import sun.misc.VM; import jdk.internal.misc.VM;
import java.io.PrintStream; import java.io.PrintStream;
import java.lang.StackWalker.Option; import java.lang.StackWalker.Option;

@ -46,6 +46,7 @@ import sun.reflect.annotation.AnnotationType;
import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.JavaLangAccess;; import jdk.internal.misc.JavaLangAccess;;
import jdk.internal.misc.SharedSecrets;; import jdk.internal.misc.SharedSecrets;;
import jdk.internal.misc.VM;
import jdk.internal.logger.LoggerFinderLoader; import jdk.internal.logger.LoggerFinderLoader;
import jdk.internal.logger.LazyLoggers; import jdk.internal.logger.LazyLoggers;
import jdk.internal.logger.LocalizedLoggerWrapper; import jdk.internal.logger.LocalizedLoggerWrapper;
@ -1817,12 +1818,12 @@ public final class System {
// removed from the system properties. // removed from the system properties.
// //
// See java.lang.Integer.IntegerCache and the // See java.lang.Integer.IntegerCache and the
// sun.misc.VM.saveAndRemoveProperties method for example. // VM.saveAndRemoveProperties method for example.
// //
// Save a private copy of the system properties object that // Save a private copy of the system properties object that
// can only be accessed by the internal implementation. Remove // can only be accessed by the internal implementation. Remove
// certain system properties that are not intended for public access. // certain system properties that are not intended for public access.
sun.misc.VM.saveAndRemoveProperties(props); VM.saveAndRemoveProperties(props);
lineSeparator = props.getProperty("line.separator"); lineSeparator = props.getProperty("line.separator");
@ -1846,7 +1847,7 @@ public final class System {
// set for the class libraries. Currently this is no-op everywhere except // set for the class libraries. Currently this is no-op everywhere except
// for Windows where the process-wide error mode is set before the java.io // for Windows where the process-wide error mode is set before the java.io
// classes are used. // classes are used.
sun.misc.VM.initializeOSEnvironment(); VM.initializeOSEnvironment();
// The main thread is not added to its thread group in the same // The main thread is not added to its thread group in the same
// way as other threads; we must do it ourselves here. // way as other threads; we must do it ourselves here.
@ -1857,10 +1858,10 @@ public final class System {
setJavaLangAccess(); setJavaLangAccess();
// Subsystems that are invoked during initialization can invoke // Subsystems that are invoked during initialization can invoke
// sun.misc.VM.isBooted() in order to avoid doing things that should // VM.isBooted() in order to avoid doing things that should
// wait until the application class loader has been set up. // wait until the application class loader has been set up.
// IMPORTANT: Ensure that this remains the last initialization action! // IMPORTANT: Ensure that this remains the last initialization action!
sun.misc.VM.booted(); VM.booted();
} }
private static void setJavaLangAccess() { private static void setJavaLangAccess() {

@ -1869,7 +1869,7 @@ class Thread implements Runnable {
*/ */
public State getState() { public State getState() {
// get current thread state // get current thread state
return sun.misc.VM.toThreadState(threadStatus); return jdk.internal.misc.VM.toThreadState(threadStatus);
} }
// Added in JSR-166 // Added in JSR-166

@ -27,7 +27,7 @@ package java.lang;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Arrays; import java.util.Arrays;
import sun.misc.VM; import jdk.internal.misc.VM;
/** /**
* A thread group represents a set of threads. In addition, a thread * A thread group represents a set of threads. In addition, a thread

@ -24,7 +24,7 @@
*/ */
package java.lang; package java.lang;
import sun.misc.VM; import jdk.internal.misc.VM;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;

@ -1836,7 +1836,7 @@ return mh1;
return false; return false;
} }
ClassLoader loader = defc.getClassLoader(); ClassLoader loader = defc.getClassLoader();
if (!sun.misc.VM.isSystemDomainLoader(loader)) { if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
ClassLoader sysl = ClassLoader.getSystemClassLoader(); ClassLoader sysl = ClassLoader.getSystemClassLoader();
boolean found = false; boolean found = false;
while (sysl != null) { while (sysl != null) {

@ -29,7 +29,7 @@ import java.security.PrivilegedAction;
import java.security.AccessController; import java.security.AccessController;
import jdk.internal.misc.JavaLangAccess; import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.SharedSecrets;
import sun.misc.VM; import jdk.internal.misc.VM;
final class Finalizer extends FinalReference<Object> { /* Package-private; must be in final class Finalizer extends FinalReference<Object> { /* Package-private; must be in
same package as the Reference same package as the Reference

@ -26,6 +26,7 @@
package java.lang.ref; package java.lang.ref;
import java.util.function.Consumer; import java.util.function.Consumer;
import jdk.internal.misc.VM;
/** /**
* Reference queues, to which registered reference objects are appended by the * Reference queues, to which registered reference objects are appended by the
@ -73,7 +74,7 @@ public class ReferenceQueue<T> {
// Volatiles ensure ordering. // Volatiles ensure ordering.
r.queue = ENQUEUED; r.queue = ENQUEUED;
if (r instanceof FinalReference) { if (r instanceof FinalReference) {
sun.misc.VM.addFinalRefCount(1); VM.addFinalRefCount(1);
} }
lock.notifyAll(); lock.notifyAll();
return true; return true;
@ -93,7 +94,7 @@ public class ReferenceQueue<T> {
r.next = r; r.next = r;
queueLength--; queueLength--;
if (r instanceof FinalReference) { if (r instanceof FinalReference) {
sun.misc.VM.addFinalRefCount(-1); VM.addFinalRefCount(-1);
} }
return r; return r;
} }

@ -34,7 +34,7 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import sun.misc.VM; import jdk.internal.misc.VM;
import sun.reflect.CallerSensitive; import sun.reflect.CallerSensitive;
import sun.reflect.Reflection; import sun.reflect.Reflection;
import sun.reflect.misc.ReflectUtil; import sun.reflect.misc.ReflectUtil;

@ -1242,7 +1242,7 @@ public final class URL implements java.io.Serializable {
private static ThreadLocal<Object> gate = new ThreadLocal<>(); private static ThreadLocal<Object> gate = new ThreadLocal<>();
private static URLStreamHandler lookupViaProviders(final String protocol) { private static URLStreamHandler lookupViaProviders(final String protocol) {
if (!sun.misc.VM.isBooted()) if (!jdk.internal.misc.VM.isBooted())
return null; return null;
if (gate.get() != null) if (gate.get() != null)

@ -31,7 +31,7 @@ import jdk.internal.misc.JavaNioAccess;
import jdk.internal.misc.JavaLangRefAccess; import jdk.internal.misc.JavaLangRefAccess;
import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.Unsafe; import jdk.internal.misc.Unsafe;
import sun.misc.VM; import jdk.internal.misc.VM;
/** /**
* Access to bits, native and otherwise. * Access to bits, native and otherwise.

@ -30,7 +30,7 @@ package java.nio;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import sun.misc.Cleaner; import sun.misc.Cleaner;
import jdk.internal.misc.Unsafe; import jdk.internal.misc.Unsafe;
import sun.misc.VM; import jdk.internal.misc.VM;
import sun.nio.ch.DirectBuffer; import sun.nio.ch.DirectBuffer;

@ -43,6 +43,7 @@ import java.util.ServiceLoader;
import java.util.ServiceConfigurationError; import java.util.ServiceConfigurationError;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import jdk.internal.misc.VM;
import sun.misc.ASCIICaseInsensitiveComparator; import sun.misc.ASCIICaseInsensitiveComparator;
import sun.nio.cs.StandardCharsets; import sun.nio.cs.StandardCharsets;
import sun.nio.cs.ThreadLocalCoders; import sun.nio.cs.ThreadLocalCoders;
@ -281,7 +282,7 @@ public abstract class Charset
static boolean atBugLevel(String bl) { // package-private static boolean atBugLevel(String bl) { // package-private
String level = bugLevel; String level = bugLevel;
if (level == null) { if (level == null) {
if (!sun.misc.VM.isBooted()) if (!VM.isBooted())
return false; return false;
bugLevel = level = AccessController.doPrivileged( bugLevel = level = AccessController.doPrivileged(
new GetPropertyAction("sun.nio.cs.bugLevel", "")); new GetPropertyAction("sun.nio.cs.bugLevel", ""));
@ -394,7 +395,7 @@ public abstract class Charset
// that loader to be prematurely initialized with incomplete // that loader to be prematurely initialized with incomplete
// information. // information.
// //
if (!sun.misc.VM.isBooted()) if (!VM.isBooted())
return null; return null;
if (gate.get() != null) if (gate.get() != null)
@ -445,7 +446,7 @@ public abstract class Charset
} }
private static Charset lookupExtendedCharset(String charsetName) { private static Charset lookupExtendedCharset(String charsetName) {
if (!sun.misc.VM.isBooted()) // see lookupViaProviders() if (!VM.isBooted()) // see lookupViaProviders()
return null; return null;
CharsetProvider[] ecps = ExtendedProviderHolder.extendedProviders; CharsetProvider[] ecps = ExtendedProviderHolder.extendedProviders;
for (CharsetProvider cp : ecps) { for (CharsetProvider cp : ecps) {

@ -69,7 +69,7 @@ import static java.time.LocalTime.NANOS_PER_MILLI;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import java.util.TimeZone; import java.util.TimeZone;
import sun.misc.VM; import jdk.internal.misc.VM;
/** /**
* A clock providing access to the current instant, date and time using a time-zone. * A clock providing access to the current instant, date and time using a time-zone.

@ -48,7 +48,7 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import sun.misc.InnocuousThread; import sun.misc.InnocuousThread;
import sun.misc.VM; import jdk.internal.misc.VM;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import jdk.internal.logger.LazyLoggers.LazyLoggerAccessor; import jdk.internal.logger.LazyLoggers.LazyLoggerAccessor;

@ -32,7 +32,7 @@ import java.lang.System.LoggerFinder;
import java.lang.System.Logger; import java.lang.System.Logger;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Objects; import java.util.Objects;
import sun.misc.VM; import jdk.internal.misc.VM;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
/** /**

@ -30,7 +30,7 @@ import java.security.ProtectionDomain;
import sun.reflect.CallerSensitive; import sun.reflect.CallerSensitive;
import sun.reflect.Reflection; import sun.reflect.Reflection;
import sun.misc.VM; import jdk.internal.misc.VM;
import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.HotSpotIntrinsicCandidate;

@ -23,7 +23,7 @@
* questions. * questions.
*/ */
package sun.misc; package jdk.internal.misc;
import static java.lang.Thread.State.*; import static java.lang.Thread.State.*;
import java.util.Properties; import java.util.Properties;

@ -23,7 +23,7 @@
* questions. * questions.
*/ */
package sun.misc; package jdk.internal.misc;
/** @deprecated */ /** @deprecated */
@Deprecated @Deprecated

@ -66,6 +66,7 @@ import java.util.TreeSet;
import java.util.jar.Attributes; import java.util.jar.Attributes;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import jdk.internal.misc.VM;
public enum LauncherHelper { public enum LauncherHelper {
INSTANCE; INSTANCE;
@ -86,9 +87,9 @@ public enum LauncherHelper {
private static final String PROP_SETTINGS = "Property settings:"; private static final String PROP_SETTINGS = "Property settings:";
private static final String LOCALE_SETTINGS = "Locale settings:"; private static final String LOCALE_SETTINGS = "Locale settings:";
// sync with java.c and sun.misc.VM // sync with java.c and jdk.internal.misc.VM
private static final String diagprop = "sun.java.launcher.diag"; private static final String diagprop = "sun.java.launcher.diag";
static final boolean trace = sun.misc.VM.getSavedProperty(diagprop) != null; static final boolean trace = VM.getSavedProperty(diagprop) != null;
private static final String defaultBundleName = private static final String defaultBundleName =
"sun.launcher.resources.launcher"; "sun.launcher.resources.launcher";

@ -32,6 +32,7 @@ import sun.reflect.CallerSensitive;
import sun.reflect.Reflection; import sun.reflect.Reflection;
import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.VM;
/** /**

@ -389,7 +389,7 @@ public class Util {
static boolean atBugLevel(String bl) { // package-private static boolean atBugLevel(String bl) { // package-private
if (bugLevel == null) { if (bugLevel == null) {
if (!sun.misc.VM.isBooted()) if (!jdk.internal.misc.VM.isBooted())
return false; return false;
String value = AccessController.doPrivileged( String value = AccessController.doPrivileged(
new GetPropertyAction("sun.nio.ch.bugLevel")); new GetPropertyAction("sun.nio.ch.bugLevel"));

@ -156,12 +156,12 @@ public class StandardCharsets extends CharsetProvider {
private boolean initialized = false; private boolean initialized = false;
/* provider the sun.nio.cs.map property fir sjis/ms932 mapping hack /* provider the sun.nio.cs.map property fir sjis/ms932 mapping hack
*/ */
private void init() { private void init() {
if (initialized) if (initialized)
return; return;
if (!sun.misc.VM.isBooted()) if (!jdk.internal.misc.VM.isBooted())
return; return;
initialized = true; initialized = true;

@ -29,6 +29,7 @@ import java.lang.reflect.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.VM;
/** Common utility routines used by both java.lang and /** Common utility routines used by both java.lang and
java.lang.reflect */ java.lang.reflect */
@ -335,7 +336,7 @@ public class Reflection {
*/ */
public static boolean isCallerSensitive(Method m) { public static boolean isCallerSensitive(Method m) {
final ClassLoader loader = m.getDeclaringClass().getClassLoader(); final ClassLoader loader = m.getDeclaringClass().getClassLoader();
if (sun.misc.VM.isSystemDomainLoader(loader) || isExtClassLoader(loader)) { if (VM.isSystemDomainLoader(loader) || isExtClassLoader(loader)) {
return m.isAnnotationPresent(CallerSensitive.class); return m.isAnnotationPresent(CallerSensitive.class);
} }
return false; return false;

@ -28,7 +28,7 @@
#include "jvm.h" #include "jvm.h"
#include "jdk_util.h" #include "jdk_util.h"
#include "sun_misc_VM.h" #include "jdk_internal_misc_VM.h"
/* Only register the performance-critical methods */ /* Only register the performance-critical methods */
static JNINativeMethod methods[] = { static JNINativeMethod methods[] = {
@ -36,12 +36,12 @@ static JNINativeMethod methods[] = {
}; };
JNIEXPORT jobject JNICALL JNIEXPORT jobject JNICALL
Java_sun_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) { Java_jdk_internal_misc_VM_latestUserDefinedLoader(JNIEnv *env, jclass cls) {
return JVM_LatestUserDefinedLoader(env); return JVM_LatestUserDefinedLoader(env);
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) { Java_jdk_internal_misc_VM_initialize(JNIEnv *env, jclass cls) {
if (!JDK_InitJvmHandle()) { if (!JDK_InitJvmHandle()) {
JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup"); JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup");
return; return;
@ -50,8 +50,8 @@ Java_sun_misc_VM_initialize(JNIEnv *env, jclass cls) {
// Registers implementations of native methods described in methods[] // Registers implementations of native methods described in methods[]
// above. // above.
// In particular, registers JVM_GetNanoTimeAdjustment as the implementation // In particular, registers JVM_GetNanoTimeAdjustment as the implementation
// of the native sun.misc.VM.getNanoTimeAdjustment - avoiding the cost of // of the native VM.getNanoTimeAdjustment - avoiding the cost of
// introducing a Java_sun_misc_VM_getNanoTimeAdjustment wrapper // introducing a Java_jdk_internal_misc_VM_getNanoTimeAdjustment wrapper
(*env)->RegisterNatives(env, cls, (*env)->RegisterNatives(env, cls,
methods, sizeof(methods)/sizeof(methods[0])); methods, sizeof(methods)/sizeof(methods[0]));
} }

@ -23,12 +23,12 @@
* questions. * questions.
*/ */
package sun.misc; package jdk.internal.misc;
public class OSEnvironment { public class OSEnvironment {
/* /*
* Initialize any miscellenous operating system settings that need to be set * Initialize any miscellaneous operating system settings that need to be set
* for the class libraries. * for the class libraries.
*/ */
public static void initialize() { public static void initialize() {

@ -28,25 +28,25 @@
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) { Java_jdk_internal_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
return getuid(); return getuid();
} }
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) { Java_jdk_internal_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
return geteuid(); return geteuid();
} }
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) { Java_jdk_internal_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
return getgid(); return getgid();
} }
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) { Java_jdk_internal_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
return getegid(); return getegid();
} }

@ -23,14 +23,14 @@
* questions. * questions.
*/ */
package sun.misc; package jdk.internal.misc;
import sun.io.Win32ErrorMode; import sun.io.Win32ErrorMode;
public class OSEnvironment { public class OSEnvironment {
/* /*
* Initialize any miscellenous operating system settings that need to be set * Initialize any miscellaneous operating system settings that need to be set
* for the class libraries. * for the class libraries.
* <p> * <p>
* At this time only the process-wide error mode needs to be set. * At this time only the process-wide error mode needs to be set.

@ -66,7 +66,7 @@ public class Win32ErrorMode {
* has completed. * has completed.
*/ */
public static void initialize() { public static void initialize() {
if (!sun.misc.VM.isBooted()) { if (!jdk.internal.misc.VM.isBooted()) {
String s = System.getProperty("sun.io.allowCriticalErrorMessageBox"); String s = System.getProperty("sun.io.allowCriticalErrorMessageBox");
if (s == null || s.equals(Boolean.FALSE.toString())) { if (s == null || s.equals(Boolean.FALSE.toString())) {
long mode = setErrorMode(0); long mode = setErrorMode(0);

@ -27,28 +27,28 @@
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) { Java_jdk_internal_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
/* -1 means function not available. */ /* -1 means function not available. */
return -1; return -1;
} }
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) { Java_jdk_internal_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
/* -1 means function not available. */ /* -1 means function not available. */
return -1; return -1;
} }
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) { Java_jdk_internal_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
/* -1 means function not available. */ /* -1 means function not available. */
return -1; return -1;
} }
JNIEXPORT jlong JNICALL JNIEXPORT jlong JNICALL
Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) { Java_jdk_internal_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
/* -1 means function not available. */ /* -1 means function not available. */
return -1; return -1;

@ -639,7 +639,7 @@ public class FileHandler extends StreamHandler {
continue; continue;
} else if (ch2 == 'h') { } else if (ch2 == 'h') {
file = new File(System.getProperty("user.home")); file = new File(System.getProperty("user.home"));
if (sun.misc.VM.isSetUID()) { if (jdk.internal.misc.VM.isSetUID()) {
// Ok, we are in a set UID program. For safety's sake // Ok, we are in a set UID program. For safety's sake
// we disallow attempts to open files relative to %h. // we disallow attempts to open files relative to %h.
throw new IOException("can't use %h in set UID program"); throw new IOException("can't use %h in set UID program");

@ -583,7 +583,7 @@ public class ManagementFactory {
ClassLoader loader = ClassLoader loader =
AccessController.doPrivileged( AccessController.doPrivileged(
(PrivilegedAction<ClassLoader>) () -> cls.getClassLoader()); (PrivilegedAction<ClassLoader>) () -> cls.getClassLoader());
if (!sun.misc.VM.isSystemDomainLoader(loader)) { if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
throw new IllegalArgumentException(mxbeanName + throw new IllegalArgumentException(mxbeanName +
" is not a platform MXBean"); " is not a platform MXBean");
} }

@ -473,7 +473,7 @@ public class ManagementFactoryHelper {
public static Thread.State toThreadState(int state) { public static Thread.State toThreadState(int state) {
// suspended and native bits may be set in state // suspended and native bits may be set in state
int threadStatus = state & ~JMM_THREAD_STATE_FLAG_MASK; int threadStatus = state & ~JMM_THREAD_STATE_FLAG_MASK;
return sun.misc.VM.toThreadState(threadStatus); return jdk.internal.misc.VM.toThreadState(threadStatus);
} }
// These values are defined in jmm.h // These values are defined in jmm.h

@ -59,7 +59,7 @@ class MemoryImpl extends NotificationEmitterSupport
} }
public int getObjectPendingFinalizationCount() { public int getObjectPendingFinalizationCount() {
return sun.misc.VM.getFinalRefCount(); return jdk.internal.misc.VM.getFinalRefCount();
} }
public void gc() { public void gc() {

@ -262,7 +262,7 @@ public class MarshalInputStream extends ObjectInputStream {
* if only code from the null class loader is on the stack. * if only code from the null class loader is on the stack.
*/ */
private static ClassLoader latestUserDefinedLoader() { private static ClassLoader latestUserDefinedLoader() {
return sun.misc.VM.latestUserDefinedLoader(); return jdk.internal.misc.VM.latestUserDefinedLoader();
} }
/** /**

@ -397,7 +397,7 @@ public class FileCredentialsCache extends CredentialsCache
*/ */
if (osname != null && !osname.startsWith("Windows")) { if (osname != null && !osname.startsWith("Windows")) {
long uid = sun.misc.VM.getuid(); long uid = jdk.internal.misc.VM.getuid();
if (uid != -1) { if (uid != -1) {
name = File.separator + "tmp" + name = File.separator + "tmp" +
File.separator + stdCacheNameComponent + "_" + uid; File.separator + stdCacheNameComponent + "_" + uid;

@ -60,7 +60,7 @@ import sun.security.krb5.internal.ReplayCache;
* *
* service_euid * service_euid
* *
* in which euid is available as sun.misc.VM.geteuid(). * in which euid is available as jdk.internal.misc.VM.geteuid().
* *
* The file has a header: * The file has a header:
* *
@ -107,7 +107,7 @@ public class DflCache extends ReplayCache {
private static long uid; private static long uid;
static { static {
// Available on Solaris, Linux and Mac. Otherwise, -1 and no _euid suffix // Available on Solaris, Linux and Mac. Otherwise, -1 and no _euid suffix
uid = sun.misc.VM.geteuid(); uid = jdk.internal.misc.VM.geteuid();
} }
public DflCache (String source) { public DflCache (String source) {

@ -97,7 +97,7 @@ public class ExtendedCharsets extends AbstractCharsetProvider {
protected void init() { protected void init() {
if (initialized) if (initialized)
return; return;
if (!sun.misc.VM.isBooted()) if (!jdk.internal.misc.VM.isBooted())
return; return;
String map = getProperty("sun.nio.cs.map"); String map = getProperty("sun.nio.cs.map");

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 4530538 * @bug 4530538
* @modules java.base/sun.misc * @modules java.base/jdk.internal.misc
* java.management * java.management
* @summary Basic unit test of * @summary Basic unit test of
* RuntimeMXBean.getObjectPendingFinalizationCount() * RuntimeMXBean.getObjectPendingFinalizationCount()
@ -50,10 +50,10 @@ public class Pending {
private static void printFinalizerInstanceCount() { private static void printFinalizerInstanceCount() {
if (!trace) return; if (!trace) return;
int count = sun.misc.VM.getFinalRefCount(); int count = jdk.internal.misc.VM.getFinalRefCount();
System.out.println(INDENT + "Finalizable object Count = " + count); System.out.println(INDENT + "Finalizable object Count = " + count);
count = sun.misc.VM.getPeakFinalRefCount(); count = jdk.internal.misc.VM.getPeakFinalRefCount();
System.out.println(INDENT + "Peak Finalizable object Count = " + count); System.out.println(INDENT + "Peak Finalizable object Count = " + count);
} }

@ -21,13 +21,13 @@
* questions. * questions.
*/ */
import java.util.Objects; import java.util.Objects;
import sun.misc.VM; import jdk.internal.misc.VM;
/** /**
* @test * @test
* @bug 8068730 * @bug 8068730
* @summary tests that VM.getgetNanoTimeAdjustment() works as expected. * @summary tests that VM.getgetNanoTimeAdjustment() works as expected.
* @modules java.base/sun.misc * @modules java.base/jdk.internal.misc
* @run main GetNanoTimeAdjustment * @run main GetNanoTimeAdjustment
* @author danielfuchs * @author danielfuchs
*/ */

@ -78,7 +78,7 @@ public class ReplayCacheTestProc {
mode = -1; mode = -1;
} }
uid = sun.misc.VM.geteuid(); uid = jdk.internal.misc.VM.geteuid();
KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true); KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true);
for (int i=0; i<nu; i++) { for (int i=0; i<nu; i++) {

@ -1,4 +1,5 @@
modules java.base/sun.misc \ modules java.base/jdk.internal.misc \
java.base/sun.misc \
java.base/sun.net.spi.nameservice \ java.base/sun.net.spi.nameservice \
java.base/sun.security.util \ java.base/sun.security.util \
java.security.jgss/sun.security.jgss \ java.security.jgss/sun.security.jgss \