8145544: Move sun.misc.VM to jdk.internal.misc
authorchegar
Wed, 06 Jan 2016 10:01:44 +0000
changeset 34882 ce2a8ec851c1
parent 34881 c519b013f50e
child 34883 78b4302edb6d
8145544: Move sun.misc.VM to jdk.internal.misc Reviewed-by: alanb, mullan, weijun
jdk/make/mapfiles/libjava/mapfile-vers
jdk/src/java.base/share/classes/java/io/ObjectInputStream.java
jdk/src/java.base/share/classes/java/lang/Class.java
jdk/src/java.base/share/classes/java/lang/Integer.java
jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java
jdk/src/java.base/share/classes/java/lang/System.java
jdk/src/java.base/share/classes/java/lang/Thread.java
jdk/src/java.base/share/classes/java/lang/ThreadGroup.java
jdk/src/java.base/share/classes/java/lang/Throwable.java
jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java
jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java
jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java
jdk/src/java.base/share/classes/java/net/URL.java
jdk/src/java.base/share/classes/java/nio/Bits.java
jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template
jdk/src/java.base/share/classes/java/nio/charset/Charset.java
jdk/src/java.base/share/classes/java/time/Clock.java
jdk/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java
jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java
jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
jdk/src/java.base/share/classes/jdk/internal/misc/VM.java
jdk/src/java.base/share/classes/jdk/internal/misc/VMNotification.java
jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
jdk/src/java.base/share/classes/sun/misc/Unsafe.java
jdk/src/java.base/share/classes/sun/misc/VM.java
jdk/src/java.base/share/classes/sun/misc/VMNotification.java
jdk/src/java.base/share/classes/sun/nio/ch/Util.java
jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
jdk/src/java.base/share/classes/sun/reflect/Reflection.java
jdk/src/java.base/share/native/libjava/VM.c
jdk/src/java.base/unix/classes/jdk/internal/misc/OSEnvironment.java
jdk/src/java.base/unix/classes/sun/misc/OSEnvironment.java
jdk/src/java.base/unix/native/libjava/VM_md.c
jdk/src/java.base/windows/classes/jdk/internal/misc/OSEnvironment.java
jdk/src/java.base/windows/classes/sun/io/Win32ErrorMode.java
jdk/src/java.base/windows/classes/sun/misc/OSEnvironment.java
jdk/src/java.base/windows/native/libjava/VM_md.c
jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java
jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java
jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java
jdk/src/java.management/share/classes/sun/management/MemoryImpl.java
jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java
jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template
jdk/test/java/lang/management/MemoryMXBean/Pending.java
jdk/test/jdk/internal/misc/VM/GetNanoTimeAdjustment.java
jdk/test/sun/misc/VM/GetNanoTimeAdjustment.java
jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java
jdk/test/sun/security/krb5/auto/TEST.properties
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Wed Jan 06 10:01:44 2016 +0000
@@ -274,12 +274,12 @@
 		Java_sun_reflect_Reflection_getClassAccessFlags;
                 Java_sun_misc_Version_getJdkVersionInfo;
                 Java_sun_misc_Version_getJvmVersionInfo;
-		Java_sun_misc_VM_latestUserDefinedLoader;
-                Java_sun_misc_VM_getuid;
-                Java_sun_misc_VM_geteuid;
-                Java_sun_misc_VM_getgid;
-                Java_sun_misc_VM_getegid;
-                Java_sun_misc_VM_initialize;
+		Java_jdk_internal_misc_VM_latestUserDefinedLoader;
+                Java_jdk_internal_misc_VM_getuid;
+                Java_jdk_internal_misc_VM_geteuid;
+                Java_jdk_internal_misc_VM_getgid;
+                Java_jdk_internal_misc_VM_getegid;
+                Java_jdk_internal_misc_VM_initialize;
 		Java_sun_misc_VMSupport_initAgentProperties;
 		Java_sun_misc_VMSupport_getVMTemporaryDirectory;
 
--- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java	Wed Jan 06 10:01:44 2016 +0000
@@ -2135,7 +2135,7 @@
      * corresponding modifications to the above class.
      */
     private static ClassLoader latestUserDefinedLoader() {
-        return sun.misc.VM.latestUserDefinedLoader();
+        return jdk.internal.misc.VM.latestUserDefinedLoader();
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/Class.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Wed Jan 06 10:01:44 2016 +0000
@@ -56,6 +56,7 @@
 import java.util.Objects;
 import java.util.StringJoiner;
 import jdk.internal.misc.Unsafe;
+import jdk.internal.misc.VM;
 import jdk.internal.HotSpotIntrinsicCandidate;
 import sun.reflect.CallerSensitive;
 import sun.reflect.ConstantPool;
@@ -360,9 +361,9 @@
             // Reflective call to get caller class is only needed if a security manager
             // is present.  Avoid the overhead of making this call otherwise.
             caller = Reflection.getCallerClass();
-            if (sun.misc.VM.isSystemDomainLoader(loader)) {
+            if (VM.isSystemDomainLoader(loader)) {
                 ClassLoader ccl = ClassLoader.getClassLoader(caller);
-                if (!sun.misc.VM.isSystemDomainLoader(ccl)) {
+                if (!VM.isSystemDomainLoader(ccl)) {
                     sm.checkPermission(
                         SecurityConstants.GET_CLASSLOADER_PERMISSION);
                 }
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java	Wed Jan 06 10:01:44 2016 +0000
@@ -28,6 +28,7 @@
 import java.lang.annotation.Native;
 import java.util.Objects;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 
 import static java.lang.String.COMPACT_STRINGS;
 import static java.lang.String.LATIN1;
@@ -1018,7 +1019,7 @@
      * may be controlled by the {@code -XX:AutoBoxCacheMax=<size>} option.
      * During VM initialization, java.lang.Integer.IntegerCache.high property
      * 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 {
@@ -1030,7 +1031,7 @@
             // high value may be configured by property
             int h = 127;
             String integerCacheHighPropValue =
-                sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
+                VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
             if (integerCacheHighPropValue != null) {
                 try {
                     int i = parseInt(integerCacheHighPropValue);
--- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java	Wed Jan 06 10:01:44 2016 +0000
@@ -24,7 +24,7 @@
  */
 package java.lang;
 
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import java.io.PrintStream;
 import java.lang.StackWalker.Option;
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Wed Jan 06 10:01:44 2016 +0000
@@ -46,6 +46,7 @@
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.misc.JavaLangAccess;;
 import jdk.internal.misc.SharedSecrets;;
+import jdk.internal.misc.VM;
 import jdk.internal.logger.LoggerFinderLoader;
 import jdk.internal.logger.LazyLoggers;
 import jdk.internal.logger.LocalizedLoggerWrapper;
@@ -1817,12 +1818,12 @@
         // removed from the system properties.
         //
         // 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
         // can only be accessed by the internal implementation.  Remove
         // certain system properties that are not intended for public access.
-        sun.misc.VM.saveAndRemoveProperties(props);
+        VM.saveAndRemoveProperties(props);
 
 
         lineSeparator = props.getProperty("line.separator");
@@ -1846,7 +1847,7 @@
         // 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
         // classes are used.
-        sun.misc.VM.initializeOSEnvironment();
+        VM.initializeOSEnvironment();
 
         // The main thread is not added to its thread group in the same
         // way as other threads; we must do it ourselves here.
@@ -1857,10 +1858,10 @@
         setJavaLangAccess();
 
         // 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.
         // IMPORTANT: Ensure that this remains the last initialization action!
-        sun.misc.VM.booted();
+        VM.booted();
     }
 
     private static void setJavaLangAccess() {
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java	Wed Jan 06 10:01:44 2016 +0000
@@ -1869,7 +1869,7 @@
      */
     public State getState() {
         // get current thread state
-        return sun.misc.VM.toThreadState(threadStatus);
+        return jdk.internal.misc.VM.toThreadState(threadStatus);
     }
 
     // Added in JSR-166
--- a/jdk/src/java.base/share/classes/java/lang/ThreadGroup.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ThreadGroup.java	Wed Jan 06 10:01:44 2016 +0000
@@ -27,7 +27,7 @@
 
 import java.io.PrintStream;
 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/jdk/src/java.base/share/classes/java/lang/Throwable.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/Throwable.java	Wed Jan 06 10:01:44 2016 +0000
@@ -24,7 +24,7 @@
  */
 
 package java.lang;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import  java.io.*;
 import  java.util.*;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Wed Jan 06 10:01:44 2016 +0000
@@ -1836,7 +1836,7 @@
                 return false;
             }
             ClassLoader loader = defc.getClassLoader();
-            if (!sun.misc.VM.isSystemDomainLoader(loader)) {
+            if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
                 ClassLoader sysl = ClassLoader.getSystemClassLoader();
                 boolean found = false;
                 while (sysl != null) {
--- a/jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Finalizer.java	Wed Jan 06 10:01:44 2016 +0000
@@ -29,7 +29,7 @@
 import java.security.AccessController;
 import jdk.internal.misc.JavaLangAccess;
 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
                                                           same package as the Reference
--- a/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java	Wed Jan 06 10:01:44 2016 +0000
@@ -26,6 +26,7 @@
 package java.lang.ref;
 
 import java.util.function.Consumer;
+import jdk.internal.misc.VM;
 
 /**
  * Reference queues, to which registered reference objects are appended by the
@@ -73,7 +74,7 @@
             // Volatiles ensure ordering.
             r.queue = ENQUEUED;
             if (r instanceof FinalReference) {
-                sun.misc.VM.addFinalRefCount(1);
+                VM.addFinalRefCount(1);
             }
             lock.notifyAll();
             return true;
@@ -93,7 +94,7 @@
             r.next = r;
             queueLength--;
             if (r instanceof FinalReference) {
-                sun.misc.VM.addFinalRefCount(-1);
+                VM.addFinalRefCount(-1);
             }
             return r;
         }
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java	Wed Jan 06 10:01:44 2016 +0000
@@ -34,7 +34,7 @@
 import java.util.Objects;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.BiFunction;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
--- a/jdk/src/java.base/share/classes/java/net/URL.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/net/URL.java	Wed Jan 06 10:01:44 2016 +0000
@@ -1242,7 +1242,7 @@
     private static ThreadLocal<Object> gate = new ThreadLocal<>();
 
     private static URLStreamHandler lookupViaProviders(final String protocol) {
-        if (!sun.misc.VM.isBooted())
+        if (!jdk.internal.misc.VM.isBooted())
             return null;
 
         if (gate.get() != null)
--- a/jdk/src/java.base/share/classes/java/nio/Bits.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java	Wed Jan 06 10:01:44 2016 +0000
@@ -31,7 +31,7 @@
 import jdk.internal.misc.JavaLangRefAccess;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.misc.Unsafe;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 /**
  * Access to bits, native and otherwise.
--- a/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template	Wed Jan 06 10:01:44 2016 +0000
@@ -30,7 +30,7 @@
 import java.io.FileDescriptor;
 import sun.misc.Cleaner;
 import jdk.internal.misc.Unsafe;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.nio.ch.DirectBuffer;
 
 
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java	Wed Jan 06 10:01:44 2016 +0000
@@ -43,6 +43,7 @@
 import java.util.ServiceConfigurationError;
 import java.util.SortedMap;
 import java.util.TreeMap;
+import jdk.internal.misc.VM;
 import sun.misc.ASCIICaseInsensitiveComparator;
 import sun.nio.cs.StandardCharsets;
 import sun.nio.cs.ThreadLocalCoders;
@@ -281,7 +282,7 @@
     static boolean atBugLevel(String bl) {              // package-private
         String level = bugLevel;
         if (level == null) {
-            if (!sun.misc.VM.isBooted())
+            if (!VM.isBooted())
                 return false;
             bugLevel = level = AccessController.doPrivileged(
                 new GetPropertyAction("sun.nio.cs.bugLevel", ""));
@@ -394,7 +395,7 @@
         // that loader to be prematurely initialized with incomplete
         // information.
         //
-        if (!sun.misc.VM.isBooted())
+        if (!VM.isBooted())
             return null;
 
         if (gate.get() != null)
@@ -445,7 +446,7 @@
     }
 
     private static Charset lookupExtendedCharset(String charsetName) {
-        if (!sun.misc.VM.isBooted())  // see lookupViaProviders()
+        if (!VM.isBooted())  // see lookupViaProviders()
             return null;
         CharsetProvider[] ecps = ExtendedProviderHolder.extendedProviders;
         for (CharsetProvider cp : ecps) {
--- a/jdk/src/java.base/share/classes/java/time/Clock.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/java/time/Clock.java	Wed Jan 06 10:01:44 2016 +0000
@@ -69,7 +69,7 @@
 import java.io.Serializable;
 import java.util.Objects;
 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/jdk/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Wed Jan 06 10:01:44 2016 +0000
@@ -48,7 +48,7 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import sun.misc.InnocuousThread;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.util.logging.PlatformLogger;
 import jdk.internal.logger.LazyLoggers.LazyLoggerAccessor;
 
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java	Wed Jan 06 10:01:44 2016 +0000
@@ -32,7 +32,7 @@
 import java.lang.System.Logger;
 import java.lang.ref.WeakReference;
 import java.util.Objects;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 import sun.util.logging.PlatformLogger;
 
 /**
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Wed Jan 06 10:01:44 2016 +0000
@@ -30,7 +30,7 @@
 
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
-import sun.misc.VM;
+import jdk.internal.misc.VM;
 
 import jdk.internal.HotSpotIntrinsicCandidate;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java	Wed Jan 06 10:01:44 2016 +0000
@@ -0,0 +1,433 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.misc;
+
+import static java.lang.Thread.State.*;
+import java.util.Properties;
+
+public class VM {
+
+    /* The following methods used to be native methods that instruct
+     * the VM to selectively suspend certain threads in low-memory
+     * situations. They are inherently dangerous and not implementable
+     * on native threads. We removed them in JDK 1.2. The skeletons
+     * remain so that existing applications that use these methods
+     * will still work.
+     */
+    private static boolean suspended = false;
+
+    /** @deprecated */
+    @Deprecated
+    public static boolean threadsSuspended() {
+        return suspended;
+    }
+
+    @SuppressWarnings("deprecation")
+    public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
+        return g.allowThreadSuspension(b);
+    }
+
+    /** @deprecated */
+    @Deprecated
+    public static boolean suspendThreads() {
+        suspended = true;
+        return true;
+    }
+
+    // Causes any suspended threadgroups to be resumed.
+    /** @deprecated */
+    @Deprecated
+    public static void unsuspendThreads() {
+        suspended = false;
+    }
+
+    // Causes threadgroups no longer marked suspendable to be resumed.
+    /** @deprecated */
+    @Deprecated
+    public static void unsuspendSomeThreads() {
+    }
+
+    /* Deprecated fields and methods -- Memory advice not supported in 1.2 */
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_GREEN = 1;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_YELLOW = 2;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int STATE_RED = 3;
+
+    /** @deprecated */
+    @Deprecated
+    public static final int getState() {
+        return STATE_GREEN;
+    }
+
+    /** @deprecated */
+    @Deprecated
+    public static void registerVMNotification(VMNotification n) { }
+
+    /** @deprecated */
+    @Deprecated
+    public static void asChange(int as_old, int as_new) { }
+
+    /** @deprecated */
+    @Deprecated
+    public static void asChange_otherthread(int as_old, int as_new) { }
+
+    /*
+     * Not supported in 1.2 because these will have to be exported as
+     * JVM functions, and we are not sure we want do that. Leaving
+     * here so it can be easily resurrected -- just remove the //
+     * comments.
+     */
+
+    /**
+     * Resume Java profiling.  All profiling data is added to any
+     * earlier profiling, unless <code>resetJavaProfiler</code> is
+     * called in between.  If profiling was not started from the
+     * command line, <code>resumeJavaProfiler</code> will start it.
+     * <p>
+     *
+     * NOTE: Profiling must be enabled from the command line for a
+     * java.prof report to be automatically generated on exit; if not,
+     * writeJavaProfilerReport must be invoked to write a report.
+     *
+     * @see     resetJavaProfiler
+     * @see     writeJavaProfilerReport
+     */
+
+    // public native static void resumeJavaProfiler();
+
+    /**
+     * Suspend Java profiling.
+     */
+    // public native static void suspendJavaProfiler();
+
+    /**
+     * Initialize Java profiling.  Any accumulated profiling
+     * information is discarded.
+     */
+    // public native static void resetJavaProfiler();
+
+    /**
+     * Write the current profiling contents to the file "java.prof".
+     * If the file already exists, it will be overwritten.
+     */
+    // public native static void writeJavaProfilerReport();
+
+
+    private static volatile boolean booted = false;
+    private static final Object lock = new Object();
+
+    // Invoked by System.initializeSystemClass just before returning.
+    // Subsystems that are invoked during initialization can check this
+    // property in order to avoid doing things that should wait until the
+    // application class loader has been set up.
+    //
+    public static void booted() {
+        synchronized (lock) {
+            booted = true;
+            lock.notifyAll();
+        }
+    }
+
+    public static boolean isBooted() {
+        return booted;
+    }
+
+    // Waits until VM completes initialization
+    //
+    // This method is invoked by the Finalizer thread
+    public static void awaitBooted() throws InterruptedException {
+        synchronized (lock) {
+            while (!booted) {
+                lock.wait();
+            }
+        }
+    }
+
+    // A user-settable upper limit on the maximum amount of allocatable direct
+    // buffer memory.  This value may be changed during VM initialization if
+    // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
+    //
+    // The initial value of this field is arbitrary; during JRE initialization
+    // it will be reset to the value specified on the command line, if any,
+    // otherwise to Runtime.getRuntime().maxMemory().
+    //
+    private static long directMemory = 64 * 1024 * 1024;
+
+    // Returns the maximum amount of allocatable direct buffer memory.
+    // The directMemory variable is initialized during system initialization
+    // in the saveAndRemoveProperties method.
+    //
+    public static long maxDirectMemory() {
+        return directMemory;
+    }
+
+    // User-controllable flag that determines if direct buffers should be page
+    // aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
+    // buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
+    private static boolean pageAlignDirectMemory;
+
+    // Returns {@code true} if the direct buffers should be page aligned. This
+    // variable is initialized by saveAndRemoveProperties.
+    public static boolean isDirectMemoryPageAligned() {
+        return pageAlignDirectMemory;
+    }
+
+    /**
+     * Returns true if the given class loader is in the system domain
+     * in which all permissions are granted.
+     */
+    public static boolean isSystemDomainLoader(ClassLoader loader) {
+        return loader == null;
+    }
+
+    /**
+     * Returns the system property of the specified key saved at
+     * system initialization time.  This method should only be used
+     * for the system properties that are not changed during runtime.
+     * It accesses a private copy of the system properties so
+     * that user's locking of the system properties object will not
+     * cause the library to deadlock.
+     *
+     * Note that the saved system properties do not include
+     * the ones set by sun.misc.Version.init().
+     *
+     */
+    public static String getSavedProperty(String key) {
+        if (savedProps.isEmpty())
+            throw new IllegalStateException("Should be non-empty if initialized");
+
+        return savedProps.getProperty(key);
+    }
+
+    // TODO: the Property Management needs to be refactored and
+    // the appropriate prop keys need to be accessible to the
+    // calling classes to avoid duplication of keys.
+    private static final Properties savedProps = new Properties();
+
+    // Save a private copy of the system properties and remove
+    // the system properties that are not intended for public access.
+    //
+    // This method can only be invoked during system initialization.
+    public static void saveAndRemoveProperties(Properties props) {
+        if (booted)
+            throw new IllegalStateException("System initialization has completed");
+
+        savedProps.putAll(props);
+
+        // Set the maximum amount of direct memory.  This value is controlled
+        // by the vm option -XX:MaxDirectMemorySize=<size>.
+        // The maximum amount of allocatable direct buffer memory (in bytes)
+        // from the system property sun.nio.MaxDirectMemorySize set by the VM.
+        // The system property will be removed.
+        String s = (String)props.remove("sun.nio.MaxDirectMemorySize");
+        if (s != null) {
+            if (s.equals("-1")) {
+                // -XX:MaxDirectMemorySize not given, take default
+                directMemory = Runtime.getRuntime().maxMemory();
+            } else {
+                long l = Long.parseLong(s);
+                if (l > -1)
+                    directMemory = l;
+            }
+        }
+
+        // Check if direct buffers should be page aligned
+        s = (String)props.remove("sun.nio.PageAlignDirectMemory");
+        if ("true".equals(s))
+            pageAlignDirectMemory = true;
+
+        // Remove other private system properties
+        // used by java.lang.Integer.IntegerCache
+        props.remove("java.lang.Integer.IntegerCache.high");
+
+        // used by sun.launcher.LauncherHelper
+        props.remove("sun.java.launcher.diag");
+    }
+
+    // Initialize any miscellenous operating system settings that need to be
+    // set for the class libraries.
+    //
+    public static void initializeOSEnvironment() {
+        if (!booted) {
+            OSEnvironment.initialize();
+        }
+    }
+
+    /* Current count of objects pending for finalization */
+    private static volatile int finalRefCount;
+
+    /* Peak count of objects pending for finalization */
+    private static volatile int peakFinalRefCount;
+
+    /*
+     * Gets the number of objects pending for finalization.
+     *
+     * @return the number of objects pending for finalization.
+     */
+    public static int getFinalRefCount() {
+        return finalRefCount;
+    }
+
+    /*
+     * Gets the peak number of objects pending for finalization.
+     *
+     * @return the peak number of objects pending for finalization.
+     */
+    public static int getPeakFinalRefCount() {
+        return peakFinalRefCount;
+    }
+
+    /*
+     * Add {@code n} to the objects pending for finalization count.
+     *
+     * @param n an integer value to be added to the objects pending
+     * for finalization count
+     */
+    public static void addFinalRefCount(int n) {
+        // The caller must hold lock to synchronize the update.
+
+        finalRefCount += n;
+        if (finalRefCount > peakFinalRefCount) {
+            peakFinalRefCount = finalRefCount;
+        }
+    }
+
+    /**
+     * Returns Thread.State for the given threadStatus
+     */
+    public static Thread.State toThreadState(int threadStatus) {
+        if ((threadStatus & JVMTI_THREAD_STATE_RUNNABLE) != 0) {
+            return RUNNABLE;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) {
+            return BLOCKED;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_INDEFINITELY) != 0) {
+            return WAITING;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) != 0) {
+            return TIMED_WAITING;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_TERMINATED) != 0) {
+            return TERMINATED;
+        } else if ((threadStatus & JVMTI_THREAD_STATE_ALIVE) == 0) {
+            return NEW;
+        } else {
+            return RUNNABLE;
+        }
+    }
+
+    /* The threadStatus field is set by the VM at state transition
+     * in the hotspot implementation. Its value is set according to
+     * the JVM TI specification GetThreadState function.
+     */
+    private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
+    private static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
+    private static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
+    private static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
+    private static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
+    private static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
+
+    /*
+     * Returns the first non-null class loader up the execution stack,
+     * or null if only code from the null class loader is on the stack.
+     */
+    public static native ClassLoader latestUserDefinedLoader();
+
+    /**
+     * Returns {@code true} if we are in a set UID program.
+     */
+    public static boolean isSetUID() {
+        long uid = getuid();
+        long euid = geteuid();
+        long gid = getgid();
+        long egid = getegid();
+        return uid != euid  || gid != egid;
+    }
+
+    /**
+     * Returns the real user ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getuid();
+
+    /**
+     * Returns the effective user ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long geteuid();
+
+    /**
+     * Returns the real group ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getgid();
+
+    /**
+     * Returns the effective group ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getegid();
+
+    /**
+     * Get a nanosecond time stamp adjustment in the form of a single long.
+     *
+     * This value can be used to create an instant using
+     * {@link java.time.Instant#ofEpochSecond(long, long)
+     *  java.time.Instant.ofEpochSecond(offsetInSeconds,
+     *  getNanoTimeAdjustment(offsetInSeconds))}.
+     * <p>
+     * The value returned has the best resolution available to the JVM on
+     * the current system.
+     * This is usually down to microseconds - or tenth of microseconds -
+     * depending on the OS/Hardware and the JVM implementation.
+     *
+     * @param offsetInSeconds The offset in seconds from which the nanosecond
+     *        time stamp should be computed.
+     *
+     * @apiNote The offset should be recent enough - so that
+     *         {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
+     *         current UTC time. If the offset is too far off, {@code -1} will be
+     *         returned. As such, {@code -1} must not be considered as a valid
+     *         nano time adjustment, but as an exception value indicating
+     *         that an offset closer to the current time should be used.
+     *
+     * @return A nanosecond time stamp adjustment in the form of a single long.
+     *     If the offset is too far off the current time, this method returns -1.
+     *     In that case, the caller should call this method again, passing a
+     *     more accurate offset.
+     */
+    public static native long getNanoTimeAdjustment(long offsetInSeconds);
+
+    static {
+        initialize();
+    }
+    private static native void initialize();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/VMNotification.java	Wed Jan 06 10:01:44 2016 +0000
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.misc;
+
+/** @deprecated */
+@Deprecated
+public interface VMNotification {
+
+    // when the vm switches allocation states, we get notified
+    // (possible semantics: if the state changes while in this
+    // notification, don't recursively notify).
+    // oldState and newState may be the same if we are just releasing
+    // suspended threads.
+    void newAllocState(int oldState, int newState,
+                       boolean threadsSuspended);
+}
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Wed Jan 06 10:01:44 2016 +0000
@@ -66,6 +66,7 @@
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
+import jdk.internal.misc.VM;
 
 public enum LauncherHelper {
     INSTANCE;
@@ -86,9 +87,9 @@
     private static final String PROP_SETTINGS   = "Property 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";
-    static final boolean trace = sun.misc.VM.getSavedProperty(diagprop) != null;
+    static final boolean trace = VM.getSavedProperty(diagprop) != null;
 
     private static final String defaultBundleName =
             "sun.launcher.resources.launcher";
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Wed Jan 06 10:01:44 2016 +0000
@@ -32,6 +32,7 @@
 import sun.reflect.Reflection;
 
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 
 
 /**
--- a/jdk/src/java.base/share/classes/sun/misc/VM.java	Tue Jan 05 16:03:36 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,433 +0,0 @@
-/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import static java.lang.Thread.State.*;
-import java.util.Properties;
-
-public class VM {
-
-    /* The following methods used to be native methods that instruct
-     * the VM to selectively suspend certain threads in low-memory
-     * situations. They are inherently dangerous and not implementable
-     * on native threads. We removed them in JDK 1.2. The skeletons
-     * remain so that existing applications that use these methods
-     * will still work.
-     */
-    private static boolean suspended = false;
-
-    /** @deprecated */
-    @Deprecated
-    public static boolean threadsSuspended() {
-        return suspended;
-    }
-
-    @SuppressWarnings("deprecation")
-    public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
-        return g.allowThreadSuspension(b);
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static boolean suspendThreads() {
-        suspended = true;
-        return true;
-    }
-
-    // Causes any suspended threadgroups to be resumed.
-    /** @deprecated */
-    @Deprecated
-    public static void unsuspendThreads() {
-        suspended = false;
-    }
-
-    // Causes threadgroups no longer marked suspendable to be resumed.
-    /** @deprecated */
-    @Deprecated
-    public static void unsuspendSomeThreads() {
-    }
-
-    /* Deprecated fields and methods -- Memory advice not supported in 1.2 */
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_GREEN = 1;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_YELLOW = 2;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int STATE_RED = 3;
-
-    /** @deprecated */
-    @Deprecated
-    public static final int getState() {
-        return STATE_GREEN;
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static void registerVMNotification(VMNotification n) { }
-
-    /** @deprecated */
-    @Deprecated
-    public static void asChange(int as_old, int as_new) { }
-
-    /** @deprecated */
-    @Deprecated
-    public static void asChange_otherthread(int as_old, int as_new) { }
-
-    /*
-     * Not supported in 1.2 because these will have to be exported as
-     * JVM functions, and we are not sure we want do that. Leaving
-     * here so it can be easily resurrected -- just remove the //
-     * comments.
-     */
-
-    /**
-     * Resume Java profiling.  All profiling data is added to any
-     * earlier profiling, unless <code>resetJavaProfiler</code> is
-     * called in between.  If profiling was not started from the
-     * command line, <code>resumeJavaProfiler</code> will start it.
-     * <p>
-     *
-     * NOTE: Profiling must be enabled from the command line for a
-     * java.prof report to be automatically generated on exit; if not,
-     * writeJavaProfilerReport must be invoked to write a report.
-     *
-     * @see     resetJavaProfiler
-     * @see     writeJavaProfilerReport
-     */
-
-    // public native static void resumeJavaProfiler();
-
-    /**
-     * Suspend Java profiling.
-     */
-    // public native static void suspendJavaProfiler();
-
-    /**
-     * Initialize Java profiling.  Any accumulated profiling
-     * information is discarded.
-     */
-    // public native static void resetJavaProfiler();
-
-    /**
-     * Write the current profiling contents to the file "java.prof".
-     * If the file already exists, it will be overwritten.
-     */
-    // public native static void writeJavaProfilerReport();
-
-
-    private static volatile boolean booted = false;
-    private static final Object lock = new Object();
-
-    // Invoked by System.initializeSystemClass just before returning.
-    // Subsystems that are invoked during initialization can check this
-    // property in order to avoid doing things that should wait until the
-    // application class loader has been set up.
-    //
-    public static void booted() {
-        synchronized (lock) {
-            booted = true;
-            lock.notifyAll();
-        }
-    }
-
-    public static boolean isBooted() {
-        return booted;
-    }
-
-    // Waits until VM completes initialization
-    //
-    // This method is invoked by the Finalizer thread
-    public static void awaitBooted() throws InterruptedException {
-        synchronized (lock) {
-            while (!booted) {
-                lock.wait();
-            }
-        }
-    }
-
-    // A user-settable upper limit on the maximum amount of allocatable direct
-    // buffer memory.  This value may be changed during VM initialization if
-    // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
-    //
-    // The initial value of this field is arbitrary; during JRE initialization
-    // it will be reset to the value specified on the command line, if any,
-    // otherwise to Runtime.getRuntime().maxMemory().
-    //
-    private static long directMemory = 64 * 1024 * 1024;
-
-    // Returns the maximum amount of allocatable direct buffer memory.
-    // The directMemory variable is initialized during system initialization
-    // in the saveAndRemoveProperties method.
-    //
-    public static long maxDirectMemory() {
-        return directMemory;
-    }
-
-    // User-controllable flag that determines if direct buffers should be page
-    // aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
-    // buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
-    private static boolean pageAlignDirectMemory;
-
-    // Returns {@code true} if the direct buffers should be page aligned. This
-    // variable is initialized by saveAndRemoveProperties.
-    public static boolean isDirectMemoryPageAligned() {
-        return pageAlignDirectMemory;
-    }
-
-    /**
-     * Returns true if the given class loader is in the system domain
-     * in which all permissions are granted.
-     */
-    public static boolean isSystemDomainLoader(ClassLoader loader) {
-        return loader == null;
-    }
-
-    /**
-     * Returns the system property of the specified key saved at
-     * system initialization time.  This method should only be used
-     * for the system properties that are not changed during runtime.
-     * It accesses a private copy of the system properties so
-     * that user's locking of the system properties object will not
-     * cause the library to deadlock.
-     *
-     * Note that the saved system properties do not include
-     * the ones set by sun.misc.Version.init().
-     *
-     */
-    public static String getSavedProperty(String key) {
-        if (savedProps.isEmpty())
-            throw new IllegalStateException("Should be non-empty if initialized");
-
-        return savedProps.getProperty(key);
-    }
-
-    // TODO: the Property Management needs to be refactored and
-    // the appropriate prop keys need to be accessible to the
-    // calling classes to avoid duplication of keys.
-    private static final Properties savedProps = new Properties();
-
-    // Save a private copy of the system properties and remove
-    // the system properties that are not intended for public access.
-    //
-    // This method can only be invoked during system initialization.
-    public static void saveAndRemoveProperties(Properties props) {
-        if (booted)
-            throw new IllegalStateException("System initialization has completed");
-
-        savedProps.putAll(props);
-
-        // Set the maximum amount of direct memory.  This value is controlled
-        // by the vm option -XX:MaxDirectMemorySize=<size>.
-        // The maximum amount of allocatable direct buffer memory (in bytes)
-        // from the system property sun.nio.MaxDirectMemorySize set by the VM.
-        // The system property will be removed.
-        String s = (String)props.remove("sun.nio.MaxDirectMemorySize");
-        if (s != null) {
-            if (s.equals("-1")) {
-                // -XX:MaxDirectMemorySize not given, take default
-                directMemory = Runtime.getRuntime().maxMemory();
-            } else {
-                long l = Long.parseLong(s);
-                if (l > -1)
-                    directMemory = l;
-            }
-        }
-
-        // Check if direct buffers should be page aligned
-        s = (String)props.remove("sun.nio.PageAlignDirectMemory");
-        if ("true".equals(s))
-            pageAlignDirectMemory = true;
-
-        // Remove other private system properties
-        // used by java.lang.Integer.IntegerCache
-        props.remove("java.lang.Integer.IntegerCache.high");
-
-        // used by sun.launcher.LauncherHelper
-        props.remove("sun.java.launcher.diag");
-    }
-
-    // Initialize any miscellenous operating system settings that need to be
-    // set for the class libraries.
-    //
-    public static void initializeOSEnvironment() {
-        if (!booted) {
-            OSEnvironment.initialize();
-        }
-    }
-
-    /* Current count of objects pending for finalization */
-    private static volatile int finalRefCount;
-
-    /* Peak count of objects pending for finalization */
-    private static volatile int peakFinalRefCount;
-
-    /*
-     * Gets the number of objects pending for finalization.
-     *
-     * @return the number of objects pending for finalization.
-     */
-    public static int getFinalRefCount() {
-        return finalRefCount;
-    }
-
-    /*
-     * Gets the peak number of objects pending for finalization.
-     *
-     * @return the peak number of objects pending for finalization.
-     */
-    public static int getPeakFinalRefCount() {
-        return peakFinalRefCount;
-    }
-
-    /*
-     * Add {@code n} to the objects pending for finalization count.
-     *
-     * @param n an integer value to be added to the objects pending
-     * for finalization count
-     */
-    public static void addFinalRefCount(int n) {
-        // The caller must hold lock to synchronize the update.
-
-        finalRefCount += n;
-        if (finalRefCount > peakFinalRefCount) {
-            peakFinalRefCount = finalRefCount;
-        }
-    }
-
-    /**
-     * Returns Thread.State for the given threadStatus
-     */
-    public static Thread.State toThreadState(int threadStatus) {
-        if ((threadStatus & JVMTI_THREAD_STATE_RUNNABLE) != 0) {
-            return RUNNABLE;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) {
-            return BLOCKED;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_INDEFINITELY) != 0) {
-            return WAITING;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) != 0) {
-            return TIMED_WAITING;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_TERMINATED) != 0) {
-            return TERMINATED;
-        } else if ((threadStatus & JVMTI_THREAD_STATE_ALIVE) == 0) {
-            return NEW;
-        } else {
-            return RUNNABLE;
-        }
-    }
-
-    /* The threadStatus field is set by the VM at state transition
-     * in the hotspot implementation. Its value is set according to
-     * the JVM TI specification GetThreadState function.
-     */
-    private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
-    private static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
-    private static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
-    private static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
-    private static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
-    private static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
-
-    /*
-     * Returns the first non-null class loader up the execution stack,
-     * or null if only code from the null class loader is on the stack.
-     */
-    public static native ClassLoader latestUserDefinedLoader();
-
-    /**
-     * Returns {@code true} if we are in a set UID program.
-     */
-    public static boolean isSetUID() {
-        long uid = getuid();
-        long euid = geteuid();
-        long gid = getgid();
-        long egid = getegid();
-        return uid != euid  || gid != egid;
-    }
-
-    /**
-     * Returns the real user ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getuid();
-
-    /**
-     * Returns the effective user ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long geteuid();
-
-    /**
-     * Returns the real group ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getgid();
-
-    /**
-     * Returns the effective group ID of the calling process,
-     * or -1 if the value is not available.
-     */
-    public static native long getegid();
-
-    /**
-     * Get a nanosecond time stamp adjustment in the form of a single long.
-     *
-     * This value can be used to create an instant using
-     * {@link java.time.Instant#ofEpochSecond(long, long)
-     *  java.time.Instant.ofEpochSecond(offsetInSeconds,
-     *  getNanoTimeAdjustment(offsetInSeconds))}.
-     * <p>
-     * The value returned has the best resolution available to the JVM on
-     * the current system.
-     * This is usually down to microseconds - or tenth of microseconds -
-     * depending on the OS/Hardware and the JVM implementation.
-     *
-     * @param offsetInSeconds The offset in seconds from which the nanosecond
-     *        time stamp should be computed.
-     *
-     * @apiNote The offset should be recent enough - so that
-     *         {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
-     *         current UTC time. If the offset is too far off, {@code -1} will be
-     *         returned. As such, {@code -1} must not be considered as a valid
-     *         nano time adjustment, but as an exception value indicating
-     *         that an offset closer to the current time should be used.
-     *
-     * @return A nanosecond time stamp adjustment in the form of a single long.
-     *     If the offset is too far off the current time, this method returns -1.
-     *     In that case, the caller should call this method again, passing a
-     *     more accurate offset.
-     */
-    public static native long getNanoTimeAdjustment(long offsetInSeconds);
-
-    static {
-        initialize();
-    }
-    private static native void initialize();
-}
--- a/jdk/src/java.base/share/classes/sun/misc/VMNotification.java	Tue Jan 05 16:03:36 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-/** @deprecated */
-@Deprecated
-public interface VMNotification {
-
-    // when the vm switches allocation states, we get notified
-    // (possible semantics: if the state changes while in this
-    // notification, don't recursively notify).
-    // oldState and newState may be the same if we are just releasing
-    // suspended threads.
-    void newAllocState(int oldState, int newState,
-                       boolean threadsSuspended);
-}
--- a/jdk/src/java.base/share/classes/sun/nio/ch/Util.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/Util.java	Wed Jan 06 10:01:44 2016 +0000
@@ -389,7 +389,7 @@
 
     static boolean atBugLevel(String bl) {              // package-private
         if (bugLevel == null) {
-            if (!sun.misc.VM.isBooted())
+            if (!jdk.internal.misc.VM.isBooted())
                 return false;
             String value = AccessController.doPrivileged(
                 new GetPropertyAction("sun.nio.ch.bugLevel"));
--- a/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template	Wed Jan 06 10:01:44 2016 +0000
@@ -156,12 +156,12 @@
 
     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() {
         if (initialized)
             return;
-        if (!sun.misc.VM.isBooted())
+        if (!jdk.internal.misc.VM.isBooted())
             return;
         initialized = true;
 
--- a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/reflect/Reflection.java	Wed Jan 06 10:01:44 2016 +0000
@@ -29,6 +29,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
 
 /** Common utility routines used by both java.lang and
     java.lang.reflect */
@@ -335,7 +336,7 @@
      */
     public static boolean isCallerSensitive(Method m) {
         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 false;
--- a/jdk/src/java.base/share/native/libjava/VM.c	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/share/native/libjava/VM.c	Wed Jan 06 10:01:44 2016 +0000
@@ -28,7 +28,7 @@
 #include "jvm.h"
 #include "jdk_util.h"
 
-#include "sun_misc_VM.h"
+#include "jdk_internal_misc_VM.h"
 
 /* Only register the performance-critical methods */
 static JNINativeMethod methods[] = {
@@ -36,12 +36,12 @@
 };
 
 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);
 }
 
 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()) {
         JNU_ThrowInternalError(env, "Handle for JVM not found for symbol lookup");
         return;
@@ -50,8 +50,8 @@
     // Registers implementations of native methods described in methods[]
     // above.
     // In particular, registers JVM_GetNanoTimeAdjustment as the implementation
-    // of the native sun.misc.VM.getNanoTimeAdjustment - avoiding the cost of
-    // introducing a Java_sun_misc_VM_getNanoTimeAdjustment  wrapper
+    // of the native VM.getNanoTimeAdjustment - avoiding the cost of
+    // introducing a Java_jdk_internal_misc_VM_getNanoTimeAdjustment wrapper
     (*env)->RegisterNatives(env, cls,
                             methods, sizeof(methods)/sizeof(methods[0]));
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/unix/classes/jdk/internal/misc/OSEnvironment.java	Wed Jan 06 10:01:44 2016 +0000
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.misc;
+
+public class OSEnvironment {
+
+    /*
+     * Initialize any miscellaneous operating system settings that need to be set
+     * for the class libraries.
+     */
+    public static void initialize() {
+        // no-op on Solaris and Linux
+    }
+
+}
--- a/jdk/src/java.base/unix/classes/sun/misc/OSEnvironment.java	Tue Jan 05 16:03:36 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-public class OSEnvironment {
-
-    /*
-     * Initialize any miscellenous operating system settings that need to be set
-     * for the class libraries.
-     */
-    public static void initialize() {
-        // no-op on Solaris and Linux
-    }
-
-}
--- a/jdk/src/java.base/unix/native/libjava/VM_md.c	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/unix/native/libjava/VM_md.c	Wed Jan 06 10:01:44 2016 +0000
@@ -28,25 +28,25 @@
 
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
 
     return getuid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
 
     return geteuid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
 
     return getgid();
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+Java_jdk_internal_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
 
     return getegid();
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/windows/classes/jdk/internal/misc/OSEnvironment.java	Wed Jan 06 10:01:44 2016 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.misc;
+
+import sun.io.Win32ErrorMode;
+
+public class OSEnvironment {
+
+    /*
+     * Initialize any miscellaneous operating system settings that need to be set
+     * for the class libraries.
+     * <p>
+     * At this time only the process-wide error mode needs to be set.
+     */
+    public static void initialize() {
+        Win32ErrorMode.initialize();
+    }
+
+}
--- a/jdk/src/java.base/windows/classes/sun/io/Win32ErrorMode.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/windows/classes/sun/io/Win32ErrorMode.java	Wed Jan 06 10:01:44 2016 +0000
@@ -66,7 +66,7 @@
      * has completed.
      */
     public static void initialize() {
-        if (!sun.misc.VM.isBooted()) {
+        if (!jdk.internal.misc.VM.isBooted()) {
             String s = System.getProperty("sun.io.allowCriticalErrorMessageBox");
             if (s == null || s.equals(Boolean.FALSE.toString())) {
                 long mode = setErrorMode(0);
--- a/jdk/src/java.base/windows/classes/sun/misc/OSEnvironment.java	Tue Jan 05 16:03:36 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import sun.io.Win32ErrorMode;
-
-public class OSEnvironment {
-
-    /*
-     * Initialize any miscellenous operating system settings that need to be set
-     * for the class libraries.
-     * <p>
-     * At this time only the process-wide error mode needs to be set.
-     */
-    public static void initialize() {
-        Win32ErrorMode.initialize();
-    }
-
-}
--- a/jdk/src/java.base/windows/native/libjava/VM_md.c	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.base/windows/native/libjava/VM_md.c	Wed Jan 06 10:01:44 2016 +0000
@@ -27,28 +27,28 @@
 
 
 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. */
     return -1;
 }
 
 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. */
     return -1;
 }
 
 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. */
     return -1;
 }
 
 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. */
     return -1;
--- a/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java	Wed Jan 06 10:01:44 2016 +0000
@@ -639,7 +639,7 @@
                     continue;
                 } else if (ch2 == 'h') {
                     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
                         // we disallow attempts to open files relative to %h.
                         throw new IOException("can't use %h in set UID program");
--- a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java	Wed Jan 06 10:01:44 2016 +0000
@@ -583,7 +583,7 @@
         ClassLoader loader =
             AccessController.doPrivileged(
                 (PrivilegedAction<ClassLoader>) () -> cls.getClassLoader());
-        if (!sun.misc.VM.isSystemDomainLoader(loader)) {
+        if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
             throw new IllegalArgumentException(mxbeanName +
                 " is not a platform MXBean");
         }
--- a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java	Wed Jan 06 10:01:44 2016 +0000
@@ -473,7 +473,7 @@
     public static Thread.State toThreadState(int state) {
         // suspended and native bits may be set in state
         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
--- a/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/MemoryImpl.java	Wed Jan 06 10:01:44 2016 +0000
@@ -59,7 +59,7 @@
     }
 
     public int getObjectPendingFinalizationCount() {
-        return sun.misc.VM.getFinalRefCount();
+        return jdk.internal.misc.VM.getFinalRefCount();
     }
 
     public void gc() {
--- a/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalInputStream.java	Wed Jan 06 10:01:44 2016 +0000
@@ -262,7 +262,7 @@
      * if only code from the null class loader is on the stack.
      */
     private static ClassLoader latestUserDefinedLoader() {
-        return sun.misc.VM.latestUserDefinedLoader();
+        return jdk.internal.misc.VM.latestUserDefinedLoader();
     }
 
     /**
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Wed Jan 06 10:01:44 2016 +0000
@@ -397,7 +397,7 @@
          */
 
         if (osname != null && !osname.startsWith("Windows")) {
-            long uid = sun.misc.VM.getuid();
+            long uid = jdk.internal.misc.VM.getuid();
             if (uid != -1) {
                 name = File.separator + "tmp" +
                         File.separator + stdCacheNameComponent + "_" + uid;
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Wed Jan 06 10:01:44 2016 +0000
@@ -60,7 +60,7 @@
  *
  *    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:
  *
@@ -107,7 +107,7 @@
     private static long uid;
     static {
         // 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) {
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template	Wed Jan 06 10:01:44 2016 +0000
@@ -97,7 +97,7 @@
     protected void init() {
         if (initialized)
             return;
-        if (!sun.misc.VM.isBooted())
+        if (!jdk.internal.misc.VM.isBooted())
             return;
 
         String map = getProperty("sun.nio.cs.map");
--- a/jdk/test/java/lang/management/MemoryMXBean/Pending.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/Pending.java	Wed Jan 06 10:01:44 2016 +0000
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug     4530538
- * @modules java.base/sun.misc
+ * @modules java.base/jdk.internal.misc
  *          java.management
  * @summary Basic unit test of
  *          RuntimeMXBean.getObjectPendingFinalizationCount()
@@ -50,10 +50,10 @@
     private static void printFinalizerInstanceCount() {
         if (!trace) return;
 
-        int count = sun.misc.VM.getFinalRefCount();
+        int count = jdk.internal.misc.VM.getFinalRefCount();
         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);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/misc/VM/GetNanoTimeAdjustment.java	Wed Jan 06 10:01:44 2016 +0000
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Objects;
+import jdk.internal.misc.VM;
+
+/**
+ * @test
+ * @bug 8068730
+ * @summary tests that VM.getgetNanoTimeAdjustment() works as expected.
+ * @modules java.base/jdk.internal.misc
+ * @run main GetNanoTimeAdjustment
+ * @author danielfuchs
+ */
+public class GetNanoTimeAdjustment {
+
+    static final int MILLIS_IN_SECOND = 1000;
+    static final int NANOS_IN_MILLI = 1000_000;
+    static final int NANOS_IN_MICRO = 1000;
+    static final int NANOS_IN_SECOND = 1000_000_000;
+
+    static final boolean verbose = true;
+
+    static final class TestAssertException extends RuntimeException {
+        TestAssertException(String msg) { super(msg); }
+    }
+
+    private static void assertEquals(long expected, long received, String msg) {
+        if (expected != received) {
+            throw new TestAssertException("Unexpected result for " + msg
+                    + ".\n\texpected: " + expected
+                    +  "\n\tactual:   " + received);
+        } else if (verbose) {
+            System.out.println("Got expected " + msg + ": " + received);
+        }
+    }
+
+    private static void assertEquals(Object expected, Object received, String msg) {
+        if (!Objects.equals(expected, received)) {
+            throw new TestAssertException("Unexpected result for " + msg
+                    + ".\n\texpected: " + expected
+                    +  "\n\tactual:   " + received);
+        } else if (verbose) {
+            System.out.println("Got expected " + msg + ": " + received);
+        }
+    }
+
+    static final long MAX_OFFSET = 0x0100000000L;
+    static final long MIN_OFFSET = -MAX_OFFSET;
+    static enum Answer {
+        YES,   // isOffLimit = YES:   we must get -1
+        NO,    // isOffLimit = NO:    we must not not get -1
+        MAYBE  // isOffLimit = MAYBE: we might get -1 or a valid adjustment.
+    };
+    static long distance(long one, long two) {
+        return one > two ? Math.subtractExact(one, two)
+                : Math.subtractExact(two, one);
+    }
+
+
+    static Answer isOffLimits(long before, long after, long offset) {
+        long relativeDistanceBefore = distance(before, offset);
+        long relativeDistanceAfter  = distance(after, offset);
+        if (relativeDistanceBefore >= MAX_OFFSET && relativeDistanceAfter >= MAX_OFFSET) {
+            return Answer.YES;
+        }
+        if (relativeDistanceBefore < MAX_OFFSET && relativeDistanceAfter < MAX_OFFSET) {
+            if (relativeDistanceBefore == 0 || relativeDistanceAfter == 0) {
+                return Answer.MAYBE; // unlucky case where
+            }
+            return Answer.NO;
+        }
+        return Answer.MAYBE;
+    }
+
+    static void testWithOffset(String name, long offset) {
+        System.out.println("Testing with offset: " + name);
+        long beforeMillis = System.currentTimeMillis();
+        long adjustment = VM.getNanoTimeAdjustment(offset);
+        long afterMillis = System.currentTimeMillis();
+
+        if (offset >= beforeMillis/MILLIS_IN_SECOND
+                && offset <= afterMillis/MILLIS_IN_SECOND) {
+            if (adjustment == -1) {
+                // it's possible that we have fallen in the unlucky case
+                // where -1 was the genuine result. let's go backward a bit.
+                offset = offset - 10;
+                beforeMillis = System.currentTimeMillis();
+                adjustment = VM.getNanoTimeAdjustment(offset);
+                afterMillis = System.currentTimeMillis();
+                if (adjustment == -1) {
+                    throw new RuntimeException(name + ": VM says " + offset
+                            + " secs is too far off, "
+                            + " when time in seconds is in ["
+                            + beforeMillis/MILLIS_IN_SECOND + ", "
+                            + afterMillis/MILLIS_IN_SECOND
+                            + "]");
+                }
+            }
+        }
+
+        Answer isOffLimit = isOffLimits(beforeMillis/MILLIS_IN_SECOND,
+                afterMillis/MILLIS_IN_SECOND, offset);
+        switch (isOffLimit) {
+            case YES:
+                if (adjustment != -1) {
+                    throw new RuntimeException(name
+                        + ": VM should have returned -1 for "
+                        + offset
+                        + " when time in seconds is in ["
+                        + beforeMillis/MILLIS_IN_SECOND + ", "
+                        + afterMillis/MILLIS_IN_SECOND + "]");
+                }
+                System.out.println("Got expected exception value: " + adjustment);
+                break;
+            case NO:
+                if (adjustment == -1) {
+                    throw new RuntimeException(name
+                            + "VM says "  + offset
+                            + " secs is too far off, "
+                            + " when time in seconds is in ["
+                            + beforeMillis/MILLIS_IN_SECOND + ", "
+                            + afterMillis/MILLIS_IN_SECOND
+                            + "]");
+                }
+                break;
+            case MAYBE:
+                System.out.println("Adjustment: " + adjustment);
+                System.out.println("Can't assert for -1 with offset "
+                        + offset + "(" + name + ")"
+                        + " when time in seconds is in ["
+                        + beforeMillis/MILLIS_IN_SECOND + ", "
+                        + afterMillis/MILLIS_IN_SECOND
+                        + "]");
+                // not conclusive
+        }
+
+        if (isOffLimit == Answer.NO || adjustment != -1) {
+            System.out.println("Validating adjustment: " + adjustment);
+            long expectedMax = distance(offset, beforeMillis/MILLIS_IN_SECOND)
+                      * NANOS_IN_SECOND
+                    + (beforeMillis % MILLIS_IN_SECOND) * NANOS_IN_MILLI
+                    + (afterMillis - beforeMillis + 1) * NANOS_IN_MILLI;
+            long absoluteAdjustment = distance(0, adjustment);
+            if (absoluteAdjustment > expectedMax) {
+                long adjSec = absoluteAdjustment / NANOS_IN_SECOND;
+                long adjMil = (absoluteAdjustment % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+                long adjMic = (absoluteAdjustment % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+                long adjNan = (absoluteAdjustment % NANOS_IN_MICRO);
+                long expSec = expectedMax / NANOS_IN_SECOND;
+                long expMil = (expectedMax % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+                long expMic = (expectedMax % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+                long expNan = (expectedMax % NANOS_IN_MICRO);
+                System.err.println("Excessive adjustment: " + adjSec + "s, "
+                        + adjMil + "ms, " + adjMic + "mics, " + adjNan + "ns");
+                System.err.println("Epected max: " + expSec + "s, "
+                        + expMil + "ms, " + expMic + "mics, " + expNan + "ns");
+
+                throw new RuntimeException(name
+                    + ": Excessive adjustment: " + adjustment
+                    + " when time in millis is in ["
+                    + beforeMillis + ", " + afterMillis
+                    + "] and offset in seconds is " + offset);
+            }
+        }
+
+    }
+
+    static void regular() {
+        System.out.println("*** Testing regular cases ***");
+        final long start = System.currentTimeMillis();
+        long offset = start/1000;
+        long adjustment = VM.getNanoTimeAdjustment(offset);
+        if (start != offset*1000) {
+            if (adjustment == -1) {
+                throw new RuntimeException("VM says " + offset
+                        + " secs is too far off, but time millis is "
+                        + System.currentTimeMillis());
+            }
+        }
+        if (adjustment == -1) {
+            offset = System.currentTimeMillis()/1000 - 1024;
+            adjustment = VM.getNanoTimeAdjustment(offset);
+            if (adjustment == -1) {
+                throw new RuntimeException("VM says " + offset
+                        + " secs is too far off, but time millis is "
+                        + System.currentTimeMillis());
+            }
+        }
+        if (adjustment > (start/1000 - offset + 20)*NANOS_IN_SECOND) {
+            throw new RuntimeException("Excessive adjustment: " + adjustment);
+        }
+        testWithOffset("System.currentTimeMillis()/1000",
+                System.currentTimeMillis()/1000);
+        testWithOffset("System.currentTimeMillis()/1000 - 1024",
+                System.currentTimeMillis()/1000 - 1024);
+        testWithOffset("System.currentTimeMillis()/1000 + 1024",
+                System.currentTimeMillis()/1000 + 1024);
+    }
+
+    static void testLimits() {
+        System.out.println("*** Testing limits ***");
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET + 1",
+                System.currentTimeMillis()/1000 - MAX_OFFSET + 1);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET - 1",
+                System.currentTimeMillis()/1000 + MAX_OFFSET - 1);
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET",
+                System.currentTimeMillis()/1000 - MAX_OFFSET);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET",
+                System.currentTimeMillis()/1000 + MAX_OFFSET);
+        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET - 1024",
+                System.currentTimeMillis()/1000 - MAX_OFFSET - 1024);
+        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET + 1024",
+                System.currentTimeMillis()/1000 + MAX_OFFSET + 1024);
+        testWithOffset("0", 0);
+        testWithOffset("-1", -1);
+        testWithOffset("Integer.MAX_VALUE + System.currentTimeMillis()/1000",
+                ((long)Integer.MAX_VALUE) + System.currentTimeMillis()/1000);
+        testWithOffset("System.currentTimeMillis()/1000 - Integer.MIN_VALUE",
+                System.currentTimeMillis()/1000 - Integer.MIN_VALUE);
+        testWithOffset("Long.MAX_VALUE", Long.MAX_VALUE);
+        testWithOffset("System.currentTimeMillis()/1000 - Long.MIN_VALUE",
+                (Long.MIN_VALUE + System.currentTimeMillis()/1000)*-1);
+    }
+
+    public static void main(String[] args) throws Exception {
+        regular();
+        testLimits();
+    }
+
+}
--- a/jdk/test/sun/misc/VM/GetNanoTimeAdjustment.java	Tue Jan 05 16:03:36 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-import java.util.Objects;
-import sun.misc.VM;
-
-/**
- * @test
- * @bug 8068730
- * @summary tests that VM.getgetNanoTimeAdjustment() works as expected.
- * @modules java.base/sun.misc
- * @run main GetNanoTimeAdjustment
- * @author danielfuchs
- */
-public class GetNanoTimeAdjustment {
-
-    static final int MILLIS_IN_SECOND = 1000;
-    static final int NANOS_IN_MILLI = 1000_000;
-    static final int NANOS_IN_MICRO = 1000;
-    static final int NANOS_IN_SECOND = 1000_000_000;
-
-    static final boolean verbose = true;
-
-    static final class TestAssertException extends RuntimeException {
-        TestAssertException(String msg) { super(msg); }
-    }
-
-    private static void assertEquals(long expected, long received, String msg) {
-        if (expected != received) {
-            throw new TestAssertException("Unexpected result for " + msg
-                    + ".\n\texpected: " + expected
-                    +  "\n\tactual:   " + received);
-        } else if (verbose) {
-            System.out.println("Got expected " + msg + ": " + received);
-        }
-    }
-
-    private static void assertEquals(Object expected, Object received, String msg) {
-        if (!Objects.equals(expected, received)) {
-            throw new TestAssertException("Unexpected result for " + msg
-                    + ".\n\texpected: " + expected
-                    +  "\n\tactual:   " + received);
-        } else if (verbose) {
-            System.out.println("Got expected " + msg + ": " + received);
-        }
-    }
-
-    static final long MAX_OFFSET = 0x0100000000L;
-    static final long MIN_OFFSET = -MAX_OFFSET;
-    static enum Answer {
-        YES,   // isOffLimit = YES:   we must get -1
-        NO,    // isOffLimit = NO:    we must not not get -1
-        MAYBE  // isOffLimit = MAYBE: we might get -1 or a valid adjustment.
-    };
-    static long distance(long one, long two) {
-        return one > two ? Math.subtractExact(one, two)
-                : Math.subtractExact(two, one);
-    }
-
-
-    static Answer isOffLimits(long before, long after, long offset) {
-        long relativeDistanceBefore = distance(before, offset);
-        long relativeDistanceAfter  = distance(after, offset);
-        if (relativeDistanceBefore >= MAX_OFFSET && relativeDistanceAfter >= MAX_OFFSET) {
-            return Answer.YES;
-        }
-        if (relativeDistanceBefore < MAX_OFFSET && relativeDistanceAfter < MAX_OFFSET) {
-            if (relativeDistanceBefore == 0 || relativeDistanceAfter == 0) {
-                return Answer.MAYBE; // unlucky case where
-            }
-            return Answer.NO;
-        }
-        return Answer.MAYBE;
-    }
-
-    static void testWithOffset(String name, long offset) {
-        System.out.println("Testing with offset: " + name);
-        long beforeMillis = System.currentTimeMillis();
-        long adjustment = VM.getNanoTimeAdjustment(offset);
-        long afterMillis = System.currentTimeMillis();
-
-        if (offset >= beforeMillis/MILLIS_IN_SECOND
-                && offset <= afterMillis/MILLIS_IN_SECOND) {
-            if (adjustment == -1) {
-                // it's possible that we have fallen in the unlucky case
-                // where -1 was the genuine result. let's go backward a bit.
-                offset = offset - 10;
-                beforeMillis = System.currentTimeMillis();
-                adjustment = VM.getNanoTimeAdjustment(offset);
-                afterMillis = System.currentTimeMillis();
-                if (adjustment == -1) {
-                    throw new RuntimeException(name + ": VM says " + offset
-                            + " secs is too far off, "
-                            + " when time in seconds is in ["
-                            + beforeMillis/MILLIS_IN_SECOND + ", "
-                            + afterMillis/MILLIS_IN_SECOND
-                            + "]");
-                }
-            }
-        }
-
-        Answer isOffLimit = isOffLimits(beforeMillis/MILLIS_IN_SECOND,
-                afterMillis/MILLIS_IN_SECOND, offset);
-        switch (isOffLimit) {
-            case YES:
-                if (adjustment != -1) {
-                    throw new RuntimeException(name
-                        + ": VM should have returned -1 for "
-                        + offset
-                        + " when time in seconds is in ["
-                        + beforeMillis/MILLIS_IN_SECOND + ", "
-                        + afterMillis/MILLIS_IN_SECOND + "]");
-                }
-                System.out.println("Got expected exception value: " + adjustment);
-                break;
-            case NO:
-                if (adjustment == -1) {
-                    throw new RuntimeException(name
-                            + "VM says "  + offset
-                            + " secs is too far off, "
-                            + " when time in seconds is in ["
-                            + beforeMillis/MILLIS_IN_SECOND + ", "
-                            + afterMillis/MILLIS_IN_SECOND
-                            + "]");
-                }
-                break;
-            case MAYBE:
-                System.out.println("Adjustment: " + adjustment);
-                System.out.println("Can't assert for -1 with offset "
-                        + offset + "(" + name + ")"
-                        + " when time in seconds is in ["
-                        + beforeMillis/MILLIS_IN_SECOND + ", "
-                        + afterMillis/MILLIS_IN_SECOND
-                        + "]");
-                // not conclusive
-        }
-
-        if (isOffLimit == Answer.NO || adjustment != -1) {
-            System.out.println("Validating adjustment: " + adjustment);
-            long expectedMax = distance(offset, beforeMillis/MILLIS_IN_SECOND)
-                      * NANOS_IN_SECOND
-                    + (beforeMillis % MILLIS_IN_SECOND) * NANOS_IN_MILLI
-                    + (afterMillis - beforeMillis + 1) * NANOS_IN_MILLI;
-            long absoluteAdjustment = distance(0, adjustment);
-            if (absoluteAdjustment > expectedMax) {
-                long adjSec = absoluteAdjustment / NANOS_IN_SECOND;
-                long adjMil = (absoluteAdjustment % NANOS_IN_SECOND) / NANOS_IN_MILLI;
-                long adjMic = (absoluteAdjustment % NANOS_IN_MILLI) / NANOS_IN_MICRO;
-                long adjNan = (absoluteAdjustment % NANOS_IN_MICRO);
-                long expSec = expectedMax / NANOS_IN_SECOND;
-                long expMil = (expectedMax % NANOS_IN_SECOND) / NANOS_IN_MILLI;
-                long expMic = (expectedMax % NANOS_IN_MILLI) / NANOS_IN_MICRO;
-                long expNan = (expectedMax % NANOS_IN_MICRO);
-                System.err.println("Excessive adjustment: " + adjSec + "s, "
-                        + adjMil + "ms, " + adjMic + "mics, " + adjNan + "ns");
-                System.err.println("Epected max: " + expSec + "s, "
-                        + expMil + "ms, " + expMic + "mics, " + expNan + "ns");
-
-                throw new RuntimeException(name
-                    + ": Excessive adjustment: " + adjustment
-                    + " when time in millis is in ["
-                    + beforeMillis + ", " + afterMillis
-                    + "] and offset in seconds is " + offset);
-            }
-        }
-
-    }
-
-    static void regular() {
-        System.out.println("*** Testing regular cases ***");
-        final long start = System.currentTimeMillis();
-        long offset = start/1000;
-        long adjustment = VM.getNanoTimeAdjustment(offset);
-        if (start != offset*1000) {
-            if (adjustment == -1) {
-                throw new RuntimeException("VM says " + offset
-                        + " secs is too far off, but time millis is "
-                        + System.currentTimeMillis());
-            }
-        }
-        if (adjustment == -1) {
-            offset = System.currentTimeMillis()/1000 - 1024;
-            adjustment = VM.getNanoTimeAdjustment(offset);
-            if (adjustment == -1) {
-                throw new RuntimeException("VM says " + offset
-                        + " secs is too far off, but time millis is "
-                        + System.currentTimeMillis());
-            }
-        }
-        if (adjustment > (start/1000 - offset + 20)*NANOS_IN_SECOND) {
-            throw new RuntimeException("Excessive adjustment: " + adjustment);
-        }
-        testWithOffset("System.currentTimeMillis()/1000",
-                System.currentTimeMillis()/1000);
-        testWithOffset("System.currentTimeMillis()/1000 - 1024",
-                System.currentTimeMillis()/1000 - 1024);
-        testWithOffset("System.currentTimeMillis()/1000 + 1024",
-                System.currentTimeMillis()/1000 + 1024);
-    }
-
-    static void testLimits() {
-        System.out.println("*** Testing limits ***");
-        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET + 1",
-                System.currentTimeMillis()/1000 - MAX_OFFSET + 1);
-        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET - 1",
-                System.currentTimeMillis()/1000 + MAX_OFFSET - 1);
-        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET",
-                System.currentTimeMillis()/1000 - MAX_OFFSET);
-        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET",
-                System.currentTimeMillis()/1000 + MAX_OFFSET);
-        testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET - 1024",
-                System.currentTimeMillis()/1000 - MAX_OFFSET - 1024);
-        testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET + 1024",
-                System.currentTimeMillis()/1000 + MAX_OFFSET + 1024);
-        testWithOffset("0", 0);
-        testWithOffset("-1", -1);
-        testWithOffset("Integer.MAX_VALUE + System.currentTimeMillis()/1000",
-                ((long)Integer.MAX_VALUE) + System.currentTimeMillis()/1000);
-        testWithOffset("System.currentTimeMillis()/1000 - Integer.MIN_VALUE",
-                System.currentTimeMillis()/1000 - Integer.MIN_VALUE);
-        testWithOffset("Long.MAX_VALUE", Long.MAX_VALUE);
-        testWithOffset("System.currentTimeMillis()/1000 - Long.MIN_VALUE",
-                (Long.MIN_VALUE + System.currentTimeMillis()/1000)*-1);
-    }
-
-    public static void main(String[] args) throws Exception {
-        regular();
-        testLimits();
-    }
-
-}
--- a/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java	Wed Jan 06 10:01:44 2016 +0000
@@ -78,7 +78,7 @@
                 mode = -1;
             }
 
-            uid = sun.misc.VM.geteuid();
+            uid = jdk.internal.misc.VM.geteuid();
 
             KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true);
             for (int i=0; i<nu; i++) {
--- a/jdk/test/sun/security/krb5/auto/TEST.properties	Tue Jan 05 16:03:36 2016 -0800
+++ b/jdk/test/sun/security/krb5/auto/TEST.properties	Wed Jan 06 10:01:44 2016 +0000
@@ -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.security.util \
         java.security.jgss/sun.security.jgss \