changeset 21637:fcaf599f308f

Merge
author lana
date Fri, 08 Nov 2013 17:36:14 -0800
parents fcec9002d5f4 14f6dddbb916
children d51c48db93d8
files jdk/src/share/classes/java/lang/invoke/MethodType.java jdk/src/solaris/classes/sun/nio/fs/UnixPath.java jdk/test/java/lang/Thread/ThreadStateTest.java langtools/test/tools/javac/ExtDirs/ext1/pkg1.jar langtools/test/tools/javac/ExtDirs/ext2/pkg2.jar langtools/test/tools/javac/ExtDirs/ext3/pkg1.jar langtools/test/tools/javac/ExtDirs/ext3/pkg2.jar langtools/test/tools/javac/T8019486/WrongLVTForLambdaTest.java nashorn/src/jdk/nashorn/internal/runtime/ScriptObjectListAdapter.java
diffstat 1159 files changed, 13189 insertions(+), 4691 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Nov 08 17:50:24 2013 -0500
+++ b/.hgtags	Fri Nov 08 17:36:14 2013 -0800
@@ -235,3 +235,4 @@
 b9a0f6c693f347a6f4b9bb994957f4eaa05bdedd jdk8-b111
 ad67c34f79c28a8e755f4a49f313868619d6702c jdk8-b112
 4a4dbcf7cb7d3e1a81beaa3b11cd909f69ebc79a jdk8-b113
+dfa34ab293faad9b543a24646dbb381bc3ab5586 jdk8-b114
--- a/.hgtags-top-repo	Fri Nov 08 17:50:24 2013 -0500
+++ b/.hgtags-top-repo	Fri Nov 08 17:36:14 2013 -0800
@@ -235,3 +235,4 @@
 d086227bfc45d124f09b3bd72a07956b4073bf71 jdk8-b111
 547316ea137d83d9c63083a9b83db64198fe0c81 jdk8-b112
 6ba4c7cb623ec612031e05cf8bf279d8f407bd1e jdk8-b113
+4f2011496393a26dcfd7b1f7787a3673ddd32599 jdk8-b114
--- a/common/autoconf/basics.m4	Fri Nov 08 17:50:24 2013 -0500
+++ b/common/autoconf/basics.m4	Fri Nov 08 17:36:14 2013 -0800
@@ -514,7 +514,7 @@
     if test "x$IS_GNU_MAKE" = x; then
       AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[[12]]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[[12]]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
       else
--- a/common/autoconf/generated-configure.sh	Fri Nov 08 17:50:24 2013 -0500
+++ b/common/autoconf/generated-configure.sh	Fri Nov 08 17:36:14 2013 -0800
@@ -3865,7 +3865,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1382702260
+DATE_WHEN_GENERATED=1383151988
 
 ###############################################################################
 #
@@ -8323,7 +8323,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -8680,7 +8680,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -9034,7 +9034,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -9393,7 +9393,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -9746,7 +9746,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
--- a/corba/.hgtags	Fri Nov 08 17:50:24 2013 -0500
+++ b/corba/.hgtags	Fri Nov 08 17:36:14 2013 -0800
@@ -235,3 +235,4 @@
 85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111
 43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112
 a259ff3e42d91da68f4d4f09d7eb9dc22bc024fc jdk8-b113
+0bbccf77c23e566170b88b52c2cf28e5d31ce927 jdk8-b114
--- a/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java	Fri Nov 08 17:36:14 2013 -0800
@@ -580,7 +580,7 @@
             java.lang.Object[] objholder = new java.lang.Object[1];
             objholder[0] = object;
             long[] longholder = new long[1];
-            TCUtility.unmarshalIn(in, typeCode, longholder, objholder);
+            TCUtility.unmarshalIn(in, realType(), longholder, objholder);
             value = longholder[0];
             object = objholder[0];
             stream = null;
--- a/corba/src/share/classes/javax/rmi/CORBA/Stub.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/corba/src/share/classes/javax/rmi/CORBA/Stub.java	Fri Nov 08 17:36:14 2013 -0800
@@ -61,13 +61,11 @@
     private transient StubDelegate stubDelegate = null;
     private static Class stubDelegateClass = null;
     private static final String StubClassKey = "javax.rmi.CORBA.StubClass";
-    private static final String defaultStubImplName = "com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl";
 
     static {
-        Object stubDelegateInstance = (Object) createDelegateIfSpecified(StubClassKey, defaultStubImplName);
+        Object stubDelegateInstance = createDelegate(StubClassKey);
         if (stubDelegateInstance != null)
             stubDelegateClass = stubDelegateInstance.getClass();
-
     }
 
 
@@ -207,7 +205,7 @@
     // are in different packages and the visibility needs to be package for
     // security reasons. If you know a better solution how to share this code
     // then remove it from PortableRemoteObject. Also in Util.java
-    private static Object createDelegateIfSpecified(String classKey, String defaultClassName) {
+    private static Object createDelegate(String classKey) {
         String className = (String)
             AccessController.doPrivileged(new GetPropertyAction(classKey));
         if (className == null) {
@@ -218,7 +216,7 @@
         }
 
         if (className == null) {
-            className = defaultClassName;
+            return new com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl();
         }
 
         try {
--- a/corba/src/share/classes/javax/rmi/CORBA/Util.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/corba/src/share/classes/javax/rmi/CORBA/Util.java	Fri Nov 08 17:36:14 2013 -0800
@@ -60,14 +60,11 @@
 public class Util {
 
     // This can only be set at static initialization time (no sync necessary).
-    private static javax.rmi.CORBA.UtilDelegate utilDelegate = null;
+    private static final javax.rmi.CORBA.UtilDelegate utilDelegate;
     private static final String UtilClassKey = "javax.rmi.CORBA.UtilClass";
-    private static final String defaultUtilImplName =
-"com.sun.corba.se.impl.javax.rmi.CORBA.Util";
 
     static {
-        utilDelegate = (javax.rmi.CORBA.UtilDelegate)
-            createDelegateIfSpecified(UtilClassKey, defaultUtilImplName);
+        utilDelegate = (javax.rmi.CORBA.UtilDelegate)createDelegate(UtilClassKey);
     }
 
     private Util(){}
@@ -338,9 +335,7 @@
     // are in different packages and the visibility needs to be package for
     // security reasons. If you know a better solution how to share this code
     // then remove it from PortableRemoteObject. Also in Stub.java
-    private static Object createDelegateIfSpecified(String classKey,
-        String defaultClassName)
-    {
+    private static Object createDelegate(String classKey) {
         String className = (String)
             AccessController.doPrivileged(new GetPropertyAction(classKey));
         if (className == null) {
@@ -351,7 +346,7 @@
         }
 
         if (className == null) {
-            className = defaultClassName;
+            return new com.sun.corba.se.impl.javax.rmi.CORBA.Util();
         }
 
         try {
--- a/corba/src/share/classes/javax/rmi/PortableRemoteObject.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/corba/src/share/classes/javax/rmi/PortableRemoteObject.java	Fri Nov 08 17:36:14 2013 -0800
@@ -65,17 +65,14 @@
  */
 public class PortableRemoteObject {
 
-    private static javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate = null;
+    private static final javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate;
 
     private static final String PortableRemoteObjectClassKey =
             "javax.rmi.CORBA.PortableRemoteObjectClass";
 
-    private static final String defaultPortableRemoteObjectImplName =
-            "com.sun.corba.se.impl.javax.rmi.PortableRemoteObject";
-
     static {
         proDelegate = (javax.rmi.CORBA.PortableRemoteObjectDelegate)
-            createDelegateIfSpecified(PortableRemoteObjectClassKey);
+            createDelegate(PortableRemoteObjectClassKey);
     }
 
     /**
@@ -181,7 +178,7 @@
     // are in different packages and the visibility needs to be package for
     // security reasons. If you know a better solution how to share this code
     // then remove it from here.
-    private static Object createDelegateIfSpecified(String classKey) {
+    private static Object createDelegate(String classKey) {
         String className = (String)
             AccessController.doPrivileged(new GetPropertyAction(classKey));
         if (className == null) {
@@ -191,7 +188,7 @@
             }
         }
         if (className == null) {
-                className = defaultPortableRemoteObjectImplName;
+            return new com.sun.corba.se.impl.javax.rmi.PortableRemoteObject();
         }
 
         try {
--- a/corba/src/share/classes/org/omg/CORBA/ORB.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/corba/src/share/classes/org/omg/CORBA/ORB.java	Fri Nov 08 17:36:14 2013 -0800
@@ -174,15 +174,6 @@
     private static final String ORBSingletonClassKey = "org.omg.CORBA.ORBSingletonClass";
 
     //
-    // The last resort fallback ORB implementation classes in case
-    // no ORB implementation class is dynamically configured through
-    // properties or applet parameters. Change these values to
-    // vendor-specific class names.
-    //
-    private static final String defaultORB = "com.sun.corba.se.impl.orb.ORBImpl";
-    private static final String defaultORBSingleton = "com.sun.corba.se.impl.orb.ORBSingleton";
-
-    //
     // The global instance of the singleton ORB implementation which
     // acts as a factory for typecodes for generated Helper classes.
     // TypeCodes should be immutable since they may be shared across
@@ -294,10 +285,11 @@
             String className = getSystemProperty(ORBSingletonClassKey);
             if (className == null)
                 className = getPropertyFromFile(ORBSingletonClassKey);
-            if (className == null)
-                className = defaultORBSingleton;
-
-            singleton = create_impl(className);
+            if (className == null) {
+                singleton = new com.sun.corba.se.impl.orb.ORBSingleton();
+            } else {
+                singleton = create_impl(className);
+            }
         }
         return singleton;
     }
@@ -347,10 +339,12 @@
             className = getSystemProperty(ORBClassKey);
         if (className == null)
             className = getPropertyFromFile(ORBClassKey);
-        if (className == null)
-            className = defaultORB;
+        if (className == null) {
+            orb = new com.sun.corba.se.impl.orb.ORBImpl();
+        } else {
+            orb = create_impl(className);
+        }
 
-        orb = create_impl(className);
         orb.set_parameters(args, props);
         return orb;
     }
@@ -375,10 +369,12 @@
             className = getSystemProperty(ORBClassKey);
         if (className == null)
             className = getPropertyFromFile(ORBClassKey);
-        if (className == null)
-            className = defaultORB;
+        if (className == null) {
+            orb = new com.sun.corba.se.impl.orb.ORBImpl();
+        } else {
+            orb = create_impl(className);
+        }
 
-        orb = create_impl(className);
         orb.set_parameters(app, props);
         return orb;
     }
--- a/hotspot/.hgtags	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/.hgtags	Fri Nov 08 17:36:14 2013 -0800
@@ -389,3 +389,5 @@
 23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55
 4589b398ab03aba6a5da8c06ff53603488d1b8f4 jdk8-b113
 82a9cdbf683e374a76f2009352de53e16bed5a91 hs25-b56
+7fd913010dbbf75260688fd2fa8964763fa49a09 jdk8-b114
+3b32d287da89a47a45d16f6d9ba5bd3cd9bf4b3e hs25-b57
--- a/hotspot/agent/src/os/bsd/ps_proc.c	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/agent/src/os/bsd/ps_proc.c	Fri Nov 08 17:36:14 2013 -0800
@@ -131,7 +131,7 @@
 
 static bool ptrace_continue(pid_t pid, int signal) {
   // pass the signal to the process so we don't swallow it
-  if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
+  if (ptrace(PT_CONTINUE, pid, NULL, signal) < 0) {
     print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
     return false;
   }
@@ -434,7 +434,6 @@
 // attach to the process. One and only one exposed stuff
 struct ps_prochandle* Pgrab(pid_t pid) {
   struct ps_prochandle* ph = NULL;
-  thread_info* thr = NULL;
 
   if ( (ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle))) == NULL) {
      print_debug("can't allocate memory for ps_prochandle\n");
--- a/hotspot/make/hotspot_version	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/make/hotspot_version	Fri Nov 08 17:36:14 2013 -0800
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=56
+HS_BUILD_NUMBER=57
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -365,7 +365,7 @@
   return entry;
 }
 
-address CppInterpreter::return_entry(TosState state, int length) {
+address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   // make it look good in the debugger
   return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation) + frame::pc_return_offset;
 }
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -4099,15 +4099,19 @@
 
 void MacroAssembler::encode_klass_not_null(Register r) {
   assert (UseCompressedClassPointers, "must be compressed");
-  assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized");
-  assert(r != G6_heapbase, "bad register choice");
-  set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
-  sub(r, G6_heapbase, r);
-  if (Universe::narrow_klass_shift() != 0) {
-    assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
-    srlx(r, LogKlassAlignmentInBytes, r);
+  if (Universe::narrow_klass_base() != NULL) {
+    assert(r != G6_heapbase, "bad register choice");
+    set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
+    sub(r, G6_heapbase, r);
+    if (Universe::narrow_klass_shift() != 0) {
+      assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+      srlx(r, LogKlassAlignmentInBytes, r);
+    }
+    reinit_heapbase();
+  } else {
+    assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
+    srlx(r, Universe::narrow_klass_shift(), r);
   }
-  reinit_heapbase();
 }
 
 void MacroAssembler::encode_klass_not_null(Register src, Register dst) {
@@ -4115,11 +4119,16 @@
     encode_klass_not_null(src);
   } else {
     assert (UseCompressedClassPointers, "must be compressed");
-    assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized");
-    set((intptr_t)Universe::narrow_klass_base(), dst);
-    sub(src, dst, dst);
-    if (Universe::narrow_klass_shift() != 0) {
-      srlx(dst, LogKlassAlignmentInBytes, dst);
+    if (Universe::narrow_klass_base() != NULL) {
+      set((intptr_t)Universe::narrow_klass_base(), dst);
+      sub(src, dst, dst);
+      if (Universe::narrow_klass_shift() != 0) {
+        srlx(dst, LogKlassAlignmentInBytes, dst);
+      }
+    } else {
+      // shift src into dst
+      assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
+      srlx(src, Universe::narrow_klass_shift(), dst);
     }
   }
 }
@@ -4129,14 +4138,16 @@
 // the instructions they generate change, then this method needs to be updated.
 int MacroAssembler::instr_size_for_decode_klass_not_null() {
   assert (UseCompressedClassPointers, "only for compressed klass ptrs");
-  // set + add + set
-  int num_instrs = insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) + 1 +
-    insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base());
-  if (Universe::narrow_klass_shift() == 0) {
-    return num_instrs * BytesPerInstWord;
-  } else { // sllx
-    return (num_instrs + 1) * BytesPerInstWord;
+  int num_instrs = 1;  // shift src,dst or add
+  if (Universe::narrow_klass_base() != NULL) {
+    // set + add + set
+    num_instrs += insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) +
+                  insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base());
+    if (Universe::narrow_klass_shift() != 0) {
+      num_instrs += 1;  // sllx
+    }
   }
+  return num_instrs * BytesPerInstWord;
 }
 
 // !!! If the instructions that get generated here change then function
@@ -4145,13 +4156,17 @@
   // Do not add assert code to this unless you change vtableStubs_sparc.cpp
   // pd_code_size_limit.
   assert (UseCompressedClassPointers, "must be compressed");
-  assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized");
-  assert(r != G6_heapbase, "bad register choice");
-  set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
-  if (Universe::narrow_klass_shift() != 0)
-    sllx(r, LogKlassAlignmentInBytes, r);
-  add(r, G6_heapbase, r);
-  reinit_heapbase();
+  if (Universe::narrow_klass_base() != NULL) {
+    assert(r != G6_heapbase, "bad register choice");
+    set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
+    if (Universe::narrow_klass_shift() != 0)
+      sllx(r, LogKlassAlignmentInBytes, r);
+    add(r, G6_heapbase, r);
+    reinit_heapbase();
+  } else {
+    assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
+    sllx(r, Universe::narrow_klass_shift(), r);
+  }
 }
 
 void  MacroAssembler::decode_klass_not_null(Register src, Register dst) {
@@ -4161,16 +4176,21 @@
     // Do not add assert code to this unless you change vtableStubs_sparc.cpp
     // pd_code_size_limit.
     assert (UseCompressedClassPointers, "must be compressed");
-    assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized");
-    if (Universe::narrow_klass_shift() != 0) {
-      assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice");
-      set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
-      sllx(src, LogKlassAlignmentInBytes, dst);
-      add(dst, G6_heapbase, dst);
-      reinit_heapbase();
+    if (Universe::narrow_klass_base() != NULL) {
+      if (Universe::narrow_klass_shift() != 0) {
+        assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice");
+        set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
+        sllx(src, LogKlassAlignmentInBytes, dst);
+        add(dst, G6_heapbase, dst);
+        reinit_heapbase();
+      } else {
+        set((intptr_t)Universe::narrow_klass_base(), dst);
+        add(src, dst, dst);
+      }
     } else {
-      set((intptr_t)Universe::narrow_klass_base(), dst);
-      add(src, dst, dst);
+      // shift/mov src into dst.
+      assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
+      sllx(src, Universe::narrow_klass_shift(), dst);
     }
   }
 }
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Fri Nov 08 17:36:14 2013 -0800
@@ -1660,12 +1660,16 @@
   if (UseCompressedClassPointers) {
     assert(Universe::heap() != NULL, "java heap should be initialized");
     st->print_cr("\tLDUW   [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check - compressed klass");
-    st->print_cr("\tSET    Universe::narrow_klass_base,R_G6_heap_base");
-    if (Universe::narrow_klass_shift() != 0) {
-      st->print_cr("\tSLL    R_G5,3,R_G5");
+    if (Universe::narrow_klass_base() != 0) {
+      st->print_cr("\tSET    Universe::narrow_klass_base,R_G6_heap_base");
+      if (Universe::narrow_klass_shift() != 0) {
+        st->print_cr("\tSLL    R_G5,Universe::narrow_klass_shift,R_G5");
+      }
+      st->print_cr("\tADD    R_G5,R_G6_heap_base,R_G5");
+      st->print_cr("\tSET    Universe::narrow_ptrs_base,R_G6_heap_base");
+    } else {
+      st->print_cr("\tSLL    R_G5,Universe::narrow_klass_shift,R_G5");
     }
-    st->print_cr("\tADD    R_G5,R_G6_heap_base,R_G5");
-    st->print_cr("\tSET    Universe::narrow_ptrs_base,R_G6_heap_base");
   } else {
     st->print_cr("\tLDX    [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check");
   }
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -153,13 +153,9 @@
 }
 
 
-address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
-  TosState incoming_state = state;
+address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
+  address entry = __ pc();
 
-  Label cont;
-  address compiled_entry = __ pc();
-
-  address entry = __ pc();
 #if !defined(_LP64) && defined(COMPILER2)
   // All return values are where we want them, except for Longs.  C2 returns
   // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1.
@@ -170,14 +166,12 @@
   // do this here. Unfortunately if we did a rethrow we'd see an machepilog node
   // first which would move g1 -> O0/O1 and destroy the exception we were throwing.
 
-  if (incoming_state == ltos) {
+  if (state == ltos) {
     __ srl (G1,  0, O1);
     __ srlx(G1, 32, O0);
   }
 #endif // !_LP64 && COMPILER2
 
-  __ bind(cont);
-
   // The callee returns with the stack possibly adjusted by adapter transition
   // We remove that possible adjustment here.
   // All interpreter local registers are untouched. Any result is passed back
@@ -186,29 +180,18 @@
 
   __ mov(Llast_SP, SP);   // Remove any adapter added stack space.
 
-  Label L_got_cache, L_giant_index;
   const Register cache = G3_scratch;
-  const Register size  = G1_scratch;
-  if (EnableInvokeDynamic) {
-    __ ldub(Address(Lbcp, 0), G1_scratch);  // Load current bytecode.
-    __ cmp_and_br_short(G1_scratch, Bytecodes::_invokedynamic, Assembler::equal, Assembler::pn, L_giant_index);
-  }
-  __ get_cache_and_index_at_bcp(cache, G1_scratch, 1);
-  __ bind(L_got_cache);
-  __ ld_ptr(cache, ConstantPoolCache::base_offset() +
-                   ConstantPoolCacheEntry::flags_offset(), size);
-  __ and3(size, 0xFF, size);                   // argument size in words
-  __ sll(size, Interpreter::logStackElementSize, size); // each argument size in bytes
-  __ add(Lesp, size, Lesp);                    // pop arguments
+  const Register index  = G1_scratch;
+  __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
+
+  const Register flags = cache;
+  __ ld_ptr(cache, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset(), flags);
+  const Register parameter_size = flags;
+  __ and3(flags, ConstantPoolCacheEntry::parameter_size_mask, parameter_size);  // argument size in words
+  __ sll(parameter_size, Interpreter::logStackElementSize, parameter_size);     // each argument size in bytes
+  __ add(Lesp, parameter_size, Lesp);                                           // pop arguments
   __ dispatch_next(state, step);
 
-  // out of the main line of code...
-  if (EnableInvokeDynamic) {
-    __ bind(L_giant_index);
-    __ get_cache_and_index_at_bcp(cache, G1_scratch, 1, sizeof(u4));
-    __ ba_short(L_got_cache);
-  }
-
   return entry;
 }
 
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -2932,9 +2932,7 @@
   ConstantPoolCacheEntry::verify_tos_state_shift();
   // load return address
   {
-    const address table_addr = (is_invokeinterface || is_invokedynamic) ?
-        (address)Interpreter::return_5_addrs_by_index_table() :
-        (address)Interpreter::return_3_addrs_by_index_table();
+    const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
     AddressLiteral table(table_addr);
     __ set(table, temp);
     __ sll(ra, LogBytesPerWord, ra);
@@ -2984,7 +2982,7 @@
   __ verify_oop(O0_recv);
 
   // get return address
-  AddressLiteral table(Interpreter::return_3_addrs_by_index_table());
+  AddressLiteral table(Interpreter::invoke_return_entry_table());
   __ set(table, Rtemp);
   __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret);          // get return type
   // Make sure we don't need to mask Rret after the above shift
@@ -3026,7 +3024,7 @@
   __ profile_final_call(O4);
 
   // get return address
-  AddressLiteral table(Interpreter::return_3_addrs_by_index_table());
+  AddressLiteral table(Interpreter::invoke_return_entry_table());
   __ set(table, Rtemp);
   __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret);          // get return type
   // Make sure we don't need to mask Rret after the above shift
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -1468,19 +1468,18 @@
     addr = new LIR_Address(src.result(), offset, type);
   }
 
-  if (data != dst) {
-    __ move(data, dst);
-    data = dst;
-  }
+  // Because we want a 2-arg form of xchg and xadd
+  __ move(data, dst);
+
   if (x->is_add()) {
-    __ xadd(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr);
+    __ xadd(LIR_OprFact::address(addr), dst, dst, LIR_OprFact::illegalOpr);
   } else {
     if (is_obj) {
       // Do the pre-write barrier, if any.
       pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */,
                   true /* do_load */, false /* patch */, NULL);
     }
-    __ xchg(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr);
+    __ xchg(LIR_OprFact::address(addr), dst, dst, LIR_OprFact::illegalOpr);
     if (is_obj) {
       // Seems to be a precise address
       post_barrier(LIR_OprFact::address(addr), data);
--- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -367,7 +367,7 @@
   return entry;
 }
 
-address CppInterpreter::return_entry(TosState state, int length) {
+address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   // make it look good in the debugger
   return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation);
 }
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -5049,25 +5049,32 @@
 }
 
 void MacroAssembler::encode_klass_not_null(Register r) {
-  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
-  // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
-  assert(r != r12_heapbase, "Encoding a klass in r12");
-  mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
-  subq(r, r12_heapbase);
+  if (Universe::narrow_klass_base() != NULL) {
+    // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
+    assert(r != r12_heapbase, "Encoding a klass in r12");
+    mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
+    subq(r, r12_heapbase);
+  }
   if (Universe::narrow_klass_shift() != 0) {
     assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
     shrq(r, LogKlassAlignmentInBytes);
   }
-  reinit_heapbase();
+  if (Universe::narrow_klass_base() != NULL) {
+    reinit_heapbase();
+  }
 }
 
 void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
   if (dst == src) {
     encode_klass_not_null(src);
   } else {
-    mov64(dst, (int64_t)Universe::narrow_klass_base());
-    negq(dst);
-    addq(dst, src);
+    if (Universe::narrow_klass_base() != NULL) {
+      mov64(dst, (int64_t)Universe::narrow_klass_base());
+      negq(dst);
+      addq(dst, src);
+    } else {
+      movptr(dst, src);
+    }
     if (Universe::narrow_klass_shift() != 0) {
       assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
       shrq(dst, LogKlassAlignmentInBytes);
@@ -5081,15 +5088,19 @@
 // generate change, then this method needs to be updated.
 int MacroAssembler::instr_size_for_decode_klass_not_null() {
   assert (UseCompressedClassPointers, "only for compressed klass ptrs");
-  // mov64 + addq + shlq? + mov64  (for reinit_heapbase()).
-  return (Universe::narrow_klass_shift() == 0 ? 20 : 24);
+  if (Universe::narrow_klass_base() != NULL) {
+    // mov64 + addq + shlq? + mov64  (for reinit_heapbase()).
+    return (Universe::narrow_klass_shift() == 0 ? 20 : 24);
+  } else {
+    // longest load decode klass function, mov64, leaq
+    return 16;
+  }
 }
 
 // !!! If the instructions that get generated here change then function
 // instr_size_for_decode_klass_not_null() needs to get updated.
 void  MacroAssembler::decode_klass_not_null(Register r) {
   // Note: it will change flags
-  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
   assert (UseCompressedClassPointers, "should only be used for compressed headers");
   assert(r != r12_heapbase, "Decoding a klass in r12");
   // Cannot assert, unverified entry point counts instructions (see .ad file)
@@ -5100,14 +5111,15 @@
     shlq(r, LogKlassAlignmentInBytes);
   }
   // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
-  mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
-  addq(r, r12_heapbase);
-  reinit_heapbase();
+  if (Universe::narrow_klass_base() != NULL) {
+    mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
+    addq(r, r12_heapbase);
+    reinit_heapbase();
+  }
 }
 
 void  MacroAssembler::decode_klass_not_null(Register dst, Register src) {
   // Note: it will change flags
-  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
   assert (UseCompressedClassPointers, "should only be used for compressed headers");
   if (dst == src) {
     decode_klass_not_null(dst);
@@ -5115,7 +5127,6 @@
     // Cannot assert, unverified entry point counts instructions (see .ad file)
     // vtableStubs also counts instructions in pd_code_size_limit.
     // Also do not verify_oop as this is called by verify_oop.
-
     mov64(dst, (int64_t)Universe::narrow_klass_base());
     if (Universe::narrow_klass_shift() != 0) {
       assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -150,13 +150,12 @@
 }
 
 
-address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
-  TosState incoming_state = state;
+address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
   address entry = __ pc();
 
 #ifdef COMPILER2
   // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases
-  if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) {
+  if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) {
     for (int i = 1; i < 8; i++) {
         __ ffree(i);
     }
@@ -164,7 +163,7 @@
     __ empty_FPU_stack();
   }
 #endif
-  if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) {
+  if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) {
     __ MacroAssembler::verify_FPU(1, "generate_return_entry_for compiled");
   } else {
     __ MacroAssembler::verify_FPU(0, "generate_return_entry_for compiled");
@@ -172,12 +171,12 @@
 
   // In SSE mode, interpreter returns FP results in xmm0 but they need
   // to end up back on the FPU so it can operate on them.
-  if (incoming_state == ftos && UseSSE >= 1) {
+  if (state == ftos && UseSSE >= 1) {
     __ subptr(rsp, wordSize);
     __ movflt(Address(rsp, 0), xmm0);
     __ fld_s(Address(rsp, 0));
     __ addptr(rsp, wordSize);
-  } else if (incoming_state == dtos && UseSSE >= 2) {
+  } else if (state == dtos && UseSSE >= 2) {
     __ subptr(rsp, 2*wordSize);
     __ movdbl(Address(rsp, 0), xmm0);
     __ fld_d(Address(rsp, 0));
@@ -194,33 +193,22 @@
   __ restore_bcp();
   __ restore_locals();
 
-  if (incoming_state == atos) {
+  if (state == atos) {
     Register mdp = rbx;
     Register tmp = rcx;
     __ profile_return_type(mdp, rax, tmp);
   }
 
-  Label L_got_cache, L_giant_index;
-  if (EnableInvokeDynamic) {
-    __ cmpb(Address(rsi, 0), Bytecodes::_invokedynamic);
-    __ jcc(Assembler::equal, L_giant_index);
-  }
-  __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2));
-  __ bind(L_got_cache);
-  __ movl(rbx, Address(rbx, rcx,
-                    Address::times_ptr, ConstantPoolCache::base_offset() +
-                    ConstantPoolCacheEntry::flags_offset()));
-  __ andptr(rbx, 0xFF);
-  __ lea(rsp, Address(rsp, rbx, Interpreter::stackElementScale()));
+  const Register cache = rbx;
+  const Register index = rcx;
+  __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
+
+  const Register flags = cache;
+  __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
+  __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
+  __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
   __ dispatch_next(state, step);
 
-  // out of the main line of code...
-  if (EnableInvokeDynamic) {
-    __ bind(L_giant_index);
-    __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4));
-    __ jmp(L_got_cache);
-  }
-
   return entry;
 }
 
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -166,7 +166,7 @@
 }
 
 
-address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
+address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
   address entry = __ pc();
 
   // Restore stack bottom in case i2c adjusted stack
@@ -183,28 +183,16 @@
     __ profile_return_type(mdp, rax, tmp);
   }
 
-  Label L_got_cache, L_giant_index;
-  if (EnableInvokeDynamic) {
-    __ cmpb(Address(r13, 0), Bytecodes::_invokedynamic);
-    __ jcc(Assembler::equal, L_giant_index);
-  }
-  __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2));
-  __ bind(L_got_cache);
-  __ movl(rbx, Address(rbx, rcx,
-                       Address::times_ptr,
-                       in_bytes(ConstantPoolCache::base_offset()) +
-                       3 * wordSize));
-  __ andl(rbx, 0xFF);
-  __ lea(rsp, Address(rsp, rbx, Address::times_8));
+  const Register cache = rbx;
+  const Register index = rcx;
+  __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
+
+  const Register flags = cache;
+  __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
+  __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
+  __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
   __ dispatch_next(state, step);
 
-  // out of the main line of code...
-  if (EnableInvokeDynamic) {
-    __ bind(L_giant_index);
-    __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4));
-    __ jmp(L_got_cache);
-  }
-
   return entry;
 }
 
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -2925,9 +2925,7 @@
   ConstantPoolCacheEntry::verify_tos_state_shift();
   // load return address
   {
-    const address table_addr = (is_invokeinterface || is_invokedynamic) ?
-        (address)Interpreter::return_5_addrs_by_index_table() :
-        (address)Interpreter::return_3_addrs_by_index_table();
+    const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
     ExternalAddress table(table_addr);
     __ movptr(flags, ArrayAddress(table, Address(noreg, flags, Address::times_ptr)));
   }
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -2980,9 +2980,7 @@
   ConstantPoolCacheEntry::verify_tos_state_shift();
   // load return address
   {
-    const address table_addr = (is_invokeinterface || is_invokedynamic) ?
-        (address)Interpreter::return_5_addrs_by_index_table() :
-        (address)Interpreter::return_3_addrs_by_index_table();
+    const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
     ExternalAddress table(table_addr);
     __ lea(rscratch1, table);
     __ movptr(flags, Address(rscratch1, flags, Address::times_ptr));
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -1006,7 +1006,7 @@
   istate->set_stack_limit(stack_base - method->max_stack() - 1);
 }
 
-address CppInterpreter::return_entry(TosState state, int length) {
+address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   ShouldNotCallThis();
   return NULL;
 }
--- a/hotspot/src/cpu/zero/vm/globals_zero.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -57,6 +57,8 @@
 // GC Ergo Flags
 define_pd_global(uintx, CMSYoungGenPerWorker, 16*M);  // default max size of CMS young gen, per GC worker thread
 
+define_pd_global(uintx, TypeProfileLevel, 0);
+
 #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct)
 
 #endif // CPU_ZERO_VM_GLOBALS_ZERO_HPP
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -945,17 +945,15 @@
 // Used by VMSelfDestructTimer and the MemProfiler.
 double os::elapsedTime() {
 
-  return (double)(os::elapsed_counter()) * 0.000001;
+  return ((double)os::elapsed_counter()) / os::elapsed_frequency();
 }
 
 jlong os::elapsed_counter() {
-  timeval time;
-  int status = gettimeofday(&time, NULL);
-  return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count;
+  return javaTimeNanos() - initial_time_count;
 }
 
 jlong os::elapsed_frequency() {
-  return (1000 * 1000);
+  return NANOSECS_PER_SEC; // nanosecond resolution
 }
 
 bool os::supports_vtime() { return true; }
@@ -3582,7 +3580,7 @@
   Bsd::_main_thread = pthread_self();
 
   Bsd::clock_init();
-  initial_time_count = os::elapsed_counter();
+  initial_time_count = javaTimeNanos();
 
 #ifdef __APPLE__
   // XXXDARWIN
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -1333,17 +1333,15 @@
 // Used by VMSelfDestructTimer and the MemProfiler.
 double os::elapsedTime() {
 
-  return (double)(os::elapsed_counter()) * 0.000001;
+  return ((double)os::elapsed_counter()) / os::elapsed_frequency(); // nanosecond resolution
 }
 
 jlong os::elapsed_counter() {
-  timeval time;
-  int status = gettimeofday(&time, NULL);
-  return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count;
+  return javaTimeNanos() - initial_time_count;
 }
 
 jlong os::elapsed_frequency() {
-  return (1000 * 1000);
+  return NANOSECS_PER_SEC; // nanosecond resolution
 }
 
 bool os::supports_vtime() { return true; }
@@ -4750,7 +4748,7 @@
   Linux::_main_thread = pthread_self();
 
   Linux::clock_init();
-  initial_time_count = os::elapsed_counter();
+  initial_time_count = javaTimeNanos();
 
   // pthread_condattr initialization for monotonic clock
   int status;
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -79,6 +79,15 @@
 # include <pthread_np.h>
 #endif
 
+// needed by current_stack_region() workaround for Mavericks
+#if defined(__APPLE__)
+# include <errno.h>
+# include <sys/types.h>
+# include <sys/sysctl.h>
+# define DEFAULT_MAIN_THREAD_STACK_PAGES 2048
+# define OS_X_10_9_0_KERNEL_MAJOR_VERSION 13
+#endif
+
 #ifdef AMD64
 #define SPELL_REG_SP "rsp"
 #define SPELL_REG_FP "rbp"
@@ -828,6 +837,21 @@
   pthread_t self = pthread_self();
   void *stacktop = pthread_get_stackaddr_np(self);
   *size = pthread_get_stacksize_np(self);
+  // workaround for OS X 10.9.0 (Mavericks)
+  // pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages
+  if (pthread_main_np() == 1) {
+    if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) {
+      char kern_osrelease[256];
+      size_t kern_osrelease_size = sizeof(kern_osrelease);
+      int ret = sysctlbyname("kern.osrelease", kern_osrelease, &kern_osrelease_size, NULL, 0);
+      if (ret == 0) {
+        // get the major number, atoi will ignore the minor amd micro portions of the version string
+        if (atoi(kern_osrelease) >= OS_X_10_9_0_KERNEL_MAJOR_VERSION) {
+          *size = (DEFAULT_MAIN_THREAD_STACK_PAGES*getpagesize());
+        }
+      }
+    }
+  }
   *bottom = (address) stacktop - *size;
 #elif defined(__OpenBSD__)
   stack_t ss;
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -1873,7 +1873,7 @@
         // number of implementors for decl_interface is 0 or 1. If
         // it's 0 then no class implements decl_interface and there's
         // no point in inlining.
-        if (!holder->is_loaded() || decl_interface->nof_implementors() != 1) {
+        if (!holder->is_loaded() || decl_interface->nof_implementors() != 1 || decl_interface->has_default_methods()) {
           singleton = NULL;
         }
       }
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -57,6 +57,7 @@
   _init_state = ik->init_state();
   _nonstatic_field_size = ik->nonstatic_field_size();
   _has_nonstatic_fields = ik->has_nonstatic_fields();
+  _has_default_methods = ik->has_default_methods();
   _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
 
   _implementor = NULL; // we will fill these lazily
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -52,6 +52,7 @@
   bool                   _has_finalizer;
   bool                   _has_subklass;
   bool                   _has_nonstatic_fields;
+  bool                   _has_default_methods;
 
   ciFlags                _flags;
   jint                   _nonstatic_field_size;
@@ -171,6 +172,11 @@
     }
   }
 
+  bool has_default_methods()  {
+    assert(is_loaded(), "must be loaded");
+    return _has_default_methods;
+  }
+
   ciInstanceKlass* get_canonical_holder(int offset);
   ciField* get_field_by_offset(int field_offset, bool is_static);
   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -131,6 +131,17 @@
   }
 }
 
+void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
+  // Lock to avoid classes being modified/added/removed during iteration
+  MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
+  for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
+    // Do not filter ArrayKlass oops here...
+    if (k->oop_is_array() || (k->oop_is_instance() && InstanceKlass::cast(k)->is_loaded())) {
+      klass_closure->do_klass(k);
+    }
+  }
+}
+
 void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
   for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
     if (k->oop_is_instance()) {
@@ -600,6 +611,12 @@
   }
 }
 
+void ClassLoaderDataGraph::loaded_classes_do(KlassClosure* klass_closure) {
+  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
+    cld->loaded_classes_do(klass_closure);
+  }
+}
+
 void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
   for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -78,6 +78,7 @@
   static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
   static void classes_do(KlassClosure* klass_closure);
   static void classes_do(void f(Klass* const));
+  static void loaded_classes_do(KlassClosure* klass_closure);
   static void classes_unloading_do(void f(Klass* const));
   static bool do_unloading(BoolObjectClosure* is_alive);
 
@@ -186,6 +187,7 @@
   bool keep_alive() const       { return _keep_alive; }
   bool is_alive(BoolObjectClosure* is_alive_closure) const;
   void classes_do(void f(Klass*));
+  void loaded_classes_do(KlassClosure* klass_closure);
   void classes_do(void f(InstanceKlass*));
 
   // Deallocate free list during class unloading.
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -173,8 +173,6 @@
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
   do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
                                                                                                                          \
-  do_klass(PostVMInitHook_klass,                        sun_misc_PostVMInitHook,                   Opt                 ) \
-                                                                                                                         \
   /* Preload boxing klasses */                                                                                           \
   do_klass(Boolean_klass,                               java_lang_Boolean,                         Pre                 ) \
   do_klass(Character_klass,                             java_lang_Character,                       Pre                 ) \
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -780,6 +780,10 @@
 void CompileBroker::compilation_init() {
   _last_method_compiled[0] = '\0';
 
+  // No need to initialize compilation system if we do not use it.
+  if (!UseCompiler) {
+    return;
+  }
 #ifndef SHARK
   // Set the interface to the current compiler(s).
   int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple);
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -158,8 +158,8 @@
   // Runtime support
 
   // length = invoke bytecode length (to advance to next bytecode)
-  static address    deopt_entry   (TosState state, int length) { ShouldNotReachHere(); return NULL; }
-  static address    return_entry  (TosState state, int length) { ShouldNotReachHere(); return NULL; }
+  static address deopt_entry(TosState state, int length) { ShouldNotReachHere(); return NULL; }
+  static address return_entry(TosState state, int length, Bytecodes::Code code) { ShouldNotReachHere(); return NULL; }
 
   static address    rethrow_exception_entry()                   { return _rethrow_exception_entry; }
 
--- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -78,7 +78,7 @@
   static address    stack_result_to_stack(int index)            { return _stack_to_stack[index]; }
   static address    stack_result_to_native(int index)           { return _stack_to_native_abi[index]; }
 
-  static address    return_entry  (TosState state, int length);
+  static address    return_entry  (TosState state, int length, Bytecodes::Code code);
   static address    deopt_entry   (TosState state, int length);
 
 #ifdef TARGET_ARCH_x86
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -329,15 +329,21 @@
 //------------------------------------------------------------------------------------------------------------------------
 // Deoptimization support
 
-// If deoptimization happens, this function returns the point of next bytecode to continue execution
+/**
+ * If a deoptimization happens, this function returns the point of next bytecode to continue execution.
+ */
 address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) {
   assert(method->contains(bcp), "just checkin'");
-  Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
+
+  // Get the original and rewritten bytecode.
+  Bytecodes::Code code = Bytecodes::java_code_at(method, bcp);
   assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute");
-  int             bci    = method->bci_from(bcp);
-  int             length = -1; // initial value for debugging
+
+  const int bci = method->bci_from(bcp);
+
   // compute continuation length
-  length = Bytecodes::length_at(method, bcp);
+  const int length = Bytecodes::length_at(method, bcp);
+
   // compute result type
   BasicType type = T_ILLEGAL;
 
@@ -393,7 +399,7 @@
   return
     is_top_frame
     ? Interpreter::deopt_entry (as_TosState(type), length)
-    : Interpreter::return_entry(as_TosState(type), length);
+    : Interpreter::return_entry(as_TosState(type), length, code);
 }
 
 // If deoptimization happens, this function returns the point where the interpreter reexecutes
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -184,8 +184,9 @@
 EntryPoint TemplateInterpreter::_continuation_entry;
 EntryPoint TemplateInterpreter::_safept_entry;
 
-address    TemplateInterpreter::_return_3_addrs_by_index[TemplateInterpreter::number_of_return_addrs];
-address    TemplateInterpreter::_return_5_addrs_by_index[TemplateInterpreter::number_of_return_addrs];
+address TemplateInterpreter::_invoke_return_entry[TemplateInterpreter::number_of_return_addrs];
+address TemplateInterpreter::_invokeinterface_return_entry[TemplateInterpreter::number_of_return_addrs];
+address TemplateInterpreter::_invokedynamic_return_entry[TemplateInterpreter::number_of_return_addrs];
 
 DispatchTable TemplateInterpreter::_active_table;
 DispatchTable TemplateInterpreter::_normal_table;
@@ -237,22 +238,37 @@
 #endif // !PRODUCT
 
   { CodeletMark cm(_masm, "return entry points");
+    const int index_size = sizeof(u2);
     for (int i = 0; i < Interpreter::number_of_return_entries; i++) {
       Interpreter::_return_entry[i] =
         EntryPoint(
-          generate_return_entry_for(itos, i),
-          generate_return_entry_for(itos, i),
-          generate_return_entry_for(itos, i),
-          generate_return_entry_for(atos, i),
-          generate_return_entry_for(itos, i),
-          generate_return_entry_for(ltos, i),
-          generate_return_entry_for(ftos, i),
-          generate_return_entry_for(dtos, i),
-          generate_return_entry_for(vtos, i)
+          generate_return_entry_for(itos, i, index_size),
+          generate_return_entry_for(itos, i, index_size),
+          generate_return_entry_for(itos, i, index_size),
+          generate_return_entry_for(atos, i, index_size),
+          generate_return_entry_for(itos, i, index_size),
+          generate_return_entry_for(ltos, i, index_size),
+          generate_return_entry_for(ftos, i, index_size),
+          generate_return_entry_for(dtos, i, index_size),
+          generate_return_entry_for(vtos, i, index_size)
         );
     }
   }
 
+  { CodeletMark cm(_masm, "invoke return entry points");
+    const TosState states[] = {itos, itos, itos, itos, ltos, ftos, dtos, atos, vtos};
+    const int invoke_length = Bytecodes::length_for(Bytecodes::_invokestatic);
+    const int invokeinterface_length = Bytecodes::length_for(Bytecodes::_invokeinterface);
+    const int invokedynamic_length = Bytecodes::length_for(Bytecodes::_invokedynamic);
+
+    for (int i = 0; i < Interpreter::number_of_return_addrs; i++) {
+      TosState state = states[i];
+      Interpreter::_invoke_return_entry[i] = generate_return_entry_for(state, invoke_length, sizeof(u2));
+      Interpreter::_invokeinterface_return_entry[i] = generate_return_entry_for(state, invokeinterface_length, sizeof(u2));
+      Interpreter::_invokedynamic_return_entry[i] = generate_return_entry_for(state, invokedynamic_length, sizeof(u4));
+    }
+  }
+
   { CodeletMark cm(_masm, "earlyret entry points");
     Interpreter::_earlyret_entry =
       EntryPoint(
@@ -298,13 +314,6 @@
     }
   }
 
-  for (int j = 0; j < number_of_states; j++) {
-    const TosState states[] = {btos, ctos, stos, itos, ltos, ftos, dtos, atos, vtos};
-    int index = Interpreter::TosState_as_index(states[j]);
-    Interpreter::_return_3_addrs_by_index[index] = Interpreter::return_entry(states[j], 3);
-    Interpreter::_return_5_addrs_by_index[index] = Interpreter::return_entry(states[j], 5);
-  }
-
   { CodeletMark cm(_masm, "continuation entry points");
     Interpreter::_continuation_entry =
       EntryPoint(
@@ -534,9 +543,46 @@
 //------------------------------------------------------------------------------------------------------------------------
 // Entry points
 
-address TemplateInterpreter::return_entry(TosState state, int length) {
+/**
+ * Returns the return entry table for the given invoke bytecode.
+ */
+address* TemplateInterpreter::invoke_return_entry_table_for(Bytecodes::Code code) {
+  switch (code) {
+  case Bytecodes::_invokestatic:
+  case Bytecodes::_invokespecial:
+  case Bytecodes::_invokevirtual:
+  case Bytecodes::_invokehandle:
+    return Interpreter::invoke_return_entry_table();
+  case Bytecodes::_invokeinterface:
+    return Interpreter::invokeinterface_return_entry_table();
+  case Bytecodes::_invokedynamic:
+    return Interpreter::invokedynamic_return_entry_table();
+  default:
+    fatal(err_msg("invalid bytecode: %s", Bytecodes::name(code)));
+    return NULL;
+  }
+}
+
+/**
+ * Returns the return entry address for the given top-of-stack state and bytecode.
+ */
+address TemplateInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   guarantee(0 <= length && length < Interpreter::number_of_return_entries, "illegal length");
-  return _return_entry[length].entry(state);
+  const int index = TosState_as_index(state);
+  switch (code) {
+  case Bytecodes::_invokestatic:
+  case Bytecodes::_invokespecial:
+  case Bytecodes::_invokevirtual:
+  case Bytecodes::_invokehandle:
+    return _invoke_return_entry[index];
+  case Bytecodes::_invokeinterface:
+    return _invokeinterface_return_entry[index];
+  case Bytecodes::_invokedynamic:
+    return _invokedynamic_return_entry[index];
+  default:
+    assert(!Bytecodes::is_invoke(code), err_msg("invoke instructions should be handled separately: %s", Bytecodes::name(code)));
+    return _return_entry[length].entry(state);
+  }
 }
 
 
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -120,8 +120,9 @@
   static EntryPoint _continuation_entry;
   static EntryPoint _safept_entry;
 
-  static address    _return_3_addrs_by_index[number_of_return_addrs];     // for invokevirtual   return entries
-  static address    _return_5_addrs_by_index[number_of_return_addrs];     // for invokeinterface return entries
+  static address _invoke_return_entry[number_of_return_addrs];           // for invokestatic, invokespecial, invokevirtual return entries
+  static address _invokeinterface_return_entry[number_of_return_addrs];  // for invokeinterface return entries
+  static address _invokedynamic_return_entry[number_of_return_addrs];    // for invokedynamic return entries
 
   static DispatchTable _active_table;                           // the active    dispatch table (used by the interpreter for dispatch)
   static DispatchTable _normal_table;                           // the normal    dispatch table (used to set the active table in normal mode)
@@ -161,12 +162,15 @@
   static address*   normal_table()                              { return _normal_table.table_for(); }
 
   // Support for invokes
-  static address*   return_3_addrs_by_index_table()             { return _return_3_addrs_by_index; }
-  static address*   return_5_addrs_by_index_table()             { return _return_5_addrs_by_index; }
-  static int        TosState_as_index(TosState state);          // computes index into return_3_entry_by_index table
+  static address*   invoke_return_entry_table()                 { return _invoke_return_entry; }
+  static address*   invokeinterface_return_entry_table()        { return _invokeinterface_return_entry; }
+  static address*   invokedynamic_return_entry_table()          { return _invokedynamic_return_entry; }
+  static int        TosState_as_index(TosState state);
 
-  static address    return_entry  (TosState state, int length);
-  static address    deopt_entry   (TosState state, int length);
+  static address* invoke_return_entry_table_for(Bytecodes::Code code);
+
+  static address deopt_entry(TosState state, int length);
+  static address return_entry(TosState state, int length, Bytecodes::Code code);
 
   // Safepoint support
   static void       notice_safepoints();                        // stops the thread when reaching a safepoint
--- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -53,7 +53,7 @@
   address generate_ClassCastException_handler();
   address generate_ArrayIndexOutOfBounds_handler(const char* name);
   address generate_continuation_for(TosState state);
-  address generate_return_entry_for(TosState state, int step);
+  address generate_return_entry_for(TosState state, int step, size_t index_size);
   address generate_earlyret_entry_for(TosState state);
   address generate_deopt_entry_for(TosState state, int step);
   address generate_safept_entry_for(TosState state, address runtime_entry);
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -56,7 +56,7 @@
 
 MetaWord* last_allocated = 0;
 
-size_t Metaspace::_class_metaspace_size;
+size_t Metaspace::_compressed_class_space_size;
 
 // Used in declarations in SpaceManager and ChunkManager
 enum ChunkIndex {
@@ -2843,6 +2843,8 @@
 #define VIRTUALSPACEMULTIPLIER 2
 
 #ifdef _LP64
+static const uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1);
+
 void Metaspace::set_narrow_klass_base_and_shift(address metaspace_base, address cds_base) {
   // Figure out the narrow_klass_base and the narrow_klass_shift.  The
   // narrow_klass_base is the lower of the metaspace base and the cds base
@@ -2852,14 +2854,22 @@
   address higher_address;
   if (UseSharedSpaces) {
     higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()),
-                          (address)(metaspace_base + class_metaspace_size()));
+                          (address)(metaspace_base + compressed_class_space_size()));
     lower_base = MIN2(metaspace_base, cds_base);
   } else {
-    higher_address = metaspace_base + class_metaspace_size();
+    higher_address = metaspace_base + compressed_class_space_size();
     lower_base = metaspace_base;
+
+    uint64_t klass_encoding_max = UnscaledClassSpaceMax << LogKlassAlignmentInBytes;
+    // If compressed class space fits in lower 32G, we don't need a base.
+    if (higher_address <= (address)klass_encoding_max) {
+      lower_base = 0; // effectively lower base is zero.
+    }
   }
+
   Universe::set_narrow_klass_base(lower_base);
-  if ((uint64_t)(higher_address - lower_base) < (uint64_t)max_juint) {
+
+  if ((uint64_t)(higher_address - lower_base) < UnscaledClassSpaceMax) {
     Universe::set_narrow_klass_shift(0);
   } else {
     assert(!UseSharedSpaces, "Cannot shift with UseSharedSpaces");
@@ -2874,24 +2884,24 @@
   assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs");
   address lower_base = MIN2((address)metaspace_base, cds_base);
   address higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()),
-                                (address)(metaspace_base + class_metaspace_size()));
-  return ((uint64_t)(higher_address - lower_base) < (uint64_t)max_juint);
+                                (address)(metaspace_base + compressed_class_space_size()));
+  return ((uint64_t)(higher_address - lower_base) < UnscaledClassSpaceMax);
 }
 
 // Try to allocate the metaspace at the requested addr.
 void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base) {
   assert(using_class_space(), "called improperly");
   assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs");
-  assert(class_metaspace_size() < KlassEncodingMetaspaceMax,
+  assert(compressed_class_space_size() < KlassEncodingMetaspaceMax,
          "Metaspace size is too big");
-  assert_is_ptr_aligned(requested_addr,          _reserve_alignment);
-  assert_is_ptr_aligned(cds_base,                _reserve_alignment);
-  assert_is_size_aligned(class_metaspace_size(), _reserve_alignment);
+  assert_is_ptr_aligned(requested_addr, _reserve_alignment);
+  assert_is_ptr_aligned(cds_base, _reserve_alignment);
+  assert_is_size_aligned(compressed_class_space_size(), _reserve_alignment);
 
   // Don't use large pages for the class space.
   bool large_pages = false;
 
-  ReservedSpace metaspace_rs = ReservedSpace(class_metaspace_size(),
+  ReservedSpace metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                              _reserve_alignment,
                                              large_pages,
                                              requested_addr, 0);
@@ -2906,7 +2916,7 @@
       while (!metaspace_rs.is_reserved() && (addr + increment > addr) &&
              can_use_cds_with_metaspace_addr(addr + increment, cds_base)) {
         addr = addr + increment;
-        metaspace_rs = ReservedSpace(class_metaspace_size(),
+        metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                      _reserve_alignment, large_pages, addr, 0);
       }
     }
@@ -2917,11 +2927,11 @@
     // initialization has happened that depends on UseCompressedClassPointers.
     // So, UseCompressedClassPointers cannot be turned off at this point.
     if (!metaspace_rs.is_reserved()) {
-      metaspace_rs = ReservedSpace(class_metaspace_size(),
+      metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                    _reserve_alignment, large_pages);
       if (!metaspace_rs.is_reserved()) {
         vm_exit_during_initialization(err_msg("Could not allocate metaspace: %d bytes",
-                                              class_metaspace_size()));
+                                              compressed_class_space_size()));
       }
     }
   }
@@ -2943,8 +2953,8 @@
   if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
     gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT,
                             Universe::narrow_klass_base(), Universe::narrow_klass_shift());
-    gclog_or_tty->print_cr("Metaspace Size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT,
-                           class_metaspace_size(), metaspace_rs.base(), requested_addr);
+    gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT,
+                           compressed_class_space_size(), metaspace_rs.base(), requested_addr);
   }
 }
 
@@ -3010,7 +3020,7 @@
   MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, _commit_alignment);
 
   CompressedClassSpaceSize = restricted_align_down(CompressedClassSpaceSize, _reserve_alignment);
-  set_class_metaspace_size(CompressedClassSpaceSize);
+  set_compressed_class_space_size(CompressedClassSpaceSize);
 }
 
 void Metaspace::global_initialize() {
@@ -3039,12 +3049,12 @@
     }
 
 #ifdef _LP64
-    if (cds_total + class_metaspace_size() > (uint64_t)max_juint) {
+    if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
       vm_exit_during_initialization("Unable to dump shared archive.",
           err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space ("
                   SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed "
-                  "klass limit: " SIZE_FORMAT, cds_total, class_metaspace_size(),
-                  cds_total + class_metaspace_size(), (size_t)max_juint));
+                  "klass limit: " SIZE_FORMAT, cds_total, compressed_class_space_size(),
+                  cds_total + compressed_class_space_size(), UnscaledClassSpaceMax));
     }
 
     // Set the compressed klass pointer base so that decoding of these pointers works
@@ -3092,7 +3102,8 @@
         cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment);
         allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
       } else {
-        allocate_metaspace_compressed_klass_ptrs((char *)CompressedKlassPointersBase, 0);
+        char* base = (char*)align_ptr_up(Universe::heap()->reserved_region().end(), _reserve_alignment);
+        allocate_metaspace_compressed_klass_ptrs(base, 0);
       }
     }
 #endif
@@ -3354,6 +3365,11 @@
   return result;
 }
 
+size_t Metaspace::class_chunk_size(size_t word_size) {
+  assert(using_class_space(), "Has to use class space");
+  return class_vsm()->calc_chunk_size(word_size);
+}
+
 void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetadataType mdtype, TRAPS) {
   // If result is still null, we are out of memory.
   if (Verbose && TraceMetadataChunkAllocation) {
@@ -3365,9 +3381,19 @@
     MetaspaceAux::dump(gclog_or_tty);
   }
 
+  bool out_of_compressed_class_space = false;
+  if (is_class_space_allocation(mdtype)) {
+    Metaspace* metaspace = loader_data->metaspace_non_null();
+    out_of_compressed_class_space =
+      MetaspaceAux::committed_bytes(Metaspace::ClassType) +
+      (metaspace->class_chunk_size(word_size) * BytesPerWord) >
+      CompressedClassSpaceSize;
+  }
+
   // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
-  const char* space_string = is_class_space_allocation(mdtype) ? "Compressed class space" :
-                                                                 "Metadata space";
+  const char* space_string = out_of_compressed_class_space ?
+    "Compressed class space" : "Metaspace";
+
   report_java_out_of_memory(space_string);
 
   if (JvmtiExport::should_post_resource_exhausted()) {
@@ -3380,7 +3406,7 @@
     vm_exit_during_initialization("OutOfMemoryError", space_string);
   }
 
-  if (is_class_space_allocation(mdtype)) {
+  if (out_of_compressed_class_space) {
     THROW_OOP(Universe::out_of_memory_error_class_metaspace());
   } else {
     THROW_OOP(Universe::out_of_memory_error_metaspace());
--- a/hotspot/src/share/vm/memory/metaspace.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -115,13 +115,13 @@
   static size_t align_word_size_up(size_t);
 
   // Aligned size of the metaspace.
-  static size_t _class_metaspace_size;
+  static size_t _compressed_class_space_size;
 
-  static size_t class_metaspace_size() {
-    return _class_metaspace_size;
+  static size_t compressed_class_space_size() {
+    return _compressed_class_space_size;
   }
-  static void set_class_metaspace_size(size_t metaspace_size) {
-    _class_metaspace_size = metaspace_size;
+  static void set_compressed_class_space_size(size_t size) {
+    _compressed_class_space_size = size;
   }
 
   static size_t _first_chunk_word_size;
@@ -192,6 +192,8 @@
   AllocRecord * _alloc_record_head;
   AllocRecord * _alloc_record_tail;
 
+  size_t class_chunk_size(size_t word_size);
+
  public:
 
   Metaspace(Mutex* lock, MetaspaceType type);
@@ -252,6 +254,7 @@
   static bool is_class_space_allocation(MetadataType mdType) {
     return mdType == ClassType && using_class_space();
   }
+
 };
 
 class MetaspaceAux : AllStatic {
--- a/hotspot/src/share/vm/memory/universe.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/memory/universe.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -677,13 +677,13 @@
 // HeapBased - Use compressed oops with heap base + encoding.
 
 // 4Gb
-static const uint64_t NarrowOopHeapMax = (uint64_t(max_juint) + 1);
+static const uint64_t UnscaledOopHeapMax = (uint64_t(max_juint) + 1);
 // 32Gb
-// OopEncodingHeapMax == NarrowOopHeapMax << LogMinObjAlignmentInBytes;
+// OopEncodingHeapMax == UnscaledOopHeapMax << LogMinObjAlignmentInBytes;
 
 char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_OOP_MODE mode) {
   assert(is_size_aligned((size_t)OopEncodingHeapMax, alignment), "Must be");
-  assert(is_size_aligned((size_t)NarrowOopHeapMax, alignment), "Must be");
+  assert(is_size_aligned((size_t)UnscaledOopHeapMax, alignment), "Must be");
   assert(is_size_aligned(heap_size, alignment), "Must be");
 
   uintx heap_base_min_address_aligned = align_size_up(HeapBaseMinAddress, alignment);
@@ -702,20 +702,40 @@
     // If the total size is small enough to allow UnscaledNarrowOop then
     // just use UnscaledNarrowOop.
     } else if ((total_size <= OopEncodingHeapMax) && (mode != HeapBasedNarrowOop)) {
-      if ((total_size <= NarrowOopHeapMax) && (mode == UnscaledNarrowOop) &&
+      if ((total_size <= UnscaledOopHeapMax) && (mode == UnscaledNarrowOop) &&
           (Universe::narrow_oop_shift() == 0)) {
         // Use 32-bits oops without encoding and
         // place heap's top on the 4Gb boundary
-        base = (NarrowOopHeapMax - heap_size);
+        base = (UnscaledOopHeapMax - heap_size);
       } else {
         // Can't reserve with NarrowOopShift == 0
         Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
+
         if (mode == UnscaledNarrowOop ||
-            mode == ZeroBasedNarrowOop && total_size <= NarrowOopHeapMax) {
+            mode == ZeroBasedNarrowOop && total_size <= UnscaledOopHeapMax) {
+
           // Use zero based compressed oops with encoding and
           // place heap's top on the 32Gb boundary in case
           // total_size > 4Gb or failed to reserve below 4Gb.
-          base = (OopEncodingHeapMax - heap_size);
+          uint64_t heap_top = OopEncodingHeapMax;
+
+          // For small heaps, save some space for compressed class pointer
+          // space so it can be decoded with no base.
+          if (UseCompressedClassPointers && !UseSharedSpaces &&
+              OopEncodingHeapMax <= 32*G) {
+
+            uint64_t class_space = align_size_up(CompressedClassSpaceSize, alignment);
+            assert(is_size_aligned((size_t)OopEncodingHeapMax-class_space,
+                   alignment), "difference must be aligned too");
+            uint64_t new_top = OopEncodingHeapMax-class_space;
+
+            if (total_size <= new_top) {
+              heap_top = new_top;
+            }
+          }
+
+          // Align base to the adjusted top of the heap
+          base = heap_top - heap_size;
         }
       }
     } else {
@@ -737,7 +757,7 @@
       // Set to a non-NULL value so the ReservedSpace ctor computes
       // the correct no-access prefix.
       // The final value will be set in initialize_heap() below.
-      Universe::set_narrow_oop_base((address)NarrowOopHeapMax);
+      Universe::set_narrow_oop_base((address)UnscaledOopHeapMax);
 #ifdef _WIN64
       if (UseLargePages) {
         // Cannot allocate guard pages for implicit checks in indexed
@@ -833,7 +853,7 @@
         Universe::set_narrow_oop_use_implicit_null_checks(true);
       }
 #endif //  _WIN64
-      if((uint64_t)Universe::heap()->reserved_region().end() > NarrowOopHeapMax) {
+      if((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) {
         // Can't reserve heap below 4Gb.
         Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
       } else {
@@ -1029,7 +1049,7 @@
     Handle msg = java_lang_String::create_from_str("Java heap space", CHECK_false);
     java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg());
 
-    msg = java_lang_String::create_from_str("Metadata space", CHECK_false);
+    msg = java_lang_String::create_from_str("Metaspace", CHECK_false);
     java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg());
     msg = java_lang_String::create_from_str("Compressed class space", CHECK_false);
     java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg());
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -2393,15 +2393,38 @@
 
 
 const char* InstanceKlass::signature_name() const {
+  int hash_len = 0;
+  char hash_buf[40];
+
+  // If this is an anonymous class, append a hash to make the name unique
+  if (is_anonymous()) {
+    assert(EnableInvokeDynamic, "EnableInvokeDynamic was not set.");
+    intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
+    sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
+    hash_len = (int)strlen(hash_buf);
+  }
+
+  // Get the internal name as a c string
   const char* src = (const char*) (name()->as_C_string());
   const int src_length = (int)strlen(src);
-  char* dest = NEW_RESOURCE_ARRAY(char, src_length + 3);
-  int src_index = 0;
+
+  char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3);
+
+  // Add L as type indicator
   int dest_index = 0;
   dest[dest_index++] = 'L';
-  while (src_index < src_length) {
+
+  // Add the actual class name
+  for (int src_index = 0; src_index < src_length; ) {
     dest[dest_index++] = src[src_index++];
   }
+
+  // If we have a hash, append it
+  for (int hash_index = 0; hash_index < hash_len; ) {
+    dest[dest_index++] = hash_buf[hash_index++];
+  }
+
+  // Add the semicolon and the NULL
   dest[dest_index++] = ';';
   dest[dest_index] = '\0';
   return dest;
--- a/hotspot/src/share/vm/oops/method.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/oops/method.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -1515,7 +1515,10 @@
       return bp->orig_bytecode();
     }
   }
-  ShouldNotReachHere();
+  {
+    ResourceMark rm;
+    fatal(err_msg("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci));
+  }
   return Bytecodes::_shouldnotreachhere;
 }
 
--- a/hotspot/src/share/vm/opto/library_call.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -2006,9 +2006,9 @@
   Node* arg2 = NULL;
 
   if (is_increment) {
-      arg2 = intcon(1);
+    arg2 = intcon(1);
   } else {
-      arg2 = argument(1);
+    arg2 = argument(1);
   }
 
   Node* add = _gvn.transform( new(C) AddExactINode(NULL, arg1, arg2) );
@@ -2056,7 +2056,7 @@
   if (is_decrement) {
     arg2 = longcon(1);
   } else {
-    Node* arg2 = argument(2); // type long
+    arg2 = argument(2); // type long
     // argument(3) == TOP
   }
 
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -713,6 +713,10 @@
       case Op_ModL: body_size += 30; break;
       case Op_DivL: body_size += 30; break;
       case Op_MulL: body_size += 10; break;
+      case Op_FlagsProj:
+        // Can't handle unrolling of loops containing
+        // nodes that generate a FlagsProj at the moment
+        return false;
       case Op_StrComp:
       case Op_StrEquals:
       case Op_StrIndexOf:
--- a/hotspot/src/share/vm/opto/postaloc.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/opto/postaloc.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -97,7 +97,8 @@
 static bool expected_yanked_node(Node *old, Node *orig_old) {
   // This code is expected only next original nodes:
   // - load from constant table node which may have next data input nodes:
-  //     MachConstantBase, Phi, MachTemp, MachSpillCopy
+  //     MachConstantBase, MachTemp, MachSpillCopy
+  // - Phi nodes that are considered Junk
   // - load constant node which may have next data input nodes:
   //     MachTemp, MachSpillCopy
   // - MachSpillCopy
@@ -112,7 +113,9 @@
     return (old == orig_old);
   } else if (old->is_MachTemp()) {
     return orig_old->is_Con();
-  } else if (old->is_Phi() || old->is_MachConstantBase()) {
+  } else if (old->is_Phi()) { // Junk phi's
+    return true;
+  } else if (old->is_MachConstantBase()) {
     return (orig_old->is_Con() && orig_old->is_MachConstant());
   }
   return false;
@@ -522,11 +525,9 @@
           u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input
       }
       if (u != NodeSentinel) {    // Junk Phi.  Remove
-        block->remove_node(j--);
+        phi->replace_by(u);
+        j -= yank_if_dead(phi, block, &value, &regnd);
         phi_dex--;
-        _cfg.unmap_node_from_block(phi);
-        phi->replace_by(u);
-        phi->disconnect_inputs(NULL, C);
         continue;
       }
       // Note that if value[pidx] exists, then we merged no new values here
--- a/hotspot/src/share/vm/opto/type.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/opto/type.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -2787,13 +2787,11 @@
 
 //-----------------------------filter------------------------------------------
 // Do not allow interface-vs.-noninterface joins to collapse to top.
-const Type *TypeOopPtr::filter( const Type *kills ) const {
+const Type *TypeOopPtr::filter(const Type *kills) const {
 
   const Type* ft = join(kills);
   const TypeInstPtr* ftip = ft->isa_instptr();
   const TypeInstPtr* ktip = kills->isa_instptr();
-  const TypeKlassPtr* ftkp = ft->isa_klassptr();
-  const TypeKlassPtr* ktkp = kills->isa_klassptr();
 
   if (ft->empty()) {
     // Check for evil case of 'this' being a class and 'kills' expecting an
@@ -2807,8 +2805,6 @@
     // uplift the type.
     if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface())
       return kills;             // Uplift to interface
-    if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
-      return kills;             // Uplift to interface
 
     return Type::TOP;           // Canonical empty value
   }
@@ -2825,14 +2821,6 @@
     assert(!ftip->klass_is_exact(), "interface could not be exact");
     return ktip->cast_to_ptr_type(ftip->ptr());
   }
-  // Interface klass type could be exact in opposite to interface type,
-  // return it here instead of incorrect Constant ptr J/L/Object (6894807).
-  if (ftkp != NULL && ktkp != NULL &&
-      ftkp->is_loaded() &&  ftkp->klass()->is_interface() &&
-      !ftkp->klass_is_exact() && // Keep exact interface klass
-      ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
-    return ktkp->cast_to_ptr_type(ftkp->ptr());
-  }
 
   return ft;
 }
@@ -4385,6 +4373,33 @@
   return (_offset == 0) && !below_centerline(_ptr);
 }
 
+// Do not allow interface-vs.-noninterface joins to collapse to top.
+const Type *TypeKlassPtr::filter(const Type *kills) const {
+  // logic here mirrors the one from TypeOopPtr::filter. See comments
+  // there.
+  const Type* ft = join(kills);
+  const TypeKlassPtr* ftkp = ft->isa_klassptr();
+  const TypeKlassPtr* ktkp = kills->isa_klassptr();
+
+  if (ft->empty()) {
+    if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
+      return kills;             // Uplift to interface
+
+    return Type::TOP;           // Canonical empty value
+  }
+
+  // Interface klass type could be exact in opposite to interface type,
+  // return it here instead of incorrect Constant ptr J/L/Object (6894807).
+  if (ftkp != NULL && ktkp != NULL &&
+      ftkp->is_loaded() &&  ftkp->klass()->is_interface() &&
+      !ftkp->klass_is_exact() && // Keep exact interface klass
+      ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
+    return ktkp->cast_to_ptr_type(ftkp->ptr());
+  }
+
+  return ft;
+}
+
 //----------------------compute_klass------------------------------------------
 // Compute the defining klass for this class
 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
--- a/hotspot/src/share/vm/opto/type.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/opto/type.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -63,7 +63,7 @@
 class     TypeOopPtr;
 class       TypeInstPtr;
 class       TypeAryPtr;
-class       TypeKlassPtr;
+class     TypeKlassPtr;
 class     TypeMetadataPtr;
 
 //------------------------------Type-------------------------------------------
@@ -1202,6 +1202,9 @@
 
   virtual intptr_t get_con() const;
 
+  // Do not allow interface-vs.-noninterface joins to collapse to top.
+  virtual const Type *filter( const Type *kills ) const;
+
   // Convenience common pre-built types.
   static const TypeKlassPtr* OBJECT; // Not-null object klass or below
   static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
--- a/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -29,8 +29,43 @@
 #include "runtime/thread.hpp"
 
 
+// The closure for GetLoadedClasses
+class LoadedClassesClosure : public KlassClosure {
+private:
+  Stack<jclass, mtInternal> _classStack;
+  JvmtiEnv* _env;
 
-// The closure for GetLoadedClasses and GetClassLoaderClasses
+public:
+  LoadedClassesClosure(JvmtiEnv* env) {
+    _env = env;
+  }
+
+  void do_klass(Klass* k) {
+    // Collect all jclasses
+    _classStack.push((jclass) _env->jni_reference(k->java_mirror()));
+  }
+
+  int extract(jclass* result_list) {
+    // The size of the Stack will be 0 after extract, so get it here
+    int count = (int)_classStack.size();
+    int i = count;
+
+    // Pop all jclasses, fill backwards
+    while (!_classStack.is_empty()) {
+      result_list[--i] = _classStack.pop();
+    }
+
+    // Return the number of elements written
+    return count;
+  }
+
+  // Return current size of the Stack
+  int get_count() {
+    return (int)_classStack.size();
+  }
+};
+
+// The closure for GetClassLoaderClasses
 class JvmtiGetLoadedClassesClosure : public StackObj {
   // Since the SystemDictionary::classes_do callback
   // doesn't pass a closureData pointer,
@@ -165,19 +200,6 @@
     }
   }
 
-  // Finally, the static methods that are the callbacks
-  static void increment(Klass* k) {
-    JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
-    if (that->get_initiatingLoader() == NULL) {
-      for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
-        that->set_count(that->get_count() + 1);
-      }
-    } else if (k != NULL) {
-      // if initiating loader not null, just include the instance with 1 dimension
-      that->set_count(that->get_count() + 1);
-    }
-  }
-
   static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) {
     JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
     oop class_loader = loader_data->class_loader();
@@ -196,24 +218,6 @@
     }
   }
 
-  static void add(Klass* k) {
-    JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
-    if (that->available()) {
-      if (that->get_initiatingLoader() == NULL) {
-        for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
-          oop mirror = l->java_mirror();
-          that->set_element(that->get_index(), mirror);
-          that->set_index(that->get_index() + 1);
-        }
-      } else if (k != NULL) {
-        // if initiating loader not null, just include the instance with 1 dimension
-        oop mirror = k->java_mirror();
-        that->set_element(that->get_index(), mirror);
-        that->set_index(that->get_index() + 1);
-      }
-    }
-  }
-
   static void add_with_loader(Klass* k, ClassLoaderData* loader_data) {
     JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
     if (that->available()) {
@@ -255,39 +259,30 @@
 
 jvmtiError
 JvmtiGetLoadedClasses::getLoadedClasses(JvmtiEnv *env, jint* classCountPtr, jclass** classesPtr) {
-  // Since SystemDictionary::classes_do only takes a function pointer
-  // and doesn't call back with a closure data pointer,
-  // we can only pass static methods.
 
-  JvmtiGetLoadedClassesClosure closure;
+  LoadedClassesClosure closure(env);
   {
     // To get a consistent list of classes we need MultiArray_lock to ensure
-    // array classes aren't created, and SystemDictionary_lock to ensure that
-    // classes aren't added to the system dictionary,
+    // array classes aren't created.
     MutexLocker ma(MultiArray_lock);
-    MutexLocker sd(SystemDictionary_lock);
+
+    // Iterate through all classes in ClassLoaderDataGraph
+    // and collect them using the LoadedClassesClosure
+    ClassLoaderDataGraph::loaded_classes_do(&closure);
+  }
 
-    // First, count the classes
-    SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::increment);
-    Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::increment);
-    // Next, fill in the classes
-    closure.allocate();
-    SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::add);
-    Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::add);
-    // Drop the SystemDictionary_lock, so the results could be wrong from here,
-    // but we still have a snapshot.
+  // Return results by extracting the collected contents into a list
+  // allocated via JvmtiEnv
+  jclass* result_list;
+  jvmtiError error = env->Allocate(closure.get_count() * sizeof(jclass),
+                               (unsigned char**)&result_list);
+
+  if (error == JVMTI_ERROR_NONE) {
+    int count = closure.extract(result_list);
+    *classCountPtr = count;
+    *classesPtr = result_list;
   }
-  // Post results
-  jclass* result_list;
-  jvmtiError err = env->Allocate(closure.get_count() * sizeof(jclass),
-                                 (unsigned char**)&result_list);
-  if (err != JVMTI_ERROR_NONE) {
-    return err;
-  }
-  closure.extract(env, result_list);
-  *classCountPtr = closure.get_count();
-  *classesPtr = result_list;
-  return JVMTI_ERROR_NONE;
+  return error;
 }
 
 jvmtiError
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -1988,6 +1988,15 @@
     warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
         "Use MaxRAMFraction instead.");
   }
+  if (FLAG_IS_CMDLINE(UseCMSCompactAtFullCollection)) {
+    warning("UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.");
+  }
+  if (FLAG_IS_CMDLINE(CMSFullGCsBeforeCompaction)) {
+    warning("CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.");
+  }
+  if (FLAG_IS_CMDLINE(UseCMSCollectionPassing)) {
+    warning("UseCMSCollectionPassing is deprecated and will likely be removed in a future release.");
+  }
 }
 
 // Check stack pages settings
--- a/hotspot/src/share/vm/runtime/handles.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -45,7 +45,7 @@
 oop* HandleArea::allocate_handle(oop obj) {
   assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
   assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark");
-  assert(obj->is_oop(), "sanity check");
+  assert(obj->is_oop(), err_msg("not an oop: " INTPTR_FORMAT, (intptr_t*) obj));
   return real_allocate_handle(obj);
 }
 
--- a/hotspot/src/share/vm/runtime/thread.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -1097,7 +1097,7 @@
 // General purpose hook into Java code, run once when the VM is initialized.
 // The Java library method itself may be changed independently from the VM.
 static void call_postVMInitHook(TRAPS) {
-  Klass* k = SystemDictionary::PostVMInitHook_klass();
+  Klass* k = SystemDictionary::resolve_or_null(vmSymbols::sun_misc_PostVMInitHook(), THREAD);
   instanceKlassHandle klass (THREAD, k);
   if (klass.not_null()) {
     JavaValue result(T_VOID);
--- a/hotspot/src/share/vm/services/jmm.h	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/services/jmm.h	Fri Nov 08 17:36:14 2013 -0800
@@ -78,6 +78,7 @@
   JMM_COMPILE_TOTAL_TIME_MS          = 8,    /* Total accumulated time spent in compilation */
   JMM_GC_TIME_MS                     = 9,    /* Total accumulated time spent in collection */
   JMM_GC_COUNT                       = 10,   /* Total number of collections */
+  JMM_JVM_UPTIME_MS                  = 11,   /* The JVM uptime in milliseconds */
 
   JMM_INTERNAL_ATTRIBUTE_INDEX       = 100,
   JMM_CLASS_LOADED_BYTES             = 101,  /* Number of bytes loaded instance classes */
--- a/hotspot/src/share/vm/services/management.cpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/services/management.cpp	Fri Nov 08 17:36:14 2013 -0800
@@ -1032,6 +1032,9 @@
   case JMM_JVM_INIT_DONE_TIME_MS:
     return Management::vm_init_done_time();
 
+  case JMM_JVM_UPTIME_MS:
+    return Management::ticks_to_ms(os::elapsed_counter());
+
   case JMM_COMPILE_TOTAL_TIME_MS:
     return Management::ticks_to_ms(CompileBroker::total_compilation_ticks());
 
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri Nov 08 17:36:14 2013 -0800
@@ -368,8 +368,6 @@
 // Klass encoding metaspace max size
 const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes;
 
-const jlong CompressedKlassPointersBase = NOT_LP64(0) LP64_ONLY(CONST64(0x800000000));  // 32*G
-
 // Machine dependent stuff
 
 #ifdef TARGET_ARCH_x86
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/inlining/InlineDefaultMethod.java	Fri Nov 08 17:36:14 2013 -0800
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8026735
+ * @summary CHA in C1 should make correct decisions about default methods
+ * @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod::test -XX:TieredStopAtLevel=1 InlineDefaultMethod
+ */
+
+
+interface InterfaceWithDefaultMethod0 {
+    default public int defaultMethod() {
+        return 1;
+    }
+}
+
+interface InterfaceWithDefaultMethod1 extends InterfaceWithDefaultMethod0 { }
+
+abstract class Subtype implements InterfaceWithDefaultMethod1 { }
+
+class Decoy extends Subtype {
+    public int defaultMethod() {
+        return 2;
+    }
+}
+
+class Instance extends Subtype { }
+
+public class InlineDefaultMethod {
+    public static int test(InterfaceWithDefaultMethod1 x) {
+        return x.defaultMethod();
+    }
+    public static void main(String[] args) {
+        InterfaceWithDefaultMethod1 a = new Decoy();
+        InterfaceWithDefaultMethod1 b = new Instance();
+        if (test(a) != 2 ||
+            test(b) != 1) {
+          System.err.println("FAILED");
+          System.exit(97);
+        }
+        System.err.println("PASSED");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java	Fri Nov 08 17:36:14 2013 -0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8027444
+ * @summary Test nested loops
+ * @compile NestedMathExactTest.java
+ * @run main NestedMathExactTest
+ *
+ */
+
+public class NestedMathExactTest {
+    public static final int LIMIT = 100;
+    public static int[] result = new int[LIMIT];
+    public static int value = 17;
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 100; ++i) {
+            result[i] = runTest();
+        }
+    }
+
+    public static int runTest() {
+        int sum = 0;
+        for (int j = 0; j < 100000; j = Math.addExact(j, 1)) {
+            sum = 1;
+            for (int i = 0; i < 5; ++i) {
+                sum *= value;
+            }
+        }
+        return sum;
+    }
+}
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java	Fri Nov 08 17:36:14 2013 -0800
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8026844
+ * @bug 8027353
  * @summary Test constant subtractExact
  * @compile SubExactLConstantTest.java Verify.java
  * @run main SubExactLConstantTest
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java	Fri Nov 08 17:36:14 2013 -0800
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8026844
+ * @bug 8027353
  * @summary Test non constant subtractExact
  * @compile SubExactLNonConstantTest.java Verify.java
  * @run main SubExactLNonConstantTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/startup/StartupOutput.java	Fri Nov 08 17:36:14 2013 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8026949
+ * @summary Test ensures correct VM output during startup
+ * @library ../../testlibrary
+ *
+ */
+import com.oracle.java.testlibrary.*;
+
+public class StartupOutput {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb;
+    OutputAnalyzer out;
+
+    pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
+    out = new OutputAnalyzer(pb.start());
+    out.shouldNotContain("no space to run compilers");
+
+    out.shouldHaveExitValue(0);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java	Fri Nov 08 17:36:14 2013 -0800
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2013, 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.
+*/
+
+/*
+* @test TestCMSForegroundFlags
+* @key gc
+* @bug 8027132
+* @summary Test that the deprecated CMS foreground collector flags print warning messages
+* @library /testlibrary
+* @run main TestCMSForegroundFlags -XX:-UseCMSCompactAtFullCollection UseCMSCompactAtFullCollection
+* @run main TestCMSForegroundFlags -XX:CMSFullGCsBeforeCompaction=4 CMSFullGCsBeforeCompaction
+* @run main TestCMSForegroundFlags -XX:-UseCMSCollectionPassing UseCMSCollectionPassing
+*/
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+public class TestCMSForegroundFlags {
+  public static void main(String[] args) throws Exception {
+    if (args.length != 2) {
+      throw new Exception("Expected two arguments,flagValue and flagName");
+    }
+    String flagValue = args[0];
+    String flagName = args[1];
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagValue, "-version");
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("warning: " + flagName + " is deprecated and will likely be removed in a future release.");
+    output.shouldNotContain("error");
+    output.shouldHaveExitValue(0);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java	Fri Nov 08 17:36:14 2013 -0800
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8026365
+ * @summary Test invokespecial of host class method from an anonymous class
+ * @author  Robert Field
+ * @library /testlibrary
+ * @compile -XDignore.symbol.file InvokeSpecialAnonTest.java
+ * @run main ClassFileInstaller InvokeSpecialAnonTest AnonTester
+ * @run main/othervm -Xbootclasspath/a:. -Xverify:all InvokeSpecialAnonTest
+ */
+import jdk.internal.org.objectweb.asm.*;
+import java.lang.reflect.Constructor;
+import sun.misc.Unsafe;
+
+public class InvokeSpecialAnonTest implements Opcodes {
+
+    static byte[] anonClassBytes() throws Exception {
+        ClassWriter cw = new ClassWriter(0);
+        MethodVisitor mv;
+
+        cw.visit(V1_8, ACC_FINAL + ACC_SUPER, "Anon", null, "java/lang/Object", null);
+
+        {
+            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(2, 2);
+            mv.visitEnd();
+        }
+        {
+            mv = cw.visitMethod(ACC_PUBLIC, "m", "(LInvokeSpecialAnonTest;)I", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitVarInsn(ALOAD, 1);
+            mv.visitMethodInsn(INVOKESPECIAL, "InvokeSpecialAnonTest", "privMethod", "()I");
+            mv.visitInsn(IRETURN);
+            mv.visitMaxs(2, 3);
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+
+        return cw.toByteArray();
+    }
+
+    private int privMethod() { return 1234; }
+
+    public static void main(String[] args) throws Exception {
+        Class<?> klass = InvokeSpecialAnonTest.class;
+        try {
+           Class<?> result = AnonTester.defineTest(klass, anonClassBytes());
+           System.out.println("Passed.");
+        } catch (Exception e) {
+           e.printStackTrace();
+           throw e;
+        }
+    }
+}
+
+
+class AnonTester {
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+
+    public static Class<?> defineTest(Class<?> targetClass, byte[] classBytes) throws Exception {
+        return UNSAFE.defineAnonymousClass(targetClass, classBytes, null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java	Fri Nov 08 17:36:14 2013 -0800
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8024927
+ * @summary Testing address of compressed class pointer space as best as possible.
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class CompressedClassPointers {
+
+    public static void smallHeapTest() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedBaseAddress=8g",
+            "-Xmx128m",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Narrow klass base: 0x0000000000000000");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void smallHeapTestWith3G() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:CompressedClassSpaceSize=3g",
+            "-Xmx128m",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Narrow klass base: 0x0000000000000000, Narrow klass shift: 3");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void largeHeapTest() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-Xmx30g",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("Narrow klass base: 0x0000000000000000");
+        output.shouldContain("Narrow klass shift: 0");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void largePagesTest() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-Xmx128m",
+            "-XX:+UseLargePages",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Narrow klass base:");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void sharingTest() throws Exception {
+        // Test small heaps
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedArchiveFile=./sample.jsa",
+            "-Xmx128m",
+            "-XX:SharedBaseAddress=8g",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC",
+            "-Xshare:dump");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        try {
+          output.shouldContain("Loading classes to share");
+          output.shouldHaveExitValue(0);
+
+          pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedArchiveFile=./sample.jsa",
+            "-Xmx128m",
+            "-XX:SharedBaseAddress=8g",
+            "-XX:+PrintCompressedOopsMode",
+            "-Xshare:on",
+            "-version");
+          output = new OutputAnalyzer(pb.start());
+          output.shouldContain("sharing");
+          output.shouldHaveExitValue(0);
+
+        } catch (RuntimeException e) {
+          output.shouldContain("Unable to use shared archive");
+          output.shouldHaveExitValue(1);
+        }
+    }
+
+  public static void main(String[] args) throws Exception {
+      if (!Platform.is64bit()) {
+          // Can't test this on 32 bit, just pass
+          System.out.println("Skipping test on 32bit");
+          return;
+      }
+      // Solaris 10 can't mmap compressed oops space without a base
+      if (Platform.isSolaris()) {
+           String name = System.getProperty("os.version");
+           if (name.equals("5.10")) {
+               System.out.println("Skipping test on Solaris 10");
+               return;
+           }
+      }
+      smallHeapTest();
+      smallHeapTestWith3G();
+      largeHeapTest();
+      largePagesTest();
+      sharingTest();
+  }
+}
--- a/jaxp/.hgtags	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/.hgtags	Fri Nov 08 17:36:14 2013 -0800
@@ -235,3 +235,4 @@
 17ee0d3e97fdb412e48f14d87f504946a708f846 jdk8-b111
 c1f9158fbb9c2da50f6946fffd974e8236e08447 jdk8-b112
 0046d2278204b7eff76803fc4623cb48c7e6384d jdk8-b113
+1b1e12117fe2840e5d21ae9a4b309e4f981f3ea8 jdk8-b114
--- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java	Fri Nov 08 17:36:14 2013 -0800
@@ -188,6 +188,19 @@
             ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager";
 
     /**
+     * Feature enableExtensionFunctions
+     */
+    public static final String ORACLE_ENABLE_EXTENSION_FUNCTION =
+            ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions";
+    public static final String SP_ORACLE_ENABLE_EXTENSION_FUNCTION = "javax.xml.enableExtensionFunctions";
+
+    /**
+     * Values for a feature
+     */
+    public static final String FEATURE_TRUE = "true";
+    public static final String FEATURE_FALSE = "false";
+
+    /**
      * Check if we're in jdk8 or above
      */
     public static final boolean IS_JDK8_OR_ABOVE = isJavaVersionAtLeast(8);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java	Fri Nov 08 17:36:14 2013 -0800
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2011, 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 com.sun.org.apache.xalan.internal.utils;
+
+
+import com.sun.org.apache.xalan.internal.XalanConstants;
+
+/**
+ * This class manages security related properties
+ *
+ */
+public final class FeatureManager extends FeaturePropertyBase {
+
+    /**
+     * States of the settings of a property, in the order: default value, value
+     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
+     * properties, and jaxp api properties
+     */
+    public static enum State {
+        //this order reflects the overriding order
+        DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
+    }
+
+    /**
+     * Xalan Features
+     */
+    public static enum Feature {
+        ORACLE_ENABLE_EXTENSION_FUNCTION(XalanConstants.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                "true");
+
+        final String name;
+        final String defaultValue;
+
+        Feature(String name, String value) {
+            this.name = name;
+            this.defaultValue = value;
+        }
+
+        public boolean equalsName(String propertyName) {
+            return (propertyName == null) ? false : name.equals(propertyName);
+        }
+
+        String defaultValue() {
+            return defaultValue;
+        }
+    }
+
+    /**
+     * Default constructor. Establishes default values
+     */
+    public FeatureManager() {
+        values = new String[Feature.values().length];
+        for (Feature feature : Feature.values()) {
+            values[feature.ordinal()] = feature.defaultValue();
+        }
+        //read system properties or jaxp.properties
+        readSystemProperties();
+    }
+
+
+    /**
+     * Check if the feature is enabled
+     * @param feature name of the feature
+     * @return true if enabled, false otherwise
+     */
+    public boolean isFeatureEnabled(Feature feature) {
+        return Boolean.parseBoolean(values[feature.ordinal()]);
+    }
+
+    /**
+     * Check if the feature is enabled
+     * @param propertyName name of the feature
+     * @return true if enabled, false otherwise
+     */
+    public boolean isFeatureEnabled(String propertyName) {
+        return Boolean.parseBoolean(values[getIndex(propertyName)]);
+    }
+
+    /**
+     * Get the index by property name
+     * @param propertyName property name
+     * @return the index of the property if found; return -1 if not
+     */
+    public int getIndex(String propertyName){
+        for (Feature feature : Feature.values()) {
+            if (feature.equalsName(propertyName)) {
+                return feature.ordinal();
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Read from system properties, or those in jaxp.properties
+     */
+    private void readSystemProperties() {
+        getSystemProperty(Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                XalanConstants.SP_ORACLE_ENABLE_EXTENSION_FUNCTION);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java	Fri Nov 08 17:36:14 2013 -0800
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2011, 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 com.sun.org.apache.xalan.internal.utils;
+
+import com.sun.org.apache.xalan.internal.XalanConstants;
+
+/**
+ * This is the base class for features and properties
+ *
+ */
+public abstract class FeaturePropertyBase {
+
+    /**
+     * States of the settings of a property, in the order: default value, value
+     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
+     * properties, and jaxp api properties
+     */
+    public static enum State {
+        //this order reflects the overriding order
+        DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
+    }
+
+
+    /**
+     * Values of the properties as defined in enum Properties
+     */
+    String[] values = null;
+    /**
+     * States of the settings for each property in Properties above
+     */
+    State[] states = {State.DEFAULT, State.DEFAULT};
+
+
+    /**
+     * Set the value for a specific property.
+     *
+     * @param property the property
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setValue(Enum property, State state, String value) {
+        //only update if it shall override
+        if (state.compareTo(states[property.ordinal()]) >= 0) {
+            values[property.ordinal()] = value;
+            states[property.ordinal()] = state;
+        }
+    }
+
+    /**
+     * Set the value of a property by its index
+     * @param index the index of the property
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setValue(int index, State state, String value) {
+        //only update if it shall override
+        if (state.compareTo(states[index]) >= 0) {
+            values[index] = value;
+            states[index] = state;
+        }
+    }
+
+     /**
+     * Set value by property name and state
+     * @param propertyName property name
+     * @param state the state of the property
+     * @param value the value of the property
+     * @return true if the property is managed by the security property manager;
+     *         false if otherwise.
+     */
+    public boolean setValue(String propertyName, State state, Object value) {
+        int index = getIndex(propertyName);
+        if (index > -1) {
+            setValue(index, state, (String)value);
+            return true;
+        }
+        return false;
+    }
+
+     /**
+     * Set value by property name and state
+     * @param propertyName property name
+     * @param state the state of the property
+     * @param value the value of the property
+     * @return true if the property is managed by the security property manager;
+     *         false if otherwise.
+     */
+    public boolean setValue(String propertyName, State state, boolean value) {
+        int index = getIndex(propertyName);
+        if (index > -1) {
+            if (value) {
+                setValue(index, state, XalanConstants.FEATURE_TRUE);
+            } else {
+                setValue(index, state, XalanConstants.FEATURE_FALSE);
+            }
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Return the value of the specified property
+     *
+     * @param property the property
+     * @return the value of the property
+     */
+    public String getValue(Enum property) {
+        return values[property.ordinal()];
+    }
+
+    /**
+     * Return the value of the specified property
+     *
+     * @param property the property
+     * @return the value of the property
+     */
+    public String getValue(String property) {
+        int index = getIndex(property);
+        if (index > -1) {
+            return getValueByIndex(index);
+        }
+        return null;
+    }
+
+    /**
+     * Return the value of the specified property.
+     *
+     * @param propertyName the property name
+     * @return the value of the property as a string. If a property is managed
+     * by this manager, its value shall not be null.
+     */
+    public String getValueAsString(String propertyName) {
+        int index = getIndex(propertyName);
+        if (index > -1) {
+            return getValueByIndex(index);
+        }
+
+        return null;
+    }
+
+    /**
+     * Return the value of a property by its ordinal
+     * @param index the index of a property
+     * @return value of a property
+     */
+    public String getValueByIndex(int index) {
+        return values[index];
+    }
+
+    /**
+     * Get the index by property name
+     * @param propertyName property name
+     * @return the index of the property if found; return -1 if not
+     */
+    public abstract int getIndex(String propertyName);
+
+    public <E extends Enum<E>> int getIndex(Class<E> property, String propertyName) {
+        for (Enum<E> enumItem : property.getEnumConstants()) {
+            if (enumItem.toString().equals(propertyName)) {
+                //internally, ordinal is used as index
+                return enumItem.ordinal();
+            }
+        }
+        return -1;
+    };
+
+
+    /**
+     * Read from system properties, or those in jaxp.properties
+     *
+     * @param property the property
+     * @param systemProperty the name of the system property
+     */
+    void getSystemProperty(Enum property, String systemProperty) {
+        try {
+            String value = SecuritySupport.getSystemProperty(systemProperty);
+            if (value != null) {
+                values[property.ordinal()] = value;
+                states[property.ordinal()] = State.SYSTEMPROPERTY;
+                return;
+            }
+
+            value = SecuritySupport.readJAXPProperty(systemProperty);
+            if (value != null) {
+                values[property.ordinal()] = value;
+                states[property.ordinal()] = State.JAXPDOTPROPERTIES;
+            }
+        } catch (NumberFormatException e) {
+            //invalid setting ignored
+        }
+    }
+}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java	Fri Nov 08 17:36:14 2013 -0800
@@ -1,42 +1,28 @@
 /*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
+ * 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.
  *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
+ * 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).
  *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
+ * 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 com.sun.org.apache.xalan.internal.utils;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java	Fri Nov 08 17:36:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -33,20 +33,10 @@
  * This class manages security related properties
  *
  */
-public final class XMLSecurityPropertyManager {
+public final class XMLSecurityPropertyManager extends FeaturePropertyBase {
 
     /**
-     * States of the settings of a property, in the order: default value, value
-     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
-     * properties, and jaxp api properties
-     */
-    public static enum State {
-        //this order reflects the overriding order
-        DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
-    }
-
-    /**
-     * Limits managed by the security manager
+     * Properties managed by the security property manager
      */
     public static enum Property {
         ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD,
@@ -73,15 +63,6 @@
 
 
     /**
-     * Values of the properties as defined in enum Properties
-     */
-    private final String[] values;
-    /**
-     * States of the settings for each property in Properties above
-     */
-    private State[] states = {State.DEFAULT, State.DEFAULT};
-
-    /**
      * Default constructor. Establishes default values
      */
     public XMLSecurityPropertyManager() {
@@ -94,86 +75,6 @@
     }
 
     /**
-     * Set limit by property name and state
-     * @param propertyName property name
-     * @param state the state of the property
-     * @param value the value of the property
-     * @return true if the property is managed by the security property manager;
-     *         false if otherwise.
-     */
-    public boolean setValue(String propertyName, State state, Object value) {
-        int index = getIndex(propertyName);
-        if (index > -1) {
-            setValue(index, state, (String)value);
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Set the value for a specific property.
-     *
-     * @param property the property
-     * @param state the state of the property
-     * @param value the value of the property
-     */
-    public void setValue(Property property, State state, String value) {
-        //only update if it shall override
-        if (state.compareTo(states[property.ordinal()]) >= 0) {
-            values[property.ordinal()] = value;
-            states[property.ordinal()] = state;
-        }
-    }
-
-    /**
-     * Set the value of a property by its index
-     * @param index the index of the property
-     * @param state the state of the property
-     * @param value the value of the property
-     */
-    public void setValue(int index, State state, String value) {
-        //only update if it shall override
-        if (state.compareTo(states[index]) >= 0) {
-            values[index] = value;
-            states[index] = state;
-        }
-    }
-
-    /**
-     * Return the value of the specified property
-     *
-     * @param propertyName the property name
-     * @return the value of the property as a string
-     */
-    public String getValue(String propertyName) {
-        int index = getIndex(propertyName);
-        if (index > -1) {
-            return getValueByIndex(index);
-        }
-
-        return null;
-    }
-
-    /**
-     * Return the value of the specified property
-     *
-     * @param property the property
-     * @return the value of the property
-     */
-    public String getValue(Property property) {
-        return values[property.ordinal()];
-    }
-
-    /**
-     * Return the value of a property by its ordinal
-     * @param index the index of a property
-     * @return value of a property
-     */
-    public String getValueByIndex(int index) {
-        return values[index];
-    }
-
-    /**
      * Get the index by property name
      * @param propertyName property name
      * @return the index of the property if found; return -1 if not
@@ -198,28 +99,4 @@
                 XalanConstants.SP_ACCESS_EXTERNAL_STYLESHEET);
     }
 
-    /**
-     * Read from system properties, or those in jaxp.properties
-     *
-     * @param property the property
-     * @param systemProperty the name of the system property
-     */
-    private void getSystemProperty(Property property, String systemProperty) {
-        try {
-            String value = SecuritySupport.getSystemProperty(systemProperty);
-            if (value != null) {
-                values[property.ordinal()] = value;
-                states[property.ordinal()] = State.SYSTEMPROPERTY;
-                return;
-            }
-
-            value = SecuritySupport.readJAXPProperty(systemProperty);
-            if (value != null) {
-                values[property.ordinal()] = value;
-                states[property.ordinal()] = State.JAXPDOTPROPERTIES;
-            }
-        } catch (NumberFormatException e) {
-            //invalid setting ignored
-        }
-    }
 }
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java	Fri Nov 08 17:36:14 2013 -0800
@@ -23,6 +23,7 @@
 
 package com.sun.org.apache.xalan.internal.xsltc.cmdline;
 
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import java.io.File;
 import java.net.URL;
 import java.util.Vector;
@@ -77,7 +78,7 @@
             final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv");
             if (args.length < 1) printUsage();
 
-            final XSLTC xsltc = new XSLTC(true);
+            final XSLTC xsltc = new XSLTC(true, new FeatureManager());
             xsltc.init();
 
             int c;
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Fri Nov 08 17:36:14 2013 -0800
@@ -42,6 +42,7 @@
 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
 import com.sun.org.apache.bcel.internal.generic.NEW;
 import com.sun.org.apache.bcel.internal.generic.PUSH;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@@ -717,6 +718,8 @@
         final ConstantPoolGen cpg = classGen.getConstantPool();
         final InstructionList il = methodGen.getInstructionList();
         final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing();
+        final boolean isExtensionFunctionEnabled = classGen.getParser().getXSLTC()
+                .getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
         int index;
 
         // Translate calls to methods in the BasisLibrary
@@ -760,7 +763,7 @@
             il.append(new INVOKESTATIC(index));
         }
         else if (_isExtConstructor) {
-            if (isSecureProcessing)
+            if (isSecureProcessing && !isExtensionFunctionEnabled)
                 translateUnallowedExtension(cpg, il);
 
             final String clazz =
@@ -822,7 +825,7 @@
         }
         // Invoke function calls that are handled in separate classes
         else {
-            if (isSecureProcessing)
+            if (isSecureProcessing && !isExtensionFunctionEnabled)
                 translateUnallowedExtension(cpg, il);
 
             final String clazz = _chosenMethod.getDeclaringClass().getName();
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	Fri Nov 08 17:36:14 2013 -0800
@@ -43,6 +43,8 @@
 
 import com.sun.org.apache.bcel.internal.classfile.JavaClass;
 import com.sun.org.apache.xalan.internal.XalanConstants;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager.Feature;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@@ -148,11 +150,14 @@
 
     private XMLSecurityManager _xmlSecurityManager;
 
+    private final FeatureManager _featureManager;
+
     /**
      * XSLTC compiler constructor
      */
-    public XSLTC(boolean useServicesMechanism) {
+    public XSLTC(boolean useServicesMechanism, FeatureManager featureManager) {
         _parser = new Parser(this, useServicesMechanism);
+        _featureManager = featureManager;
     }
 
     /**
@@ -182,6 +187,15 @@
         _useServicesMechanism = flag;
     }
 
+     /**
+     * Return the value of the specified feature
+     * @param name name of the feature
+     * @return true if the feature is enabled, false otherwise
+     */
+    public boolean getFeature(Feature name) {
+        return _featureManager.isFeatureEnabled(name);
+    }
+
     /**
      * Return allowed protocols for accessing external stylesheet.
      */
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java	Fri Nov 08 17:36:14 2013 -0800
@@ -74,12 +74,12 @@
             DocumentBuilderFactory.newInstance();
     private boolean _internal = true;
 
-    public SAX2DOM(boolean useServicesMachnism) throws ParserConfigurationException {
-        _document = createDocument(useServicesMachnism);
+    public SAX2DOM(boolean useServicesMechanism) throws ParserConfigurationException {
+        _document = createDocument(useServicesMechanism);
         _root = _document;
     }
 
-    public SAX2DOM(Node root, Node nextSibling, boolean useServicesMachnism) throws ParserConfigurationException {
+    public SAX2DOM(Node root, Node nextSibling, boolean useServicesMechanism) throws ParserConfigurationException {
         _root = root;
         if (root instanceof Document) {
           _document = (Document)root;
@@ -88,15 +88,15 @@
           _document = root.getOwnerDocument();
         }
         else {
-          _document = createDocument(useServicesMachnism);
+          _document = createDocument(useServicesMechanism);
           _root = _document;
         }
 
         _nextSibling = nextSibling;
     }
 
-    public SAX2DOM(Node root, boolean useServicesMachnism) throws ParserConfigurationException {
-        this(root, null, useServicesMachnism);
+    public SAX2DOM(Node root, boolean useServicesMechanism) throws ParserConfigurationException {
+        this(root, null, useServicesMechanism);
     }
 
     public Node getDOM() {
@@ -308,18 +308,19 @@
     public void startDTD(String name, String publicId, String systemId)
         throws SAXException {}
 
-    private Document createDocument(boolean useServicesMachnism) throws ParserConfigurationException {
+    private Document createDocument(boolean useServicesMechanism) throws ParserConfigurationException {
         if (_factory == null) {
-            if (useServicesMachnism)
+            if (useServicesMechanism) {
                 _factory = DocumentBuilderFactory.newInstance();
                 if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) {
                     _internal = false;
                 }
-            else
+            } else {
                 _factory = DocumentBuilderFactory.newInstance(
                   "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
                   SAX2DOM.class.getClassLoader()
                   );
+            }
         }
         Document doc;
         if (_internal) {
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java	Fri Nov 08 17:36:14 2013 -0800
@@ -95,7 +95,7 @@
         _tfactory = tfactory;
 
         // Instantiate XSLTC and get reference to parser object
-        XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism());
+        XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
         if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING))
             xsltc.setSecureProcessing(true);
 
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Fri Nov 08 17:36:14 2013 -0800
@@ -25,12 +25,14 @@
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
-import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.State;
+import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
@@ -227,6 +229,8 @@
     private XMLSecurityPropertyManager _xmlSecurityPropertyMgr;
     private XMLSecurityManager _xmlSecurityManager;
 
+    private final FeatureManager _featureManager;
+
     /**
      * javax.xml.transform.sax.TransformerFactory implementation.
      */
@@ -240,10 +244,13 @@
 
     private TransformerFactoryImpl(boolean useServicesMechanism) {
         this._useServicesMechanism = useServicesMechanism;
+        _featureManager = new FeatureManager();
 
         if (System.getSecurityManager() != null) {
             _isSecureMode = true;
             _isNotSecureProcessing = false;
+            _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                    FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
         }
 
         _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
@@ -504,6 +511,10 @@
                         Property.ACCESS_EXTERNAL_STYLESHEET);
             }
 
+            if (value && _featureManager != null) {
+                _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                        FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
+            }
             return;
         }
         else if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
@@ -512,6 +523,11 @@
                 _useServicesMechanism = value;
         }
         else {
+            if (_featureManager != null &&
+                    _featureManager.setValue(name, State.APIPROPERTY, value)) {
+                return;
+            }
+
             // unknown feature
             ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
             throw new TransformerConfigurationException(err.toString());
@@ -561,6 +577,13 @@
                 return !_isNotSecureProcessing;
         }
 
+        /** Check to see if the property is managed by the security manager **/
+        String propertyValue = (_featureManager != null) ?
+                _featureManager.getValueAsString(name) : null;
+        if (propertyValue != null) {
+            return Boolean.parseBoolean(propertyValue);
+        }
+
         // Feature not supported
         return false;
     }
@@ -571,6 +594,13 @@
         return _useServicesMechanism;
     }
 
+     /**
+     * @return the feature manager
+     */
+    public FeatureManager getFeatureManager() {
+        return _featureManager;
+    }
+
     /**
      * javax.xml.transform.sax.TransformerFactory implementation.
      * Get the object that is used by default during the transformation to
@@ -857,7 +887,7 @@
         }
 
         // Create and initialize a stylesheet compiler
-        final XSLTC xsltc = new XSLTC(_useServicesMechanism);
+        final XSLTC xsltc = new XSLTC(_useServicesMechanism, _featureManager);
         if (_debug) xsltc.setDebug(true);
         if (_enableInlining)
                 xsltc.setTemplateInlining(true);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Fri Nov 08 17:36:14 2013 -0800
@@ -569,32 +569,13 @@
 
         // xerces features
         fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
-
         fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
-        fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
-
-        fElementAttributeLimit = (fSecurityManager != null)?
-                fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0;
-
         fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);
 
         Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
         fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
                 (ExternalSubsetResolver) resolver : null;
 
-        // initialize vars
-        fMarkupDepth = 0;
-        fCurrentElement = null;
-        fElementStack.clear();
-        fHasExternalDTD = false;
-        fStandaloneSet = false;
-        fStandalone = false;
-        fInScanContent = false;
-        //skipping algorithm
-        fShouldSkip = false;
-        fAdd = false;
-        fSkip = false;
-
         //attribute
         fReadingAttributes = false;
         //xxx: external entities are supported in Xerces
@@ -606,9 +587,6 @@
         // setup Driver
         setScannerState(SCANNER_STATE_CONTENT);
         setDriver(fContentDriver);
-        fEntityStore = fEntityManager.getEntityStore();
-
-        dtdGrammarUtil = null;
 
         // JAXP 1.5 features and properties
         XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
@@ -617,6 +595,7 @@
 
         fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);
 
+        resetCommon();
         //fEntityManager.test();
     } // reset(XMLComponentManager)
 
@@ -630,17 +609,7 @@
         fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
         fNotifyBuiltInRefs = false ;
 
-        // initialize vars
-        fMarkupDepth = 0;
-        fCurrentElement = null;
-        fShouldSkip = false;
-        fAdd = false;
-        fSkip = false;
-        fElementStack.clear();
         //fElementStack2.clear();
-        fHasExternalDTD = false;
-        fStandaloneSet = false;
-        fStandalone = false;
         //fReplaceEntityReferences = true;
         //fSupportExternalEntities = true;
         Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactoryImpl.IS_REPLACING_ENTITY_REFERENCES);
@@ -661,20 +630,43 @@
         //we dont need to do this -- nb.
         //setScannerState(SCANNER_STATE_CONTENT);
         //setDriver(fContentDriver);
-        fEntityStore = fEntityManager.getEntityStore();
         //fEntityManager.test();
 
-        dtdGrammarUtil = null;
-
          // JAXP 1.5 features and properties
         XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
                 propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
         fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
 
         fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER);
-        fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+        resetCommon();
     } // reset(XMLComponentManager)
 
+    void resetCommon() {
+        // initialize vars
+        fMarkupDepth = 0;
+        fCurrentElement = null;
+        fElementStack.clear();
+        fHasExternalDTD = false;
+        fStandaloneSet = false;
+        fStandalone = false;
+        fInScanContent = false;
+        //skipping algorithm
+        fShouldSkip = false;
+        fAdd = false;
+        fSkip = false;
+
+        fEntityStore = fEntityManager.getEntityStore();
+        dtdGrammarUtil = null;
+
+        if (fSecurityManager != null) {
+            fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+            fElementAttributeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT);
+        } else {
+            fLimitAnalyzer = null;
+            fElementAttributeLimit = 0;
+        }
+    }
+
     /**
      * Returns a list of feature identifiers that are recognized by
      * this component. This method may return null if no features
@@ -1328,7 +1320,7 @@
                         fAttributes.getLength() > fElementAttributeLimit){
                     fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                  "ElementAttributeLimit",
-                                                 new Object[]{rawname, new Integer(fAttributes.getLength()) },
+                                                 new Object[]{rawname, fElementAttributeLimit },
                                                  XMLErrorReporter.SEVERITY_FATAL_ERROR );
                 }
 
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Fri Nov 08 17:36:14 2013 -0800
@@ -256,7 +256,7 @@
                         fAttributes.getLength() > fElementAttributeLimit){
                     fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                  "ElementAttributeLimit",
-                                                 new Object[]{rawname, new Integer(fAttributes.getLength()) },
+                                                 new Object[]{rawname, fElementAttributeLimit },
                                                  XMLErrorReporter.SEVERITY_FATAL_ERROR );
                 }
 
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	Fri Nov 08 17:36:14 2013 -0800
@@ -211,7 +211,7 @@
         if (i > 0) {
             return uri.substring(i+1, uri.length());
         }
-        return "";
+        return uri;
     }
 
     /**
--- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java	Fri Nov 08 17:36:14 2013 -0800
@@ -33,6 +33,7 @@
 import com.sun.org.apache.xpath.internal.objects.XNodeSet;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
 import com.sun.org.apache.xpath.internal.functions.FuncExtFunction;
 import java.util.Vector;
@@ -54,9 +55,12 @@
     }
 
     public JAXPExtensionsProvider(XPathFunctionResolver resolver,
-        boolean featureSecureProcessing ) {
+        boolean featureSecureProcessing, FeatureManager featureManager ) {
         this.resolver = resolver;
-        this.extensionInvocationDisabled = featureSecureProcessing;
+        if (featureSecureProcessing &&
+                !featureManager.isFeatureEnabled(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION)) {
+            this.extensionInvocationDisabled = true;
+        }
     }
 
     /**
--- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java	Fri Nov 08 17:36:14 2013 -0800
@@ -30,6 +30,7 @@
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
@@ -67,33 +68,36 @@
     private boolean featureSecureProcessing = false;
 
     private boolean useServicesMechanism = true;
+
+    private final FeatureManager featureManager;
+
     /** Protected constructor to prevent direct instantiation; use compile()
      * from the context.
      */
-    protected XPathExpressionImpl() { };
+    protected XPathExpressionImpl() {
+        this(null, null, null, null,
+             false, true, new FeatureManager());
+    };
 
     protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
             JAXPPrefixResolver prefixResolver,
             XPathFunctionResolver functionResolver,
             XPathVariableResolver variableResolver ) {
-        this.xpath = xpath;
-        this.prefixResolver = prefixResolver;
-        this.functionResolver = functionResolver;
-        this.variableResolver = variableResolver;
-        this.featureSecureProcessing = false;
+        this(xpath, prefixResolver, functionResolver, variableResolver,
+             false, true, new FeatureManager());
     };
 
     protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
-            JAXPPrefixResolver prefixResolver,
-            XPathFunctionResolver functionResolver,
-            XPathVariableResolver variableResolver,
-            boolean featureSecureProcessing, boolean useServicesMechanism ) {
+            JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
+            XPathVariableResolver variableResolver, boolean featureSecureProcessing,
+            boolean useServicesMechanism, FeatureManager featureManager ) {
         this.xpath = xpath;
         this.prefixResolver = prefixResolver;
         this.functionResolver = functionResolver;
         this.variableResolver = variableResolver;
         this.featureSecureProcessing = featureSecureProcessing;
         this.useServicesMechanism = useServicesMechanism;
+        this.featureManager = featureManager;
     };
 
     public void setXPath (com.sun.org.apache.xpath.internal.XPath xpath ) {
@@ -111,7 +115,7 @@
         com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
         if ( functionResolver != null ) {
             JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
-                    functionResolver, featureSecureProcessing );
+                    functionResolver, featureSecureProcessing, featureManager );
             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
         } else {
             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
--- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Fri Nov 08 17:36:14 2013 -0800
@@ -24,6 +24,8 @@
 import com.sun.org.apache.xalan.internal.XalanConstants;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
 
 import javax.xml.XMLConstants;
 import javax.xml.xpath.XPathFactory;
@@ -68,6 +70,8 @@
 
         private boolean _useServicesMechanism = true;
 
+        private final FeatureManager _featureManager;
+
         public XPathFactoryImpl() {
             this(true);
         }
@@ -77,9 +81,12 @@
         }
 
         public XPathFactoryImpl(boolean useServicesMechanism) {
+            _featureManager = new FeatureManager();
             if (System.getSecurityManager() != null) {
                 _isSecureMode = true;
                 _isNotSecureProcessing = false;
+                _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                        FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
             }
             this._useServicesMechanism = useServicesMechanism;
         }
@@ -131,7 +138,8 @@
         public javax.xml.xpath.XPath newXPath() {
             return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl(
                     xPathVariableResolver, xPathFunctionResolver,
-                    !_isNotSecureProcessing, _useServicesMechanism );
+                    !_isNotSecureProcessing, _useServicesMechanism,
+                    _featureManager );
         }
 
         /**
@@ -181,6 +189,10 @@
                 }
 
                 _isNotSecureProcessing = !value;
+                if (value && _featureManager != null) {
+                    _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                            FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
+                }
 
                 // all done processing feature
                 return;
@@ -192,6 +204,11 @@
                 return;
             }
 
+            if (_featureManager != null &&
+                    _featureManager.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
+                return;
+            }
+
             // unknown feature
             String fmsg = XSLMessages.createXPATHMessage(
                     XPATHErrorResources.ER_FEATURE_UNKNOWN,
@@ -240,6 +257,14 @@
             if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
                 return _useServicesMechanism;
             }
+
+            /** Check to see if the property is managed by the security manager **/
+            String propertyValue = (_featureManager != null) ?
+                    _featureManager.getValueAsString(name) : null;
+            if (propertyValue != null) {
+                return _featureManager.isFeatureEnabled(name);
+            }
+
             // unknown feature
             String fmsg = XSLMessages.createXPATHMessage(
                     XPATHErrorResources.ER_GETTING_UNKNOWN_FEATURE,
--- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java	Fri Nov 08 17:36:14 2013 -0800
@@ -35,6 +35,7 @@
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
 import org.w3c.dom.Node;
 import org.w3c.dom.Document;
@@ -70,18 +71,20 @@
     // extensions function need to throw XPathFunctionException
     private boolean featureSecureProcessing = false;
     private boolean useServiceMechanism = true;
+    private final FeatureManager featureManager;
 
     XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr ) {
-        this.origVariableResolver = this.variableResolver = vr;
-        this.origFunctionResolver = this.functionResolver = fr;
+        this(vr, fr, false, true, new FeatureManager());
     }
 
     XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
-            boolean featureSecureProcessing, boolean useServiceMechanism ) {
+            boolean featureSecureProcessing, boolean useServiceMechanism,
+            FeatureManager featureManager) {
         this.origVariableResolver = this.variableResolver = vr;
         this.origFunctionResolver = this.functionResolver = fr;
         this.featureSecureProcessing = featureSecureProcessing;
         this.useServiceMechanism = useServiceMechanism;
+        this.featureManager = featureManager;
     }
 
     /**
@@ -190,7 +193,7 @@
         com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
         if ( functionResolver != null ) {
             JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
-                    functionResolver, featureSecureProcessing );
+                    functionResolver, featureSecureProcessing, featureManager );
             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
         } else {
             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
@@ -391,7 +394,7 @@
             // Can have errorListener
             XPathExpressionImpl ximpl = new XPathExpressionImpl (xpath,
                     prefixResolver, functionResolver, variableResolver,
-                    featureSecureProcessing, useServiceMechanism );
+                    featureSecureProcessing, useServiceMechanism, featureManager );
             return ximpl;
         } catch ( javax.xml.transform.TransformerException te ) {
             throw new XPathExpressionException ( te ) ;
--- a/jaxws/.hgtags	Fri Nov 08 17:50:24 2013 -0500
+++ b/jaxws/.hgtags	Fri Nov 08 17:36:14 2013 -0800
@@ -235,3 +235,4 @@
 32edc7a2c86696dfcbdb6ffae641ff153f8e34bd jdk8-b111
 dbdd5c76250928582cb5342bcf7b299a6007d538 jdk8-b112
 9261f342aa73a79bbd1a817ae72fa72b15ef30bc jdk8-b113
+9ad289610fc6effe9076280b7920d0f16470709f jdk8-b114
--- a/jdk/.hgtags	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/.hgtags	Fri Nov 08 17:36:14 2013 -0800
@@ -235,3 +235,5 @@
 719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111
 f002f5f3a16cca62e139cb8eed05ffaeb373587d jdk8-b112
 5b4261b4b72af53e8e178933ef6bc6c7f8cdbc60 jdk8-b113
+f26a0c8071bde1e3b923713c75156e4a58955623 jdk8-b114
+f82b730c798b6bf38946baaba8a7d80fd5efaa70 jdk8-b115
--- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m	Fri Nov 08 17:36:14 2013 -0800
@@ -163,7 +163,7 @@
     if ([[jvmInfo objectForKey:@"StartOnFirstThread"] boolValue]) {
         self.startOnFirstThread = YES;
     } else if ([[jvmInfo objectForKey:@"StartOnMainThread"] boolValue]) {
-        // for key compatability with the Apple JavaApplicationStub's 'Java' dictionary
+        // for key compatibility with the Apple JavaApplicationStub's 'Java' dictionary
         self.startOnFirstThread = YES;
     }
 
--- a/jdk/src/macosx/classes/com/apple/eawt/event/package.html	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/com/apple/eawt/event/package.html	Fri Nov 08 17:36:14 2013 -0800
@@ -1,5 +1,7 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
+<title></title>
 </head>
 <body bgcolor="white">
 Classes for receiving gesture events.
--- a/jdk/src/macosx/classes/com/apple/eawt/package.html	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/com/apple/eawt/package.html	Fri Nov 08 17:36:14 2013 -0800
@@ -1,5 +1,7 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
+<title></title>
 </head>
 <body bgcolor="white">
 Provides classes for integrating Java applications with the native application environment.
--- a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java	Fri Nov 08 17:36:14 2013 -0800
@@ -244,7 +244,7 @@
      * used for getting localized defaults.  Also initialize the default
      * locale used when no locale is passed into UIDefaults.get().  The
      * default locale should generally not be relied upon. It is here for
-     * compatability with releases prior to 1.4.
+     * compatibility with releases prior to 1.4.
      */
     private void initResourceBundle(final UIDefaults table) {
         table.setDefaultLocale(Locale.getDefault());
--- a/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java	Fri Nov 08 17:36:14 2013 -0800
@@ -406,7 +406,7 @@
     }
 
     /** Draw a string with the graphics g at location (x,y) just like g.drawString() would.
-     *  The first occurence of underlineChar in text will be underlined. The matching is
+     *  The first occurrence of underlineChar in text will be underlined. The matching is
      *  not case sensitive.
      */
     public void drawString(final Graphics g, final JComponent c, final String text, final int underlinedChar, final int x, final int y, final boolean isEnabled, final boolean isSelected) {
--- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Fri Nov 08 17:36:14 2013 -0800
@@ -3514,7 +3514,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class PropertyChangeHandler implements PropertyChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3528,7 +3528,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class TabSelectionHandler implements ChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3542,7 +3542,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class MouseHandler extends MouseAdapter {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3556,7 +3556,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class FocusHandler extends FocusAdapter {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java	Fri Nov 08 17:36:14 2013 -0800
@@ -179,7 +179,7 @@
     }
 
     /**
-     * Paints the expand (toggle) part of a row. The reciever should NOT modify <code>clipBounds</code>, or
+     * Paints the expand (toggle) part of a row. The receiver should NOT modify <code>clipBounds</code>, or
      * <code>insets</code>.
      */
     protected void paintExpandControl(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) {
--- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java	Fri Nov 08 17:36:14 2013 -0800
@@ -93,9 +93,9 @@
         }
 
         if (fMenuItem instanceof JCheckBoxMenuItem) {
-            setState(((JCheckBoxMenuItem)fMenuItem).isSelected());
+            forceSetState(fMenuItem.isSelected());
         } else {
-            setState(fMenuItem.getModel().isSelected());
+            forceSetState(fMenuItem.getModel().isSelected());
         }
     }
 
@@ -196,10 +196,10 @@
 
             switch (e.getStateChange()) {
                 case ItemEvent.SELECTED:
-                    setState(true);
+                    forceSetState(true);
                     break;
                 case ItemEvent.DESELECTED:
-                    setState(false);
+                    forceSetState(false);
                     break;
             }
         }
@@ -210,4 +210,20 @@
             ((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate);
         }
     }
+
+    /*
+     * The CCheckboxMenuItem peer is calling setState unconditionally every time user clicks the menu
+     * However for Swing controls in the screen menu bar it is wrong - the state should be changed only
+     * in response to the ITEM_STATE_CHANGED event. So the setState is overridden to no-op and all the
+     * correct state changes are made with forceSetState
+     */
+
+    @Override
+    public synchronized void setState(boolean b) {
+        // No Op
+    }
+
+    private void forceSetState(boolean b) {
+        super.setState(b);
+    }
 }
--- a/jdk/src/macosx/classes/java/net/DefaultInterface.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/java/net/DefaultInterface.java	Fri Nov 08 17:36:14 2013 -0800
@@ -26,7 +26,7 @@
 package java.net;
 
 /**
- * Choose a network inteface to be the default for
+ * Choose a network interface to be the default for
  * outgoing IPv6 traffic that does not specify a scope_id (and which needs one).
  * We choose the first interface that is up and is (in order of preference):
  * 1. neither loopback nor point to point
--- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java	Fri Nov 08 17:36:14 2013 -0800
@@ -122,7 +122,7 @@
     long user() { return user; }
     long host() { return host; }
 
-    // private contructor - use factory method getFile() instead
+    // private constructor - use factory method getFile() instead
     private MacOSXPreferencesFile(String newName, long newUser, long newHost)
     {
         appName = newName;
--- a/jdk/src/macosx/classes/sun/font/CFontManager.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/font/CFontManager.java	Fri Nov 08 17:36:14 2013 -0800
@@ -342,7 +342,7 @@
 
     @Override
     public String getFontPath(boolean noType1Fonts) {
-        // In the case of the Cocoa toolkit, since we go through NSFont, we dont need to register /Library/Fonts
+        // In the case of the Cocoa toolkit, since we go through NSFont, we don't need to register /Library/Fonts
         Toolkit tk = Toolkit.getDefaultToolkit();
         if (tk instanceof HeadlessToolkit) {
             tk = ((HeadlessToolkit)tk).getUnderlyingToolkit();
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Nov 08 17:36:14 2013 -0800
@@ -56,15 +56,6 @@
 
     private final PlatformWindow platformWindow;
 
-    // Window bounds reported by the native system (as opposed to
-    // regular bounds inherited from LWComponentPeer which are
-    // requested by user and may haven't been applied yet because
-    // of asynchronous requests to the windowing system)
-    private int sysX;
-    private int sysY;
-    private int sysW;
-    private int sysH;
-
     private static final int MINIMUM_WIDTH = 1;
     private static final int MINIMUM_HEIGHT = 1;
 
@@ -320,10 +311,18 @@
         // Don't post ComponentMoved/Resized and Paint events
         // until we've got a notification from the delegate
         Rectangle cb = constrainBounds(x, y, w, h);
-        setBounds(cb.x, cb.y, cb.width, cb.height, op, false, false);
-        // Get updated bounds, so we don't have to handle 'op' here manually
-        Rectangle r = getBounds();
-        platformWindow.setBounds(r.x, r.y, r.width, r.height);
+
+        Rectangle newBounds = new Rectangle(getBounds());
+        if ((op & (SET_LOCATION | SET_BOUNDS)) != 0) {
+            newBounds.x = cb.x;
+            newBounds.y = cb.y;
+        }
+        if ((op & (SET_SIZE | SET_BOUNDS)) != 0) {
+            newBounds.width = cb.width;
+            newBounds.height = cb.height;
+        }
+        // Native system could constraint bounds, so the peer wold be updated in the callback
+        platformWindow.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
     }
 
     public Rectangle constrainBounds(Rectangle bounds) {
@@ -614,17 +613,10 @@
      */
     @Override
     public void notifyReshape(int x, int y, int w, int h) {
-        final boolean moved;
-        final boolean resized;
+        Rectangle oldBounds = getBounds();
         final boolean invalid = updateInsets(platformWindow.getInsets());
-        synchronized (getStateLock()) {
-            moved = (x != sysX) || (y != sysY);
-            resized = (w != sysW) || (h != sysH);
-            sysX = x;
-            sysY = y;
-            sysW = w;
-            sysH = h;
-        }
+        final boolean moved = (x != oldBounds.x) || (y != oldBounds.y);
+        final boolean resized = (w != oldBounds.width) || (h != oldBounds.height);
 
         // Check if anything changed
         if (!moved && !resized && !invalid) {
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java	Fri Nov 08 17:36:14 2013 -0800
@@ -620,8 +620,7 @@
                     retString[0] = new String(selectedText);
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         synchronized(retString) { return retString[0]; }
     }
@@ -669,8 +668,7 @@
 
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         synchronized(returnValue) { return returnValue; }
     }
@@ -695,8 +693,7 @@
                     returnValue[0] = fIMContext.getInsertPositionOffset();
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         returnValue[1] = fCurrentTextLength;
         synchronized(returnValue) { return returnValue; }
@@ -743,8 +740,7 @@
                     }
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         synchronized(rect) { return rect; }
     }
@@ -764,8 +760,7 @@
                     insertPositionOffset[0] = fIMContext.getInsertPositionOffset();
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         // This bit of gymnastics ensures that the returned location is within the composed text.
         // If it falls outside that region, the input method will commit the text, which is inconsistent with native
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java	Fri Nov 08 17:36:14 2013 -0800
@@ -54,14 +54,6 @@
     }
 
     @Override
-    public void enterFullScreenMode() {
-    }
-
-    @Override
-    public void exitFullScreenMode() {
-    }
-
-    @Override
     public SurfaceData replaceSurfaceData() {
         return null;
     }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Fri Nov 08 17:36:14 2013 -0800
@@ -96,14 +96,6 @@
         return peer;
     }
 
-    public void enterFullScreenMode() {
-        CWrapper.NSView.enterFullScreenMode(ptr);
-    }
-
-    public void exitFullScreenMode() {
-        CWrapper.NSView.exitFullScreenMode(ptr);
-    }
-
     public void setToolTip(String msg) {
         CWrapper.NSView.setToolTip(ptr, msg);
     }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Nov 08 17:36:14 2013 -0800
@@ -63,6 +63,8 @@
     private static native void nativeSynthesizeMouseEnteredExitedEvents();
     private static native void nativeDispose(long nsWindowPtr);
     private static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse();
+    private static native void nativeEnterFullScreenMode(long nsWindowPtr);
+    private static native void nativeExitFullScreenMode(long nsWindowPtr);
 
     // Loger to report issues happened during execution but that do not affect functionality
     private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
@@ -230,7 +232,14 @@
         contentView.initialize(peer, responder);
 
         final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L;
-        Rectangle bounds = _peer.constrainBounds(_target.getBounds());
+        Rectangle bounds;
+        if (!IS(DECORATED, styleBits)) {
+            // For undecorated frames the move/resize event does not come if the frame is centered on the screen
+            // so we need to set a stub location to force an initial move/resize. Real bounds would be set later.
+            bounds = new Rectangle(0, 0, 1, 1);
+        } else {
+            bounds = _peer.constrainBounds(_target.getBounds());
+        }
         final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(),
                 ownerPtr, styleBits, bounds.x, bounds.y, bounds.width, bounds.height);
         setPtr(nativeWindowPtr);
@@ -433,10 +442,7 @@
 
     @Override // PlatformWindow
     public Insets getInsets() {
-        if (!isFullScreenMode) {
-            return nativeGetNSWindowInsets(getNSWindowPtr());
-        }
-        return new Insets(0, 0, 0, 0);
+        return nativeGetNSWindowInsets(getNSWindowPtr());
     }
 
     @Override // PlatformWindow
@@ -538,6 +544,8 @@
         updateIconImages();
         updateFocusabilityForAutoRequestFocus(false);
 
+        boolean wasMaximized = isMaximized();
+
         // Actually show or hide the window
         LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
         if (blocker == null || !visible) {
@@ -571,16 +579,21 @@
         if (visible) {
             // Apply the extended state as expected in shared code
             if (target instanceof Frame) {
-                switch (((Frame)target).getExtendedState()) {
-                    case Frame.ICONIFIED:
-                        CWrapper.NSWindow.miniaturize(nsWindowPtr);
-                        break;
-                    case Frame.MAXIMIZED_BOTH:
-                        maximize();
-                        break;
-                    default: // NORMAL
-                        unmaximize(); // in case it was maximized, otherwise this is a no-op
-                        break;
+                if (!wasMaximized && isMaximized()) {
+                    // setVisible could have changed the native maximized state
+                    deliverZoom(true);
+                } else {
+                    switch (((Frame)target).getExtendedState()) {
+                        case Frame.ICONIFIED:
+                            CWrapper.NSWindow.miniaturize(nsWindowPtr);
+                            break;
+                        case Frame.MAXIMIZED_BOTH:
+                            maximize();
+                            break;
+                        default: // NORMAL
+                            unmaximize(); // in case it was maximized, otherwise this is a no-op
+                            break;
+                    }
                 }
             }
         }
@@ -750,18 +763,12 @@
     @Override
     public void enterFullScreenMode() {
         isFullScreenMode = true;
-        contentView.enterFullScreenMode();
-        // the move/size notification from the underlying system comes
-        // but it contains a bounds smaller than the whole screen
-        // and therefore we need to create the synthetic notifications
-        Rectangle screenBounds = getPeer().getGraphicsConfiguration().getBounds();
-        peer.notifyReshape(screenBounds.x, screenBounds.y, screenBounds.width,
-                           screenBounds.height);
+        nativeEnterFullScreenMode(getNSWindowPtr());
     }
 
     @Override
     public void exitFullScreenMode() {
-        contentView.exitFullScreenMode();
+        nativeExitFullScreenMode(getNSWindowPtr());
         isFullScreenMode = false;
     }
 
@@ -884,7 +891,7 @@
                         //Posting an empty to flush the EventQueue without blocking the main thread
                     }
                 }, target);
-            } catch (InterruptedException | InvocationTargetException e) {
+            } catch (InvocationTargetException e) {
                 e.printStackTrace();
             }
         }
@@ -919,13 +926,7 @@
 
     protected void deliverMoveResizeEvent(int x, int y, int width, int height,
                                         boolean byUser) {
-        // when the content view enters the full-screen mode, the native
-        // move/resize notifications contain a bounds smaller than
-        // the whole screen and therefore we ignore the native notifications
-        // and the content view itself creates correct synthetic notifications
-        if (isFullScreenMode) {
-            return;
-        }
+        checkZoom();
 
         final Rectangle oldB = nativeBounds;
         nativeBounds = new Rectangle(x, y, width, height);
@@ -957,6 +958,17 @@
         }
     }
 
+    private void checkZoom() {
+        if (target instanceof Frame && isVisible()) {
+            Frame targetFrame = (Frame)target;
+            if (targetFrame.getExtendedState() != Frame.MAXIMIZED_BOTH && isMaximized()) {
+                deliverZoom(true);
+            } else if (targetFrame.getExtendedState() == Frame.MAXIMIZED_BOTH && !isMaximized()) {
+                deliverZoom(false);
+            }
+        }
+    }
+
     private void deliverNCMouseDown() {
         if (peer != null) {
             peer.notifyNCMouseDown();
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Fri Nov 08 17:36:14 2013 -0800
@@ -233,6 +233,10 @@
 
 
         setAttributes(attributes);
+        // throw exception for invalid destination
+        if (destinationAttr != null) {
+            validateDestination(destinationAttr);
+        }
 
         /* Get the range of pages we are to print. If the
          * last page to print is unknown, then we print to
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Fri Nov 08 17:36:14 2013 -0800
@@ -97,6 +97,6 @@
                     setVisible(true);
                 }
             }, this);
-        } catch (InterruptedException | InvocationTargetException ex) {}
+        } catch (InvocationTargetException ex) {}
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Fri Nov 08 17:36:14 2013 -0800
@@ -82,9 +82,6 @@
         public static native Rectangle2D frame(long view);
         public static native long window(long view);
 
-        public static native void enterFullScreenMode(long view);
-        public static native void exitFullScreenMode(long view);
-
         public static native void setHidden(long view, boolean hidden);
 
         public static native void setToolTip(long view, String msg);
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Fri Nov 08 17:36:14 2013 -0800
@@ -548,22 +548,18 @@
     // Any selector invoked using ThreadUtilities performOnMainThread will be processed in doAWTRunLoop
     // The InvocationEvent will call LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual runloop
     // Does not dispatch native events while in the loop
-    public static void invokeAndWait(Runnable event, Component component) throws InterruptedException, InvocationTargetException {
+    public static void invokeAndWait(Runnable runnable, Component component) throws InvocationTargetException {
         final long mediator = createAWTRunLoopMediator();
 
         InvocationEvent invocationEvent =
-                new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event) {
-                    @Override
-                    public void dispatch() {
-                        try {
-                            super.dispatch();
-                        } finally {
+                new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(),
+                        runnable,
+                        () -> {
                             if (mediator != 0) {
                                 stopAWTRunLoop(mediator);
                             }
-                        }
-                    }
-                };
+                        },
+                        true);
 
         if (component != null) {
             AppContext appContext = SunToolkit.targetToAppContext(component);
--- a/jdk/src/macosx/native/sun/awt/AWTView.m	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m	Fri Nov 08 17:36:14 2013 -0800
@@ -272,7 +272,6 @@
  */
 
 - (void) keyDown: (NSEvent *)event {
-
     fProcessingKeystroke = YES;
     fKeyEventsNeeded = YES;
 
@@ -308,6 +307,23 @@
 
 - (BOOL) performKeyEquivalent: (NSEvent *) event {
     [self deliverJavaKeyEventHelper: event];
+
+    // Workaround for 8020209: special case for "Cmd =" and "Cmd ." 
+    // because Cocoa calls performKeyEquivalent twice for these keystrokes  
+    NSUInteger modFlags = [event modifierFlags] & 
+        (NSCommandKeyMask | NSAlternateKeyMask | NSShiftKeyMask | NSControlKeyMask);
+    if (modFlags == NSCommandKeyMask) {
+        NSString *eventChars = [event charactersIgnoringModifiers];
+        if ([eventChars length] == 1) {
+            unichar ch = [eventChars characterAtIndex:0];
+            if (ch == '=' || ch == '.') {
+                [[NSApp mainMenu] performKeyEquivalent: event];
+                return YES;
+            }
+        }
+
+    }
+
     return NO;
 }
 
@@ -580,7 +596,7 @@
 
 // --- Services menu support for lightweights ---
 
-// finds the focused accessable element, and if it's a text element, obtains the text from it
+// finds the focused accessible element, and if it is a text element, obtains the text from it
 - (NSString *)accessibleSelectedText
 {
     id focused = [self accessibilityFocusedUIElement];
@@ -598,7 +614,7 @@
     return rtfdData;
 }
 
-// finds the focused accessable element, and if it's a text element, sets the text in it
+// finds the focused accessible element, and if it is a text element, sets the text in it
 - (BOOL)replaceAccessibleTextSelection:(NSString *)text
 {
     id focused = [self accessibilityFocusedUIElement];
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.h	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h	Fri Nov 08 17:36:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, 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
@@ -45,6 +45,7 @@
     BOOL isEnabled;
     NSWindow *nsWindow;
     AWTWindow *ownerWindow;
+    jint preFullScreenLevel;
 }
 
 // An instance of either AWTWindow_Normal or AWTWindow_Panel
@@ -57,6 +58,7 @@
 @property (nonatomic) NSSize javaMaxSize;
 @property (nonatomic) jint styleBits;
 @property (nonatomic) BOOL isEnabled;
+@property (nonatomic) jint preFullScreenLevel;
 
 
 - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m	Fri Nov 08 17:36:14 2013 -0800
@@ -122,6 +122,7 @@
 @synthesize styleBits;
 @synthesize isEnabled;
 @synthesize ownerWindow;
+@synthesize preFullScreenLevel;
 
 - (void) updateMinMaxSize:(BOOL)resizable {
     if (resizable) {
@@ -501,20 +502,6 @@
     // window exposing in _setVisible:(BOOL)
 }
 
-- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)proposedFrame {
-AWT_ASSERT_APPKIT_THREAD;
-
-    [AWTToolkit eventCountPlusPlus];
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
-    jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
-    if (platformWindow != NULL) {
-        static JNF_MEMBER_CACHE(jm_deliverZoom, jc_CPlatformWindow, "deliverZoom", "(Z)V");
-        JNFCallVoidMethod(env, platformWindow, jm_deliverZoom, ![window isZoomed]);
-        (*env)->DeleteLocalRef(env, platformWindow);
-    }
-    return YES;
-}
-
 - (void) _deliverIconify:(BOOL)iconify {
 AWT_ASSERT_APPKIT_THREAD;
 
@@ -1226,3 +1213,58 @@
 JNF_COCOA_EXIT(env);
 }
 
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeEnterFullScreenMode
+(JNIEnv *env, jclass clazz, jlong windowPtr)
+{
+JNF_COCOA_ENTER(env);
+
+    NSWindow *nsWindow = OBJC(windowPtr);
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
+        NSNumber* screenID = [AWTWindow getNSWindowDisplayID_AppKitThread: nsWindow];
+        CGDirectDisplayID aID = [screenID intValue];
+
+        if (CGDisplayCapture(aID) == kCGErrorSuccess) {
+            // remove window decoration
+            NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:window.styleBits];
+            [nsWindow setStyleMask:(styleMask & ~NSTitledWindowMask) | NSBorderlessWindowMask];
+
+            int shieldLevel = CGShieldingWindowLevel();
+            window.preFullScreenLevel = [nsWindow level];
+            [nsWindow setLevel: shieldLevel];
+
+            NSRect screenRect = [[nsWindow screen] frame];
+            [nsWindow setFrame:screenRect display:YES];
+        } else {
+            [JNFException raise:env as:kRuntimeException reason:"Failed to enter full screen."];            
+        }
+    }];
+
+JNF_COCOA_EXIT(env);
+}
+
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeExitFullScreenMode
+(JNIEnv *env, jclass clazz, jlong windowPtr)
+{
+JNF_COCOA_ENTER(env);
+
+    NSWindow *nsWindow = OBJC(windowPtr);
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
+        NSNumber* screenID = [AWTWindow getNSWindowDisplayID_AppKitThread: nsWindow];
+        CGDirectDisplayID aID = [screenID intValue];
+
+        if (CGDisplayRelease(aID) == kCGErrorSuccess) {
+            NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:window.styleBits];
+            [nsWindow setStyleMask:styleMask]; 
+            [nsWindow setLevel: window.preFullScreenLevel];
+
+            // GraphicsDevice takes care of restoring pre full screen bounds
+        } else {
+            [JNFException raise:env as:kRuntimeException reason:"Failed to exit full screen."];
+        }
+    }];
+
+JNF_COCOA_EXIT(env);
+}
+
--- a/jdk/src/macosx/native/sun/awt/CPrinterJob.m	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/native/sun/awt/CPrinterJob.m	Fri Nov 08 17:36:14 2013 -0800
@@ -359,7 +359,11 @@
     static JNF_CLASS_CACHE(jc_Pageable, "java/awt/print/Pageable");
     static JNF_MEMBER_CACHE(jm_getCopies, sjc_CPrinterJob, "getCopiesInt", "()I");
     static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z");
+    static JNF_MEMBER_CACHE(jm_getFromPage, sjc_CPrinterJob, "getFromPageAttrib", "()I");
+    static JNF_MEMBER_CACHE(jm_getToPage, sjc_CPrinterJob, "getToPageAttrib", "()I");
+    static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
     static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
+    static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
 
     NSMutableDictionary* printingDictionary = [dst dictionary];
 
@@ -368,19 +372,35 @@
 
     jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object)
     [printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate];
-
     jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit)
     if (jNumPages != java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
     {
-        [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+        jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib);
+        if (selectID ==0) {
+            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
+        } else if (selectID == 2) {
+            // In Mac 10.7,  Print ALL is deselected if PrintSelection is YES whether
+            // NSPrintAllPages is YES or NO
+            [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly];
+        } else {
+            [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+        }
 
-        [printingDictionary setObject:[NSNumber numberWithInteger:1] forKey:NSPrintFirstPage];
-        [printingDictionary setObject:[NSNumber numberWithInteger:jNumPages] forKey:NSPrintLastPage];
+        jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
+        jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage);
+        // setting fromPage and toPage will not be shown in the dialog if printing All pages
+        [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
+        [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
     }
     else
     {
         [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
     }
+    jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat); 
+    if (page != NULL) {
+        javaPageFormatToNSPrintInfo(env, NULL, page, dst);
+    }
 }
 
 /*
--- a/jdk/src/macosx/native/sun/awt/CTextPipe.m	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/native/sun/awt/CTextPipe.m	Fri Nov 08 17:36:14 2013 -0800
@@ -322,7 +322,7 @@
 
     Each stage of the pipeline is responsible for doing only one major thing, like allocating buffers,
     aquiring transform arrays from JNI, filling buffers, or striking glyphs. All resources or memory
-    aquired at a given stage, must be released in that stage. Any error that occurs (like a failed malloc)
+    acquired at a given stage, must be released in that stage. Any error that occurs (like a failed malloc)
     is to be handled in the stage it occurs in, and is to return immediatly after freeing it's resources.
 
 -----------------------------------*/
--- a/jdk/src/macosx/native/sun/awt/CWrapper.m	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/native/sun/awt/CWrapper.m	Fri Nov 08 17:36:14 2013 -0800
@@ -587,46 +587,6 @@
 
 /*
  * Class:     sun_lwawt_macosx_CWrapper$NSView
- * Method:    enterFullScreenMode
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSView_enterFullScreenMode
-(JNIEnv *env, jclass cls, jlong viewPtr)
-{
-JNF_COCOA_ENTER(env);
-
-    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-        NSScreen *screen = [[view window] screen];
-        NSDictionary *opts = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], NSFullScreenModeAllScreens, nil];
-        [view enterFullScreenMode:screen withOptions:opts];
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSView
- * Method:    exitFullScreenMode
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSView_exitFullScreenMode
-(JNIEnv *env, jclass cls, jlong viewPtr)
-{
-JNF_COCOA_ENTER(env);
-
-    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-        [view exitFullScreenModeWithOptions:nil];
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSView
  * Method:    window
  * Signature: (J)J
  */
--- a/jdk/src/macosx/native/sun/awt/awt.m	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/native/sun/awt/awt.m	Fri Nov 08 17:36:14 2013 -0800
@@ -312,15 +312,17 @@
         if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
     }
 
-    // Don't set the delegate until the NSApplication has been created and
-    // its finishLaunching has initialized it.
-    //  ApplicationDelegate is the support code for com.apple.eawt.
-    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
-        if (delegate != nil) {
-            OSXAPP_SetApplicationDelegate(delegate);
-        }        
-    }];
+    if (!headless) {
+        // Don't set the delegate until the NSApplication has been created and
+        // its finishLaunching has initialized it.
+        //  ApplicationDelegate is the support code for com.apple.eawt.
+        [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+            id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
+            if (delegate != nil) {
+                OSXAPP_SetApplicationDelegate(delegate);
+            }        
+        }];
+    }
 }
 
 - (void)starter:(NSArray*)args {
--- a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m	Fri Nov 08 17:36:14 2013 -0800
@@ -341,6 +341,10 @@
     if ([event type] == NSApplicationDefined && TS_EQUAL([event timestamp], dummyEventTimestamp)) {
         [seenDummyEventLock lockWhenCondition:NO];
         [seenDummyEventLock unlockWithCondition:YES];
+    } else if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) {
+        // Cocoa won't send us key up event when releasing a key while Cmd is down,
+        // so we have to do it ourselves.
+        [[self keyWindow] sendEvent:event];
     } else {
         [super sendEvent:event];
     }
--- a/jdk/src/share/back/commonRef.c	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/back/commonRef.c	Fri Nov 08 17:36:14 2013 -0800
@@ -52,7 +52,7 @@
  * the number times an object has been referenced through
  * commonRef_refToID. A RefNode is freed once the reference
  * count is decremented to 0 (with commonRef_release*), even if the
- * correspoding object has not been collected.
+ * corresponding object has not been collected.
  *
  * One hash table is maintained. The mapping of ID to jobject (or RefNode*)
  * is handled with one hash table that will re-size itself as the number
--- a/jdk/src/share/back/eventFilter.c	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/back/eventFilter.c	Fri Nov 08 17:36:14 2013 -0800
@@ -644,7 +644,7 @@
 
             case JDWP_REQUEST_MODIFIER(Count): {
                 /*
-                 * If preceeding filters have determined that events will
+                 * If preceding filters have determined that events will
                  * be filtered out, that is fine and we won't get here.
                  * However, the count must be decremented - even if
                  * subsequent filters will filter these events.  We
--- a/jdk/src/share/back/util.c	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/back/util.c	Fri Nov 08 17:36:14 2013 -0800
@@ -1092,7 +1092,7 @@
      * we don't want to consume it.  It came from
      * user code and is intended for user code, not us.
      * So, we will remember that the interrupt has
-     * occured and re-activate it when this thread
+     * occurred and re-activate it when this thread
      * goes back into user code.
      * That being said, what do we do here?  Since
      * we could have been notified too, here we will
--- a/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -40,7 +40,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>name
      * <dd>the name of the accessible entity
--- a/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013 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
@@ -57,7 +57,7 @@
  *     &lt;int&gt;456&lt;/int&gt;
  * &lt;/array&gt;</pre>
  * is equivalent to {@code int[] array = {123, 456}} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>length
  * <dd>the array length
@@ -76,7 +76,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>length
      * <dd>the array length
@@ -110,6 +110,20 @@
     }
 
     /**
+     * Tests whether the value of this element can be used
+     * as an argument of the element that contained in this one.
+     *
+     * @return {@code true} if the value of this element can be used
+     *         as an argument of the element that contained in this one,
+     *         {@code false} otherwise
+     */
+    @Override
+    protected boolean isArgument() {
+        return true; // hack for compatibility
+    }
+
+
+    /**
      * Creates an instance of the array.
      *
      * @param type  the base class
--- a/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -37,7 +37,7 @@
  *     &lt;string&gt;true&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Boolean.valueOf("true")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -37,7 +37,7 @@
  *     &lt;string&gt;127&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Byte.decode("127")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -33,7 +33,7 @@
  * For example:<pre>
  * &lt;char&gt;X&lt;/char&gt;</pre>
  * which is equivalent to {@code Character.valueOf('X')} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>code
  * <dd>this attribute specifies character code
@@ -52,7 +52,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>code
      * <dd>this attribute specifies character code
--- a/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -36,7 +36,7 @@
  *     &lt;string&gt;java.lang.Class&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Class.forName("java.lang.Class")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -37,7 +37,7 @@
  *     &lt;string&gt;1.23e45&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Double.valueOf("1.23e45")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -126,7 +126,7 @@
 
     /**
      * Parses attributes of the element.
-     * By default, the following atribute is supported:
+     * By default, the following attribute is supported:
      * <dl>
      * <dt>id
      * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -31,7 +31,7 @@
  * For example:<pre>
  * &lt;false/&gt;</pre>
  * is equivalent to {@code false} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -43,7 +43,7 @@
  * For example:<pre>
  * &lt;field name="id"&gt;&lt;int&gt;0&lt;/int&gt;&lt;/field&gt;</pre>
  * is equivalent to {@code id = 0} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>name
  * <dd>the field name
@@ -62,7 +62,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>name
      * <dd>the field name
--- a/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -37,7 +37,7 @@
  *     &lt;string&gt;-1.23&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Float.valueOf("-1.23")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -37,7 +37,7 @@
  *     &lt;string&gt;-1&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Integer.decode("-1")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -32,7 +32,7 @@
  * is evaluated in the context of the decoder itself.
  * Typically this outer context is used to retrieve the owner of the decoder,
  * which can be set before reading the archive.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>version
  * <dd>the Java version (not supported)
@@ -54,7 +54,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>version
      * <dd>the Java version (not supported)
--- a/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -37,7 +37,7 @@
  *     &lt;string&gt;0xFFFF&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Long.decode("0xFFFF")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -43,7 +43,7 @@
  *     &lt;string&gt;10&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * is equivalent to {@code Long.valueOf("10")} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>name
  * <dd>the method name
@@ -62,7 +62,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>name
      * <dd>the method name
--- a/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -43,7 +43,7 @@
  *     &lt;string&gt;10&lt;/string&gt;
  * &lt;/new&gt;</pre>
  * is equivalent to {@code new Long("10")} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>class
  * <dd>the type of object for instantiation
@@ -63,7 +63,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>class
      * <dd>the type of object for instantiation
--- a/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -31,7 +31,7 @@
  * For example:<pre>
  * &lt;null/&gt;</pre>
  * is equivalent to {@code null} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -33,7 +33,7 @@
  * This element looks like &lt;void&gt; element,
  * but its value is always used as an argument for element
  * that contains this one.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>class
  * <dd>the type is used for static methods and fields
@@ -64,7 +64,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>class
      * <dd>the type is used for static methods and fields
--- a/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -63,7 +63,7 @@
  *     &lt;int&gt;0&lt;/int&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code set(0)} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>name
  * <dd>the property name
@@ -85,7 +85,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>name
      * <dd>the property name
--- a/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -37,7 +37,7 @@
  *     &lt;string&gt;200&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Short.decode("200")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -40,7 +40,7 @@
  * &lt;string&gt;
  *     &lt;true&gt;
  * &lt;/string&gt;</pre>
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -31,7 +31,7 @@
  * For example:<pre>
  * &lt;true/&gt;</pre>
  * is equivalent to {@code true} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -30,7 +30,7 @@
  * For example:<pre>
  * &lt;var id="id1" idref="id2"/&gt;</pre>
  * is equivalent to {@code id1 = id2} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>idref
  * <dd>the identifier to refer to the variable
@@ -47,7 +47,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>idref
      * <dd>the identifier to refer to the variable
--- a/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java	Fri Nov 08 17:36:14 2013 -0800
@@ -29,7 +29,7 @@
  * This element looks like &lt;object&gt; element,
  * but its value is not used as an argument for element
  * that contains this one.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>class
  * <dd>the type is used for static methods and fields
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java	Fri Nov 08 17:36:14 2013 -0800
@@ -408,7 +408,7 @@
      * no padding has been requested (only in encryption mode), and the total
      * input length of the data processed by this cipher is not a multiple of
      * block size
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     byte[] doFinal(byte[] input, int inputOffset, int inputLen)
@@ -448,7 +448,7 @@
      * block size
      * @exception ShortBufferException if the given output buffer is too small
      * to hold the result
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     int doFinal(byte[] input, int inputOffset, int inputLen,
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java	Fri Nov 08 17:36:14 2013 -0800
@@ -408,7 +408,7 @@
      * no padding has been requested (only in encryption mode), and the total
      * input length of the data processed by this cipher is not a multiple of
      * block size
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     byte[] doFinal(byte[] input, int inputOffset, int inputLen)
@@ -448,7 +448,7 @@
      * block size
      * @exception ShortBufferException if the given output buffer is too small
      * to hold the result
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     int doFinal(byte[] input, int inputOffset, int inputLen,
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java	Fri Nov 08 17:36:14 2013 -0800
@@ -307,7 +307,7 @@
      * no padding has been requested (only in encryption mode), and the total
      * input length of the data processed by this cipher is not a multiple of
      * block size
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
@@ -348,7 +348,7 @@
      * block size
      * @exception ShortBufferException if the given output buffer is too small
      * to hold the result
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java	Fri Nov 08 17:36:14 2013 -0800
@@ -317,7 +317,7 @@
      * no padding has been requested (only in encryption mode), and the total
      * input length of the data processed by this cipher is not a multiple of
      * block size
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
@@ -358,7 +358,7 @@
      * block size
      * @exception ShortBufferException if the given output buffer is too small
      * to hold the result
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Fri Nov 08 17:36:14 2013 -0800
@@ -187,15 +187,24 @@
         return 1;
     }
 
+    @Override
     public int getWidth(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return width;
     }
 
     public int getHeight(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return height;
     }
 
@@ -205,7 +214,18 @@
         }
     }
 
-    public void readHeader() throws IOException {
+    /**
+     * Process the image header.
+     *
+     * @exception IllegalStateException if source stream is not set.
+     *
+     * @exception IOException if image stream is corrupted.
+     *
+     * @exception IllegalArgumentException if the image stream does not contain
+     *             a BMP image, or if a sample model instance to describe the
+     *             image can not be created.
+     */
+    protected void readHeader() throws IOException, IllegalArgumentException {
         if (gotHeader)
             return;
 
@@ -307,6 +327,9 @@
                 case BI_RLE4:  // 4-bit RLE compression
 
                     // Read in the palette
+                    if (bitmapOffset < (size + 14)) {
+                        throw new IIOException(I18N.getString("BMPImageReader7"));
+                    }
                     int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
                     int sizeOfPalette = numberOfEntries * 4;
                     palette = new byte[sizeOfPalette];
@@ -375,7 +398,7 @@
                     break;
                 default:
                     throw new
-                        RuntimeException(I18N.getString("BMPImageReader2"));
+                        IIOException(I18N.getString("BMPImageReader2"));
                 }
             } else if (size == 108 || size == 124) {
                 // Windows 4.x BMP
@@ -478,7 +501,7 @@
                 }
             } else {
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader3"));
+                    IIOException(I18N.getString("BMPImageReader3"));
             }
         }
 
@@ -660,7 +683,11 @@
     public Iterator getImageTypes(int imageIndex)
       throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         ArrayList list = new ArrayList(1);
         list.add(new ImageTypeSpecifier(originalColorModel,
                                         originalSampleModel));
@@ -675,7 +702,11 @@
       throws IOException {
         checkIndex(imageIndex);
         if (metadata == null) {
-            readHeader();
+            try {
+                readHeader();
+            } catch (IllegalArgumentException e) {
+                throw new IIOException(I18N.getString("BMPImageReader6"), e);
+            }
         }
         return metadata;
     }
@@ -686,7 +717,11 @@
 
     public boolean isRandomAccessEasy(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return metadata.compression == BI_RGB;
     }
 
@@ -705,7 +740,11 @@
             param = getDefaultReadParam();
 
         //read header
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
 
         sourceRegion = new Rectangle(0, 0, 0, 0);
         destinationRegion = new Rectangle(0, 0, 0, 0);
@@ -817,7 +856,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
             break;
 
@@ -833,7 +872,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
 
             break;
@@ -874,7 +913,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
 
         case VERSION_4_8_BIT:
@@ -890,7 +929,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
             break;
 
--- a/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java	Fri Nov 08 17:36:14 2013 -0800
@@ -32,7 +32,7 @@
 
 public class StandardMetadataFormat extends IIOMetadataFormatImpl {
 
-    // Utility method for nodes with a single atttribute named "value"
+    // Utility method for nodes with a single attribute named "value"
     private void addSingleAttributeElement(String elementName,
                                            String parentName,
                                            int dataType) {
--- a/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties	Fri Nov 08 17:36:14 2013 -0800
@@ -21,6 +21,8 @@
 BMPImageReader3=New BMP version not implemented yet.
 BMPImageReader4=No ImageIO-style reader is found for
 BMPImageReader5=Input has not been set.
+BMPImageReader6=Unable to read the image header.
+BMPImageReader7=Invalid bitmap offset.
 BMPImageWriter0=Output is not an ImageOutputStream.
 BMPImageWriter1=The image region to be encoded is empty.
 BMPImageWriter2=Only 1 or 3 band image is encoded.
@@ -34,7 +36,7 @@
 BMPMetadata1=Metadata is read-only.
 
 
-# WBMP plugin properties 
+# WBMP plugin properties
 WBMPImageReader0=Only one image exists in the stream.
 WBMPImageReader1=Input has not been set.
 WBMPImageReader2=Bad WBMP header.
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Fri Nov 08 17:36:14 2013 -0800
@@ -115,6 +115,8 @@
     // The current interlace pass, starting with 0.
     int interlacePass = 0;
 
+    private byte[] fallbackColorTable = null;
+
     // End per-stream settings
 
     // Constants used to control interlacing.
@@ -239,10 +241,22 @@
         byte[] colorTable;
         if (imageMetadata.localColorTable != null) {
             colorTable = imageMetadata.localColorTable;
+            fallbackColorTable = imageMetadata.localColorTable;
         } else {
             colorTable = streamMetadata.globalColorTable;
         }
 
+        if (colorTable == null) {
+            if (fallbackColorTable == null) {
+                this.processWarningOccurred("Use default color table.");
+
+                // no color table, the spec allows to use any palette.
+                fallbackColorTable = getDefaultPalette();
+            }
+
+            colorTable = fallbackColorTable;
+        }
+
         // Normalize color table length to 2^1, 2^2, 2^4, or 2^8
         int length = colorTable.length/3;
         int bits;
@@ -1036,5 +1050,34 @@
         streamY = -1;
         rowsDone = 0;
         interlacePass = 0;
+
+        fallbackColorTable = null;
+    }
+
+    private static byte[] defaultPalette = null;
+
+    private static synchronized byte[] getDefaultPalette() {
+        if (defaultPalette == null) {
+            BufferedImage img = new BufferedImage(1, 1,
+                    BufferedImage.TYPE_BYTE_INDEXED);
+            IndexColorModel icm = (IndexColorModel) img.getColorModel();
+
+            final int size = icm.getMapSize();
+            byte[] r = new byte[size];
+            byte[] g = new byte[size];
+            byte[] b = new byte[size];
+            icm.getReds(r);
+            icm.getGreens(g);
+            icm.getBlues(b);
+
+            defaultPalette = new byte[size * 3];
+
+            for (int i = 0; i < size; i++) {
+                defaultPalette[3 * i + 0] = r[i];
+                defaultPalette[3 * i + 1] = g[i];
+                defaultPalette[3 * i + 2] = b[i];
+            }
+        }
+        return defaultPalette;
     }
 }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Fri Nov 08 17:36:14 2013 -0800
@@ -1368,7 +1368,7 @@
     /**
      * An APP2 marker segment containing an ICC profile.  In the stream
      * a profile larger than 64K is broken up into a series of chunks.
-     * This inner class represents the complete profile as a single objec,
+     * This inner class represents the complete profile as a single object,
      * combining chunks as necessary.
      */
     class ICCMarkerSegment extends MarkerSegment {
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java	Fri Nov 08 17:36:14 2013 -0800
@@ -28,6 +28,7 @@
 import javax.imageio.metadata.IIOInvalidTreeException;
 import javax.imageio.metadata.IIOMetadataNode;
 import javax.imageio.stream.ImageOutputStream;
+import javax.imageio.IIOException;
 
 import java.io.IOException;
 
@@ -60,6 +61,10 @@
         length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
         length |= buffer.buf[buffer.bufPtr++] & 0xff;
         length -= 2;  // JPEG length includes itself, we don't
+
+        if (length < 0) {
+            throw new IIOException("Invalid segment length: " + length);
+        }
         buffer.bufAvail -= 3;
         // Now that we know the true length, ensure that we've got it,
         // or at least a bufferful if length is too big.
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java	Fri Nov 08 17:36:14 2013 -0800
@@ -78,7 +78,7 @@
         numLines |= buffer.buf[buffer.bufPtr++] & 0xff;
         samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
         samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff;
-        int numComponents = buffer.buf[buffer.bufPtr++];
+        int numComponents = buffer.buf[buffer.bufPtr++] & 0xff;
         componentSpecs = new ComponentSpec [numComponents];
         for (int i = 0; i < numComponents; i++) {
             componentSpecs[i] = new ComponentSpec(buffer);
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Fri Nov 08 17:36:14 2013 -0800
@@ -688,6 +688,21 @@
             loop: while (true) {
                 int chunkLength = stream.readInt();
                 int chunkType = stream.readInt();
+                int chunkCRC;
+
+                // verify the chunk length
+                if (chunkLength < 0) {
+                    throw new IIOException("Invalid chunk lenght " + chunkLength);
+                };
+
+                try {
+                    stream.mark();
+                    stream.seek(stream.getStreamPosition() + chunkLength);
+                    chunkCRC = stream.readInt();
+                    stream.reset();
+                } catch (IOException e) {
+                    throw new IIOException("Invalid chunk length " + chunkLength);
+                }
 
                 switch (chunkType) {
                 case IDAT_TYPE:
@@ -762,7 +777,11 @@
                     break;
                 }
 
-                int chunkCRC = stream.readInt();
+                // double check whether all chunk data were consumed
+                if (chunkCRC != stream.readInt()) {
+                    throw new IIOException("Failed to read a chunk of type " +
+                            chunkType);
+                }
                 stream.flushBefore(stream.getStreamPosition());
             }
         } catch (IOException e) {
@@ -1277,6 +1296,16 @@
             is = new BufferedInputStream(is);
             this.pixelStream = new DataInputStream(is);
 
+            /*
+             * NB: the PNG spec declares that valid range for width
+             * and height is [1, 2^31-1], so here we may fail to allocate
+             * a buffer for destination image due to memory limitation.
+             *
+             * However, the recovery strategy for this case should be
+             * defined on the level of application, so we will not
+             * try to estimate the required amount of the memory and/or
+             * handle OOM in any way.
+             */
             theImage = getDestination(param,
                                       getImageTypes(0),
                                       width,
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java	Fri Nov 08 17:36:14 2013 -0800
@@ -1041,7 +1041,7 @@
         }
 
         /**
-         * Rotates the triangle to accomodate the passed in hue.
+         * Rotates the triangle to accommodate the passed in hue.
          */
         private void setAngleFromHue(float hue) {
             setHueAngle((1.0 - hue) * Math.PI * 2);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Fri Nov 08 17:36:14 2013 -0800
@@ -304,7 +304,7 @@
         table.put("Synth.doNotSetTextAA", true);
 
         initResourceBundle(table);
-        // For compatability with apps expecting certain defaults we'll
+        // For compatibility with apps expecting certain defaults we'll
         // populate the table with the values from basic.
         initSystemColorDefaults(table);
         initComponentDefaults(table);
@@ -332,7 +332,7 @@
     }
 
     protected void initComponentDefaults(UIDefaults table) {
-        // For compatability with apps expecting certain defaults we'll
+        // For compatibility with apps expecting certain defaults we'll
         // populate the table with the values from basic.
         super.initComponentDefaults(table);
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Fri Nov 08 17:36:14 2013 -0800
@@ -131,7 +131,7 @@
      * Returns a <code>SynthPainter</code> that will route the appropriate
      * calls to a <code>GTKEngine</code>.
      *
-     * @param state SynthContext indentifying requestor
+     * @param state SynthContext identifying requestor
      * @return SynthPainter
      */
     @Override
@@ -204,7 +204,7 @@
     /**
      * Returns the color for the specified state.
      *
-     * @param context SynthContext identifying requester
+     * @param context SynthContext identifying requestor
      * @param state to get the color for
      * @param type of the color
      * @return Color to render with
@@ -305,7 +305,7 @@
      * insets will be placed in it, otherwise a new Insets object will be
      * created and returned.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param insets Where to place Insets
      * @return Insets.
      */
@@ -640,7 +640,7 @@
     /**
      * Convenience method to get a class specific integer value.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param key Key identifying class specific value
      * @param defaultValue Returned if there is no value for the specified
      *        type
@@ -660,7 +660,7 @@
     /**
      * Convenience method to get a class specific Insets value.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param key Key identifying class specific value
      * @param defaultValue Returned if there is no value for the specified
      *        type
@@ -680,7 +680,7 @@
     /**
      * Convenience method to get a class specific Boolean value.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param key Key identifying class specific value
      * @param defaultValue Returned if there is no value for the specified
      *        type
@@ -702,7 +702,7 @@
      * to. A Style should NOT assume the opacity will remain this value, the
      * developer may reset it or override it.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @return opaque Whether or not the JComponent is opaque.
      */
     @Override
@@ -843,7 +843,7 @@
 
         // Is it another kind of value ?
         if (key != "engine") {
-            // For backward compatability we'll fallback to the UIManager.
+            // For backward compatibility we'll fallback to the UIManager.
             // We don't go to the UIManager for engine as the engine is GTK
             // specific.
             Object value = UIManager.get(key);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java	Fri Nov 08 17:36:14 2013 -0800
@@ -86,19 +86,19 @@
 
     protected void assembleSystemMenu() {
         systemMenu = new JPopupMenu();
-        JMenuItem mi = systemMenu.add(new JMenuItem(restoreAction));
-        mi.setMnemonic('R');
-        mi = systemMenu.add(new JMenuItem(moveAction));
-        mi.setMnemonic('M');
-        mi = systemMenu.add(new JMenuItem(sizeAction));
-        mi.setMnemonic('S');
-        mi = systemMenu.add(new JMenuItem(iconifyAction));
-        mi.setMnemonic('n');
-        mi = systemMenu.add(new JMenuItem(maximizeAction));
-        mi.setMnemonic('x');
+        JMenuItem mi = systemMenu.add(restoreAction);
+        mi.setMnemonic(getButtonMnemonic("restore"));
+        mi = systemMenu.add(moveAction);
+        mi.setMnemonic(getButtonMnemonic("move"));
+        mi = systemMenu.add(sizeAction);
+        mi.setMnemonic(getButtonMnemonic("size"));
+        mi = systemMenu.add(iconifyAction);
+        mi.setMnemonic(getButtonMnemonic("minimize"));
+        mi = systemMenu.add(maximizeAction);
+        mi.setMnemonic(getButtonMnemonic("maximize"));
         systemMenu.add(new JSeparator());
-        mi = systemMenu.add(new JMenuItem(closeAction));
-        mi.setMnemonic('C');
+        mi = systemMenu.add(closeAction);
+        mi.setMnemonic(getButtonMnemonic("close"));
 
         systemButton = new SystemButton();
         systemButton.addActionListener(new ActionListener() {
@@ -124,6 +124,14 @@
         });
     }
 
+    private static int getButtonMnemonic(String button) {
+        try {
+            return Integer.parseInt(UIManager.getString(
+                    "InternalFrameTitlePane." + button + "Button.mnemonic"));
+        } catch (NumberFormatException e) {
+            return -1;
+        }
+    }
 
     protected void createButtons() {
         minimizeButton = new MinimizeButton();
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java	Fri Nov 08 17:36:14 2013 -0800
@@ -45,7 +45,7 @@
 
     /**
      * Renders a text String in Windows without the mnemonic.
-     * This is here because the WindowsUI hiearchy doesn't match the Component heirarchy. All
+     * This is here because the WindowsUI hierarchy doesn't match the Component hierarchy. All
      * the overriden paintText methods of the ButtonUI delegates will call this static method.
      * <p>
      * @param g Graphics context
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java	Fri Nov 08 17:36:14 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -174,7 +174,7 @@
             XPStyle xp = XPStyle.getXP();
             if (xp != null) {
                 Skin skin = xp.getSkin(c, part);
-                JButton b = (JButton)c;
+                AbstractButton b = (AbstractButton)c;
                 ButtonModel model = b.getModel();
 
                 // Find out if frame is inactive
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java	Fri Nov 08 17:50:24 2013 -0500
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java	Fri Nov 08 17:36:14 2013 -0800
@@ -326,18 +326,27 @@
 
     protected void addSystemMenuItems(JPopupMenu menu) {
         JMenuItem mi = menu.add(restoreAction);
-        mi.setMnemonic('R');
+        mi.setMnemonic(getButtonMnemonic("restore"));
         mi = menu.add(moveAction);
-        mi.setMnemonic('M');
+        mi.setMnemonic(getButtonMnemonic("move"));
         mi = menu.add(sizeAction);
-        mi.setMnemonic('S');
+        mi.setMnemonic(getButtonMnemonic("size"));
         mi = menu.add(iconifyAction);
-        mi.setMnemonic('n');
+        mi.setMnemonic(getButtonMnemonic("minimize"));
         mi = menu.add(maximizeAction);
-        mi.setMnemonic('x');
-        systemPopupMenu.add(new JSeparator());
+        mi.setMnemonic(getButtonMnemonic("maximize"));
+        menu.add(new JSeparator());
         mi = menu.add(closeAction);
-        mi.setMnemonic('C');
+        mi.setMnemonic(getButtonMnemonic("close"));
+    }
+
+    private static int getButtonMnemonic(String button) {
+        try {
+            return Integer.parseInt(UIManager.getString(
+                    "InternalFrameTitlePane." + button + "Button.mnemonic"));
+        } catch (NumberFormatException e) {