Merge
authorngthomas
Tue, 26 Apr 2011 15:48:03 -0700
changeset 9288 adbb12180d75
parent 9287 66d45ea865db (current diff)
parent 9285 a31ecc5989d6 (diff)
child 9289 e047ae34aacd
Merge
jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java
jdk/src/share/native/sun/font/layout/Features.h
jdk/test/javax/swing/text/GlyphView/6539700/bug6539700.java
--- a/.hgtags	Tue Apr 19 16:01:27 2011 -0700
+++ b/.hgtags	Tue Apr 26 15:48:03 2011 -0700
@@ -112,3 +112,4 @@
 f75a1efb141210901aabe00a834e0fc32bb8b337 jdk7-b135
 46acf76a533954cfd594bb88fdea79938abfbe20 jdk7-b136
 d1cf7d4ee16c341f5b8c7e7f1d68a8c412b6c693 jdk7-b137
+62b8e328f8c8c66c14b0713222116f2add473f3f jdk7-b138
--- a/.hgtags-top-repo	Tue Apr 19 16:01:27 2011 -0700
+++ b/.hgtags-top-repo	Tue Apr 26 15:48:03 2011 -0700
@@ -112,3 +112,4 @@
 783bd02b4ab4596059c74b10a1793d7bd2f1c157 jdk7-b135
 2fe76e73adaa5133ac559f0b3c2c0707eca04580 jdk7-b136
 7654afc6a29e43cb0a1343ce7f1287bf690d5e5f jdk7-b137
+fc47c97bbbd91b1f774d855c48a7e285eb1a351a jdk7-b138
--- a/corba/.hgtags	Tue Apr 19 16:01:27 2011 -0700
+++ b/corba/.hgtags	Tue Apr 26 15:48:03 2011 -0700
@@ -112,3 +112,4 @@
 e0b72ae5dc5e824b342801c8d1d336a55eb54e2c jdk7-b135
 48ef0c712e7cbf272f47f9224db92a3c6a9e2612 jdk7-b136
 a66c01d8bf895261715955df0b95545c000ed6a8 jdk7-b137
+78d8cf04697e9df54f7f11e195b7da29b8e345a2 jdk7-b138
--- a/hotspot/.hgtags	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/.hgtags	Tue Apr 26 15:48:03 2011 -0700
@@ -162,3 +162,5 @@
 bd586e392d93b7ed7a1636dcc8da2b6a4203a102 hs21-b06
 2dbcb4a4d8dace5fe78ceb563b134f1fb296cd8f jdk7-b137
 2dbcb4a4d8dace5fe78ceb563b134f1fb296cd8f hs21-b07
+0930dc920c185afbf40fed9a655290b8e5b16783 jdk7-b138
+0930dc920c185afbf40fed9a655290b8e5b16783 hs21-b08
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HelloWorld.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HelloWorld.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -55,7 +55,7 @@
     synchronized(lock) {
       if (useMethodInvoke) {
         try {
-          Method method = HelloWorld.class.getMethod("e", null);
+          Method method = HelloWorld.class.getMethod("e");
           Integer result = (Integer) method.invoke(null, new Object[0]);
           return result.intValue();
         }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ByteValueImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -52,12 +52,10 @@
         return intValue();
     }
 
-    public int compareTo(Object obj) {
-        byte other = ((ByteValue)obj).value();
-        return value() - other;
+    public int compareTo(ByteValue byteVal) {
+        return value() - byteVal.value();
     }
 
-
     public Type type() {
         return vm.theByteType();
     }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/CharValueImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -52,9 +52,8 @@
         return intValue();
     }
 
-    public int compareTo(Object obj) {
-        char other = ((CharValue)obj).value();
-        return value() - other;
+    public int compareTo(CharValue charVal) {
+        return value() - charVal.value();
     }
 
     public Type type() {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -186,7 +186,7 @@
         // assert isVMVersionMismatch(throwable), "not a VMVersionMismatch"
         Class expClass = throwable.getClass();
         Method targetVersionMethod = expClass.getMethod("getTargetVersion", new Class[0]);
-        return (String) targetVersionMethod.invoke(throwable, null);
+        return (String) targetVersionMethod.invoke(throwable);
     }
 
     /** If the causal chain has a sun.jvm.hotspot.runtime.VMVersionMismatchException,
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/DoubleValueImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -45,8 +45,8 @@
         }
     }
 
-    public int compareTo(Object obj) {
-        double other = ((DoubleValue)obj).value();
+    public int compareTo(DoubleValue doubleVal) {
+        double other = doubleVal.value();
         if (value() < other) {
             return -1;
         } else if (value() == other) {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/FieldImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -145,8 +145,7 @@
     }
 
     // From interface Comparable
-    public int compareTo(Object object) {
-        Field field = (Field)object;
+    public int compareTo(Field field) {
         ReferenceTypeImpl declaringType = (ReferenceTypeImpl)declaringType();
         int rc = declaringType.compareTo(field.declaringType());
         if (rc == 0) {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/FloatValueImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -52,8 +52,8 @@
         return intValue();
     }
 
-    public int compareTo(Object obj) {
-        float other = ((FloatValue)obj).value();
+    public int compareTo(FloatValue floatVal) {
+        float other = floatVal.value();
         if (value() < other) {
             return -1;
         } else if (value() == other) {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/IntegerValueImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -52,9 +52,8 @@
         return intValue();
     }
 
-    public int compareTo(Object obj) {
-        int other = ((IntegerValue)obj).value();
-        return value() - other;
+    public int compareTo(IntegerValue integerVal) {
+        return value() - integerVal.value();
     }
 
     public Type type() {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/LocalVariableImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -67,8 +67,8 @@
         return (int)method.hashCode() + slot();
     }
 
-    public int compareTo(Object object) {
-        LocalVariableImpl other = (LocalVariableImpl)object;
+    public int compareTo(LocalVariable localVar) {
+        LocalVariableImpl other = (LocalVariableImpl) localVar;
         int rc = method.compareTo(other.method);
         if (rc == 0) {
             rc = slot() - other.slot();
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/LocationImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -78,8 +78,7 @@
         return method().hashCode() + (int)codeIndex();
     }
 
-    public int compareTo(Object object) {
-        LocationImpl other = (LocationImpl)object;
+    public int compareTo(Location other) {
         int rc = method().compareTo(other.method());
         if (rc == 0) {
             long diff = codeIndex() - other.codeIndex();
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/LongValueImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -52,8 +52,8 @@
         return intValue();
     }
 
-    public int compareTo(Object obj) {
-        long other = ((LongValue)obj).value();
+    public int compareTo(LongValue longVal) {
+        long other = longVal.value();
         if (value() < other) {
             return -1;
         } else if (value() == other) {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/MethodImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -200,8 +200,7 @@
     }
 
     // From interface Comparable
-    public int compareTo(Object object) {
-      Method method = (Method)object;
+    public int compareTo(Method method) {
         ReferenceTypeImpl declaringType = (ReferenceTypeImpl)declaringType();
          int rc = declaringType.compareTo(method.declaringType());
          if (rc == 0) {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -99,7 +99,7 @@
         return saKlass.hashCode();
     }
 
-    public int compareTo(Object object) {
+    public int compareTo(ReferenceType refType) {
         /*
          * Note that it is critical that compareTo() == 0
          * implies that equals() == true. Otherwise, TreeSet
@@ -108,7 +108,7 @@
          * (Classes of the same name loaded by different class loaders
          * or in different VMs must not return 0).
          */
-        ReferenceTypeImpl other = (ReferenceTypeImpl)object;
+        ReferenceTypeImpl other = (ReferenceTypeImpl)refType;
         int comp = name().compareTo(other.name());
         if (comp == 0) {
             Oop rf1 = ref();
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ShortValueImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -52,9 +52,8 @@
         return intValue();
     }
 
-    public int compareTo(Object obj) {
-        short other = ((ShortValue)obj).value();
-        return value() - other;
+    public int compareTo(ShortValue shortVal) {
+        return value() - shortVal.value();
     }
 
     public Type type() {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/VirtualMachineImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -798,12 +798,11 @@
     }
 
     public String description() {
-        String[] versionParts = {"" + vmmgr.majorInterfaceVersion(),
-                                 "" + vmmgr.minorInterfaceVersion(),
-                                 name()};
         return java.text.MessageFormat.format(java.util.ResourceBundle.
                                               getBundle("com.sun.tools.jdi.resources.jdi").getString("version_format"),
-                                              versionParts);
+                                              "" + vmmgr.majorInterfaceVersion(),
+                                              "" + vmmgr.minorInterfaceVersion(),
+                                              name());
     }
 
     public String version() {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Tue Apr 26 15:48:03 2011 -0700
@@ -331,8 +331,6 @@
     if (Assert.ASSERTS_ENABLED) {
       Assert.that(getTagAt(i).isInvokeDynamic(), "Corrupted constant pool");
     }
-    if (getTagAt(i).value() == JVM_CONSTANT_InvokeDynamicTrans)
-        return null;
     int bsmSpec = extractLowShortFromInt(this.getIntAt(i));
     TypeArray operands = getOperands();
     if (operands == null)  return null;  // safety first
@@ -368,7 +366,6 @@
     case JVM_CONSTANT_MethodHandle:       return "JVM_CONSTANT_MethodHandle";
     case JVM_CONSTANT_MethodType:         return "JVM_CONSTANT_MethodType";
     case JVM_CONSTANT_InvokeDynamic:      return "JVM_CONSTANT_InvokeDynamic";
-    case JVM_CONSTANT_InvokeDynamicTrans: return "JVM_CONSTANT_InvokeDynamic/transitional";
     case JVM_CONSTANT_Invalid:            return "JVM_CONSTANT_Invalid";
     case JVM_CONSTANT_UnresolvedClass:    return "JVM_CONSTANT_UnresolvedClass";
     case JVM_CONSTANT_UnresolvedClassInError:    return "JVM_CONSTANT_UnresolvedClassInError";
@@ -428,7 +425,6 @@
         case JVM_CONSTANT_MethodHandle:
         case JVM_CONSTANT_MethodType:
         case JVM_CONSTANT_InvokeDynamic:
-        case JVM_CONSTANT_InvokeDynamicTrans:
           visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true);
           break;
         }
@@ -592,7 +588,6 @@
                   break;
               }
 
-              case JVM_CONSTANT_InvokeDynamicTrans:
               case JVM_CONSTANT_InvokeDynamic: {
                   dos.writeByte(cpConstType);
                   int value = getIntAt(ci);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Tue Apr 26 15:48:03 2011 -0700
@@ -42,7 +42,7 @@
     public static final int JVM_CONSTANT_NameAndType        = 12;
     public static final int JVM_CONSTANT_MethodHandle       = 15;
     public static final int JVM_CONSTANT_MethodType         = 16;
-    public static final int JVM_CONSTANT_InvokeDynamicTrans = 17;  // only occurs in old class files
+    //     static final int JVM_CONSTANT_(unused)           = 17;
     public static final int JVM_CONSTANT_InvokeDynamic      = 18;
 
     // JVM_CONSTANT_MethodHandle subtypes
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Tue Apr 26 15:48:03 2011 -0700
@@ -321,7 +321,6 @@
                      break;
                 }
 
-                case JVM_CONSTANT_InvokeDynamicTrans:
                 case JVM_CONSTANT_InvokeDynamic: {
                      dos.writeByte(cpConstType);
                      int value = cpool.getIntAt(ci);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Tue Apr 26 15:48:03 2011 -0700
@@ -598,7 +598,6 @@
                buf.cell(Integer.toString(cpool.getIntAt(index)));
                break;
 
-            case JVM_CONSTANT_InvokeDynamicTrans:
             case JVM_CONSTANT_InvokeDynamic:
                buf.cell("JVM_CONSTANT_InvokeDynamic");
                buf.cell(genLowHighShort(cpool.getIntAt(index)) +
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java	Tue Apr 26 15:48:03 2011 -0700
@@ -40,7 +40,7 @@
   private static int JVM_CONSTANT_NameAndType             = 12;
   private static int JVM_CONSTANT_MethodHandle            = 15;  // JSR 292
   private static int JVM_CONSTANT_MethodType              = 16;  // JSR 292
-  private static int JVM_CONSTANT_InvokeDynamicTrans      = 17;  // JSR 292, only occurs in old class files
+  //      static int JVM_CONSTANT_(unused)                = 17;  // JSR 292 early drafts only
   private static int JVM_CONSTANT_InvokeDynamic           = 18;  // JSR 292
   private static int JVM_CONSTANT_Invalid                 = 0;   // For bad value initialization
   private static int JVM_CONSTANT_UnresolvedClass         = 100; // Temporary tag until actual use
@@ -83,7 +83,6 @@
   public boolean isMethodHandle()     { return tag == JVM_CONSTANT_MethodHandle; }
   public boolean isMethodType()       { return tag == JVM_CONSTANT_MethodType; }
   public boolean isInvokeDynamic()    { return tag == JVM_CONSTANT_InvokeDynamic; }
-  public boolean isInvokeDynamicTrans() { return tag == JVM_CONSTANT_InvokeDynamicTrans; }
 
   public boolean isInvalid()          { return tag == JVM_CONSTANT_Invalid; }
 
--- a/hotspot/make/hotspot_version	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/make/hotspot_version	Tue Apr 26 15:48:03 2011 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=21
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=08
+HS_BUILD_NUMBER=09
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/hotspot/make/linux/makefiles/sa.make	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/make/linux/makefiles/sa.make	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 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
@@ -97,8 +97,8 @@
 	$(foreach file,$(AGENT_FILES1),$(shell echo $(file) >> $(AGENT_FILES1_LIST)))
 	$(foreach file,$(AGENT_FILES2),$(shell echo $(file) >> $(AGENT_FILES2_LIST)))
 	
-	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -source 1.4 -target 1.4 -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES1_LIST)
-	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -source 1.4 -target 1.4 -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES2_LIST)
+	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES1_LIST)
+	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES2_LIST)
 	
 	$(QUIETLY) $(REMOTE) $(COMPILE.RMIC)  -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
 	$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
--- a/hotspot/make/linux/makefiles/vm.make	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/make/linux/makefiles/vm.make	Tue Apr 26 15:48:03 2011 -0700
@@ -142,13 +142,15 @@
 COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt
 COMPILER2_PATHS += $(GENERATED)/adfiles
 
+SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark
+
 # Include dirs per type.
 Src_Dirs/CORE      := $(CORE_PATHS)
 Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS)
 Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS)
 Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS)
 Src_Dirs/ZERO      := $(CORE_PATHS)
-Src_Dirs/SHARK     := $(CORE_PATHS)
+Src_Dirs/SHARK     := $(CORE_PATHS) $(SHARK_PATHS)
 Src_Dirs := $(Src_Dirs/$(TYPE))
 
 COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp chaitin\* c2_\* runtime_\*
--- a/hotspot/make/solaris/makefiles/sa.make	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/make/solaris/makefiles/sa.make	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 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
@@ -88,8 +88,8 @@
 	$(foreach file,$(AGENT_FILES1),$(shell echo $(file) >> $(AGENT_FILES1_LIST)))
 	$(foreach file,$(AGENT_FILES2),$(shell echo $(file) >> $(AGENT_FILES2_LIST)))
 	
-	$(QUIETLY) $(COMPILE.JAVAC) -source 1.4 -target 1.4 -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES1_LIST)
-	$(QUIETLY) $(COMPILE.JAVAC) -source 1.4 -target 1.4 -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES2_LIST)
+	$(QUIETLY) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES1_LIST)
+	$(QUIETLY) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES2_LIST)
 	
 	$(QUIETLY) $(COMPILE.RMIC)  -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
 	$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
--- a/hotspot/make/windows/makefiles/sa.make	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/make/windows/makefiles/sa.make	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 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
@@ -55,9 +55,9 @@
 $(GENERATED)\sa-jdi.jar: $(AGENT_FILES1:/=\) $(AGENT_FILES2:/=\)
 	@if not exist $(SA_CLASSDIR) mkdir $(SA_CLASSDIR)
 	@echo ...Building sa-jdi.jar
-	@echo ...$(COMPILE_JAVAC) -source 1.4 -target 1.4 -classpath $(SA_CLASSPATH) -d $(SA_CLASSDIR) ....
-	@$(COMPILE_JAVAC) -source 1.4 -target 1.4 -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES1:/=\)
-	@$(COMPILE_JAVAC) -source 1.4 -target 1.4 -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES2:/=\)
+	@echo ...$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -d $(SA_CLASSDIR) ....
+	@$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES1:/=\)
+	@$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES2:/=\)
 	$(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
 	$(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES)
 	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -2058,6 +2058,13 @@
   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
   if (basic_type == T_ARRAY) basic_type = T_OBJECT;
 
+#ifdef _LP64
+  // higher 32bits must be null
+  __ sra(dst_pos, 0, dst_pos);
+  __ sra(src_pos, 0, src_pos);
+  __ sra(length, 0, length);
+#endif
+
   // set up the arraycopy stub information
   ArrayCopyStub* stub = op->stub();
 
@@ -2065,20 +2072,36 @@
   // the known type isn't loaded since the code sanity checks
   // in debug mode and the type isn't required when we know the exact type
   // also check that the type is an array type.
-  // We also, for now, always call the stub if the barrier set requires a
-  // write_ref_pre barrier (which the stub does, but none of the optimized
-  // cases currently does).
-  if (op->expected_type() == NULL ||
-      Universe::heap()->barrier_set()->has_write_ref_pre_barrier()) {
+  if (op->expected_type() == NULL) {
     __ mov(src,     O0);
     __ mov(src_pos, O1);
     __ mov(dst,     O2);
     __ mov(dst_pos, O3);
     __ mov(length,  O4);
-    __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::arraycopy));
-
-    __ br_zero(Assembler::less, false, Assembler::pn, O0, *stub->entry());
-    __ delayed()->nop();
+    address copyfunc_addr = StubRoutines::generic_arraycopy();
+
+    if (copyfunc_addr == NULL) { // Use C version if stub was not generated
+      __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::arraycopy));
+    } else {
+#ifndef PRODUCT
+      if (PrintC1Statistics) {
+        address counter = (address)&Runtime1::_generic_arraycopystub_cnt;
+        __ inc_counter(counter, G1, G3);
+      }
+#endif
+      __ call_VM_leaf(tmp, copyfunc_addr);
+    }
+
+    if (copyfunc_addr != NULL) {
+      __ xor3(O0, -1, tmp);
+      __ sub(length, tmp, length);
+      __ add(src_pos, tmp, src_pos);
+      __ br_zero(Assembler::less, false, Assembler::pn, O0, *stub->entry());
+      __ delayed()->add(dst_pos, tmp, dst_pos);
+    } else {
+      __ br_zero(Assembler::less, false, Assembler::pn, O0, *stub->entry());
+      __ delayed()->nop();
+    }
     __ bind(*stub->continuation());
     return;
   }
@@ -2135,20 +2158,137 @@
     __ delayed()->nop();
   }
 
+  int shift = shift_amount(basic_type);
+
   if (flags & LIR_OpArrayCopy::type_check) {
-    if (UseCompressedOops) {
-      // We don't need decode because we just need to compare
-      __ lduw(src, oopDesc::klass_offset_in_bytes(), tmp);
-      __ lduw(dst, oopDesc::klass_offset_in_bytes(), tmp2);
-      __ cmp(tmp, tmp2);
-      __ br(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+    // We don't know the array types are compatible
+    if (basic_type != T_OBJECT) {
+      // Simple test for basic type arrays
+      if (UseCompressedOops) {
+        // We don't need decode because we just need to compare
+        __ lduw(src, oopDesc::klass_offset_in_bytes(), tmp);
+        __ lduw(dst, oopDesc::klass_offset_in_bytes(), tmp2);
+        __ cmp(tmp, tmp2);
+        __ br(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+      } else {
+        __ ld_ptr(src, oopDesc::klass_offset_in_bytes(), tmp);
+        __ ld_ptr(dst, oopDesc::klass_offset_in_bytes(), tmp2);
+        __ cmp(tmp, tmp2);
+        __ brx(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+      }
+      __ delayed()->nop();
     } else {
-      __ ld_ptr(src, oopDesc::klass_offset_in_bytes(), tmp);
-      __ ld_ptr(dst, oopDesc::klass_offset_in_bytes(), tmp2);
-      __ cmp(tmp, tmp2);
-      __ brx(Assembler::notEqual, false, Assembler::pt, *stub->entry());
+      // For object arrays, if src is a sub class of dst then we can
+      // safely do the copy.
+      address copyfunc_addr = StubRoutines::checkcast_arraycopy();
+
+      Label cont, slow;
+      assert_different_registers(tmp, tmp2, G3, G1);
+
+      __ load_klass(src, G3);
+      __ load_klass(dst, G1);
+
+      __ check_klass_subtype_fast_path(G3, G1, tmp, tmp2, &cont, copyfunc_addr == NULL ? stub->entry() : &slow, NULL);
+
+      __ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
+      __ delayed()->nop();
+
+      __ cmp(G3, 0);
+      if (copyfunc_addr != NULL) { // use stub if available
+        // src is not a sub class of dst so we have to do a
+        // per-element check.
+        __ br(Assembler::notEqual, false, Assembler::pt, cont);
+        __ delayed()->nop();
+
+        __ bind(slow);
+
+        int mask = LIR_OpArrayCopy::src_objarray|LIR_OpArrayCopy::dst_objarray;
+        if ((flags & mask) != mask) {
+          // Check that at least both of them object arrays.
+          assert(flags & mask, "one of the two should be known to be an object array");
+
+          if (!(flags & LIR_OpArrayCopy::src_objarray)) {
+            __ load_klass(src, tmp);
+          } else if (!(flags & LIR_OpArrayCopy::dst_objarray)) {
+            __ load_klass(dst, tmp);
+          }
+          int lh_offset = klassOopDesc::header_size() * HeapWordSize +
+            Klass::layout_helper_offset_in_bytes();
+
+          __ lduw(tmp, lh_offset, tmp2);
+
+          jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
+          __ set(objArray_lh, tmp);
+          __ cmp(tmp, tmp2);
+          __ br(Assembler::notEqual, false, Assembler::pt,  *stub->entry());
+          __ delayed()->nop();
+        }
+
+        Register src_ptr = O0;
+        Register dst_ptr = O1;
+        Register len     = O2;
+        Register chk_off = O3;
+        Register super_k = O4;
+
+        __ add(src, arrayOopDesc::base_offset_in_bytes(basic_type), src_ptr);
+        if (shift == 0) {
+          __ add(src_ptr, src_pos, src_ptr);
+        } else {
+          __ sll(src_pos, shift, tmp);
+          __ add(src_ptr, tmp, src_ptr);
+        }
+
+        __ add(dst, arrayOopDesc::base_offset_in_bytes(basic_type), dst_ptr);
+        if (shift == 0) {
+          __ add(dst_ptr, dst_pos, dst_ptr);
+        } else {
+          __ sll(dst_pos, shift, tmp);
+          __ add(dst_ptr, tmp, dst_ptr);
+        }
+        __ mov(length, len);
+        __ load_klass(dst, tmp);
+
+        int ek_offset = (klassOopDesc::header_size() * HeapWordSize +
+                         objArrayKlass::element_klass_offset_in_bytes());
+        __ ld_ptr(tmp, ek_offset, super_k);
+
+        int sco_offset = (klassOopDesc::header_size() * HeapWordSize +
+                          Klass::super_check_offset_offset_in_bytes());
+        __ lduw(super_k, sco_offset, chk_off);
+
+        __ call_VM_leaf(tmp, copyfunc_addr);
+
+#ifndef PRODUCT
+        if (PrintC1Statistics) {
+          Label failed;
+          __ br_notnull(O0, false, Assembler::pn,  failed);
+          __ delayed()->nop();
+          __ inc_counter((address)&Runtime1::_arraycopy_checkcast_cnt, G1, G3);
+          __ bind(failed);
+        }
+#endif
+
+        __ br_null(O0, false, Assembler::pt,  *stub->continuation());
+        __ delayed()->xor3(O0, -1, tmp);
+
+#ifndef PRODUCT
+        if (PrintC1Statistics) {
+          __ inc_counter((address)&Runtime1::_arraycopy_checkcast_attempt_cnt, G1, G3);
+        }
+#endif
+
+        __ sub(length, tmp, length);
+        __ add(src_pos, tmp, src_pos);
+        __ br(Assembler::always, false, Assembler::pt, *stub->entry());
+        __ delayed()->add(dst_pos, tmp, dst_pos);
+
+        __ bind(cont);
+      } else {
+        __ br(Assembler::equal, false, Assembler::pn, *stub->entry());
+        __ delayed()->nop();
+        __ bind(cont);
+      }
     }
-    __ delayed()->nop();
   }
 
 #ifdef ASSERT
@@ -2207,14 +2347,18 @@
   }
 #endif
 
-  int shift = shift_amount(basic_type);
+#ifndef PRODUCT
+  if (PrintC1Statistics) {
+    address counter = Runtime1::arraycopy_count_address(basic_type);
+    __ inc_counter(counter, G1, G3);
+  }
+#endif
 
   Register src_ptr = O0;
   Register dst_ptr = O1;
   Register len     = O2;
 
   __ add(src, arrayOopDesc::base_offset_in_bytes(basic_type), src_ptr);
-  LP64_ONLY(__ sra(src_pos, 0, src_pos);) //higher 32bits must be null
   if (shift == 0) {
     __ add(src_ptr, src_pos, src_ptr);
   } else {
@@ -2223,7 +2367,6 @@
   }
 
   __ add(dst, arrayOopDesc::base_offset_in_bytes(basic_type), dst_ptr);
-  LP64_ONLY(__ sra(dst_pos, 0, dst_pos);) //higher 32bits must be null
   if (shift == 0) {
     __ add(dst_ptr, dst_pos, dst_ptr);
   } else {
@@ -2231,18 +2374,14 @@
     __ add(dst_ptr, tmp, dst_ptr);
   }
 
-  if (basic_type != T_OBJECT) {
-    if (shift == 0) {
-      __ mov(length, len);
-    } else {
-      __ sll(length, shift, len);
-    }
-    __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::primitive_arraycopy));
-  } else {
-    // oop_arraycopy takes a length in number of elements, so don't scale it.
-    __ mov(length, len);
-    __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::oop_arraycopy));
-  }
+  bool disjoint = (flags & LIR_OpArrayCopy::overlapping) == 0;
+  bool aligned = (flags & LIR_OpArrayCopy::unaligned) == 0;
+  const char *name;
+  address entry = StubRoutines::select_arraycopy_function(basic_type, aligned, disjoint, name, false);
+
+  // arraycopy stubs takes a length in number of elements, so don't scale it.
+  __ mov(length, len);
+  __ call_VM_leaf(tmp, entry);
 
   __ bind(*stub->continuation());
 }
--- a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -387,7 +387,7 @@
 
 void C1_MacroAssembler::verify_not_null_oop(Register r) {
   Label not_null;
-  br_zero(Assembler::notEqual, false, Assembler::pt, r, not_null);
+  br_notnull(r, false, Assembler::pt, not_null);
   delayed()->nop();
   stop("non-null oop required");
   bind(not_null);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -2317,7 +2317,7 @@
 }
 
 void Assembler::prefetchr(Address src) {
-  NOT_LP64(assert(VM_Version::supports_3dnow(), "must support"));
+  NOT_LP64(assert(VM_Version::supports_3dnow_prefetch(), "must support"));
   InstructionMark im(this);
   prefetch_prefix(src);
   emit_byte(0x0D);
@@ -2349,7 +2349,7 @@
 }
 
 void Assembler::prefetchw(Address src) {
-  NOT_LP64(assert(VM_Version::supports_3dnow(), "must support"));
+  NOT_LP64(assert(VM_Version::supports_3dnow_prefetch(), "must support"));
   InstructionMark im(this);
   prefetch_prefix(src);
   emit_byte(0x0D);
@@ -7941,12 +7941,12 @@
 #endif
   push(rax);                          // save rax,
   // addr may contain rsp so we will have to adjust it based on the push
-  // we just did
+  // we just did (and on 64 bit we do two pushes)
   // NOTE: 64bit seemed to have had a bug in that it did movq(addr, rax); which
   // stores rax into addr which is backwards of what was intended.
   if (addr.uses(rsp)) {
     lea(rax, addr);
-    pushptr(Address(rax, BytesPerWord));
+    pushptr(Address(rax, LP64_ONLY(2 *) BytesPerWord));
   } else {
     pushptr(addr);
   }
@@ -8396,6 +8396,17 @@
     movptr(dst, src);
 }
 
+// Doesn't do verfication, generates fixed size code
+void MacroAssembler::load_heap_oop_not_null(Register dst, Address src) {
+#ifdef _LP64
+  if (UseCompressedOops) {
+    movl(dst, src);
+    decode_heap_oop_not_null(dst);
+  } else
+#endif
+    movptr(dst, src);
+}
+
 void MacroAssembler::store_heap_oop(Address dst, Register src) {
 #ifdef _LP64
   if (UseCompressedOops) {
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -385,10 +385,18 @@
 };
 
 class ExternalAddress: public AddressLiteral {
-
-  public:
-
-  ExternalAddress(address target) : AddressLiteral(target, relocInfo::external_word_type){}
+ private:
+  static relocInfo::relocType reloc_for_target(address target) {
+    // Sometimes ExternalAddress is used for values which aren't
+    // exactly addresses, like the card table base.
+    // external_word_type can't be used for values in the first page
+    // so just skip the reloc in that case.
+    return external_word_Relocation::can_be_relocated(target) ? relocInfo::external_word_type : relocInfo::none;
+  }
+
+ public:
+
+  ExternalAddress(address target) : AddressLiteral(target, reloc_for_target(target)) {}
 
 };
 
@@ -1701,6 +1709,7 @@
   void store_klass(Register dst, Register src);
 
   void load_heap_oop(Register dst, Address src);
+  void load_heap_oop_not_null(Register dst, Address src);
   void store_heap_oop(Address dst, Register src);
 
   // Used for storing NULL. All other oop constants should be
--- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -316,7 +316,9 @@
     Register tmp2 = rbx;
     __ push(tmp);
     __ push(tmp2);
-    __ load_heap_oop(tmp2, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
+    // Load without verification to keep code size small. We need it because
+    // begin_initialized_entry_offset has to fit in a byte. Also, we know it's not null.
+    __ load_heap_oop_not_null(tmp2, Address(_obj, java_lang_Class::klass_offset_in_bytes()));
     __ get_thread(tmp);
     __ cmpptr(tmp, Address(tmp2, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc)));
     __ pop(tmp2);
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1401,7 +1401,7 @@
       default:
         ShouldNotReachHere(); break;
     }
-  } else if (VM_Version::supports_3dnow()) {
+  } else if (VM_Version::supports_3dnow_prefetch()) {
     __ prefetchr(from_addr);
   }
 }
@@ -1424,7 +1424,7 @@
       default:
         ShouldNotReachHere(); break;
     }
-  } else if (VM_Version::supports_3dnow()) {
+  } else if (VM_Version::supports_3dnow_prefetch()) {
     __ prefetchw(from_addr);
   }
 }
@@ -3102,7 +3102,7 @@
   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
   if (basic_type == T_ARRAY) basic_type = T_OBJECT;
 
-  // if we don't know anything or it's an object array, just go through the generic arraycopy
+  // if we don't know anything, just go through the generic arraycopy
   if (default_type == NULL) {
     Label done;
     // save outgoing arguments on stack in case call to System.arraycopy is needed
@@ -3123,7 +3123,9 @@
     store_parameter(src, 4);
     NOT_LP64(assert(src == rcx && src_pos == rdx, "mismatch in calling convention");)
 
-    address entry = CAST_FROM_FN_PTR(address, Runtime1::arraycopy);
+    address C_entry = CAST_FROM_FN_PTR(address, Runtime1::arraycopy);
+
+    address copyfunc_addr = StubRoutines::generic_arraycopy();
 
     // pass arguments: may push as this is not a safepoint; SP must be fix at each safepoint
 #ifdef _LP64
@@ -3141,11 +3143,29 @@
     // Allocate abi space for args but be sure to keep stack aligned
     __ subptr(rsp, 6*wordSize);
     store_parameter(j_rarg4, 4);
-    __ call(RuntimeAddress(entry));
+    if (copyfunc_addr == NULL) { // Use C version if stub was not generated
+      __ call(RuntimeAddress(C_entry));
+    } else {
+#ifndef PRODUCT
+      if (PrintC1Statistics) {
+        __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));
+      }
+#endif
+      __ call(RuntimeAddress(copyfunc_addr));
+    }
     __ addptr(rsp, 6*wordSize);
 #else
     __ mov(c_rarg4, j_rarg4);
-    __ call(RuntimeAddress(entry));
+    if (copyfunc_addr == NULL) { // Use C version if stub was not generated
+      __ call(RuntimeAddress(C_entry));
+    } else {
+#ifndef PRODUCT
+      if (PrintC1Statistics) {
+        __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));
+      }
+#endif
+      __ call(RuntimeAddress(copyfunc_addr));
+    }
 #endif // _WIN64
 #else
     __ push(length);
@@ -3153,13 +3173,28 @@
     __ push(dst);
     __ push(src_pos);
     __ push(src);
-    __ call_VM_leaf(entry, 5); // removes pushed parameter from the stack
+
+    if (copyfunc_addr == NULL) { // Use C version if stub was not generated
+      __ call_VM_leaf(C_entry, 5); // removes pushed parameter from the stack
+    } else {
+#ifndef PRODUCT
+      if (PrintC1Statistics) {
+        __ incrementl(ExternalAddress((address)&Runtime1::_generic_arraycopystub_cnt));
+      }
+#endif
+      __ call_VM_leaf(copyfunc_addr, 5); // removes pushed parameter from the stack
+    }
 
 #endif // _LP64
 
     __ cmpl(rax, 0);
     __ jcc(Assembler::equal, *stub->continuation());
 
+    if (copyfunc_addr != NULL) {
+      __ mov(tmp, rax);
+      __ xorl(tmp, -1);
+    }
+
     // Reload values from the stack so they are where the stub
     // expects them.
     __ movptr   (dst,     Address(rsp, 0*BytesPerWord));
@@ -3167,6 +3202,12 @@
     __ movptr   (length,  Address(rsp, 2*BytesPerWord));
     __ movptr   (src_pos, Address(rsp, 3*BytesPerWord));
     __ movptr   (src,     Address(rsp, 4*BytesPerWord));
+
+    if (copyfunc_addr != NULL) {
+      __ subl(length, tmp);
+      __ addl(src_pos, tmp);
+      __ addl(dst_pos, tmp);
+    }
     __ jmp(*stub->entry());
 
     __ bind(*stub->continuation());
@@ -3226,10 +3267,6 @@
     __ testl(dst_pos, dst_pos);
     __ jcc(Assembler::less, *stub->entry());
   }
-  if (flags & LIR_OpArrayCopy::length_positive_check) {
-    __ testl(length, length);
-    __ jcc(Assembler::less, *stub->entry());
-  }
 
   if (flags & LIR_OpArrayCopy::src_range_check) {
     __ lea(tmp, Address(src_pos, length, Address::times_1, 0));
@@ -3242,15 +3279,190 @@
     __ jcc(Assembler::above, *stub->entry());
   }
 
+  if (flags & LIR_OpArrayCopy::length_positive_check) {
+    __ testl(length, length);
+    __ jcc(Assembler::less, *stub->entry());
+    __ jcc(Assembler::zero, *stub->continuation());
+  }
+
+#ifdef _LP64
+  __ movl2ptr(src_pos, src_pos); //higher 32bits must be null
+  __ movl2ptr(dst_pos, dst_pos); //higher 32bits must be null
+#endif
+
   if (flags & LIR_OpArrayCopy::type_check) {
-    if (UseCompressedOops) {
-      __ movl(tmp, src_klass_addr);
-      __ cmpl(tmp, dst_klass_addr);
+    // We don't know the array types are compatible
+    if (basic_type != T_OBJECT) {
+      // Simple test for basic type arrays
+      if (UseCompressedOops) {
+        __ movl(tmp, src_klass_addr);
+        __ cmpl(tmp, dst_klass_addr);
+      } else {
+        __ movptr(tmp, src_klass_addr);
+        __ cmpptr(tmp, dst_klass_addr);
+      }
+      __ jcc(Assembler::notEqual, *stub->entry());
     } else {
-      __ movptr(tmp, src_klass_addr);
-      __ cmpptr(tmp, dst_klass_addr);
+      // For object arrays, if src is a sub class of dst then we can
+      // safely do the copy.
+      Label cont, slow;
+
+      __ push(src);
+      __ push(dst);
+
+      __ load_klass(src, src);
+      __ load_klass(dst, dst);
+
+      __ check_klass_subtype_fast_path(src, dst, tmp, &cont, &slow, NULL);
+
+      __ push(src);
+      __ push(dst);
+      __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::slow_subtype_check_id)));
+      __ pop(dst);
+      __ pop(src);
+
+      __ cmpl(src, 0);
+      __ jcc(Assembler::notEqual, cont);
+
+      __ bind(slow);
+      __ pop(dst);
+      __ pop(src);
+
+      address copyfunc_addr = StubRoutines::checkcast_arraycopy();
+      if (copyfunc_addr != NULL) { // use stub if available
+        // src is not a sub class of dst so we have to do a
+        // per-element check.
+
+        int mask = LIR_OpArrayCopy::src_objarray|LIR_OpArrayCopy::dst_objarray;
+        if ((flags & mask) != mask) {
+          // Check that at least both of them object arrays.
+          assert(flags & mask, "one of the two should be known to be an object array");
+
+          if (!(flags & LIR_OpArrayCopy::src_objarray)) {
+            __ load_klass(tmp, src);
+          } else if (!(flags & LIR_OpArrayCopy::dst_objarray)) {
+            __ load_klass(tmp, dst);
+          }
+          int lh_offset = klassOopDesc::header_size() * HeapWordSize +
+            Klass::layout_helper_offset_in_bytes();
+          Address klass_lh_addr(tmp, lh_offset);
+          jint objArray_lh = Klass::array_layout_helper(T_OBJECT);
+          __ cmpl(klass_lh_addr, objArray_lh);
+          __ jcc(Assembler::notEqual, *stub->entry());
+        }
+
+#ifndef _LP64
+        // save caller save registers
+        store_parameter(rax, 2);
+        store_parameter(rcx, 1);
+        store_parameter(rdx, 0);
+
+        __ movptr(tmp, dst_klass_addr);
+        __ movptr(tmp, Address(tmp, objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)));
+        __ push(tmp);
+        __ movl(tmp, Address(tmp, Klass::super_check_offset_offset_in_bytes() + sizeof(oopDesc)));
+        __ push(tmp);
+        __ push(length);
+        __ lea(tmp, Address(dst, dst_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
+        __ push(tmp);
+        __ lea(tmp, Address(src, src_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
+        __ push(tmp);
+
+        __ call_VM_leaf(copyfunc_addr, 5);
+#else
+        __ movl2ptr(length, length); //higher 32bits must be null
+
+        // save caller save registers: copy them to callee save registers
+        __ mov(rbx, rdx);
+        __ mov(r13, r8);
+        __ mov(r14, r9);
+#ifndef _WIN64
+        store_parameter(rsi, 1);
+        store_parameter(rcx, 0);
+        // on WIN64 other incoming parameters are in rdi and rsi saved
+        // across the call
+#endif
+
+        __ lea(c_rarg0, Address(src, src_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
+        assert_different_registers(c_rarg0, dst, dst_pos, length);
+        __ lea(c_rarg1, Address(dst, dst_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
+        assert_different_registers(c_rarg1, dst, length);
+
+        __ mov(c_rarg2, length);
+        assert_different_registers(c_rarg2, dst);
+
+#ifdef _WIN64
+        // Allocate abi space for args but be sure to keep stack aligned
+        __ subptr(rsp, 6*wordSize);
+        __ load_klass(c_rarg3, dst);
+        __ movptr(c_rarg3, Address(c_rarg3, objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)));
+        store_parameter(c_rarg3, 4);
+        __ movl(c_rarg3, Address(c_rarg3, Klass::super_check_offset_offset_in_bytes() + sizeof(oopDesc)));
+        __ call(RuntimeAddress(copyfunc_addr));
+        __ addptr(rsp, 6*wordSize);
+#else
+        __ load_klass(c_rarg4, dst);
+        __ movptr(c_rarg4, Address(c_rarg4, objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)));
+        __ movl(c_rarg3, Address(c_rarg4, Klass::super_check_offset_offset_in_bytes() + sizeof(oopDesc)));
+        __ call(RuntimeAddress(copyfunc_addr));
+#endif
+
+#endif
+
+#ifndef PRODUCT
+        if (PrintC1Statistics) {
+          Label failed;
+          __ testl(rax, rax);
+          __ jcc(Assembler::notZero, failed);
+          __ incrementl(ExternalAddress((address)&Runtime1::_arraycopy_checkcast_cnt));
+          __ bind(failed);
+        }
+#endif
+
+        __ testl(rax, rax);
+        __ jcc(Assembler::zero, *stub->continuation());
+
+#ifndef PRODUCT
+        if (PrintC1Statistics) {
+          __ incrementl(ExternalAddress((address)&Runtime1::_arraycopy_checkcast_attempt_cnt));
+        }
+#endif
+
+        __ mov(tmp, rax);
+
+        __ xorl(tmp, -1);
+
+#ifndef _LP64
+        // restore caller save registers
+        assert_different_registers(tmp, rdx, rcx, rax); // result of stub will be lost
+        __ movptr(rdx, Address(rsp, 0*BytesPerWord));
+        __ movptr(rcx, Address(rsp, 1*BytesPerWord));
+        __ movptr(rax, Address(rsp, 2*BytesPerWord));
+#else
+        // restore caller save registers
+        __ mov(rdx, rbx);
+        __ mov(r8, r13);
+        __ mov(r9, r14);
+#ifndef _WIN64
+        assert_different_registers(tmp, rdx, r8, r9, rcx, rsi); // result of stub will be lost
+        __ movptr(rcx, Address(rsp, 0*BytesPerWord));
+        __ movptr(rsi, Address(rsp, 1*BytesPerWord));
+#else
+        assert_different_registers(tmp, rdx, r8, r9); // result of stub will be lost
+#endif
+#endif
+
+        __ subl(length, tmp);
+        __ addl(src_pos, tmp);
+        __ addl(dst_pos, tmp);
+      }
+
+      __ jmp(*stub->entry());
+
+      __ bind(cont);
+      __ pop(dst);
+      __ pop(src);
     }
-    __ jcc(Assembler::notEqual, *stub->entry());
   }
 
 #ifdef ASSERT
@@ -3291,16 +3503,16 @@
   }
 #endif
 
-  if (shift_amount > 0 && basic_type != T_OBJECT) {
-    __ shlptr(length, shift_amount);
+#ifndef PRODUCT
+  if (PrintC1Statistics) {
+    __ incrementl(ExternalAddress(Runtime1::arraycopy_count_address(basic_type)));
   }
+#endif
 
 #ifdef _LP64
   assert_different_registers(c_rarg0, dst, dst_pos, length);
-  __ movl2ptr(src_pos, src_pos); //higher 32bits must be null
   __ lea(c_rarg0, Address(src, src_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
   assert_different_registers(c_rarg1, length);
-  __ movl2ptr(dst_pos, dst_pos); //higher 32bits must be null
   __ lea(c_rarg1, Address(dst, dst_pos, scale, arrayOopDesc::base_offset_in_bytes(basic_type)));
   __ mov(c_rarg2, length);
 
@@ -3311,11 +3523,12 @@
   store_parameter(tmp, 1);
   store_parameter(length, 2);
 #endif // _LP64
-  if (basic_type == T_OBJECT) {
-    __ call_VM_leaf(CAST_FROM_FN_PTR(address, Runtime1::oop_arraycopy), 0);
-  } else {
-    __ call_VM_leaf(CAST_FROM_FN_PTR(address, Runtime1::primitive_arraycopy), 0);
-  }
+
+  bool disjoint = (flags & LIR_OpArrayCopy::overlapping) == 0;
+  bool aligned = (flags & LIR_OpArrayCopy::unaligned) == 0;
+  const char *name;
+  address entry = StubRoutines::select_arraycopy_function(basic_type, aligned, disjoint, name, false);
+  __ call_VM_leaf(entry, 0);
 
   __ bind(*stub->continuation());
 }
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -348,7 +348,7 @@
   }
 
   char buf[256];
-  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                cores_per_cpu(), threads_per_core(),
                cpu_family(), _model, _stepping,
                (supports_cmov() ? ", cmov" : ""),
@@ -363,8 +363,7 @@
                (supports_sse4_2() ? ", sse4.2" : ""),
                (supports_popcnt() ? ", popcnt" : ""),
                (supports_mmx_ext() ? ", mmxext" : ""),
-               (supports_3dnow()   ? ", 3dnow"  : ""),
-               (supports_3dnow2()  ? ", 3dnowext" : ""),
+               (supports_3dnow_prefetch() ? ", 3dnowpref" : ""),
                (supports_lzcnt()   ? ", lzcnt": ""),
                (supports_sse4a()   ? ", sse4a": ""),
                (supports_ht() ? ", ht": ""));
@@ -522,13 +521,13 @@
   // set valid Prefetch instruction
   if( ReadPrefetchInstr < 0 ) ReadPrefetchInstr = 0;
   if( ReadPrefetchInstr > 3 ) ReadPrefetchInstr = 3;
-  if( ReadPrefetchInstr == 3 && !supports_3dnow() ) ReadPrefetchInstr = 0;
-  if( !supports_sse() && supports_3dnow() ) ReadPrefetchInstr = 3;
+  if( ReadPrefetchInstr == 3 && !supports_3dnow_prefetch() ) ReadPrefetchInstr = 0;
+  if( !supports_sse() && supports_3dnow_prefetch() ) ReadPrefetchInstr = 3;
 
   if( AllocatePrefetchInstr < 0 ) AllocatePrefetchInstr = 0;
   if( AllocatePrefetchInstr > 3 ) AllocatePrefetchInstr = 3;
-  if( AllocatePrefetchInstr == 3 && !supports_3dnow() ) AllocatePrefetchInstr=0;
-  if( !supports_sse() && supports_3dnow() ) AllocatePrefetchInstr = 3;
+  if( AllocatePrefetchInstr == 3 && !supports_3dnow_prefetch() ) AllocatePrefetchInstr=0;
+  if( !supports_sse() && supports_3dnow_prefetch() ) AllocatePrefetchInstr = 3;
 
   // Allocation prefetch settings
   intx cache_line_size = L1_data_cache_line_size();
@@ -576,10 +575,10 @@
                   logical_processors_per_package());
     tty->print_cr("UseSSE=%d",UseSSE);
     tty->print("Allocation: ");
-    if (AllocatePrefetchStyle <= 0 || UseSSE == 0 && !supports_3dnow()) {
+    if (AllocatePrefetchStyle <= 0 || UseSSE == 0 && !supports_3dnow_prefetch()) {
       tty->print_cr("no prefetching");
     } else {
-      if (UseSSE == 0 && supports_3dnow()) {
+      if (UseSSE == 0 && supports_3dnow_prefetch()) {
         tty->print("PREFETCHW");
       } else if (UseSSE >= 1) {
         if (AllocatePrefetchInstr == 0) {
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -188,7 +188,8 @@
      CPU_FXSR   = (1 << 2),
      CPU_HT     = (1 << 3),
      CPU_MMX    = (1 << 4),
-     CPU_3DNOW  = (1 << 5), // 3DNow comes from cpuid 0x80000001 (EDX)
+     CPU_3DNOW_PREFETCH  = (1 << 5), // Processor supports 3dnow prefetch and prefetchw instructions
+                                     // may not necessarily support other 3dnow instructions
      CPU_SSE    = (1 << 6),
      CPU_SSE2   = (1 << 7),
      CPU_SSE3   = (1 << 8), // SSE3 comes from cpuid 1 (ECX)
@@ -328,8 +329,9 @@
 
     // AMD features.
     if (is_amd()) {
-      if (_cpuid_info.ext_cpuid1_edx.bits.tdnow != 0)
-        result |= CPU_3DNOW;
+      if ((_cpuid_info.ext_cpuid1_edx.bits.tdnow != 0) ||
+          (_cpuid_info.ext_cpuid1_ecx.bits.prefetchw != 0))
+        result |= CPU_3DNOW_PREFETCH;
       if (_cpuid_info.ext_cpuid1_ecx.bits.lzcnt != 0)
         result |= CPU_LZCNT;
       if (_cpuid_info.ext_cpuid1_ecx.bits.sse4a != 0)
@@ -446,9 +448,8 @@
   //
   // AMD features
   //
-  static bool supports_3dnow()    { return (_cpuFeatures & CPU_3DNOW) != 0; }
+  static bool supports_3dnow_prefetch()    { return (_cpuFeatures & CPU_3DNOW_PREFETCH) != 0; }
   static bool supports_mmx_ext()  { return is_amd() && _cpuid_info.ext_cpuid1_edx.bits.mmx_amd != 0; }
-  static bool supports_3dnow2()   { return is_amd() && _cpuid_info.ext_cpuid1_edx.bits.tdnow2 != 0; }
   static bool supports_lzcnt()    { return (_cpuFeatures & CPU_LZCNT) != 0; }
   static bool supports_sse4a()    { return (_cpuFeatures & CPU_SSE4A) != 0; }
 
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Tue Apr 26 15:48:03 2011 -0700
@@ -3423,7 +3423,7 @@
          masm.movptr(boxReg, tmpReg);                   // consider: LEA box, [tmp-2] 
 
          // Using a prefetchw helps avoid later RTS->RTO upgrades and cache probes
-         if ((EmitSync & 2048) && VM_Version::supports_3dnow() && os::is_MP()) {
+         if ((EmitSync & 2048) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
             // prefetchw [eax + Offset(_owner)-2]
             masm.prefetchw(Address(rax, ObjectMonitor::owner_offset_in_bytes()-2));
          }
@@ -3467,7 +3467,7 @@
          masm.movptr(boxReg, tmpReg) ; 
 
          // Using a prefetchw helps avoid later RTS->RTO upgrades and cache probes
-         if ((EmitSync & 2048) && VM_Version::supports_3dnow() && os::is_MP()) {
+         if ((EmitSync & 2048) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
             // prefetchw [eax + Offset(_owner)-2]
             masm.prefetchw(Address(rax, ObjectMonitor::owner_offset_in_bytes()-2));
          }
@@ -3614,7 +3614,7 @@
       // See also http://gee.cs.oswego.edu/dl/jmm/cookbook.html.
 
       masm.get_thread (boxReg) ;
-      if ((EmitSync & 4096) && VM_Version::supports_3dnow() && os::is_MP()) {
+      if ((EmitSync & 4096) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
         // prefetchw [ebx + Offset(_owner)-2]
         masm.prefetchw(Address(rbx, ObjectMonitor::owner_offset_in_bytes()-2));
       }
@@ -7333,7 +7333,7 @@
 // Must be safe to execute with invalid address (cannot fault).
 
 instruct prefetchr0( memory mem ) %{
-  predicate(UseSSE==0 && !VM_Version::supports_3dnow());
+  predicate(UseSSE==0 && !VM_Version::supports_3dnow_prefetch());
   match(PrefetchRead mem);
   ins_cost(0);
   size(0);
@@ -7343,7 +7343,7 @@
 %}
 
 instruct prefetchr( memory mem ) %{
-  predicate(UseSSE==0 && VM_Version::supports_3dnow() || ReadPrefetchInstr==3);
+  predicate(UseSSE==0 && VM_Version::supports_3dnow_prefetch() || ReadPrefetchInstr==3);
   match(PrefetchRead mem);
   ins_cost(100);
 
@@ -7387,7 +7387,7 @@
 %}
 
 instruct prefetchw0( memory mem ) %{
-  predicate(UseSSE==0 && !VM_Version::supports_3dnow());
+  predicate(UseSSE==0 && !VM_Version::supports_3dnow_prefetch());
   match(PrefetchWrite mem);
   ins_cost(0);
   size(0);
@@ -7397,7 +7397,7 @@
 %}
 
 instruct prefetchw( memory mem ) %{
-  predicate(UseSSE==0 && VM_Version::supports_3dnow() || AllocatePrefetchInstr==3);
+  predicate(UseSSE==0 && VM_Version::supports_3dnow_prefetch() || AllocatePrefetchInstr==3);
   match( PrefetchWrite mem );
   ins_cost(100);
 
--- a/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008 Red Hat, Inc.
+ * Copyright 2007, 2008, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -150,4 +150,22 @@
 #define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
                                                 ((VMJavaVal64*)(addr))->l)
 
+// VMSlots implementation
+
+#define VMSLOTS_SLOT(offset)    ((intptr_t*)&vmslots[(offset)])
+#define VMSLOTS_ADDR(offset)    ((address)vmslots[(offset)])
+#define VMSLOTS_INT(offset)     (*((jint*)&vmslots[(offset)]))
+#define VMSLOTS_FLOAT(offset)   (*((jfloat*)&vmslots[(offset)]))
+#define VMSLOTS_OBJECT(offset)  ((oop)vmslots[(offset)])
+#define VMSLOTS_DOUBLE(offset)  (((VMJavaVal64*)&vmslots[(offset) - 1])->d)
+#define VMSLOTS_LONG(offset)    (((VMJavaVal64*)&vmslots[(offset) - 1])->l)
+
+#define SET_VMSLOTS_SLOT(value, offset)   (*(intptr_t*)&vmslots[(offset)] = *(intptr_t *)(value))
+#define SET_VMSLOTS_ADDR(value, offset)   (*((address *)&vmslots[(offset)]) = (value))
+#define SET_VMSLOTS_INT(value, offset)    (*((jint *)&vmslots[(offset)]) = (value))
+#define SET_VMSLOTS_FLOAT(value, offset)  (*((jfloat *)&vmslots[(offset)]) = (value))
+#define SET_VMSLOTS_OBJECT(value, offset) (*((oop *)&vmslots[(offset)]) = (value))
+#define SET_VMSLOTS_DOUBLE(value, offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->d = (value))
+#define SET_VMSLOTS_LONG(value, offset)   (((VMJavaVal64*)&vmslots[(offset) - 1])->l = (value))
+
 #endif // CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,10 +56,13 @@
 #define fixup_after_potential_safepoint()       \
   method = istate->method()
 
-#define CALL_VM_NOCHECK(func)                   \
+#define CALL_VM_NOCHECK_NOFIX(func)             \
   thread->set_last_Java_frame();                \
   func;                                         \
-  thread->reset_last_Java_frame();              \
+  thread->reset_last_Java_frame();
+
+#define CALL_VM_NOCHECK(func)                   \
+  CALL_VM_NOCHECK_NOFIX(func)                   \
   fixup_after_potential_safepoint()
 
 int CppInterpreter::normal_entry(methodOop method, intptr_t UNUSED, TRAPS) {
@@ -177,6 +180,25 @@
         method, istate->osr_entry(), istate->osr_buf(), THREAD);
       return;
     }
+    else if (istate->msg() == BytecodeInterpreter::call_method_handle) {
+      oop method_handle = istate->callee();
+
+      // Trim back the stack to put the parameters at the top
+      stack->set_sp(istate->stack() + 1);
+
+      // Make the call
+      process_method_handle(method_handle, THREAD);
+      fixup_after_potential_safepoint();
+
+      // Convert the result
+      istate->set_stack(stack->sp() - 1);
+
+      // Restore the stack
+      stack->set_sp(istate->stack_limit() + 1);
+
+      // Resume the interpreter
+      istate->set_msg(BytecodeInterpreter::method_resume);
+    }
     else {
       ShouldNotReachHere();
     }
@@ -607,6 +629,549 @@
   return 0;
 }
 
+int CppInterpreter::method_handle_entry(methodOop method,
+                                        intptr_t UNUSED, TRAPS) {
+  JavaThread *thread = (JavaThread *) THREAD;
+  ZeroStack *stack = thread->zero_stack();
+  int argument_slots = method->size_of_parameters();
+  int result_slots = type2size[result_type_of(method)];
+  intptr_t *vmslots = stack->sp();
+  intptr_t *unwind_sp = vmslots + argument_slots;
+
+  // Find the MethodType
+  address p = (address) method;
+  for (jint* pc = method->method_type_offsets_chain(); (*pc) != -1; pc++) {
+    p = *(address*)(p + (*pc));
+  }
+  oop method_type = (oop) p;
+
+  // The MethodHandle is in the slot after the arguments
+  oop form = java_lang_invoke_MethodType::form(method_type);
+  int num_vmslots = java_lang_invoke_MethodTypeForm::vmslots(form);
+  assert(argument_slots == num_vmslots + 1, "should be");
+  oop method_handle = VMSLOTS_OBJECT(num_vmslots);
+
+  // InvokeGeneric requires some extra shuffling
+  oop mhtype = java_lang_invoke_MethodHandle::type(method_handle);
+  bool is_exact = mhtype == method_type;
+  if (!is_exact) {
+    if (method->intrinsic_id() == vmIntrinsics::_invokeExact) {
+      CALL_VM_NOCHECK_NOFIX(
+        InterpreterRuntime::throw_WrongMethodTypeException(
+          thread, method_type, mhtype));
+      // NB all oops trashed!
+      assert(HAS_PENDING_EXCEPTION, "should do");
+      stack->set_sp(unwind_sp);
+      return 0;
+    }
+    assert(method->intrinsic_id() == vmIntrinsics::_invokeGeneric, "should be");
+
+    // Load up an adapter from the calling type
+    // NB the x86 code for this (in methodHandles_x86.cpp, search for
+    // "genericInvoker") is really really odd.  I'm hoping it's trying
+    // to accomodate odd VM/class library combinations I can ignore.
+    oop adapter = java_lang_invoke_MethodTypeForm::genericInvoker(form);
+    if (adapter == NULL) {
+      CALL_VM_NOCHECK_NOFIX(
+        InterpreterRuntime::throw_WrongMethodTypeException(
+          thread, method_type, mhtype));
+      // NB all oops trashed!
+      assert(HAS_PENDING_EXCEPTION, "should do");
+      stack->set_sp(unwind_sp);
+      return 0;
+    }
+
+    // Adapters are shared among form-families of method-type.  The
+    // type being called is passed as a trusted first argument so that
+    // the adapter knows the actual types of its arguments and return
+    // values.
+    insert_vmslots(num_vmslots + 1, 1, THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      // NB all oops trashed!
+      stack->set_sp(unwind_sp);
+      return 0;
+    }
+
+    vmslots = stack->sp();
+    num_vmslots++;
+    SET_VMSLOTS_OBJECT(method_type, num_vmslots);
+
+    method_handle = adapter;
+  }
+
+  // Start processing
+  process_method_handle(method_handle, THREAD);
+  if (HAS_PENDING_EXCEPTION)
+    result_slots = 0;
+
+  // If this is an invokeExact then the eventual callee will not
+  // have unwound the method handle argument so we have to do it.
+  // If a result is being returned the it will be above the method
+  // handle argument we're unwinding.
+  if (is_exact) {
+    intptr_t result[2];
+    for (int i = 0; i < result_slots; i++)
+      result[i] = stack->pop();
+    stack->pop();
+    for (int i = result_slots - 1; i >= 0; i--)
+      stack->push(result[i]);
+  }
+
+  // Check
+  assert(stack->sp() == unwind_sp - result_slots, "should be");
+
+  // No deoptimized frames on the stack
+  return 0;
+}
+
+void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
+  JavaThread *thread = (JavaThread *) THREAD;
+  ZeroStack *stack = thread->zero_stack();
+  intptr_t *vmslots = stack->sp();
+
+  bool direct_to_method = false;
+  BasicType src_rtype = T_ILLEGAL;
+  BasicType dst_rtype = T_ILLEGAL;
+
+  MethodHandleEntry *entry =
+    java_lang_invoke_MethodHandle::vmentry(method_handle);
+  MethodHandles::EntryKind entry_kind =
+    (MethodHandles::EntryKind) (((intptr_t) entry) & 0xffffffff);
+
+  methodOop method = NULL;
+  switch (entry_kind) {
+  case MethodHandles::_invokestatic_mh:
+    direct_to_method = true;
+    break;
+
+  case MethodHandles::_invokespecial_mh:
+  case MethodHandles::_invokevirtual_mh:
+  case MethodHandles::_invokeinterface_mh:
+    {
+      oop receiver =
+        VMSLOTS_OBJECT(
+          java_lang_invoke_MethodHandle::vmslots(method_handle) - 1);
+      if (receiver == NULL) {
+          stack->set_sp(calculate_unwind_sp(stack, method_handle));
+          CALL_VM_NOCHECK_NOFIX(
+            throw_exception(
+              thread, vmSymbols::java_lang_NullPointerException()));
+          // NB all oops trashed!
+          assert(HAS_PENDING_EXCEPTION, "should do");
+          return;
+      }
+      if (entry_kind != MethodHandles::_invokespecial_mh) {
+        int index = java_lang_invoke_DirectMethodHandle::vmindex(method_handle);
+        instanceKlass* rcvrKlass =
+          (instanceKlass *) receiver->klass()->klass_part();
+        if (entry_kind == MethodHandles::_invokevirtual_mh) {
+          method = (methodOop) rcvrKlass->start_of_vtable()[index];
+        }
+        else {
+          oop iclass = java_lang_invoke_MethodHandle::vmtarget(method_handle);
+          itableOffsetEntry* ki =
+            (itableOffsetEntry *) rcvrKlass->start_of_itable();
+          int i, length = rcvrKlass->itable_length();
+          for (i = 0; i < length; i++, ki++ ) {
+            if (ki->interface_klass() == iclass)
+              break;
+          }
+          if (i == length) {
+            stack->set_sp(calculate_unwind_sp(stack, method_handle));
+            CALL_VM_NOCHECK_NOFIX(
+              throw_exception(
+                thread, vmSymbols::java_lang_IncompatibleClassChangeError()));
+            // NB all oops trashed!
+            assert(HAS_PENDING_EXCEPTION, "should do");
+            return;
+          }
+          itableMethodEntry* im = ki->first_method_entry(receiver->klass());
+          method = im[index].method();
+          if (method == NULL) {
+            stack->set_sp(calculate_unwind_sp(stack, method_handle));
+            CALL_VM_NOCHECK_NOFIX(
+              throw_exception(
+                thread, vmSymbols::java_lang_AbstractMethodError()));
+            // NB all oops trashed!
+            assert(HAS_PENDING_EXCEPTION, "should do");
+            return;
+          }
+        }
+      }
+    }
+    direct_to_method = true;
+    break;
+
+  case MethodHandles::_bound_ref_direct_mh:
+  case MethodHandles::_bound_int_direct_mh:
+  case MethodHandles::_bound_long_direct_mh:
+    direct_to_method = true;
+    // fall through
+  case MethodHandles::_bound_ref_mh:
+  case MethodHandles::_bound_int_mh:
+  case MethodHandles::_bound_long_mh:
+    {
+      BasicType arg_type  = T_ILLEGAL;
+      int       arg_mask  = -1;
+      int       arg_slots = -1;
+      MethodHandles::get_ek_bound_mh_info(
+        entry_kind, arg_type, arg_mask, arg_slots);
+      int arg_slot =
+        java_lang_invoke_BoundMethodHandle::vmargslot(method_handle);
+
+      // Create the new slot(s)
+      intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
+      insert_vmslots(arg_slot, arg_slots, THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        // all oops trashed
+        stack->set_sp(unwind_sp);
+        return;
+      }
+      vmslots = stack->sp();
+
+      // Store bound argument into new stack slot
+      oop arg = java_lang_invoke_BoundMethodHandle::argument(method_handle);
+      if (arg_type == T_OBJECT) {
+        assert(arg_slots == 1, "should be");
+        SET_VMSLOTS_OBJECT(arg, arg_slot);
+      }
+      else {
+        jvalue arg_value;
+        arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
+        switch (arg_type) {
+        case T_BOOLEAN:
+          SET_VMSLOTS_INT(arg_value.z, arg_slot);
+          break;
+        case T_CHAR:
+          SET_VMSLOTS_INT(arg_value.c, arg_slot);
+          break;
+        case T_BYTE:
+          SET_VMSLOTS_INT(arg_value.b, arg_slot);
+          break;
+        case T_SHORT:
+          SET_VMSLOTS_INT(arg_value.s, arg_slot);
+          break;
+        case T_INT:
+          SET_VMSLOTS_INT(arg_value.i, arg_slot);
+          break;
+        case T_FLOAT:
+          SET_VMSLOTS_FLOAT(arg_value.f, arg_slot);
+          break;
+        case T_LONG:
+          SET_VMSLOTS_LONG(arg_value.j, arg_slot + 1);
+          break;
+        case T_DOUBLE:
+          SET_VMSLOTS_DOUBLE(arg_value.d, arg_slot + 1);
+          break;
+        default:
+          tty->print_cr("unhandled type %s", type2name(arg_type));
+          ShouldNotReachHere();
+        }
+      }
+    }
+    break;
+
+  case MethodHandles::_adapter_retype_only:
+  case MethodHandles::_adapter_retype_raw:
+    src_rtype = result_type_of_handle(
+      java_lang_invoke_MethodHandle::vmtarget(method_handle));
+    dst_rtype = result_type_of_handle(method_handle);
+    break;
+
+  case MethodHandles::_adapter_check_cast:
+    {
+      int arg_slot =
+        java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
+      oop arg = VMSLOTS_OBJECT(arg_slot);
+      if (arg != NULL) {
+        klassOop objKlassOop = arg->klass();
+        klassOop klassOf = java_lang_Class::as_klassOop(
+          java_lang_invoke_AdapterMethodHandle::argument(method_handle));
+
+        if (objKlassOop != klassOf &&
+            !objKlassOop->klass_part()->is_subtype_of(klassOf)) {
+          ResourceMark rm(THREAD);
+          const char* objName = Klass::cast(objKlassOop)->external_name();
+          const char* klassName = Klass::cast(klassOf)->external_name();
+          char* message = SharedRuntime::generate_class_cast_message(
+            objName, klassName);
+
+          stack->set_sp(calculate_unwind_sp(stack, method_handle));
+          CALL_VM_NOCHECK_NOFIX(
+            throw_exception(
+              thread, vmSymbols::java_lang_ClassCastException(), message));
+          // NB all oops trashed!
+          assert(HAS_PENDING_EXCEPTION, "should do");
+          return;
+        }
+      }
+    }
+    break;
+
+  case MethodHandles::_adapter_dup_args:
+    {
+      int arg_slot =
+        java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
+      int conv =
+        java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
+      int num_slots = -MethodHandles::adapter_conversion_stack_move(conv);
+      assert(num_slots > 0, "should be");
+
+      // Create the new slot(s)
+      intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
+      stack->overflow_check(num_slots, THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        // all oops trashed
+        stack->set_sp(unwind_sp);
+        return;
+      }
+
+      // Duplicate the arguments
+      for (int i = num_slots - 1; i >= 0; i--)
+        stack->push(*VMSLOTS_SLOT(arg_slot + i));
+
+      vmslots = stack->sp(); // unused, but let the compiler figure that out
+    }
+    break;
+
+  case MethodHandles::_adapter_drop_args:
+    {
+      int arg_slot =
+        java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
+      int conv =
+        java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
+      int num_slots = MethodHandles::adapter_conversion_stack_move(conv);
+      assert(num_slots > 0, "should be");
+
+      remove_vmslots(arg_slot, num_slots, THREAD); // doesn't trap
+      vmslots = stack->sp(); // unused, but let the compiler figure that out
+    }
+    break;
+
+  case MethodHandles::_adapter_opt_swap_1:
+  case MethodHandles::_adapter_opt_swap_2:
+  case MethodHandles::_adapter_opt_rot_1_up:
+  case MethodHandles::_adapter_opt_rot_1_down:
+  case MethodHandles::_adapter_opt_rot_2_up:
+  case MethodHandles::_adapter_opt_rot_2_down:
+    {
+      int arg1 =
+        java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
+      int conv =
+        java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
+      int arg2 = MethodHandles::adapter_conversion_vminfo(conv);
+
+      int swap_bytes = 0, rotate = 0;
+      MethodHandles::get_ek_adapter_opt_swap_rot_info(
+        entry_kind, swap_bytes, rotate);
+      int swap_slots = swap_bytes >> LogBytesPerWord;
+
+      intptr_t tmp;
+      switch (rotate) {
+      case 0: // swap
+        for (int i = 0; i < swap_slots; i++) {
+          tmp = *VMSLOTS_SLOT(arg1 + i);
+          SET_VMSLOTS_SLOT(VMSLOTS_SLOT(arg2 + i), arg1 + i);
+          SET_VMSLOTS_SLOT(&tmp, arg2 + i);
+        }
+        break;
+
+      case 1: // up
+        assert(arg1 - swap_slots > arg2, "should be");
+
+        tmp = *VMSLOTS_SLOT(arg1);
+        for (int i = arg1 - swap_slots; i >= arg2; i--)
+          SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i + swap_slots);
+        SET_VMSLOTS_SLOT(&tmp, arg2);
+
+        break;
+
+      case -1: // down
+        assert(arg2 - swap_slots > arg1, "should be");
+
+        tmp = *VMSLOTS_SLOT(arg1);
+        for (int i = arg1 + swap_slots; i <= arg2; i++)
+          SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i - swap_slots);
+        SET_VMSLOTS_SLOT(&tmp, arg2);
+        break;
+
+      default:
+        ShouldNotReachHere();
+      }
+    }
+    break;
+
+  case MethodHandles::_adapter_opt_i2l:
+    {
+      int arg_slot =
+        java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
+      int arg = VMSLOTS_INT(arg_slot);
+      intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
+      insert_vmslots(arg_slot, 1, THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        // all oops trashed
+        stack->set_sp(unwind_sp);
+        return;
+      }
+      vmslots = stack->sp();
+      arg_slot++;
+      SET_VMSLOTS_LONG(arg, arg_slot);
+    }
+    break;
+
+  case MethodHandles::_adapter_opt_unboxi:
+  case MethodHandles::_adapter_opt_unboxl:
+    {
+      int arg_slot =
+        java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
+      oop arg = VMSLOTS_OBJECT(arg_slot);
+      jvalue arg_value;
+      BasicType arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
+      if (arg_type == T_LONG || arg_type == T_DOUBLE) {
+        intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
+        insert_vmslots(arg_slot, 1, THREAD);
+        if (HAS_PENDING_EXCEPTION) {
+          // all oops trashed
+          stack->set_sp(unwind_sp);
+          return;
+        }
+        vmslots = stack->sp();
+        arg_slot++;
+      }
+      switch (arg_type) {
+      case T_BOOLEAN:
+        SET_VMSLOTS_INT(arg_value.z, arg_slot);
+        break;
+      case T_CHAR:
+        SET_VMSLOTS_INT(arg_value.c, arg_slot);
+        break;
+      case T_BYTE:
+        SET_VMSLOTS_INT(arg_value.b, arg_slot);
+        break;
+      case T_SHORT:
+        SET_VMSLOTS_INT(arg_value.s, arg_slot);
+        break;
+      case T_INT:
+        SET_VMSLOTS_INT(arg_value.i, arg_slot);
+        break;
+      case T_FLOAT:
+        SET_VMSLOTS_FLOAT(arg_value.f, arg_slot);
+        break;
+      case T_LONG:
+        SET_VMSLOTS_LONG(arg_value.j, arg_slot);
+        break;
+      case T_DOUBLE:
+        SET_VMSLOTS_DOUBLE(arg_value.d, arg_slot);
+        break;
+      default:
+        tty->print_cr("unhandled type %s", type2name(arg_type));
+        ShouldNotReachHere();
+      }
+    }
+    break;
+
+  default:
+    tty->print_cr("unhandled entry_kind %s",
+                  MethodHandles::entry_name(entry_kind));
+    ShouldNotReachHere();
+  }
+
+  // Continue along the chain
+  if (direct_to_method) {
+    if (method == NULL) {
+      method =
+        (methodOop) java_lang_invoke_MethodHandle::vmtarget(method_handle);
+    }
+    address entry_point = method->from_interpreted_entry();
+    Interpreter::invoke_method(method, entry_point, THREAD);
+  }
+  else {
+    process_method_handle(
+      java_lang_invoke_MethodHandle::vmtarget(method_handle), THREAD);
+  }
+  // NB all oops now trashed
+
+  // Adapt the result type, if necessary
+  if (src_rtype != dst_rtype && !HAS_PENDING_EXCEPTION) {
+    switch (dst_rtype) {
+    case T_VOID:
+      for (int i = 0; i < type2size[src_rtype]; i++)
+        stack->pop();
+      return;
+
+    case T_INT:
+      switch (src_rtype) {
+      case T_VOID:
+        stack->overflow_check(1, CHECK);
+        stack->push(0);
+        return;
+
+      case T_BOOLEAN:
+      case T_CHAR:
+      case T_BYTE:
+      case T_SHORT:
+        return;
+      }
+    }
+
+    tty->print_cr("unhandled conversion:");
+    tty->print_cr("src_rtype = %s", type2name(src_rtype));
+    tty->print_cr("dst_rtype = %s", type2name(dst_rtype));
+    ShouldNotReachHere();
+  }
+}
+
+// The new slots will be inserted before slot insert_before.
+// Slots < insert_before will have the same slot number after the insert.
+// Slots >= insert_before will become old_slot + num_slots.
+void CppInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) {
+  JavaThread *thread = (JavaThread *) THREAD;
+  ZeroStack *stack = thread->zero_stack();
+
+  // Allocate the space
+  stack->overflow_check(num_slots, CHECK);
+  stack->alloc(num_slots * wordSize);
+  intptr_t *vmslots = stack->sp();
+
+  // Shuffle everything up
+  for (int i = 0; i < insert_before; i++)
+    SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i + num_slots), i);
+}
+
+void CppInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) {
+  JavaThread *thread = (JavaThread *) THREAD;
+  ZeroStack *stack = thread->zero_stack();
+  intptr_t *vmslots = stack->sp();
+
+  // Move everything down
+  for (int i = first_slot - 1; i >= 0; i--)
+    SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i + num_slots);
+
+  // Deallocate the space
+  stack->set_sp(stack->sp() + num_slots);
+}
+
+BasicType CppInterpreter::result_type_of_handle(oop method_handle) {
+  oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
+  oop return_type = java_lang_invoke_MethodType::rtype(method_type);
+  return java_lang_Class::as_BasicType(return_type, (klassOop *) NULL);
+}
+
+intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
+                                              oop method_handle) {
+  oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
+  oop form = java_lang_invoke_MethodType::form(method_type);
+  int argument_slots = java_lang_invoke_MethodTypeForm::vmslots(form);
+
+  return stack->sp() + argument_slots;
+}
+
+IRT_ENTRY(void, CppInterpreter::throw_exception(JavaThread* thread,
+                                                Symbol*     name,
+                                                char*       message))
+  THROW_MSG(name, message);
+IRT_END
+
 InterpreterFrame *InterpreterFrame::build(const methodOop method, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
   ZeroStack *stack = thread->zero_stack();
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2010 Red Hat, Inc.
+ * Copyright 2007, 2008, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,12 +36,22 @@
   static int native_entry(methodOop method, intptr_t UNUSED, TRAPS);
   static int accessor_entry(methodOop method, intptr_t UNUSED, TRAPS);
   static int empty_entry(methodOop method, intptr_t UNUSED, TRAPS);
+  static int method_handle_entry(methodOop method, intptr_t UNUSED, TRAPS);
 
  public:
   // Main loop of normal_entry
   static void main_loop(int recurse, TRAPS);
 
  private:
+  // Helpers for method_handle_entry
+  static void process_method_handle(oop method_handle, TRAPS);
+  static void insert_vmslots(int insert_before, int num_slots, TRAPS);
+  static void remove_vmslots(int first_slot, int num_slots, TRAPS);
+  static BasicType result_type_of_handle(oop method_handle);
+  static intptr_t* calculate_unwind_sp(ZeroStack* stack, oop method_handle);
+  static void throw_exception(JavaThread* thread, Symbol* name,char *msg=NULL);
+
+ private:
   // Fast result type determination
   static BasicType result_type_of(methodOop method);
 
--- a/hotspot/src/cpu/zero/vm/globals_zero.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,4 +54,6 @@
 
 define_pd_global(bool,  UseMembar,            false);
 
+// GC Ergo Flags
+define_pd_global(intx, CMSYoungGenPerWorker, 16*M);  // default max size of CMS young gen, per GC worker thread
 #endif // CPU_ZERO_VM_GLOBALS_ZERO_HPP
--- a/hotspot/src/cpu/zero/vm/interpreter_zero.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/interpreter_zero.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,9 @@
 #ifdef COMPILER1
 #include "c1/c1_Runtime1.hpp"
 #endif
+#ifdef CC_INTERP
+#include "interpreter/cppInterpreter.hpp"
+#endif
 
 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
   _masm->advance(1);
@@ -64,11 +67,15 @@
 }
 
 address InterpreterGenerator::generate_abstract_entry() {
-  return ShouldNotCallThisEntry();
+  return generate_entry((address) ShouldNotCallThisEntry());
 }
 
 address InterpreterGenerator::generate_method_handle_entry() {
-  return ShouldNotCallThisEntry();
+#ifdef CC_INTERP
+  return generate_entry((address) CppInterpreter::method_handle_entry);
+#else
+  return generate_entry((address) ShouldNotCallThisEntry());
+#endif // CC_INTERP
 }
 
 bool AbstractInterpreter::can_be_compiled(methodHandle m) {
--- a/hotspot/src/cpu/zero/vm/methodHandles_zero.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/methodHandles_zero.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2009, 2010 Red Hat, Inc.
+ * Copyright 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,10 +29,21 @@
 #include "prims/methodHandles.hpp"
 
 int MethodHandles::adapter_conversion_ops_supported_mask() {
-  ShouldNotCallThis();
+  return ((1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_ONLY)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_RAW)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_CHECK_CAST)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_PRIM)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_REF_TO_PRIM)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_SWAP_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_ROT_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_DUP_ARGS)
+         |(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS)
+         //|(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS) //BUG!
+         );
+  // FIXME: MethodHandlesTest gets a crash if we enable OP_SPREAD_ARGS.
 }
 
 void MethodHandles::generate_method_handle_stub(MacroAssembler*          masm,
                                                 MethodHandles::EntryKind ek) {
-  ShouldNotCallThis();
+  init_entry(ek, (MethodHandleEntry *) ek);
 }
--- a/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2009 Red Hat, Inc.
+ * Copyright 2007, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/safepoint.hpp"
 
-void Relocation::pd_set_data_value(address x, intptr_t o) {
+void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
   ShouldNotCallThis();
 }
 
--- a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,15 +78,17 @@
 
 nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
                                                 methodHandle method,
-                                                int total_in_args,
-                                                int comp_args_on_stack,
-                                                BasicType *in_sig_bt,
-                                                VMRegPair *in_regs,
+                                                int compile_id,
+                                                int total_args_passed,
+                                                int max_arg,
+                                                BasicType *sig_bt,
+                                                VMRegPair *regs,
                                                 BasicType ret_type) {
 #ifdef SHARK
   return SharkCompiler::compiler()->generate_native_wrapper(masm,
                                                             method,
-                                                            in_sig_bt,
+                                                            compile_id,
+                                                            sig_bt,
                                                             ret_type);
 #else
   ShouldNotCallThis();
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -2648,45 +2648,39 @@
 // writing thread stacks don't use growable mappings (i.e. those
 // creeated with MAP_GROWSDOWN), and aren't marked "[stack]", so this
 // only applies to the main thread.
-static bool
-get_stack_bounds(uintptr_t *bottom, uintptr_t *top)
-{
-  FILE *f = fopen("/proc/self/maps", "r");
-  if (f == NULL)
+
+static
+bool get_stack_bounds(uintptr_t *bottom, uintptr_t *top) {
+
+  char buf[128];
+  int fd, sz;
+
+  if ((fd = ::open("/proc/self/maps", O_RDONLY)) < 0) {
     return false;
-
-  while (!feof(f)) {
-    size_t dummy;
-    char *str = NULL;
-    ssize_t len = getline(&str, &dummy, f);
-    if (len == -1) {
-      fclose(f);
-      return false;
-    }
-
-    if (len > 0 && str[len-1] == '\n') {
-      str[len-1] = 0;
-      len--;
-    }
-
-    static const char *stack_str = "[stack]";
-    if (len > (ssize_t)strlen(stack_str)
-       && (strcmp(str + len - strlen(stack_str), stack_str) == 0)) {
-      if (sscanf(str, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) {
-        uintptr_t sp = (uintptr_t)__builtin_frame_address(0);
-        if (sp >= *bottom && sp <= *top) {
-          free(str);
-          fclose(f);
-          return true;
+  }
+
+  const char kw[] = "[stack]";
+  const int kwlen = sizeof(kw)-1;
+
+  // Address part of /proc/self/maps couldn't be more than 128 bytes
+  while ((sz = os::get_line_chars(fd, buf, sizeof(buf))) > 0) {
+     if (sz > kwlen && ::memcmp(buf+sz-kwlen, kw, kwlen) == 0) {
+        // Extract addresses
+        if (sscanf(buf, "%" SCNxPTR "-%" SCNxPTR, bottom, top) == 2) {
+           uintptr_t sp = (uintptr_t) __builtin_frame_address(0);
+           if (sp >= *bottom && sp <= *top) {
+              ::close(fd);
+              return true;
+           }
         }
-      }
-    }
-    free(str);
+     }
   }
-  fclose(f);
+
+ ::close(fd);
   return false;
 }
 
+
 // If the (growable) stack mapping already extends beyond the point
 // where we're going to put our guard pages, truncate the mapping at
 // that point by munmap()ping it.  This ensures that when we later
--- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java	Tue Apr 26 15:48:03 2011 -0700
@@ -497,6 +497,9 @@
             addAttr(rv, "TargetMachine", "MachineX64");
         }
 
+        // We always want the /DEBUG option to get full symbol information in the pdb files
+        addAttr(rv, "GenerateDebugInformation", "true");
+
         return rv;
     }
 
@@ -504,8 +507,7 @@
     Vector getDebugLinkerFlags() {
         Vector rv = new Vector();
 
-        // /DEBUG option
-        addAttr(rv, "GenerateDebugInformation", "true");
+        // Empty now that /DEBUG option is used by all configs
 
         return rv;
     }
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -2824,7 +2824,7 @@
   int idx = 0;
   if (!method()->is_static()) {
     // we should always see the receiver
-    state->store_local(idx, new Local(objectType, idx));
+    state->store_local(idx, new Local(method()->holder(), objectType, idx));
     idx = 1;
   }
 
@@ -2836,7 +2836,7 @@
     // don't allow T_ARRAY to propagate into locals types
     if (basic_type == T_ARRAY) basic_type = T_OBJECT;
     ValueType* vt = as_ValueType(basic_type);
-    state->store_local(idx, new Local(vt, idx));
+    state->store_local(idx, new Local(type, vt, idx));
     idx += type->size();
   }
 
--- a/hotspot/src/share/vm/c1/c1_Instruction.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -135,6 +135,33 @@
 }
 
 
+ciType* Local::exact_type() const {
+  ciType* type = declared_type();
+
+  // for primitive arrays, the declared type is the exact type
+  if (type->is_type_array_klass()) {
+    return type;
+  } else if (type->is_instance_klass()) {
+    ciInstanceKlass* ik = (ciInstanceKlass*)type;
+    if (ik->is_loaded() && ik->is_final() && !ik->is_interface()) {
+      return type;
+    }
+  } else if (type->is_obj_array_klass()) {
+    ciObjArrayKlass* oak = (ciObjArrayKlass*)type;
+    ciType* base = oak->base_element_type();
+    if (base->is_instance_klass()) {
+      ciInstanceKlass* ik = base->as_instance_klass();
+      if (ik->is_loaded() && ik->is_final()) {
+        return type;
+      }
+    } else if (base->is_primitive_type()) {
+      return type;
+    }
+  }
+  return NULL;
+}
+
+
 ciType* LoadIndexed::exact_type() const {
   ciType* array_type = array()->exact_type();
   if (array_type == NULL) {
@@ -189,16 +216,21 @@
   return ciTypeArrayKlass::make(elt_type());
 }
 
-
 ciType* NewObjectArray::exact_type() const {
   return ciObjArrayKlass::make(klass());
 }
 
+ciType* NewArray::declared_type() const {
+  return exact_type();
+}
 
 ciType* NewInstance::exact_type() const {
   return klass();
 }
 
+ciType* NewInstance::declared_type() const {
+  return exact_type();
+}
 
 ciType* CheckCast::declared_type() const {
   return klass();
@@ -349,6 +381,11 @@
   if (state()        != NULL) state()->values_do(f);
 }
 
+ciType* Invoke::declared_type() const {
+  ciType *t = _target->signature()->return_type();
+  assert(t->basic_type() != T_VOID, "need return value of void method?");
+  return t;
+}
 
 // Implementation of Contant
 intx Constant::hash() const {
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -621,16 +621,21 @@
 LEAF(Local, Instruction)
  private:
   int      _java_index;                          // the local index within the method to which the local belongs
+  ciType*  _declared_type;
  public:
   // creation
-  Local(ValueType* type, int index)
+  Local(ciType* declared, ValueType* type, int index)
     : Instruction(type)
     , _java_index(index)
+    , _declared_type(declared)
   {}
 
   // accessors
   int java_index() const                         { return _java_index; }
 
+  ciType* declared_type() const                  { return _declared_type; }
+  ciType* exact_type() const;
+
   // generic
   virtual void input_values_do(ValueVisitor* f)   { /* no values */ }
 };
@@ -1146,6 +1151,8 @@
   BasicTypeList* signature() const               { return _signature; }
   ciMethod* target() const                       { return _target; }
 
+  ciType* declared_type() const;
+
   // Returns false if target is not loaded
   bool target_is_final() const                   { return check_flag(TargetIsFinalFlag); }
   bool target_is_loaded() const                  { return check_flag(TargetIsLoadedFlag); }
@@ -1187,6 +1194,7 @@
   // generic
   virtual bool can_trap() const                  { return true; }
   ciType* exact_type() const;
+  ciType* declared_type() const;
 };
 
 
@@ -1208,6 +1216,8 @@
 
   virtual bool needs_exception_state() const     { return false; }
 
+  ciType* declared_type() const;
+
   // generic
   virtual bool can_trap() const                  { return true; }
   virtual void input_values_do(ValueVisitor* f)   { StateSplit::input_values_do(f); f->visit(&_length); }
@@ -1397,6 +1407,7 @@
   vmIntrinsics::ID _id;
   Values*          _args;
   Value            _recv;
+  int              _nonnull_state; // mask identifying which args are nonnull
 
  public:
   // preserves_state can be set to true for Intrinsics
@@ -1417,6 +1428,7 @@
   , _id(id)
   , _args(args)
   , _recv(NULL)
+  , _nonnull_state(AllBits)
   {
     assert(args != NULL, "args must exist");
     ASSERT_VALUES
@@ -1442,6 +1454,23 @@
   Value receiver() const                         { assert(has_receiver(), "must have receiver"); return _recv; }
   bool preserves_state() const                   { return check_flag(PreservesStateFlag); }
 
+  bool arg_needs_null_check(int i) {
+    if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
+      return is_set_nth_bit(_nonnull_state, i);
+    }
+    return true;
+  }
+
+  void set_arg_needs_null_check(int i, bool check) {
+    if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
+      if (check) {
+        _nonnull_state |= nth_bit(i);
+      } else {
+        _nonnull_state &= ~(nth_bit(i));
+      }
+    }
+  }
+
   // generic
   virtual bool can_trap() const                  { return check_flag(CanTrapFlag); }
   virtual void input_values_do(ValueVisitor* f) {
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1215,7 +1215,11 @@
     src_range_check        = 1 << 5,
     dst_range_check        = 1 << 6,
     type_check             = 1 << 7,
-    all_flags              = (1 << 8) - 1
+    overlapping            = 1 << 8,
+    unaligned              = 1 << 9,
+    src_objarray           = 1 << 10,
+    dst_objarray           = 1 << 11,
+    all_flags              = (1 << 12) - 1
   };
 
   LIR_OpArrayCopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length, LIR_Opr tmp,
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -836,6 +836,9 @@
           _masm->verify_stack_oop(r->reg2stack() * VMRegImpl::stack_slot_size);
         }
       }
+      check_codespace();
+      CHECK_BAILOUT();
+
       s.next();
     }
     VerifyOops = v;
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -706,6 +706,38 @@
   }
 }
 
+static Value maxvalue(IfOp* ifop) {
+  switch (ifop->cond()) {
+    case If::eql: return NULL;
+    case If::neq: return NULL;
+    case If::lss: // x <  y ? x : y
+    case If::leq: // x <= y ? x : y
+      if (ifop->x() == ifop->tval() &&
+          ifop->y() == ifop->fval()) return ifop->y();
+      return NULL;
+
+    case If::gtr: // x >  y ? y : x
+    case If::geq: // x >= y ? y : x
+      if (ifop->x() == ifop->tval() &&
+          ifop->y() == ifop->fval()) return ifop->y();
+      return NULL;
+
+  }
+}
+
+static ciType* phi_declared_type(Phi* phi) {
+  ciType* t = phi->operand_at(0)->declared_type();
+  if (t == NULL) {
+    return NULL;
+  }
+  for(int i = 1; i < phi->operand_count(); i++) {
+    if (t != phi->operand_at(i)->declared_type()) {
+      return NULL;
+    }
+  }
+  return t;
+}
+
 void LIRGenerator::arraycopy_helper(Intrinsic* x, int* flagsp, ciArrayKlass** expected_typep) {
   Instruction* src     = x->argument_at(0);
   Instruction* src_pos = x->argument_at(1);
@@ -715,12 +747,20 @@
 
   // first try to identify the likely type of the arrays involved
   ciArrayKlass* expected_type = NULL;
-  bool is_exact = false;
+  bool is_exact = false, src_objarray = false, dst_objarray = false;
   {
     ciArrayKlass* src_exact_type    = as_array_klass(src->exact_type());
     ciArrayKlass* src_declared_type = as_array_klass(src->declared_type());
+    Phi* phi;
+    if (src_declared_type == NULL && (phi = src->as_Phi()) != NULL) {
+      src_declared_type = as_array_klass(phi_declared_type(phi));
+    }
     ciArrayKlass* dst_exact_type    = as_array_klass(dst->exact_type());
     ciArrayKlass* dst_declared_type = as_array_klass(dst->declared_type());
+    if (dst_declared_type == NULL && (phi = dst->as_Phi()) != NULL) {
+      dst_declared_type = as_array_klass(phi_declared_type(phi));
+    }
+
     if (src_exact_type != NULL && src_exact_type == dst_exact_type) {
       // the types exactly match so the type is fully known
       is_exact = true;
@@ -744,17 +784,60 @@
     if (expected_type == NULL) expected_type = dst_exact_type;
     if (expected_type == NULL) expected_type = src_declared_type;
     if (expected_type == NULL) expected_type = dst_declared_type;
+
+    src_objarray = (src_exact_type && src_exact_type->is_obj_array_klass()) || (src_declared_type && src_declared_type->is_obj_array_klass());
+    dst_objarray = (dst_exact_type && dst_exact_type->is_obj_array_klass()) || (dst_declared_type && dst_declared_type->is_obj_array_klass());
   }
 
   // if a probable array type has been identified, figure out if any
   // of the required checks for a fast case can be elided.
   int flags = LIR_OpArrayCopy::all_flags;
+
+  if (!src_objarray)
+    flags &= ~LIR_OpArrayCopy::src_objarray;
+  if (!dst_objarray)
+    flags &= ~LIR_OpArrayCopy::dst_objarray;
+
+  if (!x->arg_needs_null_check(0))
+    flags &= ~LIR_OpArrayCopy::src_null_check;
+  if (!x->arg_needs_null_check(2))
+    flags &= ~LIR_OpArrayCopy::dst_null_check;
+
+
   if (expected_type != NULL) {
-    // try to skip null checks
-    if (src->as_NewArray() != NULL)
+    Value length_limit = NULL;
+
+    IfOp* ifop = length->as_IfOp();
+    if (ifop != NULL) {
+      // look for expressions like min(v, a.length) which ends up as
+      //   x > y ? y : x  or  x >= y ? y : x
+      if ((ifop->cond() == If::gtr || ifop->cond() == If::geq) &&
+          ifop->x() == ifop->fval() &&
+          ifop->y() == ifop->tval()) {
+        length_limit = ifop->y();
+      }
+    }
+
+    // try to skip null checks and range checks
+    NewArray* src_array = src->as_NewArray();
+    if (src_array != NULL) {
       flags &= ~LIR_OpArrayCopy::src_null_check;
-    if (dst->as_NewArray() != NULL)
+      if (length_limit != NULL &&
+          src_array->length() == length_limit &&
+          is_constant_zero(src_pos)) {
+        flags &= ~LIR_OpArrayCopy::src_range_check;
+      }
+    }
+
+    NewArray* dst_array = dst->as_NewArray();
+    if (dst_array != NULL) {
       flags &= ~LIR_OpArrayCopy::dst_null_check;
+      if (length_limit != NULL &&
+          dst_array->length() == length_limit &&
+          is_constant_zero(dst_pos)) {
+        flags &= ~LIR_OpArrayCopy::dst_range_check;
+      }
+    }
 
     // check from incoming constant values
     if (positive_constant(src_pos))
@@ -788,6 +871,28 @@
     }
   }
 
+  IntConstant* src_int = src_pos->type()->as_IntConstant();
+  IntConstant* dst_int = dst_pos->type()->as_IntConstant();
+  if (src_int && dst_int) {
+    int s_offs = src_int->value();
+    int d_offs = dst_int->value();
+    if (src_int->value() >= dst_int->value()) {
+      flags &= ~LIR_OpArrayCopy::overlapping;
+    }
+    if (expected_type != NULL) {
+      BasicType t = expected_type->element_type()->basic_type();
+      int element_size = type2aelembytes(t);
+      if (((arrayOopDesc::base_offset_in_bytes(t) + s_offs * element_size) % HeapWordSize == 0) &&
+          ((arrayOopDesc::base_offset_in_bytes(t) + d_offs * element_size) % HeapWordSize == 0)) {
+        flags &= ~LIR_OpArrayCopy::unaligned;
+      }
+    }
+  } else if (src_pos == dst_pos || is_constant_zero(dst_pos)) {
+    // src and dest positions are the same, or dst is zero so assume
+    // nonoverlapping copy.
+    flags &= ~LIR_OpArrayCopy::overlapping;
+  }
+
   if (src == dst) {
     // moving within a single array so no type checks are needed
     if (flags & LIR_OpArrayCopy::type_check) {
@@ -1351,7 +1456,7 @@
 
   if (addr->is_address()) {
     LIR_Address* address = addr->as_address_ptr();
-    LIR_Opr ptr = new_register(T_OBJECT);
+    LIR_Opr ptr = new_pointer_register();
     if (!address->index()->is_valid() && address->disp() == 0) {
       __ move(address->base(), ptr);
     } else {
@@ -1403,7 +1508,9 @@
   LIR_Const* card_table_base = new LIR_Const(((CardTableModRefBS*)_bs)->byte_map_base);
   if (addr->is_address()) {
     LIR_Address* address = addr->as_address_ptr();
-    LIR_Opr ptr = new_register(T_OBJECT);
+    // ptr cannot be an object because we use this barrier for array card marks
+    // and addr can point in the middle of an array.
+    LIR_Opr ptr = new_pointer_register();
     if (!address->index()->is_valid() && address->disp() == 0) {
       __ move(address->base(), ptr);
     } else {
--- a/hotspot/src/share/vm/c1/c1_Optimizer.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Optimizer.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -644,7 +644,7 @@
 void NullCheckVisitor::do_InstanceOf     (InstanceOf*      x) {}
 void NullCheckVisitor::do_MonitorEnter   (MonitorEnter*    x) { nce()->handle_AccessMonitor(x); }
 void NullCheckVisitor::do_MonitorExit    (MonitorExit*     x) { nce()->handle_AccessMonitor(x); }
-void NullCheckVisitor::do_Intrinsic      (Intrinsic*       x) { nce()->clear_last_explicit_null_check(); }
+void NullCheckVisitor::do_Intrinsic      (Intrinsic*       x) { nce()->handle_Intrinsic(x);     }
 void NullCheckVisitor::do_BlockBegin     (BlockBegin*      x) {}
 void NullCheckVisitor::do_Goto           (Goto*            x) {}
 void NullCheckVisitor::do_If             (If*              x) {}
@@ -1023,6 +1023,12 @@
 
 void NullCheckEliminator::handle_Intrinsic(Intrinsic* x) {
   if (!x->has_receiver()) {
+    if (x->id() == vmIntrinsics::_arraycopy) {
+      for (int i = 0; i < x->number_of_arguments(); i++) {
+        x->set_arg_needs_null_check(i, !set_contains(x->argument_at(i)));
+      }
+    }
+
     // Be conservative
     clear_last_explicit_null_check();
     return;
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -103,7 +103,10 @@
 int Runtime1::_generic_arraycopy_cnt = 0;
 int Runtime1::_primitive_arraycopy_cnt = 0;
 int Runtime1::_oop_arraycopy_cnt = 0;
+int Runtime1::_generic_arraycopystub_cnt = 0;
 int Runtime1::_arraycopy_slowcase_cnt = 0;
+int Runtime1::_arraycopy_checkcast_cnt = 0;
+int Runtime1::_arraycopy_checkcast_attempt_cnt = 0;
 int Runtime1::_new_type_array_slowcase_cnt = 0;
 int Runtime1::_new_object_array_slowcase_cnt = 0;
 int Runtime1::_new_instance_slowcase_cnt = 0;
@@ -119,6 +122,32 @@
 int Runtime1::_throw_incompatible_class_change_error_count = 0;
 int Runtime1::_throw_array_store_exception_count = 0;
 int Runtime1::_throw_count = 0;
+
+static int _byte_arraycopy_cnt = 0;
+static int _short_arraycopy_cnt = 0;
+static int _int_arraycopy_cnt = 0;
+static int _long_arraycopy_cnt = 0;
+static int _oop_arraycopy_cnt = 0;
+
+address Runtime1::arraycopy_count_address(BasicType type) {
+  switch (type) {
+  case T_BOOLEAN:
+  case T_BYTE:   return (address)&_byte_arraycopy_cnt;
+  case T_CHAR:
+  case T_SHORT:  return (address)&_short_arraycopy_cnt;
+  case T_FLOAT:
+  case T_INT:    return (address)&_int_arraycopy_cnt;
+  case T_DOUBLE:
+  case T_LONG:   return (address)&_long_arraycopy_cnt;
+  case T_ARRAY:
+  case T_OBJECT: return (address)&_oop_arraycopy_cnt;
+  default:
+    ShouldNotReachHere();
+    return NULL;
+  }
+}
+
+
 #endif
 
 // Simple helper to see if the caller of a runtime stub which
@@ -1229,9 +1258,17 @@
   tty->print_cr(" _handle_wrong_method_cnt:        %d", SharedRuntime::_wrong_method_ctr);
   tty->print_cr(" _ic_miss_cnt:                    %d", SharedRuntime::_ic_miss_ctr);
   tty->print_cr(" _generic_arraycopy_cnt:          %d", _generic_arraycopy_cnt);
+  tty->print_cr(" _generic_arraycopystub_cnt:      %d", _generic_arraycopystub_cnt);
+  tty->print_cr(" _byte_arraycopy_cnt:             %d", _byte_arraycopy_cnt);
+  tty->print_cr(" _short_arraycopy_cnt:            %d", _short_arraycopy_cnt);
+  tty->print_cr(" _int_arraycopy_cnt:              %d", _int_arraycopy_cnt);
+  tty->print_cr(" _long_arraycopy_cnt:             %d", _long_arraycopy_cnt);
   tty->print_cr(" _primitive_arraycopy_cnt:        %d", _primitive_arraycopy_cnt);
-  tty->print_cr(" _oop_arraycopy_cnt:              %d", _oop_arraycopy_cnt);
+  tty->print_cr(" _oop_arraycopy_cnt (C):          %d", Runtime1::_oop_arraycopy_cnt);
+  tty->print_cr(" _oop_arraycopy_cnt (stub):       %d", _oop_arraycopy_cnt);
   tty->print_cr(" _arraycopy_slowcase_cnt:         %d", _arraycopy_slowcase_cnt);
+  tty->print_cr(" _arraycopy_checkcast_cnt:        %d", _arraycopy_checkcast_cnt);
+  tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);
 
   tty->print_cr(" _new_type_array_slowcase_cnt:    %d", _new_type_array_slowcase_cnt);
   tty->print_cr(" _new_object_array_slowcase_cnt:  %d", _new_object_array_slowcase_cnt);
--- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -94,7 +94,10 @@
   static int _generic_arraycopy_cnt;
   static int _primitive_arraycopy_cnt;
   static int _oop_arraycopy_cnt;
+  static int _generic_arraycopystub_cnt;
   static int _arraycopy_slowcase_cnt;
+  static int _arraycopy_checkcast_cnt;
+  static int _arraycopy_checkcast_attempt_cnt;
   static int _new_type_array_slowcase_cnt;
   static int _new_object_array_slowcase_cnt;
   static int _new_instance_slowcase_cnt;
@@ -174,7 +177,8 @@
   static void trace_block_entry(jint block_id);
 
 #ifndef PRODUCT
-  static address throw_count_address()       { return (address)&_throw_count;       }
+  static address throw_count_address()               { return (address)&_throw_count;             }
+  static address arraycopy_count_address(BasicType type);
 #endif
 
   // directly accessible leaf routine
--- a/hotspot/src/share/vm/ci/ciInstance.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciInstance.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -66,8 +66,8 @@
          "invalid access");
   VM_ENTRY_MARK;
   ciConstant result;
-  oop obj = get_oop();
-  assert(obj != NULL, "bad oop");
+  Handle obj = get_oop();
+  assert(!obj.is_null(), "bad oop");
   BasicType field_btype = field->type()->basic_type();
   int offset = field->offset();
 
--- a/hotspot/src/share/vm/ci/ciMethodHandle.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciMethodHandle.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -42,9 +42,20 @@
   methodHandle callee(_callee->get_methodOop());
   // We catch all exceptions here that could happen in the method
   // handle compiler and stop the VM.
-  MethodHandleCompiler mhc(h, callee, is_invokedynamic, CATCH);
-  methodHandle m = mhc.compile(CATCH);
-  return CURRENT_ENV->get_object(m())->as_method();
+  MethodHandleCompiler mhc(h, callee, is_invokedynamic, THREAD);
+  if (!HAS_PENDING_EXCEPTION) {
+    methodHandle m = mhc.compile(THREAD);
+    if (!HAS_PENDING_EXCEPTION) {
+      return CURRENT_ENV->get_object(m())->as_method();
+    }
+  }
+  if (PrintMiscellaneous && (Verbose || WizardMode)) {
+    tty->print("*** ciMethodHandle::get_adapter => ");
+    PENDING_EXCEPTION->print();
+    tty->print("*** get_adapter (%s): ", is_invokedynamic ? "indy" : "mh"); ((ciObject*)this)->print(); //@@
+  }
+  CLEAR_PENDING_EXCEPTION;
+  return NULL;
 }
 
 
--- a/hotspot/src/share/vm/ci/ciTypeFlow.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -34,6 +34,7 @@
 #include "ci/ciEnv.hpp"
 #include "ci/ciKlass.hpp"
 #include "ci/ciMethodBlocks.hpp"
+#include "shark/shark_globals.hpp"
 #endif
 
 
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -170,7 +170,6 @@
           ShouldNotReachHere();
         }
         break;
-      case JVM_CONSTANT_InvokeDynamicTrans :  // this tag appears only in old classfiles
       case JVM_CONSTANT_InvokeDynamic :
         {
           if (_major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
@@ -186,14 +185,6 @@
           cfs->guarantee_more(5, CHECK);  // bsm_index, nt, tag/access_flags
           u2 bootstrap_specifier_index = cfs->get_u2_fast();
           u2 name_and_type_index = cfs->get_u2_fast();
-          if (tag == JVM_CONSTANT_InvokeDynamicTrans) {
-            if (!AllowTransitionalJSR292)
-              classfile_parse_error(
-                "This JVM does not support transitional InvokeDynamic tag %u in class file %s",
-                tag, CHECK);
-            cp->invoke_dynamic_trans_at_put(index, bootstrap_specifier_index, name_and_type_index);
-            break;
-          }
           if (_max_bootstrap_specifier_index < (int) bootstrap_specifier_index)
             _max_bootstrap_specifier_index = (int) bootstrap_specifier_index;  // collect for later
           cp->invoke_dynamic_at_put(index, bootstrap_specifier_index, name_and_type_index);
@@ -492,7 +483,6 @@
               ref_index, CHECK_(nullHandle));
         }
         break;
-      case JVM_CONSTANT_InvokeDynamicTrans :
       case JVM_CONSTANT_InvokeDynamic :
         {
           int name_and_type_ref_index = cp->invoke_dynamic_name_and_type_ref_index_at(index);
@@ -501,14 +491,6 @@
                          "Invalid constant pool index %u in class file %s",
                          name_and_type_ref_index,
                          CHECK_(nullHandle));
-          if (tag == JVM_CONSTANT_InvokeDynamicTrans) {
-            int bootstrap_method_ref_index = cp->invoke_dynamic_bootstrap_method_ref_index_at(index);
-            check_property(valid_cp_range(bootstrap_method_ref_index, length) &&
-                           cp->tag_at(bootstrap_method_ref_index).is_method_handle(),
-                           "Invalid constant pool index %u in class file %s",
-                           bootstrap_method_ref_index,
-                           CHECK_(nullHandle));
-          }
           // bootstrap specifier index must be checked later, when BootstrapMethods attr is available
           break;
         }
@@ -578,6 +560,7 @@
         }
         break;
       }
+      case JVM_CONSTANT_InvokeDynamic:
       case JVM_CONSTANT_Fieldref:
       case JVM_CONSTANT_Methodref:
       case JVM_CONSTANT_InterfaceMethodref: {
@@ -2783,7 +2766,6 @@
     }
   }
 
-  if (AllowTransitionalJSR292 && word_sig_index == 0)  return;
   if (word_sig_index == 0)
     THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
               "missing I or J signature (for vmentry) in java.lang.invoke.MethodHandle");
@@ -2823,7 +2805,6 @@
     }
   }
 
-  if (AllowTransitionalJSR292 && !found_vmentry)  return;
   if (!found_vmentry)
     THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
               "missing vmentry byte field in java.lang.invoke.MethodHandle");
@@ -3194,15 +3175,6 @@
     if (EnableInvokeDynamic && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) {
       java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
     }
-    if (AllowTransitionalJSR292 &&
-        EnableInvokeDynamic && class_name == vmSymbols::java_dyn_MethodHandle() && class_loader.is_null()) {
-      java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
-    }
-    if (AllowTransitionalJSR292 &&
-        EnableInvokeDynamic && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) {
-      // allow vmentry field in MethodHandleImpl also
-      java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
-    }
 
     // Add a fake "discovered" field if it is not present
     // for compatibility with earlier jdk's.
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -67,28 +67,6 @@
     return ik->find_local_field(name_symbol, signature_symbol, fd);
 }
 
-static bool find_hacked_field(instanceKlass* ik,
-                              Symbol* name_symbol, Symbol* signature_symbol,
-                              fieldDescriptor* fd,
-                              bool allow_super = false) {
-  bool found = find_field(ik, name_symbol, signature_symbol, fd, allow_super);
-  if (!found && AllowTransitionalJSR292) {
-    Symbol* backup_sig = SystemDictionary::find_backup_signature(signature_symbol);
-    if (backup_sig != NULL) {
-      found = find_field(ik, name_symbol, backup_sig, fd, allow_super);
-      if (TraceMethodHandles) {
-        ResourceMark rm;
-        tty->print_cr("MethodHandles: %s.%s: backup for %s => %s%s",
-                      ik->name()->as_C_string(), name_symbol->as_C_string(),
-                      signature_symbol->as_C_string(), backup_sig->as_C_string(),
-                      (found ? "" : " (NOT FOUND)"));
-      }
-    }
-  }
-  return found;
-}
-#define find_field find_hacked_field  /* remove after AllowTransitionalJSR292 */
-
 // Helpful routine for computing field offsets at run time rather than hardcoding them
 static void
 compute_offset(int &dest_offset,
@@ -1453,32 +1431,41 @@
       }
     }
 #ifdef ASSERT
-  assert(st_method() == method && st.bci() == bci,
-         "Wrong stack trace");
-  st.next();
-  // vframeStream::method isn't GC-safe so store off a copy
-  // of the methodOop in case we GC.
-  if (!st.at_end()) {
-    st_method = st.method();
-  }
+    assert(st_method() == method && st.bci() == bci,
+           "Wrong stack trace");
+    st.next();
+    // vframeStream::method isn't GC-safe so store off a copy
+    // of the methodOop in case we GC.
+    if (!st.at_end()) {
+      st_method = st.method();
+    }
 #endif
+
+    // the format of the stacktrace will be:
+    // - 1 or more fillInStackTrace frames for the exception class (skipped)
+    // - 0 or more <init> methods for the exception class (skipped)
+    // - rest of the stack
+
     if (!skip_fillInStackTrace_check) {
-      // check "fillInStackTrace" only once, so we negate the flag
-      // after the first time check.
-      skip_fillInStackTrace_check = true;
-      if (method->name() == vmSymbols::fillInStackTrace_name()) {
+      if ((method->name() == vmSymbols::fillInStackTrace_name() ||
+           method->name() == vmSymbols::fillInStackTrace0_name()) &&
+          throwable->is_a(method->method_holder())) {
         continue;
       }
+      else {
+        skip_fillInStackTrace_check = true; // gone past them all
+      }
     }
-    // skip <init> methods of the exceptions klass. If there is <init> methods
-    // that belongs to a superclass of the exception  we are going to skipping
-    // them in stack trace. This is simlar to classic VM.
     if (!skip_throwableInit_check) {
+      assert(skip_fillInStackTrace_check, "logic error in backtrace filtering");
+
+      // skip <init> methods of the exception class and superclasses
+      // This is simlar to classic VM.
       if (method->name() == vmSymbols::object_initializer_name() &&
           throwable->is_a(method->method_holder())) {
         continue;
       } else {
-        // if no "Throwable.init()" method found, we stop checking it next time.
+        // there are none or we've seen them all - either way stop checking
         skip_throwableInit_check = true;
       }
     }
@@ -2333,7 +2320,6 @@
   klassOop k = SystemDictionary::MethodHandle_klass();
   if (k != NULL && EnableInvokeDynamic) {
     bool allow_super = false;
-    if (AllowTransitionalJSR292)  allow_super = true;  // temporary, to access java.dyn.MethodHandleImpl
     compute_offset(_type_offset,      k, vmSymbols::type_name(),      vmSymbols::java_lang_invoke_MethodType_signature(), allow_super);
     compute_offset(_vmtarget_offset,  k, vmSymbols::vmtarget_name(),  vmSymbols::object_signature(),                      allow_super);
     compute_offset(_vmentry_offset,   k, vmSymbols::vmentry_name(),   vmSymbols::machine_word_signature(),                allow_super);
--- a/hotspot/src/share/vm/classfile/stackMapFrame.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/stackMapFrame.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -208,8 +208,10 @@
   return true;
 }
 
-bool StackMapFrame::is_assignable_to(const StackMapFrame* target, TRAPS) const {
-  if (_max_locals != target->max_locals() || _stack_size != target->stack_size()) {
+bool StackMapFrame::is_assignable_to(
+    const StackMapFrame* target, bool is_exception_handler, TRAPS) const {
+  if (_max_locals != target->max_locals() ||
+      _stack_size != target->stack_size()) {
     return false;
   }
   // Only need to compare type elements up to target->locals() or target->stack().
@@ -222,7 +224,7 @@
   bool match_flags = (_flags | target->flags()) == target->flags();
 
   return match_locals && match_stack &&
-    (match_flags || has_flag_match_exception(target));
+    (match_flags || (is_exception_handler && has_flag_match_exception(target)));
 }
 
 VerificationType StackMapFrame::pop_stack_ex(VerificationType type, TRAPS) {
--- a/hotspot/src/share/vm/classfile/stackMapFrame.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/stackMapFrame.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -134,7 +134,8 @@
   void copy_stack(const StackMapFrame* src);
 
   // Return true if this stack map frame is assignable to target.
-  bool is_assignable_to(const StackMapFrame* target, TRAPS) const;
+  bool is_assignable_to(const StackMapFrame* target,
+                        bool is_exception_handler, TRAPS) const;
 
   // Push type into stack type array.
   inline void push_stack(VerificationType type, TRAPS) {
--- a/hotspot/src/share/vm/classfile/stackMapTable.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/stackMapTable.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -98,10 +98,13 @@
   bool result = true;
   StackMapFrame *stackmap_frame = _frame_array[frame_index];
   if (match) {
+    // when checking handler target, match == true && update == false
+    bool is_exception_handler = !update;
     // Has direct control flow from last instruction, need to match the two
     // frames.
     result = frame->is_assignable_to(
-      stackmap_frame, CHECK_VERIFY_(frame->verifier(), false));
+      stackmap_frame, is_exception_handler,
+      CHECK_VERIFY_(frame->verifier(), false));
   }
   if (update) {
     // Use the frame in stackmap table as current frame
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1887,99 +1887,27 @@
   0
 };
 
-Symbol* SystemDictionary::find_backup_symbol(Symbol* symbol,
-                                             const char* from_prefix,
-                                             const char* to_prefix) {
-  assert(AllowTransitionalJSR292, "");  // delete this subroutine
-  Symbol* backup_symbol = NULL;
-  size_t from_len = strlen(from_prefix);
-  if (strncmp((const char*) symbol->base(), from_prefix, from_len) != 0)
-    return NULL;
-  char buf[100];
-  size_t to_len = strlen(to_prefix);
-  size_t tail_len = symbol->utf8_length() - from_len;
-  size_t new_len = to_len + tail_len;
-  guarantee(new_len < sizeof(buf), "buf too small");
-  memcpy(buf, to_prefix, to_len);
-  memcpy(buf + to_len, symbol->base() + from_len, tail_len);
-  buf[new_len] = '\0';
-  vmSymbols::SID backup_sid = vmSymbols::find_sid(buf);
-  if (backup_sid != vmSymbols::NO_SID) {
-    backup_symbol = vmSymbols::symbol_at(backup_sid);
-  }
-  return backup_symbol;
-}
-
-Symbol* SystemDictionary::find_backup_class_name(Symbol* symbol) {
-  assert(AllowTransitionalJSR292, "");  // delete this subroutine
-  if (symbol == NULL)  return NULL;
-  Symbol* backup_symbol = find_backup_symbol(symbol, "java/lang/invoke/", "java/dyn/");  // AllowTransitionalJSR292 ONLY
-  if (backup_symbol == NULL)
-    backup_symbol = find_backup_symbol(symbol, "java/dyn/", "sun/dyn/");  // AllowTransitionalJSR292 ONLY
-  return backup_symbol;
-}
-
-Symbol* SystemDictionary::find_backup_signature(Symbol* symbol) {
-  assert(AllowTransitionalJSR292, "");  // delete this subroutine
-  if (symbol == NULL)  return NULL;
-  return find_backup_symbol(symbol, "Ljava/lang/invoke/", "Ljava/dyn/");
-}
-
 bool SystemDictionary::initialize_wk_klass(WKID id, int init_opt, TRAPS) {
   assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
   int  info = wk_init_info[id - FIRST_WKID];
   int  sid  = (info >> CEIL_LG_OPTION_LIMIT);
   Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
   klassOop*    klassp = &_well_known_klasses[id];
-  bool pre_load = (init_opt < SystemDictionary::Opt);
-  bool try_load = true;
+  bool must_load = (init_opt < SystemDictionary::Opt);
+  bool try_load  = true;
   if (init_opt == SystemDictionary::Opt_Kernel) {
 #ifndef KERNEL
     try_load = false;
 #endif //KERNEL
   }
-  Symbol* backup_symbol = NULL;  // symbol to try if the current symbol fails
-  if (init_opt == SystemDictionary::Pre_JSR292) {
-    if (!EnableInvokeDynamic)  try_load = false;  // do not bother to load such classes
-    if (AllowTransitionalJSR292) {
-      backup_symbol = find_backup_class_name(symbol);
-      if (try_load && PreferTransitionalJSR292) {
-        while (backup_symbol != NULL) {
-          (*klassp) = resolve_or_null(backup_symbol, CHECK_0); // try backup early
-          if (TraceMethodHandles) {
-            ResourceMark rm;
-            tty->print_cr("MethodHandles: try backup first for %s => %s (%s)",
-                          symbol->as_C_string(), backup_symbol->as_C_string(),
-                          ((*klassp) == NULL) ? "no such class" : "backup load succeeded");
-          }
-          if ((*klassp) != NULL)  return true;
-          backup_symbol = find_backup_class_name(backup_symbol);  // find next backup
-        }
-      }
-    }
-  }
-  if ((*klassp) != NULL)  return true;
-  if (!try_load)          return false;
-  while (symbol != NULL) {
-    bool must_load = (pre_load && (backup_symbol == NULL));
+  if ((*klassp) == NULL && try_load) {
     if (must_load) {
       (*klassp) = resolve_or_fail(symbol, true, CHECK_0); // load required class
     } else {
       (*klassp) = resolve_or_null(symbol,       CHECK_0); // load optional klass
     }
-    if ((*klassp) != NULL)  return true;
-    // Go around again.  Example of long backup sequence:
-    // java.lang.invoke.MemberName, java.dyn.MemberName, sun.dyn.MemberName, ONLY if AllowTransitionalJSR292
-    if (TraceMethodHandles && (backup_symbol != NULL)) {
-      ResourceMark rm;
-      tty->print_cr("MethodHandles: backup for %s => %s",
-                    symbol->as_C_string(), backup_symbol->as_C_string());
-    }
-    symbol = backup_symbol;
-    if (AllowTransitionalJSR292)
-      backup_symbol = find_backup_class_name(symbol);
   }
-  return false;
+  return ((*klassp) != NULL);
 }
 
 void SystemDictionary::initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS) {
@@ -2409,9 +2337,7 @@
     // Must create lots of stuff here, but outside of the SystemDictionary lock.
     if (THREAD->is_Compiler_thread())
       return NULL;              // do not attempt from within compiler
-    bool for_invokeGeneric = (name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name));
-    if (AllowInvokeForInvokeGeneric && name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
-      for_invokeGeneric = true;
+    bool for_invokeGeneric = (name_id != vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name));
     bool found_on_bcp = false;
     Handle mt = find_method_handle_type(signature, accessing_klass,
                                         for_invokeGeneric,
@@ -2498,14 +2424,10 @@
   JavaCallArguments args(Handle(THREAD, rt()));
   args.push_oop(pts());
   JavaValue result(T_OBJECT);
-  Symbol* findMethodHandleType_signature = vmSymbols::findMethodHandleType_signature();
-  if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodType_klass()->name() == vmSymbols::java_dyn_MethodType()) {
-    findMethodHandleType_signature = vmSymbols::findMethodHandleType_TRANS_signature();
-  }
   JavaCalls::call_static(&result,
                          SystemDictionary::MethodHandleNatives_klass(),
                          vmSymbols::findMethodHandleType_name(),
-                         findMethodHandleType_signature,
+                         vmSymbols::findMethodHandleType_signature(),
                          &args, CHECK_(empty));
   Handle method_type(THREAD, (oop) result.get_jobject());
 
@@ -2513,14 +2435,10 @@
     // call java.lang.invoke.MethodHandleNatives::notifyGenericMethodType(MethodType) -> void
     JavaCallArguments args(Handle(THREAD, method_type()));
     JavaValue no_result(T_VOID);
-    Symbol* notifyGenericMethodType_signature = vmSymbols::notifyGenericMethodType_signature();
-    if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodType_klass()->name() == vmSymbols::java_dyn_MethodType()) {
-      notifyGenericMethodType_signature = vmSymbols::notifyGenericMethodType_TRANS_signature();
-    }
     JavaCalls::call_static(&no_result,
                            SystemDictionary::MethodHandleNatives_klass(),
                            vmSymbols::notifyGenericMethodType_name(),
-                           notifyGenericMethodType_signature,
+                           vmSymbols::notifyGenericMethodType_signature(),
                            &args, THREAD);
     if (HAS_PENDING_EXCEPTION) {
       // If the notification fails, just kill it.
@@ -2569,14 +2487,10 @@
   args.push_oop(name());
   args.push_oop(type());
   JavaValue result(T_OBJECT);
-  Symbol* linkMethodHandleConstant_signature = vmSymbols::linkMethodHandleConstant_signature();
-  if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandle_klass()->name() == vmSymbols::java_dyn_MethodHandle()) {
-    linkMethodHandleConstant_signature = vmSymbols::linkMethodHandleConstant_TRANS_signature();
-  }
   JavaCalls::call_static(&result,
                          SystemDictionary::MethodHandleNatives_klass(),
                          vmSymbols::linkMethodHandleConstant_name(),
-                         linkMethodHandleConstant_signature,
+                         vmSymbols::linkMethodHandleConstant_signature(),
                          &args, CHECK_(empty));
   return Handle(THREAD, (oop) result.get_jobject());
 }
@@ -2607,17 +2521,10 @@
   args.push_oop(caller_mname());
   args.push_int(caller_bci);
   JavaValue result(T_OBJECT);
-  Symbol* makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_signature();
-  if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandleNatives_klass()->name() == vmSymbols::sun_dyn_MethodHandleNatives()) {
-    makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_TRANS_signature();
-  }
-  if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandleNatives_klass()->name() == vmSymbols::java_dyn_MethodHandleNatives()) {
-    makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_TRANS2_signature();
-  }
   JavaCalls::call_static(&result,
                          SystemDictionary::MethodHandleNatives_klass(),
                          vmSymbols::makeDynamicCallSite_name(),
-                         makeDynamicCallSite_signature,
+                         vmSymbols::makeDynamicCallSite_signature(),
                          &args, CHECK_(empty));
   oop call_site_oop = (oop) result.get_jobject();
   assert(call_site_oop->is_oop()
@@ -2698,28 +2605,10 @@
       argument_info_result = argument_info;  // return argument_info to caller
       return bsm;
     }
-    // else null BSM; fall through
-  } else if (tag.is_name_and_type()) {
-    // JSR 292 EDR does not have JVM_CONSTANT_InvokeDynamic
-    // a bare name&type defaults its BSM to null, so fall through...
   } else {
     ShouldNotReachHere();  // verifier does not allow this
   }
 
-  // Fall through to pick up the per-class bootstrap method.
-  // This mechanism may go away in the PFD.
-  assert(AllowTransitionalJSR292, "else the verifier should have stopped us already");
-  argument_info_result = empty;  // return no argument_info to caller
-  oop bsm_oop = instanceKlass::cast(caller_method->method_holder())->bootstrap_method();
-  if (bsm_oop != NULL) {
-    if (TraceMethodHandles) {
-      tty->print_cr("bootstrap method for "PTR_FORMAT" registered as "PTR_FORMAT":",
-                    (intptr_t) caller_method(), (intptr_t) bsm_oop);
-    }
-    assert(bsm_oop->is_oop(), "must be sane");
-    return Handle(THREAD, bsm_oop);
-  }
-
   return empty;
 }
 
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -146,7 +146,6 @@
   /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
   template(MethodHandle_klass,           java_lang_invoke_MethodHandle,     Pre_JSR292) \
   template(MemberName_klass,             java_lang_invoke_MemberName,       Pre_JSR292) \
-  template(MethodHandleImpl_klass,       sun_dyn_MethodHandleImpl,          Opt) /* AllowTransitionalJSR292 ONLY */ \
   template(MethodHandleNatives_klass,    java_lang_invoke_MethodHandleNatives, Pre_JSR292) \
   template(AdapterMethodHandle_klass,    java_lang_invoke_AdapterMethodHandle, Pre_JSR292) \
   template(BoundMethodHandle_klass,      java_lang_invoke_BoundMethodHandle, Pre_JSR292) \
@@ -154,7 +153,6 @@
   template(MethodType_klass,             java_lang_invoke_MethodType,       Pre_JSR292) \
   template(MethodTypeForm_klass,         java_lang_invoke_MethodTypeForm,   Pre_JSR292) \
   template(WrongMethodTypeException_klass, java_lang_invoke_WrongMethodTypeException, Pre_JSR292) \
-  template(Linkage_klass,                java_lang_invoke_Linkage,          Opt) /* AllowTransitionalJSR292 ONLY */ \
   template(CallSite_klass,               java_lang_invoke_CallSite,         Pre_JSR292) \
   /* Note: MethodHandle must be first, and CallSite last in group */          \
                                                                               \
@@ -422,8 +420,6 @@
     initialize_wk_klasses_until((WKID) limit, start_id, THREAD);
   }
 
-  static Symbol* find_backup_symbol(Symbol* symbol, const char* from_prefix, const char* to_prefix);
-
 public:
   #define WK_KLASS_DECLARE(name, ignore_symbol, option) \
     static klassOop name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); }
@@ -445,9 +441,6 @@
 
   static void load_abstract_ownable_synchronizer_klass(TRAPS);
 
-  static Symbol* find_backup_class_name(Symbol* class_name_symbol);
-  static Symbol* find_backup_signature(Symbol* signature_symbol);
-
 private:
   // Tells whether ClassLoader.loadClassInternal is present
   static bool has_loadClassInternal()       { return _has_loadClassInternal; }
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1671,19 +1671,13 @@
       VerificationType::long_type(),
       VerificationType::long2_type(), CHECK_VERIFY(this));
   } else if (tag.is_method_handle()) {
-    Symbol* methodHandle_name = vmSymbols::java_lang_invoke_MethodHandle();
-    if (AllowTransitionalJSR292 && !Universe::is_bootstrapping())
-      methodHandle_name = SystemDictionaryHandles::MethodHandle_klass()->name();
     current_frame->push_stack(
       VerificationType::reference_type(
-        methodHandle_name), CHECK_VERIFY(this));
+        vmSymbols::java_lang_invoke_MethodHandle()), CHECK_VERIFY(this));
   } else if (tag.is_method_type()) {
-    Symbol* methodType_name = vmSymbols::java_lang_invoke_MethodType();
-    if (AllowTransitionalJSR292 && !Universe::is_bootstrapping())
-      methodType_name = SystemDictionaryHandles::MethodType_klass()->name();
     current_frame->push_stack(
       VerificationType::reference_type(
-        methodType_name), CHECK_VERIFY(this));
+        vmSymbols::java_lang_invoke_MethodType()), CHECK_VERIFY(this));
   } else {
     verify_error(bci, "Invalid index in ldc");
     return;
@@ -1950,8 +1944,7 @@
   unsigned int types = (opcode == Bytecodes::_invokeinterface
                                 ? 1 << JVM_CONSTANT_InterfaceMethodref
                       : opcode == Bytecodes::_invokedynamic
-                                ? ((AllowTransitionalJSR292 ? 1 << JVM_CONSTANT_NameAndType : 0)
-                                  |1 << JVM_CONSTANT_InvokeDynamic)
+                                ? 1 << JVM_CONSTANT_InvokeDynamic
                                 : 1 << JVM_CONSTANT_Methodref);
   verify_cp_type(index, cp, types, CHECK_VERIFY(this));
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -245,44 +245,15 @@
   template(java_lang_invoke_AdapterMethodHandle,      "java/lang/invoke/AdapterMethodHandle")     \
   template(java_lang_invoke_BoundMethodHandle,        "java/lang/invoke/BoundMethodHandle")       \
   template(java_lang_invoke_DirectMethodHandle,       "java/lang/invoke/DirectMethodHandle")      \
-  /* temporary transitional public names from 6839872: */                                         \
-  template(java_dyn_InvokeDynamic,                    "java/dyn/InvokeDynamic")         /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_Linkage,                          "java/dyn/Linkage")               /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_CallSite,                         "java/dyn/CallSite")              /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_MethodHandle,                     "java/dyn/MethodHandle")          /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_MethodType,                       "java/dyn/MethodType")            /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_WrongMethodTypeException,         "java/dyn/WrongMethodTypeException") /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_MethodType_signature,             "Ljava/dyn/MethodType;")          /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_MethodHandle_signature,           "Ljava/dyn/MethodHandle;")        /* AllowTransitionalJSR292 ONLY */ \
-  /* temporary transitional internal names from 6839872: */                                       \
-  template(java_dyn_MethodTypeForm,                   "java/dyn/MethodTypeForm")        /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_MethodTypeForm_signature,         "Ljava/dyn/MethodTypeForm;")      /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_MemberName,                       "java/dyn/MemberName")            /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_MethodHandleNatives,              "java/dyn/MethodHandleNatives")   /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_AdapterMethodHandle,              "java/dyn/AdapterMethodHandle")   /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_BoundMethodHandle,                "java/dyn/BoundMethodHandle")     /* AllowTransitionalJSR292 ONLY */ \
-  template(java_dyn_DirectMethodHandle,               "java/dyn/DirectMethodHandle")    /* AllowTransitionalJSR292 ONLY */ \
-  /* temporary transitional internal names from EDR: */                                           \
-  template(sun_dyn_MemberName,                        "sun/dyn/MemberName")             /* AllowTransitionalJSR292 ONLY */ \
-  template(sun_dyn_MethodHandleImpl,                  "sun/dyn/MethodHandleImpl")       /* AllowTransitionalJSR292 ONLY */ \
-  template(sun_dyn_MethodHandleNatives,               "sun/dyn/MethodHandleNatives")    /* AllowTransitionalJSR292 ONLY */ \
-  template(sun_dyn_AdapterMethodHandle,               "sun/dyn/AdapterMethodHandle")    /* AllowTransitionalJSR292 ONLY */ \
-  template(sun_dyn_BoundMethodHandle,                 "sun/dyn/BoundMethodHandle")      /* AllowTransitionalJSR292 ONLY */ \
-  template(sun_dyn_DirectMethodHandle,                "sun/dyn/DirectMethodHandle")     /* AllowTransitionalJSR292 ONLY */ \
   /* internal up-calls made only by the JVM, via class sun.invoke.MethodHandleNatives: */         \
   template(findMethodHandleType_name,                 "findMethodHandleType")                     \
   template(findMethodHandleType_signature,       "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/invoke/MethodType;") \
-  template(findMethodHandleType_TRANS_signature, "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;") /* AllowTransitionalJSR292 ONLY */ \
   template(notifyGenericMethodType_name,              "notifyGenericMethodType")                  \
   template(notifyGenericMethodType_signature,         "(Ljava/lang/invoke/MethodType;)V")         \
-  template(notifyGenericMethodType_TRANS_signature,   "(Ljava/dyn/MethodType;)V")       /* AllowTransitionalJSR292 ONLY */ \
   template(linkMethodHandleConstant_name,             "linkMethodHandleConstant")                 \
   template(linkMethodHandleConstant_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/invoke/MethodHandle;") \
-  template(linkMethodHandleConstant_TRANS_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/dyn/MethodHandle;") /* AllowTransitionalJSR292 ONLY */ \
   template(makeDynamicCallSite_name,                  "makeDynamicCallSite")                      \
   template(makeDynamicCallSite_signature, "(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/invoke/MemberName;I)Ljava/lang/invoke/CallSite;") \
-  template(makeDynamicCallSite_TRANS_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Lsun/dyn/MemberName;I)Ljava/dyn/CallSite;") /* AllowTransitionalJSR292 ONLY */ \
-  template(makeDynamicCallSite_TRANS2_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Ljava/dyn/MemberName;I)Ljava/dyn/CallSite;") /* AllowTransitionalJSR292 ONLY */ \
   NOT_LP64(  do_alias(machine_word_signature,         int_signature)  )                           \
   LP64_ONLY( do_alias(machine_word_signature,         long_signature) )                           \
                                                                                                   \
@@ -330,6 +301,7 @@
   template(dispatch_name,                             "dispatch")                                 \
   template(getSystemClassLoader_name,                 "getSystemClassLoader")                     \
   template(fillInStackTrace_name,                     "fillInStackTrace")                         \
+  template(fillInStackTrace0_name,                    "fillInStackTrace0")                        \
   template(getCause_name,                             "getCause")                                 \
   template(initCause_name,                            "initCause")                                \
   template(setProperty_name,                          "setProperty")                              \
@@ -910,8 +882,6 @@
   do_intrinsic(_invoke,                   java_lang_reflect_Method, invoke_name, object_object_array_object_signature, F_R) \
   /*   (symbols invoke_name and invoke_signature defined above) */                                                      \
   do_intrinsic(_checkSpreadArgument,      java_lang_invoke_MethodHandleNatives, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) \
-  do_intrinsic(_checkSpreadArgument_TRANS,sun_dyn_MethodHandleImpl, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) /* AllowTransitionalJSR292 ONLY */ \
-  do_intrinsic(_checkSpreadArgument_TRANS2,java_dyn_MethodHandleNatives, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) /* AllowTransitionalJSR292 ONLY */ \
    do_name(    checkSpreadArgument_name,       "checkSpreadArgument")                                                   \
    do_name(    checkSpreadArgument_signature,  "(Ljava/lang/Object;I)V")                                                \
   do_intrinsic(_invokeExact,              java_lang_invoke_MethodHandle, invokeExact_name,   object_array_object_signature, F_RN) \
--- a/hotspot/src/share/vm/code/codeCache.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -964,3 +964,14 @@
             nof_blobs(), nof_nmethods(), nof_adapters(),
             unallocated_capacity(), largest_free_block());
 }
+
+size_t CodeCache::largest_free_block() {
+  // This is called both with and without CodeCache_lock held so
+  // handle both cases.
+  if (CodeCache_lock->owned_by_self()) {
+    return _heap->largest_free_block();
+  } else {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    return _heap->largest_free_block();
+  }
+}
--- a/hotspot/src/share/vm/code/codeCache.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -160,7 +160,7 @@
   static size_t  capacity()                      { return _heap->capacity(); }
   static size_t  max_capacity()                  { return _heap->max_capacity(); }
   static size_t  unallocated_capacity()          { return _heap->unallocated_capacity(); }
-  static size_t  largest_free_block()            { return _heap->largest_free_block(); }
+  static size_t  largest_free_block();
   static bool    needs_flushing()                { return largest_free_block() < CodeCacheFlushingMinimumFreeSpace; }
 
   static bool needs_cache_clean()                { return _needs_cache_clean; }
--- a/hotspot/src/share/vm/code/relocInfo.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/code/relocInfo.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -472,20 +472,14 @@
   return itr._rh;
 }
 
-
-static inline bool is_index(intptr_t index) {
-  return 0 < index && index < os::vm_page_size();
-}
-
-
 int32_t Relocation::runtime_address_to_index(address runtime_address) {
-  assert(!is_index((intptr_t)runtime_address), "must not look like an index");
+  assert(!is_reloc_index((intptr_t)runtime_address), "must not look like an index");
 
   if (runtime_address == NULL)  return 0;
 
   StubCodeDesc* p = StubCodeDesc::desc_for(runtime_address);
   if (p != NULL && p->begin() == runtime_address) {
-    assert(is_index(p->index()), "there must not be too many stubs");
+    assert(is_reloc_index(p->index()), "there must not be too many stubs");
     return (int32_t)p->index();
   } else {
     // Known "miscellaneous" non-stub pointers:
@@ -506,7 +500,7 @@
 address Relocation::index_to_runtime_address(int32_t index) {
   if (index == 0)  return NULL;
 
-  if (is_index(index)) {
+  if (is_reloc_index(index)) {
     StubCodeDesc* p = StubCodeDesc::desc_for_index(index);
     assert(p != NULL, "there must be a stub for this index");
     return p->begin();
@@ -634,7 +628,7 @@
 #ifndef _LP64
   p = pack_1_int_to(p, index);
 #else
-  if (is_index(index)) {
+  if (is_reloc_index(index)) {
     p = pack_2_ints_to(p, index, 0);
   } else {
     jlong t = (jlong) _target;
@@ -642,7 +636,7 @@
     int32_t hi = high(t);
     p = pack_2_ints_to(p, lo, hi);
     DEBUG_ONLY(jlong t1 = jlong_from(hi, lo));
-    assert(!is_index(t1) && (address) t1 == _target, "not symmetric");
+    assert(!is_reloc_index(t1) && (address) t1 == _target, "not symmetric");
   }
 #endif /* _LP64 */
   dest->set_locs_end((relocInfo*) p);
@@ -656,7 +650,7 @@
   int32_t lo, hi;
   unpack_2_ints(lo, hi);
   jlong t = jlong_from(hi, lo);;
-  if (is_index(t)) {
+  if (is_reloc_index(t)) {
     _target = index_to_runtime_address(t);
   } else {
     _target = (address) t;
--- a/hotspot/src/share/vm/code/relocInfo.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/code/relocInfo.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -703,6 +703,10 @@
     assert(datalen()==0 || type()==relocInfo::none, "no data here");
   }
 
+  static bool is_reloc_index(intptr_t index) {
+    return 0 < index && index < os::vm_page_size();
+  }
+
  protected:
   // Helper functions for pack_data_to() and unpack_data().
 
@@ -1127,6 +1131,12 @@
     return rh;
   }
 
+  // Some address looking values aren't safe to treat as relocations
+  // and should just be treated as constants.
+  static bool can_be_relocated(address target) {
+    return target != NULL && !is_reloc_index((intptr_t)target);
+  }
+
  private:
   address _target;                  // address in runtime
 
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -847,9 +847,9 @@
 // Initialize the compilation queue
 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
   EXCEPTION_MARK;
-#ifndef ZERO
+#if !defined(ZERO) && !defined(SHARK)
   assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
-#endif // !ZERO
+#endif // !ZERO && !SHARK
   if (c2_compiler_count > 0) {
     _c2_method_queue  = new CompileQueue("C2MethodQueue",  MethodCompileQueue_lock);
   }
@@ -1118,7 +1118,7 @@
 
   assert(!HAS_PENDING_EXCEPTION, "No exception should be present");
   // some prerequisites that are compiler specific
-  if (compiler(comp_level)->is_c2()) {
+  if (compiler(comp_level)->is_c2() || compiler(comp_level)->is_shark()) {
     method->constants()->resolve_string_constants(CHECK_0);
     // Resolve all classes seen in the signature of the method
     // we are compiling.
@@ -1736,8 +1736,14 @@
   UseInterpreter = true;
   if (UseCompiler || AlwaysCompileLoopMethods ) {
     if (xtty != NULL) {
+      stringStream s;
+      // Dump code cache state into a buffer before locking the tty,
+      // because log_state() will use locks causing lock conflicts.
+      CodeCache::log_state(&s);
+      // Lock to prevent tearing
+      ttyLocker ttyl;
       xtty->begin_elem("code_cache_full");
-      CodeCache::log_state(xtty);
+      xtty->print(s.as_string());
       xtty->stamp();
       xtty->end_elem();
     }
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -554,7 +554,7 @@
 
 /* 0xB0 */ &&opc_areturn,     &&opc_return,         &&opc_getstatic,    &&opc_putstatic,
 /* 0xB4 */ &&opc_getfield,    &&opc_putfield,       &&opc_invokevirtual,&&opc_invokespecial,
-/* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,&&opc_default,      &&opc_new,
+/* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,&&opc_invokedynamic,&&opc_new,
 /* 0xBC */ &&opc_newarray,    &&opc_anewarray,      &&opc_arraylength,  &&opc_athrow,
 
 /* 0xC0 */ &&opc_checkcast,   &&opc_instanceof,     &&opc_monitorenter, &&opc_monitorexit,
@@ -568,7 +568,7 @@
 /* 0xDC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 
 /* 0xE0 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
-/* 0xE4 */ &&opc_default,     &&opc_return_register_finalizer,        &&opc_default,      &&opc_default,
+/* 0xE4 */ &&opc_default,     &&opc_fast_aldc,      &&opc_fast_aldc_w,  &&opc_return_register_finalizer,
 /* 0xE8 */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 /* 0xEC */ &&opc_default,     &&opc_default,        &&opc_default,      &&opc_default,
 
@@ -1718,8 +1718,7 @@
         }
         // Need to throw illegal monitor state exception
         CALL_VM(InterpreterRuntime::throw_illegal_monitor_state_exception(THREAD), handle_exception);
-        // Should never reach here...
-        assert(false, "Should have thrown illegal monitor exception");
+        ShouldNotReachHere();
       }
 
       /* All of the non-quick opcodes. */
@@ -2147,6 +2146,74 @@
           UPDATE_PC_AND_TOS_AND_CONTINUE(3, 2);
         }
 
+      CASE(_fast_aldc_w):
+      CASE(_fast_aldc): {
+        if (!EnableInvokeDynamic) {
+          // We should not encounter this bytecode if !EnableInvokeDynamic.
+          // The verifier will stop it.  However, if we get past the verifier,
+          // this will stop the thread in a reasonable way, without crashing the JVM.
+          CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD),
+                  handle_exception);
+          ShouldNotReachHere();
+        }
+
+        u2 index;
+        int incr;
+        if (opcode == Bytecodes::_fast_aldc) {
+          index = pc[1];
+          incr = 2;
+        } else {
+          index = Bytes::get_native_u2(pc+1);
+          incr = 3;
+        }
+
+        // We are resolved if the f1 field contains a non-null object (CallSite, etc.)
+        // This kind of CP cache entry does not need to match the flags byte, because
+        // there is a 1-1 relation between bytecode type and CP entry type.
+        ConstantPoolCacheEntry* cache = cp->entry_at(index);
+        if (cache->is_f1_null()) {
+          CALL_VM(InterpreterRuntime::resolve_ldc(THREAD, (Bytecodes::Code) opcode),
+                  handle_exception);
+        }
+
+        VERIFY_OOP(cache->f1());
+        SET_STACK_OBJECT(cache->f1(), 0);
+        UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1);
+      }
+
+      CASE(_invokedynamic): {
+        if (!EnableInvokeDynamic) {
+          // We should not encounter this bytecode if !EnableInvokeDynamic.
+          // The verifier will stop it.  However, if we get past the verifier,
+          // this will stop the thread in a reasonable way, without crashing the JVM.
+          CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD),
+                  handle_exception);
+          ShouldNotReachHere();
+        }
+
+        int index = Bytes::get_native_u4(pc+1);
+
+        // We are resolved if the f1 field contains a non-null object (CallSite, etc.)
+        // This kind of CP cache entry does not need to match the flags byte, because
+        // there is a 1-1 relation between bytecode type and CP entry type.
+        assert(constantPoolCacheOopDesc::is_secondary_index(index), "incorrect format");
+        ConstantPoolCacheEntry* cache = cp->secondary_entry_at(index);
+        if (cache->is_f1_null()) {
+          CALL_VM(InterpreterRuntime::resolve_invokedynamic(THREAD),
+                  handle_exception);
+        }
+
+        VERIFY_OOP(cache->f1());
+        oop method_handle = java_lang_invoke_CallSite::target(cache->f1());
+        CHECK_NULL(method_handle);
+
+        istate->set_msg(call_method_handle);
+        istate->set_callee((methodOop) method_handle);
+        istate->set_bcp_advance(5);
+
+        UPDATE_PC_AND_RETURN(0); // I'll be back...
+      }
+
       CASE(_invokeinterface): {
         u2 index = Bytes::get_native_u2(pc+1);
 
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -107,6 +107,7 @@
          rethrow_exception,         // unwinding and throwing exception
          // requests to frame manager from C++ interpreter
          call_method,               // request for new frame from interpreter, manager responds with method_entry
+         call_method_handle,        // like the above, except the callee is a method handle
          return_from_method,        // request from interpreter to unwind, manager responds with method_continue
          more_monitors,             // need a new monitor
          throwing_exception,        // unwind stack and rethrow
--- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -345,7 +345,6 @@
     break;
   case JVM_CONSTANT_NameAndType:
   case JVM_CONSTANT_InvokeDynamic:
-  case JVM_CONSTANT_InvokeDynamicTrans:
     has_klass = false;
     break;
   default:
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -369,10 +369,7 @@
   }
 
   // create exception
-  Symbol* java_lang_invoke_WrongMethodTypeException = vmSymbols::java_lang_invoke_WrongMethodTypeException();
-  if (AllowTransitionalJSR292)
-    java_lang_invoke_WrongMethodTypeException = SystemDictionaryHandles::WrongMethodTypeException_klass()->name();
-  THROW_MSG(java_lang_invoke_WrongMethodTypeException, message);
+  THROW_MSG(vmSymbols::java_lang_invoke_WrongMethodTypeException(), message);
 }
 IRT_END
 
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -221,9 +221,7 @@
       // Make sure the Java part of the runtime has been booted up.
       klassOop natives = SystemDictionary::MethodHandleNatives_klass();
       if (natives == NULL || instanceKlass::cast(natives)->is_not_initialized()) {
-        Symbol* natives_name = vmSymbols::java_lang_invoke_MethodHandleNatives();
-        if (natives != NULL && AllowTransitionalJSR292)  natives_name = Klass::cast(natives)->name();
-        SystemDictionary::resolve_or_fail(natives_name,
+        SystemDictionary::resolve_or_fail(vmSymbols::java_lang_invoke_MethodHandleNatives(),
                                           Handle(),
                                           Handle(),
                                           true,
--- a/hotspot/src/share/vm/interpreter/rewriter.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/interpreter/rewriter.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -52,7 +52,6 @@
       case JVM_CONSTANT_MethodHandle      : // fall through
       case JVM_CONSTANT_MethodType        : // fall through
       case JVM_CONSTANT_InvokeDynamic     : // fall through
-      case JVM_CONSTANT_InvokeDynamicTrans: // fall through
         add_cp_cache_entry(i);
         break;
     }
@@ -62,7 +61,6 @@
             "all cp cache indexes fit in a u2");
 
   _have_invoke_dynamic = ((tag_mask & (1 << JVM_CONSTANT_InvokeDynamic)) != 0);
-  _have_invoke_dynamic |= ((tag_mask & (1 << JVM_CONSTANT_InvokeDynamicTrans)) != 0);
 }
 
 
@@ -81,16 +79,10 @@
       if (pool_index >= 0 &&
           _pool->tag_at(pool_index).is_invoke_dynamic()) {
         int bsm_index = _pool->invoke_dynamic_bootstrap_method_ref_index_at(pool_index);
-        if (bsm_index != 0) {
-          assert(_pool->tag_at(bsm_index).is_method_handle(), "must be a MH constant");
-          // There is a CP cache entry holding the BSM for these calls.
-          int bsm_cache_index = cp_entry_to_cp_cache(bsm_index);
-          cache->entry_at(i)->initialize_bootstrap_method_index_in_cache(bsm_cache_index);
-        } else {
-          // There is no CP cache entry holding the BSM for these calls.
-          // We will need to look for a class-global BSM, later.
-          guarantee(AllowTransitionalJSR292, "");
-        }
+        assert(_pool->tag_at(bsm_index).is_method_handle(), "must be a MH constant");
+        // There is a CP cache entry holding the BSM for these calls.
+        int bsm_cache_index = cp_entry_to_cp_cache(bsm_index);
+        cache->entry_at(i)->initialize_bootstrap_method_index_in_cache(bsm_cache_index);
       }
     }
   }
--- a/hotspot/src/share/vm/oops/constantPoolKlass.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolKlass.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -381,7 +381,6 @@
       case JVM_CONSTANT_MethodType :
         st->print("signature_index=%d", cp->method_type_index_at(index));
         break;
-      case JVM_CONSTANT_InvokeDynamicTrans :
       case JVM_CONSTANT_InvokeDynamic :
         {
           st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index));
--- a/hotspot/src/share/vm/oops/constantPoolOop.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolOop.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -284,17 +284,13 @@
     if (constantPoolCacheOopDesc::is_secondary_index(which)) {
       // Invokedynamic index.
       int pool_index = cache()->main_entry_at(which)->constant_pool_index();
-      if (!AllowTransitionalJSR292 || tag_at(pool_index).is_invoke_dynamic())
-        pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
+      pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
       assert(tag_at(pool_index).is_name_and_type(), "");
       return pool_index;
     }
     // change byte-ordering and go via cache
     i = remap_instruction_operand_from_cache(which);
   } else {
-    if (AllowTransitionalJSR292 && tag_at(which).is_name_and_type())
-      // invokedynamic index is a simple name-and-type
-      return which;
     if (tag_at(which).is_invoke_dynamic()) {
       int pool_index = invoke_dynamic_name_and_type_ref_index_at(which);
       assert(tag_at(pool_index).is_name_and_type(), "");
@@ -953,7 +949,6 @@
   } break;
 
   case JVM_CONSTANT_InvokeDynamic:
-  case JVM_CONSTANT_InvokeDynamicTrans:
   {
     int k1 = invoke_dynamic_bootstrap_method_ref_index_at(index1);
     int k2 = cp2->invoke_dynamic_bootstrap_method_ref_index_at(index2);
@@ -1227,13 +1222,6 @@
     to_cp->method_handle_index_at_put(to_i, k1, k2);
   } break;
 
-  case JVM_CONSTANT_InvokeDynamicTrans:
-  {
-    int k1 = from_cp->invoke_dynamic_bootstrap_method_ref_index_at(from_i);
-    int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i);
-    to_cp->invoke_dynamic_trans_at_put(to_i, k1, k2);
-  } break;
-
   case JVM_CONSTANT_InvokeDynamic:
   {
     int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i);
@@ -1459,7 +1447,6 @@
       return 5;
 
     case JVM_CONSTANT_InvokeDynamic:
-    case JVM_CONSTANT_InvokeDynamicTrans:
       // u1 tag, u2 bsm, u2 nt
       return 5;
 
@@ -1674,7 +1661,6 @@
         DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1));
         break;
       }
-      case JVM_CONSTANT_InvokeDynamicTrans:
       case JVM_CONSTANT_InvokeDynamic: {
         *bytes = tag;
         idx1 = extract_low_short_from_int(*int_at_addr(idx));
--- a/hotspot/src/share/vm/oops/constantPoolOop.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/oops/constantPoolOop.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -244,12 +244,6 @@
     *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_specifier_index;
   }
 
-  void invoke_dynamic_trans_at_put(int which, int bootstrap_method_index, int name_and_type_index) {
-    tag_at_put(which, JVM_CONSTANT_InvokeDynamicTrans);
-    *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_method_index;
-    assert(AllowTransitionalJSR292, "");
-  }
-
   // Temporary until actual use
   void unresolved_string_at_put(int which, Symbol* s) {
     release_tag_at_put(which, JVM_CONSTANT_UnresolvedString);
@@ -570,15 +564,11 @@
   };
   int invoke_dynamic_bootstrap_method_ref_index_at(int which) {
     assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
-    if (tag_at(which).value() == JVM_CONSTANT_InvokeDynamicTrans)
-      return extract_low_short_from_int(*int_at_addr(which));
     int op_base = invoke_dynamic_operand_base(which);
     return operands()->short_at(op_base + _indy_bsm_offset);
   }
   int invoke_dynamic_argument_count_at(int which) {
     assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
-    if (tag_at(which).value() == JVM_CONSTANT_InvokeDynamicTrans)
-      return 0;
     int op_base = invoke_dynamic_operand_base(which);
     int argc = operands()->short_at(op_base + _indy_argc_offset);
     DEBUG_ONLY(int end_offset = op_base + _indy_argv_offset + argc;
--- a/hotspot/src/share/vm/oops/cpCacheOop.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/oops/cpCacheOop.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -185,7 +185,7 @@
         this->print(tty, 0);
       }
       assert(method->can_be_statically_bound(), "must be a MH invoker method");
-      assert(AllowTransitionalJSR292 || _f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized");
+      assert(_f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized");
       // SystemDictionary::find_method_handle_invoke only caches
       // methods which signature classes are on the boot classpath,
       // otherwise the newly created method is returned.  To avoid
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -191,8 +191,6 @@
   typeArrayOop    _inner_classes;
   // Implementors of this interface (not valid if it overflows)
   klassOop        _implementors[implementors_limit];
-  // invokedynamic bootstrap method (a java.lang.invoke.MethodHandle)
-  oop             _bootstrap_method;  // AllowTransitionalJSR292 ONLY
   // Annotations for this class, or null if none.
   typeArrayOop    _class_annotations;
   // Annotation objects (byte arrays) for fields, or null if no annotations.
@@ -526,10 +524,6 @@
                                     u2 method_index)  { _enclosing_method_class_index  = class_index;
                                                         _enclosing_method_method_index = method_index; }
 
-  // JSR 292 support
-  oop bootstrap_method() const                        { return _bootstrap_method; }  // AllowTransitionalJSR292 ONLY
-  void set_bootstrap_method(oop mh)                   { oop_store(&_bootstrap_method, mh); }
-
   // jmethodID support
   static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
                      methodHandle method_h);
@@ -793,7 +787,6 @@
   oop* adr_signers() const           { return (oop*)&this->_signers;}
   oop* adr_inner_classes() const     { return (oop*)&this->_inner_classes;}
   oop* adr_implementors() const      { return (oop*)&this->_implementors[0];}
-  oop* adr_bootstrap_method() const  { return (oop*)&this->_bootstrap_method;}  // AllowTransitionalJSR292 ONLY
   oop* adr_methods_jmethod_ids() const             { return (oop*)&this->_methods_jmethod_ids;}
   oop* adr_methods_cached_itable_indices() const   { return (oop*)&this->_methods_cached_itable_indices;}
   oop* adr_class_annotations() const   { return (oop*)&this->_class_annotations;}
--- a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -105,7 +105,6 @@
   MarkSweep::mark_and_push(ik->adr_protection_domain());
   MarkSweep::mark_and_push(ik->adr_host_klass());
   MarkSweep::mark_and_push(ik->adr_signers());
-  MarkSweep::mark_and_push(ik->adr_bootstrap_method());
   MarkSweep::mark_and_push(ik->adr_class_annotations());
   MarkSweep::mark_and_push(ik->adr_fields_annotations());
   MarkSweep::mark_and_push(ik->adr_methods_annotations());
@@ -142,7 +141,6 @@
   PSParallelCompact::mark_and_push(cm, ik->adr_protection_domain());
   PSParallelCompact::mark_and_push(cm, ik->adr_host_klass());
   PSParallelCompact::mark_and_push(cm, ik->adr_signers());
-  PSParallelCompact::mark_and_push(cm, ik->adr_bootstrap_method());
   PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations());
   PSParallelCompact::mark_and_push(cm, ik->adr_fields_annotations());
   PSParallelCompact::mark_and_push(cm, ik->adr_methods_annotations());
@@ -185,7 +183,6 @@
   for (int i = 0; i < instanceKlass::implementors_limit; i++) {
     blk->do_oop(&ik->adr_implementors()[i]);
   }
-  blk->do_oop(ik->adr_bootstrap_method());
   blk->do_oop(ik->adr_class_annotations());
   blk->do_oop(ik->adr_fields_annotations());
   blk->do_oop(ik->adr_methods_annotations());
@@ -239,8 +236,6 @@
   for (int i = 0; i < instanceKlass::implementors_limit; i++) {
     if (mr.contains(&adr[i])) blk->do_oop(&adr[i]);
   }
-  adr = ik->adr_bootstrap_method();
-  if (mr.contains(adr)) blk->do_oop(adr);
   adr = ik->adr_class_annotations();
   if (mr.contains(adr)) blk->do_oop(adr);
   adr = ik->adr_fields_annotations();
@@ -281,7 +276,6 @@
   for (int i = 0; i < instanceKlass::implementors_limit; i++) {
     MarkSweep::adjust_pointer(&ik->adr_implementors()[i]);
   }
-  MarkSweep::adjust_pointer(ik->adr_bootstrap_method());
   MarkSweep::adjust_pointer(ik->adr_class_annotations());
   MarkSweep::adjust_pointer(ik->adr_fields_annotations());
   MarkSweep::adjust_pointer(ik->adr_methods_annotations());
@@ -317,11 +311,6 @@
     pm->claim_or_forward_depth(sg_addr);
   }
 
-  oop* bsm_addr = ik->adr_bootstrap_method();
-  if (PSScavenge::should_scavenge(bsm_addr)) {
-    pm->claim_or_forward_depth(bsm_addr);
-  }
-
   klassKlass::oop_push_contents(pm, obj);
 }
 
@@ -420,7 +409,6 @@
     ik->set_breakpoints(NULL);
     ik->init_previous_versions();
     ik->set_generic_signature(NULL);
-    ik->set_bootstrap_method(NULL);
     ik->release_set_methods_jmethod_ids(NULL);
     ik->release_set_methods_cached_itable_indices(NULL);
     ik->set_class_annotations(NULL);
@@ -542,11 +530,6 @@
     } // pvw is cleaned up
   } // rm is cleaned up
 
-  if (ik->bootstrap_method() != NULL) {
-    st->print(BULLET"bootstrap method:  ");
-    ik->bootstrap_method()->print_value_on(st);
-    st->cr();
-  }
   if (ik->generic_signature() != NULL) {
     st->print(BULLET"generic signature: ");
     ik->generic_signature()->print_value_on(st);
--- a/hotspot/src/share/vm/oops/methodOop.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/oops/methodOop.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -852,11 +852,11 @@
 bool methodOopDesc::is_method_handle_invoke_name(vmSymbols::SID name_sid) {
   switch (name_sid) {
   case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
-  case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
     return true;
   }
-  if ((AllowTransitionalJSR292 || AllowInvokeForInvokeGeneric)
-      && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
+  if (AllowInvokeGeneric
+      && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name))
     return true;
   return false;
 }
@@ -921,6 +921,10 @@
     tty->cr();
   }
 
+  // invariant:   cp->symbol_at_put is preceded by a refcount increment (more usually a lookup)
+  name->increment_refcount();
+  signature->increment_refcount();
+
   constantPoolHandle cp;
   {
     constantPoolOop cp_oop = oopFactory::new_constantPool(_imcp_limit, IsSafeConc, CHECK_(empty));
@@ -1092,7 +1096,6 @@
   if (name_id == vmSymbols::NO_SID)  return;
   vmSymbols::SID   sig_id = vmSymbols::find_sid(signature());
   if (klass_id != vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle)
-      && !(klass_id == vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle) && AllowTransitionalJSR292)
       && sig_id == vmSymbols::NO_SID)  return;
   jshort flags = access_flags().as_short();
 
@@ -1118,20 +1121,17 @@
     break;
 
   // Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
-  case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle):  // AllowTransitionalJSR292 ONLY
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle):
     if (is_static() || !is_native())  break;
     switch (name_id) {
     case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
+      if (!AllowInvokeGeneric)  break;
+    case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
       id = vmIntrinsics::_invokeGeneric;
       break;
     case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
       id = vmIntrinsics::_invokeExact;
       break;
-    case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
-      if (AllowInvokeForInvokeGeneric)   id = vmIntrinsics::_invokeGeneric;
-      else if (AllowTransitionalJSR292)  id = vmIntrinsics::_invokeExact;
-      break;
     }
     break;
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_InvokeDynamic):
--- a/hotspot/src/share/vm/opto/callGenerator.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -978,31 +978,19 @@
   return head;
 }
 
-WarmCallInfo* WarmCallInfo::_always_hot  = NULL;
-WarmCallInfo* WarmCallInfo::_always_cold = NULL;
+WarmCallInfo WarmCallInfo::_always_hot(WarmCallInfo::MAX_VALUE(), WarmCallInfo::MAX_VALUE(),
+                                       WarmCallInfo::MIN_VALUE(), WarmCallInfo::MIN_VALUE());
+WarmCallInfo WarmCallInfo::_always_cold(WarmCallInfo::MIN_VALUE(), WarmCallInfo::MIN_VALUE(),
+                                        WarmCallInfo::MAX_VALUE(), WarmCallInfo::MAX_VALUE());
 
 WarmCallInfo* WarmCallInfo::always_hot() {
-  if (_always_hot == NULL) {
-    static double bits[sizeof(WarmCallInfo) / sizeof(double) + 1] = {0};
-    WarmCallInfo* ci = (WarmCallInfo*) bits;
-    ci->_profit = ci->_count = MAX_VALUE();
-    ci->_work   = ci->_size  = MIN_VALUE();
-    _always_hot = ci;
-  }
-  assert(_always_hot->is_hot(), "must always be hot");
-  return _always_hot;
+  assert(_always_hot.is_hot(), "must always be hot");
+  return &_always_hot;
 }
 
 WarmCallInfo* WarmCallInfo::always_cold() {
-  if (_always_cold == NULL) {
-    static double bits[sizeof(WarmCallInfo) / sizeof(double) + 1] = {0};
-    WarmCallInfo* ci = (WarmCallInfo*) bits;
-    ci->_profit = ci->_count = MIN_VALUE();
-    ci->_work   = ci->_size  = MAX_VALUE();
-    _always_cold = ci;
-  }
-  assert(_always_cold->is_cold(), "must always be cold");
-  return _always_cold;
+  assert(_always_cold.is_cold(), "must always be cold");
+  return &_always_cold;
 }
 
 
--- a/hotspot/src/share/vm/opto/callGenerator.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/callGenerator.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -215,8 +215,20 @@
   WarmCallInfo*  next() const          { return _next; }
   void       set_next(WarmCallInfo* n) { _next = n; }
 
-  static WarmCallInfo* _always_hot;
-  static WarmCallInfo* _always_cold;
+  static WarmCallInfo _always_hot;
+  static WarmCallInfo _always_cold;
+
+  // Constructor intitialization of always_hot and always_cold
+  WarmCallInfo(float c, float p, float w, float s) {
+    _call = NULL;
+    _hot_cg = NULL;
+    _next = NULL;
+    _count = c;
+    _profit = p;
+    _work = w;
+    _size = s;
+    _heat = 0;
+  }
 
  public:
   // Because WarmInfo objects live over the entire lifetime of the
--- a/hotspot/src/share/vm/opto/cfgnode.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/cfgnode.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1349,9 +1349,17 @@
 static void split_once(PhaseIterGVN *igvn, Node *phi, Node *val, Node *n, Node *newn) {
   igvn->hash_delete(n);         // Remove from hash before hacking edges
 
+  Node* predicate_proj = NULL;
   uint j = 1;
-  for( uint i = phi->req()-1; i > 0; i-- ) {
-    if( phi->in(i) == val ) {   // Found a path with val?
+  for (uint i = phi->req()-1; i > 0; i--) {
+    if (phi->in(i) == val) {   // Found a path with val?
+      if (n->is_Region()) {
+        Node* proj = PhaseIdealLoop::find_predicate(n->in(i));
+        if (proj != NULL) {
+          assert(predicate_proj == NULL, "only one predicate entry expected");
+          predicate_proj = proj;
+        }
+      }
       // Add to NEW Region/Phi, no DU info
       newn->set_req( j++, n->in(i) );
       // Remove from OLD Region/Phi
@@ -1362,6 +1370,12 @@
   // Register the new node but do not transform it.  Cannot transform until the
   // entire Region/Phi conglomerate has been hacked as a single huge transform.
   igvn->register_new_node_with_optimizer( newn );
+
+  // Clone loop predicates
+  if (predicate_proj != NULL) {
+    newn = igvn->clone_loop_predicates(predicate_proj, newn);
+  }
+
   // Now I can point to the new node.
   n->add_req(newn);
   igvn->_worklist.push(n);
--- a/hotspot/src/share/vm/opto/compile.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1632,7 +1632,6 @@
     igvn.replace_node(n, n->in(1));
   }
   assert(predicate_count()==0, "should be clean!");
-  igvn.optimize();
 }
 
 //------------------------------Optimize---------------------------------------
@@ -1689,7 +1688,7 @@
   if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) {
     {
       TracePhase t2("idealLoop", &_t_idealLoop, true);
-      PhaseIdealLoop ideal_loop( igvn, true, UseLoopPredicate);
+      PhaseIdealLoop ideal_loop( igvn, true );
       loop_opts_cnt--;
       if (major_progress()) print_method("PhaseIdealLoop 1", 2);
       if (failing())  return;
@@ -1697,7 +1696,7 @@
     // Loop opts pass if partial peeling occurred in previous pass
     if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) {
       TracePhase t3("idealLoop", &_t_idealLoop, true);
-      PhaseIdealLoop ideal_loop( igvn, false, UseLoopPredicate);
+      PhaseIdealLoop ideal_loop( igvn, false );
       loop_opts_cnt--;
       if (major_progress()) print_method("PhaseIdealLoop 2", 2);
       if (failing())  return;
@@ -1705,7 +1704,7 @@
     // Loop opts pass for loop-unrolling before CCP
     if(major_progress() && (loop_opts_cnt > 0)) {
       TracePhase t4("idealLoop", &_t_idealLoop, true);
-      PhaseIdealLoop ideal_loop( igvn, false, UseLoopPredicate);
+      PhaseIdealLoop ideal_loop( igvn, false );
       loop_opts_cnt--;
       if (major_progress()) print_method("PhaseIdealLoop 3", 2);
     }
@@ -1743,21 +1742,13 @@
   // peeling, unrolling, etc.
   if(loop_opts_cnt > 0) {
     debug_only( int cnt = 0; );
-    bool loop_predication = UseLoopPredicate;
     while(major_progress() && (loop_opts_cnt > 0)) {
       TracePhase t2("idealLoop", &_t_idealLoop, true);
       assert( cnt++ < 40, "infinite cycle in loop optimization" );
-      PhaseIdealLoop ideal_loop( igvn, true, loop_predication);
+      PhaseIdealLoop ideal_loop( igvn, true);
       loop_opts_cnt--;
       if (major_progress()) print_method("PhaseIdealLoop iterations", 2);
       if (failing())  return;
-      // Perform loop predication optimization during first iteration after CCP.
-      // After that switch it off and cleanup unused loop predicates.
-      if (loop_predication) {
-        loop_predication = false;
-        cleanup_loop_predicates(igvn);
-        if (failing())  return;
-      }
     }
   }
 
--- a/hotspot/src/share/vm/opto/compile.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/compile.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -489,6 +489,9 @@
   // remove the opaque nodes that protect the predicates so that the unused checks and
   // uncommon traps will be eliminated from the graph.
   void cleanup_loop_predicates(PhaseIterGVN &igvn);
+  bool is_predicate_opaq(Node * n) {
+    return _predicate_opaqs->contains(n);
+  }
 
   // Compilation environment.
   Arena*            comp_arena()                { return &_comp_arena; }
--- a/hotspot/src/share/vm/opto/doCall.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/doCall.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -63,6 +63,7 @@
                                        JVMState* jvms, bool allow_inline,
                                        float prof_factor) {
   CallGenerator* cg;
+  guarantee(call_method != NULL, "failed method resolution");
 
   // Dtrace currently doesn't work unless all calls are vanilla
   if (env()->dtrace_method_probes()) {
@@ -130,8 +131,9 @@
 
         // Get an adapter for the MethodHandle.
         ciMethod* target_method = method_handle->get_method_handle_adapter();
-
-        CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
+        CallGenerator* hit_cg = NULL;
+        if (target_method != NULL)
+          hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
         if (hit_cg != NULL && hit_cg->is_inline())
           return hit_cg;
       }
@@ -152,8 +154,9 @@
 
       // Get an adapter for the MethodHandle.
       ciMethod* target_method = method_handle->get_invokedynamic_adapter();
-
-      CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
+      CallGenerator* hit_cg = NULL;
+      if (target_method != NULL)
+        hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor);
       if (hit_cg != NULL && hit_cg->is_inline()) {
         CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method);
         return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor);
--- a/hotspot/src/share/vm/opto/escape.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/escape.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -594,7 +594,7 @@
 
 //
 // Create a new version of orig_phi if necessary. Returns either the newly
-// created phi or an existing phi.  Sets create_new to indicate wheter  a new
+// created phi or an existing phi.  Sets create_new to indicate whether a new
 // phi was created.  Cache the last newly created phi in the node map.
 //
 PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *>  &orig_phi_worklist, PhaseGVN  *igvn, bool &new_created) {
@@ -649,7 +649,7 @@
 }
 
 //
-// Return a new version  of Memory Phi "orig_phi" with the inputs having the
+// Return a new version of Memory Phi "orig_phi" with the inputs having the
 // specified alias index.
 //
 PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *>  &orig_phi_worklist, PhaseGVN  *igvn) {
@@ -828,11 +828,15 @@
       break;  // hit one of our sentinels
     if (result->is_Mem()) {
       const Type *at = phase->type(result->in(MemNode::Address));
-      if (at != Type::TOP) {
-        assert (at->isa_ptr() != NULL, "pointer type required.");
-        int idx = C->get_alias_index(at->is_ptr());
-        if (idx == alias_idx)
-          break;
+      if (at == Type::TOP)
+        break; // Dead
+      assert (at->isa_ptr() != NULL, "pointer type required.");
+      int idx = C->get_alias_index(at->is_ptr());
+      if (idx == alias_idx)
+        break; // Found
+      if (!is_instance && (at->isa_oopptr() == NULL ||
+                           !at->is_oopptr()->is_known_instance())) {
+        break; // Do not skip store to general memory slice.
       }
       result = result->in(MemNode::Memory);
     }
@@ -902,13 +906,13 @@
     PhiNode *mphi = result->as_Phi();
     assert(mphi->bottom_type() == Type::MEMORY, "memory phi required");
     const TypePtr *t = mphi->adr_type();
-    if (C->get_alias_index(t) != alias_idx) {
-      // Create a new Phi with the specified alias index type.
-      result = split_memory_phi(mphi, alias_idx, orig_phis, phase);
-    } else if (!is_instance) {
+    if (!is_instance) {
       // Push all non-instance Phis on the orig_phis worklist to update inputs
       // during Phase 4 if needed.
       orig_phis.append_if_missing(mphi);
+    } else if (C->get_alias_index(t) != alias_idx) {
+      // Create a new Phi with the specified alias index type.
+      result = split_memory_phi(mphi, alias_idx, orig_phis, phase);
     }
   }
   // the result is either MemNode, PhiNode, InitializeNode.
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -3385,10 +3385,15 @@
 #define __ ideal.
 
 void GraphKit::sync_kit(IdealKit& ideal) {
+  set_all_memory(__ merged_memory());
+  set_i_o(__ i_o());
+  set_control(__ ctrl());
+}
+
+void GraphKit::final_sync(IdealKit& ideal) {
   // Final sync IdealKit and graphKit.
   __ drain_delay_transform();
-  set_all_memory(__ merged_memory());
-  set_control(__ ctrl());
+  sync_kit(ideal);
 }
 
 // vanilla/CMS post barrier
@@ -3435,7 +3440,7 @@
   // (Else it's an array (or unknown), and we want more precise card marks.)
   assert(adr != NULL, "");
 
-  IdealKit ideal(gvn(), control(), merged_memory(), true);
+  IdealKit ideal(this, true);
 
   // Convert the pointer to an int prior to doing math on it
   Node* cast = __ CastPX(__ ctrl(), adr);
@@ -3461,7 +3466,7 @@
   }
 
   // Final sync IdealKit and GraphKit.
-  sync_kit(ideal);
+  final_sync(ideal);
 }
 
 // G1 pre/post barriers
@@ -3471,7 +3476,7 @@
                                     Node* val,
                                     const TypeOopPtr* val_type,
                                     BasicType bt) {
-  IdealKit ideal(gvn(), control(), merged_memory(), true);
+  IdealKit ideal(this, true);
 
   Node* tls = __ thread(); // ThreadLocalStorage
 
@@ -3548,7 +3553,7 @@
   } __ end_if();  // (!marking)
 
   // Final sync IdealKit and GraphKit.
-  sync_kit(ideal);
+  final_sync(ideal);
 }
 
 //
@@ -3614,7 +3619,7 @@
   // (Else it's an array (or unknown), and we want more precise card marks.)
   assert(adr != NULL, "");
 
-  IdealKit ideal(gvn(), control(), merged_memory(), true);
+  IdealKit ideal(this, true);
 
   Node* tls = __ thread(); // ThreadLocalStorage
 
@@ -3688,6 +3693,6 @@
   }
 
   // Final sync IdealKit and GraphKit.
-  sync_kit(ideal);
+  final_sync(ideal);
 }
 #undef __
--- a/hotspot/src/share/vm/opto/graphKit.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -662,7 +662,9 @@
             && Universe::heap()->can_elide_tlab_store_barriers());
   }
 
+  // Sync Ideal and Graph kits.
   void sync_kit(IdealKit& ideal);
+  void final_sync(IdealKit& ideal);
 
   // vanilla/CMS post barrier
   void write_barrier_post(Node *store, Node* obj,
--- a/hotspot/src/share/vm/opto/idealKit.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/idealKit.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -38,15 +38,16 @@
 const uint IdealKit::first_var = TypeFunc::Parms + 1;
 
 //----------------------------IdealKit-----------------------------------------
-IdealKit::IdealKit(PhaseGVN &gvn, Node* control, Node* mem, bool delay_all_transforms, bool has_declarations) :
-  _gvn(gvn), C(gvn.C) {
-  _initial_ctrl = control;
-  _initial_memory = mem;
+IdealKit::IdealKit(GraphKit* gkit, bool delay_all_transforms, bool has_declarations) :
+  _gvn(gkit->gvn()), C(gkit->C) {
+  _initial_ctrl = gkit->control();
+  _initial_memory = gkit->merged_memory();
+  _initial_i_o = gkit->i_o();
   _delay_all_transforms = delay_all_transforms;
   _var_ct = 0;
   _cvstate = NULL;
   // We can go memory state free or else we need the entire memory state
-  assert(mem == NULL || mem->Opcode() == Op_MergeMem, "memory must be pre-split");
+  assert(_initial_memory == NULL || _initial_memory->Opcode() == Op_MergeMem, "memory must be pre-split");
   int init_size = 5;
   _pending_cvstates = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, 0);
   _delay_transform  = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, 0);
@@ -56,6 +57,13 @@
   }
 }
 
+//----------------------------sync_kit-----------------------------------------
+void IdealKit::sync_kit(GraphKit* gkit) {
+  set_all_memory(gkit->merged_memory());
+  set_i_o(gkit->i_o());
+  set_ctrl(gkit->control());
+}
+
 //-------------------------------if_then-------------------------------------
 // Create:  if(left relop right)
 //          /  \
@@ -156,16 +164,14 @@
 // onto the stack.
 void IdealKit::loop(GraphKit* gkit, int nargs, IdealVariable& iv, Node* init, BoolTest::mask relop, Node* limit, float prob, float cnt) {
   assert((state() & (BlockS|LoopS|IfThenS|ElseS)), "bad state for new loop");
-
-  // Sync IdealKit and graphKit.
-  gkit->set_all_memory(this->merged_memory());
-  gkit->set_control(this->ctrl());
-  // Add loop predicate.
-  gkit->add_predicate(nargs);
-  // Update IdealKit memory.
-  this->set_all_memory(gkit->merged_memory());
-  this->set_ctrl(gkit->control());
-
+  if (UseLoopPredicate) {
+    // Sync IdealKit and graphKit.
+    gkit->sync_kit(*this);
+    // Add loop predicate.
+    gkit->add_predicate(nargs);
+    // Update IdealKit memory.
+    sync_kit(gkit);
+  }
   set(iv, init);
   Node* head = make_label(1);
   bind(head);
@@ -280,6 +286,7 @@
   _cvstate = new_cvstate();   // initialize current cvstate
   set_ctrl(_initial_ctrl);    // initialize control in current cvstate
   set_all_memory(_initial_memory);// initialize memory in current cvstate
+  set_i_o(_initial_i_o);      // initialize i_o in current cvstate
   DEBUG_ONLY(_state->push(BlockS));
 }
 
@@ -421,6 +428,9 @@
   // Get the region for the join state
   Node* join_region = join->in(TypeFunc::Control);
   assert(join_region != NULL, "join region must exist");
+  if (join->in(TypeFunc::I_O) == NULL ) {
+    join->set_req(TypeFunc::I_O,  merging->in(TypeFunc::I_O));
+  }
   if (join->in(TypeFunc::Memory) == NULL ) {
     join->set_req(TypeFunc::Memory,  merging->in(TypeFunc::Memory));
     return;
@@ -467,6 +477,20 @@
       mms.set_memory(phi);
     }
   }
+
+  Node* join_io    = join->in(TypeFunc::I_O);
+  Node* merging_io = merging->in(TypeFunc::I_O);
+  if (join_io != merging_io) {
+    PhiNode* phi;
+    if (join_io->is_Phi() && join_io->as_Phi()->region() == join_region) {
+      phi = join_io->as_Phi();
+    } else {
+      phi = PhiNode::make(join_region, join_io, Type::ABIO);
+      phi = (PhiNode*) delay_transform(phi);
+      join->set_req(TypeFunc::I_O, phi);
+    }
+    phi->set_req(slot, merging_io);
+  }
 }
 
 
@@ -477,7 +501,8 @@
                               const char *leaf_name,
                               Node* parm0,
                               Node* parm1,
-                              Node* parm2) {
+                              Node* parm2,
+                              Node* parm3) {
 
   // We only handle taking in RawMem and modifying RawMem
   const TypePtr* adr_type = TypeRawPtr::BOTTOM;
@@ -498,6 +523,7 @@
   if (parm0 != NULL)  call->init_req(TypeFunc::Parms+0, parm0);
   if (parm1 != NULL)  call->init_req(TypeFunc::Parms+1, parm1);
   if (parm2 != NULL)  call->init_req(TypeFunc::Parms+2, parm2);
+  if (parm3 != NULL)  call->init_req(TypeFunc::Parms+3, parm3);
 
   // Node *c = _gvn.transform(call);
   call = (CallNode *) _gvn.transform(call);
@@ -516,3 +542,51 @@
   assert(C->alias_type(call->adr_type()) == C->alias_type(adr_type),
          "call node must be constructed correctly");
 }
+
+
+void IdealKit::make_leaf_call_no_fp(const TypeFunc *slow_call_type,
+                              address slow_call,
+                              const char *leaf_name,
+                              const TypePtr* adr_type,
+                              Node* parm0,
+                              Node* parm1,
+                              Node* parm2,
+                              Node* parm3) {
+
+  // We only handle taking in RawMem and modifying RawMem
+  uint adr_idx = C->get_alias_index(adr_type);
+
+  // Slow-path leaf call
+  int size = slow_call_type->domain()->cnt();
+  CallNode *call =  (CallNode*)new (C, size) CallLeafNoFPNode( slow_call_type, slow_call, leaf_name, adr_type);
+
+  // Set fixed predefined input arguments
+  call->init_req( TypeFunc::Control, ctrl() );
+  call->init_req( TypeFunc::I_O    , top() )     ;   // does no i/o
+  // Narrow memory as only memory input
+  call->init_req( TypeFunc::Memory , memory(adr_idx));
+  call->init_req( TypeFunc::FramePtr, top() /* frameptr() */ );
+  call->init_req( TypeFunc::ReturnAdr, top() );
+
+  if (parm0 != NULL)  call->init_req(TypeFunc::Parms+0, parm0);
+  if (parm1 != NULL)  call->init_req(TypeFunc::Parms+1, parm1);
+  if (parm2 != NULL)  call->init_req(TypeFunc::Parms+2, parm2);
+  if (parm3 != NULL)  call->init_req(TypeFunc::Parms+3, parm3);
+
+  // Node *c = _gvn.transform(call);
+  call = (CallNode *) _gvn.transform(call);
+  Node *c = call; // dbx gets confused with call call->dump()
+
+  // Slow leaf call has no side-effects, sets few values
+
+  set_ctrl(transform( new (C, 1) ProjNode(call,TypeFunc::Control) ));
+
+  // Make memory for the call
+  Node* mem = _gvn.transform( new (C, 1) ProjNode(call, TypeFunc::Memory) );
+
+  // Set the RawPtr memory state only.
+  set_memory(mem, adr_idx);
+
+  assert(C->alias_type(call->adr_type()) == C->alias_type(adr_type),
+         "call node must be constructed correctly");
+}
--- a/hotspot/src/share/vm/opto/idealKit.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/idealKit.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -108,6 +108,7 @@
   bool _delay_all_transforms;              // flag forcing all transforms to be delayed
   Node* _initial_ctrl;                     // saves initial control until variables declared
   Node* _initial_memory;                   // saves initial memory  until variables declared
+  Node* _initial_i_o;                      // saves initial i_o  until variables declared
 
   PhaseGVN& gvn() const { return _gvn; }
   // Create a new cvstate filled with nulls
@@ -142,17 +143,21 @@
   Node* memory(uint alias_idx);
 
  public:
-  IdealKit(PhaseGVN &gvn, Node* control, Node* memory, bool delay_all_transforms = false, bool has_declarations = false);
+  IdealKit(GraphKit* gkit, bool delay_all_transforms = false, bool has_declarations = false);
   ~IdealKit() {
     stop();
     drain_delay_transform();
   }
+  void sync_kit(GraphKit* gkit);
+
   // Control
   Node* ctrl()                          { return _cvstate->in(TypeFunc::Control); }
   void set_ctrl(Node* ctrl)             { _cvstate->set_req(TypeFunc::Control, ctrl); }
   Node* top()                           { return C->top(); }
   MergeMemNode* merged_memory()         { return _cvstate->in(TypeFunc::Memory)->as_MergeMem(); }
   void set_all_memory(Node* mem)        { _cvstate->set_req(TypeFunc::Memory, mem); }
+  Node* i_o()                           { return _cvstate->in(TypeFunc::I_O); }
+  void set_i_o(Node* c)                 { _cvstate->set_req(TypeFunc::I_O, c); }
   void set(IdealVariable& v, Node* rhs) { _cvstate->set_req(first_var + v.id(), rhs); }
   Node* value(IdealVariable& v)         { return _cvstate->in(first_var + v.id()); }
   void dead(IdealVariable& v)           { set(v, (Node*)NULL); }
@@ -239,7 +244,18 @@
                       const char *leaf_name,
                       Node* parm0,
                       Node* parm1 = NULL,
-                      Node* parm2 = NULL);
+                      Node* parm2 = NULL,
+                      Node* parm3 = NULL);
+
+  void make_leaf_call_no_fp(const TypeFunc *slow_call_type,
+                            address slow_call,
+                            const char *leaf_name,
+                            const TypePtr* adr_type,
+                            Node* parm0,
+                            Node* parm1,
+                            Node* parm2,
+                            Node* parm3);
+
 };
 
 #endif // SHARE_VM_OPTO_IDEALKIT_HPP
--- a/hotspot/src/share/vm/opto/ifnode.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/ifnode.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -27,6 +27,7 @@
 #include "opto/addnode.hpp"
 #include "opto/cfgnode.hpp"
 #include "opto/connode.hpp"
+#include "opto/loopnode.hpp"
 #include "opto/phaseX.hpp"
 #include "opto/runtime.hpp"
 #include "opto/subnode.hpp"
@@ -222,22 +223,35 @@
 
   // Make a region merging constants and a region merging the rest
   uint req_c = 0;
+  Node* predicate_proj = NULL;
   for (uint ii = 1; ii < r->req(); ii++) {
-    if( phi->in(ii) == con1 ) {
+    if (phi->in(ii) == con1) {
       req_c++;
     }
+    Node* proj = PhaseIdealLoop::find_predicate(r->in(ii));
+    if (proj != NULL) {
+      assert(predicate_proj == NULL, "only one predicate entry expected");
+      predicate_proj = proj;
+    }
   }
+  Node* predicate_c = NULL;
+  Node* predicate_x = NULL;
+
   Node *region_c = new (igvn->C, req_c + 1) RegionNode(req_c + 1);
   Node *phi_c    = con1;
   uint  len      = r->req();
-  Node *region_x = new (igvn->C, len - req_c + 1) RegionNode(len - req_c + 1);
+  Node *region_x = new (igvn->C, len - req_c) RegionNode(len - req_c);
   Node *phi_x    = PhiNode::make_blank(region_x, phi);
   for (uint i = 1, i_c = 1, i_x = 1; i < len; i++) {
-    if( phi->in(i) == con1 ) {
+    if (phi->in(i) == con1) {
       region_c->init_req( i_c++, r  ->in(i) );
+      if (r->in(i) == predicate_proj)
+        predicate_c = predicate_proj;
     } else {
       region_x->init_req( i_x,   r  ->in(i) );
       phi_x   ->init_req( i_x++, phi->in(i) );
+      if (r->in(i) == predicate_proj)
+        predicate_x = predicate_proj;
     }
   }
 
@@ -277,8 +291,20 @@
   // Make the true/false arms
   Node *iff_c_t = phase->transform(new (igvn->C, 1) IfTrueNode (iff_c));
   Node *iff_c_f = phase->transform(new (igvn->C, 1) IfFalseNode(iff_c));
+  if (predicate_c != NULL) {
+    assert(predicate_x == NULL, "only one predicate entry expected");
+    // Clone loop predicates to each path
+    iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t);
+    iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f);
+  }
   Node *iff_x_t = phase->transform(new (igvn->C, 1) IfTrueNode (iff_x));
   Node *iff_x_f = phase->transform(new (igvn->C, 1) IfFalseNode(iff_x));
+  if (predicate_x != NULL) {
+    assert(predicate_c == NULL, "only one predicate entry expected");
+    // Clone loop predicates to each path
+    iff_x_t = igvn->clone_loop_predicates(predicate_x, iff_x_t);
+    iff_x_f = igvn->clone_loop_predicates(predicate_x, iff_x_f);
+  }
 
   // Merge the TRUE paths
   Node *region_s = new (igvn->C, 3) RegionNode(3);
--- a/hotspot/src/share/vm/opto/library_call.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1120,7 +1120,7 @@
   const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
   const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
 
-  IdealKit kit(gvn(), control(), merged_memory(), false, true);
+  IdealKit kit(this, false, true);
 #define __ kit.
   Node* zero             = __ ConI(0);
   Node* one              = __ ConI(1);
@@ -1171,7 +1171,7 @@
   __ bind(return_);
 
   // Final sync IdealKit and GraphKit.
-  sync_kit(kit);
+  final_sync(kit);
   Node* result = __ value(rtn);
 #undef __
   C->set_has_loops(true);
@@ -2318,22 +2318,20 @@
         // of it. So we need to emit code to conditionally do the proper type of
         // store.
 
-        IdealKit ideal(gvn(), control(),  merged_memory());
+        IdealKit ideal(this);
 #define __ ideal.
         // QQQ who knows what probability is here??
         __ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {
           // Sync IdealKit and graphKit.
-          set_all_memory( __ merged_memory());
-          set_control(__ ctrl());
+          sync_kit(ideal);
           Node* st = store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
           // Update IdealKit memory.
-          __ set_all_memory(merged_memory());
-          __ set_ctrl(control());
+          __ sync_kit(this);
         } __ else_(); {
           __ store(__ ctrl(), adr, val, type, alias_type->index(), is_volatile);
         } __ end_if();
         // Final sync IdealKit and GraphKit.
-        sync_kit(ideal);
+        final_sync(ideal);
 #undef __
       }
     }
@@ -4294,81 +4292,6 @@
   return true;
 }
 
-
-// constants for computing the copy function
-enum {
-  COPYFUNC_UNALIGNED = 0,
-  COPYFUNC_ALIGNED = 1,                 // src, dest aligned to HeapWordSize
-  COPYFUNC_CONJOINT = 0,
-  COPYFUNC_DISJOINT = 2                 // src != dest, or transfer can descend
-};
-
-// Note:  The condition "disjoint" applies also for overlapping copies
-// where an descending copy is permitted (i.e., dest_offset <= src_offset).
-static address
-select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized) {
-  int selector =
-    (aligned  ? COPYFUNC_ALIGNED  : COPYFUNC_UNALIGNED) +
-    (disjoint ? COPYFUNC_DISJOINT : COPYFUNC_CONJOINT);
-
-#define RETURN_STUB(xxx_arraycopy) { \
-  name = #xxx_arraycopy; \
-  return StubRoutines::xxx_arraycopy(); }
-
-#define RETURN_STUB_PARM(xxx_arraycopy, parm) {           \
-  name = #xxx_arraycopy; \
-  return StubRoutines::xxx_arraycopy(parm); }
-
-  switch (t) {
-  case T_BYTE:
-  case T_BOOLEAN:
-    switch (selector) {
-    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jbyte_arraycopy);
-    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jbyte_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jbyte_disjoint_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jbyte_disjoint_arraycopy);
-    }
-  case T_CHAR:
-  case T_SHORT:
-    switch (selector) {
-    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jshort_arraycopy);
-    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jshort_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jshort_disjoint_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jshort_disjoint_arraycopy);
-    }
-  case T_INT:
-  case T_FLOAT:
-    switch (selector) {
-    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jint_arraycopy);
-    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jint_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jint_disjoint_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jint_disjoint_arraycopy);
-    }
-  case T_DOUBLE:
-  case T_LONG:
-    switch (selector) {
-    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jlong_arraycopy);
-    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jlong_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jlong_disjoint_arraycopy);
-    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jlong_disjoint_arraycopy);
-    }
-  case T_ARRAY:
-  case T_OBJECT:
-    switch (selector) {
-    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB_PARM(oop_arraycopy, dest_uninitialized);
-    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB_PARM(arrayof_oop_arraycopy, dest_uninitialized);
-    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB_PARM(oop_disjoint_arraycopy, dest_uninitialized);
-    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB_PARM(arrayof_oop_disjoint_arraycopy, dest_uninitialized);
-    }
-  default:
-    ShouldNotReachHere();
-    return NULL;
-  }
-
-#undef RETURN_STUB
-#undef RETURN_STUB_PARM
-}
-
 //------------------------------basictype2arraycopy----------------------------
 address LibraryCallKit::basictype2arraycopy(BasicType t,
                                             Node* src_offset,
@@ -4401,7 +4324,7 @@
     disjoint = true;
   }
 
-  return select_arraycopy_function(t, aligned, disjoint, name, dest_uninitialized);
+  return StubRoutines::select_arraycopy_function(t, aligned, disjoint, name, dest_uninitialized);
 }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,960 @@
+/*
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "opto/loopnode.hpp"
+#include "opto/addnode.hpp"
+#include "opto/callnode.hpp"
+#include "opto/connode.hpp"
+#include "opto/loopnode.hpp"
+#include "opto/mulnode.hpp"
+#include "opto/rootnode.hpp"
+#include "opto/subnode.hpp"
+
+/*
+ * The general idea of Loop Predication is to insert a predicate on the entry
+ * path to a loop, and raise a uncommon trap if the check of the condition fails.
+ * The condition checks are promoted from inside the loop body, and thus
+ * the checks inside the loop could be eliminated. Currently, loop predication
+ * optimization has been applied to remove array range check and loop invariant
+ * checks (such as null checks).
+*/
+
+//-------------------------------is_uncommon_trap_proj----------------------------
+// Return true if proj is the form of "proj->[region->..]call_uct"
+bool PhaseIdealLoop::is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason) {
+  int path_limit = 10;
+  assert(proj, "invalid argument");
+  Node* out = proj;
+  for (int ct = 0; ct < path_limit; ct++) {
+    out = out->unique_ctrl_out();
+    if (out == NULL)
+      return false;
+    if (out->is_CallStaticJava()) {
+      int req = out->as_CallStaticJava()->uncommon_trap_request();
+      if (req != 0) {
+        Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
+        if (trap_reason == reason || reason == Deoptimization::Reason_none) {
+           return true;
+        }
+      }
+      return false; // don't do further after call
+    }
+    if (out->Opcode() != Op_Region)
+      return false;
+  }
+  return false;
+}
+
+//-------------------------------is_uncommon_trap_if_pattern-------------------------
+// Return true  for "if(test)-> proj -> ...
+//                          |
+//                          V
+//                      other_proj->[region->..]call_uct"
+//
+// "must_reason_predicate" means the uct reason must be Reason_predicate
+bool PhaseIdealLoop::is_uncommon_trap_if_pattern(ProjNode *proj, Deoptimization::DeoptReason reason) {
+  Node *in0 = proj->in(0);
+  if (!in0->is_If()) return false;
+  // Variation of a dead If node.
+  if (in0->outcnt() < 2)  return false;
+  IfNode* iff = in0->as_If();
+
+  // we need "If(Conv2B(Opaque1(...)))" pattern for reason_predicate
+  if (reason != Deoptimization::Reason_none) {
+    if (iff->in(1)->Opcode() != Op_Conv2B ||
+       iff->in(1)->in(1)->Opcode() != Op_Opaque1) {
+      return false;
+    }
+  }
+
+  ProjNode* other_proj = iff->proj_out(1-proj->_con)->as_Proj();
+  if (is_uncommon_trap_proj(other_proj, reason)) {
+    assert(reason == Deoptimization::Reason_none ||
+           Compile::current()->is_predicate_opaq(iff->in(1)->in(1)), "should be on the list");
+    return true;
+  }
+  return false;
+}
+
+//-------------------------------register_control-------------------------
+void PhaseIdealLoop::register_control(Node* n, IdealLoopTree *loop, Node* pred) {
+  assert(n->is_CFG(), "must be control node");
+  _igvn.register_new_node_with_optimizer(n);
+  loop->_body.push(n);
+  set_loop(n, loop);
+  // When called from beautify_loops() idom is not constructed yet.
+  if (_idom != NULL) {
+    set_idom(n, pred, dom_depth(pred));
+  }
+}
+
+//------------------------------create_new_if_for_predicate------------------------
+// create a new if above the uct_if_pattern for the predicate to be promoted.
+//
+//          before                                after
+//        ----------                           ----------
+//           ctrl                                 ctrl
+//            |                                     |
+//            |                                     |
+//            v                                     v
+//           iff                                 new_iff
+//          /    \                                /      \
+//         /      \                              /        \
+//        v        v                            v          v
+//  uncommon_proj cont_proj                   if_uct     if_cont
+// \      |        |                           |          |
+//  \     |        |                           |          |
+//   v    v        v                           |          v
+//     rgn       loop                          |         iff
+//      |                                      |        /     \
+//      |                                      |       /       \
+//      v                                      |      v         v
+// uncommon_trap                               | uncommon_proj cont_proj
+//                                           \  \    |           |
+//                                            \  \   |           |
+//                                             v  v  v           v
+//                                               rgn           loop
+//                                                |
+//                                                |
+//                                                v
+//                                           uncommon_trap
+//
+//
+// We will create a region to guard the uct call if there is no one there.
+// The true projecttion (if_cont) of the new_iff is returned.
+// This code is also used to clone predicates to clonned loops.
+ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
+                                                      Deoptimization::DeoptReason reason) {
+  assert(is_uncommon_trap_if_pattern(cont_proj, reason), "must be a uct if pattern!");
+  IfNode* iff = cont_proj->in(0)->as_If();
+
+  ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con);
+  Node     *rgn   = uncommon_proj->unique_ctrl_out();
+  assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct");
+
+  uint proj_index = 1; // region's edge corresponding to uncommon_proj
+  if (!rgn->is_Region()) { // create a region to guard the call
+    assert(rgn->is_Call(), "must be call uct");
+    CallNode* call = rgn->as_Call();
+    IdealLoopTree* loop = get_loop(call);
+    rgn = new (C, 1) RegionNode(1);
+    rgn->add_req(uncommon_proj);
+    register_control(rgn, loop, uncommon_proj);
+    _igvn.hash_delete(call);
+    call->set_req(0, rgn);
+    // When called from beautify_loops() idom is not constructed yet.
+    if (_idom != NULL) {
+      set_idom(call, rgn, dom_depth(rgn));
+    }
+  } else {
+    // Find region's edge corresponding to uncommon_proj
+    for (; proj_index < rgn->req(); proj_index++)
+      if (rgn->in(proj_index) == uncommon_proj) break;
+    assert(proj_index < rgn->req(), "sanity");
+  }
+
+  Node* entry = iff->in(0);
+  if (new_entry != NULL) {
+    // Clonning the predicate to new location.
+    entry = new_entry;
+  }
+  // Create new_iff
+  IdealLoopTree* lp = get_loop(entry);
+  IfNode *new_iff = iff->clone()->as_If();
+  new_iff->set_req(0, entry);
+  register_control(new_iff, lp, entry);
+  Node *if_cont = new (C, 1) IfTrueNode(new_iff);
+  Node *if_uct  = new (C, 1) IfFalseNode(new_iff);
+  if (cont_proj->is_IfFalse()) {
+    // Swap
+    Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
+  }
+  register_control(if_cont, lp, new_iff);
+  register_control(if_uct, get_loop(rgn), new_iff);
+
+  // if_uct to rgn
+  _igvn.hash_delete(rgn);
+  rgn->add_req(if_uct);
+  // When called from beautify_loops() idom is not constructed yet.
+  if (_idom != NULL) {
+    Node* ridom = idom(rgn);
+    Node* nrdom = dom_lca(ridom, new_iff);
+    set_idom(rgn, nrdom, dom_depth(rgn));
+  }
+
+  // If rgn has phis add new edges which has the same
+  // value as on original uncommon_proj pass.
+  assert(rgn->in(rgn->req() -1) == if_uct, "new edge should be last");
+  bool has_phi = false;
+  for (DUIterator_Fast imax, i = rgn->fast_outs(imax); i < imax; i++) {
+    Node* use = rgn->fast_out(i);
+    if (use->is_Phi() && use->outcnt() > 0) {
+      assert(use->in(0) == rgn, "");
+      _igvn.hash_delete(use);
+      use->add_req(use->in(proj_index));
+      _igvn._worklist.push(use);
+      has_phi = true;
+    }
+  }
+  assert(!has_phi || rgn->req() > 3, "no phis when region is created");
+
+  if (new_entry == NULL) {
+    // Attach if_cont to iff
+    _igvn.hash_delete(iff);
+    iff->set_req(0, if_cont);
+    if (_idom != NULL) {
+      set_idom(iff, if_cont, dom_depth(iff));
+    }
+  }
+  return if_cont->as_Proj();
+}
+
+//------------------------------create_new_if_for_predicate------------------------
+// Create a new if below new_entry for the predicate to be cloned (IGVN optimization)
+ProjNode* PhaseIterGVN::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
+                                                    Deoptimization::DeoptReason reason) {
+  assert(new_entry != 0, "only used for clone predicate");
+  assert(PhaseIdealLoop::is_uncommon_trap_if_pattern(cont_proj, reason), "must be a uct if pattern!");
+  IfNode* iff = cont_proj->in(0)->as_If();
+
+  ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con);
+  Node     *rgn   = uncommon_proj->unique_ctrl_out();
+  assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct");
+
+  uint proj_index = 1; // region's edge corresponding to uncommon_proj
+  if (!rgn->is_Region()) { // create a region to guard the call
+    assert(rgn->is_Call(), "must be call uct");
+    CallNode* call = rgn->as_Call();
+    rgn = new (C, 1) RegionNode(1);
+    register_new_node_with_optimizer(rgn);
+    rgn->add_req(uncommon_proj);
+    hash_delete(call);
+    call->set_req(0, rgn);
+  } else {
+    // Find region's edge corresponding to uncommon_proj
+    for (; proj_index < rgn->req(); proj_index++)
+      if (rgn->in(proj_index) == uncommon_proj) break;
+    assert(proj_index < rgn->req(), "sanity");
+  }
+
+  // Create new_iff in new location.
+  IfNode *new_iff = iff->clone()->as_If();
+  new_iff->set_req(0, new_entry);
+
+  register_new_node_with_optimizer(new_iff);
+  Node *if_cont = new (C, 1) IfTrueNode(new_iff);
+  Node *if_uct  = new (C, 1) IfFalseNode(new_iff);
+  if (cont_proj->is_IfFalse()) {
+    // Swap
+    Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
+  }
+  register_new_node_with_optimizer(if_cont);
+  register_new_node_with_optimizer(if_uct);
+
+  // if_uct to rgn
+  hash_delete(rgn);
+  rgn->add_req(if_uct);
+
+  // If rgn has phis add corresponding new edges which has the same
+  // value as on original uncommon_proj pass.
+  assert(rgn->in(rgn->req() -1) == if_uct, "new edge should be last");
+  bool has_phi = false;
+  for (DUIterator_Fast imax, i = rgn->fast_outs(imax); i < imax; i++) {
+    Node* use = rgn->fast_out(i);
+    if (use->is_Phi() && use->outcnt() > 0) {
+      hash_delete(use);
+      use->add_req(use->in(proj_index));
+      _worklist.push(use);
+      has_phi = true;
+    }
+  }
+  assert(!has_phi || rgn->req() > 3, "no phis when region is created");
+
+  return if_cont->as_Proj();
+}
+
+//--------------------------clone_predicate-----------------------
+ProjNode* PhaseIdealLoop::clone_predicate(ProjNode* predicate_proj, Node* new_entry,
+                                          Deoptimization::DeoptReason reason,
+                                          PhaseIdealLoop* loop_phase,
+                                          PhaseIterGVN* igvn) {
+  ProjNode* new_predicate_proj;
+  if (loop_phase != NULL) {
+    new_predicate_proj = loop_phase->create_new_if_for_predicate(predicate_proj, new_entry, reason);
+  } else {
+    new_predicate_proj =       igvn->create_new_if_for_predicate(predicate_proj, new_entry, reason);
+  }
+  IfNode* iff = new_predicate_proj->in(0)->as_If();
+  Node* ctrl  = iff->in(0);
+
+  // Match original condition since predicate's projections could be swapped.
+  assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+  Node* opq = new (igvn->C, 2) Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1));
+  igvn->C->add_predicate_opaq(opq);
+
+  Node* bol = new (igvn->C, 2) Conv2BNode(opq);
+  if (loop_phase != NULL) {
+    loop_phase->register_new_node(opq, ctrl);
+    loop_phase->register_new_node(bol, ctrl);
+  } else {
+    igvn->register_new_node_with_optimizer(opq);
+    igvn->register_new_node_with_optimizer(bol);
+  }
+  igvn->hash_delete(iff);
+  iff->set_req(1, bol);
+  return new_predicate_proj;
+}
+
+//--------------------------move_predicate-----------------------
+// Cut predicate from old place and move it to new.
+ProjNode* PhaseIdealLoop::move_predicate(ProjNode* predicate_proj, Node* new_entry,
+                                         Deoptimization::DeoptReason reason,
+                                         PhaseIdealLoop* loop_phase,
+                                         PhaseIterGVN* igvn) {
+  assert(new_entry != NULL, "must be");
+  assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+  IfNode* iff = predicate_proj->in(0)->as_If();
+  Node* old_entry = iff->in(0);
+
+  // Cut predicate from old place.
+  Node* old = predicate_proj;
+  igvn->_worklist.push(old);
+  for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin; ) {
+    Node* use = old->last_out(i);  // for each use...
+    igvn->hash_delete(use);
+    igvn->_worklist.push(use);
+    // Update use-def info
+    uint uses_found = 0;
+    for (uint j = 0; j < use->req(); j++) {
+      if (use->in(j) == old) {
+        use->set_req(j, old_entry);
+        uses_found++;
+        if (loop_phase != NULL) {
+          if (use->is_CFG()) {
+            // When called from beautify_loops() idom is not constructed yet.
+            if (loop_phase->_idom != NULL)
+              loop_phase->set_idom(use, old_entry, loop_phase->dom_depth(use));
+          } else {
+            loop_phase->set_ctrl(use, old_entry);
+          }
+        }
+      }
+    }
+    i -= uses_found;    // we deleted 1 or more copies of this edge
+  }
+
+  // Move predicate.
+  igvn->hash_delete(iff);
+  iff->set_req(0, new_entry);
+  igvn->_worklist.push(iff);
+
+  if (loop_phase != NULL) {
+    // Fix up idom and ctrl.
+    loop_phase->set_ctrl(iff->in(1), new_entry);
+    loop_phase->set_ctrl(iff->in(1)->in(1), new_entry);
+    // When called from beautify_loops() idom is not constructed yet.
+    if (loop_phase->_idom != NULL)
+      loop_phase->set_idom(iff, new_entry, loop_phase->dom_depth(iff));
+  }
+
+  return predicate_proj;
+}
+
+//--------------------------clone_loop_predicates-----------------------
+// Interface from IGVN
+Node* PhaseIterGVN::clone_loop_predicates(Node* old_entry, Node* new_entry) {
+  return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, false, NULL, this);
+}
+Node* PhaseIterGVN::move_loop_predicates(Node* old_entry, Node* new_entry) {
+  return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, true, NULL, this);
+}
+
+// Interface from PhaseIdealLoop
+Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry) {
+  return clone_loop_predicates(old_entry, new_entry, false, this, &this->_igvn);
+}
+Node* PhaseIdealLoop::move_loop_predicates(Node* old_entry, Node* new_entry) {
+  return clone_loop_predicates(old_entry, new_entry, true, this, &this->_igvn);
+}
+
+// Clone loop predicates to cloned loops (peeled, unswitched, split_if).
+Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry,
+                                                bool move_predicates,
+                                                PhaseIdealLoop* loop_phase,
+                                                PhaseIterGVN* igvn) {
+#ifdef ASSERT
+  if (new_entry == NULL || !(new_entry->is_Proj() || new_entry->is_Region() || new_entry->is_SafePoint())) {
+    if (new_entry != NULL)
+      new_entry->dump();
+    assert(false, "not IfTrue, IfFalse, Region or SafePoint");
+  }
+#endif
+  // Search original predicates
+  Node* entry = old_entry;
+  if (UseLoopPredicate) {
+    ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+    if (predicate_proj != NULL) { // right pattern that can be used by loop predication
+      assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+      if (move_predicates) {
+        new_entry =  move_predicate(predicate_proj, new_entry,
+                                    Deoptimization::Reason_predicate,
+                                    loop_phase, igvn);
+        assert(new_entry == predicate_proj, "old predicate fall through projection");
+      } else {
+        // clone predicate
+        new_entry = clone_predicate(predicate_proj, new_entry,
+                                    Deoptimization::Reason_predicate,
+                                    loop_phase, igvn);
+        assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone predicate");
+      }
+      if (TraceLoopPredicate) {
+        tty->print_cr("Loop Predicate %s: ", move_predicates ? "moved" : "cloned");
+        debug_only( new_entry->in(0)->dump(); )
+      }
+    }
+  }
+  return new_entry;
+}
+
+//--------------------------eliminate_loop_predicates-----------------------
+void PhaseIdealLoop::eliminate_loop_predicates(Node* entry) {
+  if (UseLoopPredicate) {
+    ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+    if (predicate_proj != NULL) { // right pattern that can be used by loop predication
+      Node* n = entry->in(0)->in(1)->in(1);
+      assert(n->Opcode()==Op_Opaque1, "must be");
+      // Remove Opaque1 node from predicates list.
+      // IGVN will remove this predicate check.
+      _igvn.replace_node(n, n->in(1));
+    }
+  }
+}
+
+//--------------------------skip_loop_predicates------------------------------
+// Skip related predicates.
+Node* PhaseIdealLoop::skip_loop_predicates(Node* entry) {
+  Node* predicate = NULL;
+  if (UseLoopPredicate) {
+    predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+    if (predicate != NULL) { // right pattern that can be used by loop predication
+      assert(entry->is_Proj() && entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+      IfNode* iff = entry->in(0)->as_If();
+      ProjNode* uncommon_proj = iff->proj_out(1 - entry->as_Proj()->_con);
+      Node* rgn = uncommon_proj->unique_ctrl_out();
+      assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct");
+      entry = entry->in(0)->in(0);
+      while (entry != NULL && entry->is_Proj() && entry->in(0)->is_If()) {
+        uncommon_proj = entry->in(0)->as_If()->proj_out(1 - entry->as_Proj()->_con);
+        if (uncommon_proj->unique_ctrl_out() != rgn)
+          break;
+        entry = entry->in(0)->in(0);
+      }
+    }
+  }
+  return entry;
+}
+
+//--------------------------find_predicate_insertion_point-------------------
+// Find a good location to insert a predicate
+ProjNode* PhaseIdealLoop::find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason) {
+  if (start_c == NULL || !start_c->is_Proj())
+    return NULL;
+  if (is_uncommon_trap_if_pattern(start_c->as_Proj(), reason)) {
+    return start_c->as_Proj();
+  }
+  return NULL;
+}
+
+//--------------------------find_predicate------------------------------------
+// Find a predicate
+Node* PhaseIdealLoop::find_predicate(Node* entry) {
+  Node* predicate = NULL;
+  if (UseLoopPredicate) {
+    predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+    if (predicate != NULL) { // right pattern that can be used by loop predication
+      assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
+      return entry;
+    }
+  }
+  return NULL;
+}
+
+//------------------------------Invariance-----------------------------------
+// Helper class for loop_predication_impl to compute invariance on the fly and
+// clone invariants.
+class Invariance : public StackObj {
+  VectorSet _visited, _invariant;
+  Node_Stack _stack;
+  VectorSet _clone_visited;
+  Node_List _old_new; // map of old to new (clone)
+  IdealLoopTree* _lpt;
+  PhaseIdealLoop* _phase;
+
+  // Helper function to set up the invariance for invariance computation
+  // If n is a known invariant, set up directly. Otherwise, look up the
+  // the possibility to push n onto the stack for further processing.
+  void visit(Node* use, Node* n) {
+    if (_lpt->is_invariant(n)) { // known invariant
+      _invariant.set(n->_idx);
+    } else if (!n->is_CFG()) {
+      Node *n_ctrl = _phase->ctrl_or_self(n);
+      Node *u_ctrl = _phase->ctrl_or_self(use); // self if use is a CFG
+      if (_phase->is_dominator(n_ctrl, u_ctrl)) {
+        _stack.push(n, n->in(0) == NULL ? 1 : 0);
+      }
+    }
+  }
+
+  // Compute invariance for "the_node" and (possibly) all its inputs recursively
+  // on the fly
+  void compute_invariance(Node* n) {
+    assert(_visited.test(n->_idx), "must be");
+    visit(n, n);
+    while (_stack.is_nonempty()) {
+      Node*  n = _stack.node();
+      uint idx = _stack.index();
+      if (idx == n->req()) { // all inputs are processed
+        _stack.pop();
+        // n is invariant if it's inputs are all invariant
+        bool all_inputs_invariant = true;
+        for (uint i = 0; i < n->req(); i++) {
+          Node* in = n->in(i);
+          if (in == NULL) continue;
+          assert(_visited.test(in->_idx), "must have visited input");
+          if (!_invariant.test(in->_idx)) { // bad guy
+            all_inputs_invariant = false;
+            break;
+          }
+        }
+        if (all_inputs_invariant) {
+          _invariant.set(n->_idx); // I am a invariant too
+        }
+      } else { // process next input
+        _stack.set_index(idx + 1);
+        Node* m = n->in(idx);
+        if (m != NULL && !_visited.test_set(m->_idx)) {
+          visit(n, m);
+        }
+      }
+    }
+  }
+
+  // Helper function to set up _old_new map for clone_nodes.
+  // If n is a known invariant, set up directly ("clone" of n == n).
+  // Otherwise, push n onto the stack for real cloning.
+  void clone_visit(Node* n) {
+    assert(_invariant.test(n->_idx), "must be invariant");
+    if (_lpt->is_invariant(n)) { // known invariant
+      _old_new.map(n->_idx, n);
+    } else { // to be cloned
+      assert(!n->is_CFG(), "should not see CFG here");
+      _stack.push(n, n->in(0) == NULL ? 1 : 0);
+    }
+  }
+
+  // Clone "n" and (possibly) all its inputs recursively
+  void clone_nodes(Node* n, Node* ctrl) {
+    clone_visit(n);
+    while (_stack.is_nonempty()) {
+      Node*  n = _stack.node();
+      uint idx = _stack.index();
+      if (idx == n->req()) { // all inputs processed, clone n!
+        _stack.pop();
+        // clone invariant node
+        Node* n_cl = n->clone();
+        _old_new.map(n->_idx, n_cl);
+        _phase->register_new_node(n_cl, ctrl);
+        for (uint i = 0; i < n->req(); i++) {
+          Node* in = n_cl->in(i);
+          if (in == NULL) continue;
+          n_cl->set_req(i, _old_new[in->_idx]);
+        }
+      } else { // process next input
+        _stack.set_index(idx + 1);
+        Node* m = n->in(idx);
+        if (m != NULL && !_clone_visited.test_set(m->_idx)) {
+          clone_visit(m); // visit the input
+        }
+      }
+    }
+  }
+
+ public:
+  Invariance(Arena* area, IdealLoopTree* lpt) :
+    _lpt(lpt), _phase(lpt->_phase),
+    _visited(area), _invariant(area), _stack(area, 10 /* guess */),
+    _clone_visited(area), _old_new(area)
+  {}
+
+  // Map old to n for invariance computation and clone
+  void map_ctrl(Node* old, Node* n) {
+    assert(old->is_CFG() && n->is_CFG(), "must be");
+    _old_new.map(old->_idx, n); // "clone" of old is n
+    _invariant.set(old->_idx);  // old is invariant
+    _clone_visited.set(old->_idx);
+  }
+
+  // Driver function to compute invariance
+  bool is_invariant(Node* n) {
+    if (!_visited.test_set(n->_idx))
+      compute_invariance(n);
+    return (_invariant.test(n->_idx) != 0);
+  }
+
+  // Driver function to clone invariant
+  Node* clone(Node* n, Node* ctrl) {
+    assert(ctrl->is_CFG(), "must be");
+    assert(_invariant.test(n->_idx), "must be an invariant");
+    if (!_clone_visited.test(n->_idx))
+      clone_nodes(n, ctrl);
+    return _old_new[n->_idx];
+  }
+};
+
+//------------------------------is_range_check_if -----------------------------------
+// Returns true if the predicate of iff is in "scale*iv + offset u< load_range(ptr)" format
+// Note: this function is particularly designed for loop predication. We require load_range
+//       and offset to be loop invariant computed on the fly by "invar"
+bool IdealLoopTree::is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const {
+  if (!is_loop_exit(iff)) {
+    return false;
+  }
+  if (!iff->in(1)->is_Bool()) {
+    return false;
+  }
+  const BoolNode *bol = iff->in(1)->as_Bool();
+  if (bol->_test._test != BoolTest::lt) {
+    return false;
+  }
+  if (!bol->in(1)->is_Cmp()) {
+    return false;
+  }
+  const CmpNode *cmp = bol->in(1)->as_Cmp();
+  if (cmp->Opcode() != Op_CmpU) {
+    return false;
+  }
+  Node* range = cmp->in(2);
+  if (range->Opcode() != Op_LoadRange) {
+    const TypeInt* tint = phase->_igvn.type(range)->isa_int();
+    if (!OptimizeFill || tint == NULL || tint->empty() || tint->_lo < 0) {
+      // Allow predication on positive values that aren't LoadRanges.
+      // This allows optimization of loops where the length of the
+      // array is a known value and doesn't need to be loaded back
+      // from the array.
+      return false;
+    }
+  }
+  if (!invar.is_invariant(range)) {
+    return false;
+  }
+  Node *iv     = _head->as_CountedLoop()->phi();
+  int   scale  = 0;
+  Node *offset = NULL;
+  if (!phase->is_scaled_iv_plus_offset(cmp->in(1), iv, &scale, &offset)) {
+    return false;
+  }
+  if (offset && !invar.is_invariant(offset)) { // offset must be invariant
+    return false;
+  }
+  return true;
+}
+
+//------------------------------rc_predicate-----------------------------------
+// Create a range check predicate
+//
+// for (i = init; i < limit; i += stride) {
+//    a[scale*i+offset]
+// }
+//
+// Compute max(scale*i + offset) for init <= i < limit and build the predicate
+// as "max(scale*i + offset) u< a.length".
+//
+// There are two cases for max(scale*i + offset):
+// (1) stride*scale > 0
+//   max(scale*i + offset) = scale*(limit-stride) + offset
+// (2) stride*scale < 0
+//   max(scale*i + offset) = scale*init + offset
+BoolNode* PhaseIdealLoop::rc_predicate(Node* ctrl,
+                                       int scale, Node* offset,
+                                       Node* init, Node* limit, Node* stride,
+                                       Node* range, bool upper) {
+  DEBUG_ONLY(ttyLocker ttyl);
+  if (TraceLoopPredicate) tty->print("rc_predicate ");
+
+  Node* max_idx_expr  = init;
+  int stride_con = stride->get_int();
+  if ((stride_con > 0) == (scale > 0) == upper) {
+    max_idx_expr = new (C, 3) SubINode(limit, stride);
+    register_new_node(max_idx_expr, ctrl);
+    if (TraceLoopPredicate) tty->print("(limit - stride) ");
+  } else {
+    if (TraceLoopPredicate) tty->print("init ");
+  }
+
+  if (scale != 1) {
+    ConNode* con_scale = _igvn.intcon(scale);
+    max_idx_expr = new (C, 3) MulINode(max_idx_expr, con_scale);
+    register_new_node(max_idx_expr, ctrl);
+    if (TraceLoopPredicate) tty->print("* %d ", scale);
+  }
+
+  if (offset && (!offset->is_Con() || offset->get_int() != 0)){
+    max_idx_expr = new (C, 3) AddINode(max_idx_expr, offset);
+    register_new_node(max_idx_expr, ctrl);
+    if (TraceLoopPredicate)
+      if (offset->is_Con()) tty->print("+ %d ", offset->get_int());
+      else tty->print("+ offset ");
+  }
+
+  CmpUNode* cmp = new (C, 3) CmpUNode(max_idx_expr, range);
+  register_new_node(cmp, ctrl);
+  BoolNode* bol = new (C, 2) BoolNode(cmp, BoolTest::lt);
+  register_new_node(bol, ctrl);
+
+  if (TraceLoopPredicate) tty->print_cr("<u range");
+  return bol;
+}
+
+//------------------------------ loop_predication_impl--------------------------
+// Insert loop predicates for null checks and range checks
+bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) {
+  if (!UseLoopPredicate) return false;
+
+  if (!loop->_head->is_Loop()) {
+    // Could be a simple region when irreducible loops are present.
+    return false;
+  }
+
+  if (loop->_head->unique_ctrl_out()->Opcode() == Op_NeverBranch) {
+    // do nothing for infinite loops
+    return false;
+  }
+
+  CountedLoopNode *cl = NULL;
+  if (loop->_head->is_CountedLoop()) {
+    cl = loop->_head->as_CountedLoop();
+    // do nothing for iteration-splitted loops
+    if (!cl->is_normal_loop()) return false;
+  }
+
+  LoopNode *lpn  = loop->_head->as_Loop();
+  Node* entry = lpn->in(LoopNode::EntryControl);
+
+  ProjNode *predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+  if (!predicate_proj) {
+#ifndef PRODUCT
+    if (TraceLoopPredicate) {
+      tty->print("missing predicate:");
+      loop->dump_head();
+      lpn->dump(1);
+    }
+#endif
+    return false;
+  }
+  ConNode* zero = _igvn.intcon(0);
+  set_ctrl(zero, C->root());
+
+  ResourceArea *area = Thread::current()->resource_area();
+  Invariance invar(area, loop);
+
+  // Create list of if-projs such that a newer proj dominates all older
+  // projs in the list, and they all dominate loop->tail()
+  Node_List if_proj_list(area);
+  LoopNode *head  = loop->_head->as_Loop();
+  Node *current_proj = loop->tail(); //start from tail
+  while (current_proj != head) {
+    if (loop == get_loop(current_proj) && // still in the loop ?
+        current_proj->is_Proj()        && // is a projection  ?
+        current_proj->in(0)->Opcode() == Op_If) { // is a if projection ?
+      if_proj_list.push(current_proj);
+    }
+    current_proj = idom(current_proj);
+  }
+
+  bool hoisted = false; // true if at least one proj is promoted
+  while (if_proj_list.size() > 0) {
+    // Following are changed to nonnull when a predicate can be hoisted
+    ProjNode* new_predicate_proj = NULL;
+
+    ProjNode* proj = if_proj_list.pop()->as_Proj();
+    IfNode*   iff  = proj->in(0)->as_If();
+
+    if (!is_uncommon_trap_if_pattern(proj, Deoptimization::Reason_none)) {
+      if (loop->is_loop_exit(iff)) {
+        // stop processing the remaining projs in the list because the execution of them
+        // depends on the condition of "iff" (iff->in(1)).
+        break;
+      } else {
+        // Both arms are inside the loop. There are two cases:
+        // (1) there is one backward branch. In this case, any remaining proj
+        //     in the if_proj list post-dominates "iff". So, the condition of "iff"
+        //     does not determine the execution the remining projs directly, and we
+        //     can safely continue.
+        // (2) both arms are forwarded, i.e. a diamond shape. In this case, "proj"
+        //     does not dominate loop->tail(), so it can not be in the if_proj list.
+        continue;
+      }
+    }
+
+    Node*     test = iff->in(1);
+    if (!test->is_Bool()){ //Conv2B, ...
+      continue;
+    }
+    BoolNode* bol = test->as_Bool();
+    if (invar.is_invariant(bol)) {
+      // Invariant test
+      new_predicate_proj = create_new_if_for_predicate(predicate_proj, NULL,
+                                                       Deoptimization::Reason_predicate);
+      Node* ctrl = new_predicate_proj->in(0)->as_If()->in(0);
+      BoolNode* new_predicate_bol = invar.clone(bol, ctrl)->as_Bool();
+
+      // Negate test if necessary
+      bool negated = false;
+      if (proj->_con != predicate_proj->_con) {
+        new_predicate_bol = new (C, 2) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate());
+        register_new_node(new_predicate_bol, ctrl);
+        negated = true;
+      }
+      IfNode* new_predicate_iff = new_predicate_proj->in(0)->as_If();
+      _igvn.hash_delete(new_predicate_iff);
+      new_predicate_iff->set_req(1, new_predicate_bol);
+#ifndef PRODUCT
+      if (TraceLoopPredicate) {
+        tty->print("Predicate invariant if%s: %d ", negated ? " negated" : "", new_predicate_iff->_idx);
+        loop->dump_head();
+      } else if (TraceLoopOpts) {
+        tty->print("Predicate IC ");
+        loop->dump_head();
+      }
+#endif
+    } else if (cl != NULL && loop->is_range_check_if(iff, this, invar)) {
+      assert(proj->_con == predicate_proj->_con, "must match");
+
+      // Range check for counted loops
+      const Node*    cmp    = bol->in(1)->as_Cmp();
+      Node*          idx    = cmp->in(1);
+      assert(!invar.is_invariant(idx), "index is variant");
+      assert(cmp->in(2)->Opcode() == Op_LoadRange || OptimizeFill, "must be");
+      Node* rng = cmp->in(2);
+      assert(invar.is_invariant(rng), "range must be invariant");
+      int scale    = 1;
+      Node* offset = zero;
+      bool ok = is_scaled_iv_plus_offset(idx, cl->phi(), &scale, &offset);
+      assert(ok, "must be index expression");
+
+      Node* init    = cl->init_trip();
+      Node* limit   = cl->limit();
+      Node* stride  = cl->stride();
+
+      // Build if's for the upper and lower bound tests.  The
+      // lower_bound test will dominate the upper bound test and all
+      // cloned or created nodes will use the lower bound test as
+      // their declared control.
+      ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
+      ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
+      assert(upper_bound_proj->in(0)->as_If()->in(0) == lower_bound_proj, "should dominate");
+      Node *ctrl = lower_bound_proj->in(0)->as_If()->in(0);
+
+      // Perform cloning to keep Invariance state correct since the
+      // late schedule will place invariant things in the loop.
+      rng = invar.clone(rng, ctrl);
+      if (offset && offset != zero) {
+        assert(invar.is_invariant(offset), "offset must be loop invariant");
+        offset = invar.clone(offset, ctrl);
+      }
+
+      // Test the lower bound
+      Node*  lower_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, false);
+      IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If();
+      _igvn.hash_delete(lower_bound_iff);
+      lower_bound_iff->set_req(1, lower_bound_bol);
+      if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx);
+
+      // Test the upper bound
+      Node* upper_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, true);
+      IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If();
+      _igvn.hash_delete(upper_bound_iff);
+      upper_bound_iff->set_req(1, upper_bound_bol);
+      if (TraceLoopPredicate) tty->print_cr("upper bound check if: %d", lower_bound_iff->_idx);
+
+      // Fall through into rest of the clean up code which will move
+      // any dependent nodes onto the upper bound test.
+      new_predicate_proj = upper_bound_proj;
+
+#ifndef PRODUCT
+      if (TraceLoopOpts && !TraceLoopPredicate) {
+        tty->print("Predicate RC ");
+        loop->dump_head();
+      }
+#endif
+    } else {
+      // Loop variant check (for example, range check in non-counted loop)
+      // with uncommon trap.
+      continue;
+    }
+    assert(new_predicate_proj != NULL, "sanity");
+    // Success - attach condition (new_predicate_bol) to predicate if
+    invar.map_ctrl(proj, new_predicate_proj); // so that invariance test can be appropriate
+
+    // Eliminate the old If in the loop body
+    dominated_by( new_predicate_proj, iff, proj->_con != new_predicate_proj->_con );
+
+    hoisted = true;
+    C->set_major_progress();
+  } // end while
+
+#ifndef PRODUCT
+  // report that the loop predication has been actually performed
+  // for this loop
+  if (TraceLoopPredicate && hoisted) {
+    tty->print("Loop Predication Performed:");
+    loop->dump_head();
+  }
+#endif
+
+  return hoisted;
+}
+
+//------------------------------loop_predication--------------------------------
+// driver routine for loop predication optimization
+bool IdealLoopTree::loop_predication( PhaseIdealLoop *phase) {
+  bool hoisted = false;
+  // Recursively promote predicates
+  if (_child) {
+    hoisted = _child->loop_predication( phase);
+  }
+
+  // self
+  if (!_irreducible && !tail()->is_top()) {
+    hoisted |= phase->loop_predication_impl(this);
+  }
+
+  if (_next) { //sibling
+    hoisted |= _next->loop_predication( phase);
+  }
+
+  return hoisted;
+}
+
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -63,6 +63,46 @@
   }
 }
 
+//------------------------------compute_exact_trip_count-----------------------
+// Compute loop exact trip count if possible. Do not recalculate trip count for
+// split loops (pre-main-post) which have their limits and inits behind Opaque node.
+void IdealLoopTree::compute_exact_trip_count( PhaseIdealLoop *phase ) {
+  if (!_head->as_Loop()->is_valid_counted_loop()) {
+    return;
+  }
+  CountedLoopNode* cl = _head->as_CountedLoop();
+  // Trip count may become nonexact for iteration split loops since
+  // RCE modifies limits. Note, _trip_count value is not reset since
+  // it is used to limit unrolling of main loop.
+  cl->set_nonexact_trip_count();
+
+  // Loop's test should be part of loop.
+  if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue))))
+    return; // Infinite loop
+
+#ifdef ASSERT
+  BoolTest::mask bt = cl->loopexit()->test_trip();
+  assert(bt == BoolTest::lt || bt == BoolTest::gt ||
+         bt == BoolTest::ne, "canonical test is expected");
+#endif
+
+  Node* init_n = cl->init_trip();
+  Node* limit_n = cl->limit();
+  if (init_n  != NULL &&  init_n->is_Con() &&
+      limit_n != NULL && limit_n->is_Con()) {
+    // Use longs to avoid integer overflow.
+    int stride_con  = cl->stride_con();
+    long init_con   = cl->init_trip()->get_int();
+    long limit_con  = cl->limit()->get_int();
+    int stride_m    = stride_con - (stride_con > 0 ? 1 : -1);
+    long trip_count = (limit_con - init_con + stride_m)/stride_con;
+    if (trip_count > 0 && (julong)trip_count < (julong)max_juint) {
+      // Set exact trip count.
+      cl->set_exact_trip_count((uint)trip_count);
+    }
+  }
+}
+
 //------------------------------compute_profile_trip_cnt----------------------------
 // Compute loop trip count from profile data as
 //    (backedge_count + loop_exit_count) / loop_exit_count
@@ -301,6 +341,132 @@
 //         peeled-loop backedge has 2 users.
 // Step 3: Cut the backedge on the clone (so its not a loop) and remove the
 //         extra backedge user.
+//
+//                   orig
+//
+//                  stmt1
+//                    |
+//                    v
+//              loop predicate
+//                    |
+//                    v
+//                   loop<----+
+//                     |      |
+//                   stmt2    |
+//                     |      |
+//                     v      |
+//                    if      ^
+//                   / \      |
+//                  /   \     |
+//                 v     v    |
+//               false true   |
+//               /       \    |
+//              /         ----+
+//             |
+//             v
+//           exit
+//
+//
+//            after clone loop
+//
+//                   stmt1
+//                     |
+//                     v
+//               loop predicate
+//                 /       \
+//        clone   /         \   orig
+//               /           \
+//              /             \
+//             v               v
+//   +---->loop clone          loop<----+
+//   |      |                    |      |
+//   |    stmt2 clone          stmt2    |
+//   |      |                    |      |
+//   |      v                    v      |
+//   ^      if clone            If      ^
+//   |      / \                / \      |
+//   |     /   \              /   \     |
+//   |    v     v            v     v    |
+//   |    true  false      false true   |
+//   |    /         \      /       \    |
+//   +----           \    /         ----+
+//                    \  /
+//                    1v v2
+//                  region
+//                     |
+//                     v
+//                   exit
+//
+//
+//         after peel and predicate move
+//
+//                   stmt1
+//                    /
+//                   /
+//        clone     /            orig
+//                 /
+//                /              +----------+
+//               /               |          |
+//              /          loop predicate   |
+//             /                 |          |
+//            v                  v          |
+//   TOP-->loop clone          loop<----+   |
+//          |                    |      |   |
+//        stmt2 clone          stmt2    |   |
+//          |                    |      |   ^
+//          v                    v      |   |
+//          if clone            If      ^   |
+//          / \                / \      |   |
+//         /   \              /   \     |   |
+//        v     v            v     v    |   |
+//      true   false      false  true   |   |
+//        |         \      /       \    |   |
+//        |          \    /         ----+   ^
+//        |           \  /                  |
+//        |           1v v2                 |
+//        v         region                  |
+//        |            |                    |
+//        |            v                    |
+//        |          exit                   |
+//        |                                 |
+//        +--------------->-----------------+
+//
+//
+//              final graph
+//
+//                  stmt1
+//                    |
+//                    v
+//                  stmt2 clone
+//                    |
+//                    v
+//                   if clone
+//                  / |
+//                 /  |
+//                v   v
+//            false  true
+//             |      |
+//             |      v
+//             | loop predicate
+//             |      |
+//             |      v
+//             |     loop<----+
+//             |      |       |
+//             |    stmt2     |
+//             |      |       |
+//             |      v       |
+//             v      if      ^
+//             |     /  \     |
+//             |    /    \    |
+//             |   v     v    |
+//             | false  true  |
+//             |  |        \  |
+//             v  v         --+
+//            region
+//              |
+//              v
+//             exit
+//
 void PhaseIdealLoop::do_peeling( IdealLoopTree *loop, Node_List &old_new ) {
 
   C->set_major_progress();
@@ -315,9 +481,10 @@
     loop->dump_head();
   }
 #endif
-  Node *h = loop->_head;
-  if (h->is_CountedLoop()) {
-    CountedLoopNode *cl = h->as_CountedLoop();
+  Node* head = loop->_head;
+  bool counted_loop = head->is_CountedLoop();
+  if (counted_loop) {
+    CountedLoopNode *cl = head->as_CountedLoop();
     assert(cl->trip_count() > 0, "peeling a fully unrolled loop");
     cl->set_trip_count(cl->trip_count() - 1);
     if (cl->is_main_loop()) {
@@ -330,11 +497,11 @@
 #endif
     }
   }
+  Node* entry = head->in(LoopNode::EntryControl);
 
   // Step 1: Clone the loop body.  The clone becomes the peeled iteration.
   //         The pre-loop illegally has 2 control users (old & new loops).
-  clone_loop( loop, old_new, dom_depth(loop->_head) );
-
+  clone_loop( loop, old_new, dom_depth(head) );
 
   // Step 2: Make the old-loop fall-in edges point to the peeled iteration.
   //         Do this by making the old-loop fall-in edges act as if they came
@@ -342,12 +509,15 @@
   //         backedges) and then map to the new peeled iteration.  This leaves
   //         the pre-loop with only 1 user (the new peeled iteration), but the
   //         peeled-loop backedge has 2 users.
-  for (DUIterator_Fast jmax, j = loop->_head->fast_outs(jmax); j < jmax; j++) {
-    Node* old = loop->_head->fast_out(j);
-    if( old->in(0) == loop->_head && old->req() == 3 &&
-        (old->is_Loop() || old->is_Phi()) ) {
-      Node *new_exit_value = old_new[old->in(LoopNode::LoopBackControl)->_idx];
-      if( !new_exit_value )     // Backedge value is ALSO loop invariant?
+  Node* new_exit_value = old_new[head->in(LoopNode::LoopBackControl)->_idx];
+  new_exit_value = move_loop_predicates(entry, new_exit_value);
+  _igvn.hash_delete(head);
+  head->set_req(LoopNode::EntryControl, new_exit_value);
+  for (DUIterator_Fast jmax, j = head->fast_outs(jmax); j < jmax; j++) {
+    Node* old = head->fast_out(j);
+    if (old->in(0) == loop->_head && old->req() == 3 && old->is_Phi()) {
+      new_exit_value = old_new[old->in(LoopNode::LoopBackControl)->_idx];
+      if (!new_exit_value )     // Backedge value is ALSO loop invariant?
         // Then loop body backedge value remains the same.
         new_exit_value = old->in(LoopNode::LoopBackControl);
       _igvn.hash_delete(old);
@@ -358,12 +528,12 @@
 
   // Step 3: Cut the backedge on the clone (so its not a loop) and remove the
   //         extra backedge user.
-  Node *nnn = old_new[loop->_head->_idx];
-  _igvn.hash_delete(nnn);
-  nnn->set_req(LoopNode::LoopBackControl, C->top());
-  for (DUIterator_Fast j2max, j2 = nnn->fast_outs(j2max); j2 < j2max; j2++) {
-    Node* use = nnn->fast_out(j2);
-    if( use->in(0) == nnn && use->req() == 3 && use->is_Phi() ) {
+  Node* new_head = old_new[head->_idx];
+  _igvn.hash_delete(new_head);
+  new_head->set_req(LoopNode::LoopBackControl, C->top());
+  for (DUIterator_Fast j2max, j2 = new_head->fast_outs(j2max); j2 < j2max; j2++) {
+    Node* use = new_head->fast_out(j2);
+    if (use->in(0) == new_head && use->req() == 3 && use->is_Phi()) {
       _igvn.hash_delete(use);
       use->set_req(LoopNode::LoopBackControl, C->top());
     }
@@ -371,15 +541,15 @@
 
 
   // Step 4: Correct dom-depth info.  Set to loop-head depth.
-  int dd = dom_depth(loop->_head);
-  set_idom(loop->_head, loop->_head->in(1), dd);
+  int dd = dom_depth(head);
+  set_idom(head, head->in(1), dd);
   for (uint j3 = 0; j3 < loop->_body.size(); j3++) {
     Node *old = loop->_body.at(j3);
     Node *nnn = old_new[old->_idx];
     if (!has_ctrl(nnn))
       set_idom(nnn, idom(nnn), dd-1);
     // While we're at it, remove any SafePoints from the peeled code
-    if( old->Opcode() == Op_SafePoint ) {
+    if (old->Opcode() == Op_SafePoint) {
       Node *nnn = old_new[old->_idx];
       lazy_replace(nnn,nnn->in(TypeFunc::Control));
     }
@@ -392,34 +562,26 @@
   loop->record_for_igvn();
 }
 
+#define EMPTY_LOOP_SIZE 7 // number of nodes in an empty loop
+
 //------------------------------policy_maximally_unroll------------------------
-// Return exact loop trip count, or 0 if not maximally unrolling
+// Calculate exact loop trip count and return true if loop can be maximally
+// unrolled.
 bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const {
   CountedLoopNode *cl = _head->as_CountedLoop();
   assert(cl->is_normal_loop(), "");
-
-  Node *init_n = cl->init_trip();
-  Node *limit_n = cl->limit();
+  if (!cl->is_valid_counted_loop())
+    return false; // Malformed counted loop
 
-  // Non-constant bounds
-  if (init_n   == NULL || !init_n->is_Con()  ||
-      limit_n  == NULL || !limit_n->is_Con() ||
-      // protect against stride not being a constant
-      !cl->stride_is_con()) {
+  if (!cl->has_exact_trip_count()) {
+    // Trip count is not exact.
     return false;
   }
-  int init   = init_n->get_int();
-  int limit  = limit_n->get_int();
-  int span   = limit - init;
-  int stride = cl->stride_con();
 
-  if (init >= limit || stride > span) {
-    // return a false (no maximally unroll) and the regular unroll/peel
-    // route will make a small mess which CCP will fold away.
-    return false;
-  }
-  uint trip_count = span/stride;   // trip_count can be greater than 2 Gig.
-  assert( (int)trip_count*stride == span, "must divide evenly" );
+  uint trip_count = cl->trip_count();
+  // Note, max_juint is used to indicate unknown trip count.
+  assert(trip_count > 1, "one iteration loop should be optimized out already");
+  assert(trip_count < max_juint, "exact trip_count should be less than max_uint.");
 
   // Real policy: if we maximally unroll, does it get too big?
   // Allow the unrolled mess to get larger than standard loop
@@ -427,15 +589,29 @@
   uint body_size    = _body.size();
   uint unroll_limit = (uint)LoopUnrollLimit * 4;
   assert( (intx)unroll_limit == LoopUnrollLimit * 4, "LoopUnrollLimit must fit in 32bits");
-  cl->set_trip_count(trip_count);
   if (trip_count > unroll_limit || body_size > unroll_limit) {
     return false;
   }
 
+  // Take into account that after unroll conjoined heads and tails will fold,
+  // otherwise policy_unroll() may allow more unrolling than max unrolling.
+  uint new_body_size = EMPTY_LOOP_SIZE + (body_size - EMPTY_LOOP_SIZE) * trip_count;
+  uint tst_body_size = (new_body_size - EMPTY_LOOP_SIZE) / trip_count + EMPTY_LOOP_SIZE;
+  if (body_size != tst_body_size) // Check for int overflow
+    return false;
+  if (new_body_size > unroll_limit ||
+      // Unrolling can result in a large amount of node construction
+      new_body_size >= MaxNodeLimit - phase->C->unique()) {
+    return false;
+  }
+
   // Currently we don't have policy to optimize one iteration loops.
   // Maximally unrolling transformation is used for that:
   // it is peeled and the original loop become non reachable (dead).
-  if (trip_count == 1)
+  // Also fully unroll a loop with few iterations regardless next
+  // conditions since following loop optimizations will split
+  // such loop anyway (pre-main-post).
+  if (trip_count <= 3)
     return true;
 
   // Do not unroll a loop with String intrinsics code.
@@ -452,17 +628,7 @@
     } // switch
   }
 
-  if (body_size <= unroll_limit) {
-    uint new_body_size = body_size * trip_count;
-    if (new_body_size <= unroll_limit &&
-        body_size == new_body_size / trip_count &&
-        // Unrolling can result in a large amount of node construction
-        new_body_size < MaxNodeLimit - phase->C->unique()) {
-      return true;    // maximally unroll
-    }
-  }
-
-  return false;               // Do not maximally unroll
+  return true; // Do maximally unroll
 }
 
 
@@ -474,12 +640,15 @@
   CountedLoopNode *cl = _head->as_CountedLoop();
   assert(cl->is_normal_loop() || cl->is_main_loop(), "");
 
-  // protect against stride not being a constant
-  if (!cl->stride_is_con()) return false;
+  if (!cl->is_valid_counted_loop())
+    return false; // Malformed counted loop
 
   // protect against over-unrolling
   if (cl->trip_count() <= 1) return false;
 
+  // Check for stride being a small enough constant
+  if (abs(cl->stride_con()) > (1<<3)) return false;
+
   int future_unroll_ct = cl->unrolled_count() * 2;
 
   // Don't unroll if the next round of unrolling would push us
@@ -560,9 +729,6 @@
     return false;
   }
 
-  // Check for stride being a small enough constant
-  if (abs(cl->stride_con()) > (1<<3)) return false;
-
   // Unroll once!  (Each trip will soon do double iterations)
   return true;
 }
@@ -956,7 +1122,11 @@
     tty->print("Unrolling ");
     loop->dump_head();
   } else if (TraceLoopOpts) {
-    tty->print("Unroll     %d ", loop_head->unrolled_count()*2);
+    if (loop_head->trip_count() < (uint)LoopUnrollLimit) {
+      tty->print("Unroll  %d(%2d) ", loop_head->unrolled_count()*2, loop_head->trip_count());
+    } else {
+      tty->print("Unroll  %d     ", loop_head->unrolled_count()*2);
+    }
     loop->dump_head();
   }
 #endif
@@ -1631,7 +1801,7 @@
 // have on the last iteration.  This will break the loop.
 bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
   // Minimum size must be empty loop
-  if (_body.size() > 7/*number of nodes in an empty loop*/)
+  if (_body.size() > EMPTY_LOOP_SIZE)
     return false;
 
   if (!_head->is_CountedLoop())
@@ -1658,8 +1828,19 @@
   // main and post loops have explicitly created zero trip guard
   bool needs_guard = !cl->is_main_loop() && !cl->is_post_loop();
   if (needs_guard) {
+    // Skip guard if values not overlap.
+    const TypeInt* init_t = phase->_igvn.type(cl->init_trip())->is_int();
+    const TypeInt* limit_t = phase->_igvn.type(cl->limit())->is_int();
+    int  stride_con = cl->stride_con();
+    if (stride_con > 0) {
+      needs_guard = (init_t->_hi >= limit_t->_lo);
+    } else {
+      needs_guard = (init_t->_lo <= limit_t->_hi);
+    }
+  }
+  if (needs_guard) {
     // Check for an obvious zero trip guard.
-    Node* inctrl = cl->in(LoopNode::EntryControl);
+    Node* inctrl = PhaseIdealLoop::skip_loop_predicates(cl->in(LoopNode::EntryControl));
     if (inctrl->Opcode() == Op_IfTrue) {
       // The test should look like just the backedge of a CountedLoop
       Node* iff = inctrl->in(0);
@@ -1702,12 +1883,49 @@
   return true;
 }
 
+//------------------------------policy_do_one_iteration_loop-------------------
+// Convert one iteration loop into normal code.
+bool IdealLoopTree::policy_do_one_iteration_loop( PhaseIdealLoop *phase ) {
+  if (!_head->as_Loop()->is_valid_counted_loop())
+    return false; // Only for counted loop
+
+  CountedLoopNode *cl = _head->as_CountedLoop();
+  if (!cl->has_exact_trip_count() || cl->trip_count() != 1) {
+    return false;
+  }
+
+#ifndef PRODUCT
+  if(TraceLoopOpts) {
+    tty->print("OneIteration ");
+    this->dump_head();
+  }
+#endif
+
+  Node *init_n = cl->init_trip();
+#ifdef ASSERT
+  // Loop boundaries should be constant since trip count is exact.
+  assert(init_n->get_int() + cl->stride_con() >= cl->limit()->get_int(), "should be one iteration");
+#endif
+  // Replace the phi at loop head with the value of the init_trip.
+  // Then the CountedLoopEnd will collapse (backedge will not be taken)
+  // and all loop-invariant uses of the exit values will be correct.
+  phase->_igvn.replace_node(cl->phi(), cl->init_trip());
+  phase->C->set_major_progress();
+  return true;
+}
 
 //=============================================================================
 //------------------------------iteration_split_impl---------------------------
 bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ) {
+  // Compute exact loop trip count if possible.
+  compute_exact_trip_count(phase);
+
+  // Convert one iteration loop into normal code.
+  if (policy_do_one_iteration_loop(phase))
+    return true;
+
   // Check and remove empty loops (spam micro-benchmarks)
-  if( policy_do_remove_empty_loop(phase) )
+  if (policy_do_remove_empty_loop(phase))
     return true;  // Here we removed an empty loop
 
   bool should_peel = policy_peeling(phase); // Should we peel?
@@ -1716,40 +1934,40 @@
 
   // Non-counted loops may be peeled; exactly 1 iteration is peeled.
   // This removes loop-invariant tests (usually null checks).
-  if( !_head->is_CountedLoop() ) { // Non-counted loop
+  if (!_head->is_CountedLoop()) { // Non-counted loop
     if (PartialPeelLoop && phase->partial_peel(this, old_new)) {
       // Partial peel succeeded so terminate this round of loop opts
       return false;
     }
-    if( should_peel ) {            // Should we peel?
+    if (should_peel) {            // Should we peel?
 #ifndef PRODUCT
       if (PrintOpto) tty->print_cr("should_peel");
 #endif
       phase->do_peeling(this,old_new);
-    } else if( should_unswitch ) {
+    } else if (should_unswitch) {
       phase->do_unswitching(this, old_new);
     }
     return true;
   }
   CountedLoopNode *cl = _head->as_CountedLoop();
 
-  if( !cl->loopexit() ) return true; // Ignore various kinds of broken loops
+  if (!cl->loopexit()) return true; // Ignore various kinds of broken loops
 
   // Do nothing special to pre- and post- loops
-  if( cl->is_pre_loop() || cl->is_post_loop() ) return true;
+  if (cl->is_pre_loop() || cl->is_post_loop()) return true;
 
   // Compute loop trip count from profile data
   compute_profile_trip_cnt(phase);
 
   // Before attempting fancy unrolling, RCE or alignment, see if we want
   // to completely unroll this loop or do loop unswitching.
-  if( cl->is_normal_loop() ) {
+  if (cl->is_normal_loop()) {
     if (should_unswitch) {
       phase->do_unswitching(this, old_new);
       return true;
     }
     bool should_maximally_unroll =  policy_maximally_unroll(phase);
-    if( should_maximally_unroll ) {
+    if (should_maximally_unroll) {
       // Here we did some unrolling and peeling.  Eventually we will
       // completely unroll this loop and it will no longer be a loop.
       phase->do_maximally_unroll(this,old_new);
@@ -1757,6 +1975,12 @@
     }
   }
 
+  // Skip next optimizations if running low on nodes. Note that
+  // policy_unswitching and policy_maximally_unroll have this check.
+  uint nodes_left = MaxNodeLimit - phase->C->unique();
+  if ((2 * _body.size()) > nodes_left) {
+    return true;
+  }
 
   // Counted loops may be peeled, may need some iterations run up
   // front for RCE, and may want to align loop refs to a cache
@@ -1787,14 +2011,14 @@
   // If we have any of these conditions (RCE, alignment, unrolling) met, then
   // we switch to the pre-/main-/post-loop model.  This model also covers
   // peeling.
-  if( should_rce || should_align || should_unroll ) {
-    if( cl->is_normal_loop() )  // Convert to 'pre/main/post' loops
+  if (should_rce || should_align || should_unroll) {
+    if (cl->is_normal_loop())  // Convert to 'pre/main/post' loops
       phase->insert_pre_post_loops(this,old_new, !may_rce_align);
 
     // Adjust the pre- and main-loop limits to let the pre and post loops run
     // with full checks, but the main-loop with no checks.  Remove said
     // checks from the main body.
-    if( should_rce )
+    if (should_rce)
       phase->do_range_check(this,old_new);
 
     // Double loop body for unrolling.  Adjust the minimum-trip test (will do
@@ -1802,16 +2026,16 @@
     // an even number of trips).  If we are peeling, we might enable some RCE
     // and we'd rather unroll the post-RCE'd loop SO... do not unroll if
     // peeling.
-      if( should_unroll && !should_peel )
-        phase->do_unroll(this,old_new, true);
+    if (should_unroll && !should_peel)
+      phase->do_unroll(this,old_new, true);
 
     // Adjust the pre-loop limits to align the main body
     // iterations.
-    if( should_align )
+    if (should_align)
       Unimplemented();
 
   } else {                      // Else we have an unchanged counted loop
-    if( should_peel )           // Might want to peel but do nothing else
+    if (should_peel)           // Might want to peel but do nothing else
       phase->do_peeling(this,old_new);
   }
   return true;
@@ -1861,651 +2085,8 @@
   return true;
 }
 
-//-------------------------------is_uncommon_trap_proj----------------------------
-// Return true if proj is the form of "proj->[region->..]call_uct"
-bool PhaseIdealLoop::is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason) {
-  int path_limit = 10;
-  assert(proj, "invalid argument");
-  Node* out = proj;
-  for (int ct = 0; ct < path_limit; ct++) {
-    out = out->unique_ctrl_out();
-    if (out == NULL || out->is_Root() || out->is_Start())
-      return false;
-    if (out->is_CallStaticJava()) {
-      int req = out->as_CallStaticJava()->uncommon_trap_request();
-      if (req != 0) {
-        Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
-        if (trap_reason == reason || reason == Deoptimization::Reason_none) {
-           return true;
-        }
-      }
-      return false; // don't do further after call
-    }
-  }
-  return false;
-}
 
-//-------------------------------is_uncommon_trap_if_pattern-------------------------
-// Return true  for "if(test)-> proj -> ...
-//                          |
-//                          V
-//                      other_proj->[region->..]call_uct"
-//
-// "must_reason_predicate" means the uct reason must be Reason_predicate
-bool PhaseIdealLoop::is_uncommon_trap_if_pattern(ProjNode *proj, Deoptimization::DeoptReason reason) {
-  Node *in0 = proj->in(0);
-  if (!in0->is_If()) return false;
-  // Variation of a dead If node.
-  if (in0->outcnt() < 2)  return false;
-  IfNode* iff = in0->as_If();
-
-  // we need "If(Conv2B(Opaque1(...)))" pattern for reason_predicate
-  if (reason != Deoptimization::Reason_none) {
-    if (iff->in(1)->Opcode() != Op_Conv2B ||
-       iff->in(1)->in(1)->Opcode() != Op_Opaque1) {
-      return false;
-    }
-  }
-
-  ProjNode* other_proj = iff->proj_out(1-proj->_con)->as_Proj();
-  return is_uncommon_trap_proj(other_proj, reason);
-}
-
-//-------------------------------register_control-------------------------
-void PhaseIdealLoop::register_control(Node* n, IdealLoopTree *loop, Node* pred) {
-  assert(n->is_CFG(), "must be control node");
-  _igvn.register_new_node_with_optimizer(n);
-  loop->_body.push(n);
-  set_loop(n, loop);
-  // When called from beautify_loops() idom is not constructed yet.
-  if (_idom != NULL) {
-    set_idom(n, pred, dom_depth(pred));
-  }
-}
-
-//------------------------------create_new_if_for_predicate------------------------
-// create a new if above the uct_if_pattern for the predicate to be promoted.
-//
-//          before                                after
-//        ----------                           ----------
-//           ctrl                                 ctrl
-//            |                                     |
-//            |                                     |
-//            v                                     v
-//           iff                                 new_iff
-//          /    \                                /      \
-//         /      \                              /        \
-//        v        v                            v          v
-//  uncommon_proj cont_proj                   if_uct     if_cont
-// \      |        |                           |          |
-//  \     |        |                           |          |
-//   v    v        v                           |          v
-//     rgn       loop                          |         iff
-//      |                                      |        /     \
-//      |                                      |       /       \
-//      v                                      |      v         v
-// uncommon_trap                               | uncommon_proj cont_proj
-//                                           \  \    |           |
-//                                            \  \   |           |
-//                                             v  v  v           v
-//                                               rgn           loop
-//                                                |
-//                                                |
-//                                                v
-//                                           uncommon_trap
-//
-//
-// We will create a region to guard the uct call if there is no one there.
-// The true projecttion (if_cont) of the new_iff is returned.
-// This code is also used to clone predicates to clonned loops.
-ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
-                                                      Deoptimization::DeoptReason reason) {
-  assert(is_uncommon_trap_if_pattern(cont_proj, reason), "must be a uct if pattern!");
-  IfNode* iff = cont_proj->in(0)->as_If();
-
-  ProjNode *uncommon_proj = iff->proj_out(1 - cont_proj->_con);
-  Node     *rgn   = uncommon_proj->unique_ctrl_out();
-  assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct");
-
-  if (!rgn->is_Region()) { // create a region to guard the call
-    assert(rgn->is_Call(), "must be call uct");
-    CallNode* call = rgn->as_Call();
-    IdealLoopTree* loop = get_loop(call);
-    rgn = new (C, 1) RegionNode(1);
-    rgn->add_req(uncommon_proj);
-    register_control(rgn, loop, uncommon_proj);
-    _igvn.hash_delete(call);
-    call->set_req(0, rgn);
-    // When called from beautify_loops() idom is not constructed yet.
-    if (_idom != NULL) {
-      set_idom(call, rgn, dom_depth(rgn));
-    }
-  }
-
-  Node* entry = iff->in(0);
-  if (new_entry != NULL) {
-    // Clonning the predicate to new location.
-    entry = new_entry;
-  }
-  // Create new_iff
-  IdealLoopTree* lp = get_loop(entry);
-  IfNode *new_iff = new (C, 2) IfNode(entry, NULL, iff->_prob, iff->_fcnt);
-  register_control(new_iff, lp, entry);
-  Node *if_cont = new (C, 1) IfTrueNode(new_iff);
-  Node *if_uct  = new (C, 1) IfFalseNode(new_iff);
-  if (cont_proj->is_IfFalse()) {
-    // Swap
-    Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp;
-  }
-  register_control(if_cont, lp, new_iff);
-  register_control(if_uct, get_loop(rgn), new_iff);
-
-  // if_uct to rgn
-  _igvn.hash_delete(rgn);
-  rgn->add_req(if_uct);
-  // When called from beautify_loops() idom is not constructed yet.
-  if (_idom != NULL) {
-    Node* ridom = idom(rgn);
-    Node* nrdom = dom_lca(ridom, new_iff);
-    set_idom(rgn, nrdom, dom_depth(rgn));
-  }
-  // rgn must have no phis
-  assert(!rgn->as_Region()->has_phi(), "region must have no phis");
-
-  if (new_entry == NULL) {
-    // Attach if_cont to iff
-    _igvn.hash_delete(iff);
-    iff->set_req(0, if_cont);
-    if (_idom != NULL) {
-      set_idom(iff, if_cont, dom_depth(iff));
-    }
-  }
-  return if_cont->as_Proj();
-}
-
-//--------------------------find_predicate_insertion_point-------------------
-// Find a good location to insert a predicate
-ProjNode* PhaseIdealLoop::find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason) {
-  if (start_c == NULL || !start_c->is_Proj())
-    return NULL;
-  if (is_uncommon_trap_if_pattern(start_c->as_Proj(), reason)) {
-    return start_c->as_Proj();
-  }
-  return NULL;
-}
-
-//--------------------------find_predicate------------------------------------
-// Find a predicate
-Node* PhaseIdealLoop::find_predicate(Node* entry) {
-  Node* predicate = NULL;
-  if (UseLoopPredicate) {
-    predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
-    if (predicate != NULL) { // right pattern that can be used by loop predication
-      assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
-      return entry;
-    }
-  }
-  return NULL;
-}
-
-//------------------------------Invariance-----------------------------------
-// Helper class for loop_predication_impl to compute invariance on the fly and
-// clone invariants.
-class Invariance : public StackObj {
-  VectorSet _visited, _invariant;
-  Node_Stack _stack;
-  VectorSet _clone_visited;
-  Node_List _old_new; // map of old to new (clone)
-  IdealLoopTree* _lpt;
-  PhaseIdealLoop* _phase;
-
-  // Helper function to set up the invariance for invariance computation
-  // If n is a known invariant, set up directly. Otherwise, look up the
-  // the possibility to push n onto the stack for further processing.
-  void visit(Node* use, Node* n) {
-    if (_lpt->is_invariant(n)) { // known invariant
-      _invariant.set(n->_idx);
-    } else if (!n->is_CFG()) {
-      Node *n_ctrl = _phase->ctrl_or_self(n);
-      Node *u_ctrl = _phase->ctrl_or_self(use); // self if use is a CFG
-      if (_phase->is_dominator(n_ctrl, u_ctrl)) {
-        _stack.push(n, n->in(0) == NULL ? 1 : 0);
-      }
-    }
-  }
-
-  // Compute invariance for "the_node" and (possibly) all its inputs recursively
-  // on the fly
-  void compute_invariance(Node* n) {
-    assert(_visited.test(n->_idx), "must be");
-    visit(n, n);
-    while (_stack.is_nonempty()) {
-      Node*  n = _stack.node();
-      uint idx = _stack.index();
-      if (idx == n->req()) { // all inputs are processed
-        _stack.pop();
-        // n is invariant if it's inputs are all invariant
-        bool all_inputs_invariant = true;
-        for (uint i = 0; i < n->req(); i++) {
-          Node* in = n->in(i);
-          if (in == NULL) continue;
-          assert(_visited.test(in->_idx), "must have visited input");
-          if (!_invariant.test(in->_idx)) { // bad guy
-            all_inputs_invariant = false;
-            break;
-          }
-        }
-        if (all_inputs_invariant) {
-          _invariant.set(n->_idx); // I am a invariant too
-        }
-      } else { // process next input
-        _stack.set_index(idx + 1);
-        Node* m = n->in(idx);
-        if (m != NULL && !_visited.test_set(m->_idx)) {
-          visit(n, m);
-        }
-      }
-    }
-  }
-
-  // Helper function to set up _old_new map for clone_nodes.
-  // If n is a known invariant, set up directly ("clone" of n == n).
-  // Otherwise, push n onto the stack for real cloning.
-  void clone_visit(Node* n) {
-    assert(_invariant.test(n->_idx), "must be invariant");
-    if (_lpt->is_invariant(n)) { // known invariant
-      _old_new.map(n->_idx, n);
-    } else{ // to be cloned
-      assert (!n->is_CFG(), "should not see CFG here");
-      _stack.push(n, n->in(0) == NULL ? 1 : 0);
-    }
-  }
-
-  // Clone "n" and (possibly) all its inputs recursively
-  void clone_nodes(Node* n, Node* ctrl) {
-    clone_visit(n);
-    while (_stack.is_nonempty()) {
-      Node*  n = _stack.node();
-      uint idx = _stack.index();
-      if (idx == n->req()) { // all inputs processed, clone n!
-        _stack.pop();
-        // clone invariant node
-        Node* n_cl = n->clone();
-        _old_new.map(n->_idx, n_cl);
-        _phase->register_new_node(n_cl, ctrl);
-        for (uint i = 0; i < n->req(); i++) {
-          Node* in = n_cl->in(i);
-          if (in == NULL) continue;
-          n_cl->set_req(i, _old_new[in->_idx]);
-        }
-      } else { // process next input
-        _stack.set_index(idx + 1);
-        Node* m = n->in(idx);
-        if (m != NULL && !_clone_visited.test_set(m->_idx)) {
-          clone_visit(m); // visit the input
-        }
-      }
-    }
-  }
-
- public:
-  Invariance(Arena* area, IdealLoopTree* lpt) :
-    _lpt(lpt), _phase(lpt->_phase),
-    _visited(area), _invariant(area), _stack(area, 10 /* guess */),
-    _clone_visited(area), _old_new(area)
-  {}
-
-  // Map old to n for invariance computation and clone
-  void map_ctrl(Node* old, Node* n) {
-    assert(old->is_CFG() && n->is_CFG(), "must be");
-    _old_new.map(old->_idx, n); // "clone" of old is n
-    _invariant.set(old->_idx);  // old is invariant
-    _clone_visited.set(old->_idx);
-  }
-
-  // Driver function to compute invariance
-  bool is_invariant(Node* n) {
-    if (!_visited.test_set(n->_idx))
-      compute_invariance(n);
-    return (_invariant.test(n->_idx) != 0);
-  }
-
-  // Driver function to clone invariant
-  Node* clone(Node* n, Node* ctrl) {
-    assert(ctrl->is_CFG(), "must be");
-    assert(_invariant.test(n->_idx), "must be an invariant");
-    if (!_clone_visited.test(n->_idx))
-      clone_nodes(n, ctrl);
-    return _old_new[n->_idx];
-  }
-};
-
-//------------------------------is_range_check_if -----------------------------------
-// Returns true if the predicate of iff is in "scale*iv + offset u< load_range(ptr)" format
-// Note: this function is particularly designed for loop predication. We require load_range
-//       and offset to be loop invariant computed on the fly by "invar"
-bool IdealLoopTree::is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const {
-  if (!is_loop_exit(iff)) {
-    return false;
-  }
-  if (!iff->in(1)->is_Bool()) {
-    return false;
-  }
-  const BoolNode *bol = iff->in(1)->as_Bool();
-  if (bol->_test._test != BoolTest::lt) {
-    return false;
-  }
-  if (!bol->in(1)->is_Cmp()) {
-    return false;
-  }
-  const CmpNode *cmp = bol->in(1)->as_Cmp();
-  if (cmp->Opcode() != Op_CmpU ) {
-    return false;
-  }
-  Node* range = cmp->in(2);
-  if (range->Opcode() != Op_LoadRange) {
-    const TypeInt* tint = phase->_igvn.type(range)->isa_int();
-    if (!OptimizeFill || tint == NULL || tint->empty() || tint->_lo < 0) {
-      // Allow predication on positive values that aren't LoadRanges.
-      // This allows optimization of loops where the length of the
-      // array is a known value and doesn't need to be loaded back
-      // from the array.
-      return false;
-    }
-  }
-  if (!invar.is_invariant(range)) {
-    return false;
-  }
-  Node *iv     = _head->as_CountedLoop()->phi();
-  int   scale  = 0;
-  Node *offset = NULL;
-  if (!phase->is_scaled_iv_plus_offset(cmp->in(1), iv, &scale, &offset)) {
-    return false;
-  }
-  if(offset && !invar.is_invariant(offset)) { // offset must be invariant
-    return false;
-  }
-  return true;
-}
-
-//------------------------------rc_predicate-----------------------------------
-// Create a range check predicate
-//
-// for (i = init; i < limit; i += stride) {
-//    a[scale*i+offset]
-// }
-//
-// Compute max(scale*i + offset) for init <= i < limit and build the predicate
-// as "max(scale*i + offset) u< a.length".
-//
-// There are two cases for max(scale*i + offset):
-// (1) stride*scale > 0
-//   max(scale*i + offset) = scale*(limit-stride) + offset
-// (2) stride*scale < 0
-//   max(scale*i + offset) = scale*init + offset
-BoolNode* PhaseIdealLoop::rc_predicate(Node* ctrl,
-                                       int scale, Node* offset,
-                                       Node* init, Node* limit, Node* stride,
-                                       Node* range, bool upper) {
-  DEBUG_ONLY(ttyLocker ttyl);
-  if (TraceLoopPredicate) tty->print("rc_predicate ");
-
-  Node* max_idx_expr  = init;
-  int stride_con = stride->get_int();
-  if ((stride_con > 0) == (scale > 0) == upper) {
-    max_idx_expr = new (C, 3) SubINode(limit, stride);
-    register_new_node(max_idx_expr, ctrl);
-    if (TraceLoopPredicate) tty->print("(limit - stride) ");
-  } else {
-    if (TraceLoopPredicate) tty->print("init ");
-  }
-
-  if (scale != 1) {
-    ConNode* con_scale = _igvn.intcon(scale);
-    max_idx_expr = new (C, 3) MulINode(max_idx_expr, con_scale);
-    register_new_node(max_idx_expr, ctrl);
-    if (TraceLoopPredicate) tty->print("* %d ", scale);
-  }
-
-  if (offset && (!offset->is_Con() || offset->get_int() != 0)){
-    max_idx_expr = new (C, 3) AddINode(max_idx_expr, offset);
-    register_new_node(max_idx_expr, ctrl);
-    if (TraceLoopPredicate)
-      if (offset->is_Con()) tty->print("+ %d ", offset->get_int());
-      else tty->print("+ offset ");
-  }
-
-  CmpUNode* cmp = new (C, 3) CmpUNode(max_idx_expr, range);
-  register_new_node(cmp, ctrl);
-  BoolNode* bol = new (C, 2) BoolNode(cmp, BoolTest::lt);
-  register_new_node(bol, ctrl);
-
-  if (TraceLoopPredicate) tty->print_cr("<u range");
-  return bol;
-}
-
-//------------------------------ loop_predication_impl--------------------------
-// Insert loop predicates for null checks and range checks
-bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) {
-  if (!UseLoopPredicate) return false;
-
-  if (!loop->_head->is_Loop()) {
-    // Could be a simple region when irreducible loops are present.
-    return false;
-  }
-
-  if (loop->_head->unique_ctrl_out()->Opcode() == Op_NeverBranch) {
-    // do nothing for infinite loops
-    return false;
-  }
-
-  CountedLoopNode *cl = NULL;
-  if (loop->_head->is_CountedLoop()) {
-    cl = loop->_head->as_CountedLoop();
-    // do nothing for iteration-splitted loops
-    if (!cl->is_normal_loop()) return false;
-  }
-
-  LoopNode *lpn  = loop->_head->as_Loop();
-  Node* entry = lpn->in(LoopNode::EntryControl);
-
-  ProjNode *predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
-  if (!predicate_proj) {
-#ifndef PRODUCT
-    if (TraceLoopPredicate) {
-      tty->print("missing predicate:");
-      loop->dump_head();
-      lpn->dump(1);
-    }
-#endif
-    return false;
-  }
-  ConNode* zero = _igvn.intcon(0);
-  set_ctrl(zero, C->root());
-
-  ResourceArea *area = Thread::current()->resource_area();
-  Invariance invar(area, loop);
-
-  // Create list of if-projs such that a newer proj dominates all older
-  // projs in the list, and they all dominate loop->tail()
-  Node_List if_proj_list(area);
-  LoopNode *head  = loop->_head->as_Loop();
-  Node *current_proj = loop->tail(); //start from tail
-  while ( current_proj != head ) {
-    if (loop == get_loop(current_proj) && // still in the loop ?
-        current_proj->is_Proj()        && // is a projection  ?
-        current_proj->in(0)->Opcode() == Op_If) { // is a if projection ?
-      if_proj_list.push(current_proj);
-    }
-    current_proj = idom(current_proj);
-  }
-
-  bool hoisted = false; // true if at least one proj is promoted
-  while (if_proj_list.size() > 0) {
-    // Following are changed to nonnull when a predicate can be hoisted
-    ProjNode* new_predicate_proj = NULL;
-
-    ProjNode* proj = if_proj_list.pop()->as_Proj();
-    IfNode*   iff  = proj->in(0)->as_If();
-
-    if (!is_uncommon_trap_if_pattern(proj, Deoptimization::Reason_none)) {
-      if (loop->is_loop_exit(iff)) {
-        // stop processing the remaining projs in the list because the execution of them
-        // depends on the condition of "iff" (iff->in(1)).
-        break;
-      } else {
-        // Both arms are inside the loop. There are two cases:
-        // (1) there is one backward branch. In this case, any remaining proj
-        //     in the if_proj list post-dominates "iff". So, the condition of "iff"
-        //     does not determine the execution the remining projs directly, and we
-        //     can safely continue.
-        // (2) both arms are forwarded, i.e. a diamond shape. In this case, "proj"
-        //     does not dominate loop->tail(), so it can not be in the if_proj list.
-        continue;
-      }
-    }
-
-    Node*     test = iff->in(1);
-    if (!test->is_Bool()){ //Conv2B, ...
-      continue;
-    }
-    BoolNode* bol = test->as_Bool();
-    if (invar.is_invariant(bol)) {
-      // Invariant test
-      new_predicate_proj = create_new_if_for_predicate(predicate_proj, NULL,
-                                                       Deoptimization::Reason_predicate);
-      Node* ctrl = new_predicate_proj->in(0)->as_If()->in(0);
-      BoolNode* new_predicate_bol = invar.clone(bol, ctrl)->as_Bool();
-
-      // Negate test if necessary
-      bool negated = false;
-      if (proj->_con != predicate_proj->_con) {
-        new_predicate_bol = new (C, 2) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate());
-        register_new_node(new_predicate_bol, ctrl);
-        negated = true;
-      }
-      IfNode* new_predicate_iff = new_predicate_proj->in(0)->as_If();
-      _igvn.hash_delete(new_predicate_iff);
-      new_predicate_iff->set_req(1, new_predicate_bol);
-#ifndef PRODUCT
-      if (TraceLoopPredicate) {
-        tty->print("Predicate invariant if%s: %d ", negated ? " negated" : "", new_predicate_iff->_idx);
-        loop->dump_head();
-      } else if (TraceLoopOpts) {
-        tty->print("Predicate IC ");
-        loop->dump_head();
-      }
-#endif
-    } else if (cl != NULL && loop->is_range_check_if(iff, this, invar)) {
-      assert(proj->_con == predicate_proj->_con, "must match");
-
-      // Range check for counted loops
-      const Node*    cmp    = bol->in(1)->as_Cmp();
-      Node*          idx    = cmp->in(1);
-      assert(!invar.is_invariant(idx), "index is variant");
-      assert(cmp->in(2)->Opcode() == Op_LoadRange || OptimizeFill, "must be");
-      Node* rng = cmp->in(2);
-      assert(invar.is_invariant(rng), "range must be invariant");
-      int scale    = 1;
-      Node* offset = zero;
-      bool ok = is_scaled_iv_plus_offset(idx, cl->phi(), &scale, &offset);
-      assert(ok, "must be index expression");
-
-      Node* init    = cl->init_trip();
-      Node* limit   = cl->limit();
-      Node* stride  = cl->stride();
-
-      // Build if's for the upper and lower bound tests.  The
-      // lower_bound test will dominate the upper bound test and all
-      // cloned or created nodes will use the lower bound test as
-      // their declared control.
-      ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
-      ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate);
-      assert(upper_bound_proj->in(0)->as_If()->in(0) == lower_bound_proj, "should dominate");
-      Node *ctrl = lower_bound_proj->in(0)->as_If()->in(0);
-
-      // Perform cloning to keep Invariance state correct since the
-      // late schedule will place invariant things in the loop.
-      rng = invar.clone(rng, ctrl);
-      if (offset && offset != zero) {
-        assert(invar.is_invariant(offset), "offset must be loop invariant");
-        offset = invar.clone(offset, ctrl);
-      }
-
-      // Test the lower bound
-      Node*  lower_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, false);
-      IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If();
-      _igvn.hash_delete(lower_bound_iff);
-      lower_bound_iff->set_req(1, lower_bound_bol);
-      if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx);
-
-      // Test the upper bound
-      Node* upper_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, true);
-      IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If();
-      _igvn.hash_delete(upper_bound_iff);
-      upper_bound_iff->set_req(1, upper_bound_bol);
-      if (TraceLoopPredicate) tty->print_cr("upper bound check if: %d", lower_bound_iff->_idx);
-
-      // Fall through into rest of the clean up code which will move
-      // any dependent nodes onto the upper bound test.
-      new_predicate_proj = upper_bound_proj;
-
-#ifndef PRODUCT
-      if (TraceLoopOpts && !TraceLoopPredicate) {
-        tty->print("Predicate RC ");
-        loop->dump_head();
-      }
-#endif
-    } else {
-      // Loop variant check (for example, range check in non-counted loop)
-      // with uncommon trap.
-      continue;
-    }
-    assert(new_predicate_proj != NULL, "sanity");
-    // Success - attach condition (new_predicate_bol) to predicate if
-    invar.map_ctrl(proj, new_predicate_proj); // so that invariance test can be appropriate
-
-    // Eliminate the old If in the loop body
-    dominated_by( new_predicate_proj, iff, proj->_con != new_predicate_proj->_con );
-
-    hoisted = true;
-    C->set_major_progress();
-  } // end while
-
-#ifndef PRODUCT
-  // report that the loop predication has been actually performed
-  // for this loop
-  if (TraceLoopPredicate && hoisted) {
-    tty->print("Loop Predication Performed:");
-    loop->dump_head();
-  }
-#endif
-
-  return hoisted;
-}
-
-//------------------------------loop_predication--------------------------------
-// driver routine for loop predication optimization
-bool IdealLoopTree::loop_predication( PhaseIdealLoop *phase) {
-  bool hoisted = false;
-  // Recursively promote predicates
-  if ( _child ) {
-    hoisted = _child->loop_predication( phase);
-  }
-
-  // self
-  if (!_irreducible && !tail()->is_top()) {
-    hoisted |= phase->loop_predication_impl(this);
-  }
-
-  if ( _next ) { //sibling
-    hoisted |= _next->loop_predication( phase);
-  }
-
-  return hoisted;
-}
-
-
+//=============================================================================
 // Process all the loops in the loop tree and replace any fill
 // patterns with an intrisc version.
 bool PhaseIdealLoop::do_intrinsify_fill() {
@@ -2625,9 +2206,12 @@
       if (value != head->phi()) {
         msg = "unhandled shift in address";
       } else {
-        found_index = true;
-        shift = n;
-        assert(type2aelembytes(store->as_Mem()->memory_type(), true) == 1 << shift->in(2)->get_int(), "scale should match");
+        if (type2aelembytes(store->as_Mem()->memory_type(), true) != (1 << n->in(2)->get_int())) {
+          msg = "scale doesn't match";
+        } else {
+          found_index = true;
+          shift = n;
+        }
       }
     } else if (n->Opcode() == Op_ConvI2L && conv == NULL) {
       if (n->in(1) == head->phi()) {
@@ -2762,6 +2346,13 @@
     return false;
   }
 
+#ifndef PRODUCT
+  if (TraceLoopOpts) {
+    tty->print("ArrayFill    ");
+    lpt->dump_head();
+  }
+#endif
+
   // Now replace the whole loop body by a call to a fill routine that
   // covers the same region as the loop.
   Node* base = store->in(MemNode::Address)->as_AddP()->in(AddPNode::Base);
--- a/hotspot/src/share/vm/opto/loopUnswitch.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -32,15 +32,17 @@
 //
 // orig:                       transformed:
 //                               if (invariant-test) then
+//  predicate                      predicate
 //  loop                           loop
 //    stmt1                          stmt1
 //    if (invariant-test) then       stmt2
 //      stmt2                        stmt4
 //    else                         endloop
 //      stmt3                    else
-//    endif                        loop [clone]
-//    stmt4                          stmt1 [clone]
-//  endloop                          stmt3
+//    endif                        predicate [clone]
+//    stmt4                        loop [clone]
+//  endloop                          stmt1 [clone]
+//                                   stmt3
 //                                   stmt4 [clone]
 //                                 endloop
 //                               endif
@@ -124,8 +126,15 @@
 
   ProjNode* proj_true = create_slow_version_of_loop(loop, old_new);
 
-  assert(proj_true->is_IfTrue() && proj_true->unique_ctrl_out() == head, "by construction");
-
+#ifdef ASSERT
+  Node* uniqc = proj_true->unique_ctrl_out();
+  Node* entry = head->in(LoopNode::EntryControl);
+  Node* predicate = find_predicate(entry);
+  if (predicate != NULL) predicate = predicate->in(0);
+  assert(proj_true->is_IfTrue() &&
+         (predicate == NULL && uniqc == head ||
+          predicate != NULL && uniqc == predicate), "by construction");
+#endif
   // Increment unswitch count
   LoopNode* head_clone = old_new[head->_idx]->as_Loop();
   int nct = head->unswitch_count() + 1;
@@ -227,21 +236,24 @@
   register_node(ifslow, outer_loop, iff, dom_depth(iff));
 
   // Clone the loop body.  The clone becomes the fast loop.  The
-  // original pre-header will (illegally) have 2 control users (old & new loops).
+  // original pre-header will (illegally) have 3 control users
+  // (old & new loops & new if).
   clone_loop(loop, old_new, dom_depth(head), iff);
   assert(old_new[head->_idx]->is_Loop(), "" );
 
   // Fast (true) control
+  Node* iffast_pred = clone_loop_predicates(entry, iffast);
   _igvn.hash_delete(head);
-  head->set_req(LoopNode::EntryControl, iffast);
-  set_idom(head, iffast, dom_depth(head));
+  head->set_req(LoopNode::EntryControl, iffast_pred);
+  set_idom(head, iffast_pred, dom_depth(head));
   _igvn._worklist.push(head);
 
   // Slow (false) control
+  Node* ifslow_pred = move_loop_predicates(entry, ifslow);
   LoopNode* slow_head = old_new[head->_idx]->as_Loop();
   _igvn.hash_delete(slow_head);
-  slow_head->set_req(LoopNode::EntryControl, ifslow);
-  set_idom(slow_head, ifslow, dom_depth(slow_head));
+  slow_head->set_req(LoopNode::EntryControl, ifslow_pred);
+  set_idom(slow_head, ifslow_pred, dom_depth(slow_head));
   _igvn._worklist.push(slow_head);
 
   recompute_dom_depth();
--- a/hotspot/src/share/vm/opto/loopnode.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -341,7 +341,12 @@
   //
   assert(x->Opcode() == Op_Loop, "regular loops only");
   C->print_method("Before CountedLoop", 3);
-
+#ifndef PRODUCT
+  if (TraceLoopOpts) {
+    tty->print("Counted      ");
+    loop->dump_head();
+  }
+#endif
   // If compare points to incr, we are ok.  Otherwise the compare
   // can directly point to the phi; in this case adjust the compare so that
   // it points to the incr by adjusting the limit.
@@ -864,8 +869,10 @@
   Node *outer = new (phase->C, 3) LoopNode( ctl, _head->in(outer_idx) );
   outer = igvn.register_new_node_with_optimizer(outer, _head);
   phase->set_created_loop_node();
+
+  Node* pred = phase->clone_loop_predicates(ctl, outer);
   // Outermost loop falls into '_head' loop
-  _head->set_req(LoopNode::EntryControl, outer);
+  _head->set_req(LoopNode::EntryControl, pred);
   _head->del_req(outer_idx);
   // Split all the Phis up between '_head' loop and 'outer' loop.
   for (DUIterator_Fast jmax, j = _head->fast_outs(jmax); j < jmax; j++) {
@@ -1103,12 +1110,13 @@
   // backedges into a private merge point and use the merge point as
   // the one true backedge.
   if( _head->req() > 3 ) {
-    // Merge the many backedges into a single backedge.
+    // Merge the many backedges into a single backedge but leave
+    // the hottest backedge as separate edge for the following peel.
     merge_many_backedges( phase );
     result = true;
   }
 
-  // If I am a shared header (multiple backedges), peel off myself loop.
+  // If I have one hot backedge, peel off myself loop.
   // I better be the outermost loop.
   if( _head->req() > 3 ) {
     split_outer_loop( phase );
@@ -1433,15 +1441,30 @@
   tty->print("Loop: N%d/N%d ",_head->_idx,_tail->_idx);
   if (_irreducible) tty->print(" IRREDUCIBLE");
   if (UseLoopPredicate) {
-    Node* entry = _head->in(LoopNode::EntryControl);
-    if (entry != NULL && entry->is_Proj() &&
-        PhaseIdealLoop::is_uncommon_trap_if_pattern(entry->as_Proj(), Deoptimization::Reason_predicate)) {
+    Node* entry = PhaseIdealLoop::find_predicate_insertion_point(_head->in(LoopNode::EntryControl),
+                                                                 Deoptimization::Reason_predicate);
+    if (entry != NULL) {
       tty->print(" predicated");
     }
   }
   if (_head->is_CountedLoop()) {
     CountedLoopNode *cl = _head->as_CountedLoop();
     tty->print(" counted");
+
+    Node* init_n = cl->init_trip();
+    if (init_n  != NULL &&  init_n->is_Con())
+      tty->print(" [%d,", cl->init_trip()->get_int());
+    else
+      tty->print(" [int,");
+    Node* limit_n = cl->limit();
+    if (limit_n  != NULL &&  limit_n->is_Con())
+      tty->print("%d),", cl->limit()->get_int());
+    else
+      tty->print("int),");
+    int stride_con  = cl->stride_con();
+    if (stride_con > 0) tty->print("+");
+    tty->print("%d", stride_con);
+
     if (cl->is_pre_loop ()) tty->print(" pre" );
     if (cl->is_main_loop()) tty->print(" main");
     if (cl->is_post_loop()) tty->print(" post");
@@ -1541,7 +1564,7 @@
 //----------------------------build_and_optimize-------------------------------
 // Create a PhaseLoop.  Build the ideal Loop tree.  Map each Ideal Node to
 // its corresponding LoopNode.  If 'optimize' is true, do some loop cleanups.
-void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
+void PhaseIdealLoop::build_and_optimize(bool do_split_ifs) {
   ResourceMark rm;
 
   int old_progress = C->major_progress();
@@ -1573,6 +1596,13 @@
   // Do not need a safepoint at the top level
   _ltree_root->_has_sfpt = 1;
 
+  // Initialize Dominators.
+  // Checked in clone_loop_predicate() during beautify_loops().
+  _idom_size = 0;
+  _idom      = NULL;
+  _dom_depth = NULL;
+  _dom_stk   = NULL;
+
   // Empty pre-order array
   allocate_preorders();
 
@@ -1698,8 +1728,9 @@
     return;
   }
 
-  // some parser-inserted loop predicates could never be used by loop
-  // predication. Eliminate them before loop optimization
+  // Some parser-inserted loop predicates could never be used by loop
+  // predication or they were moved away from loop during some optimizations.
+  // For example, peeling. Eliminate them before next loop optimizations.
   if (UseLoopPredicate) {
     eliminate_useless_predicates();
   }
@@ -1750,7 +1781,7 @@
   }
 
   // Perform loop predication before iteration splitting
-  if (do_loop_pred && C->has_loops() && !C->major_progress()) {
+  if (C->has_loops() && !C->major_progress() && (C->predicate_count() > 0)) {
     _ltree_root->_child->loop_predication(this);
   }
 
@@ -1793,8 +1824,20 @@
     C->set_major_progress();
   }
 
-  // Convert scalar to superword operations
+  // Keep loop predicates and perform optimizations with them
+  // until no more loop optimizations could be done.
+  // After that switch predicates off and do more loop optimizations.
+  if (!C->major_progress() && (C->predicate_count() > 0)) {
+     C->cleanup_loop_predicates(_igvn);
+#ifndef PRODUCT
+     if (TraceLoopOpts) {
+       tty->print_cr("PredicatesOff");
+     }
+#endif
+     C->set_major_progress();
+  }
 
+  // Convert scalar to superword operations at the end of all loop opts.
   if (UseSuperWord && C->has_loops() && !C->major_progress()) {
     // SuperWord transform
     SuperWord sw(this);
--- a/hotspot/src/share/vm/opto/loopnode.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -57,7 +57,12 @@
 protected:
   short _loop_flags;
   // Names for flag bitfields
-  enum { pre_post_main=0, inner_loop=8, partial_peel_loop=16, partial_peel_failed=32  };
+  enum { Normal=0, Pre=1, Main=2, Post=3, PreMainPostFlagsMask=3,
+         MainHasNoPreLoop=4,
+         HasExactTripCount=8,
+         InnerLoop=16,
+         PartialPeelLoop=32,
+         PartialPeelFailed=64 };
   char _unswitch_count;
   enum { _unswitch_max=3 };
 
@@ -65,13 +70,13 @@
   // Names for edge indices
   enum { Self=0, EntryControl, LoopBackControl };
 
-  int is_inner_loop() const { return _loop_flags & inner_loop; }
-  void set_inner_loop() { _loop_flags |= inner_loop; }
+  int is_inner_loop() const { return _loop_flags & InnerLoop; }
+  void set_inner_loop() { _loop_flags |= InnerLoop; }
 
-  int is_partial_peel_loop() const { return _loop_flags & partial_peel_loop; }
-  void set_partial_peel_loop() { _loop_flags |= partial_peel_loop; }
-  int partial_peel_has_failed() const { return _loop_flags & partial_peel_failed; }
-  void mark_partial_peel_failed() { _loop_flags |= partial_peel_failed; }
+  int is_partial_peel_loop() const { return _loop_flags & PartialPeelLoop; }
+  void set_partial_peel_loop() { _loop_flags |= PartialPeelLoop; }
+  int partial_peel_has_failed() const { return _loop_flags & PartialPeelFailed; }
+  void mark_partial_peel_failed() { _loop_flags |= PartialPeelFailed; }
 
   int unswitch_max() { return _unswitch_max; }
   int unswitch_count() { return _unswitch_count; }
@@ -137,8 +142,8 @@
   // the Main CountedLoop.  Used to assert that we understand the graph shape.
   node_idx_t _main_idx;
 
-  // Known trip count calculated by policy_maximally_unroll
-  int   _trip_count;
+  // Known trip count calculated by compute_exact_trip_count()
+  uint  _trip_count;
 
   // Expected trip count from profile data
   float _profile_trip_cnt;
@@ -152,7 +157,7 @@
 
 public:
   CountedLoopNode( Node *entry, Node *backedge )
-    : LoopNode(entry, backedge), _trip_count(max_jint),
+    : LoopNode(entry, backedge), _main_idx(0), _trip_count(max_juint),
       _profile_trip_cnt(COUNT_UNKNOWN), _unrolled_count_log2(0),
       _node_count_before_unroll(0) {
     init_class_id(Class_CountedLoop);
@@ -194,13 +199,12 @@
 
   // A 'main' loop that is ONLY unrolled or peeled, never RCE'd or
   // Aligned, may be missing it's pre-loop.
-  enum { Normal=0, Pre=1, Main=2, Post=3, PrePostFlagsMask=3, Main_Has_No_Pre_Loop=4 };
-  int is_normal_loop() const { return (_loop_flags&PrePostFlagsMask) == Normal; }
-  int is_pre_loop   () const { return (_loop_flags&PrePostFlagsMask) == Pre;    }
-  int is_main_loop  () const { return (_loop_flags&PrePostFlagsMask) == Main;   }
-  int is_post_loop  () const { return (_loop_flags&PrePostFlagsMask) == Post;   }
-  int is_main_no_pre_loop() const { return _loop_flags & Main_Has_No_Pre_Loop; }
-  void set_main_no_pre_loop() { _loop_flags |= Main_Has_No_Pre_Loop; }
+  int is_normal_loop() const { return (_loop_flags&PreMainPostFlagsMask) == Normal; }
+  int is_pre_loop   () const { return (_loop_flags&PreMainPostFlagsMask) == Pre;    }
+  int is_main_loop  () const { return (_loop_flags&PreMainPostFlagsMask) == Main;   }
+  int is_post_loop  () const { return (_loop_flags&PreMainPostFlagsMask) == Post;   }
+  int is_main_no_pre_loop() const { return _loop_flags & MainHasNoPreLoop; }
+  void set_main_no_pre_loop() { _loop_flags |= MainHasNoPreLoop; }
 
   int main_idx() const { return _main_idx; }
 
@@ -208,10 +212,19 @@
   void set_pre_loop  (CountedLoopNode *main) { assert(is_normal_loop(),""); _loop_flags |= Pre ; _main_idx = main->_idx; }
   void set_main_loop (                     ) { assert(is_normal_loop(),""); _loop_flags |= Main;                         }
   void set_post_loop (CountedLoopNode *main) { assert(is_normal_loop(),""); _loop_flags |= Post; _main_idx = main->_idx; }
-  void set_normal_loop(                    ) { _loop_flags &= ~PrePostFlagsMask; }
+  void set_normal_loop(                    ) { _loop_flags &= ~PreMainPostFlagsMask; }
+
+  void set_trip_count(uint tc) { _trip_count = tc; }
+  uint trip_count()            { return _trip_count; }
 
-  void set_trip_count(int tc) { _trip_count = tc; }
-  int trip_count()            { return _trip_count; }
+  bool has_exact_trip_count() const { return (_loop_flags & HasExactTripCount) != 0; }
+  void set_exact_trip_count(uint tc) {
+    _trip_count = tc;
+    _loop_flags |= HasExactTripCount;
+  }
+  void set_nonexact_trip_count() {
+    _loop_flags &= ~HasExactTripCount;
+  }
 
   void set_profile_trip_cnt(float ptc) { _profile_trip_cnt = ptc; }
   float profile_trip_cnt()             { return _profile_trip_cnt; }
@@ -384,6 +397,9 @@
   // Micro-benchmark spamming.  Remove empty loops.
   bool policy_do_remove_empty_loop( PhaseIdealLoop *phase );
 
+  // Convert one iteration loop into normal code.
+  bool policy_do_one_iteration_loop( PhaseIdealLoop *phase );
+
   // Return TRUE or FALSE if the loop should be peeled or not.  Peel if we can
   // make some loop-invariant test (usually a null-check) happen before the
   // loop.
@@ -412,6 +428,9 @@
   // Return TRUE if "iff" is a range check.
   bool is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const;
 
+  // Compute loop exact trip count if possible
+  void compute_exact_trip_count( PhaseIdealLoop *phase );
+
   // Compute loop trip count from profile data
   void compute_profile_trip_cnt( PhaseIdealLoop *phase );
 
@@ -706,11 +725,11 @@
     _dom_lca_tags(arena()), // Thread::resource_area
     _verify_me(NULL),
     _verify_only(true) {
-    build_and_optimize(false, false);
+    build_and_optimize(false);
   }
 
   // build the loop tree and perform any requested optimizations
-  void build_and_optimize(bool do_split_if, bool do_loop_pred);
+  void build_and_optimize(bool do_split_if);
 
 public:
   // Dominators for the sea of nodes
@@ -721,13 +740,13 @@
   Node *dom_lca_internal( Node *n1, Node *n2 ) const;
 
   // Compute the Ideal Node to Loop mapping
-  PhaseIdealLoop( PhaseIterGVN &igvn, bool do_split_ifs, bool do_loop_pred) :
+  PhaseIdealLoop( PhaseIterGVN &igvn, bool do_split_ifs) :
     PhaseTransform(Ideal_Loop),
     _igvn(igvn),
     _dom_lca_tags(arena()), // Thread::resource_area
     _verify_me(NULL),
     _verify_only(false) {
-    build_and_optimize(do_split_ifs, do_loop_pred);
+    build_and_optimize(do_split_ifs);
   }
 
   // Verify that verify_me made the same decisions as a fresh run.
@@ -737,7 +756,7 @@
     _dom_lca_tags(arena()), // Thread::resource_area
     _verify_me(verify_me),
     _verify_only(false) {
-    build_and_optimize(false, false);
+    build_and_optimize(false);
   }
 
   // Build and verify the loop tree without modifying the graph.  This
@@ -830,7 +849,26 @@
                                         Deoptimization::DeoptReason reason);
   void register_control(Node* n, IdealLoopTree *loop, Node* pred);
 
-   // Find a good location to insert a predicate
+  // Clone loop predicates to cloned loops (peeled, unswitched)
+  static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
+                                   Deoptimization::DeoptReason reason,
+                                   PhaseIdealLoop* loop_phase,
+                                   PhaseIterGVN* igvn);
+  static ProjNode*  move_predicate(ProjNode* predicate_proj, Node* new_entry,
+                                   Deoptimization::DeoptReason reason,
+                                   PhaseIdealLoop* loop_phase,
+                                   PhaseIterGVN* igvn);
+  static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
+                                         bool move_predicates,
+                                         PhaseIdealLoop* loop_phase,
+                                         PhaseIterGVN* igvn);
+  Node* clone_loop_predicates(Node* old_entry, Node* new_entry);
+  Node*  move_loop_predicates(Node* old_entry, Node* new_entry);
+
+  void eliminate_loop_predicates(Node* entry);
+  static Node* skip_loop_predicates(Node* entry);
+
+  // Find a good location to insert a predicate
   static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
   // Find a predicate
   static Node* find_predicate(Node* entry);
--- a/hotspot/src/share/vm/opto/loopopts.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopopts.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -2139,9 +2139,12 @@
 //
 //                   orig
 //
-//                  stmt1
-//                    |
-//                    v
+//                   stmt1
+//                     |
+//                     v
+//               loop predicate
+//                     |
+//                     v
 //                   loop<----+
 //                     |      |
 //                   stmt2    |
@@ -2172,6 +2175,9 @@
 //            after clone loop
 //
 //                   stmt1
+//                     |
+//                     v
+//               loop predicate
 //                 /       \
 //        clone   /         \   orig
 //               /           \
@@ -2210,12 +2216,15 @@
 //           after partial peel
 //
 //                  stmt1
+//                     |
+//                     v
+//               loop predicate
 //                 /
 //        clone   /             orig
 //               /          TOP
 //              /             \
 //             v               v
-//    TOP->region             region----+
+//    TOP->loop                loop----+
 //          |                    |      |
 //        stmt2                stmt2    |
 //          |                    |      |
@@ -2253,13 +2262,17 @@
 //                  stmt1
 //                    |
 //                    v
+//                  stmt2 clone
+//                    |
+//                    v
 //         ........> ifA clone
 //         :        / |
 //        dom      /  |
 //         :      v   v
 //         :  false   true
 //         :  |       |
-//         :  |     stmt2 clone
+//         :  |       v
+//         :  | loop predicate
 //         :  |       |
 //         :  |       v
 //         :  |    newloop<-----+
@@ -2289,6 +2302,7 @@
 //
 bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
 
+  assert(!loop->_head->is_CountedLoop(), "Non-counted loop only");
   if (!loop->_head->is_Loop()) {
     return false;  }
 
@@ -2316,6 +2330,7 @@
     }
   }
 
+  Node* entry = head->in(LoopNode::EntryControl);
   int dd = dom_depth(head);
 
   // Step 1: find cut point
@@ -2612,6 +2627,8 @@
 
   // Backedge of the surviving new_head (the clone) is original last_peel
   _igvn.hash_delete(new_head_clone);
+  Node* new_entry = move_loop_predicates(entry, new_head_clone->in(LoopNode::EntryControl));
+  new_head_clone->set_req(LoopNode::EntryControl, new_entry);
   new_head_clone->set_req(LoopNode::LoopBackControl, last_peel);
   _igvn._worklist.push(new_head_clone);
 
--- a/hotspot/src/share/vm/opto/parse2.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/parse2.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -795,8 +795,9 @@
   taken = method()->scale_count(taken);
   not_taken = method()->scale_count(not_taken);
 
-  // Give up if too few counts to be meaningful
-  if (taken + not_taken < 40) {
+  // Give up if too few (or too many, in which case the sum will overflow) counts to be meaningful.
+  // We also check that individual counters are positive first, overwise the sum can become positive.
+  if (taken < 0 || not_taken < 0 || taken + not_taken < 40) {
     if (C->log() != NULL) {
       C->log()->elem("branch target_bci='%d' taken='%d' not_taken='%d'", iter().get_dest(), taken, not_taken);
     }
@@ -804,13 +805,13 @@
   }
 
   // Compute frequency that we arrive here
-  int sum = taken + not_taken;
+  float sum = taken + not_taken;
   // Adjust, if this block is a cloned private block but the
   // Jump counts are shared.  Taken the private counts for
   // just this path instead of the shared counts.
   if( block()->count() > 0 )
     sum = block()->count();
-  cnt = (float)sum / (float)FreqCountInvocations;
+  cnt = sum / FreqCountInvocations;
 
   // Pin probability to sane limits
   float prob;
--- a/hotspot/src/share/vm/opto/phaseX.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/phaseX.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -471,6 +471,13 @@
     _delay_transform = delay;
   }
 
+  // Clone loop predicates. Defined in loopTransform.cpp.
+  Node* clone_loop_predicates(Node* old_entry, Node* new_entry);
+  Node*  move_loop_predicates(Node* old_entry, Node* new_entry);
+  // Create a new if below new_entry for the predicate to be cloned
+  ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
+                                        Deoptimization::DeoptReason reason);
+
 #ifndef PRODUCT
 protected:
   // Sub-quadratic implementation of VerifyIterativeGVN.
--- a/hotspot/src/share/vm/opto/split_if.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/split_if.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -399,6 +399,9 @@
 #ifndef PRODUCT
   if( PrintOpto && VerifyLoopOptimizations )
     tty->print_cr("Split-if");
+  if (TraceLoopOpts) {
+    tty->print_cr("SplitIf");
+  }
 #endif
   C->set_major_progress();
   Node *region = iff->in(0);
--- a/hotspot/src/share/vm/opto/superword.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/superword.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1132,6 +1132,13 @@
 void SuperWord::output() {
   if (_packset.length() == 0) return;
 
+#ifndef PRODUCT
+  if (TraceLoopOpts) {
+    tty->print("SuperWord    ");
+    lpt()->dump_head();
+  }
+#endif
+
   // MUST ENSURE main loop's initial value is properly aligned:
   //  (iv_initial_value + min_iv_offset) % vector_width_in_bytes() == 0
 
--- a/hotspot/src/share/vm/opto/vectornode.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/opto/vectornode.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -32,6 +32,7 @@
 //------------------------------VectorNode--------------------------------------
 // Vector Operation
 class VectorNode : public Node {
+  virtual uint size_of() const { return sizeof(*this); }
  protected:
   uint _length; // vector length
   virtual BasicType elt_basic_type() const = 0; // Vector element basic type
--- a/hotspot/src/share/vm/prims/jvm.h	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvm.h	Tue Apr 26 15:48:03 2011 -0700
@@ -1062,7 +1062,7 @@
     JVM_CONSTANT_NameAndType,
     JVM_CONSTANT_MethodHandle           = 15,  // JSR 292
     JVM_CONSTANT_MethodType             = 16,  // JSR 292
-    JVM_CONSTANT_InvokeDynamicTrans     = 17,  // JSR 292, only occurs in old class files
+    //JVM_CONSTANT_(unused)             = 17,  // JSR 292 early drafts only
     JVM_CONSTANT_InvokeDynamic          = 18,  // JSR 292
     JVM_CONSTANT_ExternalMax            = 18   // Last tag found in classfiles
 };
--- a/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -319,8 +319,11 @@
   bool enter_all_methods =
     interp_events ||
     avail.can_generate_breakpoint_events;
-  UseFastEmptyMethods = !enter_all_methods;
-  UseFastAccessorMethods = !enter_all_methods;
+  if (enter_all_methods) {
+    // Disable these when tracking the bytecodes
+    UseFastEmptyMethods = false;
+    UseFastAccessorMethods = false;
+  }
 
   if (avail.can_generate_breakpoint_events) {
     RewriteFrequentPairs = false;
--- a/hotspot/src/share/vm/prims/methodHandleWalk.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandleWalk.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -959,12 +959,6 @@
   if (m == NULL) {
     // Get the intrinsic methodOop.
     m = vmIntrinsics::method_for(iid);
-    if (m == NULL && iid == vmIntrinsics::_checkSpreadArgument && AllowTransitionalJSR292) {
-      m = vmIntrinsics::method_for(vmIntrinsics::_checkSpreadArgument_TRANS);
-      if (m == NULL)
-        // sun.dyn.MethodHandleImpl not found, look for java.dyn.MethodHandleNatives:
-        m = vmIntrinsics::method_for(vmIntrinsics::_checkSpreadArgument_TRANS2);
-    }
     if (m == NULL) {
       ArgToken zero;
       lose(vmIntrinsics::name_at(iid), CHECK_(zero));
--- a/hotspot/src/share/vm/prims/methodHandleWalk.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandleWalk.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -343,6 +343,7 @@
   int cpool_symbol_put(int tag, Symbol* con) {
     if (con == NULL)  return 0;
     ConstantValue* cv = new ConstantValue(tag, con);
+    con->increment_refcount();
     return _constants.append(cv);
   }
 
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -928,6 +928,7 @@
 };
 
 static bool is_always_null_type(klassOop klass) {
+  if (klass == NULL)  return false;  // safety
   if (!Klass::cast(klass)->oop_is_instance())  return false;
   instanceKlass* ik = instanceKlass::cast(klass);
   // Must be on the boot class path:
@@ -944,6 +945,8 @@
 }
 
 bool MethodHandles::class_cast_needed(klassOop src, klassOop dst) {
+  if (dst == NULL)  return true;
+  if (src == NULL)  return (dst != SystemDictionary::Object_klass());
   if (src == dst || dst == SystemDictionary::Object_klass())
     return false;                               // quickest checks
   Klass* srck = Klass::cast(src);
@@ -1026,10 +1029,15 @@
                                             int first_ptype_pos,
                                             KlassHandle insert_ptype,
                                             TRAPS) {
+  Handle mhi_type;
+  if (m->is_method_handle_invoke()) {
+    // use this more exact typing instead of the symbolic signature:
+    mhi_type = Handle(THREAD, m->method_handle_type());
+  }
   objArrayHandle ptypes(THREAD, java_lang_invoke_MethodType::ptypes(mtype()));
   int pnum = first_ptype_pos;
   int pmax = ptypes->length();
-  int mnum = 0;                 // method argument
+  int anum = 0;                 // method argument
   const char* err = NULL;
   ResourceMark rm(THREAD);
   for (SignatureStream ss(m->signature()); !ss.is_done(); ss.next()) {
@@ -1048,47 +1056,70 @@
       else
         ptype_oop = insert_ptype->java_mirror();
       pnum += 1;
-      mnum += 1;
+      anum += 1;
     }
-    klassOop  pklass = NULL;
-    BasicType ptype  = T_OBJECT;
-    if (ptype_oop != NULL)
-      ptype = java_lang_Class::as_BasicType(ptype_oop, &pklass);
-    else
-      // null does not match any non-reference; use Object to report the error
-      pklass = SystemDictionary::Object_klass();
-    klassOop  mklass = NULL;
-    BasicType mtype  = ss.type();
-    if (mtype == T_ARRAY)  mtype = T_OBJECT; // fold all refs to T_OBJECT
-    if (mtype == T_OBJECT) {
-      if (ptype_oop == NULL) {
+    KlassHandle pklass;
+    BasicType   ptype = T_OBJECT;
+    bool   have_ptype = false;
+    // missing ptype_oop does not match any non-reference; use Object to report the error
+    pklass = SystemDictionaryHandles::Object_klass();
+    if (ptype_oop != NULL) {
+      have_ptype = true;
+      klassOop pklass_oop = NULL;
+      ptype = java_lang_Class::as_BasicType(ptype_oop, &pklass_oop);
+      pklass = KlassHandle(THREAD, pklass_oop);
+    }
+    ptype_oop = NULL; //done with this
+    KlassHandle aklass;
+    BasicType   atype = ss.type();
+    if (atype == T_ARRAY)  atype = T_OBJECT; // fold all refs to T_OBJECT
+    if (atype == T_OBJECT) {
+      if (!have_ptype) {
         // null matches any reference
         continue;
       }
-      KlassHandle pklass_handle(THREAD, pklass); pklass = NULL;
-      // If we fail to resolve types at this point, we will throw an error.
-      Symbol* name = ss.as_symbol(CHECK);
-      instanceKlass* mk = instanceKlass::cast(m->method_holder());
-      Handle loader(THREAD, mk->class_loader());
-      Handle domain(THREAD, mk->protection_domain());
-      mklass = SystemDictionary::resolve_or_null(name, loader, domain, CHECK);
-      pklass = pklass_handle();
-      if (mklass == NULL && pklass != NULL &&
-          Klass::cast(pklass)->name() == name &&
-          m->is_method_handle_invoke()) {
-        // Assume a match.  We can't really decode the signature of MH.invoke*.
-        continue;
+      if (mhi_type.is_null()) {
+        // If we fail to resolve types at this point, we will usually throw an error.
+        TempNewSymbol name = ss.as_symbol_or_null();
+        if (name != NULL) {
+          instanceKlass* mk = instanceKlass::cast(m->method_holder());
+          Handle loader(THREAD, mk->class_loader());
+          Handle domain(THREAD, mk->protection_domain());
+          klassOop aklass_oop = SystemDictionary::resolve_or_null(name, loader, domain, CHECK);
+          if (aklass_oop != NULL)
+            aklass = KlassHandle(THREAD, aklass_oop);
+        }
+      } else {
+        // for method handle invokers we don't look at the name in the signature
+        oop atype_oop;
+        if (ss.at_return_type())
+          atype_oop = java_lang_invoke_MethodType::rtype(mhi_type());
+        else
+          atype_oop = java_lang_invoke_MethodType::ptype(mhi_type(), anum-1);
+        klassOop aklass_oop = NULL;
+        atype = java_lang_Class::as_BasicType(atype_oop, &aklass_oop);
+        aklass = KlassHandle(THREAD, aklass_oop);
       }
     }
     if (!ss.at_return_type()) {
-      err = check_argument_type_change(ptype, pklass, mtype, mklass, mnum);
+      err = check_argument_type_change(ptype, pklass(), atype, aklass(), anum);
     } else {
-      err = check_return_type_change(mtype, mklass, ptype, pklass); // note reversal!
+      err = check_return_type_change(atype, aklass(), ptype, pklass()); // note reversal!
     }
     if (err != NULL)  break;
   }
 
   if (err != NULL) {
+#ifndef PRODUCT
+    if (PrintMiscellaneous && (Verbose || WizardMode)) {
+      tty->print("*** verify_method_signature failed: ");
+      java_lang_invoke_MethodType::print_signature(mtype(), tty);
+      tty->cr();
+      tty->print_cr("    first_ptype_pos = %d, insert_ptype = "UINTX_FORMAT, first_ptype_pos, insert_ptype());
+      tty->print("    Failing method: ");
+      m->print();
+    }
+#endif //PRODUCT
     THROW_MSG(vmSymbols::java_lang_InternalError(), err);
   }
 }
@@ -1288,10 +1319,12 @@
   // format, format, format
   const char* src_name = type2name(src_type);
   const char* dst_name = type2name(dst_type);
-  if (src_type == T_OBJECT)  src_name = Klass::cast(src_klass)->external_name();
-  if (dst_type == T_OBJECT)  dst_name = Klass::cast(dst_klass)->external_name();
   if (src_name == NULL)  src_name = "unknown type";
   if (dst_name == NULL)  dst_name = "unknown type";
+  if (src_type == T_OBJECT)
+    src_name = (src_klass != NULL) ? Klass::cast(src_klass)->external_name() : "an unresolved class";
+  if (dst_type == T_OBJECT)
+    dst_name = (dst_klass != NULL) ? Klass::cast(dst_klass)->external_name() : "an unresolved class";
 
   size_t msglen = strlen(err) + strlen(src_name) + strlen(dst_name) + (argnum < 10 ? 1 : 11);
   char* msg = NEW_RESOURCE_ARRAY(char, msglen + 1);
@@ -2488,74 +2521,21 @@
 }
 JVM_END
 
-JVM_ENTRY(void, MHN_registerBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh, jobject bsm_jh)) {
-  instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
-  if (!AllowTransitionalJSR292) {
-    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
-              "registerBootstrapMethod is only supported in JSR 292 EDR");
-  }
-  ik->link_class(CHECK);
-  if (!java_lang_invoke_MethodHandle::is_instance(JNIHandles::resolve(bsm_jh))) {
-    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "method handle");
-  }
-  const char* err = NULL;
-  if (ik->is_initialized() || ik->is_in_error_state()) {
-    err = "too late: class is already initialized";
-  } else {
-    ObjectLocker ol(ik, THREAD);  // note:  this should be a recursive lock
-    if (ik->is_not_initialized() ||
-        (ik->is_being_initialized() && ik->is_reentrant_initialization(THREAD))) {
-      if (ik->bootstrap_method() != NULL) {
-        err = "class is already equipped with a bootstrap method";
-      } else {
-        ik->set_bootstrap_method(JNIHandles::resolve_non_null(bsm_jh));
-        err = NULL;
-      }
-    } else {
-      err = "class is already initialized";
-      if (ik->is_being_initialized())
-        err = "class is already being initialized in a different thread";
-    }
-  }
-  if (err != NULL) {
-    THROW_MSG(vmSymbols::java_lang_IllegalStateException(), err);
-  }
-}
-JVM_END
-
-JVM_ENTRY(jobject, MHN_getBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh)) {
-  if (!AllowTransitionalJSR292)
-    THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), "getBootstrap: transitional only");
-  instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
-  return JNIHandles::make_local(THREAD, ik->bootstrap_method());
-}
-JVM_END
-
-JVM_ENTRY(void, MHN_setCallSiteTarget(JNIEnv *env, jobject igcls, jobject site_jh, jobject target_jh)) {
-  if (!AllowTransitionalJSR292)
-    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "setCallSite: transitional only");
-}
-JVM_END
-
 
 /// JVM_RegisterMethodHandleMethods
 
 #define LANG "Ljava/lang/"
-#define JLINV "Ljava/lang/invoke/" /* standard package */
-#define JDYN "Ljava/dyn/" /* alternative package to JLINV if AllowTransitionalJSR292 */
-#define IDYN "Lsun/dyn/"  /* alternative package to JDYN if AllowTransitionalJSR292 */
-// FIXME: After AllowTransitionalJSR292 is removed, replace JDYN and IDYN by JLINV.
+#define JLINV "Ljava/lang/invoke/"
 
 #define OBJ   LANG"Object;"
 #define CLS   LANG"Class;"
 #define STRG  LANG"String;"
-#define CST   JDYN"CallSite;"
-#define MT    JDYN"MethodType;"
-#define MH    JDYN"MethodHandle;"
-#define MEM   IDYN"MemberName;"
-#define AMH   IDYN"AdapterMethodHandle;"
-#define BMH   IDYN"BoundMethodHandle;"
-#define DMH   IDYN"DirectMethodHandle;"
+#define MT    JLINV"MethodType;"
+#define MH    JLINV"MethodHandle;"
+#define MEM   JLINV"MemberName;"
+#define AMH   JLINV"AdapterMethodHandle;"
+#define BMH   JLINV"BoundMethodHandle;"
+#define DMH   JLINV"DirectMethodHandle;"
 
 #define CC (char*)  /*cast a literal from (const char*)*/
 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
@@ -2579,39 +2559,6 @@
   {CC"getMembers",              CC"("CLS""STRG""STRG"I"CLS"I["MEM")I",  FN_PTR(MHN_getMembers)}
 };
 
-// FIXME: Remove methods2 after AllowTransitionalJSR292 is removed.
-static JNINativeMethod methods2[] = {
-  {CC"registerBootstrap",       CC"("CLS MH")V",                FN_PTR(MHN_registerBootstrap)},
-  {CC"getBootstrap",            CC"("CLS")"MH,                  FN_PTR(MHN_getBootstrap)},
-  {CC"setCallSiteTarget",       CC"("CST MH")V",                FN_PTR(MHN_setCallSiteTarget)}
-};
-
-static void hack_signatures(JNINativeMethod* methods, jint num_methods, const char* from_sig, const char* to_sig) {
-  for (int i = 0; i < num_methods; i++) {
-    const char* sig = methods[i].signature;
-    if (!strstr(sig, from_sig))  continue;
-    size_t buflen = strlen(sig) + 100;
-    char* buf = NEW_C_HEAP_ARRAY(char, buflen);
-    char* bufp = buf;
-    const char* sigp = sig;
-    size_t from_len = strlen(from_sig), to_len = strlen(to_sig);
-    while (*sigp != '\0') {
-      assert(bufp < buf + buflen - to_len - 1, "oob");
-      if (strncmp(sigp, from_sig, from_len) != 0) {
-        *bufp++ = *sigp++;
-      } else {
-        strcpy(bufp, to_sig);
-        bufp += to_len;
-        sigp += from_len;
-      }
-    }
-    *bufp = '\0';
-    methods[i].signature = buf;  // replace with new signature
-    if (TraceMethodHandles)
-      tty->print_cr("MethodHandleNatives: %s: change signature %s => %s", methods[i].name, sig, buf);
-  }
-}
-
 // This one function is exported, used by NativeLookup.
 
 JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
@@ -2622,92 +2569,41 @@
     return;  // bind nothing
   }
 
-  if (SystemDictionary::MethodHandleNatives_klass() != NULL &&
-      SystemDictionary::MethodHandleNatives_klass() != java_lang_Class::as_klassOop(JNIHandles::resolve(MHN_class))) {
-    warning("multiple versions of MethodHandleNatives in boot classpath; consider using -XX:+PreferTransitionalJSR292");
-    THROW_MSG(vmSymbols::java_lang_InternalError(), "multiple versions of MethodHandleNatives in boot classpath; consider using -XX:+PreferTransitionalJSR292");
-  }
-
   bool enable_MH = true;
 
-  // Loop control.  FIXME: Replace by dead reckoning after AllowTransitionalJSR292 is removed.
-  bool registered_natives = false;
-  bool try_plain = true, try_JDYN = true, try_IDYN = true;
-  for (;;) {
+  {
     ThreadToNativeFromVM ttnfv(thread);
 
-    if      (try_plain) { try_plain = false; }
-    else if (try_JDYN)  { try_JDYN  = false; hack_signatures(methods, sizeof(methods)/sizeof(JNINativeMethod), IDYN, JDYN); }
-    else if (try_IDYN)  { try_IDYN  = false; hack_signatures(methods, sizeof(methods)/sizeof(JNINativeMethod), JDYN, JLINV); }
-    else                { break; }
     int status = env->RegisterNatives(MHN_class, methods, sizeof(methods)/sizeof(JNINativeMethod));
     if (env->ExceptionOccurred()) {
+      MethodHandles::set_enabled(false);
+      warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
+      enable_MH = false;
       env->ExceptionClear();
-      // and try again...
-    } else {
-      registered_natives = true;
-      break;
     }
   }
-  if (!registered_natives) {
-    MethodHandles::set_enabled(false);
-    warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
-    enable_MH = false;
-  }
 
   if (enable_MH) {
-    bool found_raise_exception = false;
     KlassHandle MHN_klass = SystemDictionaryHandles::MethodHandleNatives_klass();
-    KlassHandle MHI_klass = SystemDictionaryHandles::MethodHandleImpl_klass();
-    // Loop control.  FIXME: Replace by dead reckoning after AllowTransitionalJSR292 is removed.
-    bool try_MHN = true, try_MHI = AllowTransitionalJSR292;
-    for (;;) {
-      KlassHandle try_klass;
-      if      (try_MHN) { try_MHN = false; try_klass = MHN_klass; }
-      else if (try_MHI) { try_MHI = false; try_klass = MHI_klass; }
-      else              { break; }
-      if (try_klass.is_null())  continue;
+    if (MHN_klass.not_null()) {
       TempNewSymbol raiseException_name = SymbolTable::new_symbol("raiseException", CHECK);
       TempNewSymbol raiseException_sig = SymbolTable::new_symbol("(ILjava/lang/Object;Ljava/lang/Object;)V", CHECK);
-      methodOop raiseException_method  = instanceKlass::cast(try_klass->as_klassOop())
+      methodOop raiseException_method  = instanceKlass::cast(MHN_klass->as_klassOop())
                     ->find_method(raiseException_name, raiseException_sig);
       if (raiseException_method != NULL && raiseException_method->is_static()) {
         MethodHandles::set_raise_exception_method(raiseException_method);
-        found_raise_exception = true;
-        break;
+      } else {
+        warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
+        enable_MH = false;
       }
-    }
-    if (!found_raise_exception) {
-      warning("JSR 292 method handle code is mismatched to this JVM.  Disabling support.");
+    } else {
       enable_MH = false;
     }
   }
 
   if (enable_MH) {
-    if (AllowTransitionalJSR292) {
-      // We need to link the MethodHandleImpl klass before we generate
-      // the method handle adapters as the _raise_exception adapter uses
-      // one of its methods (and its c2i-adapter).
-      klassOop k = SystemDictionary::MethodHandleImpl_klass();
-      if (k != NULL) {
-        instanceKlass* ik = instanceKlass::cast(k);
-        ik->link_class(CHECK);
-      }
-    }
-
     MethodHandles::generate_adapters();
     MethodHandles::set_enabled(true);
   }
-
-  if (AllowTransitionalJSR292) {
-    ThreadToNativeFromVM ttnfv(thread);
-
-    int status = env->RegisterNatives(MHN_class, methods2, sizeof(methods2)/sizeof(JNINativeMethod));
-    if (env->ExceptionOccurred()) {
-      // Don't do this, since it's too late:
-      //   MethodHandles::set_enabled(false)
-      env->ExceptionClear();
-    }
-  }
 }
 JVM_END
--- a/hotspot/src/share/vm/prims/nativeLookup.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/prims/nativeLookup.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -117,8 +117,6 @@
 
   { CC"Java_sun_misc_Unsafe_registerNatives",                      NULL, FN_PTR(JVM_RegisterUnsafeMethods)       },
   { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
-  { CC"Java_sun_dyn_MethodHandleNatives_registerNatives",          NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },  // AllowTransitionalJSR292
-  { CC"Java_java_dyn_MethodHandleNatives_registerNatives",         NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },  // AllowTransitionalJSR292
   { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         }
 };
 
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -59,7 +59,8 @@
 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
 #endif
 
-#define DEFAULT_VENDOR_URL_BUG "http://java.sun.com/webapps/bugreport/crash.jsp"
+// Note: This is a special bug reporting site for the JVM
+#define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp"
 #define DEFAULT_JAVA_LAUNCHER  "generic"
 
 char**  Arguments::_jvm_flags_array             = NULL;
@@ -243,6 +244,7 @@
   { "MaxLiveObjectEvacuationRatio",
                            JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
   { "ForceSharedSpaces",   JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) },
+  { "AllowTransitionalJSR292",       JDK_Version::jdk(7), JDK_Version::jdk(8) },
   { NULL, JDK_Version(0), JDK_Version(0) }
 };
 
@@ -962,6 +964,16 @@
   UseCompiler                = true;
   UseLoopCounter             = true;
 
+#ifndef ZERO
+  // Turn these off for mixed and comp.  Leave them on for Zero.
+  if (FLAG_IS_DEFAULT(UseFastAccessorMethods)) {
+    UseFastAccessorMethods = mode == _int;
+  }
+  if (FLAG_IS_DEFAULT(UseFastEmptyMethods)) {
+    UseFastEmptyMethods = mode == _int;
+  }
+#endif
+
   // Default values may be platform/compiler dependent -
   // use the saved values
   ClipInlining               = Arguments::_ClipInlining;
--- a/hotspot/src/share/vm/runtime/globals.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -63,6 +63,12 @@
 
 bool Flag::is_unlocked() const {
   if (strcmp(kind, "{diagnostic}") == 0) {
+    if (strcmp(name, "EnableInvokeDynamic") == 0 && UnlockExperimentalVMOptions && !UnlockDiagnosticVMOptions) {
+      // transitional logic to allow tests to run until they are changed
+      static int warned;
+      if (++warned == 1)  warning("Use -XX:+UnlockDiagnosticVMOptions before EnableInvokeDynamic flag");
+      return true;
+    }
     return UnlockDiagnosticVMOptions;
   } else if (strcmp(kind, "{experimental}") == 0 ||
              strcmp(kind, "{C2 experimental}") == 0) {
--- a/hotspot/src/share/vm/runtime/globals.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -3718,13 +3718,7 @@
   experimental(bool, TrustFinalNonStaticFields, false,                      \
           "trust final non-static declarations for constant folding")       \
                                                                             \
-  experimental(bool, AllowTransitionalJSR292, true,                         \
-          "recognize pre-PFD formats of invokedynamic")                     \
-                                                                            \
-  experimental(bool, PreferTransitionalJSR292, false,                       \
-          "prefer pre-PFD APIs on boot class path, if they exist")          \
-                                                                            \
-  experimental(bool, AllowInvokeForInvokeGeneric, false,                    \
+  experimental(bool, AllowInvokeGeneric, true,                              \
           "accept MethodHandle.invoke and MethodHandle.invokeGeneric "      \
           "as equivalent methods")                                          \
                                                                             \
--- a/hotspot/src/share/vm/runtime/os.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/os.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1291,3 +1291,41 @@
   }
   return result;
 }
+
+// Read file line by line, if line is longer than bsize,
+// skip rest of line.
+int os::get_line_chars(int fd, char* buf, const size_t bsize){
+  size_t sz, i = 0;
+
+  // read until EOF, EOL or buf is full
+  while ((sz = (int) read(fd, &buf[i], 1)) == 1 && i < (bsize-1) && buf[i] != '\n') {
+     ++i;
+  }
+
+  if (buf[i] == '\n') {
+    // EOL reached so ignore EOL character and return
+
+    buf[i] = 0;
+    return (int) i;
+  }
+
+  buf[i+1] = 0;
+
+  if (sz != 1) {
+    // EOF reached. if we read chars before EOF return them and
+    // return EOF on next call otherwise return EOF
+
+    return (i == 0) ? -1 : (int) i;
+  }
+
+  // line is longer than size of buf, skip to EOL
+  int ch;
+  while (read(fd, &ch, 1) == 1 && ch != '\n') {
+    // Do nothing
+  }
+
+  // return initial part of line that fits in buf.
+  // If we reached EOF, it will be returned on next call.
+
+  return (int) i;
+}
--- a/hotspot/src/share/vm/runtime/os.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/os.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -658,6 +658,10 @@
   // Hook for os specific jvm options that we don't want to abort on seeing
   static bool obsolete_option(const JavaVMOption *option);
 
+  // Read file line by line. If line is longer than bsize,
+  // rest of line is skipped. Returns number of bytes read or -1 on EOF
+  static int get_line_chars(int fd, char *buf, const size_t bsize);
+
   // Platform dependent stuff
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.hpp"
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1700,9 +1700,11 @@
     message = generate_class_cast_message(objName, targetKlass->external_name());
   } else {
     // %%% need to get the MethodType string, without messing around too much
+    const char* desc = NULL;
     // Get a signature from the invoke instruction
     const char* mhName = "method handle";
     const char* targetType = "the required signature";
+    int targetArity = -1, mhArity = -1;
     vframeStream vfst(thread, true);
     if (!vfst.at_end()) {
       Bytecode_invoke call(vfst.method(), vfst.bci());
@@ -1716,20 +1718,35 @@
           && target->is_method_handle_invoke()
           && required == target->method_handle_type()) {
         targetType = target->signature()->as_C_string();
+        targetArity = ArgumentCount(target->signature()).size();
       }
     }
-    klassOop kignore; int fignore;
-    methodOop actual_method = MethodHandles::decode_method(actual,
-                                                          kignore, fignore);
+    klassOop kignore; int dmf_flags = 0;
+    methodOop actual_method = MethodHandles::decode_method(actual, kignore, dmf_flags);
+    if ((dmf_flags & ~(MethodHandles::_dmf_has_receiver |
+                       MethodHandles::_dmf_does_dispatch |
+                       MethodHandles::_dmf_from_interface)) != 0)
+      actual_method = NULL;  // MH does extra binds, drops, etc.
+    bool has_receiver = ((dmf_flags & MethodHandles::_dmf_has_receiver) != 0);
     if (actual_method != NULL) {
-      if (methodOopDesc::is_method_handle_invoke_name(actual_method->name()))
-        mhName = "$";
+      mhName = actual_method->signature()->as_C_string();
+      mhArity = ArgumentCount(actual_method->signature()).size();
+      if (!actual_method->is_static())  mhArity += 1;
+    } else if (java_lang_invoke_MethodHandle::is_instance(actual)) {
+      oopDesc* mhType = java_lang_invoke_MethodHandle::type(actual);
+      mhArity = java_lang_invoke_MethodType::ptype_count(mhType);
+      stringStream st;
+      java_lang_invoke_MethodType::print_signature(mhType, &st);
+      mhName = st.as_string();
+    }
+    if (targetArity != -1 && targetArity != mhArity) {
+      if (has_receiver && targetArity == mhArity-1)
+        desc = " cannot be called without a receiver argument as ";
       else
-        mhName = actual_method->signature()->as_C_string();
-      if (mhName[0] == '$')
-        mhName = actual_method->signature()->as_C_string();
+        desc = " cannot be called with a different arity as ";
     }
     message = generate_class_cast_message(mhName, targetType,
+                                          desc != NULL ? desc :
                                           " cannot be called as ");
   }
   if (TraceMethodHandles) {
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -433,3 +433,77 @@
 
 #undef RETURN_STUB
 }
+
+// constants for computing the copy function
+enum {
+  COPYFUNC_UNALIGNED = 0,
+  COPYFUNC_ALIGNED = 1,                 // src, dest aligned to HeapWordSize
+  COPYFUNC_CONJOINT = 0,
+  COPYFUNC_DISJOINT = 2                 // src != dest, or transfer can descend
+};
+
+// Note:  The condition "disjoint" applies also for overlapping copies
+// where an descending copy is permitted (i.e., dest_offset <= src_offset).
+address
+StubRoutines::select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized) {
+  int selector =
+    (aligned  ? COPYFUNC_ALIGNED  : COPYFUNC_UNALIGNED) +
+    (disjoint ? COPYFUNC_DISJOINT : COPYFUNC_CONJOINT);
+
+#define RETURN_STUB(xxx_arraycopy) { \
+  name = #xxx_arraycopy; \
+  return StubRoutines::xxx_arraycopy(); }
+
+#define RETURN_STUB_PARM(xxx_arraycopy, parm) {           \
+  name = #xxx_arraycopy; \
+  return StubRoutines::xxx_arraycopy(parm); }
+
+  switch (t) {
+  case T_BYTE:
+  case T_BOOLEAN:
+    switch (selector) {
+    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jbyte_arraycopy);
+    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jbyte_arraycopy);
+    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jbyte_disjoint_arraycopy);
+    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jbyte_disjoint_arraycopy);
+    }
+  case T_CHAR:
+  case T_SHORT:
+    switch (selector) {
+    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jshort_arraycopy);
+    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jshort_arraycopy);
+    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jshort_disjoint_arraycopy);
+    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jshort_disjoint_arraycopy);
+    }
+  case T_INT:
+  case T_FLOAT:
+    switch (selector) {
+    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jint_arraycopy);
+    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jint_arraycopy);
+    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jint_disjoint_arraycopy);
+    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jint_disjoint_arraycopy);
+    }
+  case T_DOUBLE:
+  case T_LONG:
+    switch (selector) {
+    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jlong_arraycopy);
+    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jlong_arraycopy);
+    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB(jlong_disjoint_arraycopy);
+    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB(arrayof_jlong_disjoint_arraycopy);
+    }
+  case T_ARRAY:
+  case T_OBJECT:
+    switch (selector) {
+    case COPYFUNC_CONJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB_PARM(oop_arraycopy, dest_uninitialized);
+    case COPYFUNC_CONJOINT | COPYFUNC_ALIGNED:    RETURN_STUB_PARM(arrayof_oop_arraycopy, dest_uninitialized);
+    case COPYFUNC_DISJOINT | COPYFUNC_UNALIGNED:  RETURN_STUB_PARM(oop_disjoint_arraycopy, dest_uninitialized);
+    case COPYFUNC_DISJOINT | COPYFUNC_ALIGNED:    RETURN_STUB_PARM(arrayof_oop_disjoint_arraycopy, dest_uninitialized);
+    }
+  default:
+    ShouldNotReachHere();
+    return NULL;
+  }
+
+#undef RETURN_STUB
+#undef RETURN_STUB_PARM
+}
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -282,6 +282,8 @@
   static address addr_fpu_subnormal_bias2()                { return (address)&_fpu_subnormal_bias2; }
 
 
+  static address select_arraycopy_function(BasicType t, bool aligned, bool disjoint, const char* &name, bool dest_uninitialized);
+
   static address jbyte_arraycopy()  { return _jbyte_arraycopy; }
   static address jshort_arraycopy() { return _jshort_arraycopy; }
   static address jint_arraycopy()   { return _jint_arraycopy; }
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -418,6 +418,11 @@
 // state of the code cache if it's requested.
 void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
   if (PrintMethodFlushing) {
+    stringStream s;
+    // Dump code cache state into a buffer before locking the tty,
+    // because log_state() will use locks causing lock conflicts.
+    CodeCache::log_state(&s);
+
     ttyLocker ttyl;
     tty->print("### sweeper: %s ", msg);
     if (format != NULL) {
@@ -426,10 +431,15 @@
       tty->vprint(format, ap);
       va_end(ap);
     }
-    CodeCache::log_state(tty); tty->cr();
+    tty->print_cr(s.as_string());
   }
 
   if (LogCompilation && (xtty != NULL)) {
+    stringStream s;
+    // Dump code cache state into a buffer before locking the tty,
+    // because log_state() will use locks causing lock conflicts.
+    CodeCache::log_state(&s);
+
     ttyLocker ttyl;
     xtty->begin_elem("sweeper state='%s' traversals='" INTX_FORMAT "' ", msg, (intx)traversal_count());
     if (format != NULL) {
@@ -438,7 +448,7 @@
       xtty->vprint(format, ap);
       va_end(ap);
     }
-    CodeCache::log_state(xtty);
+    xtty->print(s.as_string());
     xtty->stamp();
     xtty->end_elem();
   }
--- a/hotspot/src/share/vm/shark/llvmHeaders.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/shark/llvmHeaders.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -46,7 +46,11 @@
 #include <llvm/ModuleProvider.h>
 #endif
 #include <llvm/Support/IRBuilder.h>
+#if SHARK_LLVM_VERSION >= 29
+#include <llvm/Support/Threading.h>
+#else
 #include <llvm/System/Threading.h>
+#endif
 #include <llvm/Target/TargetSelect.h>
 #include <llvm/Type.h>
 #include <llvm/ExecutionEngine/JITMemoryManager.h>
@@ -55,8 +59,12 @@
 #include <llvm/ExecutionEngine/JIT.h>
 #include <llvm/ADT/StringMap.h>
 #include <llvm/Support/Debug.h>
+#if SHARK_LLVM_VERSION >= 29
+#include <llvm/Support/Host.h>
+#else
 #include <llvm/System/Host.h>
 #endif
+#endif
 
 #include <map>
 
--- a/hotspot/src/share/vm/shark/sharkCompiler.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/shark/sharkCompiler.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2008, 2009, 2010 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -218,6 +218,7 @@
 
 nmethod* SharkCompiler::generate_native_wrapper(MacroAssembler* masm,
                                                 methodHandle    target,
+                                                int             compile_id,
                                                 BasicType*      arg_types,
                                                 BasicType       return_type) {
   assert(is_initialized(), "should be");
@@ -241,6 +242,7 @@
 
   // Return the nmethod for installation in the VM
   return nmethod::new_native_nmethod(target,
+                                     compile_id,
                                      masm->code(),
                                      0,
                                      0,
--- a/hotspot/src/share/vm/shark/sharkCompiler.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/shark/sharkCompiler.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,6 +60,7 @@
   // Generate a wrapper for a native (JNI) method
   nmethod* generate_native_wrapper(MacroAssembler* masm,
                                    methodHandle    target,
+                                   int             compile_id,
                                    BasicType*      arg_types,
                                    BasicType       return_type);
 
@@ -113,7 +114,8 @@
   // Global access
  public:
   static SharkCompiler* compiler() {
-    AbstractCompiler *compiler = CompileBroker::compiler(CompLevel_simple);
+    AbstractCompiler *compiler =
+      CompileBroker::compiler(CompLevel_full_optimization);
     assert(compiler->is_shark() && compiler->is_initialized(), "should be");
     return (SharkCompiler *) compiler;
   }
--- a/hotspot/src/share/vm/utilities/constantTag.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/utilities/constantTag.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -93,8 +93,6 @@
       return "MethodType";
     case JVM_CONSTANT_InvokeDynamic :
       return "InvokeDynamic";
-    case JVM_CONSTANT_InvokeDynamicTrans :
-      return "InvokeDynamic/transitional";
     case JVM_CONSTANT_Object :
       return "Object";
     case JVM_CONSTANT_Utf8 :
--- a/hotspot/src/share/vm/utilities/constantTag.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/utilities/constantTag.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -86,8 +86,7 @@
 
   bool is_method_type() const              { return _tag == JVM_CONSTANT_MethodType; }
   bool is_method_handle() const            { return _tag == JVM_CONSTANT_MethodHandle; }
-  bool is_invoke_dynamic() const           { return (_tag == JVM_CONSTANT_InvokeDynamic ||
-                                                     _tag == JVM_CONSTANT_InvokeDynamicTrans); }
+  bool is_invoke_dynamic() const           { return _tag == JVM_CONSTANT_InvokeDynamic; }
 
   bool is_loadable_constant() const {
     return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) ||
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -746,9 +746,9 @@
   CompLevel_simple            = 1,         // C1
   CompLevel_limited_profile   = 2,         // C1, invocation & backedge counters
   CompLevel_full_profile      = 3,         // C1, invocation & backedge counters + mdo
-  CompLevel_full_optimization = 4,         // C2
+  CompLevel_full_optimization = 4,         // C2 or Shark
 
-#if defined(COMPILER2)
+#if defined(COMPILER2) || defined(SHARK)
   CompLevel_highest_tier      = CompLevel_full_optimization,  // pure C2 and tiered
 #elif defined(COMPILER1)
   CompLevel_highest_tier      = CompLevel_simple,             // pure C1
@@ -760,7 +760,7 @@
   CompLevel_initial_compile   = CompLevel_full_profile        // tiered
 #elif defined(COMPILER1)
   CompLevel_initial_compile   = CompLevel_simple              // pure C1
-#elif defined(COMPILER2)
+#elif defined(COMPILER2) || defined(SHARK)
   CompLevel_initial_compile   = CompLevel_full_optimization   // pure C2
 #else
   CompLevel_initial_compile   = CompLevel_none
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Tue Apr 26 15:48:03 2011 -0700
@@ -77,7 +77,9 @@
 # endif
 
 #ifdef LINUX
+#ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS
+#endif // __STDC_LIMIT_MACROS
 #include <inttypes.h>
 #include <signal.h>
 #include <ucontext.h>
--- a/hotspot/test/compiler/6795161/Test.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/hotspot/test/compiler/6795161/Test.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -26,7 +26,7 @@
  * @test
  * @bug 6795161
  * @summary Escape analysis leads to data corruption
- * @run main/othervm -server -Xcomp -XX:CompileOnly=Test -XX:+DoEscapeAnalysis Test
+ * @run main/othervm -server  -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:CompileOnly=Test -XX:+DoEscapeAnalysis Test
  */
 
 class Test_Class_1 {
--- a/jaxp/.hgtags	Tue Apr 19 16:01:27 2011 -0700
+++ b/jaxp/.hgtags	Tue Apr 26 15:48:03 2011 -0700
@@ -112,3 +112,4 @@
 4aa9916693dc1078580c1865e6f2584046851e5a jdk7-b135
 1759daa85d33800bd578853f9531f9de73f70fc7 jdk7-b136
 1d87f7460cde7f8f30af668490f82b52b879bfd8 jdk7-b137
+be3758943770a0a3dd4be6a1cb4063507c4d7062 jdk7-b138
--- a/jaxws/.hgtags	Tue Apr 19 16:01:27 2011 -0700
+++ b/jaxws/.hgtags	Tue Apr 26 15:48:03 2011 -0700
@@ -112,3 +112,4 @@
 d5fc61f18043765705ef22b57a68c924ab2f1a5b jdk7-b135
 c81d289c9a532d6e94af3c09d856a2a20529040f jdk7-b136
 ccea3282991ce8b678e188cf32a8239f76ff3bfa jdk7-b137
+cc956c8a8255583535597e9a63db23c510e9a063 jdk7-b138
--- a/jdk/.hgtags	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/.hgtags	Tue Apr 26 15:48:03 2011 -0700
@@ -113,3 +113,4 @@
 aa13e7702cd9d8aca9aa38f1227f966990866944 jdk7-b136
 29296ea6529a418037ccce95903249665ef31c11 jdk7-b137
 60d3d55dcc9c31a30ced9caa6ef5c0dcd7db031d jdk7-b138
+d80954a89b49fda47c0c5cace65a17f5a758b8bd jdk7-b139
--- a/jdk/make/com/sun/java/pack/Makefile	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/com/sun/java/pack/Makefile	Tue Apr 26 15:48:03 2011 -0700
@@ -56,10 +56,6 @@
 
 vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR)
 
-
-
-
-
 ifeq ($(STANDALONE),true)
   ZIPOBJDIR = $(OUTPUTDIR)/tmp/sun/java.util.zip/zip/$(OBJDIRNAME)
 
@@ -131,8 +127,9 @@
 pack200-tool:
 	$(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack)
 
+# ignore mapfile for non-product binary 
 unpacker:
-	$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_OPT= LDMAPFLAGS_DBG=
+	$(MAKE) $(UNPACK_EXE) STANDALONE=true LDMAPFLAGS_DBG=
 
 ifeq ($(PLATFORM), windows)
 IMVERSIONVALUE=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
@@ -147,8 +144,14 @@
 	$(ECHO) "Resource files not required for Unix"
 endif
 
+# Mapfile-vers.gmk, does not copy over the mapfile-vers-unpack200, when
+# the make utiliy is re-invoked, as in this case. In order to workaround
+# this special case, the mapfile required for the unpack200 command, is
+# explicitly copied over to the expected location.
 $(UNPACK_EXE): $(UNPACK_EXE_FILES_o) updatefiles winres
 	$(prep-target)
+	$(RM) $(TEMPDIR)/mapfile-vers
+	$(CP) mapfile-vers-unpack200 $(TEMPDIR)/mapfile-vers
 	$(LINKER)  $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX)
 ifdef MT
 	$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/com/sun/java/pack/mapfile-vers-unpack200	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+# Define library interface.
+
+SUNWprivate_1.1 {
+	local:
+	    *;
+};
--- a/jdk/make/common/Mapfile-vers.gmk	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/common/Mapfile-vers.gmk	Tue Apr 26 15:48:03 2011 -0700
@@ -52,8 +52,8 @@
   endif
   
   # If we are re-ordering functions in this solaris library, we need to make
-  #   sure that -xF is added to the compile lines. This option is critical and
-  #   enables the functions to be reordered.
+  # sure that -xF is added to the compile lines. This option is critical and
+  # enables the functions to be reordered.
   ifdef FILES_reorder
     CFLAGS_OPT   += -xF
     CXXFLAGS_OPT += -xF
@@ -76,7 +76,6 @@
 
 endif # PLATFORM
 
-
 ifeq ($(PLATFORM), linux)
 
 ifeq ($(VARIANT), OPT)
--- a/jdk/make/common/Program.gmk	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/common/Program.gmk	Tue Apr 26 15:48:03 2011 -0700
@@ -55,6 +55,11 @@
 
 program: $(ACTUAL_PROGRAM)
 
+# reuse the mapfiles in the launcher's directory, the same should
+# be applicable to the tool launchers as well.
+FILES_m = $(BUILDDIR)/java/main/java/mapfile-$(ARCH)
+include $(BUILDDIR)/common/Mapfile-vers.gmk
+
 include $(JDK_TOPDIR)/make/common/Rules.gmk
 
 ifdef NEVER_ACT_AS_SERVER_CLASS_MACHINE
--- a/jdk/make/common/Release.gmk	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/common/Release.gmk	Tue Apr 26 15:48:03 2011 -0700
@@ -885,12 +885,18 @@
 ABS_DB_PATH  :=$(call FullPath,$(CLOSED_SHARE_SRC)/db)
 DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null)
 
+# Java DB image. Move the Java DB demo directory into the JDK's demo
+# dir and in the process, rename it to db.  Also remove index.html,
+# since it presumes docs are co-located. Also remove register.html (no
+# longer relevant).
 initial-image-jdk-db: $(DB_ZIP_LIST)
 	$(MKDIR) -p $(JDK_IMAGE_DIR)/db
 	for d in $(DB_ZIP_LIST); do \
           ($(CD) $(JDK_IMAGE_DIR)/db && $(UNZIP) -o $$d); \
 	done
-
+	$(RM) -rf $(DEMODIR)/db
+	$(MV) $(JDK_IMAGE_DIR)/db/demo $(DEMODIR)/db
+	$(RM) $(JDK_IMAGE_DIR)/db/index.html $(JDK_IMAGE_DIR)/db/register.html
 endif
 
 # Standard jdk image
--- a/jdk/make/common/shared/Defs.gmk	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/common/shared/Defs.gmk	Tue Apr 26 15:48:03 2011 -0700
@@ -218,11 +218,7 @@
 else
   LAUNCHER_NAME = java
   PRODUCT_NAME = Java(TM)
-  ifeq ($(J4B), true)
-    PRODUCT_SUFFIX = SE Runtime Environment for Business
-  else
-    PRODUCT_SUFFIX = SE Runtime Environment
-  endif
+  PRODUCT_SUFFIX = SE Runtime Environment
   JDK_RC_PLATFORM_NAME = Platform SE
   COMPANY_NAME = Oracle Corporation
 endif
--- a/jdk/make/docs/Makefile	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/docs/Makefile	Tue Apr 26 15:48:03 2011 -0700
@@ -53,7 +53,7 @@
 DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
 
 # Url to Java Language Spec
-JLS3_URL = http://java.sun.com/docs/books/jls/
+#JLS3_URL = http://java.sun.com/docs/books/jls/
 
 # Common Java trademark line
 JAVA_TRADEMARK_LINE = Java is a trademark or registered trademark of \
@@ -293,8 +293,8 @@
 <strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>
 
 # Java language specification cite
-TAG_JLS3 = jls3:a:See <cite><a href="$(JLS3_URL)"> \
-The Java Language Specification, Third Edition</a></cite>:
+TAG_JLS = jls:a:See <cite> \
+The Java&trade; Language Specification</cite>:
 
 # Overview file for core apis
 COREAPI_OVERVIEW = $(SHARE_SRC)/classes/overview-core.html
@@ -329,7 +329,7 @@
 	  $(call OptionPair,-tag,specdefault:X)				; \
 	  $(call OptionPair,-tag,Note:X)				; \
 	  $(call OptionPair,-tag,ToDo:X)				; \
-          $(call OptionPair,-tag,$(TAG_JLS3)) 				; \
+          $(call OptionPair,-tag,$(TAG_JLS)) 				; \
 	  $(call OptionOnly,-splitIndex)				; \
 	  $(call OptionPair,-overview,$(COREAPI_OVERVIEW))		; \
 	  $(call OptionPair,-doctitle,$(COREAPI_DOCTITLE))		; \
@@ -1081,6 +1081,7 @@
 	  $(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE))		; \
 	  $(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
 	  $(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER))	; \
+          $(call OptionPair,-tag,$(TAG_JLS)) 				; \
 	  $(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM))	; \
 	  $(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \
 	  $(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
--- a/jdk/make/java/java/FILES_java.gmk	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/java/java/FILES_java.gmk	Tue Apr 26 15:48:03 2011 -0700
@@ -189,7 +189,6 @@
     java/util/ListResourceBundle.java \
         sun/util/EmptyListResourceBundle.java \
     java/util/Locale.java \
-        sun/util/locale/AsciiUtil.java \
         sun/util/locale/BaseLocale.java \
         sun/util/locale/Extension.java \
         sun/util/locale/InternalLocaleBuilder.java \
@@ -197,6 +196,7 @@
         sun/util/locale/LocaleExtensions.java \
         sun/util/locale/LocaleObjectCache.java \
         sun/util/locale/LocaleSyntaxException.java \
+        sun/util/locale/LocaleUtils.java \
         sun/util/locale/ParseStatus.java \
         sun/util/locale/StringTokenIterator.java \
         sun/util/locale/UnicodeLocaleExtension.java \
--- a/jdk/make/java/main/java/Makefile	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/java/main/java/Makefile	Tue Apr 26 15:48:03 2011 -0700
@@ -61,5 +61,4 @@
 
 ifeq ($(PLATFORM), solaris)
 LDFLAGS += -R$(OPENWIN_LIB)
-LDFLAGS += -M mapfile-$(ARCH)
 endif
--- a/jdk/make/java/main/java/mapfile-amd64	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-amd64	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -27,7 +27,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-i586	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-i586	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -27,7 +27,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-sparc	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-sparc	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -26,7 +26,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/java/main/java/mapfile-sparcv9	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/java/main/java/mapfile-sparcv9	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -28,7 +28,7 @@
 # interested in declaring a version, simply scoping the file is sufficient.
 #
 
-{
+SUNWprivate_1.1 {
 	global:
 		main;		# Provides basic adb symbol offsets
 		environ;	# Public symbols and required by Java run time
--- a/jdk/make/javax/crypto/Defs-jce.gmk	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/javax/crypto/Defs-jce.gmk	Tue Apr 26 15:48:03 2011 -0700
@@ -58,7 +58,7 @@
 SIGNING_KEY_DIR    = /security/ws/JCE-signing/src
 SIGNING_KEYSTORE   = $(SIGNING_KEY_DIR)/KeyStore.jks
 SIGNING_PASSPHRASE = $(SIGNING_KEY_DIR)/passphrase.txt
-SIGNING_ALIAS      = jce_rsa
+SIGNING_ALIAS      = oracle_jce_rsa
 
 #
 # Defines for signing the various jar files.
--- a/jdk/make/jpda/jdwp/jdwp.spec	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/jpda/jdwp/jdwp.spec	Tue Apr 26 15:48:03 2011 -0700
@@ -519,9 +519,8 @@
         "Both the JNI signature and the generic signature are "
         "returned for each class.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
 	(Out 
         )
@@ -623,8 +622,8 @@
             (referenceType refType "The reference type ID.")
         )
         (Reply
-            (int modBits "Modifier bits as defined in the "
-	                 "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>")
+            (int modBits "Modifier bits as defined in Chapter 4 of "
+	                 "<cite>The Java&trade; Virtual Machine Specification</cite>")
         )
         (ErrorSet
             (Error INVALID_CLASS     "refType is not the ID of a reference "
@@ -651,8 +650,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "field declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the field as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -686,8 +685,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "method declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the method as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -773,8 +772,8 @@
     (Command Status=9
         "Returns the current status of the reference type. The status "
 	"indicates the extent to which the reference type has been "
-	"initialized, as described in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec/html/Concepts.doc.html#16491\">VM specification</a>. "
+	"initialized, as described in section 2.1.6 of "
+	"<cite>The Java&trade; Virtual Machine Specification</cite>. "
 	"If the class is linked the PREPARED and VERIFIED bits in the returned status bits "
 	"will be set. If the class is initialized the INITIALIZED bit in the returned "
 	"status bits will be set. If an error occured during initialization then the "
@@ -852,9 +851,8 @@
         "Returns the JNI signature of a reference type along with the "
         "generic signature if there is one.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
 	"<p>
 	(Out
@@ -882,9 +880,8 @@
 	"by the compiler. "
         "Fields are returned in the order they occur in the class file.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The reference type ID.")
@@ -900,8 +897,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "field declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the field as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -925,9 +922,8 @@
 	"if present, and any synthetic methods created by the compiler. "
         "Methods are returned in the order they occur in the class file.  "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The reference type ID.")
@@ -943,8 +939,8 @@
                     (int modBits "The modifier bit flags (also known as access flags) "
 		                 "which provide additional information on the  "
                                  "method declaration. Individual flag values are "
-				 "defined in the "
- 	                         "<a href=\"http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html\">VM Specification</a>."
+				 "defined in Chapter 4 of "
+ 	                         "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 				 "In addition, The <code>0xf0000000</code> bit identifies "
 				 "the method as synthetic, if the synthetic attribute "
 				 "<a href=\"#JDWP_VirtualMachine_Capabilities\">capability</a> is available.")
@@ -1006,8 +1002,8 @@
     )
     (Command ConstantPool=18
         "Return the raw bytes of the constant pool in the format of the "
-        "constant_pool item of the Class File Format in the "
-        "Java Virtual Machine Specification. "
+        "constant_pool item of the Class File Format in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "<p>Since JDWP version 1.6. Requires canGetConstantPool capability - see "
 	"<a href=\"#JDWP_VirtualMachine_CapabilitiesNew\">CapabilitiesNew</a>.""
         (Out
@@ -1016,7 +1012,8 @@
         (Reply
             (int count "Total number of constant pool entries plus one. This "
                        "corresponds to the constant_pool_count item of the "
-                       "Class File Format in the Java Virtual Machine Specification. ")
+                       "Class File Format in "
+                       "<cite>The Java&trade; Virtual Machine Specification</cite>. ")
             (Repeat bytes
                 (byte cpbytes "Raw bytes of constant pool")
             )
@@ -1324,7 +1321,8 @@
         )
     )
     (Command Bytecodes=3
-        "Retrieve the method's bytecodes as defined in the JVM Specification."
+        "Retrieve the method's bytecodes as defined in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
 	"Requires canGetBytecodes capability - see "
 	"<a href=\"#JDWP_VirtualMachine_CapabilitiesNew\">CapabilitiesNew</a>."
         (Out
@@ -1379,9 +1377,8 @@
 	"instance methods, the \"this\" reference is included in the "
 	"table. Also, synthetic variables may be present. "
 	"Generic signatures are described in the signature attribute "
-        "section in the "
-	"<a href=\"http://java.sun.com/docs/books/vmspec\">
-        "Java Virtual Machine Specification, 3rd Edition.</a>  "
+        "section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>. "
         "Since JDWP version 1.5."
         (Out
             (referenceType refType "The class.")
@@ -1970,8 +1967,9 @@
 	"<p>"
         "The method which will return early is referred to as the "
         "called method. The called method is the current method (as "
-        "defined by the Frames section in the Java Virtual Machine "
-        "Specification) for the specified thread at the time this command "
+        "defined by the Frames section in "
+        "<cite>The Java&trade; Virtual Machine Specification</cite>) "
+        "for the specified thread at the time this command "
         "is received. "
 	"<p>"
         "The specified thread must be suspended. "
--- a/jdk/make/mksample/Makefile	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/mksample/Makefile	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -38,7 +38,7 @@
 endif
 
 SUBDIRS =
-SUBDIRS_misc = nio scripting nbproject
+SUBDIRS_misc = nio scripting nbproject forkjoin
 SUBDIRS_enterprise = $(WEBSERVICES_SUBDIR)
 SUBDIRS_management = jmx
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/forkjoin/Makefile	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+#
+# Makefile for building all the samples under the forkjoin subdirectory.
+#
+
+BUILDDIR = ../..
+PRODUCT = java
+include $(BUILDDIR)/common/Defs.gmk
+
+SUBDIRS = mergesort
+include $(BUILDDIR)/common/Subdirs.gmk
+
+all build clean clobber::
+	$(SUBDIRS-loop)
+
+clobber clean ::
+	$(RM) -r $(SAMPLEDIR)/forkjoin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/forkjoin/mergesort/Makefile	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,51 @@
+#
+# 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.
+#
+
+#
+# Makefile for the forkjoin/mergesort sample code
+#
+
+BUILDDIR = ../../..
+
+PRODUCT = java
+
+include $(BUILDDIR)/common/Defs.gmk
+
+SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/forkjoin/mergesort
+SAMPLE_DST_DIR = $(SAMPLEDIR)/forkjoin/mergesort
+
+SAMPLE_FILES =							\
+	$(SAMPLE_DST_DIR)/MergeDemo.java			\
+	$(SAMPLE_DST_DIR)/MergeSort.java
+
+all build: $(SAMPLE_FILES)
+
+$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
+	$(install-file)
+
+clean clobber:
+	$(RM) -r $(SAMPLE_DST_DIR)
+
+.PHONY: all build clean clobber
--- a/jdk/make/mksample/nio/Makefile	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/make/mksample/nio/Makefile	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
@@ -31,7 +31,7 @@
 PRODUCT = java
 include $(BUILDDIR)/common/Defs.gmk
 
-SUBDIRS = file multicast server
+SUBDIRS = chatserver file multicast server
 include $(BUILDDIR)/common/Subdirs.gmk
 
 all build clean clobber::
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/mksample/nio/chatserver/Makefile	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,56 @@
+#
+# 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.
+#
+
+#
+# Makefile for the nio/chatserver sample code
+#
+
+BUILDDIR = ../../..
+
+PRODUCT = java
+
+include $(BUILDDIR)/common/Defs.gmk
+
+SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/nio/chatserver
+SAMPLE_DST_DIR = $(SAMPLEDIR)/nio/chatserver
+
+SAMPLE_FILES =							\
+	$(SAMPLE_DST_DIR)/ChatServer.java			\
+	$(SAMPLE_DST_DIR)/Client.java				\
+	$(SAMPLE_DST_DIR)/ClientReader.java			\
+	$(SAMPLE_DST_DIR)/DataReader.java			\
+	$(SAMPLE_DST_DIR)/MessageReader.java			\
+	$(SAMPLE_DST_DIR)/NameReader.java			\
+	$(SAMPLE_DST_DIR)/README.txt
+
+all build: $(SAMPLE_FILES)
+
+$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
+	$(install-file)
+
+clean clobber:
+	$(RM) -r $(SAMPLE_DST_DIR)
+
+.PHONY: all build clean clobber
--- a/jdk/src/share/bin/jli_util.h	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/bin/jli_util.h	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -35,7 +35,6 @@
 void  JLI_MemFree(void *ptr);
 int   JLI_StrCCmp(const char *s1, const char* s2);
 
-
 #define JLI_StrLen(p1)          strlen((p1))
 #define JLI_StrChr(p1, p2)      strchr((p1), (p2))
 #define JLI_StrRChr(p1, p2)     strrchr((p1), (p2))
@@ -48,6 +47,7 @@
 #define JLI_StrSpn(p1, p2)      strspn((p1), (p2))
 #define JLI_StrCSpn(p1, p2)     strcspn((p1), (p2))
 #define JLI_StrPBrk(p1, p2)     strpbrk((p1), (p2))
+#define JLI_StrTok(p1, p2)      strtok((p1), (p2))
 
 /* On Windows lseek() is in io.h rather than the location dictated by POSIX. */
 #ifdef _WIN32
--- a/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Tue Apr 26 15:48:03 2011 -0700
@@ -175,8 +175,8 @@
     /**
      * Converts the given {@code type} to the corresponding class.
      * This method implements the concept of type erasure,
-     * that is described in <a href="http://jscstage.sfbay.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.6">section 4.6</a>
-     * of Java Language Specification.
+     * that is described in section 4.6 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param type  the array of types to convert
      * @return a corresponding class
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/package.html	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/package.html	Tue Apr 26 15:48:03 2011 -0700
@@ -88,8 +88,8 @@
 http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html</a></li>
 
 <li>
-Java Virtual Machine Specification : <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html">
-http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html</a></li>
+Class File Specification: Chapter 4 of
+<em>The Java&trade; Virtual Machine Specification</em>
 
 <li>
 Hypertext Transfer Protocol -- HTTP/1.1 : <a href="http://www.ietf.org/rfc/rfc2616.txt">
--- a/jdk/src/share/classes/com/sun/jdi/Accessible.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/Accessible.java	Tue Apr 26 15:48:03 2011 -0700
@@ -42,12 +42,9 @@
      * Returns the Java<sup><font size=-2>TM</font></sup>
      * programming language modifiers, encoded in an integer.
      * <p>
-     * The modifier encodings are defined in the
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a>, in the <code>access_flag</code> tables for
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">classes</a>,
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">fields</a>, and
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">methods</a>.
+     * The modifier encodings are defined in
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * in the <code>access_flag</code> tables for classes(section 4.1), fields(section 4.5), and methods(section 4.6).
      */
     public int modifiers();
 
--- a/jdk/src/share/classes/com/sun/jdi/ArrayType.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ArrayType.java	Tue Apr 26 15:48:03 2011 -0700
@@ -77,11 +77,9 @@
      * as specified in the array declaration.
      * <P>
      * Note: The component type of a array will always be
-     * created or loaded before the array - see the
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     * Machine Specification</a>, section
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#79473">5.3.3
-     * Creating Array Classes</a>.
+     * created or loaded before the array - see
+     * <cite>The Java&trade; Virtual Machine Specification</cite>,
+     * section 5.3.3 - Creating Array Classes.
      * However, although the component type will be loaded it may
      * not yet be prepared, in which case the type will be returned
      * but attempts to perform some operations on the returned type
--- a/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassLoaderReference.java	Tue Apr 26 15:48:03 2011 -0700
@@ -71,11 +71,9 @@
      * <p>
      * No ordering of the returned list is guaranteed.
      * <p>
-     * See the revised
-     * <a href="http://java.sun.com/docs/books/vmspec/">Java
-     * Virtual Machine Specification</a> section
-     * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#72007">5.3
-     * Creation and Loading</a>
+     * See
+     * <cite>The Java&trade; Virtual Machine Specification</cite>,
+     * section 5.3 - Creation and Loading
      * for more information on the initiating classloader.
      * <p>
      * Note that unlike {@link #definedClasses()}
--- a/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassNotLoadedException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -60,9 +60,9 @@
  * is visible to the class loader of enclosing class. (That is, the
  * class loader of the enclosing class must be an <i>initiating</i> class
  * loader for the class in question.)
- * See the <a href="http://java.sun.com/docs/books/vmspec/">Java
- * Virtual Machine Specification</a> for
- * more details.
+ * See
+ * <cite>The Java&trade; Virtual Machine Specification</cite>
+ * for more details.
  *
  * @author Gordon Hirsch
  * @since  1.3
--- a/jdk/src/share/classes/com/sun/jdi/ClassType.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassType.java	Tue Apr 26 15:48:03 2011 -0700
@@ -164,10 +164,8 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See Section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, all threads in the target VM are resumed while
@@ -280,10 +278,8 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, all threads in the target VM are resumed while
--- a/jdk/src/share/classes/com/sun/jdi/LocalVariable.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/LocalVariable.java	Tue Apr 26 15:48:03 2011 -0700
@@ -102,9 +102,7 @@
     /**
      * Gets the generic signature for this variable if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/jdi/Method.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/Method.java	Tue Apr 26 15:48:03 2011 -0700
@@ -164,10 +164,8 @@
 
     /**
      * Determine if this method is a bridge method. Bridge
-     * methods are defined in the
-     * <a href="http://java.sun.com/docs/books/jls">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Language Specification, 3rd Edition.</a>
+     * methods are defined in
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @return <code>true</code> if the method is a bridge method,
      * false otherwise.
--- a/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Tue Apr 26 15:48:03 2011 -0700
@@ -118,10 +118,8 @@
      * enclosing class's class loader). Primitive values must be
      * either assignment compatible with the field type or must be
      * convertible to the field type without loss of information.
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java<sup><font size=-2>TM</font></sup> Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment
      * compatibility.
      *
@@ -182,18 +180,13 @@
      * component type is passed.  The component type can be a primitive type.
      * Autoboxing is not supported.
      *
-     * See the <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>.
-     * section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206">5.2</a>
+     * See section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
      * for more information on assignment compatibility.
      * <p>
      * By default, the method is invoked using dynamic lookup as
-     * documented in the
-     * <a href="http://java.sun.com/docs/books/jls/">
-     * Java Language Specification</a>
-     * second edition, section
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#45606">15.12.4.4</a>;
+     * documented in section 15.12.4.4 of
+     * <cite>The Java&trade; Language Specification</cite>
      * in particular, overriding based on the runtime type of the object
      * mirrored by this {@link ObjectReference} will occur. This
      * behavior can be changed by specifying the
--- a/jdk/src/share/classes/com/sun/jdi/ReferenceType.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ReferenceType.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,9 +30,8 @@
 
 /**
  * The type of an object in a target VM. ReferenceType encompasses
- * classes, interfaces, and array types as defined in the
- * <a href="http://java.sun.com/docs/books/jls/">
- * Java<sup><font size=-2>TM</font></sup> Language Specification</a>.
+ * classes, interfaces, and array types as defined in
+ * <cite>The Java&trade; Language Specification</cite>.
  * All ReferenceType objects belong to one of the following
  * subinterfaces:
  * {@link ClassType} for classes,
@@ -98,9 +97,7 @@
     /**
      * Gets the generic signature for this type if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/jdi/TypeComponent.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/TypeComponent.java	Tue Apr 26 15:48:03 2011 -0700
@@ -74,9 +74,7 @@
     /**
      * Gets the generic signature for this TypeComponent if there is one.
      * Generic signatures are described in the
-     * <a href="http://java.sun.com/docs/books/vmspec">
-     * "Java<sup><font size=-2>TM</font></sup>
-     * Virtual Machine Specification, 3rd Edition.</a>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @return a string containing the generic signature, or <code>null</code>
      * if there is no generic signature.
--- a/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java	Tue Apr 26 15:48:03 2011 -0700
@@ -25,6 +25,7 @@
 package com.sun.media.sound;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -439,10 +440,10 @@
     }
 
     public byte[] getGuid() {
-        return guid;
+        return guid == null ? null : Arrays.copyOf(guid, guid.length);
     }
 
     public void setGuid(byte[] guid) {
-        this.guid = guid;
+        this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length);
     }
 }
--- a/jdk/src/share/classes/com/sun/media/sound/DLSSample.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DLSSample.java	Tue Apr 26 15:48:03 2011 -0700
@@ -25,6 +25,7 @@
 package com.sun.media.sound;
 
 import java.io.InputStream;
+import java.util.Arrays;
 import javax.sound.midi.Soundbank;
 import javax.sound.midi.SoundbankResource;
 import javax.sound.sampled.AudioFormat;
@@ -113,10 +114,10 @@
     }
 
     public byte[] getGuid() {
-        return guid;
+        return guid == null ? null : Arrays.copyOf(guid, guid.length);
     }
 
     public void setGuid(byte[] guid) {
-        this.guid = guid;
+        this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length);
     }
 }
--- a/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java	Tue Apr 26 15:48:03 2011 -0700
@@ -24,6 +24,8 @@
  */
 package com.sun.media.sound;
 
+import java.util.Arrays;
+
 /**
  * Connection blocks are used to connect source variable
  * to a destination variable.
@@ -117,19 +119,17 @@
     }
 
     public ModelSource[] getSources() {
-        return sources;
+        return Arrays.copyOf(sources, sources.length);
     }
 
     public void setSources(ModelSource[] source) {
-        this.sources = source;
+        this.sources = source == null ? no_sources : Arrays.copyOf(source, source.length);
     }
 
     public void addSource(ModelSource source) {
         ModelSource[] oldsources = sources;
         sources = new ModelSource[oldsources.length + 1];
-        for (int i = 0; i < oldsources.length; i++) {
-            sources[i] = oldsources[i];
-        }
+        System.arraycopy(oldsources, 0, sources, 0, oldsources.length);
         sources[sources.length - 1] = source;
     }
 }
--- a/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java	Tue Apr 26 15:48:03 2011 -0700
@@ -503,7 +503,7 @@
             firstVoice = true;
             voiceNo = 0;
 
-            int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0));
+            int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0));
             play_noteNumber = noteNumber;
             play_velocity = velocity;
             play_delay = delay;
@@ -607,7 +607,7 @@
             firstVoice = true;
             voiceNo = 0;
 
-            int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0));
+            int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0));
             play_noteNumber = noteNumber;
             play_velocity = lastVelocity[noteNumber];
             play_releasetriggered = true;
@@ -632,7 +632,7 @@
         int delay = play_delay;
         boolean releasetriggered = play_releasetriggered;
 
-        SoftPerformer p = current_instrument.getPerformers()[performerIndex];
+        SoftPerformer p = current_instrument.getPerformer(performerIndex);
 
         if (firstVoice) {
             firstVoice = false;
--- a/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java	Tue Apr 26 15:48:03 2011 -0700
@@ -76,7 +76,12 @@
         return data;
     }
 
+    /* am: currently getPerformers() is not used (replaced with getPerformer(int))
     public SoftPerformer[] getPerformers() {
         return performers;
     }
+    */
+    public SoftPerformer getPerformer(int index) {
+        return performers[index];
+    }
 }
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java	Tue Apr 26 15:48:03 2011 -0700
@@ -505,7 +505,7 @@
     }
 
     public Control[] getControls() {
-        return controls;
+        return Arrays.copyOf(controls, controls.length);
     }
 
     public boolean isControlSupported(Type control) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java	Tue Apr 26 15:48:03 2011 -0700
@@ -24,6 +24,7 @@
  */
 package com.sun.media.sound;
 
+import java.util.Arrays;
 import javax.sound.midi.MidiDevice;
 import javax.sound.midi.MidiDevice.Info;
 import javax.sound.midi.spi.MidiDeviceProvider;
@@ -39,7 +40,7 @@
     private static Info[] softinfos = {softinfo};
 
     public MidiDevice.Info[] getDeviceInfo() {
-        return softinfos;
+        return Arrays.copyOf(softinfos, softinfos.length);
     }
 
     public MidiDevice getDevice(MidiDevice.Info info) {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java	Tue Apr 26 15:48:03 2011 -0700
@@ -25,6 +25,7 @@
 package com.sun.media.sound;
 
 import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
 
 import javax.sound.midi.Patch;
 
@@ -234,8 +235,10 @@
         }
     }
 
+    // am: getTuning(int) is more effective.
+    // currently getTuning() is used only by tests
     public double[] getTuning() {
-        return tuning;
+        return Arrays.copyOf(tuning, tuning.length);
     }
 
     public double getTuning(int noteNumber) {
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -111,13 +111,13 @@
      */
     private String tableName;
 
-
     /**
      * A <code>Vector</code> object containing the <code>Row</code>
      * objects that comprise  this <code>CachedRowSetImpl</code> object.
      * @serial
      */
-    private Vector rvh;
+    private Vector<Object> rvh;
+
     /**
      * The current postion of the cursor in this <code>CachedRowSetImpl</code>
      * object.
@@ -293,12 +293,12 @@
     /**
      * The Vector holding the Match Columns
      */
-       private Vector iMatchColumns;
+    private Vector<Integer> iMatchColumns;
 
     /**
      * The Vector that will hold the Match Column names.
      */
-       private Vector strMatchColumns;
+    private Vector<String> strMatchColumns;
 
     /**
      * Trigger that indicates whether the active SyncProvider is exposes the
@@ -484,7 +484,7 @@
      */
     private void initContainer() {
 
-        rvh = new Vector(100);
+        rvh = new Vector<Object>(100);
         cursorPos = 0;
         absolutePos = 0;
         numRows = 0;
@@ -523,12 +523,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -622,7 +622,7 @@
         Row currentRow;
         int numCols;
         int i;
-        Map map = getTypeMap();
+        Map<String, Class<?>> map = getTypeMap();
         Object obj;
         int mRows;
 
@@ -939,14 +939,9 @@
      */
     public void acceptChanges(Connection con) throws SyncProviderException{
 
-      try{
-         setConnection(con);
-         acceptChanges();
-      } catch (SyncProviderException spe) {
-          throw spe;
-      } catch(SQLException sqle){
-          throw new SyncProviderException(sqle.getMessage());
-      }
+      setConnection(con);
+      acceptChanges();
+
     }
 
     /**
@@ -1289,14 +1284,7 @@
      */
     public Collection<?> toCollection() throws SQLException {
 
-        TreeMap tMap;
-        int count = 0;
-        Row origRow;
-        Vector newRow;
-
-        int colCount = ((RowSetMetaDataImpl)this.getMetaData()).getColumnCount();
-
-        tMap = new TreeMap();
+        TreeMap<Integer, Object> tMap = new TreeMap<>();
 
         for (int i = 0; i<numRows; i++) {
             tMap.put(Integer.valueOf(i), rvh.get(i));
@@ -1325,10 +1313,8 @@
      */
     public Collection<?> toCollection(int column) throws SQLException {
 
-        Vector vec;
-        Row origRow;
         int nRows = numRows;
-        vec = new Vector(nRows);
+        Vector<Object> vec = new Vector<>(nRows);
 
         // create a copy
         CachedRowSetImpl crsTemp;
@@ -2953,7 +2939,7 @@
      */
     public Object getObject(int columnIndex) throws SQLException {
         Object value;
-        java.util.Map map;
+        Map<String, Class<?>> map;
 
         // sanity check.
         checkIndex(columnIndex);
@@ -7257,7 +7243,7 @@
         Row currentRow;
         int numCols;
         int i;
-        Map map = getTypeMap();
+        Map<String, Class<?>> map = getTypeMap();
         Object obj;
         int mRows;
 
@@ -7304,11 +7290,11 @@
             resultSet.absolute(start -1);
         }
         if( pageSize == 0) {
-           rvh = new Vector(getMaxRows());
+           rvh = new Vector<Object>(getMaxRows());
 
         }
         else{
-            rvh = new Vector(getPageSize());
+            rvh = new Vector<Object>(getPageSize());
         }
 
         if (data == null) {
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -93,12 +93,12 @@
     /**
      * The Vector holding the Match Columns
      */
-    private Vector iMatchColumns;
+    private Vector<Integer> iMatchColumns;
 
     /**
      * The Vector that will hold the Match Column names.
      */
-    private Vector strMatchColumns;
+    private Vector<String> strMatchColumns;
 
 
     protected transient JdbcRowSetResourceBundle resBundle;
@@ -213,12 +213,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -286,12 +286,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -373,12 +373,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -463,12 +463,12 @@
 
         //Instantiating the vector for MatchColumns
 
-        iMatchColumns = new Vector(10);
+        iMatchColumns = new Vector<Integer>(10);
         for(int i = 0; i < 10 ; i++) {
            iMatchColumns.add(i,Integer.valueOf(-1));
         }
 
-        strMatchColumns = new Vector(10);
+        strMatchColumns = new Vector<String>(10);
         for(int j = 0; j < 10; j++) {
            strMatchColumns.add(j,null);
         }
@@ -675,7 +675,7 @@
 
         try {
 
-            Map aMap = getTypeMap();
+            Map<String, Class<?>> aMap = getTypeMap();
             if( aMap != null) {
                 conn.setTypeMap(aMap);
             }
--- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -59,8 +59,8 @@
     /**
      * A <code>Vector</code> object that contains the <code>RowSet</code> objects
      * that have been added to this <code>JoinRowSet</code> object.
-         */
-    private Vector vecRowSetsInJOIN;
+     */
+    private Vector<CachedRowSetImpl> vecRowSetsInJOIN;
 
     /**
      * The <code>CachedRowSet</code> object that encapsulates this
@@ -78,13 +78,13 @@
      * for this <code>JoinRowSet</code> object.
      * The last join type set forms the basis of succeeding joins.
      */
-    private Vector vecJoinType;
+    private Vector<Integer> vecJoinType;
 
     /**
      * A <code>Vector</code> object containing the names of all the tables entering
      * the join.
      */
-    private Vector vecTableNames;
+    private Vector<String> vecTableNames;
 
     /**
      * An <code>int</code> that indicates the column index of the match column.
@@ -121,10 +121,10 @@
      */
     public JoinRowSetImpl() throws SQLException {
 
-        vecRowSetsInJOIN = new Vector();
+        vecRowSetsInJOIN = new Vector<CachedRowSetImpl>();
         crsInternal = new CachedRowSetImpl();
-        vecJoinType = new Vector();
-        vecTableNames = new Vector();
+        vecJoinType = new Vector<Integer>();
+        vecTableNames = new Vector<String>();
         iMatchKey = -1;
         strMatchKey = null;
         supportedJOINs =
@@ -222,7 +222,7 @@
            // either of the setter methods have been set.
            if(boolColId){
               //
-              ArrayList indices = new ArrayList();
+              ArrayList<Integer> indices = new ArrayList<>();
               for(int i=0;i<cRowset.getMatchColumnNames().length;i++) {
                   if( (strMatchKey = (cRowset.getMatchColumnNames())[i]) != null) {
                       iMatchKey = cRowset.findColumn(strMatchKey);
--- a/jdk/src/share/classes/java/awt/Dialog.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Dialog.java	Tue Apr 26 15:48:03 2011 -0700
@@ -903,7 +903,7 @@
             if (peer == null) {
                 addNotify();
             }
-            validate();
+            validateUnconditionally();
             if (visible) {
                 toFront();
                 retval = false;
--- a/jdk/src/share/classes/java/awt/GraphicsDevice.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java	Tue Apr 26 15:48:03 2011 -0700
@@ -243,8 +243,10 @@
      * a non-client of the input method framework.
      * </ul>
      * <p>
-     * Simulated full-screen mode resizes
-     * the window to the size of the screen and positions it at (0,0).
+     * The simulated full-screen mode places and resizes the window to the maximum
+     * possible visible area of the screen. However, the native windowing system
+     * may modify the requested geometry-related data, so that the {@code Window} object
+     * is placed and sized in a way that corresponds closely to the desktop settings.
      * <p>
      * When entering full-screen mode, if the window to be used as a
      * full-screen window is not visible, this method will make it visible.
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Tue Apr 26 15:48:03 2011 -0700
@@ -466,6 +466,10 @@
      */
     protected void loadSystemColors(int[] systemColors)
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
+
     }
 
 /**
@@ -500,6 +504,10 @@
      */
     public void setDynamicLayout(boolean dynamic)
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
+
     }
 
     /**
@@ -523,6 +531,9 @@
      */
     protected boolean isDynamicLayoutSet()
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().isDynamicLayoutSet();
         } else {
@@ -558,6 +569,9 @@
      */
     public boolean isDynamicLayoutActive()
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().isDynamicLayoutActive();
         } else {
@@ -601,6 +615,9 @@
      */
     public Insets getScreenInsets(GraphicsConfiguration gc)
         throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().getScreenInsets(gc);
         } else {
@@ -1342,6 +1359,9 @@
      * @since 1.4
      */
     public Clipboard getSystemSelection() throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().getSystemSelection();
         } else {
@@ -1371,6 +1391,10 @@
      * @since     JDK1.1
      */
     public int getMenuShortcutKeyMask() throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
+
         return Event.CTRL_MASK;
     }
 
@@ -1499,6 +1523,9 @@
      */
     public Dimension getBestCursorSize(int preferredWidth,
         int preferredHeight) throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         // Override to implement custom cursor support.
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().
@@ -1526,6 +1553,9 @@
      * @since     1.2
      */
     public int getMaximumCursorColors() throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         // Override to implement custom cursor support.
         if (this != Toolkit.getDefaultToolkit()) {
             return Toolkit.getDefaultToolkit().getMaximumCursorColors();
@@ -2561,8 +2591,6 @@
     * initialized with {@code true}.
     * Changing this value after the {@code Toolkit} class initialization will have no effect.
     * <p>
-    * The current value could be queried by using the
-    * {@code System.getProperty("sun.awt.enableExtraMouseButtons")} method.
     * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
     * @return {@code true} if events from extra mouse buttons are allowed to be processed and posted;
     *         {@code false} otherwise
@@ -2572,6 +2600,9 @@
     * @since 1.7
      */
     public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
+        if (GraphicsEnvironment.isHeadless()){
+            throw new HeadlessException();
+        }
         return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled();
     }
 }
--- a/jdk/src/share/classes/java/awt/Window.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Window.java	Tue Apr 26 15:48:03 2011 -0700
@@ -870,6 +870,11 @@
      * are automatically enlarged if either is less than
      * the minimum size as specified by previous call to
      * {@code setMinimumSize}.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @see #getSize
      * @see #setBounds
@@ -887,6 +892,11 @@
      * are automatically enlarged if either is less than
      * the minimum size as specified by previous call to
      * {@code setMinimumSize}.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @see #getSize
      * @see #setBounds
@@ -898,6 +908,32 @@
     }
 
     /**
+     * {@inheritDoc}
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
+     */
+    @Override
+    public void setLocation(int x, int y) {
+        super.setLocation(x, y);
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
+     */
+    @Override
+    public void setLocation(Point p) {
+        super.setLocation(p);
+    }
+
+    /**
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setBounds(int, int, int, int)</code>.
      */
@@ -3147,6 +3183,11 @@
      * placed at the left side of the screen. The similar placement
      * will occur if both top and bottom edges are out of the screen.
      * In that case, the window is placed at the top side of the screen.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @param c  the component in relation to which the window's location
      *           is determined
@@ -3395,6 +3436,11 @@
      * are automatically enlarged if either is less than
      * the minimum size as specified by previous call to
      * {@code setMinimumSize}.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @see #getBounds
      * @see #setLocation(int, int)
@@ -3424,6 +3470,11 @@
      * will be automatically enlarged if either is less than
      * the minimum size as specified by previous call to
      * {@code setMinimumSize}.
+     * <p>
+     * The method changes the geometry-related data. Therefore,
+     * the native windowing system may ignore such requests, or it may modify
+     * the requested data, so that the {@code Window} object is placed and sized
+     * in a way that corresponds closely to the desktop settings.
      *
      * @see #getBounds
      * @see #setLocation(int, int)
--- a/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Tue Apr 26 15:48:03 2011 -0700
@@ -40,10 +40,9 @@
 <a name="Autoshutdown"></a>
 <h2>Auto-shutdown</h2>
 
-According to <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html"><i>The 
-Java</i><sup><small>TM</small></sup> <i>Virtual Machine Specification,
-Second edition</i></a> (see <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#19152">§2.17.9</a>
-and <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#33308">§2.19</a>),
+According to
+<cite>The Java&trade; Virtual Machine Specification</cite>,
+sections 2.17.9 and 2.19,
 the Java virtual machine (JVM) initially starts up with a single non-daemon
 thread, which typically calls the <code>main</code> method of some class.
 The virtual machine terminates all its activity and exits when
@@ -183,7 +182,8 @@
         <...>
 </pre>
 
-The Java Virtual Machine Specification guarantees
+<cite>The Java&trade; Virtual Machine Specification</cite>
+ guarantees
 that the JVM doesn't exit until this thread terminates.
 </body>
 </html>
--- a/jdk/src/share/classes/java/io/Console.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/io/Console.java	Tue Apr 26 15:48:03 2011 -0700
@@ -148,8 +148,8 @@
     *         extra arguments are ignored.  The number of arguments is
     *         variable and may be zero.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.  The behaviour on a
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+    *         The behaviour on a
     *         <tt>null</tt> argument depends on the <a
     *         href="../util/Formatter.html#syntax">conversion</a>.
     *
@@ -187,8 +187,8 @@
     *         extra arguments are ignored.  The number of arguments is
     *         variable and may be zero.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.  The behaviour on a
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+    *         The behaviour on a
     *         <tt>null</tt> argument depends on the <a
     *         href="../util/Formatter.html#syntax">conversion</a>.
     *
@@ -220,8 +220,7 @@
     *         string.  If there are more arguments than format specifiers, the
     *         extra arguments are ignored.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
     *
     * @throws  IllegalFormatException
     *          If a format string contains an illegal syntax, a format
@@ -285,8 +284,7 @@
     *         string.  If there are more arguments than format specifiers, the
     *         extra arguments are ignored.  The maximum number of arguments is
     *         limited by the maximum dimension of a Java array as defined by
-    *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-    *         Virtual Machine Specification</a>.
+    *         <cite>The Java&trade; Virtual Machine Specification</cite>.
     *
     * @throws  IllegalFormatException
     *          If a format string contains an illegal syntax, a format
--- a/jdk/src/share/classes/java/io/PrintStream.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/io/PrintStream.java	Tue Apr 26 15:48:03 2011 -0700
@@ -846,8 +846,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -896,8 +896,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -939,8 +939,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -996,8 +996,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
--- a/jdk/src/share/classes/java/io/PrintWriter.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/io/PrintWriter.java	Tue Apr 26 15:48:03 2011 -0700
@@ -779,8 +779,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -830,8 +830,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -874,8 +874,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -934,8 +934,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
--- a/jdk/src/share/classes/java/lang/AssertionError.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/AssertionError.java	Tue Apr 26 15:48:03 2011 -0700
@@ -34,11 +34,9 @@
  *     new AssertionError(<i>expression</i>)
  * </pre>
  * has as its detail message the <i>string conversion</i> of
- * <i>expression</i> (as defined in <a
- * href="http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html">
- * <i>The Java Language Specification, Second Edition</i></a>,
- * <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#40220">
- * Section  15.18.1.1</a>), regardless of the type of <i>expression</i>.
+ * <i>expression</i> (as defined in section 15.18.1.1 of
+ * <cite>The Java&trade; Language Specification</cite>),
+ * regardless of the type of <i>expression</i>.
  *
  * @since   1.4
  */
@@ -63,8 +61,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified object, which is converted to a string as
-     * defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *<p>
      * If the specified object is an instance of {@code Throwable}, it
      * becomes the <i>cause</i> of the newly constructed assertion error.
@@ -81,8 +79,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>boolean</code>, which is converted to
-     * a string as defined in <i>The Java Language Specification,
-     * Second Edition</i>, Section 15.18.1.1.
+     * a string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -93,8 +91,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>char</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -105,8 +103,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>int</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -117,8 +115,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>long</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -129,8 +127,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>float</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
@@ -141,8 +139,8 @@
     /**
      * Constructs an AssertionError with its detail message derived
      * from the specified <code>double</code>, which is converted to a
-     * string as defined in <i>The Java Language Specification, Second
-     * Edition</i>, Section 15.18.1.1.
+     * string as defined in section 15.18.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @param detailMessage value to be used in constructing detail message
      */
--- a/jdk/src/share/classes/java/lang/Byte.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Byte.java	Tue Apr 26 15:48:03 2011 -0700
@@ -251,9 +251,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Character.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Character.java	Tue Apr 26 15:48:03 2011 -0700
@@ -4182,9 +4182,11 @@
             aliases.put("AVST", AVESTAN);
             aliases.put("BALI", BALINESE);
             aliases.put("BAMU", BAMUM);
+            aliases.put("BATK", BATAK);
             aliases.put("BENG", BENGALI);
             aliases.put("BOPO", BOPOMOFO);
             aliases.put("BRAI", BRAILLE);
+            aliases.put("BRAH", BRAHMI);
             aliases.put("BUGI", BUGINESE);
             aliases.put("BUHD", BUHID);
             aliases.put("CANS", CANADIAN_ABORIGINAL);
@@ -4228,6 +4230,7 @@
             aliases.put("LISU", LISU);
             aliases.put("LYCI", LYCIAN);
             aliases.put("LYDI", LYDIAN);
+            aliases.put("MAND", MANDAIC);
             aliases.put("MLYM", MALAYALAM);
             aliases.put("MONG", MONGOLIAN);
             aliases.put("MTEI", MEETEI_MAYEK);
--- a/jdk/src/share/classes/java/lang/Class.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Class.java	Tue Apr 26 15:48:03 2011 -0700
@@ -95,8 +95,8 @@
  * </pre></blockquote>
  *
  * <p> It is also possible to get the {@code Class} object for a named
- * type (or for void) using a class literal
- * (JLS Section <A HREF="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251530">15.8.2</A>).
+ * type (or for void) using a class literal.  See Section 15.8.2 of
+ * <cite>The Java&trade; Language Specification</cite>.
  * For example:
  *
  * <p> <blockquote>
@@ -521,7 +521,8 @@
      *
      * <p> If this class object represents a reference type that is not an
      * array type then the binary name of the class is returned, as specified
-     * by the Java Language Specification, Second Edition.
+     * by
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * <p> If this class object represents a primitive type or void, then the
      * name returned is a {@code String} equal to the Java language
@@ -630,8 +631,8 @@
      *     the type variables declared by this generic declaration
      * @throws java.lang.reflect.GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Class<T>>[] getTypeParameters() {
@@ -675,8 +676,8 @@
      * returned.
      *
      * @throws java.lang.reflect.GenericSignatureFormatError if the generic
-     *     class signature does not conform to the format specified in the
-     *     Java Virtual Machine Specification, 3rd edition
+     *     class signature does not conform to the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the generic superclass
      *     refers to a non-existent type declaration
      * @throws java.lang.reflect.MalformedParameterizedTypeException if the
@@ -798,7 +799,8 @@
      *
      * @throws java.lang.reflect.GenericSignatureFormatError
      *     if the generic class signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the generic
      *     superinterfaces refers to a non-existent type declaration
      * @throws java.lang.reflect.MalformedParameterizedTypeException
--- a/jdk/src/share/classes/java/lang/ClassLoader.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java	Tue Apr 26 15:48:03 2011 -0700
@@ -160,8 +160,8 @@
  * <h4> <a name="name">Binary names</a> </h4>
  *
  * <p> Any class name provided as a {@link String} parameter to methods in
- * <tt>ClassLoader</tt> must be a binary name as defined by the <a
- * href="http://java.sun.com/docs/books/jls/">Java Language Specification</a>.
+ * <tt>ClassLoader</tt> must be a binary name as defined by
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * <p> Examples of valid class names include:
  * <blockquote><pre>
@@ -531,9 +531,8 @@
      * @param  b
      *         The bytes that make up the class data.  The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -597,9 +596,8 @@
      * @param  b
      *         The bytes that make up the class data.  The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -748,9 +746,8 @@
      * @param  b
      *         The bytes that make up the class data. The bytes in positions
      *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
-     *         of a valid class file as defined by the <a
-     *         href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         of a valid class file as defined by
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
      *         The start offset in <tt>b</tt> of the class data
@@ -838,8 +835,7 @@
      *         The bytes that make up the class data. The bytes from positions
      *         <tt>b.position()</tt> through <tt>b.position() + b.limit() -1
      *         </tt> should have the format of a valid class file as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *         Machine Specification</a>.
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  protectionDomain
      *         The ProtectionDomain of the class, or <tt>null</tt>.
@@ -998,9 +994,8 @@
      * Links the specified class.  This (misleadingly named) method may be
      * used by a class loader to link a class.  If the class <tt>c</tt> has
      * already been linked, then this method simply returns. Otherwise, the
-     * class is linked as described in the "Execution" chapter of the <a
-     * href="http://java.sun.com/docs/books/jls/">Java Language
-     * Specification</a>.
+     * class is linked as described in the "Execution" chapter of
+     * <cite>The Java&trade; Language Specification</cite>.
      * </p>
      *
      * @param  c
@@ -2034,8 +2029,8 @@
      *         The name of the package whose package default assertion status
      *         is to be set. A <tt>null</tt> value indicates the unnamed
      *         package that is "current"
-     *         (<a href="http://java.sun.com/docs/books/jls/">Java Language
-     *         Specification</a>, section 7.4.2).
+     *         (see section 7.4.2 of
+     *         <cite>The Java&trade; Language Specification</cite>.)
      *
      * @param  enabled
      *         <tt>true</tt> if classes loaded by this classloader and
--- a/jdk/src/share/classes/java/lang/Double.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Double.java	Tue Apr 26 15:48:03 2011 -0700
@@ -392,9 +392,10 @@
      * where <i>Sign</i>, <i>FloatingPointLiteral</i>,
      * <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
      * <i>FloatTypeSuffix</i> are as defined in the lexical structure
-     * sections of the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>. If {@code s} does not have the form of
+     * sections of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
+     * If {@code s} does not have the form of
      * a <i>FloatValue</i>, then a {@code NumberFormatException}
      * is thrown. Otherwise, {@code s} is regarded as
      * representing an exact decimal value in the usual
@@ -464,8 +465,8 @@
      *       // Since this method allows integer-only strings as input
      *       // in addition to strings of floating-point literals, the
      *       // two sub-patterns below are simplifications of the grammar
-     *       // productions from the Java Language Specification, 2nd
-     *       // edition, section 3.10.2.
+     *       // productions from section 3.10.2 of
+     *       // <cite>The Java&trade; Language Specification</cite>.
      *
      *       // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
      *       "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
--- a/jdk/src/share/classes/java/lang/Enum.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Enum.java	Tue Apr 26 15:48:03 2011 -0700
@@ -36,9 +36,8 @@
  *
  * More information about enums, including descriptions of the
  * implicitly declared methods synthesized by the compiler, can be
- * found in <i>The Java&trade; Language Specification, Third
- * Edition</i>, <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9">&sect;8.9</a>.
+ * found in section 8.9 of
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * <p> Note that when using an enumeration type as the type of a set
  * or as the type of the keys in a map, specialized and efficient
--- a/jdk/src/share/classes/java/lang/Error.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Error.java	Tue Apr 26 15:48:03 2011 -0700
@@ -43,7 +43,7 @@
  *
  * @author  Frank Yellin
  * @see     java.lang.ThreadDeath
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class Error extends Throwable {
--- a/jdk/src/share/classes/java/lang/Exception.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Exception.java	Tue Apr 26 15:48:03 2011 -0700
@@ -39,7 +39,7 @@
  *
  * @author  Frank Yellin
  * @see     java.lang.Error
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class Exception extends Throwable {
--- a/jdk/src/share/classes/java/lang/Float.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Float.java	Tue Apr 26 15:48:03 2011 -0700
@@ -353,9 +353,10 @@
      * where <i>Sign</i>, <i>FloatingPointLiteral</i>,
      * <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
      * <i>FloatTypeSuffix</i> are as defined in the lexical structure
-     * sections of the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>. If {@code s} does not have the form of
+     * sections of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
+     * If {@code s} does not have the form of
      * a <i>FloatValue</i>, then a {@code NumberFormatException}
      * is thrown. Otherwise, {@code s} is regarded as
      * representing an exact decimal value in the usual
--- a/jdk/src/share/classes/java/lang/Integer.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Integer.java	Tue Apr 26 15:48:03 2011 -0700
@@ -918,9 +918,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Long.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Long.java	Tue Apr 26 15:48:03 2011 -0700
@@ -598,9 +598,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/Math.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Math.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -627,11 +627,9 @@
     }
 
     /**
-     * Returns the closest {@code int} to the argument. The
-     * result is rounded to an integer by adding 1/2, taking the
-     * floor of the result, and casting the result to type {@code int}.
-     * In other words, the result is equal to the value of the expression:
-     * <p>{@code (int)Math.floor(a + 0.5f)}
+     * Returns the closest {@code int} to the argument, with ties
+     * rounding up.
+     *
      * <p>
      * Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -649,17 +647,17 @@
      * @see     java.lang.Integer#MIN_VALUE
      */
     public static int round(float a) {
-        return (int)floor(a + 0.5f);
+        if (a != 0x1.fffffep-2f) // greatest float value less than 0.5
+            return (int)floor(a + 0.5f);
+        else
+            return 0;
     }
 
     /**
-     * Returns the closest {@code long} to the argument. The result
-     * is rounded to an integer by adding 1/2, taking the floor of the
-     * result, and casting the result to type {@code long}. In other
-     * words, the result is equal to the value of the expression:
-     * <p>{@code (long)Math.floor(a + 0.5d)}
-     * <p>
-     * Special cases:
+     * Returns the closest {@code long} to the argument, with ties
+     * rounding up.
+     *
+     * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
      * <li>If the argument is negative infinity or any value less than or
      * equal to the value of {@code Long.MIN_VALUE}, the result is
@@ -676,7 +674,10 @@
      * @see     java.lang.Long#MIN_VALUE
      */
     public static long round(double a) {
-        return (long)floor(a + 0.5d);
+        if (a != 0x1.fffffffffffffp-2) // greatest double value less than 0.5
+            return (long)floor(a + 0.5d);
+        else
+            return 0;
     }
 
     private static Random randomNumberGenerator;
--- a/jdk/src/share/classes/java/lang/Object.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Object.java	Tue Apr 26 15:48:03 2011 -0700
@@ -58,9 +58,8 @@
      *
      * @return The {@code Class} object that represents the runtime
      *         class of this object.
-     * @see    <a href="http://java.sun.com/docs/books/jls/">The Java
-     *         Language Specification, Third Edition (15.8.2 Class
-     *         Literals)</a>
+     * @see    Class Literals, section 15.8.2 of
+     *         <cite>The Java&trade; Language Specification</cite>.
      */
     public final native Class<?> getClass();
 
--- a/jdk/src/share/classes/java/lang/Override.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Override.java	Tue Apr 26 15:48:03 2011 -0700
@@ -43,7 +43,7 @@
  *
  * @author  Peter von der Ah&eacute;
  * @author  Joshua Bloch
- * @jls3 9.6.1.4 Override
+ * @jls 9.6.1.4 Override
  * @since 1.5
  */
 @Target(ElementType.METHOD)
--- a/jdk/src/share/classes/java/lang/Package.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Package.java	Tue Apr 26 15:48:03 2011 -0700
@@ -109,10 +109,9 @@
     /**
      * Return the name of this package.
      *
-     * @return  The fully-qualified name of this package as defined in the
-     *          <em>Java Language Specification, Third Edition</em>
-     *          <a href="http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.5.3">
-     *          &sect;6.5.3</a>, for example, {@code java.lang}
+     * @return  The fully-qualified name of this package as defined in section 6.5.3 of
+     *          <cite>The Java&trade; Language Specification</cite>,
+     *          for example, {@code java.lang}
      */
     public String getName() {
         return pkgName;
--- a/jdk/src/share/classes/java/lang/RuntimeException.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/RuntimeException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -37,7 +37,7 @@
  * propagate outside the method or constructor boundary.
  *
  * @author  Frank Yellin
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since   JDK1.0
  */
 public class RuntimeException extends Exception {
--- a/jdk/src/share/classes/java/lang/SafeVarargs.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/SafeVarargs.java	Tue Apr 26 15:48:03 2011 -0700
@@ -70,8 +70,8 @@
  *
  * </ul>
  *
- * @jls3 4.7 Reifiable Types
- * @jls3 8.4.1 Formal Parameters
+ * @jls 4.7 Reifiable Types
+ * @jls 8.4.1 Formal Parameters
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
--- a/jdk/src/share/classes/java/lang/Short.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Short.java	Tue Apr 26 15:48:03 2011 -0700
@@ -256,9 +256,9 @@
      * </blockquote>
      *
      * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
-     * are defined in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">&sect;3.10.1</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a>.
+     * are as defined in section 3.10.1 of
+     * <cite>The Java&trade; Language Specification</cite>,
+     * except that underscores are not accepted between digits.
      *
      * <p>The sequence of characters following an optional
      * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
--- a/jdk/src/share/classes/java/lang/StrictMath.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/StrictMath.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -613,11 +613,8 @@
     public static native double pow(double a, double b);
 
     /**
-     * Returns the closest {@code int} to the argument. The
-     * result is rounded to an integer by adding 1/2, taking the
-     * floor of the result, and casting the result to type {@code int}.
-     * In other words, the result is equal to the value of the expression:
-     * <p>{@code (int)Math.floor(a + 0.5f)}
+     * Returns the closest {@code int} to the argument, with ties
+     * rounding up.
      *
      * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -635,15 +632,12 @@
      * @see     java.lang.Integer#MIN_VALUE
      */
     public static int round(float a) {
-        return (int)floor(a + 0.5f);
+        return Math.round(a);
     }
 
     /**
-     * Returns the closest {@code long} to the argument. The result
-     * is rounded to an integer by adding 1/2, taking the floor of the
-     * result, and casting the result to type {@code long}. In other
-     * words, the result is equal to the value of the expression:
-     * <p>{@code (long)Math.floor(a + 0.5d)}
+     * Returns the closest {@code long} to the argument, with ties
+     * rounding up.
      *
      * <p>Special cases:
      * <ul><li>If the argument is NaN, the result is 0.
@@ -662,7 +656,7 @@
      * @see     java.lang.Long#MIN_VALUE
      */
     public static long round(double a) {
-        return (long)floor(a + 0.5d);
+        return Math.round(a);
     }
 
     private static Random randomNumberGenerator;
--- a/jdk/src/share/classes/java/lang/String.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/String.java	Tue Apr 26 15:48:03 2011 -0700
@@ -2819,8 +2819,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -2863,8 +2863,8 @@
      *         extra arguments are ignored.  The number of arguments is
      *         variable and may be zero.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.  The behaviour on a
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
+     *         The behaviour on a
      *         <tt>null</tt> argument depends on the <a
      *         href="../util/Formatter.html#syntax">conversion</a>.
      *
@@ -3066,9 +3066,8 @@
      * if and only if <code>s.equals(t)</code> is <code>true</code>.
      * <p>
      * All literal strings and string-valued constant expressions are
-     * interned. String literals are defined in &sect;3.10.5 of the
-     * <a href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>
+     * interned. String literals are defined in section 3.10.5 of the
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * @return  a string that has the same contents as this string, but is
      *          guaranteed to be from a pool of unique strings.
--- a/jdk/src/share/classes/java/lang/Throwable.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Tue Apr 26 15:48:03 2011 -0700
@@ -108,7 +108,7 @@
  * @author  unascribed
  * @author  Josh Bloch (Added exception chaining and programmatic access to
  *          stack trace in 1.4.)
- * @jls3 11.2 Compile-Time Checking of Exceptions
+ * @jls 11.2 Compile-Time Checking of Exceptions
  * @since JDK1.0
  */
 public class Throwable implements Serializable {
--- a/jdk/src/share/classes/java/lang/annotation/Annotation.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/annotation/Annotation.java	Tue Apr 26 15:48:03 2011 -0700
@@ -31,9 +31,8 @@
  * an annotation type.  Also note that this interface does not itself
  * define an annotation type.
  *
- * More information about annotation types can be found in <i>The
- * Java&trade; Language Specification, Third Edition</i>, <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6">&sect;9.6</a>.
+ * More information about annotation types can be found in section 9.6 of
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * @author  Josh Bloch
  * @since   1.5
--- a/jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/instrument/ClassFileTransformer.java	Tue Apr 26 15:48:03 2011 -0700
@@ -36,9 +36,9 @@
  * to transform class files.
  * The transformation occurs before the class is defined by the JVM.
  * <P>
- * Note the term <i>class file</i> is used as defined in the chapter
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#80959">The class File Format</a>
- * of <i>The Java Virtual Machine Specification</i>, to mean a sequence
+ * Note the term <i>class file</i> is used as defined in section 3.1 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>,
+ * to mean a sequence
  * of bytes in class file format, whether or not they reside in a file.
  *
  * @see     java.lang.instrument.Instrumentation
--- a/jdk/src/share/classes/java/lang/instrument/Instrumentation.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/instrument/Instrumentation.java	Tue Apr 26 15:48:03 2011 -0700
@@ -434,8 +434,9 @@
      * avoiding these types of issues, is to use a unique package name for the
      * instrumentation classes.
      *
-     * <p> The <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a> specifies that a subsequent attempt to resolve a symbolic
+     * <p>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * specifies that a subsequent attempt to resolve a symbolic
      * reference that the Java virtual machine has previously unsuccessfully attempted
      * to resolve always fails with the same error that was thrown as a result of the
      * initial resolution attempt. Consequently, if the JAR file contains an entry
@@ -487,8 +488,9 @@
      * getName()} method on the <code>jarfile</code> and this is provided as the
      * parameter to the <code>appendToClassPathForInstrumentation</code> method.
      *
-     * <p> The <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
-     * Specification</a> specifies that a subsequent attempt to resolve a symbolic
+     * <p>
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
+     * specifies that a subsequent attempt to resolve a symbolic
      * reference that the Java virtual machine has previously unsuccessfully attempted
      * to resolve always fails with the same error that was thrown as a result of the
      * initial resolution attempt. Consequently, if the JAR file contains an entry
--- a/jdk/src/share/classes/java/lang/invoke/package-info.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/package-info.java	Tue Apr 26 15:48:03 2011 -0700
@@ -194,8 +194,8 @@
  * Method handle constants for subtags {@code REF_getStatic}, {@code REF_putStatic}, and {@code REF_invokeStatic}
  * may force class initialization on their first invocation, just like the corresponding bytecodes.
  * <p>
- * The rules of section 5.4.3 of the
- * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ConstantPool.doc.html#73492">JVM Specification</a>
+ * The rules of section 5.4.3 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>
  * apply to the resolution of {@code CONSTANT_MethodType}, {@code CONSTANT_MethodHandle},
  * and {@code CONSTANT_InvokeDynamic} constants,
  * by the execution of {@code invokedynamic} and {@code ldc} instructions.
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java	Tue Apr 26 15:48:03 2011 -0700
@@ -186,8 +186,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Constructor<T>>[] getTypeParameters() {
@@ -229,7 +229,8 @@
      *     parameter types of the underlying method, in declaration order
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the parameter
      *     types of the underlying method refers to a non-existent type
      *     declaration
@@ -273,7 +274,8 @@
      *     thrown by the underlying method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     {@code throws} clause refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if
@@ -468,8 +470,8 @@
      *
      * <p>If the constructor's declaring class is an inner class in a
      * non-static context, the first argument to the constructor needs
-     * to be the enclosing instance; see <i>The Java Language
-     * Specification</i>, section 15.9.3.
+     * to be the enclosing instance; see section 15.9.3 of
+     * <cite>The Java&trade; Language Specification</cite>.
      *
      * <p>If the required access and argument checks succeed and the
      * instantiation will proceed, the constructor's declaring class
@@ -541,7 +543,8 @@
      * constructor; returns {@code false} otherwise.
      *
      * @return true if and only if this constructor is a synthetic
-     * constructor as defined by the Java Language Specification.
+     * constructor as defined by
+     * <cite>The Java&trade; Language Specification</cite>.
      * @since 1.5
      */
     public boolean isSynthetic() {
--- a/jdk/src/share/classes/java/lang/reflect/Field.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java	Tue Apr 26 15:48:03 2011 -0700
@@ -221,8 +221,8 @@
      * @return a {@code Type} object that represents the declared type for
      *     the field represented by this {@code Field} object
      * @throws GenericSignatureFormatError if the generic field
-     *     signature does not conform to the format specified in the Java
-     *     Virtual Machine Specification, 3rd edition
+     *     signature does not conform to the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the generic type
      *     signature of the underlying field refers to a non-existent
      *     type declaration
--- a/jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/GenericDeclaration.java	Tue Apr 26 15:48:03 2011 -0700
@@ -42,8 +42,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      */
     public TypeVariable<?>[] getTypeParameters();
 }
--- a/jdk/src/share/classes/java/lang/reflect/Method.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java	Tue Apr 26 15:48:03 2011 -0700
@@ -194,8 +194,8 @@
      *     the type variables declared by this generic declaration
      * @throws GenericSignatureFormatError if the generic
      *     signature of this generic declaration does not conform to
-     *     the format specified in the Java Virtual Machine Specification,
-     *     3rd edition
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @since 1.5
      */
     public TypeVariable<Method>[] getTypeParameters() {
@@ -230,7 +230,8 @@
      *     type of the underlying  method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     return type refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if the
@@ -275,7 +276,8 @@
      *     parameter types of the underlying method, in declaration order
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if any of the parameter
      *     types of the underlying method refers to a non-existent type
      *     declaration
@@ -319,7 +321,8 @@
      *     thrown by the underlying method
      * @throws GenericSignatureFormatError
      *     if the generic method signature does not conform to the format
-     *     specified in the Java Virtual Machine Specification, 3rd edition
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
      * @throws TypeNotPresentException if the underlying method's
      *     {@code throws} clause refers to a non-existent type declaration
      * @throws MalformedParameterizedTypeException if
--- a/jdk/src/share/classes/java/lang/reflect/Modifier.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Modifier.java	Tue Apr 26 15:48:03 2011 -0700
@@ -34,14 +34,8 @@
  * constants to decode class and member access modifiers.  The sets of
  * modifiers are represented as integers with distinct bit positions
  * representing different modifiers.  The values for the constants
- * representing the modifiers are taken from <a
- * href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html"><i>The
- * Java</i><sup><small>TM</small></sup> <i>Virtual Machine Specification, Second
- * edition</i></a> tables
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">4.1</a>,
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">4.4</a>,
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">4.5</a>, and
- * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88478">4.7</a>.
+ * representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of
+ * <cite>The Java&trade; Virtual Machine Specification</cite>.
  *
  * @see Class#getModifiers()
  * @see Member#getModifiers()
@@ -214,14 +208,8 @@
      *    public final synchronized strictfp
      * </pre></blockquote>
      * The modifier names are returned in an order consistent with the
-     * suggested modifier orderings given in <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html"><em>The
-     * Java Language Specification, Second Edition</em></a> sections
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#21613">&sect;8.1.1</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78091">&sect;8.3.1</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78188">&sect;8.4.3</a>,
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#42018">&sect;8.8.3</a>, and
-     * <a href="http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html#235947">&sect;9.1.1</a>.
+     * suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of
+     * <cite>The Java&trade; Language Specification</cite>.
      * The full modifier ordering used by this method is:
      * <blockquote> {@code
      * public protected private abstract static final transient
@@ -269,9 +257,8 @@
     }
 
     /*
-     * Access modifier flag constants from <em>The Java Virtual
-     * Machine Specification, Second Edition</em>, tables 4.1, 4.4,
-     * 4.5, and 4.7.
+     * Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of
+     * <cite>The Java&trade; Virtual Machine Specification</cite>
      */
 
     /**
@@ -403,7 +390,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a class.
      *
-     * @jls3 8.1.1 Class Modifiers
+     * @jls 8.1.1 Class Modifiers
      * @since 1.7
      */
     public static int classModifiers() {
@@ -416,7 +403,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to an inteface.
      *
-     * @jls3 9.1.1 Interface Modifiers
+     * @jls 9.1.1 Interface Modifiers
      * @since 1.7
      */
     public static int interfaceModifiers() {
@@ -429,7 +416,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a constructor.
      *
-     * @jls3 8.8.3 Constructor Modifiers
+     * @jls 8.8.3 Constructor Modifiers
      * @since 1.7
      */
     public static int constructorModifiers() {
@@ -442,7 +429,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a method.
      *
-     * @jls3 8.4.3 Method Modifiers
+     * @jls 8.4.3 Method Modifiers
      * @since 1.7
      */
     public static int methodModifiers() {
@@ -456,7 +443,7 @@
      * @return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a field.
      *
-     * @jls3 8.3.1 Field Modifiers
+     * @jls 8.3.1 Field Modifiers
      * @since 1.7
      */
     public static int fieldModifiers() {
--- a/jdk/src/share/classes/java/math/BigDecimal.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/math/BigDecimal.java	Tue Apr 26 15:48:03 2011 -0700
@@ -2905,12 +2905,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code BigInteger}.
-     * This conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code long} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code long} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded.  Note that this
      * conversion can lose information about the precision of the
      * {@code BigDecimal} value.
@@ -2942,13 +2941,12 @@
     }
 
     /**
-     * Converts this {@code BigDecimal} to a {@code long}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code short} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * Converts this {@code BigDecimal} to a {@code long}.
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code short} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
      * "{@code BigInteger}" is too big to fit in a
      * {@code long}, only the low-order 64 bits are returned.
@@ -3011,13 +3009,12 @@
     }
 
     /**
-     * Converts this {@code BigDecimal} to an {@code int}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code short} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: any fractional part of this
+     * Converts this {@code BigDecimal} to an {@code int}.
+     * This conversion is analogous to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code short} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
      * "{@code BigInteger}" is too big to fit in an
      * {@code int}, only the low-order 32 bits are returned.
@@ -3095,12 +3092,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code float}.
-     * This conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this {@code BigDecimal} has too great a
+     * This conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this {@code BigDecimal} has too great a
      * magnitude to represent as a {@code float}, it will be
      * converted to {@link Float#NEGATIVE_INFINITY} or {@link
      * Float#POSITIVE_INFINITY} as appropriate.  Note that even when
@@ -3119,12 +3115,11 @@
 
     /**
      * Converts this {@code BigDecimal} to a {@code double}.
-     * This conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this {@code BigDecimal} has too great a
+     * This conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this {@code BigDecimal} has too great a
      * magnitude represent as a {@code double}, it will be
      * converted to {@link Double#NEGATIVE_INFINITY} or {@link
      * Double#POSITIVE_INFINITY} as appropriate.  Note that even when
--- a/jdk/src/share/classes/java/math/BigInteger.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Tue Apr 26 15:48:03 2011 -0700
@@ -2719,12 +2719,11 @@
 
     /**
      * Converts this BigInteger to an {@code int}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code long} to
-     * {@code int} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger is too big to fit in an
+     * conversion is analogous to a
+     * <i>narrowing primitive conversion</i> from {@code long} to
+     * {@code int} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger is too big to fit in an
      * {@code int}, only the low-order 32 bits are returned.
      * Note that this conversion can lose information about the
      * overall magnitude of the BigInteger value as well as return a
@@ -2740,12 +2739,11 @@
 
     /**
      * Converts this BigInteger to a {@code long}.  This
-     * conversion is analogous to a <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code long} to
-     * {@code int} as defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger is too big to fit in a
+     * conversion is analogous to a
+     * <i>narrowing primitive conversion</i> from {@code long} to
+     * {@code int} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger is too big to fit in a
      * {@code long}, only the low-order 64 bits are returned.
      * Note that this conversion can lose information about the
      * overall magnitude of the BigInteger value as well as return a
@@ -2763,12 +2761,11 @@
 
     /**
      * Converts this BigInteger to a {@code float}.  This
-     * conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger has too great a magnitude
+     * conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger has too great a magnitude
      * to represent as a {@code float}, it will be converted to
      * {@link Float#NEGATIVE_INFINITY} or {@link
      * Float#POSITIVE_INFINITY} as appropriate.  Note that even when
@@ -2784,12 +2781,11 @@
 
     /**
      * Converts this BigInteger to a {@code double}.  This
-     * conversion is similar to the <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#25363"><i>narrowing
-     * primitive conversion</i></a> from {@code double} to
-     * {@code float} defined in the <a
-     * href="http://java.sun.com/docs/books/jls/html/">Java Language
-     * Specification</a>: if this BigInteger has too great a magnitude
+     * conversion is similar to the
+     * <i>narrowing primitive conversion</i> from {@code double} to
+     * {@code float} as defined in section 5.1.3 of
+     * <cite>The Java&trade; Language Specification</cite>:
+     * if this BigInteger has too great a magnitude
      * to represent as a {@code double}, it will be converted to
      * {@link Double#NEGATIVE_INFINITY} or {@link
      * Double#POSITIVE_INFINITY} as appropriate.  Note that even when
--- a/jdk/src/share/classes/java/security/SecureClassLoader.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/security/SecureClassLoader.java	Tue Apr 26 15:48:03 2011 -0700
@@ -118,10 +118,8 @@
      *                  and without a trailing ".class" suffix.
      * @param      b    the bytes that make up the class data. The bytes in
      *             positions <code>off</code> through <code>off+len-1</code>
-     *             should have the format of a valid class file as defined
-     *             by the
-     *             <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *             Virtual Machine Specification</a>.
+     *             should have the format of a valid class file as defined by
+     *             <cite>The Java&trade; Virtual Machine Specification</cite>.
      * @param      off  the start offset in <code>b</code> of the class data
      * @param      len  the length of the class data
      * @param      cs   the associated CodeSource, or <code>null</code> if none
@@ -157,9 +155,8 @@
      *                  and without a trailing ".class" suffix.
      * @param      b    the bytes that make up the class data.  The bytes from positions
      *                  <tt>b.position()</tt> through <tt>b.position() + b.limit() -1</tt>
-     *                  should have the format of a valid class file as defined by the
-     *                  <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
-     *                  Machine Specification</a>.
+     *                  should have the format of a valid class file as defined by
+     *                  <cite>The Java&trade; Virtual Machine Specification</cite>.
      * @param      cs   the associated CodeSource, or <code>null</code> if none
      * @return the <code>Class</code> object created from the data,
      *         and optional CodeSource.
--- a/jdk/src/share/classes/java/sql/DriverManager.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/sql/DriverManager.java	Tue Apr 26 15:48:03 2011 -0700
@@ -80,7 +80,7 @@
 
 
     // List of registered JDBC drivers
-    private final static CopyOnWriteArrayList<Driver> registeredDrivers = new CopyOnWriteArrayList<Driver>();
+    private final static CopyOnWriteArrayList<DriverInfo> registeredDrivers = new CopyOnWriteArrayList<DriverInfo>();
     private static volatile int loginTimeout = 0;
     private static volatile java.io.PrintWriter logWriter = null;
     private static volatile java.io.PrintStream logStream = null;
@@ -265,22 +265,22 @@
 
         // Walk through the loaded registeredDrivers attempting to locate someone
         // who understands the given URL.
-        for (Driver aDriver : registeredDrivers) {
+        for (DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
                 try {
-                    if(aDriver.acceptsURL(url)) {
+                    if(aDriver.driver.acceptsURL(url)) {
                         // Success!
-                        println("getDriver returning " + aDriver.getClass().getName());
-                    return (aDriver);
+                        println("getDriver returning " + aDriver.driver.getClass().getName());
+                    return (aDriver.driver);
                     }
 
                 } catch(SQLException sqe) {
                     // Drop through and try the next driver.
                 }
             } else {
-                println("    skipping: " + aDriver.getClass().getName());
+                println("    skipping: " + aDriver.driver.getClass().getName());
             }
 
         }
@@ -305,7 +305,7 @@
 
         /* Register the driver if it has not already been added to our list */
         if(driver != null) {
-            registeredDrivers.addIfAbsent(driver);
+            registeredDrivers.addIfAbsent(new DriverInfo(driver));
         } else {
             // This is for compatibility with the original DriverManager
             throw new NullPointerException();
@@ -333,9 +333,10 @@
         ClassLoader callerCL = DriverManager.getCallerClassLoader();
         println("DriverManager.deregisterDriver: " + driver);
 
-        if(registeredDrivers.contains(driver)) {
+        DriverInfo aDriver = new DriverInfo(driver);
+        if(registeredDrivers.contains(aDriver)) {
             if (isDriverAllowed(driver, callerCL)) {
-                 registeredDrivers.remove(driver);
+                 registeredDrivers.remove(aDriver);
             } else {
                 // If the caller does not have permission to load the driver then
                 // throw a SecurityException.
@@ -363,11 +364,11 @@
         ClassLoader callerCL = DriverManager.getCallerClassLoader();
 
         // Walk through the loaded registeredDrivers.
-        for(Driver aDriver : registeredDrivers) {
+        for(DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
-                result.addElement(aDriver);
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
+                result.addElement(aDriver.driver);
             } else {
                 println("    skipping: " + aDriver.getClass().getName());
             }
@@ -482,8 +483,8 @@
     private static void loadInitialDrivers() {
         String drivers;
         try {
-            drivers = (String)  AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            drivers = AccessController.doPrivileged(new PrivilegedAction<String>() {
+                public String run() {
                     return System.getProperty("jdbc.drivers");
                 }
             });
@@ -495,8 +496,8 @@
         // exposed as a java.sql.Driver.class service.
         // ServiceLoader.load() replaces the sun.misc.Providers()
 
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
 
                 ServiceLoader<Driver> loadedDrivers = ServiceLoader.load(Driver.class);
                 Iterator driversIterator = loadedDrivers.iterator();
@@ -569,16 +570,16 @@
         // Remember the first exception that gets raised so we can reraise it.
         SQLException reason = null;
 
-        for(Driver aDriver : registeredDrivers) {
+        for(DriverInfo aDriver : registeredDrivers) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver, callerCL)) {
+            if(isDriverAllowed(aDriver.driver, callerCL)) {
                 try {
-                    println("    trying " + aDriver.getClass().getName());
-                    Connection con = aDriver.connect(url, info);
+                    println("    trying " + aDriver.driver.getClass().getName());
+                    Connection con = aDriver.driver.connect(url, info);
                     if (con != null) {
                         // Success!
-                        println("getConnection returning " + aDriver.getClass().getName());
+                        println("getConnection returning " + aDriver.driver.getClass().getName());
                         return (con);
                     }
                 } catch (SQLException ex) {
@@ -607,3 +608,29 @@
     private static native ClassLoader getCallerClassLoader();
 
 }
+
+/*
+ * Wrapper class for registered Drivers in order to not expose Driver.equals()
+ * to avoid the capture of the Driver it being compared to as it might not
+ * normally have access.
+ */
+class DriverInfo {
+
+    final Driver driver;
+    DriverInfo(Driver driver) {
+        this.driver = driver;
+    }
+
+    public boolean equals(Object other) {
+        return (other instanceof DriverInfo)
+                && this.driver == ((DriverInfo) other).driver;
+    }
+
+    public int hashCode() {
+        return driver.hashCode();
+    }
+
+    public String toString() {
+        return ("driver[className="  + driver + "]");
+    }
+}
--- a/jdk/src/share/classes/java/sql/ResultSet.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/sql/ResultSet.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -137,7 +137,7 @@
  * to retrieve the next result from a sequence of multiple results.
  *
  * <P>The number, types and properties of a <code>ResultSet</code>
- * object's columns are provided by the <code>ResulSetMetaData</code>
+ * object's columns are provided by the <code>ResultSetMetaData</code>
  * object returned by the <code>ResultSet.getMetaData</code> method.
  *
  * @see Statement#executeQuery
@@ -422,7 +422,7 @@
      * of this <code>ResultSet</code> object as
      * a stream of ASCII characters. The value can then be read in chunks from the
      * stream. This method is particularly
-     * suitable for retrieving large <char>LONGVARCHAR</char> values.
+     * suitable for retrieving large <code>LONGVARCHAR</code> values.
      * The JDBC driver will
      * do any necessary conversion from the database format into ASCII.
      *
--- a/jdk/src/share/classes/java/sql/SQLPermission.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java	Tue Apr 26 15:48:03 2011 -0700
@@ -116,11 +116,11 @@
 
     /**
      * Creates a new <code>SQLPermission</code> object with the specified name.
-     * The name is the symbolic name of the <code>SQLPermission</code>; currently,
-     * the only name allowed is "setLog".
+     * The name is the symbolic name of the <code>SQLPermission</code>.
      *
      * @param name the name of this <code>SQLPermission</code> object, which must
-         *             be <code>setLog</code>
+     * be either {@code  setLog}, {@code callAbort}, {@code setSyncFactory},
+     *  or {@code setNetworkTimeout}
      * @throws NullPointerException if <code>name</code> is <code>null</code>.
      * @throws IllegalArgumentException if <code>name</code> is empty.
 
@@ -134,10 +134,11 @@
      * Creates a new <code>SQLPermission</code> object with the specified name.
      * The name is the symbolic name of the <code>SQLPermission</code>; the
      * actions <code>String</code> is currently unused and should be
-         * <code>null</code>.
+     * <code>null</code>.
      *
      * @param name the name of this <code>SQLPermission</code> object, which must
-     *             be <code>setLog</code>
+     * be either {@code  setLog}, {@code callAbort}, {@code setSyncFactory},
+     *  or {@code setNetworkTimeout}
      * @param actions should be <code>null</code>
      * @throws NullPointerException if <code>name</code> is <code>null</code>.
      * @throws IllegalArgumentException if <code>name</code> is empty.
--- a/jdk/src/share/classes/java/sql/Timestamp.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/sql/Timestamp.java	Tue Apr 26 15:48:03 2011 -0700
@@ -54,7 +54,7 @@
  * As a result, the <code>Timestamp.equals(Object)</code>
  * method is not symmetric with respect to the
  * <code>java.util.Date.equals(Object)</code>
- * method.  Also, the <code>hashcode</code> method uses the underlying
+ * method.  Also, the <code>hashCode</code> method uses the underlying
  * <code>java.util.Date</code>
  * implementation and therefore does not include nanos in its computation.
  * <P>
@@ -515,6 +515,18 @@
       }
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * The {@code hashCode} method uses the underlying {@code java.util.Date}
+     * implementation and therefore does not include nanos in its computation.
+     *
+     */
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
     static final long serialVersionUID = 2745179027874758501L;
 
 }
--- a/jdk/src/share/classes/java/text/ChoiceFormat.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/text/ChoiceFormat.java	Tue Apr 26 15:48:03 2011 -0700
@@ -136,8 +136,8 @@
  * </pre>
  * </blockquote>
  * And the output result would be like the following:
+ * <blockquote>
  * <pre>
- * <blockquote>
  *   Format with -INF : is negative
  *   Format with -1.0 : is negative
  *   Format with 0 : is zero or fraction
--- a/jdk/src/share/classes/java/util/AbstractQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/AbstractQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/ArrayDeque.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/ArrayDeque.java	Tue Apr 26 15:48:03 2011 -0700
@@ -29,7 +29,7 @@
  * file:
  *
  * Written by Josh Bloch of Google Inc. and released to the public domain,
- * as explained at http://creativecommons.org/licenses/publicdomain.
+ * as explained at http://creativecommons.org/publicdomain/zero/1.0/.
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/Deque.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/Deque.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of
  * JCP JSR-166 Expert Group and released to the public domain, as explained
- * at http://creativecommons.org/licenses/publicdomain
+ * at http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/EnumMap.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/EnumMap.java	Tue Apr 26 15:48:03 2011 -0700
@@ -106,7 +106,7 @@
     /**
      * Distinguished non-null value for representing null values.
      */
-    private static final Object NULL = new Object();
+    private static final Object NULL = new Integer(0);
 
     private Object maskNull(Object value) {
         return (value == null ? NULL : value);
@@ -116,7 +116,7 @@
         return (V) (value == NULL ? null : value);
     }
 
-    private static Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
+    private static final Enum[] ZERO_LENGTH_ENUM_ARRAY = new Enum[0];
 
     /**
      * Creates an empty enum map with the specified key type.
@@ -464,6 +464,7 @@
         public Iterator<Map.Entry<K,V>> iterator() {
             return new EntryIterator();
         }
+
         public boolean contains(Object o) {
             if (!(o instanceof Map.Entry))
                 return false;
@@ -552,70 +553,82 @@
         }
     }
 
-    /**
-     * Since we don't use Entry objects, we use the Iterator itself as entry.
-     */
-    private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>>
-        implements Map.Entry<K,V>
-    {
+    private class EntryIterator extends EnumMapIterator<Map.Entry<K,V>> {
+        private Entry lastReturnedEntry = null;
+
         public Map.Entry<K,V> next() {
             if (!hasNext())
                 throw new NoSuchElementException();
-            lastReturnedIndex = index++;
-            return this;
-        }
-
-        public K getKey() {
-            checkLastReturnedIndexForEntryUse();
-            return keyUniverse[lastReturnedIndex];
+            lastReturnedEntry = new Entry(index++);
+            return lastReturnedEntry;
         }
 
-        public V getValue() {
-            checkLastReturnedIndexForEntryUse();
-            return unmaskNull(vals[lastReturnedIndex]);
-        }
-
-        public V setValue(V value) {
-            checkLastReturnedIndexForEntryUse();
-            V oldValue = unmaskNull(vals[lastReturnedIndex]);
-            vals[lastReturnedIndex] = maskNull(value);
-            return oldValue;
+        public void remove() {
+            lastReturnedIndex =
+                ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
+            super.remove();
+            lastReturnedEntry.index = lastReturnedIndex;
+            lastReturnedEntry = null;
         }
 
-        public boolean equals(Object o) {
-            if (lastReturnedIndex < 0)
-                return o == this;
+        private class Entry implements Map.Entry<K,V> {
+            private int index;
+
+            private Entry(int index) {
+                this.index = index;
+            }
+
+            public K getKey() {
+                checkIndexForEntryUse();
+                return keyUniverse[index];
+            }
 
-            if (!(o instanceof Map.Entry))
-                return false;
-            Map.Entry e = (Map.Entry)o;
-            V ourValue = unmaskNull(vals[lastReturnedIndex]);
-            Object hisValue = e.getValue();
-            return e.getKey() == keyUniverse[lastReturnedIndex] &&
-                (ourValue == hisValue ||
-                 (ourValue != null && ourValue.equals(hisValue)));
-        }
+            public V getValue() {
+                checkIndexForEntryUse();
+                return unmaskNull(vals[index]);
+            }
+
+            public V setValue(V value) {
+                checkIndexForEntryUse();
+                V oldValue = unmaskNull(vals[index]);
+                vals[index] = maskNull(value);
+                return oldValue;
+            }
+
+            public boolean equals(Object o) {
+                if (index < 0)
+                    return o == this;
 
-        public int hashCode() {
-            if (lastReturnedIndex < 0)
-                return super.hashCode();
+                if (!(o instanceof Map.Entry))
+                    return false;
 
-            Object value = vals[lastReturnedIndex];
-            return keyUniverse[lastReturnedIndex].hashCode()
-                ^ (value == NULL ? 0 : value.hashCode());
-        }
+                Map.Entry e = (Map.Entry)o;
+                V ourValue = unmaskNull(vals[index]);
+                Object hisValue = e.getValue();
+                return (e.getKey() == keyUniverse[index] &&
+                        (ourValue == hisValue ||
+                         (ourValue != null && ourValue.equals(hisValue))));
+            }
+
+            public int hashCode() {
+                if (index < 0)
+                    return super.hashCode();
 
-        public String toString() {
-            if (lastReturnedIndex < 0)
-                return super.toString();
+                return entryHashCode(index);
+            }
+
+            public String toString() {
+                if (index < 0)
+                    return super.toString();
 
-            return keyUniverse[lastReturnedIndex] + "="
-                + unmaskNull(vals[lastReturnedIndex]);
-        }
+                return keyUniverse[index] + "="
+                    + unmaskNull(vals[index]);
+            }
 
-        private void checkLastReturnedIndexForEntryUse() {
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
+            private void checkIndexForEntryUse() {
+                if (index < 0)
+                    throw new IllegalStateException("Entry was removed");
+            }
         }
     }
 
@@ -631,10 +644,35 @@
      * @return <tt>true</tt> if the specified object is equal to this map
      */
     public boolean equals(Object o) {
-        if (!(o instanceof EnumMap))
-            return super.equals(o);
+        if (this == o)
+            return true;
+        if (o instanceof EnumMap)
+            return equals((EnumMap)o);
+        if (!(o instanceof Map))
+            return false;
+
+        Map<K,V> m = (Map<K,V>)o;
+        if (size != m.size())
+            return false;
 
-        EnumMap em = (EnumMap)o;
+        for (int i = 0; i < keyUniverse.length; i++) {
+            if (null != vals[i]) {
+                K key = keyUniverse[i];
+                V value = unmaskNull(vals[i]);
+                if (null == value) {
+                    if (!((null == m.get(key)) && m.containsKey(key)))
+                       return false;
+                } else {
+                   if (!value.equals(m.get(key)))
+                      return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    private boolean equals(EnumMap em) {
         if (em.keyType != keyType)
             return size == 0 && em.size == 0;
 
@@ -650,6 +688,26 @@
     }
 
     /**
+     * Returns the hash code value for this map.  The hash code of a map is
+     * defined to be the sum of the hash codes of each entry in the map.
+     */
+    public int hashCode() {
+        int h = 0;
+
+        for (int i = 0; i < keyUniverse.length; i++) {
+            if (null != vals[i]) {
+                h += entryHashCode(i);
+            }
+        }
+
+        return h;
+    }
+
+    private int entryHashCode(int index) {
+        return (keyUniverse[index].hashCode() ^ vals[index].hashCode());
+    }
+
+    /**
      * Returns a shallow copy of this enum map.  (The values themselves
      * are not cloned.
      *
@@ -705,9 +763,13 @@
         s.writeInt(size);
 
         // Write out keys and values (alternating)
-        for (Map.Entry<K,V> e :  entrySet()) {
-            s.writeObject(e.getKey());
-            s.writeObject(e.getValue());
+        int entriesToBeWritten = size;
+        for (int i = 0; entriesToBeWritten > 0; i++) {
+            if (null != vals[i]) {
+                s.writeObject(keyUniverse[i]);
+                s.writeObject(unmaskNull(vals[i]));
+                entriesToBeWritten--;
+            }
         }
     }
 
--- a/jdk/src/share/classes/java/util/Formatter.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/Formatter.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1818,9 +1818,9 @@
  * </pre></blockquote>
  *
  * <p> The maximum number of arguments is limited by the maximum dimension of a
- * Java array as defined by the <a
- * href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
- * Specification</a>.  If the argument index is does not correspond to an
+ * Java array as defined by
+ * <cite>The Java&trade; Virtual Machine Specification</cite>.
+ * If the argument index is does not correspond to an
  * available argument, then a {@link MissingFormatArgumentException} is thrown.
  *
  * <p> If there are more arguments than format specifiers, the extra arguments
@@ -2403,8 +2403,7 @@
      *         string.  If there are more arguments than format specifiers, the
      *         extra arguments are ignored.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>.
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @throws  IllegalFormatException
      *          If a format string contains an illegal syntax, a format
@@ -2443,8 +2442,7 @@
      *         string.  If there are more arguments than format specifiers, the
      *         extra arguments are ignored.  The maximum number of arguments is
      *         limited by the maximum dimension of a Java array as defined by
-     *         the <a href="http://java.sun.com/docs/books/vmspec/">Java
-     *         Virtual Machine Specification</a>
+     *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @throws  IllegalFormatException
      *          If a format string contains an illegal syntax, a format
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -829,71 +829,82 @@
         }
     }
 
-    /**
-     * Since we don't use Entry objects, we use the Iterator
-     * itself as an entry.
-     */
     private class EntryIterator
         extends IdentityHashMapIterator<Map.Entry<K,V>>
-        implements Map.Entry<K,V>
     {
+        private Entry lastReturnedEntry = null;
+
         public Map.Entry<K,V> next() {
-            nextIndex();
-            return this;
+            lastReturnedEntry = new Entry(nextIndex());
+            return lastReturnedEntry;
         }
 
-        public K getKey() {
-            // Provide a better exception than out of bounds index
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
-
-            return (K) unmaskNull(traversalTable[lastReturnedIndex]);
-        }
-
-        public V getValue() {
-            // Provide a better exception than out of bounds index
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
-
-            return (V) traversalTable[lastReturnedIndex+1];
+        public void remove() {
+            lastReturnedIndex =
+                ((null == lastReturnedEntry) ? -1 : lastReturnedEntry.index);
+            super.remove();
+            lastReturnedEntry.index = lastReturnedIndex;
+            lastReturnedEntry = null;
         }
 
-        public V setValue(V value) {
-            // It would be mean-spirited to proceed here if remove() called
-            if (lastReturnedIndex < 0)
-                throw new IllegalStateException("Entry was removed");
-            V oldValue = (V) traversalTable[lastReturnedIndex+1];
-            traversalTable[lastReturnedIndex+1] = value;
-            // if shadowing, force into main table
-            if (traversalTable != IdentityHashMap.this.table)
-                put((K) traversalTable[lastReturnedIndex], value);
-            return oldValue;
-        }
+        private class Entry implements Map.Entry<K,V> {
+            private int index;
+
+            private Entry(int index) {
+                this.index = index;
+            }
+
+            public K getKey() {
+                checkIndexForEntryUse();
+                return (K) unmaskNull(traversalTable[index]);
+            }
 
-        public boolean equals(Object o) {
-            if (lastReturnedIndex < 0)
-                return super.equals(o);
+            public V getValue() {
+                checkIndexForEntryUse();
+                return (V) traversalTable[index+1];
+            }
+
+            public V setValue(V value) {
+                checkIndexForEntryUse();
+                V oldValue = (V) traversalTable[index+1];
+                traversalTable[index+1] = value;
+                // if shadowing, force into main table
+                if (traversalTable != IdentityHashMap.this.table)
+                    put((K) traversalTable[index], value);
+                return oldValue;
+            }
 
-            if (!(o instanceof Map.Entry))
-                return false;
-            Map.Entry e = (Map.Entry)o;
-            return e.getKey()   == getKey() &&
-                   e.getValue() == getValue();
-        }
+            public boolean equals(Object o) {
+                if (index < 0)
+                    return super.equals(o);
+
+                if (!(o instanceof Map.Entry))
+                    return false;
+                Map.Entry e = (Map.Entry)o;
+                return (e.getKey() == unmaskNull(traversalTable[index]) &&
+                       e.getValue() == traversalTable[index+1]);
+            }
+
+            public int hashCode() {
+                if (lastReturnedIndex < 0)
+                    return super.hashCode();
 
-        public int hashCode() {
-            if (lastReturnedIndex < 0)
-                return super.hashCode();
+                return (System.identityHashCode(unmaskNull(traversalTable[index])) ^
+                       System.identityHashCode(traversalTable[index+1]));
+            }
+
+            public String toString() {
+                if (index < 0)
+                    return super.toString();
 
-            return System.identityHashCode(getKey()) ^
-                   System.identityHashCode(getValue());
-        }
+                return (unmaskNull(traversalTable[index]) + "="
+                        + traversalTable[index+1]);
+            }
 
-        public String toString() {
-            if (lastReturnedIndex < 0)
-                return super.toString();
-
-            return getKey() + "=" + getValue();
+            private void checkIndexForEntryUse() {
+                if (index < 0)
+                    throw new IllegalStateException("Entry was removed");
+            }
         }
     }
 
--- a/jdk/src/share/classes/java/util/Locale.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/Locale.java	Tue Apr 26 15:48:03 2011 -0700
@@ -51,13 +51,13 @@
 
 import sun.security.action.GetPropertyAction;
 import sun.util.LocaleServiceProviderPool;
-import sun.util.locale.AsciiUtil;
 import sun.util.locale.BaseLocale;
 import sun.util.locale.InternalLocaleBuilder;
 import sun.util.locale.LanguageTag;
 import sun.util.locale.LocaleExtensions;
 import sun.util.locale.LocaleObjectCache;
 import sun.util.locale.LocaleSyntaxException;
+import sun.util.locale.LocaleUtils;
 import sun.util.locale.ParseStatus;
 import sun.util.locale.UnicodeLocaleExtension;
 import sun.util.resources.LocaleData;
@@ -412,59 +412,59 @@
 
     /** Useful constant for language.
      */
-    static public final Locale ENGLISH = getInstance("en", "", "");
+    static public final Locale ENGLISH = createConstant("en", "");
 
     /** Useful constant for language.
      */
-    static public final Locale FRENCH = getInstance("fr", "", "");
+    static public final Locale FRENCH = createConstant("fr", "");
 
     /** Useful constant for language.
      */
-    static public final Locale GERMAN = getInstance("de", "", "");
+    static public final Locale GERMAN = createConstant("de", "");
 
     /** Useful constant for language.
      */
-    static public final Locale ITALIAN = getInstance("it", "", "");
+    static public final Locale ITALIAN = createConstant("it", "");
 
     /** Useful constant for language.
      */
-    static public final Locale JAPANESE = getInstance("ja", "", "");
+    static public final Locale JAPANESE = createConstant("ja", "");
 
     /** Useful constant for language.
      */
-    static public final Locale KOREAN = getInstance("ko", "", "");
+    static public final Locale KOREAN = createConstant("ko", "");
 
     /** Useful constant for language.
      */
-    static public final Locale CHINESE = getInstance("zh", "", "");
+    static public final Locale CHINESE = createConstant("zh", "");
 
     /** Useful constant for language.
      */
-    static public final Locale SIMPLIFIED_CHINESE = getInstance("zh", "CN", "");
+    static public final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN");
 
     /** Useful constant for language.
      */
-    static public final Locale TRADITIONAL_CHINESE = getInstance("zh", "TW", "");
+    static public final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW");
 
     /** Useful constant for country.
      */
-    static public final Locale FRANCE = getInstance("fr", "FR", "");
+    static public final Locale FRANCE = createConstant("fr", "FR");
 
     /** Useful constant for country.
      */
-    static public final Locale GERMANY = getInstance("de", "DE", "");
+    static public final Locale GERMANY = createConstant("de", "DE");
 
     /** Useful constant for country.
      */
-    static public final Locale ITALY = getInstance("it", "IT", "");
+    static public final Locale ITALY = createConstant("it", "IT");
 
     /** Useful constant for country.
      */
-    static public final Locale JAPAN = getInstance("ja", "JP", "");
+    static public final Locale JAPAN = createConstant("ja", "JP");
 
     /** Useful constant for country.
      */
-    static public final Locale KOREA = getInstance("ko", "KR", "");
+    static public final Locale KOREA = createConstant("ko", "KR");
 
     /** Useful constant for country.
      */
@@ -480,19 +480,19 @@
 
     /** Useful constant for country.
      */
-    static public final Locale UK = getInstance("en", "GB", "");
+    static public final Locale UK = createConstant("en", "GB");
 
     /** Useful constant for country.
      */
-    static public final Locale US = getInstance("en", "US", "");
+    static public final Locale US = createConstant("en", "US");
 
     /** Useful constant for country.
      */
-    static public final Locale CANADA = getInstance("en", "CA", "");
+    static public final Locale CANADA = createConstant("en", "CA");
 
     /** Useful constant for country.
      */
-    static public final Locale CANADA_FRENCH = getInstance("fr", "CA", "");
+    static public final Locale CANADA_FRENCH = createConstant("fr", "CA");
 
     /**
      * Useful constant for the root locale.  The root locale is the locale whose
@@ -502,7 +502,7 @@
      *
      * @since 1.6
      */
-    static public final Locale ROOT = getInstance("", "", "");
+    static public final Locale ROOT = createConstant("", "");
 
     /**
      * The key for the private use extension ('x').
@@ -532,14 +532,14 @@
     private static final int DISPLAY_LANGUAGE = 0;
     private static final int DISPLAY_COUNTRY  = 1;
     private static final int DISPLAY_VARIANT  = 2;
-    private static final int DISPLAY_SCRIPT = 3;
+    private static final int DISPLAY_SCRIPT   = 3;
 
     /**
      * Private constructor used by getInstance method
      */
     private Locale(BaseLocale baseLocale, LocaleExtensions extensions) {
-        _baseLocale = baseLocale;
-        _extensions = extensions;
+        this.baseLocale = baseLocale;
+        this.localeExtensions = extensions;
     }
 
     /**
@@ -572,8 +572,8 @@
         if (language== null || country == null || variant == null) {
             throw new NullPointerException();
         }
-        _baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
-        _extensions = getCompatibilityExtensions(language, "", country, variant);
+        baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
+        localeExtensions = getCompatibilityExtensions(language, "", country, variant);
     }
 
     /**
@@ -627,6 +627,15 @@
     }
 
     /**
+     * This method must be called only for creating the Locale.*
+     * constants due to making shortcuts.
+     */
+    private static Locale createConstant(String lang, String country) {
+        BaseLocale base = BaseLocale.createInstance(lang, country);
+        return getInstance(base, null);
+    }
+
+    /**
      * Returns a <code>Locale</code> constructed from the given
      * <code>language</code>, <code>country</code> and
      * <code>variant</code>. If the same <code>Locale</code> instance
@@ -641,7 +650,7 @@
      * @exception NullPointerException if any argument is null.
      */
     static Locale getInstance(String language, String country, String variant) {
-        return getInstance(language, "", country, variant, LocaleExtensions.EMPTY_EXTENSIONS);
+        return getInstance(language, "", country, variant, null);
     }
 
     static Locale getInstance(String language, String script, String country,
@@ -651,10 +660,6 @@
         }
 
         if (extensions == null) {
-            extensions = LocaleExtensions.EMPTY_EXTENSIONS;
-        }
-
-        if (extensions.equals(LocaleExtensions.EMPTY_EXTENSIONS)) {
             extensions = getCompatibilityExtensions(language, script, country, variant);
         }
 
@@ -668,22 +673,33 @@
     }
 
     private static class Cache extends LocaleObjectCache<LocaleKey, Locale> {
-        public Cache() {
+        private Cache() {
         }
+
+        @Override
         protected Locale createObject(LocaleKey key) {
-            return new Locale(key._base, key._exts);
+            return new Locale(key.base, key.exts);
         }
     }
 
-    private static class LocaleKey {
-        private BaseLocale _base;
-        private LocaleExtensions _exts;
+    private static final class LocaleKey {
+        private final BaseLocale base;
+        private final LocaleExtensions exts;
+        private final int hash;
 
         private LocaleKey(BaseLocale baseLocale, LocaleExtensions extensions) {
-            _base = baseLocale;
-            _exts = extensions;
+            base = baseLocale;
+            exts = extensions;
+
+            // Calculate the hash value here because it's always used.
+            int h = base.hashCode();
+            if (exts != null) {
+                h ^= exts.hashCode();
+            }
+            hash = h;
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (this == obj) {
                 return true;
@@ -692,11 +708,18 @@
                 return false;
             }
             LocaleKey other = (LocaleKey)obj;
-            return _base.equals(other._base) && _exts.equals(other._exts);
+            if (hash != other.hash || !base.equals(other.base)) {
+                return false;
+            }
+            if (exts == null) {
+                return other.exts == null;
+            }
+            return exts.equals(other.exts);
         }
 
+        @Override
         public int hashCode() {
-            return _base.hashCode() ^ _exts.hashCode();
+            return hash;
         }
     }
 
@@ -981,7 +1004,7 @@
      * @see #getDisplayLanguage
      */
     public String getLanguage() {
-        return _baseLocale.getLanguage();
+        return baseLocale.getLanguage();
     }
 
     /**
@@ -995,7 +1018,7 @@
      * @since 1.7
      */
     public String getScript() {
-        return _baseLocale.getScript();
+        return baseLocale.getScript();
     }
 
     /**
@@ -1007,7 +1030,7 @@
      * @see #getDisplayCountry
      */
     public String getCountry() {
-        return _baseLocale.getRegion();
+        return baseLocale.getRegion();
     }
 
     /**
@@ -1017,7 +1040,7 @@
      * @see #getDisplayVariant
      */
     public String getVariant() {
-        return _baseLocale.getVariant();
+        return baseLocale.getVariant();
     }
 
     /**
@@ -1039,7 +1062,7 @@
         if (!LocaleExtensions.isValidKey(key)) {
             throw new IllegalArgumentException("Ill-formed extension key: " + key);
         }
-        return _extensions.getExtensionValue(key);
+        return (localeExtensions == null) ? null : localeExtensions.getExtensionValue(key);
     }
 
     /**
@@ -1052,7 +1075,10 @@
      * @since 1.7
      */
     public Set<Character> getExtensionKeys() {
-        return _extensions.getKeys();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getKeys();
     }
 
     /**
@@ -1064,7 +1090,10 @@
      * @since 1.7
      */
     public Set<String> getUnicodeLocaleAttributes() {
-        return _extensions.getUnicodeLocaleAttributes();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getUnicodeLocaleAttributes();
     }
 
     /**
@@ -1085,7 +1114,7 @@
         if (!UnicodeLocaleExtension.isKey(key)) {
             throw new IllegalArgumentException("Ill-formed Unicode locale key: " + key);
         }
-        return _extensions.getUnicodeLocaleType(key);
+        return (localeExtensions == null) ? null : localeExtensions.getUnicodeLocaleType(key);
     }
 
     /**
@@ -1097,7 +1126,10 @@
      * @since 1.7
      */
     public Set<String> getUnicodeLocaleKeys() {
-        return _extensions.getUnicodeLocaleKeys();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getUnicodeLocaleKeys();
     }
 
     /**
@@ -1106,16 +1138,17 @@
      * @return base locale of this Locale
      */
     BaseLocale getBaseLocale() {
-        return _baseLocale;
+        return baseLocale;
     }
 
     /**
-     * Package local method returning the Locale's LocaleExtensions,
-     * used by ResourceBundle
-     * @return locale exnteions of this Locale
+     * Package private method returning the Locale's LocaleExtensions,
+     * used by ResourceBundle.
+     * @return locale exnteions of this Locale,
+     *         or {@code null} if no extensions are defined
      */
      LocaleExtensions getLocaleExtensions() {
-         return _extensions;
+         return localeExtensions;
      }
 
     /**
@@ -1160,26 +1193,27 @@
      * @see #getDisplayName
      * @see #toLanguageTag
      */
+    @Override
     public final String toString() {
-        boolean l = (_baseLocale.getLanguage().length() != 0);
-        boolean s = (_baseLocale.getScript().length() != 0);
-        boolean r = (_baseLocale.getRegion().length() != 0);
-        boolean v = (_baseLocale.getVariant().length() != 0);
-        boolean e = (_extensions.getID().length() != 0);
+        boolean l = (baseLocale.getLanguage().length() != 0);
+        boolean s = (baseLocale.getScript().length() != 0);
+        boolean r = (baseLocale.getRegion().length() != 0);
+        boolean v = (baseLocale.getVariant().length() != 0);
+        boolean e = (localeExtensions != null && localeExtensions.getID().length() != 0);
 
-        StringBuilder result = new StringBuilder(_baseLocale.getLanguage());
+        StringBuilder result = new StringBuilder(baseLocale.getLanguage());
         if (r || (l && (v || s || e))) {
             result.append('_')
-                .append(_baseLocale.getRegion()); // This may just append '_'
+                .append(baseLocale.getRegion()); // This may just append '_'
         }
         if (v && (l || r)) {
             result.append('_')
-                .append(_baseLocale.getVariant());
+                .append(baseLocale.getVariant());
         }
 
         if (s && (l || r)) {
             result.append("_#")
-                .append(_baseLocale.getScript());
+                .append(baseLocale.getScript());
         }
 
         if (e && (l || r)) {
@@ -1187,7 +1221,7 @@
             if (!s) {
                 result.append('#');
             }
-            result.append(_extensions.getID());
+            result.append(localeExtensions.getID());
         }
 
         return result.toString();
@@ -1261,7 +1295,7 @@
      * @since 1.7
      */
     public String toLanguageTag() {
-        LanguageTag tag = LanguageTag.parseLocale(_baseLocale, _extensions);
+        LanguageTag tag = LanguageTag.parseLocale(baseLocale, localeExtensions);
         StringBuilder buf = new StringBuilder();
 
         String subtag = tag.getLanguage();
@@ -1433,8 +1467,9 @@
         bldr.setLanguageTag(tag);
         BaseLocale base = bldr.getBaseLocale();
         LocaleExtensions exts = bldr.getLocaleExtensions();
-        if (exts.isEmpty() && base.getVariant().length() > 0) {
-            exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(), base.getRegion(), base.getVariant());
+        if (exts == null && base.getVariant().length() > 0) {
+            exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(),
+                                              base.getRegion(), base.getVariant());
         }
         return getInstance(base, exts);
     }
@@ -1454,7 +1489,7 @@
      * three-letter language abbreviation is not available for this locale.
      */
     public String getISO3Language() throws MissingResourceException {
-        String lang = _baseLocale.getLanguage();
+        String lang = baseLocale.getLanguage();
         if (lang.length() == 3) {
             return lang;
         }
@@ -1481,10 +1516,10 @@
      * three-letter country abbreviation is not available for this locale.
      */
     public String getISO3Country() throws MissingResourceException {
-        String country3 = getISO3Code(_baseLocale.getRegion(), LocaleISOData.isoCountryTable);
+        String country3 = getISO3Code(baseLocale.getRegion(), LocaleISOData.isoCountryTable);
         if (country3 == null) {
             throw new MissingResourceException("Couldn't find 3-letter country code for "
-                    + _baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry");
+                    + baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry");
         }
         return country3;
     }
@@ -1542,7 +1577,7 @@
      * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
      */
     public String getDisplayLanguage(Locale inLocale) {
-        return getDisplayString(_baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE);
+        return getDisplayString(baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE);
     }
 
     /**
@@ -1568,7 +1603,7 @@
      * @since 1.7
      */
     public String getDisplayScript(Locale inLocale) {
-        return getDisplayString(_baseLocale.getScript(), inLocale, DISPLAY_SCRIPT);
+        return getDisplayString(baseLocale.getScript(), inLocale, DISPLAY_SCRIPT);
     }
 
     /**
@@ -1603,7 +1638,7 @@
      * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
      */
     public String getDisplayCountry(Locale inLocale) {
-        return getDisplayString(_baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY);
+        return getDisplayString(baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY);
     }
 
     private String getDisplayString(String code, Locale inLocale, int type) {
@@ -1662,7 +1697,7 @@
      * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
      */
     public String getDisplayVariant(Locale inLocale) {
-        if (_baseLocale.getVariant().length() == 0)
+        if (baseLocale.getVariant().length() == 0)
             return "";
 
         OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
@@ -1758,7 +1793,7 @@
                 return formatList(variantNames, listPattern, listCompositionPattern);
             }
         }
-        ArrayList<String> names = new ArrayList<String>(4);
+        ArrayList<String> names = new ArrayList<>(4);
         if (languageName.length() != 0) {
             names.add(languageName);
         }
@@ -1833,10 +1868,14 @@
      * Since Locales are often used in hashtables, caches the value
      * for speed.
      */
+    @Override
     public int hashCode() {
         int hc = hashCodeValue;
         if (hc == 0) {
-            hc = _baseLocale.hashCode() ^ _extensions.hashCode();
+            hc = baseLocale.hashCode();
+            if (localeExtensions != null) {
+                hc ^= localeExtensions.hashCode();
+            }
             hashCodeValue = hc;
         }
         return hc;
@@ -1851,21 +1890,26 @@
      *
      * @return true if this Locale is equal to the specified object.
      */
-
+    @Override
     public boolean equals(Object obj) {
         if (this == obj)                      // quick check
             return true;
         if (!(obj instanceof Locale))
             return false;
-        BaseLocale otherBase = ((Locale)obj)._baseLocale;
-        LocaleExtensions otherExt = ((Locale)obj)._extensions;
-        return _baseLocale.equals(otherBase) && _extensions.equals(otherExt);
+        BaseLocale otherBase = ((Locale)obj).baseLocale;
+        if (!baseLocale.equals(otherBase)) {
+            return false;
+        }
+        if (localeExtensions == null) {
+            return ((Locale)obj).localeExtensions == null;
+        }
+        return localeExtensions.equals(((Locale)obj).localeExtensions);
     }
 
     // ================= privates =====================================
 
-    private transient BaseLocale _baseLocale;
-    private transient LocaleExtensions _extensions;
+    private transient BaseLocale baseLocale;
+    private transient LocaleExtensions localeExtensions;
 
     /**
      * Calculated hashcode
@@ -1883,7 +1927,7 @@
      */
     private String[] getDisplayVariantArray(OpenListResourceBundle bundle, Locale inLocale) {
         // Split the variant name into tokens separated by '_'.
-        StringTokenizer tokenizer = new StringTokenizer(_baseLocale.getVariant(), "_");
+        StringTokenizer tokenizer = new StringTokenizer(baseLocale.getVariant(), "_");
         String[] names = new String[tokenizer.countTokens()];
 
         // For each variant token, lookup the display name.  If
@@ -1996,11 +2040,11 @@
      */
     private void writeObject(ObjectOutputStream out) throws IOException {
         ObjectOutputStream.PutField fields = out.putFields();
-        fields.put("language", _baseLocale.getLanguage());
-        fields.put("script", _baseLocale.getScript());
-        fields.put("country", _baseLocale.getRegion());
-        fields.put("variant", _baseLocale.getVariant());
-        fields.put("extensions", _extensions.getID());
+        fields.put("language", baseLocale.getLanguage());
+        fields.put("script", baseLocale.getScript());
+        fields.put("country", baseLocale.getRegion());
+        fields.put("variant", baseLocale.getVariant());
+        fields.put("extensions", localeExtensions == null ? "" : localeExtensions.getID());
         fields.put("hashcode", -1); // place holder just for backward support
         out.writeFields();
     }
@@ -2020,13 +2064,17 @@
         String country = (String)fields.get("country", "");
         String variant = (String)fields.get("variant", "");
         String extStr = (String)fields.get("extensions", "");
-        _baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
-        try {
-            InternalLocaleBuilder bldr = new InternalLocaleBuilder();
-            bldr.setExtensions(extStr);
-            _extensions = bldr.getLocaleExtensions();
-        } catch (LocaleSyntaxException e) {
-            throw new IllformedLocaleException(e.getMessage());
+        baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
+        if (extStr.length() > 0) {
+            try {
+                InternalLocaleBuilder bldr = new InternalLocaleBuilder();
+                bldr.setExtensions(extStr);
+                localeExtensions = bldr.getLocaleExtensions();
+            } catch (LocaleSyntaxException e) {
+                throw new IllformedLocaleException(e.getMessage());
+            }
+        } else {
+            localeExtensions = null;
         }
     }
 
@@ -2045,8 +2093,8 @@
      * @throws java.io.ObjectStreamException
      */
     private Object readResolve() throws java.io.ObjectStreamException {
-        return getInstance(_baseLocale.getLanguage(), _baseLocale.getScript(),
-                _baseLocale.getRegion(), _baseLocale.getVariant(), _extensions);
+        return getInstance(baseLocale.getLanguage(), baseLocale.getScript(),
+                baseLocale.getRegion(), baseLocale.getVariant(), localeExtensions);
     }
 
     private static volatile String[] isoLanguages = null;
@@ -2056,7 +2104,7 @@
     private static String convertOldISOCodes(String language) {
         // we accept both the old and the new ISO codes for the languages whose ISO
         // codes have changed, but we always store the OLD code, for backward compatibility
-        language = AsciiUtil.toLowerString(language).intern();
+        language = LocaleUtils.toLowerString(language).intern();
         if (language == "he") {
             return "iw";
         } else if (language == "yi") {
@@ -2068,19 +2116,22 @@
         }
     }
 
-    private static LocaleExtensions getCompatibilityExtensions(String language, String script, String country, String variant) {
-        LocaleExtensions extensions = LocaleExtensions.EMPTY_EXTENSIONS;
+    private static LocaleExtensions getCompatibilityExtensions(String language,
+                                                               String script,
+                                                               String country,
+                                                               String variant) {
+        LocaleExtensions extensions = null;
         // Special cases for backward compatibility support
-        if (AsciiUtil.caseIgnoreMatch(language, "ja")
+        if (LocaleUtils.caseIgnoreMatch(language, "ja")
                 && script.length() == 0
-                && AsciiUtil.caseIgnoreMatch(country, "JP")
-                && AsciiUtil.caseIgnoreMatch(variant, "JP")) {
+                && LocaleUtils.caseIgnoreMatch(country, "jp")
+                && "JP".equals(variant)) {
             // ja_JP_JP -> u-ca-japanese (calendar = japanese)
             extensions = LocaleExtensions.CALENDAR_JAPANESE;
-        } else if (AsciiUtil.caseIgnoreMatch(language, "th")
+        } else if (LocaleUtils.caseIgnoreMatch(language, "th")
                 && script.length() == 0
-                && AsciiUtil.caseIgnoreMatch(country, "TH")
-                && AsciiUtil.caseIgnoreMatch(variant, "TH")) {
+                && LocaleUtils.caseIgnoreMatch(country, "th")
+                && "TH".equals(variant)) {
             // th_TH_TH -> u-nu-thai (numbersystem = thai)
             extensions = LocaleExtensions.NUMBER_THAI;
         }
@@ -2196,7 +2247,7 @@
      * @since 1.7
      */
     public static final class Builder {
-        private InternalLocaleBuilder _locbld;
+        private final InternalLocaleBuilder localeBuilder;
 
         /**
          * Constructs an empty Builder. The default value of all
@@ -2204,7 +2255,7 @@
          * empty string.
          */
         public Builder() {
-            _locbld = new InternalLocaleBuilder();
+            localeBuilder = new InternalLocaleBuilder();
         }
 
         /**
@@ -2229,7 +2280,7 @@
          */
         public Builder setLocale(Locale locale) {
             try {
-                _locbld.setLocale(locale._baseLocale, locale._extensions);
+                localeBuilder.setLocale(locale.baseLocale, locale.localeExtensions);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2259,8 +2310,7 @@
             if (sts.isError()) {
                 throw new IllformedLocaleException(sts.getErrorMessage(), sts.getErrorIndex());
             }
-            _locbld.setLanguageTag(tag);
-
+            localeBuilder.setLanguageTag(tag);
             return this;
         }
 
@@ -2279,7 +2329,7 @@
          */
         public Builder setLanguage(String language) {
             try {
-                _locbld.setLanguage(language);
+                localeBuilder.setLanguage(language);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2300,7 +2350,7 @@
          */
         public Builder setScript(String script) {
             try {
-                _locbld.setScript(script);
+                localeBuilder.setScript(script);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2325,7 +2375,7 @@
          */
         public Builder setRegion(String region) {
             try {
-                _locbld.setRegion(region);
+                localeBuilder.setRegion(region);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2352,7 +2402,7 @@
          */
         public Builder setVariant(String variant) {
             try {
-                _locbld.setVariant(variant);
+                localeBuilder.setVariant(variant);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2384,7 +2434,7 @@
          */
         public Builder setExtension(char key, String value) {
             try {
-                _locbld.setExtension(key, value);
+                localeBuilder.setExtension(key, value);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2414,7 +2464,7 @@
          */
         public Builder setUnicodeLocaleKeyword(String key, String type) {
             try {
-                _locbld.setUnicodeLocaleKeyword(key, type);
+                localeBuilder.setUnicodeLocaleKeyword(key, type);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2435,7 +2485,7 @@
          */
         public Builder addUnicodeLocaleAttribute(String attribute) {
             try {
-                _locbld.addUnicodeLocaleAttribute(attribute);
+                localeBuilder.addUnicodeLocaleAttribute(attribute);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2458,7 +2508,7 @@
          */
         public Builder removeUnicodeLocaleAttribute(String attribute) {
             try {
-                _locbld.removeUnicodeLocaleAttribute(attribute);
+                localeBuilder.removeUnicodeLocaleAttribute(attribute);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2471,7 +2521,7 @@
          * @return This builder.
          */
         public Builder clear() {
-            _locbld.clear();
+            localeBuilder.clear();
             return this;
         }
 
@@ -2483,7 +2533,7 @@
          * @see #setExtension(char, String)
          */
         public Builder clearExtensions() {
-            _locbld.clearExtensions();
+            localeBuilder.clearExtensions();
             return this;
         }
 
@@ -2498,9 +2548,9 @@
          * @return A Locale.
          */
         public Locale build() {
-            BaseLocale baseloc = _locbld.getBaseLocale();
-            LocaleExtensions extensions = _locbld.getLocaleExtensions();
-            if (extensions.isEmpty() && baseloc.getVariant().length() > 0) {
+            BaseLocale baseloc = localeBuilder.getBaseLocale();
+            LocaleExtensions extensions = localeBuilder.getLocaleExtensions();
+            if (extensions == null && baseloc.getVariant().length() > 0) {
                 extensions = getCompatibilityExtensions(baseloc.getLanguage(), baseloc.getScript(),
                         baseloc.getRegion(), baseloc.getVariant());
             }
--- a/jdk/src/share/classes/java/util/NavigableMap.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/NavigableMap.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of JCP
  * JSR-166 Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/NavigableSet.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/NavigableSet.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Josh Bloch with assistance from members of JCP
  * JSR-166 Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/Properties.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/Properties.java	Tue Apr 26 15:48:03 2011 -0700
@@ -68,8 +68,9 @@
  * methods work the same way as the load(Reader)/store(Writer, String) pair, except
  * the input/output stream is encoded in ISO 8859-1 character encoding.
  * Characters that cannot be directly represented in this encoding can be written using
- * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode escapes</a>
- * ; only a single 'u' character is allowed in an escape
+ * Unicode escapes as defined in section 3.3 of
+ * <cite>The Java&trade; Language Specification</cite>;
+ * only a single 'u' character is allowed in an escape
  * sequence. The native2ascii tool can be used to convert property files to and
  * from other character encodings.
  *
@@ -272,11 +273,8 @@
      * <a name="unicodeescapes"></a>
      * Characters in keys and elements can be represented in escape
      * sequences similar to those used for character and string literals
-     * (see <a
-     * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">&sect;3.3</a>
-     * and <a
-     * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6">&sect;3.10.6</a>
-     * of the <i>Java Language Specification</i>).
+     * (see sections 3.3 and 3.10.6 of
+     * <cite>The Java&trade; Language Specification</cite>).
      *
      * The differences from the character escape sequences and Unicode
      * escapes used for characters and strings are:
@@ -326,8 +324,9 @@
      * {@link #load(java.io.Reader) load(Reader)} and is assumed to use
      * the ISO 8859-1 character encoding; that is each byte is one Latin1
      * character. Characters not in Latin1, and certain special characters,
-     * are represented in keys and elements using
-     * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode escapes</a>.
+     * are represented in keys and elements using Unicode escapes as defined in
+     * section 3.3 of
+     * <cite>The Java&trade; Language Specification</cite>.
      * <p>
      * The specified stream remains open after this method returns.
      *
--- a/jdk/src/share/classes/java/util/PropertyResourceBundle.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/PropertyResourceBundle.java	Tue Apr 26 15:48:03 2011 -0700
@@ -104,8 +104,9 @@
  * from an InputStream or a Reader, which represents a property file.
  * Constructing a PropertyResourceBundle instance from an InputStream requires
  * that the input stream be encoded in ISO-8859-1.  In that case, characters
- * that cannot be represented in ISO-8859-1 encoding must be represented by
- * <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3">Unicode Escapes</a>,
+ * that cannot be represented in ISO-8859-1 encoding must be represented by Unicode Escapes
+ * as defined in section 3.3 of
+ * <cite>The Java&trade; Language Specification</cite>
  * whereas the other constructor which takes a Reader does not have that limitation.
  *
  * @see ResourceBundle
--- a/jdk/src/share/classes/java/util/Queue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/Queue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util;
--- a/jdk/src/share/classes/java/util/ResourceBundle.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -57,7 +57,6 @@
 import java.util.jar.JarEntry;
 
 import sun.util.locale.BaseLocale;
-import sun.util.locale.LocaleExtensions;
 import sun.util.locale.LocaleObjectCache;
 
 
@@ -290,7 +289,7 @@
      * name for compatibility with some workarounds for bug 4212439.
      */
     private static final ConcurrentMap<CacheKey, BundleReference> cacheList
-        = new ConcurrentHashMap<CacheKey, BundleReference>(INITIAL_CACHE_SIZE);
+        = new ConcurrentHashMap<>(INITIAL_CACHE_SIZE);
 
     /**
      * Queue for reference objects referring to class loaders or bundles.
@@ -1755,7 +1754,7 @@
      * @since 1.6
      */
     public Set<String> keySet() {
-        Set<String> keys = new HashSet<String>();
+        Set<String> keys = new HashSet<>();
         for (ResourceBundle rb = this; rb != null; rb = rb.parent) {
             keys.addAll(rb.handleKeySet());
         }
@@ -1783,7 +1782,7 @@
         if (keySet == null) {
             synchronized (this) {
                 if (keySet == null) {
-                    Set<String> keys = new HashSet<String>();
+                    Set<String> keys = new HashSet<>();
                     Enumeration<String> enumKeys = getKeys();
                     while (enumKeys.hasMoreElements()) {
                         String key = enumKeys.nextElement();
@@ -2301,7 +2300,7 @@
             if (baseName == null) {
                 throw new NullPointerException();
             }
-            return new ArrayList<Locale>(CANDIDATES_CACHE.get(locale.getBaseLocale()));
+            return new ArrayList<>(CANDIDATES_CACHE.get(locale.getBaseLocale()));
         }
 
         private static final CandidateListCache CANDIDATES_CACHE = new CandidateListCache();
@@ -2327,14 +2326,14 @@
                 if (language.equals("nb") || isNorwegianBokmal) {
                     List<Locale> tmpList = getDefaultList("nb", script, region, variant);
                     // Insert a locale replacing "nb" with "no" for every list entry
-                    List<Locale> bokmalList = new LinkedList<Locale>();
+                    List<Locale> bokmalList = new LinkedList<>();
                     for (Locale l : tmpList) {
                         bokmalList.add(l);
                         if (l.getLanguage().length() == 0) {
                             break;
                         }
                         bokmalList.add(Locale.getInstance("no", l.getScript(), l.getCountry(),
-                                l.getVariant(), LocaleExtensions.EMPTY_EXTENSIONS));
+                                l.getVariant(), null));
                     }
                     return bokmalList;
                 } else if (language.equals("nn") || isNorwegianNynorsk) {
@@ -2374,7 +2373,7 @@
                 List<String> variants = null;
 
                 if (variant.length() > 0) {
-                    variants = new LinkedList<String>();
+                    variants = new LinkedList<>();
                     int idx = variant.length();
                     while (idx != -1) {
                         variants.add(variant.substring(0, idx));
@@ -2382,32 +2381,32 @@
                     }
                 }
 
-                LinkedList<Locale> list = new LinkedList<Locale>();
+                List<Locale> list = new LinkedList<>();
 
                 if (variants != null) {
                     for (String v : variants) {
-                        list.add(Locale.getInstance(language, script, region, v, LocaleExtensions.EMPTY_EXTENSIONS));
+                        list.add(Locale.getInstance(language, script, region, v, null));
                     }
                 }
                 if (region.length() > 0) {
-                    list.add(Locale.getInstance(language, script, region, "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, script, region, "", null));
                 }
                 if (script.length() > 0) {
-                    list.add(Locale.getInstance(language, script, "", "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, script, "", "", null));
 
                     // With script, after truncating variant, region and script,
                     // start over without script.
                     if (variants != null) {
                         for (String v : variants) {
-                            list.add(Locale.getInstance(language, "", region, v, LocaleExtensions.EMPTY_EXTENSIONS));
+                            list.add(Locale.getInstance(language, "", region, v, null));
                         }
                     }
                     if (region.length() > 0) {
-                        list.add(Locale.getInstance(language, "", region, "", LocaleExtensions.EMPTY_EXTENSIONS));
+                        list.add(Locale.getInstance(language, "", region, "", null));
                     }
                 }
                 if (language.length() > 0) {
-                    list.add(Locale.getInstance(language, "", "", "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, "", "", "", null));
                 }
                 // Add root locale at the end
                 list.add(Locale.ROOT);
--- a/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/BrokenBarrierException.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/BrokenBarrierException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Callable.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Callable.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CancellationException.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CancellationException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CompletionService.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CompletionService.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -105,7 +105,25 @@
 
     /*
      * The basic strategy is to subdivide the table among Segments,
-     * each of which itself is a concurrently readable hash table.
+     * each of which itself is a concurrently readable hash table.  To
+     * reduce footprint, all but one segments are constructed only
+     * when first needed (see ensureSegment). To maintain visibility
+     * in the presence of lazy construction, accesses to segments as
+     * well as elements of segment's table must use volatile access,
+     * which is done via Unsafe within methods segmentAt etc
+     * below. These provide the functionality of AtomicReferenceArrays
+     * but reduce the levels of indirection. Additionally,
+     * volatile-writes of table elements and entry "next" fields
+     * within locked operations use the cheaper "lazySet" forms of
+     * writes (via putOrderedObject) because these writes are always
+     * followed by lock releases that maintain sequential consistency
+     * of table updates.
+     *
+     * Historical note: The previous version of this class relied
+     * heavily on "final" fields, which avoided some volatile reads at
+     * the expense of a large initial footprint.  Some remnants of
+     * that design (including forced construction of segment 0) exist
+     * to ensure serialization compatibility.
      */
 
     /* ---------------- Constants -------------- */
@@ -137,8 +155,15 @@
     static final int MAXIMUM_CAPACITY = 1 << 30;
 
     /**
+     * The minimum capacity for per-segment tables.  Must be a power
+     * of two, at least two to avoid immediate resizing on next use
+     * after lazy construction.
+     */
+    static final int MIN_SEGMENT_TABLE_CAPACITY = 2;
+
+    /**
      * The maximum number of segments to allow; used to bound
-     * constructor arguments.
+     * constructor arguments. Must be power of two less than 1 << 24.
      */
     static final int MAX_SEGMENTS = 1 << 16; // slightly conservative
 
@@ -164,7 +189,7 @@
     final int segmentShift;
 
     /**
-     * The segments, each of which is a specialized hash table
+     * The segments, each of which is a specialized hash table.
      */
     final Segment<K,V>[] segments;
 
@@ -172,7 +197,65 @@
     transient Set<Map.Entry<K,V>> entrySet;
     transient Collection<V> values;
 
-    /* ---------------- Small Utilities -------------- */
+    /**
+     * ConcurrentHashMap list entry. Note that this is never exported
+     * out as a user-visible Map.Entry.
+     */
+    static final class HashEntry<K,V> {
+        final int hash;
+        final K key;
+        volatile V value;
+        volatile HashEntry<K,V> next;
+
+        HashEntry(int hash, K key, V value, HashEntry<K,V> next) {
+            this.hash = hash;
+            this.key = key;
+            this.value = value;
+            this.next = next;
+        }
+
+        /**
+         * Sets next field with volatile write semantics.  (See above
+         * about use of putOrderedObject.)
+         */
+        final void setNext(HashEntry<K,V> n) {
+            UNSAFE.putOrderedObject(this, nextOffset, n);
+        }
+
+        // Unsafe mechanics
+        static final sun.misc.Unsafe UNSAFE;
+        static final long nextOffset;
+        static {
+            try {
+                UNSAFE = sun.misc.Unsafe.getUnsafe();
+                Class k = HashEntry.class;
+                nextOffset = UNSAFE.objectFieldOffset
+                    (k.getDeclaredField("next"));
+            } catch (Exception e) {
+                throw new Error(e);
+            }
+        }
+    }
+
+    /**
+     * Gets the ith element of given table (if nonnull) with volatile
+     * read semantics.
+     */
+    @SuppressWarnings("unchecked")
+    static final <K,V> HashEntry<K,V> entryAt(HashEntry<K,V>[] tab, int i) {
+        return (tab == null) ? null :
+            (HashEntry<K,V>) UNSAFE.getObjectVolatile
+            (tab, ((long)i << TSHIFT) + TBASE);
+    }
+
+    /**
+     * Sets the ith element of given table, with volatile write
+     * semantics. (See above about use of putOrderedObject.)
+     */
+    static final <K,V> void setEntryAt(HashEntry<K,V>[] tab, int i,
+                                       HashEntry<K,V> e) {
+        UNSAFE.putOrderedObject(tab, ((long)i << TSHIFT) + TBASE, e);
+    }
 
     /**
      * Applies a supplemental hash function to a given hashCode, which
@@ -193,104 +276,67 @@
     }
 
     /**
-     * Returns the segment that should be used for key with given hash
-     * @param hash the hash code for the key
-     * @return the segment
-     */
-    final Segment<K,V> segmentFor(int hash) {
-        return segments[(hash >>> segmentShift) & segmentMask];
-    }
-
-    /* ---------------- Inner Classes -------------- */
-
-    /**
-     * ConcurrentHashMap list entry. Note that this is never exported
-     * out as a user-visible Map.Entry.
-     *
-     * Because the value field is volatile, not final, it is legal wrt
-     * the Java Memory Model for an unsynchronized reader to see null
-     * instead of initial value when read via a data race.  Although a
-     * reordering leading to this is not likely to ever actually
-     * occur, the Segment.readValueUnderLock method is used as a
-     * backup in case a null (pre-initialized) value is ever seen in
-     * an unsynchronized access method.
-     */
-    static final class HashEntry<K,V> {
-        final K key;
-        final int hash;
-        volatile V value;
-        final HashEntry<K,V> next;
-
-        HashEntry(K key, int hash, HashEntry<K,V> next, V value) {
-            this.key = key;
-            this.hash = hash;
-            this.next = next;
-            this.value = value;
-        }
-
-        @SuppressWarnings("unchecked")
-        static final <K,V> HashEntry<K,V>[] newArray(int i) {
-            return new HashEntry[i];
-        }
-    }
-
-    /**
      * Segments are specialized versions of hash tables.  This
      * subclasses from ReentrantLock opportunistically, just to
      * simplify some locking and avoid separate construction.
      */
     static final class Segment<K,V> extends ReentrantLock implements Serializable {
         /*
-         * Segments maintain a table of entry lists that are ALWAYS
-         * kept in a consistent state, so can be read without locking.
-         * Next fields of nodes are immutable (final).  All list
-         * additions are performed at the front of each bin. This
-         * makes it easy to check changes, and also fast to traverse.
-         * When nodes would otherwise be changed, new nodes are
-         * created to replace them. This works well for hash tables
-         * since the bin lists tend to be short. (The average length
-         * is less than two for the default load factor threshold.)
+         * Segments maintain a table of entry lists that are always
+         * kept in a consistent state, so can be read (via volatile
+         * reads of segments and tables) without locking.  This
+         * requires replicating nodes when necessary during table
+         * resizing, so the old lists can be traversed by readers
+         * still using old version of table.
          *
-         * Read operations can thus proceed without locking, but rely
-         * on selected uses of volatiles to ensure that completed
-         * write operations performed by other threads are
-         * noticed. For most purposes, the "count" field, tracking the
-         * number of elements, serves as that volatile variable
-         * ensuring visibility.  This is convenient because this field
-         * needs to be read in many read operations anyway:
-         *
-         *   - All (unsynchronized) read operations must first read the
-         *     "count" field, and should not look at table entries if
-         *     it is 0.
-         *
-         *   - All (synchronized) write operations should write to
-         *     the "count" field after structurally changing any bin.
-         *     The operations must not take any action that could even
-         *     momentarily cause a concurrent read operation to see
-         *     inconsistent data. This is made easier by the nature of
-         *     the read operations in Map. For example, no operation
-         *     can reveal that the table has grown but the threshold
-         *     has not yet been updated, so there are no atomicity
-         *     requirements for this with respect to reads.
-         *
-         * As a guide, all critical volatile reads and writes to the
-         * count field are marked in code comments.
+         * This class defines only mutative methods requiring locking.
+         * Except as noted, the methods of this class perform the
+         * per-segment versions of ConcurrentHashMap methods.  (Other
+         * methods are integrated directly into ConcurrentHashMap
+         * methods.) These mutative methods use a form of controlled
+         * spinning on contention via methods scanAndLock and
+         * scanAndLockForPut. These intersperse tryLocks with
+         * traversals to locate nodes.  The main benefit is to absorb
+         * cache misses (which are very common for hash tables) while
+         * obtaining locks so that traversal is faster once
+         * acquired. We do not actually use the found nodes since they
+         * must be re-acquired under lock anyway to ensure sequential
+         * consistency of updates (and in any case may be undetectably
+         * stale), but they will normally be much faster to re-locate.
+         * Also, scanAndLockForPut speculatively creates a fresh node
+         * to use in put if no node is found.
          */
 
         private static final long serialVersionUID = 2249069246763182397L;
 
         /**
-         * The number of elements in this segment's region.
+         * The maximum number of times to tryLock in a prescan before
+         * possibly blocking on acquire in preparation for a locked
+         * segment operation. On multiprocessors, using a bounded
+         * number of retries maintains cache acquired while locating
+         * nodes.
          */
-        transient volatile int count;
+        static final int MAX_SCAN_RETRIES =
+            Runtime.getRuntime().availableProcessors() > 1 ? 64 : 1;
 
         /**
-         * Number of updates that alter the size of the table. This is
-         * used during bulk-read methods to make sure they see a
-         * consistent snapshot: If modCounts change during a traversal
-         * of segments computing size or checking containsValue, then
-         * we might have an inconsistent view of state so (usually)
-         * must retry.
+         * The per-segment table. Elements are accessed via
+         * entryAt/setEntryAt providing volatile semantics.
+         */
+        transient volatile HashEntry<K,V>[] table;
+
+        /**
+         * The number of elements. Accessed only either within locks
+         * or among other volatile reads that maintain visibility.
+         */
+        transient int count;
+
+        /**
+         * The total number of mutative operations in this segment.
+         * Even though this may overflows 32 bits, it provides
+         * sufficient accuracy for stability checks in CHM isEmpty()
+         * and size() methods.  Accessed only either within locks or
+         * among other volatile reads that maintain visibility.
          */
         transient int modCount;
 
@@ -302,11 +348,6 @@
         transient int threshold;
 
         /**
-         * The per-segment table.
-         */
-        transient volatile HashEntry<K,V>[] table;
-
-        /**
          * The load factor for the hash table.  Even though this value
          * is same for all segments, it is replicated to avoid needing
          * links to outer object.
@@ -314,202 +355,94 @@
          */
         final float loadFactor;
 
-        Segment(int initialCapacity, float lf) {
-            loadFactor = lf;
-            setTable(HashEntry.<K,V>newArray(initialCapacity));
-        }
-
-        @SuppressWarnings("unchecked")
-        static final <K,V> Segment<K,V>[] newArray(int i) {
-            return new Segment[i];
-        }
-
-        /**
-         * Sets table to new HashEntry array.
-         * Call only while holding lock or in constructor.
-         */
-        void setTable(HashEntry<K,V>[] newTable) {
-            threshold = (int)(newTable.length * loadFactor);
-            table = newTable;
+        Segment(float lf, int threshold, HashEntry<K,V>[] tab) {
+            this.loadFactor = lf;
+            this.threshold = threshold;
+            this.table = tab;
         }
 
-        /**
-         * Returns properly casted first entry of bin for given hash.
-         */
-        HashEntry<K,V> getFirst(int hash) {
-            HashEntry<K,V>[] tab = table;
-            return tab[hash & (tab.length - 1)];
-        }
-
-        /**
-         * Reads value field of an entry under lock. Called if value
-         * field ever appears to be null. This is possible only if a
-         * compiler happens to reorder a HashEntry initialization with
-         * its table assignment, which is legal under memory model
-         * but is not known to ever occur.
-         */
-        V readValueUnderLock(HashEntry<K,V> e) {
-            lock();
+        final V put(K key, int hash, V value, boolean onlyIfAbsent) {
+            HashEntry<K,V> node = tryLock() ? null :
+                scanAndLockForPut(key, hash, value);
+            V oldValue;
             try {
-                return e.value;
+                HashEntry<K,V>[] tab = table;
+                int index = (tab.length - 1) & hash;
+                HashEntry<K,V> first = entryAt(tab, index);
+                for (HashEntry<K,V> e = first;;) {
+                    if (e != null) {
+                        K k;
+                        if ((k = e.key) == key ||
+                            (e.hash == hash && key.equals(k))) {
+                            oldValue = e.value;
+                            if (!onlyIfAbsent) {
+                                e.value = value;
+                                ++modCount;
+                            }
+                            break;
+                        }
+                        e = e.next;
+                    }
+                    else {
+                        if (node != null)
+                            node.setNext(first);
+                        else
+                            node = new HashEntry<K,V>(hash, key, value, first);
+                        int c = count + 1;
+                        if (c > threshold && first != null &&
+                            tab.length < MAXIMUM_CAPACITY)
+                            rehash(node);
+                        else
+                            setEntryAt(tab, index, node);
+                        ++modCount;
+                        count = c;
+                        oldValue = null;
+                        break;
+                    }
+                }
             } finally {
                 unlock();
             }
-        }
-
-        /* Specialized implementations of map methods */
-
-        V get(Object key, int hash) {
-            if (count != 0) { // read-volatile
-                HashEntry<K,V> e = getFirst(hash);
-                while (e != null) {
-                    if (e.hash == hash && key.equals(e.key)) {
-                        V v = e.value;
-                        if (v != null)
-                            return v;
-                        return readValueUnderLock(e); // recheck
-                    }
-                    e = e.next;
-                }
-            }
-            return null;
-        }
-
-        boolean containsKey(Object key, int hash) {
-            if (count != 0) { // read-volatile
-                HashEntry<K,V> e = getFirst(hash);
-                while (e != null) {
-                    if (e.hash == hash && key.equals(e.key))
-                        return true;
-                    e = e.next;
-                }
-            }
-            return false;
-        }
-
-        boolean containsValue(Object value) {
-            if (count != 0) { // read-volatile
-                HashEntry<K,V>[] tab = table;
-                int len = tab.length;
-                for (int i = 0 ; i < len; i++) {
-                    for (HashEntry<K,V> e = tab[i]; e != null; e = e.next) {
-                        V v = e.value;
-                        if (v == null) // recheck
-                            v = readValueUnderLock(e);
-                        if (value.equals(v))
-                            return true;
-                    }
-                }
-            }
-            return false;
-        }
-
-        boolean replace(K key, int hash, V oldValue, V newValue) {
-            lock();
-            try {
-                HashEntry<K,V> e = getFirst(hash);
-                while (e != null && (e.hash != hash || !key.equals(e.key)))
-                    e = e.next;
-
-                boolean replaced = false;
-                if (e != null && oldValue.equals(e.value)) {
-                    replaced = true;
-                    e.value = newValue;
-                }
-                return replaced;
-            } finally {
-                unlock();
-            }
+            return oldValue;
         }
 
-        V replace(K key, int hash, V newValue) {
-            lock();
-            try {
-                HashEntry<K,V> e = getFirst(hash);
-                while (e != null && (e.hash != hash || !key.equals(e.key)))
-                    e = e.next;
-
-                V oldValue = null;
-                if (e != null) {
-                    oldValue = e.value;
-                    e.value = newValue;
-                }
-                return oldValue;
-            } finally {
-                unlock();
-            }
-        }
-
-
-        V put(K key, int hash, V value, boolean onlyIfAbsent) {
-            lock();
-            try {
-                int c = count;
-                if (c++ > threshold) // ensure capacity
-                    rehash();
-                HashEntry<K,V>[] tab = table;
-                int index = hash & (tab.length - 1);
-                HashEntry<K,V> first = tab[index];
-                HashEntry<K,V> e = first;
-                while (e != null && (e.hash != hash || !key.equals(e.key)))
-                    e = e.next;
-
-                V oldValue;
-                if (e != null) {
-                    oldValue = e.value;
-                    if (!onlyIfAbsent)
-                        e.value = value;
-                }
-                else {
-                    oldValue = null;
-                    ++modCount;
-                    tab[index] = new HashEntry<K,V>(key, hash, first, value);
-                    count = c; // write-volatile
-                }
-                return oldValue;
-            } finally {
-                unlock();
-            }
-        }
-
-        void rehash() {
+        /**
+         * Doubles size of table and repacks entries, also adding the
+         * given node to new table
+         */
+        @SuppressWarnings("unchecked")
+        private void rehash(HashEntry<K,V> node) {
+            /*
+             * Reclassify nodes in each list to new table.  Because we
+             * are using power-of-two expansion, the elements from
+             * each bin must either stay at same index, or move with a
+             * power of two offset. We eliminate unnecessary node
+             * creation by catching cases where old nodes can be
+             * reused because their next fields won't change.
+             * Statistically, at the default threshold, only about
+             * one-sixth of them need cloning when a table
+             * doubles. The nodes they replace will be garbage
+             * collectable as soon as they are no longer referenced by
+             * any reader thread that may be in the midst of
+             * concurrently traversing table. Entry accesses use plain
+             * array indexing because they are followed by volatile
+             * table write.
+             */
             HashEntry<K,V>[] oldTable = table;
             int oldCapacity = oldTable.length;
-            if (oldCapacity >= MAXIMUM_CAPACITY)
-                return;
-
-            /*
-             * Reclassify nodes in each list to new Map.  Because we are
-             * using power-of-two expansion, the elements from each bin
-             * must either stay at same index, or move with a power of two
-             * offset. We eliminate unnecessary node creation by catching
-             * cases where old nodes can be reused because their next
-             * fields won't change. Statistically, at the default
-             * threshold, only about one-sixth of them need cloning when
-             * a table doubles. The nodes they replace will be garbage
-             * collectable as soon as they are no longer referenced by any
-             * reader thread that may be in the midst of traversing table
-             * right now.
-             */
-
-            HashEntry<K,V>[] newTable = HashEntry.newArray(oldCapacity<<1);
-            threshold = (int)(newTable.length * loadFactor);
-            int sizeMask = newTable.length - 1;
+            int newCapacity = oldCapacity << 1;
+            threshold = (int)(newCapacity * loadFactor);
+            HashEntry<K,V>[] newTable =
+                (HashEntry<K,V>[]) new HashEntry[newCapacity];
+            int sizeMask = newCapacity - 1;
             for (int i = 0; i < oldCapacity ; i++) {
-                // We need to guarantee that any existing reads of old Map can
-                //  proceed. So we cannot yet null out each bin.
                 HashEntry<K,V> e = oldTable[i];
-
                 if (e != null) {
                     HashEntry<K,V> next = e.next;
                     int idx = e.hash & sizeMask;
-
-                    //  Single node on list
-                    if (next == null)
+                    if (next == null)   //  Single node on list
                         newTable[idx] = e;
-
-                    else {
-                        // Reuse trailing consecutive sequence at same slot
+                    else { // Reuse consecutive sequence at same slot
                         HashEntry<K,V> lastRun = e;
                         int lastIdx = idx;
                         for (HashEntry<K,V> last = next;
@@ -522,74 +455,259 @@
                             }
                         }
                         newTable[lastIdx] = lastRun;
-
-                        // Clone all remaining nodes
+                        // Clone remaining nodes
                         for (HashEntry<K,V> p = e; p != lastRun; p = p.next) {
-                            int k = p.hash & sizeMask;
+                            V v = p.value;
+                            int h = p.hash;
+                            int k = h & sizeMask;
                             HashEntry<K,V> n = newTable[k];
-                            newTable[k] = new HashEntry<K,V>(p.key, p.hash,
-                                                             n, p.value);
+                            newTable[k] = new HashEntry<K,V>(h, p.key, v, n);
                         }
                     }
                 }
             }
+            int nodeIndex = node.hash & sizeMask; // add the new node
+            node.setNext(newTable[nodeIndex]);
+            newTable[nodeIndex] = node;
             table = newTable;
         }
 
         /**
+         * Scans for a node containing given key while trying to
+         * acquire lock, creating and returning one if not found. Upon
+         * return, guarantees that lock is held. UNlike in most
+         * methods, calls to method equals are not screened: Since
+         * traversal speed doesn't matter, we might as well help warm
+         * up the associated code and accesses as well.
+         *
+         * @return a new node if key not found, else null
+         */
+        private HashEntry<K,V> scanAndLockForPut(K key, int hash, V value) {
+            HashEntry<K,V> first = entryForHash(this, hash);
+            HashEntry<K,V> e = first;
+            HashEntry<K,V> node = null;
+            int retries = -1; // negative while locating node
+            while (!tryLock()) {
+                HashEntry<K,V> f; // to recheck first below
+                if (retries < 0) {
+                    if (e == null) {
+                        if (node == null) // speculatively create node
+                            node = new HashEntry<K,V>(hash, key, value, null);
+                        retries = 0;
+                    }
+                    else if (key.equals(e.key))
+                        retries = 0;
+                    else
+                        e = e.next;
+                }
+                else if (++retries > MAX_SCAN_RETRIES) {
+                    lock();
+                    break;
+                }
+                else if ((retries & 1) == 0 &&
+                         (f = entryForHash(this, hash)) != first) {
+                    e = first = f; // re-traverse if entry changed
+                    retries = -1;
+                }
+            }
+            return node;
+        }
+
+        /**
+         * Scans for a node containing the given key while trying to
+         * acquire lock for a remove or replace operation. Upon
+         * return, guarantees that lock is held.  Note that we must
+         * lock even if the key is not found, to ensure sequential
+         * consistency of updates.
+         */
+        private void scanAndLock(Object key, int hash) {
+            // similar to but simpler than scanAndLockForPut
+            HashEntry<K,V> first = entryForHash(this, hash);
+            HashEntry<K,V> e = first;
+            int retries = -1;
+            while (!tryLock()) {
+                HashEntry<K,V> f;
+                if (retries < 0) {
+                    if (e == null || key.equals(e.key))
+                        retries = 0;
+                    else
+                        e = e.next;
+                }
+                else if (++retries > MAX_SCAN_RETRIES) {
+                    lock();
+                    break;
+                }
+                else if ((retries & 1) == 0 &&
+                         (f = entryForHash(this, hash)) != first) {
+                    e = first = f;
+                    retries = -1;
+                }
+            }
+        }
+
+        /**
          * Remove; match on key only if value null, else match both.
          */
-        V remove(Object key, int hash, Object value) {
+        final V remove(Object key, int hash, Object value) {
+            if (!tryLock())
+                scanAndLock(key, hash);
+            V oldValue = null;
+            try {
+                HashEntry<K,V>[] tab = table;
+                int index = (tab.length - 1) & hash;
+                HashEntry<K,V> e = entryAt(tab, index);
+                HashEntry<K,V> pred = null;
+                while (e != null) {
+                    K k;
+                    HashEntry<K,V> next = e.next;
+                    if ((k = e.key) == key ||
+                        (e.hash == hash && key.equals(k))) {
+                        V v = e.value;
+                        if (value == null || value == v || value.equals(v)) {
+                            if (pred == null)
+                                setEntryAt(tab, index, next);
+                            else
+                                pred.setNext(next);
+                            ++modCount;
+                            --count;
+                            oldValue = v;
+                        }
+                        break;
+                    }
+                    pred = e;
+                    e = next;
+                }
+            } finally {
+                unlock();
+            }
+            return oldValue;
+        }
+
+        final boolean replace(K key, int hash, V oldValue, V newValue) {
+            if (!tryLock())
+                scanAndLock(key, hash);
+            boolean replaced = false;
+            try {
+                HashEntry<K,V> e;
+                for (e = entryForHash(this, hash); e != null; e = e.next) {
+                    K k;
+                    if ((k = e.key) == key ||
+                        (e.hash == hash && key.equals(k))) {
+                        if (oldValue.equals(e.value)) {
+                            e.value = newValue;
+                            ++modCount;
+                            replaced = true;
+                        }
+                        break;
+                    }
+                }
+            } finally {
+                unlock();
+            }
+            return replaced;
+        }
+
+        final V replace(K key, int hash, V value) {
+            if (!tryLock())
+                scanAndLock(key, hash);
+            V oldValue = null;
+            try {
+                HashEntry<K,V> e;
+                for (e = entryForHash(this, hash); e != null; e = e.next) {
+                    K k;
+                    if ((k = e.key) == key ||
+                        (e.hash == hash && key.equals(k))) {
+                        oldValue = e.value;
+                        e.value = value;
+                        ++modCount;
+                        break;
+                    }
+                }
+            } finally {
+                unlock();
+            }
+            return oldValue;
+        }
+
+        final void clear() {
             lock();
             try {
-                int c = count - 1;
                 HashEntry<K,V>[] tab = table;
-                int index = hash & (tab.length - 1);
-                HashEntry<K,V> first = tab[index];
-                HashEntry<K,V> e = first;
-                while (e != null && (e.hash != hash || !key.equals(e.key)))
-                    e = e.next;
-
-                V oldValue = null;
-                if (e != null) {
-                    V v = e.value;
-                    if (value == null || value.equals(v)) {
-                        oldValue = v;
-                        // All entries following removed node can stay
-                        // in list, but all preceding ones need to be
-                        // cloned.
-                        ++modCount;
-                        HashEntry<K,V> newFirst = e.next;
-                        for (HashEntry<K,V> p = first; p != e; p = p.next)
-                            newFirst = new HashEntry<K,V>(p.key, p.hash,
-                                                          newFirst, p.value);
-                        tab[index] = newFirst;
-                        count = c; // write-volatile
-                    }
-                }
-                return oldValue;
+                for (int i = 0; i < tab.length ; i++)
+                    setEntryAt(tab, i, null);
+                ++modCount;
+                count = 0;
             } finally {
                 unlock();
             }
         }
+    }
 
-        void clear() {
-            if (count != 0) {
-                lock();
-                try {
-                    HashEntry<K,V>[] tab = table;
-                    for (int i = 0; i < tab.length ; i++)
-                        tab[i] = null;
-                    ++modCount;
-                    count = 0; // write-volatile
-                } finally {
-                    unlock();
+    // Accessing segments
+
+    /**
+     * Gets the jth element of given segment array (if nonnull) with
+     * volatile element access semantics via Unsafe.
+     */
+    @SuppressWarnings("unchecked")
+    static final <K,V> Segment<K,V> segmentAt(Segment<K,V>[] ss, int j) {
+        long u = (j << SSHIFT) + SBASE;
+        return ss == null ? null :
+            (Segment<K,V>) UNSAFE.getObjectVolatile(ss, u);
+    }
+
+    /**
+     * Returns the segment for the given index, creating it and
+     * recording in segment table (via CAS) if not already present.
+     *
+     * @param k the index
+     * @return the segment
+     */
+    @SuppressWarnings("unchecked")
+    private Segment<K,V> ensureSegment(int k) {
+        final Segment<K,V>[] ss = this.segments;
+        long u = (k << SSHIFT) + SBASE; // raw offset
+        Segment<K,V> seg;
+        if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u)) == null) {
+            Segment<K,V> proto = ss[0]; // use segment 0 as prototype
+            int cap = proto.table.length;
+            float lf = proto.loadFactor;
+            int threshold = (int)(cap * lf);
+            HashEntry<K,V>[] tab = (HashEntry<K,V>[])new HashEntry[cap];
+            if ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
+                == null) { // recheck
+                Segment<K,V> s = new Segment<K,V>(lf, threshold, tab);
+                while ((seg = (Segment<K,V>)UNSAFE.getObjectVolatile(ss, u))
+                       == null) {
+                    if (UNSAFE.compareAndSwapObject(ss, u, null, seg = s))
+                        break;
                 }
             }
         }
+        return seg;
     }
 
+    // Hash-based segment and entry accesses
 
+    /**
+     * Get the segment for the given hash
+     */
+    @SuppressWarnings("unchecked")
+    private Segment<K,V> segmentForHash(int h) {
+        long u = (((h >>> segmentShift) & segmentMask) << SSHIFT) + SBASE;
+        return (Segment<K,V>) UNSAFE.getObjectVolatile(segments, u);
+    }
+
+    /**
+     * Gets the table entry for the given segment and hash
+     */
+    @SuppressWarnings("unchecked")
+    static final <K,V> HashEntry<K,V> entryForHash(Segment<K,V> seg, int h) {
+        HashEntry<K,V>[] tab;
+        return (seg == null || (tab = seg.table) == null) ? null :
+            (HashEntry<K,V>) UNSAFE.getObjectVolatile
+            (tab, ((long)(((tab.length - 1) & h)) << TSHIFT) + TBASE);
+    }
 
     /* ---------------- Public operations -------------- */
 
@@ -609,14 +727,13 @@
      * negative or the load factor or concurrencyLevel are
      * nonpositive.
      */
+    @SuppressWarnings("unchecked")
     public ConcurrentHashMap(int initialCapacity,
                              float loadFactor, int concurrencyLevel) {
         if (!(loadFactor > 0) || initialCapacity < 0 || concurrencyLevel <= 0)
             throw new IllegalArgumentException();
-
         if (concurrencyLevel > MAX_SEGMENTS)
             concurrencyLevel = MAX_SEGMENTS;
-
         // Find power-of-two sizes best matching arguments
         int sshift = 0;
         int ssize = 1;
@@ -624,21 +741,23 @@
             ++sshift;
             ssize <<= 1;
         }
-        segmentShift = 32 - sshift;
-        segmentMask = ssize - 1;
-        this.segments = Segment.newArray(ssize);
-
+        this.segmentShift = 32 - sshift;
+        this.segmentMask = ssize - 1;
         if (initialCapacity > MAXIMUM_CAPACITY)
             initialCapacity = MAXIMUM_CAPACITY;
         int c = initialCapacity / ssize;
         if (c * ssize < initialCapacity)
             ++c;
-        int cap = 1;
+        int cap = MIN_SEGMENT_TABLE_CAPACITY;
         while (cap < c)
             cap <<= 1;
-
-        for (int i = 0; i < this.segments.length; ++i)
-            this.segments[i] = new Segment<K,V>(cap, loadFactor);
+        // create segments and segments[0]
+        Segment<K,V> s0 =
+            new Segment<K,V>(loadFactor, (int)(cap * loadFactor),
+                             (HashEntry<K,V>[])new HashEntry[cap]);
+        Segment<K,V>[] ss = (Segment<K,V>[])new Segment[ssize];
+        UNSAFE.putOrderedObject(ss, SBASE, s0); // ordered write of segments[0]
+        this.segments = ss;
     }
 
     /**
@@ -701,33 +820,36 @@
      * @return <tt>true</tt> if this map contains no key-value mappings
      */
     public boolean isEmpty() {
-        final Segment<K,V>[] segments = this.segments;
         /*
-         * We keep track of per-segment modCounts to avoid ABA
-         * problems in which an element in one segment was added and
-         * in another removed during traversal, in which case the
-         * table was never actually empty at any point. Note the
-         * similar use of modCounts in the size() and containsValue()
-         * methods, which are the only other methods also susceptible
-         * to ABA problems.
+         * Sum per-segment modCounts to avoid mis-reporting when
+         * elements are concurrently added and removed in one segment
+         * while checking another, in which case the table was never
+         * actually empty at any point. (The sum ensures accuracy up
+         * through at least 1<<31 per-segment modifications before
+         * recheck.)  Methods size() and containsValue() use similar
+         * constructions for stability checks.
          */
-        int[] mc = new int[segments.length];
-        int mcsum = 0;
-        for (int i = 0; i < segments.length; ++i) {
-            if (segments[i].count != 0)
-                return false;
-            else
-                mcsum += mc[i] = segments[i].modCount;
+        long sum = 0L;
+        final Segment<K,V>[] segments = this.segments;
+        for (int j = 0; j < segments.length; ++j) {
+            Segment<K,V> seg = segmentAt(segments, j);
+            if (seg != null) {
+                if (seg.count != 0)
+                    return false;
+                sum += seg.modCount;
+            }
         }
-        // If mcsum happens to be zero, then we know we got a snapshot
-        // before any modifications at all were made.  This is
-        // probably common enough to bother tracking.
-        if (mcsum != 0) {
-            for (int i = 0; i < segments.length; ++i) {
-                if (segments[i].count != 0 ||
-                    mc[i] != segments[i].modCount)
-                    return false;
+        if (sum != 0L) { // recheck unless no modifications
+            for (int j = 0; j < segments.length; ++j) {
+                Segment<K,V> seg = segmentAt(segments, j);
+                if (seg != null) {
+                    if (seg.count != 0)
+                        return false;
+                    sum -= seg.modCount;
+                }
             }
+            if (sum != 0L)
+                return false;
         }
         return true;
     }
@@ -740,45 +862,43 @@
      * @return the number of key-value mappings in this map
      */
     public int size() {
-        final Segment<K,V>[] segments = this.segments;
-        long sum = 0;
-        long check = 0;
-        int[] mc = new int[segments.length];
         // Try a few times to get accurate count. On failure due to
         // continuous async changes in table, resort to locking.
-        for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
-            check = 0;
-            sum = 0;
-            int mcsum = 0;
-            for (int i = 0; i < segments.length; ++i) {
-                sum += segments[i].count;
-                mcsum += mc[i] = segments[i].modCount;
-            }
-            if (mcsum != 0) {
-                for (int i = 0; i < segments.length; ++i) {
-                    check += segments[i].count;
-                    if (mc[i] != segments[i].modCount) {
-                        check = -1; // force retry
-                        break;
+        final Segment<K,V>[] segments = this.segments;
+        int size;
+        boolean overflow; // true if size overflows 32 bits
+        long sum;         // sum of modCounts
+        long last = 0L;   // previous sum
+        int retries = -1; // first iteration isn't retry
+        try {
+            for (;;) {
+                if (retries++ == RETRIES_BEFORE_LOCK) {
+                    for (int j = 0; j < segments.length; ++j)
+                        ensureSegment(j).lock(); // force creation
+                }
+                sum = 0L;
+                size = 0;
+                overflow = false;
+                for (int j = 0; j < segments.length; ++j) {
+                    Segment<K,V> seg = segmentAt(segments, j);
+                    if (seg != null) {
+                        sum += seg.modCount;
+                        int c = seg.count;
+                        if (c < 0 || (size += c) < 0)
+                            overflow = true;
                     }
                 }
+                if (sum == last)
+                    break;
+                last = sum;
             }
-            if (check == sum)
-                break;
+        } finally {
+            if (retries > RETRIES_BEFORE_LOCK) {
+                for (int j = 0; j < segments.length; ++j)
+                    segmentAt(segments, j).unlock();
+            }
         }
-        if (check != sum) { // Resort to locking all segments
-            sum = 0;
-            for (int i = 0; i < segments.length; ++i)
-                segments[i].lock();
-            for (int i = 0; i < segments.length; ++i)
-                sum += segments[i].count;
-            for (int i = 0; i < segments.length; ++i)
-                segments[i].unlock();
-        }
-        if (sum > Integer.MAX_VALUE)
-            return Integer.MAX_VALUE;
-        else
-            return (int)sum;
+        return overflow ? Integer.MAX_VALUE : size;
     }
 
     /**
@@ -794,7 +914,13 @@
      */
     public V get(Object key) {
         int hash = hash(key.hashCode());
-        return segmentFor(hash).get(key, hash);
+        for (HashEntry<K,V> e = entryForHash(segmentForHash(hash), hash);
+             e != null; e = e.next) {
+            K k;
+            if ((k = e.key) == key || (e.hash == hash && key.equals(k)))
+                return e.value;
+        }
+        return null;
     }
 
     /**
@@ -808,7 +934,13 @@
      */
     public boolean containsKey(Object key) {
         int hash = hash(key.hashCode());
-        return segmentFor(hash).containsKey(key, hash);
+        for (HashEntry<K,V> e = entryForHash(segmentForHash(hash), hash);
+             e != null; e = e.next) {
+            K k;
+            if ((k = e.key) == key || (e.hash == hash && key.equals(k)))
+                return true;
+        }
+        return false;
     }
 
     /**
@@ -823,51 +955,47 @@
      * @throws NullPointerException if the specified value is null
      */
     public boolean containsValue(Object value) {
+        // Same idea as size()
         if (value == null)
             throw new NullPointerException();
-
-        // See explanation of modCount use above
-
         final Segment<K,V>[] segments = this.segments;
-        int[] mc = new int[segments.length];
-
-        // Try a few times without locking
-        for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
-            int sum = 0;
-            int mcsum = 0;
-            for (int i = 0; i < segments.length; ++i) {
-                int c = segments[i].count;
-                mcsum += mc[i] = segments[i].modCount;
-                if (segments[i].containsValue(value))
-                    return true;
-            }
-            boolean cleanSweep = true;
-            if (mcsum != 0) {
-                for (int i = 0; i < segments.length; ++i) {
-                    int c = segments[i].count;
-                    if (mc[i] != segments[i].modCount) {
-                        cleanSweep = false;
-                        break;
+        boolean found = false;
+        long last = 0;
+        int retries = -1;
+        try {
+            outer: for (;;) {
+                if (retries++ == RETRIES_BEFORE_LOCK) {
+                    for (int j = 0; j < segments.length; ++j)
+                        ensureSegment(j).lock(); // force creation
+                }
+                long hashSum = 0L;
+                int sum = 0;
+                for (int j = 0; j < segments.length; ++j) {
+                    HashEntry<K,V>[] tab;
+                    Segment<K,V> seg = segmentAt(segments, j);
+                    if (seg != null && (tab = seg.table) != null) {
+                        for (int i = 0 ; i < tab.length; i++) {
+                            HashEntry<K,V> e;
+                            for (e = entryAt(tab, i); e != null; e = e.next) {
+                                V v = e.value;
+                                if (v != null && value.equals(v)) {
+                                    found = true;
+                                    break outer;
+                                }
+                            }
+                        }
+                        sum += seg.modCount;
                     }
                 }
-            }
-            if (cleanSweep)
-                return false;
-        }
-        // Resort to locking all segments
-        for (int i = 0; i < segments.length; ++i)
-            segments[i].lock();
-        boolean found = false;
-        try {
-            for (int i = 0; i < segments.length; ++i) {
-                if (segments[i].containsValue(value)) {
-                    found = true;
+                if (retries > 0 && sum == last)
                     break;
-                }
+                last = sum;
             }
         } finally {
-            for (int i = 0; i < segments.length; ++i)
-                segments[i].unlock();
+            if (retries > RETRIES_BEFORE_LOCK) {
+                for (int j = 0; j < segments.length; ++j)
+                    segmentAt(segments, j).unlock();
+            }
         }
         return found;
     }
@@ -908,7 +1036,11 @@
         if (value == null)
             throw new NullPointerException();
         int hash = hash(key.hashCode());
-        return segmentFor(hash).put(key, hash, value, false);
+        int j = (hash >>> segmentShift) & segmentMask;
+        Segment<K,V> s = segmentAt(segments, j);
+        if (s == null)
+            s = ensureSegment(j);
+        return s.put(key, hash, value, false);
     }
 
     /**
@@ -922,7 +1054,11 @@
         if (value == null)
             throw new NullPointerException();
         int hash = hash(key.hashCode());
-        return segmentFor(hash).put(key, hash, value, true);
+        int j = (hash >>> segmentShift) & segmentMask;
+        Segment<K,V> s = segmentAt(segments, j);
+        if (s == null)
+            s = ensureSegment(j);
+        return s.put(key, hash, value, true);
     }
 
     /**
@@ -948,7 +1084,8 @@
      */
     public V remove(Object key) {
         int hash = hash(key.hashCode());
-        return segmentFor(hash).remove(key, hash, null);
+        Segment<K,V> s = segmentForHash(hash);
+        return s == null ? null : s.remove(key, hash, null);
     }
 
     /**
@@ -958,9 +1095,9 @@
      */
     public boolean remove(Object key, Object value) {
         int hash = hash(key.hashCode());
-        if (value == null)
-            return false;
-        return segmentFor(hash).remove(key, hash, value) != null;
+        Segment<K,V> s;
+        return value != null && (s = segmentForHash(hash)) != null &&
+            s.remove(key, hash, value) != null;
     }
 
     /**
@@ -969,10 +1106,11 @@
      * @throws NullPointerException if any of the arguments are null
      */
     public boolean replace(K key, V oldValue, V newValue) {
+        int hash = hash(key.hashCode());
         if (oldValue == null || newValue == null)
             throw new NullPointerException();
-        int hash = hash(key.hashCode());
-        return segmentFor(hash).replace(key, hash, oldValue, newValue);
+        Segment<K,V> s = segmentForHash(hash);
+        return s != null && s.replace(key, hash, oldValue, newValue);
     }
 
     /**
@@ -983,18 +1121,23 @@
      * @throws NullPointerException if the specified key or value is null
      */
     public V replace(K key, V value) {
+        int hash = hash(key.hashCode());
         if (value == null)
             throw new NullPointerException();
-        int hash = hash(key.hashCode());
-        return segmentFor(hash).replace(key, hash, value);
+        Segment<K,V> s = segmentForHash(hash);
+        return s == null ? null : s.replace(key, hash, value);
     }
 
     /**
      * Removes all of the mappings from this map.
      */
     public void clear() {
-        for (int i = 0; i < segments.length; ++i)
-            segments[i].clear();
+        final Segment<K,V>[] segments = this.segments;
+        for (int j = 0; j < segments.length; ++j) {
+            Segment<K,V> s = segmentAt(segments, j);
+            if (s != null)
+                s.clear();
+        }
     }
 
     /**
@@ -1095,42 +1238,41 @@
             advance();
         }
 
-        public boolean hasMoreElements() { return hasNext(); }
-
+        /**
+         * Set nextEntry to first node of next non-empty table
+         * (in backwards order, to simplify checks).
+         */
         final void advance() {
-            if (nextEntry != null && (nextEntry = nextEntry.next) != null)
-                return;
-
-            while (nextTableIndex >= 0) {
-                if ( (nextEntry = currentTable[nextTableIndex--]) != null)
-                    return;
-            }
-
-            while (nextSegmentIndex >= 0) {
-                Segment<K,V> seg = segments[nextSegmentIndex--];
-                if (seg.count != 0) {
-                    currentTable = seg.table;
-                    for (int j = currentTable.length - 1; j >= 0; --j) {
-                        if ( (nextEntry = currentTable[j]) != null) {
-                            nextTableIndex = j - 1;
-                            return;
-                        }
-                    }
+            for (;;) {
+                if (nextTableIndex >= 0) {
+                    if ((nextEntry = entryAt(currentTable,
+                                             nextTableIndex--)) != null)
+                        break;
                 }
+                else if (nextSegmentIndex >= 0) {
+                    Segment<K,V> seg = segmentAt(segments, nextSegmentIndex--);
+                    if (seg != null && (currentTable = seg.table) != null)
+                        nextTableIndex = currentTable.length - 1;
+                }
+                else
+                    break;
             }
         }
 
-        public boolean hasNext() { return nextEntry != null; }
-
-        HashEntry<K,V> nextEntry() {
-            if (nextEntry == null)
+        final HashEntry<K,V> nextEntry() {
+            HashEntry<K,V> e = nextEntry;
+            if (e == null)
                 throw new NoSuchElementException();
-            lastReturned = nextEntry;
-            advance();
-            return lastReturned;
+            lastReturned = e; // cannot assign until after null check
+            if ((nextEntry = e.next) == null)
+                advance();
+            return e;
         }
 
-        public void remove() {
+        public final boolean hasNext() { return nextEntry != null; }
+        public final boolean hasMoreElements() { return nextEntry != null; }
+
+        public final void remove() {
             if (lastReturned == null)
                 throw new IllegalStateException();
             ConcurrentHashMap.this.remove(lastReturned.key);
@@ -1142,16 +1284,16 @@
         extends HashIterator
         implements Iterator<K>, Enumeration<K>
     {
-        public K next()        { return super.nextEntry().key; }
-        public K nextElement() { return super.nextEntry().key; }
+        public final K next()        { return super.nextEntry().key; }
+        public final K nextElement() { return super.nextEntry().key; }
     }
 
     final class ValueIterator
         extends HashIterator
         implements Iterator<V>, Enumeration<V>
     {
-        public V next()        { return super.nextEntry().value; }
-        public V nextElement() { return super.nextEntry().value; }
+        public final V next()        { return super.nextEntry().value; }
+        public final V nextElement() { return super.nextEntry().value; }
     }
 
     /**
@@ -1271,15 +1413,20 @@
      * The key-value mappings are emitted in no particular order.
      */
     private void writeObject(java.io.ObjectOutputStream s) throws IOException {
+        // force all segments for serialization compatibility
+        for (int k = 0; k < segments.length; ++k)
+            ensureSegment(k);
         s.defaultWriteObject();
 
+        final Segment<K,V>[] segments = this.segments;
         for (int k = 0; k < segments.length; ++k) {
-            Segment<K,V> seg = segments[k];
+            Segment<K,V> seg = segmentAt(segments, k);
             seg.lock();
             try {
                 HashEntry<K,V>[] tab = seg.table;
                 for (int i = 0; i < tab.length; ++i) {
-                    for (HashEntry<K,V> e = tab[i]; e != null; e = e.next) {
+                    HashEntry<K,V> e;
+                    for (e = entryAt(tab, i); e != null; e = e.next) {
                         s.writeObject(e.key);
                         s.writeObject(e.value);
                     }
@@ -1297,13 +1444,20 @@
      * stream (i.e., deserialize it).
      * @param s the stream
      */
+    @SuppressWarnings("unchecked")
     private void readObject(java.io.ObjectInputStream s)
         throws IOException, ClassNotFoundException {
         s.defaultReadObject();
 
-        // Initialize each segment to be minimally sized, and let grow.
-        for (int i = 0; i < segments.length; ++i) {
-            segments[i].setTable(new HashEntry[1]);
+        // Re-initialize segments to be minimally sized, and let grow.
+        int cap = MIN_SEGMENT_TABLE_CAPACITY;
+        final Segment<K,V>[] segments = this.segments;
+        for (int k = 0; k < segments.length; ++k) {
+            Segment<K,V> seg = segments[k];
+            if (seg != null) {
+                seg.threshold = (int)(cap * seg.loadFactor);
+                seg.table = (HashEntry<K,V>[]) new HashEntry[cap];
+            }
         }
 
         // Read the keys and values, and put the mappings in the table
@@ -1315,4 +1469,31 @@
             put(key, value);
         }
     }
+
+    // Unsafe mechanics
+    private static final sun.misc.Unsafe UNSAFE;
+    private static final long SBASE;
+    private static final int SSHIFT;
+    private static final long TBASE;
+    private static final int TSHIFT;
+
+    static {
+        int ss, ts;
+        try {
+            UNSAFE = sun.misc.Unsafe.getUnsafe();
+            Class tc = HashEntry[].class;
+            Class sc = Segment[].class;
+            TBASE = UNSAFE.arrayBaseOffset(tc);
+            SBASE = UNSAFE.arrayBaseOffset(sc);
+            ts = UNSAFE.arrayIndexScale(tc);
+            ss = UNSAFE.arrayIndexScale(sc);
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+        if ((ss & (ss-1)) != 0 || (ts & (ts-1)) != 0)
+            throw new Error("data type scale not a power of two");
+        SSHIFT = 31 - Integer.numberOfLeadingZeros(ss);
+        TSHIFT = 31 - Integer.numberOfLeadingZeros(ts);
+    }
+
 }
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Martin Buchholz with assistance from members of
  * JCP JSR-166 Expert Group and released to the public domain, as explained
- * at http://creativecommons.org/licenses/publicdomain
+ * at http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea and Martin Buchholz with assistance from members of
  * JCP JSR-166 Expert Group and released to the public domain, as explained
- * at http://creativecommons.org/licenses/publicdomain
+ * at http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentNavigableMap.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/CyclicBarrier.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/CyclicBarrier.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/DelayQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/DelayQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 
--- a/jdk/src/share/classes/java/util/concurrent/Delayed.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Delayed.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Exchanger.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Exchanger.java	Tue Apr 26 15:48:03 2011 -0700
@@ -31,7 +31,7 @@
  * Written by Doug Lea, Bill Scherer, and Michael Scott with
  * assistance from members of JCP JSR-166 Expert Group and released to
  * the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ExecutionException.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutionException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Executor.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Executor.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ExecutorService.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutorService.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Executors.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Executors.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -791,18 +791,19 @@
 
     /**
      * Tries to enqueue worker w in wait queue and await change in
-     * worker's eventCount.  If the pool is quiescent, possibly
-     * terminates worker upon exit.  Otherwise, before blocking,
-     * rescans queues to avoid missed signals.  Upon finding work,
-     * releases at least one worker (which may be the current
-     * worker). Rescans restart upon detected staleness or failure to
-     * release due to contention. Note the unusual conventions about
-     * Thread.interrupt here and elsewhere: Because interrupts are
-     * used solely to alert threads to check termination, which is
-     * checked here anyway, we clear status (using Thread.interrupted)
-     * before any call to park, so that park does not immediately
-     * return due to status being set via some other unrelated call to
-     * interrupt in user code.
+     * worker's eventCount.  If the pool is quiescent and there is
+     * more than one worker, possibly terminates worker upon exit.
+     * Otherwise, before blocking, rescans queues to avoid missed
+     * signals.  Upon finding work, releases at least one worker
+     * (which may be the current worker). Rescans restart upon
+     * detected staleness or failure to release due to
+     * contention. Note the unusual conventions about Thread.interrupt
+     * here and elsewhere: Because interrupts are used solely to alert
+     * threads to check termination, which is checked here anyway, we
+     * clear status (using Thread.interrupted) before any call to
+     * park, so that park does not immediately return due to status
+     * being set via some other unrelated call to interrupt in user
+     * code.
      *
      * @param w the calling worker
      * @param c the ctl value on entry
@@ -823,7 +824,8 @@
             else if (w.eventCount != v)
                 return true;                      // update next time
         }
-        if (parallelism + (int)(nc >> AC_SHIFT) == 0 &&
+        if ((!shutdown || !tryTerminate(false)) &&
+            (int)c != 0 && parallelism + (int)(nc >> AC_SHIFT) == 0 &&
             blockedCount == 0 && quiescerCount == 0)
             idleAwaitWork(w, nc, c, v);           // quiescent
         for (boolean rescanned = false;;) {
@@ -893,7 +895,8 @@
                 w.parked = false;
                 if (w.eventCount != v)
                     break;
-                else if (System.nanoTime() - startTime < SHRINK_RATE)
+                else if (System.nanoTime() - startTime <
+                         SHRINK_RATE - (SHRINK_RATE / 10)) // timing slop
                     Thread.interrupted();          // spurious wakeup
                 else if (UNSAFE.compareAndSwapLong(this, ctlOffset,
                                                    currentCtl, prevCtl)) {
@@ -1022,8 +1025,8 @@
         do {} while (!UNSAFE.compareAndSwapLong(this, ctlOffset,  // no mask
                                                 c = ctl, c + AC_UNIT));
         int b;
-        do {} while(!UNSAFE.compareAndSwapInt(this, blockedCountOffset,
-                                              b = blockedCount, b - 1));
+        do {} while (!UNSAFE.compareAndSwapInt(this, blockedCountOffset,
+                                               b = blockedCount, b - 1));
     }
 
     /**
@@ -1175,7 +1178,7 @@
                         ws[k] = w;
                         nextWorkerIndex = k + 1;
                         int m = g & SMASK;
-                        g = k >= m? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1);
+                        g = (k > m) ? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1);
                     }
                 } finally {
                     scanGuard = g;
@@ -1358,8 +1361,8 @@
      */
     final void addQuiescerCount(int delta) {
         int c;
-        do {} while(!UNSAFE.compareAndSwapInt(this, quiescerCountOffset,
-                                              c = quiescerCount, c + delta));
+        do {} while (!UNSAFE.compareAndSwapInt(this, quiescerCountOffset,
+                                               c = quiescerCount, c + delta));
     }
 
     /**
@@ -1712,7 +1715,7 @@
      */
     public int getRunningThreadCount() {
         int r = parallelism + (int)(ctl >> AC_SHIFT);
-        return r <= 0? 0 : r; // suppress momentarily negative values
+        return (r <= 0) ? 0 : r; // suppress momentarily negative values
     }
 
     /**
@@ -1724,7 +1727,7 @@
      */
     public int getActiveThreadCount() {
         int r = parallelism + (int)(ctl >> AC_SHIFT) + blockedCount;
-        return r <= 0? 0 : r; // suppress momentarily negative values
+        return (r <= 0) ? 0 : r; // suppress momentarily negative values
     }
 
     /**
@@ -1879,9 +1882,9 @@
         int ac = rc + blockedCount;
         String level;
         if ((c & STOP_BIT) != 0)
-            level = (tc == 0)? "Terminated" : "Terminating";
+            level = (tc == 0) ? "Terminated" : "Terminating";
         else
-            level = shutdown? "Shutting down" : "Running";
+            level = shutdown ? "Shutting down" : "Running";
         return super.toString() +
             "[" + level +
             ", parallelism = " + pc +
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
@@ -361,7 +361,7 @@
     protected void onStart() {
         queue = new ForkJoinTask<?>[INITIAL_QUEUE_CAPACITY];
         int r = pool.workerSeedGenerator.nextInt();
-        seed = (r == 0)? 1 : r; //  must be nonzero
+        seed = (r == 0) ? 1 : r; //  must be nonzero
     }
 
     /**
@@ -724,7 +724,7 @@
                         Thread.yield();        // for politeness
                 }
                 else
-                    retries = helpJoinTask(joinMe)? MAX_HELP : retries - 1;
+                    retries = helpJoinTask(joinMe) ? MAX_HELP : retries - 1;
             }
             else {
                 retries = MAX_HELP;           // restart if not done
@@ -955,7 +955,7 @@
                     p.addActiveCount(1);
                 }
                 if ((t = (v != this) ? v.deqTask() :
-                     locallyFifo? locallyDeqTask() : popTask()) != null) {
+                     locallyFifo ? locallyDeqTask() : popTask()) != null) {
                     currentSteal = t;
                     t.doExec();
                     currentSteal = ps;
--- a/jdk/src/share/classes/java/util/concurrent/Future.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Future.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/FutureTask.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/FutureTask.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedTransferQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Phaser.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Phaser.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/PriorityBlockingQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RecursiveAction.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RecursiveAction.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RecursiveTask.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RecursiveTask.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RejectedExecutionException.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RejectedExecutionException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RejectedExecutionHandler.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RunnableFuture.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RunnableFuture.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/RunnableScheduledFuture.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledFuture.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledFuture.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/Semaphore.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Semaphore.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/SynchronousQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -31,7 +31,7 @@
  * Written by Doug Lea, Bill Scherer, and Michael Scott with
  * assistance from members of JCP JSR-166 Expert Group and released to
  * the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ThreadFactory.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadFactory.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/TimeUnit.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/TimeUnit.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/TimeoutException.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/TimeoutException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/TransferQueue.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/TransferQueue.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.atomic;
--- a/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
@@ -80,9 +80,8 @@
  * </pre>
  *
  * <p>The memory effects for accesses and updates of atomics generally
- * follow the rules for volatiles, as stated in
- * <a href="http://java.sun.com/docs/books/jls/"> The Java Language
- * Specification, Third Edition (17.4 Memory Model)</a>:
+ * follow the rules for volatiles, as stated in section 17.4 of
+ * <cite>The Java&trade; Language Specification</cite>.
  *
  * <ul>
  *
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/Condition.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/Condition.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/Lock.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/Lock.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
@@ -120,8 +120,8 @@
  *
  * <p>All {@code Lock} implementations <em>must</em> enforce the same
  * memory synchronization semantics as provided by the built-in monitor
- * lock, as described in <a href="http://java.sun.com/docs/books/jls/">
- * The Java Language Specification, Third Edition (17.4 Memory Model)</a>:
+ * lock, as described in section 17.4 of
+ * <cite>The Java&trade; Language Specification</cite>:
  * <ul>
  * <li>A successful {@code lock} operation has the same memory
  * synchronization effects as a successful <em>Lock</em> action.
--- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 package java.util.concurrent.locks;
--- a/jdk/src/share/classes/java/util/concurrent/locks/package-info.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/package-info.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
--- a/jdk/src/share/classes/java/util/concurrent/package-info.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/package-info.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
@@ -218,8 +218,9 @@
  *
  * <h2><a name="MemoryVisibility">Memory Consistency Properties</a></h2>
  *
- * <a href="http://java.sun.com/docs/books/jls/third_edition/html/memory.html">
- * Chapter 17 of the Java Language Specification</a> defines the
+ * Chapter 17 of
+ * <cite>The Java&trade; Language Specification</cite>
+ * defines the
  * <i>happens-before</i> relation on memory operations such as reads and
  * writes of shared variables.  The results of a write by one thread are
  * guaranteed to be visible to a read by another thread only if the write
--- a/jdk/src/share/classes/java/util/jar/JarFile.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/JarFile.java	Tue Apr 26 15:48:03 2011 -0700
@@ -37,6 +37,7 @@
 import sun.security.action.GetPropertyAction;
 import sun.security.util.ManifestEntryVerifier;
 import sun.misc.SharedSecrets;
+import sun.security.util.SignatureFileVerifier;
 
 /**
  * The <code>JarFile</code> class is used to read the contents of a jar file
@@ -178,7 +179,7 @@
                     byte[] b = getBytes(manEntry);
                     man = new Manifest(new ByteArrayInputStream(b));
                     if (!jvInitialized) {
-                        jv = new JarVerifier(b);
+                        jv = new JarVerifier(b, man);
                     }
                 } else {
                     man = new Manifest(super.getInputStream(manEntry));
@@ -297,10 +298,7 @@
             if (names != null) {
                 for (int i = 0; i < names.length; i++) {
                     String name = names[i].toUpperCase(Locale.ENGLISH);
-                    if (name.endsWith(".DSA") ||
-                        name.endsWith(".RSA") ||
-                        name.endsWith(".EC") ||
-                        name.endsWith(".SF")) {
+                    if (SignatureFileVerifier.isBlockOrSF(name)) {
                         // Assume since we found a signature-related file
                         // that the jar is signed and that we therefore
                         // need a JarVerifier and Manifest
@@ -329,17 +327,17 @@
             if (names != null) {
                 for (int i = 0; i < names.length; i++) {
                     JarEntry e = getJarEntry(names[i]);
-                    if (!e.isDirectory()) {
+                    if (!e.isDirectory() &&
+                            SignatureFileVerifier.isBlock(names[i])) {
                         if (mev == null) {
                             mev = new ManifestEntryVerifier
                                 (getManifestFromReference());
                         }
-                        byte[] b = getBytes(e);
-                        if (b != null && b.length > 0) {
-                            jv.beginEntry(e, mev);
-                            jv.update(b.length, b, 0, b.length, mev);
-                            jv.update(-1, null, 0, 0, mev);
-                        }
+                        String key = names[i].substring(
+                                0, names[i].lastIndexOf("."));
+                        jv.verifyBlock(names[i],
+                                getBytes(e),
+                                super.getInputStream(getJarEntry(key + ".SF")));
                     }
                 }
             }
--- a/jdk/src/share/classes/java/util/jar/JarInputStream.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/JarInputStream.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -95,7 +95,7 @@
             man.read(new ByteArrayInputStream(bytes));
             closeEntry();
             if (doVerify) {
-                jv = new JarVerifier(bytes);
+                jv = new JarVerifier(bytes, man);
                 mev = new ManifestEntryVerifier(man);
             }
             return (JarEntry)super.getNextEntry();
--- a/jdk/src/share/classes/java/util/jar/JarVerifier.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java	Tue Apr 26 15:48:03 2011 -0700
@@ -48,35 +48,18 @@
 
     /* a table mapping names to code signers, for jar entries that have
        had their actual hashes verified */
-    private Hashtable verifiedSigners;
+    private Map verifiedSigners;
 
     /* a table mapping names to code signers, for jar entries that have
        passed the .SF/.DSA/.EC -> MANIFEST check */
-    private Hashtable sigFileSigners;
-
-    /* a hash table to hold .SF bytes */
-    private Hashtable sigFileData;
-
-    /** "queue" of pending PKCS7 blocks that we couldn't parse
-     *  until we parsed the .SF file */
-    private ArrayList pendingBlocks;
+    private Map sigFileSigners;
 
     /* cache of CodeSigner objects */
     private ArrayList signerCache;
 
-    /* Are we parsing a block? */
-    private boolean parsingBlockOrSF = false;
-
-    /* Are we done parsing META-INF entries? */
-    private boolean parsingMeta = true;
-
     /* Are there are files to verify? */
     private boolean anyToVerify = true;
 
-    /* The output stream to use when keeping track of files we are interested
-       in */
-    private ByteArrayOutputStream baos;
-
     /** The ManifestDigester object */
     private volatile ManifestDigester manDig;
 
@@ -92,20 +75,20 @@
     /** collect -DIGEST-MANIFEST values for blacklist */
     private List manifestDigests;
 
-    public JarVerifier(byte rawBytes[]) {
+    /** The manifest object */
+    Manifest man = null;
+
+    public JarVerifier(byte rawBytes[], Manifest man) {
+        this.man = man;
         manifestRawBytes = rawBytes;
-        sigFileSigners = new Hashtable();
-        verifiedSigners = new Hashtable();
-        sigFileData = new Hashtable(11);
-        pendingBlocks = new ArrayList();
-        baos = new ByteArrayOutputStream();
+        sigFileSigners = new HashMap();
+        verifiedSigners = new HashMap();
         manifestDigests = new ArrayList();
     }
 
     /**
-     * This method scans to see which entry we're parsing and
-     * keeps various state information depending on what type of
-     * file is being parsed.
+     * This method scans to see which entry we're parsing and keeps
+     * various state information depending on the file being parsed.
      */
     public void beginEntry(JarEntry je, ManifestEntryVerifier mev)
         throws IOException
@@ -129,30 +112,6 @@
          *    b. digest mismatch between the actual jar entry and the manifest
          */
 
-        if (parsingMeta) {
-            String uname = name.toUpperCase(Locale.ENGLISH);
-            if ((uname.startsWith("META-INF/") ||
-                 uname.startsWith("/META-INF/"))) {
-
-                if (je.isDirectory()) {
-                    mev.setEntry(null, je);
-                    return;
-                }
-
-                if (SignatureFileVerifier.isBlockOrSF(uname)) {
-                    /* We parse only DSA, RSA or EC PKCS7 blocks. */
-                    parsingBlockOrSF = true;
-                    baos.reset();
-                    mev.setEntry(null, je);
-                }
-                return;
-            }
-        }
-
-        if (parsingMeta) {
-            doneWithMeta();
-        }
-
         if (je.isDirectory()) {
             mev.setEntry(null, je);
             return;
@@ -188,11 +147,7 @@
         throws IOException
     {
         if (b != -1) {
-            if (parsingBlockOrSF) {
-                baos.write(b);
-            } else {
-                mev.update((byte)b);
-            }
+            mev.update((byte)b);
         } else {
             processEntry(mev);
         }
@@ -207,11 +162,7 @@
         throws IOException
     {
         if (n != -1) {
-            if (parsingBlockOrSF) {
-                baos.write(b, off, n);
-            } else {
-                mev.update(b, off, n);
-            }
+            mev.update(b, off, n);
         } else {
             processEntry(mev);
         }
@@ -223,101 +174,10 @@
     private void processEntry(ManifestEntryVerifier mev)
         throws IOException
     {
-        if (!parsingBlockOrSF) {
-            JarEntry je = mev.getEntry();
-            if ((je != null) && (je.signers == null)) {
-                je.signers = mev.verify(verifiedSigners, sigFileSigners);
-                je.certs = mapSignersToCertArray(je.signers);
-            }
-        } else {
-
-            try {
-                parsingBlockOrSF = false;
-
-                if (debug != null) {
-                    debug.println("processEntry: processing block");
-                }
-
-                String uname = mev.getEntry().getName()
-                                             .toUpperCase(Locale.ENGLISH);
-
-                if (uname.endsWith(".SF")) {
-                    String key = uname.substring(0, uname.length()-3);
-                    byte bytes[] = baos.toByteArray();
-                    // add to sigFileData in case future blocks need it
-                    sigFileData.put(key, bytes);
-                    // check pending blocks, we can now process
-                    // anyone waiting for this .SF file
-                    Iterator it = pendingBlocks.iterator();
-                    while (it.hasNext()) {
-                        SignatureFileVerifier sfv =
-                            (SignatureFileVerifier) it.next();
-                        if (sfv.needSignatureFile(key)) {
-                            if (debug != null) {
-                                debug.println(
-                                 "processEntry: processing pending block");
-                            }
-
-                            sfv.setSignatureFile(bytes);
-                            sfv.process(sigFileSigners, manifestDigests);
-                        }
-                    }
-                    return;
-                }
-
-                // now we are parsing a signature block file
-
-                String key = uname.substring(0, uname.lastIndexOf("."));
-
-                if (signerCache == null)
-                    signerCache = new ArrayList();
-
-                if (manDig == null) {
-                    synchronized(manifestRawBytes) {
-                        if (manDig == null) {
-                            manDig = new ManifestDigester(manifestRawBytes);
-                            manifestRawBytes = null;
-                        }
-                    }
-                }
-
-                SignatureFileVerifier sfv =
-                  new SignatureFileVerifier(signerCache,
-                                            manDig, uname, baos.toByteArray());
-
-                if (sfv.needSignatureFileBytes()) {
-                    // see if we have already parsed an external .SF file
-                    byte[] bytes = (byte[]) sigFileData.get(key);
-
-                    if (bytes == null) {
-                        // put this block on queue for later processing
-                        // since we don't have the .SF bytes yet
-                        // (uname, block);
-                        if (debug != null) {
-                            debug.println("adding pending block");
-                        }
-                        pendingBlocks.add(sfv);
-                        return;
-                    } else {
-                        sfv.setSignatureFile(bytes);
-                    }
-                }
-                sfv.process(sigFileSigners, manifestDigests);
-
-            } catch (IOException ioe) {
-                // e.g. sun.security.pkcs.ParsingException
-                if (debug != null) debug.println("processEntry caught: "+ioe);
-                // ignore and treat as unsigned
-            } catch (SignatureException se) {
-                if (debug != null) debug.println("processEntry caught: "+se);
-                // ignore and treat as unsigned
-            } catch (NoSuchAlgorithmException nsae) {
-                if (debug != null) debug.println("processEntry caught: "+nsae);
-                // ignore and treat as unsigned
-            } catch (CertificateException ce) {
-                if (debug != null) debug.println("processEntry caught: "+ce);
-                // ignore and treat as unsigned
-            }
+        JarEntry je = mev.getEntry();
+        if ((je != null) && (je.signers == null)) {
+            je.signers = mev.verify(verifiedSigners, sigFileSigners);
+            je.certs = mapSignersToCertArray(je.signers);
         }
     }
 
@@ -354,15 +214,15 @@
              * Force a read of the entry data to generate the
              * verification hash.
              */
-            try {
-                InputStream s = jar.getInputStream(entry);
+            try (InputStream s = jar.getInputStream(entry)) {
                 byte[] buffer = new byte[1024];
                 int n = buffer.length;
                 while (n != -1) {
                     n = s.read(buffer, 0, buffer.length);
                 }
-                s.close();
             } catch (IOException e) {
+                // Ignore. When an exception is thrown, code signer
+                // will not be assigned.
             }
         }
         return getCodeSigners(name);
@@ -408,11 +268,7 @@
      */
     void doneWithMeta()
     {
-        parsingMeta = false;
         anyToVerify = !sigFileSigners.isEmpty();
-        baos = null;
-        sigFileData = null;
-        pendingBlocks = null;
         signerCache = null;
         manDig = null;
         // MANIFEST.MF is always treated as signed and verified,
@@ -423,6 +279,41 @@
         }
     }
 
+    /**
+     * Verifies a PKCS7 SignedData block
+     * @param key name of block
+     * @param block the pkcs7 file
+     * @param ins the clear data
+     */
+    void verifyBlock(String key, byte[] block, InputStream ins) {
+        try {
+            if (signerCache == null)
+                signerCache = new ArrayList();
+
+            if (manDig == null) {
+                synchronized(manifestRawBytes) {
+                    if (manDig == null) {
+                        manDig = new ManifestDigester(manifestRawBytes);
+                        manifestRawBytes = null;
+                    }
+                }
+            }
+            SignatureFileVerifier sfv =
+                    new SignatureFileVerifier(signerCache, man,
+                                        manDig, key, block);
+
+            if (sfv.needSignatureFile()) {
+                // see if we have already parsed an external .SF file
+                sfv.setSignatureFile(ins);
+            }
+            sfv.process(sigFileSigners, manifestDigests);
+        } catch (Exception e) {
+            if (debug != null) {
+                e.printStackTrace();
+            }
+        }
+    }
+
     static class VerifierStream extends java.io.InputStream {
 
         private InputStream is;
@@ -553,10 +444,7 @@
          * but this handles a CodeSource of any type, just in case.
          */
         CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
-        List sourceList = new ArrayList();
-        for (int i = 0; i < sources.length; i++) {
-            sourceList.add(sources[i]);
-        }
+        List sourceList = Arrays.asList(sources);
         int j = sourceList.indexOf(cs);
         if (j != -1) {
             CodeSigner[] match;
--- a/jdk/src/share/classes/java/util/jar/Pack200.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Tue Apr 26 15:48:03 2011 -0700
@@ -181,8 +181,8 @@
      * The class files will not contain identical bytes, since the unpacker
      * is free to change minor class file features such as constant pool order.
      * However, the class files will be semantically identical,
-     * as specified in the Java Virtual Machine Specification
-     * <a href="http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html">http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html</a>.
+     * as specified in
+     * <cite>The Java&trade; Virtual Machine Specification</cite>.
      * <p>
      * By default, the packer does not change the order of JAR elements.
      * Also, the modification time and deflation hint of each
--- a/jdk/src/share/classes/java/util/logging/FileHandler.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/logging/FileHandler.java	Tue Apr 26 15:48:03 2011 -0700
@@ -409,22 +409,25 @@
                     // Try the next file.
                     continue;
                 }
+                boolean available;
                 try {
-                    FileLock fl = fc.tryLock();
-                    if (fl == null) {
-                        // We failed to get the lock.  Try next file.
-                        continue;
-                    }
+                    available = fc.tryLock() != null;
                     // We got the lock OK.
                 } catch (IOException ix) {
                     // We got an IOException while trying to get the lock.
                     // This normally indicates that locking is not supported
                     // on the target directory.  We have to proceed without
                     // getting a lock.   Drop through.
+                    available = true;
                 }
-                // We got the lock.  Remember it.
-                locks.put(lockFileName, lockFileName);
-                break;
+                if (available) {
+                    // We got the lock.  Remember it.
+                    locks.put(lockFileName, lockFileName);
+                    break;
+                }
+
+                // We failed to get the lock.  Try next file.
+                fc.close();
             }
         }
 
--- a/jdk/src/share/classes/java/util/regex/Pattern.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java	Tue Apr 26 15:48:03 2011 -0700
@@ -369,13 +369,10 @@
  * part of an unescaped construct.
  *
  * <p> Backslashes within string literals in Java source code are interpreted
- * as required by the <a
- * href="http://java.sun.com/docs/books/jls">Java Language
- * Specification</a> as either <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#100850">Unicode
- * escapes</a> or other <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#101089">character
- * escapes</a>.  It is therefore necessary to double backslashes in string
+ * as required by
+ * <cite>The Java&trade; Language Specification</cite>
+ * as either Unicode escapes (section 3.3) or other character escapes (section 3.10.6)
+ * It is therefore necessary to double backslashes in string
  * literals that represent regular expressions to protect them from
  * interpretation by the Java bytecode compiler.  The string literal
  * <tt>"&#92;b"</tt>, for example, matches a single backspace character when
@@ -525,9 +522,9 @@
  * Canonical Equivalents.
  *
  * <p> Unicode escape sequences such as <tt>&#92;u2014</tt> in Java source code
- * are processed as described in <a
- * href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#100850">\u00A73.3</a>
- * of the Java Language Specification.  Such escape sequences are also
+ * are processed as described in section 3.3 of
+ * <cite>The Java&trade; Language Specification</cite>.
+ * Such escape sequences are also
  * implemented directly by the regular-expression parser so that Unicode
  * escapes can be used in expressions that are read from files or from the
  * keyboard.  Thus the strings <tt>"&#92;u2014"</tt> and <tt>"\\u2014"</tt>,
--- a/jdk/src/share/classes/java/util/zip/ZipFile.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/java/util/zip/ZipFile.java	Tue Apr 26 15:48:03 2011 -0700
@@ -31,11 +31,13 @@
 import java.io.EOFException;
 import java.io.File;
 import java.nio.charset.Charset;
-import java.util.Vector;
+import java.util.ArrayDeque;
+import java.util.Deque;
 import java.util.Enumeration;
-import java.util.Set;
-import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.NoSuchElementException;
+import java.util.WeakHashMap;
 import java.security.AccessController;
 import sun.security.action.GetPropertyAction;
 import static java.util.zip.ZipConstants64.*;
@@ -54,7 +56,7 @@
     private long jzfile;  // address of jzfile data
     private String name;  // zip file name
     private int total;    // total number of entries
-    private boolean closeRequested;
+    private volatile boolean closeRequested = false;
 
     private static final int STORED = ZipEntry.STORED;
     private static final int DEFLATED = ZipEntry.DEFLATED;
@@ -314,8 +316,9 @@
     // freeEntry releases the C jzentry struct.
     private static native void freeEntry(long jzfile, long jzentry);
 
-    // the outstanding inputstreams that need to be closed.
-    private Set<InputStream> streams = new HashSet<>();
+    // the outstanding inputstreams that need to be closed,
+    // mapped to the inflater objects they use.
+    private final Map<InputStream, Inflater> streams = new WeakHashMap<>();
 
     /**
      * Returns an input stream for reading the contents of the specified
@@ -351,51 +354,21 @@
 
             switch (getEntryMethod(jzentry)) {
             case STORED:
-                streams.add(in);
+                synchronized (streams) {
+                    streams.put(in, null);
+                }
                 return in;
             case DEFLATED:
-                final ZipFileInputStream zfin = in;
                 // MORE: Compute good size for inflater stream:
                 long size = getEntrySize(jzentry) + 2; // Inflater likes a bit of slack
                 if (size > 65536) size = 8192;
                 if (size <= 0) size = 4096;
-                InputStream is = new InflaterInputStream(zfin, getInflater(), (int)size) {
-                    private boolean isClosed = false;
-
-                    public void close() throws IOException {
-                        if (!isClosed) {
-                            super.close();
-                            releaseInflater(inf);
-                            isClosed = true;
-                        }
-                    }
-                    // Override fill() method to provide an extra "dummy" byte
-                    // at the end of the input stream. This is required when
-                    // using the "nowrap" Inflater option.
-                    protected void fill() throws IOException {
-                        if (eof) {
-                            throw new EOFException(
-                                "Unexpected end of ZLIB input stream");
-                        }
-                        len = this.in.read(buf, 0, buf.length);
-                        if (len == -1) {
-                            buf[0] = 0;
-                            len = 1;
-                            eof = true;
-                        }
-                        inf.setInput(buf, 0, len);
-                    }
-                    private boolean eof;
-
-                    public int available() throws IOException {
-                        if (isClosed)
-                            return 0;
-                        long avail = zfin.size() - inf.getBytesWritten();
-                        return avail > (long) Integer.MAX_VALUE ?
-                            Integer.MAX_VALUE : (int) avail;
-                    }
-                };
-                streams.add(is);
+                Inflater inf = getInflater();
+                InputStream is =
+                    new ZipFileInflaterInputStream(in, inf, (int)size);
+                synchronized (streams) {
+                    streams.put(is, inf);
+                }
                 return is;
             default:
                 throw new ZipException("invalid compression method");
@@ -403,36 +376,91 @@
         }
     }
 
+    private class ZipFileInflaterInputStream extends InflaterInputStream {
+        private volatile boolean closeRequested = false;
+        private boolean eof = false;
+        private final ZipFileInputStream zfin;
+
+        ZipFileInflaterInputStream(ZipFileInputStream zfin, Inflater inf,
+                int size) {
+            super(zfin, inf, size);
+            this.zfin = zfin;
+        }
+
+        public void close() throws IOException {
+            if (closeRequested)
+                return;
+            closeRequested = true;
+
+            super.close();
+            Inflater inf;
+            synchronized (streams) {
+                inf = streams.remove(this);
+            }
+            if (inf != null) {
+                releaseInflater(inf);
+            }
+        }
+
+        // Override fill() method to provide an extra "dummy" byte
+        // at the end of the input stream. This is required when
+        // using the "nowrap" Inflater option.
+        protected void fill() throws IOException {
+            if (eof) {
+                throw new EOFException("Unexpected end of ZLIB input stream");
+            }
+            len = in.read(buf, 0, buf.length);
+            if (len == -1) {
+                buf[0] = 0;
+                len = 1;
+                eof = true;
+            }
+            inf.setInput(buf, 0, len);
+        }
+
+        public int available() throws IOException {
+            if (closeRequested)
+                return 0;
+            long avail = zfin.size() - inf.getBytesWritten();
+            return (avail > (long) Integer.MAX_VALUE ?
+                    Integer.MAX_VALUE : (int) avail);
+        }
+
+        protected void finalize() throws Throwable {
+            close();
+        }
+    }
+
     /*
      * Gets an inflater from the list of available inflaters or allocates
      * a new one.
      */
     private Inflater getInflater() {
-        synchronized (inflaters) {
-            int size = inflaters.size();
-            if (size > 0) {
-                Inflater inf = (Inflater)inflaters.remove(size - 1);
-                return inf;
-            } else {
-                return new Inflater(true);
+        Inflater inf;
+        synchronized (inflaterCache) {
+            while (null != (inf = inflaterCache.poll())) {
+                if (false == inf.ended()) {
+                    return inf;
+                }
             }
         }
+        return new Inflater(true);
     }
 
     /*
      * Releases the specified inflater to the list of available inflaters.
      */
     private void releaseInflater(Inflater inf) {
-        synchronized (inflaters) {
-            if (inf.ended())
-                return;
+        if (false == inf.ended()) {
             inf.reset();
-            inflaters.add(inf);
+            synchronized (inflaterCache) {
+                inflaterCache.add(inf);
+            }
         }
     }
 
     // List of available Inflater objects for decompression
-    private Vector inflaters = new Vector();
+    private Deque<Inflater> inflaterCache = new ArrayDeque<>();
 
     /**
      * Returns the path name of the ZIP file.
@@ -540,14 +568,32 @@
      * @throws IOException if an I/O error has occurred
      */
     public void close() throws IOException {
-        synchronized (this) {
-            closeRequested = true;
+        if (closeRequested)
+            return;
+        closeRequested = true;
 
-            if (streams.size() !=0) {
-                Set<InputStream> copy = streams;
-                streams = new HashSet<>();
-                for (InputStream is: copy)
-                    is.close();
+        synchronized (this) {
+            // Close streams, release their inflaters
+            synchronized (streams) {
+                if (false == streams.isEmpty()) {
+                    Map<InputStream, Inflater> copy = new HashMap<>(streams);
+                    streams.clear();
+                    for (Map.Entry<InputStream, Inflater> e : copy.entrySet()) {
+                        e.getKey().close();
+                        Inflater inf = e.getValue();
+                        if (inf != null) {
+                            inf.end();
+                        }
+                    }
+                }
+            }
+
+            // Release cached inflaters
+            Inflater inf;
+            synchronized (inflaterCache) {
+                while (null != (inf = inflaterCache.poll())) {
+                    inf.end();
+                }
             }
 
             if (jzfile != 0) {
@@ -556,23 +602,13 @@
                 jzfile = 0;
 
                 close(zf);
-
-                // Release inflaters
-                synchronized (inflaters) {
-                    int size = inflaters.size();
-                    for (int i = 0; i < size; i++) {
-                        Inflater inf = (Inflater)inflaters.get(i);
-                        inf.end();
-                    }
-                }
             }
         }
     }
 
-
     /**
-     * Ensures that the <code>close</code> method of this ZIP file is
-     * called when there are no more references to it.
+     * Ensures that the system resources held by this ZipFile object are
+     * released when there are no more references to it.
      *
      * <p>
      * Since the time when GC would invoke this method is undetermined,
@@ -611,6 +647,7 @@
      * (possibly compressed) zip file entry.
      */
    private class ZipFileInputStream extends InputStream {
+        private volatile boolean closeRequested = false;
         protected long jzentry; // address of jzentry data
         private   long pos;     // current position within entry data
         protected long rem;     // number of remaining bytes within entry
@@ -678,15 +715,25 @@
         }
 
         public void close() {
+            if (closeRequested)
+                return;
+            closeRequested = true;
+
             rem = 0;
             synchronized (ZipFile.this) {
                 if (jzentry != 0 && ZipFile.this.jzfile != 0) {
                     freeEntry(ZipFile.this.jzfile, jzentry);
                     jzentry = 0;
                 }
+            }
+            synchronized (streams) {
                 streams.remove(this);
             }
         }
+
+        protected void finalize() {
+            close();
+        }
     }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/crypto/AEADBadTagException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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 javax.crypto;
+
+/**
+ * This exception is thrown when a {@link Cipher} operating in
+ * an AEAD mode (such as GCM/CCM) is unable to verify the supplied
+ * authentication tag.
+ *
+ * @since 1.7
+ */
+public class AEADBadTagException extends BadPaddingException {
+
+    private static final long serialVersionUID = -488059093241685509L;
+
+    /**
+     * Constructs a AEADBadTagException with no detail message.
+     */
+    public AEADBadTagException() {
+        super();
+    }
+
+    /**
+     * Constructs a AEADBadTagException with the specified
+     * detail message.
+     *
+     * @param msg the detail message.
+     */
+    public AEADBadTagException(String msg) {
+        super(msg);
+    }
+}
--- a/jdk/src/share/classes/javax/crypto/Cipher.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/crypto/Cipher.java	Tue Apr 26 15:48:03 2011 -0700
@@ -88,8 +88,35 @@
  * example, the SunJCE provider uses a default of 64 bits for DES.)
  * Thus, block ciphers can be turned into byte-oriented stream ciphers by
  * using an 8 bit mode such as CFB8 or OFB8.
+ * <p>
+ * Modes such as Authenticated Encryption with Associated Data (AEAD)
+ * provide authenticity assurances for both confidential data and
+ * Additional Associated Data (AAD) that is not encrypted.  (Please see
+ * <a href="http://www.ietf.org/rfc/rfc5116.txt"> RFC 5116 </a> for more
+ * information on AEAD and AEAD algorithms such as GCM/CCM.) Both
+ * confidential and AAD data can be used when calculating the
+ * authentication tag (similar to a {@link Mac}).  This tag is appended
+ * to the ciphertext during encryption, and is verified on decryption.
+ * <p>
+ * AEAD modes such as GCM/CCM perform all AAD authenticity calculations
+ * before starting the ciphertext authenticity calculations.  To avoid
+ * implementations having to internally buffer ciphertext, all AAD data
+ * must be supplied to GCM/CCM implementations (via the {@code
+ * updateAAD} methods) <b>before</b> the ciphertext is processed (via
+ * the {@code update} and {@code doFinal} methods).
  *
- * <p> Every implementation of the Java platform is required to support
+ * <pre>
+ *     GCMParameterSpec s = new GCMParameterSpec(...);
+ *     cipher.init(..., s);
+ *
+ *     // If the GCMParameterSpec is needed again
+ *     cipher.getParameters().getParameterSpec(GCMParameterSpec.class));
+ *
+ *     cipher.updateAAD(...);  // AAD
+ *     cipher.update(...);     // Multi-part update
+ *     cipher.doFinal(...);    // conclusion of operation
+ * </pre>
+ * Every implementation of the Java platform is required to support
  * the following standard <code>Cipher</code> transformations with the keysizes
  * in parentheses:
  * <ul>
@@ -894,7 +921,7 @@
      * <code>inputLen</code> (in bytes).
      *
      * <p>This call takes into account any unprocessed (buffered) data from a
-     * previous <code>update</code> call, and padding.
+     * previous <code>update</code> call, padding, and AEAD tagging.
      *
      * <p>The actual output length of the next <code>update</code> or
      * <code>doFinal</code> call may be smaller than the length returned by
@@ -1090,6 +1117,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them using the {@link SecureRandom <code>SecureRandom</code>}
@@ -1110,8 +1142,8 @@
      * @param key the key
      *
      * @exception InvalidKeyException if the given key is inappropriate for
-     * initializing this cipher, or if this cipher is being initialized for
-     * decryption and requires algorithm parameters that cannot be
+     * initializing this cipher, or requires
+     * algorithm parameters that cannot be
      * determined from the given key, or if the given key has a keysize that
      * exceeds the maximum allowable keysize (as determined from the
      * configured jurisdiction policy files).
@@ -1138,6 +1170,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -1155,8 +1192,8 @@
      * @param random the source of randomness
      *
      * @exception InvalidKeyException if the given key is inappropriate for
-     * initializing this cipher, or if this cipher is being initialized for
-     * decryption and requires algorithm parameters that cannot be
+     * initializing this cipher, or requires
+     * algorithm parameters that cannot be
      * determined from the given key, or if the given key has a keysize that
      * exceeds the maximum allowable keysize (as determined from the
      * configured jurisdiction policy files).
@@ -1202,6 +1239,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them using the {@link SecureRandom <code>SecureRandom</code>}
@@ -1227,7 +1269,7 @@
      * keysize (as determined from the configured jurisdiction policy files).
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or this cipher is being initialized for decryption and requires
+     * or this cipher requires
      * algorithm parameters and <code>params</code> is null, or the given
      * algorithm parameters imply a cryptographic strength that would exceed
      * the legal limits (as determined from the configured jurisdiction
@@ -1258,6 +1300,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -1280,7 +1327,7 @@
      * keysize (as determined from the configured jurisdiction policy files).
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or this cipher is being initialized for decryption and requires
+     * or this cipher requires
      * algorithm parameters and <code>params</code> is null, or the given
      * algorithm parameters imply a cryptographic strength that would exceed
      * the legal limits (as determined from the configured jurisdiction
@@ -1323,6 +1370,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them using the {@link SecureRandom <code>SecureRandom</code>}
@@ -1348,7 +1400,7 @@
      * keysize (as determined from the configured jurisdiction policy files).
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or this cipher is being initialized for decryption and requires
+     * or this cipher requires
      * algorithm parameters and <code>params</code> is null, or the given
      * algorithm parameters imply a cryptographic strength that would exceed
      * the legal limits (as determined from the configured jurisdiction
@@ -1379,6 +1431,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -1401,7 +1458,7 @@
      * keysize (as determined from the configured jurisdiction policy files).
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or this cipher is being initialized for decryption and requires
+     * or this cipher requires
      * algorithm parameters and <code>params</code> is null, or the given
      * algorithm parameters imply a cryptographic strength that would exceed
      * the legal limits (as determined from the configured jurisdiction
@@ -1444,7 +1501,7 @@
      * derived from the public key in the given certificate, the underlying
      * cipher
      * implementation is supposed to generate the required parameters itself
-     * (using provider-specific default or ramdom values) if it is being
+     * (using provider-specific default or random values) if it is being
      * initialized for encryption or key wrapping, and raise an <code>
      * InvalidKeyException</code> if it is being initialized for decryption or
      * key unwrapping.
@@ -1452,6 +1509,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them using the
@@ -1474,8 +1536,7 @@
      *
      * @exception InvalidKeyException if the public key in the given
      * certificate is inappropriate for initializing this cipher, or this
-     * cipher is being initialized for decryption or unwrapping keys and
-     * requires algorithm parameters that cannot be determined from the
+     * cipher requires algorithm parameters that cannot be determined from the
      * public key in the given certificate, or the keysize of the public key
      * in the given certificate has a keysize that exceeds the maximum
      * allowable keysize (as determined by the configured jurisdiction policy
@@ -1518,6 +1579,11 @@
      * {@link #getParameters() getParameters} or
      * {@link #getIV() getIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -1536,7 +1602,7 @@
      *
      * @exception InvalidKeyException if the public key in the given
      * certificate is inappropriate for initializing this cipher, or this
-     * cipher is being initialized for decryption or unwrapping keys and
+     * cipher
      * requires algorithm parameters that cannot be determined from the
      * public key in the given certificate, or the keysize of the public key
      * in the given certificate has a keysize that exceeds the maximum
@@ -1865,6 +1931,9 @@
      * <p>Input data that may have been buffered during a previous
      * <code>update</code> operation is processed, with padding (if requested)
      * being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in a new buffer.
      *
      * <p>Upon finishing, this method resets this cipher object to the state
@@ -1888,6 +1957,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final byte[] doFinal()
             throws IllegalBlockSizeException, BadPaddingException {
@@ -1904,6 +1976,9 @@
      * <p>Input data that may have been buffered during a previous
      * <code>update</code> operation is processed, with padding (if requested)
      * being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in the <code>output</code> buffer, starting at
      * <code>outputOffset</code> inclusive.
      *
@@ -1940,6 +2015,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final int doFinal(byte[] output, int outputOffset)
             throws IllegalBlockSizeException, ShortBufferException,
@@ -1963,6 +2041,9 @@
      * <p>The bytes in the <code>input</code> buffer, and any input bytes that
      * may have been buffered during a previous <code>update</code> operation,
      * are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in a new buffer.
      *
      * <p>Upon finishing, this method resets this cipher object to the state
@@ -1988,6 +2069,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final byte[] doFinal(byte[] input)
             throws IllegalBlockSizeException, BadPaddingException {
@@ -2011,6 +2095,9 @@
      * buffer, starting at <code>inputOffset</code> inclusive, and any input
      * bytes that may have been buffered during a previous <code>update</code>
      * operation, are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in a new buffer.
      *
      * <p>Upon finishing, this method resets this cipher object to the state
@@ -2039,6 +2126,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final byte[] doFinal(byte[] input, int inputOffset, int inputLen)
             throws IllegalBlockSizeException, BadPaddingException {
@@ -2063,6 +2153,9 @@
      * buffer, starting at <code>inputOffset</code> inclusive, and any input
      * bytes that may have been buffered during a previous <code>update</code>
      * operation, are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in the <code>output</code> buffer.
      *
      * <p>If the <code>output</code> buffer is too small to hold the result,
@@ -2105,6 +2198,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final int doFinal(byte[] input, int inputOffset, int inputLen,
                              byte[] output)
@@ -2133,6 +2229,9 @@
      * bytes that may have been buffered during a previous
      * <code>update</code> operation, are processed, with padding
      * (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in the <code>output</code> buffer, starting at
      * <code>outputOffset</code> inclusive.
      *
@@ -2178,6 +2277,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     public final int doFinal(byte[] input, int inputOffset, int inputLen,
                              byte[] output, int outputOffset)
@@ -2203,8 +2305,11 @@
      * depending on how this cipher was initialized.
      *
      * <p>All <code>input.remaining()</code> bytes starting at
-     * <code>input.position()</code> are processed. The result is stored
-     * in the output buffer.
+     * <code>input.position()</code> are processed.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
+     * The result is stored in the output buffer.
      * Upon return, the input buffer's position will be equal
      * to its limit; its limit will not have changed. The output buffer's
      * position will have advanced by n, where n is the value returned
@@ -2250,6 +2355,10 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
+     *
      * @since 1.5
      */
     public final int doFinal(ByteBuffer input, ByteBuffer output)
@@ -2441,4 +2550,128 @@
         CryptoPermission cp = getConfiguredPermission(transformation);
         return cp.getAlgorithmParameterSpec();
     }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD).
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     *
+     * @param src the buffer containing the Additional Authentication Data
+     *
+     * @throws IllegalArgumentException if the {@code src}
+     * byte array is null
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if the corresponding method
+     * in the {@code CipherSpi} has not been overridden by an
+     * implementation
+     *
+     * @since 1.7
+     */
+    public final void updateAAD(byte[] src) {
+        if (src == null) {
+            throw new IllegalArgumentException("src buffer is null");
+        }
+
+        updateAAD(src, 0, src.length);
+    }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD), using a subset of the provided buffer.
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     *
+     * @param src the buffer containing the AAD
+     * @param offset the offset in {@code src} where the AAD input starts
+     * @param len the number of AAD bytes
+     *
+     * @throws IllegalArgumentException if the {@code src}
+     * byte array is null, or the {@code offset} or {@code length}
+     * is less than 0, or the sum of the {@code offset} and
+     * {@code len} is greater than the length of the
+     * {@code src} byte array
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if the corresponding method
+     * in the {@code CipherSpi} has not been overridden by an
+     * implementation
+     *
+     * @since 1.7
+     */
+    public final void updateAAD(byte[] src, int offset, int len) {
+        checkCipherState();
+
+        // Input sanity check
+        if ((src == null) || (offset < 0) || (len < 0)
+                || ((len + offset) > src.length)) {
+            throw new IllegalArgumentException("Bad arguments");
+        }
+
+        chooseFirstProvider();
+        if (len == 0) {
+            return;
+        }
+        spi.engineUpdateAAD(src, offset, len);
+    }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD).
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     * <p>
+     * All {@code src.remaining()} bytes starting at
+     * {@code src.position()} are processed.
+     * Upon return, the input buffer's position will be equal
+     * to its limit; its limit will not have changed.
+     *
+     * @param src the buffer containing the AAD
+     *
+     * @throws IllegalArgumentException if the {@code src ByteBuffer}
+     * is null
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if the corresponding method
+     * in the {@code CipherSpi} has not been overridden by an
+     * implementation
+     *
+     * @since 1.7
+     */
+    public final void updateAAD(ByteBuffer src) {
+        checkCipherState();
+
+        // Input sanity check
+        if (src == null) {
+            throw new IllegalArgumentException("src ByteBuffer is null");
+        }
+
+        chooseFirstProvider();
+        if (src.remaining() == 0) {
+            return;
+        }
+        spi.engineUpdateAAD(src);
+    }
 }
--- a/jdk/src/share/classes/javax/crypto/CipherSpi.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/crypto/CipherSpi.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -266,7 +266,7 @@
      * <code>inputLen</code> (in bytes).
      *
      * <p>This call takes into account any unprocessed (buffered) data from a
-     * previous <code>update</code> call, and padding.
+     * previous <code>update</code> call, padding, and AEAD tagging.
      *
      * <p>The actual output length of the next <code>update</code> or
      * <code>doFinal</code> call may be smaller than the length returned by
@@ -322,6 +322,11 @@
      * {@link #engineGetParameters() engineGetParameters} or
      * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -339,8 +344,8 @@
      * @param random the source of randomness
      *
      * @exception InvalidKeyException if the given key is inappropriate for
-     * initializing this cipher, or if this cipher is being initialized for
-     * decryption and requires algorithm parameters that cannot be
+     * initializing this cipher, or requires
+     * algorithm parameters that cannot be
      * determined from the given key.
      */
     protected abstract void engineInit(int opmode, Key key,
@@ -366,6 +371,11 @@
      * {@link #engineGetParameters() engineGetParameters} or
      * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -387,7 +397,7 @@
      * initializing this cipher
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or if this cipher is being initialized for decryption and requires
+     * or if this cipher requires
      * algorithm parameters and <code>params</code> is null.
      */
     protected abstract void engineInit(int opmode, Key key,
@@ -414,6 +424,11 @@
      * {@link #engineGetParameters() engineGetParameters} or
      * {@link #engineGetIV() engineGetIV} (if the parameter is an IV).
      *
+     * <p>If this cipher requires algorithm parameters that cannot be
+     * derived from the input parameters, and there are no reasonable
+     * provider-specific default values, initialization will
+     * necessarily fail.
+     *
      * <p>If this cipher (including its underlying feedback or padding scheme)
      * requires any random bytes (e.g., for parameter generation), it will get
      * them from <code>random</code>.
@@ -435,7 +450,7 @@
      * initializing this cipher
      * @exception InvalidAlgorithmParameterException if the given algorithm
      * parameters are inappropriate for this cipher,
-     * or if this cipher is being initialized for decryption and requires
+     * or if this cipher requires
      * algorithm parameters and <code>params</code> is null.
      */
     protected abstract void engineInit(int opmode, Key key,
@@ -548,6 +563,9 @@
      * buffer, starting at <code>inputOffset</code> inclusive, and any input
      * bytes that may have been buffered during a previous <code>update</code>
      * operation, are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in a new buffer.
      *
      * <p>Upon finishing, this method resets this cipher object to the state
@@ -575,6 +593,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     protected abstract byte[] engineDoFinal(byte[] input, int inputOffset,
                                             int inputLen)
@@ -590,6 +611,9 @@
      * buffer, starting at <code>inputOffset</code> inclusive, and any input
      * bytes that may have been buffered during a previous <code>update</code>
      * operation, are processed, with padding (if requested) being applied.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
      * The result is stored in the <code>output</code> buffer, starting at
      * <code>outputOffset</code> inclusive.
      *
@@ -626,6 +650,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      */
     protected abstract int engineDoFinal(byte[] input, int inputOffset,
                                          int inputLen, byte[] output,
@@ -640,8 +667,11 @@
      * initialized.
      *
      * <p>All <code>input.remaining()</code> bytes starting at
-     * <code>input.position()</code> are processed. The result is stored
-     * in the output buffer.
+     * <code>input.position()</code> are processed.
+     * If an AEAD mode such as GCM/CCM is being used, the authentication
+     * tag is appended in the case of encryption, or verified in the
+     * case of decryption.
+     * The result is stored in the output buffer.
      * Upon return, the input buffer's position will be equal
      * to its limit; its limit will not have changed. The output buffer's
      * position will have advanced by n, where n is the value returned
@@ -678,6 +708,9 @@
      * @exception BadPaddingException if this cipher is in decryption mode,
      * and (un)padding has been requested, but the decrypted data is not
      * bounded by the appropriate padding bytes
+     * @exception AEADBadTagException if this cipher is decrypting in an
+     * AEAD mode (such as GCM/CCM), and the received authentication tag
+     * does not match the calculated value
      *
      * @throws NullPointerException if either parameter is <CODE>null</CODE>
      * @since 1.5
@@ -892,4 +925,67 @@
     {
         throw new UnsupportedOperationException();
     }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD), using a subset of the provided buffer.
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     *
+     * @param src the buffer containing the AAD
+     * @param offset the offset in {@code src} where the AAD input starts
+     * @param len the number of AAD bytes
+     *
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if this method
+     * has not been overridden by an implementation
+     *
+     * @since 1.7
+     */
+    protected void engineUpdateAAD(byte[] src, int offset, int len) {
+        throw new UnsupportedOperationException(
+            "The underlying Cipher implementation "
+            +  "does not support this method");
+    }
+
+    /**
+     * Continues a multi-part update of the Additional Authentication
+     * Data (AAD).
+     * <p>
+     * Calls to this method provide AAD to the cipher when operating in
+     * modes such as AEAD (GCM/CCM).  If this cipher is operating in
+     * either GCM or CCM mode, all AAD must be supplied before beginning
+     * operations on the ciphertext (via the {@code update} and {@code
+     * doFinal} methods).
+     * <p>
+     * All {@code src.remaining()} bytes starting at
+     * {@code src.position()} are processed.
+     * Upon return, the input buffer's position will be equal
+     * to its limit; its limit will not have changed.
+     *
+     * @param src the buffer containing the AAD
+     *
+     * @throws IllegalStateException if this cipher is in a wrong state
+     * (e.g., has not been initialized), does not accept AAD, or if
+     * operating in either GCM or CCM mode and one of the {@code update}
+     * methods has already been called for the active
+     * encryption/decryption operation
+     * @throws UnsupportedOperationException if this method
+     * has not been overridden by an implementation
+     *
+     * @since 1.7
+     */
+    protected void engineUpdateAAD(ByteBuffer src) {
+        throw new UnsupportedOperationException(
+            "The underlying Cipher implementation "
+            +  "does not support this method");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/crypto/spec/GCMParameterSpec.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,149 @@
+/*
+ * 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 javax.crypto.spec;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * Specifies the set of parameters required by a {@link
+ * javax.crypto.Cipher} using the Galois/Counter Mode (GCM) mode.
+ * <p>
+ * Simple block cipher modes (such as CBC) generally require only an
+ * initialization vector (such as {@code IvParameterSpec}),
+ * but GCM needs these parameters:
+ * <ul>
+ * <li>{@code IV}: Initialization Vector (IV) </li>
+ * <li>{@code tLen}: length (in bits) of authentication tag T</li>
+ * </ul>
+ * <p>
+ * In addition to the parameters described here, other GCM inputs/output
+ * (Additional Authenticated Data (AAD), Keys, block ciphers,
+ * plain/ciphertext and authentication tags) are handled in the {@code
+ * Cipher} class.
+  <p>
+ * Please see <a href="http://www.ietf.org/rfc/rfc5116.txt"> RFC 5116
+ * </a> for more information on the Authenticated Encryption with
+ * Associated Data (AEAD) algorithm, and <a href=
+ * "http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf">
+ * NIST Special Publication 800-38D</a>, "NIST Recommendation for Block
+ * Cipher Modes of Operation:  Galois/Counter Mode (GCM) and GMAC."
+ * <p>
+ * The GCM specification states that {@code tLen} may only have the
+ * values {128, 120, 112, 104, 96}, or {64, 32} for certain
+ * applications.  Other values can be specified for this class, but not
+ * all CSP implementations will support them.
+ *
+ * @see javax.crypto.Cipher
+ *
+ * @since 1.7
+ */
+public class GCMParameterSpec implements AlgorithmParameterSpec {
+
+    // Initialization Vector.  Could use IvParameterSpec, but that
+    // would add extra copies.
+    private byte[] iv;
+
+    // Required Tag length (in bits).
+    private int tLen;
+
+    /**
+     * Constructs a GCMParameterSpec using the specified authentication
+     * tag bit-length and IV buffer.
+     *
+     * @param tLen the authentication tag length (in bits)
+     * @param src the IV source buffer.  The contents of the buffer are
+     * copied to protect against subsequent modification.
+     *
+     * @throws IllegalArgumentException if {@code tLen} is negative,
+     * or {@code src} is null.
+     */
+    public GCMParameterSpec(int tLen, byte[] src) {
+        if (src == null) {
+            throw new IllegalArgumentException("src array is null");
+        }
+
+        init(tLen, src, 0, src.length);
+    }
+
+    /**
+     * Constructs a GCMParameterSpec object using the specified
+     * authentication tag bit-length and a subset of the specified
+     * buffer as the IV.
+     *
+     * @param tLen the authentication tag length (in bits)
+     * @param src the IV source buffer.  The contents of the
+     * buffer are copied to protect against subsequent modification.
+     * @param offset the offset in {@code src} where the IV starts
+     * @param len the number of IV bytes
+     *
+     * @throws IllegalArgumentException if {@code tLen} is negative,
+     * {@code src} is null, {@code len} or {@code offset} is negative,
+     * or the sum of {@code offset} and {@code len} is greater than the
+     * length of the {@code src} byte array.
+     */
+    public GCMParameterSpec(int tLen, byte[] src, int offset, int len) {
+        init(tLen, src, offset, len);
+    }
+
+    /*
+     * Check input parameters.
+     */
+    private void init(int tLen, byte[] src, int offset, int len) {
+        if (tLen < 0) {
+            throw new IllegalArgumentException(
+                "Length argument is negative");
+        }
+        this.tLen = tLen;
+
+        // Input sanity check
+        if ((src == null) ||(len < 0) || (offset < 0)
+                || ((len + offset) > src.length)) {
+            throw new IllegalArgumentException("Invalid buffer arguments");
+        }
+
+        iv = new byte[len];
+        System.arraycopy(src, offset, iv, 0, len);
+    }
+
+    /**
+     * Returns the authentication tag length.
+     *
+     * @return the authentication tag length (in bits)
+     */
+    public int getTLen() {
+        return tLen;
+    }
+
+    /**
+     * Returns the Initialization Vector (IV).
+     *
+     * @return the IV.  Creates a new array each time this method
+     * is called.
+     */
+    public byte[] getIV() {
+        return iv.clone();
+    }
+}
--- a/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java	Tue Apr 26 15:48:03 2011 -0700
@@ -214,7 +214,7 @@
     }
 
     /**
-     * Closes this <code>FileCacheImageOututStream</code>.  All
+     * Closes this <code>FileCacheImageOutputStream</code>.  All
      * pending data is flushed to the output, and the cache file
      * is closed and removed.  The destination <code>OutputStream</code>
      * is not closed.
--- a/jdk/src/share/classes/javax/management/remote/package.html	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/management/remote/package.html	Tue Apr 26 15:48:03 2011 -0700
@@ -154,11 +154,8 @@
       </pre>
 
       <p>The formal grammar for connection ids that follow this
-	convention is as follows (using the <a
-	href="http://java.sun.com/docs/books/jls/second_edition/html/grammars.doc.html#90767">grammar
-	notation</a> from <em>The Java Language Specification, Second
-	Edition</em>):</p>
-
+         convention is as follows (using the grammar notation from section 2.4 of 
+         <em>The Java&trade; Language Specification</em>):</p>
       <pre>
 <em>ConnectionId:</em>
     <em>Protocol</em> : <em>ClientAddress<sub>opt</sub></em> Space <em>ClientId<sub>opt</sub></em> Space <em>ArbitraryText</em>
--- a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java	Tue Apr 26 15:48:03 2011 -0700
@@ -239,6 +239,12 @@
      * If a suitable MIDI port is not available, the Receiver is
      * retrieved from an installed synthesizer.
      *
+     * <p>If a native receiver provided by the default device does not implement
+     * the {@code MidiDeviceReceiver} interface, it will be wrapped in a
+     * wrapper class that implements the {@code MidiDeviceReceiver} interface.
+     * The corresponding {@code Receiver} method calls will be forwarded
+     * to the native receiver.
+     *
      * <p>If this method returns successfully, the {@link
      * javax.sound.midi.MidiDevice MidiDevice} the
      * <code>Receiver</code> belongs to is opened implicitly, if it is
@@ -284,7 +290,13 @@
      * it is used to identify the device that provides the default transmitter.
      * For details, refer to the {@link MidiSystem class description}.
      *
-     * If this method returns successfully, the {@link
+     * <p>If a native transmitter provided by the default device does not implement
+     * the {@code MidiDeviceTransmitter} interface, it will be wrapped in a
+     * wrapper class that implements the {@code MidiDeviceTransmitter} interface.
+     * The corresponding {@code Transmitter} method calls will be forwarded
+     * to the native transmitter.
+     *
+     * <p>If this method returns successfully, the {@link
      * javax.sound.midi.MidiDevice MidiDevice} the
      * <code>Transmitter</code> belongs to is opened implicitly, if it
      * is not already open. It is possible to close an implicitly
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Tue Apr 26 15:48:03 2011 -0700
@@ -296,32 +296,32 @@
 
 public abstract class BaseRowSet implements Serializable, Cloneable {
 
-/**
- * A constant indicating to a <code>RowSetReaderImpl</code> object
- * that a given parameter is a Unicode stream. This
- * <code>RowSetReaderImpl</code> object is provided as an extension of the
- * <code>SyncProvider</code> abstract class defined in the
- * <code>SyncFactory</code> static factory SPI mechanism.
- */
-public static final int UNICODE_STREAM_PARAM = 0;
-
-/**
- * A constant indicating to a <code>RowSetReaderImpl</code> object
- * that a given parameter is a binary stream. A
- * <code>RowSetReaderImpl</code> object is provided as an extension of the
- * <code>SyncProvider</code> abstract class defined in the
- * <code>SyncFactory</code> static factory SPI mechanism.
- */
-public static final int BINARY_STREAM_PARAM = 1;
-
-/**
- * A constant indicating to a <code>RowSetReaderImpl</code> object
- * that a given parameter is an ASCII stream. A
- * <code>RowSetReaderImpl</code> object is provided as an extension of the
- * <code>SyncProvider</code> abstract class defined in the
- * <code>SyncFactory</code> static factory SPI mechanism.
- */
-public static final int ASCII_STREAM_PARAM = 2;
+    /**
+     * A constant indicating to a <code>RowSetReaderImpl</code> object
+     * that a given parameter is a Unicode stream. This
+     * <code>RowSetReaderImpl</code> object is provided as an extension of the
+     * <code>SyncProvider</code> abstract class defined in the
+     * <code>SyncFactory</code> static factory SPI mechanism.
+     */
+    public static final int UNICODE_STREAM_PARAM = 0;
+
+    /**
+     * A constant indicating to a <code>RowSetReaderImpl</code> object
+     * that a given parameter is a binary stream. A
+     * <code>RowSetReaderImpl</code> object is provided as an extension of the
+     * <code>SyncProvider</code> abstract class defined in the
+     * <code>SyncFactory</code> static factory SPI mechanism.
+     */
+    public static final int BINARY_STREAM_PARAM = 1;
+
+    /**
+     * A constant indicating to a <code>RowSetReaderImpl</code> object
+     * that a given parameter is an ASCII stream. A
+     * <code>RowSetReaderImpl</code> object is provided as an extension of the
+     * <code>SyncProvider</code> abstract class defined in the
+     * <code>SyncFactory</code> static factory SPI mechanism.
+     */
+    public static final int ASCII_STREAM_PARAM = 2;
 
     /**
      * The <code>InputStream</code> object that will be
@@ -505,21 +505,21 @@
      * custom mapping of user-defined types.
      * @serial
      */
-    private Map map;
+    private Map<String, Class<?>> map;
 
     /**
      * A <code>Vector</code> object that holds the list of listeners
      * that have registered with this <code>RowSet</code> object.
      * @serial
      */
-    private Vector listeners;
+    private Vector<RowSetListener> listeners;
 
     /**
      * A <code>Vector</code> object that holds the parameters set
      * for this <code>RowSet</code> object's current command.
      * @serial
      */
-    private Hashtable params; // could be transient?
+    private Hashtable<Integer, Object> params; // could be transient?
 
     /**
      * Constructs a new <code>BaseRowSet</code> object initialized with
@@ -529,7 +529,7 @@
      */
     public BaseRowSet() {
         // allocate the listeners collection
-        listeners = new Vector();
+        listeners = new Vector<RowSetListener>();
     }
 
     /**
@@ -542,7 +542,7 @@
      * a <code>RowSet</code> implementation extending this class.
      */
     protected void initParams() {
-        params = new Hashtable();
+        params = new Hashtable<Integer, Object>();
     }
 
     //--------------------------------------------------------------------
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -912,7 +912,12 @@
      * @since 1.6
      */
     public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
-        return (T)this;
+
+        if(isWrapperFor(iface)) {
+            return iface.cast(this);
+        } else {
+            throw new SQLException("unwrap failed for:"+ iface);
+        }
     }
 
     /**
@@ -929,8 +934,9 @@
      * @throws java.sql.SQLException  if an error occurs while determining whether this is a wrapper
      * for an object with the given interface.
      * @since 1.6
-     */    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
-        return false;
+     */
+    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
+        return interfaces.isInstance(this);
     }
 
     static final long serialVersionUID = 6893806403181801867L;
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java	Tue Apr 26 15:48:03 2011 -0700
@@ -204,9 +204,9 @@
      *
      */
     static private ClassLoader getContextClassLoader() throws SecurityException {
-        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
 
-            public Object run() {
+            public ClassLoader run() {
                 ClassLoader cl = null;
 
                 cl = Thread.currentThread().getContextClassLoader();
@@ -284,9 +284,9 @@
     static private String getSystemProperty(final String propName) {
         String property = null;
         try {
-            property = (String) AccessController.doPrivileged(new PrivilegedAction() {
+            property = AccessController.doPrivileged(new PrivilegedAction<String>() {
 
-                public Object run() {
+                public String run() {
                     return System.getProperty(propName);
                 }
             });
--- a/jdk/src/share/classes/javax/swing/Painter.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/Painter.java	Tue Apr 26 15:48:03 2011 -0700
@@ -45,14 +45,16 @@
  * <code>Painter</code> that only works with subclasses of {@link java.awt.Component}.
  * In that case, when the <code>Painter</code> is declared, you may declare that
  * it requires a <code>Component</code>, allowing the paint method to be type safe. Ex:
- * <pre><code>
- *     Painter<Component> p = new Painter<Component>() {
- *         public void paint(Graphics2D g, Component c, int width, int height) {
- *             g.setColor(c.getBackground());
- *             //and so forth
- *         }
+ * <pre>
+ * {@code
+ * Painter<Component> p = new Painter<Component>() {
+ *     public void paint(Graphics2D g, Component c, int width, int height) {
+ *         g.setColor(c.getBackground());
+ *         //and so forth
  *     }
- * </code></pre></p>
+ * }
+ * }
+ * </pre></p>
  *
  * <p>This interface makes no guarantees of threadsafety.</p>
  *
--- a/jdk/src/share/classes/javax/swing/border/TitledBorder.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/border/TitledBorder.java	Tue Apr 26 15:48:03 2011 -0700
@@ -240,9 +240,7 @@
             int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING;
             JLabel label = getLabel(c);
             Dimension size = label.getPreferredSize();
-            Insets insets = (border != null)
-                    ? border.getBorderInsets(c)
-                    : new Insets(0, 0, 0, 0);
+            Insets insets = getBorderInsets(border, c, new Insets(0, 0, 0, 0));
 
             int borderX = x + edge;
             int borderY = y + edge;
@@ -348,17 +346,8 @@
      */
     public Insets getBorderInsets(Component c, Insets insets) {
         Border border = getBorder();
-        if (border == null) {
-            insets.set(0, 0, 0, 0);
-        }
-        else if (border instanceof AbstractBorder) {
-            AbstractBorder ab = (AbstractBorder) border;
-            insets = ab.getBorderInsets(c, insets);
-        }
-        else {
-            Insets i = border.getBorderInsets(c);
-            insets.set(i.top, i.left, i.bottom, i.right);
-        }
+        insets = getBorderInsets(border, c, insets);
+
         String title = getTitle();
         if ((title != null) && !title.isEmpty()) {
             int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING;
@@ -588,9 +577,7 @@
             int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING;
             JLabel label = getLabel(c);
             Dimension size = label.getPreferredSize();
-            Insets insets = (border != null)
-                    ? border.getBorderInsets(c)
-                    : new Insets(0, 0, 0, 0);
+            Insets insets = getBorderInsets(border, c, new Insets(0, 0, 0, 0));
 
             int baseline = label.getBaseline(size.width, size.height);
             switch (getPosition()) {
@@ -728,4 +715,19 @@
         this.label.setEnabled(c.isEnabled());
         return this.label;
     }
+
+    private static Insets getBorderInsets(Border border, Component c, Insets insets) {
+        if (border == null) {
+            insets.set(0, 0, 0, 0);
+        }
+        else if (border instanceof AbstractBorder) {
+            AbstractBorder ab = (AbstractBorder) border;
+            insets = ab.getBorderInsets(c, insets);
+        }
+        else {
+            Insets i = border.getBorderInsets(c);
+            insets.set(i.top, i.left, i.bottom, i.right);
+        }
+        return insets;
+    }
 }
--- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -708,8 +708,8 @@
      *
      * @param x  the x value of the region to be painted
      * @param y  the y value of the region to be painted
-     * @param w  the width of the region to be painted
-     * @param h  the height of the region to be painted
+     * @param width  the width of the region to be painted
+     * @param height  the height of the region to be painted
      *
      * @see JComponent#paintImmediately(int, int, int, int)
      */
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -335,9 +335,8 @@
     }
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of {@code BasicColorChooserUI}.
      */
     public class PropertyHandler implements PropertyChangeListener {
         public void propertyChange(PropertyChangeEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -186,9 +186,8 @@
     /**
      * Listens for mouse movements and acts on them.
      *
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <Foo>.
+     * Instantiate it only within subclasses of {@code BasicDesktopIconUI}.
      */
     public class MouseInputHandler extends MouseInputAdapter
     {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -455,6 +455,8 @@
                 }
                 int dka = label.getDisplayedMnemonic();
                 inputMap.put(KeyStroke.getKeyStroke(dka, ActionEvent.ALT_MASK, true), RELEASE);
+                // Need this when the sticky keys are enabled
+                inputMap.put(KeyStroke.getKeyStroke(dka, 0, true), RELEASE);
                 // Need this if ALT is released before the accelerator
                 inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true), RELEASE);
                 label.requestFocus();
@@ -467,7 +469,9 @@
                 InputMap inputMap = SwingUtilities.getUIInputMap(label, JComponent.WHEN_FOCUSED);
                 if (inputMap != null) {
                     // inputMap should never be null.
-                    inputMap.remove(KeyStroke.getKeyStroke(label.getDisplayedMnemonic(), ActionEvent.ALT_MASK, true));
+                    int dka = label.getDisplayedMnemonic();
+                    inputMap.remove(KeyStroke.getKeyStroke(dka, ActionEvent.ALT_MASK, true));
+                    inputMap.remove(KeyStroke.getKeyStroke(dka, 0, true));
                     inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true));
                 }
                 if (labelFor instanceof Container &&
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1555,9 +1555,8 @@
     }
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of BasicTableUI.
+     * Instantiate it only within subclasses of {@code BasicListUI}.
      */
     public class FocusHandler implements FocusListener
     {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -911,9 +911,8 @@
      * right. If <code>syncAllWidths</code> is true, the widths of each
      * component will be set to the largest preferred size width.
      *
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of BasicOptionPaneUI.
+     * Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
      */
     public static class ButtonAreaLayout implements LayoutManager {
         protected boolean           syncAllWidths;
@@ -1115,9 +1114,8 @@
 
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of BasicOptionPaneUI.
+     * Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
      */
     public class PropertyChangeHandler implements PropertyChangeListener {
         /**
@@ -1161,9 +1159,8 @@
     }
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of BasicOptionPaneUI.
+     * Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
      */
     public class ButtonActionListener implements ActionListener {
         protected int buttonIndex;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1211,9 +1211,8 @@
 
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of BasicProgressBarUI.
+     * Instantiate it only within subclasses of {@code BasicProgressBarUI}.
      */
     public class ChangeHandler implements ChangeListener {
         // NOTE: This class exists only for backward compatability. All
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -88,9 +88,8 @@
     };
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of BasicTableUI.
+     * Instantiate it only within subclasses of {@code BasicTableHeaderUI}.
      */
     public class MouseInputHandler implements MouseInputListener {
 
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -730,9 +730,8 @@
 //
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of BasicTableUI.
+     * Instantiate it only within subclasses of {@code BasicTableUI}.
      * <p>As of Java 2 platform v1.3 this class is no longer used.
      * Instead <code>JTable</code>
      * overrides <code>processKeyBinding</code> to dispatch the event to
@@ -761,9 +760,8 @@
 //
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of BasicTableUI.
+     * Instantiate it only within subclasses of {@code BasicTableUI}.
      */
     public class FocusHandler implements FocusListener {
         // NOTE: This class exists only for backward compatability. All
@@ -784,7 +782,6 @@
 //
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
      * Instantiate it only within subclasses of BasicTableUI.
      */
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -199,9 +199,8 @@
     }
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <FooUI>.
+     * Instantiate it only within subclasses of {@code MetalComboBoxUI}.
      */
     public class MetalPropertyChangeListener extends BasicComboBoxUI.PropertyChangeHandler {
         public void propertyChange(PropertyChangeEvent e) {
@@ -244,9 +243,8 @@
     }
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <FooUI>.
+     * Instantiate it only within subclasses of {@code MetalComboBoxUI}.
      */
     public class MetalComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager {
         public void layoutContainer( Container parent ) {
@@ -356,9 +354,8 @@
     }
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of <FooUI>.
+     * Instantiate it only within subclasses of {@code MetalComboBoxUI}.
      *
      * This class is now obsolete and doesn't do anything and
      * is only included for backwards API compatibility. Do not call or
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1196,9 +1196,8 @@
     }
 
     /**
-     * This inner class is marked &quot;public&quot; due to a compiler bug.
      * This class should be treated as a &quot;protected&quot; inner class.
-     * Instantiate it only within subclasses of MetalTabbedPaneUI.
+     * Instantiate it only within subclasses of {@code MetalTabbedPaneUI}.
      */
     public class TabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout {
 
--- a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java	Tue Apr 26 15:48:03 2011 -0700
@@ -172,6 +172,11 @@
         //italic carets and we do not.
         TextHitInfo hit = layout.hitTestChar(x - (float)alloc.getX(), 0);
         int pos = hit.getInsertionIndex();
+
+        if (pos == v.getEndOffset()) {
+            pos--;
+        }
+
         biasReturn[0] = hit.isLeadingEdge() ? Position.Bias.Forward : Position.Bias.Backward;
         return pos + v.getStartOffset();
     }
--- a/jdk/src/share/classes/javax/swing/text/GlyphView.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java	Tue Apr 26 15:48:03 2011 -0700
@@ -541,7 +541,30 @@
      */
     @Override
     public float getMinimumSpan(int axis) {
-        return super.getMinimumSpan(axis);
+        switch (axis) {
+            case View.X_AXIS:
+                if (minimumSpan < 0) {
+                    minimumSpan = 0;
+                    int p0 = getStartOffset();
+                    int p1 = getEndOffset();
+                    while (p1 > p0) {
+                        int breakSpot = getBreakSpot(p0, p1);
+                        if (breakSpot == BreakIterator.DONE) {
+                            // the rest of the view is non-breakable
+                            breakSpot = p0;
+                        }
+                        minimumSpan = Math.max(minimumSpan,
+                                getPartialSpan(breakSpot, p1));
+                        // Note: getBreakSpot returns the *last* breakspot
+                        p1 = breakSpot - 1;
+                    }
+                }
+                return minimumSpan;
+            case View.Y_AXIS:
+                return super.getMinimumSpan(axis);
+            default:
+                throw new IllegalArgumentException("Invalid axis: " + axis);
+        }
     }
 
     /**
--- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java	Tue Apr 26 15:48:03 2011 -0700
@@ -721,7 +721,34 @@
     @Override
     protected SizeRequirements calculateMinorAxisRequirements(int axis,
                                                         SizeRequirements r) {
-        return super.calculateMinorAxisRequirements(axis, r);
+        r = super.calculateMinorAxisRequirements(axis, r);
+
+        float min = 0;
+        float glue = 0;
+        int n = getLayoutViewCount();
+        for (int i = 0; i < n; i++) {
+            View v = getLayoutView(i);
+            float span = v.getMinimumSpan(axis);
+            if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis)) > View.BadBreakWeight) {
+                // find the longest non-breakable fragments at the view edges
+                int p0 = v.getStartOffset();
+                int p1 = v.getEndOffset();
+                float start = findEdgeSpan(v, axis, p0, p0, p1);
+                float end = findEdgeSpan(v, axis, p1, p0, p1);
+                glue += start;
+                min = Math.max(min, Math.max(span, glue));
+                glue = end;
+            } else {
+                // non-breakable view
+                glue += span;
+                min = Math.max(min, glue);
+            }
+        }
+        r.minimum = Math.max(r.minimum, (int) min);
+        r.preferred = Math.max(r.minimum, r.preferred);
+        r.maximum = Math.max(r.preferred, r.maximum);
+
+        return r;
     }
 
     /**
--- a/jdk/src/share/classes/javax/swing/text/Utilities.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/text/Utilities.java	Tue Apr 26 15:48:03 2011 -0700
@@ -395,10 +395,10 @@
                 // the length of the string measured as a whole may differ from
                 // the sum of individual character lengths, for example if
                 // fractional metrics are enabled; and we must guard from this.
-                while (metrics.charsWidth(txt, txtOffset, offset + 1) > (x - x0)) {
+                while (offset > 0 && metrics.charsWidth(txt, txtOffset, offset) > (x - x0)) {
                     offset--;
                 }
-                return (offset < 0 ? 0 : offset);
+                return offset;
             }
             currX = nextX;
         }
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java	Tue Apr 26 15:48:03 2011 -0700
@@ -62,7 +62,6 @@
  *   <li>background-repeat
  *   <li>background-position
  *   <li>background
- *   <li>background-repeat
  *   <li>text-decoration (with the exception of blink and overline)
  *   <li>vertical-align (only sup and super)
  *   <li>text-align (justify is treated as center)
@@ -75,7 +74,18 @@
  *   <li>padding-right
  *   <li>padding-bottom
  *   <li>padding-left
+ *   <li>padding
+ *   <li>border-top-style
+ *   <li>border-right-style
+ *   <li>border-bottom-style
+ *   <li>border-left-style
  *   <li>border-style (only supports inset, outset and none)
+ *   <li>border-top-color
+ *   <li>border-right-color
+ *   <li>border-bottom-color
+ *   <li>border-left-color
+ *   <li>border-color
+ *   <li>list-style-image
  *   <li>list-style-type
  *   <li>list-style-position
  * </ul>
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Tue Apr 26 15:48:03 2011 -0700
@@ -966,6 +966,9 @@
             char data[] = {'&'};
             return data;
         }
+
+        boolean semicolon = false;
+
         switch (ch) {
           case '\n':
             ln++;
@@ -985,6 +988,8 @@
             break;
 
           case ';':
+            semicolon = true;
+
             ch = readCh();
             break;
         }
@@ -1006,7 +1011,7 @@
                 return new char[0];
             }
             /* given that there is not a match restore the entity reference */
-            String str = "&" + nm + ";";
+            String str = "&" + nm + (semicolon ? ";" : "");
 
             char b[] = new char[str.length()];
             str.getChars(0, b.length, b, 0);
--- a/jdk/src/share/classes/sun/misc/FloatingDecimal.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/FloatingDecimal.java	Tue Apr 26 15:48:03 2011 -0700
@@ -30,7 +30,7 @@
 import sun.misc.FloatConsts;
 import java.util.regex.*;
 
-public class FloatingDecimal{
+public strictfp class FloatingDecimal{
     boolean     isExceptional;
     boolean     isNegative;
     int         decExponent;
--- a/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/FormattedFloatingDecimal.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -30,7 +30,7 @@
 import sun.misc.FloatConsts;
 import java.util.regex.*;
 
-public class FormattedFloatingDecimal{
+public strictfp class FormattedFloatingDecimal{
     boolean     isExceptional;
     boolean     isNegative;
     int         decExponent;  // value set at construction, then immutable
--- a/jdk/src/share/classes/sun/misc/FpUtils.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/misc/FpUtils.java	Tue Apr 26 15:48:03 2011 -0700
@@ -531,10 +531,9 @@
      * Return {@code d} &times;
      * 2<sup>{@code scale_factor}</sup> rounded as if performed
      * by a single correctly rounded floating-point multiply to a
-     * member of the double value set.  See <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#9208">&sect;4.2.3</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a> for a discussion of floating-point
+     * member of the double value set.  See section 4.2.3 of
+     * <cite>The Java&trade; Language Specification</cite>
+     * for a discussion of floating-point
      * value sets.  If the exponent of the result is between the
      * {@code double}'s minimum exponent and maximum exponent,
      * the answer is calculated exactly.  If the exponent of the
@@ -641,11 +640,10 @@
      * Return {@code f} &times;
      * 2<sup>{@code scale_factor}</sup> rounded as if performed
      * by a single correctly rounded floating-point multiply to a
-     * member of the float value set.  See <a
-     * href="http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#9208">&sect;4.2.3</a>
-     * of the <a href="http://java.sun.com/docs/books/jls/html/">Java
-     * Language Specification</a> for a discussion of floating-point
-     * value set. If the exponent of the result is between the
+     * member of the float value set.  See section 4.2.3 of
+     * <cite>The Java&trade; Language Specification</cite>
+     * for a discussion of floating-point
+     * value sets. If the exponent of the result is between the
      * {@code float}'s minimum exponent and maximum exponent, the
      * answer is calculated exactly.  If the exponent of the result
      * would be larger than {@code float}'s maximum exponent, an
--- a/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/jar/Handler.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -25,9 +25,8 @@
 
 package sun.net.www.protocol.jar;
 
-import java.io.*;
+import java.io.IOException;
 import java.net.*;
-import java.util.*;
 import sun.net.www.ParseUtil;
 
 /*
@@ -42,7 +41,7 @@
         return new JarURLConnection(u, this);
     }
 
-    private int indexOfBangSlash(String spec) {
+    private static int indexOfBangSlash(String spec) {
         int indexOfBang = spec.length();
         while((indexOfBang = spec.lastIndexOf('!', indexOfBang)) != -1) {
             if ((indexOfBang != (spec.length() - 1)) &&
@@ -55,6 +54,75 @@
         return -1;
     }
 
+    /**
+     * Compare two jar URLs
+     */
+    @Override
+    protected boolean sameFile(URL u1, URL u2) {
+        if (!u1.getProtocol().equals("jar") || !u2.getProtocol().equals("jar"))
+            return false;
+
+        String file1 = u1.getFile();
+        String file2 = u2.getFile();
+        int sep1 = file1.indexOf(separator);
+        int sep2 = file2.indexOf(separator);
+
+        if (sep1 == -1 || sep2 == -1) {
+            return super.sameFile(u1, u2);
+        }
+
+        String entry1 = file1.substring(sep1 + 2);
+        String entry2 = file2.substring(sep2 + 2);
+
+        if (!entry1.equals(entry2))
+            return false;
+
+        URL enclosedURL1 = null, enclosedURL2 = null;
+        try {
+            enclosedURL1 = new URL(file1.substring(0, sep1));
+            enclosedURL2 = new URL(file2.substring(0, sep2));
+        } catch (MalformedURLException unused) {
+            return super.sameFile(u1, u2);
+        }
+
+        if (!super.sameFile(enclosedURL1, enclosedURL2)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    protected int hashCode(URL u) {
+        int h = 0;
+
+        String protocol = u.getProtocol();
+        if (protocol != null)
+            h += protocol.hashCode();
+
+        String file = u.getFile();
+        int sep = file.indexOf(separator);
+
+        if (sep == -1)
+            return h + file.hashCode();
+
+        URL enclosedURL = null;
+        String fileWithoutEntry = file.substring(0, sep);
+        try {
+            enclosedURL = new URL(fileWithoutEntry);
+            h += enclosedURL.hashCode();
+        } catch (MalformedURLException unused) {
+            h += fileWithoutEntry.hashCode();
+        }
+
+        String entry = file.substring(sep + 2);
+        h += entry.hashCode();
+
+        return h;
+    }
+
+
+    @Override
     protected void parseURL(URL url, String spec,
                             int start, int limit) {
         String file = null;
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -388,9 +388,8 @@
         // we must instead use a nonempty buffer, otherwise the call
         // will not block waiting for a datagram on some platforms.
         int newSize = Math.max(rem, 1);
-        ByteBuffer bb = null;
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(newSize);
         try {
-            bb = Util.getTemporaryDirectBuffer(newSize);
             int n = receiveIntoNativeBuffer(fd, bb, newSize, 0);
             bb.flip();
             if (n > 0 && rem > 0)
@@ -482,9 +481,8 @@
         assert (pos <= lim);
         int rem = (pos <= lim ? lim - pos : 0);
 
-        ByteBuffer bb = null;
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
         try {
-            bb = Util.getTemporaryDirectBuffer(rem);
             bb.put(src);
             bb.flip();
             // Do not update src until we see how many bytes were written
@@ -766,10 +764,10 @@
         // check multicast address is compatible with this socket
         if (group instanceof Inet4Address) {
             if (family == StandardProtocolFamily.INET6 && !Net.canIPv6SocketJoinIPv4Group())
-                throw new IllegalArgumentException("Group is not IPv4 multicast address");
+                throw new IllegalArgumentException("IPv6 socket cannot join IPv4 multicast group");
         } else if (group instanceof Inet6Address) {
             if (family != StandardProtocolFamily.INET6)
-                throw new IllegalArgumentException("Group is not IPv6 multicast address");
+                throw new IllegalArgumentException("Only IPv6 sockets can join IPv6 multicast group");
         } else {
             throw new IllegalArgumentException("Address type not supported");
         }
--- a/jdk/src/share/classes/sun/nio/ch/IOUtil.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/IOUtil.java	Tue Apr 26 15:48:03 2011 -0700
@@ -50,9 +50,8 @@
         int lim = src.limit();
         assert (pos <= lim);
         int rem = (pos <= lim ? lim - pos : 0);
-        ByteBuffer bb = null;
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
         try {
-            bb = Util.getTemporaryDirectBuffer(rem);
             bb.put(src);
             bb.flip();
             // Do not update src until we see how many bytes were written
@@ -187,9 +186,8 @@
             return readIntoNativeBuffer(fd, dst, position, nd, lock);
 
         // Substitute a native buffer
-        ByteBuffer bb = null;
+        ByteBuffer bb = Util.getTemporaryDirectBuffer(dst.remaining());
         try {
-            bb = Util.getTemporaryDirectBuffer(dst.remaining());
             int n = readIntoNativeBuffer(fd, bb, position, nd, lock);
             bb.flip();
             if (n > 0)
--- a/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java	Tue Apr 26 15:48:03 2011 -0700
@@ -175,25 +175,26 @@
             DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe);
         }
 
-        Remote impl = target.getImpl();
-        if (impl == null) {
-            throw new ExportException(
-                "internal error: attempt to export collected object");
-        }
+        synchronized (tableLock) {
+            /**
+             * Do nothing if impl has already been collected (see 6597112). Check while
+             * holding tableLock to ensure that Reaper cannot process weakImpl in between
+             * null check and put/increment effects.
+             */
+            if (target.getImpl() != null) {
+                if (objTable.containsKey(oe)) {
+                    throw new ExportException(
+                        "internal error: ObjID already in use");
+                } else if (implTable.containsKey(weakImpl)) {
+                    throw new ExportException("object already exported");
+                }
 
-        synchronized (tableLock) {
-            if (objTable.containsKey(oe)) {
-                throw new ExportException(
-                    "internal error: ObjID already in use");
-            } else if (implTable.containsKey(weakImpl)) {
-                throw new ExportException("object already exported");
-            }
+                objTable.put(oe, target);
+                implTable.put(weakImpl, target);
 
-            objTable.put(oe, target);
-            implTable.put(weakImpl, target);
-
-            if (!target.isPermanent()) {
-                incrementKeepAliveCount();
+                if (!target.isPermanent()) {
+                    incrementKeepAliveCount();
+                }
             }
         }
     }
--- a/jdk/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/InitSecContextToken.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -127,8 +127,8 @@
             //System.out.println("Sub-Session Key Missing in Authenticator.\n");
         }
 
-        OverloadedChecksum gssChecksum =
-            new OverloadedChecksum(context, apReq.getChecksum(), sessionKey);
+        OverloadedChecksum gssChecksum = new OverloadedChecksum(
+                context, apReq.getChecksum(), sessionKey, subKey);
         gssChecksum.setContextFlags(context);
         Credentials delegCred = gssChecksum.getDelegatedCreds();
         if (delegCred != null) {
--- a/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -210,8 +210,8 @@
         // be passed in if this checksum type denotes a
         // raw_checksum. In that case, make Checksum class krb5
         // internal.
-        public OverloadedChecksum(Krb5Context context,
-                                  Checksum checksum, EncryptionKey key)
+        public OverloadedChecksum(Krb5Context context, Checksum checksum,
+                                  EncryptionKey key, EncryptionKey subKey)
             throws GSSException, KrbException, IOException {
 
             int pos = 0;
@@ -283,9 +283,17 @@
                         new KrbCred(credBytes, EncryptionKey.NULL_KEY).
                         getDelegatedCreds()[0];
                 } else {
-                    delegCreds =
-                        new KrbCred(credBytes, key).
-                        getDelegatedCreds()[0];
+                    KrbCred cred;
+                    try {
+                        cred = new KrbCred(credBytes, key);
+                    } catch (KrbException e) {
+                        if (subKey != null) {
+                            cred = new KrbCred(credBytes, subKey);
+                        } else {
+                            throw e;
+                        }
+                    }
+                    delegCreds = cred.getDelegatedCreds()[0];
                 }
             }
         }
--- a/jdk/src/share/classes/sun/security/krb5/KrbApReq.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KrbApReq.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -37,6 +37,7 @@
 import java.net.InetAddress;
 import sun.security.util.*;
 import java.io.IOException;
+import java.util.Arrays;
 
 /**
  * This class encapsulates a KRB-AP-REQ that a client sends to a
@@ -54,9 +55,6 @@
     private static CacheTable table = new CacheTable();
     private static boolean DEBUG = Krb5.DEBUG;
 
-    // default is address-less tickets
-    private boolean KDC_EMPTY_ADDRESSES_ALLOWED = true;
-
     /**
      * Contructs a AP-REQ message to send to the peer.
      * @param tgsCred the <code>Credentials</code> to be used to construct the
@@ -312,23 +310,19 @@
             table.put(client, time, currTime.getTime());
         }
 
-        // check to use addresses in tickets
-        if (Config.getInstance().useAddresses()) {
-            KDC_EMPTY_ADDRESSES_ALLOWED = false;
-        }
-
-        // sender host address
-        HostAddress sender = null;
         if (initiator != null) {
-            sender = new HostAddress(initiator);
-        }
-
-        if (sender != null || !KDC_EMPTY_ADDRESSES_ALLOWED) {
-            if (enc_ticketPart.caddr != null) {
-                if (sender == null)
-                    throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR);
-                if (!enc_ticketPart.caddr.inList(sender))
-                    throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR);
+            // sender host address
+            HostAddress sender = new HostAddress(initiator);
+            if (enc_ticketPart.caddr != null
+                    && !enc_ticketPart.caddr.inList(sender)) {
+                if (DEBUG) {
+                    System.out.println(">>> KrbApReq: initiator is "
+                            + sender.getInetAddress()
+                            + ", but caddr is "
+                            + Arrays.toString(
+                                enc_ticketPart.caddr.getInetAddresses()));
+                }
+                throw new KrbApErrException(Krb5.KRB_AP_ERR_BADADDR);
             }
         }
 
--- a/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/NetClient.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -59,7 +59,8 @@
 
     TCPClient(String hostname, int port, int timeout)
             throws IOException {
-        tcpSocket = new Socket(hostname, port);
+        tcpSocket = new Socket();
+        tcpSocket.connect(new InetSocketAddress(hostname, port), timeout);
         out = new BufferedOutputStream(tcpSocket.getOutputStream());
         in = new BufferedInputStream(tcpSocket.getInputStream());
         tcpSocket.setSoTimeout(timeout);
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS7.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs/PKCS7.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -38,6 +38,7 @@
 import sun.security.util.*;
 import sun.security.x509.AlgorithmId;
 import sun.security.x509.CertificateIssuerName;
+import sun.security.x509.KeyUsageExtension;
 import sun.security.x509.X509CertImpl;
 import sun.security.x509.X509CertInfo;
 import sun.security.x509.X509CRLImpl;
@@ -492,7 +493,7 @@
         // CRLs (optional)
         if (crls != null && crls.length != 0) {
             // cast to X509CRLImpl[] since X509CRLImpl implements DerEncoder
-            Set<X509CRLImpl> implCRLs = new HashSet<X509CRLImpl>(crls.length);
+            Set<X509CRLImpl> implCRLs = new HashSet<>(crls.length);
             for (X509CRL crl: crls) {
                 if (crl instanceof X509CRLImpl)
                     implCRLs.add((X509CRLImpl) crl);
@@ -530,6 +531,168 @@
     }
 
     /**
+     * Verifying signed data using an external chunked data source.
+     */
+    public static class PKCS7Verifier {
+
+        private final SignerInfo si;          // Signer to verify
+        private final MessageDigest md;       // MessageDigest object for chunks
+        private final Signature sig;          // Signature object for chunks
+
+        private PKCS7Verifier(SignerInfo si, MessageDigest md, Signature sig) {
+            this.si = si;
+            this.md = md;
+            this.sig = sig;
+        }
+
+        public static PKCS7Verifier from(PKCS7 block, SignerInfo si) throws
+                SignatureException, NoSuchAlgorithmException {
+
+            try {
+                MessageDigest md = null;
+                Signature sig;
+
+                ContentInfo content = block.getContentInfo();
+                String digestAlgname = si.getDigestAlgorithmId().getName();
+
+                // if there are authenticate attributes, feed data chunks to
+                // the message digest. In this case, pv.md is not null
+                if (si.authenticatedAttributes != null) {
+                    // first, check content type
+                    ObjectIdentifier contentType = (ObjectIdentifier)
+                           si.authenticatedAttributes.getAttributeValue(
+                             PKCS9Attribute.CONTENT_TYPE_OID);
+                    if (contentType == null ||
+                        !contentType.equals(content.contentType))
+                        return null;  // contentType does not match, bad SignerInfo
+
+                    // now, check message digest
+                    byte[] messageDigest = (byte[])
+                        si.authenticatedAttributes.getAttributeValue(
+                             PKCS9Attribute.MESSAGE_DIGEST_OID);
+
+                    if (messageDigest == null) // fail if there is no message digest
+                        return null;
+
+                    md = MessageDigest.getInstance(digestAlgname);
+                }
+
+                // put together digest algorithm and encryption algorithm
+                // to form signing algorithm
+                String encryptionAlgname =
+                    si.getDigestEncryptionAlgorithmId().getName();
+
+                // Workaround: sometimes the encryptionAlgname is actually
+                // a signature name
+                String tmp = AlgorithmId.getEncAlgFromSigAlg(encryptionAlgname);
+                if (tmp != null) encryptionAlgname = tmp;
+                String algname = AlgorithmId.makeSigAlg(
+                        digestAlgname, encryptionAlgname);
+
+                sig = Signature.getInstance(algname);
+                X509Certificate cert = si.getCertificate(block);
+
+                if (cert == null) {
+                    return null;
+                }
+                if (cert.hasUnsupportedCriticalExtension()) {
+                    throw new SignatureException("Certificate has unsupported "
+                                                 + "critical extension(s)");
+                }
+
+                // Make sure that if the usage of the key in the certificate is
+                // restricted, it can be used for digital signatures.
+                // XXX We may want to check for additional extensions in the
+                // future.
+                boolean[] keyUsageBits = cert.getKeyUsage();
+                if (keyUsageBits != null) {
+                    KeyUsageExtension keyUsage;
+                    try {
+                        // We don't care whether or not this extension was marked
+                        // critical in the certificate.
+                        // We're interested only in its value (i.e., the bits set)
+                        // and treat the extension as critical.
+                        keyUsage = new KeyUsageExtension(keyUsageBits);
+                    } catch (IOException ioe) {
+                        throw new SignatureException("Failed to parse keyUsage "
+                                                     + "extension");
+                    }
+
+                    boolean digSigAllowed = ((Boolean)keyUsage.get(
+                            KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue();
+
+                    boolean nonRepuAllowed = ((Boolean)keyUsage.get(
+                            KeyUsageExtension.NON_REPUDIATION)).booleanValue();
+
+                    if (!digSigAllowed && !nonRepuAllowed) {
+                        throw new SignatureException("Key usage restricted: "
+                                                     + "cannot be used for "
+                                                     + "digital signatures");
+                    }
+                }
+
+                PublicKey key = cert.getPublicKey();
+                sig.initVerify(key);
+                return new PKCS7Verifier(si, md, sig);
+            } catch (IOException e) {
+                throw new SignatureException("IO error verifying signature:\n" +
+                                             e.getMessage());
+
+            } catch (InvalidKeyException e) {
+                throw new SignatureException("InvalidKey: " + e.getMessage());
+
+            }
+        }
+
+        public void update(byte[] data, int off, int end)
+                throws SignatureException {
+            if (md != null) {
+                md.update(data, off, end-off);
+            } else {
+                sig.update(data, off, end-off);
+            }
+        }
+
+        public SignerInfo verify() throws SignatureException {
+            try {
+                // if there are authenticate attributes, get the message
+                // digest and compare it with the digest of data
+                if (md != null) {
+                    // now, check message digest
+                    byte[] messageDigest = (byte[])
+                        si.authenticatedAttributes.getAttributeValue(
+                             PKCS9Attribute.MESSAGE_DIGEST_OID);
+
+                    byte[] computedMessageDigest = md.digest();
+
+                    if (!MessageDigest.isEqual(
+                            messageDigest, computedMessageDigest)) {
+                        return null;
+                    }
+
+                    // message digest attribute matched
+                    // digest of original data
+
+                    // the data actually signed is the DER encoding of
+                    // the authenticated attributes (tagged with
+                    // the "SET OF" tag, not 0xA0).
+                    byte[] dataSigned = si.authenticatedAttributes.getDerEncoding();
+                    sig.update(dataSigned);
+                }
+
+                if (sig.verify(si.getEncryptedDigest())) {
+                    return si;
+                }
+
+            } catch (IOException e) {
+                throw new SignatureException("IO error verifying signature:\n" +
+                                             e.getMessage());
+            }
+            return null;
+        }
+    }
+
+    /**
      * This verifies a given SignerInfo.
      *
      * @param info the signer information.
@@ -554,19 +717,16 @@
     public SignerInfo[] verify(byte[] bytes)
     throws NoSuchAlgorithmException, SignatureException {
 
-        Vector<SignerInfo> intResult = new Vector<SignerInfo>();
+        List<SignerInfo> intResult = new ArrayList<>();
         for (int i = 0; i < signerInfos.length; i++) {
 
             SignerInfo signerInfo = verify(signerInfos[i], bytes);
             if (signerInfo != null) {
-                intResult.addElement(signerInfo);
+                intResult.add(signerInfo);
             }
         }
-        if (intResult.size() != 0) {
-
-            SignerInfo[] result = new SignerInfo[intResult.size()];
-            intResult.copyInto(result);
-            return result;
+        if (!intResult.isEmpty()) {
+            return intResult.toArray(new SignerInfo[intResult.size()]);
         }
         return null;
     }
--- a/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs/SignerInfo.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -230,7 +230,7 @@
         if (userCert == null)
             return null;
 
-        ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>();
+        ArrayList<X509Certificate> certList = new ArrayList<>();
         certList.add(userCert);
 
         X509Certificate[] pkcsCerts = block.getCertificates();
@@ -276,132 +276,20 @@
     /* Returns null if verify fails, this signerInfo if
        verify succeeds. */
     SignerInfo verify(PKCS7 block, byte[] data)
-    throws NoSuchAlgorithmException, SignatureException {
-
-        try {
-
-            ContentInfo content = block.getContentInfo();
-            if (data == null) {
-                data = content.getContentBytes();
-            }
-
-            String digestAlgname = getDigestAlgorithmId().getName();
-
-            byte[] dataSigned;
-
-            // if there are authenticate attributes, get the message
-            // digest and compare it with the digest of data
-            if (authenticatedAttributes == null) {
-                dataSigned = data;
-            } else {
-
-                // first, check content type
-                ObjectIdentifier contentType = (ObjectIdentifier)
-                       authenticatedAttributes.getAttributeValue(
-                         PKCS9Attribute.CONTENT_TYPE_OID);
-                if (contentType == null ||
-                    !contentType.equals(content.contentType))
-                    return null;  // contentType does not match, bad SignerInfo
-
-                // now, check message digest
-                byte[] messageDigest = (byte[])
-                    authenticatedAttributes.getAttributeValue(
-                         PKCS9Attribute.MESSAGE_DIGEST_OID);
-
-                if (messageDigest == null) // fail if there is no message digest
-                    return null;
-
-                MessageDigest md = MessageDigest.getInstance(digestAlgname);
-                byte[] computedMessageDigest = md.digest(data);
-
-                if (messageDigest.length != computedMessageDigest.length)
-                    return null;
-                for (int i = 0; i < messageDigest.length; i++) {
-                    if (messageDigest[i] != computedMessageDigest[i])
-                        return null;
-                }
-
-                // message digest attribute matched
-                // digest of original data
-
-                // the data actually signed is the DER encoding of
-                // the authenticated attributes (tagged with
-                // the "SET OF" tag, not 0xA0).
-                dataSigned = authenticatedAttributes.getDerEncoding();
-            }
-
-            // put together digest algorithm and encryption algorithm
-            // to form signing algorithm
-            String encryptionAlgname =
-                getDigestEncryptionAlgorithmId().getName();
+            throws NoSuchAlgorithmException, SignatureException {
 
-            // Workaround: sometimes the encryptionAlgname is actually
-            // a signature name
-            String tmp = AlgorithmId.getEncAlgFromSigAlg(encryptionAlgname);
-            if (tmp != null) encryptionAlgname = tmp;
-            String algname = AlgorithmId.makeSigAlg(
-                    digestAlgname, encryptionAlgname);
-
-            Signature sig = Signature.getInstance(algname);
-            X509Certificate cert = getCertificate(block);
-
-            if (cert == null) {
-                return null;
-            }
-            if (cert.hasUnsupportedCriticalExtension()) {
-                throw new SignatureException("Certificate has unsupported "
-                                             + "critical extension(s)");
+        PKCS7.PKCS7Verifier p7v = PKCS7.PKCS7Verifier.from(block, this);
+        if (p7v == null) return null;
+        if (data == null) {
+            try {
+                data = block.getContentInfo().getContentBytes();
+            } catch (IOException e) {
+                throw new SignatureException("IO error verifying signature:\n" +
+                                             e.getMessage());
             }
-
-            // Make sure that if the usage of the key in the certificate is
-            // restricted, it can be used for digital signatures.
-            // XXX We may want to check for additional extensions in the
-            // future.
-            boolean[] keyUsageBits = cert.getKeyUsage();
-            if (keyUsageBits != null) {
-                KeyUsageExtension keyUsage;
-                try {
-                    // We don't care whether or not this extension was marked
-                    // critical in the certificate.
-                    // We're interested only in its value (i.e., the bits set)
-                    // and treat the extension as critical.
-                    keyUsage = new KeyUsageExtension(keyUsageBits);
-                } catch (IOException ioe) {
-                    throw new SignatureException("Failed to parse keyUsage "
-                                                 + "extension");
-                }
-
-                boolean digSigAllowed = ((Boolean)keyUsage.get(
-                        KeyUsageExtension.DIGITAL_SIGNATURE)).booleanValue();
-
-                boolean nonRepuAllowed = ((Boolean)keyUsage.get(
-                        KeyUsageExtension.NON_REPUDIATION)).booleanValue();
-
-                if (!digSigAllowed && !nonRepuAllowed) {
-                    throw new SignatureException("Key usage restricted: "
-                                                 + "cannot be used for "
-                                                 + "digital signatures");
-                }
-            }
-
-            PublicKey key = cert.getPublicKey();
-            sig.initVerify(key);
-
-            sig.update(dataSigned);
-
-            if (sig.verify(encryptedDigest)) {
-                return this;
-            }
-
-        } catch (IOException e) {
-            throw new SignatureException("IO error verifying signature:\n" +
-                                         e.getMessage());
-
-        } catch (InvalidKeyException e) {
-            throw new SignatureException("InvalidKey: " + e.getMessage());
-
         }
-        return null;
+        p7v.update(data, 0, data.length);
+        return p7v.verify();
     }
 
     /* Verify the content of the pkcs7 block. */
--- a/jdk/src/share/classes/sun/security/pkcs11/Config.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/Config.java	Tue Apr 26 15:48:03 2011 -0700
@@ -343,6 +343,7 @@
         st.wordChars('{', '{'); // need {} for property subst
         st.wordChars('}', '}');
         st.wordChars('*', '*');
+        st.wordChars('+', '+');
         st.wordChars('~', '~');
         // XXX check ASCII table and add all other characters except special
 
--- a/jdk/src/share/classes/sun/security/pkcs11/SessionManager.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/SessionManager.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -76,6 +76,9 @@
     // maximum number of sessions to open with this token
     private final int maxSessions;
 
+    // total number of active sessions
+    private int activeSessions;
+
     // pool of available object sessions
     private final Pool objSessions;
 
@@ -115,11 +118,6 @@
         return (maxSessions <= DEFAULT_MAX_SESSIONS);
     }
 
-    // returns the total number of active sessions
-    int totalSessionCount() {
-        return SessionRef.totalCount();
-    }
-
     synchronized Session getObjSession() throws PKCS11Exception {
         Session session = objSessions.poll();
         if (session != null) {
@@ -141,7 +139,7 @@
         // create a new session rather than re-using an obj session
         // that avoids potential expensive cancels() for Signatures & RSACipher
         if (maxSessions == Integer.MAX_VALUE ||
-                totalSessionCount() < maxSessions) {
+                activeSessions < maxSessions) {
             session = openSession();
             return ensureValid(session);
         }
@@ -164,7 +162,7 @@
         if (debug != null) {
             String location = new Exception().getStackTrace()[2].toString();
             System.out.println("Killing session (" + location + ") active: "
-                + totalSessionCount());
+                + activeSessions);
         }
         closeSession(session);
         return null;
@@ -189,7 +187,7 @@
         }
         if (debug != null) {
             System.out.println("Demoting session, active: " +
-                totalSessionCount());
+                activeSessions);
         }
         boolean present = objSessions.remove(session);
         if (present == false) {
@@ -202,16 +200,16 @@
 
     private Session openSession() throws PKCS11Exception {
         if ((maxSessions != Integer.MAX_VALUE) &&
-                (totalSessionCount() >= maxSessions)) {
+                (activeSessions >= maxSessions)) {
             throw new ProviderException("No more sessions available");
         }
         long id = token.p11.C_OpenSession
                     (token.provider.slotID, openSessionFlags, null, null);
         Session session = new Session(token, id);
+        activeSessions++;
         if (debug != null) {
-            int currTotal = totalSessionCount();
-            if (currTotal > maxActiveSessions) {
-                maxActiveSessions = currTotal;
+            if (activeSessions > maxActiveSessions) {
+                maxActiveSessions = activeSessions;
                 if (maxActiveSessions % 10 == 0) {
                     System.out.println("Open sessions: " + maxActiveSessions);
                 }
@@ -222,6 +220,7 @@
 
     private void closeSession(Session session) {
         session.close();
+        activeSessions--;
     }
 
     private static final class Pool {
@@ -275,7 +274,7 @@
             }
             if (debug != null) {
                 System.out.println("Closing " + i + " idle sessions, active: "
-                        + mgr.totalSessionCount());
+                        + mgr.activeSessions);
             }
             List<Session> subList = pool.subList(0, i);
             subList.clear();
--- a/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/CrlRevocationChecker.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -249,7 +249,7 @@
         throws CertPathValidatorException
     {
         verifyRevocationStatus(currCert, prevKey, signFlag,
-                               allowSeparateKey, null);
+                   allowSeparateKey, null, mParams.getTrustAnchors());
     }
 
     /**
@@ -260,11 +260,12 @@
      *                     circular dependencies, we assume they're
      *                     revoked while checking the revocation
      *                     status of this cert.
+     * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s
      */
     private void verifyRevocationStatus(X509Certificate currCert,
         PublicKey prevKey, boolean signFlag, boolean allowSeparateKey,
-        Set<X509Certificate> stackedCerts) throws CertPathValidatorException
-    {
+        Set<X509Certificate> stackedCerts,
+        Set<TrustAnchor> trustAnchors) throws CertPathValidatorException {
 
         String msg = "revocation status";
         if (debug != null) {
@@ -311,7 +312,7 @@
                 DistributionPointFetcher.getInstance();
             // all CRLs returned by the DP Fetcher have also been verified
             mApprovedCRLs.addAll(store.getCRLs(sel, signFlag, prevKey,
-                mSigProvider, mStores, reasonsMask, mAnchor));
+                mSigProvider, mStores, reasonsMask, trustAnchors));
         } catch (Exception e) {
             if (debug != null) {
                 debug.println("CrlRevocationChecker.verifyRevocationStatus() "
@@ -328,7 +329,7 @@
             // Now that we have a list of possible CRLs, see which ones can
             // be approved
             mApprovedCRLs.addAll(verifyPossibleCRLs(mPossibleCRLs, currCert,
-                signFlag, prevKey, reasonsMask));
+                signFlag, prevKey, reasonsMask, trustAnchors));
         }
         if (debug != null) {
             debug.println("CrlRevocationChecker.verifyRevocationStatus() " +
@@ -353,9 +354,10 @@
         // See if the cert is in the set of approved crls.
         if (debug != null) {
             BigInteger sn = currCert.getSerialNumber();
-            debug.println("starting the final sweep...");
+            debug.println("CrlRevocationChecker.verifyRevocationStatus() " +
+                            "starting the final sweep...");
             debug.println("CrlRevocationChecker.verifyRevocationStatus" +
-                          " cert SN: " + sn.toString());
+                            " cert SN: " + sn.toString());
         }
 
         CRLReason reasonCode = CRLReason.UNSPECIFIED;
@@ -497,9 +499,9 @@
         certSel.setSubject(currCert.getIssuerX500Principal());
         certSel.setKeyUsage(mCrlSignUsage);
 
-        Set<TrustAnchor> newAnchors = mAnchor == null
-            ? mParams.getTrustAnchors()
-            : Collections.singleton(mAnchor);
+        Set<TrustAnchor> newAnchors =
+            (mAnchor == null ? mParams.getTrustAnchors() :
+                                Collections.singleton(mAnchor));
 
         PKIXBuilderParameters builderParams;
         if (mParams instanceof PKIXBuilderParameters) {
@@ -617,8 +619,8 @@
                             debug.println("CrlRevocationChecker.buildToNewKey()"
                                 + " index " + i + " checking " + cert);
                         }
-                        verifyRevocationStatus(cert, prevKey2, signFlag,
-                                               true, stackedCerts);
+                        verifyRevocationStatus(cert, prevKey2, signFlag, true,
+                                stackedCerts, newAnchors);
                         signFlag = certCanSignCrl(cert);
                         prevKey2 = cert.getPublicKey();
                     }
@@ -727,12 +729,14 @@
      * @param signFlag <code>true</code> if prevKey was trusted to sign CRLs
      * @param prevKey the public key of the issuer of cert
      * @param reasonsMask the reason code mask
+     * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s>
      * @return a collection of approved crls (or an empty collection)
      */
     private Collection<X509CRL> verifyPossibleCRLs(Set<X509CRL> crls,
         X509Certificate cert, boolean signFlag, PublicKey prevKey,
-        boolean[] reasonsMask) throws CertPathValidatorException
-    {
+        boolean[] reasonsMask,
+        Set<TrustAnchor> trustAnchors) throws CertPathValidatorException {
+
         try {
             X509CertImpl certImpl = X509CertImpl.toImpl(cert);
             if (debug != null) {
@@ -764,7 +768,8 @@
                 DistributionPoint point = t.next();
                 for (X509CRL crl : crls) {
                     if (dpf.verifyCRL(certImpl, point, crl, reasonsMask,
-                        signFlag, prevKey, mSigProvider, mAnchor, mStores)) {
+                            signFlag, prevKey, mSigProvider,
+                            trustAnchors, mStores)) {
                         results.add(crl);
                     }
                 }
--- a/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Tue Apr 26 15:48:03 2011 -0700
@@ -90,8 +90,9 @@
      */
     Collection<X509CRL> getCRLs(X509CRLSelector selector, boolean signFlag,
         PublicKey prevKey, String provider, List<CertStore> certStores,
-        boolean[] reasonsMask, TrustAnchor anchor) throws CertStoreException
-    {
+        boolean[] reasonsMask,
+        Set<TrustAnchor> trustAnchors) throws CertStoreException {
+
         if (USE_CRLDP == false) {
             return Collections.emptySet();
         }
@@ -121,7 +122,7 @@
                 DistributionPoint point = t.next();
                 Collection<X509CRL> crls = getCRLs(selector, certImpl,
                     point, reasonsMask, signFlag, prevKey, provider,
-                    certStores, anchor);
+                    certStores, trustAnchors);
                 results.addAll(crls);
             }
             if (debug != null) {
@@ -142,8 +143,8 @@
     private Collection<X509CRL> getCRLs(X509CRLSelector selector,
         X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask,
         boolean signFlag, PublicKey prevKey, String provider,
-        List<CertStore> certStores, TrustAnchor anchor)
-    {
+        List<CertStore> certStores, Set<TrustAnchor> trustAnchors) {
+
         // check for full name
         GeneralNames fullName = point.getFullName();
         if (fullName == null) {
@@ -194,7 +195,7 @@
                 // we check the issuer in verifyCRLs method
                 selector.setIssuerNames(null);
                 if (selector.match(crl) && verifyCRL(certImpl, point, crl,
-                        reasonsMask, signFlag, prevKey, provider, anchor,
+                        reasonsMask, signFlag, prevKey, provider, trustAnchors,
                         certStores)) {
                     crls.add(crl);
                 }
@@ -276,12 +277,17 @@
      * @param signFlag true if prevKey can be used to verify the CRL
      * @param prevKey the public key that verifies the certificate's signature
      * @param provider the Signature provider to use
+     * @param trustAnchors a {@code Set} of {@code TrustAnchor}s
+     * @param certStores a {@code List} of {@code CertStore}s to be used in
+     *        finding certificates and CRLs
      * @return true if ok, false if not
      */
     boolean verifyCRL(X509CertImpl certImpl, DistributionPoint point,
         X509CRL crl, boolean[] reasonsMask, boolean signFlag,
-        PublicKey prevKey, String provider, TrustAnchor anchor,
+        PublicKey prevKey, String provider,
+        Set<TrustAnchor> trustAnchors,
         List<CertStore> certStores) throws CRLException, IOException {
+
         boolean indirectCRL = false;
         X509CRLImpl crlImpl = X509CRLImpl.toImpl(crl);
         IssuingDistributionPointExtension idpExt =
@@ -335,7 +341,16 @@
             byte[] crlAKID = crlImpl.getExtensionValue(
                                 PKIXExtensions.AuthorityKey_Id.toString());
 
-            if (!Arrays.equals(certAKID, crlAKID)) {
+            if (certAKID == null || crlAKID == null) {
+                // cannot recognize indirect CRL without AKID
+
+                // we accept the case that a CRL issuer provide status
+                // information for itself.
+                if (issues(certImpl, crlImpl, provider)) {
+                    // reset the public key used to verify the CRL's signature
+                    prevKey = certImpl.getPublicKey();
+                }
+            } else if (!Arrays.equals(certAKID, crlAKID)) {
                 // we accept the case that a CRL issuer provide status
                 // information for itself.
                 if (issues(certImpl, crlImpl, provider)) {
@@ -572,46 +587,19 @@
             // Except the performance improvement, another benefit is to break
             // the dead loop while looking for the issuer back and forth
             // between the delegated self-issued certificate and its issuer.
-            Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>();
-            if (anchor != null) {
-                trustAnchors.add(anchor);
-            }
+            Set<TrustAnchor> newTrustAnchors = new HashSet<>(trustAnchors);
 
             if (prevKey != null) {
-                // if the previous key is of the anchor, don't bother to
-                // duplicate the trust.
-                boolean duplicated = false;
-                PublicKey publicKey = prevKey;
+                // Add the previous certificate as a trust anchor.
                 X500Principal principal = certImpl.getIssuerX500Principal();
-
-                if (anchor != null) {
-                    X509Certificate trustedCert = anchor.getTrustedCert();
-                    X500Principal trustedPrincipal;
-                    PublicKey trustedPublicKey;
-                    if (trustedCert != null) {
-                        trustedPrincipal = trustedCert.getSubjectX500Principal();
-                        trustedPublicKey = trustedCert.getPublicKey();
-                    } else {
-                        trustedPrincipal = anchor.getCA();
-                        trustedPublicKey = anchor.getCAPublicKey();
-                    }
-
-                    if (principal.equals(trustedPrincipal) &&
-                        publicKey.equals(trustedPublicKey)) {
-                        duplicated = true;
-                    }
-                }
-
-                if (!duplicated) {
-                    TrustAnchor temporary =
-                        new TrustAnchor(principal, publicKey, null);
-                    trustAnchors.add(temporary);
-                }
+                TrustAnchor temporary =
+                        new TrustAnchor(principal, prevKey, null);
+                newTrustAnchors.add(temporary);
             }
 
             PKIXBuilderParameters params = null;
             try {
-                params = new PKIXBuilderParameters(trustAnchors, certSel);
+                params = new PKIXBuilderParameters(newTrustAnchors, certSel);
             } catch (InvalidAlgorithmParameterException iape) {
                 throw new CRLException(iape);
             }
@@ -697,6 +685,8 @@
     private static boolean issues(X509CertImpl cert, X509CRLImpl crl,
             String provider) throws IOException {
 
+        boolean matched = false;
+
         AdaptableX509CertSelector issuerSelector =
                                     new AdaptableX509CertSelector();
 
@@ -719,9 +709,24 @@
          * and MUST include authority key identifier extension in all CRLs
          * issued. [section 5.2.1, RFC 2459]
          */
-        issuerSelector.parseAuthorityKeyIdentifierExtension(
-                                        crl.getAuthKeyIdExtension());
+        AuthorityKeyIdentifierExtension crlAKID = crl.getAuthKeyIdExtension();
+        if (crlAKID != null) {
+            issuerSelector.parseAuthorityKeyIdentifierExtension(crlAKID);
+        }
+
+        matched = issuerSelector.match(cert);
 
-        return issuerSelector.match(cert);
+        // if AKID is unreliable, verify the CRL signature with the cert
+        if (matched && (crlAKID == null ||
+                cert.getAuthorityKeyIdentifierExtension() == null)) {
+            try {
+                crl.verify(cert.getPublicKey(), provider);
+                matched = true;
+            } catch (Exception e) {
+                matched = false;
+            }
+        }
+
+        return matched;
     }
 }
--- a/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/CipherSuiteList.java	Tue Apr 26 15:48:03 2011 -0700
@@ -40,10 +40,6 @@
  */
 final class CipherSuiteList {
 
-    // lists of supported and default enabled ciphersuites
-    // created on demand
-    private static CipherSuiteList supportedSuites, defaultSuites;
-
     private final Collection<CipherSuite> cipherSuites;
     private String[] suiteNames;
 
@@ -206,57 +202,8 @@
      */
     static synchronized void clearAvailableCache() {
         if (CipherSuite.DYNAMIC_AVAILABILITY) {
-            supportedSuites = null;
-            defaultSuites = null;
             CipherSuite.BulkCipher.clearAvailableCache();
             JsseJce.clearEcAvailable();
         }
     }
-
-    /**
-     * Return the list of all available CipherSuites with a priority of
-     * minPriority or above.
-     * Should be called with the Class lock held.
-     */
-    private static CipherSuiteList buildAvailableCache(int minPriority) {
-        // SortedSet automatically arranges ciphersuites in default
-        // preference order
-        Set<CipherSuite> cipherSuites = new TreeSet<>();
-        Collection<CipherSuite> allowedCipherSuites =
-                                    CipherSuite.allowedCipherSuites();
-        for (CipherSuite c : allowedCipherSuites) {
-            if ((c.allowed == false) || (c.priority < minPriority)) {
-                continue;
-            }
-
-            if (c.isAvailable()) {
-                cipherSuites.add(c);
-            }
-        }
-
-        return new CipherSuiteList(cipherSuites);
-    }
-
-    /**
-     * Return supported CipherSuites in preference order.
-     */
-    static synchronized CipherSuiteList getSupported() {
-        if (supportedSuites == null) {
-            supportedSuites =
-                buildAvailableCache(CipherSuite.SUPPORTED_SUITES_PRIORITY);
-        }
-        return supportedSuites;
-    }
-
-    /**
-     * Return default enabled CipherSuites in preference order.
-     */
-    static synchronized CipherSuiteList getDefault() {
-        if (defaultSuites == null) {
-            defaultSuites =
-                buildAvailableCache(CipherSuite.DEFAULT_SUITES_PRIORITY);
-        }
-        return defaultSuites;
-    }
-
 }
--- a/jdk/src/share/classes/sun/security/ssl/DefaultSSLContextImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2005, 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 sun.security.ssl;
-
-import java.io.*;
-import java.util.*;
-
-import java.security.*;
-
-import javax.net.ssl.*;
-
-/**
- * "Default" SSLContext as returned by SSLContext.getDefault(). It comes
- * initialized with default KeyManagers and TrustManagers created using
- * various system properties.
- *
- * @since   1.6
- */
-public final class DefaultSSLContextImpl extends SSLContextImpl {
-
-    private static final String NONE = "NONE";
-    private static final String P11KEYSTORE = "PKCS11";
-    private static final Debug debug = Debug.getInstance("ssl");
-
-    private static volatile SSLContextImpl defaultImpl;
-
-    private static TrustManager[] defaultTrustManagers;
-
-    private static KeyManager[] defaultKeyManagers;
-
-    public DefaultSSLContextImpl() throws Exception {
-        super(defaultImpl);
-        try {
-            super.engineInit(getDefaultKeyManager(), getDefaultTrustManager(), null);
-        } catch (Exception e) {
-            if (debug != null && Debug.isOn("defaultctx")) {
-                System.out.println("default context init failed: " + e);
-            }
-            throw e;
-        }
-        if (defaultImpl == null) {
-            defaultImpl = this;
-        }
-    }
-
-    protected void engineInit(KeyManager[] km, TrustManager[] tm,
-            SecureRandom sr) throws KeyManagementException {
-        throw new KeyManagementException
-            ("Default SSLContext is initialized automatically");
-    }
-
-    static synchronized SSLContextImpl getDefaultImpl() throws Exception {
-        if (defaultImpl == null) {
-            new DefaultSSLContextImpl();
-        }
-        return defaultImpl;
-    }
-
-    private static synchronized TrustManager[] getDefaultTrustManager() throws Exception {
-        if (defaultTrustManagers != null) {
-            return defaultTrustManagers;
-        }
-
-        KeyStore ks = TrustManagerFactoryImpl.getCacertsKeyStore("defaultctx");
-
-        TrustManagerFactory tmf = TrustManagerFactory.getInstance(
-            TrustManagerFactory.getDefaultAlgorithm());
-        tmf.init(ks);
-        defaultTrustManagers = tmf.getTrustManagers();
-        return defaultTrustManagers;
-    }
-
-    private static synchronized KeyManager[] getDefaultKeyManager() throws Exception {
-        if (defaultKeyManagers != null) {
-            return defaultKeyManagers;
-        }
-
-        final Map<String,String> props = new HashMap<>();
-        AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<Object>() {
-            public Object run() throws Exception {
-                props.put("keyStore",  System.getProperty(
-                            "javax.net.ssl.keyStore", ""));
-                props.put("keyStoreType", System.getProperty(
-                            "javax.net.ssl.keyStoreType",
-                            KeyStore.getDefaultType()));
-                props.put("keyStoreProvider", System.getProperty(
-                            "javax.net.ssl.keyStoreProvider", ""));
-                props.put("keyStorePasswd", System.getProperty(
-                            "javax.net.ssl.keyStorePassword", ""));
-                return null;
-            }
-        });
-
-        final String defaultKeyStore = props.get("keyStore");
-        String defaultKeyStoreType = props.get("keyStoreType");
-        String defaultKeyStoreProvider = props.get("keyStoreProvider");
-        if (debug != null && Debug.isOn("defaultctx")) {
-            System.out.println("keyStore is : " + defaultKeyStore);
-            System.out.println("keyStore type is : " +
-                                    defaultKeyStoreType);
-            System.out.println("keyStore provider is : " +
-                                    defaultKeyStoreProvider);
-        }
-
-        if (P11KEYSTORE.equals(defaultKeyStoreType) &&
-                !NONE.equals(defaultKeyStore)) {
-            throw new IllegalArgumentException("if keyStoreType is "
-                + P11KEYSTORE + ", then keyStore must be " + NONE);
-        }
-
-        FileInputStream fs = null;
-        if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) {
-            fs = AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<FileInputStream>() {
-                public FileInputStream run() throws Exception {
-                    return new FileInputStream(defaultKeyStore);
-                }
-            });
-        }
-
-        String defaultKeyStorePassword = props.get("keyStorePasswd");
-        char[] passwd = null;
-        if (defaultKeyStorePassword.length() != 0) {
-            passwd = defaultKeyStorePassword.toCharArray();
-        }
-
-        /**
-         * Try to initialize key store.
-         */
-        KeyStore ks = null;
-        if ((defaultKeyStoreType.length()) != 0) {
-            if (debug != null && Debug.isOn("defaultctx")) {
-                System.out.println("init keystore");
-            }
-            if (defaultKeyStoreProvider.length() == 0) {
-                ks = KeyStore.getInstance(defaultKeyStoreType);
-            } else {
-                ks = KeyStore.getInstance(defaultKeyStoreType,
-                                    defaultKeyStoreProvider);
-            }
-
-            // if defaultKeyStore is NONE, fs will be null
-            ks.load(fs, passwd);
-        }
-        if (fs != null) {
-            fs.close();
-            fs = null;
-        }
-
-        /*
-         * Try to initialize key manager.
-         */
-        if (debug != null && Debug.isOn("defaultctx")) {
-            System.out.println("init keymanager of type " +
-                KeyManagerFactory.getDefaultAlgorithm());
-        }
-        KeyManagerFactory kmf = KeyManagerFactory.getInstance(
-            KeyManagerFactory.getDefaultAlgorithm());
-
-        if (P11KEYSTORE.equals(defaultKeyStoreType)) {
-            kmf.init(ks, null); // do not pass key passwd if using token
-        } else {
-            kmf.init(ks, passwd);
-        }
-
-        defaultKeyManagers = kmf.getKeyManagers();
-        return defaultKeyManagers;
-    }
-}
--- a/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -247,9 +247,9 @@
                 // the SunJSSE implementation does the actual crypto using
                 // a NONEwithRSA signature obtained from the cryptoProvider.
                 if (cryptoProvider.getService("Signature", algorithm) == null) {
-                    // Calling Signature.getInstance() and catching the exception
-                    // would be cleaner, but exceptions are a little expensive.
-                    // So we check directly via getService().
+                    // Calling Signature.getInstance() and catching the
+                    // exception would be cleaner, but exceptions are a little
+                    // expensive. So we check directly via getService().
                     try {
                         return Signature.getInstance(algorithm, "SunJSSE");
                     } catch (NoSuchProviderException e) {
--- a/jdk/src/share/classes/sun/security/ssl/ProtocolList.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/ProtocolList.java	Tue Apr 26 15:48:03 2011 -0700
@@ -37,10 +37,6 @@
  */
 final class ProtocolList {
 
-    private static final ProtocolList SUPPORTED;
-    private static final ProtocolList CLIENT_DEFAULT;
-    private static final ProtocolList SERVER_DEFAULT;
-
     // the sorted protocol version list
     private final ArrayList<ProtocolVersion> protocols;
 
@@ -154,66 +150,4 @@
     public String toString() {
         return protocols.toString();
     }
-
-    /**
-     * Return the list of default enabled protocols.
-     */
-    static ProtocolList getDefault(boolean isServer) {
-        return isServer ? SERVER_DEFAULT : CLIENT_DEFAULT;
-    }
-
-    /**
-     * Return whether a protocol list is the original default enabled
-     * protocols.  See: SSLSocket/SSLEngine.setEnabledProtocols()
-     */
-    static boolean isDefaultProtocolList(ProtocolList protocols) {
-        return protocols == CLIENT_DEFAULT || protocols == SERVER_DEFAULT;
-    }
-
-    /**
-     * Return the list of supported protocols.
-     */
-    static ProtocolList getSupported() {
-        return SUPPORTED;
-    }
-
-    static {
-        if (SunJSSE.isFIPS()) {
-            SUPPORTED = new ProtocolList(new String[] {
-                ProtocolVersion.TLS10.name,
-                ProtocolVersion.TLS11.name,
-                ProtocolVersion.TLS12.name
-            });
-
-            SERVER_DEFAULT = SUPPORTED;
-            CLIENT_DEFAULT = new ProtocolList(new String[] {
-                ProtocolVersion.TLS10.name
-            });
-        } else {
-            SUPPORTED = new ProtocolList(new String[] {
-                ProtocolVersion.SSL20Hello.name,
-                ProtocolVersion.SSL30.name,
-                ProtocolVersion.TLS10.name,
-                ProtocolVersion.TLS11.name,
-                ProtocolVersion.TLS12.name
-            });
-
-            SERVER_DEFAULT = SUPPORTED;
-
-            /*
-             * RFC 5246 says that sending SSLv2 backward-compatible
-             * hello SHOULD NOT be done any longer.
-             *
-             * We are not enabling TLS 1.1/1.2 by default yet on clients
-             * out of concern for interop with existing
-             * SSLv3/TLS1.0-only servers.  When these versions of TLS
-             * gain more traction, we'll enable them.
-             */
-            CLIENT_DEFAULT = new ProtocolList(new String[] {
-                ProtocolVersion.SSL30.name,
-                ProtocolVersion.TLS10.name
-            });
-        }
-    }
-
 }
--- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -27,6 +27,7 @@
 
 import java.net.Socket;
 
+import java.io.*;
 import java.util.*;
 import java.security.*;
 import java.security.cert.*;
@@ -36,7 +37,7 @@
 
 import sun.security.provider.certpath.AlgorithmChecker;
 
-public class SSLContextImpl extends SSLContextSpi {
+public abstract class SSLContextImpl extends SSLContextSpi {
 
     private static final Debug debug = Debug.getInstance("ssl");
 
@@ -50,20 +51,24 @@
     private X509TrustManager trustManager;
     private SecureRandom secureRandom;
 
-    public SSLContextImpl() {
-        this(null);
-    }
+    // The default algrithm constraints
+    private AlgorithmConstraints defaultAlgorithmConstraints =
+                                 new SSLAlgorithmConstraints(null);
+
+    // supported and default protocols
+    private ProtocolList defaultServerProtocolList;
+    private ProtocolList defaultClientProtocolList;
+    private ProtocolList supportedProtocolList;
 
-    SSLContextImpl(SSLContextImpl other) {
-        if (other == null) {
-            ephemeralKeyManager = new EphemeralKeyManager();
-            clientCache = new SSLSessionContextImpl();
-            serverCache = new SSLSessionContextImpl();
-        } else {
-            ephemeralKeyManager = other.ephemeralKeyManager;
-            clientCache = other.clientCache;
-            serverCache = other.serverCache;
-        }
+    // supported and default cipher suites
+    private CipherSuiteList defaultServerCipherSuiteList;
+    private CipherSuiteList defaultClientCipherSuiteList;
+    private CipherSuiteList supportedCipherSuiteList;
+
+    SSLContextImpl() {
+        ephemeralKeyManager = new EphemeralKeyManager();
+        clientCache = new SSLSessionContextImpl();
+        serverCache = new SSLSessionContextImpl();
     }
 
     protected void engineInit(KeyManager[] km, TrustManager[] tm,
@@ -177,7 +182,7 @@
             throw new IllegalStateException(
                 "SSLContextImpl is not initialized");
         }
-        return new SSLSocketFactoryImpl(this);
+       return new SSLSocketFactoryImpl(this);
     }
 
     protected SSLServerSocketFactory engineGetServerSocketFactory() {
@@ -227,6 +232,535 @@
         return ephemeralKeyManager;
     }
 
+    abstract SSLParameters getDefaultServerSSLParams();
+    abstract SSLParameters getDefaultClientSSLParams();
+    abstract SSLParameters getSupportedSSLParams();
+
+    // Get suported ProtoclList.
+    ProtocolList getSuportedProtocolList() {
+        if (supportedProtocolList == null) {
+            supportedProtocolList =
+                new ProtocolList(getSupportedSSLParams().getProtocols());
+        }
+
+        return supportedProtocolList;
+    }
+
+    // Get default ProtoclList.
+    ProtocolList getDefaultProtocolList(boolean roleIsServer) {
+        if (roleIsServer) {
+            if (defaultServerProtocolList == null) {
+                defaultServerProtocolList = new ProtocolList(
+                        getDefaultServerSSLParams().getProtocols());
+            }
+
+            return defaultServerProtocolList;
+        } else {
+            if (defaultClientProtocolList == null) {
+                defaultClientProtocolList = new ProtocolList(
+                        getDefaultClientSSLParams().getProtocols());
+            }
+
+            return defaultClientProtocolList;
+        }
+    }
+
+    // Get suported CipherSuiteList.
+    CipherSuiteList getSuportedCipherSuiteList() {
+        // Clear cache of available ciphersuites.
+        clearAvailableCache();
+
+        if (supportedCipherSuiteList == null) {
+            supportedCipherSuiteList =
+                getApplicableCipherSuiteList(getSuportedProtocolList(), false);
+        }
+
+        return supportedCipherSuiteList;
+    }
+
+    // Get default CipherSuiteList.
+    CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) {
+        // Clear cache of available ciphersuites.
+        clearAvailableCache();
+
+        if (roleIsServer) {
+            if (defaultServerCipherSuiteList == null) {
+                defaultServerCipherSuiteList = getApplicableCipherSuiteList(
+                        getDefaultProtocolList(true), true);
+            }
+
+            return defaultServerCipherSuiteList;
+        } else {
+            if (defaultClientCipherSuiteList == null) {
+                defaultClientCipherSuiteList = getApplicableCipherSuiteList(
+                        getDefaultProtocolList(false), true);
+            }
+
+            return defaultClientCipherSuiteList;
+        }
+    }
+
+    /**
+     * Return whether a protocol list is the original default enabled
+     * protocols.  See: SSLSocket/SSLEngine.setEnabledProtocols()
+     */
+    boolean isDefaultProtocolList(ProtocolList protocols) {
+        return (protocols == defaultServerProtocolList) ||
+               (protocols == defaultClientProtocolList);
+    }
+
+
+    /*
+     * Return the list of all available CipherSuites with a priority of
+     * minPriority or above.
+     */
+    private CipherSuiteList getApplicableCipherSuiteList(
+            ProtocolList protocols, boolean onlyEnabled) {
+
+        int minPriority = CipherSuite.SUPPORTED_SUITES_PRIORITY;
+        if (onlyEnabled) {
+            minPriority = CipherSuite.DEFAULT_SUITES_PRIORITY;
+        }
+
+        Collection<CipherSuite> allowedCipherSuites =
+                                    CipherSuite.allowedCipherSuites();
+
+        ArrayList<CipherSuite> suites = new ArrayList<>();
+        if (!(protocols.collection().isEmpty()) &&
+                protocols.min.v != ProtocolVersion.NONE.v) {
+            for (CipherSuite suite : allowedCipherSuites) {
+                if (suite.allowed == false || suite.priority < minPriority) {
+                    continue;
+                }
+
+                if (suite.isAvailable() &&
+                        suite.obsoleted > protocols.min.v &&
+                        suite.supported <= protocols.max.v) {
+                    if (defaultAlgorithmConstraints.permits(
+                            EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
+                            suite.name, null)) {
+                        suites.add(suite);
+                    }
+                } else if (debug != null &&
+                        Debug.isOn("sslctx") && Debug.isOn("verbose")) {
+                    if (suite.obsoleted <= protocols.min.v) {
+                        System.out.println(
+                            "Ignoring obsoleted cipher suite: " + suite);
+                    } else if (suite.supported > protocols.max.v) {
+                        System.out.println(
+                            "Ignoring unsupported cipher suite: " + suite);
+                    } else {
+                        System.out.println(
+                            "Ignoring unavailable cipher suite: " + suite);
+                    }
+                }
+            }
+        }
+
+        return new CipherSuiteList(suites);
+    }
+
+    /**
+     * Clear cache of available ciphersuites. If we support all ciphers
+     * internally, there is no need to clear the cache and calling this
+     * method has no effect.
+     */
+    synchronized void clearAvailableCache() {
+        if (CipherSuite.DYNAMIC_AVAILABILITY) {
+            supportedCipherSuiteList = null;
+            defaultServerCipherSuiteList = null;
+            defaultClientCipherSuiteList = null;
+            CipherSuite.BulkCipher.clearAvailableCache();
+            JsseJce.clearEcAvailable();
+        }
+    }
+
+    /*
+     * The SSLContext implementation for TLS/SSL algorithm
+     *
+     * SSL/TLS protocols specify the forward compatibility and version
+     * roll-back attack protections, however, a number of SSL/TLS server
+     * vendors did not implement these aspects properly, and some current
+     * SSL/TLS servers may refuse to talk to a TLS 1.1 or later client.
+     *
+     * Considering above interoperability issues, SunJSSE will not set
+     * TLS 1.1 and TLS 1.2 as the enabled protocols for client by default.
+     *
+     * For SSL/TLS servers, there is no such interoperability issues as
+     * SSL/TLS clients. In SunJSSE, TLS 1.1 or later version will be the
+     * enabled protocols for server by default.
+     *
+     * We may change the behavior when popular TLS/SSL vendors support TLS
+     * forward compatibility properly.
+     *
+     * SSLv2Hello is no longer necessary.  This interoperability option was
+     * put in place in the late 90's when SSLv3/TLS1.0 were relatively new
+     * and there were a fair number of SSLv2-only servers deployed.  Because
+     * of the security issues in SSLv2, it is rarely (if ever) used, as
+     * deployments should now be using SSLv3 and TLSv1.
+     *
+     * Considering the issues of SSLv2Hello, we should not enable SSLv2Hello
+     * by default. Applications still can use it by enabling SSLv2Hello with
+     * the series of setEnabledProtocols APIs.
+     */
+
+    /*
+     * The conservative SSLContext implementation for TLS, SSL, SSLv3 and
+     * TLS10 algorithm.
+     *
+     * This is a super class of DefaultSSLContext and TLS10Context.
+     *
+     * @see SSLContext
+     */
+    private static class ConservativeSSLContext extends SSLContextImpl {
+        // parameters
+        private static SSLParameters defaultServerSSLParams;
+        private static SSLParameters defaultClientSSLParams;
+        private static SSLParameters supportedSSLParams;
+
+        static {
+            if (SunJSSE.isFIPS()) {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name
+                });
+
+            } else {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL20Hello.name,
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name
+                });
+            }
+        }
+
+        SSLParameters getDefaultServerSSLParams() {
+            return defaultServerSSLParams;
+        }
+
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+
+        SSLParameters getSupportedSSLParams() {
+            return supportedSSLParams;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for default algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class DefaultSSLContext extends ConservativeSSLContext {
+        private static final String NONE = "NONE";
+        private static final String P11KEYSTORE = "PKCS11";
+
+        private static volatile SSLContextImpl defaultImpl;
+
+        private static TrustManager[] defaultTrustManagers;
+        private static KeyManager[] defaultKeyManagers;
+
+        public DefaultSSLContext() throws Exception {
+            try {
+                super.engineInit(getDefaultKeyManager(),
+                        getDefaultTrustManager(), null);
+            } catch (Exception e) {
+                if (debug != null && Debug.isOn("defaultctx")) {
+                    System.out.println("default context init failed: " + e);
+                }
+                throw e;
+            }
+
+            if (defaultImpl == null) {
+                defaultImpl = this;
+            }
+        }
+
+        protected void engineInit(KeyManager[] km, TrustManager[] tm,
+            SecureRandom sr) throws KeyManagementException {
+            throw new KeyManagementException
+                ("Default SSLContext is initialized automatically");
+        }
+
+        static synchronized SSLContextImpl getDefaultImpl() throws Exception {
+            if (defaultImpl == null) {
+                new DefaultSSLContext();
+            }
+            return defaultImpl;
+        }
+
+        private static synchronized TrustManager[] getDefaultTrustManager()
+                throws Exception {
+            if (defaultTrustManagers != null) {
+                return defaultTrustManagers;
+            }
+
+            KeyStore ks =
+                TrustManagerFactoryImpl.getCacertsKeyStore("defaultctx");
+
+            TrustManagerFactory tmf = TrustManagerFactory.getInstance(
+                TrustManagerFactory.getDefaultAlgorithm());
+            tmf.init(ks);
+            defaultTrustManagers = tmf.getTrustManagers();
+            return defaultTrustManagers;
+        }
+
+        private static synchronized KeyManager[] getDefaultKeyManager()
+                throws Exception {
+            if (defaultKeyManagers != null) {
+                return defaultKeyManagers;
+            }
+
+            final Map<String,String> props = new HashMap<>();
+            AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<Object>() {
+                public Object run() throws Exception {
+                    props.put("keyStore",  System.getProperty(
+                                "javax.net.ssl.keyStore", ""));
+                    props.put("keyStoreType", System.getProperty(
+                                "javax.net.ssl.keyStoreType",
+                                KeyStore.getDefaultType()));
+                    props.put("keyStoreProvider", System.getProperty(
+                                "javax.net.ssl.keyStoreProvider", ""));
+                    props.put("keyStorePasswd", System.getProperty(
+                                "javax.net.ssl.keyStorePassword", ""));
+                    return null;
+                }
+            });
+
+            final String defaultKeyStore = props.get("keyStore");
+            String defaultKeyStoreType = props.get("keyStoreType");
+            String defaultKeyStoreProvider = props.get("keyStoreProvider");
+            if (debug != null && Debug.isOn("defaultctx")) {
+                System.out.println("keyStore is : " + defaultKeyStore);
+                System.out.println("keyStore type is : " +
+                                        defaultKeyStoreType);
+                System.out.println("keyStore provider is : " +
+                                        defaultKeyStoreProvider);
+            }
+
+            if (P11KEYSTORE.equals(defaultKeyStoreType) &&
+                    !NONE.equals(defaultKeyStore)) {
+                throw new IllegalArgumentException("if keyStoreType is "
+                    + P11KEYSTORE + ", then keyStore must be " + NONE);
+            }
+
+            FileInputStream fs = null;
+            if (defaultKeyStore.length() != 0 && !NONE.equals(defaultKeyStore)) {
+                fs = AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<FileInputStream>() {
+                    public FileInputStream run() throws Exception {
+                        return new FileInputStream(defaultKeyStore);
+                    }
+                });
+            }
+
+            String defaultKeyStorePassword = props.get("keyStorePasswd");
+            char[] passwd = null;
+            if (defaultKeyStorePassword.length() != 0) {
+                passwd = defaultKeyStorePassword.toCharArray();
+            }
+
+            /**
+             * Try to initialize key store.
+             */
+            KeyStore ks = null;
+            if ((defaultKeyStoreType.length()) != 0) {
+                if (debug != null && Debug.isOn("defaultctx")) {
+                    System.out.println("init keystore");
+                }
+                if (defaultKeyStoreProvider.length() == 0) {
+                    ks = KeyStore.getInstance(defaultKeyStoreType);
+                } else {
+                    ks = KeyStore.getInstance(defaultKeyStoreType,
+                                        defaultKeyStoreProvider);
+                }
+
+                // if defaultKeyStore is NONE, fs will be null
+                ks.load(fs, passwd);
+            }
+            if (fs != null) {
+                fs.close();
+                fs = null;
+            }
+
+            /*
+             * Try to initialize key manager.
+             */
+            if (debug != null && Debug.isOn("defaultctx")) {
+                System.out.println("init keymanager of type " +
+                    KeyManagerFactory.getDefaultAlgorithm());
+            }
+            KeyManagerFactory kmf = KeyManagerFactory.getInstance(
+                KeyManagerFactory.getDefaultAlgorithm());
+
+            if (P11KEYSTORE.equals(defaultKeyStoreType)) {
+                kmf.init(ks, null); // do not pass key passwd if using token
+            } else {
+                kmf.init(ks, passwd);
+            }
+
+            defaultKeyManagers = kmf.getKeyManagers();
+            return defaultKeyManagers;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for TLS, SSL, SSLv3 and TLS10 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS10Context extends ConservativeSSLContext {
+        // use the default constructor and methods
+    }
+
+    /*
+     * The SSLContext implementation for TLS11 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS11Context extends SSLContextImpl {
+        // parameters
+        private static SSLParameters defaultServerSSLParams;
+        private static SSLParameters defaultClientSSLParams;
+        private static SSLParameters supportedSSLParams;
+
+        static {
+            if (SunJSSE.isFIPS()) {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name
+                });
+
+            } else {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL20Hello.name,
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name
+                });
+            }
+        }
+
+        SSLParameters getDefaultServerSSLParams() {
+            return defaultServerSSLParams;
+        }
+
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+
+        SSLParameters getSupportedSSLParams() {
+            return supportedSSLParams;
+        }
+    }
+
+    /*
+     * The SSLContext implementation for TLS12 algorithm
+     *
+     * @see SSLContext
+     */
+    public static final class TLS12Context extends SSLContextImpl {
+        // parameters
+        private static SSLParameters defaultServerSSLParams;
+        private static SSLParameters defaultClientSSLParams;
+        private static SSLParameters supportedSSLParams;
+
+        static {
+            if (SunJSSE.isFIPS()) {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+            } else {
+                supportedSSLParams = new SSLParameters();
+                supportedSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL20Hello.name,
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+
+                defaultServerSSLParams = supportedSSLParams;
+
+                defaultClientSSLParams = new SSLParameters();
+                defaultClientSSLParams.setProtocols(new String[] {
+                    ProtocolVersion.SSL30.name,
+                    ProtocolVersion.TLS10.name,
+                    ProtocolVersion.TLS11.name,
+                    ProtocolVersion.TLS12.name
+                });
+            }
+        }
+
+        SSLParameters getDefaultServerSSLParams() {
+            return defaultServerSSLParams;
+        }
+
+        SSLParameters getDefaultClientSSLParams() {
+            return defaultClientSSLParams;
+        }
+
+        SSLParameters getSupportedSSLParams() {
+            return supportedSSLParams;
+        }
+    }
+
 }
 
 
--- a/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -374,8 +374,10 @@
         clientVerifyData = new byte[0];
         serverVerifyData = new byte[0];
 
-        enabledCipherSuites = CipherSuiteList.getDefault();
-        enabledProtocols = ProtocolList.getDefault(roleIsServer);
+        enabledCipherSuites =
+                sslContext.getDefaultCipherSuiteList(roleIsServer);
+        enabledProtocols =
+                sslContext.getDefaultProtocolList(roleIsServer);
 
         wrapLock = new Object();
         unwrapLock = new Object();
@@ -1883,8 +1885,8 @@
              * change them to the corresponding default ones.
              */
             if (roleIsServer != (!flag) &&
-                    ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-                enabledProtocols = ProtocolList.getDefault(!flag);
+                    sslContext.isDefaultProtocolList(enabledProtocols)) {
+                enabledProtocols = sslContext.getDefaultProtocolList(!flag);
             }
 
             roleIsServer = !flag;
@@ -1907,8 +1909,8 @@
                  * change them to the corresponding default ones.
                  */
                 if (roleIsServer != (!flag) &&
-                        ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-                    enabledProtocols = ProtocolList.getDefault(!flag);
+                        sslContext.isDefaultProtocolList(enabledProtocols)) {
+                    enabledProtocols = sslContext.getDefaultProtocolList(!flag);
                 }
 
                 roleIsServer = !flag;
@@ -1951,8 +1953,7 @@
      * @return an array of cipher suite names
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return sslContext.getSuportedCipherSuiteList().toStringArray();
     }
 
     /**
@@ -1992,7 +1993,7 @@
      * @return an array of protocol names.
      */
     public String[] getSupportedProtocols() {
-        return ProtocolList.getSupported().toStringArray();
+        return sslContext.getSuportedProtocolList().toStringArray();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/ssl/SSLServerSocketFactoryImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLServerSocketFactoryImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -49,7 +49,7 @@
      * java.security file is set.
      */
     public SSLServerSocketFactoryImpl() throws Exception {
-        this.context = DefaultSSLContextImpl.getDefaultImpl();
+        this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl();
     }
 
     /**
@@ -99,8 +99,7 @@
      * is encrypted to provide confidentiality.
      */
     public String[] getDefaultCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getDefault().toStringArray();
+        return context.getDefaultCipherSuiteList(true).toStringArray();
     }
 
     /**
@@ -114,8 +113,7 @@
      * @return an array of cipher suite names
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return context.getSuportedCipherSuiteList().toStringArray();
     }
 
 }
--- a/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -153,8 +153,8 @@
             throw new SSLException("No Authentication context given");
         }
         sslContext = context;
-        enabledCipherSuites = CipherSuiteList.getDefault();
-        enabledProtocols = ProtocolList.getDefault(true);
+        enabledCipherSuites = sslContext.getDefaultCipherSuiteList(true);
+        enabledProtocols = sslContext.getDefaultProtocolList(true);
     }
 
     /**
@@ -168,8 +168,7 @@
      * @return an array of cipher suite names
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return sslContext.getSuportedCipherSuiteList().toStringArray();
     }
 
     /**
@@ -194,7 +193,7 @@
     }
 
     public String[] getSupportedProtocols() {
-        return ProtocolList.getSupported().toStringArray();
+        return sslContext.getSuportedProtocolList().toStringArray();
     }
 
     /**
@@ -253,8 +252,8 @@
          * change them to the corresponding default ones.
          */
         if (useServerMode != (!flag) &&
-                ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-            enabledProtocols = ProtocolList.getDefault(!flag);
+                sslContext.isDefaultProtocolList(enabledProtocols)) {
+            enabledProtocols = sslContext.getDefaultProtocolList(!flag);
         }
 
         useServerMode = !flag;
--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -42,20 +42,18 @@
  *
  * @author David Brownell
  */
-final
-public class SSLSocketFactoryImpl extends SSLSocketFactory
-{
+final public class SSLSocketFactoryImpl extends SSLSocketFactory {
+
     private static SSLContextImpl defaultContext;
     private SSLContextImpl context;
 
-
     /**
      * Constructor used to instantiate the default factory. This method is
      * only called if the old "ssl.SocketFactory.provider" property in the
      * java.security file is set.
      */
     public SSLSocketFactoryImpl() throws Exception {
-        this.context = DefaultSSLContextImpl.getDefaultImpl();
+        this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl();
     }
 
     /**
@@ -167,11 +165,9 @@
      * is encrypted to provide confidentiality.
      */
     public String[] getDefaultCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getDefault().toStringArray();
+        return context.getDefaultCipherSuiteList(false).toStringArray();
     }
 
-
     /**
      * Returns the names of the cipher suites which could be enabled for use
      * on an SSL connection.  Normally, only a subset of these will actually
@@ -181,7 +177,6 @@
      * certain kinds of certificates to use certain cipher suites.
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return context.getSuportedCipherSuiteList().toStringArray();
     }
 }
--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -562,8 +562,11 @@
         clientVerifyData = new byte[0];
         serverVerifyData = new byte[0];
 
-        enabledCipherSuites = CipherSuiteList.getDefault();
-        enabledProtocols = ProtocolList.getDefault(roleIsServer);
+        enabledCipherSuites =
+                sslContext.getDefaultCipherSuiteList(roleIsServer);
+        enabledProtocols =
+                sslContext.getDefaultProtocolList(roleIsServer);
+
         inrec = null;
 
         // save the acc
@@ -2170,8 +2173,8 @@
              * change them to the corresponding default ones.
              */
             if (roleIsServer != (!flag) &&
-                    ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-                enabledProtocols = ProtocolList.getDefault(!flag);
+                    sslContext.isDefaultProtocolList(enabledProtocols)) {
+                enabledProtocols = sslContext.getDefaultProtocolList(!flag);
             }
             roleIsServer = !flag;
             break;
@@ -2192,8 +2195,8 @@
                  * change them to the corresponding default ones.
                  */
                 if (roleIsServer != (!flag) &&
-                        ProtocolList.isDefaultProtocolList(enabledProtocols)) {
-                    enabledProtocols = ProtocolList.getDefault(!flag);
+                        sslContext.isDefaultProtocolList(enabledProtocols)) {
+                    enabledProtocols = sslContext.getDefaultProtocolList(!flag);
                 }
                 roleIsServer = !flag;
                 connectionState = cs_START;
@@ -2230,8 +2233,7 @@
      * @return an array of cipher suite names
      */
     public String[] getSupportedCipherSuites() {
-        CipherSuiteList.clearAvailableCache();
-        return CipherSuiteList.getSupported().toStringArray();
+        return sslContext.getSuportedCipherSuiteList().toStringArray();
     }
 
     /**
@@ -2271,7 +2273,7 @@
      * @return an array of protocol names.
      */
     public String[] getSupportedProtocols() {
-        return ProtocolList.getSupported().toStringArray();
+        return sslContext.getSuportedProtocolList().toStringArray();
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Tue Apr 26 15:48:03 2011 -0700
@@ -204,22 +204,21 @@
         put("Alg.Alias.TrustManagerFactory.SunPKIX", "PKIX");
         put("Alg.Alias.TrustManagerFactory.X509", "PKIX");
         put("Alg.Alias.TrustManagerFactory.X.509", "PKIX");
+
+        put("SSLContext.TLSv1",
+            "sun.security.ssl.SSLContextImpl$TLS10Context");
+        put("Alg.Alias.SSLContext.TLS", "TLSv1");
         if (isfips == false) {
-            put("SSLContext.SSL",
-                "sun.security.ssl.SSLContextImpl");
-            put("SSLContext.SSLv3",
-                "sun.security.ssl.SSLContextImpl");
+            put("Alg.Alias.SSLContext.SSL", "TLSv1");
+            put("Alg.Alias.SSLContext.SSLv3", "TLSv1");
         }
-        put("SSLContext.TLS",
-            "sun.security.ssl.SSLContextImpl");
-        put("SSLContext.TLSv1",
-            "sun.security.ssl.SSLContextImpl");
+
         put("SSLContext.TLSv1.1",
-            "sun.security.ssl.SSLContextImpl");
+            "sun.security.ssl.SSLContextImpl$TLS11Context");
         put("SSLContext.TLSv1.2",
-            "sun.security.ssl.SSLContextImpl");
+            "sun.security.ssl.SSLContextImpl$TLS12Context");
         put("SSLContext.Default",
-            "sun.security.ssl.DefaultSSLContextImpl");
+            "sun.security.ssl.SSLContextImpl$DefaultSSLContext");
 
         /*
          * KeyStore
--- a/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/ManifestEntryVerifier.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -191,8 +191,8 @@
      *
      *
      */
-    public CodeSigner[] verify(Hashtable<String, CodeSigner[]> verifiedSigners,
-                Hashtable<String, CodeSigner[]> sigFileSigners)
+    public CodeSigner[] verify(Map<String, CodeSigner[]> verifiedSigners,
+                Map<String, CodeSigner[]> sigFileSigners)
         throws JarException
     {
         if (skip) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/util/SignatureFileManifest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,251 @@
+/*
+ * 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 sun.security.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+/**
+ * This class provides streaming mode reading of manifest files.
+ * Used by {@link SignatureFileVerifier}.
+ */
+class SignatureFileManifest extends Manifest {
+
+    /*
+     * Reading a manifest into this object by calling update(byte[]) on chunks.
+     * During the reading, the bytes are saved in (@code current} until a line
+     * is complete and the key-value pair is saved in {@code currentAttr}. When
+     * a section is complete, {@code consumeAttr} is called to merge
+     * {@code currentAttr} into main attributes or a named entry.
+     */
+
+    // Internal state during update() style reading
+    // 0. not in update mode
+    // 1, in update mode but main attributes not completed yet
+    // 2. main attributes completed, still reading the entries
+    private int state = 0;
+
+    // The partial line read
+    private byte[] current;
+
+    // Number of bytes in current
+    private int currentPos = 0;
+
+    // The current Attribute
+    private Attributes currentAttr;
+
+    /**
+     * Reads a manifest in chunks.
+     * <p>
+     * This method must be called in a row, reading chunks from a single
+     * manifest file by order. After all chunks are read, caller must call
+     * {@code update(null)} to fully consume the manifest.
+     * <p>
+     * The entry names and attributes read will be merged in with the current
+     * manifest entries. The {@link #read} method cannot be called inside a
+     * row of update calls.
+     * <p>
+     * Along with the calls, caller can call {@link #getMainAttributes()},
+     * {@link #getAttributes(java.lang.String)} or {@link #getEntries()}
+     * to get already available contents. However, in order not to return
+     * partial result, when the main attributes in the new manifest is not
+     * consumed completely, {@link #getMainAttributes()} throws an
+     * {@code IllegalStateException}. When a certain named entry is not
+     * consumed completely, {@link #getAttributes(java.lang.String)}
+     * returns the old {@code Attributes} for the name (if it exists).
+     *
+     * @param data null for last call, otherwise, feeding chunks
+     * @param offset offset into data to begin read
+     * @param length length of data after offset to read
+     * @exception IOException if an I/O error has occurred
+     * @exception IllegalStateException if {@code update(null)} is called
+     * without any previous {@code update(non-null)} call
+     */
+    public void update(byte[] data, int offset, int length) throws IOException {
+
+        // The last call
+        if (data == null) {
+            if (state == 0) {
+                throw new IllegalStateException("No data to update");
+            }
+            // We accept manifest not ended with \n or \n\n
+            if (hasLastByte()) {
+                consumeCurrent();
+            }
+            // We accept empty lines at the end
+            if (!currentAttr.isEmpty()) {
+                consumeAttr();
+            }
+            state = 0;  // back to non-update state
+            current = null;
+            currentAttr = null;
+            return;
+        }
+
+        // The first call
+        if (state == 0) {
+            current = new byte[1024];
+            currentAttr = super.getMainAttributes(); // the main attribute
+            state = 1;
+        }
+
+        int end = offset + length;
+
+        while (offset < end) {
+            switch (data[offset]) {
+                case '\r':
+                    break;  // always skip
+                case '\n':
+                    if (hasLastByte() && lastByte() == '\n') {  // new section
+                        consumeCurrent();
+                        consumeAttr();
+                        if (state == 1) {
+                            state = 2;
+                        }
+                        currentAttr = new Attributes(2);
+                    } else {
+                        if (hasLastByte()) {
+                            // save \n into current but do not parse,
+                            // there might be a continuation later
+                            ensureCapacity();
+                            current[currentPos++] = data[offset];
+                        } else if (state == 1) {
+                            // there can be multiple empty lines between
+                            // sections, but cannot be at the beginning
+                            throw new IOException("invalid manifest format");
+                        }
+                    }
+                    break;
+                case ' ':
+                    if (!hasLastByte()) {
+                        throw new IOException("invalid manifest format");
+                    } else if (lastByte() == '\n') {
+                        currentPos--;   // continuation, remove last \n
+                    } else {    // a very normal ' '
+                        ensureCapacity();
+                        current[currentPos++] = data[offset];
+                    }
+                    break;
+                default:
+                    if (hasLastByte() && lastByte() == '\n') {
+                        // The start of a new pair, not continuation
+                        consumeCurrent();   // the last line read
+                    }
+                    ensureCapacity();
+                    current[currentPos++] = data[offset];
+                    break;
+            }
+            offset++;
+        }
+    }
+
+    /**
+     * Returns the main Attributes for the Manifest.
+     * @exception IllegalStateException the main attributes is being read
+     * @return the main Attributes for the Manifest
+     */
+    public Attributes getMainAttributes() {
+        if (state == 1) {
+            throw new IllegalStateException();
+        }
+        return super.getMainAttributes();
+    }
+
+    /**
+     * Reads the Manifest from the specified InputStream. The entry
+     * names and attributes read will be merged in with the current
+     * manifest entries.
+     *
+     * @param is the input stream
+     * @exception IOException if an I/O error has occurred
+     * @exception IllegalStateException if called between two {@link #update}
+     * calls
+     */
+    public void read(InputStream is) throws IOException {
+        if (state != 0) {
+            throw new IllegalStateException("Cannot call read between updates");
+        }
+        super.read(is);
+    }
+
+    /*
+     * ----------  Helper methods  -----------------
+     */
+
+    private void ensureCapacity() {
+        if (currentPos >= current.length-1) {
+            current = Arrays.copyOf(current, current.length*2);
+        }
+    }
+
+    private boolean hasLastByte() {
+        return currentPos > 0;
+    }
+
+    private byte lastByte() {
+        return current[currentPos-1];
+    }
+
+    // Parse current as key:value and save into currentAttr.
+    // There MUST be something inside current.
+    private void consumeCurrent() throws IOException {
+        // current normally has a \n end, except for the last line
+        if (current[currentPos-1] == '\n') currentPos--;
+        for (int i=0; i<currentPos; i++) {
+            if (current[i] == ':') {
+                String key = new String(current, 0, 0, i);
+                i++;
+                while (i < currentPos && current[i] == ' ') { i++; }
+                String value = new String(current, i, currentPos-i, "UTF-8");
+                currentAttr.putValue(key, value);
+                currentPos = 0;
+                return;
+            }
+        }
+        throw new IOException("invalid header field");
+    }
+
+    // Merge currentAttr into Manifest
+    private void consumeAttr() throws IOException {
+        // Only needed for named entries. For the main attribute, key/value
+        // is added into attr directly, but since getMainAttributes() throws
+        // an exception, the partial data is not leaked.
+        if (state != 1) {
+            String name = currentAttr.getValue("Name");
+            if (name != null) {
+                currentAttr.remove(new Attributes.Name("Name"));
+                Attributes old = getAttributes(name);
+                if (old != null) old.putAll(currentAttr);
+                else getEntries().put(name, currentAttr);
+            } else {
+                throw new IOException("invalid manifest format");
+            }
+        }
+    }
+}
--- a/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java	Tue Apr 26 15:48:03 2011 -0700
@@ -55,8 +55,8 @@
     /** the PKCS7 block for this .DSA/.RSA/.EC file */
     private PKCS7 block;
 
-    /** the raw bytes of the .SF file */
-    private byte sfBytes[];
+    // the content of the raw .SF file as an InputStream
+    private InputStream sfStream;
 
     /** the name of the signature block file, uppercased and without
      *  the extension (.DSA/.RSA/.EC)
@@ -66,6 +66,9 @@
     /** the ManifestDigester */
     private ManifestDigester md;
 
+    /** The MANIFEST.MF */
+    private Manifest man;
+
     /** cache of created MessageDigest objects */
     private HashMap<String, MessageDigest> createdDigests;
 
@@ -83,6 +86,7 @@
      * @param rawBytes the raw bytes of the signature block file
      */
     public SignatureFileVerifier(ArrayList<CodeSigner[]> signerCache,
+                                 Manifest man,
                                  ManifestDigester md,
                                  String name,
                                  byte rawBytes[])
@@ -94,13 +98,18 @@
         try {
             obj = Providers.startJarVerification();
             block = new PKCS7(rawBytes);
-            sfBytes = block.getContentInfo().getData();
+            byte[] contentData = block.getContentInfo().getData();
+            if (contentData != null) {
+                sfStream = new ByteArrayInputStream(contentData);
+            }
             certificateFactory = CertificateFactory.getInstance("X509");
         } finally {
             Providers.stopJarVerification(obj);
         }
         this.name = name.substring(0, name.lastIndexOf("."))
                                                    .toUpperCase(Locale.ENGLISH);
+
+        this.man = man;
         this.md = md;
         this.signerCache = signerCache;
     }
@@ -108,31 +117,13 @@
     /**
      * returns true if we need the .SF file
      */
-    public boolean needSignatureFileBytes()
+    public boolean needSignatureFile()
     {
-
-        return sfBytes == null;
+        return sfStream == null;
     }
 
-
-    /**
-     * returns true if we need this .SF file.
-     *
-     * @param name the name of the .SF file without the extension
-     *
-     */
-    public boolean needSignatureFile(String name)
-    {
-        return this.name.equalsIgnoreCase(name);
-    }
-
-    /**
-     * used to set the raw bytes of the .SF file when it
-     * is external to the signature block file.
-     */
-    public void setSignatureFile(byte sfBytes[])
-    {
-        this.sfBytes = sfBytes;
+    public void setSignatureFile(InputStream ins) {
+        this.sfStream = ins;
     }
 
     /**
@@ -145,12 +136,18 @@
      *          Signature File or PKCS7 block file name
      */
     public static boolean isBlockOrSF(String s) {
-        // we currently only support DSA and RSA PKCS7 blocks
-        if (s.endsWith(".SF") || s.endsWith(".DSA") ||
-                s.endsWith(".RSA") || s.endsWith(".EC")) {
-            return true;
-        }
-        return false;
+        return s.endsWith(".SF") || isBlock(s);
+    }
+
+    /**
+     * Utility method used by JarVerifier to determine PKCS7 block
+     * files names that are supported
+     *
+     * @param s file name
+     * @return true if the input file name is a PKCS7 block file name
+     */
+    public static boolean isBlock(String s) {
+        return s.endsWith(".DSA") || s.endsWith(".RSA") || s.endsWith(".EC");
     }
 
     /** get digest from cache */
@@ -180,7 +177,7 @@
      *
      *
      */
-    public void process(Hashtable<String, CodeSigner[]> signers,
+    public void process(Map<String, CodeSigner[]> signers,
             List manifestDigests)
         throws IOException, SignatureException, NoSuchAlgorithmException,
             JarException, CertificateException
@@ -197,31 +194,86 @@
 
     }
 
-    private void processImpl(Hashtable<String, CodeSigner[]> signers,
+    private void processImpl(Map<String, CodeSigner[]> signers,
             List manifestDigests)
         throws IOException, SignatureException, NoSuchAlgorithmException,
             JarException, CertificateException
     {
-        Manifest sf = new Manifest();
-        sf.read(new ByteArrayInputStream(sfBytes));
+        SignatureFileManifest sf = new SignatureFileManifest();
+        InputStream ins = sfStream;
 
-        String version =
-            sf.getMainAttributes().getValue(Attributes.Name.SIGNATURE_VERSION);
+        byte[] buffer = new byte[4096];
+        int sLen = block.getSignerInfos().length;
+        boolean mainOK = false;         // main attributes of SF is available...
+        boolean manifestSigned = false; // and it matches MANIFEST.MF
+        BASE64Decoder decoder = new BASE64Decoder();
 
-        if ((version == null) || !(version.equalsIgnoreCase("1.0"))) {
-            // XXX: should this be an exception?
-            // for now we just ignore this signature file
-            return;
+        PKCS7.PKCS7Verifier[] pvs = new PKCS7.PKCS7Verifier[sLen];
+        for (int i=0; i<sLen; i++) {
+            pvs[i] = PKCS7.PKCS7Verifier.from(block, block.getSignerInfos()[i]);
         }
 
-        SignerInfo[] infos = block.verify(sfBytes);
+        /*
+         * Verify SF in streaming mode. The chunks of the file are fed into
+         * the Manifest object sf and all PKCS7Verifiers. As soon as the main
+         * attributes is available, we'll check if manifestSigned is true. If
+         * yes, there is no need to fill in sf's entries field, since it should
+         * be identical to entries in man.
+         */
+        while (true) {
+            int len = ins.read(buffer);
+            if (len < 0) {
+                if (!manifestSigned) {
+                    sf.update(null, 0, 0);
+                }
+                break;
+            } else {
+                for (int i=0; i<sLen; i++) {
+                    if (pvs[i] != null) pvs[i].update(buffer, 0, len);
+                }
+                // Continue reading if verifyManifestHash fails (or, the
+                // main attributes is not available yet)
+                if (!manifestSigned) {
+                    sf.update(buffer, 0, len);
+                    if (!mainOK) {
+                        try {
+                            Attributes attr = sf.getMainAttributes();
+                            String version = attr.getValue(
+                                    Attributes.Name.SIGNATURE_VERSION);
 
-        if (infos == null) {
+                            if ((version == null) ||
+                                    !(version.equalsIgnoreCase("1.0"))) {
+                                // XXX: should this be an exception?
+                                // for now we just ignore this signature file
+                                return;
+                            }
+
+                            mainOK = true;
+                            manifestSigned = verifyManifestHash(
+                                    sf, md, decoder, manifestDigests);
+                        } catch (IllegalStateException ise) {
+                            // main attributes not available yet
+                        }
+                    }
+                }
+            }
+        }
+        List<SignerInfo> intResult = new ArrayList<>(sLen);
+        for (int i = 0; i < sLen; i++) {
+            if (pvs[i] != null) {
+                SignerInfo signerInfo = pvs[i].verify();
+                if (signerInfo != null) {
+                    intResult.add(signerInfo);
+                }
+            }
+        }
+        if (intResult.isEmpty()) {
             throw new SecurityException("cannot verify signature block file " +
                                         name);
         }
 
-        BASE64Decoder decoder = new BASE64Decoder();
+        SignerInfo[] infos =
+                intResult.toArray(new SignerInfo[intResult.size()]);
 
         CodeSigner[] newSigners = getSigners(infos, block);
 
@@ -229,26 +281,37 @@
         if (newSigners == null)
             return;
 
-        Iterator<Map.Entry<String,Attributes>> entries =
-                                sf.getEntries().entrySet().iterator();
-
-        // see if we can verify the whole manifest first
-        boolean manifestSigned = verifyManifestHash(sf, md, decoder, manifestDigests);
-
         // verify manifest main attributes
         if (!manifestSigned && !verifyManifestMainAttrs(sf, md, decoder)) {
             throw new SecurityException
                 ("Invalid signature file digest for Manifest main attributes");
         }
 
-        // go through each section in the signature file
+        Iterator<Map.Entry<String,Attributes>> entries;
+
+        if (manifestSigned) {
+            if (debug != null) {
+                debug.println("full manifest signature match, "
+                        + "update signer info from MANIFEST.MF");
+            }
+            entries = man.getEntries().entrySet().iterator();
+        } else {
+            if (debug != null) {
+                debug.println("full manifest signature unmatch, "
+                        + "update signer info from SF file");
+            }
+            entries = sf.getEntries().entrySet().iterator();
+        }
+
+        // go through each section
+
         while(entries.hasNext()) {
 
             Map.Entry<String,Attributes> e = entries.next();
             String name = e.getKey();
 
             if (manifestSigned ||
-                (verifySection(e.getValue(), name, md, decoder))) {
+                    (verifySection(e.getValue(), name, md, decoder))) {
 
                 if (name.startsWith("./"))
                     name = name.substring(2);
@@ -593,7 +656,6 @@
         if (set == subset)
             return true;
 
-        boolean match;
         for (int i = 0; i < subset.length; i++) {
             if (!contains(set, subset[i]))
                 return false;
@@ -613,8 +675,6 @@
         if ((oldSigners == null) && (signers == newSigners))
             return true;
 
-        boolean match;
-
         // make sure all oldSigners are in signers
         if ((oldSigners != null) && !isSubSet(oldSigners, signers))
             return false;
@@ -638,7 +698,7 @@
     }
 
     void updateSigners(CodeSigner[] newSigners,
-        Hashtable<String, CodeSigner[]> signers, String name) {
+        Map<String, CodeSigner[]> signers, String name) {
 
         CodeSigner[] oldSigners = signers.get(name);
 
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Tue Apr 26 15:48:03 2011 -0700
@@ -270,11 +270,10 @@
      */
     public static int getLeftSideBearing(JComponent c, FontMetrics fm,
                                          String string) {
-        int res = 0;
-        if (!string.isEmpty()) {
-            res = getLeftSideBearing(c, fm, string.charAt(0));
+        if ((string == null) || (string.length() == 0)) {
+            return 0;
         }
-        return res;
+        return getLeftSideBearing(c, fm, string.charAt(0));
     }
 
     /**
--- a/jdk/src/share/classes/sun/util/locale/BaseLocale.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/BaseLocale.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -38,38 +38,46 @@
     public static final String SEP = "_";
 
     private static final Cache CACHE = new Cache();
-    public static final BaseLocale ROOT = BaseLocale.getInstance("", "", "", "");
+
+    private final String language;
+    private final String script;
+    private final String region;
+    private final String variant;
+
+    private volatile int hash = 0;
 
-    private String _language = "";
-    private String _script = "";
-    private String _region = "";
-    private String _variant = "";
-
-    private transient volatile int _hash = 0;
+    // This method must be called only when creating the Locale.* constants.
+    private BaseLocale(String language, String region) {
+        this.language = language;
+        this.script = "";
+        this.region = region;
+        this.variant = "";
+    }
 
     private BaseLocale(String language, String script, String region, String variant) {
-        if (language != null) {
-            _language = AsciiUtil.toLowerString(language).intern();
-        }
-        if (script != null) {
-            _script = AsciiUtil.toTitleString(script).intern();
-        }
-        if (region != null) {
-            _region = AsciiUtil.toUpperString(region).intern();
-        }
-        if (variant != null) {
-            _variant = variant.intern();
-        }
+        this.language = (language != null) ? LocaleUtils.toLowerString(language).intern() : "";
+        this.script = (script != null) ? LocaleUtils.toTitleString(script).intern() : "";
+        this.region = (region != null) ? LocaleUtils.toUpperString(region).intern() : "";
+        this.variant = (variant != null) ? variant.intern() : "";
     }
 
-    public static BaseLocale getInstance(String language, String script, String region, String variant) {
+    // Called for creating the Locale.* constants. No argument
+    // validation is performed.
+    public static BaseLocale createInstance(String language, String region) {
+        BaseLocale base = new BaseLocale(language, region);
+        CACHE.put(new Key(language, region), base);
+        return base;
+    }
+
+    public static BaseLocale getInstance(String language, String script,
+                                         String region, String variant) {
         // JDK uses deprecated ISO639.1 language codes for he, yi and id
         if (language != null) {
-            if (AsciiUtil.caseIgnoreMatch(language, "he")) {
+            if (LocaleUtils.caseIgnoreMatch(language, "he")) {
                 language = "iw";
-            } else if (AsciiUtil.caseIgnoreMatch(language, "yi")) {
+            } else if (LocaleUtils.caseIgnoreMatch(language, "yi")) {
                 language = "ji";
-            } else if (AsciiUtil.caseIgnoreMatch(language, "id")) {
+            } else if (LocaleUtils.caseIgnoreMatch(language, "id")) {
                 language = "in";
             }
         }
@@ -80,21 +88,22 @@
     }
 
     public String getLanguage() {
-        return _language;
+        return language;
     }
 
     public String getScript() {
-        return _script;
+        return script;
     }
 
     public String getRegion() {
-        return _region;
+        return region;
     }
 
     public String getVariant() {
-        return _variant;
+        return variant;
     }
 
+    @Override
     public boolean equals(Object obj) {
         if (this == obj) {
             return true;
@@ -103,138 +112,178 @@
             return false;
         }
         BaseLocale other = (BaseLocale)obj;
-        return hashCode() == other.hashCode()
-                && _language.equals(other._language)
-                && _script.equals(other._script)
-                && _region.equals(other._region)
-                && _variant.equals(other._variant);
+        return language == other.language
+               && script == other.script
+               && region == other.region
+               && variant == other.variant;
     }
 
+    @Override
     public String toString() {
         StringBuilder buf = new StringBuilder();
-        if (_language.length() > 0) {
+        if (language.length() > 0) {
             buf.append("language=");
-            buf.append(_language);
+            buf.append(language);
         }
-        if (_script.length() > 0) {
+        if (script.length() > 0) {
             if (buf.length() > 0) {
                 buf.append(", ");
             }
             buf.append("script=");
-            buf.append(_script);
+            buf.append(script);
         }
-        if (_region.length() > 0) {
+        if (region.length() > 0) {
             if (buf.length() > 0) {
                 buf.append(", ");
             }
             buf.append("region=");
-            buf.append(_region);
+            buf.append(region);
         }
-        if (_variant.length() > 0) {
+        if (variant.length() > 0) {
             if (buf.length() > 0) {
                 buf.append(", ");
             }
             buf.append("variant=");
-            buf.append(_variant);
+            buf.append(variant);
         }
         return buf.toString();
     }
 
+    @Override
     public int hashCode() {
-        int h = _hash;
+        int h = hash;
         if (h == 0) {
             // Generating a hash value from language, script, region and variant
-            for (int i = 0; i < _language.length(); i++) {
-                h = 31*h + _language.charAt(i);
-            }
-            for (int i = 0; i < _script.length(); i++) {
-                h = 31*h + _script.charAt(i);
-            }
-            for (int i = 0; i < _region.length(); i++) {
-                h = 31*h + _region.charAt(i);
-            }
-            for (int i = 0; i < _variant.length(); i++) {
-                h = 31*h + _variant.charAt(i);
-            }
-            _hash = h;
+            h = language.hashCode();
+            h = 31 * h + script.hashCode();
+            h = 31 * h + region.hashCode();
+            h = 31 * h + variant.hashCode();
+            hash = h;
         }
         return h;
     }
 
-    private static class Key implements Comparable<Key> {
-        private String _lang = "";
-        private String _scrt = "";
-        private String _regn = "";
-        private String _vart = "";
+    private static final class Key implements Comparable<Key> {
+        private final String lang;
+        private final String scrt;
+        private final String regn;
+        private final String vart;
+        private final boolean normalized;
+        private final int hash;
+
+        /**
+         * Creates a Key. language and region must be normalized
+         * (intern'ed in the proper case).
+         */
+        private Key(String language, String region) {
+            assert language.intern() == language
+                   && region.intern() == region;
 
-        private volatile int _hash; // Default to 0
+            lang = language;
+            scrt = "";
+            regn = region;
+            vart = "";
+            this.normalized = true;
+
+            int h = language.hashCode();
+            if (region != "") {
+                int len = region.length();
+                for (int i = 0; i < len; i++) {
+                    h = 31 * h + LocaleUtils.toLower(region.charAt(i));
+                }
+            }
+            hash = h;
+        }
 
         public Key(String language, String script, String region, String variant) {
+            this(language, script, region, variant, false);
+        }
+
+        private Key(String language, String script, String region,
+                    String variant, boolean normalized) {
+            int h = 0;
             if (language != null) {
-                _lang = language;
+                lang = language;
+                int len = language.length();
+                for (int i = 0; i < len; i++) {
+                    h = 31*h + LocaleUtils.toLower(language.charAt(i));
+                }
+            } else {
+                lang = "";
             }
             if (script != null) {
-                _scrt = script;
+                scrt = script;
+                int len = script.length();
+                for (int i = 0; i < len; i++) {
+                    h = 31*h + LocaleUtils.toLower(script.charAt(i));
+                }
+            } else {
+                scrt = "";
             }
             if (region != null) {
-                _regn = region;
+                regn = region;
+                int len = region.length();
+                for (int i = 0; i < len; i++) {
+                    h = 31*h + LocaleUtils.toLower(region.charAt(i));
+                }
+            } else {
+                regn = "";
             }
             if (variant != null) {
-                _vart = variant;
+                vart = variant;
+                int len = variant.length();
+                for (int i = 0; i < len; i++) {
+                    h = 31*h + variant.charAt(i);
+                }
+            } else {
+                vart = "";
             }
+            hash = h;
+            this.normalized = normalized;
         }
 
+        @Override
         public boolean equals(Object obj) {
             return (this == obj) ||
                     (obj instanceof Key)
-                    && AsciiUtil.caseIgnoreMatch(((Key)obj)._lang, this._lang)
-                    && AsciiUtil.caseIgnoreMatch(((Key)obj)._scrt, this._scrt)
-                    && AsciiUtil.caseIgnoreMatch(((Key)obj)._regn, this._regn)
-                    && ((Key)obj)._vart.equals(_vart); // variant is case sensitive in JDK!
+                    && this.hash == ((Key)obj).hash
+                    && LocaleUtils.caseIgnoreMatch(((Key)obj).lang, this.lang)
+                    && LocaleUtils.caseIgnoreMatch(((Key)obj).scrt, this.scrt)
+                    && LocaleUtils.caseIgnoreMatch(((Key)obj).regn, this.regn)
+                    && ((Key)obj).vart.equals(vart); // variant is case sensitive in JDK!
         }
 
+        @Override
         public int compareTo(Key other) {
-            int res = AsciiUtil.caseIgnoreCompare(this._lang, other._lang);
+            int res = LocaleUtils.caseIgnoreCompare(this.lang, other.lang);
             if (res == 0) {
-                res = AsciiUtil.caseIgnoreCompare(this._scrt, other._scrt);
+                res = LocaleUtils.caseIgnoreCompare(this.scrt, other.scrt);
                 if (res == 0) {
-                    res = AsciiUtil.caseIgnoreCompare(this._regn, other._regn);
+                    res = LocaleUtils.caseIgnoreCompare(this.regn, other.regn);
                     if (res == 0) {
-                        res = this._vart.compareTo(other._vart);
+                        res = this.vart.compareTo(other.vart);
                     }
                 }
             }
             return res;
         }
 
+        @Override
         public int hashCode() {
-            int h = _hash;
-            if (h == 0) {
-                // Generating a hash value from language, script, region and variant
-                for (int i = 0; i < _lang.length(); i++) {
-                    h = 31*h + AsciiUtil.toLower(_lang.charAt(i));
-                }
-                for (int i = 0; i < _scrt.length(); i++) {
-                    h = 31*h + AsciiUtil.toLower(_scrt.charAt(i));
-                }
-                for (int i = 0; i < _regn.length(); i++) {
-                    h = 31*h + AsciiUtil.toLower(_regn.charAt(i));
-                }
-                for (int i = 0; i < _vart.length(); i++) {
-                    h = 31*h + _vart.charAt(i);
-                }
-                _hash = h;
-            }
-            return h;
+            return hash;
         }
 
         public static Key normalize(Key key) {
-            String lang = AsciiUtil.toLowerString(key._lang).intern();
-            String scrt = AsciiUtil.toTitleString(key._scrt).intern();
-            String regn = AsciiUtil.toUpperString(key._regn).intern();
-            String vart = key._vart.intern(); // preserve upper/lower cases
+            if (key.normalized) {
+                return key;
+            }
 
-            return new Key(lang, scrt, regn, vart);
+            String lang = LocaleUtils.toLowerString(key.lang).intern();
+            String scrt = LocaleUtils.toTitleString(key.scrt).intern();
+            String regn = LocaleUtils.toUpperString(key.regn).intern();
+            String vart = key.vart.intern(); // preserve upper/lower cases
+
+            return new Key(lang, scrt, regn, vart, true);
         }
     }
 
@@ -243,13 +292,14 @@
         public Cache() {
         }
 
+        @Override
         protected Key normalizeKey(Key key) {
             return Key.normalize(key);
         }
 
+        @Override
         protected BaseLocale createObject(Key key) {
-            return new BaseLocale(key._lang, key._scrt, key._regn, key._vart);
+            return new BaseLocale(key.lang, key.scrt, key.regn, key.vart);
         }
-
     }
 }
--- a/jdk/src/share/classes/sun/util/locale/Extension.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/Extension.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -32,29 +32,34 @@
 package sun.util.locale;
 
 
-public class Extension {
-    private char _key;
-    protected String _value;
+class Extension {
+    private final char key;
+    private String value, id;
 
     protected Extension(char key) {
-        _key = key;
+        this.key = key;
     }
 
     Extension(char key, String value) {
-        _key = key;
-        _value = value;
+        this.key = key;
+        setValue(value);
+    }
+
+    protected void setValue(String value) {
+        this.value = value;
+        this.id = key + LanguageTag.SEP + value;
     }
 
     public char getKey() {
-        return _key;
+        return key;
     }
 
     public String getValue() {
-        return _value;
+        return value;
     }
 
     public String getID() {
-        return _key + LanguageTag.SEP + _value;
+        return id;
     }
 
     public String toString() {
--- a/jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -35,64 +35,66 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 public final class InternalLocaleBuilder {
 
-    private String _language = "";
-    private String _script = "";
-    private String _region = "";
-    private String _variant = "";
+    private static final CaseInsensitiveChar PRIVATEUSE_KEY
+        = new CaseInsensitiveChar(LanguageTag.PRIVATEUSE);
 
-    private static final CaseInsensitiveChar PRIVUSE_KEY = new CaseInsensitiveChar(LanguageTag.PRIVATEUSE.charAt(0));
+    private String language = "";
+    private String script = "";
+    private String region = "";
+    private String variant = "";
 
-    private HashMap<CaseInsensitiveChar, String> _extensions;
-    private HashSet<CaseInsensitiveString> _uattributes;
-    private HashMap<CaseInsensitiveString, String> _ukeywords;
+    private Map<CaseInsensitiveChar, String> extensions;
+    private Set<CaseInsensitiveString> uattributes;
+    private Map<CaseInsensitiveString, String> ukeywords;
 
 
     public InternalLocaleBuilder() {
     }
 
     public InternalLocaleBuilder setLanguage(String language) throws LocaleSyntaxException {
-        if (language == null || language.length() == 0) {
-            _language = "";
+        if (LocaleUtils.isEmpty(language)) {
+            this.language = "";
         } else {
             if (!LanguageTag.isLanguage(language)) {
                 throw new LocaleSyntaxException("Ill-formed language: " + language, 0);
             }
-            _language = language;
+            this.language = language;
         }
         return this;
     }
 
     public InternalLocaleBuilder setScript(String script) throws LocaleSyntaxException {
-        if (script == null || script.length() == 0) {
-            _script = "";
+        if (LocaleUtils.isEmpty(script)) {
+            this.script = "";
         } else {
             if (!LanguageTag.isScript(script)) {
                 throw new LocaleSyntaxException("Ill-formed script: " + script, 0);
             }
-            _script = script;
+            this.script = script;
         }
         return this;
     }
 
     public InternalLocaleBuilder setRegion(String region) throws LocaleSyntaxException {
-        if (region == null || region.length() == 0) {
-            _region = "";
+        if (LocaleUtils.isEmpty(region)) {
+            this.region = "";
         } else {
             if (!LanguageTag.isRegion(region)) {
                 throw new LocaleSyntaxException("Ill-formed region: " + region, 0);
             }
-            _region = region;
+            this.region = region;
         }
         return this;
     }
 
     public InternalLocaleBuilder setVariant(String variant) throws LocaleSyntaxException {
-        if (variant == null || variant.length() == 0) {
-            _variant = "";
+        if (LocaleUtils.isEmpty(variant)) {
+            this.variant = "";
         } else {
             // normalize separators to "_"
             String var = variant.replaceAll(LanguageTag.SEP, BaseLocale.SEP);
@@ -100,7 +102,7 @@
             if (errIdx != -1) {
                 throw new LocaleSyntaxException("Ill-formed variant: " + variant, errIdx);
             }
-            _variant = var;
+            this.variant = var;
         }
         return this;
     }
@@ -110,10 +112,10 @@
             throw new LocaleSyntaxException("Ill-formed Unicode locale attribute: " + attribute);
         }
         // Use case insensitive string to prevent duplication
-        if (_uattributes == null) {
-            _uattributes = new HashSet<CaseInsensitiveString>(4);
+        if (uattributes == null) {
+            uattributes = new HashSet<>(4);
         }
-        _uattributes.add(new CaseInsensitiveString(attribute));
+        uattributes.add(new CaseInsensitiveString(attribute));
         return this;
     }
 
@@ -121,8 +123,8 @@
         if (attribute == null || !UnicodeLocaleExtension.isAttribute(attribute)) {
             throw new LocaleSyntaxException("Ill-formed Unicode locale attribute: " + attribute);
         }
-        if (_uattributes != null) {
-            _uattributes.remove(new CaseInsensitiveString(attribute));
+        if (uattributes != null) {
+            uattributes.remove(new CaseInsensitiveString(attribute));
         }
         return this;
     }
@@ -134,9 +136,9 @@
 
         CaseInsensitiveString cikey = new CaseInsensitiveString(key);
         if (type == null) {
-            if (_ukeywords != null) {
+            if (ukeywords != null) {
                 // null type is used for remove the key
-                _ukeywords.remove(cikey);
+                ukeywords.remove(cikey);
             }
         } else {
             if (type.length() != 0) {
@@ -147,15 +149,17 @@
                 while (!itr.isDone()) {
                     String s = itr.current();
                     if (!UnicodeLocaleExtension.isTypeSubtag(s)) {
-                        throw new LocaleSyntaxException("Ill-formed Unicode locale keyword type: " + type, itr.currentStart());
+                        throw new LocaleSyntaxException("Ill-formed Unicode locale keyword type: "
+                                                        + type,
+                                                        itr.currentStart());
                     }
                     itr.next();
                 }
             }
-            if (_ukeywords == null) {
-                _ukeywords = new HashMap<CaseInsensitiveString, String>(4);
+            if (ukeywords == null) {
+                ukeywords = new HashMap<>(4);
             }
-            _ukeywords.put(cikey, type);
+            ukeywords.put(cikey, type);
         }
         return this;
     }
@@ -167,21 +171,21 @@
             throw new LocaleSyntaxException("Ill-formed extension key: " + singleton);
         }
 
-        boolean remove = (value == null || value.length() == 0);
+        boolean remove = LocaleUtils.isEmpty(value);
         CaseInsensitiveChar key = new CaseInsensitiveChar(singleton);
 
         if (remove) {
             if (UnicodeLocaleExtension.isSingletonChar(key.value())) {
                 // clear entire Unicode locale extension
-                if (_uattributes != null) {
-                    _uattributes.clear();
+                if (uattributes != null) {
+                    uattributes.clear();
                 }
-                if (_ukeywords != null) {
-                    _ukeywords.clear();
+                if (ukeywords != null) {
+                    ukeywords.clear();
                 }
             } else {
-                if (_extensions != null && _extensions.containsKey(key)) {
-                    _extensions.remove(key);
+                if (extensions != null && extensions.containsKey(key)) {
+                    extensions.remove(key);
                 }
             }
         } else {
@@ -197,7 +201,8 @@
                     validSubtag = LanguageTag.isExtensionSubtag(s);
                 }
                 if (!validSubtag) {
-                    throw new LocaleSyntaxException("Ill-formed extension value: " + s, itr.currentStart());
+                    throw new LocaleSyntaxException("Ill-formed extension value: " + s,
+                                                    itr.currentStart());
                 }
                 itr.next();
             }
@@ -205,10 +210,10 @@
             if (UnicodeLocaleExtension.isSingletonChar(key.value())) {
                 setUnicodeLocaleExtension(val);
             } else {
-                if (_extensions == null) {
-                    _extensions = new HashMap<CaseInsensitiveChar, String>(4);
+                if (extensions == null) {
+                    extensions = new HashMap<>(4);
                 }
-                _extensions.put(key, val);
+                extensions.put(key, val);
             }
         }
         return this;
@@ -218,7 +223,7 @@
      * Set extension/private subtags in a single string representation
      */
     public InternalLocaleBuilder setExtensions(String subtags) throws LocaleSyntaxException {
-        if (subtags == null || subtags.length() == 0) {
+        if (LocaleUtils.isEmpty(subtags)) {
             clearExtensions();
             return this;
         }
@@ -252,11 +257,12 @@
                 }
 
                 if (parsed < start) {
-                    throw new LocaleSyntaxException("Incomplete extension '" + singleton + "'", start);
+                    throw new LocaleSyntaxException("Incomplete extension '" + singleton + "'",
+                                                    start);
                 }
 
                 if (extensions == null) {
-                    extensions = new ArrayList<String>(4);
+                    extensions = new ArrayList<>(4);
                 }
                 extensions.add(sb.toString());
             } else {
@@ -281,7 +287,9 @@
                     itr.next();
                 }
                 if (parsed <= start) {
-                    throw new LocaleSyntaxException("Incomplete privateuse:" + subtags.substring(start), start);
+                    throw new LocaleSyntaxException("Incomplete privateuse:"
+                                                    + subtags.substring(start),
+                                                    start);
                 } else {
                     privateuse = sb.toString();
                 }
@@ -289,7 +297,9 @@
         }
 
         if (!itr.isDone()) {
-            throw new LocaleSyntaxException("Ill-formed extension subtags:" + subtags.substring(itr.currentStart()), itr.currentStart());
+            throw new LocaleSyntaxException("Ill-formed extension subtags:"
+                                            + subtags.substring(itr.currentStart()),
+                                            itr.currentStart());
         }
 
         return setExtensions(extensions, privateuse);
@@ -302,30 +312,31 @@
     private InternalLocaleBuilder setExtensions(List<String> bcpExtensions, String privateuse) {
         clearExtensions();
 
-        if (bcpExtensions != null && bcpExtensions.size() > 0) {
-            HashSet<CaseInsensitiveChar> processedExntensions = new HashSet<CaseInsensitiveChar>(bcpExtensions.size());
+        if (!LocaleUtils.isEmpty(bcpExtensions)) {
+            Set<CaseInsensitiveChar> done = new HashSet<>(bcpExtensions.size());
             for (String bcpExt : bcpExtensions) {
-                CaseInsensitiveChar key = new CaseInsensitiveChar(bcpExt.charAt(0));
+                CaseInsensitiveChar key = new CaseInsensitiveChar(bcpExt);
                 // ignore duplicates
-                if (!processedExntensions.contains(key)) {
+                if (!done.contains(key)) {
                     // each extension string contains singleton, e.g. "a-abc-def"
                     if (UnicodeLocaleExtension.isSingletonChar(key.value())) {
                         setUnicodeLocaleExtension(bcpExt.substring(2));
                     } else {
-                        if (_extensions == null) {
-                            _extensions = new HashMap<CaseInsensitiveChar, String>(4);
+                        if (extensions == null) {
+                            extensions = new HashMap<>(4);
                         }
-                        _extensions.put(key, bcpExt.substring(2));
+                        extensions.put(key, bcpExt.substring(2));
                     }
                 }
+                done.add(key);
             }
         }
         if (privateuse != null && privateuse.length() > 0) {
             // privateuse string contains prefix, e.g. "x-abc-def"
-            if (_extensions == null) {
-                _extensions = new HashMap<CaseInsensitiveChar, String>(1);
+            if (extensions == null) {
+                extensions = new HashMap<>(1);
             }
-            _extensions.put(new CaseInsensitiveChar(privateuse.charAt(0)), privateuse.substring(2));
+            extensions.put(new CaseInsensitiveChar(privateuse), privateuse.substring(2));
         }
 
         return this;
@@ -336,24 +347,25 @@
      */
     public InternalLocaleBuilder setLanguageTag(LanguageTag langtag) {
         clear();
-        if (langtag.getExtlangs().size() > 0) {
-            _language = langtag.getExtlangs().get(0);
+        if (!langtag.getExtlangs().isEmpty()) {
+            language = langtag.getExtlangs().get(0);
         } else {
-            String language = langtag.getLanguage();
-            if (!language.equals(LanguageTag.UNDETERMINED)) {
-                _language = language;
+            String lang = langtag.getLanguage();
+            if (!lang.equals(LanguageTag.UNDETERMINED)) {
+                language = lang;
             }
         }
-        _script = langtag.getScript();
-        _region = langtag.getRegion();
+        script = langtag.getScript();
+        region = langtag.getRegion();
 
         List<String> bcpVariants = langtag.getVariants();
-        if (bcpVariants.size() > 0) {
+        if (!bcpVariants.isEmpty()) {
             StringBuilder var = new StringBuilder(bcpVariants.get(0));
-            for (int i = 1; i < bcpVariants.size(); i++) {
+            int size = bcpVariants.size();
+            for (int i = 1; i < size; i++) {
                 var.append(BaseLocale.SEP).append(bcpVariants.get(i));
             }
-            _variant = var.toString();
+            variant = var.toString();
         }
 
         setExtensions(langtag.getExtensions(), langtag.getPrivateuse());
@@ -361,7 +373,7 @@
         return this;
     }
 
-    public InternalLocaleBuilder setLocale(BaseLocale base, LocaleExtensions extensions) throws LocaleSyntaxException {
+    public InternalLocaleBuilder setLocale(BaseLocale base, LocaleExtensions localeExtensions) throws LocaleSyntaxException {
         String language = base.getLanguage();
         String script = base.getScript();
         String region = base.getRegion();
@@ -373,14 +385,14 @@
         if (language.equals("ja") && region.equals("JP") && variant.equals("JP")) {
             // When locale ja_JP_JP is created, ca-japanese is always there.
             // The builder ignores the variant "JP"
-            assert("japanese".equals(extensions.getUnicodeLocaleType("ca")));
+            assert("japanese".equals(localeExtensions.getUnicodeLocaleType("ca")));
             variant = "";
         }
         // Exception 2 - th_TH_TH
         else if (language.equals("th") && region.equals("TH") && variant.equals("TH")) {
             // When locale th_TH_TH is created, nu-thai is always there.
             // The builder ignores the variant "TH"
-            assert("thai".equals(extensions.getUnicodeLocaleType("nu")));
+            assert("thai".equals(localeExtensions.getUnicodeLocaleType("nu")));
             variant = "";
         }
         // Exception 3 - no_NO_NY
@@ -415,36 +427,36 @@
 
         // The input locale is validated at this point.
         // Now, updating builder's internal fields.
-        _language = language;
-        _script = script;
-        _region = region;
-        _variant = variant;
+        this.language = language;
+        this.script = script;
+        this.region = region;
+        this.variant = variant;
         clearExtensions();
 
-        Set<Character> extKeys = (extensions == null) ? null : extensions.getKeys();
+        Set<Character> extKeys = (localeExtensions == null) ? null : localeExtensions.getKeys();
         if (extKeys != null) {
-            // map extensions back to builder's internal format
+            // map localeExtensions back to builder's internal format
             for (Character key : extKeys) {
-                Extension e = extensions.getExtension(key);
+                Extension e = localeExtensions.getExtension(key);
                 if (e instanceof UnicodeLocaleExtension) {
                     UnicodeLocaleExtension ue = (UnicodeLocaleExtension)e;
                     for (String uatr : ue.getUnicodeLocaleAttributes()) {
-                        if (_uattributes == null) {
-                            _uattributes = new HashSet<CaseInsensitiveString>(4);
+                        if (uattributes == null) {
+                            uattributes = new HashSet<>(4);
                         }
-                        _uattributes.add(new CaseInsensitiveString(uatr));
+                        uattributes.add(new CaseInsensitiveString(uatr));
                     }
                     for (String ukey : ue.getUnicodeLocaleKeys()) {
-                        if (_ukeywords == null) {
-                            _ukeywords = new HashMap<CaseInsensitiveString, String>(4);
+                        if (ukeywords == null) {
+                            ukeywords = new HashMap<>(4);
                         }
-                        _ukeywords.put(new CaseInsensitiveString(ukey), ue.getUnicodeLocaleType(ukey));
+                        ukeywords.put(new CaseInsensitiveString(ukey), ue.getUnicodeLocaleType(ukey));
                     }
                 } else {
-                    if (_extensions == null) {
-                        _extensions = new HashMap<CaseInsensitiveChar, String>(4);
+                    if (extensions == null) {
+                        extensions = new HashMap<>(4);
                     }
-                    _extensions.put(new CaseInsensitiveChar(key.charValue()), e.getValue());
+                    extensions.put(new CaseInsensitiveChar(key), e.getValue());
                 }
             }
         }
@@ -452,37 +464,37 @@
     }
 
     public InternalLocaleBuilder clear() {
-        _language = "";
-        _script = "";
-        _region = "";
-        _variant = "";
+        language = "";
+        script = "";
+        region = "";
+        variant = "";
         clearExtensions();
         return this;
     }
 
     public InternalLocaleBuilder clearExtensions() {
-        if (_extensions != null) {
-            _extensions.clear();
+        if (extensions != null) {
+            extensions.clear();
         }
-        if (_uattributes != null) {
-            _uattributes.clear();
+        if (uattributes != null) {
+            uattributes.clear();
         }
-        if (_ukeywords != null) {
-            _ukeywords.clear();
+        if (ukeywords != null) {
+            ukeywords.clear();
         }
         return this;
     }
 
     public BaseLocale getBaseLocale() {
-        String language = _language;
-        String script = _script;
-        String region = _region;
-        String variant = _variant;
+        String language = this.language;
+        String script = this.script;
+        String region = this.region;
+        String variant = this.variant;
 
         // Special private use subtag sequence identified by "lvariant" will be
         // interpreted as Java variant.
-        if (_extensions != null) {
-            String privuse = _extensions.get(PRIVUSE_KEY);
+        if (extensions != null) {
+            String privuse = extensions.get(PRIVATEUSE_KEY);
             if (privuse != null) {
                 StringTokenIterator itr = new StringTokenIterator(privuse, LanguageTag.SEP);
                 boolean sawPrefix = false;
@@ -492,7 +504,7 @@
                         privVarStart = itr.currentStart();
                         break;
                     }
-                    if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) {
+                    if (LocaleUtils.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) {
                         sawPrefix = true;
                     }
                     itr.next();
@@ -502,7 +514,8 @@
                     if (sb.length() != 0) {
                         sb.append(BaseLocale.SEP);
                     }
-                    sb.append(privuse.substring(privVarStart).replaceAll(LanguageTag.SEP, BaseLocale.SEP));
+                    sb.append(privuse.substring(privVarStart).replaceAll(LanguageTag.SEP,
+                                                                         BaseLocale.SEP));
                     variant = sb.toString();
                 }
             }
@@ -512,13 +525,13 @@
     }
 
     public LocaleExtensions getLocaleExtensions() {
-        if ((_extensions == null || _extensions.size() == 0)
-                && (_uattributes == null || _uattributes.size() == 0)
-                && (_ukeywords == null || _ukeywords.size() == 0)) {
-            return LocaleExtensions.EMPTY_EXTENSIONS;
+        if (LocaleUtils.isEmpty(extensions) && LocaleUtils.isEmpty(uattributes)
+            && LocaleUtils.isEmpty(ukeywords)) {
+            return null;
         }
 
-        return new LocaleExtensions(_extensions, _uattributes, _ukeywords);
+        LocaleExtensions lext = new LocaleExtensions(extensions, uattributes, ukeywords);
+        return lext.isEmpty() ? null : lext;
     }
 
     /*
@@ -540,7 +553,7 @@
                 sawPrivuseVar = true;
                 break;
             }
-            if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) {
+            if (LocaleUtils.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) {
                 prefixStart = itr.currentStart();
             }
             itr.next();
@@ -576,11 +589,11 @@
      */
     private void setUnicodeLocaleExtension(String subtags) {
         // wipe out existing attributes/keywords
-        if (_uattributes != null) {
-            _uattributes.clear();
+        if (uattributes != null) {
+            uattributes.clear();
         }
-        if (_ukeywords != null) {
-            _ukeywords.clear();
+        if (ukeywords != null) {
+            ukeywords.clear();
         }
 
         StringTokenIterator itr = new StringTokenIterator(subtags, LanguageTag.SEP);
@@ -590,10 +603,10 @@
             if (!UnicodeLocaleExtension.isAttribute(itr.current())) {
                 break;
             }
-            if (_uattributes == null) {
-                _uattributes = new HashSet<CaseInsensitiveString>(4);
+            if (uattributes == null) {
+                uattributes = new HashSet<>(4);
             }
-            _uattributes.add(new CaseInsensitiveString(itr.current()));
+            uattributes.add(new CaseInsensitiveString(itr.current()));
             itr.next();
         }
 
@@ -608,14 +621,14 @@
                     // next keyword - emit previous one
                     assert(typeStart == -1 || typeEnd != -1);
                     type = (typeStart == -1) ? "" : subtags.substring(typeStart, typeEnd);
-                    if (_ukeywords == null) {
-                        _ukeywords = new HashMap<CaseInsensitiveString, String>(4);
+                    if (ukeywords == null) {
+                        ukeywords = new HashMap<>(4);
                     }
-                    _ukeywords.put(key, type);
+                    ukeywords.put(key, type);
 
                     // reset keyword info
                     CaseInsensitiveString tmpKey = new CaseInsensitiveString(itr.current());
-                    key = _ukeywords.containsKey(tmpKey) ? null : tmpKey;
+                    key = ukeywords.containsKey(tmpKey) ? null : tmpKey;
                     typeStart = typeEnd = -1;
                 } else {
                     if (typeStart == -1) {
@@ -627,7 +640,7 @@
                 // 1. first keyword or
                 // 2. next keyword, but previous one was duplicate
                 key = new CaseInsensitiveString(itr.current());
-                if (_ukeywords != null && _ukeywords.containsKey(key)) {
+                if (ukeywords != null && ukeywords.containsKey(key)) {
                     // duplicate
                     key = null;
                 }
@@ -638,10 +651,10 @@
                     // last keyword
                     assert(typeStart == -1 || typeEnd != -1);
                     type = (typeStart == -1) ? "" : subtags.substring(typeStart, typeEnd);
-                    if (_ukeywords == null) {
-                        _ukeywords = new HashMap<CaseInsensitiveString, String>(4);
+                    if (ukeywords == null) {
+                        ukeywords = new HashMap<>(4);
                     }
-                    _ukeywords.put(key, type);
+                    ukeywords.put(key, type);
                 }
                 break;
             }
@@ -650,21 +663,24 @@
         }
     }
 
-    static class CaseInsensitiveString {
-        private String _s;
+    static final class CaseInsensitiveString {
+        private final String str, lowerStr;
 
         CaseInsensitiveString(String s) {
-            _s = s;
+            str = s;
+            lowerStr = LocaleUtils.toLowerString(s);
         }
 
         public String value() {
-            return _s;
+            return str;
         }
 
+        @Override
         public int hashCode() {
-            return AsciiUtil.toLowerString(_s).hashCode();
+            return lowerStr.hashCode();
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (this == obj) {
                 return true;
@@ -672,25 +688,36 @@
             if (!(obj instanceof CaseInsensitiveString)) {
                 return false;
             }
-            return AsciiUtil.caseIgnoreMatch(_s, ((CaseInsensitiveString)obj).value());
+            return lowerStr.equals(((CaseInsensitiveString)obj).lowerStr);
         }
     }
 
-    static class CaseInsensitiveChar {
-        private char _c;
+    static final class CaseInsensitiveChar {
+        private final char ch, lowerCh;
+
+        /**
+         * Constructs a CaseInsensitiveChar with the first char of the
+         * given s.
+         */
+        private CaseInsensitiveChar(String s) {
+            this(s.charAt(0));
+        }
 
         CaseInsensitiveChar(char c) {
-            _c = c;
+            ch = c;
+            lowerCh = LocaleUtils.toLower(ch);
         }
 
         public char value() {
-            return _c;
+            return ch;
         }
 
+        @Override
         public int hashCode() {
-            return AsciiUtil.toLower(_c);
+            return lowerCh;
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (this == obj) {
                 return true;
@@ -698,8 +725,7 @@
             if (!(obj instanceof CaseInsensitiveChar)) {
                 return false;
             }
-            return _c ==  AsciiUtil.toLower(((CaseInsensitiveChar)obj).value());
+            return lowerCh == ((CaseInsensitiveChar)obj).lowerCh;
         }
-
     }
 }
--- a/jdk/src/share/classes/sun/util/locale/LanguageTag.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/LanguageTag.java	Tue Apr 26 15:48:03 2011 -0700
@@ -44,25 +44,25 @@
     //
     public static final String SEP = "-";
     public static final String PRIVATEUSE = "x";
-    public static String UNDETERMINED = "und";
+    public static final String UNDETERMINED = "und";
     public static final String PRIVUSE_VARIANT_PREFIX = "lvariant";
 
     //
     // Language subtag fields
     //
-    private String _language = "";      // language subtag
-    private String _script = "";        // script subtag
-    private String _region = "";        // region subtag
-    private String _privateuse = "";    // privateuse
+    private String language = "";      // language subtag
+    private String script = "";        // script subtag
+    private String region = "";        // region subtag
+    private String privateuse = "";    // privateuse
 
-    private List<String> _extlangs = Collections.emptyList();   // extlang subtags
-    private List<String> _variants = Collections.emptyList();   // variant subtags
-    private List<String> _extensions = Collections.emptyList(); // extensions
+    private List<String> extlangs = Collections.emptyList();   // extlang subtags
+    private List<String> variants = Collections.emptyList();   // variant subtags
+    private List<String> extensions = Collections.emptyList(); // extensions
 
     // Map contains grandfathered tags and its preferred mappings from
     // http://www.ietf.org/rfc/rfc5646.txt
-    private static final Map<AsciiUtil.CaseInsensitiveKey, String[]> GRANDFATHERED =
-        new HashMap<AsciiUtil.CaseInsensitiveKey, String[]>();
+    // Keys are lower-case strings.
+    private static final Map<String, String[]> GRANDFATHERED = new HashMap<>();
 
     static {
         // grandfathered = irregular           ; non-redundant tags registered
@@ -126,7 +126,7 @@
             {"zh-xiang",    "hsn"},
         };
         for (String[] e : entries) {
-            GRANDFATHERED.put(new AsciiUtil.CaseInsensitiveKey(e[0]), e);
+            GRANDFATHERED.put(LocaleUtils.toLowerString(e[0]), e);
         }
     }
 
@@ -188,7 +188,7 @@
         StringTokenIterator itr;
 
         // Check if the tag is grandfathered
-        String[] gfmap = GRANDFATHERED.get(new AsciiUtil.CaseInsensitiveKey(languageTag));
+        String[] gfmap = GRANDFATHERED.get(LocaleUtils.toLowerString(languageTag));
         if (gfmap != null) {
             // use preferred mapping
             itr = new StringTokenIterator(gfmap[1], SEP);
@@ -210,11 +210,11 @@
 
         if (!itr.isDone() && !sts.isError()) {
             String s = itr.current();
-            sts._errorIndex = itr.currentStart();
+            sts.errorIndex = itr.currentStart();
             if (s.length() == 0) {
-                sts._errorMsg = "Empty subtag";
+                sts.errorMsg = "Empty subtag";
             } else {
-                sts._errorMsg = "Invalid subtag: " + s;
+                sts.errorMsg = "Invalid subtag: " + s;
             }
         }
 
@@ -235,8 +235,8 @@
         String s = itr.current();
         if (isLanguage(s)) {
             found = true;
-            _language = s;
-            sts._parseLength = itr.currentEnd();
+            language = s;
+            sts.parseLength = itr.currentEnd();
             itr.next();
         }
 
@@ -256,14 +256,14 @@
                 break;
             }
             found = true;
-            if (_extlangs.isEmpty()) {
-                _extlangs = new ArrayList<String>(3);
+            if (extlangs.isEmpty()) {
+                extlangs = new ArrayList<>(3);
             }
-            _extlangs.add(s);
-            sts._parseLength = itr.currentEnd();
+            extlangs.add(s);
+            sts.parseLength = itr.currentEnd();
             itr.next();
 
-            if (_extlangs.size() == 3) {
+            if (extlangs.size() == 3) {
                 // Maximum 3 extlangs
                 break;
             }
@@ -282,8 +282,8 @@
         String s = itr.current();
         if (isScript(s)) {
             found = true;
-            _script = s;
-            sts._parseLength = itr.currentEnd();
+            script = s;
+            sts.parseLength = itr.currentEnd();
             itr.next();
         }
 
@@ -300,8 +300,8 @@
         String s = itr.current();
         if (isRegion(s)) {
             found = true;
-            _region = s;
-            sts._parseLength = itr.currentEnd();
+            region = s;
+            sts.parseLength = itr.currentEnd();
             itr.next();
         }
 
@@ -321,11 +321,11 @@
                 break;
             }
             found = true;
-            if (_variants.isEmpty()) {
-                _variants = new ArrayList<String>(3);
+            if (variants.isEmpty()) {
+                variants = new ArrayList<>(3);
             }
-            _variants.add(s);
-            sts._parseLength = itr.currentEnd();
+            variants.add(s);
+            sts.parseLength = itr.currentEnd();
             itr.next();
         }
 
@@ -351,23 +351,23 @@
                     s = itr.current();
                     if (isExtensionSubtag(s)) {
                         sb.append(SEP).append(s);
-                        sts._parseLength = itr.currentEnd();
+                        sts.parseLength = itr.currentEnd();
                     } else {
                         break;
                     }
                     itr.next();
                 }
 
-                if (sts._parseLength <= start) {
-                    sts._errorIndex = start;
-                    sts._errorMsg = "Incomplete extension '" + singleton + "'";
+                if (sts.parseLength <= start) {
+                    sts.errorIndex = start;
+                    sts.errorMsg = "Incomplete extension '" + singleton + "'";
                     break;
                 }
 
-                if (_extensions.size() == 0) {
-                    _extensions = new ArrayList<String>(4);
+                if (extensions.isEmpty()) {
+                    extensions = new ArrayList<>(4);
                 }
-                _extensions.add(sb.toString());
+                extensions.add(sb.toString());
                 found = true;
             } else {
                 break;
@@ -395,17 +395,17 @@
                     break;
                 }
                 sb.append(SEP).append(s);
-                sts._parseLength = itr.currentEnd();
+                sts.parseLength = itr.currentEnd();
 
                 itr.next();
             }
 
-            if (sts._parseLength <= start) {
+            if (sts.parseLength <= start) {
                 // need at least 1 private subtag
-                sts._errorIndex = start;
-                sts._errorMsg = "Incomplete privateuse";
+                sts.errorIndex = start;
+                sts.errorMsg = "Incomplete privateuse";
             } else {
-                _privateuse = sb.toString();
+                privateuse = sb.toString();
                 found = true;
             }
         }
@@ -425,9 +425,8 @@
 
         String privuseVar = null;   // store ill-formed variant subtags
 
-        if (language.length() > 0 && isLanguage(language)) {
-            // Convert a deprecated language code used by Java to
-            // a new code
+        if (isLanguage(language)) {
+            // Convert a deprecated language code to its new code
             if (language.equals("iw")) {
                 language = "he";
             } else if (language.equals("ji")) {
@@ -435,22 +434,22 @@
             } else if (language.equals("in")) {
                 language = "id";
             }
-            tag._language = language;
+            tag.language = language;
         }
 
-        if (script.length() > 0 && isScript(script)) {
-            tag._script = canonicalizeScript(script);
+        if (isScript(script)) {
+            tag.script = canonicalizeScript(script);
             hasSubtag = true;
         }
 
-        if (region.length() > 0 && isRegion(region)) {
-            tag._region = canonicalizeRegion(region);
+        if (isRegion(region)) {
+            tag.region = canonicalizeRegion(region);
             hasSubtag = true;
         }
 
         // Special handling for no_NO_NY - use nn_NO for language tag
-        if (tag._language.equals("no") && tag._region.equals("NO") && variant.equals("NY")) {
-            tag._language = "nn";
+        if (tag.language.equals("no") && tag.region.equals("NO") && variant.equals("NY")) {
+            tag.language = "nn";
             variant = "";
         }
 
@@ -463,13 +462,13 @@
                     break;
                 }
                 if (variants == null) {
-                    variants = new ArrayList<String>();
+                    variants = new ArrayList<>();
                 }
                 variants.add(var);  // Do not canonicalize!
                 varitr.next();
             }
             if (variants != null) {
-                tag._variants = variants;
+                tag.variants = variants;
                 hasSubtag = true;
             }
             if (!varitr.isDone()) {
@@ -496,21 +495,23 @@
         List<String> extensions = null;
         String privateuse = null;
 
-        Set<Character> locextKeys = localeExtensions.getKeys();
-        for (Character locextKey : locextKeys) {
-            Extension ext = localeExtensions.getExtension(locextKey);
-            if (isPrivateusePrefixChar(locextKey.charValue())) {
-                privateuse = ext.getValue();
-            } else {
-                if (extensions == null) {
-                    extensions = new ArrayList<String>();
+        if (localeExtensions != null) {
+            Set<Character> locextKeys = localeExtensions.getKeys();
+            for (Character locextKey : locextKeys) {
+                Extension ext = localeExtensions.getExtension(locextKey);
+                if (isPrivateusePrefixChar(locextKey)) {
+                    privateuse = ext.getValue();
+                } else {
+                    if (extensions == null) {
+                        extensions = new ArrayList<>();
+                    }
+                    extensions.add(locextKey.toString() + SEP + ext.getValue());
                 }
-                extensions.add(locextKey.toString() + SEP + ext.getValue());
             }
         }
 
         if (extensions != null) {
-            tag._extensions = extensions;
+            tag.extensions = extensions;
             hasSubtag = true;
         }
 
@@ -519,19 +520,20 @@
             if (privateuse == null) {
                 privateuse = PRIVUSE_VARIANT_PREFIX + SEP + privuseVar;
             } else {
-                privateuse = privateuse + SEP + PRIVUSE_VARIANT_PREFIX + SEP + privuseVar.replace(BaseLocale.SEP, SEP);
+                privateuse = privateuse + SEP + PRIVUSE_VARIANT_PREFIX
+                             + SEP + privuseVar.replace(BaseLocale.SEP, SEP);
             }
         }
 
         if (privateuse != null) {
-            tag._privateuse = privateuse;
+            tag.privateuse = privateuse;
         }
 
-        if (tag._language.length() == 0 && (hasSubtag || privateuse == null)) {
+        if (tag.language.length() == 0 && (hasSubtag || privateuse == null)) {
             // use lang "und" when 1) no language is available AND
             // 2) any of other subtags other than private use are available or
             // no private use tag is available
-            tag._language = UNDETERMINED;
+            tag.language = UNDETERMINED;
         }
 
         return tag;
@@ -542,31 +544,40 @@
     //
 
     public String getLanguage() {
-        return _language;
+        return language;
     }
 
     public List<String> getExtlangs() {
-        return Collections.unmodifiableList(_extlangs);
+        if (extlangs.isEmpty()) {
+            return Collections.emptyList();
+        }
+        return Collections.unmodifiableList(extlangs);
     }
 
     public String getScript() {
-        return _script;
+        return script;
     }
 
     public String getRegion() {
-        return _region;
+        return region;
     }
 
     public List<String> getVariants() {
-        return Collections.unmodifiableList(_variants);
+        if (variants.isEmpty()) {
+            return Collections.emptyList();
+        }
+        return Collections.unmodifiableList(variants);
     }
 
     public List<String> getExtensions() {
-        return Collections.unmodifiableList(_extensions);
+        if (extensions.isEmpty()) {
+            return Collections.emptyList();
+        }
+        return Collections.unmodifiableList(extensions);
     }
 
     public String getPrivateuse() {
-        return _privateuse;
+        return privateuse;
     }
 
     //
@@ -579,25 +590,26 @@
         //                                     ;   extended language subtags
         //               / 4ALPHA              ; or reserved for future use
         //               / 5*8ALPHA            ; or registered language subtag
-        return (s.length() >= 2) && (s.length() <= 8) && AsciiUtil.isAlphaString(s);
+        int len = s.length();
+        return (len >= 2) && (len <= 8) && LocaleUtils.isAlphaString(s);
     }
 
     public static boolean isExtlang(String s) {
         // extlang       = 3ALPHA              ; selected ISO 639 codes
         //                 *2("-" 3ALPHA)      ; permanently reserved
-        return (s.length() == 3) && AsciiUtil.isAlphaString(s);
+        return (s.length() == 3) && LocaleUtils.isAlphaString(s);
     }
 
     public static boolean isScript(String s) {
         // script        = 4ALPHA              ; ISO 15924 code
-        return (s.length() == 4) && AsciiUtil.isAlphaString(s);
+        return (s.length() == 4) && LocaleUtils.isAlphaString(s);
     }
 
     public static boolean isRegion(String s) {
         // region        = 2ALPHA              ; ISO 3166-1 code
         //               / 3DIGIT              ; UN M.49 code
-        return ((s.length() == 2) && AsciiUtil.isAlphaString(s))
-                || ((s.length() == 3) && AsciiUtil.isNumericString(s));
+        return ((s.length() == 2) && LocaleUtils.isAlphaString(s))
+                || ((s.length() == 3) && LocaleUtils.isNumericString(s));
     }
 
     public static boolean isVariant(String s) {
@@ -605,13 +617,13 @@
         //               / (DIGIT 3alphanum)
         int len = s.length();
         if (len >= 5 && len <= 8) {
-            return AsciiUtil.isAlphaNumericString(s);
+            return LocaleUtils.isAlphaNumericString(s);
         }
         if (len == 4) {
-            return AsciiUtil.isNumeric(s.charAt(0))
-                    && AsciiUtil.isAlphaNumeric(s.charAt(1))
-                    && AsciiUtil.isAlphaNumeric(s.charAt(2))
-                    && AsciiUtil.isAlphaNumeric(s.charAt(3));
+            return LocaleUtils.isNumeric(s.charAt(0))
+                    && LocaleUtils.isAlphaNumeric(s.charAt(1))
+                    && LocaleUtils.isAlphaNumeric(s.charAt(2))
+                    && LocaleUtils.isAlphaNumeric(s.charAt(3));
         }
         return false;
     }
@@ -624,8 +636,8 @@
         //               / %x79-7A             ; y - z
 
         return (s.length() == 1)
-                && AsciiUtil.isAlphaString(s)
-                && !AsciiUtil.caseIgnoreMatch(PRIVATEUSE, s);
+                && LocaleUtils.isAlphaString(s)
+                && !LocaleUtils.caseIgnoreMatch(PRIVATEUSE, s);
     }
 
     public static boolean isExtensionSingletonChar(char c) {
@@ -634,22 +646,24 @@
 
     public static boolean isExtensionSubtag(String s) {
         // extension     = singleton 1*("-" (2*8alphanum))
-        return (s.length() >= 2) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s);
+        int len = s.length();
+        return (len >= 2) && (len <= 8) && LocaleUtils.isAlphaNumericString(s);
     }
 
     public static boolean isPrivateusePrefix(String s) {
         // privateuse    = "x" 1*("-" (1*8alphanum))
         return (s.length() == 1)
-                && AsciiUtil.caseIgnoreMatch(PRIVATEUSE, s);
+                && LocaleUtils.caseIgnoreMatch(PRIVATEUSE, s);
     }
 
     public static boolean isPrivateusePrefixChar(char c) {
-        return (AsciiUtil.caseIgnoreMatch(PRIVATEUSE, String.valueOf(c)));
+        return (LocaleUtils.caseIgnoreMatch(PRIVATEUSE, String.valueOf(c)));
     }
 
     public static boolean isPrivateuseSubtag(String s) {
         // privateuse    = "x" 1*("-" (1*8alphanum))
-        return (s.length() >= 1) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s);
+        int len = s.length();
+        return (len >= 1) && (len <= 8) && LocaleUtils.isAlphaNumericString(s);
     }
 
     //
@@ -657,76 +671,77 @@
     //
 
     public static String canonicalizeLanguage(String s) {
-        return AsciiUtil.toLowerString(s);
+        return LocaleUtils.toLowerString(s);
     }
 
     public static String canonicalizeExtlang(String s) {
-        return AsciiUtil.toLowerString(s);
+        return LocaleUtils.toLowerString(s);
     }
 
     public static String canonicalizeScript(String s) {
-        return AsciiUtil.toTitleString(s);
+        return LocaleUtils.toTitleString(s);
     }
 
     public static String canonicalizeRegion(String s) {
-        return AsciiUtil.toUpperString(s);
+        return LocaleUtils.toUpperString(s);
     }
 
     public static String canonicalizeVariant(String s) {
-        return AsciiUtil.toLowerString(s);
+        return LocaleUtils.toLowerString(s);
     }
 
     public static String canonicalizeExtension(String s) {
-        return AsciiUtil.toLowerString(s);
+        return LocaleUtils.toLowerString(s);
     }
 
     public static String canonicalizeExtensionSingleton(String s) {
-        return AsciiUtil.toLowerString(s);
+        return LocaleUtils.toLowerString(s);
     }
 
     public static String canonicalizeExtensionSubtag(String s) {
-        return AsciiUtil.toLowerString(s);
+        return LocaleUtils.toLowerString(s);
     }
 
     public static String canonicalizePrivateuse(String s) {
-        return AsciiUtil.toLowerString(s);
+        return LocaleUtils.toLowerString(s);
     }
 
     public static String canonicalizePrivateuseSubtag(String s) {
-        return AsciiUtil.toLowerString(s);
+        return LocaleUtils.toLowerString(s);
     }
 
+    @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
 
-        if (_language.length() > 0) {
-            sb.append(_language);
+        if (language.length() > 0) {
+            sb.append(language);
 
-            for (String extlang : _extlangs) {
+            for (String extlang : extlangs) {
                 sb.append(SEP).append(extlang);
             }
 
-            if (_script.length() > 0) {
-                sb.append(SEP).append(_script);
+            if (script.length() > 0) {
+                sb.append(SEP).append(script);
             }
 
-            if (_region.length() > 0) {
-                sb.append(SEP).append(_region);
+            if (region.length() > 0) {
+                sb.append(SEP).append(region);
             }
 
-            for (String variant : _extlangs) {
+            for (String variant : variants) {
                 sb.append(SEP).append(variant);
             }
 
-            for (String extension : _extensions) {
+            for (String extension : extensions) {
                 sb.append(SEP).append(extension);
             }
         }
-        if (_privateuse.length() > 0) {
+        if (privateuse.length() > 0) {
             if (sb.length() > 0) {
                 sb.append(SEP);
             }
-            sb.append(_privateuse);
+            sb.append(privateuse);
         }
 
         return sb.toString();
--- a/jdk/src/share/classes/sun/util/locale/LocaleExtensions.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/LocaleExtensions.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -36,6 +36,7 @@
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.SortedMap;
+import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
@@ -45,55 +46,45 @@
 
 public class LocaleExtensions {
 
-    private SortedMap<Character, Extension> _map;
-    private String _id;
+    private final Map<Character, Extension> extensionMap;
+    private final String id;
 
-    private static final SortedMap<Character, Extension> EMPTY_MAP =
-        Collections.unmodifiableSortedMap(new TreeMap<Character, Extension>());
-
-    public static final LocaleExtensions EMPTY_EXTENSIONS;
-    public static final LocaleExtensions CALENDAR_JAPANESE;
-    public static final LocaleExtensions NUMBER_THAI;
+    public static final LocaleExtensions CALENDAR_JAPANESE
+        = new LocaleExtensions("u-ca-japanese",
+                               UnicodeLocaleExtension.SINGLETON,
+                               UnicodeLocaleExtension.CA_JAPANESE);
 
-    static {
-        EMPTY_EXTENSIONS = new LocaleExtensions();
-        EMPTY_EXTENSIONS._id = "";
-        EMPTY_EXTENSIONS._map = EMPTY_MAP;
+    public static final LocaleExtensions NUMBER_THAI
+        = new LocaleExtensions("u-nu-thai",
+                               UnicodeLocaleExtension.SINGLETON,
+                               UnicodeLocaleExtension.NU_THAI);
 
-        CALENDAR_JAPANESE = new LocaleExtensions();
-        CALENDAR_JAPANESE._id = "u-ca-japanese";
-        CALENDAR_JAPANESE._map = new TreeMap<Character, Extension>();
-        CALENDAR_JAPANESE._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.CA_JAPANESE);
-
-        NUMBER_THAI = new LocaleExtensions();
-        NUMBER_THAI._id = "u-nu-thai";
-        NUMBER_THAI._map = new TreeMap<Character, Extension>();
-        NUMBER_THAI._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.NU_THAI);
-    }
-
-    private LocaleExtensions() {
+    private LocaleExtensions(String id, Character key, Extension value) {
+        this.id = id;
+        this.extensionMap = Collections.singletonMap(key, value);
     }
 
     /*
-     * Package local constructor, only used by InternalLocaleBuilder.
+     * Package private constructor, only used by InternalLocaleBuilder.
      */
     LocaleExtensions(Map<CaseInsensitiveChar, String> extensions,
-            Set<CaseInsensitiveString> uattributes, Map<CaseInsensitiveString, String> ukeywords) {
-        boolean hasExtension = (extensions != null && extensions.size() > 0);
-        boolean hasUAttributes = (uattributes != null && uattributes.size() > 0);
-        boolean hasUKeywords = (ukeywords != null && ukeywords.size() > 0);
+                     Set<CaseInsensitiveString> uattributes,
+                     Map<CaseInsensitiveString, String> ukeywords) {
+        boolean hasExtension = !LocaleUtils.isEmpty(extensions);
+        boolean hasUAttributes = !LocaleUtils.isEmpty(uattributes);
+        boolean hasUKeywords = !LocaleUtils.isEmpty(ukeywords);
 
         if (!hasExtension && !hasUAttributes && !hasUKeywords) {
-            _map = EMPTY_MAP;
-            _id = "";
+            id = "";
+            extensionMap = Collections.emptyMap();
             return;
         }
 
         // Build extension map
-        _map = new TreeMap<Character, Extension>();
+        SortedMap<Character, Extension> map = new TreeMap<>();
         if (hasExtension) {
             for (Entry<CaseInsensitiveChar, String> ext : extensions.entrySet()) {
-                char key = AsciiUtil.toLower(ext.getKey().value());
+                char key = LocaleUtils.toLower(ext.getKey().value());
                 String value = ext.getValue();
 
                 if (LanguageTag.isPrivateusePrefixChar(key)) {
@@ -104,54 +95,57 @@
                     }
                 }
 
-                Extension e = new Extension(key, AsciiUtil.toLowerString(value));
-                _map.put(Character.valueOf(key), e);
+                map.put(key, new Extension(key, LocaleUtils.toLowerString(value)));
             }
         }
 
         if (hasUAttributes || hasUKeywords) {
-            TreeSet<String> uaset = null;
-            TreeMap<String, String> ukmap = null;
+            SortedSet<String> uaset = null;
+            SortedMap<String, String> ukmap = null;
 
             if (hasUAttributes) {
-                uaset = new TreeSet<String>();
+                uaset = new TreeSet<>();
                 for (CaseInsensitiveString cis : uattributes) {
-                    uaset.add(AsciiUtil.toLowerString(cis.value()));
+                    uaset.add(LocaleUtils.toLowerString(cis.value()));
                 }
             }
 
             if (hasUKeywords) {
-                ukmap = new TreeMap<String, String>();
+                ukmap = new TreeMap<>();
                 for (Entry<CaseInsensitiveString, String> kwd : ukeywords.entrySet()) {
-                    String key = AsciiUtil.toLowerString(kwd.getKey().value());
-                    String type = AsciiUtil.toLowerString(kwd.getValue());
+                    String key = LocaleUtils.toLowerString(kwd.getKey().value());
+                    String type = LocaleUtils.toLowerString(kwd.getValue());
                     ukmap.put(key, type);
                 }
             }
 
             UnicodeLocaleExtension ule = new UnicodeLocaleExtension(uaset, ukmap);
-            _map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), ule);
+            map.put(UnicodeLocaleExtension.SINGLETON, ule);
         }
 
-        if (_map.size() == 0) {
+        if (map.isEmpty()) {
             // this could happen when only privuateuse with special variant
-            _map = EMPTY_MAP;
-            _id = "";
+            id = "";
+            extensionMap = Collections.emptyMap();
         } else {
-            _id = toID(_map);
+            id = toID(map);
+            extensionMap = map;
         }
     }
 
     public Set<Character> getKeys() {
-        return Collections.unmodifiableSet(_map.keySet());
+        if (extensionMap.isEmpty()) {
+            return Collections.emptySet();
+        }
+        return Collections.unmodifiableSet(extensionMap.keySet());
     }
 
     public Extension getExtension(Character key) {
-        return _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue())));
+        return extensionMap.get(LocaleUtils.toLower(key));
     }
 
     public String getExtensionValue(Character key) {
-        Extension ext = _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue())));
+        Extension ext = extensionMap.get(LocaleUtils.toLower(key));
         if (ext == null) {
             return null;
         }
@@ -159,7 +153,7 @@
     }
 
     public Set<String> getUnicodeLocaleAttributes() {
-        Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON));
+        Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON);
         if (ext == null) {
             return Collections.emptySet();
         }
@@ -168,7 +162,7 @@
     }
 
     public Set<String> getUnicodeLocaleKeys() {
-        Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON));
+        Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON);
         if (ext == null) {
             return Collections.emptySet();
         }
@@ -177,16 +171,16 @@
     }
 
     public String getUnicodeLocaleType(String unicodeLocaleKey) {
-        Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON));
+        Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON);
         if (ext == null) {
             return null;
         }
         assert (ext instanceof UnicodeLocaleExtension);
-        return ((UnicodeLocaleExtension)ext).getUnicodeLocaleType(AsciiUtil.toLowerString(unicodeLocaleKey));
+        return ((UnicodeLocaleExtension)ext).getUnicodeLocaleType(LocaleUtils.toLowerString(unicodeLocaleKey));
     }
 
     public boolean isEmpty() {
-        return _map.isEmpty();
+        return extensionMap.isEmpty();
     }
 
     public static boolean isValidKey(char c) {
@@ -201,7 +195,7 @@
         StringBuilder buf = new StringBuilder();
         Extension privuse = null;
         for (Entry<Character, Extension> entry : map.entrySet()) {
-            char singleton = entry.getKey().charValue();
+            char singleton = entry.getKey();
             Extension extension = entry.getValue();
             if (LanguageTag.isPrivateusePrefixChar(singleton)) {
                 privuse = extension;
@@ -221,19 +215,21 @@
         return buf.toString();
     }
 
-
+    @Override
     public String toString() {
-        return _id;
+        return id;
     }
 
     public String getID() {
-        return _id;
+        return id;
     }
 
+    @Override
     public int hashCode() {
-        return _id.hashCode();
+        return id.hashCode();
     }
 
+    @Override
     public boolean equals(Object other) {
         if (this == other) {
             return true;
@@ -241,6 +237,6 @@
         if (!(other instanceof LocaleExtensions)) {
             return false;
         }
-        return this._id.equals(((LocaleExtensions)other)._id);
+        return id.equals(((LocaleExtensions)other).id);
     }
 }
--- a/jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -34,24 +34,25 @@
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.SoftReference;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 public abstract class LocaleObjectCache<K, V> {
-    private ConcurrentHashMap<K, CacheEntry<K, V>> _map;
-    private ReferenceQueue<V> _queue = new ReferenceQueue<V>();
+    private ConcurrentMap<K, CacheEntry<K, V>> map;
+    private ReferenceQueue<V> queue = new ReferenceQueue<>();
 
     public LocaleObjectCache() {
         this(16, 0.75f, 16);
     }
 
     public LocaleObjectCache(int initialCapacity, float loadFactor, int concurrencyLevel) {
-        _map = new ConcurrentHashMap<K, CacheEntry<K, V>>(initialCapacity, loadFactor, concurrencyLevel);
+        map = new ConcurrentHashMap<>(initialCapacity, loadFactor, concurrencyLevel);
     }
 
     public V get(K key) {
         V value = null;
 
         cleanStaleEntries();
-        CacheEntry<K, V> entry = _map.get(key);
+        CacheEntry<K, V> entry = map.get(key);
         if (entry != null) {
             value = entry.get();
         }
@@ -63,11 +64,11 @@
                 return null;
             }
 
-            CacheEntry<K, V> newEntry = new CacheEntry<K, V>(key, newVal, _queue);
+            CacheEntry<K, V> newEntry = new CacheEntry<>(key, newVal, queue);
 
             while (value == null) {
                 cleanStaleEntries();
-                entry = _map.putIfAbsent(key, newEntry);
+                entry = map.putIfAbsent(key, newEntry);
                 if (entry == null) {
                     value = newVal;
                     break;
@@ -79,11 +80,17 @@
         return value;
     }
 
+    protected V put(K key, V value) {
+        CacheEntry<K, V> entry = new CacheEntry<>(key, value, queue);
+        CacheEntry<K, V> oldEntry = map.put(key, entry);
+        return (oldEntry == null) ? null : oldEntry.get();
+    }
+
     @SuppressWarnings("unchecked")
     private void cleanStaleEntries() {
         CacheEntry<K, V> entry;
-        while ((entry = (CacheEntry<K, V>)_queue.poll()) != null) {
-            _map.remove(entry.getKey());
+        while ((entry = (CacheEntry<K, V>)queue.poll()) != null) {
+            map.remove(entry.getKey());
         }
     }
 
@@ -94,15 +101,15 @@
     }
 
     private static class CacheEntry<K, V> extends SoftReference<V> {
-        private K _key;
+        private K key;
 
         CacheEntry(K key, V value, ReferenceQueue<V> queue) {
             super(value, queue);
-            _key = key;
+            this.key = key;
         }
 
         K getKey() {
-            return _key;
+            return key;
         }
     }
 }
--- a/jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -35,7 +35,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    private int _index = -1;
+    private int index = -1;
 
     public LocaleSyntaxException(String msg) {
         this(msg, 0);
@@ -43,10 +43,10 @@
 
     public LocaleSyntaxException(String msg, int errorIndex) {
         super(msg);
-        _index = errorIndex;
+        index = errorIndex;
     }
 
     public int getErrorIndex() {
-        return _index;
+        return index;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/locale/LocaleUtils.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2010, 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.
+ */
+
+/*
+ *******************************************************************************
+ * Copyright (C) 2009, International Business Machines Corporation and         *
+ * others. All Rights Reserved.                                                *
+ *******************************************************************************
+ */
+package sun.util.locale;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Collection of static utility methods for Locale support. The
+ * methods which manipulate characters or strings support ASCII only.
+ */
+public final class LocaleUtils {
+
+    private LocaleUtils() {
+    }
+
+    /**
+     * Compares two ASCII Strings s1 and s2, ignoring case.
+     */
+    public static boolean caseIgnoreMatch(String s1, String s2) {
+        if (s1 == s2) {
+            return true;
+        }
+
+        int len = s1.length();
+        if (len != s2.length()) {
+            return false;
+        }
+
+        for (int i = 0; i < len; i++) {
+            char c1 = s1.charAt(i);
+            char c2 = s2.charAt(i);
+            if (c1 != c2 && toLower(c1) != toLower(c2)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    static int caseIgnoreCompare(String s1, String s2) {
+        if (s1 == s2) {
+            return 0;
+        }
+        return toLowerString(s1).compareTo(toLowerString(s2));
+    }
+
+    static char toUpper(char c) {
+        return isLower(c) ? (char)(c - 0x20) : c;
+    }
+
+    static char toLower(char c) {
+        return isUpper(c) ? (char)(c + 0x20) : c;
+    }
+
+    /**
+     * Converts the given ASCII String to lower-case.
+     */
+    public static String toLowerString(String s) {
+        int len = s.length();
+        int idx = 0;
+        for (; idx < len; idx++) {
+            if (isUpper(s.charAt(idx))) {
+                break;
+            }
+        }
+        if (idx == len) {
+            return s;
+        }
+
+        char[] buf = new char[len];
+        for (int i = 0; i < len; i++) {
+            char c = s.charAt(i);
+            buf[i] = (i < idx) ? c : toLower(c);
+        }
+        return new String(buf);
+    }
+
+    static String toUpperString(String s) {
+        int len = s.length();
+        int idx = 0;
+        for (; idx < len; idx++) {
+            if (isLower(s.charAt(idx))) {
+                break;
+            }
+        }
+        if (idx == len) {
+            return s;
+        }
+
+        char[] buf = new char[len];
+        for (int i = 0; i < len; i++) {
+            char c = s.charAt(i);
+            buf[i] = (i < idx) ? c : toUpper(c);
+        }
+        return new String(buf);
+    }
+
+    static String toTitleString(String s) {
+        int len;
+        if ((len = s.length()) == 0) {
+            return s;
+        }
+        int idx = 0;
+        if (!isLower(s.charAt(idx))) {
+            for (idx = 1; idx < len; idx++) {
+                if (isUpper(s.charAt(idx))) {
+                    break;
+                }
+            }
+        }
+        if (idx == len) {
+            return s;
+        }
+
+        char[] buf = new char[len];
+        for (int i = 0; i < len; i++) {
+            char c = s.charAt(i);
+            if (i == 0 && idx == 0) {
+                buf[i] = toUpper(c);
+            } else if (i < idx) {
+                buf[i] = c;
+            } else {
+                buf[i] = toLower(c);
+            }
+        }
+        return new String(buf);
+    }
+
+    private static boolean isUpper(char c) {
+        return c >= 'A' && c <= 'Z';
+    }
+
+    private static boolean isLower(char c) {
+        return c >= 'a' && c <= 'z';
+    }
+
+    static boolean isAlpha(char c) {
+        return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
+    }
+
+    static boolean isAlphaString(String s) {
+        int len = s.length();
+        for (int i = 0; i < len; i++) {
+            if (!isAlpha(s.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    static boolean isNumeric(char c) {
+        return (c >= '0' && c <= '9');
+    }
+
+    static boolean isNumericString(String s) {
+        int len = s.length();
+        for (int i = 0; i < len; i++) {
+            if (!isNumeric(s.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    static boolean isAlphaNumeric(char c) {
+        return isAlpha(c) || isNumeric(c);
+    }
+
+    static boolean isAlphaNumericString(String s) {
+        int len = s.length();
+        for (int i = 0; i < len; i++) {
+            if (!isAlphaNumeric(s.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    static boolean isEmpty(String str) {
+        return str == null || str.length() == 0;
+    }
+
+    static boolean isEmpty(Set<?> set) {
+        return set == null || set.isEmpty();
+    }
+
+    static boolean isEmpty(Map<?, ?> map) {
+        return map == null || map.isEmpty();
+    }
+
+    static boolean isEmpty(List<?> list) {
+        return list == null || list.isEmpty();
+    }
+}
--- a/jdk/src/share/classes/sun/util/locale/ParseStatus.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/ParseStatus.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -32,29 +32,33 @@
 package sun.util.locale;
 
 public class ParseStatus {
-    int _parseLength = 0;
-    int _errorIndex = -1;
-    String _errorMsg = null;
+    int parseLength;
+    int errorIndex;
+    String errorMsg;
+
+    public ParseStatus() {
+        reset();
+    }
 
     public void reset() {
-        _parseLength = 0;
-        _errorIndex = -1;
-        _errorMsg = null;
+        parseLength = 0;
+        errorIndex = -1;
+        errorMsg = null;
     }
 
     public boolean isError() {
-        return (_errorIndex >= 0);
+        return (errorIndex >= 0);
     }
 
     public int getErrorIndex() {
-        return _errorIndex;
+        return errorIndex;
     }
 
     public int getParseLength() {
-        return _parseLength;
+        return parseLength;
     }
 
     public String getErrorMessage() {
-        return _errorMsg;
+        return errorMsg;
     }
 }
--- a/jdk/src/share/classes/sun/util/locale/StringTokenIterator.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/StringTokenIterator.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -31,87 +31,99 @@
 package sun.util.locale;
 
 public class StringTokenIterator {
-    private String _text;
-    private String _dlms;
+    private String text;
+    private String dlms;        // null if a single char delimiter
+    private char delimiterChar; // delimiter if a single char delimiter
 
-    private String _token;
-    private int _start;
-    private int _end;
-    private boolean _done;
+    private String token;
+    private int start;
+    private int end;
+    private boolean done;
 
     public StringTokenIterator(String text, String dlms) {
-        _text = text;
-        _dlms = dlms;
+        this.text = text;
+        if (dlms.length() == 1) {
+            delimiterChar = dlms.charAt(0);
+        } else {
+            this.dlms = dlms;
+        }
         setStart(0);
     }
 
     public String first() {
         setStart(0);
-        return _token;
+        return token;
     }
 
     public String current() {
-        return _token;
+        return token;
     }
 
     public int currentStart() {
-        return _start;
+        return start;
     }
 
     public int currentEnd() {
-        return _end;
+        return end;
     }
 
     public boolean isDone() {
-        return _done;
+        return done;
     }
 
     public String next() {
         if (hasNext()) {
-            _start = _end + 1;
-            _end = nextDelimiter(_start);
-            _token = _text.substring(_start, _end);
+            start = end + 1;
+            end = nextDelimiter(start);
+            token = text.substring(start, end);
         } else {
-            _start = _end;
-            _token = null;
-            _done = true;
+            start = end;
+            token = null;
+            done = true;
         }
-        return _token;
+        return token;
     }
 
     public boolean hasNext() {
-        return (_end < _text.length());
+        return (end < text.length());
     }
 
     public StringTokenIterator setStart(int offset) {
-        if (offset > _text.length()) {
+        if (offset > text.length()) {
             throw new IndexOutOfBoundsException();
         }
-        _start = offset;
-        _end = nextDelimiter(_start);
-        _token = _text.substring(_start, _end);
-        _done = false;
+        start = offset;
+        end = nextDelimiter(start);
+        token = text.substring(start, end);
+        done = false;
         return this;
     }
 
     public StringTokenIterator setText(String text) {
-        _text = text;
+        this.text = text;
         setStart(0);
         return this;
     }
 
     private int nextDelimiter(int start) {
-        int idx = start;
-        outer: while (idx < _text.length()) {
-            char c = _text.charAt(idx);
-            for (int i = 0; i < _dlms.length(); i++) {
-                if (c == _dlms.charAt(i)) {
-                    break outer;
+        int textlen = this.text.length();
+        if (dlms == null) {
+            for (int idx = start; idx < textlen; idx++) {
+                if (text.charAt(idx) == delimiterChar) {
+                    return idx;
                 }
             }
-            idx++;
+        } else {
+            int dlmslen = dlms.length();
+            for (int idx = start; idx < textlen; idx++) {
+                char c = text.charAt(idx);
+                for (int i = 0; i < dlmslen; i++) {
+                    if (c == dlms.charAt(i)) {
+                        return idx;
+                    }
+                }
+            }
         }
-        return idx;
+        return textlen;
     }
 }
-
--- a/jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,6 @@
+
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -32,56 +33,48 @@
 package sun.util.locale;
 
 import java.util.Collections;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.SortedMap;
 import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
 
 public class UnicodeLocaleExtension extends Extension {
     public static final char SINGLETON = 'u';
 
-    private static final SortedSet<String> EMPTY_SORTED_SET = new TreeSet<String>();
-    private static final SortedMap<String, String> EMPTY_SORTED_MAP = new TreeMap<String, String>();
-
-    private SortedSet<String> _attributes = EMPTY_SORTED_SET;
-    private SortedMap<String, String> _keywords = EMPTY_SORTED_MAP;
-
-    public static final UnicodeLocaleExtension CA_JAPANESE;
-    public static final UnicodeLocaleExtension NU_THAI;
+    private final Set<String> attributes;
+    private final Map<String, String> keywords;
 
-    static {
-        CA_JAPANESE = new UnicodeLocaleExtension();
-        CA_JAPANESE._keywords = new TreeMap<String, String>();
-        CA_JAPANESE._keywords.put("ca", "japanese");
-        CA_JAPANESE._value = "ca-japanese";
+    public static final UnicodeLocaleExtension CA_JAPANESE
+        = new UnicodeLocaleExtension("ca", "japanese");
+    public static final UnicodeLocaleExtension NU_THAI
+        = new UnicodeLocaleExtension("nu", "thai");
 
-        NU_THAI = new UnicodeLocaleExtension();
-        NU_THAI._keywords = new TreeMap<String, String>();
-        NU_THAI._keywords.put("nu", "thai");
-        NU_THAI._value = "nu-thai";
-    }
-
-    private UnicodeLocaleExtension() {
-        super(SINGLETON);
+    private UnicodeLocaleExtension(String key, String value) {
+        super(SINGLETON, key + "-" + value);
+        attributes = Collections.emptySet();
+        keywords = Collections.singletonMap(key, value);
     }
 
     UnicodeLocaleExtension(SortedSet<String> attributes, SortedMap<String, String> keywords) {
-        this();
-        if (attributes != null && attributes.size() > 0) {
-            _attributes = attributes;
+        super(SINGLETON);
+        if (attributes != null) {
+            this.attributes = attributes;
+        } else {
+            this.attributes = Collections.emptySet();
         }
-        if (keywords != null && keywords.size() > 0) {
-            _keywords = keywords;
+        if (keywords != null) {
+            this.keywords = keywords;
+        } else {
+            this.keywords = Collections.emptyMap();
         }
 
-        if (_attributes.size() > 0 || _keywords.size() > 0) {
+        if (!this.attributes.isEmpty() || !this.keywords.isEmpty()) {
             StringBuilder sb = new StringBuilder();
-            for (String attribute : _attributes) {
+            for (String attribute : this.attributes) {
                 sb.append(LanguageTag.SEP).append(attribute);
             }
-            for (Entry<String, String> keyword : _keywords.entrySet()) {
+            for (Entry<String, String> keyword : this.keywords.entrySet()) {
                 String key = keyword.getKey();
                 String value = keyword.getValue();
 
@@ -90,38 +83,46 @@
                     sb.append(LanguageTag.SEP).append(value);
                 }
             }
-            _value = sb.substring(1);   // skip leading '-'
+            setValue(sb.substring(1));   // skip leading '-'
         }
     }
 
     public Set<String> getUnicodeLocaleAttributes() {
-        return Collections.unmodifiableSet(_attributes);
+        if (attributes == Collections.EMPTY_SET) {
+            return attributes;
+        }
+        return Collections.unmodifiableSet(attributes);
     }
 
     public Set<String> getUnicodeLocaleKeys() {
-        return Collections.unmodifiableSet(_keywords.keySet());
+        if (keywords == Collections.EMPTY_MAP) {
+            return Collections.emptySet();
+        }
+        return Collections.unmodifiableSet(keywords.keySet());
     }
 
     public String getUnicodeLocaleType(String unicodeLocaleKey) {
-        return _keywords.get(unicodeLocaleKey);
+        return keywords.get(unicodeLocaleKey);
     }
 
     public static boolean isSingletonChar(char c) {
-        return (SINGLETON == AsciiUtil.toLower(c));
+        return (SINGLETON == LocaleUtils.toLower(c));
     }
 
     public static boolean isAttribute(String s) {
         // 3*8alphanum
-        return (s.length() >= 3) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s);
+        int len = s.length();
+        return (len >= 3) && (len <= 8) && LocaleUtils.isAlphaNumericString(s);
     }
 
     public static boolean isKey(String s) {
         // 2alphanum
-        return (s.length() == 2) && AsciiUtil.isAlphaNumericString(s);
+        return (s.length() == 2) && LocaleUtils.isAlphaNumericString(s);
     }
 
     public static boolean isTypeSubtag(String s) {
         // 3*8alphanum
-        return (s.length() >= 3) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s);
+        int len = s.length();
+        return (len >= 3) && (len <= 8) && LocaleUtils.isAlphaNumericString(s);
     }
 }
--- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_de.properties	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_de.properties	Tue Apr 26 15:48:03 2011 -0700
@@ -65,6 +65,8 @@
 #
 adp=Andorranische Pesete
 aed=UAE Dirham
+afa=Afghani (1927-2002)
+afn=Afghani
 all=Lek
 amd=Dram
 ang=Niederl. Antillen Gulden
@@ -85,6 +87,7 @@
 bif=Burundi-Franc
 bmd=Bermuda-Dollar
 bnd=Brunei-Dollar
+bob=Boliviano
 bov=Mvdol
 brl=Real
 bsd=Bahama-Dollar
@@ -106,6 +109,7 @@
 cve=Kap Verde Escudo
 cyp=Zypern-Pfund
 czk=Tschechische Krone
+dem=Deutsche Mark
 djf=Dschibuti-Franc
 dkk=D\u00e4nische Krone
 dop=Dominikanischer Peso
@@ -176,7 +180,9 @@
 mtl=Maltesische Lira
 mur=Mauritius-Rupie
 mvr=Rufiyaa
+mwk=Malawi Kwacha
 mxn=Mexikanischer Peso
+mxv=Mexican Unidad de Inversion (UDI)
 myr=Malaysischer Ringgit
 mzm=Alter Metical
 mzn=Metical
@@ -217,6 +223,7 @@
 srd=Surinamischer Dollar
 srg=Suriname Gulden
 std=Dobra
+svc=El Salvador Colon
 syp=Syrisches Pfund
 szl=Lilangeni
 thb=Baht
--- a/jdk/src/share/classes/sun/util/resources/CurrencyNames_it.properties	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/CurrencyNames_it.properties	Tue Apr 26 15:48:03 2011 -0700
@@ -86,6 +86,7 @@
 bif=Franco del Burundi
 bmd=Dollaro delle Bermuda
 bnd=Dollaro del Brunei
+bob=Boliviano
 bov=Mvdol Boliviano
 brl=Real Brasiliano
 bsd=Dollaro delle Bahamas
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java	Tue Apr 26 15:48:03 2011 -0700
@@ -43,822 +43,824 @@
 public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle {
 
     protected final Object[][] getContents() {
-    String ACT[] = new String[] {"Fuso hor\u00e1rio do Acre", "ACT",
-                     "Fuso hor\u00e1rio de ver\u00e3o do Acre", "ACST"};
-    String ADELAIDE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul)", "CST",
-                      "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul)", "CST"};
-    String AGT[] = new String[] {"Fuso hor\u00e1rio da Argentina", "ART",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Argentina", "ARST"};
-    String AKST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Alaska", "AKST",
-                      "Hor\u00e1rio de luz natural do Alaska", "AKDT"};
-    String AMT[] = new String[] {"Fuso hor\u00e1rio do Amazonas", "AMT",
-                     "Fuso hor\u00e1rio de ver\u00e3o do Amazonas", "AMST"};
-    String ARAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ar\u00e1bia", "AST",
-                       "Hor\u00e1rio de luz natural da Ar\u00e1bia", "ADT"};
-    String ARMT[] = new String[] {"Fuso hor\u00e1rio da Arm\u00eania", "AMT",
-                      "Fuso hor\u00e1rio de ver\u00e3o da Arm\u00eania", "AMST"};
-    String AST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Atl\u00e2ntico", "AST",
-                     "Hor\u00e1rio de luz natural do Atl\u00e2ntico", "ADT"};
-    String BDT[] = new String[] {"Fuso hor\u00e1rio de Bangladesh", "BDT",
-                     "Fuso hor\u00e1rio de ver\u00e3o de Bangladesh", "BDST"};
-    String BRISBANE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Queensland)", "EST",
-                      "Fuso hor\u00e1rio de ver\u00e3o oriental (Queensland)", "EST"};
-    String BROKEN_HILL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST",
-                         "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST"};
-    String BRT[] = new String[] {"Fuso hor\u00e1rio de Bras\u00edlia", "BRT",
-                     "Fuso hor\u00e1rio de ver\u00e3o de Bras\u00edlia", "BRST"};
-    String BTT[] = new String[] {"Fuso hor\u00e1rio de But\u00e3o", "BTT",
-                     "Fuso hor\u00e1rio de ver\u00e3o de But\u00e3o", "BTST"};
-    String CAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Central", "CAT",
-                     "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Central", "CAST"};
-    String CET[] = new String[] {"Fuso hor\u00e1rio da Europa Central", "CET",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST"};
-    String CHAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chatham", "CHAST",
-                       "Hor\u00e1rio de luz natural de Chatham", "CHADT"};
-    String CIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Central", "CIT",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Central", "CIST"};
-    String CLT[] = new String[] {"Fuso hor\u00e1rio do Chile", "CLT",
-                     "Fuso hor\u00e1rio de ver\u00e3o do Chile", "CLST"};
-    String CST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central", "CST",
-                     "Hor\u00e1rio de luz natural central", "CDT"};
-    String CTT[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da China", "CST",
-                     "Hor\u00e1rio de luz natural da China", "CDT"};
-    String CUBA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Cuba", "CST",
-                      "Hor\u00e1rio de luz natural de Cuba", "CDT"};
-    String DARWIN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Territ\u00f3rio do Norte)", "CST",
-                    "Fuso hor\u00e1rio de ver\u00e3o central (Territ\u00f3rio do Norte)", "CST"};
-    String DUBLIN[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT",
-                    "Fuso hor\u00e1rio de ver\u00e3o da Irlanda", "IST"};
-    String EAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Oriental", "EAT",
-                     "Fuso hor\u00e1rio padr\u00e3o da \u00c1frica Oriental", "EAST"};
-    String EASTER[] = new String[] {"Fuso hor\u00e1rio da Ilha de P\u00e1scoa", "EAST",
-                    "Fuso hor\u00e1rio de ver\u00e3o da Ilha de P\u00e1scoa", "EASST"};
-    String EET[] = new String[] {"Fuso hor\u00e1rio da Europa Oriental", "EET",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Europa Oriental", "EEST"};
-    String EGT[] = new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Oriental", "EGT",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Oriental", "EGST"};
-    String EST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST",
-                     "Hor\u00e1rio de luz natural oriental", "EDT"};
-    String EST_NSW[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Nova Gales do Sul)", "EST",
-                     "Fuso hor\u00e1rio de ver\u00e3o oriental (Nova Gales do Sul)", "EST"};
-    String GHMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Gana", "GMT",
-                     "Fuso hor\u00e1rio de ver\u00e3o de Gana", "GHST"};
-    String GAMBIER[] =  new String[] {"Fuso hor\u00e1rio de Gambier", "GAMT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Gambier", "GAMST"};
-    String GMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT",
-                     "Fuso hor\u00e1rio do meridiano de Greenwich", "GMT"};
-    String GMTBST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT",
-                    "Fuso hor\u00e1rio de ver\u00e3o da Gr\u00e3-Bretanha", "BST"};
-    String GST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do golfo", "GST",
-                     "Hor\u00e1rio de luz natural do golfo", "GDT"};
-    String HAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed-Aleutian", "HAST",
-                      "Hor\u00e1rio de luz natural do Hava\u00ed-Aleutian", "HADT"};
-    String HKT[] =  new String[] {"Fuso hor\u00e1rio de Hong Kong", "HKT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Hong Kong", "HKST"};
-    String HST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed", "HST",
-                     "Hor\u00e1rio de luz natural do Hava\u00ed", "HDT"};
-    String ICT[] = new String[] {"Fuso hor\u00e1rio da Indochina", "ICT",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Indochina", "ICST"};
-    String IRT[] = new String[] {"Fuso hor\u00e1rio do Ir\u00e3", "IRST",
-                     "Hor\u00e1rio de luz natural do Ir\u00e3", "IRDT"};
-    String ISRAEL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Israel", "IST",
-                    "Hor\u00e1rio de luz natural de Israel", "IDT"};
-    String IST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00cdndia", "IST",
-                     "Hor\u00e1rio de luz natural da \u00cdndia", "IDT"};
-    String JST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Jap\u00e3o", "JST",
-                     "Hor\u00e1rio de luz natural do Jap\u00e3o", "JDT"};
-    String KST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Coreia", "KST",
-                     "Hor\u00e1rio de luz natural da Coreia", "KDT"};
-    String LORD_HOWE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Lord Howe", "LHST",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Lord Howe", "LHST"};
-    String MHT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Marshall", "MHT",
-                     "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marshall", "MHST"};
-    String MSK[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Moscou", "MSK",
-                     "Hor\u00e1rio de luz natural de Moscou", "MSD"};
-    String MST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o das montanhas", "MST",
-                     "Hor\u00e1rio de luz natural das montanhas", "MDT"};
-    String MYT[] = new String[] {"Fuso hor\u00e1rio da Mal\u00e1sia", "MYT",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Mal\u00e1sia", "MYST"};
-    String NORONHA[] = new String[] {"Fuso hor\u00e1rio de Fernando de Noronha", "FNT",
-                     "Fuso hor\u00e1rio de ver\u00e3o de Fernando de Noronha", "FNST"};
-    String NOVT[] = new String[] {"Fuso hor\u00e1rio de Novosibirsk", "NOVT",
-                    "Fuso hor\u00e1rio de ver\u00e3o de Novosibirsk", "NOVST"};
+        String ACT[] = new String[] {"Fuso hor\u00e1rio do Acre", "ACT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o do Acre", "ACST"};
+        String ADELAIDE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul)", "CST",
+                                          "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul)", "CST"};
+        String AGT[] = new String[] {"Fuso hor\u00e1rio da Argentina", "ART",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Argentina", "ARST"};
+        String AKST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Alaska", "AKST",
+                                      "Hor\u00e1rio de luz natural do Alaska", "AKDT"};
+        String AMT[] = new String[] {"Fuso hor\u00e1rio do Amazonas", "AMT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o do Amazonas", "AMST"};
+        String ARAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ar\u00e1bia", "AST",
+                                       "Hor\u00e1rio de luz natural da Ar\u00e1bia", "ADT"};
+        String ARMT[] = new String[] {"Fuso hor\u00e1rio da Arm\u00eania", "AMT",
+                                      "Fuso hor\u00e1rio de ver\u00e3o da Arm\u00eania", "AMST"};
+        String AST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Atl\u00e2ntico", "AST",
+                                     "Hor\u00e1rio de luz natural do Atl\u00e2ntico", "ADT"};
+        String BDT[] = new String[] {"Fuso hor\u00e1rio de Bangladesh", "BDT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o de Bangladesh", "BDST"};
+        String BRISBANE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Queensland)", "EST",
+                                          "Fuso hor\u00e1rio de ver\u00e3o oriental (Queensland)", "EST"};
+        String BROKEN_HILL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST",
+                                             "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST"};
+        String BRT[] = new String[] {"Fuso hor\u00e1rio de Bras\u00edlia", "BRT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o de Bras\u00edlia", "BRST"};
+        String BTT[] = new String[] {"Fuso hor\u00e1rio de But\u00e3o", "BTT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o de But\u00e3o", "BTST"};
+        String CAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Central", "CAT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Central", "CAST"};
+        String CET[] = new String[] {"Fuso hor\u00e1rio da Europa Central", "CET",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST"};
+        String CHAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chatham", "CHAST",
+                                       "Hor\u00e1rio de luz natural de Chatham", "CHADT"};
+        String CIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Central", "CIT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Central", "CIST"};
+        String CLT[] = new String[] {"Fuso hor\u00e1rio do Chile", "CLT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o do Chile", "CLST"};
+        String CST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central", "CST",
+                                     "Hor\u00e1rio de luz natural central", "CDT"};
+        String CTT[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da China", "CST",
+                                     "Hor\u00e1rio de luz natural da China", "CDT"};
+        String CUBA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Cuba", "CST",
+                                      "Hor\u00e1rio de luz natural de Cuba", "CDT"};
+        String DARWIN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Territ\u00f3rio do Norte)", "CST",
+                                        "Fuso hor\u00e1rio de ver\u00e3o central (Territ\u00f3rio do Norte)", "CST"};
+        String DUBLIN[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT",
+                                        "Fuso hor\u00e1rio de ver\u00e3o da Irlanda", "IST"};
+        String EAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Oriental", "EAT",
+                                     "Fuso hor\u00e1rio padr\u00e3o da \u00c1frica Oriental", "EAST"};
+        String EASTER[] = new String[] {"Fuso hor\u00e1rio da Ilha de P\u00e1scoa", "EAST",
+                                        "Fuso hor\u00e1rio de ver\u00e3o da Ilha de P\u00e1scoa", "EASST"};
+        String EET[] = new String[] {"Fuso hor\u00e1rio da Europa Oriental", "EET",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Europa Oriental", "EEST"};
+        String EGT[] = new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Oriental", "EGT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Oriental", "EGST"};
+        String EST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST",
+                                     "Hor\u00e1rio de luz natural oriental", "EDT"};
+        String EST_NSW[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Nova Gales do Sul)", "EST",
+                                         "Fuso hor\u00e1rio de ver\u00e3o oriental (Nova Gales do Sul)", "EST"};
+        String GHMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Gana", "GMT",
+                                      "Fuso hor\u00e1rio de ver\u00e3o de Gana", "GHST"};
+        String GAMBIER[] =  new String[] {"Fuso hor\u00e1rio de Gambier", "GAMT",
+                                          "Fuso hor\u00e1rio de ver\u00e3o de Gambier", "GAMST"};
+        String GMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT",
+                                     "Fuso hor\u00e1rio do meridiano de Greenwich", "GMT"};
+        String GMTBST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT",
+                                        "Fuso hor\u00e1rio de ver\u00e3o da Gr\u00e3-Bretanha", "BST"};
+        String GST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do golfo", "GST",
+                                     "Hor\u00e1rio de luz natural do golfo", "GDT"};
+        String HAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed-Aleutian", "HAST",
+                                      "Hor\u00e1rio de luz natural do Hava\u00ed-Aleutian", "HADT"};
+        String HKT[] =  new String[] {"Fuso hor\u00e1rio de Hong Kong", "HKT",
+                                      "Fuso hor\u00e1rio de ver\u00e3o de Hong Kong", "HKST"};
+        String HST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed", "HST",
+                                     "Hor\u00e1rio de luz natural do Hava\u00ed", "HDT"};
+        String ICT[] = new String[] {"Fuso hor\u00e1rio da Indochina", "ICT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Indochina", "ICST"};
+        String IRT[] = new String[] {"Fuso hor\u00e1rio do Ir\u00e3", "IRST",
+                                     "Hor\u00e1rio de luz natural do Ir\u00e3", "IRDT"};
+        String ISRAEL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Israel", "IST",
+                                        "Hor\u00e1rio de luz natural de Israel", "IDT"};
+        String IST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00cdndia", "IST",
+                                     "Hor\u00e1rio de luz natural da \u00cdndia", "IDT"};
+        String JST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Jap\u00e3o", "JST",
+                                     "Hor\u00e1rio de luz natural do Jap\u00e3o", "JDT"};
+        String KST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Coreia", "KST",
+                                     "Hor\u00e1rio de luz natural da Coreia", "KDT"};
+        String LORD_HOWE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Lord Howe", "LHST",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Lord Howe", "LHST"};
+        String MHT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Marshall", "MHT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marshall", "MHST"};
+        String MSK[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Moscou", "MSK",
+                                     "Hor\u00e1rio de luz natural de Moscou", "MSD"};
+        String MST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o das montanhas", "MST",
+                                     "Hor\u00e1rio de luz natural das montanhas", "MDT"};
+        String MYT[] = new String[] {"Fuso hor\u00e1rio da Mal\u00e1sia", "MYT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Mal\u00e1sia", "MYST"};
+        String NORONHA[] = new String[] {"Fuso hor\u00e1rio de Fernando de Noronha", "FNT",
+                                         "Fuso hor\u00e1rio de ver\u00e3o de Fernando de Noronha", "FNST"};
+        String NOVT[] = new String[] {"Fuso hor\u00e1rio de Novosibirsk", "NOVT",
+                                      "Fuso hor\u00e1rio de ver\u00e3o de Novosibirsk", "NOVST"};
         String NPT[] = new String[] {"Fuso hor\u00e1rio do Nepal", "NPT",
                                      "Fuso hor\u00e1rio de ver\u00e3o do Nepal", "NPST"};
-    String NST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Terra Nova", "NST",
-                     "Hor\u00e1rio de luz natural de Terra Nova", "NDT"};
-    String NZST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Nova Zel\u00e2ndia", "NZST",
-                      "Hor\u00e1rio de luz natural da Nova Zel\u00e2ndia", "NZDT"};
+        String NST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Terra Nova", "NST",
+                                     "Hor\u00e1rio de luz natural de Terra Nova", "NDT"};
+        String NZST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Nova Zel\u00e2ndia", "NZST",
+                                      "Hor\u00e1rio de luz natural da Nova Zel\u00e2ndia", "NZDT"};
         String PITCAIRN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Pitcairn", "PST",
-                          "Hor\u00e1rio de luz natural de Pitcairn", "PDT"};
-    String PKT[] = new String[] {"Fuso hor\u00e1rio do Paquist\u00e3o", "PKT",
-                     "Fuso hor\u00e1rio de ver\u00e3o do Paquist\u00e3o", "PKST"};
-    String PONT[] = new String[] {"Fuso hor\u00e1rio de Pohnpei", "PONT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Pohnpei", "PONST"};
-    String PST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Pac\u00edfico", "PST",
-                     "Hor\u00e1rio de luz natural do Pac\u00edfico", "PDT"};
+                                          "Hor\u00e1rio de luz natural de Pitcairn", "PDT"};
+        String PKT[] = new String[] {"Fuso hor\u00e1rio do Paquist\u00e3o", "PKT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o do Paquist\u00e3o", "PKST"};
+        String PONT[] = new String[] {"Fuso hor\u00e1rio de Pohnpei", "PONT",
+                                      "Fuso hor\u00e1rio de ver\u00e3o de Pohnpei", "PONST"};
+        String PST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Pac\u00edfico", "PST",
+                                     "Hor\u00e1rio de luz natural do Pac\u00edfico", "PDT"};
         String RST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST",
                                      "Hor\u00e1rio de luz natural central", "CDT"};
-    String SAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00c1frica do Sul", "SAST",
-                      "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica do Sul", "SAST"};
-    String SBT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Salom\u00e3o", "SBT",
-                     "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Salom\u00e3o", "SBST"};
-    String SGT[] = new String[] {"Fuso hor\u00e1rio de Cingapura", "SGT",
-                     "Fuso hor\u00e1rio de ver\u00e1 de Cingapura", "SGST"};
-    String SLST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Serra Leoa", "SLST"};
-    String TASMANIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Tasm\u00e2nia)", "EST",
-                      "Fuso hor\u00e1rio de ver\u00e3o oriental (Tasm\u00e2nia)", "EST"};
-    String TMT[] = new String[] {"Fuso hor\u00e1rio do Turcomenist\u00e3o", "TMT",
-                     "Fuso hor\u00e1rio de ver\u00e3o do Turcomenist\u00e3o", "TMST"};
-    String TRUT[] = new String[] {"Fuso hor\u00e1rio de Chuuk", "CHUT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Chuuk", "CHUST"};
-    String ULAT[]= new String[] {"Fuso hor\u00e1rio de Ulan Bator", "ULAT",
-                     "Fuso hor\u00e1rio de ver\u00e3o de Ulan Bator", "ULAST"};
-    String WAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Ocidental", "WAT",
-                     "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Ocidental", "WAST"};
-    String WET[] = new String[] {"Fuso hor\u00e1rio da Europa Ocidental", "WET",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Europa Ocidental", "WEST"};
-    String WIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Ocidental", "WIT",
-                     "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Ocidental", "WIST"};
-    String WST_AUS[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o ocidental (Austr\u00e1lia)", "WST",
-                     "Fuso hor\u00e1rio de ver\u00e3o ocidental (Austr\u00e1lia)", "WST"};
-    String SAMOA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Samoa", "SST",
-                       "Hor\u00e1rio de luz natural de Samoa", "SDT"};
-    String WST_SAMOA[] = new String[] {"Fuso hor\u00e1rio de Samoa Ocidental", "WST",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Samoa Ocidental", "WSST"};
-    String ChST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chamorro", "ChST",
-                      "Hor\u00e1rio de luz natural de Chamorro", "ChDT"};
-    String VICTORIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Victoria)", "EST",
-                      "Fuso hor\u00e1rio de ver\u00e3o oriental (Victoria)", "EST"};
-    String UTC[] = new String[] {"Tempo universal coordenado", "UTC",
-                      "Tempo universal coordenado", "UTC"};
-    String UZT[] = new String[] {"Fuso hor\u00e1rio do Uzbequist\u00e3o", "UZT",
-                     "Fuso hor\u00e1rio de ver\u00e3o do Uzbequist\u00e3o", "UZST"};
-    String WART[] = new String[] {"Fuso hor\u00e1rio da Argentina Ocidental", "WART",
-                      "Fuso hor\u00e1rio de ver\u00e3o da Argentina Ocidental", "WARST"};
+        String SAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00c1frica do Sul", "SAST",
+                                      "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica do Sul", "SAST"};
+        String SBT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Salom\u00e3o", "SBT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Salom\u00e3o", "SBST"};
+        String SGT[] = new String[] {"Fuso hor\u00e1rio de Cingapura", "SGT",
+                                     "Fuso hor\u00e1rio de ver\u00e1 de Cingapura", "SGST"};
+        String SLST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT",
+                                      "Fuso hor\u00e1rio de ver\u00e3o de Serra Leoa", "SLST"};
+        String TASMANIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Tasm\u00e2nia)", "EST",
+                                          "Fuso hor\u00e1rio de ver\u00e3o oriental (Tasm\u00e2nia)", "EST"};
+        String TMT[] = new String[] {"Fuso hor\u00e1rio do Turcomenist\u00e3o", "TMT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o do Turcomenist\u00e3o", "TMST"};
+        String TRUT[] = new String[] {"Fuso hor\u00e1rio de Chuuk", "CHUT",
+                                      "Fuso hor\u00e1rio de ver\u00e3o de Chuuk", "CHUST"};
+        String ULAT[]= new String[] {"Fuso hor\u00e1rio de Ulan Bator", "ULAT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o de Ulan Bator", "ULAST"};
+        String WAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Ocidental", "WAT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Ocidental", "WAST"};
+        String WET[] = new String[] {"Fuso hor\u00e1rio da Europa Ocidental", "WET",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Europa Ocidental", "WEST"};
+        String WIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Ocidental", "WIT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Ocidental", "WIST"};
+        String WST_AUS[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o ocidental (Austr\u00e1lia)", "WST",
+                                         "Fuso hor\u00e1rio de ver\u00e3o ocidental (Austr\u00e1lia)", "WST"};
+        String SAMOA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Samoa", "SST",
+                                       "Hor\u00e1rio de luz natural de Samoa", "SDT"};
+        String WST_SAMOA[] = new String[] {"Fuso hor\u00e1rio de Samoa Ocidental", "WST",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Samoa Ocidental", "WSST"};
+        String ChST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chamorro", "ChST",
+                                      "Hor\u00e1rio de luz natural de Chamorro", "ChDT"};
+        String VICTORIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Victoria)", "EST",
+                                          "Fuso hor\u00e1rio de ver\u00e3o oriental (Victoria)", "EST"};
+        String UTC[] = new String[] {"Tempo universal coordenado", "UTC",
+                                     "Tempo universal coordenado", "UTC"};
+        String UZT[] = new String[] {"Fuso hor\u00e1rio do Uzbequist\u00e3o", "UZT",
+                                     "Fuso hor\u00e1rio de ver\u00e3o do Uzbequist\u00e3o", "UZST"};
+        String WART[] = new String[] {"Fuso hor\u00e1rio da Argentina Ocidental", "WART",
+                                      "Fuso hor\u00e1rio de ver\u00e3o da Argentina Ocidental", "WARST"};
 
-
-    return new Object[][] {
-        {"America/Los_Angeles", PST},
-        {"PST", PST},
-        {"America/Denver", MST},
-        {"MST", MST},
-        {"America/Phoenix", MST},
-        {"PNT", MST},
-        {"America/Chicago", CST},
-        {"CST", CST},
-        {"America/New_York", EST},
-        {"EST", EST},
-        {"America/Indianapolis", EST},
-        {"IET", EST},
-        {"Pacific/Honolulu", HST},
-        {"HST", HST},
-        {"America/Anchorage", AKST},
-        {"AST", AKST},
-        {"America/Halifax", AST},
-        {"America/Sitka", AKST},
-        {"America/St_Johns", NST},
-        {"CNT", NST},
-        {"Europe/Paris", CET},
-        {"ECT", CET},
-        {"GMT", GMT},
-        {"Africa/Casablanca", WET},
-        {"Asia/Jerusalem", ISRAEL},
-        {"Asia/Tokyo", JST},
-        {"JST", JST},
-        {"Europe/Bucharest", EET},
-        {"Asia/Shanghai", CTT},
-        {"CTT", CTT},
-        /* Don't change the order of the above zones
-         * to keep compatibility with the previous version.
-         */
+        return new Object[][] {
+            {"America/Los_Angeles", PST},
+            {"PST", PST},
+            {"America/Denver", MST},
+            {"MST", MST},
+            {"America/Phoenix", MST},
+            {"PNT", MST},
+            {"America/Chicago", CST},
+            {"CST", CST},
+            {"America/New_York", EST},
+            {"EST", EST},
+            {"America/Indianapolis", EST},
+            {"IET", EST},
+            {"Pacific/Honolulu", HST},
+            {"HST", HST},
+            {"America/Anchorage", AKST},
+            {"AST", AKST},
+            {"America/Halifax", AST},
+            {"America/Sitka", AKST},
+            {"America/St_Johns", NST},
+            {"CNT", NST},
+            {"Europe/Paris", CET},
+            {"ECT", CET},
+            {"GMT", GMT},
+            {"Africa/Casablanca", WET},
+            {"Asia/Jerusalem", ISRAEL},
+            {"Asia/Tokyo", JST},
+            {"JST", JST},
+            {"Europe/Bucharest", EET},
+            {"Asia/Shanghai", CTT},
+            {"CTT", CTT},
+            /* Don't change the order of the above zones
+             * to keep compatibility with the previous version.
+             */
 
-        {"ACT", DARWIN},
-        {"AET", EST_NSW},
-        {"AGT", AGT},
-        {"ART", EET},
-        {"Africa/Abidjan", GMT},
-        {"Africa/Accra", GHMT},
-        {"Africa/Addis_Ababa", EAT},
-        {"Africa/Algiers", CET},
-        {"Africa/Asmara", EAT},
-        {"Africa/Asmera", EAT},
-        {"Africa/Bamako", GMT},
-        {"Africa/Bangui", WAT},
-        {"Africa/Banjul", GMT},
-        {"Africa/Bissau", GMT},
-        {"Africa/Blantyre", CAT},
-        {"Africa/Brazzaville", WAT},
-        {"Africa/Bujumbura", CAT},
-        {"Africa/Cairo", EET},
-        {"Africa/Ceuta", CET},
-        {"Africa/Conakry", GMT},
-        {"Africa/Dakar", GMT},
-        {"Africa/Dar_es_Salaam", EAT},
-        {"Africa/Djibouti", EAT},
-        {"Africa/Douala", WAT},
-        {"Africa/El_Aaiun", WET},
-        {"Africa/Freetown", SLST},
-        {"Africa/Gaborone", CAT},
-        {"Africa/Harare", CAT},
-        {"Africa/Johannesburg", SAST},
-        {"Africa/Kampala", EAT},
-        {"Africa/Khartoum", EAT},
-        {"Africa/Kigali", CAT},
-        {"Africa/Kinshasa", WAT},
-        {"Africa/Lagos", WAT},
-        {"Africa/Libreville", WAT},
-        {"Africa/Lome", GMT},
-        {"Africa/Luanda", WAT},
-        {"Africa/Lubumbashi", CAT},
-        {"Africa/Lusaka", CAT},
-        {"Africa/Malabo", WAT},
-        {"Africa/Maputo", CAT},
-        {"Africa/Maseru", SAST},
-        {"Africa/Mbabane", SAST},
-        {"Africa/Mogadishu", EAT},
-        {"Africa/Monrovia", GMT},
-        {"Africa/Nairobi", EAT},
-        {"Africa/Ndjamena", WAT},
-        {"Africa/Niamey", WAT},
-        {"Africa/Nouakchott", GMT},
-        {"Africa/Ouagadougou", GMT},
-        {"Africa/Porto-Novo", WAT},
-        {"Africa/Sao_Tome", GMT},
-        {"Africa/Timbuktu", GMT},
-        {"Africa/Tripoli", EET},
-        {"Africa/Tunis", CET},
-        {"Africa/Windhoek", WAT},
-        {"America/Adak", HAST},
-        {"America/Anguilla", AST},
-        {"America/Antigua", AST},
-        {"America/Araguaina", BRT},
-        {"America/Argentina/Buenos_Aires", AGT},
-        {"America/Argentina/Catamarca", AGT},
-        {"America/Argentina/ComodRivadavia", AGT},
-        {"America/Argentina/Cordoba", AGT},
-        {"America/Argentina/Jujuy", AGT},
-        {"America/Argentina/La_Rioja", AGT},
-        {"America/Argentina/Mendoza", AGT},
-        {"America/Argentina/Rio_Gallegos", AGT},
-        {"America/Argentina/Salta", AGT},
-        {"America/Argentina/San_Juan", AGT},
-        {"America/Argentina/San_Luis", WART},
-        {"America/Argentina/Tucuman", AGT},
-        {"America/Argentina/Ushuaia", AGT},
-        {"America/Aruba", AST},
-        {"America/Asuncion", new String[] {"Fuso hor\u00e1rio do Paraguai", "PYT",
-                           "Fuso hor\u00e1rio de ver\u00e3o do Paraguai", "PYST"}},
+            {"ACT", DARWIN},
+            {"AET", EST_NSW},
+            {"AGT", AGT},
+            {"ART", EET},
+            {"Africa/Abidjan", GMT},
+            {"Africa/Accra", GHMT},
+            {"Africa/Addis_Ababa", EAT},
+            {"Africa/Algiers", CET},
+            {"Africa/Asmara", EAT},
+            {"Africa/Asmera", EAT},
+            {"Africa/Bamako", GMT},
+            {"Africa/Bangui", WAT},
+            {"Africa/Banjul", GMT},
+            {"Africa/Bissau", GMT},
+            {"Africa/Blantyre", CAT},
+            {"Africa/Brazzaville", WAT},
+            {"Africa/Bujumbura", CAT},
+            {"Africa/Cairo", EET},
+            {"Africa/Ceuta", CET},
+            {"Africa/Conakry", GMT},
+            {"Africa/Dakar", GMT},
+            {"Africa/Dar_es_Salaam", EAT},
+            {"Africa/Djibouti", EAT},
+            {"Africa/Douala", WAT},
+            {"Africa/El_Aaiun", WET},
+            {"Africa/Freetown", SLST},
+            {"Africa/Gaborone", CAT},
+            {"Africa/Harare", CAT},
+            {"Africa/Johannesburg", SAST},
+            {"Africa/Kampala", EAT},
+            {"Africa/Khartoum", EAT},
+            {"Africa/Kigali", CAT},
+            {"Africa/Kinshasa", WAT},
+            {"Africa/Lagos", WAT},
+            {"Africa/Libreville", WAT},
+            {"Africa/Lome", GMT},
+            {"Africa/Luanda", WAT},
+            {"Africa/Lubumbashi", CAT},
+            {"Africa/Lusaka", CAT},
+            {"Africa/Malabo", WAT},
+            {"Africa/Maputo", CAT},
+            {"Africa/Maseru", SAST},
+            {"Africa/Mbabane", SAST},
+            {"Africa/Mogadishu", EAT},
+            {"Africa/Monrovia", GMT},
+            {"Africa/Nairobi", EAT},
+            {"Africa/Ndjamena", WAT},
+            {"Africa/Niamey", WAT},
+            {"Africa/Nouakchott", GMT},
+            {"Africa/Ouagadougou", GMT},
+            {"Africa/Porto-Novo", WAT},
+            {"Africa/Sao_Tome", GMT},
+            {"Africa/Timbuktu", GMT},
+            {"Africa/Tripoli", EET},
+            {"Africa/Tunis", CET},
+            {"Africa/Windhoek", WAT},
+            {"America/Adak", HAST},
+            {"America/Anguilla", AST},
+            {"America/Antigua", AST},
+            {"America/Araguaina", BRT},
+            {"America/Argentina/Buenos_Aires", AGT},
+            {"America/Argentina/Catamarca", AGT},
+            {"America/Argentina/ComodRivadavia", AGT},
+            {"America/Argentina/Cordoba", AGT},
+            {"America/Argentina/Jujuy", AGT},
+            {"America/Argentina/La_Rioja", AGT},
+            {"America/Argentina/Mendoza", AGT},
+            {"America/Argentina/Rio_Gallegos", AGT},
+            {"America/Argentina/Salta", AGT},
+            {"America/Argentina/San_Juan", AGT},
+            {"America/Argentina/San_Luis", WART},
+            {"America/Argentina/Tucuman", AGT},
+            {"America/Argentina/Ushuaia", AGT},
+            {"America/Aruba", AST},
+            {"America/Asuncion", new String[] {"Fuso hor\u00e1rio do Paraguai", "PYT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o do Paraguai", "PYST"}},
             {"America/Atikokan", EST},
-        {"America/Atka", HAST},
-        {"America/Bahia", BRT},
-        {"America/Bahia_Banderas", CST},
-        {"America/Barbados", AST},
-        {"America/Belem", BRT},
-        {"America/Belize", CST},
+            {"America/Atka", HAST},
+            {"America/Bahia", BRT},
+            {"America/Bahia_Banderas", CST},
+            {"America/Barbados", AST},
+            {"America/Belem", BRT},
+            {"America/Belize", CST},
             {"America/Blanc-Sablon", AST},
-        {"America/Boa_Vista", AMT},
-        {"America/Bogota", new String[] {"Fuso hor\u00e1rio da Col\u00f4mbia", "COT",
-                         "Fuso hor\u00e1rio de ver\u00e3o da Col\u00f4mbia", "COST"}},
-        {"America/Boise", MST},
-        {"America/Buenos_Aires", AGT},
-        {"America/Cambridge_Bay", MST},
-        {"America/Campo_Grande", AMT},
-        {"America/Cancun", CST},
-        {"America/Caracas", new String[] {"Fuso hor\u00e1rio da Venezuela", "VET",
-                          "Fuso hor\u00e1rio de ver\u00e3o da Venezuela", "VEST"}},
-        {"America/Catamarca", AGT},
-        {"America/Cayenne", new String[] {"Fuso hor\u00e1rio da Guiana Francesa", "GFT",
-                          "Fuso hor\u00e1rio de ver\u00e3o da Guiana Francesa", "GFST"}},
-        {"America/Cayman", EST},
-        {"America/Chihuahua", MST},
-        {"America/Coral_Harbour", EST},
-        {"America/Cordoba", AGT},
-        {"America/Costa_Rica", CST},
-        {"America/Cuiaba", AMT},
-        {"America/Curacao", AST},
-        {"America/Danmarkshavn", GMT},
-        {"America/Dawson", PST},
-        {"America/Dawson_Creek", MST},
-        {"America/Detroit", EST},
-        {"America/Dominica", AST},
-        {"America/Edmonton", MST},
-        {"America/Eirunepe", AMT},
-        {"America/El_Salvador", CST},
-        {"America/Ensenada", PST},
-        {"America/Fort_Wayne", EST},
-        {"America/Fortaleza", BRT},
-        {"America/Glace_Bay", AST},
-        {"America/Godthab", new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Ocidental", "WGT",
-                          "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Ocidental", "WGST"}},
-        {"America/Goose_Bay", AST},
-        {"America/Grand_Turk", EST},
-        {"America/Grenada", AST},
-        {"America/Guadeloupe", AST},
-        {"America/Guatemala", CST},
-        {"America/Guayaquil", new String[] {"Fuso hor\u00e1rio do Equador", "ECT",
-                        "Fuso hor\u00e1rio de ver\u00e3o do Equador", "ECST"}},
-        {"America/Guyana", new String[] {"Fuso hor\u00e1rio da Guiana", "GYT",
-                         "Fuso hor\u00e1rio de ver\u00e3o da Guiana", "GYST"}},
-        {"America/Havana", CUBA},
-        {"America/Hermosillo", MST},
-        {"America/Indiana/Indianapolis", EST},
-        {"America/Indiana/Knox", CST},
-        {"America/Indiana/Marengo", EST},
-        {"America/Indiana/Petersburg", EST},
-        {"America/Indiana/Tell_City", CST},
-        {"America/Indiana/Vevay", EST},
-        {"America/Indiana/Vincennes", EST},
-        {"America/Indiana/Winamac", EST},
-        {"America/Inuvik", MST},
-        {"America/Iqaluit", EST},
-        {"America/Jamaica", EST},
-        {"America/Jujuy", AGT},
-        {"America/Juneau", AKST},
-        {"America/Kentucky/Louisville", EST},
-        {"America/Kentucky/Monticello", EST},
-        {"America/Knox_IN", CST},
-        {"America/La_Paz", new String[] {"Fuso hor\u00e1rio da Bol\u00edvia", "BOT",
-                         "Fuso hor\u00e1rio de ver\u00e3o da Bol\u00edvia", "BOST"}},
-        {"America/Lima", new String[] {"Fuso hor\u00e1rio do Peru", "PET",
-                       "Fuso hor\u00e1rio de ver\u00e3o do Peru", "PEST"}},
-        {"America/Louisville", EST},
-        {"America/Maceio", BRT},
-        {"America/Managua", CST},
-        {"America/Manaus", AMT},
-        {"America/Marigot", AST},
-        {"America/Martinique", AST},
-        {"America/Mazatlan", MST},
-        {"America/Mendoza", AGT},
-        {"America/Menominee", CST},
-        {"America/Merida", CST},
-        {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
-                                             "Metlakatla Daylight Time", "MeDT"}},
-        {"America/Mexico_City", CST},
-        {"America/Miquelon", new String[] {"Fuso hor\u00e1rio padr\u00e3o de S\u00e3o Pedro e Miquelon", "PMST",
-                           "Hor\u00e1rio de luz natural de S\u00e3o Pedro e Miquelon", "PMDT"}},
-        {"America/Moncton", AST},
-        {"America/Montevideo", new String[] {"Fuso hor\u00e1rio do Uruguai", "UYT",
-                         "Fuso hor\u00e1rio de ver\u00e3o do Uruguai", "UYST"}},
-        {"America/Monterrey", CST},
-        {"America/Montreal", EST},
-        {"America/Montserrat", AST},
-        {"America/Nassau", EST},
-        {"America/Nipigon", EST},
-        {"America/Nome", AKST},
-        {"America/Noronha", NORONHA},
+            {"America/Boa_Vista", AMT},
+            {"America/Bogota", new String[] {"Fuso hor\u00e1rio da Col\u00f4mbia", "COT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o da Col\u00f4mbia", "COST"}},
+            {"America/Boise", MST},
+            {"America/Buenos_Aires", AGT},
+            {"America/Cambridge_Bay", MST},
+            {"America/Campo_Grande", AMT},
+            {"America/Cancun", CST},
+            {"America/Caracas", new String[] {"Fuso hor\u00e1rio da Venezuela", "VET",
+                                              "Fuso hor\u00e1rio de ver\u00e3o da Venezuela", "VEST"}},
+            {"America/Catamarca", AGT},
+            {"America/Cayenne", new String[] {"Fuso hor\u00e1rio da Guiana Francesa", "GFT",
+                                              "Fuso hor\u00e1rio de ver\u00e3o da Guiana Francesa", "GFST"}},
+            {"America/Cayman", EST},
+            {"America/Chihuahua", MST},
+            {"America/Coral_Harbour", EST},
+            {"America/Cordoba", AGT},
+            {"America/Costa_Rica", CST},
+            {"America/Cuiaba", AMT},
+            {"America/Curacao", AST},
+            {"America/Danmarkshavn", GMT},
+            {"America/Dawson", PST},
+            {"America/Dawson_Creek", MST},
+            {"America/Detroit", EST},
+            {"America/Dominica", AST},
+            {"America/Edmonton", MST},
+            {"America/Eirunepe", AMT},
+            {"America/El_Salvador", CST},
+            {"America/Ensenada", PST},
+            {"America/Fort_Wayne", EST},
+            {"America/Fortaleza", BRT},
+            {"America/Glace_Bay", AST},
+            {"America/Godthab", new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Ocidental", "WGT",
+                                              "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Ocidental", "WGST"}},
+            {"America/Goose_Bay", AST},
+            {"America/Grand_Turk", EST},
+            {"America/Grenada", AST},
+            {"America/Guadeloupe", AST},
+            {"America/Guatemala", CST},
+            {"America/Guayaquil", new String[] {"Fuso hor\u00e1rio do Equador", "ECT",
+                                                "Fuso hor\u00e1rio de ver\u00e3o do Equador", "ECST"}},
+            {"America/Guyana", new String[] {"Fuso hor\u00e1rio da Guiana", "GYT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o da Guiana", "GYST"}},
+            {"America/Havana", CUBA},
+            {"America/Hermosillo", MST},
+            {"America/Indiana/Indianapolis", EST},
+            {"America/Indiana/Knox", CST},
+            {"America/Indiana/Marengo", EST},
+            {"America/Indiana/Petersburg", EST},
+            {"America/Indiana/Tell_City", CST},
+            {"America/Indiana/Vevay", EST},
+            {"America/Indiana/Vincennes", EST},
+            {"America/Indiana/Winamac", EST},
+            {"America/Inuvik", MST},
+            {"America/Iqaluit", EST},
+            {"America/Jamaica", EST},
+            {"America/Jujuy", AGT},
+            {"America/Juneau", AKST},
+            {"America/Kentucky/Louisville", EST},
+            {"America/Kentucky/Monticello", EST},
+            {"America/Knox_IN", CST},
+            {"America/La_Paz", new String[] {"Fuso hor\u00e1rio da Bol\u00edvia", "BOT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o da Bol\u00edvia", "BOST"}},
+            {"America/Lima", new String[] {"Fuso hor\u00e1rio do Peru", "PET",
+                                           "Fuso hor\u00e1rio de ver\u00e3o do Peru", "PEST"}},
+            {"America/Louisville", EST},
+            {"America/Maceio", BRT},
+            {"America/Managua", CST},
+            {"America/Manaus", AMT},
+            {"America/Marigot", AST},
+            {"America/Martinique", AST},
+            {"America/Matamoros", CST},
+            {"America/Mazatlan", MST},
+            {"America/Mendoza", AGT},
+            {"America/Menominee", CST},
+            {"America/Merida", CST},
+            {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST",
+                                                 "Metlakatla Daylight Time", "MeDT"}},
+            {"America/Mexico_City", CST},
+            {"America/Miquelon", new String[] {"Fuso hor\u00e1rio padr\u00e3o de S\u00e3o Pedro e Miquelon", "PMST",
+                                               "Hor\u00e1rio de luz natural de S\u00e3o Pedro e Miquelon", "PMDT"}},
+            {"America/Moncton", AST},
+            {"America/Montevideo", new String[] {"Fuso hor\u00e1rio do Uruguai", "UYT",
+                                                 "Fuso hor\u00e1rio de ver\u00e3o do Uruguai", "UYST"}},
+            {"America/Monterrey", CST},
+            {"America/Montreal", EST},
+            {"America/Montserrat", AST},
+            {"America/Nassau", EST},
+            {"America/Nipigon", EST},
+            {"America/Nome", AKST},
+            {"America/Noronha", NORONHA},
             {"America/North_Dakota/Beulah", CST},
-        {"America/North_Dakota/Center", CST},
+            {"America/North_Dakota/Center", CST},
             {"America/North_Dakota/New_Salem", CST},
-        {"America/Panama", EST},
-        {"America/Pangnirtung", EST},
-        {"America/Paramaribo", new String[] {"Fuso hor\u00e1rio do Suriname", "SRT",
-                         "Fuso hor\u00e1rio de ver\u00e3o do Suriname", "SRST"}},
-        {"America/Port-au-Prince", EST},
-        {"America/Port_of_Spain", AST},
-        {"America/Porto_Acre", AMT},
-        {"America/Porto_Velho", AMT},
-        {"America/Puerto_Rico", AST},
-        {"America/Rainy_River", CST},
-        {"America/Rankin_Inlet", CST},
-        {"America/Recife", BRT},
-        {"America/Regina", CST},
-        {"America/Resolute", RST},
-        {"America/Rio_Branco", AMT},
-        {"America/Rosario", AGT},
-        {"America/Santarem", BRT},
-        {"America/Santiago", CLT},
-        {"America/Santo_Domingo", AST},
-        {"America/Sao_Paulo", BRT},
-        {"America/Scoresbysund", EGT},
-        {"America/Shiprock", MST},
-        {"America/St_Barthelemy", AST},
-        {"America/St_Kitts", AST},
-        {"America/St_Lucia", AST},
-        {"America/St_Thomas", AST},
-        {"America/St_Vincent", AST},
-        {"America/Swift_Current", CST},
-        {"America/Tegucigalpa", CST},
-        {"America/Thule", AST},
-        {"America/Thunder_Bay", EST},
-        {"America/Tijuana", PST},
-        {"America/Toronto", EST},
-        {"America/Tortola", AST},
-        {"America/Vancouver", PST},
-        {"America/Virgin", AST},
-        {"America/Whitehorse", PST},
-        {"America/Winnipeg", CST},
-        {"America/Yakutat", AKST},
-        {"America/Yellowknife", MST},
-        {"Antarctica/Casey", WST_AUS},
-        {"Antarctica/Davis", new String[] {"Fuso hor\u00e1rio de Davis", "DAVT",
-                           "Fuso hor\u00e1rio de ver\u00e3o de Davis", "DAVST"}},
-        {"Antarctica/DumontDUrville", new String[] {"Fuso hor\u00e1rio de Dumont-d'Urville", "DDUT",
-                            "Fuso hor\u00e1rio de ver\u00e3o de Dumont-d'Urville", "DDUST"}},
-        {"Antarctica/Mawson", new String[] {"Fuso hor\u00e1rio de Mawson", "MAWT",
-                        "Fuso hor\u00e1rio de ver\u00e3o de Mawson", "MAWST"}},
-        {"Antarctica/McMurdo", NZST},
-        {"Antarctica/Palmer", CLT},
-        {"Antarctica/Rothera", new String[] {"Fuso hor\u00e1rio de Rothera", "ROTT",
-                         "Fuso hor\u00e1rio de ver\u00e3o de Rothera", "ROTST"}},
-        {"Antarctica/South_Pole", NZST},
-        {"Antarctica/Syowa", new String[] {"Fuso hor\u00e1rio de Syowa", "SYOT",
-                           "Fuso hor\u00e1rio de ver\u00e3o de Syowa", "SYOST"}},
-        {"Antarctica/Vostok", new String[] {"Fuso hor\u00e1rio de Vostok", "VOST",
-                        "Fuso hor\u00e1rio de ver\u00e3o de Vostok", "VOSST"}},
-        {"Arctic/Longyearbyen", CET},
-        {"Asia/Aden", ARAST},
-        {"Asia/Almaty", new String[] {"Fuso hor\u00e1rio de Alma-Ata", "ALMT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Alma-Ata", "ALMST"}},
-        {"Asia/Amman", EET},
-        {"Asia/Anadyr", new String[] {"Fuso hor\u00e1rio de Anadyr", "ANAT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Anadyr", "ANAST"}},
-        {"Asia/Aqtau", new String[] {"Fuso hor\u00e1rio de Aqtau", "AQTT",
-                     "Fuso hor\u00e1rio de ver\u00e3o de Aqtau", "AQTST"}},
-        {"Asia/Aqtobe", new String[] {"Fuso hor\u00e1rio de Aqtobe", "AQTT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Aqtobe", "AQTST"}},
-        {"Asia/Ashgabat", TMT},
-        {"Asia/Ashkhabad", TMT},
-        {"Asia/Baghdad", ARAST},
-        {"Asia/Bahrain", ARAST},
-        {"Asia/Baku", new String[] {"Fuso hor\u00e1rio do Azerbaij\u00e3o", "AZT",
-                    "Fuso hor\u00e1rio de ver\u00e3o do Azerbaij\u00e3o", "AZST"}},
-        {"Asia/Bangkok", ICT},
-        {"Asia/Beirut", EET},
-        {"Asia/Bishkek", new String[] {"Fuso hor\u00e1rio do Quirguist\u00e3o", "KGT",
-                       "Fuso hor\u00e1rio de ver\u00e3o do Quirguist\u00e3o", "KGST"}},
-        {"Asia/Brunei", new String[] {"Fuso hor\u00e1rio de Brunei", "BNT",
-                      "Fuso hor\u00e1rio de ver\u00e3o de Brunei", "BNST"}},
-        {"Asia/Calcutta", IST},
-        {"Asia/Choibalsan", new String[] {"Fuso hor\u00e1rio de Choibalsan", "CHOT",
-                          "Fuso hor\u00e1rio de ver\u00e3o de Choibalsan", "CHOST"}},
-        {"Asia/Chongqing", CTT},
-        {"Asia/Chungking", CTT},
-        {"Asia/Colombo", IST},
-        {"Asia/Dacca", BDT},
-        {"Asia/Dhaka", BDT},
-        {"Asia/Dili", new String[] {"Fuso hor\u00e1rio do Timor-Leste", "TLT",
-                    "Fuso hor\u00e1rio de ver\u00e3o do Timor-Leste", "TLST"}},
-        {"Asia/Damascus", EET},
-        {"Asia/Dubai", GST},
-        {"Asia/Dushanbe", new String[] {"Fuso hor\u00e1rio do Tadjiquist\u00e3o", "TJT",
-                        "Fuso hor\u00e1rio de ver\u00e3o do Tadjiquist\u00e3o", "TJST"}},
-        {"Asia/Gaza", EET},
-        {"Asia/Harbin", CTT},
-        {"Asia/Ho_Chi_Minh", ICT},
-        {"Asia/Hong_Kong", HKT},
-        {"Asia/Hovd", new String[] {"Fuso hor\u00e1rio de Hovd", "HOVT",
-                    "Fuso hor\u00e1rio de ver\u00e3o de Hovd", "HOVST"}},
-        {"Asia/Irkutsk", new String[] {"Fuso hor\u00e1rio de Irkutsk", "IRKT",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Irkutsk", "IRKST"}},
-        {"Asia/Istanbul", EET},
-        {"Asia/Jakarta", WIT},
-        {"Asia/Jayapura", new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Oriental", "EIT",
-                        "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Oriental", "EIST"}},
-        {"Asia/Kabul", new String[] {"Fuso hor\u00e1rio do Afeganist\u00e3o", "AFT",
-                     "Fuso hor\u00e1rio de ver\u00e3o do Afeganist\u00e3o", "AFST"}},
-        {"Asia/Kamchatka", new String[] {"Fuso hor\u00e1rio de Petropavlovsk-Kamchatski", "PETT",
-                         "Fuso hor\u00e1rio de ver\u00e3o de Petropavlovsk-Kamchatski", "PETST"}},
-        {"Asia/Karachi", PKT},
-        {"Asia/Kashgar", CTT},
-        {"Asia/Kathmandu", NPT},
-        {"Asia/Katmandu", NPT},
-        {"Asia/Kolkata", IST},
-        {"Asia/Krasnoyarsk", new String[] {"Fuso hor\u00e1rio de Krasnoyarsk", "KRAT",
-                           "Fuso hor\u00e1rio de ver\u00e3o de Krasnoyarsk", "KRAST"}},
-        {"Asia/Kuala_Lumpur", MYT},
-        {"Asia/Kuching", MYT},
-        {"Asia/Kuwait", ARAST},
-        {"Asia/Macao", CTT},
-        {"Asia/Macau", CTT},
-        {"Asia/Magadan", new String[] {"Fuso hor\u00e1rio de Magadan", "MAGT",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Magadan", "MAGST"}},
-        {"Asia/Makassar", CIT},
-        {"Asia/Manila", new String[] {"Fuso hor\u00e1rio das Filipinas", "PHT",
-                      "Fuso hor\u00e1rio de ver\u00e3o das Filipinas", "PHST"}},
-        {"Asia/Muscat", GST},
-        {"Asia/Nicosia", EET},
-        {"Asia/Novokuznetsk", NOVT},
-        {"Asia/Novosibirsk", NOVT},
-        {"Asia/Oral", new String[] {"Fuso hor\u00e1rio de Uralsk", "ORAT",
-                    "Fuso hor\u00e1rio de ver\u00e3o de Uralsk", "ORAST"}},
-        {"Asia/Omsk", new String[] {"Fuso hor\u00e1rio de Omsk", "OMST",
-                    "Fuso hor\u00e1rio de ver\u00e3o de Omsk", "OMSST"}},
-        {"Asia/Phnom_Penh", ICT},
-        {"Asia/Pontianak", WIT},
-        {"Asia/Pyongyang", KST},
-        {"Asia/Qatar", ARAST},
-        {"Asia/Qyzylorda", new String[] {"Fuso hor\u00e1rio de Kizil-Orda", "QYZT",
-                         "Fuso hor\u00e1rio de ver\u00e3o de Kizil-Orda", "QYZST"}},
-        {"Asia/Rangoon", new String[] {"Fuso hor\u00e1rio de Mianmar", "MMT",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Mianmar", "MMST"}},
-        {"Asia/Riyadh", ARAST},
-        {"Asia/Saigon", ICT},
-        {"Asia/Sakhalin", new String[] {"Fuso hor\u00e1rio de Sakhalina", "SAKT",
-                        "Fuso hor\u00e1rio de ver\u00e3o de Sakhalina", "SAKST"}},
-        {"Asia/Samarkand", UZT},
-        {"Asia/Seoul", KST},
-        {"Asia/Singapore", SGT},
-        {"Asia/Taipei", CTT},
-        {"Asia/Tel_Aviv", ISRAEL},
-        {"Asia/Tashkent", UZT},
-        {"Asia/Tbilisi", new String[] {"Fuso hor\u00e1rio da Ge\u00f3rgia", "GET",
-                       "Fuso hor\u00e1rio de ver\u00e3o da Ge\u00f3rgia", "GEST"}},
-        {"Asia/Tehran", IRT},
-        {"Asia/Thimbu", BTT},
-        {"Asia/Thimphu", BTT},
-        {"Asia/Ujung_Pandang", CIT},
-        {"Asia/Ulaanbaatar", ULAT},
-        {"Asia/Ulan_Bator", ULAT},
-        {"Asia/Urumqi", CTT},
-        {"Asia/Vientiane", ICT},
-        {"Asia/Vladivostok", new String[] {"Fuso hor\u00e1rio de Vladivostok", "VLAT",
-                           "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST"}},
-        {"Asia/Yakutsk", new String[] {"Fuso hor\u00e1rio de Yakutsk", "YAKT",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Yakutsk", "YAKST"}},
-        {"Asia/Yekaterinburg", new String[] {"Fuso hor\u00e1rio de Yekaterinburgo", "YEKT",
-                         "Fuso hor\u00e1rio de ver\u00e3o de Yekaterinburgo", "YEKST"}},
-        {"Asia/Yerevan", ARMT},
-        {"Atlantic/Azores", new String[] {"Fuso hor\u00e1rio das A\u00e7ores", "AZOT",
-                          "Fuso hor\u00e1rio de ver\u00e3o das A\u00e7ores", "AZOST"}},
-        {"Atlantic/Bermuda", AST},
-        {"Atlantic/Canary", WET},
-        {"Atlantic/Cape_Verde", new String[] {"Fuso hor\u00e1rio de Cabo Verde", "CVT",
-                          "Fuso hor\u00e1rio de ver\u00e3o de Cabo Verde", "CVST"}},
-        {"Atlantic/Faeroe", WET},
-        {"Atlantic/Faroe", WET},
-        {"Atlantic/Jan_Mayen", CET},
-        {"Atlantic/Madeira", WET},
-        {"Atlantic/Reykjavik", GMT},
-        {"Atlantic/South_Georgia", new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ge\u00f3rgia do Sul", "GST",
-                             "Hor\u00e1rio de luz natural da Ge\u00f3rgia do Sul", "GDT"}},
-        {"Atlantic/St_Helena", GMT},
-        {"Atlantic/Stanley", new String[] {"Fuso hor\u00e1rio das Ilhas Falkland", "FKT",
-                           "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Falkland", "FKST"}},
-        {"Australia/ACT", EST_NSW},
-        {"Australia/Adelaide", ADELAIDE},
-        {"Australia/Brisbane", BRISBANE},
-        {"Australia/Broken_Hill", BROKEN_HILL},
-        {"Australia/Canberra", EST_NSW},
-        {"Australia/Currie", EST_NSW},
-        {"Australia/Darwin", DARWIN},
-        {"Australia/Eucla", new String[] {"Fuso hor\u00e1rio ocidental central (Austr\u00e1lia)", "CWST",
-                          "Fuso hor\u00e1rio de ver\u00e3o ocidental central (Austr\u00e1lia)", "CWST"}},
-        {"Australia/Hobart", TASMANIA},
-        {"Australia/LHI", LORD_HOWE},
-        {"Australia/Lindeman", BRISBANE},
-        {"Australia/Lord_Howe", LORD_HOWE},
-        {"Australia/Melbourne", VICTORIA},
-        {"Australia/North", DARWIN},
-        {"Australia/NSW", EST_NSW},
-        {"Australia/Perth", WST_AUS},
-        {"Australia/Queensland", BRISBANE},
-        {"Australia/South", ADELAIDE},
-        {"Australia/Sydney", EST_NSW},
-        {"Australia/Tasmania", TASMANIA},
-        {"Australia/Victoria", VICTORIA},
-        {"Australia/West", WST_AUS},
-        {"Australia/Yancowinna", BROKEN_HILL},
-        {"BET", BRT},
-        {"BST", BDT},
-        {"Brazil/Acre", AMT},
-        {"Brazil/DeNoronha", NORONHA},
-        {"Brazil/East", BRT},
-        {"Brazil/West", AMT},
-        {"Canada/Atlantic", AST},
-        {"Canada/Central", CST},
-        {"Canada/East-Saskatchewan", CST},
-        {"Canada/Eastern", EST},
-        {"Canada/Mountain", MST},
-        {"Canada/Newfoundland", NST},
-        {"Canada/Pacific", PST},
-        {"Canada/Yukon", PST},
-        {"Canada/Saskatchewan", CST},
-        {"CAT", CAT},
-        {"CET", CET},
-        {"Chile/Continental", CLT},
-        {"Chile/EasterIsland", EASTER},
-        {"CST6CDT", CST},
-        {"Cuba", CUBA},
-        {"EAT", EAT},
-        {"EET", EET},
-        {"Egypt", EET},
-        {"Eire", DUBLIN},
-        {"EST5EDT", EST},
-        {"Etc/Greenwich", GMT},
-        {"Etc/UCT", UTC},
-        {"Etc/Universal", UTC},
-        {"Etc/UTC", UTC},
-        {"Etc/Zulu", UTC},
-        {"Europe/Amsterdam", CET},
-        {"Europe/Andorra", CET},
-        {"Europe/Athens", EET},
-        {"Europe/Belfast", GMTBST},
-        {"Europe/Belgrade", CET},
-        {"Europe/Berlin", CET},
-        {"Europe/Bratislava", CET},
-        {"Europe/Brussels", CET},
-        {"Europe/Budapest", CET},
-        {"Europe/Chisinau", EET},
-        {"Europe/Copenhagen", CET},
-        {"Europe/Dublin", DUBLIN},
-        {"Europe/Gibraltar", CET},
+            {"America/Ojinaga", MST},
+            {"America/Panama", EST},
+            {"America/Pangnirtung", EST},
+            {"America/Paramaribo", new String[] {"Fuso hor\u00e1rio do Suriname", "SRT",
+                                                 "Fuso hor\u00e1rio de ver\u00e3o do Suriname", "SRST"}},
+            {"America/Port-au-Prince", EST},
+            {"America/Port_of_Spain", AST},
+            {"America/Porto_Acre", AMT},
+            {"America/Porto_Velho", AMT},
+            {"America/Puerto_Rico", AST},
+            {"America/Rainy_River", CST},
+            {"America/Rankin_Inlet", CST},
+            {"America/Recife", BRT},
+            {"America/Regina", CST},
+            {"America/Resolute", RST},
+            {"America/Rio_Branco", AMT},
+            {"America/Rosario", AGT},
+            {"America/Santa_Isabel", PST},
+            {"America/Santarem", BRT},
+            {"America/Santiago", CLT},
+            {"America/Santo_Domingo", AST},
+            {"America/Sao_Paulo", BRT},
+            {"America/Scoresbysund", EGT},
+            {"America/Shiprock", MST},
+            {"America/St_Barthelemy", AST},
+            {"America/St_Kitts", AST},
+            {"America/St_Lucia", AST},
+            {"America/St_Thomas", AST},
+            {"America/St_Vincent", AST},
+            {"America/Swift_Current", CST},
+            {"America/Tegucigalpa", CST},
+            {"America/Thule", AST},
+            {"America/Thunder_Bay", EST},
+            {"America/Tijuana", PST},
+            {"America/Toronto", EST},
+            {"America/Tortola", AST},
+            {"America/Vancouver", PST},
+            {"America/Virgin", AST},
+            {"America/Whitehorse", PST},
+            {"America/Winnipeg", CST},
+            {"America/Yakutat", AKST},
+            {"America/Yellowknife", MST},
+            {"Antarctica/Casey", WST_AUS},
+            {"Antarctica/Davis", new String[] {"Fuso hor\u00e1rio de Davis", "DAVT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o de Davis", "DAVST"}},
+            {"Antarctica/DumontDUrville", new String[] {"Fuso hor\u00e1rio de Dumont-d'Urville", "DDUT",
+                                                        "Fuso hor\u00e1rio de ver\u00e3o de Dumont-d'Urville", "DDUST"}},
+            {"Antarctica/Macquarie", new String[] {"Macquarie Island Time", "MIST",
+                                                   "Macquarie Island Summer Time", "MIST"}},
+            {"Antarctica/Mawson", new String[] {"Fuso hor\u00e1rio de Mawson", "MAWT",
+                                                "Fuso hor\u00e1rio de ver\u00e3o de Mawson", "MAWST"}},
+            {"Antarctica/McMurdo", NZST},
+            {"Antarctica/Palmer", CLT},
+            {"Antarctica/Rothera", new String[] {"Fuso hor\u00e1rio de Rothera", "ROTT",
+                                                 "Fuso hor\u00e1rio de ver\u00e3o de Rothera", "ROTST"}},
+            {"Antarctica/South_Pole", NZST},
+            {"Antarctica/Syowa", new String[] {"Fuso hor\u00e1rio de Syowa", "SYOT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o de Syowa", "SYOST"}},
+            {"Antarctica/Vostok", new String[] {"Fuso hor\u00e1rio de Vostok", "VOST",
+                                                "Fuso hor\u00e1rio de ver\u00e3o de Vostok", "VOSST"}},
+            {"Arctic/Longyearbyen", CET},
+            {"Asia/Aden", ARAST},
+            {"Asia/Almaty", new String[] {"Fuso hor\u00e1rio de Alma-Ata", "ALMT",
+                                          "Fuso hor\u00e1rio de ver\u00e3o de Alma-Ata", "ALMST"}},
+            {"Asia/Amman", EET},
+            {"Asia/Anadyr", new String[] {"Fuso hor\u00e1rio de Anadyr", "ANAT",
+                                          "Fuso hor\u00e1rio de ver\u00e3o de Anadyr", "ANAST"}},
+            {"Asia/Aqtau", new String[] {"Fuso hor\u00e1rio de Aqtau", "AQTT",
+                                         "Fuso hor\u00e1rio de ver\u00e3o de Aqtau", "AQTST"}},
+            {"Asia/Aqtobe", new String[] {"Fuso hor\u00e1rio de Aqtobe", "AQTT",
+                                          "Fuso hor\u00e1rio de ver\u00e3o de Aqtobe", "AQTST"}},
+            {"Asia/Ashgabat", TMT},
+            {"Asia/Ashkhabad", TMT},
+            {"Asia/Baghdad", ARAST},
+            {"Asia/Bahrain", ARAST},
+            {"Asia/Baku", new String[] {"Fuso hor\u00e1rio do Azerbaij\u00e3o", "AZT",
+                                        "Fuso hor\u00e1rio de ver\u00e3o do Azerbaij\u00e3o", "AZST"}},
+            {"Asia/Bangkok", ICT},
+            {"Asia/Beirut", EET},
+            {"Asia/Bishkek", new String[] {"Fuso hor\u00e1rio do Quirguist\u00e3o", "KGT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o do Quirguist\u00e3o", "KGST"}},
+            {"Asia/Brunei", new String[] {"Fuso hor\u00e1rio de Brunei", "BNT",
+                                          "Fuso hor\u00e1rio de ver\u00e3o de Brunei", "BNST"}},
+            {"Asia/Calcutta", IST},
+            {"Asia/Choibalsan", new String[] {"Fuso hor\u00e1rio de Choibalsan", "CHOT",
+                                              "Fuso hor\u00e1rio de ver\u00e3o de Choibalsan", "CHOST"}},
+            {"Asia/Chongqing", CTT},
+            {"Asia/Chungking", CTT},
+            {"Asia/Colombo", IST},
+            {"Asia/Dacca", BDT},
+            {"Asia/Dhaka", BDT},
+            {"Asia/Dili", new String[] {"Fuso hor\u00e1rio do Timor-Leste", "TLT",
+                                        "Fuso hor\u00e1rio de ver\u00e3o do Timor-Leste", "TLST"}},
+            {"Asia/Damascus", EET},
+            {"Asia/Dubai", GST},
+            {"Asia/Dushanbe", new String[] {"Fuso hor\u00e1rio do Tadjiquist\u00e3o", "TJT",
+                                            "Fuso hor\u00e1rio de ver\u00e3o do Tadjiquist\u00e3o", "TJST"}},
+            {"Asia/Gaza", EET},
+            {"Asia/Harbin", CTT},
+            {"Asia/Ho_Chi_Minh", ICT},
+            {"Asia/Hong_Kong", HKT},
+            {"Asia/Hovd", new String[] {"Fuso hor\u00e1rio de Hovd", "HOVT",
+                                        "Fuso hor\u00e1rio de ver\u00e3o de Hovd", "HOVST"}},
+            {"Asia/Irkutsk", new String[] {"Fuso hor\u00e1rio de Irkutsk", "IRKT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Irkutsk", "IRKST"}},
+            {"Asia/Istanbul", EET},
+            {"Asia/Jakarta", WIT},
+            {"Asia/Jayapura", new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Oriental", "EIT",
+                                            "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Oriental", "EIST"}},
+            {"Asia/Kabul", new String[] {"Fuso hor\u00e1rio do Afeganist\u00e3o", "AFT",
+                                         "Fuso hor\u00e1rio de ver\u00e3o do Afeganist\u00e3o", "AFST"}},
+            {"Asia/Kamchatka", new String[] {"Fuso hor\u00e1rio de Petropavlovsk-Kamchatski", "PETT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o de Petropavlovsk-Kamchatski", "PETST"}},
+            {"Asia/Karachi", PKT},
+            {"Asia/Kashgar", CTT},
+            {"Asia/Kathmandu", NPT},
+            {"Asia/Katmandu", NPT},
+            {"Asia/Kolkata", IST},
+            {"Asia/Krasnoyarsk", new String[] {"Fuso hor\u00e1rio de Krasnoyarsk", "KRAT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o de Krasnoyarsk", "KRAST"}},
+            {"Asia/Kuala_Lumpur", MYT},
+            {"Asia/Kuching", MYT},
+            {"Asia/Kuwait", ARAST},
+            {"Asia/Macao", CTT},
+            {"Asia/Macau", CTT},
+            {"Asia/Magadan", new String[] {"Fuso hor\u00e1rio de Magadan", "MAGT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Magadan", "MAGST"}},
+            {"Asia/Makassar", CIT},
+            {"Asia/Manila", new String[] {"Fuso hor\u00e1rio das Filipinas", "PHT",
+                                          "Fuso hor\u00e1rio de ver\u00e3o das Filipinas", "PHST"}},
+            {"Asia/Muscat", GST},
+            {"Asia/Nicosia", EET},
+            {"Asia/Novokuznetsk", NOVT},
+            {"Asia/Novosibirsk", NOVT},
+            {"Asia/Oral", new String[] {"Fuso hor\u00e1rio de Uralsk", "ORAT",
+                                        "Fuso hor\u00e1rio de ver\u00e3o de Uralsk", "ORAST"}},
+            {"Asia/Omsk", new String[] {"Fuso hor\u00e1rio de Omsk", "OMST",
+                                        "Fuso hor\u00e1rio de ver\u00e3o de Omsk", "OMSST"}},
+            {"Asia/Phnom_Penh", ICT},
+            {"Asia/Pontianak", WIT},
+            {"Asia/Pyongyang", KST},
+            {"Asia/Qatar", ARAST},
+            {"Asia/Qyzylorda", new String[] {"Fuso hor\u00e1rio de Kizil-Orda", "QYZT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o de Kizil-Orda", "QYZST"}},
+            {"Asia/Rangoon", new String[] {"Fuso hor\u00e1rio de Mianmar", "MMT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Mianmar", "MMST"}},
+            {"Asia/Riyadh", ARAST},
+            {"Asia/Saigon", ICT},
+            {"Asia/Sakhalin", new String[] {"Fuso hor\u00e1rio de Sakhalina", "SAKT",
+                                            "Fuso hor\u00e1rio de ver\u00e3o de Sakhalina", "SAKST"}},
+            {"Asia/Samarkand", UZT},
+            {"Asia/Seoul", KST},
+            {"Asia/Singapore", SGT},
+            {"Asia/Taipei", CTT},
+            {"Asia/Tel_Aviv", ISRAEL},
+            {"Asia/Tashkent", UZT},
+            {"Asia/Tbilisi", new String[] {"Fuso hor\u00e1rio da Ge\u00f3rgia", "GET",
+                                           "Fuso hor\u00e1rio de ver\u00e3o da Ge\u00f3rgia", "GEST"}},
+            {"Asia/Tehran", IRT},
+            {"Asia/Thimbu", BTT},
+            {"Asia/Thimphu", BTT},
+            {"Asia/Ujung_Pandang", CIT},
+            {"Asia/Ulaanbaatar", ULAT},
+            {"Asia/Ulan_Bator", ULAT},
+            {"Asia/Urumqi", CTT},
+            {"Asia/Vientiane", ICT},
+            {"Asia/Vladivostok", new String[] {"Fuso hor\u00e1rio de Vladivostok", "VLAT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST"}},
+            {"Asia/Yakutsk", new String[] {"Fuso hor\u00e1rio de Yakutsk", "YAKT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Yakutsk", "YAKST"}},
+            {"Asia/Yekaterinburg", new String[] {"Fuso hor\u00e1rio de Yekaterinburgo", "YEKT",
+                                                 "Fuso hor\u00e1rio de ver\u00e3o de Yekaterinburgo", "YEKST"}},
+            {"Asia/Yerevan", ARMT},
+            {"Atlantic/Azores", new String[] {"Fuso hor\u00e1rio das A\u00e7ores", "AZOT",
+                                              "Fuso hor\u00e1rio de ver\u00e3o das A\u00e7ores", "AZOST"}},
+            {"Atlantic/Bermuda", AST},
+            {"Atlantic/Canary", WET},
+            {"Atlantic/Cape_Verde", new String[] {"Fuso hor\u00e1rio de Cabo Verde", "CVT",
+                                                  "Fuso hor\u00e1rio de ver\u00e3o de Cabo Verde", "CVST"}},
+            {"Atlantic/Faeroe", WET},
+            {"Atlantic/Faroe", WET},
+            {"Atlantic/Jan_Mayen", CET},
+            {"Atlantic/Madeira", WET},
+            {"Atlantic/Reykjavik", GMT},
+            {"Atlantic/South_Georgia", new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ge\u00f3rgia do Sul", "GST",
+                                                     "Hor\u00e1rio de luz natural da Ge\u00f3rgia do Sul", "GDT"}},
+            {"Atlantic/St_Helena", GMT},
+            {"Atlantic/Stanley", new String[] {"Fuso hor\u00e1rio das Ilhas Falkland", "FKT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Falkland", "FKST"}},
+            {"Australia/ACT", EST_NSW},
+            {"Australia/Adelaide", ADELAIDE},
+            {"Australia/Brisbane", BRISBANE},
+            {"Australia/Broken_Hill", BROKEN_HILL},
+            {"Australia/Canberra", EST_NSW},
+            {"Australia/Currie", EST_NSW},
+            {"Australia/Darwin", DARWIN},
+            {"Australia/Eucla", new String[] {"Fuso hor\u00e1rio ocidental central (Austr\u00e1lia)", "CWST",
+                                              "Fuso hor\u00e1rio de ver\u00e3o ocidental central (Austr\u00e1lia)", "CWST"}},
+            {"Australia/Hobart", TASMANIA},
+            {"Australia/LHI", LORD_HOWE},
+            {"Australia/Lindeman", BRISBANE},
+            {"Australia/Lord_Howe", LORD_HOWE},
+            {"Australia/Melbourne", VICTORIA},
+            {"Australia/North", DARWIN},
+            {"Australia/NSW", EST_NSW},
+            {"Australia/Perth", WST_AUS},
+            {"Australia/Queensland", BRISBANE},
+            {"Australia/South", ADELAIDE},
+            {"Australia/Sydney", EST_NSW},
+            {"Australia/Tasmania", TASMANIA},
+            {"Australia/Victoria", VICTORIA},
+            {"Australia/West", WST_AUS},
+            {"Australia/Yancowinna", BROKEN_HILL},
+            {"BET", BRT},
+            {"BST", BDT},
+            {"Brazil/Acre", AMT},
+            {"Brazil/DeNoronha", NORONHA},
+            {"Brazil/East", BRT},
+            {"Brazil/West", AMT},
+            {"Canada/Atlantic", AST},
+            {"Canada/Central", CST},
+            {"Canada/East-Saskatchewan", CST},
+            {"Canada/Eastern", EST},
+            {"Canada/Mountain", MST},
+            {"Canada/Newfoundland", NST},
+            {"Canada/Pacific", PST},
+            {"Canada/Yukon", PST},
+            {"Canada/Saskatchewan", CST},
+            {"CAT", CAT},
+            {"CET", CET},
+            {"Chile/Continental", CLT},
+            {"Chile/EasterIsland", EASTER},
+            {"CST6CDT", CST},
+            {"Cuba", CUBA},
+            {"EAT", EAT},
+            {"EET", EET},
+            {"Egypt", EET},
+            {"Eire", DUBLIN},
+            {"EST5EDT", EST},
+            {"Etc/Greenwich", GMT},
+            {"Etc/UCT", UTC},
+            {"Etc/Universal", UTC},
+            {"Etc/UTC", UTC},
+            {"Etc/Zulu", UTC},
+            {"Europe/Amsterdam", CET},
+            {"Europe/Andorra", CET},
+            {"Europe/Athens", EET},
+            {"Europe/Belfast", GMTBST},
+            {"Europe/Belgrade", CET},
+            {"Europe/Berlin", CET},
+            {"Europe/Bratislava", CET},
+            {"Europe/Brussels", CET},
+            {"Europe/Budapest", CET},
+            {"Europe/Chisinau", EET},
+            {"Europe/Copenhagen", CET},
+            {"Europe/Dublin", DUBLIN},
+            {"Europe/Gibraltar", CET},
             {"Europe/Guernsey", GMTBST},
-        {"Europe/Helsinki", EET},
+            {"Europe/Helsinki", EET},
             {"Europe/Isle_of_Man", GMTBST},
-        {"Europe/Istanbul", EET},
+            {"Europe/Istanbul", EET},
             {"Europe/Jersey", GMTBST},
-        {"Europe/Kaliningrad", EET},
-        {"Europe/Kiev", EET},
-        {"Europe/Lisbon", WET},
-        {"Europe/Ljubljana", CET},
-        {"Europe/London", GMTBST},
-        {"Europe/Luxembourg", CET},
-        {"Europe/Madrid", CET},
-        {"Europe/Malta", CET},
-        {"Europe/Mariehamn", EET},
-        {"Europe/Minsk", EET},
-        {"Europe/Monaco", CET},
-        {"Europe/Moscow", MSK},
-        {"Europe/Nicosia", EET},
-        {"Europe/Oslo", CET},
-        {"Europe/Podgorica", CET},
-        {"Europe/Prague", CET},
-        {"Europe/Riga", EET},
-        {"Europe/Rome", CET},
-        {"Europe/Samara", new String[] {"Fuso hor\u00e1rio de Samara", "SAMT",
-                        "Fuso hor\u00e1rio de ver\u00e3o de Samara", "SAMST"}},
-        {"Europe/San_Marino", CET},
-        {"Europe/Sarajevo", CET},
-        {"Europe/Simferopol", EET},
-        {"Europe/Skopje", CET},
-        {"Europe/Sofia", EET},
-        {"Europe/Stockholm", CET},
-        {"Europe/Tallinn", EET},
-        {"Europe/Tirane", CET},
-        {"Europe/Tiraspol", EET},
-        {"Europe/Uzhgorod", EET},
-        {"Europe/Vaduz", CET},
-        {"Europe/Vatican", CET},
-        {"Europe/Vienna", CET},
-        {"Europe/Vilnius", EET},
+            {"Europe/Kaliningrad", EET},
+            {"Europe/Kiev", EET},
+            {"Europe/Lisbon", WET},
+            {"Europe/Ljubljana", CET},
+            {"Europe/London", GMTBST},
+            {"Europe/Luxembourg", CET},
+            {"Europe/Madrid", CET},
+            {"Europe/Malta", CET},
+            {"Europe/Mariehamn", EET},
+            {"Europe/Minsk", EET},
+            {"Europe/Monaco", CET},
+            {"Europe/Moscow", MSK},
+            {"Europe/Nicosia", EET},
+            {"Europe/Oslo", CET},
+            {"Europe/Podgorica", CET},
+            {"Europe/Prague", CET},
+            {"Europe/Riga", EET},
+            {"Europe/Rome", CET},
+            {"Europe/Samara", new String[] {"Fuso hor\u00e1rio de Samara", "SAMT",
+                                            "Fuso hor\u00e1rio de ver\u00e3o de Samara", "SAMST"}},
+            {"Europe/San_Marino", CET},
+            {"Europe/Sarajevo", CET},
+            {"Europe/Simferopol", EET},
+            {"Europe/Skopje", CET},
+            {"Europe/Sofia", EET},
+            {"Europe/Stockholm", CET},
+            {"Europe/Tallinn", EET},
+            {"Europe/Tirane", CET},
+            {"Europe/Tiraspol", EET},
+            {"Europe/Uzhgorod", EET},
+            {"Europe/Vaduz", CET},
+            {"Europe/Vatican", CET},
+            {"Europe/Vienna", CET},
+            {"Europe/Vilnius", EET},
             {"Europe/Volgograd", new String[] {"Fuso hor\u00e1rio de Volgogrado", "VOLT",
                                                "Fuso hor\u00e1rio de ver\u00e3o de Volgogrado", "VOLST"}},
-        {"Europe/Warsaw", CET},
-        {"Europe/Zagreb", CET},
-        {"Europe/Zaporozhye", EET},
-        {"Europe/Zurich", CET},
-        {"GB", GMTBST},
-        {"GB-Eire", GMTBST},
-        {"Greenwich", GMT},
-        {"Hongkong", HKT},
-        {"Iceland", GMT},
-        {"Iran", IRT},
-        {"IST", IST},
-        {"Indian/Antananarivo", EAT},
-        {"Indian/Chagos", new String[] {"Fuso hor\u00e1rio dos territ\u00f3rios do Oceano \u00cdndico", "IOT",
-                        "Fuso hor\u00e1rio de ver\u00e3o dos territ\u00f3rios do Oceano \u00cdndico", "IOST"}},
-        {"Indian/Christmas", new String[] {"Fuso hor\u00e1rio das Ilhas Christmas", "CXT",
-                           "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Christmas", "CXST"}},
-        {"Indian/Cocos", new String[] {"Fuso hor\u00e1rio das Ilhas Cocos", "CCT",
-                       "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cocos", "CCST"}},
-        {"Indian/Comoro", EAT},
-        {"Indian/Kerguelen", new String[] {"Fuso hor\u00e1rio das Terras Austrais e Ant\u00e1rticas Francesas", "TFT",
-                           "Fuso hor\u00e1rio de ver\u00e3o das Terras Austrais e Ant\u00e1rticas Francesas", "TFST"}},
-        {"Indian/Mahe", new String[] {"Fuso hor\u00e1rio das Seychelles", "SCT",
-                      "Fuso hor\u00e1rio de ver\u00e3o das Seychelles", "SCST"}},
-        {"Indian/Maldives", new String[] {"Fuso hor\u00e1rio das Maldivas", "MVT",
-                          "Fuso hor\u00e1rio de ver\u00e3o das Maldivas", "MVST"}},
-        {"Indian/Mauritius", new String[] {"Fuso hor\u00e1rio das Ilhas Maur\u00edcio", "MUT",
-                           "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Maur\u00edcio", "MUST"}},
-        {"Indian/Mayotte", EAT},
-        {"Indian/Reunion", new String[] {"Fuso hor\u00e1rio de Reuni\u00e3o", "RET",
-                         "Fuso hor\u00e1rio de ver\u00e3o de Reuni\u00e3o", "REST"}},
-        {"Israel", ISRAEL},
-        {"Jamaica", EST},
-        {"Japan", JST},
-        {"Kwajalein", MHT},
-        {"Libya", EET},
-        {"MET", new String[] {"Fuso hor\u00e1rio da Europa M\u00e9dia", "MET",
-                  "Fuso hor\u00e1rio de ver\u00e3o da Europa M\u00e9dia", "MEST"}},
-        {"Mexico/BajaNorte", PST},
-        {"Mexico/BajaSur", MST},
-        {"Mexico/General", CST},
-        {"MIT", WST_SAMOA},
-        {"MST7MDT", MST},
-        {"Navajo", MST},
-        {"NET", ARMT},
-        {"NST", NZST},
-        {"NZ", NZST},
-        {"NZ-CHAT", CHAST},
-        {"PLT", PKT},
-        {"Portugal", WET},
-        {"PRT", AST},
-        {"Pacific/Apia", WST_SAMOA},
-        {"Pacific/Auckland", NZST},
-        {"Pacific/Chatham", CHAST},
-        {"Pacific/Chuuk", TRUT},
-        {"Pacific/Easter", EASTER},
-        {"Pacific/Efate", new String[] {"Fuso hor\u00e1rio de Vanuatu", "VUT",
-                        "Fuso hor\u00e1rio de ver\u00e3o de Vanuatu", "VUST"}},
-        {"Pacific/Enderbury", new String[] {"Fuso hor\u00e1rio das Ilhas F\u00e9nix", "PHOT",
-                        "Fuso hor\u00e1rio de ver\u00e3o das Ilhas F\u00e9nix", "PHOST"}},
-        {"Pacific/Fakaofo", new String[] {"Fuso hor\u00e1rio de Tokelau", "TKT",
-                          "Fuso hor\u00e1rio de ver\u00e3o de Tokelau", "TKST"}},
-        {"Pacific/Fiji", new String[] {"Fuso hor\u00e1rio de Fiji", "FJT",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Fiji", "FJST"}},
-        {"Pacific/Funafuti", new String[] {"Fuso hor\u00e1rio de Tuvalu", "TVT",
-                           "Fuso hor\u00e1rio de ver\u00e3o de Tuvalu", "TVST"}},
-        {"Pacific/Galapagos", new String[] {"Fuso hor\u00e1rio das Ilhas Gal\u00e1pagos", "GALT",
-                        "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gal\u00e1pagos", "GALST"}},
-        {"Pacific/Gambier", GAMBIER},
-        {"Pacific/Guadalcanal", SBT},
-        {"Pacific/Guam", ChST},
-        {"Pacific/Johnston", HST},
-        {"Pacific/Kiritimati", new String[] {"Fuso hor\u00e1rio das Esp\u00f3rades Equatoriais", "LINT",
-                         "Fuso hor\u00e1rio de ver\u00e3o das Esp\u00f3rades Equatoriais", "LINST"}},
-        {"Pacific/Kosrae", new String[] {"Fuso hor\u00e1rio de Kosrae", "KOST",
-                         "Fuso hor\u00e1rio de ver\u00e3o de Kosrae", "KOSST"}},
-        {"Pacific/Kwajalein", MHT},
-        {"Pacific/Majuro", MHT},
-        {"Pacific/Marquesas", new String[] {"Fuso hor\u00e1rio das Ilhas Marquesas", "MART",
-                        "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marquesas", "MARST"}},
-        {"Pacific/Midway", SAMOA},
-        {"Pacific/Nauru", new String[] {"Fuso hor\u00e1rio de Nauru", "NRT",
-                        "Fuso hor\u00e1rio de ver\u00e3o de Nauru", "NRST"}},
-        {"Pacific/Niue", new String[] {"Fuso hor\u00e1rio de Niue", "NUT",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Niue", "NUST"}},
-        {"Pacific/Norfolk", new String[] {"Fuso hor\u00e1rio da Ilha de Norfolk", "NFT",
-                          "Fuso hor\u00e1rio de ver\u00e3o da Ilha de Norfolk", "NFST"}},
-        {"Pacific/Noumea", new String[] {"Fuso hor\u00e1rio da Nova Caled\u00f4nia", "NCT",
-                         "Fuso hor\u00e1rio de ver\u00e3o da Nova Caled\u00f4nia", "NCST"}},
-        {"Pacific/Pago_Pago", SAMOA},
-        {"Pacific/Palau", new String[] {"Fuso hor\u00e1rio de Palau", "PWT",
-                        "Fuso hor\u00e1rio de ver\u00e3o de Palau", "PWST"}},
-        {"Pacific/Pitcairn", PITCAIRN},
-        {"Pacific/Pohnpei", PONT},
-        {"Pacific/Ponape", PONT},
-        {"Pacific/Port_Moresby", new String[] {"Fuso hor\u00e1rio de Papua-Nova Guin\u00e9", "PGT",
-                           "Fuso hor\u00e1rio de ver\u00e3o de Papua-Nova Guin\u00e9", "PGST"}},
-        {"Pacific/Rarotonga", new String[] {"Fuso hor\u00e1rio das Ilhas Cook", "CKT",
-                        "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cook", "CKHST"}},
-        {"Pacific/Saipan", ChST},
-        {"Pacific/Samoa", SAMOA},
-        {"Pacific/Tahiti", new String[] {"Fuso hor\u00e1rio do Taiti", "TAHT",
-                         "Fuso hor\u00e1rio de ver\u00e3o do Taiti", "TAHST"}},
-        {"Pacific/Tarawa", new String[] {"Fuso hor\u00e1rio das Ilhas Gilbert", "GILT",
-                         "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gilbert", "GILST"}},
-        {"Pacific/Tongatapu", new String[] {"Fuso hor\u00e1rio de Tonga", "TOT",
-                        "Fuso hor\u00e1rio de ver\u00e3o de Tonga", "TOST"}},
-        {"Pacific/Truk", TRUT},
-        {"Pacific/Wake", new String[] {"Fuso hor\u00e1rio de Wake", "WAKT",
-                       "Fuso hor\u00e1rio de ver\u00e3o de Wake", "WAKST"}},
-        {"Pacific/Wallis", new String[] {"Fuso hor\u00e1rio de Wallis e Futuna", "WFT",
-                         "Fuso hor\u00e1rio de ver\u00e3o de Wallis e Futuna", "WFST"}},
-        {"Pacific/Yap", TRUT},
-        {"Poland", CET},
-        {"PRC", CTT},
-        {"PST8PDT", PST},
-        {"ROK", KST},
-        {"Singapore", SGT},
-        {"SST", SBT},
-        {"SystemV/AST4", AST},
-        {"SystemV/AST4ADT", AST},
-        {"SystemV/CST6", CST},
-        {"SystemV/CST6CDT", CST},
-        {"SystemV/EST5", EST},
-        {"SystemV/EST5EDT", EST},
-        {"SystemV/HST10", HST},
-        {"SystemV/MST7", MST},
-        {"SystemV/MST7MDT", MST},
-        {"SystemV/PST8", PST},
-        {"SystemV/PST8PDT", PST},
-        {"SystemV/YST9", AKST},
-        {"SystemV/YST9YDT", AKST},
-        {"Turkey", EET},
-        {"UCT", UTC},
-        {"Universal", UTC},
-        {"US/Alaska", AKST},
-        {"US/Aleutian", HAST},
-        {"US/Arizona", MST},
-        {"US/Central", CST},
-        {"US/Eastern", EST},
-        {"US/Hawaii", HST},
-        {"US/Indiana-Starke", CST},
-        {"US/East-Indiana", EST},
-        {"US/Michigan", EST},
-        {"US/Mountain", MST},
-        {"US/Pacific", PST},
-        {"US/Pacific-New", PST},
-        {"US/Samoa", SAMOA},
-        {"UTC", UTC},
-        {"VST", ICT},
-        {"W-SU", MSK},
-        {"WET", WET},
-        {"Zulu", UTC},
+            {"Europe/Warsaw", CET},
+            {"Europe/Zagreb", CET},
+            {"Europe/Zaporozhye", EET},
+            {"Europe/Zurich", CET},
+            {"GB", GMTBST},
+            {"GB-Eire", GMTBST},
+            {"Greenwich", GMT},
+            {"Hongkong", HKT},
+            {"Iceland", GMT},
+            {"Iran", IRT},
+            {"IST", IST},
+            {"Indian/Antananarivo", EAT},
+            {"Indian/Chagos", new String[] {"Fuso hor\u00e1rio dos territ\u00f3rios do Oceano \u00cdndico", "IOT",
+                                            "Fuso hor\u00e1rio de ver\u00e3o dos territ\u00f3rios do Oceano \u00cdndico", "IOST"}},
+            {"Indian/Christmas", new String[] {"Fuso hor\u00e1rio das Ilhas Christmas", "CXT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Christmas", "CXST"}},
+            {"Indian/Cocos", new String[] {"Fuso hor\u00e1rio das Ilhas Cocos", "CCT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cocos", "CCST"}},
+            {"Indian/Comoro", EAT},
+            {"Indian/Kerguelen", new String[] {"Fuso hor\u00e1rio das Terras Austrais e Ant\u00e1rticas Francesas", "TFT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o das Terras Austrais e Ant\u00e1rticas Francesas", "TFST"}},
+            {"Indian/Mahe", new String[] {"Fuso hor\u00e1rio das Seychelles", "SCT",
+                                          "Fuso hor\u00e1rio de ver\u00e3o das Seychelles", "SCST"}},
+            {"Indian/Maldives", new String[] {"Fuso hor\u00e1rio das Maldivas", "MVT",
+                                              "Fuso hor\u00e1rio de ver\u00e3o das Maldivas", "MVST"}},
+            {"Indian/Mauritius", new String[] {"Fuso hor\u00e1rio das Ilhas Maur\u00edcio", "MUT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Maur\u00edcio", "MUST"}},
+            {"Indian/Mayotte", EAT},
+            {"Indian/Reunion", new String[] {"Fuso hor\u00e1rio de Reuni\u00e3o", "RET",
+                                             "Fuso hor\u00e1rio de ver\u00e3o de Reuni\u00e3o", "REST"}},
+            {"Israel", ISRAEL},
+            {"Jamaica", EST},
+            {"Japan", JST},
+            {"Kwajalein", MHT},
+            {"Libya", EET},
+            {"MET", new String[] {"Fuso hor\u00e1rio da Europa M\u00e9dia", "MET",
+                                  "Fuso hor\u00e1rio de ver\u00e3o da Europa M\u00e9dia", "MEST"}},
+            {"Mexico/BajaNorte", PST},
+            {"Mexico/BajaSur", MST},
+            {"Mexico/General", CST},
+            {"MIT", WST_SAMOA},
+            {"MST7MDT", MST},
+            {"Navajo", MST},
+            {"NET", ARMT},
+            {"NST", NZST},
+            {"NZ", NZST},
+            {"NZ-CHAT", CHAST},
+            {"PLT", PKT},
+            {"Portugal", WET},
+            {"PRT", AST},
+            {"Pacific/Apia", WST_SAMOA},
+            {"Pacific/Auckland", NZST},
+            {"Pacific/Chatham", CHAST},
+            {"Pacific/Chuuk", TRUT},
+            {"Pacific/Easter", EASTER},
+            {"Pacific/Efate", new String[] {"Fuso hor\u00e1rio de Vanuatu", "VUT",
+                                            "Fuso hor\u00e1rio de ver\u00e3o de Vanuatu", "VUST"}},
+            {"Pacific/Enderbury", new String[] {"Fuso hor\u00e1rio das Ilhas F\u00e9nix", "PHOT",
+                                                "Fuso hor\u00e1rio de ver\u00e3o das Ilhas F\u00e9nix", "PHOST"}},
+            {"Pacific/Fakaofo", new String[] {"Fuso hor\u00e1rio de Tokelau", "TKT",
+                                              "Fuso hor\u00e1rio de ver\u00e3o de Tokelau", "TKST"}},
+            {"Pacific/Fiji", new String[] {"Fuso hor\u00e1rio de Fiji", "FJT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Fiji", "FJST"}},
+            {"Pacific/Funafuti", new String[] {"Fuso hor\u00e1rio de Tuvalu", "TVT",
+                                               "Fuso hor\u00e1rio de ver\u00e3o de Tuvalu", "TVST"}},
+            {"Pacific/Galapagos", new String[] {"Fuso hor\u00e1rio das Ilhas Gal\u00e1pagos", "GALT",
+                                                "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gal\u00e1pagos", "GALST"}},
+            {"Pacific/Gambier", GAMBIER},
+            {"Pacific/Guadalcanal", SBT},
+            {"Pacific/Guam", ChST},
+            {"Pacific/Johnston", HST},
+            {"Pacific/Kiritimati", new String[] {"Fuso hor\u00e1rio das Esp\u00f3rades Equatoriais", "LINT",
+                                                 "Fuso hor\u00e1rio de ver\u00e3o das Esp\u00f3rades Equatoriais", "LINST"}},
+            {"Pacific/Kosrae", new String[] {"Fuso hor\u00e1rio de Kosrae", "KOST",
+                                             "Fuso hor\u00e1rio de ver\u00e3o de Kosrae", "KOSST"}},
+            {"Pacific/Kwajalein", MHT},
+            {"Pacific/Majuro", MHT},
+            {"Pacific/Marquesas", new String[] {"Fuso hor\u00e1rio das Ilhas Marquesas", "MART",
+                                                "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marquesas", "MARST"}},
+            {"Pacific/Midway", SAMOA},
+            {"Pacific/Nauru", new String[] {"Fuso hor\u00e1rio de Nauru", "NRT",
+                                            "Fuso hor\u00e1rio de ver\u00e3o de Nauru", "NRST"}},
+            {"Pacific/Niue", new String[] {"Fuso hor\u00e1rio de Niue", "NUT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Niue", "NUST"}},
+            {"Pacific/Norfolk", new String[] {"Fuso hor\u00e1rio da Ilha de Norfolk", "NFT",
+                                              "Fuso hor\u00e1rio de ver\u00e3o da Ilha de Norfolk", "NFST"}},
+            {"Pacific/Noumea", new String[] {"Fuso hor\u00e1rio da Nova Caled\u00f4nia", "NCT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o da Nova Caled\u00f4nia", "NCST"}},
+            {"Pacific/Pago_Pago", SAMOA},
+            {"Pacific/Palau", new String[] {"Fuso hor\u00e1rio de Palau", "PWT",
+                                            "Fuso hor\u00e1rio de ver\u00e3o de Palau", "PWST"}},
+            {"Pacific/Pitcairn", PITCAIRN},
+            {"Pacific/Pohnpei", PONT},
+            {"Pacific/Ponape", PONT},
+            {"Pacific/Port_Moresby", new String[] {"Fuso hor\u00e1rio de Papua-Nova Guin\u00e9", "PGT",
+                                                   "Fuso hor\u00e1rio de ver\u00e3o de Papua-Nova Guin\u00e9", "PGST"}},
+            {"Pacific/Rarotonga", new String[] {"Fuso hor\u00e1rio das Ilhas Cook", "CKT",
+                                                "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cook", "CKHST"}},
+            {"Pacific/Saipan", ChST},
+            {"Pacific/Samoa", SAMOA},
+            {"Pacific/Tahiti", new String[] {"Fuso hor\u00e1rio do Taiti", "TAHT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o do Taiti", "TAHST"}},
+            {"Pacific/Tarawa", new String[] {"Fuso hor\u00e1rio das Ilhas Gilbert", "GILT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gilbert", "GILST"}},
+            {"Pacific/Tongatapu", new String[] {"Fuso hor\u00e1rio de Tonga", "TOT",
+                                                "Fuso hor\u00e1rio de ver\u00e3o de Tonga", "TOST"}},
+            {"Pacific/Truk", TRUT},
+            {"Pacific/Wake", new String[] {"Fuso hor\u00e1rio de Wake", "WAKT",
+                                           "Fuso hor\u00e1rio de ver\u00e3o de Wake", "WAKST"}},
+            {"Pacific/Wallis", new String[] {"Fuso hor\u00e1rio de Wallis e Futuna", "WFT",
+                                             "Fuso hor\u00e1rio de ver\u00e3o de Wallis e Futuna", "WFST"}},
+            {"Pacific/Yap", TRUT},
+            {"Poland", CET},
+            {"PRC", CTT},
+            {"PST8PDT", PST},
+            {"ROK", KST},
+            {"Singapore", SGT},
+            {"SST", SBT},
+            {"SystemV/AST4", AST},
+            {"SystemV/AST4ADT", AST},
+            {"SystemV/CST6", CST},
+            {"SystemV/CST6CDT", CST},
+            {"SystemV/EST5", EST},
+            {"SystemV/EST5EDT", EST},
+            {"SystemV/HST10", HST},
+            {"SystemV/MST7", MST},
+            {"SystemV/MST7MDT", MST},
+            {"SystemV/PST8", PST},
+            {"SystemV/PST8PDT", PST},
+            {"SystemV/YST9", AKST},
+            {"SystemV/YST9YDT", AKST},
+            {"Turkey", EET},
+            {"UCT", UTC},
+            {"Universal", UTC},
+            {"US/Alaska", AKST},
+            {"US/Aleutian", HAST},
+            {"US/Arizona", MST},
+            {"US/Central", CST},
+            {"US/Eastern", EST},
+            {"US/Hawaii", HST},
+            {"US/Indiana-Starke", CST},
+            {"US/East-Indiana", EST},
+            {"US/Michigan", EST},
+            {"US/Mountain", MST},
+            {"US/Pacific", PST},
+            {"US/Pacific-New", PST},
+            {"US/Samoa", SAMOA},
+            {"UTC", UTC},
+            {"VST", ICT},
+            {"W-SU", MSK},
+            {"WET", WET},
+            {"Zulu", UTC},
         };
     }
 }
-
-
--- a/jdk/src/share/native/sun/font/layout/Features.h	Tue Apr 19 16:01:27 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * 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.
- *
- */
-
-/*
- *
- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
- *
- */
-
-#ifndef __FEATURES_H
-#define __FEATURES_H
-
-/**
- * \file
- * \internal
- */
-
-#include "LETypes.h"
-#include "OpenTypeTables.h"
-
-U_NAMESPACE_BEGIN
-
-struct FeatureRecord
-{
-    ATag        featureTag;
-    Offset      featureTableOffset;
-};
-
-struct FeatureTable
-{
-    Offset      featureParamsOffset;
-    le_uint16   lookupCount;
-    le_uint16   lookupListIndexArray[ANY_NUMBER];
-};
-
-struct FeatureListTable
-{
-    le_uint16           featureCount;
-    FeatureRecord       featureRecordArray[ANY_NUMBER];
-
-    const FeatureTable  *getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const;
-
-    const FeatureTable *getFeatureTable(LETag featureTag) const;
-};
-
-U_NAMESPACE_END
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/forkjoin/mergesort/MergeDemo.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Arrays;
+import java.util.Random;
+
+import static java.lang.Integer.parseInt;
+
+/**
+ * MergeExample is a class that runs a demo benchmark of the {@code ForkJoin} framework
+ * by benchmarking a {@link MergeSort} algorithm that is implemented using
+ * {@link java.util.concurrent.RecursiveAction}.
+ * The {@code ForkJoin} framework is setup with different parallelism levels
+ * and the sort is executed with arrays of different sizes to see the
+ * trade offs by using multiple threads for different sizes of the array.
+ */
+public class MergeDemo {
+    // Use a fixed seed to always get the same random values back
+    private final Random random = new Random(759123751834L);
+    private static final int ITERATIONS = 10;
+
+    /**
+     * Represents the formula {@code f(n) = start + (step * n)} for n = 0 & n < iterations
+     */
+    private static class Range {
+        private final int start;
+        private final int step;
+        private final int iterations;
+
+        private Range(int start, int step, int iterations) {
+            this.start = start;
+            this.step = step;
+            this.iterations = iterations;
+        }
+
+        /**
+         * Parses start, step and iterations from args
+         * @param args the string array containing the arguments
+         * @param start which element to start the start argument from
+         * @return the constructed range
+         */
+        public static Range parse(String[] args, int start) {
+            if (args.length < start + 3) {
+                throw new IllegalArgumentException("Too few elements in array");
+            }
+            return new Range(parseInt(args[start]), parseInt(args[start + 1]), parseInt(args[start + 2]));
+        }
+
+        public int get(int iteration) {
+            return start + (step * iteration);
+        }
+
+        public int getIterations() {
+            return iterations;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder();
+            builder.append(start).append(" ").append(step).append(" ").append(iterations);
+            return builder.toString();
+        }
+    }
+
+    /**
+     * Wraps the different parameters that is used when running the MergeExample.
+     * {@code sizes} represents the different array sizes
+     * {@code parallelism} represents the different parallelism levels
+     */
+    private static class Configuration {
+        private final Range sizes;
+        private final Range parallelism;
+
+        private final static Configuration defaultConfig = new Configuration(new Range(20000, 20000, 10),
+                new Range(2, 2, 10));
+
+        private Configuration(Range sizes, Range parallelism) {
+            this.sizes = sizes;
+            this.parallelism = parallelism;
+        }
+
+        /**
+         * Parses the arguments and attempts to create a configuration containing the
+         * parameters for creating the array sizes and parallelism sizes
+         * @param args the input arguments
+         * @return the configuration
+         */
+        public static Configuration parse(String[] args) {
+            if (args.length == 0) {
+                return defaultConfig;
+            } else {
+                try {
+                    if (args.length == 6) {
+                        return new Configuration(Range.parse(args, 0), Range.parse(args, 3));
+                    }
+                } catch (NumberFormatException e) {
+                    System.err.println("MergeExample: error: Argument was not a number.");
+                }
+                System.err.println("MergeExample <size start> <size step> <size steps> <parallel start> <parallel step>" +
+                        " <parallel steps>");
+                System.err.println("example: MergeExample 20000 10000 3 1 1 4");
+                System.err.println("example: will run with arrays of sizes 20000, 30000, 40000" +
+                        " and parallelism: 1, 2, 3, 4");
+                return null;
+            }
+        }
+
+        /**
+         * Creates an array for reporting the test result time in
+         * @return an array containing {@code sizes.iterations * parallelism.iterations} elements
+         */
+        private long[][] createTimesArray() {
+            return new long[sizes.getIterations()][parallelism.getIterations()];
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder("");
+            if (this == defaultConfig) {
+                builder.append("Default configuration. ");
+            }
+            builder.append("Running with parameters: ");
+            builder.append(sizes);
+            builder.append(" ");
+            builder.append(parallelism);
+            return builder.toString();
+        }
+    }
+
+    /**
+     * Generates an array of {@code elements} random elements
+     * @param elements the number of elements requested in the array
+     * @return an array of {@code elements} random elements
+     */
+    private int[] generateArray(int elements) {
+        int[] array = new int[elements];
+        for (int i = 0; i < elements; ++i) {
+            array[i] = random.nextInt();
+        }
+        return array;
+    }
+
+    /**
+     * Runs the test
+     * @param config contains the settings for the test
+     */
+    private void run(Configuration config) {
+        Range sizes = config.sizes;
+        Range parallelism = config.parallelism;
+
+        // Run a couple of sorts to make the JIT compile / optimize the code
+        // which should produce somewhat more fair times
+        warmup();
+
+        long[][] times = config.createTimesArray();
+
+        for (int size = 0; size < sizes.getIterations(); size++) {
+            runForSize(parallelism, sizes.get(size), times, size);
+        }
+
+        printResults(sizes, parallelism, times);
+    }
+
+    /**
+     * Prints the results as a table
+     * @param sizes the different sizes of the arrays
+     * @param parallelism the different parallelism levels used
+     * @param times the median times for the different sizes / parallelism
+     */
+    private void printResults(Range sizes, Range parallelism, long[][] times) {
+        System.out.println("Time in milliseconds. Y-axis: number of elements. X-axis parallelism used.");
+        long[] sums = new long[times[0].length];
+        System.out.format("%8s  ", "");
+        for (int i = 0; i < times[0].length; i++) {
+            System.out.format("%4d ", parallelism.get(i));
+        }
+        System.out.println("");
+        for (int size = 0; size < sizes.getIterations(); size++) {
+            System.out.format("%8d: ", sizes.get(size));
+            for (int i = 0; i < times[size].length; i++) {
+                sums[i] += times[size][i];
+                System.out.format("%4d ", times[size][i]);
+            }
+            System.out.println("");
+        }
+        System.out.format("%8s: ", "Total");
+        for (long sum : sums) {
+            System.out.format("%4d ", sum);
+        }
+        System.out.println("");
+    }
+
+    private void runForSize(Range parallelism, int elements, long[][] times, int size) {
+        for (int step = 0; step < parallelism.getIterations(); step++) {
+            long time = runForParallelism(ITERATIONS, elements, parallelism.get(step));
+            times[size][step] = time;
+        }
+    }
+
+    /**
+     * Runs <i>iterations</i> number of test sorts of a random array of <i>element</i> length
+     * @param iterations number of iterations
+     * @param elements number of elements in the random array
+     * @param parallelism parallelism for the ForkJoin framework
+     * @return the median time of runs
+     */
+    private long runForParallelism(int iterations, int elements, int parallelism) {
+        MergeSort mergeSort = new MergeSort(parallelism);
+        long[] times = new long[iterations];
+
+        for (int i = 0; i < iterations; i++) {
+            // Suggest the VM to run a garbage collection to reduce the risk of getting one
+            // while running the test run
+            System.gc();
+            long start = System.currentTimeMillis();
+            mergeSort.sort(generateArray(elements));
+            times[i] = System.currentTimeMillis() - start;
+        }
+
+        return medianValue(times);
+    }
+
+    /**
+     * Calculates the median value of the array
+     * @param times array of times
+     * @return the median value
+     */
+    private long medianValue(long[] times) {
+        if (times.length == 0) {
+            throw new IllegalArgumentException("Empty array");
+        }
+        // Make a copy of times to avoid having side effects on the parameter value
+        Arrays.sort(times.clone());
+        long median = times[times.length / 2];
+        if (times.length > 1 && times.length % 2 != 0) {
+            median = (median + times[times.length / 2 + 1]) / 2;
+        }
+        return median;
+    }
+
+    /**
+     * Generates 1000 arrays of 1000 elements and sorts them as a warmup
+     */
+    private void warmup() {
+        MergeSort mergeSort = new MergeSort(Runtime.getRuntime().availableProcessors());
+        for (int i = 0; i < 1000; i++) {
+            mergeSort.sort(generateArray(1000));
+        }
+    }
+
+    public static void main(String[] args) {
+        Configuration configuration = Configuration.parse(args);
+        if (configuration == null) {
+            System.exit(1);
+        }
+        System.out.println(configuration);
+        new MergeDemo().run(configuration);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/forkjoin/mergesort/MergeSort.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Arrays;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ForkJoinTask;
+import java.util.concurrent.RecursiveAction;
+
+/**
+ * A class for sorting an array of {@code ints} in parallel.
+ * A {@code ForkJoinPool} is used for the parallelism, using the merge sort
+ * algorithm the array is split into halves and a new sub task is created
+ * for each part. Each sub task is dispatched to the {@code ForkJoinPool}
+ * which will schedule the task to a {@code Thread}.
+ * This happens until the size of the array is at most 2
+ * elements long. At this point the array is sorted using a simple compare
+ * and possibly a swap. The tasks then finish by using insert sort to
+ * merge the two just sorted arrays.
+ *
+ * The idea of this class is to demonstrate the usage of RecursiveAction not
+ * to implement the best possible parallel merge sort. This version creates
+ * a small array for each merge (creating a lot of objects), this could
+ * be avoided by keeping a single array.
+ */
+public class MergeSort {
+    private final ForkJoinPool pool;
+
+    private static class MergeSortTask extends RecursiveAction {
+        private final int[] array;
+        private final int low;
+        private final int high;
+        private static final int THRESHOLD = 8;
+
+        /**
+         * Creates a {@code MergeSortTask} containing the array and the bounds of the array
+         *
+         * @param array the array to sort
+         * @param low the lower element to start sorting at
+         * @param high the non-inclusive high element to sort to
+         */
+        protected MergeSortTask(int[] array, int low, int high) {
+            this.array = array;
+            this.low = low;
+            this.high = high;
+        }
+
+        @Override
+        protected void compute() {
+            if (high - low <= THRESHOLD) {
+                Arrays.sort(array, low, high);
+            } else {
+                int middle = low + ((high - low) >> 1);
+                // Execute the sub tasks and wait for them to finish
+                invokeAll(new MergeSortTask(array, low, middle), new MergeSortTask(array, middle, high));
+                // Then merge the results
+                merge(middle);
+            }
+        }
+
+        /**
+         * Merges the two sorted arrays this.low, middle - 1 and middle, this.high - 1
+         * @param middle the index in the array where the second sorted list begins
+         */
+        private void merge(int middle) {
+            if (array[middle - 1] < array[middle]) {
+                return; // the arrays are already correctly sorted, so we can skip the merge
+            }
+            int[] copy = new int[high - low];
+            System.arraycopy(array, low, copy, 0, copy.length);
+            int copyLow = 0;
+            int copyHigh = high - low;
+            int copyMiddle = middle - low;
+
+            for (int i = low, p = copyLow, q = copyMiddle; i < high; i++) {
+                if (q >= copyHigh || (p < copyMiddle && copy[p] < copy[q]) ) {
+                    array[i] = copy[p++];
+                } else {
+                    array[i] = copy[q++];
+                }
+            }
+        }
+    }
+
+    /**
+     * Creates a {@code MergeSort} containing a ForkJoinPool with the indicated parallelism level
+     * @param parallelism the parallelism level used
+     */
+    public MergeSort(int parallelism) {
+        pool = new ForkJoinPool(parallelism);
+    }
+
+    /**
+     * Sorts all the elements of the given array using the ForkJoin framework
+     * @param array the array to sort
+     */
+    public void sort(int[] array) {
+        ForkJoinTask<Void> job = pool.submit(new MergeSortTask(array, 0, array.length));
+        job.join();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/ChatServer.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.net.StandardSocketOption;
+import java.nio.channels.*;
+import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Implements a chat server, this class holds the list of {@code clients} connected to the server.
+ * It sets up a server socket using AsynchronousServerSocketChannel listening to a specified port.
+ */
+public class ChatServer implements Runnable {
+    private final List<Client> connections = Collections.synchronizedList(new ArrayList<Client>());
+    private int port;
+    private final AsynchronousServerSocketChannel listener;
+    private final AsynchronousChannelGroup channelGroup;
+
+    /**
+     *
+     * @param port to listen to
+     * @throws java.io.IOException when failing to start the server
+     */
+    public ChatServer(int port) throws IOException {
+        channelGroup = AsynchronousChannelGroup.withFixedThreadPool(Runtime.getRuntime().availableProcessors(),
+                Executors.defaultThreadFactory());
+        this.port = port;
+        listener = createListener(channelGroup);
+    }
+
+    /**
+     *
+     * @return The socket address that the server is bound to
+     * @throws java.io.IOException if an I/O error occurs
+     */
+    public SocketAddress getSocketAddress() throws IOException {
+        return listener.getLocalAddress();
+    }
+
+    /**
+     * Start accepting connections
+     */
+    public void run() {
+
+        // call accept to wait for connections, tell it to call our CompletionHandler when there
+        // is a new incoming connection
+        listener.accept(null, new CompletionHandler<AsynchronousSocketChannel, Void>() {
+            @Override
+            public void completed(AsynchronousSocketChannel result, Void attachment) {
+                // request a new accept and handle the incoming connection
+                listener.accept(null, this);
+                handleNewConnection(result);
+            }
+
+            @Override
+            public void failed(Throwable exc, Void attachment) {
+            }
+        });
+    }
+
+    /**
+     * Shuts down the server
+     * @throws InterruptedException if terminated while waiting for shutdown
+     * @throws IOException if failing to shutdown the channel group
+     */
+    public void shutdown() throws InterruptedException, IOException {
+        channelGroup.shutdownNow();
+        channelGroup.awaitTermination(1, TimeUnit.SECONDS);
+    }
+
+    /*
+    * Creates a listener and starts accepting connections
+    */
+    private AsynchronousServerSocketChannel createListener(AsynchronousChannelGroup channelGroup) throws IOException {
+        final AsynchronousServerSocketChannel listener = openChannel(channelGroup);
+        listener.setOption(StandardSocketOption.SO_REUSEADDR, true);
+        listener.bind(new InetSocketAddress(port));
+        return listener;
+    }
+
+    private AsynchronousServerSocketChannel openChannel(AsynchronousChannelGroup channelGroup) throws IOException {
+        return AsynchronousServerSocketChannel.open(channelGroup);
+    }
+
+    /**
+     * Creates a new client and adds it to the list of connections.
+     * Sets the clients handler to the initial state of NameReader
+     *
+     * @param channel the newly accepted channel
+     */
+    private void handleNewConnection(AsynchronousSocketChannel channel) {
+        Client client = new Client(channel, new ClientReader(this, new NameReader(this)));
+        try {
+            channel.setOption(StandardSocketOption.TCP_NODELAY, true);
+        } catch (IOException e) {
+            // ignore
+        }
+        connections.add(client);
+        client.run();
+    }
+
+    /**
+     * Sends a message to all clients except the source.
+     * The method is synchronized as it is desired that messages are sent to
+     * all clients in the same order as received.
+     *
+     * @param client the message source
+     * @param message the message to be sent
+     */
+    public void writeMessageToClients(Client client, String message) {
+        synchronized (connections) {
+            for (Client clientConnection : connections) {
+                if (clientConnection != client) {
+                    clientConnection.writeMessageFrom(client, message);
+                }
+            }
+        }
+    }
+
+    public void removeClient(Client client) {
+        connections.remove(client);
+    }
+
+    private static void usage() {
+        System.err.println("ChatServer [-port <port number>]");
+        System.exit(1);
+    }
+
+    public static void main(String[] args) throws IOException {
+        int port = 5000;
+        if (args.length != 0 && args.length != 2) {
+            usage();
+        } else if (args.length == 2) {
+            try {
+                if (args[0].equals("-port")) {
+                    port = Integer.parseInt(args[1]);
+                } else {
+                    usage();
+                }
+            } catch (NumberFormatException e) {
+                usage();
+            }
+        }
+        System.out.println("Running on port " + port);
+        new ChatServer(port).run();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/Client.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousSocketChannel;
+import java.nio.channels.CompletionHandler;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Client represents a remote connection to the chat server.
+ * It contains methods for reading and writing messages from the
+ * channel.
+ * Messages are considered to be separated by newline, so incomplete
+ * messages are buffered in the {@code Client}.
+ *
+ * All reads and writes are asynchronous and uses the nio2 asynchronous
+ * elements.
+ */
+class Client {
+    private final AsynchronousSocketChannel channel;
+    private AtomicReference<ClientReader> reader;
+    private String userName;
+    private final StringBuilder messageBuffer = new StringBuilder();
+
+    private final Queue<ByteBuffer> queue = new LinkedList<ByteBuffer>();
+    private boolean writing = false;
+
+    public Client(AsynchronousSocketChannel channel, ClientReader reader) {
+        this.channel = channel;
+        this.reader = new AtomicReference<ClientReader>(reader);
+    }
+
+    /**
+     * Enqueues a write of the buffer to the channel.
+     * The call is asynchronous so the buffer is not safe to modify after
+     * passing the buffer here.
+     *
+     * @param buffer the buffer to send to the channel
+     */
+    private void writeMessage(final ByteBuffer buffer) {
+        boolean threadShouldWrite = false;
+
+        synchronized(queue) {
+            queue.add(buffer);
+            // Currently no thread writing, make this thread dispatch a write
+            if (!writing) {
+                writing = true;
+                threadShouldWrite = true;
+            }
+        }
+
+        if (threadShouldWrite) {
+            writeFromQueue();
+        }
+    }
+
+    private void writeFromQueue() {
+        ByteBuffer buffer;
+
+        synchronized (queue) {
+            buffer = queue.poll();
+            if (buffer == null) {
+                writing = false;
+            }
+        }
+
+        // No new data in buffer to write
+        if (writing) {
+            writeBuffer(buffer);
+        }
+    }
+
+    private void writeBuffer(ByteBuffer buffer) {
+        channel.write(buffer, buffer, new CompletionHandler<Integer, ByteBuffer>() {
+            @Override
+            public void completed(Integer result, ByteBuffer buffer) {
+                if (buffer.hasRemaining()) {
+                    channel.write(buffer, buffer, this);
+                } else {
+                    // Go back and check if there is new data to write
+                    writeFromQueue();
+                }
+            }
+
+            @Override
+            public void failed(Throwable exc, ByteBuffer attachment) {
+            }
+        });
+    }
+
+    /**
+     * Sends a message
+     * @param string the message
+     */
+    public void writeStringMessage(String string) {
+        writeMessage(ByteBuffer.wrap(string.getBytes()));
+    }
+
+    /**
+     * Send a message from a specific client
+     * @param client the message is sent from
+     * @param message to send
+     */
+    public void writeMessageFrom(Client client, String message) {
+        if (reader.get().acceptsMessages()) {
+            writeStringMessage(client.getUserName() + ": " + message);
+        }
+    }
+
+    /**
+     * Enqueue a read
+     * @param completionHandler callback on completed read
+     */
+    public void read(CompletionHandler<Integer, ? super ByteBuffer> completionHandler) {
+        ByteBuffer input = ByteBuffer.allocate(256);
+        if (!channel.isOpen()) {
+            return;
+        }
+        channel.read(input, input, completionHandler);
+    }
+
+    /**
+     * Closes the channel
+     */
+    public void close() {
+        try {
+            channel.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Run the current states actions.
+     */
+    public void run() {
+        reader.get().run(this);
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public void setReader(ClientReader reader) {
+        this.reader.set(reader);
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void appendMessage(String message) {
+        synchronized (messageBuffer) {
+            messageBuffer.append(message);
+        }
+    }
+
+    /**
+     * @return the next newline separated message in the buffer. null is returned if the buffer
+     * doesn't contain any newline.
+     */
+    public String nextMessage() {
+        synchronized(messageBuffer) {
+            int nextNewline = messageBuffer.indexOf("\n");
+            if (nextNewline == -1) {
+                return null;
+            }
+            String message = messageBuffer.substring(0, nextNewline + 1);
+            messageBuffer.delete(0, nextNewline + 1);
+            return message;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/ClientReader.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.nio.ByteBuffer;
+import java.nio.channels.CompletionHandler;
+
+/**
+ * Handles a cycle of reading / writing on the {@code Client}.
+ */
+class ClientReader {
+    private final DataReader callback;
+    private final ChatServer chatServer;
+
+    ClientReader(ChatServer chatServer, DataReader callback) {
+        this.chatServer = chatServer;
+        this.callback = callback;
+    }
+
+    public boolean acceptsMessages() {
+        return callback.acceptsMessages();
+    }
+
+    /**
+     * Runs a cycle of doing a beforeRead action and then enqueing a new
+     * read on the client. Handles closed channels and errors while reading.
+     * If the client is still connected a new round of actions are called.
+     */
+    public void run(final Client client) {
+        callback.beforeRead(client);
+        client.read(new CompletionHandler<Integer, ByteBuffer>() {
+            @Override
+            public void completed(Integer result, ByteBuffer buffer) {
+                // if result is negative or zero the connection has been closed or something gone wrong
+                if (result < 1) {
+                    client.close();
+                    System.out.println("Closing connection to " + client);
+                    chatServer.removeClient(client);
+                } else {
+                    callback.onData(client, buffer, result);
+                    // enqueue next round of actions
+                    client.run();
+                }
+            }
+
+            @Override
+            public void failed(Throwable exc, ByteBuffer buffer) {
+                client.close();
+                chatServer.removeClient(client);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/DataReader.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.nio.ByteBuffer;
+
+public interface DataReader {
+    void beforeRead(Client client);
+    void onData(Client client, ByteBuffer buffer, int bytes);
+    boolean acceptsMessages();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/MessageReader.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.nio.ByteBuffer;
+
+/**
+ * Writes all messages in our buffer to the other clients
+ * and appends new data read from the socket to our buffer
+ */
+class MessageReader implements DataReader {
+    private final ChatServer chatServer;
+
+    public MessageReader(ChatServer chatServer) {
+        this.chatServer = chatServer;
+    }
+
+    public boolean acceptsMessages() {
+        return true;
+    }
+
+    /**
+     * Write all full messages in our buffer to
+     * the other clients
+     *
+     * @param client the client to read messages from
+     */
+    @Override
+    public void beforeRead(Client client) {
+        // Check if we have any messages buffered and send them
+        String message = client.nextMessage();
+        while (message != null) {
+            chatServer.writeMessageToClients(client, message);
+            message = client.nextMessage();
+        }
+    }
+
+    /**
+     * Append the read buffer to the clients message buffer
+     * @param client the client to append messages to
+     * @param buffer the buffer we received from the socket
+     * @param bytes the number of bytes read into the buffer
+     */
+    @Override
+    public void onData(Client client, ByteBuffer buffer, int bytes) {
+        buffer.flip();
+        // Just append the message on the buffer
+        client.appendMessage(new String(buffer.array(), 0, bytes));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/NameReader.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.nio.ByteBuffer;
+
+/**
+ * The first state a newly connected {@code Client} is in, this
+ * handles writing out the welcoming message and reads the response
+ * up to a newline. When a newline character have been received
+ * it changes the handler from NameReader to MessageReader on the
+ * client.
+ */
+class NameReader implements DataReader {
+    private final StringBuilder buffer = new StringBuilder();
+    private final ChatServer chatServer;
+    private boolean once = true;
+    private static final String NEWLINE = "\n";
+
+    public NameReader(ChatServer chatServer) {
+        this.chatServer = chatServer;
+    }
+
+    /**
+     * Writes the welcoming message to the client the first time this method
+     * is called.
+     *
+     * @param client the client to receive the message
+     */
+    @Override
+    public void beforeRead(Client client) {
+        // if it is a long name that takes more than one read we only want to display Name: once.
+        if (once) {
+            client.writeStringMessage("Name: ");
+            once = false;
+        }
+    }
+
+    public boolean acceptsMessages() {
+        return false;
+    }
+
+    /**
+     * Receives incoming data from the socket, searches for a newline
+     * and tries to set the username if one is found
+     */
+    @Override
+    public void onData(Client client, ByteBuffer buffer, int bytes) {
+        buffer.flip();
+        String name;
+        name = this.buffer.append(new String(buffer.array(), 0, bytes)).toString();
+        if (name.contains(NEWLINE)) {
+            onUserNameRead(client, name);
+        }
+    }
+
+    /**
+     * Splits the name on the newlines, takes the first as the username
+     * and appends everything else to the clients message buffer.
+     * Sets the clients handler to MessageReader.
+     *
+     * @param client the client to set the username for
+     * @param name the string containing the buffered input
+     */
+    private void onUserNameRead(Client client, String name) {
+        String[] strings = name.split(NEWLINE, 2);
+        client.setUserName(strings[0].trim());
+        sendRemainingParts(client, strings);
+        client.setReader(new ClientReader(chatServer, new MessageReader(chatServer)));
+        client.writeStringMessage("Welcome " + client.getUserName() + "\n");
+    }
+
+    /**
+     * Appends the remaining parts to the clients message buffer
+     *
+     * @param client the client
+     * @param strings the messages to append to the buffer
+     */
+    private void sendRemainingParts(Client client, String[] strings) {
+        for (int i = 1; i < strings.length; ++i) {
+            client.appendMessage(strings[i]);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/sample/nio/chatserver/README.txt	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,62 @@
+A Simple Chat Server Example
+
+INTRODUCTION
+============
+This directory contains a very simple chat server, the server takes input from a
+socket ("user") and sends it to all other connected sockets ("users") along with
+the provided name the user was asked for when first connecting.
+
+The server was written to demonstrate the asynchronous I/O API in JDK 7. 
+The sample assumes the reader has some familiarity with the subject matter.
+
+SETUP
+=====
+
+The server must be built with version 7 (or later) of the JDK.
+The server is built with:
+
+    % mkdir build
+    % javac -source 7 -target 7 -d build *.java
+
+EXECUTION
+=========
+
+    % java -classpath build ChatServer [-port <port number>]
+
+    Usage:  ChatServer [options]
+        options:
+            -port port      port number
+                default: 5000
+
+CLIENT EXECUTION
+================
+
+No client binary is included in the sample.
+Connections can be made using for example the telnet command or any program
+that supports a raw TCP connection to a port.
+
+SOURCE CODE OVERVIEW
+====================
+ChatServer is the main class, it handles the startup and handles incoming
+connections on the listening sockets. It keeps a list of connected client
+and provides methods for sending a message to them.
+
+Client represents a connected user, it provides methods for reading/writing
+from/to the underlying socket. It also contains a buffer of input read from
+the user.
+
+DataReader provides the interface of the two states a user can
+be in. Waiting for a name (and not receiving any messages while doing so, implemented
+by NameReader) and waiting for messages from the user (implemented by MessageReader).
+
+ClientReader contains the "main loop" for a connected client. 
+
+NameReader is the initial state for a new client, it sends the user a string and
+waits for a response before changing the state to MessageReader.
+
+MessageReader is the main state for a client, it checks for new messages to send to
+other clients and reads messages from the client.
+
+FINALLY
+=======
+This is a sample: it is not production quality and isn't optimized for performance.
--- a/jdk/src/solaris/bin/java_md.c	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/solaris/bin/java_md.c	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -46,6 +46,10 @@
 #define JVM_DLL "libjvm.so"
 #define JAVA_DLL "libjava.so"
 
+/* help jettison the LD_LIBRARY_PATH settings in the future */
+#ifndef SETENV_REQUIRED
+#define SETENV_REQUIRED
+#endif
 /*
  * If a processor / os combination has the ability to run binaries of
  * two data models and cohabitation of jre/jdk bits with both data
@@ -106,10 +110,22 @@
  * Previously the launcher modified the LD_LIBRARY_PATH appropriately for the
  * desired data model path, regardless if data models matched or not. The
  * launcher subsequently exec'ed the desired executable, in order to make the
- * LD_LIBRARY_PATH path available for the runtime linker. This is no longer the
- * case, the launcher dlopens the target libjvm.so. All other required
- * libraries are loaded by the runtime linker, by virtue of the $ORIGIN paths
- * baked into the shared libraries, by the build infrastructure at compile time.
+ * LD_LIBRARY_PATH path available, for the runtime linker.
+ *
+ * Now, in most cases,the launcher will dlopen the target libjvm.so. All
+ * required libraries are loaded by the runtime linker, using the
+ * $RPATH/$ORIGIN baked into the shared libraries at compile time. Therefore,
+ * in most cases, the launcher will only exec, if the data models are
+ * mismatched, and will not set any environment variables, regardless of the
+ * data models.
+ *
+ * However, if the environment contains a LD_LIBRARY_PATH, this will cause the
+ * launcher to inspect the LD_LIBRARY_PATH. The launcher will check
+ *  a. if the LD_LIBRARY_PATH's first component is the the path to the desired
+ *     libjvm.so
+ *  b. if any other libjvm.so is found in any of the paths.
+ * If case b is true, then the launcher will set the LD_LIBRARY_PATH to the
+ * desired JRE and reexec, in order to propagate the environment.
  *
  *  Main
  *  (incoming argv)
@@ -137,11 +153,11 @@
  *  |                                          |
  *  |                                          |
  * \|/                                        \|/
- * YES                              (find the desired executable and exec child)
+ * YES                             Find the desired executable/library
  *  |                                          |
  *  |                                          |
  * \|/                                        \|/
- * CheckJvmType                                Main
+ * CheckJvmType                          RequiresSetenv
  * (removes -client, -server, etc.)
  *  |
  *  |
@@ -156,7 +172,42 @@
  *  processes version options,
  *  creates argument list for vm,
  *  etc.)
- *
+ *   |
+ *   |
+ *  \|/
+ * RequiresSetenv
+ * Is LD_LIBRARY_PATH
+ * and friends set ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ *  YES                              YES --> Continue
+ *   |
+ *   |
+ *  \|/
+ * Path is desired JRE ? YES --> Have Desired Model ? NO --> Re-exec --> Main
+ *  NO                               YES --> Continue
+ *   |
+ *   |
+ *  \|/
+ * Paths have well known
+ * jvm paths ?       --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ *  YES                              YES --> Continue
+ *   |
+ *   |
+ *  \|/
+ *  Does libjvm.so exit
+ *  in any of them ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
+ *   YES                             YES --> Continue
+ *   |
+ *   |
+ *  \|/
+ *  Set the LD_LIBRARY_PATH
+ *   |
+ *   |
+ *  \|/
+ * Re-exec
+ *   |
+ *   |
+ *  \|/
+ * Main
  */
 
 static const char * SetExecname(char **argv);
@@ -182,6 +233,130 @@
     }
 }
 
+#ifdef SETENV_REQUIRED
+static jboolean
+JvmExists(const char *path) {
+    char tmp[PATH_MAX + 1];
+    struct stat statbuf;
+    JLI_Snprintf(tmp, PATH_MAX, "%s/%s", path, JVM_DLL);
+    if (stat(tmp, &statbuf) == 0) {
+        return JNI_TRUE;
+    }
+    return JNI_FALSE;
+}
+/*
+ * contains a lib/$LIBARCH/{server,client}/libjvm.so ?
+ */
+static jboolean
+ContainsLibJVM(int wanted, const char *env) {
+    char clientPattern[PATH_MAX + 1];
+    char serverPattern[PATH_MAX + 1];
+    char *envpath;
+    char *path;
+    jboolean clientPatternFound;
+    jboolean serverPatternFound;
+
+    /* fastest path */
+    if (env == NULL) {
+        return JNI_FALSE;
+    }
+
+    /* the usual suspects */
+    JLI_Snprintf(clientPattern, PATH_MAX, "lib/%s/client", GetArchPath(wanted));
+    JLI_Snprintf(serverPattern, PATH_MAX, "lib/%s/server", GetArchPath(wanted));
+
+    /* to optimize for time, test if any of our usual suspects are present. */
+    clientPatternFound = JLI_StrStr(env, clientPattern) != NULL;
+    serverPatternFound = JLI_StrStr(env, serverPattern) != NULL;
+    if (clientPatternFound == JNI_FALSE && serverPatternFound == JNI_FALSE) {
+        return JNI_FALSE;
+    }
+
+    /*
+     * we have a suspicious path component, check if it contains a libjvm.so
+     */
+    envpath = JLI_StringDup(env);
+    for (path = JLI_StrTok(envpath, ":"); path != NULL; path = JLI_StrTok(NULL, ":")) {
+        if (clientPatternFound && JLI_StrStr(path, clientPattern) != NULL) {
+            if (JvmExists(path)) {
+                JLI_MemFree(envpath);
+                return JNI_TRUE;
+            }
+        }
+        if (serverPatternFound && JLI_StrStr(path, serverPattern)  != NULL) {
+            if (JvmExists(path)) {
+                JLI_MemFree(envpath);
+                return JNI_TRUE;
+            }
+        }
+    }
+    JLI_MemFree(envpath);
+    return JNI_FALSE;
+}
+
+/*
+ * Test whether the environment variable needs to be set, see flowchart.
+ */
+static jboolean
+RequiresSetenv(int wanted, const char *jvmpath) {
+    char jpath[PATH_MAX + 1];
+    char *llp;
+    char *dmllp = NULL;
+    char *p; /* a utility pointer */
+
+    llp = getenv("LD_LIBRARY_PATH");
+#ifdef __solaris__
+    dmllp = (CURRENT_DATA_MODEL == 32)
+            ? getenv("LD_LIBRARY_PATH_32")
+            : getenv("LD_LIBRARY_PATH_64");
+#endif /* __solaris__ */
+    /* no environment variable is a good environment variable */
+    if (llp == NULL && dmllp == NULL) {
+        return JNI_FALSE;
+    }
+#ifdef __linux
+    /*
+     * On linux, if a binary is running as sgid or suid, glibc sets
+     * LD_LIBRARY_PATH to the empty string for security purposes. (In contrast,
+     * on Solaris the LD_LIBRARY_PATH variable for a privileged binary does not
+     * lose its settings; but the dynamic linker does apply more scrutiny to the
+     * path.) The launcher uses the value of LD_LIBRARY_PATH to prevent an exec
+     * loop, here and further downstream. Therefore, if we are running sgid or
+     * suid, this function's setting of LD_LIBRARY_PATH will be ineffective and
+     * we should case a return from the calling function.  Getting the right
+     * libraries will be handled by the RPATH. In reality, this check is
+     * redundant, as the previous check for a non-null LD_LIBRARY_PATH will
+     * return back to the calling function forthwith, it is left here to safe
+     * guard against any changes, in the glibc's existing security policy.
+     */
+    if ((getgid() != getegid()) || (getuid() != geteuid())) {
+        return JNI_FALSE;
+    }
+#endif /* __linux */
+
+    /*
+     * Prevent recursions. Since LD_LIBRARY_PATH is the one which will be set by
+     * previous versions of the JRE, thus it is the only path that matters here.
+     * So we check to see if the desired JRE is set.
+     */
+    JLI_StrNCpy(jpath, jvmpath, PATH_MAX);
+    p = JLI_StrRChr(jpath, '/');
+    *p = '\0';
+    if (llp != NULL && JLI_StrNCmp(llp, jpath, JLI_StrLen(jpath)) == 0) {
+        return JNI_FALSE;
+    }
+
+    /* scrutinize all the paths further */
+    if (llp != NULL &&  ContainsLibJVM(wanted, llp)) {
+        return JNI_TRUE;
+    }
+    if (dmllp != NULL && ContainsLibJVM(wanted, dmllp)) {
+        return JNI_TRUE;
+    }
+    return JNI_FALSE;
+}
+#endif /* SETENV_REQUIRED */
+
 void
 CreateExecutionEnvironment(int *pargc, char ***pargv,
                            char jrepath[], jint so_jrepath,
@@ -195,7 +370,6 @@
    * informative to issue an error message based on whether or not the
    * os/processor combination has dual mode capabilities.
    */
-
     jboolean jvmpathExists;
 
     /* Compute/set the name of the executable */
@@ -207,13 +381,24 @@
       char * jvmtype    = NULL;
       int  argc         = *pargc;
       char **argv       = *pargv;
-
       int running       = CURRENT_DATA_MODEL;
 
       int wanted        = running;      /* What data mode is being
                                            asked for? Current model is
                                            fine unless another model
                                            is asked for */
+#ifdef SETENV_REQUIRED
+      jboolean mustsetenv = JNI_FALSE;
+      char *runpath     = NULL; /* existing effective LD_LIBRARY_PATH setting */
+      char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
+      char* newpath     = NULL; /* path on new LD_LIBRARY_PATH */
+      char* lastslash   = NULL;
+      char** newenvp    = NULL; /* current environment */
+#ifdef __solaris__
+      char*  dmpath     = NULL;  /* data model specific LD_LIBRARY_PATH,
+                                    Solaris only */
+#endif /* __solaris__ */
+#endif  /* SETENV_REQUIRED */
 
       char** newargv    = NULL;
       int    newargc    = 0;
@@ -300,9 +485,18 @@
         }
         /*
          * we seem to have everything we need, so without further ado
-         * we return back.
+         * we return back, otherwise proceed to set the environment.
          */
+#ifdef SETENV_REQUIRED
+        mustsetenv = RequiresSetenv(wanted, jvmpath);
+        JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE");
+
+        if (mustsetenv == JNI_FALSE) {
+            return;
+        }
+#else
         return;
+#endif /* SETENV_REQUIRED */
       } else {  /* do the same speculatively or exit */
 #ifdef DUAL_MODE
         if (running != wanted) {
@@ -331,67 +525,240 @@
 
           /* exec child can do error checking on the existence of the path */
           jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, GetArchPath(wanted));
-
+#ifdef SETENV_REQUIRED
+          mustsetenv = RequiresSetenv(wanted, jvmpath);
+#endif /* SETENV_REQUIRED */
         }
 #else
         JLI_ReportErrorMessage(JRE_ERROR2, wanted);
         exit(1);
 #endif
-      }
+        }
+#ifdef SETENV_REQUIRED
+        if (mustsetenv) {
+            /*
+             * We will set the LD_LIBRARY_PATH as follows:
+             *
+             *     o          $JVMPATH (directory portion only)
+             *     o          $JRE/lib/$LIBARCHNAME
+             *     o          $JRE/../lib/$LIBARCHNAME
+             *
+             * followed by the user's previous effective LD_LIBRARY_PATH, if
+             * any.
+             */
+
+#ifdef __solaris__
+            /*
+             * Starting in Solaris 7, ld.so.1 supports three LD_LIBRARY_PATH
+             * variables:
+             *
+             * 1. LD_LIBRARY_PATH -- used for 32 and 64 bit searches if
+             * data-model specific variables are not set.
+             *
+             * 2. LD_LIBRARY_PATH_64 -- overrides and replaces LD_LIBRARY_PATH
+             * for 64-bit binaries.
+             *
+             * 3. LD_LIBRARY_PATH_32 -- overrides and replaces LD_LIBRARY_PATH
+             * for 32-bit binaries.
+             *
+             * The vm uses LD_LIBRARY_PATH to set the java.library.path system
+             * property.  To shield the vm from the complication of multiple
+             * LD_LIBRARY_PATH variables, if the appropriate data model
+             * specific variable is set, we will act as if LD_LIBRARY_PATH had
+             * the value of the data model specific variant and the data model
+             * specific variant will be unset.  Note that the variable for the
+             * *wanted* data model must be used (if it is set), not simply the
+             * current running data model.
+             */
+
+            switch (wanted) {
+                case 0:
+                    if (running == 32) {
+                        dmpath = getenv("LD_LIBRARY_PATH_32");
+                        wanted = 32;
+                    } else {
+                        dmpath = getenv("LD_LIBRARY_PATH_64");
+                        wanted = 64;
+                    }
+                    break;
 
-      {
-        char *newexec = execname;
+                case 32:
+                    dmpath = getenv("LD_LIBRARY_PATH_32");
+                    break;
+
+                case 64:
+                    dmpath = getenv("LD_LIBRARY_PATH_64");
+                    break;
+
+                default:
+                    JLI_ReportErrorMessage(JRE_ERROR3, __LINE__);
+                    exit(1); /* unknown value in wanted */
+                    break;
+            }
+
+            /*
+             * If dmpath is NULL, the relevant data model specific variable is
+             * not set and normal LD_LIBRARY_PATH should be used.
+             */
+            if (dmpath == NULL) {
+                runpath = getenv("LD_LIBRARY_PATH");
+            } else {
+                runpath = dmpath;
+            }
+#else
+            /*
+             * If not on Solaris, assume only a single LD_LIBRARY_PATH
+             * variable.
+             */
+            runpath = getenv("LD_LIBRARY_PATH");
+#endif /* __solaris__ */
+
+            /* runpath contains current effective LD_LIBRARY_PATH setting */
+
+            jvmpath = JLI_StringDup(jvmpath);
+            new_runpath = JLI_MemAlloc(((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
+                    2 * JLI_StrLen(jrepath) + 2 * JLI_StrLen(arch) +
+                    JLI_StrLen(jvmpath) + 52);
+            newpath = new_runpath + JLI_StrLen("LD_LIBRARY_PATH=");
+
+
+            /*
+             * Create desired LD_LIBRARY_PATH value for target data model.
+             */
+            {
+                /* remove the name of the .so from the JVM path */
+                lastslash = JLI_StrRChr(jvmpath, '/');
+                if (lastslash)
+                    *lastslash = '\0';
+
+                sprintf(new_runpath, "LD_LIBRARY_PATH="
+                        "%s:"
+                        "%s/lib/%s:"
+                        "%s/../lib/%s",
+                        jvmpath,
 #ifdef DUAL_MODE
-        /*
-         * If the data model is being changed, the path to the
-         * executable must be updated accordingly; the executable name
-         * and directory the executable resides in are separate.  In the
-         * case of 32 => 64, the new bits are assumed to reside in, e.g.
-         * "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32,
-         * the bits are assumed to be in "olddir/../execname".  For example,
-         *
-         * olddir/sparcv9/execname
-         * olddir/amd64/execname
-         *
-         * for Solaris SPARC and Linux amd64, respectively.
-         */
-
-        if (running != wanted) {
-          char *oldexec = JLI_StrCpy(JLI_MemAlloc(JLI_StrLen(execname) + 1), execname);
-          char *olddir = oldexec;
-          char *oldbase = JLI_StrRChr(oldexec, '/');
+                        jrepath, GetArchPath(wanted),
+                        jrepath, GetArchPath(wanted)
+#else
+                        jrepath, arch,
+                        jrepath, arch
+#endif
+                        );
 
 
-          newexec = JLI_MemAlloc(JLI_StrLen(execname) + 20);
-          *oldbase++ = 0;
-          sprintf(newexec, "%s/%s/%s", olddir,
-                  ((wanted==64) ? LIBARCH64NAME : ".."), oldbase);
-          argv[0] = newexec;
+                /*
+                 * Check to make sure that the prefix of the current path is the
+                 * desired environment variable setting, though the RequiresSetenv
+                 * checks if the desired runpath exists, this logic does a more
+                 * comprehensive check.
+                 */
+                if (runpath != NULL &&
+                        JLI_StrNCmp(newpath, runpath, JLI_StrLen(newpath)) == 0 &&
+                        (runpath[JLI_StrLen(newpath)] == 0 || runpath[JLI_StrLen(newpath)] == ':') &&
+                        (running == wanted) /* data model does not have to be changed */
+#ifdef __solaris__
+                        && (dmpath == NULL) /* data model specific variables not set  */
+#endif
+                        ) {
+
+                    return;
+
+                }
+            }
+
+            /*
+             * Place the desired environment setting onto the prefix of
+             * LD_LIBRARY_PATH.  Note that this prevents any possible infinite
+             * loop of execv() because we test for the prefix, above.
+             */
+            if (runpath != 0) {
+                JLI_StrCat(new_runpath, ":");
+                JLI_StrCat(new_runpath, runpath);
+            }
+
+            if (putenv(new_runpath) != 0) {
+                exit(1); /* problem allocating memory; LD_LIBRARY_PATH not set
+                    properly */
+            }
+
+            /*
+             * Unix systems document that they look at LD_LIBRARY_PATH only
+             * once at startup, so we have to re-exec the current executable
+             * to get the changed environment variable to have an effect.
+             */
+
+#ifdef __solaris__
+            /*
+             * If dmpath is not NULL, remove the data model specific string
+             * in the environment for the exec'ed child.
+             */
+            if (dmpath != NULL)
+                (void)UnsetEnv((wanted == 32) ? "LD_LIBRARY_PATH_32" : "LD_LIBRARY_PATH_64");
+#endif
+
+            newenvp = environ;
         }
-#endif
-        JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
-        (void)fflush(stdout);
-        (void)fflush(stderr);
-        execv(newexec, argv);
-        JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
+#endif /* SETENV_REQUIRED */
+        {
+            char *newexec = execname;
+#ifdef DUAL_MODE
+            /*
+             * If the data model is being changed, the path to the
+             * executable must be updated accordingly; the executable name
+             * and directory the executable resides in are separate.  In the
+             * case of 32 => 64, the new bits are assumed to reside in, e.g.
+             * "olddir/LIBARCH64NAME/execname"; in the case of 64 => 32,
+             * the bits are assumed to be in "olddir/../execname".  For example,
+             *
+             * olddir/sparcv9/execname
+             * olddir/amd64/execname
+             *
+             * for Solaris SPARC and Linux amd64, respectively.
+             */
+
+            if (running != wanted) {
+                char *oldexec = JLI_StrCpy(JLI_MemAlloc(JLI_StrLen(execname) + 1), execname);
+                char *olddir = oldexec;
+                char *oldbase = JLI_StrRChr(oldexec, '/');
+
+
+                newexec = JLI_MemAlloc(JLI_StrLen(execname) + 20);
+                *oldbase++ = 0;
+                sprintf(newexec, "%s/%s/%s", olddir,
+                        ((wanted == 64) ? LIBARCH64NAME : ".."), oldbase);
+                argv[0] = newexec;
+            }
+#endif /* DUAL_MODE */
+            JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
+            (void) fflush(stdout);
+            (void) fflush(stderr);
+#ifdef SETENV_REQUIRED
+            if (mustsetenv) {
+                execve(newexec, argv, newenvp);
+            } else {
+                execv(newexec, argv);
+            }
+#else
+            execv(newexec, argv);
+#endif /* SETENV_REQUIRED */
+            JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
 
 #ifdef DUAL_MODE
-        if (running != wanted) {
-          JLI_ReportErrorMessage(JRE_ERROR5, wanted, running);
-#  ifdef __solaris__
-#    ifdef __sparc
-          JLI_ReportErrorMessage(JRE_ERROR6);
-#    else
-          JLI_ReportErrorMessage(JRE_ERROR7);
-#    endif
+            if (running != wanted) {
+                JLI_ReportErrorMessage(JRE_ERROR5, wanted, running);
+#ifdef __solaris__
+#ifdef __sparc
+                JLI_ReportErrorMessage(JRE_ERROR6);
+#else
+                JLI_ReportErrorMessage(JRE_ERROR7);
+#endif  /* __sparc */
+            }
+#endif /* __solaris__ */
+#endif /* DUAL_MODE */
+
         }
-#  endif
-#endif
-
-      }
-      exit(1);
+        exit(1);
     }
-
 }
 
 /*
--- a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	Tue Apr 26 15:48:03 2011 -0700
@@ -128,12 +128,12 @@
         }
     }
 
-    /* Calculate toolkit name, kind of toolkit (XAWT, Motif) and library to load */
+    /* Calculate library name to load */
     if (AWTIsHeadless()) {
-        strcpy(p, "/headless/libmawt");
+        strncpy(p, "/headless/libmawt.so", MAXPATHLEN-len-1);
     } else {
         /* Default AWT Toolkit on Linux and Solaris is XAWT. */
-        strcpy(p, "/xawt/libmawt");
+        strncpy(p, "/xawt/libmawt.so", MAXPATHLEN-len-1);
     }
 
     if (toolkit) {
@@ -143,23 +143,12 @@
         (*env)->DeleteLocalRef(env, propname);
     }
 
-    strcat(p, ".so");
-
     JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load",
                                "(Ljava/lang/String;)V",
                                JNU_NewStringPlatform(env, buf));
 
     awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
 
-/*
-  if (dlsym(awtHandle, "AWTCharRBearing") == NULL) {
-  printf("========= AWTCharRBearing not found\n"); fflush(stdout);
-  }
-  else {
-  printf("========= AWTCharRBearing was found\n"); fflush(stdout);
-  }
-*/
-
     return JNI_VERSION_1_2;
 }
 
--- a/jdk/src/solaris/native/sun/awt/awt_mgrsel.c	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_mgrsel.c	Tue Apr 26 15:48:03 2011 -0700
@@ -136,7 +136,7 @@
         || per_scr_owners == NULL || mgrsel == NULL)
     {
         DTRACE_PRINTLN("MG: select: unable to allocate memory");
-        if (namesbuf != NULL) free(per_scr_atoms);
+        if (namesbuf != NULL) free(namesbuf);
         if (names != NULL) free(names);
         if (per_scr_atoms != NULL) free(per_scr_atoms);
         if (per_scr_owners != NULL) free(per_scr_owners);
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Tue Apr 26 15:48:03 2011 -0700
@@ -443,6 +443,8 @@
             "gtk_file_chooser_set_current_folder");
     fp_gtk_file_chooser_set_filename = dl_symbol(
             "gtk_file_chooser_set_filename");
+    fp_gtk_file_chooser_set_current_name = dl_symbol(
+            "gtk_file_chooser_set_current_name");
     fp_gtk_file_filter_add_custom = dl_symbol("gtk_file_filter_add_custom");
     fp_gtk_file_chooser_set_filter = dl_symbol("gtk_file_chooser_set_filter");
     fp_gtk_file_chooser_get_type = dl_symbol("gtk_file_chooser_get_type");
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Tue Apr 26 15:48:03 2011 -0700
@@ -766,6 +766,8 @@
     const gchar *filename);
 gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
     const char *filename);
+void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
+    const gchar *name);
 void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
     GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
     GDestroyNotify notify);
--- a/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Tue Apr 26 15:48:03 2011 -0700
@@ -4,6 +4,7 @@
 #include <string.h>
 #include "gtk2_interface.h"
 #include "sun_awt_X11_GtkFileDialogPeer.h"
+#include "java_awt_FileDialog.h"
 #include "debug_assert.h"
 
 static JavaVM *jvm;
@@ -220,7 +221,7 @@
 
     const char *title = jtitle == NULL? "": (*env)->GetStringUTFChars(env, jtitle, 0);
 
-    if (mode == 1) {
+    if (mode == java_awt_FileDialog_SAVE) {
         /* Save action */
         dialog = fp_gtk_file_chooser_dialog_new(title, NULL,
                 GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL,
@@ -253,7 +254,11 @@
     /* Set the filename */
     if (jfile != NULL) {
         const char *filename = (*env)->GetStringUTFChars(env, jfile, 0);
-        fp_gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename);
+        if (mode == java_awt_FileDialog_SAVE) {
+            fp_gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), filename);
+        } else {
+            fp_gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename);
+        }
         (*env)->ReleaseStringUTFChars(env, jfile, filename);
     }
 
--- a/jdk/src/windows/classes/sun/awt/Win32FontManager.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/windows/classes/sun/awt/Win32FontManager.java	Tue Apr 26 15:48:03 2011 -0700
@@ -62,8 +62,11 @@
                     String eudcFile = getEUDCFontFile();
                     if (eudcFile != null) {
                         try {
+                            /* Must use Java rasteriser since GDI doesn't
+                             * enumerate (allow direct use) of EUDC fonts.
+                             */
                             eudcFont = new TrueTypeFont(eudcFile, null, 0,
-                                                        false);
+                                                        true);
                         } catch (FontFormatException e) {
                         }
                     }
@@ -100,6 +103,14 @@
             });
     }
 
+    /**
+     * Whether registerFontFile expects absolute or relative
+     * font file names.
+     */
+    protected boolean useAbsoluteFontFileNames() {
+        return false;
+    }
+
     /* Unlike the shared code version, this expects a base file name -
      * not a full path name.
      * The font configuration file has base file names and the FontConfiguration
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java	Tue Apr 26 15:48:03 2011 -0700
@@ -72,12 +72,6 @@
     }
 
     /**
-     * Noop function that just acts as an entry point for someone to force
-     * a static initialization of this class.
-     */
-    public static void init() {}
-
-    /**
      * Initializes native components of the graphics environment.  This
      * includes everything from the native GraphicsDevice elements to
      * the DirectX rendering layer.
@@ -208,14 +202,6 @@
  * ----END DISPLAY CHANGE SUPPORT----
  */
 
-    /**
-     * Whether registerFontFile expects absolute or relative
-     * font file names.
-     */
-    protected boolean useAbsoluteFontFileNames() {
-        return false;
-    }
-
     protected GraphicsDevice makeScreenDevice(int screennum) {
         GraphicsDevice device = null;
         if (WindowsFlags.isD3DEnabled()) {
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Tue Apr 26 15:48:03 2011 -0700
@@ -103,9 +103,6 @@
 
     static {
         loadLibraries();
-        // Force Win32GE to load if it is not already loaded; this loads
-        // various other classes that are required for basic awt functionality
-        Win32GraphicsEnvironment.init();
         initIDs();
 
         // Print out which version of Windows is running
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileSystem.java	Tue Apr 26 15:48:03 2011 -0700
@@ -56,8 +56,9 @@
         // parse default directory and check it is absolute
         WindowsPathParser.Result result = WindowsPathParser.parse(dir);
 
-        if (result.type() != WindowsPathType.ABSOLUTE)
-            throw new AssertionError("Default directory must be absolute/non-UNC");
+        if ((result.type() != WindowsPathType.ABSOLUTE) &&
+            (result.type() != WindowsPathType.UNC))
+            throw new AssertionError("Default directory is not an absolute path");
         this.defaultDirectory = result.path();
         this.defaultRoot = result.root();
 
--- a/jdk/src/windows/native/sun/windows/awt_Button.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Button.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -317,7 +317,9 @@
             badAlloc = 1;
         } else {
             c->SetText(labelStr);
-            JNU_ReleaseStringPlatformChars(env, label, labelStr);
+            if (label != NULL) {
+                JNU_ReleaseStringPlatformChars(env, label, labelStr);
+            }
         }
     }
 
--- a/jdk/src/windows/native/sun/windows/awt_Checkbox.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Checkbox.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -384,7 +384,9 @@
         {
             c->SetText(labelStr);
             c->VerifyState();
-            JNU_ReleaseStringPlatformChars(env, label, labelStr);
+            if (label != NULL) {
+                JNU_ReleaseStringPlatformChars(env, label, labelStr);
+            }
         }
     }
 
--- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Tue Apr 26 15:48:03 2011 -0700
@@ -225,7 +225,6 @@
 {
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
     jobject peer;
-    WCHAR unicodeChar = L' ';
     LPTSTR fileBuffer = NULL;
     LPTSTR currentDirectory = NULL;
     jint mode = 0;
@@ -263,7 +262,7 @@
         HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL;
 
         if (title == NULL || env->GetStringLength(title)==0) {
-            title = JNU_NewStringPlatform(env, &unicodeChar);
+            title = JNU_NewStringPlatform(env, L" ");
         }
 
         JavaStringBuffer titleBuffer(env, title);
--- a/jdk/test/ProblemList.txt	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/ProblemList.txt	Tue Apr 26 15:48:03 2011 -0700
@@ -288,12 +288,6 @@
 
 # jdk_math
 
-# Problems with rounding add failures on solaris-sparcv9 and -server
-java/math/BigDecimal/AddTests.java			 	solaris-sparcv9
-
-# Should be samevm? But seems problematic with samevm on windows
-java/math/BigInteger/ModPow65537.java			 	generic-all
-
 ############################################################################
 
 # jdk_misc
--- a/jdk/test/com/sun/tools/attach/ApplicationSetup.sh	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/com/sun/tools/attach/ApplicationSetup.sh	Tue Apr 26 15:48:03 2011 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -40,7 +40,8 @@
 
 startApplication() 
 {
-  ${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} &
+  # put all output from the app into ${OUTPUTFILE}
+  ${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} 2>&1 &
   pid="$!"
 
   # MKS creates an intermediate shell to launch ${JAVA} so
--- a/jdk/test/com/sun/tools/attach/BasicTests.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -75,14 +75,23 @@
 
         // Test 3 - load an "bad" agent (agentmain throws an exception)
         System.out.println(" - Test: Load a bad agent");
+        System.out.println("INFO: This test will cause error messages "
+            + "to appear in the application log about SilverBullet.jar "
+            + "not being found and an agent failing to start.");
         try {
             vm.loadAgent(badagent);
+            throw new RuntimeException(
+                "AgentInitializationException not thrown as expected!");
         } catch (AgentInitializationException x) {
-            System.out.println(" - AgentInitializationException throws as expected!");
+            System.out.println(
+                " - AgentInitializationException thrown as expected!");
         }
 
         // Test 4 - detach from the VM and attempt a load (should throw IOE)
         System.out.println(" - Test: Detach from VM");
+        System.out.println("INFO: This test will cause error messages "
+            + "to appear in the application log about a BadAgent including "
+            + "a RuntimeException and an InvocationTargetException.");
         vm.detach();
         try {
             vm.loadAgent(agent);
--- a/jdk/test/com/sun/tools/attach/BasicTests.sh	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.sh	Tue Apr 26 15:48:03 2011 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -39,11 +39,9 @@
 
 # Windows 2000 is a problem here, so we skip it, see 6962615
 osrev=`uname -a`
-if [ "`echo ${osrev} | grep 'CYGWIN'`" != "" ] ; then
-  if [ "`echo ${osrev} | grep '5.0'`" != "" ] ; then
-     echo "Treating as a pass, not testing Windows 2000"
-     exit 0
-  fi
+if [ "`echo ${osrev} | grep 'CYGWIN[^ ]*-5\.0'`" != "" ] ; then
+  echo "Treating as a pass, not testing Windows 2000"
+  exit 0
 fi
 if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then
   if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then
@@ -58,7 +56,7 @@
 
 startApplication -Dattach.test=true
 # pid = process-id, port = shutdown port
-                                                                                                      
+
 failures=0
 
 echo "Running tests ..."
@@ -69,6 +67,18 @@
 
 stopApplication $port
 
+# Add these info messages to $OUTPUTFILE just in case someone
+# looks at it and wonders about the failures. We have to do
+# this after the application is stopped because it is writing
+# to $OUTPUTFILE.
+(
+echo ""
+echo "INFO: Test 2 will cause error messages about SilverBullet.jar" \
+    "and an agent failing to start."
+echo "INFO: Test 3 will cause error messages about BadAgent" \
+    "including a RuntimeException and an InvocationTargetException."
+) >> ${OUTPUTFILE}
+
 if [ $failures = 0 ]; 
   then echo "All tests passed.";
   else echo "$failures test(s) failed:"; cat ${OUTPUTFILE};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ *
+ * 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 7027013
+  @summary Dialog.show() should validate the window unconditionally
+  @author anthony.petrov@oracle.com: area=awt.toplevel
+  @run main ValidateOnShow
+*/
+
+import java.awt.*;
+
+public class ValidateOnShow {
+    private static Dialog dialog = new Dialog((Frame)null);
+    private static Panel panel = new Panel() {
+        @Override
+        public boolean isValidateRoot() {
+            return true;
+        }
+    };
+    private static Button button = new Button("Test");
+
+    private static void sleep() {
+        try { Thread.sleep(500); } catch (Exception e) {}
+    }
+
+    private static void test() {
+        System.out.println("Before showing: panel.isValid=" + panel.isValid() + "      dialog.isValid=" + dialog.isValid());
+        dialog.setVisible(true);
+        sleep();
+        System.out.println("After showing:  panel.isValid=" + panel.isValid() + "      dialog.isValid=" + dialog.isValid());
+
+        if (!panel.isValid()) {
+            dialog.dispose();
+            throw new RuntimeException("The panel hasn't been validated upon showing the dialog");
+        }
+
+        dialog.setVisible(false);
+        sleep();
+    }
+
+    public static void main(String[] args) {
+        // setup
+        dialog.add(panel);
+        panel.add(button);
+
+        dialog.setBounds(200, 200, 300, 200);
+
+        // The first test should always succeed since the dialog is invalid initially
+        test();
+
+        // now invalidate the button and the panel
+        button.setBounds(1, 1, 30, 30);
+        sleep();
+        // since the panel is a validate root, the dialog is still valid
+
+        // w/o a fix this would fail
+        test();
+
+        // cleanup
+        dialog.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FileDialog/FileNameOverrideTest/FileNameOverrideTest.html	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,22 @@
+<html>
+<!--  
+  @test
+  @bug 6260659
+  @summary File Name set programmatically in FileDialog is overridden during navigation, XToolkit
+  @author Dmitry.Cherepanov@SUN.COM area=awt.filedialog
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno FileNameOverrideTest.html
+  -->
+<head>
+<title> FileNameOverrideTest </title>
+</head>
+<body>
+
+<h1>FileNameOverrideTest<br>Bug ID: 6260659</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="FileNameOverrideTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FileDialog/FileNameOverrideTest/FileNameOverrideTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,73 @@
+/*
+  test
+  @bug 6260659
+  @summary File Name set programmatically in FileDialog is overridden during navigation, XToolkit
+  @author Dmitry.Cherepanov@SUN.COM area=awt.filedialog
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno FileNameOverrideTest.html
+*/
+
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+
+public class FileNameOverrideTest extends Applet implements ActionListener {
+    private final static String fileName = "input";
+    private final static String clickDirName = "Directory for double click";
+    private final static String dirPath = ".";
+    private Button showBtn;
+    private FileDialog fd;
+
+    public void init() {
+        this.setLayout(new GridLayout(1, 1));
+
+        fd = new FileDialog(new Frame(), "Open");
+
+        showBtn = new Button("Show File Dialog");
+        showBtn.addActionListener(this);
+        add(showBtn);
+
+        try {
+            File tmpFileUp = new File(dirPath + File.separator + fileName);
+            File tmpDir = new File(dirPath + File.separator + clickDirName);
+            File tmpFileIn = new File(tmpDir.getAbsolutePath() + File.separator + fileName);
+            tmpDir.mkdir();
+            tmpFileUp.createNewFile();
+            tmpFileIn.createNewFile();
+        } catch (IOException ex) {
+            throw new RuntimeException("Cannot create test folder", ex);
+        }
+
+        String[] instructions = {
+                "1) Click on 'Show File Dialog' button. A file dialog will come up.",
+                "2) Double-click on '" + clickDirName + "' and click OK.",
+                "3) See result of the test below"
+        };
+        Sysout.createDialogWithInstructions(instructions);
+    }//End  init()
+
+    public void start() {
+        setSize(200, 200);
+        show();
+    }// start()
+
+    public void actionPerformed(ActionEvent e) {
+        if (e.getSource() == showBtn) {
+            fd.setFile(fileName);
+            fd.setDirectory(dirPath);
+            fd.setVisible(true);
+            String output = fd.getFile();
+            if (fileName.equals(output)) {
+                Sysout.println("TEST PASSED");
+            } else {
+                Sysout.println("TEST FAILED (output file - " + output + ")");
+            }
+        }
+    }
+}// class ManualYesNoTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FileDialog/SaveFileNameOverrideTest/SaveFileNameOverrideTest.html	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,22 @@
+<html>
+<!--  
+  @test
+  @bug 6998877
+  @summary After double-click on the folder names, FileNameOverrideTest FAILED
+  @author Sergey.Bylokhov@oracle.com area=awt.filedialog
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno SaveFileNameOverrideTest.html
+  -->
+<head>
+<title> SaveFileNameOverrideTest </title>
+</head>
+<body>
+
+<h1>SaveFileNameOverrideTest<br>Bug ID: 6260659</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="SaveFileNameOverrideTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FileDialog/SaveFileNameOverrideTest/SaveFileNameOverrideTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,65 @@
+/*
+  test
+  @bug 6998877
+  @summary After double-click on the folder names, FileNameOverrideTest FAILED
+  @author Sergey.Bylokhov@oracle.com area=awt.filedialog
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno SaveFileNameOverrideTest.html
+*/
+
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+
+public class SaveFileNameOverrideTest extends Applet implements ActionListener {
+    private final static String clickDirName = "Directory for double click";
+    private final static String dirPath = ".";
+    private Button showBtn;
+    private FileDialog fd;
+
+    public void init() {
+        this.setLayout(new GridLayout(1, 1));
+
+        fd = new FileDialog(new Frame(), "Save", FileDialog.SAVE);
+
+        showBtn = new Button("Show File Dialog");
+        showBtn.addActionListener(this);
+        add(showBtn);
+
+        File tmpDir = new File(dirPath + File.separator + clickDirName);
+        tmpDir.mkdir();
+
+        String[] instructions = {
+                "1) Click on 'Show File Dialog' button. A file dialog will come up.",
+                "2) Double-click on '" + clickDirName + "' and click OK.",
+                "3) See result of the test below"
+        };
+
+        Sysout.createDialogWithInstructions(instructions);
+
+    }//End  init()
+
+    public void start() {
+        setSize(200, 200);
+        show();
+    }// start()
+
+    public void actionPerformed(ActionEvent e) {
+        if (e.getSource() == showBtn) {
+            fd.setFile("input");
+            fd.setDirectory(dirPath);
+            fd.setVisible(true);
+            String output = fd.getFile();
+            if ("input".equals(output)) {
+                Sysout.println("TEST PASSED");
+            } else {
+                Sysout.println("TEST FAILED (output file - " + output + ")");
+            }
+        }
+    }
+}// class ManualYesNoTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init1.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *
+ * 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 7002839
+ * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
+ * @run main GE_init1
+ */
+
+import java.awt.Toolkit;
+
+public class GE_init1 {
+    public static void main(String[] args) {
+        Toolkit.getDefaultToolkit();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init2.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ *
+ * 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 7002839
+ * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
+ * @run main GE_init2
+ */
+
+
+import java.awt.GraphicsEnvironment;
+
+public class GE_init2 {
+    public static void main(String[] args) {
+        GraphicsEnvironment.getLocalGraphicsEnvironment();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init3.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ *
+ * 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 7002839
+ * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
+ * @run main GE_init3
+ */
+
+
+import java.awt.Frame;
+
+public class GE_init3 {
+    public static void main(String[] args) {
+        new Frame("Test3").setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init4.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *
+ * 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 7002839
+ * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
+ * @run main/othervm -Djava.awt.headless=true GE_init4
+ */
+
+import java.awt.Toolkit;
+
+public class GE_init4 {
+    public static void main(String[] args) {
+        Toolkit.getDefaultToolkit();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init5.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *
+ * 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 7002839
+ * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
+ * @run main/othervm -Djava.awt.headless=true GE_init4
+ */
+
+import java.awt.Toolkit;
+
+public class GE_init5 {
+    public static void main(String[] args) {
+        GraphicsEnvironment.getLocalGraphicsEnvironment();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/LoadLock/GE_init6.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ * 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 7002839
+ * @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
+ * @run main/othervm -Djava.awt.headless=true GE_init6
+ */
+
+import java.awt.*;
+
+public class GE_init6 {
+    private static boolean passed = false;
+    public static void main(String[] args) {
+         try {
+             new Frame("Test3").setVisible(true);
+         } catch (HeadlessException e){
+             passed = true;
+         }
+         if (!passed){
+             throw new RuntimeException("Should have thrown HE but it either didn't throw any or just passed through.");
+         }
+    }
+}
--- a/jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -43,6 +43,7 @@
     private static void initAndShowGUI() {
         frame = new JFrame();
         JApplet applet = new JApplet();
+        applet.setBackground(new Color(0, 0, 0, 0));
         JPanel panel = new JPanel() {
             protected void paintComponent(Graphics g) {
                 paintComponentCalled = true;
--- a/jdk/test/java/lang/Character/CheckScript.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/lang/Character/CheckScript.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,34 +1,58 @@
+
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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 6945564 6959267
+ * @bug 6945564 6959267 7033561
  * @summary  Check that the j.l.Character.UnicodeScript
  */
 
 import java.io.*;
-import java.lang.reflect.*;
 import java.util.*;
 import java.util.regex.*;
 import java.lang.Character.UnicodeScript;
 
 public class CheckScript {
 
-    static BufferedReader open(String[] args) throws FileNotFoundException {
+    public static void main(String[] args) throws Exception {
+        File fScripts;
+        File fAliases;
         if (args.length == 0) {
-            return new BufferedReader(new FileReader(new File(System.getProperty("test.src", "."), "Scripts.txt")));
-        } else if (args.length == 1) {
-            return new BufferedReader(new FileReader(args[0]));
+            fScripts = new File(System.getProperty("test.src", "."), "Scripts.txt");
+            fAliases = new File(System.getProperty("test.src", "."), "PropertyValueAliases.txt");
+        } else if (args.length == 2) {
+            fScripts = new File(args[0]);
+            fAliases = new File(args[1]);
         } else {
-            System.out.println("java CharacterScript Scripts.txt");
+            System.out.println("java CharacterScript Scripts.txt PropertyValueAliases.txt");
             throw new RuntimeException("Datafile name should be specified.");
         }
-    }
-
-    public static void main(String[] args) throws Exception {
 
         Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s+;\\s+(\\w+)\\s+#.*").matcher("");
         String line = null;
         HashMap<String,ArrayList<Integer>> scripts = new HashMap<>();
-        try (BufferedReader sbfr = open(args)) {
+        try (BufferedReader sbfr = new BufferedReader(new FileReader(fScripts))) {
             while ((line = sbfr.readLine()) != null) {
                 if (line.length() <= 1 || line.charAt(0) == '#') {
                     continue;
@@ -107,5 +131,29 @@
                 }
             }
         }
+        // check all aliases
+        m = Pattern.compile("sc\\s*;\\s*(\\p{Alpha}{4})\\s*;\\s*([\\p{Alpha}|_]+)\\s*.*").matcher("");
+        line = null;
+        try (BufferedReader sbfr = new BufferedReader(new FileReader(fAliases))) {
+            while ((line = sbfr.readLine()) != null) {
+                if (line.length() <= 1 || line.charAt(0) == '#') {
+                    continue;
+                }
+                m.reset(line);
+                if (m.matches()) {
+                    String alias = m.group(1);
+                    String name = m.group(2);
+                    // HRKT -> Katakana_Or_Hiragana not supported
+                    if ("HRKT".equals(alias.toUpperCase(Locale.ENGLISH)))
+                        continue;
+                    if (Character.UnicodeScript.forName(alias) !=
+                        Character.UnicodeScript.forName(name)) {
+                        throw new RuntimeException(
+                            "UnicodeScript failed: alias<" + alias +
+                            "> does not map to <" + name + ">");
+                    }
+                }
+            }
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Character/PropertyValueAliases.txt	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,1178 @@
+# PropertyValueAliases-6.0.0.txt
+# Date: 2010-07-17, 22:44:06 GMT [MD]
+#
+# Unicode Character Database
+# Copyright (c) 1991-2010 Unicode, Inc.
+# For terms of use, see http://www.unicode.org/terms_of_use.html
+# For documentation, see http://www.unicode.org/reports/tr44/
+#
+# This file contains aliases for property values used in the UCD.
+# These names can be used for XML formats of UCD data, for regular-expression
+# property tests, and other programmatic textual descriptions of Unicode data.
+# For information on which properties are normative, see UCD.html.
+#
+# The names may be translated in appropriate environments, and additional
+# aliases may be useful.
+#
+# FORMAT
+#
+# Each line describes a property value name.
+# This consists of three or more fields, separated by semicolons.
+#
+# First Field: The first field describes the property for which that
+# property value name is used.
+#
+# Second Field: The second field is an abbreviated name.
+# If there is no abbreviated name available, the field is marked with "n/a".
+#
+# Third Field: The third field is a long name.
+#
+# In the case of ccc, there are 4 fields. The second field is numeric, third
+# is abbreviated, and fourth is long.
+#
+# The above are the preferred aliases. Other aliases may be listed in additional fields.
+#
+# Loose matching should be applied to all property names and property values, with
+# the exception of String Property values. With loose matching of property names and
+# values, the case distinctions, whitespace, and '_' are ignored. For Numeric Property
+# values, numeric equivalencies are applied: thus "01.00" is equivalent to "1".
+#
+# NOTE: Property value names are NOT unique across properties. For example:
+#
+#   AL means Arabic Letter for the Bidi_Class property, and
+#   AL means Above_Left for the Combining_Class property, and
+#   AL means Alphabetic for the Line_Break property.
+#
+# In addition, some property names may be the same as some property value names.
+# For example:
+#
+#   sc means the Script property, and
+#   Sc means the General_Category property value Currency_Symbol (Sc)
+#
+# The combination of property value and property name is, however, unique.
+#
+# For more information, see UTS #18: Unicode Regular Expressions
+# ================================================
+
+
+# ASCII_Hex_Digit (AHex)
+
+AHex; N        ; No                               ; F                                ; False
+AHex; Y        ; Yes                              ; T                                ; True
+
+# Age (age)
+
+age; n/a       ; 1.1
+age; n/a       ; 2.0
+age; n/a       ; 2.1
+age; n/a       ; 3.0
+age; n/a       ; 3.1
+age; n/a       ; 3.2
+age; n/a       ; 4.0
+age; n/a       ; 4.1
+age; n/a       ; 5.0
+age; n/a       ; 5.1
+age; n/a       ; 5.2
+age; n/a       ; 6.0
+age; n/a       ; unassigned
+
+# Alphabetic (Alpha)
+
+Alpha; N       ; No                               ; F                                ; False
+Alpha; Y       ; Yes                              ; T                                ; True
+
+# Bidi_Class (bc)
+
+bc ; AL        ; Arabic_Letter
+bc ; AN        ; Arabic_Number
+bc ; B         ; Paragraph_Separator
+bc ; BN        ; Boundary_Neutral
+bc ; CS        ; Common_Separator
+bc ; EN        ; European_Number
+bc ; ES        ; European_Separator
+bc ; ET        ; European_Terminator
+bc ; L         ; Left_To_Right
+bc ; LRE       ; Left_To_Right_Embedding
+bc ; LRO       ; Left_To_Right_Override
+bc ; NSM       ; Nonspacing_Mark
+bc ; ON        ; Other_Neutral
+bc ; PDF       ; Pop_Directional_Format
+bc ; R         ; Right_To_Left
+bc ; RLE       ; Right_To_Left_Embedding
+bc ; RLO       ; Right_To_Left_Override
+bc ; S         ; Segment_Separator
+bc ; WS        ; White_Space
+
+# Bidi_Control (Bidi_C)
+
+Bidi_C; N      ; No                               ; F                                ; False
+Bidi_C; Y      ; Yes                              ; T                                ; True
+
+# Bidi_Mirrored (Bidi_M)
+
+Bidi_M; N      ; No                               ; F                                ; False
+Bidi_M; Y      ; Yes                              ; T                                ; True
+
+# Bidi_Mirroring_Glyph (bmg)
+
+# @missing: 0000..10FFFF; Bidi_Mirroring_Glyph; <none>
+
+# Block (blk)
+
+blk; n/a       ; Aegean_Numbers
+blk; n/a       ; Alchemical_Symbols
+blk; n/a       ; Alphabetic_Presentation_Forms
+blk; n/a       ; Ancient_Greek_Musical_Notation
+blk; n/a       ; Ancient_Greek_Numbers
+blk; n/a       ; Ancient_Symbols
+blk; n/a       ; Arabic
+blk; n/a       ; Arabic_Presentation_Forms_A      ; Arabic_Presentation_Forms-A
+blk; n/a       ; Arabic_Presentation_Forms_B
+blk; n/a       ; Arabic_Supplement
+blk; n/a       ; Armenian
+blk; n/a       ; Arrows
+blk; n/a       ; Avestan
+blk; n/a       ; Balinese
+blk; n/a       ; Bamum
+blk; n/a       ; Bamum_Supplement
+blk; n/a       ; Basic_Latin                      ; ASCII
+blk; n/a       ; Batak
+blk; n/a       ; Bengali
+blk; n/a       ; Block_Elements
+blk; n/a       ; Bopomofo
+blk; n/a       ; Bopomofo_Extended
+blk; n/a       ; Box_Drawing
+blk; n/a       ; Brahmi
+blk; n/a       ; Braille_Patterns
+blk; n/a       ; Buginese
+blk; n/a       ; Buhid
+blk; n/a       ; Byzantine_Musical_Symbols
+blk; n/a       ; Carian
+blk; n/a       ; Cham
+blk; n/a       ; Cherokee
+blk; n/a       ; CJK_Compatibility
+blk; n/a       ; CJK_Compatibility_Forms
+blk; n/a       ; CJK_Compatibility_Ideographs
+blk; n/a       ; CJK_Compatibility_Ideographs_Supplement
+blk; n/a       ; CJK_Radicals_Supplement
+blk; n/a       ; CJK_Strokes
+blk; n/a       ; CJK_Symbols_And_Punctuation
+blk; n/a       ; CJK_Unified_Ideographs
+blk; n/a       ; CJK_Unified_Ideographs_Extension_A
+blk; n/a       ; CJK_Unified_Ideographs_Extension_B
+blk; n/a       ; CJK_Unified_Ideographs_Extension_C
+blk; n/a       ; CJK_Unified_Ideographs_Extension_D
+blk; n/a       ; Combining_Diacritical_Marks
+blk; n/a       ; Combining_Diacritical_Marks_For_Symbols; Combining_Marks_For_Symbols
+blk; n/a       ; Combining_Diacritical_Marks_Supplement
+blk; n/a       ; Combining_Half_Marks
+blk; n/a       ; Common_Indic_Number_Forms
+blk; n/a       ; Control_Pictures
+blk; n/a       ; Coptic
+blk; n/a       ; Counting_Rod_Numerals
+blk; n/a       ; Cuneiform
+blk; n/a       ; Cuneiform_Numbers_And_Punctuation
+blk; n/a       ; Currency_Symbols
+blk; n/a       ; Cypriot_Syllabary
+blk; n/a       ; Cyrillic
+blk; n/a       ; Cyrillic_Extended_A
+blk; n/a       ; Cyrillic_Extended_B
+blk; n/a       ; Cyrillic_Supplement              ; Cyrillic_Supplementary
+blk; n/a       ; Deseret
+blk; n/a       ; Devanagari
+blk; n/a       ; Devanagari_Extended
+blk; n/a       ; Dingbats
+blk; n/a       ; Domino_Tiles
+blk; n/a       ; Egyptian_Hieroglyphs
+blk; n/a       ; Emoticons
+blk; n/a       ; Enclosed_Alphanumeric_Supplement
+blk; n/a       ; Enclosed_Alphanumerics
+blk; n/a       ; Enclosed_CJK_Letters_And_Months
+blk; n/a       ; Enclosed_Ideographic_Supplement
+blk; n/a       ; Ethiopic
+blk; n/a       ; Ethiopic_Extended
+blk; n/a       ; Ethiopic_Extended_A
+blk; n/a       ; Ethiopic_Supplement
+blk; n/a       ; General_Punctuation
+blk; n/a       ; Geometric_Shapes
+blk; n/a       ; Georgian
+blk; n/a       ; Georgian_Supplement
+blk; n/a       ; Glagolitic
+blk; n/a       ; Gothic
+blk; n/a       ; Greek_And_Coptic                 ; Greek
+blk; n/a       ; Greek_Extended
+blk; n/a       ; Gujarati
+blk; n/a       ; Gurmukhi
+blk; n/a       ; Halfwidth_And_Fullwidth_Forms
+blk; n/a       ; Hangul_Compatibility_Jamo
+blk; n/a       ; Hangul_Jamo
+blk; n/a       ; Hangul_Jamo_Extended_A
+blk; n/a       ; Hangul_Jamo_Extended_B
+blk; n/a       ; Hangul_Syllables
+blk; n/a       ; Hanunoo
+blk; n/a       ; Hebrew
+blk; n/a       ; High_Private_Use_Surrogates
+blk; n/a       ; High_Surrogates
+blk; n/a       ; Hiragana
+blk; n/a       ; Ideographic_Description_Characters
+blk; n/a       ; Imperial_Aramaic
+blk; n/a       ; Inscriptional_Pahlavi
+blk; n/a       ; Inscriptional_Parthian
+blk; n/a       ; IPA_Extensions
+blk; n/a       ; Javanese
+blk; n/a       ; Kaithi
+blk; n/a       ; Kana_Supplement
+blk; n/a       ; Kanbun
+blk; n/a       ; Kangxi_Radicals
+blk; n/a       ; Kannada
+blk; n/a       ; Katakana
+blk; n/a       ; Katakana_Phonetic_Extensions
+blk; n/a       ; Kayah_Li
+blk; n/a       ; Kharoshthi
+blk; n/a       ; Khmer
+blk; n/a       ; Khmer_Symbols
+blk; n/a       ; Lao
+blk; n/a       ; Latin_1_Supplement               ; Latin_1
+blk; n/a       ; Latin_Extended_A
+blk; n/a       ; Latin_Extended_Additional
+blk; n/a       ; Latin_Extended_B
+blk; n/a       ; Latin_Extended_C
+blk; n/a       ; Latin_Extended_D
+blk; n/a       ; Lepcha
+blk; n/a       ; Letterlike_Symbols
+blk; n/a       ; Limbu
+blk; n/a       ; Linear_B_Ideograms
+blk; n/a       ; Linear_B_Syllabary
+blk; n/a       ; Lisu
+blk; n/a       ; Low_Surrogates
+blk; n/a       ; Lycian
+blk; n/a       ; Lydian
+blk; n/a       ; Mahjong_Tiles
+blk; n/a       ; Malayalam
+blk; n/a       ; Mandaic
+blk; n/a       ; Mathematical_Alphanumeric_Symbols
+blk; n/a       ; Mathematical_Operators
+blk; n/a       ; Meetei_Mayek
+blk; n/a       ; Miscellaneous_Mathematical_Symbols_A
+blk; n/a       ; Miscellaneous_Mathematical_Symbols_B
+blk; n/a       ; Miscellaneous_Symbols
+blk; n/a       ; Miscellaneous_Symbols_And_Arrows
+blk; n/a       ; Miscellaneous_Symbols_And_Pictographs
+blk; n/a       ; Miscellaneous_Technical
+blk; n/a       ; Modifier_Tone_Letters
+blk; n/a       ; Mongolian
+blk; n/a       ; Musical_Symbols
+blk; n/a       ; Myanmar
+blk; n/a       ; Myanmar_Extended_A
+blk; n/a       ; New_Tai_Lue
+blk; n/a       ; NKo
+blk; n/a       ; No_Block
+blk; n/a       ; Number_Forms
+blk; n/a       ; Ogham
+blk; n/a       ; Ol_Chiki
+blk; n/a       ; Old_Italic
+blk; n/a       ; Old_Persian
+blk; n/a       ; Old_South_Arabian
+blk; n/a       ; Old_Turkic
+blk; n/a       ; Optical_Character_Recognition
+blk; n/a       ; Oriya
+blk; n/a       ; Osmanya
+blk; n/a       ; Phags_Pa
+blk; n/a       ; Phaistos_Disc
+blk; n/a       ; Phoenician
+blk; n/a       ; Phonetic_Extensions
+blk; n/a       ; Phonetic_Extensions_Supplement
+blk; n/a       ; Playing_Cards
+blk; n/a       ; Private_Use_Area                 ; Private_Use
+blk; n/a       ; Rejang
+blk; n/a       ; Rumi_Numeral_Symbols
+blk; n/a       ; Runic
+blk; n/a       ; Samaritan
+blk; n/a       ; Saurashtra
+blk; n/a       ; Shavian
+blk; n/a       ; Sinhala
+blk; n/a       ; Small_Form_Variants
+blk; n/a       ; Spacing_Modifier_Letters
+blk; n/a       ; Specials
+blk; n/a       ; Sundanese
+blk; n/a       ; Superscripts_And_Subscripts
+blk; n/a       ; Supplemental_Arrows_A
+blk; n/a       ; Supplemental_Arrows_B
+blk; n/a       ; Supplemental_Mathematical_Operators
+blk; n/a       ; Supplemental_Punctuation
+blk; n/a       ; Supplementary_Private_Use_Area_A
+blk; n/a       ; Supplementary_Private_Use_Area_B
+blk; n/a       ; Syloti_Nagri
+blk; n/a       ; Syriac
+blk; n/a       ; Tagalog
+blk; n/a       ; Tagbanwa
+blk; n/a       ; Tags
+blk; n/a       ; Tai_Le
+blk; n/a       ; Tai_Tham
+blk; n/a       ; Tai_Viet
+blk; n/a       ; Tai_Xuan_Jing_Symbols
+blk; n/a       ; Tamil
+blk; n/a       ; Telugu
+blk; n/a       ; Thaana
+blk; n/a       ; Thai
+blk; n/a       ; Tibetan
+blk; n/a       ; Tifinagh
+blk; n/a       ; Transport_And_Map_Symbols
+blk; n/a       ; Ugaritic
+blk; n/a       ; Unified_Canadian_Aboriginal_Syllabics; Canadian_Syllabics
+blk; n/a       ; Unified_Canadian_Aboriginal_Syllabics_Extended
+blk; n/a       ; Vai
+blk; n/a       ; Variation_Selectors
+blk; n/a       ; Variation_Selectors_Supplement
+blk; n/a       ; Vedic_Extensions
+blk; n/a       ; Vertical_Forms
+blk; n/a       ; Yi_Radicals
+blk; n/a       ; Yi_Syllables
+blk; n/a       ; Yijing_Hexagram_Symbols
+
+# Canonical_Combining_Class (ccc)
+
+ccc;   0; NR   ; Not_Reordered
+ccc;   1; OV   ; Overlay
+ccc;   7; NK   ; Nukta
+ccc;   8; KV   ; Kana_Voicing
+ccc;   9; VR   ; Virama
+ccc; 200; ATBL ; Attached_Below_Left
+ccc; 202; ATB  ; Attached_Below
+ccc; 214; ATA  ; Attached_Above
+ccc; 216; ATAR ; Attached_Above_Right
+ccc; 218; BL   ; Below_Left
+ccc; 220; B    ; Below
+ccc; 222; BR   ; Below_Right
+ccc; 224; L    ; Left
+ccc; 226; R    ; Right
+ccc; 228; AL   ; Above_Left
+ccc; 230; A    ; Above
+ccc; 232; AR   ; Above_Right
+ccc; 233; DB   ; Double_Below
+ccc; 234; DA   ; Double_Above
+ccc; 240; IS   ; Iota_Subscript
+
+# Case_Folding (cf)
+
+# @missing: 0000..10FFFF; Case_Folding; <code point>
+
+# Case_Ignorable (CI)
+
+CI ; N         ; No                               ; F                                ; False
+CI ; Y         ; Yes                              ; T                                ; True
+
+# Cased (Cased)
+
+Cased; N       ; No                               ; F                                ; False
+Cased; Y       ; Yes                              ; T                                ; True
+
+# Changes_When_Casefolded (CWCF)
+
+CWCF; N        ; No                               ; F                                ; False
+CWCF; Y        ; Yes                              ; T                                ; True
+
+# Changes_When_Casemapped (CWCM)
+
+CWCM; N        ; No                               ; F                                ; False
+CWCM; Y        ; Yes                              ; T                                ; True
+
+# Changes_When_Lowercased (CWL)
+
+CWL; N         ; No                               ; F                                ; False
+CWL; Y         ; Yes                              ; T                                ; True
+
+# Changes_When_NFKC_Casefolded (CWKCF)
+
+CWKCF; N       ; No                               ; F                                ; False
+CWKCF; Y       ; Yes                              ; T                                ; True
+
+# Changes_When_Titlecased (CWT)
+
+CWT; N         ; No                               ; F                                ; False
+CWT; Y         ; Yes                              ; T                                ; True
+
+# Changes_When_Uppercased (CWU)
+
+CWU; N         ; No                               ; F                                ; False
+CWU; Y         ; Yes                              ; T                                ; True
+
+# Composition_Exclusion (CE)
+
+CE ; N         ; No                               ; F                                ; False
+CE ; Y         ; Yes                              ; T                                ; True
+
+# Dash (Dash)
+
+Dash; N        ; No                               ; F                                ; False
+Dash; Y        ; Yes                              ; T                                ; True
+
+# Decomposition_Mapping (dm)
+
+# @missing: 0000..10FFFF; Decomposition_Mapping; <code point>
+
+# Decomposition_Type (dt)
+
+dt ; Can       ; Canonical                        ; can
+dt ; Com       ; Compat                           ; com
+dt ; Enc       ; Circle                           ; enc
+dt ; Fin       ; Final                            ; fin
+dt ; Font      ; font
+dt ; Fra       ; Fraction                         ; fra
+dt ; Init      ; Initial                          ; init
+dt ; Iso       ; Isolated                         ; iso
+dt ; Med       ; Medial                           ; med
+dt ; Nar       ; Narrow                           ; nar
+dt ; Nb        ; Nobreak                          ; nb
+dt ; None      ; none
+dt ; Sml       ; Small                            ; sml
+dt ; Sqr       ; Square                           ; sqr
+dt ; Sub       ; sub
+dt ; Sup       ; Super                            ; sup
+dt ; Vert      ; Vertical                         ; vert
+dt ; Wide      ; wide
+
+# Default_Ignorable_Code_Point (DI)
+
+DI ; N         ; No                               ; F                                ; False
+DI ; Y         ; Yes                              ; T                                ; True
+
+# Deprecated (Dep)
+
+Dep; N         ; No                               ; F                                ; False
+Dep; Y         ; Yes                              ; T                                ; True
+
+# Diacritic (Dia)
+
+Dia; N         ; No                               ; F                                ; False
+Dia; Y         ; Yes                              ; T                                ; True
+
+# East_Asian_Width (ea)
+
+ea ; A         ; Ambiguous
+ea ; F         ; Fullwidth
+ea ; H         ; Halfwidth
+ea ; N         ; Neutral
+ea ; Na        ; Narrow
+ea ; W         ; Wide
+
+# Expands_On_NFC (XO_NFC)
+
+XO_NFC; N      ; No                               ; F                                ; False
+XO_NFC; Y      ; Yes                              ; T                                ; True
+
+# Expands_On_NFD (XO_NFD)
+
+XO_NFD; N      ; No                               ; F                                ; False
+XO_NFD; Y      ; Yes                              ; T                                ; True
+
+# Expands_On_NFKC (XO_NFKC)
+
+XO_NFKC; N     ; No                               ; F                                ; False
+XO_NFKC; Y     ; Yes                              ; T                                ; True
+
+# Expands_On_NFKD (XO_NFKD)
+
+XO_NFKD; N     ; No                               ; F                                ; False
+XO_NFKD; Y     ; Yes                              ; T                                ; True
+
+# Extender (Ext)
+
+Ext; N         ; No                               ; F                                ; False
+Ext; Y         ; Yes                              ; T                                ; True
+
+# FC_NFKC_Closure (FC_NFKC)
+
+# @missing: 0000..10FFFF; FC_NFKC_Closure; <code point>
+
+# Full_Composition_Exclusion (Comp_Ex)
+
+Comp_Ex; N     ; No                               ; F                                ; False
+Comp_Ex; Y     ; Yes                              ; T                                ; True
+
+# General_Category (gc)
+
+gc ; C         ; Other                            # Cc | Cf | Cn | Co | Cs
+gc ; Cc        ; Control                          ; cntrl
+gc ; Cf        ; Format
+gc ; Cn        ; Unassigned
+gc ; Co        ; Private_Use
+gc ; Cs        ; Surrogate
+gc ; L         ; Letter                           # Ll | Lm | Lo | Lt | Lu
+gc ; LC        ; Cased_Letter                     # Ll | Lt | Lu
+gc ; Ll        ; Lowercase_Letter
+gc ; Lm        ; Modifier_Letter
+gc ; Lo        ; Other_Letter
+gc ; Lt        ; Titlecase_Letter
+gc ; Lu        ; Uppercase_Letter
+gc ; M         ; Mark                             # Mc | Me | Mn
+gc ; Mc        ; Spacing_Mark
+gc ; Me        ; Enclosing_Mark
+gc ; Mn        ; Nonspacing_Mark
+gc ; N         ; Number                           # Nd | Nl | No
+gc ; Nd        ; Decimal_Number                   ; digit
+gc ; Nl        ; Letter_Number
+gc ; No        ; Other_Number
+gc ; P         ; Punctuation                      ; punct                            # Pc | Pd | Pe | Pf | Pi | Po | Ps
+gc ; Pc        ; Connector_Punctuation
+gc ; Pd        ; Dash_Punctuation
+gc ; Pe        ; Close_Punctuation
+gc ; Pf        ; Final_Punctuation
+gc ; Pi        ; Initial_Punctuation
+gc ; Po        ; Other_Punctuation
+gc ; Ps        ; Open_Punctuation
+gc ; S         ; Symbol                           # Sc | Sk | Sm | So
+gc ; Sc        ; Currency_Symbol
+gc ; Sk        ; Modifier_Symbol
+gc ; Sm        ; Math_Symbol
+gc ; So        ; Other_Symbol
+gc ; Z         ; Separator                        # Zl | Zp | Zs
+gc ; Zl        ; Line_Separator
+gc ; Zp        ; Paragraph_Separator
+gc ; Zs        ; Space_Separator
+
+# Grapheme_Base (Gr_Base)
+
+Gr_Base; N     ; No                               ; F                                ; False
+Gr_Base; Y     ; Yes                              ; T                                ; True
+
+# Grapheme_Cluster_Break (GCB)
+
+GCB; CN        ; Control
+GCB; CR        ; CR
+GCB; EX        ; Extend
+GCB; L         ; L
+GCB; LF        ; LF
+GCB; LV        ; LV
+GCB; LVT       ; LVT
+GCB; PP        ; Prepend
+GCB; SM        ; SpacingMark
+GCB; T         ; T
+GCB; V         ; V
+GCB; XX        ; Other
+
+# Grapheme_Extend (Gr_Ext)
+
+Gr_Ext; N      ; No                               ; F                                ; False
+Gr_Ext; Y      ; Yes                              ; T                                ; True
+
+# Grapheme_Link (Gr_Link)
+
+Gr_Link; N     ; No                               ; F                                ; False
+Gr_Link; Y     ; Yes                              ; T                                ; True
+
+# Hangul_Syllable_Type (hst)
+
+hst; L         ; Leading_Jamo
+hst; LV        ; LV_Syllable
+hst; LVT       ; LVT_Syllable
+hst; NA        ; Not_Applicable
+hst; T         ; Trailing_Jamo
+hst; V         ; Vowel_Jamo
+
+# Hex_Digit (Hex)
+
+Hex; N         ; No                               ; F                                ; False
+Hex; Y         ; Yes                              ; T                                ; True
+
+# Hyphen (Hyphen)
+
+Hyphen; N      ; No                               ; F                                ; False
+Hyphen; Y      ; Yes                              ; T                                ; True
+
+# IDS_Binary_Operator (IDSB)
+
+IDSB; N        ; No                               ; F                                ; False
+IDSB; Y        ; Yes                              ; T                                ; True
+
+# IDS_Trinary_Operator (IDST)
+
+IDST; N        ; No                               ; F                                ; False
+IDST; Y        ; Yes                              ; T                                ; True
+
+# ID_Continue (IDC)
+
+IDC; N         ; No                               ; F                                ; False
+IDC; Y         ; Yes                              ; T                                ; True
+
+# ID_Start (IDS)
+
+IDS; N         ; No                               ; F                                ; False
+IDS; Y         ; Yes                              ; T                                ; True
+
+# ISO_Comment (isc)
+
+# @missing: 0000..10FFFF; ISO_Comment; <none>
+
+# Ideographic (Ideo)
+
+Ideo; N        ; No                               ; F                                ; False
+Ideo; Y        ; Yes                              ; T                                ; True
+
+# Jamo_Short_Name (JSN)
+
+# @missing: 0000..10FFFF; Jamo_Short_Name; <none>
+JSN; A         ; A
+JSN; AE        ; AE
+JSN; B         ; B
+JSN; BB        ; BB
+JSN; BS        ; BS
+JSN; C         ; C
+JSN; D         ; D
+JSN; DD        ; DD
+JSN; E         ; E
+JSN; EO        ; EO
+JSN; EU        ; EU
+JSN; G         ; G
+JSN; GG        ; GG
+JSN; GS        ; GS
+JSN; H         ; H
+JSN; I         ; I
+JSN; J         ; J
+JSN; JJ        ; JJ
+JSN; K         ; K
+JSN; L         ; L
+JSN; LB        ; LB
+JSN; LG        ; LG
+JSN; LH        ; LH
+JSN; LM        ; LM
+JSN; LP        ; LP
+JSN; LS        ; LS
+JSN; LT        ; LT
+JSN; M         ; M
+JSN; N         ; N
+JSN; NG        ; NG
+JSN; NH        ; NH
+JSN; NJ        ; NJ
+JSN; O         ; O
+JSN; OE        ; OE
+JSN; P         ; P
+JSN; R         ; R
+JSN; S         ; S
+JSN; SS        ; SS
+JSN; T         ; T
+JSN; U         ; U
+JSN; WA        ; WA
+JSN; WAE       ; WAE
+JSN; WE        ; WE
+JSN; WEO       ; WEO
+JSN; WI        ; WI
+JSN; YA        ; YA
+JSN; YAE       ; YAE
+JSN; YE        ; YE
+JSN; YEO       ; YEO
+JSN; YI        ; YI
+JSN; YO        ; YO
+JSN; YU        ; YU
+
+# Join_Control (Join_C)
+
+Join_C; N      ; No                               ; F                                ; False
+Join_C; Y      ; Yes                              ; T                                ; True
+
+# Joining_Group (jg)
+
+jg ; n/a       ; Ain
+jg ; n/a       ; Alaph
+jg ; n/a       ; Alef
+jg ; n/a       ; Beh
+jg ; n/a       ; Beth
+jg ; n/a       ; Burushaski_Yeh_Barree
+jg ; n/a       ; Dal
+jg ; n/a       ; Dalath_Rish
+jg ; n/a       ; E
+jg ; n/a       ; Farsi_Yeh
+jg ; n/a       ; Fe
+jg ; n/a       ; Feh
+jg ; n/a       ; Final_Semkath
+jg ; n/a       ; Gaf
+jg ; n/a       ; Gamal
+jg ; n/a       ; Hah
+jg ; n/a       ; He
+jg ; n/a       ; Heh
+jg ; n/a       ; Heh_Goal
+jg ; n/a       ; Heth
+jg ; n/a       ; Kaf
+jg ; n/a       ; Kaph
+jg ; n/a       ; Khaph
+jg ; n/a       ; Knotted_Heh
+jg ; n/a       ; Lam
+jg ; n/a       ; Lamadh
+jg ; n/a       ; Meem
+jg ; n/a       ; Mim
+jg ; n/a       ; No_Joining_Group
+jg ; n/a       ; Noon
+jg ; n/a       ; Nun
+jg ; n/a       ; Nya
+jg ; n/a       ; Pe
+jg ; n/a       ; Qaf
+jg ; n/a       ; Qaph
+jg ; n/a       ; Reh
+jg ; n/a       ; Reversed_Pe
+jg ; n/a       ; Sad
+jg ; n/a       ; Sadhe
+jg ; n/a       ; Seen
+jg ; n/a       ; Semkath
+jg ; n/a       ; Shin
+jg ; n/a       ; Swash_Kaf
+jg ; n/a       ; Syriac_Waw
+jg ; n/a       ; Tah
+jg ; n/a       ; Taw
+jg ; n/a       ; Teh_Marbuta
+jg ; n/a       ; Teh_Marbuta_Goal                 ; Hamza_On_Heh_Goal
+jg ; n/a       ; Teth
+jg ; n/a       ; Waw
+jg ; n/a       ; Yeh
+jg ; n/a       ; Yeh_Barree
+jg ; n/a       ; Yeh_With_Tail
+jg ; n/a       ; Yudh
+jg ; n/a       ; Yudh_He
+jg ; n/a       ; Zain
+jg ; n/a       ; Zhain
+
+# Joining_Type (jt)
+
+jt ; C         ; Join_Causing
+jt ; D         ; Dual_Joining
+jt ; L         ; Left_Joining
+jt ; R         ; Right_Joining
+jt ; T         ; Transparent
+jt ; U         ; Non_Joining
+
+# Line_Break (lb)
+
+lb ; AI        ; Ambiguous
+lb ; AL        ; Alphabetic
+lb ; B2        ; Break_Both
+lb ; BA        ; Break_After
+lb ; BB        ; Break_Before
+lb ; BK        ; Mandatory_Break
+lb ; CB        ; Contingent_Break
+lb ; CL        ; Close_Punctuation
+lb ; CM        ; Combining_Mark
+lb ; CP        ; Close_Parenthesis
+lb ; CR        ; Carriage_Return
+lb ; EX        ; Exclamation
+lb ; GL        ; Glue
+lb ; H2        ; H2
+lb ; H3        ; H3
+lb ; HY        ; Hyphen
+lb ; ID        ; Ideographic
+lb ; IN        ; Inseparable                      ; Inseperable
+lb ; IS        ; Infix_Numeric
+lb ; JL        ; JL
+lb ; JT        ; JT
+lb ; JV        ; JV
+lb ; LF        ; Line_Feed
+lb ; NL        ; Next_Line
+lb ; NS        ; Nonstarter
+lb ; NU        ; Numeric
+lb ; OP        ; Open_Punctuation
+lb ; PO        ; Postfix_Numeric
+lb ; PR        ; Prefix_Numeric
+lb ; QU        ; Quotation
+lb ; SA        ; Complex_Context
+lb ; SG        ; Surrogate
+lb ; SP        ; Space
+lb ; SY        ; Break_Symbols
+lb ; WJ        ; Word_Joiner
+lb ; XX        ; Unknown
+lb ; ZW        ; ZWSpace
+
+# Logical_Order_Exception (LOE)
+
+LOE; N         ; No                               ; F                                ; False
+LOE; Y         ; Yes                              ; T                                ; True
+
+# Lowercase (Lower)
+
+Lower; N       ; No                               ; F                                ; False
+Lower; Y       ; Yes                              ; T                                ; True
+
+# Lowercase_Mapping (lc)
+
+# @missing: 0000..10FFFF; Lowercase_Mapping; <code point>
+
+# Math (Math)
+
+Math; N        ; No                               ; F                                ; False
+Math; Y        ; Yes                              ; T                                ; True
+
+# NFC_Quick_Check (NFC_QC)
+
+NFC_QC; M      ; Maybe
+NFC_QC; N      ; No
+NFC_QC; Y      ; Yes
+
+# NFD_Quick_Check (NFD_QC)
+
+NFD_QC; N      ; No
+NFD_QC; Y      ; Yes
+
+# NFKC_Casefold (NFKC_CF)
+
+# @missing: 0000..10FFFF; NFKC_Casefold; <code point>
+
+# NFKC_Quick_Check (NFKC_QC)
+
+NFKC_QC; M     ; Maybe
+NFKC_QC; N     ; No
+NFKC_QC; Y     ; Yes
+
+# NFKD_Quick_Check (NFKD_QC)
+
+NFKD_QC; N     ; No
+NFKD_QC; Y     ; Yes
+
+# Name (na)
+
+# @missing: 0000..10FFFF; Name; <none>
+
+# Name_Alias (Name_Alias)
+
+# @missing: 0000..10FFFF; Name_Alias; <none>
+
+# Noncharacter_Code_Point (NChar)
+
+NChar; N       ; No                               ; F                                ; False
+NChar; Y       ; Yes                              ; T                                ; True
+
+# Numeric_Type (nt)
+
+nt ; De        ; Decimal
+nt ; Di        ; Digit
+nt ; None      ; None
+nt ; Nu        ; Numeric
+
+# Numeric_Value (nv)
+
+# @missing: 0000..10FFFF; Numeric_Value; NaN
+
+# Other_Alphabetic (OAlpha)
+
+OAlpha; N      ; No                               ; F                                ; False
+OAlpha; Y      ; Yes                              ; T                                ; True
+
+# Other_Default_Ignorable_Code_Point (ODI)
+
+ODI; N         ; No                               ; F                                ; False
+ODI; Y         ; Yes                              ; T                                ; True
+
+# Other_Grapheme_Extend (OGr_Ext)
+
+OGr_Ext; N     ; No                               ; F                                ; False
+OGr_Ext; Y     ; Yes                              ; T                                ; True
+
+# Other_ID_Continue (OIDC)
+
+OIDC; N        ; No                               ; F                                ; False
+OIDC; Y        ; Yes                              ; T                                ; True
+
+# Other_ID_Start (OIDS)
+
+OIDS; N        ; No                               ; F                                ; False
+OIDS; Y        ; Yes                              ; T                                ; True
+
+# Other_Lowercase (OLower)
+
+OLower; N      ; No                               ; F                                ; False
+OLower; Y      ; Yes                              ; T                                ; True
+
+# Other_Math (OMath)
+
+OMath; N       ; No                               ; F                                ; False
+OMath; Y       ; Yes                              ; T                                ; True
+
+# Other_Uppercase (OUpper)
+
+OUpper; N      ; No                               ; F                                ; False
+OUpper; Y      ; Yes                              ; T                                ; True
+
+# Pattern_Syntax (Pat_Syn)
+
+Pat_Syn; N     ; No                               ; F                                ; False
+Pat_Syn; Y     ; Yes                              ; T                                ; True
+
+# Pattern_White_Space (Pat_WS)
+
+Pat_WS; N      ; No                               ; F                                ; False
+Pat_WS; Y      ; Yes                              ; T                                ; True
+
+# Quotation_Mark (QMark)
+
+QMark; N       ; No                               ; F                                ; False
+QMark; Y       ; Yes                              ; T                                ; True
+
+# Radical (Radical)
+
+Radical; N     ; No                               ; F                                ; False
+Radical; Y     ; Yes                              ; T                                ; True
+
+# STerm (STerm)
+
+STerm; N       ; No                               ; F                                ; False
+STerm; Y       ; Yes                              ; T                                ; True
+
+# Script (sc)
+
+sc ; Arab      ; Arabic
+sc ; Armi      ; Imperial_Aramaic
+sc ; Armn      ; Armenian
+sc ; Avst      ; Avestan
+sc ; Bali      ; Balinese
+sc ; Bamu      ; Bamum
+sc ; Batk      ; Batak
+sc ; Beng      ; Bengali
+sc ; Bopo      ; Bopomofo
+sc ; Brah      ; Brahmi
+sc ; Brai      ; Braille
+sc ; Bugi      ; Buginese
+sc ; Buhd      ; Buhid
+sc ; Cans      ; Canadian_Aboriginal
+sc ; Cari      ; Carian
+sc ; Cham      ; Cham
+sc ; Cher      ; Cherokee
+sc ; Copt      ; Coptic                           ; Qaac
+sc ; Cprt      ; Cypriot
+sc ; Cyrl      ; Cyrillic
+sc ; Deva      ; Devanagari
+sc ; Dsrt      ; Deseret
+sc ; Egyp      ; Egyptian_Hieroglyphs
+sc ; Ethi      ; Ethiopic
+sc ; Geor      ; Georgian
+sc ; Glag      ; Glagolitic
+sc ; Goth      ; Gothic
+sc ; Grek      ; Greek
+sc ; Gujr      ; Gujarati
+sc ; Guru      ; Gurmukhi
+sc ; Hang      ; Hangul
+sc ; Hani      ; Han
+sc ; Hano      ; Hanunoo
+sc ; Hebr      ; Hebrew
+sc ; Hira      ; Hiragana
+sc ; Hrkt      ; Katakana_Or_Hiragana
+sc ; Ital      ; Old_Italic
+sc ; Java      ; Javanese
+sc ; Kali      ; Kayah_Li
+sc ; Kana      ; Katakana
+sc ; Khar      ; Kharoshthi
+sc ; Khmr      ; Khmer
+sc ; Knda      ; Kannada
+sc ; Kthi      ; Kaithi
+sc ; Lana      ; Tai_Tham
+sc ; Laoo      ; Lao
+sc ; Latn      ; Latin
+sc ; Lepc      ; Lepcha
+sc ; Limb      ; Limbu
+sc ; Linb      ; Linear_B
+sc ; Lisu      ; Lisu
+sc ; Lyci      ; Lycian
+sc ; Lydi      ; Lydian
+sc ; Mand      ; Mandaic
+sc ; Mlym      ; Malayalam
+sc ; Mong      ; Mongolian
+sc ; Mtei      ; Meetei_Mayek
+sc ; Mymr      ; Myanmar
+sc ; Nkoo      ; Nko
+sc ; Ogam      ; Ogham
+sc ; Olck      ; Ol_Chiki
+sc ; Orkh      ; Old_Turkic
+sc ; Orya      ; Oriya
+sc ; Osma      ; Osmanya
+sc ; Phag      ; Phags_Pa
+sc ; Phli      ; Inscriptional_Pahlavi
+sc ; Phnx      ; Phoenician
+sc ; Prti      ; Inscriptional_Parthian
+sc ; Rjng      ; Rejang
+sc ; Runr      ; Runic
+sc ; Samr      ; Samaritan
+sc ; Sarb      ; Old_South_Arabian
+sc ; Saur      ; Saurashtra
+sc ; Shaw      ; Shavian
+sc ; Sinh      ; Sinhala
+sc ; Sund      ; Sundanese
+sc ; Sylo      ; Syloti_Nagri
+sc ; Syrc      ; Syriac
+sc ; Tagb      ; Tagbanwa
+sc ; Tale      ; Tai_Le
+sc ; Talu      ; New_Tai_Lue
+sc ; Taml      ; Tamil
+sc ; Tavt      ; Tai_Viet
+sc ; Telu      ; Telugu
+sc ; Tfng      ; Tifinagh
+sc ; Tglg      ; Tagalog
+sc ; Thaa      ; Thaana
+sc ; Thai      ; Thai
+sc ; Tibt      ; Tibetan
+sc ; Ugar      ; Ugaritic
+sc ; Vaii      ; Vai
+sc ; Xpeo      ; Old_Persian
+sc ; Xsux      ; Cuneiform
+sc ; Yiii      ; Yi
+sc ; Zinh      ; Inherited                        ; Qaai
+sc ; Zyyy      ; Common
+sc ; Zzzz      ; Unknown
+
+# Sentence_Break (SB)
+
+SB ; AT        ; ATerm
+SB ; CL        ; Close
+SB ; CR        ; CR
+SB ; EX        ; Extend
+SB ; FO        ; Format
+SB ; LE        ; OLetter
+SB ; LF        ; LF
+SB ; LO        ; Lower
+SB ; NU        ; Numeric
+SB ; SC        ; SContinue
+SB ; SE        ; Sep
+SB ; SP        ; Sp
+SB ; ST        ; STerm
+SB ; UP        ; Upper
+SB ; XX        ; Other
+
+# Simple_Case_Folding (scf)
+
+# @missing: 0000..10FFFF; Simple_Case_Folding; <code point>
+
+# Simple_Lowercase_Mapping (slc)
+
+# @missing: 0000..10FFFF; Simple_Lowercase_Mapping; <code point>
+
+# Simple_Titlecase_Mapping (stc)
+
+# @missing: 0000..10FFFF; Simple_Titlecase_Mapping; <code point>
+
+# Simple_Uppercase_Mapping (suc)
+
+# @missing: 0000..10FFFF; Simple_Uppercase_Mapping; <code point>
+
+# Soft_Dotted (SD)
+
+SD ; N         ; No                               ; F                                ; False
+SD ; Y         ; Yes                              ; T                                ; True
+
+# Terminal_Punctuation (Term)
+
+Term; N        ; No                               ; F                                ; False
+Term; Y        ; Yes                              ; T                                ; True
+
+# Titlecase_Mapping (tc)
+
+# @missing: 0000..10FFFF; Titlecase_Mapping; <code point>
+
+# Unicode_1_Name (na1)
+
+# @missing: 0000..10FFFF; Unicode_1_Name; <none>
+
+# Unified_Ideograph (UIdeo)
+
+UIdeo; N       ; No                               ; F                                ; False
+UIdeo; Y       ; Yes                              ; T                                ; True
+
+# Uppercase (Upper)
+
+Upper; N       ; No                               ; F                                ; False
+Upper; Y       ; Yes                              ; T                                ; True
+
+# Uppercase_Mapping (uc)
+
+# @missing: 0000..10FFFF; Uppercase_Mapping; <code point>
+
+# Variation_Selector (VS)
+
+VS ; N         ; No                               ; F                                ; False
+VS ; Y         ; Yes                              ; T                                ; True
+
+# White_Space (WSpace)
+
+WSpace; N      ; No                               ; F                                ; False
+WSpace; Y      ; Yes                              ; T                                ; True
+
+# Word_Break (WB)
+
+WB ; CR        ; CR
+WB ; EX        ; ExtendNumLet
+WB ; Extend    ; Extend
+WB ; FO        ; Format
+WB ; KA        ; Katakana
+WB ; LE        ; ALetter
+WB ; LF        ; LF
+WB ; MB        ; MidNumLet
+WB ; ML        ; MidLetter
+WB ; MN        ; MidNum
+WB ; NL        ; Newline
+WB ; NU        ; Numeric
+WB ; XX        ; Other
+
+# XID_Continue (XIDC)
+
+XIDC; N        ; No                               ; F                                ; False
+XIDC; Y        ; Yes                              ; T                                ; True
+
+# XID_Start (XIDS)
+
+XIDS; N        ; No                               ; F                                ; False
+XIDS; Y        ; Yes                              ; T                                ; True
+
+# cjkAccountingNumeric (cjkAccountingNumeric)
+
+# @missing: 0000..10FFFF; cjkAccountingNumeric; NaN
+
+# cjkCompatibilityVariant (cjkCompatibilityVariant)
+
+# @missing: 0000..10FFFF; cjkCompatibilityVariant; <code point>
+
+# cjkIICore (cjkIICore)
+
+# @missing: 0000..10FFFF; cjkIICore; <none>
+
+# cjkIRG_GSource (cjkIRG_GSource)
+
+# @missing: 0000..10FFFF; cjkIRG_GSource; <none>
+
+# cjkIRG_HSource (cjkIRG_HSource)
+
+# @missing: 0000..10FFFF; cjkIRG_HSource; <none>
+
+# cjkIRG_JSource (cjkIRG_JSource)
+
+# @missing: 0000..10FFFF; cjkIRG_JSource; <none>
+
+# cjkIRG_KPSource (cjkIRG_KPSource)
+
+# @missing: 0000..10FFFF; cjkIRG_KPSource; <none>
+
+# cjkIRG_KSource (cjkIRG_KSource)
+
+# @missing: 0000..10FFFF; cjkIRG_KSource; <none>
+
+# cjkIRG_MSource (cjkIRG_MSource)
+
+# @missing: 0000..10FFFF; cjkIRG_MSource; <none>
+
+# cjkIRG_TSource (cjkIRG_TSource)
+
+# @missing: 0000..10FFFF; cjkIRG_TSource; <none>
+
+# cjkIRG_USource (cjkIRG_USource)
+
+# @missing: 0000..10FFFF; cjkIRG_USource; <none>
+
+# cjkIRG_VSource (cjkIRG_VSource)
+
+# @missing: 0000..10FFFF; cjkIRG_VSource; <none>
+
+# cjkOtherNumeric (cjkOtherNumeric)
+
+# @missing: 0000..10FFFF; cjkOtherNumeric; NaN
+
+# cjkPrimaryNumeric (cjkPrimaryNumeric)
+
+# @missing: 0000..10FFFF; cjkPrimaryNumeric; NaN
+
+# cjkRSUnicode (cjkRSUnicode)
+
+# @missing: 0000..10FFFF; cjkRSUnicode; <none>
+
+# EOF
--- a/jdk/test/java/lang/Double/ParseDouble.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/lang/Double/ParseDouble.java	Tue Apr 26 15:48:03 2011 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4160406 4705734 4707389 4826774 4895911 4421494
+ * @bug 4160406 4705734 4707389 4826774 4895911 4421494 7021568
  * @summary Test for Double.parseDouble method and acceptance regex
  */
 
@@ -581,6 +581,31 @@
         }
     }
 
+
+    private static void testStrictness() {
+        final double expected = 0x0.0000008000001p-1022;
+        boolean failed = false;
+        double conversion = 0.0;
+        double sum = 0.0; // Prevent conversion from being optimized away
+
+        //2^-1047 + 2^-1075
+        String decimal = "6.631236871469758276785396630275967243399099947355303144249971758736286630139265439618068200788048744105960420552601852889715006376325666595539603330361800519107591783233358492337208057849499360899425128640718856616503093444922854759159988160304439909868291973931426625698663157749836252274523485312442358651207051292453083278116143932569727918709786004497872322193856150225415211997283078496319412124640111777216148110752815101775295719811974338451936095907419622417538473679495148632480391435931767981122396703443803335529756003353209830071832230689201383015598792184172909927924176339315507402234836120730914783168400715462440053817592702766213559042115986763819482654128770595766806872783349146967171293949598850675682115696218943412532098591327667236328125E-316";
+
+        for(int i = 0; i <= 12_000; i++) {
+            conversion = Double.parseDouble(decimal);
+            sum += conversion;
+            if (conversion != expected) {
+                failed = true;
+                System.out.printf("Iteration %d converts as %a%n",
+                                  i, conversion);
+            }
+        }
+
+        System.out.println("Sum = "  + sum);
+        if (failed)
+            throw new RuntimeException("Inconsistent conversion");
+    }
+
     public static void main(String[] args) throws Exception {
         rudimentaryTest();
 
@@ -595,5 +620,6 @@
         testRegex(paddedBadStrings, true);
 
         testSubnormalPowers();
+        testStrictness();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Math/RoundTests.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ *
+ * 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 6430675
+ * @summary Check for correct implementation of {Math, StrictMath}.round
+ */
+public class RoundTests {
+    public static void main(String... args) {
+        int failures = 0;
+
+        failures += testNearFloatHalfCases();
+        failures += testNearDoubleHalfCases();
+
+        if (failures > 0) {
+            System.err.println("Testing {Math, StrictMath}.round incurred "
+                               + failures + " failures.");
+            throw new RuntimeException();
+        }
+    }
+
+    private static int testNearDoubleHalfCases() {
+        int failures = 0;
+        double [][] testCases = {
+            {+0x1.fffffffffffffp-2,  0.0},
+            {+0x1.0p-1,              1.0}, // +0.5
+            {+0x1.0000000000001p-1,  1.0},
+
+            {-0x1.fffffffffffffp-2,  0.0},
+            {-0x1.0p-1,              0.0}, // -0.5
+            {-0x1.0000000000001p-1, -1.0},
+        };
+
+        for(double[] testCase : testCases) {
+            failures += testNearHalfCases(testCase[0], (long)testCase[1]);
+        }
+
+        return failures;
+    }
+
+    private static int testNearHalfCases(double input, double expected) {
+        int failures = 0;
+
+        failures += Tests.test("Math.round",        input, Math.round(input),       expected);
+        failures += Tests.test("StrictMath.round",  input, StrictMath.round(input), expected);
+
+        return failures;
+    }
+
+    private static int testNearFloatHalfCases() {
+        int failures = 0;
+        float [][] testCases = {
+            {+0x1.fffffep-2f,  0.0f},
+            {+0x1.0p-1f,       1.0f}, // +0.5
+            {+0x1.000002p-1f,  1.0f},
+
+            {-0x1.fffffep-2f,  0.0f},
+            {-0x1.0p-1f,       0.0f}, // -0.5
+            {-0x1.000002p-1f, -1.0f},
+        };
+
+        for(float[] testCase : testCases) {
+            failures += testNearHalfCases(testCase[0], (int)testCase[1]);
+        }
+
+        return failures;
+    }
+
+    private static int testNearHalfCases(float input, float expected) {
+        int failures = 0;
+
+        failures += Tests.test("Math.round",        input, Math.round(input),       expected);
+        failures += Tests.test("StrictMath.round",  input, StrictMath.round(input), expected);
+
+        return failures;
+    }
+}
--- a/jdk/test/java/lang/invoke/ClassValueTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/lang/invoke/ClassValueTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -52,9 +52,9 @@
     static String nameForCV1(Class<?> type) {
         return "CV1:" + type.getName();
     }
-    static int countForCV1;
-    static final ClassValue<String> CV1 = new CV1();
-    private static class CV1 extends ClassValue<String> {
+    int countForCV1;
+    final ClassValue<String> CV1 = new CV1();
+    private class CV1 extends ClassValue<String> {
         protected String computeValue(Class<?> type) {
             countForCV1++;
             return nameForCV1(type);
@@ -103,8 +103,8 @@
     static String nameForCVN(Class<?> type, int n) {
         return "CV[" + n + "]" + type.getName();
     }
-    static int countForCVN;
-    static class CVN extends ClassValue<String> {
+    int countForCVN;
+    class CVN extends ClassValue<String> {
         final int n;
         CVN(int n) { this.n = n; }
         protected String computeValue(Class<?> type) {
--- a/jdk/test/java/lang/reflect/Generics/Probe.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/lang/reflect/Generics/Probe.java	Tue Apr 26 15:48:03 2011 -0700
@@ -38,12 +38,12 @@
           "java.util.concurrent.ConcurrentHashMap$KeyIterator",
           "java.util.concurrent.ConcurrentHashMap$ValueIterator",
           "java.util.AbstractList$ListItr",
-          "java.util.EnumMap$EntryIterator",
-          "java.util.EnumMap$KeyIterator",
-          "java.util.EnumMap$ValueIterator",
-          "java.util.IdentityHashMap$EntryIterator",
-          "java.util.IdentityHashMap$KeyIterator",
-          "java.util.IdentityHashMap$ValueIterator",
+//          "java.util.EnumMap$EntryIterator",
+//          "java.util.EnumMap$KeyIterator",
+//          "java.util.EnumMap$ValueIterator",
+//          "java.util.IdentityHashMap$EntryIterator",
+//          "java.util.IdentityHashMap$KeyIterator",
+//          "java.util.IdentityHashMap$ValueIterator",
           "java.util.WeakHashMap$EntryIterator",
           "java.util.WeakHashMap$KeyIterator",
           "java.util.WeakHashMap$ValueIterator",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigDecimal/DivideMcTests.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,5797 @@
+/*
+ * 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.
+ *
+ * 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 7036582
+ * @summary Some tests for the divide(..,MathContext) method.
+ * @run main DivideMcTests
+ * @run main/othervm -XX:+AggressiveOpts DivideMcTests
+ * @author Sergey V. Kuksenko
+ */
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+
+
+public class DivideMcTests {
+
+    static String[] value = new String[75];
+    static String[][] results = new String[75][75];
+    static {
+        value[0]="11061";
+        value[1]="5030285645";
+        value[2]="224198292018431";
+        value[3]="19226185404220649458";
+        value[4]="2754593222460641763294400";
+        value[5]="88290e4";
+        value[6]="14207e-4";
+        value[7]="9206524943e4";
+        value[8]="9637167289e-4";
+        value[9]="987673128759528e4";
+        value[10]="270627774630281e-4";
+        value[11]="81503625886547904651e4";
+        value[12]="60700032235397315737e-4";
+        value[13]="6477954854329556663533122e4";
+        value[14]="8056417378028557868905113e-4";
+        value[15]="74996e8";
+        value[16]="65282e-8";
+        value[17]="6336626690e8";
+        value[18]="8318166778e-8";
+        value[19]="983114227763768e8";
+        value[20]="245802997834566e-8";
+        value[21]="52727924122290902686e8";
+        value[22]="42785567085625398961e-8";
+        value[23]="4810906998143118279742863e8";
+        value[24]="8077506080975981172874361e-8";
+        value[25]="80689e12";
+        value[26]="30125e-12";
+        value[27]="6921467144e12";
+        value[28]="1953347181e-12";
+        value[29]="405471649883944e12";
+        value[30]="866720590936024e-12";
+        value[31]="33231666378140173438e12";
+        value[32]="42631490906110209257e-12";
+        value[33]="7723154992826793726050991e12";
+        value[34]="1611437259018380210686834e-12";
+        value[35]="65645e16";
+        value[36]="31153e-16";
+        value[37]="7758733150e16";
+        value[38]="6365465077e-16";
+        value[39]="727973863299662e16";
+        value[40]="351084160935215e-16";
+        value[41]="45470432070181568402e16";
+        value[42]="97216256670931719037e-16";
+        value[43]="2520581904836081418366563e16";
+        value[44]="3700768934485477578987416e-16";
+        value[45]="28736e20";
+        value[46]="52779e-20";
+        value[47]="7904805864e20";
+        value[48]="6373815349e-20";
+        value[49]="186651310031326e20";
+        value[50]="189125880591366e-20";
+        value[51]="74987916068454915171e20";
+        value[52]="10554589082317914511e-20";
+        value[53]="3599986721169840668392202e20";
+        value[54]="2588106172836128849130551e-20";
+        value[55]="71080e24";
+        value[56]="61576e-24";
+        value[57]="7086656363e24";
+        value[58]="7703864845e-24";
+        value[59]="361167296280301e24";
+        value[60]="149150690375117e-24";
+        value[61]="78129219923655854302e24";
+        value[62]="20861932490694515212e-24";
+        value[63]="9185868654811652011998047e24";
+        value[64]="1996563690880014012200226e-24";
+        value[65]="84665e28";
+        value[66]="94968e-28";
+        value[67]="2622821029e28";
+        value[68]="4451579486e-28";
+        value[69]="590522407411869e28";
+        value[70]="606293232614518e-28";
+        value[71]="96628087822208148505e28";
+        value[72]="24875240094942654314e-28";
+        value[73]="5099400093819597146233149e28";
+        value[74]="8906650752845770170008864e-28";
+        //--------------------------------------------
+        initResults1();
+        initResults2();
+    }
+
+    private static void initResults1() {
+        results[0][0]="1";
+        results[0][1]="0.000002198881093560642";
+        results[0][2]="4.933579065397471E-11";
+        results[0][3]="5.753091300977375E-16";
+        results[0][4]="4.015474920147867E-21";
+        results[0][5]="0.00001252803261977574";
+        results[0][6]="7785.598648553530";
+        results[0][7]="1.201430514605841E-10";
+        results[0][8]="0.01147743903192921";
+        results[0][9]="1.119904923797219E-15";
+        results[0][10]="4.087163638363069E-7";
+        results[0][11]="1.357117536758031E-20";
+        results[0][12]="1.822239559462666E-12";
+        results[0][13]="1.707483341383177E-25";
+        results[0][14]="1.372942771084022E-17";
+        results[0][15]="1.474878660195210E-9";
+        results[0][16]="16943414.72381361";
+        results[0][17]="1.745565983468090E-14";
+        results[0][18]="132.9740109233477";
+        results[0][19]="1.125098151123273E-19";
+        results[0][20]="0.004499945117611804";
+        results[0][21]="2.097749946374985E-24";
+        results[0][22]="2.585217575324869E-8";
+        results[0][23]="2.299150660004288E-29";
+        results[0][24]="1.369358300583728E-13";
+        results[0][25]="1.370818822887878E-13";
+        results[0][26]="367170124481.3278";
+        results[0][27]="1.598071589430057E-18";
+        results[0][28]="5662587.842852089";
+        results[0][29]="2.727934247231818E-23";
+        results[0][30]="12.76189825841631";
+        results[0][31]="3.328451806821200E-28";
+        results[0][32]="0.0002594560913752765";
+        results[0][33]="1.432186717769276E-33";
+        results[0][34]="6.864058738928437E-9";
+        results[0][35]="1.684972198948892E-17";
+        results[0][36]="3550540878888069";
+        results[0][37]="1.425619335806130E-22";
+        results[0][38]="17376577934.52694";
+        results[0][39]="1.519422682273810E-27";
+        results[0][40]="315052.6634564146";
+        results[0][41]="2.432569803367569E-32";
+        results[0][42]="1.137772670824026";
+        results[0][43]="4.388272398043467E-37";
+        results[0][44]="0.00002988838318687904";
+        results[0][45]="3.849178730512249E-21";
+        results[0][46]="2.095719888592054E+19";
+        results[0][47]="1.399275351008165E-26";
+        results[0][48]="173538130528606.9";
+        results[0][49]="5.926023234524105E-31";
+        results[0][50]="5848485656.967753";
+        results[0][51]="1.475037656720937E-36";
+        results[0][52]="104798.0164242535";
+        results[0][53]="3.072511333154488E-41";
+        results[0][54]="0.4273781391232109";
+        results[0][55]="1.556133933595948E-25";
+        results[0][56]="1.796316746784461E+23";
+        results[0][57]="1.560820707738894E-30";
+        results[0][58]="1.435772852009322E+18";
+        results[0][59]="3.062569649555309E-35";
+        results[0][60]="74159898101586.80";
+        results[0][61]="1.415731529229177E-40";
+        results[0][62]="530200162.6615257";
+        results[0][63]="1.204132174718842E-45";
+        results[0][64]="5540.018608234184";
+        results[0][65]="1.306443040217327E-29";
+        results[0][66]="1.164708112206217E+27";
+        results[0][67]="4.217214929154817E-34";
+        results[0][68]="2.484736043641657E+22";
+        results[0][69]="1.873087263272185E-39";
+        results[0][70]="1.824364747121068E+17";
+        results[0][71]="1.144698218633054E-44";
+        results[0][72]="4446590247082.196";
+        results[0][73]="2.169078675235893E-49";
+        results[0][74]="12418809.61422664";
+        results[1][0]="454776.7511979025";
+        results[1][1]="1";
+        results[1][2]="0.00002243677059139446";
+        results[1][3]="2.616372171203405E-10";
+        results[1][4]="1.826144638701504E-15";
+        results[1][5]="5.697457973722958";
+        results[1][6]="3540709259.519955";
+        results[1][7]="0.00005463826662224685";
+        results[1][8]="5219.672435012765";
+        results[1][9]="5.093067228950338E-10";
+        results[1][10]="0.1858747001068956";
+        results[1][11]="6.171855043605175E-15";
+        results[1][12]="8.287121867567282E-7";
+        results[1][13]="7.765237267187802E-20";
+        results[1][14]="6.243824530142372E-12";
+        results[1][15]="0.0006707405254946931";
+        results[1][16]="7705471102294.660";
+        results[1][17]="7.938428269631898E-9";
+        results[1][18]="60473488.68147447";
+        results[1][19]="5.116684819466090E-14";
+        results[1][20]="2046.470421156359";
+        results[1][21]="9.540079054379898E-19";
+        results[1][22]="0.01175696850045963";
+        results[1][23]="1.045600267671264E-23";
+        results[1][24]="6.227523191653488E-8";
+        results[1][25]="6.234165307538822E-8";
+        results[1][26]="1.669804363485477E+17";
+        results[1][27]="7.267658056226699E-13";
+        results[1][28]="2575213302545.012";
+        results[1][29]="1.240601074437582E-17";
+        results[1][30]="5803814.629080740";
+        results[1][31]="1.513702499224934E-22";
+        results[1][32]="117.9945983141544";
+        results[1][33]="6.513252226158986E-28";
+        results[1][34]="0.003121614333321446";
+        results[1][35]="7.662861824967629E-12";
+        results[1][36]="1.614703445896061E+21";
+        results[1][37]="6.483385299828233E-17";
+        results[1][38]="7902463660001319";
+        results[1][39]="6.909981111408860E-22";
+        results[1][40]="143278626742.9544";
+        results[1][41]="1.106276192237624E-26";
+        results[1][42]="517432.5588391111";
+        results[1][43]="1.995684264553637E-31";
+        results[1][44]="13.59254180428686";
+        results[1][45]="1.750516997842428E-15";
+        results[1][46]="9.530846823547244E+24";
+        results[1][47]="6.363578981627979E-21";
+        results[1][48]="7.892110721075739E+19";
+        results[1][49]="2.695017594120158E-25";
+        results[1][50]="2659755306503325";
+        results[1][51]="6.708128334181145E-31";
+        results[1][52]="47659701441.40646";
+        results[1][53]="1.397306722110734E-35";
+        results[1][54]="194361.6416434591";
+        results[1][55]="7.076935347495779E-20";
+        results[1][56]="8.169230942250227E+28";
+        results[1][57]="7.098249706679054E-25";
+        results[1][58]="6.529561130949462E+23";
+        results[1][59]="1.392785475542062E-29";
+        results[1][60]="3.372619752780715E+19";
+        results[1][61]="6.438417854312836E-35";
+        results[1][62]="241122707459808.1";
+        results[1][63]="5.476113184315002E-40";
+        results[1][64]="2519471664.228668";
+        results[1][65]="5.941399214551468E-24";
+        results[1][66]="5.296821713629854E+32";
+        results[1][67]="1.917891304584321E-28";
+        results[1][68]="1.130000185511682E+28";
+        results[1][69]="8.518365403010947E-34";
+        results[1][70]="8.296786726957023E+22";
+        results[1][71]="5.205821369719668E-39";
+        results[1][72]="2.022205866476320E+18";
+        results[1][73]="9.864465530164297E-44";
+        results[1][74]="5647785890103.269";
+        results[2][0]="20269260647.17756";
+        results[2][1]="44569.69401753148";
+        results[2][2]="1";
+        results[2][3]="0.00001166109071065203";
+        results[2][4]="8.139070777868161E-11";
+        results[2][5]="253933.9585665772";
+        results[2][6]="157808328301844.9";
+        results[2][7]="2.435210825001846";
+        results[2][8]="232639203.3002624";
+        results[2][9]="0.00002269964480050335";
+        results[2][10]="8284.378509364762";
+        results[2][11]="2.750776908140411E-10";
+        results[2][12]="0.03693544859234678";
+        results[2][13]="3.460942489720927E-15";
+        results[2][14]="2.782853488076028E-7";
+        results[2][15]="29.89469998645674";
+        results[2][16]="3.434304892902040E+17";
+        results[2][17]="0.0003538133189576156";
+        results[2][18]="2695284886705.971";
+        results[2][19]="2.280490767877520E-9";
+        results[2][20]="91210560.48686773";
+        results[2][21]="4.251984043567731E-14";
+        results[2][22]="524.0044886392415";
+        results[2][23]="4.660208399475724E-19";
+        results[2][24]="0.002775588031390770";
+        results[2][25]="0.002778548402117154";
+        results[2][26]="7.442266954968664E+21";
+        results[2][27]="3.239172957900716E-8";
+        results[2][28]="1.147764689243079E+17";
+        results[2][29]="5.529321028550383E-13";
+        results[2][30]="258674242152.6016";
+        results[2][31]="6.746525722402801E-18";
+        results[2][32]="5258983.142583397";
+        results[2][33]="2.902936587789118E-23";
+        results[2][34]="139.1293956768774";
+        results[2][35]="3.415314068374301E-7";
+        results[2][36]="7.196683851264116E+25";
+        results[2][37]="2.889624990111060E-12";
+        results[2][38]="3.522103873109208E+20";
+        results[2][39]="3.079757438024150E-17";
+        results[2][40]="6385884553185581";
+        results[2][41]="4.930639138691073E-22";
+        results[2][42]="23061810822.16754";
+        results[2][43]="8.894703702675794E-27";
+        results[2][44]="605815.4291375707";
+        results[2][45]="7.802000696632482E-11";
+        results[2][46]="4.247869266534626E+29";
+        results[2][47]="2.836227680675536E-16";
+        results[2][48]="3.517489599908254E+24";
+        results[2][49]="1.201161095417993E-20";
+        results[2][50]="1.185444801723589E+20";
+        results[2][51]="2.989792272847868E-26";
+        results[2][52]="2124178310210390";
+        results[2][53]="6.227753305311532E-31";
+        results[2][54]="8662638896.794075";
+        results[2][55]="3.154168430197397E-15";
+        results[2][56]="3.641001234546430E+33";
+        results[2][57]="3.163668174867180E-20";
+        results[2][58]="2.910205416751843E+28";
+        results[2][59]="6.207602247697180E-25";
+        results[2][60]="1.503166304189191E+24";
+        results[2][61]="2.869583137237347E-30";
+        results[2][62]="1.074676529216240E+19";
+        results[2][63]="2.440686890302896E-35";
+        results[2][64]="112292081160512.5";
+        results[2][65]="2.648063450285608E-19";
+        results[2][66]="2.360777230418994E+37";
+        results[2][67]="8.547982860420744E-24";
+        results[2][68]="5.036376250800950E+32";
+        results[2][69]="3.796609395417242E-29";
+        results[2][70]="3.697852457491911E+27";
+        results[2][71]="2.320218655583322E-34";
+        results[2][72]="9.012909670930670E+22";
+        results[2][73]="4.396562103259092E-39";
+        results[2][74]="2.517200889984344E+17";
+        results[3][0]="1738195950114877";
+        results[3][1]="3822086211.611279";
+        results[3][2]="85755.27151045421";
+        results[3][3]="1";
+        results[3][4]="0.000006979682243988879";
+        results[3][5]="21776175562.60126";
+        results[3][6]="1.353289604013560E+19";
+        results[3][7]="208832.1654832305";
+        results[3][8]="19950038042989.76";
+        results[3][9]="1.946614203058035";
+        results[3][10]="710429128.3659471";
+        results[3][11]="0.00002358936206222687";
+        results[3][12]="3167.409422397122";
+        results[3][13]="2.967940628880855E-10";
+        results[3][14]="0.02386443564437743";
+        results[3][15]="2563628.114062170";
+        results[3][16]="2.945097485404958E+22";
+        results[3][17]="30.34135723122526";
+        results[3][18]="2.311348872574943E+17";
+        results[3][19]="0.0001955641049764209";
+        results[3][20]="7821786379172.049";
+        results[3][21]="3.646300461142698E-9";
+        results[3][22]="44936147.19595487";
+        results[3][23]="3.996374365923399E-14";
+        results[3][24]="238.0213052330826";
+        results[3][25]="238.2751726284952";
+        results[3][26]="6.382136233766191E+26";
+        results[3][27]="0.002777761564740970";
+        results[3][28]="9.842687255615237E+21";
+        results[3][29]="4.741684260718020E-8";
+        results[3][30]="2.218267986855733E+16";
+        results[3][31]="5.785501450769154E-13";
+        results[3][32]="450985527261.1410";
+        results[3][33]="2.489421152634873E-18";
+        results[3][34]="11931079.10135604";
+        results[3][35]="0.02928811852269122";
+        results[3][36]="6.171535776400555E+30";
+        results[3][37]="2.478005755903675E-7";
+        results[3][38]="3.020389739265025E+25";
+        results[3][39]="2.641054352841019E-12";
+        results[3][40]="5.476232636928451E+20";
+        results[3][41]="4.228282980585251E-17";
+        results[3][42]="1977671848577708";
+        results[3][43]="7.627677310280051E-22";
+        results[3][44]="51951866610.91471";
+        results[3][45]="0.000006690626880644714";
+        results[3][46]="3.642771822925908E+34";
+        results[3][47]="2.432214748217965E-11";
+        results[3][48]="3.016432756753313E+29";
+        results[3][49]="1.030058958653646E-15";
+        results[3][50]="1.016581408324629E+25";
+        results[3][51]="2.563904481179269E-21";
+        results[3][52]="1.821594877287098E+20";
+        results[3][53]="5.340626755971191E-26";
+        results[3][54]="742866950591597.5";
+        results[3][55]="2.704865701212809E-10";
+        results[3][56]="3.122350494384281E+38";
+        results[3][57]="2.713012233047182E-15";
+        results[3][58]="2.495654556647489E+33";
+        results[3][59]="5.323346161801775E-20";
+        results[3][60]="1.289044345411101E+29";
+        results[3][61]="2.460818810556097E-25";
+        results[3][62]="9.215917754885128E+23";
+        results[3][63]="2.093017669499310E-30";
+        results[3][64]="9.629637908393713E+18";
+        results[3][65]="2.270854001561525E-14";
+        results[3][66]="2.024490923702789E+42";
+        results[3][67]="7.330345910620899E-19";
+        results[3][68]="4.318958128162389E+37";
+        results[3][69]="3.255792695231470E-24";
+        results[3][70]="3.171103414978191E+32";
+        results[3][71]="1.989709807731689E-29";
+        results[3][72]="7.729045159298581E+27";
+        results[3][73]="3.770283768775571E-34";
+        results[3][74]="2.158632457669644E+22";
+        results[4][0]="2.490365448386802E+20";
+        results[4][1]="547601750051441.0";
+        results[4][2]="12286414841.35031";
+        results[4][3]="143272.9979736873";
+        results[4][4]="1";
+        results[4][5]="3119937957255229";
+        results[4][6]="1.938898586936469E+24";
+        results[4][7]="29920010422.11961";
+        results[4][8]="2.858301760108257E+18";
+        results[4][9]="278897.2527702849";
+        results[4][10]="101785311068822.8";
+        results[4][11]="3.379718622942007";
+        results[4][12]="453804243.7569410";
+        results[4][13]="0.00004252257517076709";
+        results[4][14]="3419.129239720079";
+        results[4][15]="367298685591.3171";
+        results[4][16]="4.219529460587362E+27";
+        results[4][17]="4347097.213108260";
+        results[4][18]="3.311538823369143E+22";
+        results[4][19]="28.01905561601273";
+        results[4][20]="1.120650784053732E+18";
+        results[4][21]="0.0005224163985807529";
+        results[4][22]="6438136526151.358";
+        results[4][23]="5.725725364310391E-9";
+        results[4][24]="34102025.98235386";
+        results[4][25]="34138398.32518239";
+        results[4][26]="9.143877916881798E+31";
+        results[4][27]="397.9782270365194";
+        results[4][28]="1.410191311229400E+27";
+        results[4][29]="0.006793553194777180";
+        results[4][30]="3.178179047858768E+21";
+        results[4][31]="8.289061376328140E-8";
+        results[4][32]="6.461404853344776E+16";
+        results[4][33]="3.566668317571105E-13";
+        results[4][34]="1709401471912.486";
+        results[4][35]="4196.196545754653";
+        results[4][36]="8.842144327867755E+35";
+        results[4][37]="0.03550313136443727";
+        results[4][38]="4.327402929934638E+30";
+        results[4][39]="3.783917749429893E-7";
+        results[4][40]="7.845962674940902E+25";
+        results[4][41]="6.057987789095672E-12";
+        results[4][42]="2.833469747538924E+20";
+        results[4][43]="1.092840195819694E-16";
+        results[4][44]="7443299679674857";
+        results[4][45]="0.9585861715133080";
+        results[4][46]="5.219108400046689E+39";
+        results[4][47]="0.000003484706986930048";
+        results[4][48]="4.321733642460815E+34";
+        results[4][49]="1.475796350959623E-10";
+        results[4][50]="1.456486660549828E+30";
+        results[4][51]="3.673382815367253E-16";
+        results[4][52]="2.609853591624336E+25";
+        results[4][53]="7.651676063864807E-21";
+        results[4][54]="1.064327751068292E+20";
+        results[4][55]="0.00003875342181289592";
+        results[4][56]="4.473485160550607E+43";
+        results[4][57]="3.887013961679578E-10";
+        results[4][58]="3.575599102375792E+38";
+        results[4][59]="7.626917638530619E-15";
+        results[4][60]="1.846852478880778E+34";
+        results[4][61]="3.525688884584153E-20";
+        results[4][62]="1.320392165821326E+29";
+        results[4][63]="2.998729163210665E-25";
+        results[4][64]="1.379667092536635E+24";
+        results[4][65]="3.253520607642641E-9";
+        results[4][66]="2.900548840094181E+47";
+        results[4][67]="1.050240634798815E-13";
+        results[4][68]="6.187900791446503E+42";
+        results[4][69]="4.664671802266443E-19";
+        results[4][70]="4.543334931485233E+37";
+        results[4][71]="2.850716892513680E-24";
+        results[4][72]="1.107363471446723E+33";
+        results[4][73]="5.401798587640085E-29";
+        results[4][74]="3.092737437336386E+27";
+        results[5][0]="79820.99267697315";
+        results[5][1]="0.1755168716666387";
+        results[5][2]="0.000003938031784503595";
+        results[5][3]="4.592174586052730E-11";
+        results[5][4]="3.205191941956922E-16";
+        results[5][5]="1";
+        results[5][6]="621454212.7120434";
+        results[5][7]="0.000009589937630824491";
+        results[5][8]="916.1405769180272";
+        results[5][9]="8.939192272132398E-11";
+        results[5][10]="0.03262414588473695";
+        results[5][11]="1.083264689633546E-15";
+        results[5][12]="1.454529705315602E-7";
+        results[5][13]="1.362930152886002E-20";
+        results[5][14]="1.095896548766010E-12";
+        results[5][15]="0.0001177262787348659";
+        results[5][16]="1352440182592.445";
+        results[5][17]="1.393328095835799E-9";
+        results[5][18]="10614117.55214028";
+        results[5][19]="8.980645128168683E-15";
+        results[5][20]="359.1900862796728";
+        results[5][21]="1.674444831077185E-19";
+        results[5][22]="0.002063546331483886";
+        results[5][23]="1.835204879954603E-24";
+        results[5][24]="1.093035388830462E-8";
+        results[5][25]="1.094201192231903E-8";
+        results[5][26]="2.930788381742739E+16";
+        results[5][27]="1.275596606371755E-13";
+        results[5][28]="451993382737.0138";
+        results[5][29]="2.177464195715552E-18";
+        results[5][30]="1018667.387429325";
+        results[5][31]="2.656803272979331E-23";
+        results[5][32]="20.71004276966202";
+        results[5][33]="1.143185655111196E-28";
+        results[5][34]="0.0005478959823343203";
+        results[5][35]="1.344961535532028E-12";
+        results[5][36]="2.834076974930183E+20";
+        results[5][37]="1.137943505635324E-17";
+        results[5][38]="1387015700062728";
+        results[5][39]="1.212818267950047E-22";
+        results[5][40]="25147816342.61536";
+        results[5][41]="1.941701364608288E-27";
+        results[5][42]="90818.14402590475";
+        results[5][43]="3.502762589487909E-32";
+        results[5][44]="2.385720415486439";
+        results[5][45]="3.072452672605791E-16";
+        results[5][46]="1.672824418802933E+24";
+        results[5][47]="1.116915475458918E-21";
+        results[5][48]="1.385198584609954E+19";
+        results[5][49]="4.730210572065213E-26";
+        results[5][50]="466831930796205.5";
+        results[5][51]="1.177389699953815E-31";
+        results[5][52]="8365081701.561654";
+        results[5][53]="2.452509046236414E-36";
+        results[5][54]="34113.74731325223";
+        results[5][55]="1.242121553179516E-20";
+        results[5][56]="1.433837858906067E+28";
+        results[5][57]="1.245862582824943E-25";
+        results[5][58]="1.146048143060329E+23";
+        results[5][59]="2.444573495698746E-30";
+        results[5][60]="5.919516683291835E+18";
+        results[5][61]="1.130050960271621E-35";
+        results[5][62]="42321103301135.62";
+        results[5][63]="9.611502550034045E-41";
+        results[5][64]="442209784.7581557";
+        results[5][65]="1.042815803460698E-24";
+        results[5][66]="9.296815769522365E+31";
+        results[5][67]="3.366222819772885E-29";
+        results[5][68]="1.983340975437319E+27";
+        results[5][69]="1.495116847249808E-34";
+        results[5][70]="1.456226051200787E+22";
+        results[5][71]="9.137094812685324E-40";
+        results[5][72]="3.549312475498482E+17";
+        results[5][73]="1.731380130517828E-44";
+        results[5][74]="991281711273.9084";
+        results[6][0]="0.0001284422746587108";
+        results[6][1]="2.824292893609623E-10";
+        results[6][2]="6.336801173682476E-15";
+        results[6][3]="7.389401330167758E-20";
+        results[6][4]="5.157567325787970E-25";
+        results[6][5]="1.609129006682524E-9";
+        results[6][6]="1";
+        results[6][7]="1.543144681403597E-14";
+        results[6][8]="0.000001474188376517659";
+        results[6][9]="1.438431358140050E-19";
+        results[6][10]="5.249645946137250E-11";
+        results[6][11]="1.743112634004281E-24";
+        results[6][12]="2.340525939904718E-16";
+        results[6][13]="2.193130443091112E-29";
+        results[6][14]="1.763438924942655E-21";
+        results[6][15]="1.894367699610646E-13";
+        results[6][16]="2176.250727612512";
+        results[6][17]="2.242044654835111E-18";
+        results[6][18]="0.01707948443348703";
+        results[6][19]="1.445101657445832E-23";
+        results[6][20]="5.779831867454199E-7";
+        results[6][21]="2.694397747775916E-28";
+        results[6][22]="3.320512258624031E-12";
+        results[6][23]="2.953081405540270E-33";
+        results[6][24]="1.758834949497607E-17";
+        results[6][25]="1.760710877566955E-17";
+        results[6][26]="47160165.97510373";
+        results[6][27]="2.052599500138579E-22";
+        results[6][28]="727.3156629906847";
+        results[6][29]="3.503820798338526E-27";
+        results[6][30]="0.001639167241274031";
+        results[6][31]="4.275139211600108E-32";
+        results[6][32]="3.332513055029883E-8";
+        results[6][33]="1.839533197662788E-37";
+        results[6][34]="8.816353178189703E-13";
+        results[6][35]="2.164216619696854E-21";
+        results[6][36]="456039546753.1217";
+        results[6][37]="1.831097902883797E-26";
+        results[6][38]="2231887.195695002";
+        results[6][39]="1.951581054792877E-31";
+        results[6][40]="40.46608073162718";
+        results[6][41]="3.124447988106234E-36";
+        results[6][42]="0.0001461381098851545";
+        results[6][43]="5.636396886267384E-41";
+        results[6][44]="3.838931922393911E-9";
+        results[6][45]="4.943972717149220E-25";
+        results[6][46]="2691790295382633";
+        results[6][47]="1.797261089573547E-30";
+        results[6][48]="22289632225.11453";
+        results[6][49]="7.611519039226468E-35";
+        results[6][50]="751192.8010897827";
+        results[6][51]="1.894571918364917E-40";
+        results[6][52]="13.46049560925206";
+        results[6][53]="3.946403445450303E-45";
+        results[6][54]="0.00005489342032839216";
+        results[6][55]="1.998733821046708E-29";
+        results[6][56]="2.307230089645316E+19";
+        results[6][57]="2.004753620364024E-34";
+        results[6][58]="184413931005301.8";
+        results[6][59]="3.933634120896147E-39";
+        results[6][60]="9525266000.626017";
+        results[6][61]="1.818397779202506E-44";
+        results[6][62]="68100.11491666482";
+        results[6][63]="1.546614755106283E-49";
+        results[6][64]="0.7115725916931837";
+        results[6][65]="1.678025157975551E-33";
+        results[6][66]="1.495977592452194E+23";
+        results[6][67]="5.416686782253186E-38";
+        results[6][68]="3.191451493718201E+18";
+        results[6][69]="2.405835887289389E-43";
+        results[6][70]="23432555792739.37";
+        results[6][71]="1.470276429990037E-48";
+        results[6][72]="571130165.8104760";
+        results[6][73]="2.786013989610011E-53";
+        results[6][74]="1595.100155404736";
+        results[7][0]="8323411032.456378";
+        results[7][1]="18302.19115320239";
+        results[7][2]="0.4106420642242513";
+        results[7][3]="0.000004788534360528390";
+        results[7][4]="3.342244825091065E-11";
+        results[7][5]="104275.9649224148";
+        results[7][6]="64802737685647.92";
+        results[7][7]="1";
+        results[7][8]="95531442.66270503";
+        results[7][9]="0.000009321428998035992";
+        results[7][10]="3401.914291900572";
+        results[7][11]="1.129584707779182E-10";
+        results[7][12]="0.01516724885301000";
+        results[7][13]="1.421208568140421E-15";
+        results[7][14]="1.142756700777198E-7";
+        results[7][15]="12.27602131180330";
+        results[7][16]="1.410270050396740E+17";
+        results[7][17]="0.0001452906316467887";
+        results[7][18]="1106797349549.367";
+        results[7][19]="9.364654363655727E-10";
+        results[7][20]="37454892.83737830";
+        results[7][21]="1.746043504699232E-14";
+        results[7][22]="215.1782848775914";
+        results[7][23]="1.913677596875906E-19";
+        results[7][24]="0.001139773198646432";
+        results[7][25]="0.001140988851392383";
+        results[7][26]="3.056107864896266E+21";
+        results[7][27]="1.330140669811724E-8";
+        results[7][28]="4.713204612344845E+16";
+        results[7][29]="2.270571800922490E-13";
+        results[7][30]="106222524759.1882";
+        results[7][31]="2.770407248989495E-18";
+        results[7][32]="2159559.693390987";
+        results[7][33]="1.192067872721828E-23";
+        results[7][34]="57.13238223502557";
+        results[7][35]="1.402471619011349E-7";
+        results[7][36]="2.955261112252432E+25";
+        results[7][37]="1.186601570773187E-12";
+        results[7][38]="1.446324004865796E+20";
+        results[7][39]="1.264677951660229E-17";
+        results[7][40]="2622312814817888";
+        results[7][41]="2.024727833856987E-22";
+        results[7][42]="9470149600.764056";
+        results[7][43]="3.652539489129880E-27";
+        results[7][44]="248773.2983599527";
+        results[7][45]="3.203829671144209E-11";
+        results[7][46]="1.744353804164535E+29";
+        results[7][47]="1.164674389402563E-16";
+        results[7][48]="1.444429190193662E+24";
+        results[7][49]="4.932472716883077E-21";
+        results[7][50]="4.867935004036829E+19";
+        results[7][51]="1.227734470523965E-26";
+        results[7][52]="872276966085176.7";
+        results[7][53]="2.557377472772532E-31";
+        results[7][54]="3557243918.208811";
+        results[7][55]="1.295234235087226E-15";
+        results[7][56]="1.495148262797194E+33";
+        results[7][57]="1.299135229848029E-20";
+        results[7][58]="1.195052759651575E+28";
+        results[7][59]="2.549102600877473E-25";
+        results[7][60]="6.172633140245884E+23";
+        results[7][61]="1.178371542938247E-30";
+        results[7][62]="4.413073883307109E+18";
+        results[7][63]="1.002248702759050E-35";
+        results[7][64]="46111852003790.03";
+        results[7][65]="1.087406241422075E-19";
+        results[7][66]="9.694344350728666E+36";
+        results[7][67]="3.510161326756695E-24";
+        results[7][68]="2.068147939838898E+32";
+        results[7][69]="1.559047519187323E-29";
+        results[7][70]="1.518493766341199E+27";
+        results[7][71]="9.527793781803528E-35";
+        results[7][72]="3.701079831937688E+22";
+        results[7][73]="1.805413337572430E-39";
+        results[7][74]="1.033668569530294E+17";
+        results[8][0]="87.12745040231444";
+        results[8][1]="0.0001915829034197918";
+        results[8][2]="4.298501653263149E-9";
+        results[8][3]="5.012521769858929E-14";
+        results[8][4]="3.498580919469208E-19";
+        results[8][5]="0.001091535540718088";
+        results[8][6]="678339.3601041740";
+        results[8][7]="1.046775775731475E-8";
+        results[8][8]="1";
+        results[8][9]="9.757446070344992E-14";
+        results[8][10]="0.00003561041471876213";
+        results[8][11]="1.182421908739965E-18";
+        results[8][12]="1.587670868382187E-10";
+        results[8][13]="1.487686701391408E-23";
+        results[8][14]="1.196210031928393E-15";
+        results[8][15]="1.285024173155902E-7";
+        results[8][16]="1476236525.994914";
+        results[8][17]="1.520867136485833E-12";
+        results[8][18]="11585.68654152080";
+        results[8][19]="9.802693335972867E-18";
+        results[8][20]="0.3920687450478594";
+        results[8][21]="1.827716044092442E-22";
+        results[8][22]="0.000002252434160733091";
+        results[8][23]="2.003191350969721E-27";
+        results[8][24]="1.193086974171064E-11";
+        results[8][25]="1.194359490017227E-11";
+        results[8][26]="31990596809958.51";
+        results[8][27]="1.392359031474151E-16";
+        results[8][28]="493366841.4268441";
+        results[8][29]="2.376779558264652E-21";
+        results[8][30]="1111.911657549550";
+        results[8][31]="2.899995197153080E-26";
+        results[8][32]="0.02260574773287777";
+        results[8][33]="1.247827772192961E-31";
+        results[8][34]="5.980479373345604E-7";
+        results[8][35]="1.468073316931983E-15";
+        results[8][36]="3.093495743267101E+17";
+        results[8][37]="1.242105779730290E-20";
+        results[8][38]="1513976932152.447";
+        results[8][39]="1.323834243899629E-25";
+        results[8][40]="27449735.30941583";
+        results[8][41]="2.119436048930757E-30";
+        results[8][42]="99.13123194632914";
+        results[8][43]="3.823389857123776E-35";
+        results[8][44]="0.002604098623720172";
+        results[8][45]="3.353691289323497E-19";
+        results[8][46]="1.825947306504481E+21";
+        results[8][47]="1.219152937441450E-24";
+        results[8][48]="1.511993486054156E+16";
+        results[8][49]="5.163192954489619E-29";
+        results[8][50]="509563644006.1053";
+        results[8][51]="1.285162702774995E-34";
+        results[8][52]="9130783.978265085";
+        results[8][53]="2.677000787899666E-39";
+        results[8][54]="37.23636761949100";
+        results[8][55]="1.355819821187394E-23";
+        results[8][56]="1.565084982623100E+25";
+        results[8][57]="1.359903288004258E-28";
+        results[8][58]="1.250952279524317E+20";
+        results[8][59]="2.668338852452637E-33";
+        results[8][60]="6461362843686697";
+        results[8][61]="1.233490785959079E-38";
+        results[8][62]="46194988375.59113";
+        results[8][63]="1.049129663306469E-43";
+        results[8][64]="482687.6965168229";
+        results[8][65]="1.138270511899841E-27";
+        results[8][66]="1.014780482794204E+29";
+        results[8][67]="3.674351845758363E-32";
+        results[8][68]="2.164887164052315E+24";
+        results[8][69]="1.631973176299542E-37";
+        results[8][70]="1.589522490205218E+19";
+        results[8][71]="9.973463726956913E-43";
+        results[8][72]="387420071212069.1";
+        results[8][73]="1.889862946953332E-47";
+        results[8][74]="1082019218.719317";
+        results[9][0]="892932943458573.4";
+        results[9][1]="1963453367.188511";
+        results[9][2]="44053.55276650961";
+        results[9][3]="0.5137124749367641";
+        results[9][4]="0.000003585549839831714";
+        results[9][5]="11186693042.92137";
+        results[9][6]="6.952017517839994E+18";
+        results[9][7]="107279.6885767942";
+        results[9][8]="10248583418146.87";
+        results[9][9]="1";
+        results[9][10]="364956305.8000387";
+        results[9][11]="0.00001211814956716597";
+        results[9][12]="1627.137733517652";
+        results[9][13]="1.524668125927760E-10";
+        results[9][14]="0.01225945829784226";
+        results[9][15]="1316967.743292346";
+        results[9][16]="1.512933318157422E+22";
+        results[9][17]="15.58673371619321";
+        results[9][18]="1.187368749772774E+17";
+        results[9][19]="0.0001004637203762303";
+        results[9][20]="4018149239271.144";
+        results[9][21]="1.873150034256679E-9";
+        results[9][22]="23084259.39015671";
+        results[9][23]="2.052987366292351E-14";
+        results[9][24]="122.2745137989658";
+        results[9][25]="122.4049286469690";
+        results[9][26]="3.278583000031628E+26";
+        results[9][27]="0.001426970768207302";
+        results[9][28]="5.056311230110650E+21";
+        results[9][29]="2.435862356942155E-8";
+        results[9][30]="1.139551937600652E+16";
+        results[9][31]="2.972084269024861E-13";
+        results[9][32]="231676891369.9822";
+        results[9][33]="1.278846701479992E-18";
+        results[9][34]="6129144.173823912";
+        results[9][35]="0.01504567185253299";
+        results[9][36]="3.170394917855513E+30";
+        results[9][37]="1.272982469772824E-7";
+        results[9][38]="1.551611888231443E+25";
+        results[9][39]="1.356742568040473E-12";
+        results[9][40]="2.813209021245996E+20";
+        results[9][41]="2.172121714689447E-17";
+        results[9][42]="1015954699945620";
+        results[9][43]="3.918432989082965E-22";
+        results[9][44]="26688321974.27763";
+        results[9][45]="0.000003437058493734438";
+        results[9][46]="1.871337328785176E+34";
+        results[9][47]="1.249459057884749E-11";
+        results[9][48]="1.549579136952070E+29";
+        results[9][49]="5.291541369807505E-16";
+        results[9][50]="5.222305512451464E+24";
+        results[9][51]="1.317109716528063E-21";
+        results[9][52]="9.357760127432864E+19";
+        results[9][53]="2.743546588523462E-26";
+        results[9][54]="381620019737136.4";
+        results[9][55]="1.389523253741598E-10";
+        results[9][56]="1.603990400090178E+38";
+        results[9][57]="1.393708228772385E-15";
+        results[9][58]="1.282048878882594E+33";
+        results[9][59]="2.734669331724314E-20";
+        results[9][60]="6.621981609843777E+28";
+        results[9][61]="1.264153321541716E-25";
+        results[9][62]="4.734331918675705E+23";
+        results[9][63]="1.075209287084869E-30";
+        results[9][64]="4.946865122665819E+18";
+        results[9][65]="1.166566029362225E-14";
+        results[9][66]="1.040006242902376E+42";
+        results[9][67]="3.765690139887650E-19";
+        results[9][68]="2.218702669166555E+37";
+        results[9][69]="1.672541323348396E-24";
+        results[9][70]="1.629035383588871E+32";
+        results[9][71]="1.022138749735799E-29";
+        results[9][72]="3.970506917681290E+27";
+        results[9][73]="1.936841806071609E-34";
+        results[9][74]="1.108916422308302E+22";
+        results[10][0]="2446684.518852554";
+        results[10][1]="5.379968330412397";
+        results[10][2]="0.0001207091152184304";
+        results[10][3]="1.407599942164664E-9";
+        results[10][4]="9.824600322966481E-15";
+        results[10][5]="30.65214346248511";
+        results[10][6]="19048903683.41529";
+        results[10][7]="0.0002939521440563168";
+        results[10][8]="28081.67239549524";
+        results[10][9]="2.740054039641405E-9";
+        results[10][10]="1";
+        results[10][11]="3.320438467449187E-14";
+        results[10][12]="0.000004458445319778002";
+        results[10][13]="4.177673057560849E-19";
+        results[10][14]="3.359157823281803E-11";
+        results[10][15]="0.003608562785085618";
+        results[10][16]="41455190501253.18";
+        results[10][17]="4.270849268387010E-8";
+        results[10][18]="325345453.9358852";
+        results[10][19]="2.752760228542944E-13";
+        results[10][20]="11009.94605494694";
+        results[10][21]="5.132532318219450E-18";
+        results[10][22]="0.06325211819412893";
+        results[10][23]="5.625296326342124E-23";
+        results[10][24]="3.350387754800450E-7";
+        results[10][25]="3.353961192111453E-7";
+        results[10][26]="8.983494593536299E+17";
+        results[10][27]="3.909977017876616E-12";
+        results[10][28]="13854566011748.89";
+        results[10][29]="6.674394491149785E-17";
+        results[10][30]="31224338.90003856";
+        results[10][31]="8.143671507496243E-22";
+        results[10][32]="634.8072020898827";
+        results[10][33]="3.504109070472339E-27";
+        results[10][34]="0.01679418625303079";
+        results[10][35]="4.122595393865199E-11";
+        results[10][36]="8.687053401928578E+21";
+        results[10][37]="3.488040758693718E-16";
+        results[10][38]="4.251500422304194E+16";
+        results[10][39]="3.717547954312753E-21";
+        results[10][40]="770834474302.0734";
+        results[10][41]="5.951730878927634E-26";
+        results[10][42]="2783770.779678667";
+        results[10][43]="1.073671814080092E-30";
+        results[10][44]="73.12744443686990";
+        results[10][45]="9.417726010240848E-15";
+        results[10][46]="5.127565407269577E+25";
+        results[10][47]="3.423585338923651E-20";
+        results[10][48]="4.245930573949562E+20";
+        results[10][49]="1.449910930627067E-24";
+        results[10][50]="1.430939931563421E+16";
+        results[10][51]="3.608951799423663E-30";
+        results[10][52]="256407684391.6768";
+        results[10][53]="7.517465912828107E-35";
+        results[10][54]="1045659.476688773";
+        results[10][55]="3.807368804590335E-19";
+        results[10][56]="4.395020375313125E+29";
+        results[10][57]="3.818835862329240E-24";
+        results[10][58]="3.512883209599986E+24";
+        results[10][59]="7.493141749474667E-29";
+        results[10][60]="1.814458746048353E+20";
+        results[10][61]="3.463848415416480E-34";
+        results[10][62]="1297232529877061";
+        results[10][63]="2.946131550536850E-39";
+        results[10][64]="13554677762.92165";
+        results[10][65]="3.196453961262399E-23";
+        results[10][66]="2.849673307116934E+33";
+        results[10][67]="1.031819447983696E-27";
+        results[10][68]="6.079365211412986E+28";
+        results[10][69]="4.582853609507953E-33";
+        results[10][70]="4.463644983521472E+23";
+        results[10][71]="2.800715410287590E-38";
+        results[10][72]="1.087940351921676E+19";
+        results[10][73]="5.307051214872866E-43";
+        results[10][74]="30384909225705.58";
+        results[11][0]="7.368558528753992E+19";
+        results[11][1]="162025840356721.7";
+        results[11][2]="3635336609.961668";
+        results[11][3]="42391.98997251724";
+        results[11][4]="0.2958826196985332";
+        results[11][5]="923135416089567.4";
+        results[11][6]="5.736863932325467E+23";
+        results[11][7]="8852811065.104166";
+        results[11][8]="8.457218126697593E+17";
+        results[11][9]="82520.84977639587";
+        results[11][10]="30116504485873.39";
+        results[11][11]="1";
+        results[11][12]="134272788.4731154";
+        results[11][13]="0.00001258169093785437";
+        results[11][14]="1011.660916536231";
+        results[11][15]="108677297304.5868";
+        results[11][16]="1.248485430693727E+27";
+        results[11][17]="1286230.511498665";
+        results[11][18]="9.798267822918602E+21";
+        results[11][19]="8.290351577144743";
+        results[11][20]="3.315810897530334E+17";
+        results[11][21]="0.0001545739325855462";
+        results[11][22]="1904932701334.478";
+        results[11][23]="1.694142620466497E-9";
+        results[11][24]="10090196.78468630";
+        results[11][25]="10100958.72876698";
+        results[11][26]="2.705514552250553E+31";
+        results[11][27]="117.7548403985430";
+        results[11][28]="4.172510994426643E+26";
+        results[11][29]="0.002010094316332011";
+        results[11][30]="9.403679425514422E+20";
+        results[11][31]="2.452589194869899E-8";
+        results[11][32]="1.911817394940469E+16";
+        results[11][33]="1.055315165398698E-13";
+        results[11][34]="505782185625.9951";
+        results[11][35]="1241.581626727822";
+        results[11][36]="2.616236827482037E+35";
+        results[11][37]="0.01050475951561086";
+        results[11][38]="1.280403315400169E+30";
+        results[11][39]="1.119595496425095E-7";
+        results[11][40]="2.321483990318425E+25";
+        results[11][41]="1.792453297139352E-12";
+        results[11][42]="8.383744517383584E+19";
+        results[11][43]="3.233524200509892E-17";
+        results[11][44]="2202343008423450";
+        results[11][45]="0.2836289876341450";
+        results[11][46]="1.544243465896434E+39";
+        results[11][47]="0.000001031064232174645";
+        results[11][48]="1.278725871770590E+34";
+        results[11][49]="4.366624904634691E-11";
+        results[11][50]="4.309490886794513E+29";
+        results[11][51]="1.086890130566436E-16";
+        results[11][52]="7.722103177194344E+24";
+        results[11][53]="2.263997958860880E-21";
+        results[11][54]="3.149160832039346E+19";
+        results[11][55]="0.00001146646396828192";
+        results[11][56]="1.323626508486227E+43";
+        results[11][57]="1.150099873786527E-10";
+        results[11][58]="1.057957629402673E+38";
+        results[11][59]="2.256672371113390E-15";
+        results[11][60]="5.464515496479744E+33";
+        results[11][61]="1.043190063412758E-20";
+        results[11][62]="3.906810930526339E+28";
+        results[11][63]="8.872718405771617E-26";
+        results[11][64]="4.082195136515981E+23";
+        results[11][65]="9.626602006324680E-10";
+        results[11][66]="8.582219893706080E+46";
+        results[11][67]="3.107479503381239E-14";
+        results[11][68]="1.830892296607818E+42";
+        results[11][69]="1.380195312888473E-19";
+        results[11][70]="1.344293841695707E+37";
+        results[11][71]="8.434775821758094E-25";
+        results[11][72]="3.276496048901183E+32";
+        results[11][73]="1.598298317194785E-29";
+        results[11][74]="9.150872549988179E+26";
+        results[12][0]="548775266570.8102";
+        results[12][1]="1206691.558276256";
+        results[12][2]="27.07426166761666";
+        results[12][3]="0.0003157154212300068";
+        results[12][4]="2.203593319712548E-9";
+        results[12][5]="6875074.440525237";
+        results[12][6]="4272543973773303";
+        results[12][7]="65.93153509191260";
+        results[12][8]="6298534664.297173";
+        results[12][9]="0.0006145761230907817";
+        results[12][10]="224293.4315161216";
+        results[12][11]="7.447525380023099E-9";
+        results[12][12]="1";
+        results[12][13]="9.370246258327704E-14";
+        results[12][14]="0.000007534370351881011";
+        results[12][15]="809.3769299082260";
+        results[12][16]="9.298126931680603E+18";
+        results[12][17]="0.009579234378946397";
+        results[12][18]="72972848291449.96";
+        results[12][19]="6.174260378010000E-8";
+        results[12][20]="2469458581.471433";
+        results[12][21]="1.151193286020835E-12";
+        results[12][22]="14187.03464042448";
+        results[12][23]="1.261717016330308E-17";
+        results[12][24]="0.07514699664337871";
+        results[12][25]="0.07522714649505796";
+        results[12][26]="2.014938829390782E+23";
+        results[12][27]="8.769821624887181E-7";
+        results[12][28]="3.107488152941784E+18";
+        results[12][29]="1.497022843712283E-11";
+        results[12][30]="7003414118711.969";
+        results[12][31]="1.826572027556399E-16";
+        results[12][32]="142383085.7078879";
+        results[12][33]="7.859486478230080E-22";
+        results[12][34]="3766.825664213152";
+        results[12][35]="0.000009246710676425823";
+        results[12][36]="1.948449017282359E+27";
+        results[12][37]="7.823446310355102E-11";
+        results[12][38]="9.535836188108477E+21";
+        results[12][39]="8.338215874985453E-16";
+        results[12][40]="1.728931093721377E+17";
+        results[12][41]="1.334934142295141E-20";
+        results[12][42]="624381500728.4375";
+        results[12][43]="2.408175355021632E-25";
+        results[12][44]="16402005.45075007";
+        results[12][45]="2.112334083915552E-9";
+        results[12][46]="1.150079240519853E+31";
+        results[12][47]="7.678877037554697E-15";
+        results[12][48]="9.523343384103629E+25";
+        results[12][49]="3.252054980230781E-19";
+        results[12][50]="3.209504275438039E+21";
+        results[12][51]="8.094641832690152E-25";
+        results[12][52]="5.751055939931189E+16";
+        results[12][53]="1.686118225893689E-29";
+        results[12][54]="234534552223.8769";
+        results[12][55]="8.539678142289999E-14";
+        results[12][56]="9.857742015622534E+34";
+        results[12][57]="8.565397999586525E-19";
+        results[12][58]="7.879166295965479E+29";
+        results[12][59]="1.680662475826388E-23";
+        results[12][60]="4.069711784956242E+25";
+        results[12][61]="7.769184473454425E-29";
+        results[12][62]="2.909607356004657E+20";
+        results[12][63]="6.607979551678220E-34";
+        results[12][64]="3040225188540963";
+        results[12][65]="7.169436276548434E-18";
+        results[12][66]="6.391630047531518E+38";
+        results[12][67]="2.314303246933335E-22";
+        results[12][68]="1.363561684707550E+34";
+        results[12][69]="1.027903962212583E-27";
+        results[12][70]="1.001166250423753E+29";
+        results[12][71]="6.281820700734860E-33";
+        results[12][72]="2.440178748173697E+24";
+        results[12][73]="1.190336728215637E-37";
+        results[12][74]="6.815135556539365E+18";
+        results[13][0]="5.856572510920854E+24";
+        results[13][1]="1.287790656733084E+19";
+        results[13][2]="288938635348614.2";
+        results[13][3]="3369339636.612199";
+        results[13][4]="23516.92003563011";
+        results[13][5]="7.337133145689837E+19";
+        results[13][6]="4.559692302618115E+28";
+        results[13][7]="703626492562206.3";
+        results[13][8]="6.721845393016666E+22";
+        results[13][9]="6558804391.555706";
+        results[13][10]="2.393677021207241E+18";
+        results[13][11]="79480.57259865707";
+        results[13][12]="10672078112261.57";
+        results[13][13]="1";
+        results[13][14]="80407388.92198187";
+        results[13][15]="8637733818243049";
+        results[13][16]="9.923033691261843E+31";
+        results[13][17]="102230337547.7774";
+        results[13][18]="7.787719370405676E+26";
+        results[13][19]="658921.8903956439";
+        results[13][20]="2.635425487645780E+22";
+        results[13][21]="12.28562467072543";
+        results[13][22]="1.514051418639709E+17";
+        results[13][23]="0.0001346514255384665";
+        results[13][24]="801974618079.9959";
+        results[13][25]="802829983557.8030";
+        results[13][26]="2.150358457868733E+36";
+        results[13][27]="9359222.141139671";
+        results[13][28]="3.316335630112216E+31";
+        results[13][29]="159.7634472393744";
+        results[13][30]="7.474098252740968E+25";
+        results[13][31]="0.001949331935575389";
+        results[13][32]="1.519523412539414E+21";
+        results[13][33]="8.387705361793504E-9";
+        results[13][34]="4.019985772375435E+16";
+        results[13][35]="98681618.62029944";
+        results[13][36]="2.079400011019663E+40";
+        results[13][37]="834.9243013119425";
+        results[13][38]="1.017671886652243E+35";
+        results[13][39]="0.008898609113474424";
+        results[13][40]="1.845128768291237E+30";
+        results[13][41]="1.424652144129865E-7";
+        results[13][42]="6.663448147624991E+24";
+        results[13][43]="2.570023549681410E-12";
+        results[13][44]="1.750434833681448E+20";
+        results[13][45]="22542.99434273927";
+        results[13][46]="1.227373549011834E+44";
+        results[13][47]="0.08194957555923548";
+        results[13][48]="1.016338644850434E+39";
+        results[13][49]="0.000003470618477439216";
+        results[13][50]="3.425208032911223E+34";
+        results[13][51]="8.638664992924948E-12";
+        results[13][52]="6.137571821893155E+29";
+        results[13][53]="1.799438541324536E-16";
+        results[13][54]="2.502971061357505E+24";
+        results[13][55]="0.9113611218809168";
+        results[13][56]="1.052025928012465E+48";
+        results[13][57]="0.000009141059651419642";
+        results[13][58]="8.408707817004228E+42";
+        results[13][59]="1.793616122236614E-10";
+        results[13][60]="4.343228206344449E+38";
+        results[13][61]="8.291334356927543E-16";
+        results[13][62]="3.105155697929257E+33";
+        results[13][63]="7.052087393973718E-21";
+        results[13][64]="3.244552069097433E+28";
+        results[13][65]="0.00007651278396420666";
+        results[13][66]="6.821197513193451E+51";
+        results[13][67]="2.469842502673314E-9";
+        results[13][68]="1.455203681008597E+47";
+        results[13][69]="1.096987137663585E-14";
+        results[13][70]="1.068452442788232E+42";
+        results[13][71]="6.704008120546416E-20";
+        results[13][72]="2.604177820839036E+37";
+        results[13][73]="1.270336654341115E-24";
+        results[13][74]="7.273165900503936E+31";
+        results[14][0]="7.283624788019671E+16";
+        results[14][1]="160158248389.6609";
+        results[14][2]="3593433.877438394";
+        results[14][3]="41.90335840753915";
+        results[14][4]="0.0002924721266406031";
+        results[14][5]="912494889345.1759";
+        results[14][6]="5.670737930617694E+20";
+        results[14][7]="8750769.077266332";
+        results[14][8]="835973594359440.8";
+        results[14][9]="81.56967263194704";
+        results[14][10]="29769366389.07392";
+        results[14][11]="0.0009884734930986993";
+        results[14][12]="132725.0922501232";
+        results[14][13]="1.243666799042916E-8";
+        results[14][14]="1";
+        results[14][15]="107424627.6871908";
+        results[14][16]="1.234094754760663E+24";
+        results[14][17]="1271.404766631212";
+        results[14][18]="9.685328021236938E+18";
+        results[14][19]="0.008194792782476575";
+        results[14][20]="327759118033654.3";
+        results[14][21]="1.527922350848377E-7";
+        results[14][22]="1882975481.406032";
+        results[14][23]="1.674615073859902E-12";
+        results[14][24]="9973.892061812134";
+        results[14][25]="9984.529958270096";
+        results[14][26]="2.674329420092467E+28";
+        results[14][27]="0.1163975384180276";
+        results[14][28]="4.124416517653632E+23";
+        results[14][29]="0.000001986924950322545";
+        results[14][30]="9.295287849718610E+17";
+        results[14][31]="2.424319408589176E-11";
+        results[14][32]="18897808185436.61";
+        results[14][33]="1.043151067861683E-16";
+        results[14][34]="499952283.7728221";
+        results[14][35]="1.227270527538816";
+        results[14][36]="2.586080755634628E+32";
+        results[14][37]="0.00001038367633255766";
+        results[14][38]="1.265644737748760E+27";
+        results[14][39]="1.106690471208886E-10";
+        results[14][40]="2.294725389082761E+22";
+        results[14][41]="1.771792571839617E-15";
+        results[14][42]="8.287109228345220E+16";
+        results[14][43]="3.196252961497192E-20";
+        results[14][44]="2176957686537.825";
+        results[14][45]="0.0002803597361507711";
+        results[14][46]="1.526443732929490E+36";
+        results[14][47]="1.019179663186800E-9";
+        results[14][48]="1.263986629184754E+31";
+        results[14][49]="4.316292972536028E-14";
+        results[14][50]="4.259817510346784E+26";
+        results[14][51]="1.074362083975506E-19";
+        results[14][52]="7.633094301629857E+21";
+        results[14][53]="2.237901970763539E-24";
+        results[14][54]="3.112862007975538E+16";
+        results[14][55]="1.133429569221800E-8";
+        results[14][56]="1.308369718401416E+40";
+        results[14][57]="1.136843239654142E-13";
+        results[14][58]="1.045763073486079E+35";
+        results[14][59]="2.230660821453777E-18";
+        results[14][60]="5.401528720897306E+30";
+        results[14][61]="1.031165725947463E-23";
+        results[14][62]="3.861779047373550E+25";
+        results[14][63]="8.770446955834192E-29";
+        results[14][64]="4.035141686102474E+20";
+        results[14][65]="9.515640911862703E-13";
+        results[14][66]="8.483296876872797E+43";
+        results[14][67]="3.071661119439865E-17";
+        results[14][68]="1.809788503915430E+39";
+        results[14][69]="1.364286482089321E-22";
+        results[14][70]="1.328798829452025E+34";
+        results[14][71]="8.337552320037675E-28";
+        results[14][72]="3.238729494581439E+29";
+        results[14][73]="1.579875520611302E-32";
+        results[14][74]="9.045394954387817E+23";
+        results[15][0]="678021878.6728144";
+        results[15][1]="1490.889490034119";
+        results[15][2]="0.03345074546501661";
+        results[15][3]="3.900721772064906E-7";
+        results[15][4]="2.722579849122226E-12";
+        results[15][5]="8494.280212934647";
+        results[15][6]="5278806222284.789";
+        results[15][7]="0.08145961746078984";
+        results[15][8]="7781954.774781330";
+        results[15][9]="7.593200403679254E-7";
+        results[15][10]="277.1186368526144";
+        results[15][11]="9.201553818525026E-12";
+        results[15][12]="0.001235518289498798";
+        results[15][13]="1.157711062927156E-16";
+        results[15][14]="9.308852369606484E-9";
+        results[15][15]="1";
+        results[15][16]="1.148800588217273E+16";
+        results[15][17]="0.00001183531927458393";
+        results[15][18]="90159288700.90755";
+        results[15][19]="7.628411621159118E-11";
+        results[15][20]="3051061.242567714";
+        results[15][21]="1.422320359626963E-15";
+        results[15][22]="17.52834077199745";
+        results[15][23]="1.558874449847949E-20";
+        results[15][24]="0.00009284548875379919";
+        results[15][25]="0.00009294451536144952";
+        results[15][26]="2.489493775933610E+20";
+        results[15][27]="1.083527501319018E-9";
+        results[15][28]="3839358447360413";
+        results[15][29]="1.849599103204027E-14";
+        results[15][30]="8652846232.602745";
+        results[15][31]="2.256763147132834E-19";
+        results[15][32]="175916.9065073704";
+        results[15][33]="9.710539289921761E-25";
+        results[15][34]="4.653982001488808";
+        results[15][35]="1.142448015842791E-8";
+        results[15][36]="2.407344397008314E+24";
+        results[15][37]="9.666011003355619E-14";
+        results[15][38]="1.178170001607253E+19";
+        results[15][39]="1.030201821533375E-18";
+        results[15][40]="213612598757592.2";
+        results[15][41]="1.649335548082038E-23";
+        results[15][42]="771434763.7746916";
+        results[15][43]="2.975344695449488E-28";
+        results[15][44]="20264.97771886068";
+        results[15][45]="2.609827394209354E-12";
+        results[15][46]="1.420943936035166E+28";
+        results[15][47]="9.487393022711177E-18";
+        results[15][48]="1.176626492823741E+23";
+        results[15][49]="4.017973406530782E-22";
+        results[15][50]="3.965401232528285E+18";
+        results[15][51]="1.000107803123075E-27";
+        results[15][52]="71055347977156.85";
+        results[15][53]="2.083229906348919E-32";
+        results[15][54]="289771728.7920109";
+        results[15][55]="1.055092853123241E-16";
+        results[15][56]="1.217942055346239E+32";
+        results[15][57]="1.058270588532557E-21";
+        results[15][58]="9.734854064667849E+26";
+        results[15][59]="2.076489227357834E-26";
+        results[15][60]="5.028203343302236E+22";
+        results[15][61]="9.598969511443032E-32";
+        results[15][62]="3.594873103603994E+17";
+        results[15][63]="8.164279592732510E-37";
+        results[15][64]="3756253824637.292";
+        results[15][65]="8.857969645071753E-21";
+        results[15][66]="7.896975823435262E+35";
+        results[15][67]="2.859363989032589E-25";
+        results[15][68]="1.684705400315972E+31";
+        results[15][69]="1.269994145161927E-30";
+        results[15][70]="1.236959213227480E+26";
+        results[15][71]="7.761304367110075E-36";
+        results[15][72]="3.014885473014884E+21";
+        results[15][73]="1.470682798372580E-40";
+        results[15][74]="8420224625517956";
+        results[16][0]="5.901998011029744E-8";
+        results[16][1]="1.297779184068582E-13";
+        results[16][2]="2.911797383123386E-18";
+        results[16][3]="3.395473341564099E-23";
+        results[16][4]="2.369932499205253E-28";
+        results[16][5]="7.394042360403217E-13";
+        results[16][6]="0.0004595058773843880";
+        results[16][7]="7.090840507594115E-18";
+        results[16][8]="6.773982233816134E-10";
+        results[16][9]="6.609676632793603E-23";
+        results[16][10]="2.412243166437193E-14";
+        results[16][11]="8.009705002679486E-28";
+        results[16][12]="1.075485425556837E-19";
+        results[16][13]="1.007756328470993E-32";
+        results[16][14]="8.103105504195564E-25";
+        results[16][15]="8.704730918982346E-17";
+        results[16][16]="1";
+        results[16][17]="1.030232696254985E-21";
+        results[16][18]="0.000007848123479882456";
+        results[16][19]="6.640327050142802E-27";
+        results[16][20]="2.655866713388787E-10";
+        results[16][21]="1.238091601114291E-31";
+        results[16][22]="1.525794898764651E-15";
+        results[16][23]="1.356958262240303E-36";
+        results[16][24]="8.081949966432234E-21";
+        results[16][25]="8.090569966166392E-21";
+        results[16][26]="21670.37344398340";
+        results[16][27]="9.431815342299341E-26";
+        results[16][28]="0.3342058218579424";
+        results[16][29]="1.610026250138211E-30";
+        results[16][30]="7.532069813813702E-7";
+        results[16][31]="1.964451594366708E-35";
+        results[16][32]="1.531309335246434E-11";
+        results[16][33]="8.452763159697483E-41";
+        results[16][34]="4.051166102474697E-16";
+        results[16][35]="9.944702566836774E-25";
+        results[16][36]="209552852.0527718";
+        results[16][37]="8.414002484413322E-30";
+        results[16][38]="1025.565284080813";
+        results[16][39]="8.967629648693503E-35";
+        results[16][40]="0.01859440193089382";
+        results[16][41]="1.435702214116641E-39";
+        results[16][42]="6.715132040207400E-8";
+        results[16][43]="2.589957496510927E-44";
+        results[16][44]="1.764011781218549E-12";
+        results[16][45]="2.271784521158129E-28";
+        results[16][46]="1236893461414.578";
+        results[16][47]="8.258520338533136E-34";
+        results[16][48]="10242217.01217658";
+        results[16][49]="3.497537734347732E-38";
+        results[16][50]="345.1775071495967";
+        results[16][51]="8.705669316160942E-44";
+        results[16][52]="0.006185176844958069";
+        results[16][53]="1.813395577714413E-48";
+        results[16][54]="2.522384927062784E-8";
+        results[16][55]="9.184299380979178E-33";
+        results[16][56]="1.060185786670131E+16";
+        results[16][57]="9.211960712648993E-38";
+        results[16][58]="84739285168.49519";
+        results[16][59]="1.807527998031550E-42";
+        results[16][60]="4376915.710937338";
+        results[16][61]="8.355644669662702E-48";
+        results[16][62]="31.29240305475972";
+        results[16][63]="7.106785700207527E-53";
+        results[16][64]="0.0003269717880686592";
+        results[16][65]="7.710624224886317E-37";
+        results[16][66]="6.874104961671300E+19";
+        results[16][67]="2.488999412395668E-41";
+        results[16][68]="1466490718750697";
+        results[16][69]="1.105495730231758E-46";
+        results[16][70]="10767397108.90133";
+        results[16][71]="6.756006609601578E-52";
+        results[16][72]="262437.6679414338";
+        results[16][73]="1.280189802700927E-56";
+        results[16][74]="0.7329578964252270";
+        results[17][0]="57288009131181.63";
+        results[17][1]="125969520.1662847";
+        results[17][2]="2826.349225478968";
+        results[17][3]="0.03295831469829135";
+        results[17][4]="2.300385638914618E-7";
+        results[17][5]="717706047.1174538";
+        results[17][6]="4.460214464700500E+17";
+        results[17][7]="6882.756229121966";
+        results[17][8]="657519632063.7410";
+        results[17][9]="0.06415712350055034";
+        results[17][10]="23414546.78351770";
+        results[17][11]="7.774656183788081E-7";
+        results[17][12]="104.3924765216976";
+        results[17][13]="9.781832125249994E-12";
+        results[17][14]="0.0007865315800645127";
+        results[17][15]="84492.86215264814";
+        results[17][16]="9.706544974112313E+20";
+        results[17][17]="1";
+        results[17][18]="7617816351986589";
+        results[17][19]="0.000006445463315502565";
+        results[17][20]="257792896987.5612";
+        results[17][21]="1.201759180828659E-10";
+        results[17][22]="1481019.680613023";
+        results[17][23]="1.317137640042879E-15";
+        results[17][24]="7.844781082769998";
+        results[17][25]="7.853148124279642";
+        results[17][26]="2.103444544398340E+25";
+        results[17][27]="0.00009155033980755107";
+        results[17][28]="3.243983840474286E+20";
+        results[17][29]="1.562779220646795E-9";
+        results[17][30]="731103743959364.5";
+        results[17][31]="1.906803775018709E-14";
+        results[17][32]="14863722931.84754";
+        results[17][33]="8.204712576512332E-20";
+        results[17][34]="393228.2597126994";
+        results[17][35]="0.0009652870271917130";
+        results[17][36]="2.034034182903733E+29";
+        results[17][37]="8.167089352725064E-9";
+        results[17][38]="9.954695553818683E+23";
+        results[17][39]="8.704470049622648E-14";
+        results[17][40]="1.804873986089417E+19";
+        results[17][41]="1.393570811075580E-18";
+        results[17][42]="65180731155375.70";
+        results[17][43]="2.513953892092264E-23";
+        results[17][44]="1712245968.926182";
+        results[17][45]="2.205117862611359E-7";
+        results[17][46]="1.200596201140605E+33";
+        results[17][47]="8.016169908559313E-13";
+        results[17][48]="9.941654006331020E+27";
+        results[17][49]="3.394900731710114E-17";
+        results[17][50]="3.350480997199534E+23";
+        results[17][51]="8.450197074706576E-23";
+        results[17][52]="6.003669721842360E+18";
+        results[17][53]="1.760180573094133E-27";
+        results[17][54]="24483642736557.92";
+        results[17][55]="8.914781499718627E-12";
+        results[17][56]="1.029074101922827E+37";
+        results[17][57]="8.941631095708316E-17";
+        results[17][58]="8.225256825621270E+31";
+        results[17][59]="1.754485180486043E-21";
+        results[17][60]="4.248472919611204E+27";
+        results[17][61]="8.110444077378283E-27";
+        results[17][62]="3.037411175990747E+22";
+        results[17][63]="6.898233502044262E-32";
+        results[17][64]="3.173766366154361E+17";
+        results[17][65]="7.484352081733892E-16";
+        results[17][66]="6.672380896723107E+40";
+        results[17][67]="2.415958473695767E-20";
+        results[17][68]="1.423455811567193E+36";
+        results[17][69]="1.073054402418369E-25";
+        results[17][70]="1.045142242916776E+31";
+        results[17][71]="6.557748200149776E-31";
+        results[17][72]="2.547363026774680E+26";
+        results[17][73]="1.242621989531652E-35";
+        results[17][74]="7.114488785782220E+20";
+        results[18][0]="0.007520266502124582";
+        results[18][1]="1.653617183005917E-8";
+        results[18][2]="3.710182938109170E-13";
+        results[18][3]="4.326477979440449E-18";
+        results[18][4]="3.019744153210938E-23";
+        results[18][5]="9.421414404802356E-8";
+        results[18][6]="58.54977671570353";
+        results[18][7]="9.035077653620603E-13";
+        results[18][8]="0.00008631340028199442";
+        results[18][9]="8.421983483996608E-18";
+        results[18][10]="3.073655979828342E-9";
+        results[18][11]="1.020588555112725E-22";
+        results[18][12]="1.370372711787334E-14";
+        results[18][13]="1.284072977513965E-27";
+        results[18][14]="1.032489553071727E-19";
+        results[18][15]="1.109148058296442E-11";
+        results[18][16]="127418.9941790999";
+        results[18][17]="1.312712139272323E-16";
+        results[18][18]="1";
+        results[18][19]="8.461037937494653E-22";
+        results[18][20]="0.00003384078652937511";
+        results[18][21]="1.577563865155743E-26";
+        results[18][22]="1.944152513241934E-10";
+        results[18][23]="1.729022569176787E-31";
+        results[18][24]="1.029793935728606E-15";
+        results[18][25]="1.030892287424556E-15";
+        results[18][26]="2761217187.717842";
+        results[18][27]="1.201792424198785E-20";
+        results[18][28]="42584.16966993846";
+        results[18][29]="2.051479253945588E-25";
+        results[18][30]="0.09597287597629022";
+        results[18][31]="2.503084462677351E-30";
+        results[18][32]="0.000001951178952741667";
+        results[18][33]="1.077042579842804E-35";
+        results[18][34]="5.161955100297903E-11";
+        results[18][35]="1.267143998476655E-19";
+        results[18][36]="26701013635925.91";
+        results[18][37]="1.072103733584393E-24";
+        results[18][38]="130676496.9625801";
+        results[18][39]="1.142646350007201E-29";
+        results[18][40]="2369.279991396404";
+        results[18][41]="1.829357320634491E-34";
+        results[18][42]="0.008556353703430740";
+        results[18][43]="3.300097791720419E-39";
+        results[18][44]="2.247686068829500E-7";
+        results[18][45]="2.894684986776169E-23";
+        results[18][46]="1.576037207601508E+17";
+        results[18][47]="1.052292354943532E-28";
+        results[18][48]="1305052989855.606";
+        results[18][49]="4.456527402140359E-33";
+        results[18][50]="43982170.77425067";
+        results[18][51]="1.109267627921080E-38";
+        results[18][52]="788.1090124044157";
+        results[18][53]="2.310610405611983E-43";
+        results[18][54]="0.003213997503388622";
+        results[18][55]="1.170254189364097E-27";
+        results[18][56]="1.350878065804859E+21";
+        results[18][57]="1.173778768423119E-32";
+        results[18][58]="1.079739448362558E+16";
+        results[18][59]="2.303133994597421E-37";
+        results[18][60]="557702197494.3356";
+        results[18][61]="1.064667839526379E-42";
+        results[18][62]="3987246.522684476";
+        results[18][63]="9.055394857668533E-48";
+        results[18][64]="41.66241636065038";
+        results[18][65]="9.824799832280163E-32";
+        results[18][66]="8.758915400977171E+24";
+        results[18][67]="3.171458016398266E-36";
+        results[18][68]="1.868587723561991E+20";
+        results[18][69]="1.408611540154202E-41";
+        results[18][70]="1371970909543155";
+        results[18][71]="8.608435668627840E-47";
+        results[18][72]="33439543683.80610";
+        results[18][73]="1.631204970184925E-51";
+        results[18][74]="93392.75793813131";
+        results[19][0]="8.888113441495055E+18";
+        results[19][1]="19543904603925.69";
+        results[19][2]="438502104.0583787";
+        results[19][3]="5113.412812236528";
+        results[19][4]="0.03568999661175253";
+        results[19][5]="111350575123317.2";
+        results[19][6]="6.919928399829436E+22";
+        results[19][7]="1067845070.589050";
+        results[19][8]="1.020127801336300E+17";
+        results[19][9]="9953.842006398556";
+        results[19][10]="3632717407172.463";
+        results[19][11]="0.1206221462014772";
+        results[19][12]="16196271.92208414";
+        results[19][13]="0.000001517630563767670";
+        results[19][14]="122.0287109807536";
+        results[19][15]="13108888844.25527";
+        results[19][16]="1.505949921515530E+26";
+        results[19][17]="155147.8848067927";
+        results[19][18]="1.181888093857317E+21";
+        results[19][19]="1";
+        results[19][20]="3.999602268583552E+16";
+        results[19][21]="0.00001864503949527103";
+        results[19][22]="229777070804.3422";
+        results[19][23]="2.043511188520634E-10";
+        results[19][24]="1217101.191764106";
+        results[19][25]="1218399.320556418";
+        results[19][26]="3.263449718717902E+30";
+        results[19][27]="14.20384157448466";
+        results[19][28]="5.032972311970014E+25";
+        results[19][29]="0.0002424618905033581";
+        results[19][30]="1.134291994496223E+20";
+        results[19][31]="2.958365724357601E-9";
+        results[19][32]="2306075173230364";
+        results[19][33]="1.272943801693578E-14";
+        results[19][34]="61008532740.68144";
+        results[19][35]="149.7622405002312";
+        results[19][36]="3.155761011022271E+34";
+        results[19][37]="0.001267106638103371";
+        results[19][38]="1.544449959070552E+29";
+        results[19][39]="1.350480116563032E-8";
+        results[19][40]="2.800223812845777E+24";
+        results[19][41]="2.162095636668628E-13";
+        results[19][42]="1.011265256891675E+19";
+        results[19][43]="3.900346288599187E-18";
+        results[19][44]="265651340347854.4";
+        results[19][45]="0.03421193721338280";
+        results[19][46]="1.862699611140355E+38";
+        results[19][47]="1.243691805564838E-7";
+        results[19][48]="1.542426590563234E+33";
+        results[19][49]="5.267116676538570E-12";
+        results[19][50]="5.198200398008612E+28";
+        results[19][51]="1.311030202341272E-17";
+        results[19][52]="9.314566584224275E+23";
+        results[19][53]="2.730882927935629E-22";
+        results[19][54]="3.798585382942154E+18";
+        results[19][55]="0.000001383109493196072";
+        results[19][56]="1.596586702227764E+42";
+        results[19][57]="1.387275151221789E-11";
+        results[19][58]="1.276131198487774E+37";
+        results[19][59]="2.722046646772734E-16";
+        results[19][60]="6.591415871366172E+32";
+        results[19][61]="1.258318243449020E-21";
+        results[19][62]="4.712479192434771E+27";
+        results[19][63]="1.070246336745521E-26";
+        results[19][64]="4.924031385797897E+22";
+        results[19][65]="1.161181394630329E-10";
+        results[19][66]="1.035205782751841E+46";
+        results[19][67]="3.748308469749455E-15";
+        results[19][68]="2.208461582805865E+41";
+        results[19][69]="1.664821208178269E-20";
+        results[19][70]="1.621516083107649E+36";
+        results[19][71]="1.017420762348790E-25";
+        results[19][72]="3.952179854391208E+31";
+        results[19][73]="1.927901732902443E-30";
+        results[19][74]="1.103797886595758E+26";
+        results[20][0]="222.2249324966694";
+        results[20][1]="0.0004886462025847162";
+        results[20][2]="1.096364274774934E-8";
+        results[20][3]="1.278480326006873E-13";
+        results[20][4]="8.923386430719285E-19";
+        results[20][5]="0.002784041203245736";
+        results[20][6]="1730154.134120969";
+        results[20][7]="2.669878150077217E-8";
+        results[20][8]="2.550573114105107";
+        results[20][9]="2.488707960935246E-13";
+        results[20][10]="0.00009082696636380747";
+        results[20][11]="3.015853529960997E-18";
+        results[20][12]="4.049470630943514E-10";
+        results[20][13]="3.794453702780639E-23";
+        results[20][14]="3.051021146259370E-15";
+        results[20][15]="3.277548107026588E-7";
+        results[20][16]="3765249193.262553";
+        results[20][17]="3.879082828446787E-12";
+        results[20][18]="29550.14060125232";
+        results[20][19]="2.500248606854969E-17";
+        results[20][20]="1";
+        results[20][21]="4.661723402280728E-22";
+        results[20][22]="0.000005744998011657722";
+        results[20][23]="5.109286002191258E-27";
+        results[20][24]="3.043055559109729E-11";
+        results[20][25]="3.046301203814225E-11";
+        results[20][26]="81594356127656.76";
+        results[20][27]="3.551313510859396E-16";
+        results[20][28]="1258368201.134266";
+        results[20][29]="6.062150039464433E-21";
+        results[20][30]="2836.011979005927";
+        results[20][31]="7.396649780892585E-26";
+        results[20][32]="0.05765761239172050";
+        results[20][33]="3.182675966789038E-31";
+        results[20][34]="0.000001525364989911545";
+        results[20][35]="3.744428331701820E-15";
+        results[20][36]="7.890187071375662E+17";
+        results[20][37]="3.168081606654638E-20";
+        results[20][38]="3861508858523.363";
+        results[20][39]="3.376536030022057E-25";
+        results[20][40]="70012556.86949763";
+        results[20][41]="5.405776603467944E-30";
+        results[20][42]="252.8414549704244";
+        results[20][43]="9.751835374322068E-35";
+        results[20][44]="0.006641943936138782";
+        results[20][45]="8.553834835557002E-19";
+        results[20][46]="4.657212107742966E+21";
+        results[20][47]="3.109538704220428E-24";
+        results[20][48]="3.856449934231786E+16";
+        results[20][49]="1.316910113265814E-28";
+        results[20][50]="1299679330327.398";
+        results[20][51]="3.277901436948555E-34";
+        results[20][52]="23288732.12566459";
+        results[20][53]="6.827886236055077E-39";
+        results[20][54]="94.97407811720772";
+        results[20][55]="3.458117583491362E-23";
+        results[20][56]="3.991863677968137E+25";
+        results[20][57]="3.468532764166796E-28";
+        results[20][58]="3.190645251183220E+20";
+        results[20][59]="6.805793336387770E-33";
+        results[20][60]="1.648017834958501E+16";
+        results[20][61]="3.146108435163604E-38";
+        results[20][62]="117823695357.1807";
+        results[20][63]="2.675881912439624E-43";
+        results[20][64]="1231130.261245134";
+        results[20][65]="2.903242164230390E-27";
+        results[20][66]="2.588271816133498E+29";
+        results[20][67]="9.371703029553756E-32";
+        results[20][68]="5.521702995703085E+24";
+        results[20][69]="4.162466906410325E-37";
+        results[20][70]="4.054193327782826E+19";
+        results[20][71]="2.543804843647882E-42";
+        results[20][72]="988143217498189.4";
+        results[20][73]="4.820233621842614E-47";
+        results[20][74]="2759769128.210504";
+        results[21][0]="4.767012396916274E+23";
+        results[21][1]="1.048209343234839E+18";
+        results[21][2]="23518432565916.35";
+        results[21][3]="274250575.5235032";
+        results[21][4]="1914.181872385126";
+        results[21][5]="5.972128680744241E+18";
+        results[21][6]="3.711404527506926E+27";
+        results[21][7]="57272341571595.42";
+        results[21][8]="5.471309415005725E+21";
+        results[21][9]="533860065.5108917";
+        results[21][10]="1.948355973230217E+17";
+        results[21][11]="6469.396121798011";
+        results[21][12]="868663857010.9776";
+        results[21][13]="0.08139594255901624";
+        results[21][14]="6544835.210014115";
+        results[21][15]="703076485709783.2";
+        results[21][16]="8.076946803451319E+30";
+        results[21][17]="8321134682.827734";
+        results[21][18]="6.338887585392785E+25";
+        results[21][19]="53633.56834152223";
+        results[21][20]="2.145129416109833E+21";
+        results[21][21]="1";
+        results[21][22]="1.232376423029948E+16";
+        results[21][23]="0.00001096007969861868";
+        results[21][24]="65277479947.02833";
+        results[21][25]="65347103226.32689";
+        results[21][26]="1.750304535179781E+35";
+        results[21][27]="761802.7077972777";
+        results[21][28]="2.699362644550329E+30";
+        results[21][29]="13.00409637452654";
+        results[21][30]="6.083612720605475E+24";
+        results[21][31]="0.0001586677102565503";
+        results[21][32]="1.236830404041385E+20";
+        results[21][33]="6.827251838304966E-10";
+        results[21][34]="3272105310163334";
+        results[21][35]="8032283.360848641";
+        results[21][36]="1.692547238541742E+39";
+        results[21][37]="67.95945047071364";
+        results[21][38]="8.283436242987168E+33";
+        results[21][39]="0.0007243106762555027";
+        results[21][40]="1.501859952378219E+29";
+        results[21][41]="1.159609040901739E-8";
+        results[21][42]="5.423776426690670E+23";
+        results[21][43]="2.091894892251871E-13";
+        results[21][44]="1.424782931756363E+19";
+        results[21][45]="1834.908272629834";
+        results[21][46]="9.990322689382312E+42";
+        results[21][47]="0.006670362944955292";
+        results[21][48]="8.272584195675434E+37";
+        results[21][49]="2.824942622339028E-7";
+        results[21][50]="2.787980362995230E+33";
+        results[21][51]="7.031522795507035E-13";
+        results[21][52]="4.995734434666519E+28";
+        results[21][53]="1.464669961481319E-17";
+        results[21][54]="2.037316887371354E+23";
+        results[21][55]="0.07418109752713971";
+        results[21][56]="8.563064200709839E+46";
+        results[21][57]="7.440451663154942E-7";
+        results[21][58]="6.844346984684270E+41";
+        results[21][59]="1.459930748584969E-11";
+        results[21][60]="3.535211536043119E+37";
+        results[21][61]="6.748809750540721E-17";
+        results[21][62]="2.527470748254518E+32";
+        results[21][63]="5.740113004410473E-22";
+        results[21][64]="2.640933738459919E+27";
+        results[21][65]="0.000006227830168580984";
+        results[21][66]="5.552178009675986E+50";
+        results[21][67]="2.010351584774140E-10";
+        results[21][68]="1.184476752310447E+46";
+        results[21][69]="8.929030204524482E-16";
+        results[21][70]="8.696769366023154E+40";
+        results[21][71]="5.456790598951745E-21";
+        results[21][72]="2.119695083184782E+36";
+        results[21][73]="1.034002493473623E-25";
+        results[21][74]="5.920061938596140E+30";
+        results[22][0]="38681463.77870482";
+        results[22][1]="85.05593937424482";
+        results[22][2]="0.001908380599175486";
+        results[22][3]="2.225379927743381E-8";
+        results[22][4]="1.553244476779973E-13";
+        results[22][5]="484.6026400002877";
+        results[22][6]="301158352119.5565";
+        results[22][7]="0.004647309093335652";
+        results[22][8]="443964.1421858626";
+        results[22][9]="4.331956174545530E-8";
+        results[22][10]="15.80974722349805";
+        results[22][11]="5.249529284155089E-13";
+        results[22][12]="0.00007048689351547812";
+        results[22][13]="6.604795502245522E-18";
+        results[22][14]="5.310743606992122E-10";
+        results[22][15]="0.05705046547232572";
+        results[22][16]="655396082926770.0";
+        results[22][17]="6.752104736286019E-7";
+        results[22][18]="5143629387.040573";
+        results[22][19]="4.352044338016266E-12";
+        results[22][20]="174064.4640730606";
+        results[22][21]="8.114403856748394E-17";
+        results[22][22]="1";
+        results[22][23]="8.893451297674116E-22";
+        results[22][24]="0.000005296878350409827";
+        results[22][25]="0.000005302527864470423";
+        results[22][26]="1.420267787074702E+19";
+        results[22][27]="6.181574830231600E-11";
+        results[22][28]="219037186537017.3";
+        results[22][29]="1.055204897749860E-15";
+        results[22][30]="493648905.2304466";
+        results[22][31]="1.287493880047189E-20";
+        results[22][32]="10036.14140069709";
+        results[22][33]="5.539907864773438E-26";
+        results[22][34]="0.2655118394847626";
+        results[22][35]="6.517719108176616E-10";
+        results[22][36]="1.373401184015196E+23";
+        results[22][37]="5.514504270020602E-15";
+        results[22][38]="6.721514699722450E+17";
+        results[22][39]="5.877349344891688E-20";
+        results[22][40]="12186698189873.78";
+        results[22][41]="9.409536073813374E-25";
+        results[22][42]="44010712.35487979";
+        results[22][43]="1.697447998160085E-29";
+        results[22][44]="1156.126411647312";
+        results[22][45]="1.488918676420706E-13";
+        results[22][46]="8.106551296088482E+26";
+        results[22][47]="5.412601880645680E-19";
+        results[22][48]="6.712708910266456E+21";
+        results[22][49]="2.292272530980073E-23";
+        results[22][50]="2.262279861002728E+17";
+        results[22][51]="5.705661569067654E-29";
+        results[22][52]="4053740676394.876";
+        results[22][53]="1.188492358430754E-33";
+        results[22][54]="16531612.00830475";
+        results[22][55]="6.019353838720512E-18";
+        results[22][56]="6.948416117582402E+30";
+        results[22][57]="6.037482967145447E-23";
+        results[22][58]="5.553779556944628E+25";
+        results[22][59]="1.184646769690344E-27";
+        results[22][60]="2.868613412248970E+21";
+        results[22][61]="5.476256786824880E-33";
+        results[22][62]="2.050891838745521E+16";
+        results[22][63]="4.657759510115996E-38";
+        results[22][64]="214296029127.7612";
+        results[22][65]="5.053512913910754E-22";
+        results[22][66]="4.505261465506844E+34";
+        results[22][67]="1.631280465291153E-26";
+        results[22][68]="9.611322727176706E+29";
+        results[22][69]="7.245375712861636E-32";
+        results[22][70]="7.056909888490957E+24";
+        results[22][71]="4.427860268160242E-37";
+        results[22][72]="1.720006195812521E+20";
+        results[22][73]="8.390313820929822E-42";
+        results[22][74]="480377734267339.0";
+        results[23][0]="4.349432237720928E+28";
+        results[23][1]="9.563884315247705E+22";
+        results[23][2]="2.145826783438484E+18";
+        results[23][3]="25022680771022.83";
+        results[23][4]="174650360.6745100";
+        results[23][5]="5.448982895167197E+23";
+        results[23][6]="3.386293375197521E+32";
+        results[23][7]="5.225540611608288E+18";
+        results[23][8]="4.992034333194938E+26";
+        results[23][9]="48709505787460.23";
+        results[23][10]="1.777684128953709E+22";
+        results[23][11]="590269076.4751797";
+        results[23][12]="7.925707484777299E+16";
+        results[23][13]="7426.583090383436";
+        results[23][14]="597152154909.8750";
+        results[23][15]="6.414884791379698E+19";
+        results[23][16]="7.369423421683034E+35";
+        results[23][17]="759222096156514.8";
+        results[23][18]="5.783614498890633E+30";
+        results[23][19]="4893538169.095777";
+        results[23][20]="1.957220636251567E+26";
+        results[23][21]="91240.21243440706";
+        results[23][22]="1.124422866364071E+21";
+        results[23][23]="1";
+        results[23][24]="5955931137549612";
+        results[23][25]="5962283580343192";
+        results[23][26]="1.596981576147093E+40";
+        results[23][27]="69507040892.53014";
+        results[23][28]="2.462904211262749E+35";
+        results[23][29]="1186496.515729304";
+        results[23][30]="5.550701169967046E+29";
+        results[23][31]="14.47687559028860";
+        results[23][32]="1.128486688100694E+25";
+        results[23][33]="0.00006229199080701412";
+        results[23][34]="2.985475836070540E+20";
+        results[23][35]="732867240177.1831";
+        results[23][36]="1.544283695998176E+44";
+        results[23][37]="6200634.697873477";
+        results[23][38]="7.557824824970159E+38";
+        results[23][39]="66.08625997006110";
+        results[23][40]="1.370300211017172E+34";
+        results[23][41]="0.001058029752327336";
+        results[23][42]="4.948665133679859E+28";
+        results[23][43]="1.908649343595118E-8";
+        results[23][44]="1.299974973663679E+24";
+        results[23][45]="167417420.5923969";
+        results[23][46]="9.115191644675190E+47";
+        results[23][47]="608.6053321123179";
+        results[23][48]="7.547923393949451E+42";
+        results[23][49]="0.02577483649772239";
+        results[23][50]="2.543759205826400E+38";
+        results[23][51]="6.415576335994377E-8";
+        results[23][52]="4.558118710848557E+33";
+        results[23][53]="1.336367984318503E-12";
+        results[23][54]="1.858852255999673E+28";
+        results[23][55]="6768.299096993695";
+        results[23][56]="7.812957967622318E+51";
+        results[23][57]="0.06788683903541942";
+        results[23][58]="6.244796728573862E+46";
+        results[23][59]="0.000001332043916404155";
+        results[23][60]="3.225534515491407E+42";
+        results[23][61]="6.157628353187331E-12";
+        results[23][62]="2.306069679924920E+37";
+        results[23][63]="5.237291299199141E-17";
+        results[23][64]="2.409593553222759E+32";
+        results[23][65]="0.5682285475867381";
+        results[23][66]="5.065819010764803E+55";
+        results[23][67]="0.00001834249056626394";
+        results[23][68]="1.080719105044218E+51";
+        results[23][69]="8.146866126940509E-11";
+        results[23][70]="7.934950844489962E+45";
+        results[23][71]="4.978787334584325E-16";
+        results[23][72]="1.934014296859477E+41";
+        results[23][73]="9.434260716223996E-21";
+        results[23][74]="5.401477089023595E+35";
+        results[24][0]="7302690607518.291";
+        results[24][1]="16057748.30899485";
+        results[24][2]="360.2840150232697";
+        results[24][3]="0.004201304580784266";
+        results[24][4]="2.932377098408908E-8";
+        results[24][5]="91488346.14311905";
+        results[24][6]="5.685581812469896E+16";
+        results[24][7]="877.3675334597941";
+        results[24][8]="83816186216.83326";
+        results[24][9]="0.008178319168327438";
+        results[24][10]="2984729.151326427";
+        results[24][11]="9.910609488981233E-8";
+        results[24][12]="13.30725171553627";
+        results[24][13]="1.246922255961287E-12";
+        results[24][14]="0.0001002617627905542";
+        results[24][15]="10770.58253903672";
+        results[24][16]="1.237325155628808E+20";
+        results[24][17]="0.1274732831227585";
+        results[24][18]="971068060613965.9";
+        results[24][19]="8.216243700744122E-7";
+        results[24][20]="32861706944.73151";
+        results[24][21]="1.531921883031460E-11";
+        results[24][22]="188790.4410571613";
+        results[24][23]="1.678998593008280E-16";
+        results[24][24]="1";
+        results[24][25]="1.001066574251259";
+        results[24][26]="2.681329819411114E+24";
+        results[24][27]="0.00001167022238627271";
+        results[24][28]="4.135212705424321E+19";
+        results[24][29]="1.992125980518727E-10";
+        results[24][30]="93196194545840.82";
+        results[24][31]="2.430665374725046E-15";
+        results[24][32]="1894727561.549639";
+        results[24][33]="1.045881649206614E-20";
+        results[24][34]="50126.09728222654";
+        results[24][35]="0.0001230483065119351";
+        results[24][36]="2.592850152786563E+28";
+        results[24][37]="1.041085693348789E-9";
+        results[24][38]="1.268957724732794E+23";
+        results[24][39]="1.109587375069120E-14";
+        results[24][40]="2.300732126296780E+18";
+        results[24][41]="1.776430465518496E-19";
+        results[24][42]="8308801796717.613";
+        results[24][43]="3.204619562442379E-24";
+        results[24][44]="218265615.1727291";
+        results[24][45]="2.810936136197098E-8";
+        results[24][46]="1.530439394641047E+32";
+        results[24][47]="1.021847496313918E-13";
+        results[24][48]="1.267295275857541E+27";
+        results[24][49]="4.327591421469434E-18";
+        results[24][50]="4.270968127534385E+22";
+        results[24][51]="1.077174364147177E-23";
+        results[24][52]="7.653074902279439E+17";
+        results[24][53]="2.243759965412078E-28";
+        results[24][54]="3121010322433.718";
+        results[24][55]="1.136396466091162E-12";
+        results[24][56]="1.311794543487070E+36";
+        results[24][57]="1.139819072242488E-17";
+        results[24][58]="1.048500492089822E+31";
+        results[24][59]="2.236499861467814E-22";
+        results[24][60]="5.415667913209714E+26";
+        results[24][61]="1.033864934126942E-27";
+        results[24][62]="3.871887747972994E+21";
+        results[24][63]="8.793404722529862E-33";
+        results[24][64]="4.045704185582832E+16";
+        results[24][65]="9.540549319052715E-17";
+        results[24][66]="8.505502991508699E+39";
+        results[24][67]="3.079701585302480E-21";
+        results[24][68]="1.814525856806408E+35";
+        results[24][69]="1.367857676455993E-26";
+        results[24][70]="1.332277130348850E+30";
+        results[24][71]="8.359376929654525E-32";
+        results[24][72]="3.247207283284959E+25";
+        results[24][73]="1.584011046861337E-36";
+        results[24][74]="9.069072432637074E+19";
+        results[25][0]="7294910044299.792";
+        results[25][1]="16040639.77563644";
+        results[25][2]="359.9001547851519";
+        results[25][3]="0.004196828351727361";
+        results[25][4]="2.929252832762058E-8";
+        results[25][5]="91390870.99331748";
+        results[25][6]="5.679524178222003E+16";
+        results[25][7]="876.4327528526417";
+        results[25][8]="83726885276.85887";
+        results[25][9]="0.008169605677269126";
+        results[25][10]="2981549.107819164";
+        results[25][11]="9.900050350191554E-8";
+        results[25][12]="13.29307366544463";
+        results[25][13]="1.245593737753071E-12";
+        results[25][14]="0.0001001549401102962";
+        results[25][15]="10759.10715238146";
+        results[25][16]="1.236006862534849E+20";
+        results[25][17]="0.1273374682578942";
+        results[25][18]="970033447915559.5";
+        results[25][19]="8.207489803452292E-7";
+        results[25][20]="32826694837.26416";
+        results[25][21]="1.530289715424023E-11";
+        results[25][22]="188589.2965693774";
+        results[25][23]="1.677209724302378E-16";
+        results[25][24]="0.9989345621173533";
+        results[25][25]="1";
+        results[25][26]="2.678473029045643E+24";
+        results[25][27]="0.00001165778848924346";
+        results[25][28]="4.130806893155160E+19";
+        results[25][29]="1.990003494032078E-10";
+        results[25][30]="93096899789653.17";
+        results[25][31]="2.428075651754777E-15";
+        results[25][32]="1892708847.028269";
+        results[25][33]="1.044767327276784E-20";
+        results[25][34]="50072.69103927282";
+        results[25][35]="0.0001229172061847818";
+        results[25][36]="2.590087632009758E+28";
+        results[25][37]="1.039976481212013E-9";
+        results[25][38]="1.267605729101387E+23";
+        results[25][39]="1.108405178645614E-14";
+        results[25][40]="2.298280839131601E+18";
+        results[25][41]="1.774537789204645E-19";
+        results[25][42]="8299949284523.987";
+        results[25][43]="3.201205239361082E-24";
+        results[25][44]="218033066.7178449";
+        results[25][45]="2.807941258351893E-8";
+        results[25][46]="1.528808806532901E+32";
+        results[25][47]="1.020758781281058E-13";
+        results[25][48]="1.265945051462143E+27";
+        results[25][49]="4.322980641628383E-18";
+        results[25][50]="4.266417676295733E+22";
+        results[25][51]="1.076026701773399E-23";
+        results[25][52]="7.644921026359818E+17";
+        results[25][53]="2.241369378545362E-28";
+        results[25][54]="3117685079804.065";
+        results[25][55]="1.135185706246483E-12";
+        results[25][56]="1.310396907886189E+36";
+        results[25][57]="1.138604665823557E-17";
+        results[25][58]="1.047383379945576E+31";
+        results[25][59]="2.234117009790872E-22";
+        results[25][60]="5.409897855455146E+26";
+        results[25][61]="1.032763415260583E-27";
+        results[25][62]="3.867762492088947E+21";
+        results[25][63]="8.784035896021034E-33";
+        results[25][64]="4.041393739081530E+16";
+        results[25][65]="9.530384456386937E-17";
+        results[25][66]="8.496440906410580E+39";
+        results[25][67]="3.076420354566251E-21";
+        results[25][68]="1.812592592219525E+35";
+        results[25][69]="1.366400309069427E-26";
+        results[25][70]="1.330857671823993E+30";
+        results[25][71]="8.350470532798348E-32";
+        results[25][72]="3.243747585632540E+25";
+        results[25][73]="1.582323381485480E-36";
+        results[25][74]="9.059409899306875E+19";
+        results[26][0]="2.723533134436308E-12";
+        results[26][1]="5.988725516997952E-18";
+        results[26][2]="1.343676605597132E-22";
+        results[26][3]="1.566873478364917E-27";
+        results[26][4]="1.093627899552070E-32";
+        results[26][5]="3.412051194925813E-17";
+        results[26][6]="2.120433589075808E-8";
+        results[26][7]="3.272135815251872E-22";
+        results[26][8]="3.125918550193178E-14";
+        results[26][9]="3.050098167380094E-27";
+        results[26][10]="1.113152559494507E-18";
+        results[26][11]="3.696154578685082E-32";
+        results[26][12]="4.962929819077190E-24";
+        results[26][13]="4.650387456755103E-37";
+        results[26][14]="3.739255128732137E-29";
+        results[26][15]="4.016880900314683E-21";
+        results[26][16]="0.00004614595141080237";
+        results[26][17]="4.754106794320244E-26";
+        results[26][18]="3.621591247686330E-10";
+        results[26][19]="3.064242094077263E-31";
+        results[26][20]="1.225574963096063E-14";
+        results[26][21]="5.713291486714258E-36";
+        results[26][22]="7.040925726124371E-20";
+        results[26][23]="6.261813003582785E-41";
+        results[26][24]="3.729492704555177E-25";
+        results[26][25]="3.733470485444113E-25";
+        results[26][26]="1";
+        results[26][27]="4.352400925014057E-30";
+        results[26][28]="0.00001542224561666388";
+        results[26][29]="7.429619310899423E-35";
+        results[26][30]="3.475745276510183E-11";
+        results[26][31]="9.065148782251936E-40";
+        results[26][32]="7.066372617918999E-16";
+        results[26][33]="3.900607980544203E-45";
+        results[26][34]="1.869449141218870E-20";
+        results[26][35]="4.589077614441313E-29";
+        results[26][36]="9670.015728822264";
+        results[26][37]="3.882721498161075E-34";
+        results[26][38]="0.04732568576779893";
+        results[26][39]="4.138198020386811E-39";
+        results[26][40]="8.580563680159561E-7";
+        results[26][41]="6.625184461300789E-44";
+        results[26][42]="3.098761568445328E-12";
+        results[26][43]="1.195160527900366E-48";
+        results[26][44]="8.140200194419411E-17";
+        results[26][45]="1.048336581291759E-32";
+        results[26][46]="57077625.57077626";
+        results[26][47]="3.810972782670732E-38";
+        results[26][48]="472.6368485827938";
+        results[26][49]="1.613972063466582E-42";
+        results[26][50]="0.01592854447302717";
+        results[26][51]="4.017313932620759E-48";
+        results[26][52]="2.854208701546549E-7";
+        results[26][53]="8.368086421777320E-53";
+        results[26][54]="1.163978522835795E-12";
+        results[26][55]="4.238182329769274E-37";
+        results[26][56]="489232817981.0316";
+        results[26][57]="4.250946914441208E-42";
+        results[26][58]="3910374.935971505";
+        results[26][59]="8.341009917082876E-47";
+        results[26][60]="201.9769397260919";
+        results[26][61]="3.855791729321848E-52";
+        results[26][62]="0.001444017710892185";
+        results[26][63]="3.279493876087616E-57";
+        results[26][64]="1.508842424491952E-8";
+        results[26][65]="3.558140908285596E-41";
+        results[26][66]="3172121135540393";
+        results[26][67]="1.148572459459261E-45";
+        results[26][68]="67672609451.86232";
+        results[26][69]="5.101415225212420E-51";
+        results[26][70]="496871.7838081744";
+        results[26][71]="3.117623527377340E-56";
+        results[26][72]="12.11043587318969";
+        results[26][73]="5.907557643204166E-61";
+        results[26][74]="0.00003382303947460244";
+        results[27][0]="6.257541943766386E+17";
+        results[27][1]="1375959067231.062";
+        results[27][2]="30872077.93461244";
+        results[27][3]="360.0021012218345";
+        results[27][4]="0.002512700273696726";
+        results[27][5]="7839468959112.017";
+        results[27][6]="4.871871010065461E+21";
+        results[27][7]="75180018.37666884";
+        results[27][8]="7182055614931850";
+        results[27][9]="700.7852033691596";
+        results[27][10]="255755978980.9374";
+        results[27][11]="0.008492219908884301";
+        results[27][12]="1140274.047492801";
+        results[27][13]="1.068464862698761E-7";
+        results[27][14]="8.591246976449121";
+        results[27][15]="922911507.8137501";
+        results[27][16]="1.060241283048926E+25";
+        results[27][17]="10922.95235716340";
+        results[27][18]="8.320904507836979E+19";
+        results[27][19]="0.07040348871507895";
+        results[27][20]="2815859531810263";
+        results[27][21]="0.000001312675827697515";
+        results[27][22]="16177107411.35740";
+        results[27][23]="1.438703169001500E-11";
+        results[27][24]="85688.17001947338";
+        results[27][25]="85779.56281525363";
+        results[27][26]="2.297582454439834E+29";
+        results[27][27]="1";
+        results[27][28]="3.543388093690857E+24";
+        results[27][29]="0.00001707016297188988";
+        results[27][30]="7.985811363411926E+18";
+        results[27][31]="2.082792678898868E-10";
+        results[27][32]="162355737434647.7";
+        results[27][33]="8.961968457746355E-16";
+        results[27][34]="4295213546.332090";
+        results[27][35]="10.54378420900297";
+        results[27][36]="2.221765847269926E+33";
+        results[27][37]="0.00008920872789651233";
+        results[27][38]="1.087346652644278E+28";
+        results[27][39]="9.507851164638391E-10";
+        results[27][40]="1.971455256073830E+23";
+        results[27][41]="1.522190757571212E-14";
+        results[27][42]="7.119660210152448E+17";
+        results[27][43]="2.745979859142930E-19";
+        results[27][44]="18702781142325.76";
+        results[27][45]="0.002408639735523385";
+        results[27][46]="1.311405510525019E+37";
+        results[27][47]="8.756024199812025E-9";
+        results[27][48]="1.085922130625564E+32";
+        results[27][49]="3.708233894976874E-13";
+        results[27][50]="3.659714430599182E+27";
+        results[27][51]="9.230110005566145E-19";
+        results[27][52]="6.557779833982852E+22";
+        results[27][53]="1.922636853991178E-23";
+        results[27][54]="2.674336631412318E+17";
+        results[27][55]="9.737573359594823E-8";
+        results[27][56]="1.124052738729375E+41";
+        results[27][57]="9.766901045375269E-13";
+        results[27][58]="8.984408843169418E+35";
+        results[27][59]="1.916415803779827E-17";
+        results[27][60]="4.640586729161206E+31";
+        results[27][61]="8.858999425264104E-23";
+        results[27][62]="3.317749756446258E+26";
+        results[27][63]="7.534907589141790E-28";
+        results[27][64]="3.466689881027168E+21";
+        results[27][65]="8.175122121301600E-12";
+        results[27][66]="7.288209864375369E+44";
+        results[27][67]="2.638939930506406E-16";
+        results[27][68]="1.554834001227581E+40";
+        results[27][69]="1.172092211426029E-21";
+        results[27][70]="1.141603892583884E+35";
+        results[27][71]="7.162997116051003E-27";
+        results[27][72]="2.782472497785938E+30";
+        results[27][73]="1.357310078961783E-31";
+        results[27][74]="7.771122205267246E+24";
+        results[28][0]="1.765977019256848E-7";
+        results[28][1]="3.883173479306462E-13";
+        results[28][2]="8.712587252178613E-18";
+        results[28][3]="1.015982702721253E-22";
+        results[28][4]="7.091236430383361E-28";
+        results[28][5]="2.212421770302413E-12";
+        results[28][6]="0.001374918829450271";
+        results[28][7]="2.121698679027844E-17";
+        results[28][8]="2.026889357030855E-9";
+        results[28][9]="1.977726359178481E-22";
+        results[28][10]="7.217837059291388E-14";
+        results[28][11]="2.396638382345144E-27";
+        results[28][12]="3.218033185591791E-19";
+        results[28][13]="3.015376341646586E-32";
+        results[28][14]="2.424585382489199E-24";
+        results[28][15]="2.604601820097072E-16";
+        results[28][16]="2.992168102999295";
+        results[28][17]="3.082629412401127E-21";
+        results[28][18]="0.00002348290474490412";
+        results[28][19]="1.986897479292069E-26";
+        results[28][20]="7.946799665619501E-10";
+        results[28][21]="3.704578197445509E-31";
+        results[28][22]="4.565434827802628E-15";
+        results[28][23]="4.060247229376789E-36";
+        results[28][24]="2.418255289959476E-20";
+        results[28][25]="2.420834538784717E-20";
+        results[28][26]="64841.40019917012";
+        results[28][27]="2.822157702060747E-25";
+        results[28][28]="1";
+        results[28][29]="4.817469190655120E-30";
+        results[28][30]="0.000002253721904645720";
+        results[28][31]="5.877969400550175E-35";
+        results[28][32]="4.581934948749433E-11";
+        results[28][33]="2.529208830865435E-40";
+        results[28][34]="1.212176999177676E-15";
+        results[28][35]="2.975622181430421E-24";
+        results[28][36]="627017359.8048342";
+        results[28][37]="2.517610985241837E-29";
+        results[28][38]="3068.663730570020";
+        results[28][39]="2.683265539433148E-34";
+        results[28][40]="0.05563757635196901";
+        results[28][41]="4.295862370485278E-39";
+        results[28][42]="2.009280389813716E-7";
+        results[28][43]="7.749588209183903E-44";
+        results[28][44]="5.278219785077115E-12";
+        results[28][45]="6.797561181096882E-28";
+        results[28][46]="3700993162053.089";
+        results[28][47]="2.471088113492979E-33";
+        results[28][48]="30646435.04783151";
+        results[28][49]="1.046522084775171E-37";
+        results[28][50]="1032.829126765834";
+        results[28][51]="2.604882604307646E-43";
+        results[28][52]="0.01850708886689335";
+        results[28][53]="5.425984405757048E-48";
+        results[28][54]="7.547399722243467E-8";
+        results[28][55]="2.748096765616207E-32";
+        results[28][56]="3.172254094127582E+16";
+        results[28][57]="2.756373501047097E-37";
+        results[28][58]="253554186152.1326";
+        results[28][59]="5.408427620988176E-42";
+        results[28][60]="13096467.57978319";
+        results[28][61]="2.500149346056082E-47";
+        results[28][62]="93.63213028664973";
+        results[28][63]="2.126469748701247E-52";
+        results[28][64]="0.0009783545548396877";
+        results[28][65]="2.307148385991850E-36";
+        results[28][66]="2.056847760298206E+20";
+        results[28][67]="7.447504650154305E-41";
+        results[28][68]="4387986751990347";
+        results[28][69]="3.307829062001381E-46";
+        results[28][70]="32217862181.58138";
+        results[28][71]="2.021510748090225E-51";
+        results[28][72]="785257.6190398789";
+        results[28][73]="3.830543093426676E-56";
+        results[28][74]="2.193133238525025";
+        results[29][0]="3.665777505505325E+22";
+        results[29][1]="8.060608850055552E+16";
+        results[29][2]="1808540315956.603";
+        results[29][3]="21089552.67824123";
+        results[29][4]="147.1983763619884";
+        results[29][5]="4.592498016581085E+17";
+        results[29][6]="2.854027239276019E+26";
+        results[29][7]="4404176954869.778";
+        results[29][8]="4.207373782405491E+20";
+        results[29][9]="41053222.77960500";
+        results[29][10]="1.498263252683064E+16";
+        results[29][11]="497.4890938574387";
+        results[29][12]="66799247867.20172";
+        results[29][13]="0.006259254023867518";
+        results[29][14]="503290.2726585955";
+        results[29][15]="54065770158934.34";
+        results[29][16]="6.211078856100365E+29";
+        results[29][17]="639885651.6572606";
+        results[29][18]="4.874531380596274E+24";
+        results[29][19]="4124.359493873326";
+        results[29][20]="1.649579758814986E+20";
+        results[29][21]="0.07689884565596421";
+        results[29][22]="947683243446292.2";
+        results[29][23]="8.428174771211442E-7";
+        results[29][24]="5019762855.256830";
+        results[29][25]="5025116805.065672";
+        results[29][26]="1.345963983017241E+34";
+        results[29][27]="58581.74884719846";
+        results[29][28]="2.075778713727511E+29";
+        results[29][29]="1";
+        results[29][30]="4.678227956325009E+23";
+        results[29][31]="0.00001220136376160371";
+        results[29][32]="9.511083034298228E+18";
+        results[29][33]="5.250077853682115E-11";
+        results[29][34]="251621121216311.1";
+        results[29][35]="617673.3184308691";
+        results[29][36]="1.301549288620499E+38";
+        results[29][37]="5.226003292611552";
+        results[29][38]="6.369866851504902E+32";
+        results[29][39]="0.00005569865490033896";
+        results[29][40]="1.154912966748064E+28";
+        results[29][41]="8.917259665756348E-10";
+        results[29][42]="4.170821463085429E+22";
+        results[29][43]="1.608643024477765E-14";
+        results[29][44]="1.095641627623847E+18";
+        results[29][45]="141.1023280498135";
+        results[29][46]="7.682442825440876E+41";
+        results[29][47]="0.0005129432105733799";
+        results[29][48]="6.361521752392140E+36";
+        results[29][49]="2.172348267022037E-8";
+        results[29][50]="2.143924716258292E+32";
+        results[29][51]="5.407159861780895E-14";
+        results[29][52]="3.841662112296063E+27";
+        results[29][53]="1.126314293048790E-18";
+        results[29][54]="1.566673168742592E+22";
+        results[29][55]="0.005704440769329544";
+        results[29][56]="6.584897523124984E+45";
+        results[29][57]="5.721621440556141E-8";
+        results[29][58]="5.263223823910997E+40";
+        results[29][59]="1.122669893038318E-12";
+        results[29][60]="2.718536862713640E+36";
+        results[29][61]="5.189756793682972E-18";
+        results[29][62]="1.943595829699885E+31";
+        results[29][63]="4.414080639739539E-23";
+        results[29][64]="2.030847559414579E+26";
+        results[29][65]="4.789129509052666E-7";
+        results[29][66]="4.269560798205122E+49";
+        results[29][67]="1.545937162317696E-11";
+        results[29][68]="9.108489495899883E+44";
+        results[29][69]="6.866321155551707E-17";
+        results[29][70]="6.687715251833322E+39";
+        results[29][71]="4.196208980457067E-22";
+        results[29][72]="1.630021050395328E+35";
+        results[29][73]="7.951359815351027E-27";
+        results[29][74]="4.552459292898528E+29";
+        results[30][0]="0.07835824888672127";
+        results[30][1]="1.723004720015306E-7";
+        results[30][2]="3.865866163087327E-12";
+        results[30][3]="4.508021600300163E-17";
+        results[30][4]="3.146455831913338E-22";
+        results[30][5]="9.816746980813501E-7";
+        results[30][6]="610.0658766354783";
+        results[30][7]="9.414199128358610E-12";
+        results[30][8]="0.0008993520242460782";
+        results[30][9]="8.775378874836710E-17";
+        results[30][10]="3.202629856156106E-8";
+        results[30][11]="1.063413537138199E-21";
+        results[30][12]="1.427875009316049E-13";
+        results[30][13]="1.337954046340334E-26";
+        results[30][14]="1.075813913638266E-18";
+        results[30][15]="1.155689091332903E-10";
+        results[30][16]="1327656.307919525";
+        results[30][17]="1.367794937807870E-15";
+        results[30][18]="10.41961064339727";
+        results[30][19]="8.816072094770739E-21";
+        results[30][20]="0.0003526078195024119";
+        results[30][21]="1.643760124001572E-25";
+        results[30][22]="2.025731221936322E-9";
+        results[30][23]="1.801574196446855E-30";
+        results[30][24]="1.073005185322375E-14";
+        results[30][25]="1.074149625024506E-14";
+        results[30][26]="28770807997.87632";
+        results[30][27]="1.252220913433587E-19";
+        results[30][28]="443710.4675331262";
+        results[30][29]="2.137561506912014E-24";
+        results[30][30]="1";
+        results[30][31]="2.608116550863527E-29";
+        results[30][32]="0.00002033052498315981";
+        results[30][33]="1.122236432832213E-34";
+        results[30][34]="5.378556230380286E-10";
+        results[30][35]="1.320314709324433E-18";
+        results[30][36]="278214165870389.4";
+        results[30][37]="1.117090347328190E-23";
+        results[30][38]="1361598218.593171";
+        results[30][39]="1.190593007017408E-28";
+        results[30][40]="24686.97501554217";
+        results[30][41]="1.906119100865986E-33";
+        results[30][42]="0.08915387411693861";
+        results[30][43]="3.438573407486192E-38";
+        results[30][44]="0.000002342001368579163";
+        results[30][45]="3.016149049749527E-22";
+        results[30][46]="1.642169406271479E+18";
+        results[30][47]="1.096447662153521E-27";
+        results[30][48]="13598144023296.90";
+        results[30][49]="4.643528035193328E-32";
+        results[30][50]="458277094.7190988";
+        results[30][51]="1.155813678226253E-37";
+        results[30][52]="8211.789053806363";
+        results[30][53]="2.407566077505911E-42";
+        results[30][54]="0.03348860259416035";
+        results[30][55]="1.219359300697839E-26";
+        results[30][56]="1.407562347239223E+22";
+        results[30][57]="1.223031774845527E-31";
+        results[30][58]="1.125046464825440E+17";
+        results[30][59]="2.399775948327737E-36";
+        results[30][60]="5811039752858.027";
+        results[30][61]="1.109342435241184E-41";
+        results[30][62]="41545556.30561193";
+        results[30][63]="9.435368863912798E-47";
+        results[30][64]="434.1061569410814";
+        results[30][65]="1.023705889016741E-30";
+        results[30][66]="9.126448813663803E+25";
+        results[30][67]="3.304535770275098E-35";
+        results[30][68]="1.946995653254801E+21";
+        results[30][69]="1.467718379620295E-40";
+        results[30][70]="1.429540269150730E+16";
+        results[30][71]="8.969654791583536E-46";
+        results[30][72]="348427025278.1341";
+        results[30][73]="1.699652066890138E-50";
+        results[30][74]="973116.1746283781";
+        results[31][0]="3.004399817208225E+27";
+        results[31][1]="6.606317955556214E+21";
+        results[31][2]="1.482244404226248E+17";
+        results[31][3]="1728458645303.865";
+        results[31][4]="12064092.11609646";
+        results[31][5]="3.763921891283291E+22";
+        results[31][6]="2.339105115657083E+31";
+        results[31][7]="3.609577618470172E+17";
+        results[31][8]="3.448281572954666E+25";
+        results[31][9]="3364642148346.955";
+        results[31][10]="1.227947368799811E+21";
+        results[31][11]="40773236.79365905";
+        results[31][12]="5474736199359228";
+        results[31][13]="512.9962638737704";
+        results[31][14]="41248690104.82190";
+        results[31][15]="4.431125177094802E+18";
+        results[31][16]="5.090479209910875E+34";
+        results[31][17]="52443781216564.26";
+        results[31][18]="3.995070941115503E+29";
+        results[31][19]="338024467.9576074";
+        results[31][20]="1.351963428879995E+25";
+        results[31][21]="6302.479555437567";
+        results[31][22]="7.767027210749525E+19";
+        results[31][23]="0.06907567822651053";
+        results[31][24]="411409982796631.8";
+        results[31][25]="411848782090993.5";
+        results[31][26]="1.103125854876022E+39";
+        results[31][27]="4801245991.169322";
+        results[31][28]="1.701267787999033E+34";
+        results[31][29]="81958.05153739330";
+        results[31][30]="3.834184479481592E+28";
+        results[31][31]="1";
+        results[31][32]="7.795098335014412E+23";
+        results[31][33]="0.000004302861513074059";
+        results[31][34]="2.062237682054311E+19";
+        results[31][35]="50623301665.22991";
+        results[31][36]="1.066724436752164E+43";
+        results[31][37]="428313.0471904447";
+        results[31][38]="5.220618757019720E+37";
+        results[31][39]="4.564953228885464";
+        results[31][40]="9.465441644994164E+32";
+        results[31][41]="0.00007308412272583773";
+        results[31][42]="3.418324004248217E+27";
+        results[31][43]="1.318412479054169E-9";
+        results[31][44]="8.979665298330876E+22";
+        results[31][45]="11564471.87435279";
+        results[31][46]="6.296380450205607E+46";
+        results[31][47]="42.03982608792905";
+        results[31][48]="5.213779276388035E+41";
+        results[31][49]="0.001780414312257591";
+        results[31][50]="1.757118923873884E+37";
+        results[31][51]="4.431602866227630E-9";
+        results[31][52]="3.148551413888119E+32";
+        results[31][53]="9.231052487699542E-14";
+        results[31][54]="1.284014803060566E+27";
+        results[31][55]="467.5248505647183";
+        results[31][56]="5.396853705687309E+50";
+        results[31][57]="0.004689329449025547";
+        results[31][58]="4.313635694129337E+45";
+        results[31][59]="9.201183695311428E-8";
+        results[31][60]="2.228059843005880E+41";
+        results[31][61]="4.253423547632060E-13";
+        results[31][62]="1.592933271784059E+36";
+        results[31][63]="3.617694485619832E-18";
+        results[31][64]="1.664443089390894E+31";
+        results[31][65]="0.03925077231221895";
+        results[31][66]="3.499248839413294E+54";
+        results[31][67]="0.000001267019976228053";
+        results[31][68]="7.465140515327681E+49";
+        results[31][69]="5.627503031390007E-12";
+        results[31][70]="5.481121112771666E+44";
+        results[31][71]="3.439131118819729E-17";
+        results[31][72]="1.335933492553362E+40";
+        results[31][73]="6.516779575388975E-22";
+        results[31][74]="3.731106933492626E+34";
+        results[32][0]="3854.216698861785";
+        results[32][1]="0.008474964229612891";
+        results[32][2]="1.901508281900985E-7";
+        results[32][3]="2.217366056230347E-12";
+        results[32][4]="1.547651049109460E-17";
+        results[32][5]="0.04828575252702482";
+        results[32][6]="30007384.32189076";
+        results[32][7]="4.630573551915940E-7";
+        results[32][8]="44.23653717702960";
+        results[32][9]="4.316356258436777E-12";
+        results[32][10]="0.001575281434595963";
+        results[32][11]="5.230625072490977E-17";
+        results[32][12]="7.023306139407549E-9";
+        results[32][13]="6.581010807387358E-22";
+        results[32][14]="5.291618954893612E-14";
+        results[32][15]="0.000005684501960919277";
+        results[32][16]="65303591964.26306";
+        results[32][17]="6.727789562447809E-11";
+        results[32][18]="512510.6534153962";
+        results[32][19]="4.336372081917841E-16";
+        results[32][20]="17.34376361626097";
+        results[32][21]="8.085182873354881E-21";
+        results[32][22]="0.00009963988749008084";
+        results[32][23]="8.861424866987624E-26";
+        results[32][24]="5.277803628834801E-10";
+        results[32][25]="5.283432798288516E-10";
+        results[32][26]="1415153225099094";
+        results[32][27]="6.159314205957922E-15";
+        results[32][28]="21824840622.69226";
+        results[32][29]="1.051404972907783E-19";
+        results[32][30]="49187.12137676328";
+        results[32][31]="1.282857453520695E-24";
+        results[32][32]="1";
+        results[32][33]="5.519957963514394E-30";
+        results[32][34]="0.00002645556981354615";
+        results[32][35]="6.494247986306681E-14";
+        results[32][36]="1.368455394540179E+19";
+        results[32][37]="5.494645850284232E-19";
+        results[32][38]="66973096844326.95";
+        results[32][39]="5.856184274649082E-24";
+        results[32][40]="1214281236.514595";
+        results[32][41]="9.375651157286216E-29";
+        results[32][42]="4385.222427398534";
+        results[32][43]="1.691335275569338E-33";
+        results[32][44]="0.1151963055808490";
+        results[32][45]="1.483556894004392E-17";
+        results[32][46]="8.077358590748254E+22";
+        results[32][47]="5.393110424161355E-23";
+        results[32][48]="6.688535605726128E+17";
+        results[32][49]="2.284017770834574E-27";
+        results[32][50]="22541331082138.75";
+        results[32][51]="5.685114767983791E-33";
+        results[32][52]="403914264.9099497";
+        results[32][53]="1.184212448768611E-37";
+        results[32][54]="1647.207960537155";
+        results[32][55]="5.997677392530980E-22";
+        results[32][56]="6.923394001901749E+26";
+        results[32][57]="6.015741235696518E-27";
+        results[32][58]="5.533779701986738E+21";
+        results[32][59]="1.180380708474336E-31";
+        results[32][60]="2.858283176490243E+17";
+        results[32][61]="5.456536101060227E-37";
+        results[32][62]="2043506320669.287";
+        results[32][63]="4.640986335438119E-42";
+        results[32][64]="21352432.23186122";
+        results[32][65]="5.035314581717381E-26";
+        results[32][66]="4.489037455364987E+30";
+        results[32][67]="1.625406020263772E-30";
+        results[32][68]="9.576711151667440E+25";
+        results[32][69]="7.219284208528977E-36";
+        results[32][70]="7.031497073168779E+20";
+        results[32][71]="4.411914989412857E-41";
+        results[32][72]="1.713812238330015E+16";
+        results[32][73]="8.360099251239178E-46";
+        results[32][74]="47864783395.13761";
+        results[33][0]="6.982329800946383E+32";
+        results[33][1]="1.535331298830604E+27";
+        results[33][2]="3.444787613364996E+22";
+        results[33][3]="4.016998083837972E+17";
+        results[33][4]="2803737019990.124";
+        results[33][5]="8.747485550828852E+27";
+        results[33][6]="5.436161746200319E+36";
+        results[33][7]="8.388784085898711E+22";
+        results[33][8]="8.013926459118452E+30";
+        results[33][9]="7.819545523655909E+17";
+        results[33][10]="2.853792447348690E+26";
+        results[33][11]="9475842220292.549";
+        results[33][12]="1.272347758049958E+21";
+        results[33][13]="119222118.1915926";
+        results[33][14]="9586339225533875";
+        results[33][15]="1.029808922186089E+24";
+        results[33][16]="1.183045095558775E+40";
+        results[33][17]="1.218811738588753E+19";
+        results[33][18]="9.284683992214605E+34";
+        results[33][19]="78558063495777.08";
+        results[33][20]="3.142010089732407E+30";
+        results[33][21]="1464718196.550773";
+        results[33][22]="1.805084171812118E+25";
+        results[33][23]="16053.42817021349";
+        results[33][24]="9.561311270339060E+19";
+        results[33][25]="9.571509118748273E+19";
+        results[33][26]="2.563702902183168E+44";
+        results[33][27]="1115826288292324";
+        results[33][28]="3.953805584562284E+39";
+        results[33][29]="19047336589.46896";
+        results[33][30]="8.910778252638594E+33";
+        results[33][31]="232403.4824178150";
+        results[33][32]="1.811607998846661E+29";
+        results[33][33]="1";
+        results[33][34]="4.792712188826647E+24";
+        results[33][35]="1.176503159848700E+16";
+        results[33][36]="2.479104738813852E+48";
+        results[33][37]="99541443732.04527";
+        results[33][38]="1.213289979507148E+43";
+        results[33][39]="1060911.027467431";
+        results[33][40]="2.199801600919255E+38";
+        results[33][41]="16.98500463093566";
+        results[33][42]="7.944304026196954E+32";
+        results[33][43]="0.0003064036513952934";
+        results[33][44]="2.086905486278503E+28";
+        results[33][45]="2687623535922.464";
+        results[33][46]="1.463300743255233E+52";
+        results[33][47]="9770201.983074019";
+        results[33][48]="1.211700460390415E+47";
+        results[33][49]="413.7744863151833";
+        results[33][50]="4.083605569305342E+42";
+        results[33][51]="0.001029919938804072";
+        results[33][52]="7.317343131591340E+37";
+        results[33][53]="2.145328744523008E-8";
+        results[33][54]="2.984095117073005E+32";
+        results[33][55]="108654403.3881091";
+        results[33][56]="1.254247595301220E+56";
+        results[33][57]="1089.816494157951";
+        results[33][58]="1.002503957197447E+51";
+        results[33][59]="0.02138387133156396";
+        results[33][60]="5.178088665498566E+46";
+        results[33][61]="9.885104446676278E-8";
+        results[33][62]="3.702032396218190E+41";
+        results[33][63]="8.407647967817748E-13";
+        results[33][64]="3.868223702607104E+36";
+        results[33][65]="9122.016172948436";
+        results[33][66]="8.132376161261471E+59";
+        results[33][67]="0.2944598547683367";
+        results[33][68]="1.734924652500475E+55";
+        results[33][69]="0.000001307851301811848";
+        results[33][70]="1.273831634161944E+50";
+        results[33][71]="7.992660485051813E-12";
+        results[33][72]="3.104755959479955E+45";
+        results[33][73]="1.514522267469688E-16";
+        results[33][74]="8.671222446169412E+39";
+        results[34][0]="145686398.9710135";
+        results[34][1]="320.3470682862941";
+        results[34][2]="0.007187553680765358";
+        results[34][3]="8.381471545908569E-8";
+        results[34][4]="5.850000812747606E-13";
+        results[34][5]="1825.163958566520";
+        results[34][6]="1134255830941.353";
+        results[34][7]="0.01750320852868166";
+        results[34][8]="1672106.761971122";
+        results[34][9]="1.631549155379241E-7";
+        results[34][10]="59.54441524783812";
+        results[34][11]="1.977135669106896E-12";
+        results[34][12]="0.0002654755194806417";
+        results[34][13]="2.487570993091087E-17";
+        results[34][14]="2.000190883125157E-9";
+        results[34][15]="0.2148697609230333";
+        results[34][16]="2468425077384854";
+        results[34][17]="0.000002543052222977617";
+        results[34][18]="19372504808.15474";
+        results[34][19]="1.639114981260948E-11";
+        results[34][20]="655580.7997520574";
+        results[34][21]="3.056136356290082E-16";
+        results[34][22]="3.766310391056549";
+        results[34][23]="3.349549803478537E-21";
+        results[34][24]="0.00001994968797131100";
+        results[34][25]="0.00001997096579482185";
+        results[34][26]="5.349169324542341E+19";
+        results[34][27]="2.328172951619490E-10";
+        results[34][28]="824962031682160.1";
+        results[34][29]="3.974229171089060E-15";
+        results[34][30]="1859235001.303121";
+        results[34][31]="4.849101578843441E-20";
+        results[34][32]="37799.22364355827";
+        results[34][33]="2.086501255659210E-25";
+        results[34][34]="1";
+        results[34][35]="2.454775320311342E-9";
+        results[34][36]="5.172655150445800E+23";
+        results[34][37]="2.076933473370431E-14";
+        results[34][38]="2.531531065720401E+18";
+        results[34][39]="2.213592190953497E-19";
+        results[34][40]="45898888025191.66";
+        results[34][41]="3.543923348982476E-24";
+        results[34][42]="165758003.2599846";
+        results[34][43]="6.393116033748466E-29";
+        results[34][44]="4354.330917562191";
+        results[34][45]="5.607729882441468E-13";
+        results[34][46]="3.053178838209099E+27";
+        results[34][47]="2.038553870572805E-18";
+        results[34][48]="2.528214532087444E+22";
+        results[34][49]="8.633409852563746E-23";
+        results[34][50]="8.520448147972540E+17";
+        results[34][51]="2.148929245543152E-28";
+        results[34][52]="15267645632154.63";
+        results[34][53]="4.476231119249052E-33";
+        results[34][54]="62263182.08779341";
+        results[34][55]="2.267075491021919E-17";
+        results[34][56]="2.616989182503541E+31";
+        results[34][57]="2.273903483498682E-22";
+        results[34][58]="2.091725765495799E+26";
+        results[34][59]="4.461747438416318E-27";
+        results[34][60]="1.080408850247748E+22";
+        results[34][61]="2.062528284031250E-32";
+        results[34][62]="7.724295243200328E+16";
+        results[34][63]="1.754256804199234E-37";
+        results[34][64]="807105361266.0442";
+        results[34][65]="1.903309819900053E-21";
+        results[34][66]="1.696821307196509E+35";
+        results[34][67]="6.143908567153631E-26";
+        results[34][68]="3.619922465916360E+30";
+        results[34][69]="2.728833383445953E-31";
+        results[34][70]="2.657851304177320E+25";
+        results[34][71]="1.667669613811836E-36";
+        results[34][72]="6.478077207970342E+20";
+        results[34][73]="3.160052612799337E-41";
+        results[34][74]="1809251652203281";
+        results[35][0]="5.934816020251334E+16";
+        results[35][1]="130499547406.9147";
+        results[35][2]="2927988.407449751";
+        results[35][3]="34.14353841900911";
+        results[35][4]="0.0002383110488501100";
+        results[35][5]="743515686940.7634";
+        results[35][6]="4.620609558668262E+20";
+        results[35][7]="7130269.065301548";
+        results[35][8]="681164890381514.3";
+        results[35][9]="66.46429682910084";
+        results[35][10]="24256564238.34587";
+        results[35][11]="0.0008054242898515592";
+        results[35][12]="108146.5653023476";
+        results[35][13]="1.013359948875315E-8";
+        results[35][14]="0.8148162752717714";
+        results[35][15]="87531335.00453358";
+        results[35][16]="1.005560491406513E+24";
+        results[35][17]="1035.961296309220";
+        results[35][18]="7.891762903049598E+18";
+        results[35][19]="0.006677250531641558";
+        results[35][20]="267063463742543.0";
+        results[35][21]="1.244975998822763E-7";
+        results[35][22]="1534279068.187334";
+        results[35][23]="1.364503616996488E-12";
+        results[35][24]="8126.889579768451";
+        results[35][25]="8135.557510937055";
+        results[35][26]="2.179087136929461E+28";
+        results[35][27]="0.09484260870458016";
+        results[35][28]="3.360641704583902E+23";
+        results[35][29]="0.000001618978787266365";
+        results[35][30]="7.573951823286671E+17";
+        results[35][31]="1.975374910575696E-11";
+        results[35][32]="15398241676457.85";
+        results[35][33]="8.499764676608273E-17";
+        results[35][34]="407369257.6773865";
+        results[35][35]="1";
+        results[35][36]="2.107180688858216E+32";
+        results[35][37]="0.000008460788472922284";
+        results[35][38]="1.031267931029763E+27";
+        results[35][39]="9.017494076291857E-11";
+        results[35][40]="1.869779594303981E+22";
+        results[35][41]="1.443685423940549E-15";
+        results[35][42]="6.752471474210576E+16";
+        results[35][43]="2.604358932913510E-20";
+        results[35][44]="1773820553569.003";
+        results[35][45]="0.0002284416759465479";
+        results[35][46]="1.243771196877546E+36";
+        results[35][47]="8.304441769906065E-10";
+        results[35][48]="1.029916877185643E+31";
+        results[35][49]="3.516985762863528E-14";
+        results[35][50]="3.470968637118237E+26";
+        results[35][51]="8.754077115581401E-20";
+        results[35][52]="6.219569467652223E+21";
+        results[35][53]="1.823478948240904E-24";
+        results[35][54]="2.536410626773635E+16";
+        results[35][55]="9.235368598761958E-9";
+        results[35][56]="1.066080940626218E+40";
+        results[35][57]="9.263183741028816E-14";
+        results[35][58]="8.521047723546869E+34";
+        results[35][59]="1.817578741931636E-18";
+        results[35][60]="4.401253513135038E+30";
+        results[35][61]="8.402106160044240E-24";
+        results[35][62]="3.146640419303486E+25";
+        results[35][63]="7.146302921021462E-29";
+        results[35][64]="3.287899118863873E+20";
+        results[35][65]="7.753499084627650E-13";
+        results[35][66]="6.912328363238143E+43";
+        results[35][67]="2.502839472239110E-17";
+        results[35][68]="1.474645127790042E+39";
+        results[35][69]="1.111642829739649E-22";
+        results[35][70]="1.082726912799589E+34";
+        results[35][71]="6.793573326296614E-28";
+        results[35][72]="2.638969503387675E+29";
+        results[35][73]="1.287308287097552E-32";
+        results[35][74]="7.370335025096355E+23";
+        results[36][0]="2.816472290028026E-16";
+        results[36][1]="6.193087669080073E-22";
+        results[36][2]="1.389528872835434E-26";
+        results[36][3]="1.620342223120407E-31";
+        results[36][4]="1.130947384389897E-36";
+        results[36][5]="3.528485672216559E-21";
+        results[36][6]="2.192792285493067E-12";
+        results[36][7]="3.383795752781463E-26";
+        results[36][8]="3.232588899391471E-18";
+        results[36][9]="3.154181185340816E-31";
+        results[36][10]="1.151138313225971E-22";
+        results[36][11]="3.822283936590086E-36";
+        results[36][12]="5.132287225019476E-28";
+        results[36][13]="4.809079516690182E-41";
+        results[36][14]="3.866855270552440E-33";
+        results[36][15]="4.153954877593472E-25";
+        results[36][16]="4.772065806807389E-9";
+        results[36][17]="4.916338222853396E-30";
+        results[36][18]="3.745176170594929E-14";
+        results[36][19]="3.168807766200464E-35";
+        results[36][20]="1.267397073040055E-18";
+        results[36][21]="5.908254595372923E-40";
+        results[36][22]="7.281193664595935E-24";
+        results[36][23]="6.475494124501726E-45";
+        results[36][24]="3.856759708713939E-29";
+        results[36][25]="3.860873229312546E-29";
+        results[36][26]="0.0001034124481327801";
+        results[36][27]="4.500924349110802E-34";
+        results[36][28]="1.594852174924249E-9";
+        results[36][29]="7.683151216346878E-39";
+        results[36][30]="3.594353281298647E-15";
+        results[36][31]="9.374492282605629E-44";
+        results[36][32]="7.307508918374459E-20";
+        results[36][33]="4.033714204743355E-49";
+        results[36][34]="1.933243123531666E-24";
+        results[36][35]="4.745677507807144E-33";
+        results[36][36]="1";
+        results[36][37]="4.015217355426124E-38";
+        results[36][38]="0.000004894065024810755";
+        results[36][39]="4.279411881464243E-43";
+        results[36][40]="8.873370965245172E-11";
+        results[36][41]="6.851265444743684E-48";
+        results[36][42]="3.204505199727048E-16";
+        results[36][43]="1.235944761018426E-52";
+        results[36][44]="8.417980303958437E-21";
+        results[36][45]="1.084110523385301E-36";
+        results[36][46]="5902.536993880142";
+        results[36][47]="3.941020252233737E-42";
+        results[36][48]="0.04887653358970880";
+        results[36][49]="1.669048023009940E-46";
+        results[36][50]="0.000001647209779147603";
+        results[36][51]="4.154402686902390E-52";
+        results[36][52]="2.951607093088121E-11";
+        results[36][53]="8.653643030626684E-57";
+        results[36][54]="1.203698686204266E-16";
+        results[36][55]="4.382808103545301E-41";
+        results[36][56]="50592763.41431727";
+        results[36][57]="4.396008273048529E-46";
+        results[36][58]="404.3814452458765";
+        results[36][59]="8.625642554253372E-51";
+        results[36][60]="0.02088692980344213";
+        results[36][61]="3.987368622192980E-56";
+        results[36][62]="1.493294066304539E-7";
+        results[36][63]="3.391404903626805E-61";
+        results[36][64]="1.560330889633121E-12";
+        results[36][65]="3.679560621272072E-45";
+        results[36][66]="328036812399.9663";
+        results[36][67]="1.187766898905705E-49";
+        results[36][68]="6998190.214950595";
+        results[36][69]="5.275498373810540E-55";
+        results[36][70]="51.38272757170476";
+        results[36][71]="3.224010813224441E-60";
+        results[36][72]="0.001252369821601588";
+        results[36][73]="6.109149983692593E-65";
+        results[36][74]="3.497723315360298E-9";
+        results[37][0]="7.014495208389838E+21";
+        results[37][1]="1.542404089460013E+16";
+        results[37][2]="346065667144.4297";
+        results[37][3]="4035503.136413506";
+        results[37][4]="28.16652958678678";
+        results[37][5]="8.787782478196851E+16";
+        results[37][6]="5.461204441472514E+25";
+        results[37][7]="842742858791.6008";
+        results[37][8]="8.050844109405394E+19";
+        results[37][9]="7855567.721827779";
+        results[37][10]="2866938975720293";
+        results[37][11]="95.19494458811030";
+        results[37][12]="12782090658.38928";
+        results[37][13]="0.001197713371653776";
+        results[37][14]="96305.00489162340";
+        results[37][15]="10345529294895.73";
+        results[37][16]="1.188495013939524E+29";
+        results[37][17]="122442642.2696522";
+        results[37][18]="9.327455624622005E+23";
+        results[37][19]="789.1995590022467";
+        results[37][20]="3.156484346550524E+19";
+        results[37][21]="0.01471465694724737";
+        results[37][22]="181339962947614.9";
+        results[37][23]="1.612738128796641E-7";
+        results[37][24]="960535723.8013413";
+        results[37][25]="961560206.4717620";
+        results[37][26]="2.575513078838174E+33";
+        results[37][27]="11209.66550672107";
+        results[37][28]="3.972019529077253E+28";
+        results[37][29]="0.1913508170601013";
+        results[37][30]="8.951827418361983E+22";
+        results[37][31]="0.000002334740925030381";
+        results[37][32]="1.819953509739433E+18";
+        results[37][33]="1.004606686931215E-11";
+        results[37][34]="48147907134319.92";
+        results[37][35]="118192.2941579709";
+        results[37][36]="2.490525198215260E+37";
+        results[37][37]="1";
+        results[37][38]="1.218879226599518E+32";
+        results[37][39]="0.00001065798312432847";
+        results[37][40]="2.209935398205477E+27";
+        results[37][41]="1.706324922979563E-10";
+        results[37][42]="7.980900947732038E+21";
+        results[37][43]="3.078151570918528E-15";
+        results[37][44]="2.096519206508824E+17";
+        results[37][45]="27.00004576141425";
+        results[37][46]="1.470041711665625E+41";
+        results[37][47]="0.00009815210244864781";
+        results[37][48]="1.217282385065843E+36";
+        results[37][49]="4.156806158337618E-9";
+        results[37][50]="4.102417461713700E+31";
+        results[37][51]="1.034664457526358E-14";
+        results[37][52]="7.351051840566861E+26";
+        results[37][53]="2.155211602413563E-19";
+        results[37][54]="2.997841909050329E+21";
+        results[37][55]="0.001091549402082161";
+        results[37][56]="1.260025521307003E+45";
+        results[37][57]="1.094836937559011E-8";
+        results[37][58]="1.007122179075560E+40";
+        results[37][59]="2.148238013216586E-13";
+        results[37][60]="5.201942498882593E+35";
+        results[37][61]="9.930642028144481E-19";
+        results[37][62]="3.719086500476785E+30";
+        results[37][63]="8.446379369833354E-24";
+        results[37][64]="3.886043398184922E+25";
+        results[37][65]="9.164038445638694E-8";
+        results[37][66]="8.169839472243282E+48";
+        results[37][67]="2.958163391330656E-12";
+        results[37][68]="1.742916907223793E+44";
+        results[37][69]="1.313876163311878E-17";
+        results[37][70]="1.279699777703607E+39";
+        results[37][71]="8.029480169653943E-23";
+        results[37][72]="3.119058598183105E+34";
+        results[37][73]="1.521499197406275E-27";
+        results[37][74]="8.711168053289843E+28";
+    }
+
+    private static void initResults2() {
+        results[38][0]="5.754873046740801E-11";
+        results[38][1]="1.265428153832008E-16";
+        results[38][2]="2.839212118742058E-21";
+        results[38][3]="3.310831006343367E-26";
+        results[38][4]="2.310854838782263E-31";
+        results[38][5]="7.209723725223695E-16";
+        results[38][6]="4.480513181530232E-7";
+        results[38][7]="6.914080086037084E-21";
+        results[38][8]="6.605120453046024E-13";
+        results[38][9]="6.444910660872926E-26";
+        results[38][10]="2.352110786003469E-17";
+        results[38][11]="7.810039133548062E-31";
+        results[38][12]="1.048675732545652E-22";
+        results[38][13]="9.826349859084964E-36";
+        results[38][14]="7.901111348029064E-28";
+        results[38][15]="8.487739448770601E-20";
+        results[38][16]="0.0009750720071382617";
+        results[38][17]="1.004551062956811E-24";
+        results[38][18]="7.652485513797906E-9";
+        results[38][19]="6.474797024837234E-30";
+        results[38][20]="2.589661286915703E-13";
+        results[38][21]="1.207228462519536E-34";
+        results[38][22]="1.487759894419769E-18";
+        results[38][23]="1.323132016365500E-39";
+        results[38][24]="7.880483175360085E-24";
+        results[38][25]="7.888888295802402E-24";
+        results[38][26]="21.13017452946058";
+        results[38][27]="9.196699116773269E-29";
+        results[38][28]="0.0003258747415163162";
+        results[38][29]="1.569891527267555E-33";
+        results[38][30]="7.344310431260839E-10";
+        results[38][31]="1.915481759045105E-38";
+        results[38][32]="1.493136867068297E-14";
+        results[38][33]="8.242052739990580E-44";
+        results[38][34]="3.950178662790491E-19";
+        results[38][35]="9.696801092238556E-28";
+        results[38][36]="204329.1200526434";
+        results[38][37]="8.204258290543218E-33";
+        results[38][38]="1";
+        results[38][39]="8.744084640824158E-38";
+        results[38][40]="0.00001813088081229221";
+        results[38][41]="1.399913039571560E-42";
+        results[38][42]="6.547737276643480E-11";
+        results[38][43]="2.525395054525697E-47";
+        results[38][44]="1.720038508128311E-15";
+        results[38][45]="2.215153492831292E-31";
+        results[38][46]="1206060190.037704";
+        results[38][47]="8.052652002485662E-37";
+        results[38][48]="9986.899099608667";
+        results[38][49]="3.410351138672251E-41";
+        results[38][50]="0.3365729247153389";
+        results[38][51]="8.488654453591028E-47";
+        results[38][52]="0.000006030992800718365";
+        results[38][53]="1.768191265697641E-51";
+        results[38][54]="2.459506933606407E-11";
+        results[38][55]="8.955353231570062E-36";
+        results[38][56]="10337574829479.02";
+        results[38][57]="8.982325021761465E-41";
+        results[38][58]="82626904.87270614";
+        results[38][59]="1.762469952999227E-45";
+        results[38][60]="4267.807987338662";
+        results[38][61]="8.147355218982128E-51";
+        results[38][62]="0.03051234625478403";
+        results[38][63]="6.929627797002850E-56";
+        results[38][64]="3.188210376696939E-7";
+        results[38][65]="7.518413839248804E-40";
+        results[38][66]="6.702747322255918E+16";
+        results[38][67]="2.426953652810597E-44";
+        results[38][68]="1429934048581.875";
+        results[38][69]="1.077937940559859E-49";
+        results[38][70]="10498987.51063113";
+        results[38][71]="6.587592925063573E-55";
+        results[38][72]="255.8956236283385";
+        results[38][73]="1.248277240437528E-59";
+        results[38][74]="0.0007146867272151842";
+        results[39][0]="6.581447096100371E+26";
+        results[39][1]="1.447181958788470E+21";
+        results[39][2]="3.247008961334176E+16";
+        results[39][3]="378636660364.1785";
+        results[39][4]="2642763.575267104";
+        results[39][5]="8.245258390527376E+21";
+        results[39][6]="5.124050561692560E+30";
+        results[39][7]="7.907151371518986E+16";
+        results[39][8]="7.553815778735954E+24";
+        results[39][9]="737059500863.3713";
+        results[39][10]="2.689945125899165E+20";
+        results[39][11]="8931797.271363033";
+        results[39][12]="1199297325702478";
+        results[39][13]="112.3771127878607";
+        results[39][14]="9035950213.862933";
+        results[39][15]="9.706835875242173E+17";
+        results[39][16]="1.115121876320673E+34";
+        results[39][17]="11488350172947.65";
+        results[39][18]="8.751614180482857E+28";
+        results[39][19]="74047739.59538163";
+        results[39][20]="2.961615072691725E+24";
+        results[39][21]="1380.623029291435";
+        results[39][22]="1.701447270390950E+19";
+        results[39][23]="0.01513173843478247";
+        results[39][24]="90123592108977.16";
+        results[39][25]="90219715611751.54";
+        results[39][26]="2.416510749542446E+38";
+        results[39][27]="1051762362.161496";
+        results[39][28]="3.726802231475215E+33";
+        results[39][29]="17953.75492979660";
+        results[39][30]="8.399175823358240E+27";
+        results[39][31]="0.2190602947851342";
+        results[39][32]="1.707596539147366E+23";
+        results[39][33]="9.425861114736121E-7";
+        results[39][34]="4.517543945478293E+18";
+        results[39][35]="11089555385.78204";
+        results[39][36]="2.336769695694354E+42";
+        results[39][37]="93826.38237785791";
+        results[39][38]="1.143630283873541E+37";
+        results[39][39]="1";
+        results[39][40]="2.073502437023907E+32";
+        results[39][41]="0.00001600982946843494";
+        results[39][42]="7.488190640417148E+26";
+        results[39][43]="2.888118263100058E-10";
+        results[39][44]="1.967088127324202E+22";
+        results[39][45]="2533316.617830116";
+        results[39][46]="1.379286957501396E+46";
+        results[39][47]="9.209256695537514";
+        results[39][48]="1.142132025230187E+41";
+        results[39][49]="0.0003900180840828200";
+        results[39][50]="3.849149894363509E+36";
+        results[39][51]="9.707882302464703E-10";
+        results[39][52]="6.897226008724825E+31";
+        results[39][53]="2.022157079132508E-14";
+        results[39][54]="2.812766612669237E+26";
+        results[39][55]="102.4161315840830";
+        results[39][56]="1.182236363680106E+50";
+        results[39][57]="0.001027245891448147";
+        results[39][58]="9.449463067516497E+44";
+        results[39][59]="2.015614012667092E-8";
+        results[39][60]="4.880794460077878E+40";
+        results[39][61]="9.317562161903105E-14";
+        results[39][62]="3.489484320900643E+35";
+        results[39][63]="7.924932204624348E-19";
+        results[39][64]="3.646133938150488E+30";
+        results[39][65]="0.008598285753258867";
+        results[39][66]="7.665464822884150E+53";
+        results[39][67]="2.775537694911710E-7";
+        results[39][68]="1.635315881900131E+49";
+        results[39][69]="1.232762472960531E-12";
+        results[39][70]="1.200696006716784E+44";
+        results[39][71]="7.533770766933783E-18";
+        results[39][72]="2.926499846920735E+39";
+        results[39][73]="1.427567654834451E-22";
+        results[39][74]="8.173373847257529E+33";
+        results[40][0]="0.000003174072515461667";
+        results[40][1]="6.979408043839129E-12";
+        results[40][2]="1.565953771433517E-16";
+        results[40][3]="1.826072897737389E-21";
+        results[40][4]="1.274540858056698E-26";
+        results[40][5]="3.976488401123740E-11";
+        results[40][6]="0.02471205468678926";
+        results[40][7]="3.813427575647367E-16";
+        results[40][8]="3.643022377913347E-8";
+        results[40][9]="3.554659438554945E-21";
+        results[40][10]="1.297295377072253E-12";
+        results[40][11]="4.307589473674706E-26";
+        results[40][12]="5.783920502277423E-18";
+        results[40][13]="5.419675944492992E-31";
+        results[40][14]="4.357819914999574E-23";
+        results[40][15]="4.681371818966545E-15";
+        results[40][16]="53.77962699292531";
+        results[40][17]="5.540553012050880E-20";
+        results[40][18]="0.0004220691533424975";
+        results[40][19]="3.571143118677119E-25";
+        results[40][20]="1.428315211889754E-8";
+        results[40][21]="6.658410449100025E-30";
+        results[40][22]="8.205668052327118E-14";
+        results[40][23]="7.297670918825164E-35";
+        results[40][24]="4.346442545702108E-19";
+        results[40][25]="4.351078349405929E-19";
+        results[40][26]="1165424.600614822";
+        results[40][27]="5.072395109750087E-24";
+        results[40][28]="17.97346443838419";
+        results[40][29]="8.658661118125126E-29";
+        results[40][30]="0.00004050719050715733";
+        results[40][31]="1.056474739906990E-33";
+        results[40][32]="8.235324486033761E-10";
+        results[40][33]="4.545864497880714E-39";
+        results[40][34]="2.178702018774722E-14";
+        results[40][35]="5.348223946000686E-23";
+        results[40][36]="11269674218.70173";
+        results[40][37]="4.525019151292953E-28";
+        results[40][38]="55154.51843475961";
+        results[40][39]="4.822757775174344E-33";
+        results[40][40]="1";
+        results[40][41]="7.721152954810994E-38";
+        results[40][42]="0.000003611372963305955";
+        results[40][43]="1.392869480898883E-42";
+        results[40][44]="9.486789560505935E-11";
+        results[40][45]="1.221757241561856E-26";
+        results[40][46]="66519668984864.25";
+        results[40][47]="4.441401433197993E-32";
+        results[40][48]="550822610.4954504";
+        results[40][49]="1.880962747469021E-36";
+        results[40][50]="18563.51758085312";
+        results[40][51]="4.681876485468906E-42";
+        results[40][52]="0.3326365036071236";
+        results[40][53]="9.752373776010145E-47";
+        results[40][54]="0.000001356529205100136";
+        results[40][55]="4.939281949004150E-31";
+        results[40][56]="5.701639615032074E+17";
+        results[40][57]="4.954158109997452E-36";
+        results[40][58]="4557247148008.799";
+        results[40][59]="9.720818151340577E-41";
+        results[40][60]="235388894.3136845";
+        results[40][61]="4.493634536198847E-46";
+        results[40][62]="1682.893763997254";
+        results[40][63]="3.822002840758163E-51";
+        results[40][64]="0.01758442079954232";
+        results[40][65]="4.146744946969999E-35";
+        results[40][66]="3.696868007488996E+21";
+        results[40][67]="1.338574599842493E-39";
+        results[40][68]="7.886732384299944E+16";
+        results[40][69]="5.945314801413554E-45";
+        results[40][70]="579066600201.4157";
+        results[40][71]="3.633355154261108E-50";
+        results[40][72]="14113799.89078350";
+        results[40][73]="6.884813006940251E-55";
+        results[40][74]="39.41820227126789";
+        results[41][0]="4.110878950382567E+31";
+        results[41][1]="9.039334001912643E+25";
+        results[41][2]="2.028134632999056E+21";
+        results[41][3]="2.365026192881695E+16";
+        results[41][4]="165071313250.2498";
+        results[41][5]="5.150122558634225E+26";
+        results[41][6]="3.200565360046566E+35";
+        results[41][7]="4.938935412840446E+21";
+        results[41][8]="4.718236252065705E+29";
+        results[41][9]="4.603793577667779E+16";
+        results[41][10]="1.680183496771577E+25";
+        results[41][11]="557894591505.3629";
+        results[41][12]="7.491006247549473E+19";
+        results[41][13]="7019257.326220990";
+        results[41][14]="564400153772921.7";
+        results[41][15]="6.063047638564933E+22";
+        results[41][16]="6.965232693572741E+38";
+        results[41][17]="7.175810457942816E+17";
+        results[41][18]="5.466400624527316E+33";
+        results[41][19]="4625142306567.008";
+        results[41][20]="1.849872966186717E+29";
+        results[41][21]="86235960.97719082";
+        results[41][22]="1.062751651256206E+24";
+        results[41][23]="945.1530051969814";
+        results[41][24]="5.629266213401292E+18";
+        results[41][25]="5.635270243797986E+18";
+        results[41][26]="1.509391935939637E+43";
+        results[41][27]="65694788581924.34";
+        results[41][28]="2.327821316787288E+38";
+        results[41][29]="1121420747.497299";
+        results[41][30]="5.246261891744755E+32";
+        results[41][31]="13682.86247002409";
+        results[41][32]="1.066592584583160E+28";
+        results[41][33]="0.05887546231095213";
+        results[41][34]="2.821731458405042E+23";
+        results[41][35]="692671674463882.5";
+        results[41][36]="1.459584376149378E+47";
+        results[41][37]="5860548518.823794";
+        results[41][38]="7.143300846072895E+41";
+        results[41][39]="62461.62721293222";
+        results[41][40]="1.295143362464938E+37";
+        results[41][41]="1";
+        results[41][42]="4.677245722811041E+31";
+        results[41][43]="0.00001803965662966171";
+        results[41][44]="1.228675253039092E+27";
+        results[41][45]="158235078195.2310";
+        results[41][46]="8.615250775911171E+50";
+        results[41][47]="575225.1586248642";
+        results[41][48]="7.133942478787923E+45";
+        results[41][49]="24.36116417428315";
+        results[41][50]="2.404241657884309E+41";
+        results[41][51]="0.00006063701254035724";
+        results[41][52]="4.308119597603104E+36";
+        results[41][53]="1.263072216427666E-9";
+        results[41][54]="1.756899795975280E+31";
+        results[41][55]="6397078.231595606";
+        results[41][56]="7.384440702575934E+54";
+        results[41][57]="64.16344992765041";
+        results[41][58]="5.902288394855864E+49";
+        results[41][59]="0.001258985310643743";
+        results[41][60]="3.048623640683292E+45";
+        results[41][61]="5.819900942901146E-9";
+        results[41][62]="2.179588688174679E+40";
+        results[41][63]="4.950041610530071E-14";
+        results[41][64]="2.277434588131763E+35";
+        results[41][65]="537.0629193903215";
+        results[41][66]="4.787974061808353E+58";
+        results[41][67]="0.01733646008150164";
+        results[41][68]="1.021444909906334E+54";
+        results[41][69]="7.700035002815314E-8";
+        results[41][70]="7.499742636760013E+48";
+        results[41][71]="4.705715811519044E-13";
+        results[41][72]="1.827939424770661E+44";
+        results[41][73]="8.916819867750936E-18";
+        results[41][74]="5.105222303193294E+38";
+        results[42][0]="0.8789101950179163";
+        results[42][1]="0.000001932619010762593";
+        results[42][2]="4.336172938504800E-11";
+        results[42][3]="5.056450597297903E-16";
+        results[42][4]="3.529241845156713E-21";
+        results[42][5]="0.00001101101559303791";
+        results[42][6]="6842.842026531408";
+        results[42][7]="1.055949527892695E-10";
+        results[42][8]="0.01008763817785915";
+        results[42][9]="9.842958549761383E-16";
+        results[42][10]="3.592249790463821E-7";
+        results[42][11]="1.192784438894235E-20";
+        results[42][12]="1.601584926576693E-12";
+        results[42][13]="1.500724516564931E-25";
+        results[42][14]="1.206693398681896E-17";
+        results[42][15]="1.296285890859935E-9";
+        results[42][16]="14891739.93917645";
+        results[42][17]="1.534195738946580E-14";
+        results[42][18]="116.8722138729541";
+        results[42][19]="9.888602354180532E-20";
+        results[42][20]="0.003955047640890110";
+        results[42][21]="1.843733814467261E-24";
+        results[42][22]="2.272174083292525E-8";
+        results[42][23]="2.020746954959940E-29";
+        results[42][24]="1.203542971015447E-13";
+        results[42][25]="1.204826638958615E-13";
+        results[42][26]="322709565712.6364";
+        results[42][27]="1.404561412318563E-18";
+        results[42][28]="4976906.185267212";
+        results[42][29]="2.397609221230570E-23";
+        results[42][30]="11.21656248710349";
+        results[42][31]="2.925410226640957E-28";
+        results[42][32]="0.0002280386038692306";
+        results[42][33]="1.258763507416664E-33";
+        results[42][34]="6.032891204846025E-9";
+        results[42][35]="1.480939243977938E-17";
+        results[42][36]="3120606576282596";
+        results[42][37]="1.252991368454678E-22";
+        results[42][38]="15272451501.17909";
+        results[42][39]="1.335436085991919E-27";
+        results[42][40]="276902.9978793913";
+        results[42][41]="2.138010400272485E-32";
+        results[42][42]="1";
+        results[42][43]="3.856897349156122E-37";
+        results[42][44]="0.00002626920469555007";
+        results[42][45]="3.383082428693337E-21";
+        results[42][46]="1.841949575985368E+19";
+        results[42][47]="1.229837371638349E-26";
+        results[42][48]="152524432145942.5";
+        results[42][49]="5.208442236736284E-31";
+        results[42][50]="5140293669.325014";
+        results[42][51]="1.296425634527369E-36";
+        results[42][52]="92108.04505293148";
+        results[42][53]="2.700461535017569E-41";
+        results[42][54]="0.3756270036031754";
+        results[42][55]="1.367701979050812E-25";
+        results[42][56]="1.578801102230280E+23";
+        results[42][57]="1.371821232626794E-30";
+        results[42][58]="1.261915397360943E+18";
+        results[42][59]="2.691723687946608E-35";
+        results[42][60]="65179890502974.45";
+        results[42][61]="1.244300874447829E-40";
+        results[42][62]="465998328.3633725";
+        results[42][63]="1.058324044509485E-45";
+        results[42][64]="4869.178835365991";
+        results[42][65]="1.148246107257210E-29";
+        results[42][66]="1.023673834038115E+27";
+        results[42][67]="3.706553195815928E-34";
+        results[42][68]="2.183859840685134E+22";
+        results[42][69]="1.646275491848131E-39";
+        results[42][70]="1.603452775675989E+17";
+        results[42][71]="1.006086934575439E-44";
+        results[42][72]="3908153501227.777";
+        results[42][73]="1.906425361460782E-49";
+        results[42][74]="10915018.37993031";
+        results[43][0]="2.278801107346606E+36";
+        results[43][1]="5.010812670929508E+30";
+        results[43][2]="1.124264543740979E+26";
+        results[43][3]="1.311015082733337E+21";
+        results[43][4]="9150468694555485";
+        results[43][5]="2.854889460681936E+31";
+        results[43][6]="1.774183082168003E+40";
+        results[43][7]="2.737821187083793E+26";
+        results[43][8]="2.615480077546344E+34";
+        results[43][9]="2.552040580472019E+21";
+        results[43][10]="9.313833025008547E+29";
+        results[43][11]="3.092600945563700E+16";
+        results[43][12]="4.152521525954315E+24";
+        results[43][13]="389101492911.9866";
+        results[43][14]="3.128663507069788E+19";
+        results[43][15]="3.360955124054725E+27";
+        results[43][16]="3.861067223485925E+43";
+        results[43][17]="3.977797696073652E+22";
+        results[43][18]="3.030213233404445E+38";
+        results[43][19]="2.563874912653335E+17";
+        results[43][20]="1.025447991701273E+34";
+        results[43][21]="4780354900735.599";
+        results[43][22]="5.891196673382220E+28";
+        results[43][23]="52393070.69974453";
+        results[43][24]="3.120495211724467E+23";
+        results[43][25]="3.123823451568468E+23";
+        results[43][26]="8.367076862526411E+47";
+        results[43][27]="3.641687307612366E+18";
+        results[43][28]="1.290391144673877E+43";
+        results[43][29]="62164195833605.98";
+        results[43][30]="2.908182788312382E+37";
+        results[43][31]="758487966.3133965";
+        results[43][32]="5.912488283338024E+32";
+        results[43][33]="3263.668678379727";
+        results[43][34]="1.564182465516227E+28";
+        results[43][35]="3.839716512812981E+19";
+        results[43][36]="8.090976486489524E+51";
+        results[43][37]="324870292108974.2";
+        results[43][38]="3.959776503909459E+46";
+        results[43][39]="3462462090.893108";
+        results[43][40]="7.179423583569754E+41";
+        results[43][41]="55433.42761611934";
+        results[43][42]="2.592757622182496E+36";
+        results[43][43]="1";
+        results[43][44]="6.810968070305965E+31";
+        results[43][45]="8771512753466319";
+        results[43][46]="4.775728802811879E+55";
+        results[43][47]="31886702193.60218";
+        results[43][48]="3.954588840154493E+50";
+        results[43][49]="1350422.830899525";
+        results[43][50]="1.332753559139886E+46";
+        results[43][51]="3.361317445513614";
+        results[43][52]="2.388138358753168E+41";
+        results[43][53]="0.00007001642228327445";
+        results[43][54]="9.739097766897050E+35";
+        results[43][55]="354611973105.8077";
+        results[43][56]="4.093448591717685E+59";
+        results[43][57]="3556799.957164907";
+        results[43][58]="3.271840765057037E+54";
+        results[43][59]="69.78987108732747";
+        results[43][60]="1.689956579146075E+50";
+        results[43][61]="0.0003226170576512954";
+        results[43][62]="1.208220717788436E+45";
+        results[43][63]="2.743977733140975E-9";
+        results[43][64]="1.262460053916486E+40";
+        results[43][65]="29771238.46732512";
+        results[43][66]="2.654138135831102E+63";
+        results[43][67]="961.0194050476638";
+        results[43][68]="5.662219247714633E+58";
+        results[43][69]="0.004268393329701480";
+        results[43][70]="4.157364405943601E+53";
+        results[43][71]="2.608539568198692E-8";
+        results[43][72]="1.013289477896753E+49";
+        results[43][73]="4.942898887049463E-13";
+        results[43][74]="2.829999710082635E+43";
+        results[44][0]="33457.81515672613";
+        results[44][1]="0.07356975717997179";
+        results[44][2]="0.000001650667764311622";
+        results[44][3]="1.924858653278701E-11";
+        results[44][4]="1.343490176447769E-16";
+        results[44][5]="0.4191605996698921";
+        results[44][6]="260489120.4677608";
+        results[44][7]="0.000004019724008133258";
+        results[44][8]="384.0100336028812";
+        results[44][9]="3.746957193351482E-11";
+        results[44][10]="0.01367475655276438";
+        results[44][11]="4.540618769080169E-16";
+        results[44][12]="6.096815435177592E-8";
+        results[44][13]="5.712866201918743E-21";
+        results[44][14]="4.593566545569257E-13";
+        results[44][15]="0.00004934621759141124";
+        results[44][16]="566889637953.1077";
+        results[44][17]="5.840282401874423E-10";
+        results[44][18]="4449019.878121849";
+        results[44][19]="3.764332597345680E-15";
+        results[44][20]="150.5583319604680";
+        results[44][21]="7.018612995084639E-20";
+        results[44][22]="0.0008649573177513917";
+        results[44][23]="7.692455779988837E-25";
+        results[44][24]="4.581573690425900E-9";
+        results[44][25]="4.586460278954353E-9";
+        results[44][26]="1.228471015596839E+16";
+        results[44][27]="5.346798384636640E-14";
+        results[44][28]="189457817354.8698";
+        results[44][29]="9.127071980358501E-19";
+        results[44][30]="426985.2329790381";
+        results[44][31]="1.113627253106948E-23";
+        results[44][32]="8.680833946520647";
+        results[44][33]="4.791783847304273E-29";
+        results[44][34]="0.0002296564085119783";
+        results[44][35]="5.637548837665439E-13";
+        results[44][36]="1.187933404322369E+20";
+        results[44][37]="4.769810822125617E-18";
+        results[44][38]="581382332589848.2";
+        results[44][39]="5.083656324845414E-23";
+        results[44][40]="10540973778.55897";
+        results[44][41]="8.138847083690577E-28";
+        results[44][42]="38067.38771080486";
+        results[44][43]="1.468220067511016E-32";
+        results[44][44]="1";
+        results[44][45]="1.287851104706806E-16";
+        results[44][46]="7.011820865278762E+23";
+        results[44][47]="4.681669604739426E-22";
+        results[44][48]="5.806206693869941E+18";
+        results[44][49]="1.982717899951718E-26";
+        results[44][50]="195677552057591.1";
+        results[44][51]="4.935153726777955E-32";
+        results[44][52]="3506312662.314225";
+        results[44][53]="1.027995162516290E-36";
+        results[44][54]="14299.13878080998";
+        results[44][55]="5.206484150936237E-21";
+        results[44][56]="6.010083367684613E+27";
+        results[44][57]="5.222165073231839E-26";
+        results[44][58]="4.803782268957339E+22";
+        results[44][59]="1.024668892394211E-30";
+        results[44][60]="2.481228162724536E+18";
+        results[44][61]="4.736728381649903E-36";
+        results[44][62]="17739339038395.46";
+        results[44][63]="4.028763172600968E-41";
+        results[44][64]="185356918.5591225";
+        results[44][65]="4.371072975238266E-25";
+        results[44][66]="3.896858872973504E+31";
+        results[44][67]="1.410987975758478E-29";
+        results[44][68]="8.313383926141755E+26";
+        results[44][69]="6.266940742697879E-35";
+        results[44][70]="6.103925848762411E+21";
+        results[44][71]="3.829910140925841E-40";
+        results[44][72]="1.487731945645773E+17";
+        results[44][73]="7.257263337643890E-45";
+        results[44][74]="415506236539.3683";
+        results[45][0]="2.597956785100805E+20";
+        results[45][1]="571259805664574.7";
+        results[45][2]="12817225207.78065";
+        results[45][3]="149462.8258067859";
+        results[45][4]="1.043203031420026";
+        results[45][5]="3254728734851059";
+        results[45][6]="2.022664883508130E+24";
+        results[45][7]="31212645572.47396";
+        results[45][8]="2.981789060858130E+18";
+        results[45][9]="290946.4595446784";
+        results[45][10]="106182745061026.3";
+        results[45][11]="3.525732712799818";
+        results[45][12]="473409962.7585133";
+        results[45][13]="0.00004435967932193017";
+        results[45][14]="3566.845987692836";
+        results[45][15]="383167102245.4531";
+        results[45][16]="4.401825924450844E+27";
+        results[45][17]="4534904.990592084";
+        results[45][18]="3.454607339203797E+22";
+        results[45][19]="29.22956375615078";
+        results[45][20]="1.169066295088082E+18";
+        results[45][21]="0.0005449863706629740";
+        results[45][22]="6716283540777.093";
+        results[45][23]="5.973094057127134E-9";
+        results[45][24]="35575336.88235604";
+        results[45][25]="35613280.62065461";
+        results[45][26]="9.538921161825726E+31";
+        results[45][27]="415.1720928836645";
+        results[45][28]="1.471115850756691E+27";
+        results[45][29]="0.007087055286904757";
+        results[45][30]="3.315486017121880E+21";
+        results[45][31]="8.647173955412170E-8";
+        results[45][32]="6.740557130241340E+16";
+        results[45][33]="3.720759200959941E-13";
+        results[45][34]="1783252797412.961";
+        results[45][35]="4377.484956965496";
+        results[45][36]="9.224151767085032E+35";
+        results[45][37]="0.03703697426428437";
+        results[45][38]="4.514359854683718E+30";
+        results[45][39]="3.947394466849308E-7";
+        results[45][40]="8.184932046906727E+25";
+        results[45][41]="6.319711225890107E-12";
+        results[45][42]="2.955884230069542E+20";
+        results[45][43]="1.140054205136760E-16";
+        results[45][44]="7764872789604521";
+        results[45][45]="1";
+        results[45][46]="5.444589704238428E+39";
+        results[45][47]="0.000003635256892375972";
+        results[45][48]="4.508445636805033E+34";
+        results[45][49]="1.539555227079692E-10";
+        results[45][50]="1.519411299508411E+30";
+        results[45][51]="3.832084088557348E-16";
+        results[45][52]="2.722607178344951E+25";
+        results[45][53]="7.982251665267820E-21";
+        results[45][54]="1.110309936338901E+20";
+        results[45][55]="0.00004042768711311199";
+        results[45][56]="4.666753280498896E+43";
+        results[45][57]="4.054944747996101E-10";
+        results[45][58]="3.730075822741150E+38";
+        results[45][59]="7.956423600906009E-15";
+        results[45][60]="1.926642104554017E+34";
+        results[45][61]="3.678009332242079E-20";
+        results[45][62]="1.377437110048061E+29";
+        results[45][63]="3.128283353469004E-25";
+        results[45][64]="1.439272893284671E+24";
+        results[45][65]="3.394082560680328E-9";
+        results[45][66]="3.025861342768090E+47";
+        results[45][67]="1.095614213942617E-13";
+        results[45][68]="6.455236863763371E+42";
+        results[45][69]="4.866199764703870E-19";
+        results[45][70]="4.739620773281892E+37";
+        results[45][71]="2.973876503990548E-24";
+        results[45][72]="1.155204930297025E+33";
+        results[45][73]="5.635172661746553E-29";
+        results[45][74]="3.226353070015521E+27";
+        results[46][0]="4.771630051532411E-20";
+        results[46][1]="1.049224710578041E-25";
+        results[46][2]="2.354121413006176E-30";
+        results[46][3]="2.745162334095334E-35";
+        results[46][4]="1.916036080015227E-40";
+        results[46][5]="5.977913693510024E-25";
+        results[46][6]="3.714999648060815E-16";
+        results[46][7]="5.732781948321280E-30";
+        results[46][8]="5.476609299938448E-22";
+        results[46][9]="5.343771989249925E-35";
+        results[46][10]="1.950243284234377E-26";
+        results[46][11]="6.475662821856263E-40";
+        results[46][12]="8.695053043023237E-32";
+        results[46][13]="8.147478824234940E-45";
+        results[46][14]="6.551174985538704E-37";
+        results[46][15]="7.037575337351325E-29";
+        results[46][16]="8.084770687172574E-13";
+        results[46][17]="8.329195103649068E-34";
+        results[46][18]="6.345027865946450E-18";
+        results[46][19]="5.368552148823365E-39";
+        results[46][20]="2.147207335344303E-22";
+        results[46][21]="1.000968668472338E-43";
+        results[46][22]="1.233570187216990E-27";
+        results[46][23]="1.097069638227704E-48";
+        results[46][24]="6.534071218380670E-33";
+        results[46][25]="6.541040290498085E-33";
+        results[46][26]="1.752E-8";
+        results[46][27]="7.625406420624627E-38";
+        results[46][28]="2.701977432039512E-13";
+        results[46][29]="1.301669303269579E-42";
+        results[46][30]="6.089505724445841E-19";
+        results[46][31]="1.588214066650539E-47";
+        results[46][32]="1.238028482659409E-23";
+        results[46][33]="6.833865181913444E-53";
+        results[46][34]="3.275274895415460E-28";
+        results[46][35]="8.040063980501181E-37";
+        results[46][36]="0.0001694186755689661";
+        results[46][37]="6.802528064778204E-42";
+        results[46][38]="8.291460146518372E-10";
+        results[46][39]="7.250122931717692E-47";
+        results[46][40]="1.503314756763955E-14";
+        results[46][41]="1.160732317619898E-51";
+        results[46][42]="5.429030267916215E-20";
+        results[46][43]="2.093921244881440E-56";
+        results[46][44]="1.426163074062281E-24";
+        results[46][45]="1.836685690423163E-40";
+        results[46][46]="1";
+        results[46][47]="6.676824315239122E-46";
+        results[46][48]="0.000008280597587170547";
+        results[46][49]="2.827679055193452E-50";
+        results[46][50]="2.790680991674361E-10";
+        results[46][51]="7.038334009951569E-56";
+        results[46][52]="5.000573645109554E-15";
+        results[46][53]="1.466088741095387E-60";
+        results[46][54]="2.039290372008313E-20";
+        results[46][55]="7.425295441755768E-45";
+        results[46][56]="8571.358971027673";
+        results[46][57]="7.447658994100996E-50";
+        results[46][58]="0.06850976887822076";
+        results[46][59]="1.461344937472920E-54";
+        results[46][60]="0.000003538635984001130";
+        results[46][61]="6.755347109771878E-60";
+        results[46][62]="2.529919029483109E-11";
+        results[46][63]="5.745673270905503E-65";
+        results[46][64]="2.643491927709899E-16";
+        results[46][65]="6.233862871316364E-49";
+        results[46][66]="55575562.29466768";
+        results[46][67]="2.012298948972625E-53";
+        results[46][68]="1185.624117596628";
+        results[46][69]="8.937679474572159E-59";
+        results[46][70]="0.008705193652319216";
+        results[46][71]="5.462076419965100E-64";
+        results[46][72]="2.121748364982833E-7";
+        results[46][73]="1.035004099089370E-68";
+        results[46][74]="5.925796515950347E-13";
+        results[47][0]="7.146556246270681E+25";
+        results[47][1]="1.571442741399231E+20";
+        results[47][2]="3525810028628656";
+        results[47][3]="41114790572.36538";
+        results[47][4]="286968.1737232600";
+        results[47][5]="8.953228977234115E+20";
+        results[47][6]="5.564021865277680E+29";
+        results[47][7]="8586090748616571";
+        results[47][8]="8.202416360482460E+23";
+        results[47][9]="80034635283.92306";
+        results[47][10]="2.920914482927399E+19";
+        results[47][11]="969871.6809241588";
+        results[47][12]="130227375058794.5";
+        results[47][13]="12.20262573876507";
+        results[47][14]="981181273.6462696";
+        results[47][15]="1.054030330150941E+17";
+        results[47][16]="1.210870663276248E+33";
+        results[47][17]="1247478548243.150";
+        results[47][18]="9.503062483559163E+27";
+        results[47][19]="8040577.219577623";
+        results[47][20]="3.215911088814389E+23";
+        results[47][21]="149.9168798238013";
+        results[47][22]="1.847540281090668E+18";
+        results[47][23]="0.001643100951037101";
+        results[47][24]="9786196116419.247";
+        results[47][25]="9796633821214.788";
+        results[47][26]="2.624001946556017E+37";
+        results[47][27]="114207084.9942909";
+        results[47][28]="4.046800251839102E+32";
+        results[47][29]="1949.533553397026";
+        results[47][30]="9.120362371295601E+26";
+        results[47][31]="0.02378696805044898";
+        results[47][32]="1.854217550450959E+22";
+        results[47][33]="1.023520293369992E-7";
+        results[47][34]="4.905438185545787E+17";
+        results[47][35]="1204174859.319065";
+        results[47][36]="2.537414009565692E+41";
+        results[47][37]="10188.26876910955";
+        results[47][38]="1.241826915768028E+36";
+        results[47][39]="0.1085863966072925";
+        results[47][40]="2.251541579928655E+31";
+        results[47][41]="0.000001738449692274594";
+        results[47][42]="8.131156387513517E+25";
+        results[47][43]="3.136103551657476E-11";
+        results[47][44]="2.135990115551220E+21";
+        results[47][45]="275083.7229955457";
+        results[47][46]="1.497718006025124E+45";
+        results[47][47]="1";
+        results[47][48]="1.240200010695352E+40";
+        results[47][49]="0.00004235065836223342";
+        results[47][50]="4.179653170302738E+35";
+        results[47][51]="1.054143957912348E-10";
+        results[47][52]="7.489449188735266E+30";
+        results[47][53]="2.195787505969266E-15";
+        results[47][54]="3.054281909670523E+25";
+        results[47][55]="11.12099868317389";
+        results[47][56]="1.283747866701312E+49";
+        results[47][57]="0.0001115449297820002";
+        results[47][58]="1.026083144375309E+44";
+        results[47][59]="2.188682625866851E-9";
+        results[47][60]="5.299878830006924E+39";
+        results[47][61]="1.011760500325512E-14";
+        results[47][62]="3.789105284242457E+34";
+        results[47][63]="8.605398314572440E-20";
+        results[47][64]="3.959205458913181E+29";
+        results[47][65]="0.0009336568669461997";
+        results[47][66]="8.323652034369472E+52";
+        results[47][67]="3.013856369381733E-8";
+        results[47][68]="1.775730589302118E+48";
+        results[47][69]="1.338612348114789E-13";
+        results[47][70]="1.303792527901410E+43";
+        results[47][71]="8.180650204466976E-19";
+        results[47][72]="3.177780730489156E+38";
+        results[47][73]="1.550144275515960E-23";
+        results[47][74]="8.875172141979778E+32";
+        results[48][0]="5.762422338848205E-15";
+        results[48][1]="1.267088153400481E-20";
+        results[48][2]="2.842936621692024E-25";
+        results[48][3]="3.315174183018531E-30";
+        results[48][4]="2.313886238094478E-35";
+        results[48][5]="7.219181503001472E-20";
+        results[48][6]="4.486390757373126E-11";
+        results[48][7]="6.923150035938593E-25";
+        results[48][8]="6.613785107035720E-17";
+        results[48][9]="6.453365150275192E-30";
+        results[48][10]="2.355196305223146E-21";
+        results[48][11]="7.820284410257130E-35";
+        results[48][12]="1.050051394418058E-26";
+        results[48][13]="9.839240149597593E-40";
+        results[48][14]="7.911476094054727E-32";
+        results[48][15]="8.498873738599392E-24";
+        results[48][16]="9.763511150087314E-8";
+        results[48][17]="1.005868841707006E-28";
+        results[48][18]="7.662524110309441E-13";
+        results[48][19]="6.483290719429564E-34";
+        results[48][20]="2.593058426931717E-17";
+        results[48][21]="1.208812115230884E-38";
+        results[48][22]="1.489711550683502E-22";
+        results[48][23]="1.324867712358631E-43";
+        results[48][24]="7.890820861170891E-28";
+        results[48][25]="7.899237007522711E-28";
+        results[48][26]="0.002115789327468880";
+        results[48][27]="9.208763426010420E-33";
+        results[48][28]="3.263022268134115E-8";
+        results[48][29]="1.571950924515769E-37";
+        results[48][30]="7.353944761040615E-14";
+        results[48][31]="1.917994504540616E-42";
+        results[48][32]="1.495095576891135E-18";
+        results[48][33]="8.252864735875365E-48";
+        results[48][34]="3.955360541236747E-23";
+        results[48][35]="9.709521439561277E-32";
+        results[48][36]="20.45971607549835";
+        results[48][37]="8.215020707343183E-37";
+        results[48][38]="0.0001001311808626548";
+        results[48][39]="8.755555206487259E-42";
+        results[48][40]="1.815466505814869E-9";
+        results[48][41]="1.401749457573287E-46";
+        results[48][42]="6.556326654887352E-15";
+        results[48][43]="2.528707889543666E-51";
+        results[48][44]="1.722294869481269E-19";
+        results[48][45]="2.218059350292316E-35";
+        results[48][46]="120764.2310199132";
+        results[48][47]="8.063215540849113E-41";
+        results[48][48]="1";
+        results[48][49]="3.414824866715520E-45";
+        results[48][50]="0.00003370144439814430";
+        results[48][51]="8.499789943731035E-51";
+        results[48][52]="6.038904309100998E-10";
+        results[48][53]="1.770510794253370E-55";
+        results[48][54]="2.462733336018967E-15";
+        results[48][55]="8.967100941193022E-40";
+        results[48][56]="1035113574.931792";
+        results[48][57]="8.994108113211472E-45";
+        results[48][58]="8273.529555930313";
+        results[48][59]="1.764781976287603E-49";
+        results[48][60]="0.4273406534672904";
+        results[48][61]="8.158042989841942E-55";
+        results[48][62]="0.000003055237261381728";
+        results[48][63]="6.938718142525727E-60";
+        results[48][64]="3.192392698572340E-11";
+        results[48][65]="7.528276559381090E-44";
+        results[48][66]="6711540044014.826";
+        results[48][67]="2.430137351548587E-48";
+        results[48][68]="143180984.8402199";
+        results[48][69]="1.079351988849169E-53";
+        results[48][70]="1051.276017301760";
+        results[48][71]="6.596234586290859E-59";
+        results[48][72]="0.02562313097149101";
+        results[48][73]="1.249914741289858E-63";
+        results[48][74]="7.156242594292246E-8";
+        results[49][0]="1.687472290311238E+30";
+        results[49][1]="3.710550915072856E+24";
+        results[49][2]="8.325277964917845E+19";
+        results[49][3]="970818215402995.0";
+        results[49][4]="6776002660.189255";
+        results[49][5]="2.114070789798686E+25";
+        results[49][6]="1.313798198291870E+34";
+        results[49][7]="2.027380702131727E+20";
+        results[49][8]="1.936786033011718E+28";
+        results[49][9]="1889808526690925";
+        results[49][10]="6.896975385705340E+23";
+        results[49][11]="22900982379.74620";
+        results[49][12]="3.074978762902205E+18";
+        results[49][13]="288133.0824752154";
+        results[49][14]="23168028823874.12";
+        results[49][15]="2.488816870650781E+21";
+        results[49][16]="2.859154284968690E+37";
+        results[49][17]="2.945594228012286E+16";
+        results[49][18]="2.243899587646931E+32";
+        results[49][19]="189857195390.0929";
+        results[49][20]="7.593532693891262E+27";
+        results[49][21]="3539894.906509671";
+        results[49][22]="4.362483022786321E+22";
+        results[49][23]="38.79753030008030";
+        results[49][24]="2.310754187742728E+17";
+        results[49][25]="2.313218778660363E+17";
+        results[49][26]="6.195894108923685E+41";
+        results[49][27]="2696701525096.859";
+        results[49][28]="9.555460076266186E+36";
+        results[49][29]="46033134.51994738";
+        results[49][30]="2.153534968284877E+31";
+        results[49][31]="561.6670193647148";
+        results[49][32]="4.378249647482396E+26";
+        results[49][33]="0.002416775400787454";
+        results[49][34]="1.158290892101044E+22";
+        results[49][35]="28433438956710.49";
+        results[49][36]="5.991439348740924E+45";
+        results[49][37]="240569312.5704755";
+        results[49][38]="2.932249376494788E+40";
+        results[49][39]="2563.983673607429";
+        results[49][40]="5.316426395714516E+35";
+        results[49][41]="0.04104894137430629";
+        results[49][42]="1.919959854688953E+30";
+        results[49][43]="7.405088074035996E-7";
+        results[49][44]="5.043581843006266E+25";
+        results[49][45]="6495382448.194808";
+        results[49][46]="3.536469240253245E+49";
+        results[49][47]="23612.38381341809";
+        results[49][48]="2.928407865794388E+44";
+        results[49][49]="1";
+        results[49][50]="9.869157486415798E+39";
+        results[49][51]="0.000002489085172882200";
+        results[49][52]="1.768437487955098E+35";
+        results[49][53]="5.184777736365438E-11";
+        results[49][54]="7.211887672551995E+29";
+        results[49][55]="262593.2892956190";
+        results[49][56]="3.031234734820807E+53";
+        results[49][57]="2.633841694453359";
+        results[49][58]="2.422826902946868E+48";
+        results[49][59]="0.00005168001420772782";
+        results[49][60]="1.251427730987327E+44";
+        results[49][61]="2.389007726094191E-10";
+        results[49][62]="8.946980828098355E+38";
+        results[49][63]="2.031939678710256E-15";
+        results[49][64]="9.348627889203813E+33";
+        results[49][65]="22.04586429236709";
+        results[49][66]="1.965412665648703E+57";
+        results[49][67]="0.0007116433335235624";
+        results[49][68]="4.192923222382870E+52";
+        results[49][69]="3.160782854106722E-9";
+        results[49][70]="3.078564958187471E+47";
+        results[49][71]="1.931646524711914E-14";
+        results[49][72]="7.503497828319405E+42";
+        results[49][73]="3.660260159965578E-19";
+        results[49][74]="2.095639710265825E+37";
+        results[50][0]="1.709844323220016E-10";
+        results[50][1]="3.759744355260485E-16";
+        results[50][2]="8.435652158126978E-21";
+        results[50][3]="9.836890501942623E-26";
+        results[50][4]="6.865836997247178E-31";
+        results[50][5]="2.142098545603874E-15";
+        results[50][6]="0.000001331216165209868";
+        results[50][7]="2.054259145142100E-20";
+        results[50][8]="1.962463397384800E-12";
+        results[50][9]="1.914863076500820E-25";
+        results[50][10]="6.988413545126361E-17";
+        results[50][11]="2.320459716168051E-30";
+        results[50][12]="3.115745966294182E-22";
+        results[50][13]="2.919530698256769E-35";
+        results[50][14]="2.347518403243974E-27";
+        results[50][15]="2.521812904573124E-19";
+        results[50][16]="0.002897060148147514";
+        results[50][17]="2.984646087638879E-24";
+        results[50][18]="2.273648577130825E-8";
+        results[50][19]="1.923742686763465E-29";
+        results[50][20]="7.694205614150171E-13";
+        results[50][21]="3.586825837344361E-34";
+        results[50][22]="4.420319595457841E-18";
+        results[50][23]="3.931189704235886E-39";
+        results[50][24]="2.341389516707296E-23";
+        results[50][25]="2.343886782477983E-23";
+        results[50][26]="62.78037530003851";
+        results[50][27]="2.732453635286172E-28";
+        results[50][28]="0.0009682143677835323";
+        results[50][29]="4.664342886746792E-33";
+        results[50][30]="2.182085929066454E-9";
+        results[50][31]="5.691134427004636E-38";
+        results[50][32]="4.436295249628704E-14";
+        results[50][33]="2.448816329168904E-43";
+        results[50][34]="1.173647186900553E-18";
+        results[50][35]="2.881040149156310E-27";
+        results[50][36]="607087.2166127371";
+        results[50][37]="2.437587128400801E-32";
+        results[50][38]="2.971124313834108";
+        results[50][39]="2.597976247857604E-37";
+        results[50][40]="0.00005386910081262968";
+        results[50][41]="4.159315669124470E-42";
+        results[50][42]="1.945414142323337E-10";
+        results[50][43]="7.503262648537709E-47";
+        results[50][44]="5.110448232230970E-15";
+        results[50][45]="6.581496401425599E-31";
+        results[50][46]="3583354754.568408";
+        results[50][47]="2.392543015543006E-36";
+        results[50][48]="29672.31873465527";
+        results[50][49]="1.013257718682096E-40";
+        results[50][50]="1";
+        results[50][51]="2.522084763880048E-46";
+        results[50][52]="0.00001791882934677280";
+        results[50][53]="5.253516061023365E-51";
+        results[50][54]="7.307500850481565E-11";
+        results[50][55]="2.660746772529066E-35";
+        results[50][56]="30714219921944.59";
+        results[50][57]="2.668760426691597E-40";
+        results[50][58]="245494806.0441551";
+        results[50][59]="5.236517329758060E-45";
+        results[50][60]="12680.18807795731";
+        results[50][61]="2.420680518456101E-50";
+        results[50][62]="0.09065597382971390";
+        results[50][63]="2.058878563349585E-55";
+        results[50][64]="9.472569367822474E-7";
+        results[50][65]="2.233814215925896E-39";
+        results[50][66]="1.991469553864102E+17";
+        results[50][67]="7.210781006414067E-44";
+        results[50][68]="4248511818920.849";
+        results[50][69]="3.202687624001662E-49";
+        results[50][70]="31193797.06347679";
+        results[50][71]="1.957255750929793E-54";
+        results[50][72]="760.2977091658982";
+        results[50][73]="3.708786859469685E-59";
+        results[50][74]="0.002123423112003558";
+        results[51][0]="6.779487936755711E+35";
+        results[51][1]="1.490728784815458E+30";
+        results[51][2]="3.344713975889266E+25";
+        results[51][3]="3.900301307403033E+20";
+        results[51][4]="2722286378148756";
+        results[51][5]="8.493364601705167E+30";
+        results[51][6]="5.278237211829022E+39";
+        results[51][7]="8.145083680620504E+25";
+        results[51][8]="7.781115946181321E+33";
+        results[51][9]="7.592381921196569E+20";
+        results[51][10]="2.770887658182901E+29";
+        results[51][11]="9200561969210697";
+        results[51][12]="1.235385111125618E+24";
+        results[51][13]="115758627151.1858";
+        results[51][14]="9.307848954420085E+18";
+        results[51][15]="9.998922084971854E+26";
+        results[51][16]="1.148676757275435E+43";
+        results[51][17]="1.183404352773304E+22";
+        results[51][18]="9.014957029568579E+37";
+        results[51][19]="7.627589343206385E+16";
+        results[51][20]="3.050732364091198E+33";
+        results[51][21]="1422167045577.915";
+        results[51][22]="1.752645136580379E+28";
+        results[51][23]="15587064.16428300";
+        results[51][24]="9.283548079903686E+22";
+        results[51][25]="9.293449673246033E+22";
+        results[51][26]="2.489225429658254E+47";
+        results[51][27]="1.083410706261310E+18";
+        results[51][28]="3.838944597143528E+42";
+        results[51][29]="18493997321370.88";
+        results[51][30]="8.651913529303709E+36";
+        results[51][31]="225651988.7241708";
+        results[51][32]="1.758979441596474E+32";
+        results[51][33]="970.9492576298560";
+        results[51][34]="4.653480341774795E+27";
+        results[51][35]="1.142324869654275E+19";
+        results[51][36]="2.407084905737968E+51";
+        results[51][37]="96649690895033.44";
+        results[51][38]="1.178043004892208E+46";
+        results[51][39]="1030090774.530830";
+        results[51][40]="2.135895731345520E+41";
+        results[51][41]="16491.57763724665";
+        results[51][42]="7.713516096621809E+35";
+        results[51][43]="0.2975023978573374";
+        results[51][44]="2.026279332645786E+31";
+        results[51][45]="2609546076992446";
+        results[51][46]="1.420790770352885E+55";
+        results[51][47]="9486370362.359466";
+        results[51][48]="1.176499662485828E+50";
+        results[51][49]="401754.0303139023";
+        results[51][50]="3.964973795970168E+45";
+        results[51][51]="1";
+        results[51][52]="7.104768881441538E+40";
+        results[51][53]="0.00002083005351866606";
+        results[51][54]="2.897404938618912E+35";
+        results[51][55]="105497912307.8994";
+        results[51][56]="1.217810771541752E+59";
+        results[51][57]="1058156.515955435";
+        results[51][58]="9.733804730118538E+53";
+        results[51][59]="20.76265399463438";
+        results[51][60]="5.027661345707404E+49";
+        results[51][61]="0.00009597934824093921";
+        results[51][62]="3.594485606829729E+44";
+        results[51][63]="8.163399552765810E-10";
+        results[51][64]="3.755848932392581E+39";
+        results[51][65]="8857014.831211825";
+        results[51][66]="7.896124596543564E+62";
+        results[51][67]="285.9055773891117";
+        results[51][68]="1.684523803389072E+58";
+        results[51][69]="0.001269857250584455";
+        results[51][70]="1.236825879534966E+53";
+        results[51][71]="7.760467764448543E-9";
+        results[51][72]="3.014560493978934E+48";
+        results[51][73]="1.470524271263579E-13";
+        results[51][74]="8.419316996851535E+42";
+        results[52][0]="0.000009542165339768479";
+        results[52][1]="2.098208695724657E-11";
+        results[52][2]="4.707702715884311E-16";
+        results[52][3]="5.489694840870986E-21";
+        results[52][4]="3.831632560574457E-26";
+        results[52][5]="1.195445586399130E-10";
+        results[52][6]="0.07429146957357580";
+        results[52][7]="1.146424861461206E-15";
+        results[52][8]="1.095196209197808E-7";
+        results[52][9]="1.068631794769388E-20";
+        results[52][10]="3.900039120795011E-12";
+        results[52][11]="1.294983992124446E-25";
+        results[52][12]="1.738811116505963E-17";
+        results[52][13]="1.629308835837862E-30";
+        results[52][14]="1.310084692372364E-22";
+        results[52][15]="1.407353603167891E-14";
+        results[52][16]="161.6768647148971";
+        results[52][17]="1.665647922572809E-19";
+        results[52][18]="0.001268859998122764";
+        results[52][19]="1.073587258148610E-24";
+        results[52][20]="4.293922033213574E-8";
+        results[52][21]="2.001707682980056E-29";
+        results[52][22]="2.466857354302527E-13";
+        results[52][23]="2.193887573879874E-34";
+        results[52][24]="1.306664331355432E-18";
+        results[52][25]="1.308057985886294E-18";
+        results[52][26]="3503598.035624204";
+        results[52][27]="1.524906333112822E-23";
+        results[52][28]="54.03334944745757";
+        results[52][29]="2.603039962310287E-28";
+        results[52][30]="0.0001217761432311118";
+        results[52][31]="3.176063746613903E-33";
+        results[52][32]="2.475772922312967E-9";
+        results[52][33]="1.366616245837476E-38";
+        results[52][34]="6.549798338873787E-14";
+        results[52][35]="1.607828331528359E-22";
+        results[52][36]="33879848111.95684";
+        results[52][37]="1.360349541383301E-27";
+        results[52][38]="165810.1796906287";
+        results[52][39]="1.449858245525120E-32";
+        results[52][40]="3.006284605435543";
+        results[52][41]="2.321198326426144E-37";
+        results[52][42]="0.00001085681494407283";
+        results[52][43]="4.187362077807307E-42";
+        results[52][44]="2.851998941075561E-10";
+        results[52][45]="3.672949986886802E-26";
+        results[52][46]="199977056827865.5";
+        results[52][47]="1.335211675518248E-31";
+        results[52][48]="1655929534.258291";
+        results[52][49]="5.654709351113861E-36";
+        results[52][50]="55807.21712605078";
+        results[52][51]="1.407505320281584E-41";
+        results[52][52]="1";
+        results[52][53]="2.931841114927259E-46";
+        results[52][54]="0.000004078112866116254";
+        results[52][55]="1.484888728519684E-30";
+        results[52][56]="1.714075140041236E+18";
+        results[52][57]="1.489360925897899E-35";
+        results[52][58]="13700381944223.89";
+        results[52][59]="2.922354596061357E-40";
+        results[52][60]="707646009.2657238";
+        results[52][61]="1.350914432862808E-45";
+        results[52][62]="5059.257615288420";
+        results[52][63]="1.149002830210218E-50";
+        results[52][64]="0.05286377354516463";
+        results[52][65]="1.246629549674354E-34";
+        results[52][66]="1.111383737924134E+22";
+        results[52][67]="4.024136212733528E-39";
+        results[52][68]="2.370976215411088E+17";
+        results[52][69]="1.787330836195764E-44";
+        results[52][70]="1740839005707.414";
+        results[52][71]="1.092289966633505E-49";
+        results[52][72]="42430099.33586029";
+        results[52][73]="2.069770735406687E-54";
+        results[52][74]="118.5023346620570";
+        results[53][0]="3.254666595398102E+40";
+        results[53][1]="7.156624842464271E+34";
+        results[53][2]="1.605715497990454E+30";
+        results[53][3]="1.872439407756647E+25";
+        results[53][4]="1.306903208726412E+20";
+        results[53][5]="4.077456927364187E+35";
+        results[53][6]="2.533952784662378E+44";
+        results[53][7]="3.910255762579582E+30";
+        results[53][8]="3.735523741793833E+38";
+        results[53][9]="3.644917145504665E+25";
+        results[53][10]="1.330235496370605E+34";
+        results[53][11]="4.416965112915320E+20";
+        results[53][12]="5.930782222996091E+28";
+        results[53][13]="5557288993398558";
+        results[53][14]="4.468470974440470E+23";
+        results[53][15]="4.800238307602860E+31";
+        results[53][16]="5.514516591357251E+47";
+        results[53][17]="5.681235296456829E+26";
+        results[53][18]="4.327860714083221E+42";
+        results[53][19]="3.661819369005083E+21";
+        results[53][20]="1.464582105541592E+38";
+        results[53][21]="6.827476675964822E+16";
+        results[53][22]="8.414021284245927E+32";
+        results[53][23]="748296885090.3456";
+        results[53][24]="4.456804718040974E+27";
+        results[53][25]="4.461558231196124E+27";
+        results[53][26]="1.195016338977540E+52";
+        results[53][27]="5.201190219172758E+22";
+        results[53][28]="1.842983549563809E+47";
+        results[53][29]="8.878516468907865E+17";
+        results[53][30]="4.153572395553678E+41";
+        results[53][31]="10833000910053.42";
+        results[53][32]="8.444430735716701E+36";
+        results[53][33]="46612902.68696511";
+        results[53][34]="2.234022268644081E+32";
+        results[53][35]="5.484022730093443E+23";
+        results[53][36]="1.155582679411242E+56";
+        results[53][37]="4.639915630001839E+18";
+        results[53][38]="5.655496774583657E+50";
+        results[53][39]="49452142482867.52";
+        results[53][40]="1.025391379542793E+46";
+        results[53][41]="791720367.9994558";
+        results[53][42]="3.703070704887838E+40";
+        results[53][43]="14282.36358541959";
+        results[53][44]="9.727672234879347E+35";
+        results[53][45]="1.252779343391509E+20";
+        results[53][46]="6.820869514711989E+59";
+        results[53][47]="455417474269022.8";
+        results[53][48]="5.648087564592924E+54";
+        results[53][49]="19287229864.95862";
+        results[53][50]="1.903487090139787E+50";
+        results[53][51]="48007.55788283925";
+        results[53][52]="3.410826033199997E+45";
+        results[53][53]="1";
+        results[53][54]="1.390973353007717E+40";
+        results[53][55]="5064697131640181";
+        results[53][56]="5.846412110513578E+63";
+        results[53][57]="50799510188.83404";
+        results[53][58]="4.672961940014202E+58";
+        results[53][59]="996764.3134487737";
+        results[53][60]="2.413657430693617E+54";
+        results[53][61]="4.607734116234075";
+        results[53][62]="1.725624758289108E+49";
+        results[53][63]="0.00003919048765501487";
+        results[53][64]="1.803091350210368E+44";
+        results[53][65]="425203652178.5674";
+        results[53][66]="3.790736586186758E+67";
+        results[53][67]="13725628.55553436";
+        results[53][68]="8.086987399622141E+62";
+        results[53][69]="60.96274546037631";
+        results[53][70]="5.937699000276846E+57";
+        results[53][71]="0.0003725611053996715";
+        results[53][72]="1.447216874060142E+53";
+        results[53][73]="7.059627907080629E-9";
+        results[53][74]="4.041908480603224E+47";
+        results[54][0]="2.339848271255880";
+        results[54][1]="0.000005145048125465107";
+        results[54][2]="1.154382644727447E-10";
+        results[54][3]="1.346136073496915E-15";
+        results[54][4]="9.395602050179328E-21";
+        results[54][5]="0.00002931369546761954";
+        results[54][6]="18217.11953851009";
+        results[54][7]="2.811165112634539E-10";
+        results[54][8]="0.02685546587730432";
+        results[54][9]="2.620407599917871E-15";
+        results[54][10]="9.563342773563720E-7";
+        results[54][11]="3.175449122274317E-20";
+        results[54][12]="4.263764083022794E-12";
+        results[54][13]="3.995251944533639E-25";
+        results[54][14]="3.212477769454207E-17";
+        results[54][15]="3.450992283369952E-9";
+        results[54][16]="39645019.65068670";
+        results[54][17]="4.084359548780881E-14";
+        results[54][18]="311.1390095809556";
+        results[54][19]="2.632558963898978E-19";
+        results[54][20]="0.01052918880419032";
+        results[54][21]="4.908416585552623E-24";
+        results[54][22]="6.049016874444212E-8";
+        results[54][23]="5.379663697167850E-29";
+        results[54][24]="3.204090652350726E-13";
+        results[54][25]="3.207508052939222E-13";
+        results[54][26]="859122381024.4411";
+        results[54][27]="3.739245045871056E-18";
+        results[54][28]="13249596.37493202";
+        results[54][29]="6.382952232485079E-23";
+        results[54][30]="29.86090557789883";
+        results[54][31]="7.788072206149096E-28";
+        results[54][32]="0.0006070878868712484";
+        results[54][33]="3.351099615688073E-33";
+        results[54][34]="1.606085597408052E-8";
+        results[54][35]="3.942579286824783E-17";
+        results[54][36]="8307726937489580";
+        results[54][37]="3.335732938354928E-22";
+        results[54][38]="40658555840.44592";
+        results[54][39]="3.555218536425345E-27";
+        results[54][40]="737175.4299430523";
+        results[54][41]="5.691844249118863E-32";
+        results[54][42]="2.662215416909782";
+        results[54][43]="1.026789158436190E-36";
+        results[54][44]="0.00006993428173045223";
+        results[54][45]="9.006494198343990E-21";
+        results[54][46]="4.903666558358682E+19";
+        results[54][47]="3.274092011067419E-26";
+        results[54][48]="406052894714338.1";
+        results[54][49]="1.386599522072340E-30";
+        results[54][50]="13684569053.92081";
+        results[54][51]="3.451364311115807E-36";
+        results[54][52]="245211.4575613350";
+        results[54][53]="7.189210331295627E-41";
+        results[54][54]="1";
+        results[54][55]="3.641117294367092E-25";
+        results[54][56]="4.203108634591608E+23";
+        results[54][57]="3.652083634743231E-30";
+        results[54][58]="3.359490625690135E+18";
+        results[54][59]="7.165948300112717E-35";
+        results[54][60]="173522909369510.1";
+        results[54][61]="3.312596971229334E-40";
+        results[54][62]="1240587934.023157";
+        results[54][63]="2.817486587379466E-45";
+        results[54][64]="12962.80296320216";
+        results[54][65]="3.056878489146789E-29";
+        results[54][66]="2.725240262863416E+27";
+        results[54][67]="9.867643061497388E-34";
+        results[54][68]="5.813905336242105E+22";
+        results[54][69]="4.382739994878830E-39";
+        results[54][70]="4.268736699691402E+17";
+        results[54][71]="2.678420147978238E-44";
+        results[54][72]="10404346502618.53";
+        results[54][73]="5.075314988468698E-49";
+        results[54][74]="29058130.20690411";
+        results[55][0]="6.426182081186150E+24";
+        results[55][1]="1.413041028209840E+19";
+        results[55][2]="317040773861723.4";
+        results[55][3]="3697041222.976872";
+        results[55][4]="25804.17297930660";
+        results[55][5]="8.050741873371843E+19";
+        results[55][6]="5.003167452664180E+28";
+        results[55][7]="772061124475030.9";
+        results[55][8]="7.375611304488999E+22";
+        results[55][9]="7196712953.937829";
+        results[55][10]="2.626485773572434E+18";
+        results[55][11]="87210.84396777946";
+        results[55][12]="11710043204647.52";
+        results[55][13]="1.097259885232042";
+        results[55][14]="88227802.34034201";
+        results[55][15]="9477838818070297";
+        results[55][16]="1.088814680922766E+32";
+        results[55][17]="112173248444.9072";
+        results[55][18]="8.545152062590683E+26";
+        results[55][19]="723008.5578324046";
+        results[55][20]="2.891746668111807E+22";
+        results[55][21]="13.48052311620413";
+        results[55][22]="1.661307885852018E+17";
+        results[55][23]="0.0001477476077326687";
+        results[55][24]="879974577393.4671";
+        results[55][25]="880913135619.4773";
+        results[55][26]="2.359502074688797E+36";
+        results[55][27]="10269499.01244810";
+        results[55][28]="3.638882052887863E+31";
+        results[55][29]="175.3020217821514";
+        results[55][30]="8.201028191015562E+25";
+        results[55][31]="0.002138923735908606";
+        results[55][32]="1.667312085250398E+21";
+        results[55][33]="9.203492622641725E-9";
+        results[55][34]="4.410969127231112E+16";
+        results[55][35]="108279381.5218219";
+        results[55][36]="2.281642217442943E+40";
+        results[55][37]="916.1289430349850";
+        results[55][38]="1.116650537551916E+35";
+        results[55][39]="0.009764086814575751";
+        results[55][40]="2.024585780533582E+30";
+        results[55][41]="1.563213648163519E-7";
+        results[55][42]="7.311534349712662E+24";
+        results[55][43]="2.819983745167070E-12";
+        results[55][44]="1.920681924711475E+20";
+        results[55][45]="24735.52338530067";
+        results[55][46]="1.346747759525569E+44";
+        results[55][47]="0.08991998187294129";
+        results[55][48]="1.115187624805477E+39";
+        results[55][49]="0.000003808170432239159";
+        results[55][50]="3.758343373088038E+34";
+        results[55][51]="9.478860558694889E-12";
+        results[55][52]="6.734511352893900E+29";
+        results[55][53]="1.974451727335874E-16";
+        results[55][54]="2.746409739524259E+24";
+        results[55][55]="1";
+        results[55][56]="1.154345849032090E+48";
+        results[55][57]="0.00001003011806401597";
+        results[55][58]="9.226537774235836E+42";
+        results[55][59]="1.968063020435687E-10";
+        results[55][60]="4.765650083230079E+38";
+        results[55][61]="9.097748584902804E-16";
+        results[55][62]="3.407162784737478E+33";
+        results[55][63]="7.737972604557934E-21";
+        results[55][64]="3.560116830967234E+28";
+        results[55][65]="0.00008395440855134944";
+        results[55][66]="7.484626400471738E+51";
+        results[55][67]="2.710059101024540E-9";
+        results[55][68]="1.596736624012738E+47";
+        results[55][69]="1.203679980773772E-14";
+        results[55][70]="1.172370004749711E+42";
+        results[55][71]="7.356039180945439E-20";
+        results[55][72]="2.857459856817670E+37";
+        results[55][73]="1.393889451548389E-24";
+        results[55][74]="7.980553181260552E+31";
+        results[56][0]="5.566946930657264E-24";
+        results[56][1]="1.224105435467771E-29";
+        results[56][2]="2.746497283526938E-34";
+        results[56][3]="3.202715395976701E-39";
+        results[56][4]="2.235393578184839E-44";
+        results[56][5]="6.974289273983464E-29";
+        results[56][6]="4.334201449989442E-20";
+        results[56][7]="6.688299915682963E-34";
+        results[56][8]="6.389429399060419E-26";
+        results[56][9]="6.234451278160885E-39";
+        results[56][10]="2.275302307167926E-30";
+        results[56][11]="7.555001305796269E-44";
+        results[56][12]="1.014431092247293E-35";
+        results[56][13]="9.505469146461484E-49";
+        results[56][14]="7.643099545454276E-41";
+        results[56][15]="8.210571230465625E-33";
+        results[56][16]="9.432309059158727E-17";
+        results[56][17]="9.717473193927414E-38";
+        results[56][18]="7.402592619669160E-22";
+        results[56][19]="6.263361699083869E-43";
+        results[56][20]="2.505095566061517E-26";
+        results[56][21]="1.167806262525866E-47";
+        results[56][22]="1.439176904603599E-31";
+        results[56][23]="1.279924970982950E-52";
+        results[56][24]="7.623144988404633E-37";
+        results[56][25]="7.631275638562877E-37";
+        results[56][26]="2.044016597510373E-12";
+        results[56][27]="8.896379729748234E-42";
+        results[56][28]="3.152332601134258E-17";
+        results[56][29]="1.518626518466200E-46";
+        results[56][30]="7.104481033905097E-23";
+        results[56][31]="1.852931456982391E-51";
+        results[56][32]="1.444378291521926E-27";
+        results[56][33]="7.972907452613771E-57";
+        results[56][34]="3.821185072852883E-32";
+        results[56][35]="9.380150811181354E-41";
+        results[56][36]="1.976567264789908E-8";
+        results[56][37]="7.936347185751581E-46";
+        results[56][38]="9.673448719794147E-14";
+        results[56][39]="8.458545437455212E-51";
+        results[56][40]="1.753881457824083E-18";
+        results[56][41]="1.354198700046664E-55";
+        results[56][42]="6.333920077629528E-24";
+        results[56][43]="2.442927955717607E-60";
+        results[56][44]="1.663870430445044E-28";
+        results[56][45]="2.142817371937639E-44";
+        results[56][46]="0.0001166676140131492";
+        results[56][47]="7.789691620439270E-50";
+        results[56][48]="9.660775630982277E-10";
+        results[56][49]="3.298985685643760E-54";
+        results[56][50]="3.255820927704967E-14";
+        results[56][51]="8.211456355686501E-60";
+        results[56][52]="5.834049958719679E-19";
+        results[56][53]="1.710450753551403E-64";
+        results[56][54]="2.379191419821972E-24";
+        results[56][55]="8.662915025323579E-49";
+        results[56][56]="1";
+        results[56][57]="8.689006048253338E-54";
+        results[56][58]="0.000007992871271614319";
+        results[56][59]="1.704916271051602E-58";
+        results[56][60]="4.128442171144841E-10";
+        results[56][61]="7.881302291277083E-64";
+        results[56][62]="2.951596168162563E-15";
+        results[56][63]="6.703339914156715E-69";
+        results[56][64]="3.084098958689342E-20";
+        results[56][65]="7.272899072816394E-53";
+        results[56][66]="6483.868250358015";
+        results[56][67]="2.347701170578040E-57";
+        results[56][68]="0.1383239369164440";
+        results[56][69]="1.042737739112631E-62";
+        results[56][70]="0.000001015614172938495";
+        results[56][71]="6.372474234748120E-68";
+        results[56][72]="2.475393192788476E-11";
+        results[56][73]="1.207514587345858E-72";
+        results[56][74]="6.913485406433592E-17";
+        results[57][0]="6.406885781574903E+29";
+        results[57][1]="1.408798001370755E+24";
+        results[57][2]="3.160887756637065E+19";
+        results[57][3]="368593988563342.1";
+        results[57][4]="2572668917.216598";
+        results[57][5]="8.026567406274776E+24";
+        results[57][6]="4.988144128246639E+33";
+        results[57][7]="7.697428081578381E+19";
+        results[57][8]="7.353464094256007E+27";
+        results[57][9]="717510293299212.7";
+        results[57][10]="2.618599060159830E+23";
+        results[57][11]="8694897050.180986";
+        results[57][12]="1.167488072414467E+18";
+        results[57][13]="109396.5074218388";
+        results[57][14]="8796287518974.268";
+        results[57][15]="9.449379117552936E+20";
+        results[57][16]="1.085545228853283E+37";
+        results[57][17]="1.118364188028252E+16";
+        results[57][18]="8.519492999037822E+31";
+        results[57][19]="72083753473.07911";
+        results[57][20]="2.883063439189447E+27";
+        results[57][21]="1344004.430472940";
+        results[57][22]="1.656319372562645E+22";
+        results[57][23]="14.73039567328003";
+        results[57][24]="8.773322225891460E+16";
+        results[57][25]="8.782679625475591E+16";
+        results[57][26]="2.352417049958506E+41";
+        results[57][27]="1023866214425.824";
+        results[57][28]="3.627955353728795E+36";
+        results[57][29]="17477563.14166077";
+        results[57][30]="8.176402449775297E+30";
+        results[57][31]="213.2501055578004";
+        results[57][32]="1.662305542775258E+26";
+        results[57][33]="0.0009175856718636401";
+        results[57][34]="4.397724033833556E+21";
+        results[57][35]="10795424423794.65";
+        results[57][36]="2.274790987384843E+45";
+        results[57][37]="91337802.52514549";
+        results[57][38]="1.113297501011488E+40";
+        results[57][39]="973.4767579262472";
+        results[57][40]="2.018506429946206E+35";
+        results[57][41]="0.01558519688588414";
+        results[57][42]="7.289579547366953E+29";
+        results[57][43]="2.811516003270229E-7";
+        results[57][44]="1.914914572742777E+25";
+        results[57][45]="2466124847.925947";
+        results[57][46]="1.342703795638417E+49";
+        results[57][47]="8964.997350882443";
+        results[57][48]="1.111838981044821E+44";
+        results[57][49]="0.3796735400255500";
+        results[57][50]="3.747057959937145E+39";
+        results[57][51]="9.450397790132930E-7";
+        results[57][52]="6.714289213658032E+34";
+        results[57][53]="1.968522917411524E-11";
+        results[57][54]="2.738162922904441E+29";
+        results[57][55]="99699.72373382105";
+        results[57][56]="1.150879622417825E+53";
+        results[57][57]="1";
+        results[57][58]="9.198832671109769E+47";
+        results[57][59]="0.00001962153394281874";
+        results[57][60]="4.751339967101001E+43";
+        results[57][61]="9.070430205145709E-11";
+        results[57][62]="3.396931883544830E+38";
+        results[57][63]="7.714737309343017E-16";
+        results[57][64]="3.549426645075597E+33";
+        results[57][65]="8.370231338805882";
+        results[57][66]="7.462151843778957E+56";
+        results[57][67]="0.0002701921436744741";
+        results[57][68]="1.591942002897441E+52";
+        results[57][69]="1.200065615470761E-9";
+        results[57][70]="1.168849655873646E+47";
+        results[57][71]="7.333950741154235E-15";
+        results[57][72]="2.848879583052055E+42";
+        results[57][73]="1.389703932348617E-19";
+        results[57][74]="7.956589474147437E+36";
+        results[58][0]="6.964890014465238E-19";
+        results[58][1]="1.531496497153692E-24";
+        results[58][2]="3.436183556816159E-29";
+        results[58][3]="4.006964815448415E-34";
+        results[58][4]="2.796734117467348E-39";
+        results[58][5]="8.725636929437082E-24";
+        results[58][6]="5.422583828394453E-15";
+        results[58][7]="8.367831394252054E-29";
+        results[58][8]="7.993910050511732E-21";
+        results[58][9]="7.800014620905704E-34";
+        results[58][10]="2.846664521232035E-25";
+        results[58][11]="9.452174380221672E-39";
+        results[58][12]="1.269169811166505E-30";
+        results[58][13]="1.189243367426543E-43";
+        results[58][14]="9.562395396755339E-36";
+        results[58][15]="1.027236765294149E-27";
+        results[58][16]="1.180090200208327E-11";
+        results[58][17]="1.215767508784710E-32";
+        results[58][18]="9.261493608634160E-17";
+        results[58][19]="7.836184878051788E-38";
+        results[58][20]="3.134162281529605E-21";
+        results[58][21]="1.461059765435212E-42";
+        results[58][22]="1.800575607560021E-26";
+        results[58][23]="1.601333147361503E-47";
+        results[58][24]="9.537429953960697E-32";
+        results[58][25]="9.547602331172774E-32";
+        results[58][26]="2.557299533609959E-7";
+        results[58][27]="1.113039285562200E-36";
+        results[58][28]="3.943930152271277E-12";
+        results[58][29]="1.899976199866263E-41";
+        results[58][30]="8.888521774566507E-18";
+        results[58][31]="2.318230075295776E-46";
+        results[58][32]="1.807083140011844E-22";
+        results[58][33]="9.975022969440973E-52";
+        results[58][34]="4.780741416946553E-27";
+        results[58][35]="1.173564604311067E-35";
+        results[58][36]="0.002472912671331814";
+        results[58][37]="9.929281876384678E-41";
+        results[58][38]="1.210259541417636E-8";
+        results[58][39]="1.058261186752084E-45";
+        results[58][40]="2.194307149738259E-13";
+        results[58][41]="1.694258113296445E-50";
+        results[58][42]="7.924461513753702E-19";
+        results[58][43]="3.056383460588637E-55";
+        results[58][44]="2.081693016068045E-23";
+        results[58][45]="2.680910650403675E-39";
+        results[58][46]="14.59645852517100";
+        results[58][47]="9.745798919724109E-45";
+        results[58][48]="0.0001208673992447659";
+        results[58][49]="4.127410005162593E-49";
+        results[58][50]="4.073405935195787E-9";
+        results[58][51]="1.027347504625585E-54";
+        results[58][52]="7.299066581290476E-14";
+        results[58][53]="2.139970350361897E-59";
+        results[58][54]="2.976641733579987E-19";
+        results[58][55]="1.083830169527293E-43";
+        results[58][56]="125111.4857249578";
+        results[58][57]="1.087094456170119E-48";
+        results[58][58]="1";
+        results[58][59]="2.133046077079208E-53";
+        results[58][60]="0.00005165155337615015";
+        results[58][61]="9.860414391091898E-59";
+        results[58][62]="3.692785818589105E-10";
+        results[58][63]="8.386648159795576E-64";
+        results[58][64]="3.858562028444187E-15";
+        results[58][65]="9.099232085277269E-48";
+        results[58][66]="811206390.0471738";
+        results[58][67]="2.937243814892411E-52";
+        results[58][68]="17305.91325894164";
+        results[58][69]="1.304584677618646E-57";
+        results[58][70]="0.1270649980996593";
+        results[58][71]="7.972697192533506E-63";
+        results[58][72]="0.000003097001201032130";
+        results[58][73]="1.510739440573996E-67";
+        results[58][74]="8.649564307367203E-12";
+        results[59][0]="3.265231862221327E+34";
+        results[59][1]="7.179856607930284E+28";
+        results[59][2]="1.610927955912394E+24";
+        results[59][3]="1.878517702221967E+19";
+        results[59][4]="131114566512174.5";
+        results[59][5]="4.090693128103987E+29";
+        results[59][6]="2.542178477372429E+38";
+        results[59][7]="3.922949196535957E+24";
+        results[59][8]="3.747649962375796E+32";
+        results[59][9]="3.656749239841227E+19";
+        results[59][10]="1.334553693809554E+28";
+        results[59][11]="443130342180164.7";
+        results[59][12]="5.950034670157650E+22";
+        results[59][13]="5575329010.496484";
+        results[59][14]="4.482976481149991E+17";
+        results[59][15]="4.815820794179703E+25";
+        results[59][16]="5.532417761102616E+41";
+        results[59][17]="5.699677666829715E+20";
+        results[59][18]="4.341909773142817E+36";
+        results[59][19]="3673706331174018";
+        results[59][20]="1.469336417627336E+32";
+        results[59][21]="68496399638.76680";
+        results[59][22]="8.441334797725325E+26";
+        results[59][23]="750725.9991093196";
+        results[59][24]="4.471272353863239E+21";
+        results[59][25]="4.476041297826234E+21";
+        results[59][26]="1.198895589312202E+46";
+        results[59][27]="5.218074271917703E+16";
+        results[59][28]="1.848966224710778E+41";
+        results[59][29]="890733782210.6083";
+        results[59][30]="4.167055681580780E+35";
+        results[59][31]="10868166.89150073";
+        results[59][32]="8.471842964059609E+30";
+        results[59][33]="46.76421703510423";
+        results[59][34]="2.241274329850788E+26";
+        results[59][35]="5.501824910965054E+17";
+        results[59][36]="1.159333920586464E+50";
+        results[59][37]="4654977678672.980";
+        results[59][38]="5.673855592818941E+44";
+        results[59][39]="49612673.54342235";
+        results[59][40]="1.028719994995578E+40";
+        results[59][41]="794.2904429033256";
+        results[59][42]="3.715091576739267E+34";
+        results[59][43]="0.01432872685419792";
+        results[59][44]="9.759250109207765E+29";
+        results[59][45]="125684610342532.4";
+        results[59][46]="6.843011354521704E+53";
+        results[59][47]="456895846.0132791";
+        results[59][48]="5.666422331123308E+48";
+        results[59][49]="19349.83988163200";
+        results[59][50]="1.909666171287554E+44";
+        results[59][51]="0.04816339954701486";
+        results[59][52]="3.421898223260666E+39";
+        results[59][53]="0.000001003246190205216";
+        results[59][54]="1.395488717081967E+34";
+        results[59][55]="5081138101.861297";
+        results[59][56]="5.865390676242383E+57";
+        results[59][57]="50964.41506123880";
+        results[59][58]="4.688131263293223E+52";
+        results[59][59]="1";
+        results[59][60]="2.421492621803881E+48";
+        results[59][61]="0.000004622691697590433";
+        results[59][62]="1.731226464477344E+43";
+        results[59][63]="3.931770743217822E-11";
+        results[59][64]="1.808944527690531E+38";
+        results[59][65]="426583.9441094915";
+        results[59][66]="3.803042038163392E+61";
+        results[59][67]="13.77018455651177";
+        results[59][68]="8.113239298908500E+56";
+        results[59][69]="0.00006116064212757286";
+        results[59][70]="5.956973900613066E+51";
+        results[59][71]="3.737705096108644E-10";
+        results[59][72]="1.451914815301539E+47";
+        results[59][73]="7.082544802045064E-15";
+        results[59][74]="4.055029284323338E+41";
+        results[60][0]="1.348437667255375E-14";
+        results[60][1]="2.965054092372860E-20";
+        results[60][2]="6.652623846164517E-25";
+        results[60][3]="7.757685013397121E-30";
+        results[60][4]="5.414617634246651E-35";
+        results[60][5]="1.689327108110964E-19";
+        results[60][6]="1.049839447984212E-10";
+        results[60][7]="1.620054160484525E-24";
+        results[60][8]="1.547661111428041E-16";
+        results[60][9]="1.510121982992930E-29";
+        results[60][10]="5.511285402205287E-21";
+        results[60][11]="1.829988405457360E-34";
+        results[60][12]="2.457176460742298E-26";
+        results[60][13]="2.302434853732143E-39";
+        results[60][14]="1.851327747515669E-31";
+        results[60][15]="1.988781940038362E-23";
+        results[60][16]="2.284713862551959E-7";
+        results[60][17]="2.353786922788046E-28";
+        results[60][18]="1.793071650950697E-12";
+        results[60][19]="1.517124726334002E-33";
+        results[60][20]="6.067895497169673E-17";
+        results[60][21]="2.828685044174972E-38";
+        results[60][22]="3.486004756618662E-22";
+        results[60][23]="3.100261352644838E-43";
+        results[60][24]="1.846494312475907E-27";
+        results[60][25]="1.848463735764689E-27";
+        results[60][26]="0.004951060261414672";
+        results[60][27]="2.154899926158156E-32";
+        results[60][28]="7.635646741444116E-8";
+        results[60][29]="3.678449292763319E-37";
+        results[60][30]="1.720862431732932E-13";
+        results[60][31]="4.488209789961917E-42";
+        results[60][32]="3.498603666092752E-18";
+        results[60][33]="1.931214516782934E-47";
+        results[60][34]="9.255755353824531E-23";
+        results[60][35]="2.272079981340803E-31";
+        results[60][36]="47.87683060222675";
+        results[60][37]="1.922358811568574E-36";
+        results[60][38]="0.0002343123221491472";
+        results[60][39]="2.048846777260200E-41";
+        results[60][40]="4.248288785737604E-9";
+        results[60][41]="3.280168751088831E-46";
+        results[60][42]="1.534215526112867E-14";
+        results[60][43]="5.917311795698881E-51";
+        results[60][44]="4.030262170254993E-19";
+        results[60][45]="5.190377588220942E-35";
+        results[60][46]="282594.7637793763";
+        results[60][47]="1.886835590161396E-40";
+        results[60][48]="2.340053519098534";
+        results[60][49]="7.990872946462834E-45";
+        results[60][50]="0.00007886318356258115";
+        results[60][51]="1.988996336942614E-50";
+        results[60][52]="1.413135928001109E-9";
+        results[60][53]="4.143090014694539E-55";
+        results[60][54]="5.762927809552455E-15";
+        results[60][55]="2.098349611355051E-39";
+        results[60][56]="2422221163.685803";
+        results[60][57]="2.104669434147318E-44";
+        results[60][58]="19360.50195272046";
+        results[60][59]="4.129684274053472E-49";
+        results[60][60]="1";
+        results[60][61]="1.909025720733676E-54";
+        results[60][62]="0.000007149418705177280";
+        results[60][63]="1.623697180745017E-59";
+        results[60][64]="7.470369768638670E-11";
+        results[60][65]="1.761657005552672E-43";
+        results[60][66]="15705362898567.62";
+        results[60][67]="5.686651461384062E-48";
+        results[60][68]="335051167.4433505";
+        results[60][69]="2.525741419852499E-53";
+        results[60][70]="2460.042143830875";
+        results[60][71]="1.543554195644939E-58";
+        results[60][72]="0.05995949780016016";
+        results[60][73]="2.924867388928466E-63";
+        results[60][74]="1.674599066629639E-7";
+        results[61][0]="7.063486115509977E+39";
+        results[61][1]="1.553176607402299E+34";
+        results[61][2]="3.484826722820572E+29";
+        results[61][3]="4.063688052571492E+24";
+        results[61][4]="2.836325134564299E+19";
+        results[61][5]="8.849158446444201E+34";
+        results[61][6]="5.499346795499110E+43";
+        results[61][7]="8.486287758668364E+29";
+        results[61][8]="8.107073124364424E+37";
+        results[61][9]="7.910432879932915E+24";
+        results[61][10]="2.886962361139478E+33";
+        results[61][11]="9.585980878005454E+19";
+        results[61][12]="1.287136382739755E+28";
+        results[61][13]="1206078487432465";
+        results[61][14]="9.697762200941783E+22";
+        results[61][15]="1.041778493835083E+31";
+        results[61][16]="1.196795746509847E+47";
+        results[61][17]="1.232978108793337E+26";
+        results[61][18]="9.392600798807385E+41";
+        results[61][19]="7.947115169045187E+20";
+        results[61][20]="3.178529985880788E+37";
+        results[61][21]="1.481742762003150E+16";
+        results[61][22]="1.826064844887958E+32";
+        results[61][23]="162400187644.0589";
+        results[61][24]="9.672443343331502E+26";
+        results[61][25]="9.682759722348257E+26";
+        results[61][26]="2.593501076303929E+51";
+        results[61][27]="1.128795648353017E+22";
+        results[61][28]="3.999761060584132E+46";
+        results[61][29]="1.926872567934611E+17";
+        results[61][30]="9.014349115587456E+40";
+        results[61][31]="2351047312362.565";
+        results[61][32]="1.832664499013753E+36";
+        results[61][33]="10116230.99578109";
+        results[61][34]="4.848418359846594E+31";
+        results[61][35]="1.190177773229581E+23";
+        results[61][36]="2.507919620057646E+55";
+        results[61][37]="1.006984238446915E+18";
+        results[61][38]="1.227392169756080E+50";
+        results[61][39]="10732421019831.98";
+        results[61][40]="2.225370113978822E+45";
+        results[61][41]="171824230.3109566";
+        results[61][42]="8.036641462972210E+39";
+        results[61][43]="3099.650115465570";
+        results[61][44]="2.111161796555619E+35";
+        results[61][45]="2.718862051908959E+19";
+        results[61][46]="1.480308833506809E+59";
+        results[61][47]="98837620136215.22";
+        results[61][48]="1.225784175500373E+54";
+        results[61][49]="4185838283.725054";
+        results[61][50]="4.131069723475097E+49";
+        results[61][51]="10418.90800810271";
+        results[61][52]="7.402393339457015E+44";
+        results[61][53]="0.2170264114148377";
+        results[61][54]="3.018779551769291E+39";
+        results[61][55]="1099173043382890";
+        results[61][56]="1.268825839997009E+63";
+        results[61][57]="11024835397.91414";
+        results[61][58]="1.014156160519400E+58";
+        results[61][59]="216324.1819741618";
+        results[61][60]="5.238274105681931E+53";
+        results[61][61]="1";
+        results[61][62]="3.745061487400818E+48";
+        results[61][63]="0.000008505370897365375";
+        results[61][64]="3.913184451892906E+43";
+        results[61][65]="92280422752.79732";
+        results[61][66]="8.226899579190449E+66";
+        results[61][67]="2978823.909820644";
+        results[61][68]="1.755089854497003E+62";
+        results[61][69]="13.23052587726166";
+        results[61][70]="1.288637506091553E+57";
+        results[61][71]="0.00008085559973763583";
+        results[61][72]="3.140842847162717E+52";
+        results[61][73]="1.532125710597750E-9";
+        results[61][74]="8.772008928125169E+46";
+        results[62][0]="1.886080145619249E-9";
+        results[62][1]="4.147265973142270E-15";
+        results[62][2]="9.305125522088941E-20";
+        results[62][3]="1.085079127870824E-24";
+        results[62][4]="7.573507522122931E-30";
+        results[62][5]="2.362887358782933E-14";
+        results[62][6]="0.00001468426303279687";
+        results[62][7]="2.265994239939194E-19";
+        results[62][8]="2.164736988067710E-11";
+        results[62][9]="2.112230441755173E-24";
+        results[62][10]="7.708718190213518E-16";
+        results[62][11]="2.559632441351024E-29";
+        results[62][12]="3.436889853664501E-21";
+        results[62][13]="3.220450429158424E-34";
+        results[62][14]="2.589480101613048E-26";
+        results[62][15]="2.781739358191706E-18";
+        results[62][16]="0.03195663810957770";
+        results[62][17]="3.292277344287504E-23";
+        results[62][18]="2.507996418858833E-7";
+        results[62][19]="2.122025284706531E-28";
+        results[62][20]="8.487257142703900E-12";
+        results[62][21]="3.956524524331703E-33";
+        results[62][22]="4.875927540926171E-17";
+        results[62][23]="4.336382411621481E-38";
+        results[62][24]="2.582719502969886E-22";
+        results[62][25]="2.585474165089977E-22";
+        results[62][26]="692.5122818487806";
+        results[62][27]="3.014091096102228E-27";
+        results[62][28]="0.01068009450322826";
+        results[62][29]="5.145102622258724E-32";
+        results[62][30]="2.406996292561188E-8";
+        results[62][31]="6.277726868495983E-37";
+        results[62][32]="4.893549826028827E-13";
+        results[62][33]="2.701218933204230E-42";
+        results[62][34]="1.294616490585723E-17";
+        results[62][35]="3.177992610357912E-26";
+        results[62][36]="6696604.657880305";
+        results[62][37]="2.688832324474842E-31";
+        results[62][38]="32.77361864111679";
+        results[62][39]="2.865752953840177E-36";
+        results[62][40]="0.0005942145733696068";
+        results[62][41]="4.588021608964494E-41";
+        results[62][42]="2.145930444669381E-9";
+        results[62][43]="8.276633443518753E-46";
+        results[62][44]="5.637188611343273E-14";
+        results[62][45]="7.259859580559060E-30";
+        results[62][46]="39526956726.52857";
+        results[62][47]="2.639145457790906E-35";
+        results[62][48]="327306.8224978871";
+        results[62][49]="1.117695476511428E-39";
+        results[62][50]="11.03071267954583";
+        results[62][51]="2.782039238382100E-45";
+        results[62][52]="0.0001976574580780646";
+        results[62][53]="5.795002622652810E-50";
+        results[62][54]="8.060694228719894E-10";
+        results[62][55]="2.934993316079701E-34";
+        results[62][56]="338799735135353.3";
+        results[62][57]="2.943832947737714E-39";
+        results[62][58]="2707982669.793906";
+        results[62][59]="5.776251810602371E-44";
+        results[62][60]="139871.5114105495";
+        results[62][61]="2.670183128806329E-49";
+        results[62][62]="1";
+        results[62][63]="2.271089787438537E-54";
+        results[62][64]="0.00001044891910335168";
+        results[62][65]="2.464056279536351E-38";
+        results[62][66]="2.196732845873822E+18";
+        results[62][67]="7.954005347687989E-43";
+        results[62][68]="46864113190170.53";
+        results[62][69]="3.532792698269964E-48";
+        results[62][70]="344089812.7912729";
+        results[62][71]="2.158992582889526E-53";
+        results[62][72]="8386.625580725921";
+        results[62][73]="4.091056223648521E-58";
+        results[62][74]="0.02342287024561831";
+        results[63][0]="8.304736149364119E+44";
+        results[63][1]="1.826112730584637E+39";
+        results[63][2]="4.097207241015242E+34";
+        results[63][3]="4.777790529781906E+29";
+        results[63][4]="3.334745972621699E+24";
+        results[63][5]="1.040420053778644E+40";
+        results[63][6]="6.465734254108293E+48";
+        results[63][7]="9.977563425596263E+34";
+        results[63][8]="9.531710283058522E+42";
+        results[63][9]="9.300514904509633E+29";
+        results[63][10]="3.394281561588036E+38";
+        results[63][11]="1.127050306645041E+25";
+        results[63][12]="1.513321874227095E+33";
+        results[63][13]="1.418019862962190E+20";
+        results[63][14]="1.140192746202962E+28";
+        results[63][15]="1.224847812524888E+36";
+        results[63][16]="1.407105887505231E+52";
+        results[63][17]="1.449646492400778E+31";
+        results[63][18]="1.104314075441065E+47";
+        results[63][19]="9.343643287216183E+25";
+        results[63][20]="3.737085688838532E+42";
+        results[63][21]="1.742125981198698E+21";
+        results[63][22]="2.146954985177189E+37";
+        results[63][23]="1.909383959897199E+16";
+        results[63][24]="1.137215938028950E+32";
+        results[63][25]="1.138428863266573E+32";
+        results[63][26]="3.049251005746606E+56";
+        results[63][27]="1.327156289801157E+27";
+        results[63][28]="4.702629795748353E+51";
+        results[63][29]="2.265477415607447E+22";
+        results[63][30]="1.059841978011769E+46";
+        results[63][31]="2.764191404152434E+17";
+        results[63][32]="2.154714381216979E+41";
+        results[63][33]="1189393280769.765";
+        results[63][34]="5.700419674053768E+36";
+        results[63][35]="1.399324953128441E+28";
+        results[63][36]="2.948630518669679E+60";
+        results[63][37]="1.183939243330163E+23";
+        results[63][38]="1.443078949251087E+55";
+        results[63][39]="1.261840447564310E+18";
+        results[63][40]="2.616429243159934E+50";
+        results[63][41]="20201850381878.22";
+        results[63][42]="9.448901829150850E+44";
+        results[63][43]="364434444.1728835";
+        results[63][44]="2.482151362981211E+40";
+        results[63][45]="3.196641374864857E+24";
+        results[63][46]="1.740440071773177E+64";
+        results[63][47]="1.162061259043167E+19";
+        results[63][48]="1.441188385893991E+59";
+        results[63][49]="492140593777240.2";
+        results[63][50]="4.857013025445766E+54";
+        results[63][51]="1224979854.944370";
+        results[63][52]="8.703198753801531E+49";
+        results[63][53]="25516.39593777902";
+        results[63][54]="3.549262681424497E+44";
+        results[63][55]="1.292328173158645E+20";
+        results[63][56]="1.491793662272907E+68";
+        results[63][57]="1296220415423529";
+        results[63][58]="1.192371470635743E+63";
+        results[63][59]="25433832878.60738";
+        results[63][60]="6.158783865974074E+58";
+        results[63][61]="117572.7680858409";
+        results[63][62]="4.403172457253908E+53";
+        results[63][63]="1";
+        results[63][64]="4.600839280395232E+48";
+        results[63][65]="1.084966474317800E+16";
+        results[63][66]="9.672593562896609E+71";
+        results[63][67]="350228572717.9005";
+        results[63][68]="2.063507724325885E+67";
+        results[63][69]="1555549.550621002";
+        results[63][70]="1.515086786504186E+62";
+        results[63][71]="9.506416676394638";
+        results[63][72]="3.692775876635344E+57";
+        results[63][73]="0.0001801362608504635";
+        results[63][74]="1.031349371353387E+52";
+        results[64][0]="0.0001805048088671923";
+        results[64][1]="3.969086115148465E-10";
+        results[64][2]="8.905347462307516E-15";
+        results[64][3]="1.038460645678428E-19";
+        results[64][4]="7.248125329722949E-25";
+        results[64][5]="2.261370133514570E-9";
+        results[64][6]="1.405337995973826";
+        results[64][7]="2.168639854061398E-14";
+        results[64][8]="0.000002071732938743234";
+        results[64][9]="2.021482242194446E-19";
+        results[64][10]="7.377526913516641E-11";
+        results[64][11]="2.449662415828232E-24";
+        results[64][12]="3.289230033910451E-16";
+        results[64][13]="3.082089541802851E-29";
+        results[64][14]="2.478227724801148E-21";
+        results[64][15]="2.662226906608371E-13";
+        results[64][16]="3058.367836279547";
+        results[64][17]="3.150830542109802E-18";
+        results[64][18]="0.02400244842602282";
+        results[64][19]="2.030856267253379E-23";
+        results[64][20]="8.122617333673738E-7";
+        results[64][21]="3.786539531215795E-28";
+        results[64][22]="4.666442043141217E-12";
+        results[64][23]="4.150077504409531E-33";
+        results[64][24]="2.471757583175691E-17";
+        results[64][25]="2.474393896169260E-17";
+        results[64][26]="66275973.14124528";
+        results[64][27]="2.884596068061627E-22";
+        results[64][28]="1022.124336267703";
+        results[64][29]="4.924052498988474E-27";
+        results[64][30]="0.002303584005917990";
+        results[64][31]="6.008015572139217E-32";
+        results[64][32]="4.683307218312307E-8";
+        results[64][33]="2.585165897530746E-37";
+        results[64][34]="1.238995610723459E-12";
+        results[64][35]="3.041455847178024E-21";
+        results[64][36]="640889702718.8438";
+        results[64][37]="2.573311457270591E-26";
+        results[64][38]="3136555.878837656";
+        results[64][39]="2.742631008523106E-31";
+        results[64][40]="56.86852080029998";
+        results[64][41]="4.390905474129667E-36";
+        results[64][42]="0.0002053734384814057";
+        results[64][43]="7.921042704660115E-41";
+        results[64][44]="5.394996894497005E-9";
+        results[64][45]="6.947952710467755E-25";
+        results[64][46]="3782875179294822";
+        results[64][47]="2.525759297863022E-30";
+        results[64][48]="31324467082.23605";
+        results[64][49]="1.069675691290314E-34";
+        results[64][50]="1055679.785673480";
+        results[64][51]="2.662513902983238E-40";
+        results[64][52]="18.91654592432077";
+        results[64][53]="5.546030709333330E-45";
+        results[64][54]="0.00007714380931645150";
+        results[64][55]="2.808896582554887E-29";
+        results[64][56]="3.242438110432659E+19";
+        results[64][57]="2.817356435263650E-34";
+        results[64][58]="259163904228646.2";
+        results[64][59]="5.528085492354452E-39";
+        results[64][60]="13386218232.43738";
+        results[64][61]="2.555463490907705E-44";
+        results[64][62]="95703.67902257296";
+        results[64][63]="2.173516480484612E-49";
+        results[64][64]="1";
+        results[64][65]="2.358192512703023E-33";
+        results[64][66]="2.102354151798515E+23";
+        results[64][67]="7.612275747389602E-38";
+        results[64][68]="4.485068046429608E+18";
+        results[64][69]="3.381012584485181E-43";
+        results[64][70]="32930660998313.20";
+        results[64][71]="2.066235331649750E-48";
+        results[64][72]="802630922.6602931";
+        results[64][73]="3.915291316913575E-53";
+        results[64][74]="2241.654855774030";
+        results[65][0]="7.654371214175933E+28";
+        results[65][1]="1.683105214594628E+23";
+        results[65][2]="3.776344558103940E+18";
+        results[65][3]="44036296446727.19";
+        results[65][4]="307359356.4002524";
+        results[65][5]="9.589421225506852E+23";
+        results[65][6]="5.959386218061519E+32";
+        results[65][7]="9.196195146831527E+18";
+        results[65][8]="8.785257893845823E+26";
+        results[65][9]="85721680113273.25";
+        results[65][10]="3.128466770111285E+22";
+        results[65][11]="1038788140.761402";
+        results[65][12]="1.394809802928366E+17";
+        results[65][13]="13069.71133696832";
+        results[65][14]="1050901362569.648";
+        results[65][15]="1.128926876100059E+20";
+        results[65][16]="1.296911859318036E+36";
+        results[65][17]="1336121001630285";
+        results[65][18]="1.017832441445189E+31";
+        results[65][19]="8611918901.080548";
+        results[65][20]="3.444425037361932E+26";
+        results[65][21]="160569.5680407179";
+        results[65][22]="1.978821499094838E+21";
+        results[65][23]="1.759855262899042";
+        results[65][24]="1.048157675788096E+16";
+        results[65][25]="1.049275613776351E+16";
+        results[65][26]="2.810456431535270E+40";
+        results[65][27]="122322331723.2581";
+        results[65][28]="4.334354938206963E+35";
+        results[65][29]="2088062.137617592";
+        results[65][30]="9.768430666746378E+29";
+        results[65][31]="25.47720569790407";
+        results[65][32]="1.985973237165517E+25";
+        results[65][33]="0.0001096248878581826";
+        results[65][34]="5.254005362366659E+20";
+        results[65][35]="1289740269632.112";
+        results[65][36]="2.717715789811575E+44";
+        results[65][37]="10912219.60636705";
+        results[65][38]="1.330067779429277E+39";
+        results[65][39]="116.3022524136263";
+        results[65][40]="2.411530038110238E+34";
+        results[65][41]="0.001861979227937033";
+        results[65][42]="8.708934379831493E+28";
+        results[65][43]="3.358946592354670E-8";
+        results[65][44]="2.287767799039069E+24";
+        results[65][45]="294630428.7305122";
+        results[65][46]="1.604141798821501E+48";
+        results[65][47]="1071.057296746282";
+        results[65][48]="1.328325270880074E+43";
+        results[65][49]="0.04535998166087906";
+        results[65][50]="4.476648025921479E+38";
+        results[65][51]="1.129048577943026E-7";
+        results[65][52]="8.021629202205431E+33";
+        results[65][53]="2.351814230372703E-12";
+        results[65][54]="3.271310925672783E+28";
+        results[65][55]="11911.22678671919";
+        results[65][56]="1.374967519812914E+52";
+        results[65][57]="0.1194710109580630";
+        results[65][58]="1.098993838851543E+47";
+        results[65][59]="0.000002344204496696504";
+        results[65][60]="5.676473892750065E+42";
+        results[65][61]="1.083653466433309E-11";
+        results[65][62]="4.058348862827780E+37";
+        results[65][63]="9.216874656230971E-17";
+        results[65][64]="4.240535896086675E+32";
+        results[65][65]="1";
+        results[65][66]="8.915108246988459E+55";
+        results[65][67]="0.00003228012855771563";
+        results[65][68]="1.901909204727609E+51";
+        results[65][69]="1.433730522963019E-10";
+        results[65][70]="1.396436500452086E+46";
+        results[65][71]="8.761945093623320E-16";
+        results[65][72]="3.403585238850141E+41";
+        results[65][73]="1.660293337300849E-20";
+        results[65][74]="9.505817882546773E+35";
+        results[66][0]="8.585842148087876E-28";
+        results[66][1]="1.887924597172652E-33";
+        results[66][2]="4.235893108061360E-38";
+        results[66][3]="4.939513377372926E-43";
+        results[66][4]="3.447623381399535E-48";
+        results[66][5]="1.075637104994903E-32";
+        results[66][6]="6.684592102484691E-24";
+        results[66][7]="1.031529275030174E-37";
+        results[66][8]="9.854347979244672E-30";
+        results[66][9]="9.615326896589304E-43";
+        results[66][10]="3.509174183238983E-34";
+        results[66][11]="1.165199694700630E-47";
+        results[66][12]="1.564546121354764E-39";
+        results[66][13]="1.466018243960560E-52";
+        results[66][14]="1.178786991088576E-44";
+        results[66][15]="1.266307536401941E-36";
+        results[66][16]="1.454734842682516E-20";
+        results[66][17]="1.498715399312880E-41";
+        results[66][18]="1.141693867585976E-25";
+        results[66][19]="9.659915126649943E-47";
+        results[66][20]="3.863581845487368E-30";
+        results[66][21]="1.801094990573543E-51";
+        results[66][22]="2.219627002020180E-35";
+        results[66][23]="1.974014464146888E-56";
+        results[66][24]="1.175709421298576E-40";
+        results[66][25]="1.176963402694295E-40";
+        results[66][26]="3.152464730290456E-16";
+        results[66][27]="1.372079040819037E-45";
+        results[66][28]="4.861808536840948E-21";
+        results[66][29]="2.342161283709532E-50";
+        results[66][30]="1.095716439567200E-26";
+        results[66][31]="2.857756181088471E-55";
+        results[66][32]="2.227649044907988E-31";
+        results[66][33]="1.229652908535508E-60";
+        results[66][34]="5.893372482764269E-36";
+        results[66][35]="1.446690532409171E-44";
+        results[66][36]="3.048438352646615E-12";
+        results[66][37]="1.224014258049331E-49";
+        results[66][38]="1.491925552197951E-17";
+        results[66][39]="1.304552330622721E-54";
+        results[66][40]="2.704992436771430E-22";
+        results[66][41]="2.088566034591912E-59";
+        results[66][42]="9.768736552103434E-28";
+        results[66][43]="3.767701411241225E-64";
+        results[66][44]="2.566169401041071E-32";
+        results[66][45]="3.304844097995546E-48";
+        results[66][46]="1.799352015005968E-8";
+        results[66][47]="1.201395728546636E-53";
+        results[66][48]="1.489970995392888E-13";
+        results[66][49]="5.087990005752511E-58";
+        results[66][50]="5.021417465608115E-18";
+        results[66][51]="1.266444048309139E-63";
+        results[66][52]="8.997792264513616E-23";
+        results[66][53]="2.638009730467547E-68";
+        results[66][54]="3.669401240055428E-28";
+        results[66][55]="1.336072031513787E-52";
+        results[66][56]="0.0001542289203585813";
+        results[66][57]="1.340096021811295E-57";
+        results[66][58]="1.232731906786197E-9";
+        results[66][59]="2.629473957860669E-62";
+        results[66][60]="6.367251788185060E-14";
+        results[66][61]="1.215524743403277E-67";
+        results[66][62]="4.552214903502375E-19";
+        results[66][63]="1.033848877756975E-72";
+        results[66][64]="4.756572526776819E-24";
+        results[66][65]="1.121691371877399E-56";
+        results[66][66]="1";
+        results[66][67]="3.620834168628286E-61";
+        results[66][68]="0.00002133355145037165";
+        results[66][69]="1.608203157204890E-66";
+        results[66][70]="1.566370773931775E-10";
+        results[66][71]="9.828198212380789E-72";
+        results[66][72]="3.817772195867480E-15";
+        results[66][73]="1.862336711235894E-76";
+        results[66][74]="1.066259390149060E-20";
+        results[67][0]="2.371233187776874E+33";
+        results[67][1]="5.214059825026099E+27";
+        results[67][2]="1.169866641439169E+23";
+        results[67][3]="1.364192102518798E+18";
+        results[67][4]="9521627395340.313";
+        results[67][5]="2.970688672556348E+28";
+        results[67][6]="1.846146990216091E+37";
+        results[67][7]="2.848871909041218E+23";
+        results[67][8]="2.721568434319621E+31";
+        results[67][9]="2.655555722462696E+18";
+        results[67][10]="9.691618063161386E+26";
+        results[67][11]="32180421428746.45";
+        results[67][12]="4.320954919477782E+21";
+        results[67][13]="404884116.6663938";
+        results[67][14]="3.255567463712780E+16";
+        results[67][15]="3.497281226998773E+24";
+        results[67][16]="4.017678730737416E+40";
+        results[67][17]="4.139143991453913E+19";
+        results[67][18]="3.153123878132466E+35";
+        results[67][19]="266787007544990.6";
+        results[67][20]="1.067041920605562E+31";
+        results[67][21]="4974254292.501521";
+        results[67][22]="6.130153712234388E+25";
+        results[67][23]="54518.22348701272";
+        results[67][24]="3.247067848301876E+20";
+        results[67][25]="3.250531087260965E+20";
+        results[67][26]="8.706459847302905E+44";
+        results[67][27]="3789400389299890";
+        results[67][28]="1.342731622167273E+40";
+        results[67][29]="64685682211.09210";
+        results[67][30]="3.026143668938864E+34";
+        results[67][31]="789253.5388250330";
+        results[67][32]="6.152308946399247E+29";
+        results[67][33]="3.396048676267737";
+        results[67][34]="1.627628388459699E+25";
+        results[67][35]="3.995461998628989E+16";
+        results[67][36]="8.419160366577858E+48";
+        results[67][37]="338047588219.9918";
+        results[67][38]="4.120391828834159E+43";
+        results[67][39]="3602905.490468613";
+        results[67][40]="7.470633314853486E+38";
+        results[67][41]="57.68190249329044";
+        results[67][42]="2.697924317203462E+33";
+        results[67][43]="0.001040561714724588";
+        results[67][44]="7.087232614171990E+28";
+        results[67][45]="9127300351475.501";
+        results[67][46]="4.969440552113530E+52";
+        results[67][47]="33180081.51148695";
+        results[67][48]="4.114993744541877E+47";
+        results[67][49]="1405.198296524041";
+        results[67][50]="1.386812328803897E+43";
+        results[67][51]="0.003497658244837316";
+        results[67][52]="2.485005345583759E+38";
+        results[67][53]="7.285640842996488E-8";
+        results[67][54]="1.013413227219280E+33";
+        results[67][55]="368995642.7968486";
+        results[67][56]="4.259485885734702E+56";
+        results[67][57]="3701.069862359855";
+        results[67][58]="3.404552236793557E+51";
+        results[67][59]="0.07262066792903739";
+        results[67][60]="1.758504115806338E+47";
+        results[67][61]="3.357029587090330E-7";
+        results[67][62]="1.257228221867707E+42";
+        results[67][63]="2.855278175163260E-12";
+        results[67][64]="1.313667598474634E+37";
+        results[67][65]="30978.81094903443";
+        results[67][66]="2.761794529736332E+60";
+        results[67][67]="1";
+        results[67][68]="5.891888569548503E+55";
+        results[67][69]="0.000004441526682273164";
+        results[67][70]="4.325994234983640E+50";
+        results[67][71]="2.714346406011766E-11";
+        results[67][72]="1.054390236632627E+46";
+        results[67][73]="5.143391341618445E-16";
+        results[67][74]="2.944789350993672E+40";
+        results[68][0]="4.024572358737908E-23";
+        results[68][1]="8.849556069295544E-29";
+        results[68][2]="1.985554593624666E-33";
+        results[68][3]="2.315373222720905E-38";
+        results[68][4]="1.616056937083241E-43";
+        results[68][5]="5.041997379091630E-28";
+        results[68][6]="3.133370511719575E-19";
+        results[68][7]="4.835244040026928E-33";
+        results[68][8]="4.619178387700187E-25";
+        results[68][9]="4.507138400728770E-38";
+        results[68][10]="1.644908580459467E-29";
+        results[68][11]="5.461817725994849E-43";
+        results[68][12]="7.333734962012186E-35";
+        results[68][13]="6.871890258736175E-48";
+        results[68][14]="5.525507526633783E-40";
+        results[68][15]="5.935755888314043E-32";
+        results[68][16]="6.818999856009313E-16";
+        results[68][17]="7.025156607418828E-37";
+        results[68][18]="5.351635287926178E-21";
+        results[68][19]="4.528038919877851E-42";
+        results[68][20]="1.811035473617807E-25";
+        results[68][21]="8.442546449724692E-47";
+        results[68][22]="1.040439519497590E-30";
+        results[68][23]="9.253098194827277E-52";
+        results[68][24]="5.511081565737588E-36";
+        results[68][25]="5.516959543432190E-36";
+        results[68][26]="1.477702733941909E-11";
+        results[68][27]="6.431554746104564E-41";
+        results[68][28]="2.278949451126784E-16";
+        results[68][29]="1.097876876786368E-45";
+        results[68][30]="5.136118297584773E-22";
+        results[68][31]="1.339559513912385E-50";
+        results[68][32]="1.044199813655115E-26";
+        results[68][33]="5.763939076885797E-56";
+        results[68][34]="2.762490106944477E-31";
+        results[68][35]="6.781292537131541E-40";
+        results[68][36]="1.428940867974192E-7";
+        results[68][37]="5.737508172967645E-45";
+        results[68][38]="6.993329524475215E-13";
+        results[68][39]="6.115026528318585E-50";
+        results[68][40]="1.267952240893443E-17";
+        results[68][41]="9.790053191333628E-55";
+        results[68][42]="4.579048441525779E-23";
+        results[68][43]="1.766091979577825E-59";
+        results[68][44]="1.202879608212802E-27";
+        results[68][45]="1.549129832266147E-43";
+        results[68][46]="0.0008434376335284867";
+        results[68][47]="5.631484899930744E-49";
+        results[68][48]="6.984167633124823E-9";
+        results[68][49]="2.384970930690432E-53";
+        results[68][50]="2.353765371550753E-13";
+        results[68][51]="5.936395781336616E-59";
+        results[68][52]="4.217672001516121E-18";
+        results[68][53]="1.236554418332251E-63";
+        results[68][54]="1.720014245444119E-23";
+        results[68][55]="6.262773615644344E-48";
+        results[68][56]="7.229406726646745";
+        results[68][57]="6.281635877311693E-53";
+        results[68][58]="0.00005778371733623009";
+        results[68][59]="1.232553315830994E-57";
+        results[68][60]="2.984618760264661E-9";
+        results[68][61]="5.697713979929495E-63";
+        results[68][62]="2.133828919245919E-14";
+        results[68][63]="4.846117066640417E-68";
+        results[68][64]="2.229620575759295E-19";
+        results[68][65]="5.257874547924172E-52";
+        results[68][66]="46874.52074382950";
+        results[68][67]="1.697248663473332E-56";
+        results[68][68]="1";
+        results[68][69]="7.538375225269271E-62";
+        results[68][70]="0.000007342287933519324";
+        results[68][71]="4.606920809807113E-67";
+        results[68][72]="1.789562419904057E-10";
+        results[68][73]="8.729614080282214E-72";
+        results[68][74]="4.998039790184512E-16";
+        results[69][0]="5.338779562533849E+38";
+        results[69][1]="1.173934144274364E+33";
+        results[69][2]="2.633929108448886E+28";
+        results[69][3]="3.071448625904928E+23";
+        results[69][4]="2.143773543755267E+18";
+        results[69][5]="6.688440450921611E+33";
+        results[69][6]="4.156559494698874E+42";
+        results[69][7]="6.414172677182188E+28";
+        results[69][8]="6.127551693389194E+36";
+        results[69][9]="5.978925519149620E+23";
+        results[69][10]="2.182046570122424E+32";
+        results[69][11]="7.245351369200056E+18";
+        results[69][12]="9.728535318099962E+26";
+        results[69][13]="91158771663435.09";
+        results[69][14]="7.329838806791966E+21";
+        results[69][15]="7.874052048267494E+29";
+        results[69][16]="9.045715624703119E+45";
+        results[69][17]="9.319191997593739E+24";
+        results[69][18]="7.099189318657215E+40";
+        results[69][19]="6.006651015061551E+19";
+        results[69][20]="2.402421502642987E+36";
+        results[69][21]="1119942454101324";
+        results[69][22]="1.380190675584772E+31";
+        results[69][23]="12274658554.81710";
+        results[69][24]="7.310702108942491E+25";
+        results[69][25]="7.318499515570511E+25";
+        results[69][26]="1.960240356553922E+50";
+        results[69][27]="8.531751941115174E+20";
+        results[69][28]="3.023130824647137E+45";
+        results[69][29]="1.456383960705739E+16";
+        results[69][30]="6.813296160116931E+39";
+        results[69][31]="177698704811.3589";
+        results[69][32]="1.385178878009241E+35";
+        results[69][33]="764612.9178559042";
+        results[69][34]="3.664569651142300E+30";
+        results[69][35]="8.995695139186061E+21";
+        results[69][36]="1.895555508014859E+54";
+        results[69][37]="7.611067373954845E+16";
+        results[69][38]="9.276971914362904E+48";
+        results[69][39]="811186276297.3776";
+        results[69][40]="1.681996720782961E+44";
+        results[69][41]="12986953.95065576";
+        results[69][42]="6.074317481804861E+38";
+        results[69][43]="234.2801899350586";
+        results[69][44]="1.595674893152901E+34";
+        results[69][45]="2.054991673899878E+18";
+        results[69][46]="1.118858651001097E+58";
+        results[69][47]="7470422646319.768";
+        results[69][48]="9.264818245864578E+52";
+        results[69][49]="316377317.3157802";
+        results[69][50]="3.122377569719179E+48";
+        results[69][51]="787.4900895669555";
+        results[69][52]="5.594935082798914E+43";
+        results[69][53]="0.01640346071109881";
+        results[69][54]="2.281677674624746E+38";
+        results[69][55]="83078560412474.54";
+        results[69][56]="9.590139135570173E+61";
+        results[69][57]="833287769.5256027";
+        results[69][58]="7.665274758748302E+56";
+        results[69][59]="16350.38425388234";
+        results[69][60]="3.959233483443444E+52";
+        results[69][61]="0.07558278554283523";
+        results[69][62]="2.830621792469476E+47";
+        results[69][63]="6.428596244978392E-7";
+        results[69][64]="2.957693812169788E+42";
+        results[69][65]="6974811402.726853";
+        results[69][66]="6.218119865763931E+65";
+        results[69][67]="225147.8087458437";
+        results[69][68]="1.326545800808529E+61";
+        results[69][69]="1";
+        results[69][70]="9.739881226537191E+55";
+        results[69][71]="0.000006111291454907054";
+        results[69][72]="2.373936513408476E+51";
+        results[69][73]="1.158023290087738E-10";
+        results[69][74]="6.630128695943206E+45";
+        results[70][0]="5.481360027253576E-18";
+        results[70][1]="1.205285893092693E-23";
+        results[70][2]="2.704272308036475E-28";
+        results[70][3]="3.153476469031765E-33";
+        results[70][4]="2.201026371773776E-38";
+        results[70][5]="6.867065722216763E-23";
+        results[70][6]="4.267566922042078E-14";
+        results[70][7]="6.585473198283149E-28";
+        results[70][8]="6.291197552485674E-20";
+        results[70][9]="6.138602083626537E-33";
+        results[70][10]="2.240321539216762E-24";
+        results[70][11]="7.438849818270307E-38";
+        results[70][12]="9.988351081318820E-30";
+        results[70][13]="9.359330934659115E-43";
+        results[70][14]="7.525593625126715E-35";
+        results[70][15]="8.084340933043336E-27";
+        results[70][16]="9.287295619229160E-11";
+        results[70][17]="9.568075606715566E-32";
+        results[70][18]="7.288784281388184E-16";
+        results[70][19]="6.167068032304013E-37";
+        results[70][20]="2.466581929251223E-20";
+        results[70][21]="1.149852270323317E-41";
+        results[70][22]="1.417050827913914E-25";
+        results[70][23]="1.260247252438118E-46";
+        results[70][24]="7.505945851807534E-31";
+        results[70][25]="7.513951500384414E-31";
+        results[70][26]="0.000002012591643533670";
+        results[70][27]="8.759605730991504E-36";
+        results[70][28]="3.103868265262150E-11";
+        results[70][29]="1.495278973975256E-40";
+        results[70][30]="6.995255898556019E-17";
+        results[70][31]="1.824444268654967E-45";
+        results[70][32]="1.422172248091892E-21";
+        results[70][33]="7.850331026344006E-51";
+        results[70][34]="3.762437719628292E-26";
+        results[70][35]="9.235939258352015E-35";
+        results[70][36]="0.01946179284866684";
+        results[70][37]="7.814332841367511E-40";
+        results[70][38]="9.524727970077244E-8";
+        results[70][39]="8.328502755118070E-45";
+        results[70][40]="1.726917075949764E-12";
+        results[70][41]="1.333379088368309E-49";
+        results[70][42]="6.236541637956356E-18";
+        results[70][43]="2.405370091133565E-54";
+        results[70][44]="1.638289888797966E-22";
+        results[70][45]="2.109873443118451E-38";
+        results[70][46]="114.8739522564880";
+        results[70][47]="7.669931976137371E-44";
+        results[70][48]="0.0009512249718838192";
+        results[70][49]="3.248266687829637E-48";
+        results[70][50]="3.205765550006891E-8";
+        results[70][51]="8.085212450243923E-54";
+        results[70][52]="5.744356581633671E-13";
+        results[70][53]="1.684154080483660E-58";
+        results[70][54]="2.342613448311986E-18";
+        results[70][55]="8.529730340665701E-43";
+        results[70][56]="984625.8812110530";
+        results[70][57]="8.555420237109612E-48";
+        results[70][58]="7.869987919219759";
+        results[70][59]="1.678704685775246E-52";
+        results[70][60]="0.0004064971010792362";
+        results[70][61]="7.760134213639389E-58";
+        results[70][62]="2.906217978056231E-9";
+        results[70][63]="6.600281970033780E-63";
+        results[70][64]="3.036683654941584E-14";
+        results[70][65]="7.161084658530892E-47";
+        results[70][66]="6384184489.665129";
+        results[70][67]="2.311607333900624E-51";
+        results[70][68]="136197.3282789357";
+        results[70][69]="1.026706565245795E-56";
+        results[70][70]="1";
+        results[70][71]="6.274503058883598E-62";
+        results[70][72]="0.00002437336203793195";
+        results[70][73]="1.188950114640616E-66";
+        results[70][74]="6.807196660549431E-11";
+        results[71][0]="8.735926934473208E+43";
+        results[71][1]="1.920926457094031E+38";
+        results[71][2]="4.309938624075892E+33";
+        results[71][3]="5.025858525269176E+28";
+        results[71][4]="3.507889550962140E+23";
+        results[71][5]="1.094439775990578E+39";
+        results[71][6]="6.801442093489699E+47";
+        results[71][7]="1.049560919244317E+34";
+        results[71][8]="1.002660687778045E+42";
+        results[71][9]="9.783407587849290E+28";
+        results[71][10]="3.570516291397545E+37";
+        results[71][11]="1.185567964261042E+24";
+        results[71][12]="1.591895164857249E+32";
+        results[71][13]="1.491644971215360E+19";
+        results[71][14]="1.199392773340319E+27";
+        results[71][15]="1.288443221267910E+35";
+        results[71][16]="1.480164330477132E+51";
+        results[71][17]="1.524913689087910E+30";
+        results[71][18]="1.161651243610208E+46";
+        results[71][19]="9.828775242323811E+24";
+        results[71][20]="3.931119175659616E+41";
+        results[71][21]="1.832579025832696E+20";
+        results[71][22]="2.258427184775404E+36";
+        results[71][23]="2008521217714331";
+        results[71][24]="1.196261406101385E+31";
+        results[71][25]="1.197537307714907E+31";
+        results[71][26]="3.207571379990312E+55";
+        results[71][27]="1.396063664131845E+26";
+        results[71][28]="4.946795365519211E+50";
+        results[71][29]="2.383103426586433E+21";
+        results[71][30]="1.114870107307058E+45";
+        results[71][31]="2.907711178930534E+16";
+        results[71][32]="2.266589456958420E+40";
+        results[71][33]="125114785229.5539";
+        results[71][34]="5.996391561721113E+35";
+        results[71][35]="1.471979401663617E+27";
+        results[71][36]="3.101726569582645E+59";
+        results[71][37]="1.245410635397457E+22";
+        results[71][38]="1.518005152072067E+54";
+        results[71][39]="1.327356553492530E+17";
+        results[71][40]="2.752277048466415E+49";
+        results[71][41]="2125075206522.494";
+        results[71][42]="9.939498920359126E+43";
+        results[71][43]="38335627.03787325";
+        results[71][44]="2.611027317101128E+39";
+        results[71][45]="3.362614414748335E+23";
+        results[71][46]="1.830805582186251E+63";
+        results[71][47]="1.222396722761668E+18";
+        results[71][48]="1.516016428642984E+58";
+        results[71][49]="51769305988793.17";
+        results[71][50]="5.109194337658483E+53";
+        results[71][51]="128858211.9471067";
+        results[71][52]="9.155078143600022E+48";
+        results[71][53]="2684.123451177847";
+        results[71][54]="3.733544196771496E+43";
+        results[71][55]="1.359427234414859E+19";
+        results[71][56]="1.569249185107967E+67";
+        results[71][57]="136352156606197.4";
+        results[71][58]="1.254280672965365E+62";
+        results[71][59]="2675438469.025040";
+        results[71][60]="6.478554512834406E+57";
+        results[71][61]="12367.72719817611";
+        results[71][62]="4.631789881656898E+52";
+        results[71][63]="0.1051921069779213";
+        results[71][64]="4.839719777715578E+47";
+        results[71][65]="1141299094338961";
+        results[71][66]="1.017480496822173E+71";
+        results[71][67]="36841281488.06609";
+        results[71][68]="2.170647252870554E+66";
+        results[71][69]="163631.5347383819";
+        results[71][70]="1.593751713267834E+61";
+        results[71][71]="1";
+        results[71][72]="3.884508750605123E+56";
+        results[71][73]="0.00001894891282198470";
+        results[71][74]="1.084898134030173E+51";
+        results[72][0]="2.248914211639332E-13";
+        results[72][1]="4.945094941013564E-19";
+        results[72][2]="1.109519607441867E-23";
+        results[72][3]="1.293820878762663E-28";
+        results[72][4]="9.030458614401850E-34";
+        results[72][5]="2.817447060249479E-18";
+        results[72][6]="1.750914344685201E-9";
+        results[72][7]="2.701914158594232E-23";
+        results[72][8]="2.581177575212958E-15";
+        results[72][9]="2.518570098812429E-28";
+        results[72][10]="9.191680391610227E-20";
+        results[72][11]="3.052040915280100E-33";
+        results[72][12]="4.098060442286985E-25";
+        results[72][13]="3.839983552574039E-38";
+        results[72][14]="3.087630509658344E-30";
+        results[72][15]="3.316875579356586E-22";
+        results[72][16]="0.000003810428616608354";
+        results[72][17]="3.925628147575576E-27";
+        results[72][18]="2.990471429442005E-11";
+        results[72][19]="2.530249221550267E-32";
+        results[72][20]="1.011999052659421E-15";
+        results[72][21]="4.717659666868350E-37";
+        results[72][22]="5.813932545327873E-21";
+        results[72][23]="5.170592593983595E-42";
+        results[72][24]="3.079569343009031E-26";
+        results[72][25]="3.082853932375250E-26";
+        results[72][26]="0.08257341110354408";
+        results[72][27]="3.593925908686312E-31";
+        results[72][28]="0.000001273467427444617";
+        results[72][29]="6.134890097017279E-36";
+        results[72][30]="2.870041436084768E-12";
+        results[72][31]="7.485402571116811E-41";
+        results[72][32]="5.834944911902525E-17";
+        results[72][33]="3.220865063312414E-46";
+        results[72][34]="1.543667924750332E-21";
+        results[72][35]="3.789357924433339E-30";
+        results[72][36]="798.4861841537783";
+        results[72][37]="3.206095584682231E-35";
+        results[72][38]="0.003907843306661606";
+        results[72][39]="3.417051263652724E-40";
+        results[72][40]="7.085264122619546E-8";
+        results[72][41]="5.470640801598023E-45";
+        results[72][42]="2.558753129030992E-13";
+        results[72][43]="9.868848160504565E-50";
+        results[72][44]="6.721640971189435E-18";
+        results[72][45]="8.656472750188841E-34";
+        results[72][46]="4713094.241069868";
+        results[72][47]="3.146850222878877E-39";
+        results[72][48]="39.02723680071055";
+        results[72][49]="1.332711787062614E-43";
+        results[72][50]="0.001315274251052358";
+        results[72][51]="3.317233148902893E-49";
+        results[72][52]="2.356817484881160E-8";
+        results[72][53]="6.909814402554038E-54";
+        results[72][54]="9.611367708181607E-14";
+        results[72][55]="3.499611718478145E-38";
+        results[72][56]="40397622604.49307";
+        results[72][57]="3.510151871454961E-43";
+        results[72][58]="322892.9971569699";
+        results[72][59]="6.887456409020225E-48";
+        results[72][60]="16.67792487743833";
+        results[72][61]="3.183858755949381E-53";
+        results[72][62]="0.0001192374680822991";
+        results[72][63]="2.707989960417380E-58";
+        results[72][64]="1.245902658080421E-9";
+        results[72][65]="2.938078319842043E-42";
+        results[72][66]="261932862595217.9";
+        results[72][67]="9.484154587713828E-47";
+        results[72][68]="5587958200.718210";
+        results[72][69]="4.212412566013441E-52";
+        results[72][70]="41028.39807014366";
+        results[72][71]="2.574328091922103E-57";
+        results[72][72]="1";
+        results[72][73]="4.878071858901815E-62";
+        results[72][74]="0.000002792883743307747";
+        results[73][0]="4.610252322411714E+48";
+        results[73][1]="1.013739666829516E+43";
+        results[73][2]="2.274504434405050E+38";
+        results[73][3]="2.652320253137757E+33";
+        results[73][4]="1.851235257619769E+28";
+        results[73][5]="5.775739148057081E+43";
+        results[73][6]="3.589357425085942E+52";
+        results[73][7]="5.538897820177879E+38";
+        results[73][8]="5.291388995229049E+46";
+        results[73][9]="5.163044275816442E+33";
+        results[73][10]="1.884285565584005E+42";
+        results[73][11]="6.256654275624378E+28";
+        results[73][12]="8.400984161003253E+36";
+        results[73][13]="7.871929040091104E+23";
+        results[73][14]="6.329612598928488E+31";
+        results[73][15]="6.799562768440446E+39";
+        results[73][16]="7.811341708004652E+55";
+        results[73][17]="8.047499629206652E+34";
+        results[73][18]="6.130437426797644E+50";
+        results[73][19]="5.186986364157197E+29";
+        results[73][20]="2.074588242919507E+46";
+        results[73][21]="9.671156562114322E+24";
+        results[73][22]="1.191850533058106E+41";
+        results[73][23]="1.059966466985920E+20";
+        results[73][24]="6.313087285479891E+35";
+        results[73][25]="6.319820661824533E+35";
+        results[73][26]="1.692746919110240E+60";
+        results[73][27]="7.367513256550102E+30";
+        results[73][28]="2.610595875336918E+55";
+        results[73][29]="1.257646519868694E+26";
+        results[73][30]="5.883557108424581E+49";
+        results[73][31]="1.534500267243291E+21";
+        results[73][32]="1.196158047826734E+45";
+        results[73][33]="6602742141723014";
+        results[73][34]="3.164504274231525E+40";
+        results[73][35]="7.768146993403301E+31";
+        results[73][36]="1.636888933271145E+64";
+        results[73][37]="6.572464853775255E+26";
+        results[73][38]="8.011040877822095E+58";
+        results[73][39]="7.004921949677867E+21";
+        results[73][40]="1.452472273381932E+54";
+        results[73][41]="1.121476058540394E+17";
+        results[73][42]="5.245419098043044E+48";
+        results[73][43]="2023104301445.511";
+        results[73][44]="1.377929880004403E+44";
+        results[73][45]="1.774568518172187E+28";
+        results[73][46]="9.661797483505934E+67";
+        results[73][47]="6.451012436678859E+22";
+        results[73][48]="8.000545692964971E+62";
+        results[73][49]="2.732046237963053E+18";
+        results[73][50]="2.696299458262718E+58";
+        results[73][51]="6800295782542.430";
+        results[73][52]="4.831452986040559E+53";
+        results[73][53]="141650525.0931179";
+        results[73][54]="1.970321058440780E+48";
+        results[73][55]="7.174170081344397E+23";
+        results[73][56]="8.281473453650119E+71";
+        results[73][57]="7.195777292721534E+18";
+        results[73][58]="6.619275125431665E+66";
+        results[73][59]="141192188394099.9";
+        results[73][60]="3.418958424526566E+62";
+        results[73][61]="652687957.0540302";
+        results[73][62]="2.444356531253368E+57";
+        results[73][63]="5551.353154988210";
+        results[73][64]="2.554088365481576E+52";
+        results[73][65]="6.023032060260553E+19";
+        results[73][66]="5.369598279230475E+75";
+        results[73][67]="1944242492124535";
+        results[73][68]="1.145526011577904E+71";
+        results[73][69]="8635404905.580393";
+        results[73][70]="8.410781812340964E+65";
+        results[73][71]="52773.47620913591";
+        results[73][72]="2.049990301342397E+61";
+        results[73][73]="1";
+        results[73][74]="5.725384586557730E+55";
+        results[74][0]="8.052301557585906E-8";
+        results[74][1]="1.770605365462456E-13";
+        results[74][2]="3.972666639277327E-18";
+        results[74][3]="4.632562604379404E-23";
+        results[74][4]="3.233381495395381E-28";
+        results[74][5]="1.008794965777072E-12";
+        results[74][6]="0.0006269198812448631";
+        results[74][7]="9.674280804091849E-18";
+        results[74][8]="9.241980019390084E-10";
+        results[74][9]="9.017812162240471E-23";
+        results[74][10]="3.291107413129942E-14";
+        results[74][11]="1.092791965506384E-27";
+        results[74][12]="1.467322244295588E-19";
+        results[74][13]="1.374917076937174E-32";
+        results[74][14]="1.105534921407618E-24";
+        results[74][15]="1.187616773274011E-16";
+        results[74][16]="1.364334847713883";
+        results[74][17]="1.405582368754908E-21";
+        results[74][18]="0.00001070746835276518";
+        results[74][19]="9.059629594726956E-27";
+        results[74][20]="3.623491507959662E-10";
+        results[74][21]="1.689171516062104E-31";
+        results[74][22]="2.081695150848690E-15";
+        results[74][23]="1.851345444067719E-36";
+        results[74][24]="1.102648597668354E-20";
+        results[74][25]="1.103824654270814E-20";
+        results[74][26]="29565.64565260007";
+        results[74][27]="1.286815434870144E-25";
+        results[74][28]="0.4559686490696489";
+        results[74][29]="2.196614918797670E-30";
+        results[74][30]="0.000001027626532239985";
+        results[74][31]="2.680169766841597E-35";
+        results[74][32]="2.089218688706290E-11";
+        results[74][33]="1.153239933824738E-40";
+        results[74][34]="5.527147087483460E-16";
+        results[74][35]="1.356790426208511E-24";
+        results[74][36]="285900258.4934282";
+        results[74][37]="1.147951679823628E-29";
+        results[74][38]="1399.214455677041";
+        results[74][39]="1.223484963110475E-34";
+        results[74][40]="0.02536899052671676";
+        results[74][41]="1.958778561659312E-39";
+        results[74][42]="9.161688649454979E-8";
+        results[74][43]="3.533569266587664E-44";
+        results[74][44]="2.406702744894305E-12";
+        results[74][45]="3.099474788713032E-28";
+        results[74][46]="1687536852317.355";
+        results[74][47]="1.126738708841461E-33";
+        results[74][48]="13973813.58756047";
+        results[74][49]="4.771812612164872E-38";
+        results[74][50]="470.9377016512027";
+        results[74][51]="1.187744802071186E-43";
+        results[74][52]="0.008438652308849302";
+        results[74][53]="2.474078779366023E-48";
+        results[74][54]="3.441377655339997E-8";
+        results[74][55]="1.253045969730694E-32";
+        results[74][56]="1.446448413805017E+16";
+        results[74][57]="1.256819901603824E-37";
+        results[74][58]="115612759725.7422";
+        results[74][59]="2.466073435932954E-42";
+        results[74][60]="5971578.629938194";
+        results[74][61]="1.139989719793558E-47";
+        results[74][62]="42.69331595631704";
+        results[74][63]="9.696035386027837E-53";
+        results[74][64]="0.0004460990046813902";
+        results[74][65]="1.051987332763925E-36";
+        results[74][66]="9.378580946051059E+19";
+        results[74][67]="3.395828634270787E-41";
+        results[74][68]="2000784391440555";
+        results[74][69]="1.508266348754094E-46";
+        results[74][70]="14690335094.84779";
+        results[74][71]="9.217455248864755E-52";
+        results[74][72]="358052.8557252626";
+        results[74][73]="1.746607559512835E-56";
+        results[74][74]="1";
+    }
+
+    public static int mcDivideTests() {
+        int failures = 0;
+        for(int i=0; i<value.length; i++) {
+            for(int j=0; j<value.length; j++) {
+                BigDecimal v1 = new BigDecimal(value[i]);
+                BigDecimal v2 = new BigDecimal(value[j]);
+                BigDecimal res1  = v1.divide(v2, MathContext.DECIMAL64);
+                if(!res1.toString().equals(results[i][j])) {
+                    failures++;
+                    System.err.println("Unexpected result from " + v1 + " / " + v2 +
+                                       "; expected " + results[i][j] + " got " + res1);
+
+                }
+            }
+        }
+        for (int mpc = 1; mpc < 23; mpc++) {
+            for (int i = 0; i < value.length; i++) {
+                for (int j = 0; j < value.length; j++) {
+                    BigDecimal v1 = new BigDecimal(value[i]);
+                    BigDecimal v2 = new BigDecimal(value[j]);
+                    BigDecimal res1 = v1.divide(v2, new MathContext(mpc, RoundingMode.HALF_EVEN));
+                    BigDecimal res2 = v1.divide(v2, new MathContext(128, RoundingMode.HALF_EVEN)).round(new MathContext(mpc, RoundingMode.HALF_EVEN));
+                    if (!res1.equals(res2)) {
+                        failures++;
+                        System.err.println("Unexpected result from " + v1 + " / " + v2 +
+                                           "; expected " + res2 + " got " + res1);
+
+                    }
+                }
+            }
+        }
+        return failures;
+    }
+
+    public static void main(String argv[]) {
+        int failures = 0;
+        failures += mcDivideTests();
+        if (failures > 0) {
+            throw new RuntimeException("Incurred " + failures +
+                                       " failures while testing DECIMAL64 divide.");
+        }
+    }
+
+}
--- a/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/math/BigDecimal/FloatDoubleValueTests.java	Tue Apr 26 15:48:03 2011 -0700
@@ -25,6 +25,8 @@
  * @test
  * @bug 6274390
  * @summary Verify {float, double}Value methods work with condensed representation
+ * @run main FloatDoubleValueTests
+ * @run main/othervm -XX:+AggressiveOpts FloatDoubleValueTests
  */
 import java.math.*;
 
@@ -64,6 +66,7 @@
 
     static void checkDouble(BigDecimal bd, double d) {
         double dbd = bd.doubleValue();
+
         if (d != dbd ) {
             String message = String.format("Bad conversion:"+
                                            "got %g (%a)\texpected %g (%a)",
@@ -156,9 +159,29 @@
         }
     }
 
+    static void testFloatValue1() {
+        checkFloat(new BigDecimal("85070591730234615847396907784232501249"), 8.507059e+37f);
+        checkFloat(new BigDecimal("7784232501249e12"), 7.7842326e24f);
+        checkFloat(new BigDecimal("907784232501249e-12"),907.78424f);
+        checkFloat(new BigDecimal("7784e8"),7.7839997e11f);
+        checkFloat(new BigDecimal("9077e-8"),9.077e-5f);
+
+    }
+
+    static void testDoubleValue1() {
+        checkDouble(new BigDecimal("85070591730234615847396907784232501249"), 8.507059173023462e37);
+        checkDouble(new BigDecimal("7784232501249e12"), 7.784232501249e24);
+        checkDouble(new BigDecimal("907784232501249e-12"), 907.784232501249);
+        checkDouble(new BigDecimal("7784e8"), 7.784e11);
+        checkDouble(new BigDecimal("9077e-8"), 9.077e-5);
+
+    }
+
     public static void main(String[] args) throws Exception {
         testFloatDoubleValue();
         testDoubleValue();
         testFloatValue();
+        testFloatValue1();
+        testDoubleValue1();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigDecimal/RangeTests.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,245 @@
+/*
+ * 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.
+ *
+ * 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 7036582
+ * @summary Some new tests for the add method and constructor with MathContext.
+ * @run main RangeTests
+ * @run main/othervm -XX:+AggressiveOpts RangeTests
+ * @author Sergey V. Kuksenko
+ */
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.math.MathContext;
+
+public class RangeTests {
+
+
+    private static int addTest(BigDecimal arg1, BigDecimal arg2, BigDecimal expectedResult) {
+        int failures = 0;
+        BigDecimal result = arg1.add(arg2);
+        if (!result.equals(expectedResult)) {
+            System.out.println("Sum:" +
+                    arg1 + " + " +
+                    arg2 + " == " +
+                    result + "; expected  " +
+                    expectedResult
+            );
+            failures++;
+        }
+        result = arg2.add(arg1);
+        if (!result.equals(expectedResult)) {
+            System.out.println("Sum:" +
+                    arg2 + " + " +
+                    arg1 + " == " +
+                    result + "; expected  " +
+                    expectedResult
+            );
+            failures++;
+        }
+        return failures;
+    }
+
+    /*
+     *  Test BigDecimal.add(BigDecimal) when values are withing different ranges:
+     *  1. within 32 bits
+     *  2. within 64 bits
+     *  3. outside 64 bits.
+     */
+    private static int addBoundaryTest() {
+        int failures = 0;
+        failures += addTest(
+                new BigDecimal("85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(0),
+                new BigDecimal("85070591730234615847396907784232501249") );
+        failures += addTest(
+                new BigDecimal("-85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(0),
+                new BigDecimal("-85070591730234615847396907784232501249") );
+        failures += addTest(
+                new BigDecimal("85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(1),
+                new BigDecimal("85070591730234615847396907784232501250") );
+        failures += addTest(
+                new BigDecimal("85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(-1),
+                new BigDecimal("85070591730234615847396907784232501248") );
+        failures += addTest(
+                new BigDecimal("-85070591730234615847396907784232501250"),
+                BigDecimal.valueOf(-1),
+                new BigDecimal("-85070591730234615847396907784232501251") );
+        failures += addTest(
+                new BigDecimal("-85070591730234615847396907784232501249"),
+                BigDecimal.valueOf(1),
+                new BigDecimal("-85070591730234615847396907784232501248") );
+        failures += addTest(
+                new BigDecimal("147573952589676412927"),
+                BigDecimal.valueOf(Integer.MAX_VALUE),
+                new BigDecimal("147573952591823896574") );
+        failures += addTest(
+                new BigDecimal("-147573952589676412927"),
+                BigDecimal.valueOf(Integer.MAX_VALUE),
+                new BigDecimal("-147573952587528929280") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(999),
+                new BigDecimal("79228162514264337593543951334") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(Integer.MAX_VALUE/2),
+                new BigDecimal("79228162514264337594617692158") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(Integer.MIN_VALUE/2),
+                new BigDecimal("79228162514264337592470208511") );
+        failures += addTest(
+                new BigDecimal("-79228162514264337593543950335"),
+                BigDecimal.valueOf(Integer.MAX_VALUE/2),
+                new BigDecimal("-79228162514264337592470208512") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(-(Integer.MIN_VALUE/2)),
+                new BigDecimal("79228162514264337594617692159") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(Long.MAX_VALUE/2),
+                new BigDecimal("79228162518876023611971338238") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(Long.MIN_VALUE/2),
+                new BigDecimal("79228162509652651575116562431") );
+        failures += addTest(
+                new BigDecimal("-79228162514264337593543950335"),
+                BigDecimal.valueOf(Long.MAX_VALUE/2),
+                new BigDecimal("-79228162509652651575116562432") );
+        failures += addTest(
+                new BigDecimal("79228162514264337593543950335"),
+                BigDecimal.valueOf(-(Long.MIN_VALUE/2)),
+                new BigDecimal("79228162518876023611971338239") );
+        failures += addTest(
+                new BigDecimal("-9223372036854775808"),
+                BigDecimal.valueOf(1),
+                new BigDecimal("-9223372036854775807") );
+        failures += addTest(
+                new BigDecimal("-9223372036854775808"),
+                BigDecimal.valueOf(Long.MAX_VALUE/2),
+                new BigDecimal("-4611686018427387905") );
+        failures += addTest(
+                new BigDecimal("9223372036854775808"),
+                BigDecimal.valueOf(-1),
+                new BigDecimal("9223372036854775807") );
+        failures += addTest(
+                new BigDecimal("9223372036854775808"),
+                BigDecimal.valueOf(-Long.MAX_VALUE/2),
+                new BigDecimal("4611686018427387905") );
+
+        return failures;
+    }
+
+    private static int testRoundingFromBigInteger(BigInteger bi, int scale, MathContext mc) {
+        int failures = 0;
+        BigDecimal bd1 = new BigDecimal(bi,scale, mc);
+        BigDecimal bd2 = (new BigDecimal(bi,scale)).round(mc);
+        if (!bd1.equals(bd2)) {
+            System.out.println("new BigDecimal(BigInteger,int,MathContext):" +
+                    "BigInteger == " +
+                    bi + ";  scale == " + scale + "; result == " +
+                    bd1 + "; expected  == " +
+                    bd2
+            );
+            failures++;
+        }
+        return failures;
+    }
+
+    private static int roundingConstructorTest() {
+        int failures = 0;
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                7, MathContext.DECIMAL64);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                0, MathContext.DECIMAL64);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                -7, MathContext.DECIMAL64);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                7, MathContext.DECIMAL128);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                177, MathContext.DECIMAL128);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                177, MathContext.DECIMAL32);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                177, MathContext.UNLIMITED);
+        failures += testRoundingFromBigInteger(
+                new BigInteger("85070591730234615847396907784232501249"),
+                0, MathContext.UNLIMITED);
+        return failures;
+    }
+
+    private static int minLongConstructorTest(MathContext mc) {
+        int failures = 0;
+        BigDecimal bd1 = new BigDecimal(Long.MIN_VALUE,mc);
+        BigDecimal bd2 = new BigDecimal(Long.MIN_VALUE).round(mc);
+        if (!bd1.equals(bd2)) {
+            System.out.println("new BigDecimal(long,MathContext):" +
+                    "long == " +
+                    Long.MIN_VALUE + "; result == " +
+                    bd1 + "; expected  == " +
+                    bd2
+            );
+            failures++;
+        }
+        return failures;
+    }
+
+    private static int minLongConstructorTest() {
+        int failures = 0;
+        failures+=minLongConstructorTest(MathContext.UNLIMITED);
+        failures+=minLongConstructorTest(MathContext.DECIMAL32);
+        failures+=minLongConstructorTest(MathContext.DECIMAL64);
+        failures+=minLongConstructorTest(MathContext.DECIMAL128);
+        return failures;
+    }
+
+    public static void main(String argv[]) {
+        int failures = 0;
+
+        failures += addBoundaryTest();
+        failures += roundingConstructorTest();
+        failures += minLongConstructorTest();
+        if (failures > 0) {
+            throw new RuntimeException("Incurred " + failures +
+                                       " failures while testing.");
+        }
+    }
+
+
+
+}
--- a/jdk/test/java/math/BigDecimal/StrippingZerosTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/math/BigDecimal/StrippingZerosTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -25,6 +25,8 @@
  * @test
  * @bug 4108852
  * @summary A few tests of stripTrailingZeros
+ * @run main StrippingZerosTest
+ * @run main/othervm -XX:+AggressiveOpts StrippingZerosTest
  * @author Joseph D. Darcy
  */
 
@@ -53,6 +55,11 @@
             {new BigDecimal("10000000e2"),      new BigDecimal("1e9")},
             {new BigDecimal("1000000e3"),       new BigDecimal("1e9")},
             {new BigDecimal("100000e4"),        new BigDecimal("1e9")},
+            // BD value which larger than Long.MaxValue
+            {new BigDecimal("1.0000000000000000000000000000"),    new BigDecimal("1")},
+            {new BigDecimal("-1.0000000000000000000000000000"),   new BigDecimal("-1")},
+            {new BigDecimal("1.00000000000000000000000000001"),   new BigDecimal("1.00000000000000000000000000001")},
+            {new BigDecimal("1000000000000000000000000000000e4"), new BigDecimal("1e34")},
         };
 
         for(int i = 0; i < testCases.length; i++) {
--- a/jdk/test/java/math/BigDecimal/ToPlainStringTests.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/math/BigDecimal/ToPlainStringTests.java	Tue Apr 26 15:48:03 2011 -0700
@@ -25,6 +25,8 @@
  * @test
  * @bug 4984872
  * @summary Basic tests of toPlainString method
+ * @run main ToPlainStringTests
+ * @run main/othervm -XX:+AggressiveOpts ToPlainStringTests
  * @author Joseph D. Darcy
  */
 
@@ -60,6 +62,11 @@
             {"8e-8",                    "0.00000008"},
             {"9e-9",                    "0.000000009"},
             {"9000e-12",                "0.000000009000"},
+
+            {"9000e-22",                 "0.0000000000000000009000"},
+            {"12345678901234567890",     "12345678901234567890"},
+            {"12345678901234567890e22",  "123456789012345678900000000000000000000000"},
+            {"12345678901234567890e-22", "0.0012345678901234567890"},
         };
 
         int errors = 0;
@@ -73,8 +80,8 @@
                                    s + "'' from BigDecimal " +
                                    bd);
             }
-
-            if (!(s=("-"+bd.toPlainString())).equals("-"+testCase[1])) {
+            bd = new BigDecimal("-"+testCase[0]);
+            if (bd.signum()!=0 && !(s=(bd.toPlainString())).equals("-"+testCase[1])) {
                 errors++;
                 System.err.println("Unexpected plain result ``" +
                                    s + "'' from BigDecimal " +
--- a/jdk/test/java/net/URL/Equals.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/net/URL/Equals.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -23,16 +23,19 @@
 
 /*
  * @test
- * @bug 4052976
- * @summary Test URL.equals involving anchors
- *
+ * @bug 4052976 7030649
+ * @summary Test URL.equals with anchors, and jar URLs
  */
 
 import java.net.*;
 
 public class Equals {
+    public static void main(String[] args) throws Exception {
+        anchors();
+        jarURLs();
+    }
 
-    public static void main(String[] args) throws Exception {
+    static void anchors() throws Exception {
         URL url1, url2;
 
         url1 = new URL(null, "http://JavaSoft/Test#bar");
@@ -45,4 +48,74 @@
         if (url1.equals(null))
             throw new RuntimeException("URL.equals fails given null");
     }
+
+    static final String HTTP_URL1A = "http://localhost/xyz";
+    static final String HTTP_URL1B = "http://LOCALHOST/xyz";
+    static final String FILE_URL1A = "file:///c:/foo/xyz";
+    static final String FILE_URL1B = "file:/c:/foo/xyz";
+
+    static void jarURLs() throws Exception {
+        int failed = 0;
+        failed = compareJarURLS(HTTP_URL1A, HTTP_URL1A, "!/abc", "!/abc", true);
+        failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/abc", true);
+        failed = compareJarURLS(HTTP_URL1B, HTTP_URL1A, "!/", "!/", true);
+        failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/", false);
+        failed = compareJarURLS(HTTP_URL1A, HTTP_URL1B, "!/abc", "!/xy", false);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1A, "!/abc", "!/abc", true);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/abc", true);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/", "!/", true);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/", false);
+        failed = compareJarURLS(FILE_URL1A, FILE_URL1B, "!/abc", "!/xy", false);
+
+        failed = (new URL("jar:file://xzy!/abc")).equals(
+                      new URL("file://xzy!/abc")) ? 1 : 0;
+
+        if (failed > 0)
+            throw new RuntimeException("Some jar URL tests failed. Check output");
+    }
+
+    static int compareJarURLS(String urlStr1, String urlStr2,
+                                  String entry1,  String entry2,
+                                  boolean expectEqual) throws Exception {
+        int failed = 0;
+
+        URL url1 = new URL(urlStr1);
+        URL url2 = new URL(urlStr2);
+
+        if (!url1.equals(url2)) {
+            System.out.println("Urls are not equal, so the test cannot run.");
+            System.out.println("url1: " + url1 + ", url2:" + url2);
+            return 1;
+        }
+
+        URL jarUrl1 = new URL("jar:" + urlStr1 + entry1);
+        URL jarUrl2 = new URL("jar:" + urlStr2 + entry2);
+        jarUrl2.openConnection();
+
+        boolean equal = jarUrl1.equals(jarUrl2);
+        if (expectEqual && !equal) {
+            System.out.println("URLs should be equal, but are not. " +
+                                jarUrl1 + ", " + jarUrl2);
+            failed++;
+        } else if (!expectEqual && equal) {
+            System.out.println("URLs should NOT be equal, but are. " +
+                                jarUrl1 + ", " + jarUrl2);
+            failed++;
+        }
+
+        if (expectEqual) {
+            // hashCode MUST produce the same integer result for equal urls
+            int hash1 = jarUrl1.hashCode();
+            int hash2 = jarUrl2.hashCode();
+            if (hash1 != hash2) {
+                System.out.println("jarUrl1.hashCode = " + hash1);
+                System.out.println("jarUrl2.hashCode = " + hash2);
+                System.out.println("Equal urls should have same hashCode. " +
+                                    jarUrl1 + ", " + jarUrl2);
+                failed++;
+            }
+        }
+
+        return failed;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/exportObject/GcDuringExport.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6597112
+ * @summary GC'ing objects whilst being exported to RMI should not cause exceptions
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.rmi.Remote;
+import java.rmi.server.UnicastRemoteObject;
+
+public class GcDuringExport {
+    private static final long MAX_EXPORT_ITERATIONS = 50000;
+
+    public static void main(String[] args) throws Exception {
+        Thread gcInducingThread = new Thread() {
+            public void run() {
+                while (true) {
+                    System.gc();
+                    try { Thread.sleep(1); } catch (InterruptedException e) { }
+                }
+            }
+        };
+        gcInducingThread.setDaemon(true);
+        gcInducingThread.start();
+
+        long i = 0;
+        try {
+            while (i < MAX_EXPORT_ITERATIONS) {
+                i++;
+                UnicastRemoteObject.exportObject(new Remote() { }, 0);
+            }
+        } catch (Throwable e) {
+            throw new RuntimeException("Test FAILED on iteration " + i + ".", e);
+        }
+
+        System.out.println("Test successfully exported " + i + " objects.");
+    }
+}
--- a/jdk/test/java/text/Bidi/Bug6665028.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/text/Bidi/Bug6665028.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -28,7 +28,7 @@
  * that this test case fails without the fix in some different ways,
  * including timeout, due to the memory corruption.
  * @build Bug6665028
- * @run main/othervm/timeout=60 -Xmx16m Bug6665028
+ * @run main/othervm -Xmx16m Bug6665028 10
  */
 
 import java.awt.font.TextAttribute;
@@ -36,6 +36,7 @@
 import java.text.Bidi;
 
 // test1() and test2() were derived from BidiEmbeddingTest.
+// Usage: java Bug6665028 [duration]
 public class Bug6665028 {
 
     private static boolean runrun = true;
@@ -50,6 +51,11 @@
     }
 
     public static void main(String[] args) {
+        int duration = 45;
+        if (args.length == 1) {
+            duration = Math.max(1, Math.min(Integer.parseInt(args[0]), 45));
+        }
+
         Test[] tests = new Test[4];
         for (int i = 0; i < tests.length; i++) {
             Test t = new Test();
@@ -58,7 +64,7 @@
         }
 
         try {
-            Thread.sleep(45000);
+            Thread.sleep(duration * 1000);
         } catch (InterruptedException e) {
         }
 
--- a/jdk/test/java/util/Currency/CurrencyTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/Currency/CurrencyTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -23,7 +23,7 @@
 /*
  * @test
  * @bug 4290801 4692419 4693631 5101540 5104960 6296410 6336600 6371531
- *    6488442
+ *    6488442 7036905
  * @summary Basic tests for Currency class.
  */
 
@@ -249,7 +249,7 @@
         testDisplayName("ITL", new Locale("it"), "Lira Italiana");
         testDisplayName("JPY", Locale.JAPANESE, "\u65e5\u672c\u5186");
         testDisplayName("KRW", Locale.KOREAN, "\ub300\ud55c\ubbfc\uad6d \uc6d0");
-        testDisplayName("SEK", new Locale("sv"), "Svensk krona");
+        testDisplayName("SEK", new Locale("sv"), "svensk krona");
         testDisplayName("CNY", Locale.SIMPLIFIED_CHINESE, "\u4eba\u6c11\u5e01");
         testDisplayName("TWD", Locale.TRADITIONAL_CHINESE, "\u65b0\u81fa\u5e63");
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/EnumMap/DistinctEntrySetElements.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Sets from Map.entrySet() return distinct objects for each Entry
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.EnumMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class DistinctEntrySetElements {
+    static enum TestEnum { e00, e01, e02 }
+
+    public static void main(String[] args) throws Exception {
+        final EnumMap<TestEnum, String> enumMap = new EnumMap<>(TestEnum.class);
+
+        for (TestEnum e : TestEnum.values()) {
+            enumMap.put(e, e.name());
+        }
+
+        Set<Map.Entry<TestEnum, String>> entrySet = enumMap.entrySet();
+        HashSet<Map.Entry<TestEnum, String>> hashSet = new HashSet<>(entrySet);
+
+        if (false == hashSet.equals(entrySet)) {
+            throw new RuntimeException("Test FAILED: Sets are not equal.");
+        }
+        if (hashSet.hashCode() != entrySet.hashCode()) {
+            throw new RuntimeException("Test FAILED: Set's hashcodes are not equal.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/EnumMap/EntrySetIteratorRemoveInvalidatesEntry.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Iterator.remove() from Map.entrySet().iterator() invalidates returned Entry.
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.EnumMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class EntrySetIteratorRemoveInvalidatesEntry {
+    static enum TestEnum { e00, e01, e02 }
+
+    public static void main(String[] args) throws Exception {
+        final EnumMap<TestEnum, String> enumMap = new EnumMap<>(TestEnum.class);
+
+        for (TestEnum e : TestEnum.values()) {
+            enumMap.put(e, e.name());
+        }
+
+        Iterator<Map.Entry<TestEnum, String>> entrySetIterator =
+            enumMap.entrySet().iterator();
+        Map.Entry<TestEnum, String> entry = entrySetIterator.next();
+
+        entrySetIterator.remove();
+
+        try {
+            entry.getKey();
+            throw new RuntimeException("Test FAILED: Entry not invalidated by removal.");
+        } catch (Exception e) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/EnumMap/SimpleSerialization.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary A serialized EnumMap can be successfully de-serialized.
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.EnumMap;
+
+public class SimpleSerialization {
+    private enum TestEnum { e00, e01, e02, e03, e04, e05, e06, e07 }
+    public static void main(final String[] args) throws Exception {
+        final EnumMap<TestEnum, String> enumMap = new EnumMap<>(TestEnum.class);
+
+        enumMap.put(TestEnum.e01, TestEnum.e01.name());
+        enumMap.put(TestEnum.e04, TestEnum.e04.name());
+        enumMap.put(TestEnum.e05, TestEnum.e05.name());
+
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        final ObjectOutputStream oos = new ObjectOutputStream(baos);
+
+        oos.writeObject(enumMap);
+        oos.close();
+
+        final byte[] data = baos.toByteArray();
+        final ByteArrayInputStream bais = new ByteArrayInputStream(data);
+        final ObjectInputStream ois = new ObjectInputStream(bais);
+
+        final Object deserializedObject = ois.readObject();
+        ois.close();
+
+        if (false == enumMap.equals(deserializedObject)) {
+            throw new RuntimeException(getFailureText(enumMap, deserializedObject));
+        }
+    }
+
+    private static String getFailureText(final Object orig, final Object copy) {
+        final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
+
+        pw.println("Test FAILED: Deserialized object is not equal to the original object");
+        pw.print("\tOriginal: ");
+        printObject(pw, orig).println();
+        pw.print("\tCopy:     ");
+        printObject(pw, copy).println();
+
+        pw.close();
+        return sw.toString();
+    }
+
+    private static PrintWriter printObject(final PrintWriter pw, final Object o) {
+        pw.printf("%s@%08x", o.getClass().getName(), System.identityHashCode(o));
+        return pw;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/IdentityHashMap/DistinctEntrySetElements.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Sets from Map.entrySet() return distinct objects for each Entry
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.IdentityHashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class DistinctEntrySetElements {
+    public static void main(String[] args) throws Exception {
+        final IdentityHashMap<String, String> identityHashMap =
+            new IdentityHashMap<>();
+
+        identityHashMap.put("One", "Un");
+        identityHashMap.put("Two", "Deux");
+        identityHashMap.put("Three", "Trois");
+
+        Set<Map.Entry<String, String>> entrySet = identityHashMap.entrySet();
+        HashSet<Map.Entry<String, String>> hashSet = new HashSet<>(entrySet);
+
+        // NB: These comparisons are valid in this case because none of the
+        //     keys put into 'identityHashMap' above are equal to any other.
+        if (false == hashSet.equals(entrySet)) {
+            throw new RuntimeException("Test FAILED: Sets are not equal.");
+        }
+        if (hashSet.hashCode() != entrySet.hashCode()) {
+            throw new RuntimeException("Test FAILED: Set's hashcodes are not equal.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/IdentityHashMap/EntrySetIteratorRemoveInvalidatesEntry.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Iterator.remove() from Map.entrySet().iterator() invalidates returned Entry.
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class EntrySetIteratorRemoveInvalidatesEntry {
+    public static void main(String[] args) throws Exception {
+        final IdentityHashMap<String, String> identityHashMap =
+            new IdentityHashMap<>();
+
+        identityHashMap.put("One", "Un");
+        identityHashMap.put("Two", "Deux");
+        identityHashMap.put("Three", "Trois");
+
+        Iterator<Map.Entry<String, String>> entrySetIterator =
+            identityHashMap.entrySet().iterator();
+        Map.Entry<String, String> entry = entrySetIterator.next();
+
+        entrySetIterator.remove();
+
+        try {
+            entry.getKey();
+            throw new RuntimeException("Test FAILED: Entry not invalidated by removal.");
+        } catch (Exception e) { }
+    }
+}
--- a/jdk/test/java/util/Locale/Bug4518797.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/Locale/Bug4518797.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,17 +24,22 @@
  * @test
  * @bug 4518797
  * @summary Make sure that hashCode() and read/writeObject() are thread-safe.
- * @run main/timeout=200 Bug4518797
+ * @run main Bug4518797 10
  */
 
 import java.util.*;
 import java.io.*;
 
+// Usage: java Bug4518797 [duration]
 public class Bug4518797 {
     static volatile boolean runrun = true;
     static volatile String message = null;
 
     public static void main(String[] args) {
+        int duration = 180;
+        if (args.length == 1) {
+            duration = Math.max(5, Integer.parseInt(args[0]));
+        }
         final Locale loc = new Locale("ja", "US");
         final int hashcode = loc.hashCode();
 
@@ -84,7 +89,7 @@
         t1.start();
         t2.start();
         try {
-            for (int i = 0; runrun && i < 180; i++) {
+            for (int i = 0; runrun && i < duration; i++) {
                 Thread.sleep(1000);
             }
             runrun = false;
--- a/jdk/test/java/util/Locale/LocaleEnhanceTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/Locale/LocaleEnhanceTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -33,8 +33,10 @@
 import java.io.ObjectOutputStream;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.text.DecimalFormatSymbols;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Calendar;
 import java.util.IllformedLocaleException;
 import java.util.List;
 import java.util.Locale;
@@ -43,8 +45,10 @@
 
 /**
  * @test
- * @bug 6875847 6992272 7002320 7015500 7023613
+ * @bug 6875847 6992272 7002320 7015500 7023613 7032820 7033504
  * @summary test API changes to Locale
+ * @compile LocaleEnhanceTest.java
+ * @run main/othervm -esa LocaleEnhanceTest
  */
 public class LocaleEnhanceTest extends LocaleTestFmwk {
 
@@ -593,6 +597,9 @@
         assertEquals("extension", "aa-00-bb-01", locale.getExtension('d'));
         assertEquals("extension c", "1234", locale.getExtension('c'));
 
+        locale = Locale.forLanguageTag("und-U-ca-gregory-u-ca-japanese");
+        assertEquals("Unicode extension", "ca-gregory", locale.getExtension(Locale.UNICODE_LOCALE_EXTENSION));
+
         // redundant Unicode locale keys in an extension are ignored
         locale = Locale.forLanguageTag("und-u-aa-000-bb-001-bB-002-cc-003-c-1234");
         assertEquals("Unicode keywords", "aa-000-bb-001-cc-003", locale.getExtension(Locale.UNICODE_LOCALE_EXTENSION));
@@ -1275,6 +1282,35 @@
         }
     }
 
+    /*
+     * 7033504: (lc) incompatible behavior change for ja_JP_JP and th_TH_TH locales
+     */
+    public void testBug7033504() {
+        checkCalendar(new Locale("ja", "JP", "jp"), "java.util.GregorianCalendar");
+        checkCalendar(new Locale("ja", "jp", "jp"), "java.util.GregorianCalendar");
+        checkCalendar(new Locale("ja", "JP", "JP"), "java.util.JapaneseImperialCalendar");
+        checkCalendar(new Locale("ja", "jp", "JP"), "java.util.JapaneseImperialCalendar");
+        checkCalendar(Locale.forLanguageTag("en-u-ca-japanese"),
+                      "java.util.JapaneseImperialCalendar");
+
+        checkDigit(new Locale("th", "TH", "th"), '0');
+        checkDigit(new Locale("th", "th", "th"), '0');
+        checkDigit(new Locale("th", "TH", "TH"), '\u0e50');
+        checkDigit(new Locale("th", "TH", "TH"), '\u0e50');
+        checkDigit(Locale.forLanguageTag("en-u-nu-thai"), '\u0e50');
+    }
+
+    private void checkCalendar(Locale loc, String expected) {
+        Calendar cal = Calendar.getInstance(loc);
+        assertEquals("Wrong calendar", expected, cal.getClass().getName());
+    }
+
+    private void checkDigit(Locale loc, Character expected) {
+        DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc);
+        Character zero = dfs.getZeroDigit();
+        assertEquals("Wrong digit zero char", expected, zero);
+    }
+
     ///
     /// utility asserts
     ///
--- a/jdk/test/java/util/PriorityQueue/NoNulls.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/PriorityQueue/NoNulls.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Martin Buchholz with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/PriorityQueue/PriorityQueueSort.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/PriorityQueue/PriorityQueueSort.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/Random/DistinctSeeds.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/Random/DistinctSeeds.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/ResourceBundle/Bug4168625Test.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/ResourceBundle/Bug4168625Test.java	Tue Apr 26 15:48:03 2011 -0700
@@ -282,7 +282,7 @@
         thread1.start();            //start thread 1
         loader.waitForNotify(1);    //wait for thread1 to do getBundle & block in loader
         thread2.start();            //start second thread
-        thread2.join(1000);         //wait until thread2 blocks somewhere in getBundle
+        thread2.join();             //wait until thread2 terminates.
 
             //Thread1 should be blocked inside getBundle at the class loader
             //Thread2 should have completed its getBundle call and terminated
@@ -292,7 +292,6 @@
 
         thread1.ping();             //continue thread1
         thread1.join();
-        thread2.join();
     }
 
     /**
@@ -318,8 +317,7 @@
         loader.waitForNotify(3);    //wait for thread1 to do getBundle(en) & block in loader
         causeResourceBundleCacheFlush();    //cause a cache flush
         thread1.ping();             //kick thread 1
-        thread1.ping();             //kick thread 1
-        thread1.join(1000);         //wait until thread2 blocks somewhere in getBundle
+        thread1.join();             //wait until thread1 terminates
 
         ResourceBundle bundle = (ResourceBundle)thread1.bundle;
         String s1 = bundle.getString("Bug4168625Resource3_en_US");
--- a/jdk/test/java/util/ResourceBundle/Control/StressTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/ResourceBundle/Control/StressTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,12 +24,13 @@
  * @test
  * @bug 5102289
  * @summary Stress test for ResourceBundle.getBundle with ResourceBundle.Control.
- * @run main/timeout=300/othervm -esa StressTest
+ * @run main/othervm -esa StressTest 2 15
  */
 
 import java.util.*;
 import java.util.concurrent.atomic.*;
 
+// Usage: java StressTest [threadsFactor [duration]]
 public class StressTest {
     static final Locale ROOT_LOCALE = new Locale("");
     static final Random rand = new Random();
@@ -60,16 +61,16 @@
     static volatile boolean runrun = true;
 
     public static void main(String[] args) {
-        int nThreads = 2;
+        int threadsFactor = 2;
         if (args.length > 0) {
-            nThreads = Math.max(Integer.parseInt(args[0]), 2);
+            threadsFactor = Math.max(2, Integer.parseInt(args[0]));
         }
-        int nSeconds = 180;
+        int duration = 180;
         if (args.length > 1) {
-            nSeconds = Integer.parseInt(args[1]);
+            duration = Math.max(5, Integer.parseInt(args[1]));
         }
         Locale.setDefault(Locale.US);
-        Thread[] tasks = new Thread[locales.length * nThreads];
+        Thread[] tasks = new Thread[locales.length * threadsFactor];
         counters = new AtomicIntegerArray(tasks.length);
 
         for (int i = 0; i < tasks.length; i++) {
@@ -84,8 +85,8 @@
         System.out.printf("%d processors, intervalForCounterCheck = %d [sec]%n",
                           nProcessors, intervalForCounterCheck);
         try {
-            for (int i = 0; runrun && i < nSeconds; i++) {
-                Thread.sleep(1000); // 1 seconds
+            for (int i = 0; runrun && i < duration; i++) {
+                Thread.sleep(1000); // 1 second
                 if ((i % intervalForCounterCheck) == 0) {
                     checkCounters();
                 }
--- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
--- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/PollMemoryLeak.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/DistinctEntrySetElements.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 6312706
+ * @summary Sets from Map.entrySet() return distinct objects for each Entry
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class DistinctEntrySetElements {
+    public static void main(String[] args) throws Exception {
+        final ConcurrentHashMap<String, String> concurrentHashMap =
+            new ConcurrentHashMap<>();
+
+        concurrentHashMap.put("One", "Un");
+        concurrentHashMap.put("Two", "Deux");
+        concurrentHashMap.put("Three", "Trois");
+
+        Set<Map.Entry<String, String>> entrySet = concurrentHashMap.entrySet();
+        HashSet<Map.Entry<String, String>> hashSet = new HashSet<>(entrySet);
+
+        if (false == hashSet.equals(entrySet)) {
+            throw new RuntimeException("Test FAILED: Sets are not equal.");
+        }
+        if (hashSet.hashCode() != entrySet.hashCode()) {
+            throw new RuntimeException("Test FAILED: Set's hashcodes are not equal.");
+        }
+    }
+}
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/GCRetention.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /*
  * @test
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 import java.util.*;
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/RemovePollRace.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/Phaser/Arrive.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/Arrive.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Phaser/Basic.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/Basic.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Phaser/FickleRegister.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/FickleRegister.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Phaser/PhaseOverflow.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/PhaseOverflow.java	Tue Apr 26 15:48:03 2011 -0700
@@ -29,7 +29,7 @@
  * Written by Martin Buchholz and Doug Lea with assistance from
  * members of JCP JSR-166 Expert Group and released to the public
  * domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Phaser/TieredArriveLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Phaser/TieredArriveLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Semaphore/PermitOverflow.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Semaphore/PermitOverflow.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/Semaphore/RacingReleases.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/Semaphore/RacingReleases.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/forkjoin/Integrate.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/forkjoin/Integrate.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/forkjoin/NQueensCS.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/forkjoin/NQueensCS.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 /**
  * Misc utilities in JSR166 performance tests
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /*
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java	Tue Apr 26 15:48:03 2011 -0700
@@ -28,7 +28,7 @@
  *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
+ * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 import java.util.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,148 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/*
+ * @test
+ * @bug 7031076
+ * @summary Allow stale InputStreams from ZipFiles to be GC'd
+ * @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
+ */
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+public class ClearStaleZipFileInputStreams {
+    private static final int ZIP_ENTRY_NUM = 5;
+
+    private static final byte[][] data;
+
+    static {
+        data = new byte[ZIP_ENTRY_NUM][];
+        Random r = new Random();
+        for (int i = 0; i < ZIP_ENTRY_NUM; i++) {
+            data[i] = new byte[1000];
+            r.nextBytes(data[i]);
+        }
+    }
+
+    private static File createTestFile(int compression) throws Exception {
+        File tempZipFile =
+            File.createTempFile("test-data" + compression, ".zip");
+        tempZipFile.deleteOnExit();
+
+        ZipOutputStream zos =
+            new ZipOutputStream(new FileOutputStream(tempZipFile));
+        zos.setLevel(compression);
+
+        try {
+            for (int i = 0; i < ZIP_ENTRY_NUM; i++) {
+                String text = "Entry" + i;
+                ZipEntry entry = new ZipEntry(text);
+                zos.putNextEntry(entry);
+                try {
+                    zos.write(data[i], 0, data[i].length);
+                } finally {
+                    zos.closeEntry();
+                }
+            }
+        } finally {
+            zos.close();
+        }
+
+        return tempZipFile;
+    }
+
+    private static void startGcInducingThread(final int sleepMillis) {
+        final Thread gcInducingThread = new Thread() {
+            public void run() {
+                while (true) {
+                    System.gc();
+                    try {
+                        Thread.sleep(sleepMillis);
+                    } catch (InterruptedException e) { }
+                }
+            }
+        };
+
+        gcInducingThread.setDaemon(true);
+        gcInducingThread.start();
+    }
+
+    public static void main(String[] args) throws Exception {
+        startGcInducingThread(500);
+        runTest(ZipOutputStream.DEFLATED);
+        runTest(ZipOutputStream.STORED);
+    }
+
+    private static void runTest(int compression) throws Exception {
+        ReferenceQueue<InputStream> rq = new ReferenceQueue<>();
+
+        System.out.println("Testing with a zip file with compression level = "
+                + compression);
+        File f = createTestFile(compression);
+        try {
+            ZipFile zf = new ZipFile(f);
+            try {
+                Set<Object> refSet = createTransientInputStreams(zf, rq);
+
+                System.out.println("Waiting for 'stale' input streams from ZipFile to be GC'd ...");
+                System.out.println("(The test will hang on failure)");
+                while (false == refSet.isEmpty()) {
+                    refSet.remove(rq.remove());
+                }
+                System.out.println("Test PASSED.");
+                System.out.println();
+            } finally {
+                zf.close();
+            }
+        } finally {
+            f.delete();
+        }
+    }
+
+    private static Set<Object> createTransientInputStreams(ZipFile zf,
+            ReferenceQueue<InputStream> rq) throws Exception {
+        Enumeration<? extends ZipEntry> zfe = zf.entries();
+        Set<Object> refSet = new HashSet<>();
+
+        while (zfe.hasMoreElements()) {
+            InputStream is = zf.getInputStream(zfe.nextElement());
+            refSet.add(new WeakReference<InputStream>(is, rq));
+        }
+
+        return refSet;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/Cipher/GCMAPI.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,138 @@
+/*
+ * 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.
+ *
+ * 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 7031343
+ * @summary Provide API changes to support GCM AEAD ciphers
+ * @author Brad Wetmore
+ */
+
+import javax.crypto.*;
+import javax.crypto.spec.*;
+import java.nio.ByteBuffer;
+
+/*
+ * At this point in time, we can't really do any testing since only the API
+ * is available, the underlying implementation doesn't exist yet.  Test
+ * what we can...
+ */
+public class GCMAPI {
+
+    // 16 elements
+    private static byte[] bytes = new byte[] {
+        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+        0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
+
+    private static int failed = 0;
+    private static Cipher c;
+
+    public static void main(String[] args) throws Exception {
+        c = Cipher.getInstance("AES");
+        c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(new byte[16], "AES"));
+
+        updateAADFail((byte[]) null);
+        updateAADPass(bytes);
+
+        updateAADFail(null, 2, 4);
+        updateAADFail(bytes, -2, 4);
+        updateAADFail(bytes, 2, -4);
+        updateAADFail(bytes, 2, 15);  // one too many
+
+        updateAADPass(bytes, 2, 14);  // ok.
+        updateAADPass(bytes, 4, 4);
+        updateAADPass(bytes, 0, 0);
+
+        ByteBuffer bb = ByteBuffer.wrap(bytes);
+
+        updateAADFail((ByteBuffer) null);
+        updateAADPass(bb);
+
+        if (failed != 0) {
+            throw new Exception("Test(s) failed");
+        }
+    }
+
+    private static void updateAADPass(byte[] src) {
+        try {
+            c.updateAAD(src);
+        } catch (UnsupportedOperationException e) {
+            // swallow
+        }catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void updateAADFail(byte[] src) {
+        try {
+            c.updateAAD(src);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+
+    private static void updateAADPass(byte[] src, int offset, int len) {
+        try {
+            c.updateAAD(src, offset, len);
+        } catch (UnsupportedOperationException e) {
+            // swallow
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void updateAADFail(byte[] src, int offset, int len) {
+        try {
+            c.updateAAD(src, offset, len);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+
+    private static void updateAADPass(ByteBuffer src) {
+        try {
+            c.updateAAD(src);
+        } catch (UnsupportedOperationException e) {
+            // swallow
+        }catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void updateAADFail(ByteBuffer src) {
+        try {
+            c.updateAAD(src);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/crypto/spec/GCMParameterSpec/GCMParameterSpecTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ *
+ * 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 7031343
+ * @summary Provide API changes to support GCM AEAD ciphers
+ * @author Brad Wetmore
+ */
+
+import javax.crypto.AEADBadTagException;
+import javax.crypto.spec.GCMParameterSpec;
+import java.util.Arrays;
+
+public class GCMParameterSpecTest {
+
+    // 16 elements
+    private static byte[] bytes = new byte[] {
+        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+        0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
+
+    private static int failed = 0;
+
+    public static void main(String[] args) throws Exception {
+        newGCMParameterSpecFail(-1, bytes);
+        newGCMParameterSpecFail(128, null);
+        newGCMParameterSpecPass(128, bytes);
+
+        newGCMParameterSpecFail(-1, bytes, 2, 4);
+        newGCMParameterSpecFail(128, null, 2, 4);
+        newGCMParameterSpecFail(128, bytes, -2, 4);
+        newGCMParameterSpecFail(128, bytes, 2, -4);
+        newGCMParameterSpecFail(128, bytes, 2, 15);  // one too many
+
+        newGCMParameterSpecPass(128, bytes, 2, 14);  // ok.
+        newGCMParameterSpecPass(96, bytes, 4, 4);
+        newGCMParameterSpecPass(96, bytes, 0, 0);
+
+        // Might as well check the Exception constructors.
+        try {
+            new AEADBadTagException();
+            new AEADBadTagException("Bad Tag Seen");
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+
+        if (failed != 0) {
+            throw new Exception("Test(s) failed");
+        }
+    }
+
+    private static void newGCMParameterSpecPass(
+            int tLen, byte[] src) {
+        try {
+            GCMParameterSpec gcmps = new GCMParameterSpec(tLen, src);
+            if (gcmps.getTLen() != tLen) {
+                throw new Exception("tLen's not equal");
+            }
+            if (!Arrays.equals(gcmps.getIV(), src)) {
+                throw new Exception("IV's not equal");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void newGCMParameterSpecFail(
+            int tLen, byte[] src) {
+        try {
+            new GCMParameterSpec(tLen, src);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+
+    private static void newGCMParameterSpecPass(
+            int tLen, byte[] src, int offset, int len) {
+        try {
+            GCMParameterSpec gcmps =
+                new GCMParameterSpec(tLen, src, offset, len);
+            if (gcmps.getTLen() != tLen) {
+                throw new Exception("tLen's not equal");
+            }
+            if (!Arrays.equals(gcmps.getIV(),
+                    Arrays.copyOfRange(src, offset, offset + len))) {
+                System.out.println(offset + " " + len);
+                System.out.println(Arrays.copyOfRange(src, offset, len)[0]);
+                throw new Exception("IV's not equal");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            failed++;
+        }
+    }
+
+    private static void newGCMParameterSpecFail(
+            int tLen, byte[] src, int offset, int len) {
+        try {
+            new GCMParameterSpec(tLen, src, offset, len);
+            new Exception("Didn't Fail as Expected").printStackTrace();
+            failed++;
+        } catch (IllegalArgumentException e) {
+            // swallow
+        }
+    }
+}
--- a/jdk/test/javax/imageio/metadata/DOML3Node.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/javax/imageio/metadata/DOML3Node.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 6559064
+ * @bug 6559064 6942504
  *
  * @summary Verify DOM L3 Node APIs behave as per Image I/O spec.
  *
@@ -34,6 +34,7 @@
 
 import javax.imageio.metadata.IIOMetadataNode;
 import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.UserDataHandler;
 
@@ -74,7 +75,7 @@
         }
 
         try {
-            node.setUserData("key");
+            node.getUserData("key");
             throw new RuntimeException("No expected DOM exception");
         } catch (DOMException e) {
         }
@@ -116,12 +117,6 @@
         }
 
         try {
-            node.lookupPrefix("namespaceURI");
-            throw new RuntimeException("No expected DOM exception");
-        } catch (DOMException e) {
-        }
-
-        try {
             node.getTextContent();
             throw new RuntimeException("No expected DOM exception");
         } catch (DOMException e) {
--- a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java	Tue Apr 26 15:48:03 2011 -0700
@@ -59,9 +59,7 @@
         toolkit.realSync();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                if (panel.getPaintRectangle() != null) {
-                    throw new RuntimeException("paint rectangle is not null");
-                }
+                panel.resetPaintRectangle();
                 button.repaint();
             }
         });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ *
+ * 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 6596966
+   @summary Some JFileChooser mnemonics do not work with sticky keys
+ * @library ../../regtesthelpers
+ * @build Util
+   @run main bug6596966
+   @author Pavel Porvatov
+*/
+
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class bug6596966 {
+    private static JFrame frame;
+
+    private static JLabel label;
+    private static JButton button;
+    private static JComboBox comboBox;
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                button = new JButton("Button");
+                comboBox = new JComboBox();
+
+                label = new JLabel("Label");
+                label.setDisplayedMnemonic('L');
+                label.setLabelFor(comboBox);
+
+                JPanel pnContent = new JPanel();
+
+                pnContent.add(button);
+                pnContent.add(label);
+                pnContent.add(comboBox);
+
+                frame = new JFrame();
+
+                frame.add(pnContent);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+
+        Util.blockTillDisplayed(frame);
+
+        robot.keyPress(KeyEvent.VK_ALT);
+        robot.keyPress(KeyEvent.VK_L);
+
+        robot.waitForIdle();
+
+        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED,
+                EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_L, 'L'));
+
+        robot.waitForIdle();
+
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    if (!comboBox.isFocusOwner()) {
+                        throw new RuntimeException("comboBox isn't focus owner");
+                    }
+                }
+            });
+        } finally {
+            robot.keyRelease(KeyEvent.VK_ALT);
+        }
+    }
+}
--- a/jdk/test/javax/swing/JLabel/7004134/bug7004134.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/javax/swing/JLabel/7004134/bug7004134.java	Tue Apr 26 15:48:03 2011 -0700
@@ -52,7 +52,13 @@
                 frame.add(label);
                 frame.pack();
                 frame.setVisible(true);
+            }
+        });
 
+        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
                 ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
 
                 toolTipManager.setInitialDelay(0);
@@ -83,7 +89,13 @@
                             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                             frame.pack();
                             frame.setVisible(true);
+                        }
+                    });
 
+                    ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+
+                    SwingUtilities.invokeAndWait(new Runnable() {
+                        public void run() {
                             ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
 
                             toolTipManager.setInitialDelay(0);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenuItem/7036148/bug7036148.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ *
+ * 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 7036148
+ * @summary NullPointerException with null JMenu name
+ * @author Alexander Potochkin
+ * @run main bug7036148
+ */
+
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+public class bug7036148 extends JFrame {
+    public bug7036148() {
+        JMenuBar bar = new JMenuBar();
+        Action menuAction = new AbstractAction(null, null){
+            public void actionPerformed(ActionEvent e) {
+            }
+        };
+        JMenu menu = new JMenu(menuAction);
+        menu.add(new JMenuItem("test"));
+        bar.add(menu);
+        setJMenuBar(bar);
+        pack();
+    }
+
+       public static void main(String[] args) {
+            new bug7036148();
+       }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/border/Test7034614.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ *
+ * 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 7034614
+ * @summary Tests that TitledBorder does not modify Insets
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.image.BufferedImage;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+
+public class Test7034614 {
+
+    public static void main(String[] args) {
+        Graphics g = new BufferedImage(9, 9, 9).getGraphics();
+
+        BrokenBorder broken = new BrokenBorder();
+        TitledBorder titled = new TitledBorder(broken, broken.getClass().getName());
+
+        Insets insets = (Insets) broken.getBorderInsets(broken).clone();
+        titled.getBorderInsets(broken);
+        broken.validate(insets);
+        for (int i = 0; i < 10; i++) {
+            titled.paintBorder(broken, g, 0, 0, i, i);
+            broken.validate(insets);
+            titled.getBaseline(broken, i, i);
+            broken.validate(insets);
+        }
+    }
+
+    private static class BrokenBorder extends Component implements Border {
+        private Insets insets = new Insets(1, 2, 3, 4);
+
+        private void validate(Insets insets) {
+            if (!this.insets.equals(insets)) {
+                throw new Error("unexpected change");
+            }
+        }
+
+        public Insets getBorderInsets(Component c) {
+            return this.insets;
+        }
+
+        public boolean isBorderOpaque() {
+            return false;
+        }
+
+        public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/7032791/bug7032791.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ *
+ * 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 7032791
+ * @author Alexander Potochkin
+ * @summary TableCellRenderer.getTableCellRendererComponent() doesn't accept null JTable with GTK+ L&F
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import javax.swing.table.TableCellRenderer;
+
+public class bug7032791 {
+
+    public static void main(String[] args) throws Exception {
+
+        UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+        Object value = "Test value";
+        JTable table = new JTable(1, 1);
+        TableCellRenderer renderer = table.getDefaultRenderer(Object.class);
+        renderer.getTableCellRendererComponent(null, value, true, true, 0, 0);
+        System.out.println("OK");
+    }
+}
+
--- a/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java	Tue Apr 26 15:48:03 2011 -0700
@@ -31,6 +31,8 @@
    @run main bug6796710
  */
 
+import sun.awt.SunToolkit;
+
 import javax.swing.*;
 import java.awt.*;
 import java.awt.image.BufferedImage;
@@ -91,7 +93,7 @@
             }
         });
 
-        robot.waitForIdle();
+        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
 
         BufferedImage bufferedImage = getPnBottomImage();
 
@@ -101,7 +103,10 @@
             }
         });
 
-        robot.waitForIdle();
+        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+
+        // On Linux platforms realSync doesn't guaranties setSize completion
+        Thread.sleep(1000);
 
         if (!Util.compareBufferedImages(bufferedImage, getPnBottomImage())) {
             throw new RuntimeException("The test failed");
--- a/jdk/test/javax/swing/text/GlyphView/6539700/bug6539700.java	Tue Apr 19 16:01:27 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2009, 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 6539700
- * @summary test that the long space-less lines are correctly soft-wrapped
- * @author Sergey Groznyh
- * @run main bug6539700
- */
-
-import javax.swing.JEditorPane;
-import javax.swing.JFrame;
-import javax.swing.SwingUtilities;
-import javax.swing.text.ParagraphView;
-import javax.swing.text.View;
-
-public class bug6539700 {
-    static JFrame f;
-    static JEditorPane ep;
-    static String text = "AAAAAAAA<b>AAAAAA</b>AAAAAAAA<b>AAAAAAAAA</b>" +
-                         "AA<b>AAA</b>AAAAAAAAA";
-    static int size = 100;
-    static Class rowClass = null;
-
-    static void createContentPane() {
-        ep = new JEditorPane();
-        ep.setContentType("text/html");
-        ep.setEditable(false);
-        ep.setText(text);
-        f = new JFrame();
-        f.setSize(size, 2 * size);
-        f.add(ep);
-        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        f.setVisible(true);
-    }
-
-    static void checkRows(View v, boolean last) {
-        int width = (int) v.getPreferredSpan(View.X_AXIS);
-
-        if (v.getClass() == rowClass) {
-            // Row width shouldn't exceed the container width
-            if (width > size) {
-                throw new RuntimeException("too long row: " + width);
-            }
-
-            // Row shouldn't be too short (except for the last one)
-            if (!last) {
-                if (width < size * 2 / 3) {
-                    throw new RuntimeException("too short row: " + width);
-                }
-            }
-        }
-
-        int n = v.getViewCount();
-        if (n > 0) {
-            for (int i = 0; i < n; i++) {
-                View c = v.getView(i);
-                checkRows(c, i == n - 1);
-            }
-        }
-    }
-
-    public static void main(String[] argv) {
-        try {
-            SwingUtilities.invokeAndWait(new Runnable() {
-                public void run() {
-                    createContentPane();
-                }
-            });
-        } catch (Exception ex) {
-            throw new RuntimeException(ex);
-        }
-
-        Class[] pvchildren = ParagraphView.class.getDeclaredClasses();
-        for (Class c : pvchildren) {
-            if (c.getName().equals("javax.swing.text.ParagraphView$Row")) {
-                rowClass = c;
-                break;
-            }
-        }
-        if (rowClass == null) {
-            throw new RuntimeException("can't find ParagraphView.Row class");
-        }
-
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                checkRows(ep.getUI().getRootView(ep), true);
-            }
-        });
-
-        System.out.println("OK");
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/parser/Parser/7003777/bug7003777.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010, 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 7003777
+   @summary Nonexistent html entities not parsed properly.
+   @author Pavel Porvatov
+*/
+
+import javax.swing.*;
+import javax.swing.text.BadLocationException;
+
+public class bug7003777 {
+    private static final String[] TEST_STRINGS = {
+            "&a",
+            "&aa",
+            "&a;",
+            "&aa;",
+    };
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JTextPane pane = new JTextPane();
+
+                pane.setContentType("text/html");
+
+                for (String testString : TEST_STRINGS) {
+                    pane.setText(testString);
+
+                    String parsedText;
+
+                    try {
+                        parsedText = pane.getDocument().getText(0, pane.getDocument().getLength());
+                    } catch (BadLocationException e) {
+                        throw new RuntimeException("The test failed.", e);
+                    }
+
+                    if (parsedText.charAt(0) != '\n') {
+                        throw new RuntimeException("The first char should be \\n");
+                    }
+
+                    parsedText = parsedText.substring(1);
+
+                    if (!testString.equals(parsedText)) {
+                        throw new RuntimeException("The '" + testString +
+                                "' string wasn't parsed correctly. Parsed value is '" + parsedText + "'");
+                    }
+                }
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sample/chatserver/ChatTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,399 @@
+/*
+ * 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.
+ *
+ * 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
+ * @summary Test chat server chatserver test
+ *
+ * @library ../../../src/share/sample/nio/chatserver
+ * @build ChatTest ChatServer Client ClientReader DataReader MessageReader NameReader
+ * @run main ChatTest
+ */
+
+import java.io.*;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CyclicBarrier;
+
+public class ChatTest {
+    public static int listeningPort = 0;
+
+    public static void main(String[] args) throws Throwable {
+        testStartStop();
+        testPortOpen();
+        testAsksForName();
+        testUseName();
+        testConnectDisconnectConnect();
+        testUsernameAndMessage();
+        testDontReceiveMessageInNameState();
+    }
+
+    private static ChatServer startServer() throws IOException {
+        ChatServer server = new ChatServer(0);
+        InetSocketAddress address = (InetSocketAddress) server.getSocketAddress();
+        listeningPort = address.getPort();
+        server.run();
+        return server;
+    }
+
+    public static void testStartStop() throws Exception {
+        ChatServer server = startServer();
+        server.shutdown();
+    }
+
+    public static void testPortOpen() throws Exception {
+        ChatServer server = startServer();
+        try {
+            Socket socket = new Socket("localhost", listeningPort);
+            if (!socket.isConnected()) {
+                throw new RuntimeException("Failed to connect to server: port not open");
+            }
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testAsksForName() throws Exception {
+        ChatServer server = startServer();
+        try {
+            Socket socket = new Socket("localhost", listeningPort);
+
+            Reader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+            String string = readAvailableString(reader);
+            if (!string.equals("Name: ")) {
+                throw new RuntimeException("Server doesn't send Name: ");
+            }
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testUseName() throws Throwable {
+        ChatServer server = startServer();
+        try {
+            performTestUseName();
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testConnectDisconnectConnect() throws Exception {
+        ChatServer server = startServer();
+        try {
+            performTestConnectDisconnectConnect();
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testUsernameAndMessage() throws Exception {
+        ChatServer server = startServer();
+        try {
+            performTestUsernameAndMessage();
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    public static void testDontReceiveMessageInNameState() throws Exception {
+        ChatServer server = startServer();
+        try {
+            performDontReceiveMessageInNameState();
+        } finally {
+            server.shutdown();
+        }
+    }
+
+    private static void assertEqual(List<Exception> exception, Object value, Object expected) {
+        if (expected == value) {
+            return;
+        }
+        if (expected == null) {
+            exception.add(new RuntimeException("Expected null, but was: " + value));
+            return;
+        }
+        if (!expected.equals(value)) {
+            exception.add(new RuntimeException("Expected: " + expected + " but was: " + value));
+            return;
+        }
+    }
+
+    private static void performDontReceiveMessageInNameState() throws Exception {
+        final CyclicBarrier barrier1 = new CyclicBarrier(2);
+        final CyclicBarrier barrier2 = new CyclicBarrier(2);
+        final CyclicBarrier barrier3 = new CyclicBarrier(2);
+        final List<Exception> exceptions = Collections.synchronizedList(new ArrayList<Exception>());
+
+        ChatConnection chatConnection = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                writer.write("testClient1\n");
+                waitForJoin(reader, "testClient1");
+                barrier1.await();
+                writer.write("Ignore this!\n");
+                barrier2.await();
+                barrier3.await();
+            }
+        };
+
+        Thread client2 = new Thread(new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                barrier1.await();
+                barrier2.await();
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                string = readAvailableString(reader, true);
+                assertEqual(exceptions, string, null);
+                writer.write("testClient2\n");
+                barrier3.await();
+            }
+        });
+
+        client2.start();
+        chatConnection.run();
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+
+    }
+
+    private static void waitForJoin(BufferedReader reader, String s) throws IOException {
+        String joined;
+        do {
+            joined = readAvailableString(reader);
+        } while (!(joined != null && joined.contains("Welcome " + s)));
+    }
+
+    private static void performTestUsernameAndMessage() throws Exception {
+        final CyclicBarrier barrier1 = new CyclicBarrier(2);
+        final CyclicBarrier barrier2 = new CyclicBarrier(2);
+        final CyclicBarrier barrier3 = new CyclicBarrier(2);
+        final List<Exception> exceptions = Collections.synchronizedList(new ArrayList<Exception>());
+
+        ChatConnection chatConnection = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                writer.write("testClient1\n");
+                waitForJoin(reader, "testClient1");
+                barrier1.await();
+                barrier2.await();
+                string = readAvailableString(reader);
+                assertEqual(exceptions, string, "testClient2: Hello world!\n");
+                barrier3.await();
+            }
+        };
+
+        Thread client2 = new Thread(new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                barrier1.await();
+                writer.write("testClient2\nHello world!\n");
+                barrier2.await();
+                barrier3.await();
+            }
+        });
+
+        client2.start();
+        chatConnection.run();
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+    }
+
+    private static void performTestConnectDisconnectConnect() throws Exception {
+        final CyclicBarrier barrier1 = new CyclicBarrier(2);
+        final CyclicBarrier barrier2 = new CyclicBarrier(2);
+        final CyclicBarrier barrier3 = new CyclicBarrier(2);
+        final List<Exception> exceptions = new ArrayList<Exception>();
+
+        ChatConnection chatConnection = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "Name: ");
+                writer.write("testClient1\n");
+            }
+        };
+
+        ChatConnection chatConnection2 = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                readAvailableString(reader);
+                writer.write("testClient1\n");
+                waitForJoin(reader, "testClient1");
+                barrier1.await();
+                writer.write("Good morning!\n");
+                barrier2.await();
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "testClient2: Hello world!\n");
+                barrier3.await();
+            }
+        };
+
+        Thread client2 = new Thread(new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                readAvailableString(reader);
+                writer.write("testClient2\n");
+                waitForJoin(reader, "testClient2");
+                barrier1.await();
+                writer.write("Hello world!\n");
+                barrier2.await();
+                String string = readAvailableString(reader);
+                assertEqual(exceptions, string, "testClient1: Good morning!\n");
+                barrier3.await();
+            }
+        });
+
+        client2.start();
+        chatConnection.run();
+        chatConnection2.run();
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+    }
+
+    private static void performTestUseName() throws Exception {
+        final CyclicBarrier barrier1 = new CyclicBarrier(2);
+        final CyclicBarrier barrier2 = new CyclicBarrier(2);
+        final CyclicBarrier barrier3 = new CyclicBarrier(2);
+        final List<Exception> exceptions = new ArrayList<Exception>();
+
+        ChatConnection chatConnection = new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                if (!"Name: ".equals(string)) {
+                    exceptions.add(new RuntimeException("Expected Name: "));
+                }
+                writer.write("testClient1\n");
+                waitForJoin(reader, "testClient1");
+                barrier1.await();
+                barrier2.await();
+                string = readAvailableString(reader);
+                if (!"testClient2: Hello world!\n".equals(string)) {
+                    exceptions.add(new RuntimeException("testClient2: Hello world!\n"));
+                }
+                barrier3.await();
+            }
+        };
+
+        Thread client2 = new Thread(new ChatConnection() {
+            @Override
+            public void run(Socket socket, BufferedReader reader, Writer writer) throws Exception {
+                String string = readAvailableString(reader);
+                if (!"Name: ".equals(string)) {
+                    exceptions.add(new RuntimeException("Expected Name: "));
+                }
+                writer.write("testClient2\n");
+                waitForJoin(reader, "testClient2");
+                barrier1.await();
+                writer.write("Hello world!\n");
+                barrier2.await();
+                barrier3.await();
+            }
+        });
+
+        client2.start();
+        chatConnection.run();
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+    }
+
+    private static String readAvailableString(Reader reader) throws IOException {
+        return readAvailableString(reader, false);
+    }
+
+    private static String readAvailableString(Reader reader, boolean now) throws IOException {
+        StringBuilder builder = new StringBuilder();
+        int bytes;
+        if (now && !reader.ready()) {
+            return null;
+        }
+        do {
+            char[] buf = new char[256];
+            bytes = reader.read(buf);
+            builder.append(buf, 0, bytes);
+        } while (bytes == 256);
+        return builder.toString();
+    }
+
+    private abstract static class ChatConnection implements Runnable {
+        public Exception exception;
+
+        @Override
+        public void run() {
+            try (Socket socket = new Socket("localhost", listeningPort);
+            BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+            Writer writer = new FlushingWriter(new OutputStreamWriter(socket.getOutputStream()))) {
+                socket.setTcpNoDelay(true);
+
+                run(socket, reader, writer);
+            } catch (Exception e) {
+                exception = e;
+            }
+        }
+
+        public abstract void run(Socket socket, BufferedReader reader, Writer writer) throws Exception;
+    }
+
+    private static class FlushingWriter extends Writer {
+        public final Writer delegate;
+
+        private FlushingWriter(Writer delegate) {
+            this.delegate = delegate;
+        }
+
+        @Override
+        public void write(char[] cbuf, int off, int len) throws IOException {
+            delegate.write(cbuf, off, len);
+        }
+
+        @Override
+        public void flush() throws IOException {
+            delegate.flush();
+        }
+
+        @Override
+        public void close() throws IOException {
+            delegate.close();
+        }
+
+        @Override
+        public void write(String str) throws IOException {
+            super.write(str);
+            flush();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sample/mergesort/MergeSortTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ *
+ * 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
+ * @summary Test MergeSort
+ *
+ * @library ../../../src/share/sample/forkjoin/mergesort
+ * @build MergeSortTest MergeDemo MergeSort
+ * @run main MergeSortTest
+ */
+
+import java.util.Arrays;
+import java.util.Random;
+
+public class MergeSortTest {
+    private Random random;
+    private MergeSort target;
+
+    public MergeSortTest(Random random, MergeSort target) {
+        this.random = random;
+        this.target = target;
+    }
+
+    public static void main(String[] args) {
+        MergeSortTest test = new MergeSortTest(new Random(), new MergeSort(Runtime.getRuntime().availableProcessors() * 4));
+        test.run();
+    }
+
+    private int[] generateArray(int elements) {
+        int[] array = new int[elements];
+        for (int i = 0; i < array.length; ++i) {
+            array[i] = random.nextInt(10);
+        }
+        return array;
+    }
+
+    private void run() {
+        testSort();
+        testSortSingle();
+        testSortEmpty();
+        testLong();
+    }
+
+    public void testLong() {
+        for (int i = 0; i < 1000; ++i) {
+            int elements = 1 + i * 100;
+
+            int[] array = generateArray(elements);
+            int[] copy = Arrays.copyOf(array, array.length);
+            Arrays.sort(copy);
+            target.sort(array);
+            assertEqual(copy, array);
+        }
+   }
+
+    private void testSortEmpty() {
+        int[] array = { };
+        target.sort(array);
+        assertEqual(new int[] { }, array);
+    }
+
+    private void testSortSingle() {
+        int[] array = { 1 };
+        target.sort(array);
+        assertEqual(new int[] { 1 }, array);
+    }
+
+    private void testSort() {
+        int[] array = { 7, 3, 9, 0, -6, 12, 54, 3, -6, 88, 1412};
+        target.sort(array);
+        assertEqual(new int[] { -6, -6, 0, 3, 3, 7, 9, 12, 54, 88, 1412 }, array);
+    }
+
+    private void assertEqual(int[] expected, int[] array) {
+        if (!Arrays.equals(expected, array)) {
+            throw new RuntimeException("Invalid sorted array!");
+        }
+    }
+
+
+}
--- a/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6476665
+ * @bug 6476665 7033534
  * @summary Verifies color conversion of Component Color Model based images
  * @run main ColConvCCMTest
  */
--- a/jdk/test/sun/java2d/cmm/ColorConvertOp/MTColConvTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/sun/java2d/cmm/ColorConvertOp/MTColConvTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6476665
+ * @bug 6476665 7033534
  * @summary Verifies MT safety of color conversion of Component and Direct Color Model based images
  * @run main MTColConvTest
  */
--- a/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	Tue Apr 26 15:48:03 2011 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -26,16 +26,16 @@
 
 # @test
 # @bug 4763315
-# @build CanonicalName Lookup 
+# @build CanonicalName Lookup
 # @run shell/timeout=120 cname.sh
 # @summary Test DNS provider's handling of CNAME records
 
 
 # The host that we try to resolve
 
-HOST=webcache.sfbay.sun.com
+HOST=www-proxy.us.oracle.com
 
-# fail gracefully if DNS is not configured or there 
+# fail gracefully if DNS is not configured or there
 # isn't a CNAME record.
 
 CLASSPATH=${TESTCLASSES}
@@ -43,7 +43,7 @@
 JAVA="${TESTJAVA}/bin/java"
 
 sh -xc "$JAVA CanonicalName $HOST" 2>&1
-if [ $? != 0 ]; then 
+if [ $? != 0 ]; then
     echo "DNS not configured or host doesn't resolve to CNAME record"
     exit 0
 fi
@@ -70,7 +70,7 @@
 go "$np $sm" "$HOST"
 
 
-# 
+#
 # Results
 #
 echo ''
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/KrbCredSubKey.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,352 @@
+/*
+ * 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.
+ *
+ * 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 7030180
+ * @run main/othervm KrbCredSubKey
+ * @summary AES 128/256 decrypt exception
+ */
+
+import java.io.FileOutputStream;
+import java.security.PrivilegedExceptionAction;
+import javax.security.auth.Subject;
+import javax.security.auth.kerberos.KerberosKey;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import org.ietf.jgss.GSSContext;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSManager;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.Config;
+import sun.security.krb5.EncryptedData;
+
+public class KrbCredSubKey {
+
+    public static void main(String[] args) throws Exception {
+
+        // We don't care about clock difference
+        new FileOutputStream("krb5.conf").write(
+                "[libdefaults]\nclockskew=999999999".getBytes());
+        System.setProperty("java.security.krb5.conf", "krb5.conf");
+        Config.refresh();
+
+        Subject subj = new Subject();
+        KerberosPrincipal kp = new KerberosPrincipal(princ);
+        KerberosKey kk = new KerberosKey(
+                kp, key, EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, 0);
+        subj.getPrincipals().add(kp);
+        subj.getPrivateCredentials().add(kk);
+
+        Subject.doAs(subj, new PrivilegedExceptionAction() {
+            public Object run() throws Exception {
+                GSSManager man = GSSManager.getInstance();
+                GSSContext ctxt = man.createContext(man.createCredential(
+                        null, GSSCredential.INDEFINITE_LIFETIME,
+                        GSSUtil.GSS_KRB5_MECH_OID, GSSCredential.ACCEPT_ONLY));
+                return ctxt.acceptSecContext(token, 0, token.length);
+            }
+        });
+    }
+
+    // All following data generated by myself on a test machine
+
+    private static String princ = "server/host.rabbit.hole@RABBIT.HOLE";
+
+    // A aes-128 key for princ
+    private static byte[] key = {
+            (byte)0x83, (byte)0xA1, (byte)0xD6, (byte)0xE2,
+            (byte)0xC7, (byte)0x76, (byte)0xD5, (byte)0x24,
+            (byte)0x63, (byte)0x9F, (byte)0xF9, (byte)0xFF,
+            (byte)0x76, (byte)0x6D, (byte)0x26, (byte)0x30,
+    };
+
+    // A JGSS token generated by the first call of an initiator's
+    // initSecContext, targetting princ, using the authenticator
+    // subkey to encrypt the KRB_CRED inside AP_REQ
+    private static byte[] token = {
+            (byte)0x60, (byte)0x82, (byte)0x04, (byte)0x1C,
+            (byte)0x06, (byte)0x09, (byte)0x2A, (byte)0x86,
+            (byte)0x48, (byte)0x86, (byte)0xF7, (byte)0x12,
+            (byte)0x01, (byte)0x02, (byte)0x02, (byte)0x01,
+            (byte)0x00, (byte)0x6E, (byte)0x82, (byte)0x04,
+            (byte)0x0B, (byte)0x30, (byte)0x82, (byte)0x04,
+            (byte)0x07, (byte)0xA0, (byte)0x03, (byte)0x02,
+            (byte)0x01, (byte)0x05, (byte)0xA1, (byte)0x03,
+            (byte)0x02, (byte)0x01, (byte)0x0E, (byte)0xA2,
+            (byte)0x07, (byte)0x03, (byte)0x05, (byte)0x00,
+            (byte)0x20, (byte)0x00, (byte)0x00, (byte)0x00,
+            (byte)0xA3, (byte)0x82, (byte)0x01, (byte)0x04,
+            (byte)0x61, (byte)0x82, (byte)0x01, (byte)0x00,
+            (byte)0x30, (byte)0x81, (byte)0xFD, (byte)0xA0,
+            (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x05,
+            (byte)0xA1, (byte)0x0D, (byte)0x1B, (byte)0x0B,
+            (byte)0x52, (byte)0x41, (byte)0x42, (byte)0x42,
+            (byte)0x49, (byte)0x54, (byte)0x2E, (byte)0x48,
+            (byte)0x4F, (byte)0x4C, (byte)0x45, (byte)0xA2,
+            (byte)0x25, (byte)0x30, (byte)0x23, (byte)0xA0,
+            (byte)0x03, (byte)0x02, (byte)0x01, (byte)0x00,
+            (byte)0xA1, (byte)0x1C, (byte)0x30, (byte)0x1A,
+            (byte)0x1B, (byte)0x06, (byte)0x73, (byte)0x65,
+            (byte)0x72, (byte)0x76, (byte)0x65, (byte)0x72,
+            (byte)0x1B, (byte)0x10, (byte)0x68, (byte)0x6F,
+            (byte)0x73, (byte)0x74, (byte)0x2E, (byte)0x72,
+            (byte)0x61, (byte)0x62, (byte)0x62, (byte)0x69,
+            (byte)0x74, (byte)0x2E, (byte)0x68, (byte)0x6F,
+            (byte)0x6C, (byte)0x65, (byte)0xA3, (byte)0x81,
+            (byte)0xBF, (byte)0x30, (byte)0x81, (byte)0xBC,
+            (byte)0xA0, (byte)0x03, (byte)0x02, (byte)0x01,
+            (byte)0x11, (byte)0xA2, (byte)0x81, (byte)0xB4,
+            (byte)0x04, (byte)0x81, (byte)0xB1, (byte)0xA7,
+            (byte)0xE8, (byte)0x58, (byte)0xBA, (byte)0x98,
+            (byte)0x69, (byte)0x45, (byte)0xB3, (byte)0x68,
+            (byte)0xBF, (byte)0xFD, (byte)0x25, (byte)0x74,
+            (byte)0xC4, (byte)0x2E, (byte)0x09, (byte)0x7B,
+            (byte)0x3C, (byte)0x7F, (byte)0xA5, (byte)0x6C,
+            (byte)0xC3, (byte)0x86, (byte)0xC9, (byte)0xEE,
+            (byte)0x58, (byte)0xD3, (byte)0x7C, (byte)0xD6,
+            (byte)0x19, (byte)0xA1, (byte)0x3B, (byte)0xF7,
+            (byte)0x17, (byte)0xD6, (byte)0x18, (byte)0xA9,
+            (byte)0x58, (byte)0x43, (byte)0x55, (byte)0xD6,
+            (byte)0xBA, (byte)0x85, (byte)0xF7, (byte)0x6B,
+            (byte)0x20, (byte)0x01, (byte)0xEF, (byte)0xB4,
+            (byte)0x74, (byte)0x0B, (byte)0x31, (byte)0x07,
+            (byte)0x55, (byte)0xD8, (byte)0x8C, (byte)0x85,
+            (byte)0x25, (byte)0x12, (byte)0x66, (byte)0x85,
+            (byte)0xA8, (byte)0x5A, (byte)0x84, (byte)0xB2,
+            (byte)0x6C, (byte)0xDE, (byte)0xEE, (byte)0xF9,
+            (byte)0x15, (byte)0xF2, (byte)0xBC, (byte)0xB0,
+            (byte)0x43, (byte)0xA5, (byte)0x21, (byte)0x31,
+            (byte)0xFA, (byte)0x2F, (byte)0x2C, (byte)0x37,
+            (byte)0x39, (byte)0xD8, (byte)0xAA, (byte)0xE0,
+            (byte)0x78, (byte)0x08, (byte)0x18, (byte)0xFB,
+            (byte)0x03, (byte)0x43, (byte)0x22, (byte)0xE6,
+            (byte)0x2C, (byte)0xF2, (byte)0x98, (byte)0xDC,
+            (byte)0x2A, (byte)0xDE, (byte)0x8C, (byte)0x95,
+            (byte)0x0B, (byte)0xB6, (byte)0xE6, (byte)0x0F,
+            (byte)0xB5, (byte)0x4E, (byte)0xAD, (byte)0xAC,
+            (byte)0xD1, (byte)0x4C, (byte)0xE8, (byte)0x22,
+            (byte)0x93, (byte)0x38, (byte)0xA2, (byte)0x44,
+            (byte)0x0E, (byte)0x83, (byte)0x9E, (byte)0x4D,
+            (byte)0xC0, (byte)0x1A, (byte)0x02, (byte)0xB2,
+            (byte)0xB8, (byte)0xCE, (byte)0xDF, (byte)0xB5,
+            (byte)0xFB, (byte)0xF2, (byte)0x75, (byte)0x5E,
+            (byte)0x74, (byte)0xC1, (byte)0x90, (byte)0x82,
+            (byte)0x60, (byte)0x00, (byte)0xA5, (byte)0xC3,
+            (byte)0xBF, (byte)0x66, (byte)0x97, (byte)0x0E,
+            (byte)0xF3, (byte)0x9F, (byte)0xB3, (byte)0xD9,
+            (byte)0x51, (byte)0x51, (byte)0x38, (byte)0xBC,
+            (byte)0xD9, (byte)0xC1, (byte)0xD0, (byte)0x1E,
+            (byte)0x90, (byte)0x9B, (byte)0x43, (byte)0xEE,
+            (byte)0xD9, (byte)0xD6, (byte)0x3E, (byte)0x31,
+            (byte)0xEA, (byte)0x8E, (byte)0xB1, (byte)0xDC,
+            (byte)0xDE, (byte)0xFD, (byte)0xA4, (byte)0x77,
+            (byte)0x6C, (byte)0x4A, (byte)0x81, (byte)0x1F,
+            (byte)0xA4, (byte)0x82, (byte)0x02, (byte)0xE8,
+            (byte)0x30, (byte)0x82, (byte)0x02, (byte)0xE4,
+            (byte)0xA0, (byte)0x03, (byte)0x02, (byte)0x01,
+            (byte)0x11, (byte)0xA2, (byte)0x82, (byte)0x02,
+            (byte)0xDB, (byte)0x04, (byte)0x82, (byte)0x02,
+            (byte)0xD7, (byte)0x81, (byte)0x78, (byte)0x25,
+            (byte)0x75, (byte)0x92, (byte)0x7A, (byte)0xEC,
+            (byte)0xBE, (byte)0x31, (byte)0xF1, (byte)0x50,
+            (byte)0xE7, (byte)0xC1, (byte)0x32, (byte)0xA5,
+            (byte)0xCB, (byte)0x34, (byte)0x46, (byte)0x95,
+            (byte)0x2B, (byte)0x84, (byte)0xB7, (byte)0x06,
+            (byte)0x0E, (byte)0x15, (byte)0x02, (byte)0x74,
+            (byte)0xCA, (byte)0x18, (byte)0x5D, (byte)0xE8,
+            (byte)0x0E, (byte)0x1B, (byte)0xB7, (byte)0x77,
+            (byte)0x5A, (byte)0x6C, (byte)0xFB, (byte)0x94,
+            (byte)0x82, (byte)0x2B, (byte)0xE6, (byte)0x14,
+            (byte)0x0C, (byte)0xDA, (byte)0x22, (byte)0xA2,
+            (byte)0x42, (byte)0xD7, (byte)0xB0, (byte)0xFC,
+            (byte)0xCA, (byte)0x4A, (byte)0xEA, (byte)0xB8,
+            (byte)0x92, (byte)0xB5, (byte)0x8C, (byte)0x71,
+            (byte)0xED, (byte)0x2B, (byte)0x46, (byte)0xC5,
+            (byte)0xE5, (byte)0x47, (byte)0x76, (byte)0x29,
+            (byte)0x27, (byte)0x0F, (byte)0xFF, (byte)0x03,
+            (byte)0x72, (byte)0x13, (byte)0xAA, (byte)0xDB,
+            (byte)0x4E, (byte)0xFF, (byte)0x48, (byte)0x36,
+            (byte)0xAB, (byte)0x73, (byte)0xD7, (byte)0xDA,
+            (byte)0xF1, (byte)0x80, (byte)0x1B, (byte)0x5B,
+            (byte)0x9A, (byte)0x88, (byte)0x07, (byte)0x47,
+            (byte)0x43, (byte)0x27, (byte)0xD5, (byte)0x00,
+            (byte)0x04, (byte)0xEE, (byte)0xAF, (byte)0x53,
+            (byte)0x5C, (byte)0xCC, (byte)0x2C, (byte)0xC7,
+            (byte)0x2F, (byte)0x94, (byte)0x12, (byte)0x86,
+            (byte)0xEF, (byte)0xAC, (byte)0xB1, (byte)0x6C,
+            (byte)0xB0, (byte)0xB5, (byte)0x3D, (byte)0x92,
+            (byte)0xBD, (byte)0xBE, (byte)0x7B, (byte)0x1A,
+            (byte)0x39, (byte)0x4A, (byte)0x1E, (byte)0x91,
+            (byte)0xA4, (byte)0xDF, (byte)0x82, (byte)0x12,
+            (byte)0x2E, (byte)0x67, (byte)0x17, (byte)0x92,
+            (byte)0xB3, (byte)0x93, (byte)0x38, (byte)0x32,
+            (byte)0x94, (byte)0xF5, (byte)0xF7, (byte)0x09,
+            (byte)0x07, (byte)0x5E, (byte)0x21, (byte)0x12,
+            (byte)0x70, (byte)0x37, (byte)0xAF, (byte)0x5A,
+            (byte)0x2D, (byte)0xAC, (byte)0xFF, (byte)0x22,
+            (byte)0x46, (byte)0xA0, (byte)0x12, (byte)0x74,
+            (byte)0x1C, (byte)0xA1, (byte)0x68, (byte)0xC3,
+            (byte)0x64, (byte)0xDB, (byte)0xC3, (byte)0x9F,
+            (byte)0xAB, (byte)0x0E, (byte)0x19, (byte)0xFE,
+            (byte)0xD9, (byte)0xA4, (byte)0xAA, (byte)0x7B,
+            (byte)0x73, (byte)0xAD, (byte)0xC8, (byte)0xA8,
+            (byte)0xD5, (byte)0x29, (byte)0xAD, (byte)0x1F,
+            (byte)0xEF, (byte)0x54, (byte)0xAE, (byte)0x72,
+            (byte)0x02, (byte)0xD9, (byte)0x06, (byte)0x0D,
+            (byte)0x1A, (byte)0x94, (byte)0x7B, (byte)0xBC,
+            (byte)0x32, (byte)0x9A, (byte)0xBC, (byte)0x4B,
+            (byte)0x33, (byte)0xC2, (byte)0x02, (byte)0xA3,
+            (byte)0xF4, (byte)0xB1, (byte)0xED, (byte)0x76,
+            (byte)0x0D, (byte)0x59, (byte)0xCD, (byte)0x56,
+            (byte)0xCB, (byte)0xDC, (byte)0xCE, (byte)0xED,
+            (byte)0xFF, (byte)0x25, (byte)0x84, (byte)0x5E,
+            (byte)0x41, (byte)0xF9, (byte)0x42, (byte)0xBE,
+            (byte)0x73, (byte)0xAC, (byte)0xA2, (byte)0x20,
+            (byte)0x97, (byte)0xB7, (byte)0x88, (byte)0x77,
+            (byte)0x65, (byte)0x43, (byte)0x9F, (byte)0xEE,
+            (byte)0xF4, (byte)0x3A, (byte)0x7E, (byte)0x9B,
+            (byte)0x5B, (byte)0x54, (byte)0xD3, (byte)0x0D,
+            (byte)0x50, (byte)0x6D, (byte)0xF6, (byte)0x14,
+            (byte)0xB7, (byte)0x5A, (byte)0x34, (byte)0x0F,
+            (byte)0x1F, (byte)0xC7, (byte)0x39, (byte)0x99,
+            (byte)0x9B, (byte)0x96, (byte)0xE3, (byte)0xAD,
+            (byte)0x86, (byte)0xE3, (byte)0x6A, (byte)0x71,
+            (byte)0x63, (byte)0x04, (byte)0xAD, (byte)0x9C,
+            (byte)0x17, (byte)0x68, (byte)0x44, (byte)0xFE,
+            (byte)0x21, (byte)0x62, (byte)0xD5, (byte)0x99,
+            (byte)0x4A, (byte)0xDF, (byte)0x48, (byte)0xDE,
+            (byte)0x9A, (byte)0xD4, (byte)0xBB, (byte)0xA1,
+            (byte)0x9B, (byte)0xE7, (byte)0x2A, (byte)0x08,
+            (byte)0x80, (byte)0x3A, (byte)0x08, (byte)0xA4,
+            (byte)0xBA, (byte)0xBE, (byte)0x1E, (byte)0x81,
+            (byte)0x63, (byte)0x20, (byte)0xAC, (byte)0x9C,
+            (byte)0x42, (byte)0x2F, (byte)0xCA, (byte)0x06,
+            (byte)0x95, (byte)0x92, (byte)0x97, (byte)0x09,
+            (byte)0x3C, (byte)0x0C, (byte)0x5A, (byte)0x99,
+            (byte)0xFB, (byte)0xAB, (byte)0xEB, (byte)0xDE,
+            (byte)0xC4, (byte)0x09, (byte)0xD3, (byte)0xA3,
+            (byte)0xF0, (byte)0x65, (byte)0xDC, (byte)0x5F,
+            (byte)0xAA, (byte)0xBB, (byte)0x28, (byte)0xC0,
+            (byte)0x3E, (byte)0xBF, (byte)0x77, (byte)0xAE,
+            (byte)0xCC, (byte)0x3A, (byte)0xD3, (byte)0x31,
+            (byte)0x0D, (byte)0x9B, (byte)0x96, (byte)0xEF,
+            (byte)0x2C, (byte)0xED, (byte)0x60, (byte)0x63,
+            (byte)0xC5, (byte)0x8F, (byte)0xCA, (byte)0xB0,
+            (byte)0xA2, (byte)0x0B, (byte)0x49, (byte)0x5A,
+            (byte)0xB2, (byte)0x8F, (byte)0xEF, (byte)0xE4,
+            (byte)0x19, (byte)0xC0, (byte)0xC6, (byte)0x2D,
+            (byte)0xD3, (byte)0x4F, (byte)0xB2, (byte)0xED,
+            (byte)0xA3, (byte)0xA4, (byte)0x6F, (byte)0xAE,
+            (byte)0xD4, (byte)0xE9, (byte)0xA2, (byte)0x5A,
+            (byte)0xFB, (byte)0xB0, (byte)0x14, (byte)0xBD,
+            (byte)0x06, (byte)0x12, (byte)0xD7, (byte)0x91,
+            (byte)0x15, (byte)0x46, (byte)0x78, (byte)0xE4,
+            (byte)0xD1, (byte)0x73, (byte)0xCA, (byte)0xA5,
+            (byte)0xA5, (byte)0x64, (byte)0xC8, (byte)0x6F,
+            (byte)0xD1, (byte)0xBD, (byte)0xEA, (byte)0x74,
+            (byte)0xE4, (byte)0xCA, (byte)0x40, (byte)0x16,
+            (byte)0x9E, (byte)0x46, (byte)0x7C, (byte)0x25,
+            (byte)0x6C, (byte)0x32, (byte)0xB4, (byte)0x14,
+            (byte)0xF9, (byte)0x26, (byte)0x8A, (byte)0x3A,
+            (byte)0xDD, (byte)0x51, (byte)0x26, (byte)0x79,
+            (byte)0x43, (byte)0x27, (byte)0x2E, (byte)0xED,
+            (byte)0xC7, (byte)0x82, (byte)0x7C, (byte)0xCE,
+            (byte)0x43, (byte)0x03, (byte)0x60, (byte)0x2A,
+            (byte)0x9C, (byte)0xB2, (byte)0x71, (byte)0x41,
+            (byte)0xAB, (byte)0x3D, (byte)0xA6, (byte)0xB5,
+            (byte)0x51, (byte)0xBC, (byte)0x80, (byte)0x1F,
+            (byte)0x96, (byte)0x73, (byte)0x23, (byte)0x11,
+            (byte)0xED, (byte)0xC0, (byte)0x1D, (byte)0x0B,
+            (byte)0xA0, (byte)0x13, (byte)0xB3, (byte)0x2F,
+            (byte)0x16, (byte)0x59, (byte)0x64, (byte)0x45,
+            (byte)0xE8, (byte)0x68, (byte)0xFB, (byte)0xF9,
+            (byte)0x6F, (byte)0xB0, (byte)0x2B, (byte)0xFB,
+            (byte)0x39, (byte)0xBB, (byte)0x53, (byte)0x8F,
+            (byte)0xD2, (byte)0xAF, (byte)0x38, (byte)0x5E,
+            (byte)0xEF, (byte)0x5B, (byte)0xE2, (byte)0x98,
+            (byte)0xE8, (byte)0x46, (byte)0x3C, (byte)0x03,
+            (byte)0x71, (byte)0x46, (byte)0x8D, (byte)0x41,
+            (byte)0x92, (byte)0x32, (byte)0x85, (byte)0x8D,
+            (byte)0xBA, (byte)0x33, (byte)0x05, (byte)0xB1,
+            (byte)0xE4, (byte)0x56, (byte)0x3E, (byte)0xF5,
+            (byte)0x20, (byte)0x35, (byte)0xA6, (byte)0x74,
+            (byte)0xA2, (byte)0xBE, (byte)0x54, (byte)0x08,
+            (byte)0xB4, (byte)0xFC, (byte)0x1D, (byte)0x13,
+            (byte)0x84, (byte)0xBE, (byte)0x1C, (byte)0xC5,
+            (byte)0x3E, (byte)0x43, (byte)0x14, (byte)0x6F,
+            (byte)0xC0, (byte)0x3D, (byte)0xF4, (byte)0xDC,
+            (byte)0x66, (byte)0x4E, (byte)0xF0, (byte)0x3E,
+            (byte)0xD4, (byte)0xC6, (byte)0xE9, (byte)0x8D,
+            (byte)0x7D, (byte)0xB9, (byte)0xDC, (byte)0x9F,
+            (byte)0xBE, (byte)0x54, (byte)0x63, (byte)0x93,
+            (byte)0x49, (byte)0x2F, (byte)0x6A, (byte)0xC3,
+            (byte)0x34, (byte)0xC5, (byte)0xF7, (byte)0x76,
+            (byte)0xE8, (byte)0xD5, (byte)0x5B, (byte)0xD9,
+            (byte)0x41, (byte)0xCA, (byte)0x74, (byte)0x25,
+            (byte)0x25, (byte)0x09, (byte)0xF4, (byte)0xD3,
+            (byte)0x00, (byte)0x9F, (byte)0x7D, (byte)0xFB,
+            (byte)0x3D, (byte)0xAB, (byte)0x87, (byte)0xF7,
+            (byte)0xCE, (byte)0x42, (byte)0x0F, (byte)0x60,
+            (byte)0xEB, (byte)0x03, (byte)0x47, (byte)0x98,
+            (byte)0x0F, (byte)0xEB, (byte)0xA4, (byte)0x05,
+            (byte)0xE2, (byte)0x58, (byte)0x8F, (byte)0x44,
+            (byte)0x09, (byte)0xD3, (byte)0x66, (byte)0x1E,
+            (byte)0x69, (byte)0x89, (byte)0xB7, (byte)0xEE,
+            (byte)0x8B, (byte)0xA4, (byte)0x8E, (byte)0x05,
+            (byte)0x2D, (byte)0x2E, (byte)0xB3, (byte)0x5A,
+            (byte)0xAE, (byte)0xAB, (byte)0x80, (byte)0xD6,
+            (byte)0x5C, (byte)0x93, (byte)0x40, (byte)0x91,
+            (byte)0x53, (byte)0xE6, (byte)0x13, (byte)0xD5,
+            (byte)0x2F, (byte)0x64, (byte)0xF0, (byte)0x68,
+            (byte)0xD2, (byte)0x85, (byte)0x94, (byte)0xE5,
+            (byte)0x2D, (byte)0x73, (byte)0x10, (byte)0x59,
+            (byte)0x18, (byte)0xCD, (byte)0xED, (byte)0xBC,
+            (byte)0x05, (byte)0x97, (byte)0xFD, (byte)0xE7,
+            (byte)0x6F, (byte)0x5D, (byte)0x7C, (byte)0x46,
+            (byte)0x28, (byte)0x5F, (byte)0xC2, (byte)0xB4,
+            (byte)0x31, (byte)0xA5, (byte)0x2B, (byte)0x82,
+            (byte)0xAB, (byte)0x32, (byte)0x49, (byte)0xA5,
+            (byte)0xCD, (byte)0x91, (byte)0x37, (byte)0x97,
+            (byte)0xA1, (byte)0x85, (byte)0x8F, (byte)0xBB,
+            (byte)0x6E, (byte)0x1E, (byte)0x9F, (byte)0xFC,
+            (byte)0x10, (byte)0x3B, (byte)0x8A, (byte)0xF6,
+            (byte)0x9A, (byte)0x66, (byte)0xBD, (byte)0x75,
+            (byte)0x4F, (byte)0x1D, (byte)0xBA, (byte)0x64,
+            (byte)0x15, (byte)0xDD, (byte)0x9F, (byte)0x00,
+            (byte)0x6C, (byte)0x2F, (byte)0x87, (byte)0x20,
+            (byte)0x25, (byte)0xA2, (byte)0x09, (byte)0x9F,
+            (byte)0x5D, (byte)0x64, (byte)0xC9, (byte)0xA8,
+            (byte)0x32, (byte)0x59, (byte)0x90, (byte)0x1D,
+            (byte)0x78, (byte)0xFE, (byte)0x5A, (byte)0xA2,
+            (byte)0x1F, (byte)0x9B, (byte)0x22, (byte)0xBE,
+            (byte)0x8F, (byte)0xEA, (byte)0x59, (byte)0x5B,
+            (byte)0x96, (byte)0xE3, (byte)0x4A, (byte)0xB2,
+            (byte)0x71, (byte)0x65, (byte)0xB7, (byte)0x3C,
+            (byte)0xC6, (byte)0x1B, (byte)0xD6, (byte)0x80,
+            (byte)0x90, (byte)0xD2, (byte)0xF2, (byte)0x6F,
+            (byte)0xA2, (byte)0x68, (byte)0x53, (byte)0xC0,
+            (byte)0x44, (byte)0xAF, (byte)0xD4, (byte)0x68,
+            (byte)0x12, (byte)0xFF, (byte)0xB4, (byte)0x36,
+            (byte)0x34, (byte)0x43, (byte)0xAC, (byte)0x1C,
+    };
+}
--- a/jdk/test/sun/security/krb5/auto/KDC.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/sun/security/krb5/auto/KDC.java	Tue Apr 26 15:48:03 2011 -0700
@@ -691,7 +691,10 @@
                     new KerberosTime(new Date()),
                     body.from,
                     till, body.rtime,
-                    body.addresses,
+                    body.addresses != null  // always set caddr
+                            ? body.addresses
+                            : new HostAddresses(
+                                new InetAddress[]{InetAddress.getLocalHost()}),
                     null);
             EncryptionKey skey = keyForUser(body.sname, e3, true);
             if (skey == null) {
@@ -716,7 +719,10 @@
                     till, body.rtime,
                     body.crealm,
                     body.sname,
-                    body.addresses
+                    body.addresses != null  // always set caddr
+                            ? body.addresses
+                            : new HostAddresses(
+                                new InetAddress[]{InetAddress.getLocalHost()})
                     );
             EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_TGS_REP_PART_SESSKEY);
             TGSRep tgsRep = new TGSRep(null,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/NoAddresses.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ *
+ * 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 7032354
+ * @run main/othervm NoAddresses 1
+ * @run main/othervm NoAddresses 2
+ * @run main/othervm/fail NoAddresses 3
+ * @summary no-addresses should not be used on acceptor side
+ */
+
+import java.net.InetAddress;
+import org.ietf.jgss.ChannelBinding;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.Config;
+
+public class NoAddresses {
+
+    public static void main(String[] args)
+            throws Exception {
+
+        OneKDC kdc = new OneKDC(null);
+        kdc.writeJAASConf();
+        KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
+                "noaddresses = false",
+                "default_keytab_name = " + OneKDC.KTAB);
+        Config.refresh();
+
+        Context c = Context.fromJAAS("client");
+        Context s = Context.fromJAAS("server");
+
+        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+        s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+        InetAddress initiator = InetAddress.getLocalHost();
+        InetAddress acceptor = InetAddress.getLocalHost();
+        switch (args[0]) {
+            case "1":
+                // no initiator host address available, should be OK
+                break;
+            case "2":
+                // correct initiator host address, still fine
+                c.x().setChannelBinding(
+                        new ChannelBinding(initiator, acceptor, null));
+                s.x().setChannelBinding(
+                        new ChannelBinding(initiator, acceptor, null));
+                break;
+            case "3":
+                // incorrect initiator host address, fail
+                initiator = InetAddress.getByAddress(new byte[]{1,1,1,1});
+                c.x().setChannelBinding(
+                        new ChannelBinding(initiator, acceptor, null));
+                s.x().setChannelBinding(
+                        new ChannelBinding(initiator, acceptor, null));
+                break;
+        }
+
+        Context.handshake(c, s);
+    }
+}
--- a/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,27 +22,44 @@
  */
 /**
  * @test
- * @bug 6581254
- * @summary Allow "~" in config to support windows short path
+ * @bug 6581254 6986789
+ * @summary Allow '~' and '+' in config file
  * @author Valerie Peng
  */
 
 import java.security.*;
 import java.io.*;
+import java.lang.reflect.*;
 
 public class ConfigShortPath {
 
-    public static void main(String[] args) {
-        String testSrc = System.getProperty("test.src", ".");
-        String configFile = testSrc + File.separator + "csp.cfg";
-        System.out.println("Testing against " + configFile);
+    private static final String[] configNames = { "csp.cfg", "cspPlus.cfg" };
+
+    public static void main(String[] args) throws Exception {
+        Constructor cons = null;
         try {
-            Provider p = new sun.security.pkcs11.SunPKCS11(configFile);
-        } catch (ProviderException pe) {
-            String cause = pe.getCause().getMessage();
-            if (cause.indexOf("Unexpected token") != -1) {
-                // re-throw to indicate test failure
-                throw pe;
+            Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11");
+            cons = clazz.getConstructor(String.class);
+        } catch (Exception ex) {
+            System.out.println("Skipping test - no PKCS11 provider available");
+            return;
+        }
+        String testSrc = System.getProperty("test.src", ".");
+        for (int i = 0; i < configNames.length; i++) {
+            String configFile = testSrc + File.separator + configNames[i];
+
+            System.out.println("Testing against " + configFile);
+            try {
+                Object obj = cons.newInstance(configFile);
+            } catch (InvocationTargetException ite) {
+                Throwable cause = ite.getCause();
+                if (cause instanceof ProviderException) {
+                    String causeMsg = cause.getCause().getMessage();
+                    // Indicate failure if due to parsing config
+                    if (causeMsg.indexOf("Unexpected token") != -1) {
+                        throw (ProviderException) cause;
+                    }
+                }
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Provider/cspPlus.cfg	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,4 @@
+showInfo = false
+name = NSS
+nssSecmodDirectory = /export/local/38289.JDK7.PIT.JSN-TL+7-b112_pit_security_oel5.5-x64-32/results/ResultDir/KeytoolNSS/db
+nssLibraryDirectory = /export/local/common/testbase/7/security/tools/lib/nss/Linux2.6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/javax/net/ssl/SSLContextVersion.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ *
+ * 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 6976117
+ * @summary SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets
+ *          without TLSv1.1 enabled
+ */
+
+import javax.net.ssl.*;
+
+public class SSLContextVersion {
+    static enum ContextVersion {
+        TLS_CV_01("SSL", "TLSv1", "TLSv1.2"),
+        TLS_CV_02("TLS", "TLSv1", "TLSv1.2"),
+        TLS_CV_03("SSLv3", "TLSv1", "TLSv1.2"),
+        TLS_CV_04("TLSv1", "TLSv1", "TLSv1.2"),
+        TLS_CV_05("TLSv1.1", "TLSv1.1", "TLSv1.2"),
+        TLS_CV_06("TLSv1.2", "TLSv1.2", "TLSv1.2"),
+        TLS_CV_07("Default", "TLSv1", "TLSv1.2");
+
+        final String contextVersion;
+        final String defaultProtocolVersion;
+        final String supportedProtocolVersion;
+
+        ContextVersion(String contextVersion, String defaultProtocolVersion,
+                String supportedProtocolVersion) {
+            this.contextVersion = contextVersion;
+            this.defaultProtocolVersion = defaultProtocolVersion;
+            this.supportedProtocolVersion = supportedProtocolVersion;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        for (ContextVersion cv : ContextVersion.values()) {
+            System.out.println("Checking SSLContext of " + cv.contextVersion);
+            SSLContext context = SSLContext.getInstance(cv.contextVersion);
+
+            // Default SSLContext is initialized automatically.
+            if (!cv.contextVersion.equals("Default")) {
+                // Use default TK, KM and random.
+                context.init((KeyManager[])null, (TrustManager[])null, null);
+            }
+
+            SSLParameters parameters = context.getDefaultSSLParameters();
+
+            String[] protocols = parameters.getProtocols();
+            String[] ciphers = parameters.getCipherSuites();
+
+            if (protocols.length == 0 || ciphers.length == 0) {
+                throw new Exception("No default protocols or cipher suites");
+            }
+
+            boolean isMatch = false;
+            for (String protocol : protocols) {
+                System.out.println("\tdefault protocol version " + protocol);
+                if (protocol.equals(cv.defaultProtocolVersion)) {
+                    isMatch = true;
+                    break;
+                }
+            }
+
+            if (!isMatch) {
+                throw new Exception("No matched default protocol");
+            }
+
+            parameters = context.getSupportedSSLParameters();
+
+            protocols = parameters.getProtocols();
+            ciphers = parameters.getCipherSuites();
+
+            if (protocols.length == 0 || ciphers.length == 0) {
+                throw new Exception("No default protocols or cipher suites");
+            }
+
+            isMatch = false;
+            for (String protocol : protocols) {
+                System.out.println("\tsupported protocol version " + protocol);
+                if (protocol.equals(cv.supportedProtocolVersion)) {
+                    isMatch = true;
+                    break;
+                }
+            }
+
+            if (!isMatch) {
+                throw new Exception("No matched default protocol");
+            }
+            System.out.println("\t... Success");
+        }
+    }
+}
--- a/jdk/test/sun/text/resources/LocaleData	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/sun/text/resources/LocaleData	Tue Apr 26 15:48:03 2011 -0700
@@ -6942,3 +6942,14 @@
 CurrencyNames/zh_TW/xts=XTS
 CurrencyNames/zh_TW/xxx=XXX
 CurrencyNames/zh_TW/yer=\u8449\u9580\u91cc\u96c5
+
+# bug 7036905
+CurrencyNames/de/afa=Afghani (1927-2002)
+CurrencyNames/de/afn=Afghani
+CurrencyNames/de/bob=Boliviano
+CurrencyNames/de/dem=Deutsche Mark
+CurrencyNames/de/mwk=Malawi Kwacha
+CurrencyNames/de/mxv=Mexican Unidad de Inversion (UDI)
+CurrencyNames/de/svc=El Salvador Colon
+
+CurrencyNames/it/bob=Boliviano
--- a/jdk/test/sun/text/resources/LocaleDataTest.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java	Tue Apr 26 15:48:03 2011 -0700
@@ -33,7 +33,7 @@
  *      6379214 6485516 6486607 4225362 4494727 6533691 6531591 6531593 6570259
  *      6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611
  *      6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
- *      6919624 6998391 7019267 7020960 7025837 7020583
+ *      6919624 6998391 7019267 7020960 7025837 7020583 7036905
  * @summary Verify locale data
  *
  */
--- a/jdk/test/tools/launcher/ExecutionEnvironment.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/tools/launcher/ExecutionEnvironment.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -30,7 +30,7 @@
  */
 
 /*
- * This test tests for various things as follows:
+ * This tests for various things as follows:
  * Ensures that:
  *   1. uneccessary execs do not occur
  *   2. the environment is pristine,  users environment variable wrt.
@@ -84,7 +84,9 @@
     static int errors = 0;
     static int passes = 0;
 
-    private static void createTestJar() {
+    static final String LIBJVM = TestHelper.isWindows ? "jvm.dll" : "libjvm.so";
+
+    static void createTestJar() {
         try {
             List<String> codeList = new ArrayList<String>();
             codeList.add("static void printValue(String name, boolean property) {\n");
@@ -127,6 +129,7 @@
                 testJarFile.getAbsolutePath());
 
         if (!tr.isNotZeroOutput()) {
+            System.out.println(tr);
             throw new RuntimeException("Error: No output at all. Did the test execute ?");
         }
 
@@ -177,7 +180,6 @@
 
         Map<String, String> env = new HashMap<String, String>();
 
-
         if (TestHelper.isLinux) {
             for (String x : LD_PATH_STRINGS) {
                 String pairs[] = x.split("=");
@@ -209,7 +211,7 @@
             verifyJavaLibraryPathOverride(tr, true);
 
             // try changing the model from 32 to 64 bit
-            if (TestHelper.java64Cmd != null && TestHelper.is32Bit) {
+            if (TestHelper.dualModePresent() && TestHelper.is32Bit) {
                 // verify the override occurs
                 env.clear();
                 for (String x : LD_PATH_STRINGS) {
@@ -326,7 +328,7 @@
         File symLink = null;
         String libPathPrefix = TestHelper.isSDK ? "jre/lib" : "/lib";
         symLink = new File(TestHelper.JAVAHOME, libPathPrefix +
-                TestHelper.getJreArch() + "/libjvm.so");
+                TestHelper.getJreArch() + "/" + LIBJVM);
         if (symLink.exists()) {
             System.out.println("FAIL: The symlink exists " +
                     symLink.getAbsolutePath());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/Test7029048.java	Tue Apr 26 15:48:03 2011 -0700
@@ -0,0 +1,313 @@
+/*
+ * 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.
+ *
+ * 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 7029048
+ * @summary Checks for LD_LIBRARY_PATH on *nixes
+ * @compile -XDignore.symbol.file ExecutionEnvironment.java TestHelper.java Test7029048.java
+ * @run main Test7029048
+ */
+
+/*
+ * 7029048: test for LD_LIBRARY_PATH set to different paths pointing which may
+ * contain a libjvm.so and may not, but we test to ensure that the launcher
+ * behaves correctly in all cases.
+ */
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Test7029048 {
+
+    static int passes = 0;
+    static int errors = 0;
+
+    private static final String LIBJVM = ExecutionEnvironment.LIBJVM;
+    private static final String LD_LIBRARY_PATH =
+            ExecutionEnvironment.LD_LIBRARY_PATH;
+    private static final String LD_LIBRARY_PATH_32 =
+            ExecutionEnvironment.LD_LIBRARY_PATH_32;
+    private static final String LD_LIBRARY_PATH_64 =
+            ExecutionEnvironment.LD_LIBRARY_PATH_64;
+
+    private static final File libDir =
+            new File(System.getProperty("sun.boot.library.path"));
+    private static final File srcServerDir = new File(libDir, "server");
+    private static final File srcLibjvmSo = new File(srcServerDir, LIBJVM);
+
+    private static final File dstLibDir = new File("lib");
+    private static final File dstLibArchDir =
+            new File(dstLibDir, TestHelper.getJreArch());
+
+    private static final File dstServerDir = new File(dstLibArchDir, "server");
+    private static final File dstServerLibjvm = new File(dstServerDir, LIBJVM);
+
+    private static final File dstClientDir = new File(dstLibArchDir, "client");
+    private static final File dstClientLibjvm = new File(dstClientDir, LIBJVM);
+
+    // used primarily to test the solaris variants in dual mode
+    private static final File dstOtherArchDir;
+    private static final File dstOtherServerDir;
+    private static final File dstOtherServerLibjvm;
+
+    private static final Map<String, String> env = new HashMap<>();
+
+    static {
+        if (TestHelper.isDualMode) {
+            dstOtherArchDir = new File(dstLibDir, TestHelper.getComplementaryJreArch());
+            dstOtherServerDir = new File(dstOtherArchDir, "server");
+            dstOtherServerLibjvm = new File(dstOtherServerDir, LIBJVM);
+        } else {
+            dstOtherArchDir = null;
+            dstOtherServerDir = null;
+            dstOtherServerLibjvm = null;
+        }
+    }
+
+    static String getValue(String name, List<String> in) {
+        for (String x : in) {
+            String[] s = x.split("=");
+            if (name.equals(s[0].trim())) {
+                return s[1].trim();
+            }
+        }
+        return null;
+    }
+
+    static void run(boolean want32, String dflag, Map<String, String> env,
+            int nLLPComponents, String caseID) {
+        final boolean want64 = want32 == false;
+        env.put(ExecutionEnvironment.JLDEBUG_KEY, "true");
+        List<String> cmdsList = new ArrayList<>();
+
+        // only for a dual-mode system
+        if (want64 && TestHelper.isDualMode) {
+            cmdsList.add(TestHelper.java64Cmd);
+        } else {
+            cmdsList.add(TestHelper.javaCmd); // a 32-bit java command for all
+        }
+
+        /*
+         * empty or null strings can confuse the ProcessBuilder. A null flag
+         * indicates that the appropriate data model is enforced on the chosen
+         * launcher variant.
+         */
+
+        if (dflag != null) {
+            cmdsList.add(dflag);
+        } else {
+            cmdsList.add(want32 ? "-d32" : "-d64");
+        }
+        cmdsList.add("-server");
+        cmdsList.add("-jar");
+        cmdsList.add(ExecutionEnvironment.testJarFile.getAbsolutePath());
+        String[] cmds = new String[cmdsList.size()];
+        TestHelper.TestResult tr = TestHelper.doExec(env, cmdsList.toArray(cmds));
+        analyze(tr, nLLPComponents, caseID);
+    }
+
+    // no cross launch, ie. no change to the data model.
+    static void run(Map<String, String> env, int nLLPComponents, String caseID)
+            throws IOException {
+        boolean want32 = TestHelper.is32Bit;
+        run(want32, null, env, nLLPComponents, caseID);
+    }
+
+    static void analyze(TestHelper.TestResult tr, int nLLPComponents, String caseID) {
+        String envValue = getValue(LD_LIBRARY_PATH, tr.testOutput);
+       /*
+        * the envValue can never be null, since the test code should always
+        * print a "null" string.
+        */
+        if (envValue == null) {
+            System.out.println(tr);
+            throw new RuntimeException("NPE, likely a program crash ??");
+        }
+        String values[] = envValue.split(File.pathSeparator);
+        if (values.length == nLLPComponents) {
+            System.out.println(caseID + " :OK");
+            passes++;
+        } else {
+            System.out.println("FAIL: test7029048, " + caseID);
+            System.out.println(" expected " + nLLPComponents
+                    + " but got " + values.length);
+            System.out.println(envValue);
+            System.out.println(tr);
+            errors++;
+        }
+    }
+
+    /*
+     * A crucial piece, specifies what we should expect, given the conditions.
+     * That is for a given enum type, the value indicates how many absolute
+     * environment variables that can be expected. This value is used to base
+     * the actual expected values by adding the set environment variable usually
+     * it is 1, but it could be more if the test wishes to set more paths in
+     * the future.
+     */
+    private static enum LLP_VAR {
+        LLP_SET_NON_EXISTENT_PATH(0),   // env set, but the path does not exist
+        LLP_SET_EMPTY_PATH(0),          // env set, with a path but no libjvm.so
+        LLP_SET_WITH_JVM(3);            // env set, with a libjvm.so
+        private final int value;
+        LLP_VAR(int i) {
+            this.value = i;
+        }
+    }
+
+    /*
+     * test for 7029048
+     */
+    static void test7029048() throws IOException {
+        String desc = null;
+        for (LLP_VAR v : LLP_VAR.values()) {
+            switch (v) {
+                case LLP_SET_WITH_JVM:
+                    // copy the files into the directory structures
+                    TestHelper.copyFile(srcLibjvmSo, dstServerLibjvm);
+                    // does not matter if it is client or a server
+                    TestHelper.copyFile(srcLibjvmSo, dstClientLibjvm);
+                    // does not matter if the arch do not match either
+                    if (TestHelper.isDualMode) {
+                        TestHelper.copyFile(srcLibjvmSo, dstOtherServerLibjvm);
+                    }
+                    desc = "LD_LIBRARY_PATH should be set";
+                    break;
+                case LLP_SET_EMPTY_PATH:
+                    if (!dstClientDir.exists()) {
+                        Files.createDirectories(dstClientDir.toPath());
+                    } else {
+                        Files.deleteIfExists(dstClientLibjvm.toPath());
+                    }
+
+                    if (!dstServerDir.exists()) {
+                        Files.createDirectories(dstServerDir.toPath());
+                    } else {
+                        Files.deleteIfExists(dstServerLibjvm.toPath());
+                    }
+
+                    if (TestHelper.isDualMode) {
+                        if (!dstOtherServerDir.exists()) {
+                            Files.createDirectories(dstOtherServerDir.toPath());
+                        } else {
+                            Files.deleteIfExists(dstOtherServerLibjvm.toPath());
+                        }
+                    }
+
+                    desc = "LD_LIBRARY_PATH should not be set";
+                    break;
+                case LLP_SET_NON_EXISTENT_PATH:
+                    if (dstLibDir.exists()) {
+                        TestHelper.recursiveDelete(dstLibDir);
+                    }
+                    desc = "LD_LIBRARY_PATH should not be set";
+                    break;
+                default:
+                    throw new RuntimeException("unknown case");
+            }
+
+            /*
+             * Case 1: set the server path
+             */
+            env.clear();
+            env.put(LD_LIBRARY_PATH, dstServerDir.getAbsolutePath());
+            run(env, v.value + 1, "Case 1: " + desc);
+
+            /*
+             * Case 2: repeat with client path
+             */
+            env.clear();
+            env.put(LD_LIBRARY_PATH, dstClientDir.getAbsolutePath());
+            run(env, v.value + 1, "Case 2: " + desc);
+
+            if (!TestHelper.isDualMode) {
+                continue; // nothing more to do for Linux
+            }
+
+            // Tests applicable only to solaris.
+
+            // initialize test variables for dual mode operations
+            final File dst32ServerDir = TestHelper.is32Bit
+                    ? dstServerDir
+                    : dstOtherServerDir;
+
+            final File dst64ServerDir = TestHelper.is64Bit
+                    ? dstServerDir
+                    : dstOtherServerDir;
+
+            /*
+             * Case 3: set the appropriate LLP_XX flag,
+             * java32 -d32, LLP_32 is relevant, LLP_64 is ignored
+             * java64 -d64, LLP_64 is relevant, LLP_32 is ignored
+             */
+            env.clear();
+            env.put(LD_LIBRARY_PATH_32, dst32ServerDir.getAbsolutePath());
+            env.put(LD_LIBRARY_PATH_64, dst64ServerDir.getAbsolutePath());
+            run(TestHelper.is32Bit, null, env, v.value + 1, "Case 3: " + desc);
+
+            /*
+             * Case 4: we are in dual mode environment, running 64-bit then
+             * we have the following scenarios:
+             * java32 -d64, LLP_64 is relevant, LLP_32 is ignored
+             * java64 -d32, LLP_32 is relevant, LLP_64 is ignored
+             */
+            if (TestHelper.dualModePresent()) {
+                run(true, "-d64", env, v.value + 1, "Case 4A: " + desc);
+                run(false,"-d32", env, v.value + 1, "Case 4B: " + desc);
+            }
+        }
+        return;
+    }
+
+    public static void main(String... args) throws Exception {
+        if (TestHelper.isWindows) {
+            System.out.println("Warning: noop on windows");
+            return;
+        }
+        // create our test jar first
+        ExecutionEnvironment.createTestJar();
+
+        // run the tests
+        test7029048();
+        if (errors > 0) {
+            throw new Exception("Test7029048: FAIL: with "
+                    + errors + " errors and passes " + passes);
+        } else if (TestHelper.dualModePresent() && passes < 15) {
+            throw new Exception("Test7029048: FAIL: " +
+                    "all tests did not run, expected " + 15 + " got " + passes);
+        } else if (TestHelper.isSolaris && passes < 9) {
+            throw new Exception("Test7029048: FAIL: " +
+                    "all tests did not run, expected " + 9 + " got " + passes);
+        } else if (TestHelper.isLinux && passes < 6) {
+             throw new Exception("Test7029048: FAIL: " +
+                    "all tests did not run, expected " + 6 + " got " + passes);
+        } else {
+            System.out.println("Test7029048: PASS " + passes);
+        }
+    }
+}
--- a/jdk/test/tools/launcher/TestHelper.java	Tue Apr 19 16:01:27 2011 -0700
+++ b/jdk/test/tools/launcher/TestHelper.java	Tue Apr 26 15:48:03 2011 -0700
@@ -1,6 +1,5 @@
-
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -22,20 +21,28 @@
  * questions.
  */
 
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.FileVisitResult;
+import java.nio.file.SimpleFileVisitor;
 import javax.tools.ToolProvider;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import javax.tools.JavaCompiler;
 
+import static java.nio.file.StandardCopyOption.*;
+
 /**
- * This class provides some common utilites for the launcher tests.
+ * This class provides some common utilities for the launcher tests.
  */
 public enum TestHelper {
     INSTANCE;
@@ -101,6 +108,13 @@
     }
 
     /*
+     * is a dual mode available in the test jdk
+     */
+    static boolean dualModePresent() {
+        return isDualMode && java64Cmd != null;
+    }
+
+    /*
      * usually the jre/lib/arch-name is the same as os.arch, except for x86.
      */
     static String getJreArch() {
@@ -109,6 +123,27 @@
     }
 
     /*
+     * get the complementary jre arch ie. if sparc then return sparcv9 and
+     * vice-versa.
+     */
+    static String getComplementaryJreArch() {
+        String arch = System.getProperty("os.arch");
+        if (arch != null) {
+            switch (arch) {
+                case "sparc":
+                    return "sparcv9";
+                case "sparcv9":
+                    return "sparc";
+                case "x86":
+                    return "amd64";
+                case "amd64":
+                    return "i386";
+            }
+        }
+        return null;
+    }
+
+    /*
      * A convenience method to create a jar with jar file name and defs
      */
     static void createJar(File jarName, String... mainDefs)
@@ -168,6 +203,44 @@
         }
     }
 
+   static void copyFile(File src, File dst) throws IOException {
+        Path parent = dst.toPath().getParent();
+        if (parent != null) {
+            Files.createDirectories(parent);
+        }
+        Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING);
+    }
+
+    static void recursiveDelete(File target) throws IOException {
+        if (!target.exists()) {
+            return;
+        }
+        Files.walkFileTree(target.toPath(), new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
+                try {
+                    Files.deleteIfExists(dir);
+                } catch (IOException ex) {
+                    System.out.println("Error: could not delete: " + dir.toString());
+                    System.out.println(ex.getMessage());
+                    return FileVisitResult.TERMINATE;
+                }
+                return FileVisitResult.CONTINUE;
+            }
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+                try {
+                    Files.deleteIfExists(file);
+                } catch (IOException ex) {
+                    System.out.println("Error: could not delete: " + file.toString());
+                    System.out.println(ex.getMessage());
+                    return FileVisitResult.TERMINATE;
+                }
+                return FileVisitResult.CONTINUE;
+            }
+        });
+    }
+
     static TestResult doExec(String...cmds) {
         return doExec(null, cmds);
     }
@@ -187,7 +260,7 @@
         }
         BufferedReader rdr = null;
         try {
-            List<String> outputList = new ArrayList<String>();
+            List<String> outputList = new ArrayList<>();
             pb.redirectErrorStream(true);
             Process p = pb.start();
             rdr = new BufferedReader(new InputStreamReader(p.getInputStream()));
@@ -198,7 +271,9 @@
             }
             p.waitFor();
             p.destroy();
-            return new TestHelper.TestResult(cmdStr, p.exitValue(), outputList);
+
+            return new TestHelper.TestResult(cmdStr, p.exitValue(), outputList,
+                    env, new Throwable("current stack of the test"));
         } catch (Exception ex) {
             ex.printStackTrace();
             throw new RuntimeException(ex.getMessage());
@@ -213,11 +288,16 @@
         StringBuilder status;
         int exitValue;
         List<String> testOutput;
+        Map<String, String> env;
+        Throwable t;
 
-        public TestResult(String str, int rv, List<String> oList) {
+        public TestResult(String str, int rv, List<String> oList,
+                Map<String, String> env, Throwable t) {
             status = new StringBuilder("Executed command: " + str + "\n");
             exitValue = rv;
             testOutput = oList;
+            this.env = env;
+            this.t = t;
         }
 
         void appendStatus(String x) {
@@ -262,11 +342,21 @@
 
         @Override
         public String toString() {
-            status = status.append("++++Test Output Begin++++\n");
+            status.append("++++Begin Test Info++++\n");
+            status.append("++++Test Environment++++\n");
+            for (String x : env.keySet()) {
+                status.append(x).append("=").append(env.get(x)).append("\n");
+            }
+            status.append("++++Test Output++++\n");
             for (String x : testOutput) {
                 appendStatus(x);
             }
-            status = status.append("++++Test Output End++++\n");
+            status.append("++++Test Stack Trace++++\n");
+            status.append(t.toString());
+            for (StackTraceElement e : t.getStackTrace()) {
+                status.append(e.toString());
+            }
+            status.append("++++End of Test Info++++\n");
             return status.toString();
         }
 
--- a/langtools/.hgtags	Tue Apr 19 16:01:27 2011 -0700
+++ b/langtools/.hgtags	Tue Apr 26 15:48:03 2011 -0700
@@ -112,3 +112,4 @@
 9d0a61ac567b983da7cc8f4a7030f2245bb6dbab jdk7-b135
 ed0f7f1f9511db4f9615b1426d22f8b961629275 jdk7-b136
 a15c9b058ae007d4ccb7e35ce44e4dfa977f090b jdk7-b137
+53f212bed4f4304dce7f0bf0fa01c998c65bacd6 jdk7-b138