Merge
authorchegar
Wed, 08 May 2013 10:10:05 +0100
changeset 18361 af64e7ce59e6
parent 18360 0c15995eec18 (current diff)
parent 17289 4dec41b3c5e3 (diff)
child 18362 8d823fbb258c
Merge
hotspot/agent/doc/c2replay.html
jdk/src/share/classes/java/beans/ReflectionUtils.java
jdk/test/java/awt/Focus/OverrideRedirectWindowActivationTest/OverrideRedirectWindowActivationTest.java
jdk/test/java/io/Serializable/accessConstants/AccessConstants.java
jdk/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh
jdk/test/sun/reflect/CallerSensitive/MethodFinder.java
langtools/make/Makefile-classic
nashorn/src/jdk/nashorn/internal/codegen/Frame.java
nashorn/src/jdk/nashorn/internal/ir/DoWhileNode.java
nashorn/src/jdk/nashorn/internal/ir/LabeledNode.java
--- a/.hgtags	Sun Apr 28 08:15:54 2013 +0100
+++ b/.hgtags	Wed May 08 10:10:05 2013 +0100
@@ -209,3 +209,4 @@
 1872c12529090e1c1dbf567f02ad7ae6231b8f0c jdk8-b85
 da9a4c9312816451884aa6db6f18be51a07bff13 jdk8-b86
 5ebf6c63714de2c9dcf831074086d31daec819df jdk8-b87
+e517701a4d0e25ae9c7945bca6e1762a8c5d8aa6 jdk8-b88
--- a/.hgtags-top-repo	Sun Apr 28 08:15:54 2013 +0100
+++ b/.hgtags-top-repo	Wed May 08 10:10:05 2013 +0100
@@ -209,3 +209,4 @@
 7fc358f5943676b82f1dccd3152b1ac07d92e38b jdk8-b85
 df9b5240f0a76c91cfe1a5b39da4d08df56e05be jdk8-b86
 b9415faa7066a4d3b16d466556d5428446918d95 jdk8-b87
+e1a929afcfc492470d50be0b6b0e8dc77d3760b9 jdk8-b88
--- a/common/makefiles/NativeCompilation.gmk	Sun Apr 28 08:15:54 2013 +0100
+++ b/common/makefiles/NativeCompilation.gmk	Wed May 08 10:10:05 2013 +0100
@@ -411,6 +411,8 @@
             $1_EXTRA_LDFLAGS+="-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
         endif
 
+        $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)        
+
         ifneq (,$$($1_DEBUG_SYMBOLS))
             ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
                 ifeq ($(OPENJDK_TARGET_OS), windows)
@@ -549,6 +551,8 @@
             endif
         endif
 
+        $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
+
         $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
 	    	$$(call LINKING_EXE_MSG,$$($1_BASENAME))
 		$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
--- a/common/makefiles/javadoc/CORE_PKGS.gmk	Sun Apr 28 08:15:54 2013 +0100
+++ b/common/makefiles/javadoc/CORE_PKGS.gmk	Wed May 08 10:10:05 2013 +0100
@@ -142,6 +142,7 @@
   java.util.prefs                                \
   java.util.regex                                \
   java.util.spi                                  \
+  java.util.stream                               \
   java.util.zip                                  \
   javax.accessibility                            \
   javax.activation                               \
--- a/common/makefiles/javadoc/Javadoc.gmk	Sun Apr 28 08:15:54 2013 +0100
+++ b/common/makefiles/javadoc/Javadoc.gmk	Wed May 08 10:10:05 2013 +0100
@@ -390,6 +390,17 @@
 	  $(call OptionPair,-tag,specdefault:X)				; \
 	  $(call OptionPair,-tag,Note:X)				; \
 	  $(call OptionPair,-tag,ToDo:X)				; \
+          $(call OptionPair,-tag,apiNote:a:API Note:)                   ; \
+          $(call OptionPair,-tag,implSpec:a:Implementation Requirements:) ; \
+          $(call OptionPair,-tag,implNote:a:Implementation Note:)       ; \
+          $(call OptionPair,-tag,param)                                 ; \
+          $(call OptionPair,-tag,return)                                ; \
+          $(call OptionPair,-tag,throws)                                ; \
+          $(call OptionPair,-tag,since)                                 ; \
+          $(call OptionPair,-tag,version)                               ; \
+          $(call OptionPair,-tag,serialData)                            ; \
+          $(call OptionPair,-tag,factory)                               ; \
+          $(call OptionPair,-tag,see)                                   ; \
           $(call OptionPair,-tag,$(TAG_JLS)) 				; \
 	  $(call OptionOnly,-splitIndex)				; \
 	  $(call OptionPair,-overview,$(COREAPI_OVERVIEW))		; \
--- a/corba/.hgtags	Sun Apr 28 08:15:54 2013 +0100
+++ b/corba/.hgtags	Wed May 08 10:10:05 2013 +0100
@@ -209,3 +209,4 @@
 9583a6431596bac1959d2d8828f5ea217843dd12 jdk8-b85
 44a8ce4a759f2668ff434661a93ff462ea472478 jdk8-b86
 f1709874d55a06bc3d5dfa02dbcdfbc59f4cba34 jdk8-b87
+4e3a881ebb1ee96ce0872508b0066d74f310dbfa jdk8-b88
--- a/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/corba/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -258,6 +258,19 @@
   {
     Vector labels = vectorizeLabels (u.branches (), true);
 
+    if (Util.javaName(utype).equals ("boolean")) {
+        stream.println( "" ) ;
+        stream.println( "  private void verifyDefault (boolean discriminator)" ) ;
+        stream.println( "  {" ) ;
+        if (labels.contains ("true"))
+            stream.println ("    if ( discriminator )");
+        else
+            stream.println ("    if ( !discriminator )");
+        stream.println( "        throw new org.omg.CORBA.BAD_OPERATION();" ) ;
+        stream.println( "  }" ) ;
+        return;
+    }
+
     stream.println( "" ) ;
     stream.println( "  private void verifyDefault( " + Util.javaName(utype) +
         " value )" ) ;
@@ -763,7 +776,7 @@
             stream.println (indent + "if (" + disName + ')');
 
             if (firstBranch == null)
-                stream.println (indent + "  throw new org.omg.CORBA.BAD_OPERATION ();");
+                stream.println (indent + "  value._default(" + disName + ");");
             else {
                 stream.println (indent + '{');
                 index = readBranch (index, indent + "  ", firstBranch.typedef.name (),
@@ -774,7 +787,7 @@
             stream.println (indent + "else");
 
             if (secondBranch == null)
-                stream.println (indent + "  throw new org.omg.CORBA.BAD_OPERATION ();");
+                stream.println (indent + "  value._default(" + disName + ");");
             else {
                 stream.println (indent + '{');
                 index = readBranch (index, indent + "  ", secondBranch.typedef.name (),
@@ -924,23 +937,25 @@
         firstBranch = secondBranch;
         secondBranch = tmp;
       }
-      stream.println (indent + "if (" + disName + ')');
-      if (firstBranch == null)
-        stream.println (indent + "  throw new org.omg.CORBA.BAD_OPERATION ();");
-      else
-      {
-        stream.println (indent + '{');
-        index = writeBranch (index, indent + "  ", name, firstBranch.typedef, stream);
-        stream.println (indent + '}');
-      }
-      stream.println (indent + "else");
-      if (secondBranch == null)
-        stream.println (indent + "  throw new org.omg.CORBA.BAD_OPERATION ();");
-      else
-      {
-        stream.println (indent + '{');
-        index = writeBranch (index, indent + "  ", name, secondBranch.typedef, stream);
-        stream.println (indent + '}');
+      if (firstBranch != null && secondBranch != null) {
+          stream.println (indent + "if (" + disName + ')');
+          stream.println (indent + '{');
+          index = writeBranch (index, indent + "  ", name, firstBranch.typedef, stream);
+          stream.println (indent + '}');
+          stream.println (indent + "else");
+          stream.println (indent + '{');
+          index = writeBranch (index, indent + "  ", name, secondBranch.typedef, stream);
+          stream.println (indent + '}');
+      } else if (firstBranch != null) {
+          stream.println (indent + "if (" + disName + ')');
+          stream.println (indent + '{');
+          index = writeBranch (index, indent + "  ", name, firstBranch.typedef, stream);
+          stream.println (indent + '}');
+      } else {
+          stream.println (indent + "if (!" + disName + ')');
+          stream.println (indent + '{');
+          index = writeBranch (index, indent + "  ", name, secondBranch.typedef, stream);
+          stream.println (indent + '}');
       }
     }
     return index;
--- a/hotspot/.hgtags	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/.hgtags	Wed May 08 10:10:05 2013 +0100
@@ -337,3 +337,5 @@
 d4c2667846607042370760e23f64c3ab9350e60d jdk8-b87
 01d5f04e64dc2d64625b2db2056f5ed4de918a45 hs25-b29
 c4af77d2045476c56fbf3f914b336bb1b7cd18af hs25-b30
+8482058e74bc8c1a890e6f3be3eff192dba6ce67 jdk8-b88
+4ec91349972255650f97bedfd07e6423e02428cf hs25-b31
--- a/hotspot/agent/doc/c2replay.html	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-<html>
-<head>
-<title>
-C2 Replay
-</title>
-</head>
-<body>
-
-<h1>C2 compiler replay</h1>
-<p>
-The C2 compiler replay is a function to repeat the compiling process from a crashed java process in compiled method<br>
-This function only exists in debug version of VM
-</p>
-<h2>Usage</h2>
-<pre> 
-First, use SA to attach to the core file, if suceeded, do
-       clhsdb>dumpreplaydata <address> | -a | <thread_id> [> replay.txt]
-       create file replay.txt, address is address of Method, or nmethod(CodeBlob)
-       clhsdb>buildreplayjars [all | boot | app]
-       create files:
-         all:
-           app.jar, boot.jar
-         boot:
-           boot.jar
-         app:
-           app.jar
-       exit SA now.
-Second, use the obtained replay text file, replay.txt and jar files, app.jar and boot.jar, using debug version of java
-       java -Xbootclasspath/p:boot.jar -cp app.jar -XX:ReplayDataFile=<datafile> -XX:+ReplayCompiles ....
-       This will replay the compiling process.
-
-       With ReplayCompiles, the replay will recompile all the methods in app.jar, and in boot.jar to emulate the process in java app.
-
-notes:
-       1) Most time, we don't need the boot.jar which is the classes loaded from JDK. It will be only modified when an agent(JVMDI) is running and modifies the classes.
-       2) If encounter error as "<flag>" not found, that means the SA is using a VMStructs which is different from the one with corefile. In this case, SA has a utility tool vmstructsdump which is located at agent/src/os/<os>/proc/<os_platform>
-
-       Use this tool to dump VM type library:
-       vmstructsdump libjvm.so > <type_name>.db
-
-       set env SA_TYPEDB=<type_name>.db (refer different shell for set envs)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/doc/cireplay.html	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,41 @@
+<html>
+<head>
+<title>
+Replay
+</title>
+</head>
+<body>
+
+<h1>Compiler replay</h1>
+<p>
+The compiler replay is a function to repeat the compiling process from a crashed java process in compiled method<br>
+This function only exists in debug version of VM
+</p>
+<h2>Usage</h2>
+<pre>
+First, use SA to attach to the core file, if succeeded, do
+       hsdb&gt; dumpreplaydata &lt;address&gt; | -a | &lt;thread_id&gt; [&gt; replay.txt]
+       create file replay.txt, address is address of Method, or nmethod(CodeBlob)
+       hsdb&gt; buildreplayjars [all | boot | app]
+       create files:
+         all:
+           app.jar, boot.jar
+         boot:
+           boot.jar
+         app:
+           app.jar
+       exit SA now.
+Second, use the obtained replay text file, replay.txt and jar files, app.jar and boot.jar, using debug version of java
+       java -Xbootclasspath/p:boot.jar -cp app.jar -XX:ReplayDataFile=&lt;datafile&gt; -XX:+ReplayCompiles ....
+       This will replay the compiling process.
+
+       With ReplayCompiles, the replay will recompile all the methods in app.jar, and in boot.jar to emulate the process in java app.
+
+notes:
+       1) Most time, we don't need the boot.jar which is the classes loaded from JDK. It will be only modified when an agent(JVMDI) is running and modifies the classes.
+       2) If encounter error as "&lt;flag&gt;" not found, that means the SA is using a VMStructs which is different from the one with corefile. In this case, SA has a utility tool vmstructsdump which is located at agent/src/os/&lt;os&gt;/proc/&lt;os_platform&gt;
+
+       Use this tool to dump VM type library:
+       vmstructsdump libjvm.so &gt; &lt;type_name&gt;.db
+
+       set env SA_TYPEDB=&lt;type_name&gt;.db (refer different shell for set envs)
--- a/hotspot/agent/doc/clhsdb.html	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/agent/doc/clhsdb.html	Wed May 08 10:10:05 2013 +0100
@@ -15,7 +15,7 @@
 <p>
 There is also JavaScript based SA command line interface called <a href="jsdb.html">jsdb</a>.
 But, CLHSDB supports Unix shell-like (or dbx/gdb-like) command line interface with
-support for output redirection/appending (familiar >, >>), command history and so on.
+support for output redirection/appending (familiar &gt;, &gt;&gt;), command history and so on.
 Each CLHSDB command can have zero or more arguments and optionally end with output redirection
 (or append) to a file. Commands may be stored in a file and run using <b>source</b> command.
 <b>help</b> command prints usage message for all supported commands (or a specific command)
@@ -49,7 +49,7 @@
   dumpheap [ file ] <font color="red">dump heap in hprof binary format</font>
   dumpideal -a | id <font color="red">dump ideal graph like debug flag -XX:+PrintIdeal</font>
   dumpilt -a | id <font color="red">dump inline tree for C2 compilation</font>
-  dumpreplaydata <address> | -a | <thread_id> [>replay.txt] <font color="red">dump replay data into a file</font>
+  dumpreplaydata &lt;address&gt; | -a | &lt;thread_id&gt; [&gt;replay.txt] <font color="red">dump replay data into a file</font>
   echo [ true | false ] <font color="red">turn on/off command echo mode</font>
   examine [ address/count ] | [ address,address] <font color="red">show contents of memory from given address</font>
   field [ type [ name fieldtype isStatic offset address ] ] <font color="red">print info about a field of HotSpot type</font>
@@ -96,11 +96,11 @@
 
 <h3>JavaScript integration</h3>
 
-<p>Few CLHSDB commands are already implemented in JavaScript. It is possible to extend CLHSDB command set 
+<p>Few CLHSDB commands are already implemented in JavaScript. It is possible to extend CLHSDB command set
 by implementing more commands in a JavaScript file and by loading it by <b>jsload</b> command. <b>jseval</b>
 command may be used to evaluate arbitrary JavaScript expression from a string. Any JavaScript function
 may be exposed as a CLHSDB command by registering it using JavaScript <b><code>registerCommand</code></b>
-function. This function accepts command name, usage and name of the JavaScript implementation function 
+function. This function accepts command name, usage and name of the JavaScript implementation function
 as arguments.
 </p>
 
@@ -127,11 +127,11 @@
 </code>
 </pre>
 
-<h3>C2 Compilation Replay</h3>
+<h3>Compilation Replay</h3>
 <p>
 When a java process crashes in compiled method, usually a core file is saved.
-The C2 replay function can reproduce the compiling process in the core.
-<a href="c2replay.html">c2replay.html</a>
+The replay function can reproduce the compiling process in the core.
+<a href="cireplay.html">cireplay.html</a>
 
 </body>
 </html>
--- a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m	Wed May 08 10:10:05 2013 +0100
@@ -204,7 +204,7 @@
   jstring objectName, jstring symbolName) 
 {
   struct ps_prochandle* ph = get_proc_handle(env, this_obj);
-  if (ph->core != NULL) {
+  if (ph != NULL && ph->core != NULL) {
     return lookupByNameIncore(env, ph, this_obj, objectName, symbolName);
   }
 
@@ -238,10 +238,13 @@
   const char* sym = NULL;
 
   struct ps_prochandle* ph = get_proc_handle(env, this_obj);
-  sym = symbol_for_pc(ph, (uintptr_t) addr, &offset);
-  if (sym == NULL) return 0;
-  return (*env)->CallObjectMethod(env, this_obj, createClosestSymbol_ID,
+  if (ph != NULL && ph->core != NULL) {
+    sym = symbol_for_pc(ph, (uintptr_t) addr, &offset);
+    if (sym == NULL) return 0;
+    return (*env)->CallObjectMethod(env, this_obj, createClosestSymbol_ID,
                           (*env)->NewStringUTF(env, sym), (jlong)offset);
+  }
+  return 0;
 }
 
 /** called from Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0 */
@@ -279,7 +282,7 @@
   jbyteArray array;
 
   struct ps_prochandle* ph = get_proc_handle(env, this_obj);
-  if (ph->core != NULL) {
+  if (ph != NULL && ph->core != NULL) {
     return readBytesFromCore(env, ph, this_obj, addr, numBytes);
   }
 
@@ -394,9 +397,9 @@
 /* For core file only, called from
  * Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
  */
-jlongArray getThreadIntegerRegisterSetFromCore(JNIEnv *env, jobject this_obj, long lwp_id) {
+jlongArray getThreadIntegerRegisterSetFromCore(JNIEnv *env, jobject this_obj, long lwp_id, struct ps_prochandle* ph) {
   if (!_threads_filled)  {
-    if (!fill_java_threads(env, this_obj, get_proc_handle(env, this_obj))) {
+    if (!fill_java_threads(env, this_obj, ph)) {
       throw_new_debugger_exception(env, "Failed to fill in threads");
       return 0;
     } else {
@@ -409,7 +412,6 @@
   jlongArray array;
   jlong *regs;
 
-  struct ps_prochandle* ph = get_proc_handle(env, this_obj);
   if (get_lwp_regs(ph, lwp_id, &gregs) != true) {
     THROW_NEW_DEBUGGER_EXCEPTION_("get_thread_regs failed for a lwp", 0);
   }
@@ -521,8 +523,8 @@
   print_debug("getThreadRegisterSet0 called\n");
 
   struct ps_prochandle* ph = get_proc_handle(env, this_obj);
-  if (ph->core != NULL) {
-    return getThreadIntegerRegisterSetFromCore(env, this_obj, thread_id);
+  if (ph != NULL && ph->core != NULL) {
+    return getThreadIntegerRegisterSetFromCore(env, this_obj, thread_id, ph);
   }
 
   kern_return_t result;
@@ -705,8 +707,8 @@
   task_t gTask = 0;
   result = task_for_pid(mach_task_self(), jpid, &gTask);
   if (result != KERN_SUCCESS) {
-    print_error("attach: task_for_pid(%d) failed (%d)\n", (int)jpid, result);
-    THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
+    print_error("attach: task_for_pid(%d) failed: '%s' (%d)\n", (int)jpid, mach_error_string(result), result);
+    THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process. Could be caused by an incorrect pid or lack of privileges.");
   }
   putTask(env, this_obj, gTask);
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java	Wed May 08 10:10:05 2013 +0100
@@ -93,10 +93,11 @@
     CompileTask task = task();
     Method method = task.method();
     int entryBci = task.osrBci();
+    int compLevel = task.compLevel();
     Klass holder = method.getMethodHolder();
     out.println("compile " + holder.getName().asString() + " " +
                 OopUtilities.escapeString(method.getName().asString()) + " " +
                 method.getSignature().asString() + " " +
-                entryBci);
+                entryBci + " " + compLevel);
   }
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java	Wed May 08 10:10:05 2013 +0100
@@ -78,6 +78,8 @@
       current sweep traversal index. */
   private static CIntegerField stackTraversalMarkField;
 
+  private static CIntegerField compLevelField;
+
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
@@ -113,7 +115,7 @@
     osrEntryPointField          = type.getAddressField("_osr_entry_point");
     lockCountField              = type.getJIntField("_lock_count");
     stackTraversalMarkField     = type.getCIntegerField("_stack_traversal_mark");
-
+    compLevelField              = type.getCIntegerField("_comp_level");
     pcDescSize = db.lookupType("PcDesc").getSize();
   }
 
@@ -530,7 +532,7 @@
     out.println("compile " + holder.getName().asString() + " " +
                 OopUtilities.escapeString(method.getName().asString()) + " " +
                 method.getSignature().asString() + " " +
-                getEntryBCI());
+                getEntryBCI() + " " + getCompLevel());
 
   }
 
@@ -551,4 +553,5 @@
   private int getHandlerTableOffset() { return (int) handlerTableOffsetField.getValue(addr); }
   private int getNulChkTableOffset()  { return (int) nulChkTableOffsetField .getValue(addr); }
   private int getNMethodEndOffset()   { return (int) nmethodEndOffsetField  .getValue(addr); }
+  private int getCompLevel()          { return (int) compLevelField         .getValue(addr); }
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java	Wed May 08 10:10:05 2013 +0100
@@ -46,10 +46,12 @@
     Type type      = db.lookupType("CompileTask");
     methodField = type.getAddressField("_method");
     osrBciField = new CIntField(type.getCIntegerField("_osr_bci"), 0);
+    compLevelField = new CIntField(type.getCIntegerField("_comp_level"), 0);
   }
 
   private static AddressField methodField;
   private static CIntField osrBciField;
+  private static CIntField compLevelField;
 
   public CompileTask(Address addr) {
     super(addr);
@@ -63,4 +65,8 @@
   public int osrBci() {
     return (int)osrBciField.getValue(getAddress());
   }
+
+  public int compLevel() {
+      return (int)compLevelField.getValue(getAddress());
+  }
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java	Wed May 08 10:10:05 2013 +0100
@@ -117,8 +117,6 @@
                 mode = MODE_HEAP_SUMMARY;
             } else if (modeFlag.equals("-histo")) {
                 mode = MODE_HISTOGRAM;
-            } else if (modeFlag.equals("-permstat")) {
-                mode = MODE_CLSTATS;
             } else if (modeFlag.equals("-clstats")) {
                 mode = MODE_CLSTATS;
             } else if (modeFlag.equals("-finalizerinfo")) {
--- a/hotspot/make/hotspot_version	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/make/hotspot_version	Wed May 08 10:10:05 2013 +0100
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=30
+HS_BUILD_NUMBER=31
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "asm/macroAssembler.inline.hpp"
+#include "code/compiledIC.hpp"
+#include "code/icBuffer.hpp"
+#include "code/nmethod.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/safepoint.hpp"
+#ifdef COMPILER2
+#include "opto/matcher.hpp"
+#endif
+
+// Release the CompiledICHolder* associated with this call site is there is one.
+void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) {
+  // This call site might have become stale so inspect it carefully.
+  NativeCall* call = nativeCall_at(call_site->addr());
+  if (is_icholder_entry(call->destination())) {
+    NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value());
+    InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data());
+  }
+}
+
+bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) {
+  // This call site might have become stale so inspect it carefully.
+  NativeCall* call = nativeCall_at(call_site->addr());
+  return is_icholder_entry(call->destination());
+}
+
+//-----------------------------------------------------------------------------
+// High-level access to an inline cache. Guaranteed to be MT-safe.
+
+CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
+  : _ic_call(call)
+{
+  address ic_call = call->instruction_address();
+
+  assert(ic_call != NULL, "ic_call address must be set");
+  assert(nm != NULL, "must pass nmethod");
+  assert(nm->contains(ic_call), "must be in nmethod");
+
+  // Search for the ic_call at the given address.
+  RelocIterator iter(nm, ic_call, ic_call+1);
+  bool ret = iter.next();
+  assert(ret == true, "relocInfo must exist at this address");
+  assert(iter.addr() == ic_call, "must find ic_call");
+  if (iter.type() == relocInfo::virtual_call_type) {
+    virtual_call_Relocation* r = iter.virtual_call_reloc();
+    _is_optimized = false;
+    _value = nativeMovConstReg_at(r->cached_value());
+  } else {
+    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
+    _is_optimized = true;
+    _value = NULL;
+  }
+}
+
+// ----------------------------------------------------------------------------
+
+#define __ _masm.
+void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
+#ifdef COMPILER2
+  // Stub is fixed up when the corresponding call is converted from calling
+  // compiled code to calling interpreted code.
+  // set (empty), G5
+  // jmp -1
+
+  address mark = cbuf.insts_mark();  // Get mark within main instrs section.
+
+  MacroAssembler _masm(&cbuf);
+
+  address base =
+  __ start_a_stub(to_interp_stub_size()*2);
+  if (base == NULL) return;  // CodeBuffer::expand failed.
+
+  // Static stub relocation stores the instruction address of the call.
+  __ relocate(static_stub_Relocation::spec(mark));
+
+  __ set_metadata(NULL, as_Register(Matcher::inline_cache_reg_encode()));
+
+  __ set_inst_mark();
+  AddressLiteral addrlit(-1);
+  __ JUMP(addrlit, G3, 0);
+
+  __ delayed()->nop();
+
+  // Update current stubs pointer and restore code_end.
+  __ end_a_stub();
+#else
+  ShouldNotReachHere();
+#endif
+}
+#undef __
+
+int CompiledStaticCall::to_interp_stub_size() {
+  // This doesn't need to be accurate but it must be larger or equal to
+  // the real size of the stub.
+  return (NativeMovConstReg::instruction_size +  // sethi/setlo;
+          NativeJump::instruction_size + // sethi; jmp; nop
+          (TraceJumps ? 20 * BytesPerInstWord : 0) );
+}
+
+// Relocation entries for call stub, compiled java to interpreter.
+int CompiledStaticCall::reloc_to_interp_stub() {
+  return 10;  // 4 in emit_java_to_interp + 1 in Java_Static_Call
+}
+
+void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
+  address stub = find_stub();
+  guarantee(stub != NULL, "stub not found");
+
+  if (TraceICs) {
+    ResourceMark rm;
+    tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
+                  instruction_address(),
+                  callee->name_and_sig_as_C_string());
+  }
+
+  // Creation also verifies the object.
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
+  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
+
+  assert(method_holder->data() == 0 || method_holder->data() == (intptr_t)callee(),
+         "a) MT-unsafe modification of inline cache");
+  assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry,
+         "b) MT-unsafe modification of inline cache");
+
+  // Update stub.
+  method_holder->set_data((intptr_t)callee());
+  jump->set_jump_destination(entry);
+
+  // Update jump to call.
+  set_destination_mt_safe(stub);
+}
+
+void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
+  assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
+  // Reset stub.
+  address stub = static_stub->addr();
+  assert(stub != NULL, "stub not found");
+  // Creation also verifies the object.
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
+  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
+  method_holder->set_data(0);
+  jump->set_jump_destination((address)-1);
+}
+
+//-----------------------------------------------------------------------------
+// Non-product mode code
+#ifndef PRODUCT
+
+void CompiledStaticCall::verify() {
+  // Verify call.
+  NativeCall::verify();
+  if (os::is_MP()) {
+    verify_alignment();
+  }
+
+  // Verify stub.
+  address stub = find_stub();
+  assert(stub != NULL, "no stub found for static call");
+  // Creation also verifies the object.
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
+  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
+
+  // Verify state.
+  assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check");
+}
+
+#endif // !PRODUCT
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Wed May 08 10:10:05 2013 +0100
@@ -1656,53 +1656,6 @@
 }
 
 //=============================================================================
-
-// emit call stub, compiled java to interpretor
-void emit_java_to_interp(CodeBuffer &cbuf ) {
-
-  // Stub is fixed up when the corresponding call is converted from calling
-  // compiled code to calling interpreted code.
-  // set (empty), G5
-  // jmp -1
-
-  address mark = cbuf.insts_mark();  // get mark within main instrs section
-
-  MacroAssembler _masm(&cbuf);
-
-  address base =
-  __ start_a_stub(Compile::MAX_stubs_size);
-  if (base == NULL)  return;  // CodeBuffer::expand failed
-
-  // static stub relocation stores the instruction address of the call
-  __ relocate(static_stub_Relocation::spec(mark));
-
-  __ set_metadata(NULL, reg_to_register_object(Matcher::inline_cache_reg_encode()));
-
-  __ set_inst_mark();
-  AddressLiteral addrlit(-1);
-  __ JUMP(addrlit, G3, 0);
-
-  __ delayed()->nop();
-
-  // Update current stubs pointer and restore code_end.
-  __ end_a_stub();
-}
-
-// size of call stub, compiled java to interpretor
-uint size_java_to_interp() {
-  // This doesn't need to be accurate but it must be larger or equal to
-  // the real size of the stub.
-  return (NativeMovConstReg::instruction_size +  // sethi/setlo;
-          NativeJump::instruction_size + // sethi; jmp; nop
-          (TraceJumps ? 20 * BytesPerInstWord : 0) );
-}
-// relocation entries for call stub, compiled java to interpretor
-uint reloc_java_to_interp() {
-  return 10;  // 4 in emit_java_to_interp + 1 in Java_Static_Call
-}
-
-
-//=============================================================================
 #ifndef PRODUCT
 void MachUEPNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
   st->print_cr("\nUEP:");
@@ -2576,15 +2529,15 @@
   enc_class Java_Static_Call (method meth) %{    // JAVA STATIC CALL
     // CALL to fixup routine.  Fixup routine uses ScopeDesc info to determine
     // who we intended to call.
-    if ( !_method ) {
+    if (!_method) {
       emit_call_reloc(cbuf, $meth$$method, relocInfo::runtime_call_type);
     } else if (_optimized_virtual) {
       emit_call_reloc(cbuf, $meth$$method, relocInfo::opt_virtual_call_type);
     } else {
       emit_call_reloc(cbuf, $meth$$method, relocInfo::static_call_type);
     }
-    if( _method ) {  // Emit stub for static call
-      emit_java_to_interp(cbuf);
+    if (_method) {  // Emit stub for static call.
+      CompiledStaticCall::emit_to_interp_stub(cbuf);
     }
   %}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "asm/macroAssembler.inline.hpp"
+#include "code/compiledIC.hpp"
+#include "code/icBuffer.hpp"
+#include "code/nmethod.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/safepoint.hpp"
+
+// Release the CompiledICHolder* associated with this call site is there is one.
+void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) {
+  // This call site might have become stale so inspect it carefully.
+  NativeCall* call = nativeCall_at(call_site->addr());
+  if (is_icholder_entry(call->destination())) {
+    NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value());
+    InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data());
+  }
+}
+
+bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) {
+  // This call site might have become stale so inspect it carefully.
+  NativeCall* call = nativeCall_at(call_site->addr());
+  return is_icholder_entry(call->destination());
+}
+
+//-----------------------------------------------------------------------------
+// High-level access to an inline cache. Guaranteed to be MT-safe.
+
+CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
+  : _ic_call(call)
+{
+  address ic_call = call->instruction_address();
+
+  assert(ic_call != NULL, "ic_call address must be set");
+  assert(nm != NULL, "must pass nmethod");
+  assert(nm->contains(ic_call), "must be in nmethod");
+
+  // Search for the ic_call at the given address.
+  RelocIterator iter(nm, ic_call, ic_call+1);
+  bool ret = iter.next();
+  assert(ret == true, "relocInfo must exist at this address");
+  assert(iter.addr() == ic_call, "must find ic_call");
+  if (iter.type() == relocInfo::virtual_call_type) {
+    virtual_call_Relocation* r = iter.virtual_call_reloc();
+    _is_optimized = false;
+    _value = nativeMovConstReg_at(r->cached_value());
+  } else {
+    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
+    _is_optimized = true;
+    _value = NULL;
+  }
+}
+
+// ----------------------------------------------------------------------------
+
+#define __ _masm.
+void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
+  // Stub is fixed up when the corresponding call is converted from
+  // calling compiled code to calling interpreted code.
+  // movq rbx, 0
+  // jmp -5 # to self
+
+  address mark = cbuf.insts_mark();  // Get mark within main instrs section.
+
+  // Note that the code buffer's insts_mark is always relative to insts.
+  // That's why we must use the macroassembler to generate a stub.
+  MacroAssembler _masm(&cbuf);
+
+  address base =
+  __ start_a_stub(to_interp_stub_size()*2);
+  if (base == NULL) return;  // CodeBuffer::expand failed.
+  // Static stub relocation stores the instruction address of the call.
+  __ relocate(static_stub_Relocation::spec(mark), Assembler::imm_operand);
+  // Static stub relocation also tags the Method* in the code-stream.
+  __ mov_metadata(rbx, (Metadata*) NULL);  // Method is zapped till fixup time.
+  // This is recognized as unresolved by relocs/nativeinst/ic code.
+  __ jump(RuntimeAddress(__ pc()));
+
+  // Update current stubs pointer and restore insts_end.
+  __ end_a_stub();
+}
+#undef __
+
+int CompiledStaticCall::to_interp_stub_size() {
+  return NOT_LP64(10)    // movl; jmp
+         LP64_ONLY(15);  // movq (1+1+8); jmp (1+4)
+}
+
+// Relocation entries for call stub, compiled java to interpreter.
+int CompiledStaticCall::reloc_to_interp_stub() {
+  return 4; // 3 in emit_to_interp_stub + 1 in emit_call
+}
+
+void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
+  address stub = find_stub();
+  guarantee(stub != NULL, "stub not found");
+
+  if (TraceICs) {
+    ResourceMark rm;
+    tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
+                  instruction_address(),
+                  callee->name_and_sig_as_C_string());
+  }
+
+  // Creation also verifies the object.
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
+  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
+
+  assert(method_holder->data() == 0 || method_holder->data() == (intptr_t)callee(),
+         "a) MT-unsafe modification of inline cache");
+  assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry,
+         "b) MT-unsafe modification of inline cache");
+
+  // Update stub.
+  method_holder->set_data((intptr_t)callee());
+  jump->set_jump_destination(entry);
+
+  // Update jump to call.
+  set_destination_mt_safe(stub);
+}
+
+void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
+  assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
+  // Reset stub.
+  address stub = static_stub->addr();
+  assert(stub != NULL, "stub not found");
+  // Creation also verifies the object.
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
+  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
+  method_holder->set_data(0);
+  jump->set_jump_destination((address)-1);
+}
+
+//-----------------------------------------------------------------------------
+// Non-product mode code
+#ifndef PRODUCT
+
+void CompiledStaticCall::verify() {
+  // Verify call.
+  NativeCall::verify();
+  if (os::is_MP()) {
+    verify_alignment();
+  }
+
+  // Verify stub.
+  address stub = find_stub();
+  assert(stub != NULL, "no stub found for static call");
+  // Creation also verifies the object.
+  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
+  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
+
+  // Verify state.
+  assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check");
+}
+
+#endif // !PRODUCT
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Wed May 08 10:10:05 2013 +0100
@@ -1257,43 +1257,6 @@
 }
 
 //=============================================================================
-
-// emit call stub, compiled java to interpreter
-void emit_java_to_interp(CodeBuffer &cbuf ) {
-  // Stub is fixed up when the corresponding call is converted from calling
-  // compiled code to calling interpreted code.
-  // mov rbx,0
-  // jmp -1
-
-  address mark = cbuf.insts_mark();  // get mark within main instrs section
-
-  // Note that the code buffer's insts_mark is always relative to insts.
-  // That's why we must use the macroassembler to generate a stub.
-  MacroAssembler _masm(&cbuf);
-
-  address base =
-  __ start_a_stub(Compile::MAX_stubs_size);
-  if (base == NULL)  return;  // CodeBuffer::expand failed
-  // static stub relocation stores the instruction address of the call
-  __ relocate(static_stub_Relocation::spec(mark), RELOC_IMM32);
-  // static stub relocation also tags the Method* in the code-stream.
-  __ mov_metadata(rbx, (Metadata*)NULL);  // method is zapped till fixup time
-  // This is recognized as unresolved by relocs/nativeInst/ic code
-  __ jump(RuntimeAddress(__ pc()));
-
-  __ end_a_stub();
-  // Update current stubs pointer and restore insts_end.
-}
-// size of call stub, compiled java to interpretor
-uint size_java_to_interp() {
-  return 10;  // movl; jmp
-}
-// relocation entries for call stub, compiled java to interpretor
-uint reloc_java_to_interp() {
-  return 4;  // 3 in emit_java_to_interp + 1 in Java_Static_Call
-}
-
-//=============================================================================
 #ifndef PRODUCT
 void MachUEPNode::format( PhaseRegAlloc *ra_, outputStream* st ) const {
   st->print_cr(  "CMP    EAX,[ECX+4]\t# Inline cache check");
@@ -1909,8 +1872,8 @@
       emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4),
                      static_call_Relocation::spec(), RELOC_IMM32 );
     }
-    if (_method) {  // Emit stub for static call
-      emit_java_to_interp(cbuf);
+    if (_method) {  // Emit stub for static call.
+      CompiledStaticCall::emit_to_interp_stub(cbuf);
     }
   %}
 
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Wed May 08 10:10:05 2013 +0100
@@ -1388,48 +1388,6 @@
 }
 
 //=============================================================================
-
-// emit call stub, compiled java to interpreter
-void emit_java_to_interp(CodeBuffer& cbuf)
-{
-  // Stub is fixed up when the corresponding call is converted from
-  // calling compiled code to calling interpreted code.
-  // movq rbx, 0
-  // jmp -5 # to self
-
-  address mark = cbuf.insts_mark();  // get mark within main instrs section
-
-  // Note that the code buffer's insts_mark is always relative to insts.
-  // That's why we must use the macroassembler to generate a stub.
-  MacroAssembler _masm(&cbuf);
-
-  address base =
-  __ start_a_stub(Compile::MAX_stubs_size);
-  if (base == NULL)  return;  // CodeBuffer::expand failed
-  // static stub relocation stores the instruction address of the call
-  __ relocate(static_stub_Relocation::spec(mark), RELOC_IMM64);
-  // static stub relocation also tags the Method* in the code-stream.
-  __ mov_metadata(rbx, (Metadata*) NULL);  // method is zapped till fixup time
-  // This is recognized as unresolved by relocs/nativeinst/ic code
-  __ jump(RuntimeAddress(__ pc()));
-
-  // Update current stubs pointer and restore insts_end.
-  __ end_a_stub();
-}
-
-// size of call stub, compiled java to interpretor
-uint size_java_to_interp()
-{
-  return 15;  // movq (1+1+8); jmp (1+4)
-}
-
-// relocation entries for call stub, compiled java to interpretor
-uint reloc_java_to_interp()
-{
-  return 4; // 3 in emit_java_to_interp + 1 in Java_Static_Call
-}
-
-//=============================================================================
 #ifndef PRODUCT
 void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
 {
@@ -2078,8 +2036,8 @@
                      RELOC_DISP32);
     }
     if (_method) {
-      // Emit stub for static call
-      emit_java_to_interp(cbuf);
+      // Emit stub for static call.
+      CompiledStaticCall::emit_to_interp_stub(cbuf);
     }
   %}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "code/codeCache.hpp"
+#include "code/compiledIC.hpp"
+#include "code/icBuffer.hpp"
+#include "code/nmethod.hpp"
+#include "code/vtableStubs.hpp"
+#include "interpreter/interpreter.hpp"
+#include "interpreter/linkResolver.hpp"
+#include "memory/metadataFactory.hpp"
+#include "memory/oopFactory.hpp"
+#include "oops/method.hpp"
+#include "oops/oop.inline.hpp"
+#include "oops/symbol.hpp"
+#include "runtime/icache.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "runtime/stubRoutines.hpp"
+#include "utilities/events.hpp"
+
+
+// Release the CompiledICHolder* associated with this call site is there is one.
+void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) {
+  // This call site might have become stale so inspect it carefully.
+  NativeCall* call = nativeCall_at(call_site->addr());
+  if (is_icholder_entry(call->destination())) {
+    NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value());
+    InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data());
+  }
+}
+
+bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) {
+  // This call site might have become stale so inspect it carefully.
+  NativeCall* call = nativeCall_at(call_site->addr());
+  return is_icholder_entry(call->destination());
+}
+
+//-----------------------------------------------------------------------------
+// High-level access to an inline cache. Guaranteed to be MT-safe.
+
+CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
+  : _ic_call(call)
+{
+  address ic_call = call->instruction_address();
+
+  assert(ic_call != NULL, "ic_call address must be set");
+  assert(nm != NULL, "must pass nmethod");
+  assert(nm->contains(ic_call), "must be in nmethod");
+
+  // Search for the ic_call at the given address.
+  RelocIterator iter(nm, ic_call, ic_call+1);
+  bool ret = iter.next();
+  assert(ret == true, "relocInfo must exist at this address");
+  assert(iter.addr() == ic_call, "must find ic_call");
+  if (iter.type() == relocInfo::virtual_call_type) {
+    virtual_call_Relocation* r = iter.virtual_call_reloc();
+    _is_optimized = false;
+    _value = nativeMovConstReg_at(r->cached_value());
+  } else {
+    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
+    _is_optimized = true;
+    _value = NULL;
+  }
+}
+
+// ----------------------------------------------------------------------------
+
+void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
+  ShouldNotReachHere(); // Only needed for COMPILER2.
+}
+
+int CompiledStaticCall::to_interp_stub_size() {
+  ShouldNotReachHere(); // Only needed for COMPILER2.
+  return 0;
+}
+
+// Relocation entries for call stub, compiled java to interpreter.
+int CompiledStaticCall::reloc_to_interp_stub() {
+  ShouldNotReachHere(); // Only needed for COMPILER2.
+  return 0;
+}
+
+void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
+  ShouldNotReachHere(); // Only needed for COMPILER2.
+}
+
+void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
+  ShouldNotReachHere(); // Only needed for COMPILER2.
+}
+
+//-----------------------------------------------------------------------------
+// Non-product mode code.
+#ifndef PRODUCT
+
+void CompiledStaticCall::verify() {
+  ShouldNotReachHere(); // Only needed for COMPILER2.
+}
+
+#endif // !PRODUCT
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1230,10 +1230,6 @@
   return retval;
 }
 
-const char* os::get_current_directory(char *buf, int buflen) {
-  return getcwd(buf, buflen);
-}
-
 // check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
@@ -2080,9 +2076,10 @@
     flags |= MAP_FIXED;
   }
 
-  // Map uncommitted pages PROT_READ and PROT_WRITE, change access
-  // to PROT_EXEC if executable when we commit the page.
-  addr = (char*)::mmap(requested_addr, bytes, PROT_READ|PROT_WRITE,
+  // Map reserved/uncommitted pages PROT_NONE so we fail early if we
+  // touch an uncommitted page. Otherwise, the read/write might
+  // succeed if we have enough swap space to back the physical page.
+  addr = (char*)::mmap(requested_addr, bytes, PROT_NONE,
                        flags, -1, 0);
 
   if (addr != MAP_FAILED) {
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed May 08 10:10:05 2013 +0100
@@ -119,6 +119,7 @@
 Mutex* os::Linux::_createThread_lock = NULL;
 pthread_t os::Linux::_main_thread;
 int os::Linux::_page_size = -1;
+const int os::Linux::_vm_default_page_size = (8 * K);
 bool os::Linux::_is_floating_stack = false;
 bool os::Linux::_is_NPTL = false;
 bool os::Linux::_supports_fast_thread_cpu_time = false;
@@ -1662,10 +1663,6 @@
   return retval;
 }
 
-const char* os::get_current_directory(char *buf, int buflen) {
-  return getcwd(buf, buflen);
-}
-
 // check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
@@ -2906,9 +2903,10 @@
     flags |= MAP_FIXED;
   }
 
-  // Map uncommitted pages PROT_READ and PROT_WRITE, change access
-  // to PROT_EXEC if executable when we commit the page.
-  addr = (char*)::mmap(requested_addr, bytes, PROT_READ|PROT_WRITE,
+  // Map reserved/uncommitted pages PROT_NONE so we fail early if we
+  // touch an uncommitted page. Otherwise, the read/write might
+  // succeed if we have enough swap space to back the physical page.
+  addr = (char*)::mmap(requested_addr, bytes, PROT_NONE,
                        flags, -1, 0);
 
   if (addr != MAP_FAILED) {
@@ -4249,6 +4247,15 @@
   Linux::clock_init();
   initial_time_count = os::elapsed_counter();
   pthread_mutex_init(&dl_mutex, NULL);
+
+  // If the pagesize of the VM is greater than 8K determine the appropriate
+  // number of initial guard pages.  The user can change this with the
+  // command line arguments, if needed.
+  if (vm_page_size() > (int)Linux::vm_default_page_size()) {
+    StackYellowPages = 1;
+    StackRedPages = 1;
+    StackShadowPages = round_to((StackShadowPages*Linux::vm_default_page_size()), vm_page_size()) / vm_page_size();
+  }
 }
 
 // To install functions for atexit system call
@@ -4302,8 +4309,8 @@
   // Add in 2*BytesPerWord times page size to account for VM stack during
   // class initialization depending on 32 or 64 bit VM.
   os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed,
-            (size_t)(StackYellowPages+StackRedPages+StackShadowPages+
-                    2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::page_size());
+            (size_t)(StackYellowPages+StackRedPages+StackShadowPages) * Linux::page_size() +
+                    (2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::vm_default_page_size());
 
   size_t threadStackSizeInBytes = ThreadStackSize * K;
   if (threadStackSizeInBytes != 0 &&
--- a/hotspot/src/os/linux/vm/os_linux.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os/linux/vm/os_linux.hpp	Wed May 08 10:10:05 2013 +0100
@@ -70,6 +70,7 @@
   static pthread_t _main_thread;
   static Mutex* _createThread_lock;
   static int _page_size;
+  static const int _vm_default_page_size;
 
   static julong available_memory();
   static julong physical_memory() { return _physical_memory; }
@@ -116,6 +117,8 @@
   static int page_size(void)                                        { return _page_size; }
   static void set_page_size(int val)                                { _page_size = val; }
 
+  static int vm_default_page_size(void)                             { return _vm_default_page_size; }
+
   static address   ucontext_get_pc(ucontext_t* uc);
   static intptr_t* ucontext_get_sp(ucontext_t* uc);
   static intptr_t* ucontext_get_fp(ucontext_t* uc);
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Wed May 08 10:10:05 2013 +0100
@@ -251,3 +251,11 @@
   return true;
 #endif
 }
+
+const char* os::get_current_directory(char *buf, size_t buflen) {
+  return getcwd(buf, buflen);
+}
+
+FILE* os::open(int fd, const char* mode) {
+  return ::fdopen(fd, mode);
+}
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed May 08 10:10:05 2013 +0100
@@ -824,7 +824,7 @@
       // allocate new buffer and initialize
       info = (Dl_serinfo*)malloc(_info.dls_size);
       if (info == NULL) {
-        vm_exit_out_of_memory(_info.dls_size,
+        vm_exit_out_of_memory(_info.dls_size, OOM_MALLOC_ERROR,
                               "init_system_properties_values info");
       }
       info->dls_size = _info.dls_size;
@@ -866,7 +866,7 @@
       common_path = malloc(bufsize);
       if (common_path == NULL) {
         free(info);
-        vm_exit_out_of_memory(bufsize,
+        vm_exit_out_of_memory(bufsize, OOM_MALLOC_ERROR,
                               "init_system_properties_values common_path");
       }
       sprintf(common_path, COMMON_DIR "/lib/%s", cpu_arch);
@@ -879,7 +879,7 @@
       if (library_path == NULL) {
         free(info);
         free(common_path);
-        vm_exit_out_of_memory(bufsize,
+        vm_exit_out_of_memory(bufsize, OOM_MALLOC_ERROR,
                               "init_system_properties_values library_path");
       }
       library_path[0] = '\0';
@@ -1623,7 +1623,8 @@
   // %%% this is used only in threadLocalStorage.cpp
   if (thr_setspecific((thread_key_t)index, value)) {
     if (errno == ENOMEM) {
-       vm_exit_out_of_memory(SMALLINT, "thr_setspecific: out of swap space");
+       vm_exit_out_of_memory(SMALLINT, OOM_MALLOC_ERROR,
+                             "thr_setspecific: out of swap space");
     } else {
       fatal(err_msg("os::thread_local_storage_at_put: thr_setspecific failed "
                     "(%s)", strerror(errno)));
@@ -1915,10 +1916,6 @@
   return retval;
 }
 
-const char* os::get_current_directory(char *buf, int buflen) {
-  return getcwd(buf, buflen);
-}
-
 // check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1221,8 +1221,10 @@
 
 // Needs to be in os specific directory because windows requires another
 // header file <direct.h>
-const char* os::get_current_directory(char *buf, int buflen) {
-  return _getcwd(buf, buflen);
+const char* os::get_current_directory(char *buf, size_t buflen) {
+  int n = static_cast<int>(buflen);
+  if (buflen > INT_MAX)  n = INT_MAX;
+  return _getcwd(buf, n);
 }
 
 //-----------------------------------------------------------
@@ -4098,6 +4100,10 @@
   return ::open(pathbuf, oflag | O_BINARY | O_NOINHERIT, mode);
 }
 
+FILE* os::open(int fd, const char* mode) {
+  return ::_fdopen(fd, mode);
+}
+
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   WIN32_FIND_DATA fd;
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Wed May 08 10:10:05 2013 +0100
@@ -178,7 +178,7 @@
     // JVM needs to know exact stack location, abort if it fails
     if (rslt != 0) {
       if (rslt == ENOMEM) {
-        vm_exit_out_of_memory(0, "pthread_getattr_np");
+        vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
       } else {
         fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
       }
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Wed May 08 10:10:05 2013 +0100
@@ -710,7 +710,7 @@
      // JVM needs to know exact stack location, abort if it fails
      if (rslt != 0) {
        if (rslt == ENOMEM) {
-         vm_exit_out_of_memory(0, "pthread_getattr_np");
+         vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
        } else {
          fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
        }
--- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Wed May 08 10:10:05 2013 +0100
@@ -313,7 +313,7 @@
   int res = pthread_getattr_np(pthread_self(), &attr);
   if (res != 0) {
     if (res == ENOMEM) {
-      vm_exit_out_of_memory(0, "pthread_getattr_np");
+      vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
     }
     else {
       fatal(err_msg("pthread_getattr_np failed with errno = %d", res));
--- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Wed May 08 10:10:05 2013 +0100
@@ -591,7 +591,7 @@
   // on the thread stack, which could get a mapping error when touched.
   address addr = (address) info->si_addr;
   if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) {
-    vm_exit_out_of_memory(0, "Out of swap space to map in thread stack.");
+    vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "Out of swap space to map in thread stack.");
   }
 
   VMError err(t, sig, pc, info, ucVoid);
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Wed May 08 10:10:05 2013 +0100
@@ -745,7 +745,7 @@
   // on the thread stack, which could get a mapping error when touched.
   address addr = (address) info->si_addr;
   if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) {
-    vm_exit_out_of_memory(0, "Out of swap space to map in thread stack.");
+    vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "Out of swap space to map in thread stack.");
   }
 
   VMError err(t, sig, pc, info, ucVoid);
--- a/hotspot/src/share/vm/adlc/main.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/adlc/main.cpp	Wed May 08 10:10:05 2013 +0100
@@ -213,6 +213,7 @@
   AD.addInclude(AD._CPP_file, "adfiles", get_basename(AD._HPP_file._name));
   AD.addInclude(AD._CPP_file, "memory/allocation.inline.hpp");
   AD.addInclude(AD._CPP_file, "asm/macroAssembler.inline.hpp");
+  AD.addInclude(AD._CPP_file, "code/compiledIC.hpp");
   AD.addInclude(AD._CPP_file, "code/vmreg.hpp");
   AD.addInclude(AD._CPP_file, "gc_interface/collectedHeap.inline.hpp");
   AD.addInclude(AD._CPP_file, "oops/compiledICHolder.hpp");
--- a/hotspot/src/share/vm/asm/assembler.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/asm/assembler.cpp	Wed May 08 10:10:05 2013 +0100
@@ -44,7 +44,7 @@
   CodeSection* cs = code->insts();
   cs->clear_mark();   // new assembler kills old mark
   if (cs->start() == NULL)  {
-    vm_exit_out_of_memory(0, err_msg("CodeCache: no room for %s",
+    vm_exit_out_of_memory(0, OOM_MMAP_ERROR, err_msg("CodeCache: no room for %s",
                                      code->name()));
   }
   _code_section = cs;
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Wed May 08 10:10:05 2013 +0100
@@ -483,7 +483,8 @@
     {
       // We have to lock the cpool to keep the oop from being resolved
       // while we are accessing it.
-        MonitorLockerEx ml(cpool->lock());
+      oop cplock = cpool->lock();
+      ObjectLocker ol(cplock, THREAD, cplock != NULL);
       constantTag tag = cpool->tag_at(index);
       if (tag.is_klass()) {
         // The klass has been inserted into the constant pool
@@ -1149,23 +1150,9 @@
   record_method_not_compilable("out of memory");
 }
 
-fileStream* ciEnv::_replay_data_stream = NULL;
-
-void ciEnv::dump_replay_data() {
+void ciEnv::dump_replay_data(outputStream* out) {
   VM_ENTRY_MARK;
   MutexLocker ml(Compile_lock);
-  if (_replay_data_stream == NULL) {
-    _replay_data_stream = new (ResourceObj::C_HEAP, mtCompiler) fileStream(ReplayDataFile);
-    if (_replay_data_stream == NULL) {
-      fatal(err_msg("Can't open %s for replay data", ReplayDataFile));
-    }
-  }
-  dump_replay_data(_replay_data_stream);
-}
-
-
-void ciEnv::dump_replay_data(outputStream* out) {
-  ASSERT_IN_VM;
   ResourceMark rm;
 #if INCLUDE_JVMTI
   out->print_cr("JvmtiExport can_access_local_variables %d",     _jvmti_can_access_local_variables);
@@ -1178,13 +1165,15 @@
   for (int i = 0; i < objects->length(); i++) {
     objects->at(i)->dump_replay_data(out);
   }
-  Method* method = task()->method();
-  int entry_bci = task()->osr_bci();
+  CompileTask* task = this->task();
+  Method* method = task->method();
+  int entry_bci = task->osr_bci();
+  int comp_level = task->comp_level();
   // Klass holder = method->method_holder();
-  out->print_cr("compile %s %s %s %d",
+  out->print_cr("compile %s %s %s %d %d",
                 method->klass_name()->as_quoted_ascii(),
                 method->name()->as_quoted_ascii(),
                 method->signature()->as_quoted_ascii(),
-                entry_bci);
+                entry_bci, comp_level);
   out->flush();
 }
--- a/hotspot/src/share/vm/ci/ciEnv.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp	Wed May 08 10:10:05 2013 +0100
@@ -46,8 +46,6 @@
   friend class CompileBroker;
   friend class Dependencies;  // for get_object, during logging
 
-  static fileStream* _replay_data_stream;
-
 private:
   Arena*           _arena;       // Alias for _ciEnv_arena except in init_shared_objects()
   Arena            _ciEnv_arena;
@@ -451,10 +449,6 @@
   // RedefineClasses support
   void metadata_do(void f(Metadata*)) { _factory->metadata_do(f); }
 
-  // Dump the compilation replay data for this ciEnv to
-  // ReplayDataFile, creating the file if needed.
-  void  dump_replay_data();
-
   // Dump the compilation replay data for the ciEnv to the stream.
   void dump_replay_data(outputStream* out);
 };
--- a/hotspot/src/share/vm/ci/ciMethod.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp	Wed May 08 10:10:05 2013 +0100
@@ -196,7 +196,6 @@
   // Analysis and profiling.
   //
   // Usage note: liveness_at_bci and init_vars should be wrapped in ResourceMarks.
-  bool          uses_monitors() const            { return _uses_monitors; } // this one should go away, it has a misleading name
   bool          has_monitor_bytecodes() const    { return _uses_monitors; }
   bool          has_balanced_monitors();
 
--- a/hotspot/src/share/vm/ci/ciReplay.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp	Wed May 08 10:10:05 2013 +0100
@@ -89,7 +89,7 @@
     loader = Handle(thread, SystemDictionary::java_system_loader());
     stream = fopen(filename, "rt");
     if (stream == NULL) {
-      fprintf(stderr, "Can't open replay file %s\n", filename);
+      fprintf(stderr, "ERROR: Can't open replay file %s\n", filename);
     }
     buffer_length = 32;
     buffer = NEW_RESOURCE_ARRAY(char, buffer_length);
@@ -327,7 +327,6 @@
         if (had_error()) {
           tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message);
           tty->print_cr("%s", buffer);
-          assert(false, "error");
           return;
         }
         pos = 0;
@@ -370,11 +369,47 @@
     }
   }
 
-  // compile <klass> <name> <signature> <entry_bci>
+  // validation of comp_level
+  bool is_valid_comp_level(int comp_level) {
+    const int msg_len = 256;
+    char* msg = NULL;
+    if (!is_compile(comp_level)) {
+      msg = NEW_RESOURCE_ARRAY(char, msg_len);
+      jio_snprintf(msg, msg_len, "%d isn't compilation level", comp_level);
+    } else if (!TieredCompilation && (comp_level != CompLevel_highest_tier)) {
+      msg = NEW_RESOURCE_ARRAY(char, msg_len);
+      switch (comp_level) {
+        case CompLevel_simple:
+          jio_snprintf(msg, msg_len, "compilation level %d requires Client VM or TieredCompilation", comp_level);
+          break;
+        case CompLevel_full_optimization:
+          jio_snprintf(msg, msg_len, "compilation level %d requires Server VM", comp_level);
+          break;
+        default:
+          jio_snprintf(msg, msg_len, "compilation level %d requires TieredCompilation", comp_level);
+      }
+    }
+    if (msg != NULL) {
+      report_error(msg);
+      return false;
+    }
+    return true;
+  }
+
+  // compile <klass> <name> <signature> <entry_bci> <comp_level>
   void process_compile(TRAPS) {
     // methodHandle method;
     Method* method = parse_method(CHECK);
     int entry_bci = parse_int("entry_bci");
+    const char* comp_level_label = "comp_level";
+    int comp_level = parse_int(comp_level_label);
+    // old version w/o comp_level
+    if (had_error() && (error_message() == comp_level_label)) {
+      comp_level = CompLevel_full_optimization;
+    }
+    if (!is_valid_comp_level(comp_level)) {
+      return;
+    }
     Klass* k = method->method_holder();
     ((InstanceKlass*)k)->initialize(THREAD);
     if (HAS_PENDING_EXCEPTION) {
@@ -389,12 +424,12 @@
       }
     }
     // Make sure the existence of a prior compile doesn't stop this one
-    nmethod* nm = (entry_bci != InvocationEntryBci) ? method->lookup_osr_nmethod_for(entry_bci, CompLevel_full_optimization, true) : method->code();
+    nmethod* nm = (entry_bci != InvocationEntryBci) ? method->lookup_osr_nmethod_for(entry_bci, comp_level, true) : method->code();
     if (nm != NULL) {
       nm->make_not_entrant();
     }
     replay_state = this;
-    CompileBroker::compile_method(method, entry_bci, CompLevel_full_optimization,
+    CompileBroker::compile_method(method, entry_bci, comp_level,
                                   methodHandle(), 0, "replay", THREAD);
     replay_state = NULL;
     reset();
@@ -551,7 +586,7 @@
           if (parsed_two_word == i) continue;
 
         default:
-          ShouldNotReachHere();
+          fatal(err_msg_res("Unexpected tag: %d", cp->tag_at(i).value()));
           break;
       }
 
@@ -819,6 +854,11 @@
     ReplaySuppressInitializers = 1;
   }
 
+  if (FLAG_IS_DEFAULT(ReplayDataFile)) {
+    tty->print_cr("ERROR: no compiler replay data file specified (use -XX:ReplayDataFile=replay_pid12345.txt).");
+    return 1;
+  }
+
   // Load and parse the replay data
   CompileReplay rp(ReplayDataFile, THREAD);
   int exit_code = 0;
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed May 08 10:10:05 2013 +0100
@@ -2027,7 +2027,6 @@
   u2 method_parameters_length = 0;
   u1* method_parameters_data = NULL;
   bool method_parameters_seen = false;
-  bool method_parameters_four_byte_flags;
   bool parsed_code_attribute = false;
   bool parsed_checked_exceptions_attribute = false;
   bool parsed_stackmap_attribute = false;
@@ -2241,26 +2240,14 @@
       }
       method_parameters_seen = true;
       method_parameters_length = cfs->get_u1_fast();
-      // Track the actual size (note: this is written for clarity; a
-      // decent compiler will CSE and constant-fold this into a single
-      // expression)
-      // Use the attribute length to figure out the size of flags
-      if (method_attribute_length == (method_parameters_length * 6u) + 1u) {
-        method_parameters_four_byte_flags = true;
-      } else if (method_attribute_length == (method_parameters_length * 4u) + 1u) {
-        method_parameters_four_byte_flags = false;
-      } else {
+      if (method_attribute_length != (method_parameters_length * 4u) + 1u) {
         classfile_parse_error(
           "Invalid MethodParameters method attribute length %u in class file",
           method_attribute_length, CHECK_(nullHandle));
       }
       method_parameters_data = cfs->get_u1_buffer();
       cfs->skip_u2_fast(method_parameters_length);
-      if (method_parameters_four_byte_flags) {
-        cfs->skip_u4_fast(method_parameters_length);
-      } else {
-        cfs->skip_u2_fast(method_parameters_length);
-      }
+      cfs->skip_u2_fast(method_parameters_length);
       // ignore this attribute if it cannot be reflected
       if (!SystemDictionary::Parameter_klass_loaded())
         method_parameters_length = 0;
@@ -2423,13 +2410,8 @@
     for (int i = 0; i < method_parameters_length; i++) {
       elem[i].name_cp_index = Bytes::get_Java_u2(method_parameters_data);
       method_parameters_data += 2;
-      if (method_parameters_four_byte_flags) {
-        elem[i].flags = Bytes::get_Java_u4(method_parameters_data);
-        method_parameters_data += 4;
-      } else {
-        elem[i].flags = Bytes::get_Java_u2(method_parameters_data);
-        method_parameters_data += 2;
-      }
+      elem[i].flags = Bytes::get_Java_u2(method_parameters_data);
+      method_parameters_data += 2;
     }
   }
 
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Wed May 08 10:10:05 2013 +0100
@@ -304,7 +304,19 @@
 
   inline void assert_property(bool b, const char* msg, TRAPS) {
 #ifdef ASSERT
-    if (!b) { fatal(msg); }
+    if (!b) {
+      ResourceMark rm(THREAD);
+      fatal(err_msg(msg, _class_name->as_C_string()));
+    }
+#endif
+  }
+
+  inline void assert_property(bool b, const char* msg, int index, TRAPS) {
+#ifdef ASSERT
+    if (!b) {
+      ResourceMark rm(THREAD);
+      fatal(err_msg(msg, index, _class_name->as_C_string()));
+    }
 #endif
   }
 
@@ -312,7 +324,7 @@
     if (_need_verify) {
       guarantee_property(property, msg, index, CHECK);
     } else {
-      assert_property(property, msg, CHECK);
+      assert_property(property, msg, index, CHECK);
     }
   }
 
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1345,9 +1345,10 @@
           tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_class_counter, buffer);
           // Preload all classes to get around uncommon traps
           // Iterate over all methods in class
+          int comp_level = CompilationPolicy::policy()->initial_compile_level();
           for (int n = 0; n < k->methods()->length(); n++) {
             methodHandle m (THREAD, k->methods()->at(n));
-            if (CompilationPolicy::can_be_compiled(m)) {
+            if (CompilationPolicy::can_be_compiled(m, comp_level)) {
 
               if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
                 // Give sweeper a chance to keep up with CTW
@@ -1356,7 +1357,7 @@
                 _codecache_sweep_counter = 0;
               }
               // Force compilation
-              CompileBroker::compile_method(m, InvocationEntryBci, CompilationPolicy::policy()->initial_compile_level(),
+              CompileBroker::compile_method(m, InvocationEntryBci, comp_level,
                                             methodHandle(), 0, "CTW", THREAD);
               if (HAS_PENDING_EXCEPTION) {
                 clear_pending_exception_if_not_oom(CHECK);
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed May 08 10:10:05 2013 +0100
@@ -53,6 +53,7 @@
 #include "classfile/metadataOnStackMark.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
+#include "memory/gcLocker.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/metaspaceShared.hpp"
 #include "memory/oopFactory.hpp"
@@ -65,17 +66,19 @@
 
 ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
 
-ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous) :
+ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies) :
   _class_loader(h_class_loader()),
   _is_anonymous(is_anonymous), _keep_alive(is_anonymous), // initially
   _metaspace(NULL), _unloading(false), _klasses(NULL),
   _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL),
-  _next(NULL), _dependencies(),
+  _next(NULL), _dependencies(dependencies),
   _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) {
     // empty
 }
 
 void ClassLoaderData::init_dependencies(TRAPS) {
+  assert(!Universe::is_fully_initialized(), "should only be called when initializing");
+  assert(is_the_null_class_loader_data(), "should only call this for the null class loader");
   _dependencies.init(CHECK);
 }
 
@@ -277,6 +280,9 @@
 void ClassLoaderData::unload() {
   _unloading = true;
 
+  // Tell serviceability tools these classes are unloading
+  classes_do(InstanceKlass::notify_unload_class);
+
   if (TraceClassLoaderData) {
     ResourceMark rm;
     tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this);
@@ -300,6 +306,9 @@
 
 
 ClassLoaderData::~ClassLoaderData() {
+  // Release C heap structures for all the classes.
+  classes_do(InstanceKlass::release_C_heap_structures);
+
   Metaspace *m = _metaspace;
   if (m != NULL) {
     _metaspace = NULL;
@@ -423,7 +432,7 @@
 // These anonymous class loaders are to contain classes used for JSR292
 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
   // Add a new class loader data to the graph.
-  return ClassLoaderDataGraph::add(NULL, loader, CHECK_NULL);
+  return ClassLoaderDataGraph::add(loader, true, CHECK_NULL);
 }
 
 const char* ClassLoaderData::loader_name() {
@@ -495,19 +504,22 @@
 ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
 ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
 
-
 // Add a new class loader data node to the list.  Assign the newly created
 // ClassLoaderData into the java/lang/ClassLoader object as a hidden field
-ClassLoaderData* ClassLoaderDataGraph::add(ClassLoaderData** cld_addr, Handle loader, TRAPS) {
-  // Not assigned a class loader data yet.
-  // Create one.
-  ClassLoaderData* *list_head = &_head;
-  ClassLoaderData* next = _head;
+ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_anonymous, TRAPS) {
+  // We need to allocate all the oops for the ClassLoaderData before allocating the
+  // actual ClassLoaderData object.
+  ClassLoaderData::Dependencies dependencies(CHECK_NULL);
 
-  bool is_anonymous = (cld_addr == NULL);
-  ClassLoaderData* cld = new ClassLoaderData(loader, is_anonymous);
+  No_Safepoint_Verifier no_safepoints; // we mustn't GC until we've installed the
+                                       // ClassLoaderData in the graph since the CLD
+                                       // contains unhandled oops
 
-  if (cld_addr != NULL) {
+  ClassLoaderData* cld = new ClassLoaderData(loader, is_anonymous, dependencies);
+
+
+  if (!is_anonymous) {
+    ClassLoaderData** cld_addr = java_lang_ClassLoader::loader_data_addr(loader());
     // First, Atomically set it
     ClassLoaderData* old = (ClassLoaderData*) Atomic::cmpxchg_ptr(cld, cld_addr, NULL);
     if (old != NULL) {
@@ -519,6 +531,9 @@
 
   // We won the race, and therefore the task of adding the data to the list of
   // class loader data
+  ClassLoaderData** list_head = &_head;
+  ClassLoaderData* next = _head;
+
   do {
     cld->set_next(next);
     ClassLoaderData* exchanged = (ClassLoaderData*)Atomic::cmpxchg_ptr(cld, list_head, next);
@@ -531,10 +546,6 @@
                    cld->loader_name());
         tty->print_cr("]");
       }
-      // Create dependencies after the CLD is added to the list.  Otherwise,
-      // the GC GC will not find the CLD and the _class_loader field will
-      // not be updated.
-      cld->init_dependencies(CHECK_NULL);
       return cld;
     }
     next = exchanged;
@@ -665,6 +676,8 @@
     dead->unload();
     data = data->next();
     // Remove from loader list.
+    // This class loader data will no longer be found
+    // in the ClassLoaderDataGraph.
     if (prev != NULL) {
       prev->set_next(data);
     } else {
@@ -686,6 +699,7 @@
     next = purge_me->next();
     delete purge_me;
   }
+  Metaspace::purge();
 }
 
 // CDS support
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed May 08 10:10:05 2013 +0100
@@ -62,7 +62,7 @@
   // CMS support.
   static ClassLoaderData* _saved_head;
 
-  static ClassLoaderData* add(ClassLoaderData** loader_data_addr, Handle class_loader, TRAPS);
+  static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
  public:
   static ClassLoaderData* find_or_create(Handle class_loader, TRAPS);
   static void purge();
@@ -100,6 +100,9 @@
                     Thread* THREAD);
    public:
     Dependencies() : _list_head(NULL) {}
+    Dependencies(TRAPS) : _list_head(NULL) {
+      init(CHECK);
+    }
     void add(Handle dependency, TRAPS);
     void init(TRAPS);
     void oops_do(OopClosure* f);
@@ -150,7 +153,7 @@
   void set_next(ClassLoaderData* next) { _next = next; }
   ClassLoaderData* next() const        { return _next; }
 
-  ClassLoaderData(Handle h_class_loader, bool is_anonymous);
+  ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies);
   ~ClassLoaderData();
 
   void set_metaspace(Metaspace* m) { _metaspace = m; }
@@ -190,7 +193,9 @@
   static void init_null_class_loader_data() {
     assert(_the_null_class_loader_data == NULL, "cannot initialize twice");
     assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice");
-    _the_null_class_loader_data = new ClassLoaderData((oop)NULL, false);
+
+    // We explicitly initialize the Dependencies object at a later phase in the initialization
+    _the_null_class_loader_data = new ClassLoaderData((oop)NULL, false, Dependencies());
     ClassLoaderDataGraph::_head = _the_null_class_loader_data;
     assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be");
     if (DumpSharedSpaces) {
--- a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp	Wed May 08 10:10:05 2013 +0100
@@ -43,10 +43,9 @@
   assert(loader() != NULL,"Must be a class loader");
   // Gets the class loader data out of the java/lang/ClassLoader object, if non-null
   // it's already in the loader_data, so no need to add
-  ClassLoaderData** loader_data_addr = java_lang_ClassLoader::loader_data_addr(loader());
-  ClassLoaderData* loader_data_id = *loader_data_addr;
-  if (loader_data_id) {
-     return loader_data_id;
+  ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data(loader());
+  if (loader_data) {
+     return loader_data;
   }
-  return ClassLoaderDataGraph::add(loader_data_addr, loader, THREAD);
+  return ClassLoaderDataGraph::add(loader, false, THREAD);
 }
--- a/hotspot/src/share/vm/classfile/dictionary.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp	Wed May 08 10:10:05 2013 +0100
@@ -27,7 +27,6 @@
 #include "classfile/systemDictionary.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiRedefineClassesTrace.hpp"
-#include "services/classLoadingService.hpp"
 #include "utilities/hashtable.inline.hpp"
 
 
@@ -156,19 +155,7 @@
           if (k_def_class_loader_data == loader_data) {
             // This is the defining entry, so the referred class is about
             // to be unloaded.
-            // Notify the debugger and clean up the class.
             class_was_unloaded = true;
-            // notify the debugger
-            if (JvmtiExport::should_post_class_unload()) {
-              JvmtiExport::post_class_unload(ik);
-            }
-
-            // notify ClassLoadingService of class unload
-            ClassLoadingService::notify_class_unloaded(ik);
-
-            // Clean up C heap
-            ik->release_C_heap_structures();
-            ik->constants()->release_C_heap_structures();
           }
           // Also remove this system dictionary entry.
           purge_entry = true;
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed May 08 10:10:05 2013 +0100
@@ -315,14 +315,18 @@
   return string;
 }
 
-jchar* java_lang_String::as_unicode_string(oop java_string, int& length) {
+jchar* java_lang_String::as_unicode_string(oop java_string, int& length, TRAPS) {
   typeArrayOop value  = java_lang_String::value(java_string);
   int          offset = java_lang_String::offset(java_string);
                length = java_lang_String::length(java_string);
 
-  jchar* result = NEW_RESOURCE_ARRAY(jchar, length);
-  for (int index = 0; index < length; index++) {
-    result[index] = value->char_at(index + offset);
+  jchar* result = NEW_RESOURCE_ARRAY_RETURN_NULL(jchar, length);
+  if (result != NULL) {
+    for (int index = 0; index < length; index++) {
+      result[index] = value->char_at(index + offset);
+    }
+  } else {
+    THROW_MSG_0(vmSymbols::java_lang_OutOfMemoryError(), "could not allocate Unicode string");
   }
   return result;
 }
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed May 08 10:10:05 2013 +0100
@@ -153,7 +153,7 @@
   static char*  as_utf8_string(oop java_string, char* buf, int buflen);
   static char*  as_utf8_string(oop java_string, int start, int len);
   static char*  as_platform_dependent_str(Handle java_string, TRAPS);
-  static jchar* as_unicode_string(oop java_string, int& length);
+  static jchar* as_unicode_string(oop java_string, int& length, TRAPS);
   // produce an ascii string with all other values quoted using \u####
   static char*  as_quoted_ascii(oop java_string);
 
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed May 08 10:10:05 2013 +0100
@@ -735,7 +735,7 @@
   ResourceMark rm(THREAD);
   int length;
   Handle h_string (THREAD, string);
-  jchar* chars = java_lang_String::as_unicode_string(string, length);
+  jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL);
   oop result = intern(h_string, chars, length, CHECK_NULL);
   return result;
 }
--- a/hotspot/src/share/vm/code/codeCache.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Wed May 08 10:10:05 2013 +0100
@@ -463,8 +463,10 @@
 }
 #endif //PRODUCT
 
-
-nmethod* CodeCache::find_and_remove_saved_code(Method* m) {
+/**
+ * Remove and return nmethod from the saved code list in order to reanimate it.
+ */
+nmethod* CodeCache::reanimate_saved_code(Method* m) {
   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   nmethod* saved = _saved_nmethods;
   nmethod* prev = NULL;
@@ -479,7 +481,7 @@
       saved->set_speculatively_disconnected(false);
       saved->set_saved_nmethod_link(NULL);
       if (PrintMethodFlushing) {
-        saved->print_on(tty, " ### nmethod is reconnected\n");
+        saved->print_on(tty, " ### nmethod is reconnected");
       }
       if (LogCompilation && (xtty != NULL)) {
         ttyLocker ttyl;
@@ -496,6 +498,9 @@
   return NULL;
 }
 
+/**
+ * Remove nmethod from the saved code list in order to discard it permanently
+ */
 void CodeCache::remove_saved_code(nmethod* nm) {
   // For conc swpr this will be called with CodeCache_lock taken by caller
   assert_locked_or_safepoint(CodeCache_lock);
@@ -529,7 +534,7 @@
   nm->set_saved_nmethod_link(_saved_nmethods);
   _saved_nmethods = nm;
   if (PrintMethodFlushing) {
-    nm->print_on(tty, " ### nmethod is speculatively disconnected\n");
+    nm->print_on(tty, " ### nmethod is speculatively disconnected");
   }
   if (LogCompilation && (xtty != NULL)) {
     ttyLocker ttyl;
--- a/hotspot/src/share/vm/code/codeCache.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/code/codeCache.hpp	Wed May 08 10:10:05 2013 +0100
@@ -57,7 +57,7 @@
   static int _number_of_nmethods_with_dependencies;
   static bool _needs_cache_clean;
   static nmethod* _scavenge_root_nmethods;  // linked via nm->scavenge_root_link()
-  static nmethod* _saved_nmethods;          // linked via nm->saved_nmethod_look()
+  static nmethod* _saved_nmethods;          // Linked list of speculatively disconnected nmethods.
 
   static void verify_if_often() PRODUCT_RETURN;
 
@@ -168,7 +168,7 @@
   static void set_needs_cache_clean(bool v)      { _needs_cache_clean = v;    }
   static void clear_inline_caches();             // clear all inline caches
 
-  static nmethod* find_and_remove_saved_code(Method* m);
+  static nmethod* reanimate_saved_code(Method* m);
   static void remove_saved_code(nmethod* nm);
   static void speculatively_disconnect(nmethod* nm);
 
--- a/hotspot/src/share/vm/code/compiledIC.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/code/compiledIC.cpp	Wed May 08 10:10:05 2013 +0100
@@ -45,25 +45,6 @@
 // Every time a compiled IC is changed or its type is being accessed,
 // either the CompiledIC_lock must be set or we must be at a safe point.
 
-
-// Release the CompiledICHolder* associated with this call site is there is one.
-void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) {
-  // This call site might have become stale so inspect it carefully.
-  NativeCall* call = nativeCall_at(call_site->addr());
-  if (is_icholder_entry(call->destination())) {
-    NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value());
-    InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data());
-  }
-}
-
-
-bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) {
-  // This call site might have become stale so inspect it carefully.
-  NativeCall* call = nativeCall_at(call_site->addr());
-  return is_icholder_entry(call->destination());
-}
-
-
 //-----------------------------------------------------------------------------
 // Low-level access to an inline cache. Private, since they might not be
 // MT-safe to use.
@@ -488,33 +469,6 @@
   return (cb != NULL && cb->is_adapter_blob());
 }
 
-
-CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
-  : _ic_call(call)
-{
-  address ic_call = call->instruction_address();
-
-  assert(ic_call != NULL, "ic_call address must be set");
-  assert(nm != NULL, "must pass nmethod");
-  assert(nm->contains(ic_call),   "must be in nmethod");
-
-  // search for the ic_call at the given address
-  RelocIterator iter(nm, ic_call, ic_call+1);
-  bool ret = iter.next();
-  assert(ret == true, "relocInfo must exist at this address");
-  assert(iter.addr() == ic_call, "must find ic_call");
-  if (iter.type() == relocInfo::virtual_call_type) {
-    virtual_call_Relocation* r = iter.virtual_call_reloc();
-    _is_optimized = false;
-    _value = nativeMovConstReg_at(r->cached_value());
-  } else {
-    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
-    _is_optimized = true;
-    _value = NULL;
-}
-}
-
-
 // ----------------------------------------------------------------------------
 
 void CompiledStaticCall::set_to_clean() {
@@ -549,33 +503,6 @@
   return nm->stub_contains(destination());
 }
 
-
-void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
-  address stub=find_stub();
-  guarantee(stub != NULL, "stub not found");
-
-  if (TraceICs) {
-    ResourceMark rm;
-    tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
-                  instruction_address(),
-                  callee->name_and_sig_as_C_string());
-  }
-
-  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);   // creation also verifies the object
-  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
-
-  assert(method_holder->data()    == 0           || method_holder->data()    == (intptr_t)callee(), "a) MT-unsafe modification of inline cache");
-  assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry, "b) MT-unsafe modification of inline cache");
-
-  // Update stub
-  method_holder->set_data((intptr_t)callee());
-  jump->set_jump_destination(entry);
-
-  // Update jump to call
-  set_destination_mt_safe(stub);
-}
-
-
 void CompiledStaticCall::set(const StaticCallInfo& info) {
   assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
   MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
@@ -618,19 +545,6 @@
   }
 }
 
-
-void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
-  assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
-  // Reset stub
-  address stub = static_stub->addr();
-  assert(stub!=NULL, "stub not found");
-  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);   // creation also verifies the object
-  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
-  method_holder->set_data(0);
-  jump->set_jump_destination((address)-1);
-}
-
-
 address CompiledStaticCall::find_stub() {
   // Find reloc. information containing this call-site
   RelocIterator iter((nmethod*)NULL, instruction_address());
@@ -668,19 +582,16 @@
           || is_optimized() || is_megamorphic(), "sanity check");
 }
 
-
 void CompiledIC::print() {
   print_compiled_ic();
   tty->cr();
 }
 
-
 void CompiledIC::print_compiled_ic() {
   tty->print("Inline cache at " INTPTR_FORMAT ", calling %s " INTPTR_FORMAT " cached_value " INTPTR_FORMAT,
              instruction_address(), is_call_to_interpreted() ? "interpreted " : "", ic_destination(), is_optimized() ? NULL : cached_value());
 }
 
-
 void CompiledStaticCall::print() {
   tty->print("static call at " INTPTR_FORMAT " -> ", instruction_address());
   if (is_clean()) {
@@ -693,21 +604,4 @@
   tty->cr();
 }
 
-void CompiledStaticCall::verify() {
-  // Verify call
-  NativeCall::verify();
-  if (os::is_MP()) {
-    verify_alignment();
-  }
-
-  // Verify stub
-  address stub = find_stub();
-  assert(stub != NULL, "no stub found for static call");
-  NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);   // creation also verifies the object
-  NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
-
-  // Verify state
-  assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check");
-}
-
-#endif
+#endif // !PRODUCT
--- a/hotspot/src/share/vm/code/compiledIC.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/code/compiledIC.hpp	Wed May 08 10:10:05 2013 +0100
@@ -304,6 +304,11 @@
   friend CompiledStaticCall* compiledStaticCall_at(address native_call);
   friend CompiledStaticCall* compiledStaticCall_at(Relocation* call_site);
 
+  // Code
+  static void emit_to_interp_stub(CodeBuffer &cbuf);
+  static int to_interp_stub_size();
+  static int reloc_to_interp_stub();
+
   // State
   bool is_clean() const;
   bool is_call_to_compiled() const;
--- a/hotspot/src/share/vm/code/stubs.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/code/stubs.cpp	Wed May 08 10:10:05 2013 +0100
@@ -67,7 +67,7 @@
   intptr_t size = round_to(buffer_size, 2*BytesPerWord);
   BufferBlob* blob = BufferBlob::create(name, size);
   if( blob == NULL) {
-    vm_exit_out_of_memory(size, err_msg("CodeCache: no room for %s", name));
+    vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, err_msg("CodeCache: no room for %s", name));
   }
   _stub_interface  = stub_interface;
   _buffer_size     = blob->content_size();
--- a/hotspot/src/share/vm/code/vtableStubs.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/code/vtableStubs.cpp	Wed May 08 10:10:05 2013 +0100
@@ -60,7 +60,7 @@
     const int bytes = chunk_factor * real_size + pd_code_alignment();
     BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
     if (blob == NULL) {
-      vm_exit_out_of_memory(bytes, "CodeCache: no room for vtable chunks");
+      vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "CodeCache: no room for vtable chunks");
     }
     _chunk = blob->content_begin();
     _chunk_end = _chunk + bytes;
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Wed May 08 10:10:05 2013 +0100
@@ -65,7 +65,7 @@
 HS_DTRACE_PROBE_DECL9(hotspot, method__compile__end,
   char*, intptr_t, char*, intptr_t, char*, intptr_t, char*, intptr_t, bool);
 
-#define DTRACE_METHOD_COMPILE_BEGIN_PROBE(compiler, method, comp_name)   \
+#define DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, comp_name)             \
   {                                                                      \
     Symbol* klass_name = (method)->klass_name();                         \
     Symbol* name = (method)->name();                                     \
@@ -77,8 +77,7 @@
       signature->bytes(), signature->utf8_length());                     \
   }
 
-#define DTRACE_METHOD_COMPILE_END_PROBE(compiler, method,                \
-                                        comp_name, success)              \
+#define DTRACE_METHOD_COMPILE_END_PROBE(method, comp_name, success)      \
   {                                                                      \
     Symbol* klass_name = (method)->klass_name();                         \
     Symbol* name = (method)->name();                                     \
@@ -92,7 +91,7 @@
 
 #else /* USDT2 */
 
-#define DTRACE_METHOD_COMPILE_BEGIN_PROBE(compiler, method, comp_name)   \
+#define DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, comp_name)             \
   {                                                                      \
     Symbol* klass_name = (method)->klass_name();                         \
     Symbol* name = (method)->name();                                     \
@@ -104,8 +103,7 @@
       (char *) signature->bytes(), signature->utf8_length());            \
   }
 
-#define DTRACE_METHOD_COMPILE_END_PROBE(compiler, method,                \
-                                        comp_name, success)              \
+#define DTRACE_METHOD_COMPILE_END_PROBE(method, comp_name, success)      \
   {                                                                      \
     Symbol* klass_name = (method)->klass_name();                         \
     Symbol* name = (method)->name();                                     \
@@ -120,8 +118,8 @@
 
 #else //  ndef DTRACE_ENABLED
 
-#define DTRACE_METHOD_COMPILE_BEGIN_PROBE(compiler, method, comp_name)
-#define DTRACE_METHOD_COMPILE_END_PROBE(compiler, method, comp_name, success)
+#define DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, comp_name)
+#define DTRACE_METHOD_COMPILE_END_PROBE(method, comp_name, success)
 
 #endif // ndef DTRACE_ENABLED
 
@@ -1229,7 +1227,7 @@
     if (method->is_not_compilable(comp_level)) return NULL;
 
     if (UseCodeCacheFlushing) {
-      nmethod* saved = CodeCache::find_and_remove_saved_code(method());
+      nmethod* saved = CodeCache::reanimate_saved_code(method());
       if (saved != NULL) {
         method->set_code(method, saved);
         return saved;
@@ -1288,9 +1286,9 @@
     method->jmethod_id();
   }
 
-  // If the compiler is shut off due to code cache flushing or otherwise,
+  // If the compiler is shut off due to code cache getting full
   // fail out now so blocking compiles dont hang the java thread
-  if (!should_compile_new_jobs() || (UseCodeCacheFlushing && CodeCache::needs_flushing())) {
+  if (!should_compile_new_jobs()) {
     CompilationPolicy::policy()->delay_compilation(method());
     return NULL;
   }
@@ -1766,8 +1764,7 @@
     // Save information about this method in case of failure.
     set_last_compile(thread, method, is_osr, task_level);
 
-    DTRACE_METHOD_COMPILE_BEGIN_PROBE(compiler(task_level), method,
-                                      compiler_name(task_level));
+    DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, compiler_name(task_level));
   }
 
   // Allocate a new set of JNI handles.
@@ -1842,13 +1839,14 @@
         }
       }
     }
+    // simulate crash during compilation
+    assert(task->compile_id() != CICrashAt, "just as planned");
   }
   pop_jni_handle_block();
 
   methodHandle method(thread, task->method());
 
-  DTRACE_METHOD_COMPILE_END_PROBE(compiler(task_level), method,
-                                  compiler_name(task_level), task->is_success());
+  DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success());
 
   collect_statistics(thread, time, task);
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed May 08 10:10:05 2013 +0100
@@ -2444,8 +2444,7 @@
         // initial marking in checkpointRootsInitialWork has been completed
         if (VerifyDuringGC &&
             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-          gclog_or_tty->print("Verify before initial mark: ");
-          Universe::verify();
+          Universe::verify("Verify before initial mark: ");
         }
         {
           bool res = markFromRoots(false);
@@ -2456,8 +2455,7 @@
       case FinalMarking:
         if (VerifyDuringGC &&
             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-          gclog_or_tty->print("Verify before re-mark: ");
-          Universe::verify();
+          Universe::verify("Verify before re-mark: ");
         }
         checkpointRootsFinal(false, clear_all_soft_refs,
                              init_mark_was_synchronous);
@@ -2468,8 +2466,7 @@
         // final marking in checkpointRootsFinal has been completed
         if (VerifyDuringGC &&
             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-          gclog_or_tty->print("Verify before sweep: ");
-          Universe::verify();
+          Universe::verify("Verify before sweep: ");
         }
         sweep(false);
         assert(_collectorState == Resizing, "Incorrect state");
@@ -2484,8 +2481,7 @@
         // The heap has been resized.
         if (VerifyDuringGC &&
             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-          gclog_or_tty->print("Verify before reset: ");
-          Universe::verify();
+          Universe::verify("Verify before reset: ");
         }
         reset(false);
         assert(_collectorState == Idling, "Collector state should "
@@ -2853,8 +2849,8 @@
   bool failed() { return _failed; }
 };
 
-bool CMSCollector::verify_after_remark() {
-  gclog_or_tty->print(" [Verifying CMS Marking... ");
+bool CMSCollector::verify_after_remark(bool silent) {
+  if (!silent) gclog_or_tty->print(" [Verifying CMS Marking... ");
   MutexLockerEx ml(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
   static bool init = false;
 
@@ -2915,7 +2911,7 @@
     warning("Unrecognized value %d for CMSRemarkVerifyVariant",
             CMSRemarkVerifyVariant);
   }
-  gclog_or_tty->print(" done] ");
+  if (!silent) gclog_or_tty->print(" done] ");
   return true;
 }
 
@@ -3426,8 +3422,9 @@
 void ConcurrentMarkSweepGeneration::shrink_free_list_by(size_t bytes) {
   assert_locked_or_safepoint(Heap_lock);
   assert_lock_strong(freelistLock());
-  // XXX Fix when compaction is implemented.
-  warning("Shrinking of CMS not yet implemented");
+  if (PrintGCDetails && Verbose) {
+    warning("Shrinking of CMS not yet implemented");
+  }
   return;
 }
 
@@ -6010,26 +6007,23 @@
                                         &cmsDrainMarkingStackClosure,
                                         NULL);
     }
-    verify_work_stacks_empty();
-  }
+  }
+
+  // This is the point where the entire marking should have completed.
+  verify_work_stacks_empty();
 
   if (should_unload_classes()) {
     {
       TraceTime t("class unloading", PrintGCDetails, false, gclog_or_tty);
 
-      // Follow SystemDictionary roots and unload classes
+      // Unload classes and purge the SystemDictionary.
       bool purged_class = SystemDictionary::do_unloading(&_is_alive_closure);
 
-      // Follow CodeCache roots and unload any methods marked for unloading
+      // Unload nmethods.
       CodeCache::do_unloading(&_is_alive_closure, purged_class);
 
-      cmsDrainMarkingStackClosure.do_void();
-      verify_work_stacks_empty();
-
-      // Update subklass/sibling/implementor links in KlassKlass descendants
+      // Prune dead klasses from subklass/sibling/implementor lists.
       Klass::clean_weak_klass_links(&_is_alive_closure);
-      // Nothing should have been pushed onto the working stacks.
-      verify_work_stacks_empty();
     }
 
     {
@@ -6043,11 +6037,10 @@
   // Need to check if we really scanned the StringTable.
   if ((roots_scanning_options() & SharedHeap::SO_Strings) == 0) {
     TraceTime t("scrub string table", PrintGCDetails, false, gclog_or_tty);
-    // Now clean up stale oops in StringTable
+    // Delete entries for dead interned strings.
     StringTable::unlink(&_is_alive_closure);
   }
 
-  verify_work_stacks_empty();
   // Restore any preserved marks as a result of mark stack or
   // work queue overflow
   restore_preserved_marks_if_any();  // done single-threaded for now
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Wed May 08 10:10:05 2013 +0100
@@ -990,7 +990,7 @@
 
   // debugging
   void verify();
-  bool verify_after_remark();
+  bool verify_after_remark(bool silent = VerifySilently);
   void verify_ok_to_terminate() const PRODUCT_RETURN;
   void verify_work_stacks_empty() const PRODUCT_RETURN;
   void verify_overflow_empty() const PRODUCT_RETURN;
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1273,10 +1273,9 @@
 
   if (VerifyDuringGC) {
     HandleMark hm;  // handle scope
-    gclog_or_tty->print(" VerifyDuringGC:(before)");
     Universe::heap()->prepare_for_verify();
-    Universe::verify(/* silent */ false,
-                     /* option */ VerifyOption_G1UsePrevMarking);
+    Universe::verify(VerifyOption_G1UsePrevMarking,
+                     " VerifyDuringGC:(before)");
   }
 
   G1CollectorPolicy* g1p = g1h->g1_policy();
@@ -1300,10 +1299,9 @@
     // Verify the heap w.r.t. the previous marking bitmap.
     if (VerifyDuringGC) {
       HandleMark hm;  // handle scope
-      gclog_or_tty->print(" VerifyDuringGC:(overflow)");
       Universe::heap()->prepare_for_verify();
-      Universe::verify(/* silent */ false,
-                       /* option */ VerifyOption_G1UsePrevMarking);
+      Universe::verify(VerifyOption_G1UsePrevMarking,
+                       " VerifyDuringGC:(overflow)");
     }
 
     // Clear the marking state because we will be restarting
@@ -1323,10 +1321,9 @@
 
     if (VerifyDuringGC) {
       HandleMark hm;  // handle scope
-      gclog_or_tty->print(" VerifyDuringGC:(after)");
       Universe::heap()->prepare_for_verify();
-      Universe::verify(/* silent */ false,
-                       /* option */ VerifyOption_G1UseNextMarking);
+      Universe::verify(VerifyOption_G1UseNextMarking,
+                       " VerifyDuringGC:(after)");
     }
     assert(!restart_for_overflow(), "sanity");
     // Completely reset the marking state since marking completed
@@ -1972,10 +1969,9 @@
 
   if (VerifyDuringGC) {
     HandleMark hm;  // handle scope
-    gclog_or_tty->print(" VerifyDuringGC:(before)");
     Universe::heap()->prepare_for_verify();
-    Universe::verify(/* silent */ false,
-                     /* option */ VerifyOption_G1UsePrevMarking);
+    Universe::verify(VerifyOption_G1UsePrevMarking,
+                     " VerifyDuringGC:(before)");
   }
 
   G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
@@ -2127,10 +2123,9 @@
 
   if (VerifyDuringGC) {
     HandleMark hm;  // handle scope
-    gclog_or_tty->print(" VerifyDuringGC:(after)");
     Universe::heap()->prepare_for_verify();
-    Universe::verify(/* silent */ false,
-                     /* option */ VerifyOption_G1UsePrevMarking);
+    Universe::verify(VerifyOption_G1UsePrevMarking,
+                     " VerifyDuringGC:(after)");
   }
 
   g1h->verify_region_sets_optional();
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Wed May 08 10:10:05 2013 +0100
@@ -77,7 +77,7 @@
     assert(delta > 0, "just checking");
     if (!_vs.expand_by(delta)) {
       // Do better than this for Merlin
-      vm_exit_out_of_memory(delta, "offset table expansion");
+      vm_exit_out_of_memory(delta, OOM_MMAP_ERROR, "offset table expansion");
     }
     assert(_vs.high() == high + delta, "invalid expansion");
     // Initialization of the contents is left to the
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1271,9 +1271,8 @@
   if (guard && total_collections() >= VerifyGCStartAt) {
     double verify_start = os::elapsedTime();
     HandleMark hm;  // Discard invalid handles created during verification
-    gclog_or_tty->print(msg);
     prepare_for_verify();
-    Universe::verify(false /* silent */, VerifyOption_G1UsePrevMarking);
+    Universe::verify(VerifyOption_G1UsePrevMarking, msg);
     verify_time_ms = (os::elapsedTime() - verify_start) * 1000;
   }
 
@@ -1304,7 +1303,7 @@
 
   print_heap_before_gc();
 
-  size_t metadata_prev_used = MetaspaceAux::used_in_bytes();
+  size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes();
 
   HRSPhaseSetter x(HRSPhaseFullGC);
   verify_region_sets_optional();
@@ -1425,6 +1424,7 @@
 
       // Delete metaspaces for unloaded class loaders and clean up loader_data graph
       ClassLoaderDataGraph::purge();
+    MetaspaceAux::verify_metrics();
 
       // Note: since we've just done a full GC, concurrent
       // marking is no longer active. Therefore we need not
@@ -1831,7 +1831,7 @@
     if (G1ExitOnExpansionFailure &&
         _g1_storage.uncommitted_size() >= aligned_expand_bytes) {
       // We had head room...
-      vm_exit_out_of_memory(aligned_expand_bytes, "G1 heap expansion");
+      vm_exit_out_of_memory(aligned_expand_bytes, OOM_MMAP_ERROR, "G1 heap expansion");
     }
   }
   return successful;
@@ -1955,13 +1955,6 @@
   int n_rem_sets = HeapRegionRemSet::num_par_rem_sets();
   assert(n_rem_sets > 0, "Invariant.");
 
-  HeapRegionRemSetIterator** iter_arr =
-    NEW_C_HEAP_ARRAY(HeapRegionRemSetIterator*, n_queues, mtGC);
-  for (int i = 0; i < n_queues; i++) {
-    iter_arr[i] = new HeapRegionRemSetIterator();
-  }
-  _rem_set_iterator = iter_arr;
-
   _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC);
   _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(unsigned int, n_queues, mtGC);
 
@@ -3614,7 +3607,7 @@
   uint array_length = g1_policy()->young_cset_region_length();
   _surviving_young_words = NEW_C_HEAP_ARRAY(size_t, (size_t) array_length, mtGC);
   if (_surviving_young_words == NULL) {
-    vm_exit_out_of_memory(sizeof(size_t) * array_length,
+    vm_exit_out_of_memory(sizeof(size_t) * array_length, OOM_MALLOC_ERROR,
                           "Not enough space for young surv words summary.");
   }
   memset(_surviving_young_words, 0, (size_t) array_length * sizeof(size_t));
@@ -4397,7 +4390,7 @@
                       PADDING_ELEM_NUM;
   _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC);
   if (_surviving_young_words_base == NULL)
-    vm_exit_out_of_memory(array_length * sizeof(size_t),
+    vm_exit_out_of_memory(array_length * sizeof(size_t), OOM_MALLOC_ERROR,
                           "Not enough space for young surv histo.");
   _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM;
   memset(_surviving_young_words, 0, (size_t) real_length * sizeof(size_t));
@@ -5079,10 +5072,9 @@
 }
 
 void
-G1CollectedHeap::g1_process_weak_roots(OopClosure* root_closure,
-                                       OopClosure* non_root_closure) {
+G1CollectedHeap::g1_process_weak_roots(OopClosure* root_closure) {
   CodeBlobToOopClosure roots_in_blobs(root_closure, /*do_marking=*/ false);
-  SharedHeap::process_weak_roots(root_closure, &roots_in_blobs, non_root_closure);
+  SharedHeap::process_weak_roots(root_closure, &roots_in_blobs);
 }
 
 // Weak Reference Processing support
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed May 08 10:10:05 2013 +0100
@@ -786,9 +786,6 @@
   // concurrently after the collection.
   DirtyCardQueueSet _dirty_card_queue_set;
 
-  // The Heap Region Rem Set Iterator.
-  HeapRegionRemSetIterator** _rem_set_iterator;
-
   // The closure used to refine a single card.
   RefineCardTableEntryClosure* _refine_cte_cl;
 
@@ -827,8 +824,7 @@
   // Apply "blk" to all the weak roots of the system.  These include
   // JNI weak roots, the code cache, system dictionary, symbol table,
   // string table, and referents of reachable weak refs.
-  void g1_process_weak_roots(OopClosure* root_closure,
-                             OopClosure* non_root_closure);
+  void g1_process_weak_roots(OopClosure* root_closure);
 
   // Frees a non-humongous region by initializing its contents and
   // adding it to the free list that's passed as a parameter (this is
@@ -1114,15 +1110,6 @@
   G1RemSet* g1_rem_set() const { return _g1_rem_set; }
   ModRefBarrierSet* mr_bs() const { return _mr_bs; }
 
-  // The rem set iterator.
-  HeapRegionRemSetIterator* rem_set_iterator(int i) {
-    return _rem_set_iterator[i];
-  }
-
-  HeapRegionRemSetIterator* rem_set_iterator() {
-    return _rem_set_iterator[0];
-  }
-
   unsigned get_gc_time_stamp() {
     return _gc_time_stamp;
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Wed May 08 10:10:05 2013 +0100
@@ -144,33 +144,28 @@
                                     &GenMarkSweep::follow_stack_closure,
                                     NULL);
 
-  // Follow system dictionary roots and unload classes
+
+  // This is the point where the entire marking should have completed.
+  assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed");
+
+  // Unload classes and purge the SystemDictionary.
   bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive);
-  assert(GenMarkSweep::_marking_stack.is_empty(),
-         "stack should be empty by now");
 
-  // Follow code cache roots (has to be done after system dictionary,
-  // assumes all live klasses are marked)
+  // Unload nmethods.
   CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class);
-  GenMarkSweep::follow_stack();
 
-  // Update subklass/sibling/implementor links of live klasses
+  // Prune dead klasses from subklass/sibling/implementor lists.
   Klass::clean_weak_klass_links(&GenMarkSweep::is_alive);
-  assert(GenMarkSweep::_marking_stack.is_empty(),
-         "stack should be empty by now");
 
-  // Visit interned string tables and delete unmarked oops
+  // Delete entries for dead interned strings.
   StringTable::unlink(&GenMarkSweep::is_alive);
+
   // Clean up unreferenced symbols in symbol table.
   SymbolTable::unlink();
 
-  assert(GenMarkSweep::_marking_stack.is_empty(),
-         "stack should be empty by now");
-
   if (VerifyDuringGC) {
     HandleMark hm;  // handle scope
     COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
-    gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying ");
     Universe::heap()->prepare_for_verify();
     // Note: we can verify only the heap here. When an object is
     // marked, the previous value of the mark word (including
@@ -182,11 +177,13 @@
     // fail. At the end of the GC, the orginal mark word values
     // (including hash values) are restored to the appropriate
     // objects.
-    Universe::heap()->verify(/* silent      */ false,
-                             /* option      */ VerifyOption_G1UseMarkWord);
-
-    G1CollectedHeap* g1h = G1CollectedHeap::heap();
-    gclog_or_tty->print_cr("]");
+    if (!VerifySilently) {
+      gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying ");
+    }
+    Universe::heap()->verify(VerifySilently, VerifyOption_G1UseMarkWord);
+    if (!VerifySilently) {
+      gclog_or_tty->print_cr("]");
+    }
   }
 }
 
@@ -308,17 +305,16 @@
   sh->process_strong_roots(true,  // activate StrongRootsScope
                            false, // not scavenging.
                            SharedHeap::SO_AllClasses,
-                           &GenMarkSweep::adjust_root_pointer_closure,
+                           &GenMarkSweep::adjust_pointer_closure,
                            NULL,  // do not touch code cache here
                            &GenMarkSweep::adjust_klass_closure);
 
   assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity");
-  g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_root_pointer_closure);
+  g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
 
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
-  g1h->g1_process_weak_roots(&GenMarkSweep::adjust_root_pointer_closure,
-                             &GenMarkSweep::adjust_pointer_closure);
+  g1h->g1_process_weak_roots(&GenMarkSweep::adjust_pointer_closure);
 
   GenMarkSweep::adjust_marks();
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Wed May 08 10:10:05 2013 +0100
@@ -169,14 +169,13 @@
     //   _try_claimed || r->claim_iter()
     // is true: either we're supposed to work on claimed-but-not-complete
     // regions, or we successfully claimed the region.
-    HeapRegionRemSetIterator* iter = _g1h->rem_set_iterator(_worker_i);
-    hrrs->init_iterator(iter);
+    HeapRegionRemSetIterator iter(hrrs);
     size_t card_index;
 
     // We claim cards in block so as to recude the contention. The block size is determined by
     // the G1RSetScanBlockSize parameter.
     size_t jump_to_card = hrrs->iter_claimed_next(_block_size);
-    for (size_t current_card = 0; iter->has_next(card_index); current_card++) {
+    for (size_t current_card = 0; iter.has_next(card_index); current_card++) {
       if (current_card >= jump_to_card + _block_size) {
         jump_to_card = hrrs->iter_claimed_next(_block_size);
       }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Wed May 08 10:10:05 2013 +0100
@@ -53,14 +53,14 @@
     NumSeqTasks          = 1
   };
 
-  CardTableModRefBS*             _ct_bs;
-  SubTasksDone*                  _seq_task;
-  G1CollectorPolicy* _g1p;
+  CardTableModRefBS*     _ct_bs;
+  SubTasksDone*          _seq_task;
+  G1CollectorPolicy*     _g1p;
 
-  ConcurrentG1Refine* _cg1r;
+  ConcurrentG1Refine*    _cg1r;
 
-  size_t*             _cards_scanned;
-  size_t              _total_cards_scanned;
+  size_t*                _cards_scanned;
+  size_t                 _total_cards_scanned;
 
   // Used for caching the closure that is responsible for scanning
   // references into the collection set.
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Wed May 08 10:10:05 2013 +0100
@@ -285,7 +285,7 @@
   _fine_grain_regions = new PerRegionTablePtr[_max_fine_entries];
 
   if (_fine_grain_regions == NULL) {
-    vm_exit_out_of_memory(sizeof(void*)*_max_fine_entries,
+    vm_exit_out_of_memory(sizeof(void*)*_max_fine_entries, OOM_MALLOC_ERROR,
                           "Failed to allocate _fine_grain_entries.");
   }
 
@@ -877,14 +877,9 @@
   return _iter_state == Complete;
 }
 
-void HeapRegionRemSet::init_iterator(HeapRegionRemSetIterator* iter) const {
-  iter->initialize(this);
-}
-
 #ifndef PRODUCT
 void HeapRegionRemSet::print() const {
-  HeapRegionRemSetIterator iter;
-  init_iterator(&iter);
+  HeapRegionRemSetIterator iter(this);
   size_t card_index;
   while (iter.has_next(card_index)) {
     HeapWord* card_start =
@@ -928,35 +923,23 @@
 
 //-------------------- Iteration --------------------
 
-HeapRegionRemSetIterator::
-HeapRegionRemSetIterator() :
-  _hrrs(NULL),
+HeapRegionRemSetIterator:: HeapRegionRemSetIterator(const HeapRegionRemSet* hrrs) :
+  _hrrs(hrrs),
   _g1h(G1CollectedHeap::heap()),
-  _bosa(NULL),
-  _sparse_iter() { }
-
-void HeapRegionRemSetIterator::initialize(const HeapRegionRemSet* hrrs) {
-  _hrrs = hrrs;
-  _coarse_map = &_hrrs->_other_regions._coarse_map;
-  _fine_grain_regions = _hrrs->_other_regions._fine_grain_regions;
-  _bosa = _hrrs->bosa();
-
-  _is = Sparse;
+  _coarse_map(&hrrs->_other_regions._coarse_map),
+  _fine_grain_regions(hrrs->_other_regions._fine_grain_regions),
+  _bosa(hrrs->bosa()),
+  _is(Sparse),
   // Set these values so that we increment to the first region.
-  _coarse_cur_region_index = -1;
-  _coarse_cur_region_cur_card = (HeapRegion::CardsPerRegion-1);
-
-  _cur_region_cur_card = 0;
-
-  _fine_array_index = -1;
-  _fine_cur_prt = NULL;
-
-  _n_yielded_coarse = 0;
-  _n_yielded_fine = 0;
-  _n_yielded_sparse = 0;
-
-  _sparse_iter.init(&hrrs->_other_regions._sparse_table);
-}
+  _coarse_cur_region_index(-1),
+  _coarse_cur_region_cur_card(HeapRegion::CardsPerRegion-1),
+  _cur_region_cur_card(0),
+  _fine_array_index(-1),
+  _fine_cur_prt(NULL),
+  _n_yielded_coarse(0),
+  _n_yielded_fine(0),
+  _n_yielded_sparse(0),
+  _sparse_iter(&hrrs->_other_regions._sparse_table) {}
 
 bool HeapRegionRemSetIterator::coarse_has_next(size_t& card_index) {
   if (_hrrs->_other_regions._n_coarse_entries == 0) return false;
@@ -1209,8 +1192,7 @@
   hrrs->add_reference((OopOrNarrowOopStar)hr5->bottom());
 
   // Now, does iteration yield these three?
-  HeapRegionRemSetIterator iter;
-  hrrs->init_iterator(&iter);
+  HeapRegionRemSetIterator iter(hrrs);
   size_t sum = 0;
   size_t card_index;
   while (iter.has_next(card_index)) {
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Wed May 08 10:10:05 2013 +0100
@@ -281,9 +281,6 @@
     return (_iter_state == Unclaimed) && (_iter_claimed == 0);
   }
 
-  // Initialize the given iterator to iterate over this rem set.
-  void init_iterator(HeapRegionRemSetIterator* iter) const;
-
   // The actual # of bytes this hr_remset takes up.
   size_t mem_size() {
     return _other_regions.mem_size()
@@ -345,9 +342,9 @@
 #endif
 };
 
-class HeapRegionRemSetIterator : public CHeapObj<mtGC> {
+class HeapRegionRemSetIterator : public StackObj {
 
-  // The region over which we're iterating.
+  // The region RSet over which we're iterating.
   const HeapRegionRemSet* _hrrs;
 
   // Local caching of HRRS fields.
@@ -362,8 +359,10 @@
   size_t _n_yielded_coarse;
   size_t _n_yielded_sparse;
 
-  // If true we're iterating over the coarse table; if false the fine
-  // table.
+  // Indicates what granularity of table that we're currently iterating over.
+  // We start iterating over the sparse table, progress to the fine grain
+  // table, and then finish with the coarse table.
+  // See HeapRegionRemSetIterator::has_next().
   enum IterState {
     Sparse,
     Fine,
@@ -403,9 +402,7 @@
 public:
   // We require an iterator to be initialized before use, so the
   // constructor does little.
-  HeapRegionRemSetIterator();
-
-  void initialize(const HeapRegionRemSet* hrrs);
+  HeapRegionRemSetIterator(const HeapRegionRemSet* hrrs);
 
   // If there remains one or more cards to be yielded, returns true and
   // sets "card_index" to one of those cards (which is then considered
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Wed May 08 10:10:05 2013 +0100
@@ -35,10 +35,6 @@
 
 #define UNROLL_CARD_LOOPS  1
 
-void SparsePRT::init_iterator(SparsePRTIter* sprt_iter) {
-    sprt_iter->init(this);
-}
-
 void SparsePRTEntry::init(RegionIdx_t region_ind) {
   _region_ind = region_ind;
   _next_index = NullEntry;
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp	Wed May 08 10:10:05 2013 +0100
@@ -192,18 +192,11 @@
   size_t compute_card_ind(CardIdx_t ci);
 
 public:
-  RSHashTableIter() :
-    _tbl_ind(RSHashTable::NullEntry),
+  RSHashTableIter(RSHashTable* rsht) :
+    _tbl_ind(RSHashTable::NullEntry), // So that first increment gets to 0.
     _bl_ind(RSHashTable::NullEntry),
     _card_ind((SparsePRTEntry::cards_num() - 1)),
-    _rsht(NULL) {}
-
-  void init(RSHashTable* rsht) {
-    _rsht = rsht;
-    _tbl_ind = -1; // So that first increment gets to 0.
-    _bl_ind = RSHashTable::NullEntry;
-    _card_ind = (SparsePRTEntry::cards_num() - 1);
-  }
+    _rsht(rsht) {}
 
   bool has_next(size_t& card_index);
 };
@@ -284,8 +277,6 @@
   static void cleanup_all();
   RSHashTable* cur() const { return _cur; }
 
-  void init_iterator(SparsePRTIter* sprt_iter);
-
   static void add_to_expanded_list(SparsePRT* sprt);
   static SparsePRT* get_from_expanded_list();
 
@@ -321,9 +312,9 @@
 
 class SparsePRTIter: public RSHashTableIter {
 public:
-  void init(const SparsePRT* sprt) {
-    RSHashTableIter::init(sprt->cur());
-  }
+  SparsePRTIter(const SparsePRT* sprt) :
+    RSHashTableIter(sprt->cur()) {}
+
   bool has_next(size_t& card_index) {
     return RSHashTableIter::has_next(card_index);
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Wed May 08 10:10:05 2013 +0100
@@ -567,7 +567,7 @@
         MemRegion(new_start_aligned, new_end_for_commit);
       if (!os::commit_memory((char*)new_committed.start(),
                              new_committed.byte_size())) {
-        vm_exit_out_of_memory(new_committed.byte_size(),
+        vm_exit_out_of_memory(new_committed.byte_size(), OOM_MMAP_ERROR,
                               "card table expansion");
       }
     }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Wed May 08 10:10:05 2013 +0100
@@ -43,7 +43,7 @@
   _time_stamp_index(0)
 {
   if (!os::create_thread(this, os::pgc_thread))
-    vm_exit_out_of_memory(0, "Cannot create GC thread. Out of system resources.");
+    vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GC thread. Out of system resources.");
 
   if (PrintGCTaskTimeStamps) {
     _time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp	Wed May 08 10:10:05 2013 +0100
@@ -99,7 +99,7 @@
     // Expand
     size_t expand_by = requested_blocks_size_in_bytes - current_blocks_size_in_bytes;
     if (!_virtual_space.expand_by(expand_by)) {
-      vm_exit_out_of_memory(expand_by, "object start array expansion");
+      vm_exit_out_of_memory(expand_by, OOM_MMAP_ERROR, "object start array expansion");
     }
     // Clear *only* the newly allocated region
     memset(_blocks_region.end(), clean_block, expand_by);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Wed May 08 10:10:05 2013 +0100
@@ -138,8 +138,7 @@
 
   if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
-    gclog_or_tty->print(" VerifyBeforeGC:");
-    Universe::verify();
+    Universe::verify(" VerifyBeforeGC:");
   }
 
   // Verify object start arrays
@@ -177,7 +176,7 @@
     size_t prev_used = heap->used();
 
     // Capture metadata size before collection for sizing.
-    size_t metadata_prev_used = MetaspaceAux::used_in_bytes();
+    size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes();
 
     // For PrintGCDetails
     size_t old_gen_prev_used = old_gen->used_in_bytes();
@@ -238,6 +237,7 @@
 
     // Delete metaspaces for unloaded class loaders and clean up loader_data graph
     ClassLoaderDataGraph::purge();
+    MetaspaceAux::verify_metrics();
 
     BiasedLocking::restore_marks();
     Threads::gc_epilogue();
@@ -340,8 +340,7 @@
 
   if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
-    gclog_or_tty->print(" VerifyAfterGC:");
-    Universe::verify();
+    Universe::verify(" VerifyAfterGC:");
   }
 
   // Re-verify object start arrays
@@ -518,23 +517,23 @@
       is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL);
   }
 
-  // Follow system dictionary roots and unload classes
+  // This is the point where the entire marking should have completed.
+  assert(_marking_stack.is_empty(), "Marking should have completed");
+
+  // Unload classes and purge the SystemDictionary.
   bool purged_class = SystemDictionary::do_unloading(is_alive_closure());
 
-  // Follow code cache roots
+  // Unload nmethods.
   CodeCache::do_unloading(is_alive_closure(), purged_class);
-  follow_stack(); // Flush marking stack
 
-  // Update subklass/sibling/implementor links of live klasses
-  Klass::clean_weak_klass_links(&is_alive);
-  assert(_marking_stack.is_empty(), "just drained");
+  // Prune dead klasses from subklass/sibling/implementor lists.
+  Klass::clean_weak_klass_links(is_alive_closure());
 
-  // Visit interned string tables and delete unmarked oops
+  // Delete entries for dead interned strings.
   StringTable::unlink(is_alive_closure());
+
   // Clean up unreferenced symbols in symbol table.
   SymbolTable::unlink();
-
-  assert(_marking_stack.is_empty(), "stack should be empty by now");
 }
 
 
@@ -583,28 +582,27 @@
   ClassLoaderDataGraph::clear_claimed_marks();
 
   // General strong roots.
-  Universe::oops_do(adjust_root_pointer_closure());
-  JNIHandles::oops_do(adjust_root_pointer_closure());   // Global (strong) JNI handles
-  CLDToOopClosure adjust_from_cld(adjust_root_pointer_closure());
-  Threads::oops_do(adjust_root_pointer_closure(), &adjust_from_cld, NULL);
-  ObjectSynchronizer::oops_do(adjust_root_pointer_closure());
-  FlatProfiler::oops_do(adjust_root_pointer_closure());
-  Management::oops_do(adjust_root_pointer_closure());
-  JvmtiExport::oops_do(adjust_root_pointer_closure());
+  Universe::oops_do(adjust_pointer_closure());
+  JNIHandles::oops_do(adjust_pointer_closure());   // Global (strong) JNI handles
+  CLDToOopClosure adjust_from_cld(adjust_pointer_closure());
+  Threads::oops_do(adjust_pointer_closure(), &adjust_from_cld, NULL);
+  ObjectSynchronizer::oops_do(adjust_pointer_closure());
+  FlatProfiler::oops_do(adjust_pointer_closure());
+  Management::oops_do(adjust_pointer_closure());
+  JvmtiExport::oops_do(adjust_pointer_closure());
   // SO_AllClasses
-  SystemDictionary::oops_do(adjust_root_pointer_closure());
-  ClassLoaderDataGraph::oops_do(adjust_root_pointer_closure(), adjust_klass_closure(), true);
-  //CodeCache::scavenge_root_nmethods_oops_do(adjust_root_pointer_closure());
+  SystemDictionary::oops_do(adjust_pointer_closure());
+  ClassLoaderDataGraph::oops_do(adjust_pointer_closure(), adjust_klass_closure(), true);
 
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
   // Global (weak) JNI handles
-  JNIHandles::weak_oops_do(&always_true, adjust_root_pointer_closure());
+  JNIHandles::weak_oops_do(&always_true, adjust_pointer_closure());
 
   CodeCache::oops_do(adjust_pointer_closure());
-  StringTable::oops_do(adjust_root_pointer_closure());
-  ref_processor()->weak_oops_do(adjust_root_pointer_closure());
-  PSScavenge::reference_processor()->weak_oops_do(adjust_root_pointer_closure());
+  StringTable::oops_do(adjust_pointer_closure());
+  ref_processor()->weak_oops_do(adjust_pointer_closure());
+  PSScavenge::reference_processor()->weak_oops_do(adjust_pointer_closure());
 
   adjust_marks();
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp	Wed May 08 10:10:05 2013 +0100
@@ -44,7 +44,6 @@
   static KlassClosure* follow_klass_closure() { return &MarkSweep::follow_klass_closure; }
   static VoidClosure* follow_stack_closure() { return (VoidClosure*)&MarkSweep::follow_stack_closure; }
   static OopClosure* adjust_pointer_closure() { return (OopClosure*)&MarkSweep::adjust_pointer_closure; }
-  static OopClosure* adjust_root_pointer_closure() { return (OopClosure*)&MarkSweep::adjust_root_pointer_closure; }
   static KlassClosure* adjust_klass_closure() { return &MarkSweep::adjust_klass_closure; }
   static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&MarkSweep::is_alive; }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed May 08 10:10:05 2013 +0100
@@ -787,12 +787,11 @@
 void PSParallelCompact::KeepAliveClosure::do_oop(oop* p)       { PSParallelCompact::KeepAliveClosure::do_oop_work(p); }
 void PSParallelCompact::KeepAliveClosure::do_oop(narrowOop* p) { PSParallelCompact::KeepAliveClosure::do_oop_work(p); }
 
-PSParallelCompact::AdjustPointerClosure PSParallelCompact::_adjust_root_pointer_closure(true);
-PSParallelCompact::AdjustPointerClosure PSParallelCompact::_adjust_pointer_closure(false);
+PSParallelCompact::AdjustPointerClosure PSParallelCompact::_adjust_pointer_closure;
 PSParallelCompact::AdjustKlassClosure PSParallelCompact::_adjust_klass_closure;
 
-void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p)       { adjust_pointer(p, _is_root); }
-void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p, _is_root); }
+void PSParallelCompact::AdjustPointerClosure::do_oop(oop* p)       { adjust_pointer(p); }
+void PSParallelCompact::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p); }
 
 void PSParallelCompact::FollowStackClosure::do_void() { _compaction_manager->follow_marking_stacks(); }
 
@@ -805,7 +804,7 @@
   klass->oops_do(_mark_and_push_closure);
 }
 void PSParallelCompact::AdjustKlassClosure::do_klass(Klass* klass) {
-  klass->oops_do(&PSParallelCompact::_adjust_root_pointer_closure);
+  klass->oops_do(&PSParallelCompact::_adjust_pointer_closure);
 }
 
 void PSParallelCompact::post_initialize() {
@@ -892,7 +891,7 @@
     _heap_used      = heap->used();
     _young_gen_used = heap->young_gen()->used_in_bytes();
     _old_gen_used   = heap->old_gen()->used_in_bytes();
-    _metadata_used  = MetaspaceAux::used_in_bytes();
+    _metadata_used  = MetaspaceAux::allocated_used_bytes();
   };
 
   size_t heap_used() const      { return _heap_used; }
@@ -967,8 +966,7 @@
 
   if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
-    gclog_or_tty->print(" VerifyBeforeGC:");
-    Universe::verify();
+    Universe::verify(" VerifyBeforeGC:");
   }
 
   // Verify object start arrays
@@ -1027,6 +1025,7 @@
 
   // Delete metaspaces for unloaded class loaders and clean up loader_data graph
   ClassLoaderDataGraph::purge();
+  MetaspaceAux::verify_metrics();
 
   Threads::gc_epilogue();
   CodeCache::gc_epilogue();
@@ -2168,8 +2167,7 @@
 
   if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
-    gclog_or_tty->print(" VerifyAfterGC:");
-    Universe::verify();
+    Universe::verify(" VerifyAfterGC:");
   }
 
   // Re-verify object start arrays
@@ -2356,22 +2354,24 @@
   }
 
   TraceTime tm_c("class unloading", print_phases(), true, gclog_or_tty);
+
+  // This is the point where the entire marking should have completed.
+  assert(cm->marking_stacks_empty(), "Marking should have completed");
+
   // Follow system dictionary roots and unload classes.
   bool purged_class = SystemDictionary::do_unloading(is_alive_closure());
 
-  // Follow code cache roots.
+  // Unload nmethods.
   CodeCache::do_unloading(is_alive_closure(), purged_class);
-  cm->follow_marking_stacks(); // Flush marking stack.
-
-  // Update subklass/sibling/implementor links of live klasses
+
+  // Prune dead klasses from subklass/sibling/implementor lists.
   Klass::clean_weak_klass_links(is_alive_closure());
 
-  // Visit interned string tables and delete unmarked oops
+  // Delete entries for dead interned strings.
   StringTable::unlink(is_alive_closure());
+
   // Clean up unreferenced symbols in symbol table.
   SymbolTable::unlink();
-
-  assert(cm->marking_stacks_empty(), "marking stacks should be empty");
 }
 
 void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) {
@@ -2398,7 +2398,7 @@
 
 void PSParallelCompact::adjust_class_loader(ParCompactionManager* cm,
                                             ClassLoaderData* cld) {
-  cld->oops_do(PSParallelCompact::adjust_root_pointer_closure(),
+  cld->oops_do(PSParallelCompact::adjust_pointer_closure(),
                PSParallelCompact::adjust_klass_closure(),
                true);
 }
@@ -2419,32 +2419,31 @@
   ClassLoaderDataGraph::clear_claimed_marks();
 
   // General strong roots.
-  Universe::oops_do(adjust_root_pointer_closure());
-  JNIHandles::oops_do(adjust_root_pointer_closure());   // Global (strong) JNI handles
-  CLDToOopClosure adjust_from_cld(adjust_root_pointer_closure());
-  Threads::oops_do(adjust_root_pointer_closure(), &adjust_from_cld, NULL);
-  ObjectSynchronizer::oops_do(adjust_root_pointer_closure());
-  FlatProfiler::oops_do(adjust_root_pointer_closure());
-  Management::oops_do(adjust_root_pointer_closure());
-  JvmtiExport::oops_do(adjust_root_pointer_closure());
+  Universe::oops_do(adjust_pointer_closure());
+  JNIHandles::oops_do(adjust_pointer_closure());   // Global (strong) JNI handles
+  CLDToOopClosure adjust_from_cld(adjust_pointer_closure());
+  Threads::oops_do(adjust_pointer_closure(), &adjust_from_cld, NULL);
+  ObjectSynchronizer::oops_do(adjust_pointer_closure());
+  FlatProfiler::oops_do(adjust_pointer_closure());
+  Management::oops_do(adjust_pointer_closure());
+  JvmtiExport::oops_do(adjust_pointer_closure());
   // SO_AllClasses
-  SystemDictionary::oops_do(adjust_root_pointer_closure());
-  ClassLoaderDataGraph::oops_do(adjust_root_pointer_closure(), adjust_klass_closure(), true);
+  SystemDictionary::oops_do(adjust_pointer_closure());
+  ClassLoaderDataGraph::oops_do(adjust_pointer_closure(), adjust_klass_closure(), true);
 
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
   // Global (weak) JNI handles
-  JNIHandles::weak_oops_do(&always_true, adjust_root_pointer_closure());
+  JNIHandles::weak_oops_do(&always_true, adjust_pointer_closure());
 
   CodeCache::oops_do(adjust_pointer_closure());
-  StringTable::oops_do(adjust_root_pointer_closure());
-  ref_processor()->weak_oops_do(adjust_root_pointer_closure());
+  StringTable::oops_do(adjust_pointer_closure());
+  ref_processor()->weak_oops_do(adjust_pointer_closure());
   // Roots were visited so references into the young gen in roots
   // may have been scanned.  Process them also.
   // Should the reference processor have a span that excludes
   // young gen objects?
-  PSScavenge::reference_processor()->weak_oops_do(
-                                              adjust_root_pointer_closure());
+  PSScavenge::reference_processor()->weak_oops_do(adjust_pointer_closure());
 }
 
 void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q,
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Wed May 08 10:10:05 2013 +0100
@@ -799,16 +799,6 @@
     virtual void do_oop(narrowOop* p);
   };
 
-  // Current unused
-  class FollowRootClosure: public OopsInGenClosure {
-   private:
-    ParCompactionManager* _compaction_manager;
-   public:
-    FollowRootClosure(ParCompactionManager* cm) : _compaction_manager(cm) { }
-    virtual void do_oop(oop* p);
-    virtual void do_oop(narrowOop* p);
- };
-
   class FollowStackClosure: public VoidClosure {
    private:
     ParCompactionManager* _compaction_manager;
@@ -818,10 +808,7 @@
   };
 
   class AdjustPointerClosure: public OopClosure {
-   private:
-    bool _is_root;
    public:
-    AdjustPointerClosure(bool is_root) : _is_root(is_root) { }
     virtual void do_oop(oop* p);
     virtual void do_oop(narrowOop* p);
     // do not walk from thread stacks to the code cache on this phase
@@ -838,7 +825,6 @@
   friend class AdjustPointerClosure;
   friend class AdjustKlassClosure;
   friend class FollowKlassClosure;
-  friend class FollowRootClosure;
   friend class InstanceClassLoaderKlass;
   friend class RefProcTaskProxy;
 
@@ -853,7 +839,6 @@
   static IsAliveClosure       _is_alive_closure;
   static SpaceInfo            _space_info[last_space_id];
   static bool                 _print_phases;
-  static AdjustPointerClosure _adjust_root_pointer_closure;
   static AdjustPointerClosure _adjust_pointer_closure;
   static AdjustKlassClosure   _adjust_klass_closure;
 
@@ -889,9 +874,6 @@
   static void marking_phase(ParCompactionManager* cm,
                             bool maximum_heap_compaction);
 
-  template <class T> static inline void adjust_pointer(T* p, bool is_root);
-  static void adjust_root_pointer(oop* p) { adjust_pointer(p, true); }
-
   template <class T>
   static inline void follow_root(ParCompactionManager* cm, T* p);
 
@@ -1046,7 +1028,6 @@
 
   // Closure accessors
   static OopClosure* adjust_pointer_closure()      { return (OopClosure*)&_adjust_pointer_closure; }
-  static OopClosure* adjust_root_pointer_closure() { return (OopClosure*)&_adjust_root_pointer_closure; }
   static KlassClosure* adjust_klass_closure()      { return (KlassClosure*)&_adjust_klass_closure; }
   static BoolObjectClosure* is_alive_closure()     { return (BoolObjectClosure*)&_is_alive_closure; }
 
@@ -1067,6 +1048,7 @@
   // Check mark and maybe push on marking stack
   template <class T> static inline void mark_and_push(ParCompactionManager* cm,
                                                       T* p);
+  template <class T> static inline void adjust_pointer(T* p);
 
   static void follow_klass(ParCompactionManager* cm, Klass* klass);
   static void adjust_klass(ParCompactionManager* cm, Klass* klass);
@@ -1151,9 +1133,6 @@
   static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; }
   static ParallelCompactData& summary_data() { return _summary_data; }
 
-  static inline void adjust_pointer(oop* p)       { adjust_pointer(p, false); }
-  static inline void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
-
   // Reference Processing
   static ReferenceProcessor* const ref_processor() { return _ref_processor; }
 
@@ -1230,7 +1209,7 @@
 }
 
 template <class T>
-inline void PSParallelCompact::adjust_pointer(T* p, bool isroot) {
+inline void PSParallelCompact::adjust_pointer(T* p) {
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
     oop obj     = oopDesc::decode_heap_oop_not_null(heap_oop);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed May 08 10:10:05 2013 +0100
@@ -314,8 +314,7 @@
 
   if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
-    gclog_or_tty->print(" VerifyBeforeGC:");
-    Universe::verify();
+    Universe::verify(" VerifyBeforeGC:");
   }
 
   {
@@ -638,8 +637,7 @@
 
   if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
     HandleMark hm;  // Discard invalid handles created during verification
-    gclog_or_tty->print(" VerifyAfterGC:");
-    Universe::verify();
+    Universe::verify(" VerifyAfterGC:");
   }
 
   heap->print_heap_after_gc();
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Wed May 08 10:10:05 2013 +0100
@@ -81,7 +81,7 @@
 }
 
 void MarkSweep::adjust_class_loader(ClassLoaderData* cld) {
-  cld->oops_do(&MarkSweep::adjust_root_pointer_closure, &MarkSweep::adjust_klass_closure, true);
+  cld->oops_do(&MarkSweep::adjust_pointer_closure, &MarkSweep::adjust_klass_closure, true);
 }
 
 
@@ -121,11 +121,10 @@
   }
 }
 
-MarkSweep::AdjustPointerClosure MarkSweep::adjust_root_pointer_closure(true);
-MarkSweep::AdjustPointerClosure MarkSweep::adjust_pointer_closure(false);
+MarkSweep::AdjustPointerClosure MarkSweep::adjust_pointer_closure;
 
-void MarkSweep::AdjustPointerClosure::do_oop(oop* p)       { adjust_pointer(p, _is_root); }
-void MarkSweep::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p, _is_root); }
+void MarkSweep::AdjustPointerClosure::do_oop(oop* p)       { adjust_pointer(p); }
+void MarkSweep::AdjustPointerClosure::do_oop(narrowOop* p) { adjust_pointer(p); }
 
 void MarkSweep::adjust_marks() {
   assert( _preserved_oop_stack.size() == _preserved_mark_stack.size(),
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp	Wed May 08 10:10:05 2013 +0100
@@ -80,10 +80,7 @@
   };
 
   class AdjustPointerClosure: public OopsInGenClosure {
-   private:
-    bool _is_root;
    public:
-    AdjustPointerClosure(bool is_root) : _is_root(is_root) {}
     virtual void do_oop(oop* p);
     virtual void do_oop(narrowOop* p);
   };
@@ -146,7 +143,6 @@
   static MarkAndPushClosure   mark_and_push_closure;
   static FollowKlassClosure   follow_klass_closure;
   static FollowStackClosure   follow_stack_closure;
-  static AdjustPointerClosure adjust_root_pointer_closure;
   static AdjustPointerClosure adjust_pointer_closure;
   static AdjustKlassClosure   adjust_klass_closure;
 
@@ -179,12 +175,7 @@
   static void adjust_marks();   // Adjust the pointers in the preserved marks table
   static void restore_marks();  // Restore the marks that we saved in preserve_mark
 
-  template <class T> static inline void adjust_pointer(T* p, bool isroot);
-
-  static void adjust_root_pointer(oop* p)  { adjust_pointer(p, true); }
-  static void adjust_pointer(oop* p)       { adjust_pointer(p, false); }
-  static void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
-
+  template <class T> static inline void adjust_pointer(T* p);
 };
 
 class PreservedMark VALUE_OBJ_CLASS_SPEC {
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Wed May 08 10:10:05 2013 +0100
@@ -76,7 +76,7 @@
   _objarray_stack.push(task);
 }
 
-template <class T> inline void MarkSweep::adjust_pointer(T* p, bool isroot) {
+template <class T> inline void MarkSweep::adjust_pointer(T* p) {
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
     oop obj     = oopDesc::decode_heap_oop_not_null(heap_oop);
--- a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Wed May 08 10:10:05 2013 +0100
@@ -225,7 +225,10 @@
         gclog_or_tty->print_cr("\nCMS full GC for Metaspace");
       }
       heap->collect_as_vm_thread(GCCause::_metadata_GC_threshold);
-      _result = _loader_data->metaspace_non_null()->allocate(_size, _mdtype);
+      // After a GC try to allocate without expanding.  Could fail
+      // and expansion will be tried below.
+      _result =
+        _loader_data->metaspace_non_null()->allocate(_size, _mdtype);
     }
     if (_result == NULL && !UseConcMarkSweepGC /* CMS already tried */) {
       // If still failing, allow the Metaspace to expand.
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1052,7 +1052,7 @@
     return;
   }
   if (set_handler_blob() == NULL) {
-    vm_exit_out_of_memory(blob_size, "native signature handlers");
+    vm_exit_out_of_memory(blob_size, OOM_MALLOC_ERROR, "native signature handlers");
   }
 
   BufferBlob* bb = BufferBlob::create("Signature Handler Temp Buffer",
--- a/hotspot/src/share/vm/memory/allocation.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Wed May 08 10:10:05 2013 +0100
@@ -259,7 +259,7 @@
     }
     if (p == NULL) p = os::malloc(bytes, mtChunk, CURRENT_PC);
     if (p == NULL)
-      vm_exit_out_of_memory(bytes, "ChunkPool::allocate");
+      vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "ChunkPool::allocate");
 
     return p;
   }
@@ -371,7 +371,7 @@
    default: {
      void *p =  os::malloc(bytes, mtChunk, CALLER_PC);
      if (p == NULL)
-       vm_exit_out_of_memory(bytes, "Chunk::new");
+       vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "Chunk::new");
      return p;
    }
   }
@@ -531,7 +531,7 @@
 }
 
 void Arena::signal_out_of_memory(size_t sz, const char* whence) const {
-  vm_exit_out_of_memory(sz, whence);
+  vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, whence);
 }
 
 // Grow a new Chunk
--- a/hotspot/src/share/vm/memory/allocation.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/allocation.hpp	Wed May 08 10:10:05 2013 +0100
@@ -539,6 +539,9 @@
 #define NEW_RESOURCE_ARRAY(type, size)\
   (type*) resource_allocate_bytes((size) * sizeof(type))
 
+#define NEW_RESOURCE_ARRAY_RETURN_NULL(type, size)\
+  (type*) resource_allocate_bytes((size) * sizeof(type), AllocFailStrategy::RETURN_NULL)
+
 #define NEW_RESOURCE_ARRAY_IN_THREAD(thread, type, size)\
   (type*) resource_allocate_bytes(thread, (size) * sizeof(type))
 
--- a/hotspot/src/share/vm/memory/allocation.inline.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/allocation.inline.hpp	Wed May 08 10:10:05 2013 +0100
@@ -58,7 +58,9 @@
   #ifdef ASSERT
   if (PrintMallocFree) trace_heap_malloc(size, "AllocateHeap", p);
   #endif
-  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) vm_exit_out_of_memory(size, "AllocateHeap");
+  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
+    vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "AllocateHeap");
+  }
   return p;
 }
 
@@ -68,7 +70,9 @@
   #ifdef ASSERT
   if (PrintMallocFree) trace_heap_malloc(size, "ReallocateHeap", p);
   #endif
-  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) vm_exit_out_of_memory(size, "ReallocateHeap");
+  if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
+    vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "ReallocateHeap");
+  }
   return p;
 }
 
@@ -130,12 +134,12 @@
 
   _addr = os::reserve_memory(_size, NULL, alignment);
   if (_addr == NULL) {
-    vm_exit_out_of_memory(_size, "Allocator (reserve)");
+    vm_exit_out_of_memory(_size, OOM_MMAP_ERROR, "Allocator (reserve)");
   }
 
   bool success = os::commit_memory(_addr, _size, false /* executable */);
   if (!success) {
-    vm_exit_out_of_memory(_size, "Allocator (commit)");
+    vm_exit_out_of_memory(_size, OOM_MMAP_ERROR, "Allocator (commit)");
   }
 
   return (E*)_addr;
--- a/hotspot/src/share/vm/memory/blockOffsetTable.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/blockOffsetTable.cpp	Wed May 08 10:10:05 2013 +0100
@@ -80,7 +80,7 @@
     assert(delta > 0, "just checking");
     if (!_vs.expand_by(delta)) {
       // Do better than this for Merlin
-      vm_exit_out_of_memory(delta, "offset table expansion");
+      vm_exit_out_of_memory(delta, OOM_MMAP_ERROR, "offset table expansion");
     }
     assert(_vs.high() == high + delta, "invalid expansion");
   } else {
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Wed May 08 10:10:05 2013 +0100
@@ -116,7 +116,7 @@
   _guard_region = MemRegion((HeapWord*)guard_page, _page_size);
   if (!os::commit_memory((char*)guard_page, _page_size, _page_size)) {
     // Do better than this for Merlin
-    vm_exit_out_of_memory(_page_size, "card table last card");
+    vm_exit_out_of_memory(_page_size, OOM_MMAP_ERROR, "card table last card");
   }
 
   *guard_card = last_card;
@@ -292,7 +292,7 @@
       if (!os::commit_memory((char*)new_committed.start(),
                              new_committed.byte_size(), _page_size)) {
         // Do better than this for Merlin
-        vm_exit_out_of_memory(new_committed.byte_size(),
+        vm_exit_out_of_memory(new_committed.byte_size(), OOM_MMAP_ERROR,
                 "card table expansion");
       }
     // Use new_end_aligned (as opposed to new_end_for_commit) because
--- a/hotspot/src/share/vm/memory/filemap.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Wed May 08 10:10:05 2013 +0100
@@ -238,8 +238,8 @@
 
 void FileMapInfo::write_space(int i, Metaspace* space, bool read_only) {
   align_file_position();
-  size_t used = space->used_words(Metaspace::NonClassType) * BytesPerWord;
-  size_t capacity = space->capacity_words(Metaspace::NonClassType) * BytesPerWord;
+  size_t used = space->used_bytes_slow(Metaspace::NonClassType);
+  size_t capacity = space->capacity_bytes_slow(Metaspace::NonClassType);
   struct FileMapInfo::FileMapHeader::space_info* si = &_header._space[i];
   write_region(i, (char*)space->bottom(), used, capacity, read_only, false);
 }
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Wed May 08 10:10:05 2013 +0100
@@ -377,7 +377,7 @@
 
   ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
 
-  const size_t metadata_prev_used = MetaspaceAux::used_in_bytes();
+  const size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes();
 
   print_heap_before_gc();
 
@@ -447,8 +447,7 @@
             prepare_for_verify();
             prepared_for_verification = true;
           }
-          gclog_or_tty->print(" VerifyBeforeGC:");
-          Universe::verify();
+          Universe::verify(" VerifyBeforeGC:");
         }
         COMPILER2_PRESENT(DerivedPointerTable::clear());
 
@@ -519,8 +518,7 @@
         if (VerifyAfterGC && i >= VerifyGCLevel &&
             total_collections() >= VerifyGCStartAt) {
           HandleMark hm;  // Discard invalid handles created during verification
-          gclog_or_tty->print(" VerifyAfterGC:");
-          Universe::verify();
+          Universe::verify(" VerifyAfterGC:");
         }
 
         if (PrintGCDetails) {
@@ -556,6 +554,7 @@
     if (complete) {
       // Delete metaspaces for unloaded class loaders and clean up loader_data graph
       ClassLoaderDataGraph::purge();
+      MetaspaceAux::verify_metrics();
       // Resize the metaspace capacity after full collections
       MetaspaceGC::compute_new_size();
       update_full_collections_completed();
@@ -633,9 +632,8 @@
 }
 
 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure,
-                                              CodeBlobClosure* code_roots,
-                                              OopClosure* non_root_closure) {
-  SharedHeap::process_weak_roots(root_closure, code_roots, non_root_closure);
+                                              CodeBlobClosure* code_roots) {
+  SharedHeap::process_weak_roots(root_closure, code_roots);
   // "Local" "weak" refs
   for (int i = 0; i < _n_gens; i++) {
     _gens[i]->ref_processor()->weak_oops_do(root_closure);
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Wed May 08 10:10:05 2013 +0100
@@ -432,8 +432,7 @@
   // JNI weak roots, the code cache, system dictionary, symbol table,
   // string table, and referents of reachable weak refs.
   void gen_process_weak_roots(OopClosure* root_closure,
-                              CodeBlobClosure* code_roots,
-                              OopClosure* non_root_closure);
+                              CodeBlobClosure* code_roots);
 
   // Set the saved marks of generations, if that makes sense.
   // In particular, if any generation might iterate over the oops
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp	Wed May 08 10:10:05 2013 +0100
@@ -223,23 +223,23 @@
       &is_alive, &keep_alive, &follow_stack_closure, NULL);
   }
 
-  // Follow system dictionary roots and unload classes
+  // This is the point where the entire marking should have completed.
+  assert(_marking_stack.is_empty(), "Marking should have completed");
+
+  // Unload classes and purge the SystemDictionary.
   bool purged_class = SystemDictionary::do_unloading(&is_alive);
 
-  // Follow code cache roots
+  // Unload nmethods.
   CodeCache::do_unloading(&is_alive, purged_class);
-  follow_stack(); // Flush marking stack
 
-  // Update subklass/sibling/implementor links of live klasses
+  // Prune dead klasses from subklass/sibling/implementor lists.
   Klass::clean_weak_klass_links(&is_alive);
-  assert(_marking_stack.is_empty(), "just drained");
 
-  // Visit interned string tables and delete unmarked oops
+  // Delete entries for dead interned strings.
   StringTable::unlink(&is_alive);
+
   // Clean up unreferenced symbols in symbol table.
   SymbolTable::unlink();
-
-  assert(_marking_stack.is_empty(), "stack should be empty by now");
 }
 
 
@@ -282,11 +282,10 @@
   // Need new claim bits for the pointer adjustment tracing.
   ClassLoaderDataGraph::clear_claimed_marks();
 
-  // Because the two closures below are created statically, cannot
+  // Because the closure below is created statically, we cannot
   // use OopsInGenClosure constructor which takes a generation,
   // as the Universe has not been created when the static constructors
   // are run.
-  adjust_root_pointer_closure.set_orig_generation(gch->get_gen(level));
   adjust_pointer_closure.set_orig_generation(gch->get_gen(level));
 
   gch->gen_process_strong_roots(level,
@@ -294,18 +293,17 @@
                                 true,  // activate StrongRootsScope
                                 false, // not scavenging
                                 SharedHeap::SO_AllClasses,
-                                &adjust_root_pointer_closure,
+                                &adjust_pointer_closure,
                                 false, // do not walk code
-                                &adjust_root_pointer_closure,
+                                &adjust_pointer_closure,
                                 &adjust_klass_closure);
 
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
   CodeBlobToOopClosure adjust_code_pointer_closure(&adjust_pointer_closure,
                                                    /*do_marking=*/ false);
-  gch->gen_process_weak_roots(&adjust_root_pointer_closure,
-                              &adjust_code_pointer_closure,
-                              &adjust_pointer_closure);
+  gch->gen_process_weak_roots(&adjust_pointer_closure,
+                              &adjust_code_pointer_closure);
 
   adjust_marks();
   GenAdjustPointersClosure blk;
--- a/hotspot/src/share/vm/memory/metachunk.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/metachunk.cpp	Wed May 08 10:10:05 2013 +0100
@@ -28,6 +28,7 @@
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
 
+class VirtualSpaceNode;
 //
 // Future modification
 //
@@ -45,27 +46,30 @@
 
 // Metachunk methods
 
-Metachunk* Metachunk::initialize(MetaWord* ptr, size_t word_size) {
-  // Set bottom, top, and end.  Allow space for the Metachunk itself
-  Metachunk* chunk = (Metachunk*) ptr;
-
-  MetaWord* chunk_bottom = ptr + _overhead;
-  chunk->set_bottom(ptr);
-  chunk->set_top(chunk_bottom);
-  MetaWord* chunk_end = ptr + word_size;
-  assert(chunk_end > chunk_bottom, "Chunk must be too small");
-  chunk->set_end(chunk_end);
-  chunk->set_next(NULL);
-  chunk->set_prev(NULL);
-  chunk->set_word_size(word_size);
+Metachunk::Metachunk(size_t word_size,
+                     VirtualSpaceNode* container) :
+    _word_size(word_size),
+    _bottom(NULL),
+    _end(NULL),
+    _top(NULL),
+    _next(NULL),
+    _prev(NULL),
+    _container(container)
+{
+  _bottom = (MetaWord*)this;
+  _top = (MetaWord*)this + _overhead;
+  _end = (MetaWord*)this + word_size;
 #ifdef ASSERT
-  size_t data_word_size = pointer_delta(chunk_end, chunk_bottom, sizeof(MetaWord));
-  Copy::fill_to_words((HeapWord*) chunk_bottom, data_word_size, metadata_chunk_initialize);
+  set_is_free(false);
+  size_t data_word_size = pointer_delta(end(),
+                                        top(),
+                                        sizeof(MetaWord));
+  Copy::fill_to_words((HeapWord*) top(),
+                      data_word_size,
+                      metadata_chunk_initialize);
 #endif
-  return chunk;
 }
 
-
 MetaWord* Metachunk::allocate(size_t word_size) {
   MetaWord* result = NULL;
   // If available, bump the pointer to allocate.
--- a/hotspot/src/share/vm/memory/metachunk.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/metachunk.hpp	Wed May 08 10:10:05 2013 +0100
@@ -41,10 +41,13 @@
 //            |              |              |        |
 //            +--------------+ <- bottom ---+     ---+
 
+class VirtualSpaceNode;
+
 class Metachunk VALUE_OBJ_CLASS_SPEC {
   // link to support lists of chunks
   Metachunk* _next;
   Metachunk* _prev;
+  VirtualSpaceNode* _container;
 
   MetaWord* _bottom;
   MetaWord* _end;
@@ -61,29 +64,20 @@
   // the space.
   static size_t _overhead;
 
-  void set_bottom(MetaWord* v) { _bottom = v; }
-  void set_end(MetaWord* v) { _end = v; }
-  void set_top(MetaWord* v) { _top = v; }
-  void set_word_size(size_t v) { _word_size = v; }
  public:
-#ifdef ASSERT
-  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), _is_free(false),
-    _next(NULL), _prev(NULL) {}
-#else
-  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL),
-    _next(NULL), _prev(NULL) {}
-#endif
+  Metachunk(size_t word_size , VirtualSpaceNode* container);
 
   // Used to add a Metachunk to a list of Metachunks
   void set_next(Metachunk* v) { _next = v; assert(v != this, "Boom");}
   void set_prev(Metachunk* v) { _prev = v; assert(v != this, "Boom");}
+  void set_container(VirtualSpaceNode* v) { _container = v; }
 
   MetaWord* allocate(size_t word_size);
-  static Metachunk* initialize(MetaWord* ptr, size_t word_size);
 
   // Accessors
   Metachunk* next() const { return _next; }
   Metachunk* prev() const { return _prev; }
+  VirtualSpaceNode* container() const { return _container; }
   MetaWord* bottom() const { return _bottom; }
   MetaWord* end() const { return _end; }
   MetaWord* top() const { return _top; }
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed May 08 10:10:05 2013 +0100
@@ -47,7 +47,6 @@
 // the free chunk lists
 const bool metaspace_slow_verify = false;
 
-
 // Parameters for stress mode testing
 const uint metadata_deallocate_a_lot_block = 10;
 const uint metadata_deallocate_a_lock_chunk = 3;
@@ -112,6 +111,7 @@
 class ChunkManager VALUE_OBJ_CLASS_SPEC {
 
   // Free list of chunks of different sizes.
+  //   SpecializedChunk
   //   SmallChunk
   //   MediumChunk
   //   HumongousChunk
@@ -165,6 +165,10 @@
   // for special, small, medium, and humongous chunks.
   static ChunkIndex list_index(size_t size);
 
+  // Remove the chunk from its freelist.  It is
+  // expected to be on one of the _free_chunks[] lists.
+  void remove_chunk(Metachunk* chunk);
+
   // Add the simple linked list of chunks to the freelist of chunks
   // of type index.
   void return_chunks(ChunkIndex index, Metachunk* chunks);
@@ -215,7 +219,6 @@
   void print_on(outputStream* st);
 };
 
-
 // Used to manage the free list of Metablocks (a block corresponds
 // to the allocation of a quantum of metadata).
 class BlockFreelist VALUE_OBJ_CLASS_SPEC {
@@ -255,6 +258,8 @@
   ReservedSpace _rs;
   VirtualSpace _virtual_space;
   MetaWord* _top;
+  // count of chunks contained in this VirtualSpace
+  uintx _container_count;
 
   // Convenience functions for logical bottom and end
   MetaWord* bottom() const { return (MetaWord*) _virtual_space.low(); }
@@ -264,10 +269,19 @@
   char* low()  const { return virtual_space()->low(); }
   char* high() const { return virtual_space()->high(); }
 
+  // The first Metachunk will be allocated at the bottom of the
+  // VirtualSpace
+  Metachunk* first_chunk() { return (Metachunk*) bottom(); }
+
+  void inc_container_count();
+#ifdef ASSERT
+  uint container_count_slow();
+#endif
+
  public:
 
   VirtualSpaceNode(size_t byte_size);
-  VirtualSpaceNode(ReservedSpace rs) : _top(NULL), _next(NULL), _rs(rs) {}
+  VirtualSpaceNode(ReservedSpace rs) : _top(NULL), _next(NULL), _rs(rs), _container_count(0) {}
   ~VirtualSpaceNode();
 
   // address of next available space in _virtual_space;
@@ -282,15 +296,22 @@
   MemRegion* reserved() { return &_reserved; }
   VirtualSpace* virtual_space() const { return (VirtualSpace*) &_virtual_space; }
 
-  // Returns true if "word_size" is available in the virtual space
+  // Returns true if "word_size" is available in the VirtualSpace
   bool is_available(size_t word_size) { return _top + word_size <= end(); }
 
   MetaWord* top() const { return _top; }
   void inc_top(size_t word_size) { _top += word_size; }
 
+  uintx container_count() { return _container_count; }
+  void dec_container_count();
+#ifdef ASSERT
+  void verify_container_count();
+#endif
+
   // used and capacity in this single entry in the list
   size_t used_words_in_vs() const;
   size_t capacity_words_in_vs() const;
+  size_t free_words_in_vs() const;
 
   bool initialize();
 
@@ -306,6 +327,10 @@
   bool expand_by(size_t words, bool pre_touch = false);
   bool shrink_by(size_t words);
 
+  // In preparation for deleting this node, remove all the chunks
+  // in the node from any freelist.
+  void purge(ChunkManager* chunk_manager);
+
 #ifdef ASSERT
   // Debug support
   static void verify_virtual_space_total();
@@ -317,7 +342,7 @@
 };
 
   // byte_size is the size of the associated virtualspace.
-VirtualSpaceNode::VirtualSpaceNode(size_t byte_size) : _top(NULL), _next(NULL), _rs(0) {
+VirtualSpaceNode::VirtualSpaceNode(size_t byte_size) : _top(NULL), _next(NULL), _rs(0), _container_count(0) {
   // align up to vm allocation granularity
   byte_size = align_size_up(byte_size, os::vm_allocation_granularity());
 
@@ -341,6 +366,39 @@
   MemTracker::record_virtual_memory_type((address)_rs.base(), mtClass);
 }
 
+void VirtualSpaceNode::purge(ChunkManager* chunk_manager) {
+  Metachunk* chunk = first_chunk();
+  Metachunk* invalid_chunk = (Metachunk*) top();
+  while (chunk < invalid_chunk ) {
+    assert(chunk->is_free(), "Should be marked free");
+      MetaWord* next = ((MetaWord*)chunk) + chunk->word_size();
+      chunk_manager->remove_chunk(chunk);
+      assert(chunk->next() == NULL &&
+             chunk->prev() == NULL,
+             "Was not removed from its list");
+      chunk = (Metachunk*) next;
+  }
+}
+
+#ifdef ASSERT
+uint VirtualSpaceNode::container_count_slow() {
+  uint count = 0;
+  Metachunk* chunk = first_chunk();
+  Metachunk* invalid_chunk = (Metachunk*) top();
+  while (chunk < invalid_chunk ) {
+    MetaWord* next = ((MetaWord*)chunk) + chunk->word_size();
+    // Don't count the chunks on the free lists.  Those are
+    // still part of the VirtualSpaceNode but not currently
+    // counted.
+    if (!chunk->is_free()) {
+      count++;
+    }
+    chunk = (Metachunk*) next;
+  }
+  return count;
+}
+#endif
+
 // List of VirtualSpaces for metadata allocation.
 // It has a  _next link for singly linked list and a MemRegion
 // for total space in the VirtualSpace.
@@ -390,6 +448,8 @@
   VirtualSpaceList(size_t word_size);
   VirtualSpaceList(ReservedSpace rs);
 
+  size_t free_bytes();
+
   Metachunk* get_new_chunk(size_t word_size,
                            size_t grow_chunks_by_words,
                            size_t medium_chunk_bunch);
@@ -410,14 +470,14 @@
   void initialize(size_t word_size);
 
   size_t virtual_space_total() { return _virtual_space_total; }
-  void inc_virtual_space_total(size_t v) {
-    Atomic::add_ptr(v, &_virtual_space_total);
-  }
-
-  size_t virtual_space_count() { return _virtual_space_count; }
-  void inc_virtual_space_count() {
-    Atomic::inc_ptr(&_virtual_space_count);
-  }
+
+  void inc_virtual_space_total(size_t v);
+  void dec_virtual_space_total(size_t v);
+  void inc_virtual_space_count();
+  void dec_virtual_space_count();
+
+  // Unlink empty VirtualSpaceNodes and free it.
+  void purge();
 
   // Used and capacity in the entire list of virtual spaces.
   // These are global values shared by all Metaspaces
@@ -520,7 +580,11 @@
   bool has_small_chunk_limit() { return !vs_list()->is_class(); }
 
   // Sum of all space in allocated chunks
-  size_t _allocation_total;
+  size_t _allocated_blocks_words;
+
+  // Sum of all allocated chunks
+  size_t _allocated_chunks_words;
+  size_t _allocated_chunks_count;
 
   // Free lists of blocks are per SpaceManager since they
   // are assumed to be in chunks in use by the SpaceManager
@@ -576,12 +640,27 @@
   size_t medium_chunk_size() { return (size_t) vs_list()->is_class() ? ClassMediumChunk : MediumChunk; }
   size_t medium_chunk_bunch() { return medium_chunk_size() * MediumChunkMultiple; }
 
-  size_t allocation_total() const { return _allocation_total; }
-  void inc_allocation_total(size_t v) { Atomic::add_ptr(v, &_allocation_total); }
+  size_t allocated_blocks_words() const { return _allocated_blocks_words; }
+  size_t allocated_blocks_bytes() const { return _allocated_blocks_words * BytesPerWord; }
+  size_t allocated_chunks_words() const { return _allocated_chunks_words; }
+  size_t allocated_chunks_count() const { return _allocated_chunks_count; }
+
   bool is_humongous(size_t word_size) { return word_size > medium_chunk_size(); }
 
   static Mutex* expand_lock() { return _expand_lock; }
 
+  // Increment the per Metaspace and global running sums for Metachunks
+  // by the given size.  This is used when a Metachunk to added to
+  // the in-use list.
+  void inc_size_metrics(size_t words);
+  // Increment the per Metaspace and global running sums Metablocks by the given
+  // size.  This is used when a Metablock is allocated.
+  void inc_used_metrics(size_t words);
+  // Delete the portion of the running sums for this SpaceManager. That is,
+  // the globals running sums for the Metachunks and Metablocks are
+  // decremented for all the Metachunks in-use by this SpaceManager.
+  void dec_total_from_size_metrics();
+
   // Set the sizes for the initial chunks.
   void get_initial_chunk_sizes(Metaspace::MetaspaceType type,
                                size_t* chunk_word_size,
@@ -627,7 +706,7 @@
   void verify_chunk_size(Metachunk* chunk);
   NOT_PRODUCT(void mangle_freed_chunks();)
 #ifdef ASSERT
-  void verify_allocation_total();
+  void verify_allocated_blocks_words();
 #endif
 };
 
@@ -641,6 +720,28 @@
             SpaceManager::_expand_lock_name,
             Mutex::_allow_vm_block_flag);
 
+void VirtualSpaceNode::inc_container_count() {
+  assert_lock_strong(SpaceManager::expand_lock());
+  _container_count++;
+  assert(_container_count == container_count_slow(),
+         err_msg("Inconsistency in countainer_count _container_count " SIZE_FORMAT
+                 "container_count_slow() " SIZE_FORMAT,
+                 _container_count, container_count_slow()));
+}
+
+void VirtualSpaceNode::dec_container_count() {
+  assert_lock_strong(SpaceManager::expand_lock());
+  _container_count--;
+}
+
+#ifdef ASSERT
+void VirtualSpaceNode::verify_container_count() {
+  assert(_container_count == container_count_slow(),
+    err_msg("Inconsistency in countainer_count _container_count " SIZE_FORMAT
+            "container_count_slow() " SIZE_FORMAT, _container_count, container_count_slow()));
+}
+#endif
+
 // BlockFreelist methods
 
 BlockFreelist::BlockFreelist() : _dictionary(NULL) {}
@@ -701,6 +802,10 @@
 
 VirtualSpaceNode::~VirtualSpaceNode() {
   _rs.release();
+#ifdef ASSERT
+  size_t word_size = sizeof(*this) / BytesPerWord;
+  Copy::fill_to_words((HeapWord*) this, word_size, 0xf1f1f1f1);
+#endif
 }
 
 size_t VirtualSpaceNode::used_words_in_vs() const {
@@ -712,6 +817,9 @@
   return pointer_delta(end(), bottom(), sizeof(MetaWord));
 }
 
+size_t VirtualSpaceNode::free_words_in_vs() const {
+  return pointer_delta(end(), top(), sizeof(MetaWord));
+}
 
 // Allocates the chunk from the virtual space only.
 // This interface is also used internally for debugging.  Not all
@@ -733,8 +841,8 @@
   // Take the space  (bump top on the current virtual space).
   inc_top(chunk_word_size);
 
-  // Point the chunk at the space
-  Metachunk* result = Metachunk::initialize(chunk_limit, chunk_word_size);
+  // Initialize the chunk
+  Metachunk* result = ::new (chunk_limit) Metachunk(chunk_word_size, this);
   return result;
 }
 
@@ -762,9 +870,11 @@
 
 Metachunk* VirtualSpaceNode::get_chunk_vs(size_t chunk_word_size) {
   assert_lock_strong(SpaceManager::expand_lock());
-  Metachunk* result = NULL;
-
-  return take_from_committed(chunk_word_size);
+  Metachunk* result = take_from_committed(chunk_word_size);
+  if (result != NULL) {
+    inc_container_count();
+  }
+  return result;
 }
 
 Metachunk* VirtualSpaceNode::get_chunk_vs_with_expand(size_t chunk_word_size) {
@@ -843,6 +953,83 @@
   }
 }
 
+void VirtualSpaceList::inc_virtual_space_total(size_t v) {
+  assert_lock_strong(SpaceManager::expand_lock());
+  _virtual_space_total = _virtual_space_total + v;
+}
+void VirtualSpaceList::dec_virtual_space_total(size_t v) {
+  assert_lock_strong(SpaceManager::expand_lock());
+  _virtual_space_total = _virtual_space_total - v;
+}
+
+void VirtualSpaceList::inc_virtual_space_count() {
+  assert_lock_strong(SpaceManager::expand_lock());
+  _virtual_space_count++;
+}
+void VirtualSpaceList::dec_virtual_space_count() {
+  assert_lock_strong(SpaceManager::expand_lock());
+  _virtual_space_count--;
+}
+
+void ChunkManager::remove_chunk(Metachunk* chunk) {
+  size_t word_size = chunk->word_size();
+  ChunkIndex index = list_index(word_size);
+  if (index != HumongousIndex) {
+    free_chunks(index)->remove_chunk(chunk);
+  } else {
+    humongous_dictionary()->remove_chunk(chunk);
+  }
+
+  // Chunk is being removed from the chunks free list.
+  dec_free_chunks_total(chunk->capacity_word_size());
+}
+
+// Walk the list of VirtualSpaceNodes and delete
+// nodes with a 0 container_count.  Remove Metachunks in
+// the node from their respective freelists.
+void VirtualSpaceList::purge() {
+  assert_lock_strong(SpaceManager::expand_lock());
+  // Don't use a VirtualSpaceListIterator because this
+  // list is being changed and a straightforward use of an iterator is not safe.
+  VirtualSpaceNode* purged_vsl = NULL;
+  VirtualSpaceNode* prev_vsl = virtual_space_list();
+  VirtualSpaceNode* next_vsl = prev_vsl;
+  while (next_vsl != NULL) {
+    VirtualSpaceNode* vsl = next_vsl;
+    next_vsl = vsl->next();
+    // Don't free the current virtual space since it will likely
+    // be needed soon.
+    if (vsl->container_count() == 0 && vsl != current_virtual_space()) {
+      // Unlink it from the list
+      if (prev_vsl == vsl) {
+        // This is the case of the current note being the first note.
+        assert(vsl == virtual_space_list(), "Expected to be the first note");
+        set_virtual_space_list(vsl->next());
+      } else {
+        prev_vsl->set_next(vsl->next());
+      }
+
+      vsl->purge(chunk_manager());
+      dec_virtual_space_total(vsl->reserved()->word_size());
+      dec_virtual_space_count();
+      purged_vsl = vsl;
+      delete vsl;
+    } else {
+      prev_vsl = vsl;
+    }
+  }
+#ifdef ASSERT
+  if (purged_vsl != NULL) {
+  // List should be stable enough to use an iterator here.
+  VirtualSpaceListIterator iter(virtual_space_list());
+    while (iter.repeat()) {
+      VirtualSpaceNode* vsl = iter.get_next();
+      assert(vsl != purged_vsl, "Purge of vsl failed");
+    }
+  }
+#endif
+}
+
 size_t VirtualSpaceList::used_words_sum() {
   size_t allocated_by_vs = 0;
   VirtualSpaceListIterator iter(virtual_space_list());
@@ -907,6 +1094,10 @@
   link_vs(class_entry, rs.size()/BytesPerWord);
 }
 
+size_t VirtualSpaceList::free_bytes() {
+  return virtual_space_list()->free_words_in_vs() * BytesPerWord;
+}
+
 // Allocate another meta virtual space and add it to the list.
 bool VirtualSpaceList::grow_vs(size_t vs_word_size) {
   assert_lock_strong(SpaceManager::expand_lock());
@@ -955,8 +1146,10 @@
   // Get a chunk from the chunk freelist
   Metachunk* next = chunk_manager()->chunk_freelist_allocate(grow_chunks_by_words);
 
-  // Allocate a chunk out of the current virtual space.
-  if (next == NULL) {
+  if (next != NULL) {
+    next->container()->inc_container_count();
+  } else {
+    // Allocate a chunk out of the current virtual space.
     next = current_virtual_space()->get_chunk_vs(grow_chunks_by_words);
   }
 
@@ -1045,9 +1238,9 @@
 //
 // After the GC the compute_new_size() for MetaspaceGC is called to
 // resize the capacity of the metaspaces.  The current implementation
-// is based on the flags MinMetaspaceFreeRatio and MaxHeapFreeRatio used
+// is based on the flags MinMetaspaceFreeRatio and MaxMetaspaceFreeRatio used
 // to resize the Java heap by some GC's.  New flags can be implemented
-// if really needed.  MinHeapFreeRatio is used to calculate how much
+// if really needed.  MinMetaspaceFreeRatio is used to calculate how much
 // free space is desirable in the metaspace capacity to decide how much
 // to increase the HWM.  MaxMetaspaceFreeRatio is used to decide how much
 // free space is desirable in the metaspace capacity before decreasing
@@ -1082,7 +1275,11 @@
 }
 
 bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) {
+
+  size_t committed_capacity_bytes = MetaspaceAux::allocated_capacity_bytes();
   // If the user wants a limit, impose one.
+  size_t max_metaspace_size_bytes = MaxMetaspaceSize;
+  size_t metaspace_size_bytes = MetaspaceSize;
   if (!FLAG_IS_DEFAULT(MaxMetaspaceSize) &&
       MetaspaceAux::reserved_in_bytes() >= MaxMetaspaceSize) {
     return false;
@@ -1094,57 +1291,48 @@
 
   // If this is part of an allocation after a GC, expand
   // unconditionally.
-  if(MetaspaceGC::expand_after_GC()) {
+  if (MetaspaceGC::expand_after_GC()) {
     return true;
   }
 
-  size_t metaspace_size_words = MetaspaceSize / BytesPerWord;
+
 
   // If the capacity is below the minimum capacity, allow the
   // expansion.  Also set the high-water-mark (capacity_until_GC)
   // to that minimum capacity so that a GC will not be induced
   // until that minimum capacity is exceeded.
-  if (vsl->capacity_words_sum() < metaspace_size_words ||
+  if (committed_capacity_bytes < metaspace_size_bytes ||
       capacity_until_GC() == 0) {
-    set_capacity_until_GC(metaspace_size_words);
+    set_capacity_until_GC(metaspace_size_bytes);
     return true;
   } else {
-    if (vsl->capacity_words_sum() < capacity_until_GC()) {
+    if (committed_capacity_bytes < capacity_until_GC()) {
       return true;
     } else {
       if (TraceMetadataChunkAllocation && Verbose) {
         gclog_or_tty->print_cr("  allocation request size " SIZE_FORMAT
                         "  capacity_until_GC " SIZE_FORMAT
-                        "  capacity_words_sum " SIZE_FORMAT
-                        "  used_words_sum " SIZE_FORMAT
-                        "  free chunks " SIZE_FORMAT
-                        "  free chunks count %d",
+                        "  allocated_capacity_bytes " SIZE_FORMAT,
                         word_size,
                         capacity_until_GC(),
-                        vsl->capacity_words_sum(),
-                        vsl->used_words_sum(),
-                        vsl->chunk_manager()->free_chunks_total(),
-                        vsl->chunk_manager()->free_chunks_count());
+                        MetaspaceAux::allocated_capacity_bytes());
       }
       return false;
     }
   }
 }
 
-// Variables are in bytes
+
 
 void MetaspaceGC::compute_new_size() {
   assert(_shrink_factor <= 100, "invalid shrink factor");
   uint current_shrink_factor = _shrink_factor;
   _shrink_factor = 0;
 
-  VirtualSpaceList *vsl = Metaspace::space_list();
-
-  size_t capacity_after_gc = vsl->capacity_bytes_sum();
-  // Check to see if these two can be calculated without walking the CLDG
-  size_t used_after_gc = vsl->used_bytes_sum();
-  size_t capacity_until_GC = vsl->capacity_bytes_sum();
-  size_t free_after_gc = capacity_until_GC - used_after_gc;
+  // Until a faster way of calculating the "used" quantity is implemented,
+  // use "capacity".
+  const size_t used_after_gc = MetaspaceAux::allocated_capacity_bytes();
+  const size_t capacity_until_GC = MetaspaceGC::capacity_until_GC();
 
   const double minimum_free_percentage = MinMetaspaceFreeRatio / 100.0;
   const double maximum_used_percentage = 1.0 - minimum_free_percentage;
@@ -1157,45 +1345,34 @@
                                   MetaspaceSize);
 
   if (PrintGCDetails && Verbose) {
-    const double free_percentage = ((double)free_after_gc) / capacity_until_GC;
     gclog_or_tty->print_cr("\nMetaspaceGC::compute_new_size: ");
     gclog_or_tty->print_cr("  "
                   "  minimum_free_percentage: %6.2f"
                   "  maximum_used_percentage: %6.2f",
                   minimum_free_percentage,
                   maximum_used_percentage);
-    double d_free_after_gc = free_after_gc / (double) K;
     gclog_or_tty->print_cr("  "
-                  "   free_after_gc       : %6.1fK"
-                  "   used_after_gc       : %6.1fK"
-                  "   capacity_after_gc   : %6.1fK"
-                  "   metaspace HWM     : %6.1fK",
-                  free_after_gc / (double) K,
-                  used_after_gc / (double) K,
-                  capacity_after_gc / (double) K,
-                  capacity_until_GC / (double) K);
-    gclog_or_tty->print_cr("  "
-                  "   free_percentage: %6.2f",
-                  free_percentage);
+                  "   used_after_gc       : %6.1fKB",
+                  used_after_gc / (double) K);
   }
 
 
+  size_t shrink_bytes = 0;
   if (capacity_until_GC < minimum_desired_capacity) {
     // If we have less capacity below the metaspace HWM, then
     // increment the HWM.
     size_t expand_bytes = minimum_desired_capacity - capacity_until_GC;
     // Don't expand unless it's significant
     if (expand_bytes >= MinMetaspaceExpansion) {
-      size_t expand_words = expand_bytes / BytesPerWord;
-      MetaspaceGC::inc_capacity_until_GC(expand_words);
+      MetaspaceGC::set_capacity_until_GC(capacity_until_GC + expand_bytes);
     }
     if (PrintGCDetails && Verbose) {
-      size_t new_capacity_until_GC = MetaspaceGC::capacity_until_GC_in_bytes();
+      size_t new_capacity_until_GC = capacity_until_GC;
       gclog_or_tty->print_cr("    expanding:"
-                    "  minimum_desired_capacity: %6.1fK"
-                    "  expand_words: %6.1fK"
-                    "  MinMetaspaceExpansion: %6.1fK"
-                    "  new metaspace HWM:  %6.1fK",
+                    "  minimum_desired_capacity: %6.1fKB"
+                    "  expand_bytes: %6.1fKB"
+                    "  MinMetaspaceExpansion: %6.1fKB"
+                    "  new metaspace HWM:  %6.1fKB",
                     minimum_desired_capacity / (double) K,
                     expand_bytes / (double) K,
                     MinMetaspaceExpansion / (double) K,
@@ -1205,11 +1382,10 @@
   }
 
   // No expansion, now see if we want to shrink
-  size_t shrink_words = 0;
   // We would never want to shrink more than this
-  size_t max_shrink_words = capacity_until_GC - minimum_desired_capacity;
-  assert(max_shrink_words >= 0, err_msg("max_shrink_words " SIZE_FORMAT,
-    max_shrink_words));
+  size_t max_shrink_bytes = capacity_until_GC - minimum_desired_capacity;
+  assert(max_shrink_bytes >= 0, err_msg("max_shrink_bytes " SIZE_FORMAT,
+    max_shrink_bytes));
 
   // Should shrinking be considered?
   if (MaxMetaspaceFreeRatio < 100) {
@@ -1219,17 +1395,15 @@
     size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
     maximum_desired_capacity = MAX2(maximum_desired_capacity,
                                     MetaspaceSize);
-    if (PrintGC && Verbose) {
+    if (PrintGCDetails && Verbose) {
       gclog_or_tty->print_cr("  "
                              "  maximum_free_percentage: %6.2f"
                              "  minimum_used_percentage: %6.2f",
                              maximum_free_percentage,
                              minimum_used_percentage);
       gclog_or_tty->print_cr("  "
-                             "  capacity_until_GC: %6.1fK"
-                             "  minimum_desired_capacity: %6.1fK"
-                             "  maximum_desired_capacity: %6.1fK",
-                             capacity_until_GC / (double) K,
+                             "  minimum_desired_capacity: %6.1fKB"
+                             "  maximum_desired_capacity: %6.1fKB",
                              minimum_desired_capacity / (double) K,
                              maximum_desired_capacity / (double) K);
     }
@@ -1239,17 +1413,17 @@
 
     if (capacity_until_GC > maximum_desired_capacity) {
       // Capacity too large, compute shrinking size
-      shrink_words = capacity_until_GC - maximum_desired_capacity;
+      shrink_bytes = capacity_until_GC - maximum_desired_capacity;
       // We don't want shrink all the way back to initSize if people call
       // System.gc(), because some programs do that between "phases" and then
       // we'd just have to grow the heap up again for the next phase.  So we
       // damp the shrinking: 0% on the first call, 10% on the second call, 40%
       // on the third call, and 100% by the fourth call.  But if we recompute
       // size without shrinking, it goes back to 0%.
-      shrink_words = shrink_words / 100 * current_shrink_factor;
-      assert(shrink_words <= max_shrink_words,
+      shrink_bytes = shrink_bytes / 100 * current_shrink_factor;
+      assert(shrink_bytes <= max_shrink_bytes,
         err_msg("invalid shrink size " SIZE_FORMAT " not <= " SIZE_FORMAT,
-          shrink_words, max_shrink_words));
+          shrink_bytes, max_shrink_bytes));
       if (current_shrink_factor == 0) {
         _shrink_factor = 10;
       } else {
@@ -1263,11 +1437,11 @@
                       MetaspaceSize / (double) K,
                       maximum_desired_capacity / (double) K);
         gclog_or_tty->print_cr("  "
-                      "  shrink_words: %.1fK"
+                      "  shrink_bytes: %.1fK"
                       "  current_shrink_factor: %d"
                       "  new shrink factor: %d"
                       "  MinMetaspaceExpansion: %.1fK",
-                      shrink_words / (double) K,
+                      shrink_bytes / (double) K,
                       current_shrink_factor,
                       _shrink_factor,
                       MinMetaspaceExpansion / (double) K);
@@ -1275,23 +1449,11 @@
     }
   }
 
-
   // Don't shrink unless it's significant
-  if (shrink_words >= MinMetaspaceExpansion) {
-    VirtualSpaceNode* csp = vsl->current_virtual_space();
-    size_t available_to_shrink = csp->capacity_words_in_vs() -
-      csp->used_words_in_vs();
-    shrink_words = MIN2(shrink_words, available_to_shrink);
-    csp->shrink_by(shrink_words);
-    MetaspaceGC::dec_capacity_until_GC(shrink_words);
-    if (PrintGCDetails && Verbose) {
-      size_t new_capacity_until_GC = MetaspaceGC::capacity_until_GC_in_bytes();
-      gclog_or_tty->print_cr("  metaspace HWM: %.1fK", new_capacity_until_GC / (double) K);
-    }
+  if (shrink_bytes >= MinMetaspaceExpansion &&
+      ((capacity_until_GC - shrink_bytes) >= MetaspaceSize)) {
+    MetaspaceGC::set_capacity_until_GC(capacity_until_GC - shrink_bytes);
   }
-  assert(used_after_gc <= vsl->capacity_bytes_sum(),
-         "sanity check");
-
 }
 
 // Metadebug methods
@@ -1567,9 +1729,6 @@
       }
       // Chunk is being removed from the chunks free list.
       dec_free_chunks_total(chunk->capacity_word_size());
-#ifdef ASSERT
-      chunk->set_is_free(false);
-#endif
     } else {
       return NULL;
     }
@@ -1578,6 +1737,11 @@
   // Remove it from the links to this freelist
   chunk->set_next(NULL);
   chunk->set_prev(NULL);
+#ifdef ASSERT
+  // Chunk is no longer on any freelist. Setting to false make container_count_slow()
+  // work.
+  chunk->set_is_free(false);
+#endif
   slow_locked_verify();
   return chunk;
 }
@@ -1692,18 +1856,28 @@
 }
 
 size_t SpaceManager::sum_capacity_in_chunks_in_use() const {
-  MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
-  size_t sum = 0;
-  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
-    Metachunk* chunk = chunks_in_use(i);
-    while (chunk != NULL) {
-      // Just changed this sum += chunk->capacity_word_size();
-      // sum += chunk->word_size() - Metachunk::overhead();
-      sum += chunk->capacity_word_size();
-      chunk = chunk->next();
+  // For CMS use "allocated_chunks_words()" which does not need the
+  // Metaspace lock.  For the other collectors sum over the
+  // lists.  Use both methods as a check that "allocated_chunks_words()"
+  // is correct.  That is, sum_capacity_in_chunks() is too expensive
+  // to use in the product and allocated_chunks_words() should be used
+  // but allow for  checking that allocated_chunks_words() returns the same
+  // value as sum_capacity_in_chunks_in_use() which is the definitive
+  // answer.
+  if (UseConcMarkSweepGC) {
+    return allocated_chunks_words();
+  } else {
+    MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
+    size_t sum = 0;
+    for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+      Metachunk* chunk = chunks_in_use(i);
+      while (chunk != NULL) {
+        sum += chunk->capacity_word_size();
+        chunk = chunk->next();
+      }
     }
+  return sum;
   }
-  return sum;
 }
 
 size_t SpaceManager::sum_count_in_chunks_in_use() {
@@ -1861,12 +2035,44 @@
 SpaceManager::SpaceManager(Mutex* lock,
                            VirtualSpaceList* vs_list) :
   _vs_list(vs_list),
-  _allocation_total(0),
+  _allocated_blocks_words(0),
+  _allocated_chunks_words(0),
+  _allocated_chunks_count(0),
   _lock(lock)
 {
   initialize();
 }
 
+void SpaceManager::inc_size_metrics(size_t words) {
+  assert_lock_strong(SpaceManager::expand_lock());
+  // Total of allocated Metachunks and allocated Metachunks count
+  // for each SpaceManager
+  _allocated_chunks_words = _allocated_chunks_words + words;
+  _allocated_chunks_count++;
+  // Global total of capacity in allocated Metachunks
+  MetaspaceAux::inc_capacity(words);
+  // Global total of allocated Metablocks.
+  // used_words_slow() includes the overhead in each
+  // Metachunk so include it in the used when the
+  // Metachunk is first added (so only added once per
+  // Metachunk).
+  MetaspaceAux::inc_used(Metachunk::overhead());
+}
+
+void SpaceManager::inc_used_metrics(size_t words) {
+  // Add to the per SpaceManager total
+  Atomic::add_ptr(words, &_allocated_blocks_words);
+  // Add to the global total
+  MetaspaceAux::inc_used(words);
+}
+
+void SpaceManager::dec_total_from_size_metrics() {
+  MetaspaceAux::dec_capacity(allocated_chunks_words());
+  MetaspaceAux::dec_used(allocated_blocks_words());
+  // Also deduct the overhead per Metachunk
+  MetaspaceAux::dec_used(allocated_chunks_count() * Metachunk::overhead());
+}
+
 void SpaceManager::initialize() {
   Metadebug::init_allocation_fail_alot_count();
   for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
@@ -1887,11 +2093,13 @@
   assert_lock_strong(SpaceManager::expand_lock());
   Metachunk* cur = chunks;
 
-  // This return chunks one at a time.  If a new
+  // This returns chunks one at a time.  If a new
   // class List can be created that is a base class
   // of FreeList then something like FreeList::prepend()
   // can be used in place of this loop
   while (cur != NULL) {
+    assert(cur->container() != NULL, "Container should have been set");
+    cur->container()->dec_container_count();
     // Capture the next link before it is changed
     // by the call to return_chunk_at_head();
     Metachunk* next = cur->next();
@@ -1903,7 +2111,10 @@
 
 SpaceManager::~SpaceManager() {
   // This call this->_lock which can't be done while holding expand_lock()
-  const size_t in_use_before = sum_capacity_in_chunks_in_use();
+  assert(sum_capacity_in_chunks_in_use() == allocated_chunks_words(),
+    err_msg("sum_capacity_in_chunks_in_use() " SIZE_FORMAT
+            " allocated_chunks_words() " SIZE_FORMAT,
+            sum_capacity_in_chunks_in_use(), allocated_chunks_words()));
 
   MutexLockerEx fcl(SpaceManager::expand_lock(),
                     Mutex::_no_safepoint_check_flag);
@@ -1912,17 +2123,19 @@
 
   chunk_manager->slow_locked_verify();
 
+  dec_total_from_size_metrics();
+
   if (TraceMetadataChunkAllocation && Verbose) {
     gclog_or_tty->print_cr("~SpaceManager(): " PTR_FORMAT, this);
     locked_print_chunks_in_use_on(gclog_or_tty);
   }
 
-  // Mangle freed memory.
-  NOT_PRODUCT(mangle_freed_chunks();)
+  // Do not mangle freed Metachunks.  The chunk size inside Metachunks
+  // is during the freeing of a VirtualSpaceNodes.
 
   // Have to update before the chunks_in_use lists are emptied
   // below.
-  chunk_manager->inc_free_chunks_total(in_use_before,
+  chunk_manager->inc_free_chunks_total(allocated_chunks_words(),
                                        sum_count_in_chunks_in_use());
 
   // Add all the chunks in use by this space manager
@@ -1978,6 +2191,7 @@
                    " granularity %d",
                    humongous_chunks->word_size(), HumongousChunkGranularity));
     Metachunk* next_humongous_chunks = humongous_chunks->next();
+    humongous_chunks->container()->dec_container_count();
     chunk_manager->humongous_dictionary()->return_chunk(humongous_chunks);
     humongous_chunks = next_humongous_chunks;
   }
@@ -1987,7 +2201,6 @@
                      chunk_manager->humongous_dictionary()->total_count(),
                      chunk_size_name(HumongousIndex));
   }
-  set_chunks_in_use(HumongousIndex, NULL);
   chunk_manager->slow_locked_verify();
 }
 
@@ -2067,12 +2280,17 @@
     assert(new_chunk->word_size() > medium_chunk_size(), "List inconsistency");
   }
 
+  // Add to the running sum of capacity
+  inc_size_metrics(new_chunk->word_size());
+
   assert(new_chunk->is_empty(), "Not ready for reuse");
   if (TraceMetadataChunkAllocation && Verbose) {
     gclog_or_tty->print("SpaceManager::add_chunk: %d) ",
                         sum_count_in_chunks_in_use());
     new_chunk->print_on(gclog_or_tty);
-    vs_list()->chunk_manager()->locked_print_free_chunks(tty);
+    if (vs_list() != NULL) {
+      vs_list()->chunk_manager()->locked_print_free_chunks(tty);
+    }
   }
 }
 
@@ -2143,7 +2361,7 @@
   // of memory if this returns null.
   if (DumpSharedSpaces) {
     assert(current_chunk() != NULL, "should never happen");
-    inc_allocation_total(word_size);
+    inc_used_metrics(word_size);
     return current_chunk()->allocate(word_size); // caller handles null result
   }
   if (current_chunk() != NULL) {
@@ -2154,7 +2372,7 @@
     result = grow_and_allocate(word_size);
   }
   if (result > 0) {
-    inc_allocation_total(word_size);
+    inc_used_metrics(word_size);
     assert(result != (MetaWord*) chunks_in_use(MediumIndex),
            "Head of the list is being allocated");
   }
@@ -2188,20 +2406,14 @@
 }
 
 #ifdef ASSERT
-void SpaceManager::verify_allocation_total() {
+void SpaceManager::verify_allocated_blocks_words() {
   // Verification is only guaranteed at a safepoint.
-  if (SafepointSynchronize::is_at_safepoint()) {
-    gclog_or_tty->print_cr("Chunk " PTR_FORMAT " allocation_total " SIZE_FORMAT
-                           " sum_used_in_chunks_in_use " SIZE_FORMAT,
-                           this,
-                           allocation_total(),
-                           sum_used_in_chunks_in_use());
-  }
-  MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
-  assert(allocation_total() == sum_used_in_chunks_in_use(),
+  assert(SafepointSynchronize::is_at_safepoint() || !Universe::is_fully_initialized(),
+    "Verification can fail if the applications is running");
+  assert(allocated_blocks_words() == sum_used_in_chunks_in_use(),
     err_msg("allocation total is not consistent " SIZE_FORMAT
             " vs " SIZE_FORMAT,
-            allocation_total(), sum_used_in_chunks_in_use()));
+            allocated_blocks_words(), sum_used_in_chunks_in_use()));
 }
 
 #endif
@@ -2257,14 +2469,65 @@
 
 // MetaspaceAux
 
-size_t MetaspaceAux::used_in_bytes(Metaspace::MetadataType mdtype) {
+
+size_t MetaspaceAux::_allocated_capacity_words = 0;
+size_t MetaspaceAux::_allocated_used_words = 0;
+
+size_t MetaspaceAux::free_bytes() {
+  size_t result = 0;
+  if (Metaspace::class_space_list() != NULL) {
+    result = result + Metaspace::class_space_list()->free_bytes();
+  }
+  if (Metaspace::space_list() != NULL) {
+    result = result + Metaspace::space_list()->free_bytes();
+  }
+  return result;
+}
+
+void MetaspaceAux::dec_capacity(size_t words) {
+  assert_lock_strong(SpaceManager::expand_lock());
+  assert(words <= _allocated_capacity_words,
+    err_msg("About to decrement below 0: words " SIZE_FORMAT
+            " is greater than _allocated_capacity_words " SIZE_FORMAT,
+            words, _allocated_capacity_words));
+  _allocated_capacity_words = _allocated_capacity_words - words;
+}
+
+void MetaspaceAux::inc_capacity(size_t words) {
+  assert_lock_strong(SpaceManager::expand_lock());
+  // Needs to be atomic
+  _allocated_capacity_words = _allocated_capacity_words + words;
+}
+
+void MetaspaceAux::dec_used(size_t words) {
+  assert(words <= _allocated_used_words,
+    err_msg("About to decrement below 0: words " SIZE_FORMAT
+            " is greater than _allocated_used_words " SIZE_FORMAT,
+            words, _allocated_used_words));
+  // For CMS deallocation of the Metaspaces occurs during the
+  // sweep which is a concurrent phase.  Protection by the expand_lock()
+  // is not enough since allocation is on a per Metaspace basis
+  // and protected by the Metaspace lock.
+  jlong minus_words = (jlong) - (jlong) words;
+  Atomic::add_ptr(minus_words, &_allocated_used_words);
+}
+
+void MetaspaceAux::inc_used(size_t words) {
+  // _allocated_used_words tracks allocations for
+  // each piece of metadata.  Those allocations are
+  // generally done concurrently by different application
+  // threads so must be done atomically.
+  Atomic::add_ptr(words, &_allocated_used_words);
+}
+
+size_t MetaspaceAux::used_bytes_slow(Metaspace::MetadataType mdtype) {
   size_t used = 0;
   ClassLoaderDataGraphMetaspaceIterator iter;
   while (iter.repeat()) {
     Metaspace* msp = iter.get_next();
-    // Sum allocation_total for each metaspace
+    // Sum allocated_blocks_words for each metaspace
     if (msp != NULL) {
-      used += msp->used_words(mdtype);
+      used += msp->used_words_slow(mdtype);
     }
   }
   return used * BytesPerWord;
@@ -2282,13 +2545,15 @@
   return free * BytesPerWord;
 }
 
-size_t MetaspaceAux::capacity_in_bytes(Metaspace::MetadataType mdtype) {
-  size_t capacity = free_chunks_total(mdtype);
+size_t MetaspaceAux::capacity_bytes_slow(Metaspace::MetadataType mdtype) {
+  // Don't count the space in the freelists.  That space will be
+  // added to the capacity calculation as needed.
+  size_t capacity = 0;
   ClassLoaderDataGraphMetaspaceIterator iter;
   while (iter.repeat()) {
     Metaspace* msp = iter.get_next();
     if (msp != NULL) {
-      capacity += msp->capacity_words(mdtype);
+      capacity += msp->capacity_words_slow(mdtype);
     }
   }
   return capacity * BytesPerWord;
@@ -2315,23 +2580,30 @@
   return free_chunks_total(mdtype) * BytesPerWord;
 }
 
+size_t MetaspaceAux::free_chunks_total() {
+  return free_chunks_total(Metaspace::ClassType) +
+         free_chunks_total(Metaspace::NonClassType);
+}
+
+size_t MetaspaceAux::free_chunks_total_in_bytes() {
+  return free_chunks_total() * BytesPerWord;
+}
+
 void MetaspaceAux::print_metaspace_change(size_t prev_metadata_used) {
   gclog_or_tty->print(", [Metaspace:");
   if (PrintGCDetails && Verbose) {
     gclog_or_tty->print(" "  SIZE_FORMAT
                         "->" SIZE_FORMAT
-                        "("  SIZE_FORMAT "/" SIZE_FORMAT ")",
+                        "("  SIZE_FORMAT ")",
                         prev_metadata_used,
-                        used_in_bytes(),
-                        capacity_in_bytes(),
+                        allocated_capacity_bytes(),
                         reserved_in_bytes());
   } else {
     gclog_or_tty->print(" "  SIZE_FORMAT "K"
                         "->" SIZE_FORMAT "K"
-                        "("  SIZE_FORMAT "K/" SIZE_FORMAT "K)",
+                        "("  SIZE_FORMAT "K)",
                         prev_metadata_used / K,
-                        used_in_bytes()/ K,
-                        capacity_in_bytes()/K,
+                        allocated_capacity_bytes() / K,
                         reserved_in_bytes()/ K);
   }
 
@@ -2346,23 +2618,30 @@
   out->print_cr(" Metaspace total "
                 SIZE_FORMAT "K, used " SIZE_FORMAT "K,"
                 " reserved " SIZE_FORMAT "K",
-                capacity_in_bytes()/K, used_in_bytes()/K, reserved_in_bytes()/K);
-  out->print_cr("  data space     "
-                SIZE_FORMAT "K, used " SIZE_FORMAT "K,"
-                " reserved " SIZE_FORMAT "K",
-                capacity_in_bytes(nct)/K, used_in_bytes(nct)/K, reserved_in_bytes(nct)/K);
-  out->print_cr("  class space    "
-                SIZE_FORMAT "K, used " SIZE_FORMAT "K,"
-                " reserved " SIZE_FORMAT "K",
-                capacity_in_bytes(ct)/K, used_in_bytes(ct)/K, reserved_in_bytes(ct)/K);
+                allocated_capacity_bytes()/K, allocated_used_bytes()/K, reserved_in_bytes()/K);
+#if 0
+// The calls to capacity_bytes_slow() and used_bytes_slow() cause
+// lock ordering assertion failures with some collectors.  Do
+// not include this code until the lock ordering is fixed.
+  if (PrintGCDetails && Verbose) {
+    out->print_cr("  data space     "
+                  SIZE_FORMAT "K, used " SIZE_FORMAT "K,"
+                  " reserved " SIZE_FORMAT "K",
+                  capacity_bytes_slow(nct)/K, used_bytes_slow(nct)/K, reserved_in_bytes(nct)/K);
+    out->print_cr("  class space    "
+                  SIZE_FORMAT "K, used " SIZE_FORMAT "K,"
+                  " reserved " SIZE_FORMAT "K",
+                  capacity_bytes_slow(ct)/K, used_bytes_slow(ct)/K, reserved_in_bytes(ct)/K);
+  }
+#endif
 }
 
 // Print information for class space and data space separately.
 // This is almost the same as above.
 void MetaspaceAux::print_on(outputStream* out, Metaspace::MetadataType mdtype) {
   size_t free_chunks_capacity_bytes = free_chunks_total_in_bytes(mdtype);
-  size_t capacity_bytes = capacity_in_bytes(mdtype);
-  size_t used_bytes = used_in_bytes(mdtype);
+  size_t capacity_bytes = capacity_bytes_slow(mdtype);
+  size_t used_bytes = used_bytes_slow(mdtype);
   size_t free_bytes = free_in_bytes(mdtype);
   size_t used_and_free = used_bytes + free_bytes +
                            free_chunks_capacity_bytes;
@@ -2435,6 +2714,36 @@
   Metaspace::class_space_list()->chunk_manager()->verify();
 }
 
+void MetaspaceAux::verify_capacity() {
+#ifdef ASSERT
+  size_t running_sum_capacity_bytes = allocated_capacity_bytes();
+  // For purposes of the running sum of used, verify against capacity
+  size_t capacity_in_use_bytes = capacity_bytes_slow();
+  assert(running_sum_capacity_bytes == capacity_in_use_bytes,
+    err_msg("allocated_capacity_words() * BytesPerWord " SIZE_FORMAT
+            " capacity_bytes_slow()" SIZE_FORMAT,
+            running_sum_capacity_bytes, capacity_in_use_bytes));
+#endif
+}
+
+void MetaspaceAux::verify_used() {
+#ifdef ASSERT
+  size_t running_sum_used_bytes = allocated_used_bytes();
+  // For purposes of the running sum of used, verify against capacity
+  size_t used_in_use_bytes = used_bytes_slow();
+  assert(allocated_used_bytes() == used_in_use_bytes,
+    err_msg("allocated_used_bytes() " SIZE_FORMAT
+            " used_bytes_slow()()" SIZE_FORMAT,
+            allocated_used_bytes(), used_in_use_bytes));
+#endif
+}
+
+void MetaspaceAux::verify_metrics() {
+  verify_capacity();
+  verify_used();
+}
+
+
 // Metaspace methods
 
 size_t Metaspace::_first_chunk_word_size = 0;
@@ -2584,8 +2893,8 @@
   MetaWord* result;
   MetaspaceGC::set_expand_after_GC(true);
   size_t before_inc = MetaspaceGC::capacity_until_GC();
-  size_t delta_words = MetaspaceGC::delta_capacity_until_GC(word_size);
-  MetaspaceGC::inc_capacity_until_GC(delta_words);
+  size_t delta_bytes = MetaspaceGC::delta_capacity_until_GC(word_size) * BytesPerWord;
+  MetaspaceGC::inc_capacity_until_GC(delta_bytes);
   if (PrintGCDetails && Verbose) {
     gclog_or_tty->print_cr("Increase capacity to GC from " SIZE_FORMAT
       " to " SIZE_FORMAT, before_inc, MetaspaceGC::capacity_until_GC());
@@ -2603,8 +2912,8 @@
   return (char*)vsm()->current_chunk()->bottom();
 }
 
-size_t Metaspace::used_words(MetadataType mdtype) const {
-  // return vsm()->allocation_total();
+size_t Metaspace::used_words_slow(MetadataType mdtype) const {
+  // return vsm()->allocated_used_words();
   return mdtype == ClassType ? class_vsm()->sum_used_in_chunks_in_use() :
                                vsm()->sum_used_in_chunks_in_use();  // includes overhead!
 }
@@ -2619,16 +2928,24 @@
 // have been made. Don't include space in the global freelist and
 // in the space available in the dictionary which
 // is already counted in some chunk.
-size_t Metaspace::capacity_words(MetadataType mdtype) const {
+size_t Metaspace::capacity_words_slow(MetadataType mdtype) const {
   return mdtype == ClassType ? class_vsm()->sum_capacity_in_chunks_in_use() :
                                vsm()->sum_capacity_in_chunks_in_use();
 }
 
+size_t Metaspace::used_bytes_slow(MetadataType mdtype) const {
+  return used_words_slow(mdtype) * BytesPerWord;
+}
+
+size_t Metaspace::capacity_bytes_slow(MetadataType mdtype) const {
+  return capacity_words_slow(mdtype) * BytesPerWord;
+}
+
 void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
   if (SafepointSynchronize::is_at_safepoint()) {
     assert(Thread::current()->is_VM_thread(), "should be the VM thread");
     // Don't take Heap_lock
-    MutexLocker ml(vsm()->lock());
+    MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
     if (word_size < TreeChunk<Metablock, FreeList>::min_size()) {
       // Dark matter.  Too small for dictionary.
 #ifdef ASSERT
@@ -2642,7 +2959,7 @@
       vsm()->deallocate(ptr, word_size);
     }
   } else {
-    MutexLocker ml(vsm()->lock());
+    MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
 
     if (word_size < TreeChunk<Metablock, FreeList>::min_size()) {
       // Dark matter.  Too small for dictionary.
@@ -2716,6 +3033,13 @@
   return Metablock::initialize(result, word_size);
 }
 
+void Metaspace::purge() {
+  MutexLockerEx cl(SpaceManager::expand_lock(),
+                   Mutex::_no_safepoint_check_flag);
+  space_list()->purge();
+  class_space_list()->purge();
+}
+
 void Metaspace::print_on(outputStream* out) const {
   // Print both class virtual space counts and metaspace.
   if (Verbose) {
@@ -2733,7 +3057,8 @@
   // aren't deleted presently.  When they are, some sort of locking might
   // be needed.  Note, locking this can cause inversion problems with the
   // caller in MetaspaceObj::is_metadata() function.
-  return space_list()->contains(ptr) || class_space_list()->contains(ptr);
+  return space_list()->contains(ptr) ||
+         class_space_list()->contains(ptr);
 }
 
 void Metaspace::verify() {
@@ -2742,10 +3067,6 @@
 }
 
 void Metaspace::dump(outputStream* const out) const {
-  if (UseMallocOnly) {
-    // Just print usage for now
-    out->print_cr("usage %d", used_words(Metaspace::NonClassType));
-  }
   out->print_cr("\nVirtual space manager: " INTPTR_FORMAT, vsm());
   vsm()->dump(out);
   out->print_cr("\nClass space manager: " INTPTR_FORMAT, class_vsm());
--- a/hotspot/src/share/vm/memory/metaspace.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Wed May 08 10:10:05 2013 +0100
@@ -111,6 +111,10 @@
   SpaceManager* _class_vsm;
   SpaceManager* class_vsm() const { return _class_vsm; }
 
+  // Allocate space for metadata of type mdtype. This is space
+  // within a Metachunk and is used by
+  //   allocate(ClassLoaderData*, size_t, bool, MetadataType, TRAPS)
+  // which returns a Metablock.
   MetaWord* allocate(size_t word_size, MetadataType mdtype);
 
   // Virtual Space lists for both classes and other metadata
@@ -133,11 +137,14 @@
   static size_t first_class_chunk_word_size() { return _first_class_chunk_word_size; }
 
   char*  bottom() const;
-  size_t used_words(MetadataType mdtype) const;
+  size_t used_words_slow(MetadataType mdtype) const;
   size_t free_words(MetadataType mdtype) const;
-  size_t capacity_words(MetadataType mdtype) const;
+  size_t capacity_words_slow(MetadataType mdtype) const;
   size_t waste_words(MetadataType mdtype) const;
 
+  size_t used_bytes_slow(MetadataType mdtype) const;
+  size_t capacity_bytes_slow(MetadataType mdtype) const;
+
   static Metablock* allocate(ClassLoaderData* loader_data, size_t size,
                             bool read_only, MetadataType mdtype, TRAPS);
   void deallocate(MetaWord* ptr, size_t byte_size, bool is_class);
@@ -150,6 +157,9 @@
   static bool contains(const void *ptr);
   void dump(outputStream* const out) const;
 
+  // Free empty virtualspaces
+  static void purge();
+
   void print_on(outputStream* st) const;
   // Debugging support
   void verify();
@@ -158,28 +168,81 @@
 class MetaspaceAux : AllStatic {
 
   // Statistics for class space and data space in metaspace.
-  static size_t used_in_bytes(Metaspace::MetadataType mdtype);
+
+  // These methods iterate over the classloader data graph
+  // for the given Metaspace type.  These are slow.
+  static size_t used_bytes_slow(Metaspace::MetadataType mdtype);
   static size_t free_in_bytes(Metaspace::MetadataType mdtype);
-  static size_t capacity_in_bytes(Metaspace::MetadataType mdtype);
+  static size_t capacity_bytes_slow(Metaspace::MetadataType mdtype);
+
+  // Iterates over the virtual space list.
   static size_t reserved_in_bytes(Metaspace::MetadataType mdtype);
 
   static size_t free_chunks_total(Metaspace::MetadataType mdtype);
   static size_t free_chunks_total_in_bytes(Metaspace::MetadataType mdtype);
 
  public:
-  // Total of space allocated to metadata in all Metaspaces
-  static size_t used_in_bytes() {
-    return used_in_bytes(Metaspace::ClassType) +
-           used_in_bytes(Metaspace::NonClassType);
+  // Running sum of space in all Metachunks that has been
+  // allocated to a Metaspace.  This is used instead of
+  // iterating over all the classloaders
+  static size_t _allocated_capacity_words;
+  // Running sum of space in all Metachunks that have
+  // are being used for metadata.
+  static size_t _allocated_used_words;
+
+ public:
+  // Decrement and increment _allocated_capacity_words
+  static void dec_capacity(size_t words);
+  static void inc_capacity(size_t words);
+
+  // Decrement and increment _allocated_used_words
+  static void dec_used(size_t words);
+  static void inc_used(size_t words);
+
+  // Total of space allocated to metadata in all Metaspaces.
+  // This sums the space used in each Metachunk by
+  // iterating over the classloader data graph
+  static size_t used_bytes_slow() {
+    return used_bytes_slow(Metaspace::ClassType) +
+           used_bytes_slow(Metaspace::NonClassType);
   }
 
-  // Total of available space in all Metaspaces
-  // Total of capacity allocated to all Metaspaces.  This includes
-  // space in Metachunks not yet allocated and in the Metachunk
-  // freelist.
-  static size_t capacity_in_bytes() {
-    return capacity_in_bytes(Metaspace::ClassType) +
-           capacity_in_bytes(Metaspace::NonClassType);
+  // Used by MetaspaceCounters
+  static size_t free_chunks_total();
+  static size_t free_chunks_total_in_bytes();
+
+  static size_t allocated_capacity_words() {
+    return _allocated_capacity_words;
+  }
+  static size_t allocated_capacity_bytes() {
+    return _allocated_capacity_words * BytesPerWord;
+  }
+
+  static size_t allocated_used_words() {
+    return _allocated_used_words;
+  }
+  static size_t allocated_used_bytes() {
+    return _allocated_used_words * BytesPerWord;
+  }
+
+  static size_t free_bytes();
+
+  // Total capacity in all Metaspaces
+  static size_t capacity_bytes_slow() {
+#ifdef PRODUCT
+    // Use allocated_capacity_bytes() in PRODUCT instead of this function.
+    guarantee(false, "Should not call capacity_bytes_slow() in the PRODUCT");
+#endif
+    size_t class_capacity = capacity_bytes_slow(Metaspace::ClassType);
+    size_t non_class_capacity = capacity_bytes_slow(Metaspace::NonClassType);
+    assert(allocated_capacity_bytes() == class_capacity + non_class_capacity,
+           err_msg("bad accounting: allocated_capacity_bytes() " SIZE_FORMAT
+             " class_capacity + non_class_capacity " SIZE_FORMAT
+             " class_capacity " SIZE_FORMAT " non_class_capacity " SIZE_FORMAT,
+             allocated_capacity_bytes(), class_capacity + non_class_capacity,
+             class_capacity, non_class_capacity));
+
+    return class_capacity + non_class_capacity;
   }
 
   // Total space reserved in all Metaspaces
@@ -198,6 +261,11 @@
   static void print_waste(outputStream* out);
   static void dump(outputStream* out);
   static void verify_free_chunks();
+  // Checks that the values returned by allocated_capacity_bytes() and
+  // capacity_bytes_slow() are the same.
+  static void verify_capacity();
+  static void verify_used();
+  static void verify_metrics();
 };
 
 // Metaspace are deallocated when their class loader are GC'ed.
@@ -232,7 +300,6 @@
  public:
 
   static size_t capacity_until_GC() { return _capacity_until_GC; }
-  static size_t capacity_until_GC_in_bytes() { return _capacity_until_GC * BytesPerWord; }
   static void inc_capacity_until_GC(size_t v) { _capacity_until_GC += v; }
   static void dec_capacity_until_GC(size_t v) {
     _capacity_until_GC = _capacity_until_GC > v ? _capacity_until_GC - v : 0;
--- a/hotspot/src/share/vm/memory/metaspaceCounters.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceCounters.cpp	Wed May 08 10:10:05 2013 +0100
@@ -29,6 +29,16 @@
 
 MetaspaceCounters* MetaspaceCounters::_metaspace_counters = NULL;
 
+size_t MetaspaceCounters::calc_total_capacity() {
+  // The total capacity is the sum of
+  //   1) capacity of Metachunks in use by all Metaspaces
+  //   2) unused space at the end of each Metachunk
+  //   3) space in the freelist
+  size_t total_capacity = MetaspaceAux::allocated_capacity_bytes()
+    + MetaspaceAux::free_bytes() + MetaspaceAux::free_chunks_total_in_bytes();
+  return total_capacity;
+}
+
 MetaspaceCounters::MetaspaceCounters() :
     _capacity(NULL),
     _used(NULL),
@@ -36,8 +46,8 @@
   if (UsePerfData) {
     size_t min_capacity = MetaspaceAux::min_chunk_size();
     size_t max_capacity = MetaspaceAux::reserved_in_bytes();
-    size_t curr_capacity = MetaspaceAux::capacity_in_bytes();
-    size_t used = MetaspaceAux::used_in_bytes();
+    size_t curr_capacity = calc_total_capacity();
+    size_t used = MetaspaceAux::allocated_used_bytes();
 
     initialize(min_capacity, max_capacity, curr_capacity, used);
   }
@@ -82,15 +92,13 @@
 
 void MetaspaceCounters::update_capacity() {
   assert(UsePerfData, "Should not be called unless being used");
-  assert(_capacity != NULL, "Should be initialized");
-  size_t capacity_in_bytes = MetaspaceAux::capacity_in_bytes();
-  _capacity->set_value(capacity_in_bytes);
+  size_t total_capacity = calc_total_capacity();
+  _capacity->set_value(total_capacity);
 }
 
 void MetaspaceCounters::update_used() {
   assert(UsePerfData, "Should not be called unless being used");
-  assert(_used != NULL, "Should be initialized");
-  size_t used_in_bytes = MetaspaceAux::used_in_bytes();
+  size_t used_in_bytes = MetaspaceAux::allocated_used_bytes();
   _used->set_value(used_in_bytes);
 }
 
--- a/hotspot/src/share/vm/memory/metaspaceCounters.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceCounters.hpp	Wed May 08 10:10:05 2013 +0100
@@ -37,6 +37,7 @@
                   size_t max_capacity,
                   size_t curr_capacity,
                   size_t used);
+  size_t calc_total_capacity();
  public:
   MetaspaceCounters();
   ~MetaspaceCounters();
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed May 08 10:10:05 2013 +0100
@@ -376,18 +376,17 @@
   const char* fmt = "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT;
   Metaspace* ro_space = _loader_data->ro_metaspace();
   Metaspace* rw_space = _loader_data->rw_metaspace();
-  const size_t BPW = BytesPerWord;
 
   // Allocated size of each space (may not be all occupied)
-  const size_t ro_alloced = ro_space->capacity_words(Metaspace::NonClassType) * BPW;
-  const size_t rw_alloced = rw_space->capacity_words(Metaspace::NonClassType) * BPW;
+  const size_t ro_alloced = ro_space->capacity_bytes_slow(Metaspace::NonClassType);
+  const size_t rw_alloced = rw_space->capacity_bytes_slow(Metaspace::NonClassType);
   const size_t md_alloced = md_end-md_low;
   const size_t mc_alloced = mc_end-mc_low;
   const size_t total_alloced = ro_alloced + rw_alloced + md_alloced + mc_alloced;
 
   // Occupied size of each space.
-  const size_t ro_bytes = ro_space->used_words(Metaspace::NonClassType) * BPW;
-  const size_t rw_bytes = rw_space->used_words(Metaspace::NonClassType) * BPW;
+  const size_t ro_bytes = ro_space->used_bytes_slow(Metaspace::NonClassType);
+  const size_t rw_bytes = rw_space->used_bytes_slow(Metaspace::NonClassType);
   const size_t md_bytes = size_t(md_top - md_low);
   const size_t mc_bytes = size_t(mc_top - mc_low);
 
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Wed May 08 10:10:05 2013 +0100
@@ -218,14 +218,13 @@
 static AlwaysTrueClosure always_true;
 
 void SharedHeap::process_weak_roots(OopClosure* root_closure,
-                                    CodeBlobClosure* code_roots,
-                                    OopClosure* non_root_closure) {
+                                    CodeBlobClosure* code_roots) {
   // Global (weak) JNI handles
   JNIHandles::weak_oops_do(&always_true, root_closure);
 
   CodeCache::blobs_do(code_roots);
-    StringTable::oops_do(root_closure);
-  }
+  StringTable::oops_do(root_closure);
+}
 
 void SharedHeap::set_barrier_set(BarrierSet* bs) {
   _barrier_set = bs;
--- a/hotspot/src/share/vm/memory/sharedHeap.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/sharedHeap.hpp	Wed May 08 10:10:05 2013 +0100
@@ -249,8 +249,7 @@
   // JNI weak roots, the code cache, system dictionary, symbol table,
   // string table.
   void process_weak_roots(OopClosure* root_closure,
-                          CodeBlobClosure* code_roots,
-                          OopClosure* non_root_closure);
+                          CodeBlobClosure* code_roots);
 
   // The functions below are helper functions that a subclass of
   // "SharedHeap" can use in the implementation of its virtual
--- a/hotspot/src/share/vm/memory/universe.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1270,7 +1270,7 @@
   st->print_cr("}");
 }
 
-void Universe::verify(bool silent, VerifyOption option) {
+void Universe::verify(VerifyOption option, const char* prefix, bool silent) {
   // The use of _verify_in_progress is a temporary work around for
   // 6320749.  Don't bother with a creating a class to set and clear
   // it since it is only used in this method and the control flow is
@@ -1287,11 +1287,12 @@
   HandleMark hm;  // Handles created during verification can be zapped
   _verify_count++;
 
+  if (!silent) gclog_or_tty->print(prefix);
   if (!silent) gclog_or_tty->print("[Verifying ");
   if (!silent) gclog_or_tty->print("threads ");
   Threads::verify();
+  if (!silent) gclog_or_tty->print("heap ");
   heap()->verify(silent, option);
-
   if (!silent) gclog_or_tty->print("syms ");
   SymbolTable::verify();
   if (!silent) gclog_or_tty->print("strs ");
--- a/hotspot/src/share/vm/memory/universe.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/memory/universe.hpp	Wed May 08 10:10:05 2013 +0100
@@ -445,12 +445,12 @@
 
   // Debugging
   static bool verify_in_progress() { return _verify_in_progress; }
-  static void verify(bool silent, VerifyOption option);
-  static void verify(bool silent) {
-    verify(silent, VerifyOption_Default /* option */);
+  static void verify(VerifyOption option, const char* prefix, bool silent = VerifySilently);
+  static void verify(const char* prefix, bool silent = VerifySilently) {
+    verify(VerifyOption_Default, prefix, silent);
   }
-  static void verify() {
-    verify(false /* silent */);
+  static void verify(bool silent = VerifySilently) {
+    verify("", silent);
   }
 
   static int  verify_count()       { return _verify_count; }
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Wed May 08 10:10:05 2013 +0100
@@ -40,6 +40,7 @@
 #include "runtime/init.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/signature.hpp"
+#include "runtime/synchronizer.hpp"
 #include "runtime/vframe.hpp"
 
 ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {
@@ -69,7 +70,6 @@
 
   // only set to non-zero if constant pool is merged by RedefineClasses
   set_version(0);
-  set_lock(new Monitor(Monitor::nonleaf + 2, "A constant pool lock"));
 
   // initialize tag array
   int length = tags->length();
@@ -95,9 +95,6 @@
 void ConstantPool::release_C_heap_structures() {
   // walk constant pool and decrement symbol reference counts
   unreference_symbols();
-
-  delete _lock;
-  set_lock(NULL);
 }
 
 objArrayOop ConstantPool::resolved_references() const {
@@ -154,9 +151,6 @@
       ClassLoaderData* loader_data = pool_holder()->class_loader_data();
       set_resolved_references(loader_data->add_handle(refs_handle));
     }
-
-    // Also need to recreate the mutex.  Make sure this matches the constructor
-    set_lock(new Monitor(Monitor::nonleaf + 2, "A constant pool lock"));
   }
 }
 
@@ -167,7 +161,23 @@
   set_resolved_reference_length(
     resolved_references() != NULL ? resolved_references()->length() : 0);
   set_resolved_references(NULL);
-  set_lock(NULL);
+}
+
+oop ConstantPool::lock() {
+  if (_pool_holder) {
+    // We re-use the _pool_holder's init_lock to reduce footprint.
+    // Notes on deadlocks:
+    // [1] This lock is a Java oop, so it can be recursively locked by
+    //     the same thread without self-deadlocks.
+    // [2] Deadlock will happen if there is circular dependency between
+    //     the <clinit> of two Java classes. However, in this case,
+    //     the deadlock would have happened long before we reach
+    //     ConstantPool::lock(), so reusing init_lock does not
+    //     increase the possibility of deadlock.
+    return _pool_holder->init_lock();
+  } else {
+    return NULL;
+  }
 }
 
 int ConstantPool::cp_to_object_index(int cp_index) {
@@ -208,7 +218,9 @@
 
   Symbol* name = NULL;
   Handle       loader;
-  {  MonitorLockerEx ml(this_oop->lock());
+  {
+    oop cplock = this_oop->lock();
+    ObjectLocker ol(cplock , THREAD, cplock != NULL);
 
     if (this_oop->tag_at(which).is_unresolved_klass()) {
       if (this_oop->tag_at(which).is_unresolved_klass_in_error()) {
@@ -255,7 +267,8 @@
 
       bool throw_orig_error = false;
       {
-        MonitorLockerEx ml(this_oop->lock());
+        oop cplock = this_oop->lock();
+        ObjectLocker ol(cplock, THREAD, cplock != NULL);
 
         // some other thread has beaten us and has resolved the class.
         if (this_oop->tag_at(which).is_klass()) {
@@ -323,7 +336,8 @@
       }
       return k();
     } else {
-      MonitorLockerEx ml(this_oop->lock());
+      oop cplock = this_oop->lock();
+      ObjectLocker ol(cplock, THREAD, cplock != NULL);
       // Only updated constant pool - if it is resolved.
       do_resolve = this_oop->tag_at(which).is_unresolved_klass();
       if (do_resolve) {
@@ -619,7 +633,8 @@
                                      int tag, TRAPS) {
   ResourceMark rm;
   Symbol* error = PENDING_EXCEPTION->klass()->name();
-  MonitorLockerEx ml(this_oop->lock());  // lock cpool to change tag.
+  oop cplock = this_oop->lock();
+  ObjectLocker ol(cplock, THREAD, cplock != NULL);  // lock cpool to change tag.
 
   int error_tag = (tag == JVM_CONSTANT_MethodHandle) ?
            JVM_CONSTANT_MethodHandleInError : JVM_CONSTANT_MethodTypeInError;
@@ -780,7 +795,8 @@
   if (cache_index >= 0) {
     // Cache the oop here also.
     Handle result_handle(THREAD, result_oop);
-    MonitorLockerEx ml(this_oop->lock());  // don't know if we really need this
+    oop cplock = this_oop->lock();
+    ObjectLocker ol(cplock, THREAD, cplock != NULL);  // don't know if we really need this
     oop result = this_oop->resolved_references()->obj_at(cache_index);
     // Benign race condition:  resolved_references may already be filled in while we were trying to lock.
     // The important thing here is that all threads pick up the same result.
@@ -1043,24 +1059,13 @@
 
   case JVM_CONSTANT_InvokeDynamic:
   {
-    int k1 = invoke_dynamic_bootstrap_method_ref_index_at(index1);
-    int k2 = cp2->invoke_dynamic_bootstrap_method_ref_index_at(index2);
-    bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
-    if (!match)  return false;
-    k1 = invoke_dynamic_name_and_type_ref_index_at(index1);
-    k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2);
-    match = compare_entry_to(k1, cp2, k2, CHECK_false);
-    if (!match)  return false;
-    int argc = invoke_dynamic_argument_count_at(index1);
-    if (argc == cp2->invoke_dynamic_argument_count_at(index2)) {
-      for (int j = 0; j < argc; j++) {
-        k1 = invoke_dynamic_argument_index_at(index1, j);
-        k2 = cp2->invoke_dynamic_argument_index_at(index2, j);
-        match = compare_entry_to(k1, cp2, k2, CHECK_false);
-        if (!match)  return false;
-      }
-      return true;           // got through loop; all elements equal
-    }
+    int k1 = invoke_dynamic_name_and_type_ref_index_at(index1);
+    int k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2);
+    int i1 = invoke_dynamic_bootstrap_specifier_index(index1);
+    int i2 = cp2->invoke_dynamic_bootstrap_specifier_index(index2);
+    bool match = compare_entry_to(k1, cp2, k2, CHECK_false) &&
+                 compare_operand_to(i1, cp2, i2, CHECK_false);
+    return match;
   } break;
 
   case JVM_CONSTANT_String:
@@ -1095,6 +1100,80 @@
 } // end compare_entry_to()
 
 
+// Resize the operands array with delta_len and delta_size.
+// Used in RedefineClasses for CP merge.
+void ConstantPool::resize_operands(int delta_len, int delta_size, TRAPS) {
+  int old_len  = operand_array_length(operands());
+  int new_len  = old_len + delta_len;
+  int min_len  = (delta_len > 0) ? old_len : new_len;
+
+  int old_size = operands()->length();
+  int new_size = old_size + delta_size;
+  int min_size = (delta_size > 0) ? old_size : new_size;
+
+  ClassLoaderData* loader_data = pool_holder()->class_loader_data();
+  Array<u2>* new_ops = MetadataFactory::new_array<u2>(loader_data, new_size, CHECK);
+
+  // Set index in the resized array for existing elements only
+  for (int idx = 0; idx < min_len; idx++) {
+    int offset = operand_offset_at(idx);                       // offset in original array
+    operand_offset_at_put(new_ops, idx, offset + 2*delta_len); // offset in resized array
+  }
+  // Copy the bootstrap specifiers only
+  Copy::conjoint_memory_atomic(operands()->adr_at(2*old_len),
+                               new_ops->adr_at(2*new_len),
+                               (min_size - 2*min_len) * sizeof(u2));
+  // Explicitly deallocate old operands array.
+  // Note, it is not needed for 7u backport.
+  if ( operands() != NULL) { // the safety check
+    MetadataFactory::free_array<u2>(loader_data, operands());
+  }
+  set_operands(new_ops);
+} // end resize_operands()
+
+
+// Extend the operands array with the length and size of the ext_cp operands.
+// Used in RedefineClasses for CP merge.
+void ConstantPool::extend_operands(constantPoolHandle ext_cp, TRAPS) {
+  int delta_len = operand_array_length(ext_cp->operands());
+  if (delta_len == 0) {
+    return; // nothing to do
+  }
+  int delta_size = ext_cp->operands()->length();
+
+  assert(delta_len  > 0 && delta_size > 0, "extended operands array must be bigger");
+
+  if (operand_array_length(operands()) == 0) {
+    ClassLoaderData* loader_data = pool_holder()->class_loader_data();
+    Array<u2>* new_ops = MetadataFactory::new_array<u2>(loader_data, delta_size, CHECK);
+    // The first element index defines the offset of second part
+    operand_offset_at_put(new_ops, 0, 2*delta_len); // offset in new array
+    set_operands(new_ops);
+  } else {
+    resize_operands(delta_len, delta_size, CHECK);
+  }
+
+} // end extend_operands()
+
+
+// Shrink the operands array to a smaller array with new_len length.
+// Used in RedefineClasses for CP merge.
+void ConstantPool::shrink_operands(int new_len, TRAPS) {
+  int old_len = operand_array_length(operands());
+  if (new_len == old_len) {
+    return; // nothing to do
+  }
+  assert(new_len < old_len, "shrunken operands array must be smaller");
+
+  int free_base  = operand_next_offset_at(new_len - 1);
+  int delta_len  = new_len - old_len;
+  int delta_size = 2*delta_len + free_base - operands()->length();
+
+  resize_operands(delta_len, delta_size, CHECK);
+
+} // end shrink_operands()
+
+
 void ConstantPool::copy_operands(constantPoolHandle from_cp,
                                  constantPoolHandle to_cp,
                                  TRAPS) {
@@ -1357,6 +1436,46 @@
 } // end find_matching_entry()
 
 
+// Compare this constant pool's bootstrap specifier at idx1 to the constant pool
+// cp2's bootstrap specifier at idx2.
+bool ConstantPool::compare_operand_to(int idx1, constantPoolHandle cp2, int idx2, TRAPS) {
+  int k1 = operand_bootstrap_method_ref_index_at(idx1);
+  int k2 = cp2->operand_bootstrap_method_ref_index_at(idx2);
+  bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
+
+  if (!match) {
+    return false;
+  }
+  int argc = operand_argument_count_at(idx1);
+  if (argc == cp2->operand_argument_count_at(idx2)) {
+    for (int j = 0; j < argc; j++) {
+      k1 = operand_argument_index_at(idx1, j);
+      k2 = cp2->operand_argument_index_at(idx2, j);
+      match = compare_entry_to(k1, cp2, k2, CHECK_false);
+      if (!match) {
+        return false;
+      }
+    }
+    return true;           // got through loop; all elements equal
+  }
+  return false;
+} // end compare_operand_to()
+
+// Search constant pool search_cp for a bootstrap specifier that matches
+// this constant pool's bootstrap specifier at pattern_i index.
+// Return the index of a matching bootstrap specifier or (-1) if there is no match.
+int ConstantPool::find_matching_operand(int pattern_i,
+                    constantPoolHandle search_cp, int search_len, TRAPS) {
+  for (int i = 0; i < search_len; i++) {
+    bool found = compare_operand_to(pattern_i, search_cp, i, CHECK_(-1));
+    if (found) {
+      return i;
+    }
+  }
+  return -1;  // bootstrap specifier not found; return unused index (-1)
+} // end find_matching_operand()
+
+
 #ifndef PRODUCT
 
 const char* ConstantPool::printable_name_at(int which) {
--- a/hotspot/src/share/vm/oops/constantPool.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.hpp	Wed May 08 10:10:05 2013 +0100
@@ -111,7 +111,6 @@
     int                _version;
   } _saved;
 
-  Monitor*             _lock;
 
   void set_tags(Array<u1>* tags)               { _tags = tags; }
   void tag_at_put(int which, jbyte t)          { tags()->at_put(which, t); }
@@ -567,6 +566,47 @@
          _indy_argc_offset = 1,  // u2 argc
          _indy_argv_offset = 2   // u2 argv[argc]
   };
+
+  // These functions are used in RedefineClasses for CP merge
+
+  int operand_offset_at(int bootstrap_specifier_index) {
+    assert(0 <= bootstrap_specifier_index &&
+           bootstrap_specifier_index < operand_array_length(operands()),
+           "Corrupted CP operands");
+    return operand_offset_at(operands(), bootstrap_specifier_index);
+  }
+  int operand_bootstrap_method_ref_index_at(int bootstrap_specifier_index) {
+    int offset = operand_offset_at(bootstrap_specifier_index);
+    return operands()->at(offset + _indy_bsm_offset);
+  }
+  int operand_argument_count_at(int bootstrap_specifier_index) {
+    int offset = operand_offset_at(bootstrap_specifier_index);
+    int argc = operands()->at(offset + _indy_argc_offset);
+    return argc;
+  }
+  int operand_argument_index_at(int bootstrap_specifier_index, int j) {
+    int offset = operand_offset_at(bootstrap_specifier_index);
+    return operands()->at(offset + _indy_argv_offset + j);
+  }
+  int operand_next_offset_at(int bootstrap_specifier_index) {
+    int offset = operand_offset_at(bootstrap_specifier_index) + _indy_argv_offset
+                   + operand_argument_count_at(bootstrap_specifier_index);
+    return offset;
+  }
+  // Compare a bootsrap specifier in the operands arrays
+  bool compare_operand_to(int bootstrap_specifier_index1, constantPoolHandle cp2,
+                          int bootstrap_specifier_index2, TRAPS);
+  // Find a bootsrap specifier in the operands array
+  int find_matching_operand(int bootstrap_specifier_index, constantPoolHandle search_cp,
+                            int operands_cur_len, TRAPS);
+  // Resize the operands array with delta_len and delta_size
+  void resize_operands(int delta_len, int delta_size, TRAPS);
+  // Extend the operands array with the length and size of the ext_cp operands
+  void extend_operands(constantPoolHandle ext_cp, TRAPS);
+  // Shrink the operands array to a smaller array with new_len length
+  void shrink_operands(int new_len, TRAPS);
+
+
   int invoke_dynamic_bootstrap_method_ref_index_at(int which) {
     assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
     int op_base = invoke_dynamic_operand_base(which);
@@ -782,8 +822,17 @@
 
   void set_resolved_reference_length(int length) { _saved._resolved_reference_length = length; }
   int  resolved_reference_length() const  { return _saved._resolved_reference_length; }
-  void set_lock(Monitor* lock)            { _lock = lock; }
-  Monitor* lock()                         { return _lock; }
+
+  // lock() may return null -- constant pool updates may happen before this lock is
+  // initialized, because the _pool_holder has not been fully initialized and
+  // has not been registered into the system dictionary. In this case, no other
+  // thread can be modifying this constantpool, so no synchronization is
+  // necessary.
+  //
+  // Use cplock() like this:
+  //    oop cplock = cp->lock();
+  //    ObjectLocker ol(cplock , THREAD, cplock != NULL);
+  oop lock();
 
   // Decrease ref counts of symbols that are in the constant pool
   // when the holder class is unloaded
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Wed May 08 10:10:05 2013 +0100
@@ -266,7 +266,8 @@
   // the lock, so that when the losing writer returns, he can use the linked
   // cache entry.
 
-  MonitorLockerEx ml(cpool->lock());
+  oop cplock = cpool->lock();
+  ObjectLocker ol(cplock, Thread::current(), cplock != NULL);
   if (!is_f1_null()) {
     return;
   }
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed May 08 10:10:05 2013 +0100
@@ -54,6 +54,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/thread.inline.hpp"
+#include "services/classLoadingService.hpp"
 #include "services/threadService.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/macros.hpp"
@@ -418,25 +419,6 @@
   set_annotations(NULL);
 }
 
-volatile oop InstanceKlass::init_lock() const {
-  volatile oop lock = _init_lock;  // read once
-  assert((oop)lock != NULL || !is_not_initialized(), // initialized or in_error state
-         "only fully initialized state can have a null lock");
-  return lock;
-}
-
-// Set the initialization lock to null so the object can be GC'ed.  Any racing
-// threads to get this lock will see a null lock and will not lock.
-// That's okay because they all check for initialized state after getting
-// the lock and return.
-void InstanceKlass::fence_and_clear_init_lock() {
-  // make sure previous stores are all done, notably the init_state.
-  OrderAccess::storestore();
-  klass_oop_store(&_init_lock, NULL);
-  assert(!is_not_initialized(), "class must be initialized now");
-}
-
-
 bool InstanceKlass::should_be_initialized() const {
   return !is_initialized();
 }
@@ -473,7 +455,7 @@
 void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
   EXCEPTION_MARK;
   volatile oop init_lock = this_oop->init_lock();
-  ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
+  ObjectLocker ol(init_lock, THREAD);
 
   // abort if someone beat us to the initialization
   if (!this_oop->is_not_initialized()) return;  // note: not equivalent to is_initialized()
@@ -492,7 +474,6 @@
   } else {
     // linking successfull, mark class as initialized
     this_oop->set_init_state (fully_initialized);
-    this_oop->fence_and_clear_init_lock();
     // trace
     if (TraceClassInitialization) {
       ResourceMark rm(THREAD);
@@ -619,7 +600,7 @@
   // verification & rewriting
   {
     volatile oop init_lock = this_oop->init_lock();
-    ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
+    ObjectLocker ol(init_lock, THREAD);
     // rewritten will have been set if loader constraint error found
     // on an earlier link attempt
     // don't verify or rewrite if already rewritten
@@ -742,7 +723,7 @@
   // Step 1
   {
     volatile oop init_lock = this_oop->init_lock();
-    ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
+    ObjectLocker ol(init_lock, THREAD);
 
     Thread *self = THREAD; // it's passed the current thread
 
@@ -890,9 +871,8 @@
 
 void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
   volatile oop init_lock = this_oop->init_lock();
-  ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
+  ObjectLocker ol(init_lock, THREAD);
   this_oop->set_init_state(state);
-  this_oop->fence_and_clear_init_lock();
   ol.notify_all(CHECK);
 }
 
@@ -2312,7 +2292,29 @@
   m->clear_all_breakpoints();
 }
 
+
+void InstanceKlass::notify_unload_class(InstanceKlass* ik) {
+  // notify the debugger
+  if (JvmtiExport::should_post_class_unload()) {
+    JvmtiExport::post_class_unload(ik);
+  }
+
+  // notify ClassLoadingService of class unload
+  ClassLoadingService::notify_class_unloaded(ik);
+}
+
+void InstanceKlass::release_C_heap_structures(InstanceKlass* ik) {
+  // Clean up C heap
+  ik->release_C_heap_structures();
+  ik->constants()->release_C_heap_structures();
+}
+
 void InstanceKlass::release_C_heap_structures() {
+
+  // Can't release the constant pool here because the constant pool can be
+  // deallocated separately from the InstanceKlass for default methods and
+  // redefine classes.
+
   // Deallocate oop map cache
   if (_oop_map_cache != NULL) {
     delete _oop_map_cache;
@@ -2837,7 +2839,7 @@
   st->print(BULLET"protection domain: "); ((InstanceKlass*)this)->protection_domain()->print_value_on(st); st->cr();
   st->print(BULLET"host class:        "); host_klass()->print_value_on_maybe_null(st); st->cr();
   st->print(BULLET"signers:           "); signers()->print_value_on(st);               st->cr();
-  st->print(BULLET"init_lock:         "); ((oop)_init_lock)->print_value_on(st);             st->cr();
+  st->print(BULLET"init_lock:         "); ((oop)_init_lock)->print_value_on(st);       st->cr();
   if (source_file_name() != NULL) {
     st->print(BULLET"source file:       ");
     source_file_name()->print_value_on(st);
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed May 08 10:10:05 2013 +0100
@@ -184,8 +184,9 @@
   oop             _protection_domain;
   // Class signers.
   objArrayOop     _signers;
-  // Initialization lock.  Must be one per class and it has to be a VM internal
-  // object so java code cannot lock it (like the mirror)
+  // Lock for (1) initialization; (2) access to the ConstantPool of this class.
+  // Must be one per class and it has to be a VM internal object so java code
+  // cannot lock it (like the mirror).
   // It has to be an object not a Mutex because it's held through java calls.
   volatile oop    _init_lock;
 
@@ -236,7 +237,7 @@
     _misc_rewritten            = 1 << 0, // methods rewritten.
     _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops
     _misc_should_verify_class  = 1 << 2, // allow caching of preverification
-    _misc_is_anonymous         = 1 << 3, // has embedded _inner_classes field
+    _misc_is_anonymous         = 1 << 3, // has embedded _host_klass field
     _misc_is_contended         = 1 << 4, // marked with contended annotation
     _misc_has_default_methods  = 1 << 5  // class/superclass/implemented interfaces has default methods
   };
@@ -934,7 +935,9 @@
   // referenced by handles.
   bool on_stack() const { return _constants->on_stack(); }
 
-  void release_C_heap_structures();
+  // callbacks for actions during class unloading
+  static void notify_unload_class(InstanceKlass* ik);
+  static void release_C_heap_structures(InstanceKlass* ik);
 
   // Parallel Scavenge and Parallel Old
   PARALLEL_GC_DECLS
@@ -968,6 +971,7 @@
 #endif // INCLUDE_ALL_GCS
 
   u2 idnum_allocated_count() const      { return _idnum_allocated_count; }
+
 private:
   // initialization state
 #ifdef ASSERT
@@ -994,9 +998,10 @@
          { OrderAccess::release_store_ptr(&_methods_cached_itable_indices, indices); }
 
   // Lock during initialization
-  volatile oop init_lock() const;
-  void set_init_lock(oop value)      { klass_oop_store(&_init_lock, value); }
-  void fence_and_clear_init_lock();  // after fully_initialized
+public:
+  volatile oop init_lock() const     {return _init_lock; }
+private:
+  void set_init_lock(oop value) { klass_oop_store(&_init_lock, value); }
 
   // Offsets for memory management
   oop* adr_protection_domain() const { return (oop*)&this->_protection_domain;}
@@ -1022,6 +1027,8 @@
   // Returns the array class with this class as element type
   Klass* array_klass_impl(bool or_null, TRAPS);
 
+  // Free CHeap allocated fields.
+  void release_C_heap_structures();
 public:
   // CDS support - remove and restore oops from metadata. Oops are not shared.
   virtual void remove_unshareable_info();
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Wed May 08 10:10:05 2013 +0100
@@ -519,6 +519,9 @@
 // check if a method is a miranda method, given a class's methods table and it's super
 // the caller must make sure that the method belongs to an interface implemented by the class
 bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods, Klass* super) {
+  if (m->is_static()) {
+    return false;
+  }
   Symbol* name = m->name();
   Symbol* signature = m->signature();
   if (InstanceKlass::find_method(class_methods, name, signature) == NULL) {
--- a/hotspot/src/share/vm/oops/method.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/oops/method.cpp	Wed May 08 10:10:05 2013 +0100
@@ -877,7 +877,7 @@
   debug_only(No_Safepoint_Verifier nsv;)
   nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code);
   if (code == NULL && UseCodeCacheFlushing) {
-    nmethod *saved_code = CodeCache::find_and_remove_saved_code(this);
+    nmethod *saved_code = CodeCache::reanimate_saved_code(this);
     if (saved_code != NULL) {
       methodHandle method(this);
       assert( ! saved_code->is_osr_method(), "should not get here for osr" );
--- a/hotspot/src/share/vm/oops/oop.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/oops/oop.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,11 +103,17 @@
 
 // When String table needs to rehash
 unsigned int oopDesc::new_hash(jint seed) {
+  EXCEPTION_MARK;
   ResourceMark rm;
   int length;
-  jchar* chars = java_lang_String::as_unicode_string(this, length);
-  // Use alternate hashing algorithm on the string
-  return AltHashing::murmur3_32(seed, chars, length);
+  jchar* chars = java_lang_String::as_unicode_string(this, length, THREAD);
+  if (chars != NULL) {
+    // Use alternate hashing algorithm on the string
+    return AltHashing::murmur3_32(seed, chars, length);
+  } else {
+    vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "unable to create Unicode strings for String table rehash");
+    return 0;
+  }
 }
 
 VerifyOopClosure VerifyOopClosure::verify_oop;
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Wed May 08 10:10:05 2013 +0100
@@ -3564,7 +3564,8 @@
 
   Node* no_ctrl = NULL;
   Node* no_base = __ top();
-  Node* zero = __ ConI(0);
+  Node* zero  = __ ConI(0);
+  Node* zeroX = __ ConX(0);
 
   float likely  = PROB_LIKELY(0.999);
   float unlikely  = PROB_UNLIKELY(0.999);
@@ -3590,7 +3591,9 @@
 
   // if (!marking)
   __ if_then(marking, BoolTest::ne, zero); {
-    Node* index   = __ load(__ ctrl(), index_adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw);
+    BasicType index_bt = TypeX_X->basic_type();
+    assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 PtrQueue::_index with wrong size.");
+    Node* index   = __ load(__ ctrl(), index_adr, TypeX_X, index_bt, Compile::AliasIdxRaw);
 
     if (do_load) {
       // load original value
@@ -3603,22 +3606,16 @@
       Node* buffer  = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw);
 
       // is the queue for this thread full?
-      __ if_then(index, BoolTest::ne, zero, likely); {
+      __ if_then(index, BoolTest::ne, zeroX, likely); {
 
         // decrement the index
-        Node* next_index = __ SubI(index,  __ ConI(sizeof(intptr_t)));
-        Node* next_indexX = next_index;
-#ifdef _LP64
-        // We could refine the type for what it's worth
-        // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue);
-        next_indexX = _gvn.transform( new (C) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) );
-#endif
+        Node* next_index = _gvn.transform(new (C) SubXNode(index, __ ConX(sizeof(intptr_t))));
 
         // Now get the buffer location we will log the previous value into and store it
-        Node *log_addr = __ AddP(no_base, buffer, next_indexX);
+        Node *log_addr = __ AddP(no_base, buffer, next_index);
         __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw);
         // update the index
-        __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw);
+        __ store(__ ctrl(), index_adr, next_index, index_bt, Compile::AliasIdxRaw);
 
       } __ else_(); {
 
@@ -3645,26 +3642,21 @@
                             Node* buffer,
                             const TypeFunc* tf) {
 
-  Node* zero = __ ConI(0);
+  Node* zero  = __ ConI(0);
+  Node* zeroX = __ ConX(0);
   Node* no_base = __ top();
   BasicType card_bt = T_BYTE;
   // Smash zero into card. MUST BE ORDERED WRT TO STORE
   __ storeCM(__ ctrl(), card_adr, zero, oop_store, oop_alias_idx, card_bt, Compile::AliasIdxRaw);
 
   //  Now do the queue work
-  __ if_then(index, BoolTest::ne, zero); {
-
-    Node* next_index = __ SubI(index, __ ConI(sizeof(intptr_t)));
-    Node* next_indexX = next_index;
-#ifdef _LP64
-    // We could refine the type for what it's worth
-    // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue);
-    next_indexX = _gvn.transform( new (C) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) );
-#endif // _LP64
-    Node* log_addr = __ AddP(no_base, buffer, next_indexX);
+  __ if_then(index, BoolTest::ne, zeroX); {
+
+    Node* next_index = _gvn.transform(new (C) SubXNode(index, __ ConX(sizeof(intptr_t))));
+    Node* log_addr = __ AddP(no_base, buffer, next_index);
 
     __ store(__ ctrl(), log_addr, card_adr, T_ADDRESS, Compile::AliasIdxRaw);
-    __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw);
+    __ store(__ ctrl(), index_adr, next_index, TypeX_X->basic_type(), Compile::AliasIdxRaw);
 
   } __ else_(); {
     __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), "g1_wb_post", card_adr, __ thread());
@@ -3725,7 +3717,7 @@
   // Now some values
   // Use ctrl to avoid hoisting these values past a safepoint, which could
   // potentially reset these fields in the JavaThread.
-  Node* index  = __ load(__ ctrl(), index_adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw);
+  Node* index  = __ load(__ ctrl(), index_adr, TypeX_X, TypeX_X->basic_type(), Compile::AliasIdxRaw);
   Node* buffer = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw);
 
   // Convert the store obj pointer to an int prior to doing math on it
--- a/hotspot/src/share/vm/opto/output.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/opto/output.cpp	Wed May 08 10:10:05 2013 +0100
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "asm/assembler.inline.hpp"
+#include "code/compiledIC.hpp"
 #include "code/debugInfo.hpp"
 #include "code/debugInfoRec.hpp"
 #include "compiler/compileBroker.hpp"
@@ -41,8 +42,6 @@
 #include "runtime/handles.inline.hpp"
 #include "utilities/xmlstream.hpp"
 
-extern uint size_java_to_interp();
-extern uint reloc_java_to_interp();
 extern uint size_exception_handler();
 extern uint size_deopt_handler();
 
@@ -389,15 +388,15 @@
         MachNode *mach = nj->as_Mach();
         blk_size += (mach->alignment_required() - 1) * relocInfo::addr_unit(); // assume worst case padding
         reloc_size += mach->reloc();
-        if( mach->is_MachCall() ) {
+        if (mach->is_MachCall()) {
           MachCallNode *mcall = mach->as_MachCall();
           // This destination address is NOT PC-relative
 
           mcall->method_set((intptr_t)mcall->entry_point());
 
-          if( mcall->is_MachCallJava() && mcall->as_MachCallJava()->_method ) {
-            stub_size  += size_java_to_interp();
-            reloc_size += reloc_java_to_interp();
+          if (mcall->is_MachCallJava() && mcall->as_MachCallJava()->_method) {
+            stub_size  += CompiledStaticCall::to_interp_stub_size();
+            reloc_size += CompiledStaticCall::reloc_to_interp_stub();
           }
         } else if (mach->is_MachSafePoint()) {
           // If call/safepoint are adjacent, account for possible
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Wed May 08 10:10:05 2013 +0100
@@ -259,7 +259,8 @@
       // bytes to the InstanceKlass here because they have not been
       // validated and we're not at a safepoint.
       constantPoolHandle  constants(current_thread, ikh->constants());
-      MonitorLockerEx ml(constants->lock());    // lock constant pool while we query it
+      oop cplock = constants->lock();
+      ObjectLocker ol(cplock, current_thread, cplock != NULL);    // lock constant pool while we query it
 
       JvmtiClassFileReconstituter reconstituter(ikh);
       if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
@@ -2417,7 +2418,8 @@
 
   instanceKlassHandle ikh(thread, k_oop);
   constantPoolHandle  constants(thread, ikh->constants());
-  MonitorLockerEx ml(constants->lock());    // lock constant pool while we query it
+  oop cplock = constants->lock();
+  ObjectLocker ol(cplock, thread, cplock != NULL);    // lock constant pool while we query it
 
   JvmtiConstantPoolReconstituter reconstituter(ikh);
   if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed May 08 10:10:05 2013 +0100
@@ -415,20 +415,26 @@
     // this is an indirect CP entry so it needs special handling
     case JVM_CONSTANT_InvokeDynamic:
     {
-      // TBD: cross-checks and possible extra appends into CP and bsm operands
-      // are needed as well. This issue is tracked by a separate bug 8007037.
-      int bss_idx = scratch_cp->invoke_dynamic_bootstrap_specifier_index(scratch_i);
-
-      int ref_i = scratch_cp->invoke_dynamic_name_and_type_ref_index_at(scratch_i);
-      int new_ref_i = find_or_append_indirect_entry(scratch_cp, ref_i, merge_cp_p,
+      // Index of the bootstrap specifier in the operands array
+      int old_bs_i = scratch_cp->invoke_dynamic_bootstrap_specifier_index(scratch_i);
+      int new_bs_i = find_or_append_operand(scratch_cp, old_bs_i, merge_cp_p,
+                                            merge_cp_length_p, THREAD);
+      // The bootstrap method NameAndType_info index
+      int old_ref_i = scratch_cp->invoke_dynamic_name_and_type_ref_index_at(scratch_i);
+      int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p,
                                                     merge_cp_length_p, THREAD);
-      if (new_ref_i != ref_i) {
+      if (new_bs_i != old_bs_i) {
         RC_TRACE(0x00080000,
-                 ("InvokeDynamic entry@%d name_and_type ref_index change: %d to %d",
-                  *merge_cp_length_p, ref_i, new_ref_i));
+                 ("InvokeDynamic entry@%d bootstrap_method_attr_index change: %d to %d",
+                  *merge_cp_length_p, old_bs_i, new_bs_i));
       }
-
-      (*merge_cp_p)->invoke_dynamic_at_put(*merge_cp_length_p, bss_idx, new_ref_i);
+      if (new_ref_i != old_ref_i) {
+        RC_TRACE(0x00080000,
+                 ("InvokeDynamic entry@%d name_and_type_index change: %d to %d",
+                  *merge_cp_length_p, old_ref_i, new_ref_i));
+      }
+
+      (*merge_cp_p)->invoke_dynamic_at_put(*merge_cp_length_p, new_bs_i, new_ref_i);
       if (scratch_i != *merge_cp_length_p) {
         // The new entry in *merge_cp_p is at a different index than
         // the new entry in scratch_cp so we need to map the index values.
@@ -492,6 +498,105 @@
 } // end find_or_append_indirect_entry()
 
 
+// Append a bootstrap specifier into the merge_cp operands that is semantically equal
+// to the scratch_cp operands bootstrap specifier passed by the old_bs_i index.
+// Recursively append new merge_cp entries referenced by the new bootstrap specifier.
+void VM_RedefineClasses::append_operand(constantPoolHandle scratch_cp, int old_bs_i,
+       constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS) {
+
+  int old_ref_i = scratch_cp->operand_bootstrap_method_ref_index_at(old_bs_i);
+  int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p,
+                                                merge_cp_length_p, THREAD);
+  if (new_ref_i != old_ref_i) {
+    RC_TRACE(0x00080000,
+             ("operands entry@%d bootstrap method ref_index change: %d to %d",
+              _operands_cur_length, old_ref_i, new_ref_i));
+  }
+
+  Array<u2>* merge_ops = (*merge_cp_p)->operands();
+  int new_bs_i = _operands_cur_length;
+  // We have _operands_cur_length == 0 when the merge_cp operands is empty yet.
+  // However, the operand_offset_at(0) was set in the extend_operands() call.
+  int new_base = (new_bs_i == 0) ? (*merge_cp_p)->operand_offset_at(0)
+                                 : (*merge_cp_p)->operand_next_offset_at(new_bs_i - 1);
+  int argc     = scratch_cp->operand_argument_count_at(old_bs_i);
+
+  ConstantPool::operand_offset_at_put(merge_ops, _operands_cur_length, new_base);
+  merge_ops->at_put(new_base++, new_ref_i);
+  merge_ops->at_put(new_base++, argc);
+
+  for (int i = 0; i < argc; i++) {
+    int old_arg_ref_i = scratch_cp->operand_argument_index_at(old_bs_i, i);
+    int new_arg_ref_i = find_or_append_indirect_entry(scratch_cp, old_arg_ref_i, merge_cp_p,
+                                                      merge_cp_length_p, THREAD);
+    merge_ops->at_put(new_base++, new_arg_ref_i);
+    if (new_arg_ref_i != old_arg_ref_i) {
+      RC_TRACE(0x00080000,
+               ("operands entry@%d bootstrap method argument ref_index change: %d to %d",
+                _operands_cur_length, old_arg_ref_i, new_arg_ref_i));
+    }
+  }
+  if (old_bs_i != _operands_cur_length) {
+    // The bootstrap specifier in *merge_cp_p is at a different index than
+    // that in scratch_cp so we need to map the index values.
+    map_operand_index(old_bs_i, new_bs_i);
+  }
+  _operands_cur_length++;
+} // end append_operand()
+
+
+int VM_RedefineClasses::find_or_append_operand(constantPoolHandle scratch_cp,
+      int old_bs_i, constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS) {
+
+  int new_bs_i = old_bs_i; // bootstrap specifier index
+  bool match = (old_bs_i < _operands_cur_length) &&
+               scratch_cp->compare_operand_to(old_bs_i, *merge_cp_p, old_bs_i, THREAD);
+
+  if (!match) {
+    // forward reference in *merge_cp_p or not a direct match
+    int found_i = scratch_cp->find_matching_operand(old_bs_i, *merge_cp_p,
+                                                    _operands_cur_length, THREAD);
+    if (found_i != -1) {
+      guarantee(found_i != old_bs_i, "compare_operand_to() and find_matching_operand() disagree");
+      // found a matching operand somewhere else in *merge_cp_p so just need a mapping
+      new_bs_i = found_i;
+      map_operand_index(old_bs_i, found_i);
+    } else {
+      // no match found so we have to append this bootstrap specifier to *merge_cp_p
+      append_operand(scratch_cp, old_bs_i, merge_cp_p, merge_cp_length_p, THREAD);
+      new_bs_i = _operands_cur_length - 1;
+    }
+  }
+  return new_bs_i;
+} // end find_or_append_operand()
+
+
+void VM_RedefineClasses::finalize_operands_merge(constantPoolHandle merge_cp, TRAPS) {
+  if (merge_cp->operands() == NULL) {
+    return;
+  }
+  // Shrink the merge_cp operands
+  merge_cp->shrink_operands(_operands_cur_length, CHECK);
+
+  if (RC_TRACE_ENABLED(0x00040000)) {
+    // don't want to loop unless we are tracing
+    int count = 0;
+    for (int i = 1; i < _operands_index_map_p->length(); i++) {
+      int value = _operands_index_map_p->at(i);
+      if (value != -1) {
+        RC_TRACE_WITH_THREAD(0x00040000, THREAD,
+          ("operands_index_map[%d]: old=%d new=%d", count, i, value));
+        count++;
+      }
+    }
+  }
+  // Clean-up
+  _operands_index_map_p = NULL;
+  _operands_cur_length = 0;
+  _operands_index_map_count = 0;
+} // end finalize_operands_merge()
+
+
 jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
              instanceKlassHandle the_class,
              instanceKlassHandle scratch_class) {
@@ -765,6 +870,31 @@
 } // end find_new_index()
 
 
+// Find new bootstrap specifier index value for old bootstrap specifier index
+// value by seaching the index map. Returns unused index (-1) if there is
+// no mapped value for the old bootstrap specifier index.
+int VM_RedefineClasses::find_new_operand_index(int old_index) {
+  if (_operands_index_map_count == 0) {
+    // map is empty so nothing can be found
+    return -1;
+  }
+
+  if (old_index == -1 || old_index >= _operands_index_map_p->length()) {
+    // The old_index is out of range so it is not mapped.
+    // This should not happen in regular constant pool merging use.
+    return -1;
+  }
+
+  int value = _operands_index_map_p->at(old_index);
+  if (value == -1) {
+    // the old_index is not mapped
+    return -1;
+  }
+
+  return value;
+} // end find_new_operand_index()
+
+
 // Returns true if the current mismatch is due to a resolved/unresolved
 // class pair. Otherwise, returns false.
 bool VM_RedefineClasses::is_unresolved_class_mismatch(constantPoolHandle cp1,
@@ -1014,6 +1144,25 @@
 } // end map_index()
 
 
+// Map old_index to new_index as needed.
+void VM_RedefineClasses::map_operand_index(int old_index, int new_index) {
+  if (find_new_operand_index(old_index) != -1) {
+    // old_index is already mapped
+    return;
+  }
+
+  if (old_index == new_index) {
+    // no mapping is needed
+    return;
+  }
+
+  _operands_index_map_p->at_put(old_index, new_index);
+  _operands_index_map_count++;
+
+  RC_TRACE(0x00040000, ("mapped bootstrap specifier at index %d to %d", old_index, new_index));
+} // end map_index()
+
+
 // Merge old_cp and scratch_cp and return the results of the merge via
 // merge_cp_p. The number of entries in *merge_cp_p is returned via
 // merge_cp_length_p. The entries in old_cp occupy the same locations
@@ -1086,6 +1235,7 @@
     } // end for each old_cp entry
 
     ConstantPool::copy_operands(old_cp, *merge_cp_p, CHECK_0);
+    (*merge_cp_p)->extend_operands(scratch_cp, CHECK_0);
 
     // We don't need to sanity check that *merge_cp_length_p is within
     // *merge_cp_p bounds since we have the minimum on-entry check above.
@@ -1198,6 +1348,8 @@
         CHECK_0);
     }
 
+    finalize_operands_merge(*merge_cp_p, THREAD);
+
     RC_TRACE_WITH_THREAD(0x00020000, THREAD,
       ("after pass 1b: merge_cp_len=%d, scratch_i=%d, index_map_len=%d",
       *merge_cp_length_p, scratch_i, _index_map_count));
@@ -1270,6 +1422,11 @@
   _index_map_count = 0;
   _index_map_p = new intArray(scratch_cp->length(), -1);
 
+  _operands_cur_length = ConstantPool::operand_array_length(old_cp->operands());
+  _operands_index_map_count = 0;
+  _operands_index_map_p = new intArray(
+    ConstantPool::operand_array_length(scratch_cp->operands()), -1);
+
   // reference to the cp holder is needed for copy_operands()
   merge_cp->set_pool_holder(scratch_class());
   bool result = merge_constant_pools(old_cp, scratch_cp, &merge_cp,
@@ -1400,7 +1557,6 @@
   return true;
 } // end rewrite_cp_refs()
 
-
 // Rewrite constant pool references in the methods.
 bool VM_RedefineClasses::rewrite_cp_refs_in_methods(
        instanceKlassHandle scratch_class, TRAPS) {
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Wed May 08 10:10:05 2013 +0100
@@ -359,8 +359,15 @@
   // _index_map_p contains any entries.
   int                         _index_map_count;
   intArray *                  _index_map_p;
+
+  // _operands_index_map_count is just an optimization for knowing if
+  // _operands_index_map_p contains any entries.
+  int                         _operands_cur_length;
+  int                         _operands_index_map_count;
+  intArray *                  _operands_index_map_p;
+
   // ptr to _class_count scratch_classes
-  Klass**                   _scratch_classes;
+  Klass**                     _scratch_classes;
   jvmtiError                  _res;
 
   // Performance measurement support. These timers do not cover all
@@ -422,12 +429,19 @@
   // Support for constant pool merging (these routines are in alpha order):
   void append_entry(constantPoolHandle scratch_cp, int scratch_i,
     constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
+  void append_operand(constantPoolHandle scratch_cp, int scratch_bootstrap_spec_index,
+    constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
+  void finalize_operands_merge(constantPoolHandle merge_cp, TRAPS);
   int find_or_append_indirect_entry(constantPoolHandle scratch_cp, int scratch_i,
     constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
+  int find_or_append_operand(constantPoolHandle scratch_cp, int scratch_bootstrap_spec_index,
+    constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
   int find_new_index(int old_index);
+  int find_new_operand_index(int old_bootstrap_spec_index);
   bool is_unresolved_class_mismatch(constantPoolHandle cp1, int index1,
     constantPoolHandle cp2, int index2);
   void map_index(constantPoolHandle scratch_cp, int old_index, int new_index);
+  void map_operand_index(int old_bootstrap_spec_index, int new_bootstrap_spec_index);
   bool merge_constant_pools(constantPoolHandle old_cp,
     constantPoolHandle scratch_cp, constantPoolHandle *merge_cp_p,
     int *merge_cp_length_p, TRAPS);
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Wed May 08 10:10:05 2013 +0100
@@ -153,7 +153,8 @@
     size_t s = initial_size * sizeof(JvmtiTagHashmapEntry*);
     _table = (JvmtiTagHashmapEntry**)os::malloc(s, mtInternal);
     if (_table == NULL) {
-      vm_exit_out_of_memory(s, "unable to allocate initial hashtable for jvmti object tags");
+      vm_exit_out_of_memory(s, OOM_MALLOC_ERROR,
+        "unable to allocate initial hashtable for jvmti object tags");
     }
     for (int i=0; i<initial_size; i++) {
       _table[i] = NULL;
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Wed May 08 10:10:05 2013 +0100
@@ -67,7 +67,8 @@
   TraceTime timer("MethodHandles adapters generation", TraceStartupTime);
   _adapter_code = MethodHandlesAdapterBlob::create(adapter_code_size);
   if (_adapter_code == NULL)
-    vm_exit_out_of_memory(adapter_code_size, "CodeCache: no room for MethodHandles adapters");
+    vm_exit_out_of_memory(adapter_code_size, OOM_MALLOC_ERROR,
+                          "CodeCache: no room for MethodHandles adapters");
   {
     CodeBuffer code(_adapter_code);
     MethodHandlesAdapterGenerator g(&code);
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -310,12 +310,8 @@
 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
   ResourceMark rm(THREAD);
   int len;
-  jchar* name = java_lang_String::as_unicode_string(JNIHandles::resolve(javaString), len);
-  oop found_string = StringTable::the_table()->lookup(name, len);
-  if (found_string == NULL) {
-        return false;
-  }
-  return true;
+  jchar* name = java_lang_String::as_unicode_string(JNIHandles::resolve(javaString), len, CHECK_false);
+  return (StringTable::lookup(name, len) != NULL);
 WB_END
 
 
@@ -324,6 +320,11 @@
   Universe::heap()->collect(GCCause::_last_ditch_collection);
 WB_END
 
+
+WB_ENTRY(jlong, WB_ReserveMemory(JNIEnv* env, jobject o, jlong size))
+  return (jlong)os::reserve_memory(size, NULL, 0);
+WB_END
+
 //Some convenience methods to deal with objects from java
 int WhiteBox::offset_for_field(const char* field_name, oop object,
     Symbol* signature_symbol) {
@@ -425,6 +426,8 @@
       CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_ClearMethodState},
   {CC"isInStringTable",   CC"(Ljava/lang/String;)Z",  (void*)&WB_IsInStringTable  },
   {CC"fullGC",   CC"()V",                             (void*)&WB_FullGC },
+
+  {CC"reserveMemory", CC"(J)J", (void*)&WB_ReserveMemory },
 };
 
 #undef CC
@@ -436,9 +439,29 @@
       instanceKlassHandle ikh = instanceKlassHandle(JNIHandles::resolve(wbclass)->klass());
       Handle loader(ikh->class_loader());
       if (loader.is_null()) {
+        ResourceMark rm;
         ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
-        jint result = env->RegisterNatives(wbclass, methods, sizeof(methods)/sizeof(methods[0]));
-        if (result == 0) {
+        bool result = true;
+        //  one by one registration natives for exception catching
+        jclass exceptionKlass = env->FindClass(vmSymbols::java_lang_NoSuchMethodError()->as_C_string());
+        for (int i = 0, n = sizeof(methods) / sizeof(methods[0]); i < n; ++i) {
+          if (env->RegisterNatives(wbclass, methods + i, 1) != 0) {
+            result = false;
+            if (env->ExceptionCheck() && env->IsInstanceOf(env->ExceptionOccurred(), exceptionKlass)) {
+              // j.l.NoSuchMethodError is thrown when a method can't be found or a method is not native
+              // ignoring the exception
+              tty->print_cr("Warning: 'NoSuchMethodError' on register of sun.hotspot.WhiteBox::%s%s", methods[i].name, methods[i].signature);
+              env->ExceptionClear();
+            } else {
+              // register is failed w/o exception or w/ unexpected exception
+              tty->print_cr("Warning: unexpected error on register of sun.hotspot.WhiteBox::%s%s. All methods will be unregistered", methods[i].name, methods[i].signature);
+              env->UnregisterNatives(wbclass);
+              break;
+            }
+          }
+        }
+
+        if (result) {
           WhiteBox::set_used();
         }
       }
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed May 08 10:10:05 2013 +0100
@@ -2224,6 +2224,55 @@
   return JNI_OK;
 }
 
+// Checks if name in command-line argument -agent{lib,path}:name[=options]
+// represents a valid HPROF of JDWP agent.  is_path==true denotes that we
+// are dealing with -agentpath (case where name is a path), otherwise with
+// -agentlib
+bool valid_hprof_or_jdwp_agent(char *name, bool is_path) {
+  char *_name;
+  const char *_hprof = "hprof", *_jdwp = "jdwp";
+  size_t _len_hprof, _len_jdwp, _len_prefix;
+
+  if (is_path) {
+    if ((_name = strrchr(name, (int) *os::file_separator())) == NULL) {
+      return false;
+    }
+
+    _name++;  // skip past last path separator
+    _len_prefix = strlen(JNI_LIB_PREFIX);
+
+    if (strncmp(_name, JNI_LIB_PREFIX, _len_prefix) != 0) {
+      return false;
+    }
+
+    _name += _len_prefix;
+    _len_hprof = strlen(_hprof);
+    _len_jdwp = strlen(_jdwp);
+
+    if (strncmp(_name, _hprof, _len_hprof) == 0) {
+      _name += _len_hprof;
+    }
+    else if (strncmp(_name, _jdwp, _len_jdwp) == 0) {
+      _name += _len_jdwp;
+    }
+    else {
+      return false;
+    }
+
+    if (strcmp(_name, JNI_LIB_SUFFIX) != 0) {
+      return false;
+    }
+
+    return true;
+  }
+
+  if (strcmp(name, _hprof) == 0 || strcmp(name, _jdwp) == 0) {
+    return true;
+  }
+
+  return false;
+}
+
 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
                                        SysClassPath* scp_p,
                                        bool* scp_assembly_required_p,
@@ -2322,7 +2371,7 @@
           options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1, mtInternal), pos + 1);
         }
 #if !INCLUDE_JVMTI
-        if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
+        if (valid_hprof_or_jdwp_agent(name, is_absolute_path)) {
           jio_fprintf(defaultStream::error_stream(),
             "Profiling and debugging agents are not supported in this VM\n");
           return JNI_ERR;
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Wed May 08 10:10:05 2013 +0100
@@ -109,6 +109,9 @@
 
 // Returns true if m is allowed to be compiled
 bool CompilationPolicy::can_be_compiled(methodHandle m, int comp_level) {
+  // allow any levels for WhiteBox
+  assert(WhiteBoxAPI || comp_level == CompLevel_all || is_compile(comp_level), "illegal compilation level");
+
   if (m->is_abstract()) return false;
   if (DontCompileHugeMethods && m->code_size() > HugeMethodLimit) return false;
 
@@ -122,7 +125,13 @@
     return false;
   }
   if (comp_level == CompLevel_all) {
-    return !m->is_not_compilable(CompLevel_simple) && !m->is_not_compilable(CompLevel_full_optimization);
+    if (TieredCompilation) {
+      // enough to be compilable at any level for tiered
+      return !m->is_not_compilable(CompLevel_simple) || !m->is_not_compilable(CompLevel_full_optimization);
+    } else {
+      // must be compilable at available level for non-tiered
+      return !m->is_not_compilable(CompLevel_highest_tier);
+    }
   } else if (is_compile(comp_level)) {
     return !m->is_not_compilable(comp_level);
   }
@@ -436,7 +445,7 @@
   reset_counter_for_invocation_event(m);
   const char* comment = "count";
 
-  if (is_compilation_enabled() && can_be_compiled(m)) {
+  if (is_compilation_enabled() && can_be_compiled(m, comp_level)) {
     nmethod* nm = m->code();
     if (nm == NULL ) {
       CompileBroker::compile_method(m, InvocationEntryBci, comp_level, m, hot_count, comment, thread);
@@ -449,7 +458,7 @@
   const int hot_count = m->backedge_count();
   const char* comment = "backedge_count";
 
-  if (is_compilation_enabled() && !m->is_not_osr_compilable(comp_level) && can_be_compiled(m)) {
+  if (is_compilation_enabled() && !m->is_not_osr_compilable(comp_level) && can_be_compiled(m, comp_level)) {
     CompileBroker::compile_method(m, bci, comp_level, m, hot_count, comment, thread);
     NOT_PRODUCT(trace_osr_completion(m->lookup_osr_nmethod_for(bci, comp_level, true));)
   }
@@ -467,7 +476,7 @@
   reset_counter_for_invocation_event(m);
   const char* comment = "count";
 
-  if (is_compilation_enabled() && m->code() == NULL && can_be_compiled(m)) {
+  if (is_compilation_enabled() && m->code() == NULL && can_be_compiled(m, comp_level)) {
     ResourceMark rm(thread);
     frame       fr     = thread->last_frame();
     assert(fr.is_interpreted_frame(), "must be interpreted");
@@ -505,7 +514,7 @@
   const int hot_count = m->backedge_count();
   const char* comment = "backedge_count";
 
-  if (is_compilation_enabled() && !m->is_not_osr_compilable(comp_level) && can_be_compiled(m)) {
+  if (is_compilation_enabled() && !m->is_not_osr_compilable(comp_level) && can_be_compiled(m, comp_level)) {
     CompileBroker::compile_method(m, bci, comp_level, m, hot_count, comment, thread);
     NOT_PRODUCT(trace_osr_completion(m->lookup_osr_nmethod_for(bci, comp_level, true));)
   }
@@ -600,7 +609,7 @@
 
     // If the caller method is too big or something then we do not want to
     // compile it just to inline a method
-    if (!can_be_compiled(next_m)) {
+    if (!can_be_compiled(next_m, CompLevel_any)) {
       msg = "caller cannot be compiled";
       break;
     }
--- a/hotspot/src/share/vm/runtime/globals.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed May 08 10:10:05 2013 +0100
@@ -2123,6 +2123,9 @@
   product(intx, PrefetchFieldsAhead, -1,                                    \
           "How many fields ahead to prefetch in oop scan (<= 0 means off)") \
                                                                             \
+  diagnostic(bool, VerifySilently, false,                                   \
+          "Don't print print the verification progress")                    \
+                                                                            \
   diagnostic(bool, VerifyDuringStartup, false,                              \
           "Verify memory system before executing any Java code "            \
           "during VM initialization")                                       \
@@ -3179,6 +3182,9 @@
   product(uintx,  CodeCacheFlushingMinimumFreeSpace, 1500*K,                \
           "When less than X space left, start code cache cleaning")         \
                                                                             \
+  product(uintx, CodeCacheFlushingFraction, 2,                              \
+          "Fraction of the code cache that is flushed when full")           \
+                                                                            \
   /* interpreter debugging */                                               \
   develop(intx, BinarySwitchThreshold, 5,                                   \
           "Minimal number of lookupswitch entries for rewriting to binary " \
@@ -3223,8 +3229,9 @@
   develop(bool, ReplayCompiles, false,                                      \
           "Enable replay of compilations from ReplayDataFile")              \
                                                                             \
-  develop(ccstr, ReplayDataFile, "replay.txt",                              \
-          "file containing compilation replay information")                 \
+  product(ccstr, ReplayDataFile, NULL,                                      \
+          "File containing compilation replay information"                  \
+          "[default: ./replay_pid%p.log] (%p replaced with pid)")           \
                                                                             \
   develop(intx, ReplaySuppressInitializers, 2,                              \
           "Controls handling of class initialization during replay"         \
@@ -3237,8 +3244,8 @@
   develop(bool, ReplayIgnoreInitErrors, false,                              \
           "Ignore exceptions thrown during initialization for replay")      \
                                                                             \
-  develop(bool, DumpReplayDataOnError, true,                                \
-          "record replay data for crashing compiler threads")               \
+  product(bool, DumpReplayDataOnError, true,                                \
+          "Record replay data for crashing compiler threads")               \
                                                                             \
   product(bool, CICompilerCountPerCPU, false,                               \
           "1 compiler thread for log(N CPUs)")                              \
@@ -3247,7 +3254,9 @@
           "Fire OutOfMemoryErrors throughout CI for testing the compiler "  \
           "(non-negative value throws OOM after this many CI accesses "     \
           "in each compile)")                                               \
-                                                                            \
+  notproduct(intx, CICrashAt, -1,                                           \
+          "id of compilation to trigger assert in compiler thread for "     \
+          "the purpose of testing, e.g. generation of replay data")         \
   notproduct(bool, CIObjectFactoryVerify, false,                            \
           "enable potentially expensive verification in ciObjectFactory")   \
                                                                             \
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp	Wed May 08 10:10:05 2013 +0100
@@ -2404,7 +2404,7 @@
   size_t sz = strlen (SyncKnobs) ;
   char * knobs = (char *) malloc (sz + 2) ;
   if (knobs == NULL) {
-     vm_exit_out_of_memory (sz + 2, "Parse SyncKnobs") ;
+     vm_exit_out_of_memory (sz + 2, OOM_MALLOC_ERROR, "Parse SyncKnobs") ;
      guarantee (0, "invariant") ;
   }
   strcpy (knobs, SyncKnobs) ;
--- a/hotspot/src/share/vm/runtime/os.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/os.hpp	Wed May 08 10:10:05 2013 +0100
@@ -454,6 +454,7 @@
   // File i/o operations
   static const int default_file_open_flags();
   static int open(const char *path, int oflag, int mode);
+  static FILE* open(int fd, const char* mode);
   static int close(int fd);
   static jlong lseek(int fd, jlong offset, int whence);
   static char* native_path(char *path);
@@ -477,7 +478,7 @@
   static const char*    dll_file_extension();
 
   static const char*    get_temp_directory();
-  static const char*    get_current_directory(char *buf, int buflen);
+  static const char*    get_current_directory(char *buf, size_t buflen);
 
   // Builds a platform-specific full library path given a ld path and lib name
   // Returns true if buffer contains full path to existing file, false otherwise
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1316,12 +1316,6 @@
   assert(stub_frame.is_runtime_frame(), "sanity check");
   frame caller_frame = stub_frame.sender(&reg_map);
 
-  // MethodHandle invokes don't have a CompiledIC and should always
-  // simply redispatch to the callee_target.
-  address   sender_pc = caller_frame.pc();
-  CodeBlob* sender_cb = caller_frame.cb();
-  nmethod*  sender_nm = sender_cb->as_nmethod_or_null();
-
   if (caller_frame.is_interpreted_frame() ||
       caller_frame.is_entry_frame()) {
     Method* callee = thread->callee_target();
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp	Wed May 08 10:10:05 2013 +0100
@@ -154,9 +154,10 @@
 // Set carry flags on the counters if necessary
 void SimpleThresholdPolicy::handle_counter_overflow(Method* method) {
   MethodCounters *mcs = method->method_counters();
-  assert(mcs != NULL, "");
-  set_carry_if_necessary(mcs->invocation_counter());
-  set_carry_if_necessary(mcs->backedge_counter());
+  if (mcs != NULL) {
+    set_carry_if_necessary(mcs->invocation_counter());
+    set_carry_if_necessary(mcs->backedge_counter());
+  }
   MethodData* mdo = method->method_data();
   if (mdo != NULL) {
     set_carry_if_necessary(mdo->invocation_counter());
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp	Wed May 08 10:10:05 2013 +0100
@@ -147,7 +147,7 @@
     TraceTime timer("StubRoutines generation 1", TraceStartupTime);
     _code1 = BufferBlob::create("StubRoutines (1)", code_size1);
     if (_code1 == NULL) {
-      vm_exit_out_of_memory(code_size1, "CodeCache: no room for StubRoutines (1)");
+      vm_exit_out_of_memory(code_size1, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (1)");
     }
     CodeBuffer buffer(_code1);
     StubGenerator_generate(&buffer, false);
@@ -199,7 +199,7 @@
     TraceTime timer("StubRoutines generation 2", TraceStartupTime);
     _code2 = BufferBlob::create("StubRoutines (2)", code_size2);
     if (_code2 == NULL) {
-      vm_exit_out_of_memory(code_size2, "CodeCache: no room for StubRoutines (2)");
+      vm_exit_out_of_memory(code_size2, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (2)");
     }
     CodeBuffer buffer(_code2);
     StubGenerator_generate(&buffer, true);
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Wed May 08 10:10:05 2013 +0100
@@ -136,13 +136,12 @@
 
 jint      NMethodSweeper::_locked_seen = 0;
 jint      NMethodSweeper::_not_entrant_seen_on_stack = 0;
-bool      NMethodSweeper::_rescan = false;
-bool      NMethodSweeper::_do_sweep = false;
-bool      NMethodSweeper::_was_full = false;
-jint      NMethodSweeper::_advise_to_sweep = 0;
-jlong     NMethodSweeper::_last_was_full = 0;
-uint      NMethodSweeper::_highest_marked = 0;
-long      NMethodSweeper::_was_full_traversal = 0;
+bool      NMethodSweeper::_resweep = false;
+jint      NMethodSweeper::_flush_token = 0;
+jlong     NMethodSweeper::_last_full_flush_time = 0;
+int       NMethodSweeper::_highest_marked = 0;
+int       NMethodSweeper::_dead_compile_ids = 0;
+long      NMethodSweeper::_last_flush_traversal_id = 0;
 
 class MarkActivationClosure: public CodeBlobClosure {
 public:
@@ -155,20 +154,16 @@
 };
 static MarkActivationClosure mark_activation_closure;
 
+bool NMethodSweeper::sweep_in_progress() {
+  return (_current != NULL);
+}
+
 void NMethodSweeper::scan_stacks() {
   assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
   if (!MethodFlushing) return;
-  _do_sweep = true;
 
   // No need to synchronize access, since this is always executed at a
-  // safepoint.  If we aren't in the middle of scan and a rescan
-  // hasn't been requested then just return. If UseCodeCacheFlushing is on and
-  // code cache flushing is in progress, don't skip sweeping to help make progress
-  // clearing space in the code cache.
-  if ((_current == NULL && !_rescan) && !(UseCodeCacheFlushing && !CompileBroker::should_compile_new_jobs())) {
-    _do_sweep = false;
-    return;
-  }
+  // safepoint.
 
   // Make sure CompiledIC_lock in unlocked, since we might update some
   // inline caches. If it is, we just bail-out and try later.
@@ -176,7 +171,7 @@
 
   // Check for restart
   assert(CodeCache::find_blob_unsafe(_current) == _current, "Sweeper nmethod cached state invalid");
-  if (_current == NULL) {
+  if (!sweep_in_progress() && _resweep) {
     _seen        = 0;
     _invocations = NmethodSweepFraction;
     _current     = CodeCache::first_nmethod();
@@ -187,39 +182,30 @@
     Threads::nmethods_do(&mark_activation_closure);
 
     // reset the flags since we started a scan from the beginning.
-    _rescan = false;
+    _resweep = false;
     _locked_seen = 0;
     _not_entrant_seen_on_stack = 0;
   }
 
   if (UseCodeCacheFlushing) {
-    if (!CodeCache::needs_flushing()) {
-      // scan_stacks() runs during a safepoint, no race with setters
-      _advise_to_sweep = 0;
+    // only allow new flushes after the interval is complete.
+    jlong now           = os::javaTimeMillis();
+    jlong max_interval  = (jlong)MinCodeCacheFlushingInterval * (jlong)1000;
+    jlong curr_interval = now - _last_full_flush_time;
+    if (curr_interval > max_interval) {
+      _flush_token = 0;
     }
 
-    if (was_full()) {
-      // There was some progress so attempt to restart the compiler
-      jlong now           = os::javaTimeMillis();
-      jlong max_interval  = (jlong)MinCodeCacheFlushingInterval * (jlong)1000;
-      jlong curr_interval = now - _last_was_full;
-      if ((!CodeCache::needs_flushing()) && (curr_interval > max_interval)) {
-        CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
-        set_was_full(false);
-
-        // Update the _last_was_full time so we can tell how fast the
-        // code cache is filling up
-        _last_was_full = os::javaTimeMillis();
-
-        log_sweep("restart_compiler");
-      }
+    if (!CodeCache::needs_flushing() && !CompileBroker::should_compile_new_jobs()) {
+      CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
+      log_sweep("restart_compiler");
     }
   }
 }
 
 void NMethodSweeper::possibly_sweep() {
   assert(JavaThread::current()->thread_state() == _thread_in_vm, "must run in vm mode");
-  if ((!MethodFlushing) || (!_do_sweep)) return;
+  if (!MethodFlushing || !sweep_in_progress()) return;
 
   if (_invocations > 0) {
     // Only one thread at a time will sweep
@@ -253,6 +239,14 @@
     tty->print_cr("### Sweep at %d out of %d. Invocations left: %d", _seen, CodeCache::nof_nmethods(), _invocations);
   }
 
+  if (!CompileBroker::should_compile_new_jobs()) {
+    // If we have turned off compilations we might as well do full sweeps
+    // in order to reach the clean state faster. Otherwise the sleeping compiler
+    // threads will slow down sweeping. After a few iterations the cache
+    // will be clean and sweeping stops (_resweep will not be set)
+    _invocations = 1;
+  }
+
   // We want to visit all nmethods after NmethodSweepFraction
   // invocations so divide the remaining number of nmethods by the
   // remaining number of invocations.  This is only an estimate since
@@ -296,7 +290,7 @@
 
   assert(_invocations > 1 || _current == NULL, "must have scanned the whole cache");
 
-  if (_current == NULL && !_rescan && (_locked_seen || _not_entrant_seen_on_stack)) {
+  if (!sweep_in_progress() && !_resweep && (_locked_seen || _not_entrant_seen_on_stack)) {
     // we've completed a scan without making progress but there were
     // nmethods we were unable to process either because they were
     // locked or were still on stack.  We don't have to aggresively
@@ -318,6 +312,13 @@
   if (_invocations == 1) {
     log_sweep("finished");
   }
+
+  // Sweeper is the only case where memory is released,
+  // check here if it is time to restart the compiler.
+  if (UseCodeCacheFlushing && !CompileBroker::should_compile_new_jobs() && !CodeCache::needs_flushing()) {
+    CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
+    log_sweep("restart_compiler");
+  }
 }
 
 class NMethodMarker: public StackObj {
@@ -392,7 +393,7 @@
         tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), nm);
       }
       nm->mark_for_reclamation();
-      _rescan = true;
+      _resweep = true;
       SWEEP(nm);
     }
   } else if (nm->is_not_entrant()) {
@@ -403,7 +404,7 @@
         tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm);
       }
       nm->make_zombie();
-      _rescan = true;
+      _resweep = true;
       SWEEP(nm);
     } else {
       // Still alive, clean up its inline caches
@@ -425,16 +426,15 @@
       release_nmethod(nm);
     } else {
       nm->make_zombie();
-      _rescan = true;
+      _resweep = true;
       SWEEP(nm);
     }
   } else {
     assert(nm->is_alive(), "should be alive");
 
     if (UseCodeCacheFlushing) {
-      if ((nm->method()->code() != nm) && !(nm->is_locked_by_vm()) && !(nm->is_osr_method()) &&
-          (_traversals > _was_full_traversal+2) && (((uint)nm->compile_id()) < _highest_marked) &&
-          CodeCache::needs_flushing()) {
+      if (nm->is_speculatively_disconnected() && !nm->is_locked_by_vm() && !nm->is_osr_method() &&
+          (_traversals > _last_flush_traversal_id + 2) && (nm->compile_id() < _highest_marked)) {
         // This method has not been called since the forced cleanup happened
         nm->make_not_entrant();
       }
@@ -457,41 +457,27 @@
 // _code field is restored and the Method*/nmethod
 // go back to their normal state.
 void NMethodSweeper::handle_full_code_cache(bool is_full) {
-  // Only the first one to notice can advise us to start early cleaning
-  if (!is_full){
-    jint old = Atomic::cmpxchg( 1, &_advise_to_sweep, 0 );
-    if (old != 0) {
-      return;
-    }
-  }
 
   if (is_full) {
     // Since code cache is full, immediately stop new compiles
-    bool did_set = CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation);
-    if (!did_set) {
-      // only the first to notice can start the cleaning,
-      // others will go back and block
-      return;
+    if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) {
+      log_sweep("disable_compiler");
     }
-    set_was_full(true);
+  }
 
-    // If we run out within MinCodeCacheFlushingInterval of the last unload time, give up
-    jlong now = os::javaTimeMillis();
-    jlong max_interval = (jlong)MinCodeCacheFlushingInterval * (jlong)1000;
-    jlong curr_interval = now - _last_was_full;
-    if (curr_interval < max_interval) {
-      _rescan = true;
-      log_sweep("disable_compiler", "flushing_interval='" UINT64_FORMAT "'",
-                           curr_interval/1000);
-      return;
-    }
+  // Make sure only one thread can flush
+  // The token is reset after CodeCacheMinimumFlushInterval in scan stacks,
+  // no need to check the timeout here.
+  jint old = Atomic::cmpxchg( 1, &_flush_token, 0 );
+  if (old != 0) {
+    return;
   }
 
   VM_HandleFullCodeCache op(is_full);
   VMThread::execute(&op);
 
-  // rescan again as soon as possible
-  _rescan = true;
+  // resweep again as soon as possible
+  _resweep = true;
 }
 
 void NMethodSweeper::speculative_disconnect_nmethods(bool is_full) {
@@ -500,62 +486,64 @@
 
   debug_only(jlong start = os::javaTimeMillis();)
 
-  if ((!was_full()) && (is_full)) {
-    if (!CodeCache::needs_flushing()) {
-      log_sweep("restart_compiler");
-      CompileBroker::set_should_compile_new_jobs(CompileBroker::run_compilation);
-      return;
-    }
-  }
+  // Traverse the code cache trying to dump the oldest nmethods
+  int curr_max_comp_id = CompileBroker::get_compilation_id();
+  int flush_target = ((curr_max_comp_id - _dead_compile_ids) / CodeCacheFlushingFraction) + _dead_compile_ids;
 
-  // Traverse the code cache trying to dump the oldest nmethods
-  uint curr_max_comp_id = CompileBroker::get_compilation_id();
-  uint flush_target = ((curr_max_comp_id - _highest_marked) >> 1) + _highest_marked;
   log_sweep("start_cleaning");
 
   nmethod* nm = CodeCache::alive_nmethod(CodeCache::first());
   jint disconnected = 0;
   jint made_not_entrant  = 0;
+  jint nmethod_count = 0;
+
   while ((nm != NULL)){
-    uint curr_comp_id = nm->compile_id();
+    int curr_comp_id = nm->compile_id();
 
     // OSR methods cannot be flushed like this. Also, don't flush native methods
     // since they are part of the JDK in most cases
-    if (nm->is_in_use() && (!nm->is_osr_method()) && (!nm->is_locked_by_vm()) &&
-        (!nm->is_native_method()) && ((curr_comp_id < flush_target))) {
+    if (!nm->is_osr_method() && !nm->is_locked_by_vm() && !nm->is_native_method()) {
+
+      // only count methods that can be speculatively disconnected
+      nmethod_count++;
 
-      if ((nm->method()->code() == nm)) {
-        // This method has not been previously considered for
-        // unloading or it was restored already
-        CodeCache::speculatively_disconnect(nm);
-        disconnected++;
-      } else if (nm->is_speculatively_disconnected()) {
-        // This method was previously considered for preemptive unloading and was not called since then
-        CompilationPolicy::policy()->delay_compilation(nm->method());
-        nm->make_not_entrant();
-        made_not_entrant++;
-      }
+      if (nm->is_in_use() && (curr_comp_id < flush_target)) {
+        if ((nm->method()->code() == nm)) {
+          // This method has not been previously considered for
+          // unloading or it was restored already
+          CodeCache::speculatively_disconnect(nm);
+          disconnected++;
+        } else if (nm->is_speculatively_disconnected()) {
+          // This method was previously considered for preemptive unloading and was not called since then
+          CompilationPolicy::policy()->delay_compilation(nm->method());
+          nm->make_not_entrant();
+          made_not_entrant++;
+        }
 
-      if (curr_comp_id > _highest_marked) {
-        _highest_marked = curr_comp_id;
+        if (curr_comp_id > _highest_marked) {
+          _highest_marked = curr_comp_id;
+        }
       }
     }
     nm = CodeCache::alive_nmethod(CodeCache::next(nm));
   }
 
+  // remember how many compile_ids wheren't seen last flush.
+  _dead_compile_ids = curr_max_comp_id - nmethod_count;
+
   log_sweep("stop_cleaning",
                        "disconnected='" UINT32_FORMAT "' made_not_entrant='" UINT32_FORMAT "'",
                        disconnected, made_not_entrant);
 
   // Shut off compiler. Sweeper will start over with a new stack scan and
   // traversal cycle and turn it back on if it clears enough space.
-  if (was_full()) {
-    _last_was_full = os::javaTimeMillis();
-    CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation);
+  if (is_full) {
+    _last_full_flush_time = os::javaTimeMillis();
   }
 
   // After two more traversals the sweeper will get rid of unrestored nmethods
-  _was_full_traversal = _traversals;
+  _last_flush_traversal_id = _traversals;
+  _resweep = true;
 #ifdef ASSERT
   jlong end = os::javaTimeMillis();
   if(PrintMethodFlushing && Verbose) {
--- a/hotspot/src/share/vm/runtime/sweeper.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp	Wed May 08 10:10:05 2013 +0100
@@ -35,26 +35,29 @@
   static nmethod*  _current;      // Current nmethod
   static int       _seen;         // Nof. nmethod we have currently processed in current pass of CodeCache
 
-  static volatile int      _invocations;   // No. of invocations left until we are completed with this pass
-  static volatile int      _sweep_started; // Flag to control conc sweeper
+  static volatile int  _invocations;   // No. of invocations left until we are completed with this pass
+  static volatile int  _sweep_started; // Flag to control conc sweeper
 
-  static bool      _rescan;          // Indicates that we should do a full rescan of the
-                                     // of the code cache looking for work to do.
-  static bool      _do_sweep;        // Flag to skip the conc sweep if no stack scan happened
-  static int       _locked_seen;     // Number of locked nmethods encountered during the scan
+  //The following are reset in scan_stacks and synchronized by the safepoint
+  static bool      _resweep;           // Indicates that a change has happend and we want another sweep,
+                                       // always checked and reset at a safepoint so memory will be in sync.
+  static int       _locked_seen;       // Number of locked nmethods encountered during the scan
   static int       _not_entrant_seen_on_stack; // Number of not entrant nmethod were are still on stack
+  static jint      _flush_token;       // token that guards method flushing, making sure it is executed only once.
 
-  static bool      _was_full;        // remember if we did emergency unloading
-  static jint      _advise_to_sweep; // flag to indicate code cache getting full
-  static jlong     _last_was_full;   // timestamp of last emergency unloading
-  static uint      _highest_marked;   // highest compile id dumped at last emergency unloading
-  static long      _was_full_traversal;   // trav number at last emergency unloading
+  // These are set during a flush, a VM-operation
+  static long      _last_flush_traversal_id; // trav number at last flush unloading
+  static jlong     _last_full_flush_time;    // timestamp of last emergency unloading
+
+  // These are synchronized by the _sweep_started token
+  static int       _highest_marked;   // highest compile id dumped at last emergency unloading
+  static int       _dead_compile_ids; // number of compile ids that where not in the cache last flush
 
   static void process_nmethod(nmethod *nm);
-
   static void release_nmethod(nmethod* nm);
 
   static void log_sweep(const char* msg, const char* format = NULL, ...);
+  static bool sweep_in_progress();
 
  public:
   static long traversal_count() { return _traversals; }
@@ -71,17 +74,14 @@
   static void possibly_sweep();   // Compiler threads call this to sweep
 
   static void notify(nmethod* nm) {
-    // Perform a full scan of the code cache from the beginning.  No
+    // Request a new sweep of the code cache from the beginning. No
     // need to synchronize the setting of this flag since it only
     // changes to false at safepoint so we can never overwrite it with false.
-     _rescan = true;
+     _resweep = true;
   }
 
   static void handle_full_code_cache(bool is_full); // Called by compilers who fail to allocate
   static void speculative_disconnect_nmethods(bool was_full);   // Called by vm op to deal with alloc failure
-
-  static void set_was_full(bool state) { _was_full = state; }
-  static bool was_full() { return _was_full; }
 };
 
 #endif // SHARE_VM_RUNTIME_SWEEPER_HPP
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1018,7 +1018,8 @@
         // We might be able to induce a STW safepoint and scavenge enough
         // objectMonitors to permit progress.
         if (temp == NULL) {
-            vm_exit_out_of_memory (sizeof (ObjectMonitor[_BLOCKSIZE]), "Allocate ObjectMonitors") ;
+            vm_exit_out_of_memory (sizeof (ObjectMonitor[_BLOCKSIZE]), OOM_MALLOC_ERROR,
+                                   "Allocate ObjectMonitors");
         }
 
         // Format the block.
--- a/hotspot/src/share/vm/runtime/thread.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed May 08 10:10:05 2013 +0100
@@ -3447,7 +3447,8 @@
 
   assert (Universe::is_fully_initialized(), "not initialized");
   if (VerifyDuringStartup) {
-    VM_Verify verify_op(false /* silent */);   // make sure we're starting with a clean slate
+    // Make sure we're starting with a clean slate.
+    VM_Verify verify_op;
     VMThread::execute(&verify_op);
   }
 
--- a/hotspot/src/share/vm/runtime/virtualspace.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp	Wed May 08 10:10:05 2013 +0100
@@ -60,72 +60,6 @@
   initialize(size, alignment, large, NULL, 0, executable);
 }
 
-char *
-ReservedSpace::align_reserved_region(char* addr, const size_t len,
-                                     const size_t prefix_size,
-                                     const size_t prefix_align,
-                                     const size_t suffix_size,
-                                     const size_t suffix_align)
-{
-  assert(addr != NULL, "sanity");
-  const size_t required_size = prefix_size + suffix_size;
-  assert(len >= required_size, "len too small");
-
-  const size_t s = size_t(addr);
-  const size_t beg_ofs = (s + prefix_size) & (suffix_align - 1);
-  const size_t beg_delta = beg_ofs == 0 ? 0 : suffix_align - beg_ofs;
-
-  if (len < beg_delta + required_size) {
-     return NULL; // Cannot do proper alignment.
-  }
-  const size_t end_delta = len - (beg_delta + required_size);
-
-  if (beg_delta != 0) {
-    os::release_memory(addr, beg_delta);
-  }
-
-  if (end_delta != 0) {
-    char* release_addr = (char*) (s + beg_delta + required_size);
-    os::release_memory(release_addr, end_delta);
-  }
-
-  return (char*) (s + beg_delta);
-}
-
-char* ReservedSpace::reserve_and_align(const size_t reserve_size,
-                                       const size_t prefix_size,
-                                       const size_t prefix_align,
-                                       const size_t suffix_size,
-                                       const size_t suffix_align)
-{
-  assert(reserve_size > prefix_size + suffix_size, "should not be here");
-
-  char* raw_addr = os::reserve_memory(reserve_size, NULL, prefix_align);
-  if (raw_addr == NULL) return NULL;
-
-  char* result = align_reserved_region(raw_addr, reserve_size, prefix_size,
-                                       prefix_align, suffix_size,
-                                       suffix_align);
-  if (result == NULL && !os::release_memory(raw_addr, reserve_size)) {
-    fatal("os::release_memory failed");
-  }
-
-#ifdef ASSERT
-  if (result != NULL) {
-    const size_t raw = size_t(raw_addr);
-    const size_t res = size_t(result);
-    assert(res >= raw, "alignment decreased start addr");
-    assert(res + prefix_size + suffix_size <= raw + reserve_size,
-           "alignment increased end addr");
-    assert((res & (prefix_align - 1)) == 0, "bad alignment of prefix");
-    assert(((res + prefix_size) & (suffix_align - 1)) == 0,
-           "bad alignment of suffix");
-  }
-#endif
-
-  return result;
-}
-
 // Helper method.
 static bool failed_to_reserve_as_requested(char* base, char* requested_address,
                                            const size_t size, bool special)
@@ -155,92 +89,6 @@
   return true;
 }
 
-ReservedSpace::ReservedSpace(const size_t suffix_size,
-                             const size_t suffix_align,
-                             char* requested_address,
-                             const size_t noaccess_prefix)
-{
-  assert(suffix_size != 0, "sanity");
-  assert(suffix_align != 0, "sanity");
-  assert((suffix_size & (suffix_align - 1)) == 0,
-    "suffix_size not divisible by suffix_align");
-
-  // Assert that if noaccess_prefix is used, it is the same as prefix_align.
-  // Add in noaccess_prefix to prefix
-  const size_t adjusted_prefix_size = noaccess_prefix;
-  const size_t size = adjusted_prefix_size + suffix_size;
-
-  // On systems where the entire region has to be reserved and committed up
-  // front, the compound alignment normally done by this method is unnecessary.
-  const bool try_reserve_special = UseLargePages &&
-    suffix_align == os::large_page_size();
-  if (!os::can_commit_large_page_memory() && try_reserve_special) {
-    initialize(size, suffix_align, true, requested_address, noaccess_prefix,
-               false);
-    return;
-  }
-
-  _base = NULL;
-  _size = 0;
-  _alignment = 0;
-  _special = false;
-  _noaccess_prefix = 0;
-  _executable = false;
-
-  // Optimistically try to reserve the exact size needed.
-  char* addr;
-  if (requested_address != 0) {
-    requested_address -= noaccess_prefix; // adjust address
-    assert(requested_address != NULL, "huge noaccess prefix?");
-    addr = os::attempt_reserve_memory_at(size, requested_address);
-    if (failed_to_reserve_as_requested(addr, requested_address, size, false)) {
-      // OS ignored requested address. Try different address.
-      addr = NULL;
-    }
-  } else {
-    addr = os::reserve_memory(size, NULL, suffix_align);
-  }
-  if (addr == NULL) return;
-
-  // Check whether the result has the needed alignment
-  const size_t ofs = (size_t(addr) + adjusted_prefix_size) & (suffix_align - 1);
-  if (ofs != 0) {
-    // Wrong alignment.  Release, allocate more space and do manual alignment.
-    //
-    // On most operating systems, another allocation with a somewhat larger size
-    // will return an address "close to" that of the previous allocation.  The
-    // result is often the same address (if the kernel hands out virtual
-    // addresses from low to high), or an address that is offset by the increase
-    // in size.  Exploit that to minimize the amount of extra space requested.
-    if (!os::release_memory(addr, size)) {
-      fatal("os::release_memory failed");
-    }
-
-    const size_t extra = MAX2(ofs, suffix_align - ofs);
-    addr = reserve_and_align(size + extra, adjusted_prefix_size, suffix_align,
-                             suffix_size, suffix_align);
-    if (addr == NULL) {
-      // Try an even larger region.  If this fails, address space is exhausted.
-      addr = reserve_and_align(size + suffix_align, adjusted_prefix_size,
-                               suffix_align, suffix_size, suffix_align);
-    }
-
-    if (requested_address != 0 &&
-        failed_to_reserve_as_requested(addr, requested_address, size, false)) {
-      // As a result of the alignment constraints, the allocated addr differs
-      // from the requested address. Return back to the caller who can
-      // take remedial action (like try again without a requested address).
-      assert(_base == NULL, "should be");
-      return;
-    }
-  }
-
-  _base = addr;
-  _size = size;
-  _alignment = suffix_align;
-  _noaccess_prefix = noaccess_prefix;
-}
-
 void ReservedSpace::initialize(size_t size, size_t alignment, bool large,
                                char* requested_address,
                                const size_t noaccess_prefix,
@@ -476,20 +324,6 @@
   protect_noaccess_prefix(size);
 }
 
-ReservedHeapSpace::ReservedHeapSpace(const size_t heap_space_size,
-                                     const size_t alignment,
-                                     char* requested_address) :
-  ReservedSpace(heap_space_size, alignment,
-                requested_address,
-                (UseCompressedOops && (Universe::narrow_oop_base() != NULL) &&
-                 Universe::narrow_oop_use_implicit_null_checks()) ?
-                  lcm(os::vm_page_size(), alignment) : 0) {
-  if (base() > 0) {
-    MemTracker::record_virtual_memory_type((address)base(), mtJavaHeap);
-  }
-  protect_noaccess_prefix(heap_space_size);
-}
-
 // Reserve space for code segment.  Same as Java heap only we mark this as
 // executable.
 ReservedCodeSpace::ReservedCodeSpace(size_t r_size,
--- a/hotspot/src/share/vm/runtime/virtualspace.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/virtualspace.hpp	Wed May 08 10:10:05 2013 +0100
@@ -47,28 +47,6 @@
                   const size_t noaccess_prefix,
                   bool executable);
 
-  // Release parts of an already-reserved memory region [addr, addr + len) to
-  // get a new region that has "compound alignment."  Return the start of the
-  // resulting region, or NULL on failure.
-  //
-  // The region is logically divided into a prefix and a suffix.  The prefix
-  // starts at the result address, which is aligned to prefix_align.  The suffix
-  // starts at result address + prefix_size, which is aligned to suffix_align.
-  // The total size of the result region is size prefix_size + suffix_size.
-  char* align_reserved_region(char* addr, const size_t len,
-                              const size_t prefix_size,
-                              const size_t prefix_align,
-                              const size_t suffix_size,
-                              const size_t suffix_align);
-
-  // Reserve memory, call align_reserved_region() to alignment it and return the
-  // result.
-  char* reserve_and_align(const size_t reserve_size,
-                          const size_t prefix_size,
-                          const size_t prefix_align,
-                          const size_t suffix_size,
-                          const size_t suffix_align);
-
  protected:
   // Create protection page at the beginning of the space.
   void protect_noaccess_prefix(const size_t size);
@@ -79,9 +57,6 @@
   ReservedSpace(size_t size, size_t alignment, bool large,
                 char* requested_address = NULL,
                 const size_t noaccess_prefix = 0);
-  ReservedSpace(const size_t suffix_size, const size_t suffix_align,
-                char* requested_address,
-                const size_t noaccess_prefix = 0);
   ReservedSpace(size_t size, size_t alignment, bool large, bool executable);
 
   // Accessors
@@ -128,8 +103,6 @@
   // Constructor
   ReservedHeapSpace(size_t size, size_t forced_base_alignment,
                     bool large, char* requested_address);
-  ReservedHeapSpace(const size_t prefix_size, const size_t prefix_align,
-                    char* requested_address);
 };
 
 // Class encapsulating behavior specific memory space for Code
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed May 08 10:10:05 2013 +0100
@@ -828,6 +828,7 @@
   nonstatic_field(nmethod,             _lock_count,                                   jint)                                  \
   nonstatic_field(nmethod,             _stack_traversal_mark,                         long)                                  \
   nonstatic_field(nmethod,             _compile_id,                                   int)                                   \
+  nonstatic_field(nmethod,             _comp_level,                                   int)                                   \
   nonstatic_field(nmethod,             _exception_cache,                              ExceptionCache*)                       \
   nonstatic_field(nmethod,             _marked_for_deoptimization,                    bool)                                  \
                                                                                                                              \
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Wed May 08 10:10:05 2013 +0100
@@ -293,7 +293,7 @@
     os::check_heap();
     // Silent verification so as not to pollute normal output,
     // unless we really asked for it.
-    Universe::verify(!(PrintGCDetails || Verbose));
+    Universe::verify(!(PrintGCDetails || Verbose) || VerifySilently);
   }
 
   CompileBroker::set_should_block();
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp	Wed May 08 10:10:05 2013 +0100
@@ -302,7 +302,7 @@
  private:
   bool _silent;
  public:
-  VM_Verify(bool silent) : _silent(silent) {}
+  VM_Verify(bool silent = VerifySilently) : _silent(silent) {}
   VMOp_Type type() const { return VMOp_Verify; }
   void doit();
 };
--- a/hotspot/src/share/vm/services/memBaseline.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/services/memBaseline.cpp	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,12 @@
  */
 #include "precompiled.hpp"
 #include "memory/allocation.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/thread.inline.hpp"
 #include "services/memBaseline.hpp"
 #include "services/memTracker.hpp"
 
+
 MemType2Name MemBaseline::MemType2NameMap[NUMBER_OF_MEMORY_TYPE] = {
   {mtJavaHeap,   "Java Heap"},
   {mtClass,      "Class"},
@@ -149,6 +152,15 @@
   return true;
 }
 
+// check if there is a safepoint in progress, if so, block the thread
+// for the safepoint
+void MemBaseline::check_safepoint(JavaThread* thr) {
+  if (SafepointSynchronize::is_synchronizing()) {
+    // grab and drop the SR_lock to honor the safepoint protocol
+    MutexLocker ml(thr->SR_lock());
+  }
+}
+
 // baseline mmap'd memory records, generate overall summary and summaries by
 // memory types
 bool MemBaseline::baseline_vm_summary(const MemPointerArray* vm_records) {
@@ -306,7 +318,7 @@
         committed_rec->pc() != vm_ptr->pc()) {
         if (!_vm_map->append(vm_ptr)) {
           return false;
-  }
+        }
         committed_rec = (VMMemRegionEx*)_vm_map->at(_vm_map->length() - 1);
     } else {
         committed_rec->expand_region(vm_ptr->addr(), vm_ptr->size());
@@ -344,16 +356,27 @@
 
 // baseline a snapshot. If summary_only = false, memory usages aggregated by
 // callsites are also baselined.
+// The method call can be lengthy, especially when detail tracking info is
+// requested. So the method checks for safepoint explicitly.
 bool MemBaseline::baseline(MemSnapshot& snapshot, bool summary_only) {
-  MutexLockerEx snapshot_locker(snapshot._lock, true);
+  Thread* THREAD = Thread::current();
+  assert(THREAD->is_Java_thread(), "must be a JavaThread");
+  MutexLocker snapshot_locker(snapshot._lock);
   reset();
-  _baselined = baseline_malloc_summary(snapshot._alloc_ptrs) &&
-               baseline_vm_summary(snapshot._vm_ptrs);
+  _baselined = baseline_malloc_summary(snapshot._alloc_ptrs);
+  if (_baselined) {
+    check_safepoint((JavaThread*)THREAD);
+    _baselined = baseline_vm_summary(snapshot._vm_ptrs);
+  }
   _number_of_classes = snapshot.number_of_classes();
 
   if (!summary_only && MemTracker::track_callsite() && _baselined) {
-    _baselined =  baseline_malloc_details(snapshot._alloc_ptrs) &&
-      baseline_vm_details(snapshot._vm_ptrs);
+    check_safepoint((JavaThread*)THREAD);
+    _baselined =  baseline_malloc_details(snapshot._alloc_ptrs);
+    if (_baselined) {
+      check_safepoint((JavaThread*)THREAD);
+      _baselined =  baseline_vm_details(snapshot._vm_ptrs);
+    }
   }
   return _baselined;
 }
--- a/hotspot/src/share/vm/services/memBaseline.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/services/memBaseline.hpp	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -330,6 +330,9 @@
   // should not use copy constructor
   MemBaseline(MemBaseline& copy) { ShouldNotReachHere(); }
 
+  // check and block at a safepoint
+  static inline void check_safepoint(JavaThread* thr);
+
  public:
   // create a memory baseline
   MemBaseline();
--- a/hotspot/src/share/vm/services/memTracker.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/services/memTracker.cpp	Wed May 08 10:10:05 2013 +0100
@@ -573,7 +573,7 @@
 
 // baseline current memory snapshot
 bool MemTracker::baseline() {
-  MutexLockerEx lock(_query_lock, true);
+  MutexLocker lock(_query_lock);
   MemSnapshot* snapshot = get_snapshot();
   if (snapshot != NULL) {
     return _baseline.baseline(*snapshot, false);
@@ -584,7 +584,7 @@
 // print memory usage from current snapshot
 bool MemTracker::print_memory_usage(BaselineOutputer& out, size_t unit, bool summary_only) {
   MemBaseline  baseline;
-  MutexLockerEx lock(_query_lock, true);
+  MutexLocker  lock(_query_lock);
   MemSnapshot* snapshot = get_snapshot();
   if (snapshot != NULL && baseline.baseline(*snapshot, summary_only)) {
     BaselineReporter reporter(out, unit);
@@ -597,7 +597,7 @@
 // Whitebox API for blocking until the current generation of NMT data has been merged
 bool MemTracker::wbtest_wait_for_data_merge() {
   // NMT can't be shutdown while we're holding _query_lock
-  MutexLockerEx lock(_query_lock, true);
+  MutexLocker lock(_query_lock);
   assert(_worker_thread != NULL, "Invalid query");
   // the generation at query time, so NMT will spin till this generation is processed
   unsigned long generation_at_query_time = SequenceGenerator::current_generation();
@@ -641,7 +641,7 @@
 
 // compare memory usage between current snapshot and baseline
 bool MemTracker::compare_memory_usage(BaselineOutputer& out, size_t unit, bool summary_only) {
-  MutexLockerEx lock(_query_lock, true);
+  MutexLocker lock(_query_lock);
   if (_baseline.baselined()) {
     MemBaseline baseline;
     MemSnapshot* snapshot = get_snapshot();
--- a/hotspot/src/share/vm/utilities/debug.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Wed May 08 10:10:05 2013 +0100
@@ -229,11 +229,11 @@
 }
 
 void report_vm_out_of_memory(const char* file, int line, size_t size,
-                             const char* message) {
+                             VMErrorType vm_err_type, const char* message) {
   if (Debugging) return;
 
   Thread* thread = ThreadLocalStorage::get_thread_slow();
-  VMError(thread, file, line, size, message).report_and_die();
+  VMError(thread, file, line, size, vm_err_type, message).report_and_die();
 
   // The UseOSErrorReporting option in report_and_die() may allow a return
   // to here. If so then we'll have to figure out how to handle it.
@@ -344,7 +344,7 @@
                            msg, eol, msg, eol, msg, eol, msg, eol, msg, eol,
                            msg, eol, msg, eol, msg, eol, msg, eol, msg, eol,
                            msg, eol, msg, eol, msg, eol, msg, eol, msg));
-    case  8: vm_exit_out_of_memory(num, "ChunkPool::allocate");
+    case  8: vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate");
     case  9: ShouldNotCallThis();
     case 10: ShouldNotReachHere();
     case 11: Unimplemented();
--- a/hotspot/src/share/vm/utilities/debug.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/utilities/debug.hpp	Wed May 08 10:10:05 2013 +0100
@@ -174,9 +174,9 @@
 } while (0)
 
 // out of memory
-#define vm_exit_out_of_memory(size, msg)                                     \
+#define vm_exit_out_of_memory(size, vm_err_type, msg)                        \
 do {                                                                         \
-  report_vm_out_of_memory(__FILE__, __LINE__, size, msg);                    \
+  report_vm_out_of_memory(__FILE__, __LINE__, size, vm_err_type, msg);       \
   BREAKPOINT;                                                                \
 } while (0)
 
@@ -204,12 +204,20 @@
   BREAKPOINT;                                                                \
 } while (0);
 
+
+// types of VM error - originally in vmError.hpp
+enum VMErrorType {
+  INTERNAL_ERROR   = 0xe0000000,
+  OOM_MALLOC_ERROR = 0xe0000001,
+  OOM_MMAP_ERROR   = 0xe0000002
+};
+
 // error reporting helper functions
 void report_vm_error(const char* file, int line, const char* error_msg,
                      const char* detail_msg = NULL);
 void report_fatal(const char* file, int line, const char* message);
 void report_vm_out_of_memory(const char* file, int line, size_t size,
-                             const char* message);
+                             VMErrorType vm_err_type, const char* message);
 void report_should_not_call(const char* file, int line);
 void report_should_not_reach_here(const char* file, int line);
 void report_unimplemented(const char* file, int line);
--- a/hotspot/src/share/vm/utilities/ostream.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/utilities/ostream.hpp	Wed May 08 10:10:05 2013 +0100
@@ -196,7 +196,7 @@
   fileStream() { _file = NULL; _need_close = false; }
   fileStream(const char* file_name);
   fileStream(const char* file_name, const char* opentype);
-  fileStream(FILE* file) { _file = file; _need_close = false; }
+  fileStream(FILE* file, bool need_close = false) { _file = file; _need_close = need_close; }
   ~fileStream();
   bool is_open() const { return _file != NULL; }
   void set_need_close(bool b) { _need_close = b;}
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Wed May 08 10:10:05 2013 +0100
@@ -100,7 +100,7 @@
                  const char* message, const char * detail_msg)
 {
   _thread = thread;
-  _id = internal_error;     // Value that's not an OS exception/signal
+  _id = INTERNAL_ERROR;     // Value that's not an OS exception/signal
   _filename = filename;
   _lineno = lineno;
   _message = message;
@@ -119,9 +119,9 @@
 
 // Constructor for OOM errors
 VMError::VMError(Thread* thread, const char* filename, int lineno, size_t size,
-                 const char* message) {
+                 VMErrorType vm_err_type, const char* message) {
     _thread = thread;
-    _id = oom_error;     // Value that's not an OS exception/signal
+    _id = vm_err_type; // Value that's not an OS exception/signal
     _filename = filename;
     _lineno = lineno;
     _message = message;
@@ -142,7 +142,7 @@
 // Constructor for non-fatal errors
 VMError::VMError(const char* message) {
     _thread = NULL;
-    _id = internal_error;     // Value that's not an OS exception/signal
+    _id = INTERNAL_ERROR;     // Value that's not an OS exception/signal
     _filename = NULL;
     _lineno = 0;
     _message = message;
@@ -351,9 +351,12 @@
   STEP(15, "(printing type of error)")
 
      switch(_id) {
-       case oom_error:
+       case OOM_MALLOC_ERROR:
+       case OOM_MMAP_ERROR:
          if (_size) {
-           st->print("# Native memory allocation (malloc) failed to allocate ");
+           st->print("# Native memory allocation ");
+           st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " :
+                                                 "(mmap) failed to map ");
            jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size);
            st->print(buf);
            st->print(" bytes");
@@ -386,7 +389,7 @@
            return;  // that's enough for the screen
          }
          break;
-       case internal_error:
+       case INTERNAL_ERROR:
        default:
          break;
      }
@@ -796,6 +799,56 @@
 VMError* volatile VMError::first_error = NULL;
 volatile jlong VMError::first_error_tid = -1;
 
+/** Expand a pattern into a buffer starting at pos and open a file using constructed path */
+static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) {
+  int fd = -1;
+  if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) {
+    fd = open(buf, O_RDWR | O_CREAT | O_TRUNC, 0666);
+  }
+  return fd;
+}
+
+/**
+ * Construct file name for a log file and return it's file descriptor.
+ * Name and location depends on pattern, default_pattern params and access
+ * permissions.
+ */
+static int prepare_log_file(const char* pattern, const char* default_pattern, char* buf, size_t buflen) {
+  int fd = -1;
+
+  // If possible, use specified pattern to construct log file name
+  if (pattern != NULL) {
+    fd = expand_and_open(pattern, buf, buflen, 0);
+  }
+
+  // Either user didn't specify, or the user's location failed,
+  // so use the default name in the current directory
+  if (fd == -1) {
+    const char* cwd = os::get_current_directory(buf, buflen);
+    if (cwd != NULL) {
+      size_t pos = strlen(cwd);
+      int fsep_len = jio_snprintf(&buf[pos], buflen-pos, "%s", os::file_separator());
+      pos += fsep_len;
+      if (fsep_len > 0) {
+        fd = expand_and_open(default_pattern, buf, buflen, pos);
+      }
+    }
+  }
+
+   // try temp directory if it exists.
+   if (fd == -1) {
+     const char* tmpdir = os::get_temp_directory();
+     if (tmpdir != NULL && strlen(tmpdir) > 0) {
+       int pos = jio_snprintf(buf, buflen, "%s%s", tmpdir, os::file_separator());
+       if (pos > 0) {
+         fd = expand_and_open(default_pattern, buf, buflen, pos);
+       }
+     }
+   }
+
+  return fd;
+}
+
 void VMError::report_and_die() {
   // Don't allocate large buffer on stack
   static char buffer[O_BUFLEN];
@@ -905,36 +958,7 @@
     // see if log file is already open
     if (!log.is_open()) {
       // open log file
-      int fd = -1;
-
-      if (ErrorFile != NULL) {
-        bool copy_ok =
-          Arguments::copy_expand_pid(ErrorFile, strlen(ErrorFile), buffer, sizeof(buffer));
-        if (copy_ok) {
-          fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
-        }
-      }
-
-      if (fd == -1) {
-        const char *cwd = os::get_current_directory(buffer, sizeof(buffer));
-        size_t len = strlen(cwd);
-        // either user didn't specify, or the user's location failed,
-        // so use the default name in the current directory
-        jio_snprintf(&buffer[len], sizeof(buffer)-len, "%shs_err_pid%u.log",
-                     os::file_separator(), os::current_process_id());
-        fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
-      }
-
-      if (fd == -1) {
-        const char * tmpdir = os::get_temp_directory();
-        // try temp directory if it exists.
-        if (tmpdir != NULL && tmpdir[0] != '\0') {
-          jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
-                       tmpdir, os::file_separator(), os::current_process_id());
-          fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
-        }
-      }
-
+      int fd = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer));
       if (fd != -1) {
         out.print_raw("# An error report file with more information is saved as:\n# ");
         out.print_raw_cr(buffer);
@@ -958,7 +982,7 @@
     // Run error reporting to determine whether or not to report the crash.
     if (!transmit_report_done && should_report_bug(first_error->_id)) {
       transmit_report_done = true;
-      FILE* hs_err = ::fdopen(log.fd(), "r");
+      FILE* hs_err = os::open(log.fd(), "r");
       if (NULL != hs_err) {
         ErrorReporter er;
         er.call(hs_err, buffer, O_BUFLEN);
@@ -1008,7 +1032,19 @@
     skip_replay = true;
     ciEnv* env = ciEnv::current();
     if (env != NULL) {
-      env->dump_replay_data();
+      int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", buffer, sizeof(buffer));
+      if (fd != -1) {
+        FILE* replay_data_file = os::open(fd, "w");
+        if (replay_data_file != NULL) {
+          fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
+          env->dump_replay_data(&replay_data_stream);
+          out.print_raw("#\n# Compiler replay data is saved as:\n# ");
+          out.print_raw_cr(buffer);
+        } else {
+          out.print_raw("#\n# Can't open file to dump replay data. Error: ");
+          out.print_raw_cr(strerror(os::get_last_error()));
+        }
+      }
     }
   }
 
--- a/hotspot/src/share/vm/utilities/vmError.hpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/utilities/vmError.hpp	Wed May 08 10:10:05 2013 +0100
@@ -34,10 +34,6 @@
   friend class VM_ReportJavaOutOfMemory;
   friend class Decoder;
 
-  enum ErrorType {
-    internal_error = 0xe0000000,
-    oom_error      = 0xe0000001
-  };
   int          _id;          // Solaris/Linux signals: 0 - SIGRTMAX
                              // Windows exceptions: 0xCxxxxxxx system errors
                              //                     0x8xxxxxxx system warnings
@@ -96,9 +92,12 @@
   // accessor
   const char* message() const    { return _message; }
   const char* detail_msg() const { return _detail_msg; }
-  bool should_report_bug(unsigned int id) { return id != oom_error; }
+  bool should_report_bug(unsigned int id) {
+    return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
+  }
 
 public:
+
   // Constructor for crashes
   VMError(Thread* thread, unsigned int sig, address pc, void* siginfo,
           void* context);
@@ -108,7 +107,7 @@
 
   // Constructor for VM OOM errors
   VMError(Thread* thread, const char* filename, int lineno, size_t size,
-          const char* message);
+          VMErrorType vm_err_type, const char* message);
   // Constructor for non-fatal errors
   VMError(const char* message);
 
--- a/hotspot/src/share/vm/utilities/workgroup.cpp	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp	Wed May 08 10:10:05 2013 +0100
@@ -79,7 +79,7 @@
   }
   _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, total_workers(), mtInternal);
   if (gang_workers() == NULL) {
-    vm_exit_out_of_memory(0, "Cannot create GangWorker array.");
+    vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array.");
     return false;
   }
   os::ThreadType worker_type;
@@ -93,7 +93,8 @@
     assert(new_worker != NULL, "Failed to allocate GangWorker");
     _gang_workers[worker] = new_worker;
     if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) {
-      vm_exit_out_of_memory(0, "Cannot create worker GC thread. Out of system resources.");
+      vm_exit_out_of_memory(0, OOM_MALLOC_ERROR,
+              "Cannot create worker GC thread. Out of system resources.");
       return false;
     }
     if (!DisableStartThread) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/ciReplay/TestSA.sh	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,92 @@
+#!/bin/sh
+# 
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+# 
+# 
+
+##
+## @test
+## @bug 8011675
+## @summary testing of ciReplay with using generated by SA replay.txt 
+## @author igor.ignatyev@oracle.com
+## @run shell TestSA.sh
+##
+
+if [ "${TESTSRC}" = "" ]
+then
+  TESTSRC=${PWD}
+  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
+fi
+echo "TESTSRC=${TESTSRC}"
+
+## Adding common setup Variables for running shell tests.
+. ${TESTSRC}/../../test_env.sh
+
+. ${TESTSRC}/common.sh
+
+generate_replay
+
+${MV} ${replay_data} replay_vm.txt    
+
+if [ -z "${core_file}" -o ! -r "${core_file}" ]
+then
+    # skip test if MacOS host isn't configured for core dumping
+    if [ "$OS" = "Darwin" ]
+    then
+        if [ ! -d "/cores" ]
+        then
+            echo TEST SKIPPED: \'/cores\' dir doens\'t exist
+            exit 0
+        fi
+        if [ ! -w "/cores" ]
+        then
+            echo TEST SKIPPED: \'/cores\' dir exists but is not writable
+            exit 0
+        fi
+    fi
+    test_fail 2 "CHECK :: CORE GENERATION" "core wasn't generated on $OS"
+fi
+
+echo "dumpreplaydata -a > ${replay_data}" | \
+        ${JAVA} ${TESTVMOPTS} \
+        -cp ${TESTJAVA}${FS}lib${FS}sa-jdi.jar \
+        sun.jvm.hotspot.CLHSDB  ${JAVA} ${core_file}
+
+if [ ! -s ${replay_data} ]
+then
+    test_fail 1 "CHECK :: REPLAY DATA GENERATION" \
+        "replay data wasn't generated by SA"
+fi
+
+diff --brief ${replay_data} replay_vm.txt
+if [ $? -ne 0 ]
+then
+    echo WARNING: replay.txt from SA != replay.txt from VM
+fi
+
+common_tests 10 
+${VM_TYPE}_tests 20
+
+cleanup
+
+echo TEST PASSED
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/ciReplay/TestVM.sh	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,86 @@
+#!/bin/sh
+# 
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+# 
+# 
+
+##
+## @test
+## @bug 8011675
+## @summary testing of ciReplay with using generated by VM replay.txt 
+## @author igor.ignatyev@oracle.com
+## @run shell TestVM.sh
+##
+
+if [ "${TESTSRC}" = "" ]
+then
+  TESTSRC=${PWD}
+  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
+fi
+echo "TESTSRC=${TESTSRC}"
+
+## Adding common setup Variables for running shell tests.
+. ${TESTSRC}/../../test_env.sh
+
+. ${TESTSRC}/common.sh
+
+generate_replay
+
+if [ ! -s ${replay_data} ]
+then
+    test_fail 1 "CHECK :: REPLAY DATA GENERATION" \
+        "replay data wasn't generated by VM"
+fi
+
+common_tests 10
+${VM_TYPE}_tests 20
+
+cleanup
+
+if [ $is_tiered -eq 1 ]
+then
+    stop_level=1
+    while [ $stop_level -le $server_level ]
+    do
+        generate_replay "-XX:TieredStopAtLevel=$stop_level"
+        if [ ! -s ${replay_data} ]
+        then
+            test_fail `expr $stop_level + 30` \
+                    "TIERED LEVEL $stop_level :: REPLAY DATA GENERATION" \
+                    "replay data wasn't generated by VM with stop_level=$stop_level"
+        fi
+        level=`grep "^compile " $replay_data | awk '{print $6}'`
+        if [ $level -gt $stop_level ]
+        then
+            test_fail `expr $stop_level + 40` \
+                    "TIERED LEVEL $stop_level :: COMP_LEVEL VERIFICATION" \
+                    "comp_level in replay[$level] is greater than stop_level[$stop_level]"
+        fi
+        positive_test `expr $stop_level + 50` "TIERED LEVEL $stop_level :: REPLAY" \
+                "-XX:TieredStopAtLevel=$stop_level"
+        stop_level=`expr $stop_level + 1`
+    done
+    cleanup
+fi
+
+echo TEST PASSED
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,74 @@
+#!/bin/sh
+# 
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+# 
+# 
+
+##
+## @test
+## @bug 8011675
+## @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level
+## @author igor.ignatyev@oracle.com
+## @run shell TestVM_no_comp_level.sh
+##
+
+if [ "${TESTSRC}" = "" ]
+then
+  TESTSRC=${PWD}
+  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
+fi
+echo "TESTSRC=${TESTSRC}"
+
+## Adding common setup Variables for running shell tests.
+. ${TESTSRC}/../../test_env.sh
+
+. ${TESTSRC}/common.sh
+
+generate_replay
+
+if [ ! -s ${replay_data} ]
+then
+    test_fail 1 "CHECK :: REPLAY DATA GENERATION" \
+            "replay data wasn't generated by VM"
+fi
+
+${CP} ${replay_data} replay_vm.txt
+
+sed 's/^\(compile *[^ ][^ ]* *[^ ][^ ]* [^ ][^ ]* [^ ][^ ]*\).*$/\1/' \
+        replay_vm.txt > ${replay_data}
+
+if [ $client_available -eq 1 ]
+then
+    # tiered is unavailable in client vm, so results w/ flags will be the same as w/o flags
+    negative_test 10 "CLIENT" -client
+fi
+
+if [ $server_available -eq 1 ]
+then
+    positive_test 21 "SERVER :: NON-TIERED" -XX:-TieredCompilation -server
+    positive_test 22 "SERVER :: TIERED" -XX:+TieredCompilation -server
+fi
+
+cleanup
+
+echo TEST PASSED
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/ciReplay/common.sh	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,253 @@
+#!/bin/sh
+# 
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+# 
+# 
+
+# $1 - error code
+# $2 - test name
+# $3,.. - decription
+test_fail() {
+    error=$1
+    shift
+    name=$1
+    shift
+    echo "TEST [$name] FAILED:"
+    echo "$@"
+    exit $error
+}
+
+# $@ - additional vm opts
+start_test() {
+    # disable core dump on *nix
+    ulimit -S -c 0
+    # disable core dump on windows
+    VMOPTS="$@ -XX:-CreateMinidumpOnCrash"
+    cmd="${JAVA} ${VMOPTS} -XX:+ReplayCompiles -XX:ReplayDataFile=${replay_data}"
+    echo $cmd
+    $cmd
+    return $?
+}
+
+# $1 - error_code
+# $2 - test name
+# $3,.. - additional vm opts
+positive_test() {
+    error=$1
+    shift
+    name=$1
+    shift
+    VMOPTS="${TESTVMOPTS} $@"
+    echo "POSITIVE TEST [$name]"
+    start_test ${VMOPTS}
+    exit_code=$?
+    if [ ${exit_code} -ne 0 ]
+    then
+        test_fail $error "$name" "exit_code[${exit_code}] != 0 during replay "\
+                "w/ vmopts: ${VMOPTS}"
+    fi
+}
+
+# $1 - error_code
+# $2 - test name
+# $2,.. - additional vm opts
+negative_test() {
+    error=$1
+    shift
+    name=$1
+    shift
+    VMOPTS="${TESTVMOPTS} $@"
+    echo "NEGATIVE TEST [$name]"
+    start_test ${VMOPTS}
+    exit_code=$?
+    if [ ${exit_code} -eq 0 ]
+    then
+        test_fail $error "$name" "exit_code[${exit_code}] == 0 during replay "\
+                "w/ vmopts: ${VMOPTS}"
+    fi
+}
+
+# $1 - initial error_code
+common_tests() {
+    positive_test $1 "COMMON :: THE SAME FLAGS"
+    positive_test `expr $1 + 1` "COMMON :: TIERED" -XX:+TieredCompilation
+}
+
+# $1 - initial error_code
+# $2 - non-tiered comp_level 
+nontiered_tests() {
+    level=`grep "^compile " $replay_data | awk '{print $6}'`
+    # is level available in non-tiere
+    if [ "$level" -eq $2 ]
+    then
+        positive_test $1 "NON-TIERED :: AVAILABLE COMP_LEVEL" \
+                -XX:-TieredCompilation
+    else
+        negative_test `expr $1 + 1` "NON-TIERED :: UNAVAILABLE COMP_LEVEL" \
+        negative_test `expr $1 + 1` "NON-TIERED :: UNAVAILABLE COMP_LEVEL" \
+                -XX:-TieredCompilation
+    fi
+}
+
+# $1 - initial error_code
+client_tests() {
+    # testing in opposite VM
+    if [ $server_available -eq 1 ]
+    then
+        negative_test $1 "SERVER :: NON-TIERED" -XX:-TieredCompilation \
+                -server
+        positive_test `expr $1 + 1` "SERVER :: TIERED" -XX:+TieredCompilation \
+                -server
+    fi
+    nontiered_tests `expr $1 + 2` $client_level 
+}
+
+# $1 - initial error_code
+server_tests() {
+    # testing in opposite VM
+    if [ $client_available -eq 1 ]
+    then
+        # tiered is unavailable in client vm, so results w/ flags will be the same as w/o flags
+        negative_test $1 "CLIENT" -client
+    fi
+    nontiered_tests `expr $1 + 2` $server_level
+}
+
+cleanup() {
+    ${RM} -f core*
+    ${RM} -f replay*.txt
+    ${RM} -f hs_err_pid*.log
+    ${RM} -f test_core
+    ${RM} -f test_replay.txt
+}
+
+JAVA=${TESTJAVA}${FS}bin${FS}java
+
+replay_data=test_replay.txt
+
+${JAVA} ${TESTVMOPTS} -Xinternalversion 2>&1 | grep debug
+
+# Only test fastdebug 
+if [ $? -ne 0 ]
+then
+    echo TEST SKIPPED: product build
+    exit 0
+fi
+
+is_int=`${JAVA} ${TESTVMOPTS} -version 2>&1 | grep -c "interpreted mode"`
+# Not applicable for Xint
+if [ $is_int -ne 0 ]
+then
+    echo TEST SKIPPED: interpreted mode
+    exit 0
+fi
+
+cleanup
+
+client_available=`${JAVA} ${TESTVMOPTS} -client -Xinternalversion 2>&1 | \
+        grep -c Client`
+server_available=`${JAVA} ${TESTVMOPTS} -server -Xinternalversion 2>&1 | \
+        grep -c Server`
+is_tiered=`${JAVA} ${TESTVMOPTS} -XX:+PrintFlagsFinal -version | \
+        grep TieredCompilation | \
+        grep -c true`
+# CompLevel_simple -- C1
+client_level=1
+# CompLevel_full_optimization -- C2 or Shark 
+server_level=4
+
+echo "client_available=$client_available"
+echo "server_available=$server_available"
+echo "is_tiered=$is_tiered"
+
+# crash vm in compiler thread with generation replay data and 'small' dump-file
+# $@ - additional vm opts
+generate_replay() {
+    # enable core dump
+    ulimit -c unlimited
+
+    cmd="${JAVA} ${TESTVMOPTS} $@ \
+            -Xms8m \
+            -Xmx32m \
+            -XX:MetaspaceSize=4m \
+            -XX:MaxMetaspaceSize=16m \
+            -XX:InitialCodeCacheSize=512k \
+            -XX:ReservedCodeCacheSize=4m \
+            -XX:ThreadStackSize=512 \
+            -XX:VMThreadStackSize=512 \
+            -XX:CompilerThreadStackSize=512 \
+            -XX:ParallelGCThreads=1 \
+            -XX:CICompilerCount=1 \
+            -Xcomp \
+            -XX:CICrashAt=1 \
+            -XX:+CreateMinidumpOnCrash \
+            -XX:+DumpReplayDataOnError \
+            -XX:ReplayDataFile=${replay_data} \
+            -version"
+    echo GENERATION OF REPLAY.TXT:
+    echo $cmd
+
+    ${cmd} 2>&1 > crash.out
+    
+    core_locations=`grep -i core crash.out | grep "location:" | \
+            sed -e 's/.*location: //'`
+    rm crash.out 
+    # processing core locations for *nix
+    if [ $OS != "windows" ]
+    then
+        # remove 'or' between '/core.<pid>' and 'core'
+        core_locations=`echo $core_locations | \
+                sed -e 's/\([^ ]*\) or \([^ ]*\)/\1 \2/'`
+        # add <core_path>/core.<pid> core.<pid>
+        core=`echo $core_locations | awk '{print $1}'`
+        dir=`dirname $core`
+        core=`basename $core`
+        if [ -n ${core} ]
+        then
+            core_locations="$core_locations $dir${FS}$core"
+        fi
+        core=`echo $core_locations | awk '{print $2}'`
+        if [ -n ${core} ]
+        then
+            core_locations="$core_locations $dir${FS}$core"
+        fi
+    fi
+
+    echo "LOOKING FOR CORE IN ${core_locations}"
+    for core in $core_locations
+    do
+        if [ -r "$core" ]
+        then
+            core_file=$core
+        fi
+    done
+
+    # core-file was found
+    if [ -n "$core_file" ]
+    then
+        ${MV} "${core_file}" test_core
+        core_file=test_core
+    fi
+
+    ${RM} -f hs_err_pid*.log
+}
+
--- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Wed May 08 10:10:05 2013 +0100
@@ -42,6 +42,11 @@
     protected static int COMP_LEVEL_NONE = 0;
     /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */
     protected static int COMP_LEVEL_ANY = -1;
+    /** {@code CompLevel::CompLevel_simple} -- C1 */
+    protected static int COMP_LEVEL_SIMPLE = 1;
+    /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
+    protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
+
     /** Instance of WhiteBox */
     protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
     /** Value of {@code -XX:CompileThreshold} */
@@ -91,6 +96,17 @@
         return result == null ? defaultValue : result;
     }
 
+    /** copy of is_c1_compile(int) from utilities/globalDefinitions.hpp */
+    protected static boolean isC1Compile(int compLevel) {
+        return (compLevel > COMP_LEVEL_NONE)
+                && (compLevel < COMP_LEVEL_FULL_OPTIMIZATION);
+    }
+
+    /** copy of is_c2_compile(int) from utilities/globalDefinitions.hpp */
+    protected static boolean isC2Compile(int compLevel) {
+        return compLevel == COMP_LEVEL_FULL_OPTIMIZATION;
+    }
+
     /** tested method */
     protected final Executable method;
     private final Callable<Integer> callable;
--- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Wed May 08 10:10:05 2013 +0100
@@ -23,6 +23,7 @@
 
 /*
  * @test MakeMethodNotCompilableTest
+ * @bug 8012322
  * @library /testlibrary /testlibrary/whitebox
  * @build MakeMethodNotCompilableTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
@@ -67,28 +68,69 @@
         }
 
         if (TIERED_COMPILATION) {
-            for (int i = 1, n = TIERED_STOP_AT_LEVEL + 1; i < n; ++i) {
-                WHITE_BOX.makeMethodNotCompilable(method, i);
-                if (WHITE_BOX.isMethodCompilable(method, i)) {
+            final int tierLimit = TIERED_STOP_AT_LEVEL + 1;
+            for (int testedTier = 1; testedTier < tierLimit; ++testedTier) {
+                testTier(testedTier);
+            }
+            for (int testedTier = 1; testedTier < tierLimit; ++testedTier) {
+                WHITE_BOX.makeMethodNotCompilable(method, testedTier);
+                if (WHITE_BOX.isMethodCompilable(method, testedTier)) {
                     throw new RuntimeException(method
-                            + " must be not compilable at level" + i);
+                            + " must be not compilable at level" + testedTier);
                 }
-                WHITE_BOX.enqueueMethodForCompilation(method, i);
+                WHITE_BOX.enqueueMethodForCompilation(method, testedTier);
                 checkNotCompiled();
 
                 if (!WHITE_BOX.isMethodCompilable(method)) {
                     System.out.println(method
-                            + " is not compilable after level " + i);
+                            + " is not compilable after level " + testedTier);
                 }
             }
+        } else {
+            compile();
+            checkCompiled();
+            int compLevel = WHITE_BOX.getMethodCompilationLevel(method);
+            WHITE_BOX.deoptimizeMethod(method);
+            WHITE_BOX.makeMethodNotCompilable(method, compLevel);
+            if (WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY)) {
+                throw new RuntimeException(method
+                        + " must be not compilable at CompLevel::CompLevel_any,"
+                        + " after it is not compilable at " + compLevel);
+            }
+            WHITE_BOX.clearMethodState(method);
+
+            // nocompilable at opposite level must make no sense
+            int oppositeLevel;
+            if (isC1Compile(compLevel)) {
+              oppositeLevel = COMP_LEVEL_FULL_OPTIMIZATION;
+            } else {
+              oppositeLevel = COMP_LEVEL_SIMPLE;
+            }
+            WHITE_BOX.makeMethodNotCompilable(method, oppositeLevel);
+
+            if (!WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY)) {
+                  throw new RuntimeException(method
+                        + " must be compilable at CompLevel::CompLevel_any,"
+                        + " even it is not compilable at opposite level ["
+                        + compLevel + "]");
+            }
 
-            // WB.clearMethodState() must reset no-compilable flags
-            WHITE_BOX.clearMethodState(method);
-            if (!WHITE_BOX.isMethodCompilable(method)) {
-                throw new RuntimeException(method
-                        + " is not compilable after clearMethodState()");
+            if (!WHITE_BOX.isMethodCompilable(method, compLevel)) {
+                  throw new RuntimeException(method
+                        + " must be compilable at level " + compLevel
+                        + ", even it is not compilable at opposite level ["
+                        + compLevel + "]");
             }
         }
+
+        // clearing after tiered/non-tiered tests
+        // WB.clearMethodState() must reset no-compilable flags
+        WHITE_BOX.clearMethodState(method);
+        if (!WHITE_BOX.isMethodCompilable(method)) {
+            throw new RuntimeException(method
+                    + " is not compilable after clearMethodState()");
+        }
+
         WHITE_BOX.makeMethodNotCompilable(method);
         if (WHITE_BOX.isMethodCompilable(method)) {
             throw new RuntimeException(method + " must be not compilable");
@@ -108,4 +150,65 @@
         compile();
         checkCompiled();
     }
+
+    // separately tests each tier
+    private void testTier(int testedTier) {
+        if (!WHITE_BOX.isMethodCompilable(method, testedTier)) {
+            throw new RuntimeException(method
+                    + " is not compilable on start");
+        }
+        WHITE_BOX.makeMethodNotCompilable(method, testedTier);
+
+        // tests for all other tiers
+        for (int anotherTier = 1, tierLimit = TIERED_STOP_AT_LEVEL + 1;
+                    anotherTier < tierLimit; ++anotherTier) {
+            boolean isCompilable = WHITE_BOX.isMethodCompilable(method,
+                    anotherTier);
+            if (sameCompile(testedTier, anotherTier)) {
+                if (isCompilable) {
+                    throw new RuntimeException(method
+                            + " must be not compilable at level " + anotherTier
+                            + ", if it is not compilable at " + testedTier);
+                }
+                WHITE_BOX.enqueueMethodForCompilation(method, anotherTier);
+                checkNotCompiled();
+            } else {
+                if (!isCompilable) {
+                    throw new RuntimeException(method
+                            + " must be compilable at level " + anotherTier
+                            + ", even if it is not compilable at "
+                            + testedTier);
+                }
+                WHITE_BOX.enqueueMethodForCompilation(method, anotherTier);
+                checkCompiled();
+                WHITE_BOX.deoptimizeMethod(method);
+            }
+
+            if (!WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY)) {
+                throw new RuntimeException(method
+                        + " must be compilable at 'CompLevel::CompLevel_any'"
+                        + ", if it is not compilable only at " + testedTier);
+            }
+        }
+
+        // clear state after test
+        WHITE_BOX.clearMethodState(method);
+        if (!WHITE_BOX.isMethodCompilable(method, testedTier)) {
+            throw new RuntimeException(method
+                    + " is not compilable after clearMethodState()");
+        }
+    }
+
+    private boolean sameCompile(int level1, int level2) {
+        if (level1 == level2) {
+            return true;
+        }
+        if (isC1Compile(level1) && isC1Compile(level2)) {
+            return true;
+        }
+        if (isC2Compile(level1) && isC2Compile(level2)) {
+            return true;
+        }
+        return false;
+    }
 }
--- a/hotspot/test/gc/7072527/TestFullGCCount.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/test/gc/7072527/TestFullGCCount.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,71 +25,67 @@
  * @test TestFullGCount.java
  * @bug 7072527
  * @summary CMS: JMM GC counters overcount in some cases
- * @run main/othervm -XX:+UseConcMarkSweepGC TestFullGCCount
- *
+ * @run main/othervm -XX:+PrintGC TestFullGCCount
  */
 import java.util.*;
 import java.lang.management.*;
 
+/*
+ * Originally for a specific failure in CMS, this test now monitors all
+ * collectors for double-counting of collections.
+ */
 public class TestFullGCCount {
 
-    public String collectorName = "ConcurrentMarkSweep";
-
-    public static void main(String [] args) {
+    static List<GarbageCollectorMXBean> collectors = ManagementFactory.getGarbageCollectorMXBeans();
 
-        TestFullGCCount t = null;
-        if (args.length==2) {
-            t = new TestFullGCCount(args[0], args[1]);
-        } else {
-            t = new TestFullGCCount();
+    public static void main(String[] args) {
+        int iterations = 20;
+        boolean failed = false;
+        String errorMessage = "";
+        HashMap<String, List> counts = new HashMap<String, List>();
+
+        // Prime the collection of count lists for all collectors.
+        for (int i = 0; i < collectors.size(); i++) {
+            GarbageCollectorMXBean collector = collectors.get(i);
+            counts.put(collector.getName(), new ArrayList<Long>(iterations));
         }
-        System.out.println("Monitoring collector: " + t.collectorName);
-        t.run();
-    }
 
-    public TestFullGCCount(String pool, String collector) {
-        collectorName = collector;
-    }
-
-    public TestFullGCCount() {
-    }
+        // Perform some gc, record collector counts.
+        for (int i = 0; i < iterations; i++) {
+            System.gc();
+            addCollectionCount(counts, i);
+        }
 
-    public void run() {
-        int count = 0;
-        int iterations = 20;
-        long counts[] = new long[iterations];
-        boolean diffAlways2 = true; // assume we will fail
+        // Check the increments:
+        //   Old gen collectors should increase by one,
+        //   New collectors may or may not increase.
+        //   Any increase >=2 is unexpected.
+        for (String collector : counts.keySet()) {
+            System.out.println("Checking: " + collector);
 
-        for (int i=0; i<iterations; i++) {
-            System.gc();
-            counts[i] = getCollectionCount();
-            if (i>0) {
-                if (counts[i] - counts[i-1] != 2) {
-                    diffAlways2 = false;
+            for (int i = 0; i < iterations - 1; i++) {
+                List<Long> theseCounts = counts.get(collector);
+                long a = theseCounts.get(i);
+                long b = theseCounts.get(i + 1);
+                if (b - a >= 2) {
+                    failed = true;
+                    errorMessage += "Collector '" + collector + "' has increment " + (b - a) +
+                                    " at iteration " + i + "\n";
                 }
             }
         }
-        if (diffAlways2) {
-            throw new RuntimeException("FAILED: System.gc must be incrementing count twice.");
+        if (failed) {
+            System.err.println(errorMessage);
+            throw new RuntimeException("FAILED: System.gc collections miscounted.");
         }
         System.out.println("Passed.");
     }
 
-    private long getCollectionCount() {
-        long count = 0;
-        List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
-        List<GarbageCollectorMXBean> collectors = ManagementFactory.getGarbageCollectorMXBeans();
-        for (int i=0; i<collectors.size(); i++) {
+    private static void addCollectionCount(HashMap<String, List> counts, int iteration) {
+        for (int i = 0; i < collectors.size(); i++) {
             GarbageCollectorMXBean collector = collectors.get(i);
-            String name = collector.getName();
-            if (name.contains(collectorName)) {
-                System.out.println(name + ": collection count = "
-                                   + collector.getCollectionCount());
-                count = collector.getCollectionCount();
-            }
+            List thisList = counts.get(collector.getName());
+            thisList.add(collector.getCollectionCount());
         }
-        return count;
     }
-
 }
-
--- a/hotspot/test/gc/TestVerifyDuringStartup.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/test/gc/TestVerifyDuringStartup.java	Wed May 08 10:10:05 2013 +0100
@@ -23,22 +23,43 @@
 
 /* @test TestVerifyDuringStartup.java
  * @key gc
- * @bug 8010463
+ * @bug 8010463 8011343 8011898
  * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463
  * @library /testlibrary
  */
 
+import com.oracle.java.testlibrary.JDKToolFinder;
 import com.oracle.java.testlibrary.OutputAnalyzer;
 import com.oracle.java.testlibrary.ProcessTools;
+import java.util.ArrayList;
+import java.util.Collections;
 
 public class TestVerifyDuringStartup {
   public static void main(String args[]) throws Exception {
+    ArrayList<String> vmOpts = new ArrayList();
+
+    String testVmOptsStr = System.getProperty("test.java.opts");
+    if (!testVmOptsStr.isEmpty()) {
+      String[] testVmOpts = testVmOptsStr.split(" ");
+      Collections.addAll(vmOpts, testVmOpts);
+    }
+    Collections.addAll(vmOpts, new String[] {"-XX:-UseTLAB",
+                                             "-XX:+UnlockDiagnosticVMOptions",
+                                             "-XX:+VerifyDuringStartup",
+                                             "-version"});
+
+    System.out.print("Testing:\n" + JDKToolFinder.getJDKTool("java"));
+    for (int i = 0; i < vmOpts.size(); i += 1) {
+      System.out.print(" " + vmOpts.get(i));
+    }
+    System.out.println();
+
     ProcessBuilder pb =
-      ProcessTools.createJavaProcessBuilder(System.getProperty("test.vm.opts"),
-                                            "-XX:-UseTLAB",
-                                            "-XX:+UnlockDiagnosticVMOptions",
-                                            "-XX:+VerifyDuringStartup", "-version");
+      ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+    System.out.println("Output:\n" + output.getOutput());
+
     output.shouldContain("[Verifying");
     output.shouldHaveExitValue(0);
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/concurrentMarkSweep/GuardShrinkWarning.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test GuardShrinkWarning
+ * @summary Remove warning about CMS generation shrinking.
+ * @bug 8012111
+ * @key gc
+ * @key regression
+ * @library /testlibrary
+ * @run main/othervm GuardShrinkWarning
+ * @author jon.masamitsu@oracle.com
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class GuardShrinkWarning {
+  public static void main(String args[]) throws Exception {
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+      "-showversion",
+      "-XX:+UseConcMarkSweepGC",
+      "-XX:+ExplicitGCInvokesConcurrent",
+      "GuardShrinkWarning$SystemGCCaller"
+      );
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+    output.shouldNotContain("Shrinking of CMS not yet implemented");
+
+    output.shouldNotContain("error");
+
+    output.shouldHaveExitValue(0);
+  }
+  static class SystemGCCaller {
+    public static void main(String [] args) {
+      System.gc();
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/lambda-features/PublicStaticInterfaceMethodHandling.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8013418
+ * @summary [JDK 8] Test correct handling of static public interface methods
+ * @run main/othervm -Xverify:all PublicStaticInterfaceMethodHandling
+ */
+
+class TestClass implements InterfaceWithStaticAndDefaultMethods {
+}
+
+interface InterfaceWithStaticAndDefaultMethods {
+    public static String get() {
+        return "Hello from StaticMethodInInterface.get()";
+    }
+    default void default_method() {
+        System.out.println("Default method FunctionalInterface:default_method()");
+    }
+}
+
+public class PublicStaticInterfaceMethodHandling  {
+    public static void main(String[] args) {
+        TestClass tc = new TestClass();
+        tc.default_method();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/memory/ReserveMemory.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @key regression
+ * @bug 8012015
+ * @summary Make sure reserved (but uncommitted) memory is not accessible
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ReserveMemory
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main ReserveMemory
+ */
+
+import com.oracle.java.testlibrary.*;
+
+import java.lang.reflect.Field;
+import sun.hotspot.WhiteBox;
+import sun.misc.Unsafe;
+
+public class ReserveMemory {
+  private static Unsafe getUnsafe() throws Exception {
+    Field f = Unsafe.class.getDeclaredField("theUnsafe");
+    f.setAccessible(true);
+    return (Unsafe)f.get(null);
+  }
+
+  private static boolean isWindows() {
+    return System.getProperty("os.name").toLowerCase().startsWith("win");
+  }
+
+  public static void main(String args[]) throws Exception {
+    if (args.length > 0) {
+      long address = WhiteBox.getWhiteBox().reserveMemory(4096);
+
+      System.out.println("Reserved memory at address: 0x" + Long.toHexString(address));
+      System.out.println("Will now read from the address, expecting a crash!");
+
+      int x = getUnsafe().getInt(address);
+
+      throw new Exception("Read of reserved/uncommitted memory unexpectedly succeeded, expected crash!");
+    }
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+          "-Xbootclasspath/a:.",
+          "-XX:+UnlockDiagnosticVMOptions",
+          "-XX:+WhiteBoxAPI",
+          "ReserveMemory",
+          "test");
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    if (isWindows()) {
+      output.shouldContain("EXCEPTION_ACCESS_VIOLATION");
+    } else {
+      output.shouldContain("SIGSEGV");
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/sanity/WhiteBox.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test WhiteBox
+ * @bug 8011675
+ * @summary verify that whitebox can be used even if not all functions are declared in java-part
+ * @author igor.ignatyev@oracle.com
+ * @library /testlibrary
+ * @compile WhiteBox.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox
+ * @clean sun.hotspot.WhiteBox
+ */
+
+package sun.hotspot;
+
+public class WhiteBox {
+    private static native void registerNatives();
+    static { registerNatives(); }
+    public native int notExistedMethod();
+    public native int getHeapOopSize();
+    public static void main(String[] args) {
+        WhiteBox wb = new WhiteBox();
+        if (wb.getHeapOopSize() < 0) {
+            throw new Error("wb.getHeapOopSize() < 0");
+        }
+        boolean catched = false;
+        try {
+            wb.notExistedMethod();
+        } catch (UnsatisfiedLinkError e) {
+            catched = true;
+        }
+        if (!catched) {
+            throw new Error("wb.notExistedMethod() was invoked");
+        }
+    }
+}
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Wed May 08 10:10:05 2013 +0100
@@ -111,6 +111,9 @@
   // Intered strings
   public native boolean isInStringTable(String str);
 
+  // Memory
+  public native long reserveMemory(long size);
+
   // force Full GC
   public native void fullGC();
 }
--- a/jaxp/.hgtags	Sun Apr 28 08:15:54 2013 +0100
+++ b/jaxp/.hgtags	Wed May 08 10:10:05 2013 +0100
@@ -209,3 +209,4 @@
 41b50e2c5ea3f4aa1af729e1deb1678cb3e1ef9c jdk8-b85
 ca71ec37b2efc9c3f0971ebabb3a6eb1213d76de jdk8-b86
 eddbc8ad2435a89f64729512337c9f2669e4dd85 jdk8-b87
+7122f7bb0fcc8a39e5254402119b2ee3fa0ad313 jdk8-b88
--- a/jaxws/.hgtags	Sun Apr 28 08:15:54 2013 +0100
+++ b/jaxws/.hgtags	Wed May 08 10:10:05 2013 +0100
@@ -209,3 +209,4 @@
 8c0b6bccfe474576d6b30d1582c4329029330150 jdk8-b85
 a5e7c2f093c9996ab3419db1565094a07b059e9c jdk8-b86
 72e03566f0a61282cc48ebc869803b256cccd66c jdk8-b87
+24fa5452e5d4e9df8b85196283275a6ca4b4adb4 jdk8-b88
--- a/jdk/.hgtags	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/.hgtags	Wed May 08 10:10:05 2013 +0100
@@ -209,3 +209,4 @@
 296676d534c52888c36e305a2bf7f345c4ca70f8 jdk8-b85
 7989cd0cc3a9149864589438ee2c949015d8aa9a jdk8-b86
 d5228e624826a10ccc5b05f30ad8d839b58fe48d jdk8-b87
+8dbb4b159e04de3c447c9242c70505e71f8624c7 jdk8-b88
--- a/jdk/make/docs/CORE_PKGS.gmk	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/docs/CORE_PKGS.gmk	Wed May 08 10:10:05 2013 +0100
@@ -142,6 +142,7 @@
   java.util.prefs                                \
   java.util.regex                                \
   java.util.spi                                  \
+  java.util.stream                               \
   java.util.zip                                  \
   javax.accessibility                            \
   javax.activation                               \
--- a/jdk/make/java/java/FILES_java.gmk	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/java/java/FILES_java.gmk	Wed May 08 10:10:05 2013 +0100
@@ -252,6 +252,7 @@
     java/util/Scanner.java \
     java/util/InputMismatchException.java \
     java/util/Stack.java \
+    java/util/StringJoiner.java \
     java/util/StringTokenizer.java \
     java/util/TimeZone.java \
         java/util/SimpleTimeZone.java \
--- a/jdk/make/netbeans/common/closed-share-sources.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/closed-share-sources.ent	Wed May 08 10:10:05 2013 +0100
@@ -37,6 +37,7 @@
     <location>${root}/src/closed/share/classes</location>
     <includes>${includes}</includes>
     <excludes>${excludes}</excludes>
+    <encoding>US-ASCII</encoding>
 </source-folder>
 <source-folder>
     <label>Closed-Source Packages</label>
--- a/jdk/make/netbeans/common/demo-view.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/demo-view.ent	Wed May 08 10:10:05 2013 +0100
@@ -31,7 +31,7 @@
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
 
-<source-folder style="tree">
+<source-folder style="tree"> <!-- hierarchy in demo/ dir isn't packages -->
     <label>Demos</label>
     <location>${root}/src/share/demo</location>
     <includes>${demos}</includes>
--- a/jdk/make/netbeans/common/java-data-native.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/java-data-native.ent	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -34,8 +34,9 @@
 <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
     <compilation-unit>
         <package-root>${root}/src/share/classes</package-root>
+        <package-root>${root}/src/macosx/classes</package-root>
+        <package-root>${root}/src/solaris/classes</package-root>
         <package-root>${root}/src/windows/classes</package-root>
-        <package-root>${root}/src/solaris/classes</package-root>
         <classpath mode="boot">${bootstrap.jdk}/jre/lib/rt.jar</classpath>
         <built-to>${root}/build/${platform}-${arch}/classes</built-to>
         <javadoc-built-to>${root}/build/${platform}-${arch}/docs/api</javadoc-built-to>
@@ -44,6 +45,7 @@
     <compilation-unit>
         <package-root>${root}/test</package-root>
         <unit-tests/>
+        <classpath mode="compile">${jtreg.home}/lib/testng.jar</classpath>
         <source-level>1.8</source-level>
     </compilation-unit>
 </java-data>
--- a/jdk/make/netbeans/common/java-data-no-native.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/java-data-no-native.ent	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -42,6 +42,7 @@
     <compilation-unit>
         <package-root>${root}/test</package-root>
         <unit-tests/>
+        <classpath mode="compile">${jtreg.home}/lib/testng.jar</classpath>
         <source-level>1.8</source-level>
     </compilation-unit>
 </java-data>
--- a/jdk/make/netbeans/common/jtreg-view.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/jtreg-view.ent	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -31,7 +31,7 @@
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
 
-<source-folder style="tree">
+<source-folder style="tree"> <!-- hierarchy in test/ dir isn't packages -->
     <label>Tests</label>
     <location>${root}/test</location>
     <includes>${jtreg.tests}</includes>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/common/macosx-sources.ent	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2007, 2013, 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.
+-->
+
+<!--
+  OS X is a trademark in the United States and other countries,
+  exclusively licensed through Apple Inc.
+-->
+<source-folder>
+    <label>Sources for OS Xâ„¢ Platform</label>
+    <type>java</type>
+    <location>${root}/src/macosx/classes</location>
+    <includes>${includes}</includes>
+    <excludes>${excludes}</excludes>
+    <encoding>US-ASCII</encoding>
+</source-folder>
+<source-folder>
+    <label>Sources for OS Xâ„¢ Platform</label>
+    <location>${root}/src/macosx/classes</location>
+</source-folder>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/common/macosx-view.ent	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2007, 2013, 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.
+-->
+
+<!--
+  OS X is a trademark in the United States and other countries,
+  exclusively licensed through Apple Inc.
+-->
+<source-folder style="tree">
+    <label>Sources for OS Xâ„¢ Platform</label>
+    <location>${root}/src/macosx/classes</location>
+    <includes>${includes}</includes>
+    <excludes>${excludes}</excludes>
+</source-folder>
--- a/jdk/make/netbeans/common/properties.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/properties.ent	Wed May 08 10:10:05 2013 +0100
@@ -41,3 +41,5 @@
 <property-file>${user.home}/.openjdk/build.properties</property-file>
 <property-file>build.properties</property-file>
 <property name="bootstrap.jdk">${java.home}/..</property>
+<property name="jtreg.home">${env.JT_HOME}</property>
+<property name="jtreg.tests">**</property>
--- a/jdk/make/netbeans/common/sample-view.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/sample-view.ent	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -31,7 +31,7 @@
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
 
-<source-folder style="tree">
+<source-folder style="tree"> <!-- hierarchy in sample/ dir isn't packages -->
     <label>Samples</label>
     <location>${root}/src/share/sample</location>
     <includes>${samples}</includes>
--- a/jdk/make/netbeans/common/share-sources.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/share-sources.ent	Wed May 08 10:10:05 2013 +0100
@@ -37,6 +37,7 @@
     <location>${root}/src/share/classes</location>
     <includes>${includes}</includes>
     <excludes>${excludes}</excludes>
+    <encoding>US-ASCII</encoding>
 </source-folder>
 <source-folder>
     <label>Sources for All Platforms</label>
--- a/jdk/make/netbeans/common/shared.xml	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/shared.xml	Wed May 08 10:10:05 2013 +0100
@@ -276,7 +276,7 @@
         <!-- You can override this target in the ../build.xml file. -->
     </target>
     <target name="-jtreg" depends="-init,-pre-jtreg,-taskdef-jtreg,-check-tests-defined,-jtreg-setup,-jtreg-make,-jtreg-ant,-post-jtreg">
-        <property name="jtreg.report" location="${jtreg.dir}/JTreport/report.html"/>
+        <property name="jtreg.report" location="${jtreg.dir}/JTreport/html/report.html"/>
         <condition property="jtreg.passed">
             <equals arg1="${jtreg.result}" arg2="0"/>
         </condition>
@@ -338,7 +338,7 @@
         <!-- Note: even with this default value, includes/excludes
          from share.src.dir get javadoc'd; see packageset below -->
         <property name="javadoc.packagenames" value="none"/> <!-- default, can be overridden per user or per project -->
-        <javadoc destdir="${javadoc.dir}" source="1.5"
+        <javadoc destdir="${javadoc.dir}" source="1.8"
             windowtitle="UNOFFICIAL" failonerror="true" use="true"
             author="false" version="false"
             packagenames="${javadoc.packagenames}">
--- a/jdk/make/netbeans/common/unix-sources.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/unix-sources.ent	Wed May 08 10:10:05 2013 +0100
@@ -41,6 +41,7 @@
     <location>${root}/src/solaris/classes</location>
     <includes>${includes}</includes>
     <excludes>${excludes}</excludes>
+    <encoding>US-ASCII</encoding>
 </source-folder>
 <source-folder>
     <label>Sources for Unix® Platform</label>
--- a/jdk/make/netbeans/common/windows-sources.ent	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/common/windows-sources.ent	Wed May 08 10:10:05 2013 +0100
@@ -37,6 +37,7 @@
     <location>${root}/src/windows/classes</location>
     <includes>${includes}</includes>
     <excludes>${excludes}</excludes>
+    <encoding>US-ASCII</encoding>
 </source-folder>
 <source-folder>
     <label>Sources for Windows Platform</label>
--- a/jdk/make/netbeans/j2se/nbproject/project.xml	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/j2se/nbproject/project.xml	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -34,12 +34,14 @@
 <!DOCTYPE project [
     <!ENTITY properties SYSTEM "../../common/properties.ent">
     <!ENTITY share-sources SYSTEM "../../common/share-sources.ent">
+    <!ENTITY macosx-sources SYSTEM "../../common/macosx-sources.ent">
     <!ENTITY unix-sources SYSTEM "../../common/unix-sources.ent">
     <!ENTITY windows-sources SYSTEM "../../common/windows-sources.ent">
     <!ENTITY jtreg-sources SYSTEM "../../common/jtreg-sources.ent">
     <!ENTITY build-folder SYSTEM "../../common/build-folder.ent">
     <!ENTITY standard-bindings SYSTEM "../../common/standard-bindings.ent">
     <!ENTITY share-view SYSTEM "../../common/share-view.ent">
+    <!ENTITY macosx-view SYSTEM "../../common/macosx-view.ent">
     <!ENTITY unix-view SYSTEM "../../common/unix-view.ent">
     <!ENTITY windows-view SYSTEM "../../common/windows-view.ent">
     <!ENTITY jtreg-view SYSTEM "../../common/jtreg-view.ent">
@@ -58,6 +60,7 @@
             </properties>
             <folders>
                 &share-sources;
+                &macosx-sources;
                 &unix-sources;
                 &windows-sources;
                 &build-folder;
@@ -83,6 +86,7 @@
             <view>
                 <items>
                     &share-view;
+                    &macosx-view;
                     &unix-view;
                     &windows-view;
                     &jtreg-view;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/jdbc/README	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,64 @@
+Working on JDBC Using the NetBeans IDE
+
+This JDBC NetBeans project allows a developer interested in making changes
+to and/or fixing bugs in the JDBC source to modify, build, run and test
+as well as generating the javadoc.
+
+README FIRST
+
+  make/netbeans/README to get started with NetBeans IDE and OpenJDK, and
+  working with the OpenJDK NetBeans projects.
+
+WORKING WITH JDBC
+
+JDBC doesn't contain native code. You don't need to
+have all the Java SE sources to work on JDBC but just the following subset:
+
+            make/netbeans/ 
+            src/share/classes/com/sun/rowset/
+            src/share/classes/java/sql/
+            src/share/classes/javax/sql/
+            test/TEST.ROOT
+            test/java/sql/
+            test/javax/sql/
+
+The set of actions supported by this project are:
+
+* Build Project:
+
+  - Compiles JDBC source files and puts the class files under
+    build/${platform}-${arch}/classes.
+
+  - Generates JDBC's jar file under dist/lib/jdbc.jar
+
+    This new jar file could be used to patch an existing JDK installation
+    by using -Xbootclasspath/p:$MYSRC/dist/lib/jdbc.jar
+
+* Generate Javadoc for Project
+
+  - Generates the javadoc for the JDBC source files,
+
+  - The javadoc is generated under build/${platform}-${arch}/javadoc/jdbc.
+
+* Test Project
+
+  - Runs the JDBC jtreg unit tests located under test/java/sql or test/javax/sql.
+
+  - The test results are written under
+
+        build/${platform}-${arch}/jtreg/jdbc
+
+    and the HTML test report can be found at
+
+        build/${platform}-${arch}/jtreg/jdbc/JTreport/html/report.html
+
+
+
+* Clean Project
+
+  - Cleans the files created by this projet under build and dist.
+
+IMPORTANT NOTE
+
+  Please make sure to follow carefully the governance rules documented at
+  http://openjdk.dev.java.net/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/jdbc/build.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 2007, 2013, 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.
+#
+
+includes=\
+    java/sql/ \
+    javax/sql/ \
+    com/sun/rowset/
+excludes= 
+jtreg.tests=\
+    java/sql/ \
+    javax/sql/
+
+build.jdk.version = 1.8.0
+build.release = ${build.jdk.version}-opensource
+build.number = b00
+jdbc.version = ${build.release}-${user.name}-${build.number}
+jdbc.args = -debug
+javadoc.options=-J-Xmx256m -Xdoclint:none -keywords  -quiet
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/jdbc/build.xml	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,52 @@
+<!--
+ Copyright (c) 2007, 2013, 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.
+-->
+
+<project name="jdbc" default="build" basedir=".">
+
+    <import file="../common/shared.xml"/>
+
+    <target name="-post-compile">
+        <mkdir dir="${dist.dir}/lib"/>
+        <jar destfile="${dist.dir}/lib/jdbc.jar">
+            <fileset dir="${classes.dir}">
+                <include name="java/sql/**/*.class"/>
+                <include name="javax/sql/**/*.class"/>
+                <include name="com/sun/rowset/**/*.class"/>
+            </fileset>
+        </jar>
+    </target>
+
+    
+    <target name="clean" depends="-init,shared.clean">
+        <delete file="${dist.dir}/lib/jdbc.jar"/>
+    </target>
+
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/netbeans/jdbc/nbproject/project.xml	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2013, 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.
+-->
+
+<!DOCTYPE project [
+    <!ENTITY properties SYSTEM "../../common/properties.ent">
+    <!ENTITY share-sources SYSTEM "../../common/share-sources.ent">
+    <!ENTITY jtreg-sources SYSTEM "../../common/jtreg-sources.ent">
+    <!ENTITY build-folder SYSTEM "../../common/build-folder.ent">
+    <!ENTITY standard-bindings SYSTEM "../../common/standard-bindings.ent">
+    <!ENTITY share-view SYSTEM "../../common/share-view.ent">
+    <!ENTITY jtreg-view SYSTEM "../../common/jtreg-view.ent">
+    <!ENTITY file-view SYSTEM "../../common/file-view.ent">
+    <!ENTITY standard-actions SYSTEM "../../common/standard-actions.ent">
+    <!ENTITY java-data-no-native SYSTEM "../../common/java-data-no-native.ent">
+]>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.ant.freeform</type>
+    <configuration>
+        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
+            <name>JDBC</name> <!-- Customized -->
+            <properties>
+                <property name="name">jdbc</property> <!-- Customized -->
+                &properties;
+            </properties>
+            <folders>
+                &share-sources;
+                &jtreg-sources;
+                &build-folder;
+            </folders>
+            <ide-actions>
+                &standard-bindings;
+                <action name="run">
+                    <target>run</target>
+                </action>
+                <action name="debug">
+                    <target>debug</target>
+                </action>
+               <action name="rowsetjavadoc">
+                    <target>debug</target>
+                </action>
+            </ide-actions>
+            <view>
+                <items>
+                    &share-view;
+                    &jtreg-view;
+                    &file-view;
+                </items>
+                <context-menu>
+                    &standard-actions;
+                    <ide-action name="run"/>
+                    <ide-action name="debug"/>
+                    <ide-action name="rowsetjavadoc"/>
+                </context-menu>
+            </view>
+        </general-data>
+        &java-data-no-native;
+    </configuration>
+</project>
--- a/jdk/make/netbeans/world/nbproject/project.xml	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/netbeans/world/nbproject/project.xml	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -34,11 +34,13 @@
 <!DOCTYPE project [
     <!ENTITY properties SYSTEM "../../common/properties.ent">
     <!ENTITY share-sources SYSTEM "../../common/share-sources.ent">
+    <!ENTITY macosx-sources SYSTEM "../../common/macosx-sources.ent">
     <!ENTITY unix-sources SYSTEM "../../common/unix-sources.ent">
     <!ENTITY windows-sources SYSTEM "../../common/windows-sources.ent">
     <!ENTITY build-folder SYSTEM "../../common/build-folder.ent">
     <!ENTITY standard-bindings SYSTEM "../../common/standard-bindings.ent">
     <!ENTITY share-view SYSTEM "../../common/share-view.ent">
+    <!ENTITY macosx-view SYSTEM "../../common/macosx-view.ent">
     <!ENTITY unix-view SYSTEM "../../common/unix-view.ent">
     <!ENTITY windows-view SYSTEM "../../common/windows-view.ent">
     <!ENTITY file-view SYSTEM "../../common/file-view.ent">
@@ -56,6 +58,7 @@
             </properties>
             <folders>
                 &share-sources;
+                &macosx-sources;
                 &unix-sources;
                 &windows-sources;
                 &build-folder;
@@ -66,6 +69,7 @@
             <view>
                 <items>
                     &share-view;
+                    &macosx-view;
                     &unix-view;
                     &windows-view;
                     &file-view;
--- a/jdk/make/tools/src/build/tools/deps/refs.allowed	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/make/tools/src/build/tools/deps/refs.allowed	Wed May 08 10:10:05 2013 +0100
@@ -13,10 +13,11 @@
 javax.security.auth.kerberos.KerberosKey=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
 javax.security.auth.kerberos.KerberosPrincipal=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
 javax.security.auth.kerberos.KerberosTicket=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+javax.security.auth.kerberos.KeyTab=sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
 javax.security.auth.kerberos.ServicePermission=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
 sun.security.jgss.GSSCaller=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
 sun.security.jgss.krb5.Krb5Util=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
-sun.security.jgss.krb5.ServiceCreds=sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.jgss.krb5.ServiceCreds=sun.security.ssl.krb5.Krb5ProxyImpl,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
 sun.security.krb5.EncryptedData= sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
 sun.security.krb5.EncryptionKey=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
 sun.security.krb5.internal.crypto.KeyUsage=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Wed May 08 10:10:05 2013 +0100
@@ -63,7 +63,12 @@
 # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
 # not on other platforms.
 ifeq ($(OPENJDK_TARGET_OS), windows)
-    WINDOWS_ONLY := true
+    DEBUG_ALL_BINARIES := true
+endif
+
+# Build everything with debugging on OpenJDK
+ifdef OPENJDK
+    DEBUG_ALL_BINARIES := true
 endif
 
 #
@@ -91,7 +96,8 @@
 			-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
 		CFLAGS_windows_debug:=-DLOGGING,\
 		ARFLAGS:=$(ARFLAGS),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 else
 
@@ -105,7 +111,8 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) \
 			-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
 		LDFLAGS:=-nostdlib -r -arch x86_64,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
 $(BUILD_LIBFDLIBM) : $(BUILD_LIBFDLIBM_MAC)
@@ -257,7 +264,7 @@
 			  -D "JDK_FTYPE=0x2L",\
 		REORDER:=$(LIBJAVA_REORDER), \
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJAVA)
 
@@ -308,7 +315,7 @@
 			  -D "JDK_INTERNAL_NAME=mlib_image" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBMLIB_IMAGE) : $(BUILD_LIBJAVA)
 
@@ -431,7 +438,8 @@
                          $(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_solaris:=-lc,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image_v))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image_v,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)
 
@@ -739,7 +747,7 @@
 			  -D "JDK_INTERNAL_NAME=awt" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBAWT) : $(BUILD_LIBJAVA)
 
@@ -895,7 +903,8 @@
 			  -D "JDK_FNAME=xawt.dll" \
 			  -D "JDK_INTERNAL_NAME=xawt" \
 			  -D "JDK_FTYPE=0x2L",\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_xawt))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_xawt,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBAWT_XAWT) : $(BUILD_LIBJAVA)
 
@@ -956,7 +965,7 @@
 			  -D "JDK_INTERNAL_NAME=zip" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libzip,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBZIP) : $(BUILD_LIBJAVA)
 
@@ -986,7 +995,7 @@
 			  -D "JDK_FNAME=unpack.dll" \
 			  -D "JDK_INTERNAL_NAME=unpack" \
 			  -D "JDK_FTYPE=0x2L",\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBUNPACK) : $(BUILD_LIBJAVA)
 
@@ -1100,7 +1109,7 @@
 			  -D "JDK_INTERNAL_NAME=dt_shmem" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_shmem,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
   BUILD_LIBRARIES += $(BUILD_LIBDT_SHMEM)
 
@@ -1134,7 +1143,7 @@
 			  -D "JDK_INTERNAL_NAME=jdwp" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjdwp,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJDWP) : $(BUILD_LIBJAVA)
 
@@ -1175,7 +1184,7 @@
 			  -D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjaas,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJAAS) : $(BUILD_LIBJAVA)
 
@@ -1240,7 +1249,7 @@
 			  -D "JDK_INTERNAL_NAME=lcms" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/liblcms,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
     BUILD_LIBRARIES += $(BUILD_LIBLCMS)
 
@@ -1300,7 +1309,7 @@
 			  -D "JDK_FTYPE=0x2L",\
 		REORDER:=$(BUILD_LIBJPEG_REORDER),\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjpeg,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJPEG) : $(BUILD_LIBJAVA)
 
@@ -1377,7 +1386,7 @@
 			  -D "JDK_INTERNAL_NAME=fontmanager" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfontmanager,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBFONTMANAGER) : $(BUILD_LIBAWT)
 
@@ -1434,7 +1443,7 @@
 			  -D "JDK_INTERNAL_NAME=t2k" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libt2k,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
     # t2k is linked against fontmanager
     $(BUILD_LIBT2K) : $(BUILD_LIBFONTMANAGER)
@@ -1472,7 +1481,7 @@
 			  -D "JDK_INTERNAL_NAME=jawt" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJAWT) : $(BUILD_LIBAWT)
 
@@ -1521,7 +1530,8 @@
 		LDFLAGS_SUFFIX_solaris:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender,\
 		LDFLAGS_SUFFIX_macosx:=-Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
 				       -framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 ifndef BUILD_HEADLESS_ONLY
 $(BUILD_LIBJAWT) : $(BUILD_LIBAWT_XAWT)
@@ -1828,7 +1838,7 @@
 			  -D "JDK_INTERNAL_NAME=net" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnet,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBNET) : $(BUILD_LIBJAVA)
 
@@ -1965,7 +1975,7 @@
 			  -D "JDK_INTERNAL_NAME=nio" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnio,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBNIO)
 
@@ -2002,7 +2012,8 @@
 		LDFLAGS_SUFFIX_posix:=-lnio -lnet,\
 		LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm -lc,\
 		LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
     BUILD_LIBRARIES += $(BUILD_LIBSCTP)
 
@@ -2126,7 +2137,7 @@
 			  -D "JDK_INTERNAL_NAME=jli" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJLI)
 
@@ -2143,7 +2154,8 @@
 		OPTIMIZATION:=HIGH, \
 		CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
 		ARFLAGS:=$(ARFLAGS),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
 
@@ -2161,7 +2173,8 @@
 		OPTIMIZATION:=HIGH, \
 		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS),\
 		LDFLAGS:=-nostdlib -r,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(JDK_OUTPUTDIR)/objs/libjli_static.a : $(BUILD_LIBJLI_STATIC)
 	$(call install-file)
@@ -2192,7 +2205,7 @@
 			  -D "JDK_INTERNAL_NAME=jfr" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjfr,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJFR)
 
@@ -2244,7 +2257,7 @@
 			  -D "JDK_INTERNAL_NAME=kcms" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkcms,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBKCMS) : $(BUILD_LIBJAVA)
 
@@ -2279,7 +2292,8 @@
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN), \
 		LDFLAGS_SUFFIX:=-L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -ldga -lX11 $(LIBDL) -lc, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunwjdga))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunwjdga,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNWJDGA)
 
@@ -2369,7 +2383,8 @@
 		LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
 		LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc,\
 		LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBAWT_HEADLESS) : $(BUILD_LIBAWT)
 
@@ -2462,7 +2477,7 @@
 			  -D "JDK_INTERNAL_NAME=splashscreen" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsplashscreen,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
 
@@ -2504,7 +2519,7 @@
 			  -D "JDK_INTERNAL_NAME=dcpr" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdcpr,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBDCPR) : $(BUILD_LIBJAVA)
 
@@ -2538,7 +2553,7 @@
 			  -D "JDK_INTERNAL_NAME=j2pcsc" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pcsc,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
 
@@ -2561,7 +2576,8 @@
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=$(LIBDL),\
 		LDFLAGS_SUFFIX_solaris:=-lc,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2gss))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2gss,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
 endif
@@ -2601,7 +2617,7 @@
 			  -D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkrb5,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBKRB5)
 endif
@@ -2627,7 +2643,7 @@
 			  -D "JDK_INTERNAL_NAME=sunmscapi" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunmscapi,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
 endif
@@ -2659,7 +2675,7 @@
 			  -D "JDK_INTERNAL_NAME=j2pkcs11" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pkcs11,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)
 
@@ -2705,7 +2721,7 @@
 			  -D "JDK_INTERNAL_NAME=sunec" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunec,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
 endif
@@ -2849,7 +2865,7 @@
 			  -D "JDK_INTERNAL_NAME=jsound" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsound,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJSOUND) : $(BUILD_LIBJAVA)
 
@@ -2884,7 +2900,8 @@
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX:=-lasound -ljava -ljvm,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJSOUNDALSA) : $(BUILD_LIBJAVA)
 
@@ -2917,7 +2934,7 @@
 			  -D "JDK_INTERNAL_NAME=jsoundds" \
 			  -D "JDK_FTYPE=0x2L",\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundds,\
-		DEBUG_SYMBOLS:=$(WINDOWS_ONLY)))
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJSOUNDDS) : $(BUILD_LIBJAVA)
 
@@ -2942,7 +2959,8 @@
 		LDFLAGS:=$(LDFLAGS_JDKLIB),\
 		LDFLAGS_SUFFIX:=$(LIBDL),\
 		LDFLAGS_SUFFIX_solaris:=-lc,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJ2UCRYPTO) : $(BUILD_LIBJAVA)
 
@@ -2972,7 +2990,8 @@
                                 -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                                 -framework JavaNativeFoundation \
                                 $(LDFLAGS_JDKLIB_SUFFIX),\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libAppleScriptEngine))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libAppleScriptEngine,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBAPPLESCRIPTENGINE) : $(BUILD_LIBJAVA)
 
@@ -3011,7 +3030,8 @@
 	-framework OpenGL \
 	-framework IOSurface \
 	-framework QuartzCore, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxapp))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxapp,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBOSXAPP)
 
@@ -3051,7 +3071,8 @@
     -framework Security \
     -framework SystemConfiguration \
     $(LDFLAGS_JDKLIB_SUFFIX), \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosx))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosx,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBOSX)
 
@@ -3184,7 +3205,8 @@
 				       -framework JavaRuntimeSupport \
 				       -framework OpenGL \
 				       -framework QuartzCore -ljava,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_lwawt))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_lwawt,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
 
@@ -3224,7 +3246,8 @@
 				       -framework JavaNativeFoundation \
 				       -framework JavaRuntimeSupport \
 				       -ljava -ljvm,\
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxui))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxui,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 BUILD_LIBRARIES += $(BUILD_LIBOSXUI)
 
@@ -3264,7 +3287,8 @@
                                   -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                                   -framework JavaNativeFoundation \
                                   -lffi, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64,\
 		LIBRARY:=JObjC,\
@@ -3288,7 +3312,8 @@
                                   -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                                   -framework JavaNativeFoundation \
                                   -lffi, \
-		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64))
+		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64,\
+		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
 $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX): $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
 	$(LIPO) -create -output $@ $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
--- a/jdk/makefiles/CopyFiles.gmk	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/makefiles/CopyFiles.gmk	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -294,45 +294,56 @@
 
 
 ifeq ($(OPENJDK_TARGET_CPU_BITS),32)
-    # On 32 bit machines, we can have client and/or server libjvms installed.
-    # Since the currently committed jvm.cfg expects clientANDserver, we need 
-    # to patch the jvm.cfg when we have built only a client or only a server.
-    # This should also support -kernel, -zero and -zeroshark.
-    ifeq ($(JVM_VARIANTS),$(COMMA)client$(COMMA))
-        # Create a patched jvm.cfg to use -client by default and alias -server to -client.
-        $(JVMCFG):
-		$(MKDIR) -p $(@D)
-		$(RM) $(JVMCFG)
-		$(PRINTF) "-client KNOWN\n">$(JVMCFG)
-		$(PRINTF) "-server ALIASED_TO -client\n">>$(JVMCFG)
-		$(PRINTF) "-hotspot ALIASED_TO -client\n">>$(JVMCFG)
-		$(PRINTF) "-classic WARN\n">>$(JVMCFG)
-		$(PRINTF) "-native ERROR\n">>$(JVMCFG)
-		$(PRINTF) "-green ERROR\n">>$(JVMCFG)
+  # On 32-bit machines we have three potential VMs: client, server and minimal.
+  # Historically we usually have both client and server and so that is what the
+  # committed jvm.cfg expects (including platform specific ergonomics switches
+  # to decide whether to use client or server by default). So when we have anything
+  # other than client and server we need to define a new jvm.cfg file.
+  # The main problem is deciding whether to use aliases for the VMs that are not
+  # present and the current position is that we add aliases for client and server, but
+  # not for minimal.
+  # To do: should this also support, -zero and -zeroshark?
+
+  CLIENT_AND_SERVER := $(and $(findstring true,$(JVM_VARIANT_SERVER)),$(findstring true,$(JVM_VARIANT_CLIENT)))
 
+  ifeq ($(CLIENT_AND_SERVER), true)
+    # Use the committed jvm.cfg for this 32 bit setup (the minimal
+    # VM is already KNOWN on platforms that potentially support it)
+    $(JVMCFG): $(JVMCFG_SRC)
+	$(call install-file)
+  else
+    $(JVMCFG):
+	$(MKDIR) -p $(@D)
+	$(RM) $(@)
+
+    # Now check for other permutations
+    ifeq ($(JVM_VARIANT_SERVER), true)
+	$(PRINTF) "-server KNOWN\n">>$(@)
+	$(PRINTF) "-client ALIASED_TO -server\n">>$(@)
+        ifeq ($(JVM_VARIANT_MINIMAL1), true)
+	    $(PRINTF) "-minimal KNOWN\n">>$(@)
+        endif
     else
-        ifeq ($(JVM_VARIANTS),$(COMMA)server$(COMMA))
-            # Create a patched jvm.cfg to use -server by default and alias -client to -server.
-
-            $(JVMCFG):
-		$(MKDIR) -p $(@D)
-		$(RM) $(JVMCFG)
-		$(PRINTF) "-server KNOWN\n">$(JVMCFG)
-		$(PRINTF) "-client IGNORE\n">>$(JVMCFG)
-		$(PRINTF) "-hotspot IGNORE\n">>$(JVMCFG)
-		$(PRINTF) "-classic WARN\n">>$(JVMCFG)
-		$(PRINTF) "-native ERROR\n">>$(JVMCFG)
-		$(PRINTF) "-green ERROR\n">>$(JVMCFG)
+        ifeq ($(JVM_VARIANT_CLIENT), true)
+	    $(PRINTF) "-client KNOWN\n">>$(@)
+	    $(PRINTF) "-server ALIASED_TO -client\n">>$(@)
+            ifeq ($(JVM_VARIANT_MINIMAL1), true)
+	        $(PRINTF) "-minimal KNOWN\n">>$(@)
+            endif
         else
-            # Use the default jvm.cfg for this 32 bit setup. 
-            $(JVMCFG): $(JVMCFG_SRC)
-	    	$(call install-file)
+            ifeq ($(JVM_VARIANT_MINIMAL1), true)
+	        $(PRINTF) "-minimal KNOWN\n">>$(@)
+	        $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
+	        $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)
+            endif
         endif
     endif
+  endif
+
 else
     # Use the default jvm.cfg for this 64 bit setup.
     $(JVMCFG): $(JVMCFG_SRC)
-		$(call install-file)
+	$(call install-file)
 endif
 
 COPY_FILES += $(JVMCFG)
--- a/jdk/makefiles/profile-includes.txt	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/makefiles/profile-includes.txt	Wed May 08 10:10:05 2013 +0100
@@ -36,7 +36,6 @@
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sunec$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify.diz \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)zip$(SHARED_LIBRARY_SUFFIX) \
@@ -172,6 +171,7 @@
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)mlib_image$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)splashscreen$(SHARED_LIBRARY_SUFFIX) \
     $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)t2k$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
     alt-rt.jar \
     charsets.jar \
     cmm/CIEXYZ.pf \
--- a/jdk/src/macosx/bin/x86_64/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/bin/x86_64/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,3 @@
 #
 -server KNOWN
 -client IGNORE
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Allgemeine Datei
+FileChooser.directoryDescription.textAndMnemonic=Verzeichnis
+FileChooser.newFolderError.textAndMnemonic=Bei der Erstellung des Ordners ist ein Fehler aufgetreten
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
+FileChooser.cancelButton.textAndMnemonic=Abbrechen
+FileChooser.saveButton.textAndMnemonic=Speichern
+FileChooser.openButton.textAndMnemonic=\u00D6ffnen
+FileChooser.saveDialogTitle.textAndMnemonic=Speichern
+FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
+FileChooser.updateButton.textAndMnemonic=Updaten
+FileChooser.helpButton.textAndMnemonic=Hilfe
+FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ffnen
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Speichern
+FileChooser.openTitle.textAndMnemonic=\u00D6ffnen
+FileChooser.newFolderExistsError.textAndMnemonic=Dieser Name ist bereits vergeben
+FileChooser.chooseButton.textAndMnemonic=W\u00E4hlen
+
+FileChooser.newFolderButton.textAndMnemonic=Neuer Ordner
+FileChooser.newFolderTitle.textAndMnemonic=Neuer Ordner
+FileChooser.fileNameLabel.textAndMnemonic=Datei:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Speichern unter:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Dateiformat:
+
+FileChooser.desktopName=Desktop
+FileChooser.newFolderPrompt.textAndMnemonic=Name des neuen Ordners:
+FileChooser.untitledFolderName=unbenannter Ordner
+FileChooser.untitledFileName=unbenannt
+FileChooser.createButton.textAndMnemonic=Erstellen
+
+FileChooser.byDate.textAndMnemonic=\u00C4nderungsdatum
+FileChooser.by.textAndMnemonic=Name
+FileChooser.newFolderAccessibleName=Neuer Ordner
+
+FileChooser.mac.newFolder=unbenannter Ordner
+FileChooser.mac.newFolder.subsequent=unbenannter Ordner {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Vorschau
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Abbrechen
+ColorChooser.reset.textAndMnemonic=&Zur\u00FCcksetzen
+ColorChooser.sample.textAndMnemonic=Beispieltext  Beispieltext
+ColorChooser.swatches.textAndMnemonic=&Muster
+ColorChooser.swatchesRecent.textAndMnemonic=Aktuell:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=Ro&t
+ColorChooser.rgbGreen.textAndMnemonic=Gr\u00FC&n
+ColorChooser.rgbBlue.textAndMnemonic=&Blau
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&Ja
+OptionPane.noButton.textAndMnemonic=&Nein
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Abbrechen
+OptionPane.title.textAndMnemonic=Option ausw\u00E4hlen
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Eingabe
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Meldung
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Drucken
+PrintingDialog.titleAborting.textAndMnemonic=Drucken (wird abgebrochen)
+
+PrintingDialog.contentInitial.textAndMnemonic=Druckvorgang l\u00E4uft...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=Seite {0} wurde gedruckt ...
+
+PrintingDialog.contentAborting.textAndMnemonic=Druckvorgang wird abgebrochen ...
+
+PrintingDialog.abortButton.textAndMnemonic=&Abbruch
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Druckvorgang abbrechen
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimieren
+InternalFrame.maxButtonToolTip=Maximieren
+InternalFrame.restoreButtonToolTip=Wiederherstellen
+InternalFrame.closeButtonToolTip=Schlie\u00DFen
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Wiederherstellen
+InternalFrameTitlePane.moveButton.textAndMnemonic=Verschieben
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Gr\u00F6\u00DFe
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimieren
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximieren
+InternalFrameTitlePane.closeButton.textAndMnemonic=Schlie\u00DFen
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Abfrage weiterleiten
+FormView.resetButton.textAndMnemonic=Zur\u00FCcksetzen
+FormView.browseFileButton.textAndMnemonic=Durchsuchen ...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=Formatvorlagen\u00E4nderung
+AbstractDocument.addition.textAndMnemonic=Hinzuf\u00FCgen
+AbstractDocument.deletion.textAndMnemonic=L\u00F6schen
+AbstractDocument.undo.textAndMnemonic=R\u00FCckg\u00E4ngig
+AbstractDocument.redo.textAndMnemonic=Wiederherstellen
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=Klicken
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=R\u00FCckg\u00E4ngig
+AbstractUndoableEdit.redo.textAndMnemonic=Wiederherstellen
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=Fortschritt ...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=linke Schaltfl\u00E4che
+SplitPane.rightButton.textAndMnemonic=rechte Schaltfl\u00E4che
+# Used for Isindex
+IsindexView.prompt=Dieser Index kann durchsucht werden. Geben Sie Schl\u00FCsselw\u00F6rter f\u00FCr die Suche ein:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Als Symbol darstellen
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximieren
+InternalFrameTitlePane.closeButtonAccessibleName=Schlie\u00DFen
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Archivo Gen\u00E9rico
+FileChooser.directoryDescription.textAndMnemonic=Directorio
+FileChooser.newFolderError.textAndMnemonic=Se ha producido un error durante la creaci\u00F3n de carpetas
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
+FileChooser.cancelButton.textAndMnemonic=Cancelar
+FileChooser.saveButton.textAndMnemonic=Guardar
+FileChooser.openButton.textAndMnemonic=Abrir
+FileChooser.saveDialogTitle.textAndMnemonic=Guardar
+FileChooser.openDialogTitle.textAndMnemonic=Abrir
+FileChooser.updateButton.textAndMnemonic=Actualizar
+FileChooser.helpButton.textAndMnemonic=Ayuda
+FileChooser.directoryOpenButton.textAndMnemonic=Abrir
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Guardar
+FileChooser.openTitle.textAndMnemonic=Abrir
+FileChooser.newFolderExistsError.textAndMnemonic=Ya existe ese nombre
+FileChooser.chooseButton.textAndMnemonic=Seleccionar
+
+FileChooser.newFolderButton.textAndMnemonic=Nueva Carpeta
+FileChooser.newFolderTitle.textAndMnemonic=Nueva Carpeta
+FileChooser.fileNameLabel.textAndMnemonic=Archivo:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Guardar como:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Formato de Archivo:
+
+FileChooser.desktopName=Escritorio
+FileChooser.newFolderPrompt.textAndMnemonic=Nombre de la Nueva Carpeta:
+FileChooser.untitledFolderName=carpeta sin t\u00EDtulo
+FileChooser.untitledFileName=sin t\u00EDtulo
+FileChooser.createButton.textAndMnemonic=Crear
+
+FileChooser.byDate.textAndMnemonic=Fecha de Modificaci\u00F3n
+FileChooser.by.textAndMnemonic=Nombre
+FileChooser.newFolderAccessibleName=Nueva Carpeta
+
+FileChooser.mac.newFolder=carpeta sin t\u00EDtulo
+FileChooser.mac.newFolder.subsequent=carpeta sin t\u00EDtulo {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Vista Previa
+ColorChooser.ok.textAndMnemonic=Aceptar
+ColorChooser.cancel.textAndMnemonic=Cancelar
+ColorChooser.reset.textAndMnemonic=&Restablecer
+ColorChooser.sample.textAndMnemonic=Texto de Ejemplo  Texto de Ejemplo
+ColorChooser.swatches.textAndMnemonic=M&uestras
+ColorChooser.swatchesRecent.textAndMnemonic=Reciente:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=Ro&jo
+ColorChooser.rgbGreen.textAndMnemonic=&Verde
+ColorChooser.rgbBlue.textAndMnemonic=A&zul
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&S\u00ED
+OptionPane.noButton.textAndMnemonic=&No
+OptionPane.okButton.textAndMnemonic=Aceptar
+OptionPane.cancelButton.textAndMnemonic=Cancelar
+OptionPane.title.textAndMnemonic=Seleccionar una Opci\u00F3n
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Entrada
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Mensaje
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Impresi\u00F3n
+PrintingDialog.titleAborting.textAndMnemonic=Impresi\u00F3n (Abortando)
+
+PrintingDialog.contentInitial.textAndMnemonic=Impresi\u00F3n en curso...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=P\u00E1gina {0} impresa...
+
+PrintingDialog.contentAborting.textAndMnemonic=Abortando la impresi\u00F3n...
+
+PrintingDialog.abortButton.textAndMnemonic=&Abortar
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Abortar Impresi\u00F3n
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimizar
+InternalFrame.maxButtonToolTip=Maximizar
+InternalFrame.restoreButtonToolTip=Restaurar
+InternalFrame.closeButtonToolTip=Cerrar
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar
+InternalFrameTitlePane.moveButton.textAndMnemonic=Mover
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Tama\u00F1o
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar
+InternalFrameTitlePane.closeButton.textAndMnemonic=Cerrar
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Enviar Consulta
+FormView.resetButton.textAndMnemonic=Restablecer
+FormView.browseFileButton.textAndMnemonic=Examinar...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=cambio de estilo
+AbstractDocument.addition.textAndMnemonic=adici\u00F3n
+AbstractDocument.deletion.textAndMnemonic=supresi\u00F3n
+AbstractDocument.undo.textAndMnemonic=Deshacer
+AbstractDocument.redo.textAndMnemonic=Rehacer
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=hacer clic
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=Deshacer
+AbstractUndoableEdit.redo.textAndMnemonic=Rehacer
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=Progreso...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=bot\u00F3n: izquierda
+SplitPane.rightButton.textAndMnemonic=bot\u00F3n: derecha
+# Used for Isindex
+IsindexView.prompt=En este \u00EDndice se pueden efectuar b\u00FAsquedas. Escriba las palabras clave de b\u00FAsqueda:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Convertir en Icono
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximizar
+InternalFrameTitlePane.closeButtonAccessibleName=Cerrar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Fichier g\u00E9n\u00E9rique
+FileChooser.directoryDescription.textAndMnemonic=R\u00E9pertoire
+FileChooser.newFolderError.textAndMnemonic=Erreur lors de la cr\u00E9ation du dossier
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
+FileChooser.cancelButton.textAndMnemonic=Annuler
+FileChooser.saveButton.textAndMnemonic=Enregistrer
+FileChooser.openButton.textAndMnemonic=Ouvrir
+FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
+FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
+FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jour
+FileChooser.helpButton.textAndMnemonic=Aide
+FileChooser.directoryOpenButton.textAndMnemonic=Ouvrir
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Enregistrer
+FileChooser.openTitle.textAndMnemonic=Ouvrir
+FileChooser.newFolderExistsError.textAndMnemonic=Ce nom est d\u00E9j\u00E0 utilis\u00E9
+FileChooser.chooseButton.textAndMnemonic=Choisir
+
+FileChooser.newFolderButton.textAndMnemonic=Nouveau dossier
+FileChooser.newFolderTitle.textAndMnemonic=Nouveau dossier
+FileChooser.fileNameLabel.textAndMnemonic=Fichier :
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Enregistrer sous :
+FileChooser.filesOfTypeLabel.textAndMnemonic=Format de fichier :
+
+FileChooser.desktopName=Bureau
+FileChooser.newFolderPrompt.textAndMnemonic=Nom du nouveau dossier :
+FileChooser.untitledFolderName=dossier sans titre
+FileChooser.untitledFileName=sans titre
+FileChooser.createButton.textAndMnemonic=Cr\u00E9er
+
+FileChooser.byDate.textAndMnemonic=Date de modification
+FileChooser.by.textAndMnemonic=Nom
+FileChooser.newFolderAccessibleName=Nouveau dossier
+
+FileChooser.mac.newFolder=dossier sans titre
+FileChooser.mac.newFolder.subsequent=dossier {0} sans titre
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Aper\u00E7u
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Annuler
+ColorChooser.reset.textAndMnemonic=&R\u00E9initialiser
+ColorChooser.sample.textAndMnemonic=Echantillon de texte  Echantillon de texte
+ColorChooser.swatches.textAndMnemonic=&Echantillons
+ColorChooser.swatchesRecent.textAndMnemonic=Dernier :
+ColorChooser.hsb.textAndMnemonic=&TSL
+ColorChooser.hsbHue.textAndMnemonic=T
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=V
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&VB
+ColorChooser.rgbRed.textAndMnemonic=R&ouge
+ColorChooser.rgbGreen.textAndMnemonic=&Vert
+ColorChooser.rgbBlue.textAndMnemonic=&Bleu
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&Oui
+OptionPane.noButton.textAndMnemonic=&Non
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Annuler
+OptionPane.title.textAndMnemonic=S\u00E9lectionner une option
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Entr\u00E9e
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Message
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Impression
+PrintingDialog.titleAborting.textAndMnemonic=Impression (abandon)
+
+PrintingDialog.contentInitial.textAndMnemonic=Impression en cours...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=Page {0} imprim\u00E9e...
+
+PrintingDialog.contentAborting.textAndMnemonic=Abandon de l'impression...
+
+PrintingDialog.abortButton.textAndMnemonic=&Abandonner
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Abandonner l'impression
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=R\u00E9duire
+InternalFrame.maxButtonToolTip=Agrandir
+InternalFrame.restoreButtonToolTip=Restaurer
+InternalFrame.closeButtonToolTip=Fermer
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurer
+InternalFrameTitlePane.moveButton.textAndMnemonic=D\u00E9placer
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Taille
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=R\u00E9duire
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Agrandir
+InternalFrameTitlePane.closeButton.textAndMnemonic=Fermer
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Soumettre la requ\u00EAte
+FormView.resetButton.textAndMnemonic=R\u00E9initialiser
+FormView.browseFileButton.textAndMnemonic=Parcourir...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=modification de style
+AbstractDocument.addition.textAndMnemonic=ajout
+AbstractDocument.deletion.textAndMnemonic=suppression
+AbstractDocument.undo.textAndMnemonic=Annuler
+AbstractDocument.redo.textAndMnemonic=R\u00E9tablir
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=cliquer
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=Annuler
+AbstractUndoableEdit.redo.textAndMnemonic=R\u00E9tablir
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=Progression...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=bouton gauche
+SplitPane.rightButton.textAndMnemonic=bouton droit
+# Used for Isindex
+IsindexView.prompt=Ceci est un index de recherche. Tapez des mots-cl\u00E9s pour la recherche :
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=R\u00E9duire
+InternalFrameTitlePane.maximizeButtonAccessibleName=Agrandir
+InternalFrameTitlePane.closeButtonAccessibleName=Fermer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=File generico
+FileChooser.directoryDescription.textAndMnemonic=Directory
+FileChooser.newFolderError.textAndMnemonic=Si \u00E8 verificato un errore durante la creazione della cartella
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
+FileChooser.cancelButton.textAndMnemonic=Annulla
+FileChooser.saveButton.textAndMnemonic=Salva
+FileChooser.openButton.textAndMnemonic=Apri
+FileChooser.saveDialogTitle.textAndMnemonic=Salva
+FileChooser.openDialogTitle.textAndMnemonic=Apri
+FileChooser.updateButton.textAndMnemonic=Aggiorna
+FileChooser.helpButton.textAndMnemonic=?
+FileChooser.directoryOpenButton.textAndMnemonic=Apri
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Salva
+FileChooser.openTitle.textAndMnemonic=Apri
+FileChooser.newFolderExistsError.textAndMnemonic=Il nome \u00E8 gi\u00E0 stato assegnato
+FileChooser.chooseButton.textAndMnemonic=Scegli
+
+FileChooser.newFolderButton.textAndMnemonic=Nuova cartella
+FileChooser.newFolderTitle.textAndMnemonic=Nuova cartella
+FileChooser.fileNameLabel.textAndMnemonic=File:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Salva con nome:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Formato file:
+
+FileChooser.desktopName=Desktop
+FileChooser.newFolderPrompt.textAndMnemonic=Nome nuova cartella:
+FileChooser.untitledFolderName=cartella senza titolo
+FileChooser.untitledFileName=senza titolo
+FileChooser.createButton.textAndMnemonic=Crea
+
+FileChooser.byDate.textAndMnemonic=Data modifica
+FileChooser.by.textAndMnemonic=Nome
+FileChooser.newFolderAccessibleName=Nuova cartella
+
+FileChooser.mac.newFolder=cartella senza titolo
+FileChooser.mac.newFolder.subsequent=cartella senza titolo {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Anteprima
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Annulla
+ColorChooser.reset.textAndMnemonic=R&eimposta
+ColorChooser.sample.textAndMnemonic=Testo di prova          Testo di prova
+ColorChooser.swatches.textAndMnemonic=Colori ca&mpione
+ColorChooser.swatchesRecent.textAndMnemonic=Recenti:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=&Rosso
+ColorChooser.rgbGreen.textAndMnemonic=Ver&de
+ColorChooser.rgbBlue.textAndMnemonic=&Blu
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&S\u00EC
+OptionPane.noButton.textAndMnemonic=&No
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Annulla
+OptionPane.title.textAndMnemonic=Selezionare una opzione
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Input
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Messaggio
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Stampa in corso
+PrintingDialog.titleAborting.textAndMnemonic=Stampa in corso (operazione interrotta)
+
+PrintingDialog.contentInitial.textAndMnemonic=Stampa in corso...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=Pagina stampata {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=Interruzione della stampa in corso...
+
+PrintingDialog.abortButton.textAndMnemonic=&Interrompi
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Interrompe la stampa
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Riduce a icona
+InternalFrame.maxButtonToolTip=Ingrandisce
+InternalFrame.restoreButtonToolTip=Ripristina
+InternalFrame.closeButtonToolTip=Chiude
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Ripristina
+InternalFrameTitlePane.moveButton.textAndMnemonic=Sposta
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Dimensiona
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Riduci a icona
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ingrandisci
+InternalFrameTitlePane.closeButton.textAndMnemonic=Chiudi
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Sottometti query
+FormView.resetButton.textAndMnemonic=Reimposta
+FormView.browseFileButton.textAndMnemonic=Sfoglia...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=modifica di stile
+AbstractDocument.addition.textAndMnemonic=aggiunta
+AbstractDocument.deletion.textAndMnemonic=eliminazione
+AbstractDocument.undo.textAndMnemonic=Annulla
+AbstractDocument.redo.textAndMnemonic=Ripeti
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=fare clic
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=Annulla
+AbstractUndoableEdit.redo.textAndMnemonic=Ripeti
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=In corso...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=pulsante sinistro
+SplitPane.rightButton.textAndMnemonic=pulsante destro
+# Used for Isindex
+IsindexView.prompt=Questo \u00E8 un indice di ricerca. Immettere le parole chiave:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Riduci a icona
+InternalFrameTitlePane.maximizeButtonAccessibleName=Ingrandisci
+InternalFrameTitlePane.closeButtonAccessibleName=Chiudi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=\u6C4E\u7528\u30D5\u30A1\u30A4\u30EB
+FileChooser.directoryDescription.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA
+FileChooser.newFolderError.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
+FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openButton.textAndMnemonic=\u958B\u304F
+FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F
+FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0
+FileChooser.helpButton.textAndMnemonic=\u30D8\u30EB\u30D7
+FileChooser.directoryOpenButton.textAndMnemonic=\u958B\u304F
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openTitle.textAndMnemonic=\u958B\u304F
+FileChooser.newFolderExistsError.textAndMnemonic=\u305D\u306E\u540D\u524D\u306F\u3059\u3067\u306B\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059
+FileChooser.chooseButton.textAndMnemonic=\u9078\u629E
+
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+FileChooser.newFolderTitle.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=\u5225\u540D\u4FDD\u5B58:
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F:
+
+FileChooser.desktopName=\u30C7\u30B9\u30AF\u30C8\u30C3\u30D7
+FileChooser.newFolderPrompt.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u540D\u524D:
+FileChooser.untitledFolderName=\u7121\u984C\u306E\u30D5\u30A9\u30EB\u30C0
+FileChooser.untitledFileName=\u7121\u984C
+FileChooser.createButton.textAndMnemonic=\u4F5C\u6210
+
+FileChooser.byDate.textAndMnemonic=\u5909\u66F4\u65E5
+FileChooser.by.textAndMnemonic=\u540D\u524D
+FileChooser.newFolderAccessibleName=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+
+FileChooser.mac.newFolder=\u7121\u984C\u306E\u30D5\u30A9\u30EB\u30C0
+FileChooser.mac.newFolder.subsequent=\u7121\u984C\u306E\u30D5\u30A9\u30EB\u30C0{0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=\u30D7\u30EC\u30D3\u30E5\u30FC
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=\u53D6\u6D88
+ColorChooser.reset.textAndMnemonic=\u30EA\u30BB\u30C3\u30C8(&R)
+ColorChooser.sample.textAndMnemonic=\u30B5\u30F3\u30D7\u30EB\u30FB\u30C6\u30AD\u30B9\u30C8  \u30B5\u30F3\u30D7\u30EB\u30FB\u30C6\u30AD\u30B9\u30C8
+ColorChooser.swatches.textAndMnemonic=\u30B5\u30F3\u30D7\u30EB(&S)
+ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u65B0:
+ColorChooser.hsb.textAndMnemonic=HSB(&H)
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
+ColorChooser.rgbRed.textAndMnemonic=\u8D64(&D)
+ColorChooser.rgbGreen.textAndMnemonic=\u7DD1(&N)
+ColorChooser.rgbBlue.textAndMnemonic=\u9752(&B)
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=\u306F\u3044(&Y)
+OptionPane.noButton.textAndMnemonic=\u3044\u3044\u3048(&N)
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+OptionPane.title.textAndMnemonic=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u9078\u629E
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=\u5165\u529B
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=\u30E1\u30C3\u30BB\u30FC\u30B8
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=\u5370\u5237\u3057\u3066\u3044\u307E\u3059
+PrintingDialog.titleAborting.textAndMnemonic=\u5370\u5237\u3092\u4E2D\u6B62\u3057\u3066\u3044\u307E\u3059
+
+PrintingDialog.contentInitial.textAndMnemonic=\u5370\u5237\u4E2D...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=\u30DA\u30FC\u30B8{0}\u3092\u5370\u5237\u3057\u307E\u3057\u305F...
+
+PrintingDialog.contentAborting.textAndMnemonic=\u5370\u5237\u3092\u4E2D\u6B62\u3057\u3066\u3044\u307E\u3059...
+
+PrintingDialog.abortButton.textAndMnemonic=\u4E2D\u6B62(&A)
+PrintingDialog.abortButtonToolTip.textAndMnemonic=\u5370\u5237\u306E\u4E2D\u6B62
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=\u6700\u5C0F\u5316
+InternalFrame.maxButtonToolTip=\u6700\u5927\u5316
+InternalFrame.restoreButtonToolTip=\u5FA9\u5143
+InternalFrame.closeButtonToolTip=\u9589\u3058\u308B
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u5143
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u30B5\u30A4\u30BA
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u9589\u3058\u308B
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=\u554F\u5408\u305B\u306E\u5B9F\u884C
+FormView.resetButton.textAndMnemonic=\u30EA\u30BB\u30C3\u30C8
+FormView.browseFileButton.textAndMnemonic=\u53C2\u7167...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=\u30B9\u30BF\u30A4\u30EB\u5909\u66F4
+AbstractDocument.addition.textAndMnemonic=\u8FFD\u52A0
+AbstractDocument.deletion.textAndMnemonic=\u524A\u9664
+AbstractDocument.undo.textAndMnemonic=\u5143\u306B\u623B\u3059
+AbstractDocument.redo.textAndMnemonic=\u3084\u308A\u76F4\u3057
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=\u30AF\u30EA\u30C3\u30AF
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\u5143\u306B\u623B\u3059
+AbstractUndoableEdit.redo.textAndMnemonic=\u3084\u308A\u76F4\u3057
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=\u30C8\u30B0\u30EB\u30FB\u30DD\u30C3\u30D7\u30A2\u30C3\u30D7
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=\u9032\u884C\u4E2D...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=\u5DE6\u30DC\u30BF\u30F3
+SplitPane.rightButton.textAndMnemonic=\u53F3\u30DC\u30BF\u30F3
+# Used for Isindex
+IsindexView.prompt=\u691C\u7D22\u7528\u306E\u7D22\u5F15\u3067\u3059\u3002\u691C\u7D22\u3059\u308B\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=\u30A2\u30A4\u30B3\u30F3\u5316
+InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButtonAccessibleName=\u9589\u3058\u308B
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=\uC77C\uBC18 \uD30C\uC77C
+FileChooser.directoryDescription.textAndMnemonic=\uB514\uB809\uD1A0\uB9AC
+FileChooser.newFolderError.textAndMnemonic=\uD3F4\uB354 \uC0DD\uC131 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=\uBAA8\uB4E0 \uD30C\uC77C
+FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C
+FileChooser.saveButton.textAndMnemonic=\uC800\uC7A5
+FileChooser.openButton.textAndMnemonic=\uC5F4\uAE30
+FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5
+FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30
+FileChooser.updateButton.textAndMnemonic=\uAC31\uC2E0
+FileChooser.helpButton.textAndMnemonic=\uB3C4\uC6C0\uB9D0
+FileChooser.directoryOpenButton.textAndMnemonic=\uC5F4\uAE30
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=\uC800\uC7A5
+FileChooser.openTitle.textAndMnemonic=\uC5F4\uAE30
+FileChooser.newFolderExistsError.textAndMnemonic=\uD574\uB2F9 \uC774\uB984\uC740 \uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC785\uB2C8\uB2E4.
+FileChooser.chooseButton.textAndMnemonic=\uC120\uD0DD
+
+FileChooser.newFolderButton.textAndMnemonic=\uC0C8 \uD3F4\uB354
+FileChooser.newFolderTitle.textAndMnemonic=\uC0C8 \uD3F4\uB354
+FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=\uB2E4\uB978 \uC774\uB984\uC73C\uB85C \uC800\uC7A5:
+FileChooser.filesOfTypeLabel.textAndMnemonic=\uD30C\uC77C \uD615\uC2DD:
+
+FileChooser.desktopName=\uB370\uC2A4\uD06C\uD1B1
+FileChooser.newFolderPrompt.textAndMnemonic=\uC0C8 \uD3F4\uB354\uC758 \uC774\uB984:
+FileChooser.untitledFolderName=\uC81C\uBAA9 \uC5C6\uB294 \uD3F4\uB354
+FileChooser.untitledFileName=\uC81C\uBAA9 \uC5C6\uC74C
+FileChooser.createButton.textAndMnemonic=\uC0DD\uC131
+
+FileChooser.byDate.textAndMnemonic=\uC218\uC815\uB41C \uB0A0\uC9DC
+FileChooser.by.textAndMnemonic=\uC774\uB984
+FileChooser.newFolderAccessibleName=\uC0C8 \uD3F4\uB354
+
+FileChooser.mac.newFolder=\uC81C\uBAA9 \uC5C6\uB294 \uD3F4\uB354
+FileChooser.mac.newFolder.subsequent=\uC81C\uBAA9 \uC5C6\uB294 \uD3F4\uB354 {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=\uBBF8\uB9AC\uBCF4\uAE30
+ColorChooser.ok.textAndMnemonic=\uD655\uC778
+ColorChooser.cancel.textAndMnemonic=\uCDE8\uC18C
+ColorChooser.reset.textAndMnemonic=\uC7AC\uC124\uC815(&R)
+ColorChooser.sample.textAndMnemonic=\uC0D8\uD50C \uD14D\uC2A4\uD2B8  \uC0D8\uD50C \uD14D\uC2A4\uD2B8
+ColorChooser.swatches.textAndMnemonic=\uACAC\uBCF8(&S)
+ColorChooser.swatchesRecent.textAndMnemonic=\uCD5C\uADFC \uBAA9\uB85D:
+ColorChooser.hsb.textAndMnemonic=HSB(&H)
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
+ColorChooser.rgbRed.textAndMnemonic=\uBE68\uAC04\uC0C9(&D)
+ColorChooser.rgbGreen.textAndMnemonic=\uB179\uC0C9(&N)
+ColorChooser.rgbBlue.textAndMnemonic=\uD30C\uB780\uC0C9(&B)
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=\uC608(&Y)
+OptionPane.noButton.textAndMnemonic=\uC544\uB2C8\uC624(&N)
+OptionPane.okButton.textAndMnemonic=\uD655\uC778
+OptionPane.cancelButton.textAndMnemonic=\uCDE8\uC18C
+OptionPane.title.textAndMnemonic=\uC635\uC158 \uC120\uD0DD
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=\uC785\uB825
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=\uBA54\uC2DC\uC9C0
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=\uC778\uC1C4
+PrintingDialog.titleAborting.textAndMnemonic=\uC778\uC1C4(\uC911\uB2E8 \uC911)
+
+PrintingDialog.contentInitial.textAndMnemonic=\uC778\uC1C4 \uC9C4\uD589 \uC911...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=\uC778\uC1C4\uB41C \uD398\uC774\uC9C0 {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=\uC778\uC1C4 \uC911\uB2E8 \uC911...
+
+PrintingDialog.abortButton.textAndMnemonic=\uC911\uB2E8(&A)
+PrintingDialog.abortButtonToolTip.textAndMnemonic=\uC778\uC1C4 \uC911\uB2E8
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=\uCD5C\uC18C\uD654
+InternalFrame.maxButtonToolTip=\uCD5C\uB300\uD654
+InternalFrame.restoreButtonToolTip=\uBCF5\uC6D0
+InternalFrame.closeButtonToolTip=\uB2EB\uAE30
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\uBCF5\uC6D0
+InternalFrameTitlePane.moveButton.textAndMnemonic=\uC774\uB3D9
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\uD06C\uAE30
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\uCD5C\uC18C\uD654
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\uCD5C\uB300\uD654
+InternalFrameTitlePane.closeButton.textAndMnemonic=\uB2EB\uAE30
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=\uC9C8\uC758 \uC81C\uCD9C
+FormView.resetButton.textAndMnemonic=\uC7AC\uC124\uC815
+FormView.browseFileButton.textAndMnemonic=\uCC3E\uC544\uBCF4\uAE30...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=\uC2A4\uD0C0\uC77C \uBCC0\uACBD
+AbstractDocument.addition.textAndMnemonic=\uCD94\uAC00
+AbstractDocument.deletion.textAndMnemonic=\uC0AD\uC81C
+AbstractDocument.undo.textAndMnemonic=\uC2E4\uD589 \uCDE8\uC18C
+AbstractDocument.redo.textAndMnemonic=\uC7AC\uC2E4\uD589
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=\uB204\uB974\uAE30
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\uC2E4\uD589 \uCDE8\uC18C
+AbstractUndoableEdit.redo.textAndMnemonic=\uC7AC\uC2E4\uD589
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=\uC9C4\uD589...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=\uC67C\uCABD \uB2E8\uCD94
+SplitPane.rightButton.textAndMnemonic=\uC624\uB978\uCABD \uB2E8\uCD94
+# Used for Isindex
+IsindexView.prompt=\uB2E4\uC74C\uC740 \uAC80\uC0C9 \uAC00\uB2A5\uD55C \uC778\uB371\uC2A4\uC785\uB2C8\uB2E4. \uAC80\uC0C9 \uD0A4\uC6CC\uB4DC \uC785\uB825:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=\uC544\uC774\uCF58\uD654
+InternalFrameTitlePane.maximizeButtonAccessibleName=\uCD5C\uB300\uD654
+InternalFrameTitlePane.closeButtonAccessibleName=\uB2EB\uAE30
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Arquivo Gen\u00E9rico
+FileChooser.directoryDescription.textAndMnemonic=Diret\u00F3rio
+FileChooser.newFolderError.textAndMnemonic=Ocorreu um erro durante a cria\u00E7\u00E3o da pasta
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Todos os Arquivos
+FileChooser.cancelButton.textAndMnemonic=Cancelar
+FileChooser.saveButton.textAndMnemonic=Salvar
+FileChooser.openButton.textAndMnemonic=Abrir
+FileChooser.saveDialogTitle.textAndMnemonic=Salvar
+FileChooser.openDialogTitle.textAndMnemonic=Abrir
+FileChooser.updateButton.textAndMnemonic=Atualizar
+FileChooser.helpButton.textAndMnemonic=Ajuda
+FileChooser.directoryOpenButton.textAndMnemonic=Abrir
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Salvar
+FileChooser.openTitle.textAndMnemonic=Abrir
+FileChooser.newFolderExistsError.textAndMnemonic=Este nome j\u00E1 foi utilizado
+FileChooser.chooseButton.textAndMnemonic=Escolher
+
+FileChooser.newFolderButton.textAndMnemonic=Nova Pasta
+FileChooser.newFolderTitle.textAndMnemonic=Nova Pasta
+FileChooser.fileNameLabel.textAndMnemonic=Arquivo:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Salvar como:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Formato do Arquivo:
+
+FileChooser.desktopName=\u00C1rea de Trabalho
+FileChooser.newFolderPrompt.textAndMnemonic=Nome da nova pasta:
+FileChooser.untitledFolderName=pasta sem t\u00EDtulo
+FileChooser.untitledFileName=sem t\u00EDtulo
+FileChooser.createButton.textAndMnemonic=Criar
+
+FileChooser.byDate.textAndMnemonic=Data da Modifica\u00E7\u00E3o
+FileChooser.by.textAndMnemonic=Nome
+FileChooser.newFolderAccessibleName=Nova Pasta
+
+FileChooser.mac.newFolder=pasta sem t\u00EDtulo
+FileChooser.mac.newFolder.subsequent=pasta sem t\u00EDtulo {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=Visualizar
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Cancelar
+ColorChooser.reset.textAndMnemonic=&Redefinir
+ColorChooser.sample.textAndMnemonic=Texto de Amostra Texto de Amostra
+ColorChooser.swatches.textAndMnemonic=Amo&stras
+ColorChooser.swatchesRecent.textAndMnemonic=Recente:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=&Vermelho
+ColorChooser.rgbGreen.textAndMnemonic=&Verde
+ColorChooser.rgbBlue.textAndMnemonic=&Azul
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&Sim
+OptionPane.noButton.textAndMnemonic=&N\u00E3o
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Cancelar
+OptionPane.title.textAndMnemonic=Selecionar uma Op\u00E7\u00E3o
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Entrada
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Mensagem
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Impress\u00E3o
+PrintingDialog.titleAborting.textAndMnemonic=Impress\u00E3o (Abortando)
+
+PrintingDialog.contentInitial.textAndMnemonic=Impress\u00E3o em andamento...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=P\u00E1gina impressa {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=Abortando impress\u00E3o...
+
+PrintingDialog.abortButton.textAndMnemonic=&Abortar
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Abortar Impress\u00E3o
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimizar
+InternalFrame.maxButtonToolTip=Maximizar
+InternalFrame.restoreButtonToolTip=Restaurar
+InternalFrame.closeButtonToolTip=Fechar
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar
+InternalFrameTitlePane.moveButton.textAndMnemonic=Mover
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Tamanho
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar
+InternalFrameTitlePane.closeButton.textAndMnemonic=Fechar
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Submeter Consulta
+FormView.resetButton.textAndMnemonic=Redefinir
+FormView.browseFileButton.textAndMnemonic=Procurar...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=altera\u00E7\u00E3o de estilo
+AbstractDocument.addition.textAndMnemonic=adi\u00E7\u00E3o
+AbstractDocument.deletion.textAndMnemonic=dele\u00E7\u00E3o
+AbstractDocument.undo.textAndMnemonic=Desfazer
+AbstractDocument.redo.textAndMnemonic=Refazer
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=clicar
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=Desfazer
+AbstractUndoableEdit.redo.textAndMnemonic=Refazer
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=Andamento...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=bot\u00E3o esquerdo
+SplitPane.rightButton.textAndMnemonic=bot\u00E3o direito
+# Used for Isindex
+IsindexView.prompt=Trata-se de um \u00EDndice pesquis\u00E1vel. Informe as palavras-chave de pesquisa:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Iconizar
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximizar
+InternalFrameTitlePane.closeButtonAccessibleName=Fechar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=Generisk fil
+FileChooser.directoryDescription.textAndMnemonic=Katalog
+FileChooser.newFolderError.textAndMnemonic=Ett fel intr\u00E4ffade n\u00E4r en mapp skulle skapas
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
+FileChooser.cancelButton.textAndMnemonic=Avbryt
+FileChooser.saveButton.textAndMnemonic=Spara
+FileChooser.openButton.textAndMnemonic=\u00D6ppna
+FileChooser.saveDialogTitle.textAndMnemonic=Spara
+FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
+FileChooser.updateButton.textAndMnemonic=Uppdatera
+FileChooser.helpButton.textAndMnemonic=Hj\u00E4lp
+FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ppna
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=Spara
+FileChooser.openTitle.textAndMnemonic=\u00D6ppna
+FileChooser.newFolderExistsError.textAndMnemonic=Namnet finns redan
+FileChooser.chooseButton.textAndMnemonic=V\u00E4lj
+
+FileChooser.newFolderButton.textAndMnemonic=Ny mapp
+FileChooser.newFolderTitle.textAndMnemonic=Ny mapp
+FileChooser.fileNameLabel.textAndMnemonic=Fil:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=Spara som:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Filformat:
+
+FileChooser.desktopName=Klientdator
+FileChooser.newFolderPrompt.textAndMnemonic=Namn p\u00E5 ny mapp:
+FileChooser.untitledFolderName=namnl\u00F6s mapp
+FileChooser.untitledFileName=namnl\u00F6s
+FileChooser.createButton.textAndMnemonic=Skapa
+
+FileChooser.byDate.textAndMnemonic=\u00C4ndringsdatum
+FileChooser.by.textAndMnemonic=Namn
+FileChooser.newFolderAccessibleName=Ny mapp
+
+FileChooser.mac.newFolder=namnl\u00F6s mapp
+FileChooser.mac.newFolder.subsequent=namnl\u00F6s mapp {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=F\u00F6rhandsgranska
+ColorChooser.ok.textAndMnemonic=OK
+ColorChooser.cancel.textAndMnemonic=Avbryt
+ColorChooser.reset.textAndMnemonic=&\u00C5terst\u00E4ll
+ColorChooser.sample.textAndMnemonic=Exempeltext  Exempeltext
+ColorChooser.swatches.textAndMnemonic=&Prov
+ColorChooser.swatchesRecent.textAndMnemonic=Senaste:
+ColorChooser.hsb.textAndMnemonic=&HSB
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgbRed.textAndMnemonic=R\u00F6&d
+ColorChooser.rgbGreen.textAndMnemonic=Gr\u00F6&n
+ColorChooser.rgbBlue.textAndMnemonic=&Bl\u00E5
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=&Ja
+OptionPane.noButton.textAndMnemonic=&Nej
+OptionPane.okButton.textAndMnemonic=OK
+OptionPane.cancelButton.textAndMnemonic=Avbryt
+OptionPane.title.textAndMnemonic=V\u00E4lj ett alternativ
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=Indata
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=Meddelande
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=Skriver ut
+PrintingDialog.titleAborting.textAndMnemonic=Skriver ut (avbryter)
+
+PrintingDialog.contentInitial.textAndMnemonic=Utskrift p\u00E5g\u00E5r...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=Utskriven sida {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=Utskriften avbryts...
+
+PrintingDialog.abortButton.textAndMnemonic=&Avbryt
+PrintingDialog.abortButtonToolTip.textAndMnemonic=Avbryt utskrift
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=Minimera
+InternalFrame.maxButtonToolTip=Maximera
+InternalFrame.restoreButtonToolTip=\u00C5terst\u00E4ll
+InternalFrame.closeButtonToolTip=St\u00E4ng
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u00C5terst\u00E4ll
+InternalFrameTitlePane.moveButton.textAndMnemonic=Flytta
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Storlek
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimera
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximera
+InternalFrameTitlePane.closeButton.textAndMnemonic=St\u00E4ng
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=Skicka fr\u00E5ga
+FormView.resetButton.textAndMnemonic=\u00C5terst\u00E4ll
+FormView.browseFileButton.textAndMnemonic=Bl\u00E4ddra...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=format\u00E4ndring
+AbstractDocument.addition.textAndMnemonic=till\u00E4gg
+AbstractDocument.deletion.textAndMnemonic=borttagning
+AbstractDocument.undo.textAndMnemonic=\u00C5ngra
+AbstractDocument.redo.textAndMnemonic=G\u00F6r om
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=klicka
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\u00C5ngra
+AbstractUndoableEdit.redo.textAndMnemonic=G\u00F6r om
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=v\u00E4xlaPopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=P\u00E5g\u00E5r...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=v\u00E4nster knapp
+SplitPane.rightButton.textAndMnemonic=h\u00F6ger knapp
+# Used for Isindex
+IsindexView.prompt=Detta \u00E4r ett s\u00F6kbart index. Ange s\u00F6kord:
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=Minimera
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximera
+InternalFrameTitlePane.closeButtonAccessibleName=St\u00E4ng
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=\u901A\u7528\u6587\u4EF6
+FileChooser.directoryDescription.textAndMnemonic=\u76EE\u5F55
+FileChooser.newFolderError.textAndMnemonic=\u521B\u5EFA\u6587\u4EF6\u5939\u65F6\u51FA\u9519
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6587\u4EF6
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
+FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openButton.textAndMnemonic=\u6253\u5F00
+FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
+FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0
+FileChooser.helpButton.textAndMnemonic=\u5E2E\u52A9
+FileChooser.directoryOpenButton.textAndMnemonic=\u6253\u5F00
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openTitle.textAndMnemonic=\u6253\u5F00
+FileChooser.newFolderExistsError.textAndMnemonic=\u8BE5\u540D\u79F0\u5DF2\u88AB\u4F7F\u7528
+FileChooser.chooseButton.textAndMnemonic=\u9009\u62E9
+
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939
+FileChooser.newFolderTitle.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939
+FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=\u53E6\u5B58\u4E3A: 
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u683C\u5F0F:
+
+FileChooser.desktopName=\u684C\u9762
+FileChooser.newFolderPrompt.textAndMnemonic=\u65B0\u6587\u4EF6\u5939\u7684\u540D\u79F0:
+FileChooser.untitledFolderName=\u65E0\u6807\u9898\u7684\u6587\u4EF6\u5939
+FileChooser.untitledFileName=\u65E0\u6807\u9898
+FileChooser.createButton.textAndMnemonic=\u521B\u5EFA
+
+FileChooser.byDate.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
+FileChooser.by.textAndMnemonic=\u540D\u79F0
+FileChooser.newFolderAccessibleName=\u65B0\u5EFA\u6587\u4EF6\u5939
+
+FileChooser.mac.newFolder=\u65E0\u6807\u9898\u7684\u6587\u4EF6\u5939
+FileChooser.mac.newFolder.subsequent=\u65E0\u6807\u9898\u7684\u6587\u4EF6\u5939 {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=\u9884\u89C8
+ColorChooser.ok.textAndMnemonic=\u786E\u5B9A
+ColorChooser.cancel.textAndMnemonic=\u53D6\u6D88
+ColorChooser.reset.textAndMnemonic=\u91CD\u7F6E(&R)
+ColorChooser.sample.textAndMnemonic=\u793A\u4F8B\u6587\u672C  \u793A\u4F8B\u6587\u672C
+ColorChooser.swatches.textAndMnemonic=\u6837\u672C(&S)
+ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u8FD1:
+ColorChooser.hsb.textAndMnemonic=HSB(&H)
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
+ColorChooser.rgbRed.textAndMnemonic=\u7EA2\u8272(&D)
+ColorChooser.rgbGreen.textAndMnemonic=\u7EFF\u8272(&N)
+ColorChooser.rgbBlue.textAndMnemonic=\u84DD\u8272(&B)
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=\u662F(&Y)
+OptionPane.noButton.textAndMnemonic=\u5426(&N)
+OptionPane.okButton.textAndMnemonic=\u786E\u5B9A
+OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+OptionPane.title.textAndMnemonic=\u9009\u62E9\u4E00\u4E2A\u9009\u9879
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=\u8F93\u5165
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=\u6D88\u606F
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=\u6253\u5370
+PrintingDialog.titleAborting.textAndMnemonic=\u6253\u5370 (\u6B63\u5728\u4E2D\u6B62)
+
+PrintingDialog.contentInitial.textAndMnemonic=\u6B63\u5728\u8FDB\u884C\u6253\u5370...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=\u5DF2\u6253\u5370\u9875 {0}...
+
+PrintingDialog.contentAborting.textAndMnemonic=\u6B63\u5728\u4E2D\u6B62\u6253\u5370...
+
+PrintingDialog.abortButton.textAndMnemonic=\u4E2D\u6B62(&A)
+PrintingDialog.abortButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6253\u5370
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=\u6700\u5C0F\u5316
+InternalFrame.maxButtonToolTip=\u6700\u5927\u5316
+InternalFrame.restoreButtonToolTip=\u8FD8\u539F
+InternalFrame.closeButtonToolTip=\u5173\u95ED
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u8FD8\u539F
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52A8
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u5173\u95ED
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=\u63D0\u4EA4\u67E5\u8BE2
+FormView.resetButton.textAndMnemonic=\u91CD\u7F6E
+FormView.browseFileButton.textAndMnemonic=\u6D4F\u89C8...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=\u6837\u5F0F\u66F4\u6539
+AbstractDocument.addition.textAndMnemonic=\u6DFB\u52A0
+AbstractDocument.deletion.textAndMnemonic=\u5220\u9664
+AbstractDocument.undo.textAndMnemonic=\u64A4\u6D88
+AbstractDocument.redo.textAndMnemonic=\u91CD\u505A
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=\u5355\u51FB
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\u64A4\u6D88
+AbstractUndoableEdit.redo.textAndMnemonic=\u91CD\u505A
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=togglePopup
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=\u8FDB\u5EA6...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=\u5DE6\u952E
+SplitPane.rightButton.textAndMnemonic=\u53F3\u952E
+# Used for Isindex
+IsindexView.prompt=\u8FD9\u662F\u53EF\u641C\u7D22\u7D22\u5F15\u3002\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u5B57: 
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=\u56FE\u6807\u5316
+InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButtonAccessibleName=\u5173\u95ED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/com/apple/laf/resources/aqua_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used in Swing
+# Currently, it contains the additional strings needed for the Aqua versions of these components:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+
+############ FILE CHOOSER STRINGS #############
+FileChooser.fileDescription.textAndMnemonic=\u4E00\u822C\u6A94\u6848
+FileChooser.directoryDescription.textAndMnemonic=\u76EE\u9304
+FileChooser.newFolderError.textAndMnemonic=\u5EFA\u7ACB\u8CC7\u6599\u593E\u6642\u767C\u751F\u932F\u8AA4
+FileChooser.newFolderErrorSeparator= :
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6A94\u6848
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
+FileChooser.saveButton.textAndMnemonic=\u5132\u5B58
+FileChooser.openButton.textAndMnemonic=\u958B\u555F
+FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F
+FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0
+FileChooser.helpButton.textAndMnemonic=\u8AAA\u660E
+FileChooser.directoryOpenButton.textAndMnemonic=\u958B\u555F
+
+# File Size Units
+FileChooser.fileSizeKiloBytes={0} KB
+FileChooser.fileSizeMegaBytes={0} MB
+FileChooser.fileSizeGigaBytes={0} GB
+
+# Mac-specific strings
+FileChooser.saveTitle.textAndMnemonic=\u5132\u5B58
+FileChooser.openTitle.textAndMnemonic=\u958B\u555F
+FileChooser.newFolderExistsError.textAndMnemonic=\u8A72\u540D\u7A31\u5DF2\u7D93\u88AB\u4F7F\u7528
+FileChooser.chooseButton.textAndMnemonic=\u9078\u64C7
+
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u8CC7\u6599\u593E
+FileChooser.newFolderTitle.textAndMnemonic=\u65B0\u8CC7\u6599\u593E
+FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848:
+FileChooser.saveDialogFileNameLabel.textAndMnemonic=\u53E6\u5B58\u65B0\u6A94:
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u683C\u5F0F:
+
+FileChooser.desktopName=\u684C\u9762
+FileChooser.newFolderPrompt.textAndMnemonic=\u65B0\u8CC7\u6599\u593E\u540D\u7A31:
+FileChooser.untitledFolderName=\u672A\u547D\u540D\u7684\u8CC7\u6599\u593E
+FileChooser.untitledFileName=\u672A\u547D\u540D
+FileChooser.createButton.textAndMnemonic=\u5EFA\u7ACB
+
+FileChooser.byDate.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
+FileChooser.by.textAndMnemonic=\u540D\u7A31
+FileChooser.newFolderAccessibleName=\u65B0\u8CC7\u6599\u593E
+
+FileChooser.mac.newFolder=\u672A\u547D\u540D\u7684\u8CC7\u6599\u593E
+FileChooser.mac.newFolder.subsequent=\u672A\u547D\u540D\u7684\u8CC7\u6599\u593E {0}
+
+
+############ COLOR CHOOSER STRINGS #############
+ColorChooser.preview.textAndMnemonic=\u9810\u89BD
+ColorChooser.ok.textAndMnemonic=\u78BA\u5B9A
+ColorChooser.cancel.textAndMnemonic=\u53D6\u6D88
+ColorChooser.reset.textAndMnemonic=\u91CD\u8A2D(&R)
+ColorChooser.sample.textAndMnemonic=\u7BC4\u4F8B\u6587\u5B57  \u7BC4\u4F8B\u6587\u5B57
+ColorChooser.swatches.textAndMnemonic=\u8ABF\u8272\u677F(&S)
+ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u65B0\u9078\u64C7:
+ColorChooser.hsb.textAndMnemonic=HSB(&H)
+ColorChooser.hsbHue.textAndMnemonic=H
+ColorChooser.hsbSaturation.textAndMnemonic=S
+ColorChooser.hsbBrightness.textAndMnemonic=B
+ColorChooser.hsbRed.textAndMnemonic=R
+ColorChooser.hsbGreen.textAndMnemonic=G
+ColorChooser.hsbBlue.textAndMnemonic=B
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
+ColorChooser.rgbRed.textAndMnemonic=\u7D05(&D)
+ColorChooser.rgbGreen.textAndMnemonic=\u7DA0(&N)
+ColorChooser.rgbBlue.textAndMnemonic=\u85CD(&B)
+
+############ OPTION PANE STRINGS #############
+# We only define mnemonics for YES/NO, but for completeness you can
+# define mnemonics for any of the buttons.
+OptionPane.yesButton.textAndMnemonic=\u662F(&Y)
+OptionPane.noButton.textAndMnemonic=\u5426(&N)
+OptionPane.okButton.textAndMnemonic=\u78BA\u5B9A
+OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+OptionPane.title.textAndMnemonic=\u9078\u53D6\u4E00\u500B\u9078\u9805
+# Title for the dialog for the showInputDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.inputDialog.titleAndMnemonic=\u8F38\u5165
+# Title for the dialog for the showMessageDialog methods. Only used if
+# the developer uses one of the variants that doesn't take a title.
+OptionPane.messageDialog.titleAndMnemonic=\u8A0A\u606F
+
+############ Printing Dialog Strings ############
+PrintingDialog.titleProgress.textAndMnemonic=\u5217\u5370\u4E2D
+PrintingDialog.titleAborting.textAndMnemonic=\u5217\u5370 (\u4E2D\u6B62\u4E2D)
+
+PrintingDialog.contentInitial.textAndMnemonic=\u6B63\u5728\u5217\u5370...
+
+# The following string will be formatted by a MessageFormat
+# and {0} will be replaced by page number being printed
+PrintingDialog.contentProgress.textAndMnemonic=\u5DF2\u5217\u5370\u7B2C {0} \u9801...
+
+PrintingDialog.contentAborting.textAndMnemonic=\u6B63\u5728\u4E2D\u6B62\u5217\u5370...
+
+PrintingDialog.abortButton.textAndMnemonic=\u4E2D\u6B62(&A)
+PrintingDialog.abortButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u5217\u5370
+
+############ Internal Frame Strings ############
+InternalFrame.iconButtonToolTip=\u6700\u5C0F\u5316
+InternalFrame.maxButtonToolTip=\u6700\u5927\u5316
+InternalFrame.restoreButtonToolTip=\u5FA9\u539F
+InternalFrame.closeButtonToolTip=\u95DC\u9589
+
+############ Internal Frame Title Pane Strings ############
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u539F
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u95DC\u9589
+
+############ Text strings #############
+# Used for html forms
+FormView.submitButton.textAndMnemonic=\u9001\u51FA\u67E5\u8A62
+FormView.resetButton.textAndMnemonic=\u91CD\u8A2D
+FormView.browseFileButton.textAndMnemonic=\u700F\u89BD...
+
+############ Abstract Document Strings ############
+AbstractDocument.styleChange.textAndMnemonic=\u6A23\u5F0F\u8B8A\u66F4
+AbstractDocument.addition.textAndMnemonic=\u9644\u52A0
+AbstractDocument.deletion.textAndMnemonic=\u522A\u9664
+AbstractDocument.undo.textAndMnemonic=\u9084\u539F
+AbstractDocument.redo.textAndMnemonic=\u91CD\u505A
+
+############ Abstract Button Strings ############
+AbstractButton.click.textAndMnemonic=\u6309\u4E00\u4E0B
+
+############ Abstract Undoable Edit Strings ############
+AbstractUndoableEdit.undo.textAndMnemonic=\u9084\u539F
+AbstractUndoableEdit.redo.textAndMnemonic=\u91CD\u505A
+
+############ Combo Box Strings ############
+ComboBox.togglePopup.textAndMnemonic=\u5207\u63DB\u5373\u73FE\u5F0F\u8996\u7A97
+
+############ Progress Monitor Strings ############
+ProgressMonitor.progress.textAndMnemonic=\u9032\u5EA6...
+
+############ Split Pane Strings ############
+SplitPane.leftButton.textAndMnemonic=\u5DE6\u6309\u9215
+SplitPane.rightButton.textAndMnemonic=\u53F3\u6309\u9215
+# Used for Isindex
+IsindexView.prompt=\u9019\u662F\u4E00\u500B\u53EF\u641C\u5C0B\u7684\u7D22\u5F15\u3002\u8F38\u5165\u641C\u5C0B\u95DC\u9375\u5B57: 
+
+############ InternalFrameTitlePane Strings ############
+InternalFrameTitlePane.iconifyButtonAccessibleName=\u5716\u793A\u5316
+InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
+InternalFrameTitlePane.closeButtonAccessibleName=\u95DC\u9589
--- a/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/classes/sun/awt/CGraphicsDevice.java	Wed May 08 10:10:05 2013 +0100
@@ -35,10 +35,18 @@
 
 import sun.java2d.opengl.CGLGraphicsConfig;
 
-public final class CGraphicsDevice extends GraphicsDevice {
+public final class CGraphicsDevice extends GraphicsDevice
+        implements DisplayChangedListener {
 
-    // CoreGraphics display ID
-    private final int displayID;
+    /**
+     * CoreGraphics display ID. This identifier can become non-valid at any time
+     * therefore methods, which is using this id should be ready to it.
+     */
+    private volatile int displayID;
+    private volatile Insets screenInsets;
+    private volatile double xResolution;
+    private volatile double yResolution;
+    private volatile int scale;
 
     // Array of all GraphicsConfig instances for this device
     private final GraphicsConfiguration[] configs;
@@ -51,7 +59,7 @@
     // Save/restore DisplayMode for the Full Screen mode
     private DisplayMode originalMode;
 
-    public CGraphicsDevice(int displayID) {
+    public CGraphicsDevice(final int displayID) {
         this.displayID = displayID;
         configs = new GraphicsConfiguration[] {
             CGLGraphicsConfig.getConfig(this, 0)
@@ -89,7 +97,7 @@
      */
     @Override
     public String getIDstring() {
-        return "Display " + this.displayID;
+        return "Display " + displayID;
     }
 
     /**
@@ -104,15 +112,37 @@
     }
 
     public double getXResolution() {
-        return nativeGetXResolution(displayID);
+        return xResolution;
     }
 
     public double getYResolution() {
-        return nativeGetYResolution(displayID);
+        return yResolution;
     }
 
     public Insets getScreenInsets() {
-        return nativeGetScreenInsets(displayID);
+        return screenInsets;
+    }
+
+    public int getScaleFactor() {
+        return scale;
+    }
+
+    public void invalidate(final int defaultDisplayID) {
+        displayID = defaultDisplayID;
+    }
+
+    @Override
+    public void displayChanged() {
+        xResolution = nativeGetXResolution(displayID);
+        yResolution = nativeGetYResolution(displayID);
+        screenInsets = nativeGetScreenInsets(displayID);
+        scale = (int) nativeGetScaleFactor(displayID);
+        //TODO configs/fullscreenWindow/modes?
+    }
+
+    @Override
+    public void paletteChanged() {
+        // devices do not need to react to this event.
     }
 
     /**
@@ -219,10 +249,6 @@
         return nativeGetDisplayModes(displayID);
     }
 
-    public int getScaleFactor() {
-        return (int) nativeGetScaleFactor(displayID);
-    }
-
     private static native double nativeGetScaleFactor(int displayID);
 
     private static native void nativeSetDisplayMode(int displayID, int w, int h, int bpp, int refrate);
--- a/jdk/src/macosx/classes/sun/awt/CGraphicsEnvironment.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/classes/sun/awt/CGraphicsEnvironment.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,19 +26,20 @@
 package sun.awt;
 
 import java.awt.*;
-import java.awt.print.*;
 import java.util.*;
 
 import sun.java2d.*;
 
 /**
- * This is an implementation of a GraphicsEnvironment object for the default local GraphicsEnvironment used by the Java
- * Runtime Environment for Mac OS X GUI environments.
+ * This is an implementation of a GraphicsEnvironment object for the default
+ * local GraphicsEnvironment used by the Java Runtime Environment for Mac OS X
+ * GUI environments.
  *
  * @see GraphicsDevice
  * @see GraphicsConfiguration
  */
-public class CGraphicsEnvironment extends SunGraphicsEnvironment {
+public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
+
     // Global initialization of the Cocoa runtime.
     private static native void initCocoa();
 
@@ -53,7 +54,8 @@
     private static native int getMainDisplayID();
 
     /**
-     * Noop function that just acts as an entry point for someone to force a static initialization of this class.
+     * Noop function that just acts as an entry point for someone to force a
+     * static initialization of this class.
      */
     public static void init() { }
 
@@ -78,8 +80,9 @@
     }
 
     /**
-     * Register the instance with CGDisplayRegisterReconfigurationCallback()
-     * The registration uses a weak global reference -- if our instance is garbage collected, the reference will be dropped.
+     * Register the instance with CGDisplayRegisterReconfigurationCallback().
+     * The registration uses a weak global reference -- if our instance is
+     * garbage collected, the reference will be dropped.
      *
      * @return Return the registration context (a pointer).
      */
@@ -91,7 +94,7 @@
     private native void deregisterDisplayReconfiguration(long context);
 
     /** Available CoreGraphics displays. */
-    private final Map<Integer, CGraphicsDevice> devices = new HashMap<Integer, CGraphicsDevice>();
+    private final Map<Integer, CGraphicsDevice> devices = new HashMap<>(5);
 
     /** Reference to the display reconfiguration callback context. */
     private final long displayReconfigContext;
@@ -118,11 +121,18 @@
     /**
      * Called by the CoreGraphics Display Reconfiguration Callback.
      *
-     * @param displayId
-     *            CoreGraphics displayId
+     * @param displayId CoreGraphics displayId
+     * @param removed   true if displayId was removed, false otherwise.
      */
-    void _displayReconfiguration(long displayId) {
-        displayChanged();
+    void _displayReconfiguration(final int displayId, final boolean removed) {
+        synchronized (this) {
+            if (removed && devices.containsKey(displayId)) {
+                final CGraphicsDevice gd = devices.remove(displayId);
+                gd.invalidate(getMainDisplayID());
+                gd.displayChanged();
+            }
+        }
+        initDevices();
     }
 
     @Override
@@ -135,31 +145,30 @@
     }
 
     /**
-     * (Re)create all CGraphicsDevices
-     *
-     * @return
+     * (Re)create all CGraphicsDevices, reuses a devices if it is possible.
      */
-    private synchronized void initDevices() {
-        devices.clear();
+    private void initDevices() {
+        synchronized (this) {
+            final Map<Integer, CGraphicsDevice> old = new HashMap<>(devices);
+            devices.clear();
 
-        int mainID = getMainDisplayID();
+            int mainID = getMainDisplayID();
 
-        // initialization of the graphics device may change
-        // list of displays on hybrid systems via an activation
-        // of discrete video.
-        // So, we initialize the main display first, and then
-        // retrieve actual list of displays.
-        CGraphicsDevice mainDevice = new CGraphicsDevice(mainID);
+            // initialization of the graphics device may change
+            // list of displays on hybrid systems via an activation
+            // of discrete video.
+            // So, we initialize the main display first, and then
+            // retrieve actual list of displays.
+            if (!old.containsKey(mainID)) {
+                old.put(mainID, new CGraphicsDevice(mainID));
+            }
 
-        final int[] displayIDs = getDisplayIDs();
-
-        for (int displayID : displayIDs) {
-            if (displayID != mainID) {
-                devices.put(displayID, new CGraphicsDevice(displayID));
-            } else {
-                devices.put(mainID, mainDevice);
+            for (final int id : getDisplayIDs()) {
+                devices.put(id, old.containsKey(id) ? old.get(id)
+                                                    : new CGraphicsDevice(id));
             }
         }
+        displayChanged();
     }
 
     @Override
@@ -167,7 +176,7 @@
         final int mainDisplayID = getMainDisplayID();
         CGraphicsDevice d = devices.get(mainDisplayID);
         if (d == null) {
-            // we do not exepct that this may happen, the only responce
+            // we do not expect that this may happen, the only response
             // is to re-initialize the list of devices
             initDevices();
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed May 08 10:10:05 2013 +0100
@@ -87,18 +87,22 @@
 
     private final T target;
 
-    // Container peer. It may not be the peer of the target's direct
-    // parent, for example, in the case of hw/lw mixing. However,
-    // let's skip this scenario for the time being. We also assume
-    // the container peer is not null, which might also be false if
-    // addNotify() is called for a component outside of the hierarchy.
-    // The exception is LWWindowPeers: their parents are always null
-    private LWContainerPeer containerPeer;
+    /**
+     * Container peer. It may not be the peer of the target's direct parent, for
+     * example, in the case of hw/lw mixing. However, let's skip this scenario
+     * for the time being. We also assume the container peer is not null, which
+     * might also be false if addNotify() is called for a component outside of
+     * the hierarchy. The exception is LWWindowPeers: their containers are
+     * always null
+     */
+    private final LWContainerPeer containerPeer;
 
-    // Handy reference to the top-level window peer. Window peer is
-    // borrowed from the containerPeer in constructor, and should also
-    // be updated when the component is reparented to another container
-    private LWWindowPeer windowPeer;
+    /**
+     * Handy reference to the top-level window peer. Window peer is borrowed
+     * from the containerPeer in constructor, and should also be updated when
+     * the component is reparented to another container
+     */
+    private final LWWindowPeer windowPeer;
 
     private final AtomicBoolean disposed = new AtomicBoolean(false);
 
@@ -183,13 +187,13 @@
         this.target = target;
         this.platformComponent = platformComponent;
 
-        initializeContainerPeer();
         // Container peer is always null for LWWindowPeers, so
         // windowPeer is always null for them as well. On the other
         // hand, LWWindowPeer shouldn't use windowPeer at all
-        if (containerPeer != null) {
-            windowPeer = containerPeer.getWindowPeerOrSelf();
-        }
+        final Container container = SunToolkit.getNativeContainer(target);
+        containerPeer = (LWContainerPeer) LWToolkit.targetToPeer(container);
+        windowPeer = containerPeer != null ? containerPeer.getWindowPeerOrSelf()
+                                           : null;
         // don't bother about z-order here as updateZOrder()
         // will be called from addNotify() later anyway
         if (containerPeer != null) {
@@ -356,15 +360,6 @@
         return containerPeer;
     }
 
-    // Just a helper method
-    // Overridden in LWWindowPeer to skip containerPeer initialization
-    protected void initializeContainerPeer() {
-        Container parent = LWToolkit.getNativeContainer(target);
-        if (parent != null) {
-            containerPeer = (LWContainerPeer) LWToolkit.targetToPeer(parent);
-        }
-    }
-
     public PlatformWindow getPlatformWindow() {
         LWWindowPeer windowPeer = getWindowPeer();
         return windowPeer.getPlatformWindow();
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed May 08 10:10:05 2013 +0100
@@ -41,7 +41,7 @@
 
 public class LWWindowPeer
     extends LWContainerPeer<Window, JComponent>
-    implements WindowPeer, FramePeer, DialogPeer, FullScreenCapable
+    implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener
 {
     public static enum PeerType {
         SIMPLEWINDOW,
@@ -189,6 +189,7 @@
         if (getSurfaceData() == null) {
             replaceSurfaceData(false);
         }
+        activateDisplayListener();
     }
 
     // Just a helper method
@@ -201,15 +202,11 @@
         return this;
     }
 
-    @Override
-    protected void initializeContainerPeer() {
-        // No-op as LWWindowPeer doesn't have any containerPeer
-    }
-
     // ---- PEER METHODS ---- //
 
     @Override
     protected void disposeImpl() {
+        deactivateDisplayListener();
         SurfaceData oldData = getSurfaceData();
         synchronized (surfaceDataLock){
             surfaceData = null;
@@ -880,6 +877,18 @@
 
     // ---- UTILITY METHODS ---- //
 
+    private void activateDisplayListener() {
+        final GraphicsEnvironment ge =
+                GraphicsEnvironment.getLocalGraphicsEnvironment();
+        ((SunGraphicsEnvironment) ge).addDisplayChangedListener(this);
+    }
+
+    private void deactivateDisplayListener() {
+        final GraphicsEnvironment ge =
+                GraphicsEnvironment.getLocalGraphicsEnvironment();
+        ((SunGraphicsEnvironment) ge).removeDisplayChangedListener(this);
+    }
+
     private void postWindowStateChangedEvent(int newWindowState) {
         if (getTarget() instanceof Frame) {
             AWTAccessor.getFrameAccessor().setExtendedState(
@@ -941,7 +950,6 @@
             graphicsDevice = newGraphicsDevice;
         }
 
-        // TODO: DisplayChangedListener stuff
         final GraphicsConfiguration newGC = newGraphicsDevice.getDefaultConfiguration();
 
         if (!setGraphicsConfig(newGC)) return false;
@@ -954,6 +962,20 @@
         return true;
     }
 
+    @Override
+    public final void displayChanged() {
+        updateGraphicsDevice();
+        // Replace surface unconditionally, because internal state of the
+        // GraphicsDevice could be changed.
+        replaceSurfaceData();
+        repaintPeer();
+    }
+
+    @Override
+    public final void paletteChanged() {
+        // components do not need to react to this event.
+    }
+
     /*
      * May be called by delegate to provide SD to Java2D code.
      */
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed May 08 10:10:05 2013 +0100
@@ -32,6 +32,7 @@
 import java.beans.*;
 import java.lang.reflect.InvocationTargetException;
 import java.util.List;
+import java.util.Objects;
 
 import javax.swing.*;
 
@@ -916,9 +917,12 @@
 
         final Rectangle oldB = nativeBounds;
         nativeBounds = new Rectangle(x, y, width, height);
+        final GraphicsConfiguration oldGC = peer.getGraphicsConfiguration();
         peer.notifyReshape(x, y, width, height);
+        final GraphicsConfiguration newGC = peer.getGraphicsConfiguration();
+        // System-dependent appearance optimization.
         if ((byUser && !oldB.getSize().equals(nativeBounds.getSize()))
-            || isFullScreenAnimationOn) {
+            || isFullScreenAnimationOn || !Objects.equals(newGC, oldGC)) {
             flushBuffers();
         }
     }
--- a/jdk/src/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -520,14 +520,22 @@
     }
 
     private static boolean isSupportedCalendarLocale(Locale locale) {
-        Locale base = locale.stripExtensions();
+        Locale base = locale;
+
+        if (base.hasExtensions() || base.getVariant() != "") {
+            base = new Locale.Builder()
+                            .setLocale(locale)
+                            .clearExtensions()
+                            .build();
+        }
+
         if (!supportedLocaleSet.contains(base)) {
             return false;
         }
 
         String requestedCalType = locale.getUnicodeLocaleType("ca");
         String nativeCalType =
-            getCalendarID(locale.toLanguageTag()).replaceFirst("gregorian", "gregory");
+            getCalendarID(base.toLanguageTag()).replaceFirst("gregorian", "gregory");
 
         if (requestedCalType == null) {
             return Calendar.getAvailableCalendarTypes().contains(nativeCalType);
--- a/jdk/src/macosx/native/sun/awt/AWTEvent.h	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/native/sun/awt/AWTEvent.h	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,5 +35,6 @@
 jint GetJavaMouseModifiers(NSInteger button, NSUInteger modifierFlags);
 jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods);
 NSUInteger JavaModifiersToNsKeyModifiers(jint javaModifiers, BOOL isExtMods);
+unichar NsCharToJavaChar(unichar nsChar, NSUInteger modifiers);
 
 #endif /* __AWTEVENT_H */
--- a/jdk/src/macosx/native/sun/awt/AWTEvent.m	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/native/sun/awt/AWTEvent.m	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -341,8 +341,7 @@
     {0, 0, 0}
 };
 
-static unichar
-NsCharToJavaChar(unichar nsChar, NSUInteger modifiers)
+unichar NsCharToJavaChar(unichar nsChar, NSUInteger modifiers)
 {
     const struct _char *cur;
     // Mask off just the keyboard modifiers from the event modifier mask.
--- a/jdk/src/macosx/native/sun/awt/CGraphicsEnv.m	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/native/sun/awt/CGraphicsEnv.m	Wed May 08 10:10:05 2013 +0100
@@ -124,10 +124,11 @@
 
         jobject graphicsEnv = [wrapper jObjectWithEnv:env];
         if (graphicsEnv == NULL) return; // ref already GC'd
-
         static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
-        static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(J)V");
-        JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration);
+        static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(IZ)V");
+        JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
+                            (jint) display, 
+                            (jboolean) flags & kCGDisplayRemoveFlag);
     });
 }
 
--- a/jdk/src/macosx/native/sun/awt/CMenuItem.m	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/native/sun/awt/CMenuItem.m	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,12 +71,21 @@
 JNF_COCOA_ENTER(env);
 
     // If we are called as a result of user pressing a shorcut, do nothing,
-    // because AVTView has already sent corresponding key event to the Java 
+    // because AVTView has already sent corresponding key event to the Java
     // layer from performKeyEquivalent
     NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent];
     if ([currEvent type] == NSKeyDown) {
         NSString *menuKey = [sender keyEquivalent];
         NSString *eventKey = [currEvent charactersIgnoringModifiers];
+
+        // Apple uses characters from private Unicode range for some of the
+        // keys, so we need to do the same translation here that we do
+        // for the regular key down events
+        if ([eventKey length] == 1) {
+            unichar ch =  NsCharToJavaChar([eventKey characterAtIndex:0], 0);
+            eventKey = [NSString stringWithCharacters: &ch length: 1];
+        }
+
         if ([menuKey isEqualToString:eventKey]) {
             return;
         }
--- a/jdk/src/macosx/native/sun/awt/CTextPipe.m	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/native/sun/awt/CTextPipe.m	Wed May 08 10:10:05 2013 +0100
@@ -143,6 +143,8 @@
     CGContextRef cgRef = qsdo->cgRef;
     CGAffineTransform ctmText = CGContextGetTextMatrix(cgRef);
 
+    BOOL saved = false;
+
     /* Save and restore of graphics context is done before the iteration.  
        This seems to work using our test case (see bug ID 7158350) so we are restoring it at
        the end of the for loop.  If we find out that save/restore outside the loop
@@ -175,10 +177,19 @@
                 CFRelease(fallback);
 
                 if (cgFallback) {
+                    if (!saved) {
+                        CGContextSaveGState(cgRef);
+                        saved = true;
+                    }
                     CGContextSetFont(cgRef, cgFallback);
                     CFRelease(cgFallback);
                 }
             }
+        } else {
+            if (saved) {
+                CGContextRestoreGState(cgRef);
+                saved = false;
+            }
         }
 
         // if we have per-glyph transformations
--- a/jdk/src/macosx/native/sun/awt/awt.m	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/native/sun/awt/awt.m	Wed May 08 10:10:05 2013 +0100
@@ -316,7 +316,10 @@
     // its finishLaunching has initialized it.
     //  ApplicationDelegate is the support code for com.apple.eawt.
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);
+        id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
+        if (delegate != nil) {
+            OSXAPP_SetApplicationDelegate(delegate);
+        }        
     }];
 }
 
--- a/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLLayer.m	Wed May 08 10:10:05 2013 +0100
@@ -216,7 +216,11 @@
 {
     JNF_COCOA_ENTER(env);
     CGLLayer *layer = jlong_to_ptr(layerPtr);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+    // We always call all setXX methods asynchronously, exception is only in 
+    // this method where we need to change native texture size and layer's scale
+    // in one call on appkit, otherwise we'll get window's contents blinking, 
+    // during screen-2-screen moving.
+    [ThreadUtilities performOnMainThreadWaiting:[NSThread isMainThread] block:^(){
         layer.contentsScale = scale;
     }];
     JNF_COCOA_EXIT(env);
--- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -77,7 +77,7 @@
 armed=armado
 busy=ocupado
 checked=selecionado
-collapsed=recolhido
+collapsed=contra\u00EDdo
 editable=edit\u00E1vel
 expandable=expans\u00EDvel
 expanded=expandido
--- a/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/accessibility/internal/resources/accessibility_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -27,8 +27,8 @@
 glasspane=\u73BB\u7483\u7A97\u683C
 filechooser=\u6587\u4EF6\u9009\u62E9\u5668
 filler=\u6F0F\u6597
-frame=\u5E27
-internalframe=\u5185\u90E8\u5E27
+frame=\u6846\u67B6
+internalframe=\u5185\u90E8\u6846\u67B6
 label=\u6807\u7B7E
 layeredpane=\u5206\u5C42\u7A97\u683C
 list=\u5217\u8868
--- a/jdk/src/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -241,14 +241,29 @@
         int off = secret.length >> 1;
         int seclen = off + (secret.length & 1);
 
+        byte[] secKey = secret;
+        int keyLen = seclen;
         byte[] output = new byte[outputLength];
 
         // P_MD5(S1, label + seed)
-        expand(md5, 16, secret, 0, seclen, labelBytes, seed, output,
+        // If we have a long secret, digest it first.
+        if (seclen > 64) {              // 64: block size of HMAC-MD5
+            md5.update(secret, 0, seclen);
+            secKey = md5.digest();
+            keyLen = secKey.length;
+        }
+        expand(md5, 16, secKey, 0, keyLen, labelBytes, seed, output,
             HMAC_ipad64.clone(), HMAC_opad64.clone());
 
         // P_SHA-1(S2, label + seed)
-        expand(sha, 20, secret, off, seclen, labelBytes, seed, output,
+        // If we have a long secret, digest it first.
+        if (seclen > 64) {              // 64: block size of HMAC-SHA1
+            sha.update(secret, off, seclen);
+            secKey = sha.digest();
+            keyLen = secKey.length;
+            off = 0;
+        }
+        expand(sha, 20, secKey, off, keyLen, labelBytes, seed, output,
             HMAC_ipad64.clone(), HMAC_opad64.clone());
 
         return output;
--- a/jdk/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Wed May 08 10:10:05 2013 +0100
@@ -60,6 +60,13 @@
     public X509Certificate getTimestampingAuthorityCertificate();
 
     /**
+     * Retrieves the TSAPolicyID for a Timestamping Authority (TSA).
+     *
+     * @return The TSAPolicyID. May be null.
+     */
+    public String getTSAPolicyID();
+
+    /**
      * Retrieves the JAR file's signature.
      *
      * @return The non-null array of signature bytes.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=&GTK-Farbauswahl
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Farbton:
-
-GTKColorChooserPanel.red.textAndMnemonic=&Rot:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=S\u00E4ttigung(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=Gr\u00FCn(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=&Wert:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Blau:
-
-GTKColorChooserPanel.color.textAndMnemonic=Farb&name:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
-FileChooser.newFolderButton.textAndMnemonic=&Neuer Ordner
-FileChooser.newFolderDialog.textAndMnemonic=Ordnername:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fehler
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Fehler beim Erstellen von Verzeichnis "{0}": Datei oder Verzeichnis nicht vorhanden
-FileChooser.deleteFileButton.textAndMnemonic=Datei l\u00F6schen(&L)
-FileChooser.renameFileButton.textAndMnemonic=Datei &umbenennen
-FileChooser.cancelButton.textAndMnemonic=&Abbrechen
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Speichern
-FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
-FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
-FileChooser.filterLabel.textAndMnemonic=Filter:
-FileChooser.foldersLabel.textAndMnemonic=&Ordner
-FileChooser.filesLabel.textAndMnemonic=&Dateien
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
-FileChooser.saveButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei speichern.
-FileChooser.openButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei \u00F6ffnen.
-
-FileChooser.renameFileDialog.textAndMnemonic=Datei "{0}" umbenennen in
-FileChooser.renameFileError.titleAndMnemonic=Fehler
-FileChooser.renameFileError.textAndMnemonic=Fehler beim Umbenennen der Datei "{0}" in "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Abbrechen
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=&GTK-Farbauswahl
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Farbton:
+
+GTKColorChooserPanel.red.textAndMnemonic=R&ot:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&S\u00E4ttigung:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Gr\u00FCn:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Wert:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Blau:
+
+GTKColorChooserPanel.color.textAndMnemonic=Farb&name:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
+FileChooser.newFolderButton.textAndMnemonic=&Neuer Ordner
+FileChooser.newFolderDialog.textAndMnemonic=Ordnername:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fehler
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Fehler beim Erstellen von Verzeichnis "{0}": Datei oder Verzeichnis nicht vorhanden
+FileChooser.deleteFileButton.textAndMnemonic=Datei &l\u00F6schen
+FileChooser.renameFileButton.textAndMnemonic=Datei &umbenennen
+FileChooser.cancelButton.textAndMnemonic=&Abbrechen
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Speichern
+FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
+FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
+FileChooser.filterLabel.textAndMnemonic=Filter:
+FileChooser.foldersLabel.textAndMnemonic=&Ordner
+FileChooser.filesLabel.textAndMnemonic=&Dateien
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
+FileChooser.saveButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei speichern.
+FileChooser.openButtonToolTip.textAndMnemonic=Ausgew\u00E4hlte Datei \u00F6ffnen.
+
+FileChooser.renameFileDialog.textAndMnemonic=Datei "{0}" umbenennen in
+FileChooser.renameFileError.titleAndMnemonic=Fehler
+FileChooser.renameFileError.textAndMnemonic=Fehler beim Umbenennen der Datei "{0}" in "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=Selector de Color para &GTK
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Mat:
-
-GTKColorChooserPanel.red.textAndMnemonic=Ro&jo:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=Saturaci\u00F3n(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=V&erde:
-
-GTKColorChooserPanel.value.textAndMnemonic=&Valor:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Azul:
-
-GTKColorChooserPanel.color.textAndMnemonic=&Nombre del Color:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
-FileChooser.newFolderButton.textAndMnemonic=&Nueva Carpeta
-FileChooser.newFolderDialog.textAndMnemonic=Nombre de la Carpeta:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error al crear el directorio "{0}": no existe dicho archivo o directorio
-FileChooser.deleteFileButton.textAndMnemonic=Su&primir Archivo
-FileChooser.renameFileButton.textAndMnemonic=Cambia&r Nombre de Archivo
-FileChooser.cancelButton.textAndMnemonic=&Cancelar
-FileChooser.saveButton.textAndMnemonic=&Aceptar
-FileChooser.openButton.textAndMnemonic=&Aceptar
-FileChooser.saveDialogTitle.textAndMnemonic=Guardar
-FileChooser.openDialogTitle.textAndMnemonic=Abrir
-FileChooser.pathLabel.textAndMnemonic=Selecci\u00F3n(&S):
-FileChooser.filterLabel.textAndMnemonic=Filtro:
-FileChooser.foldersLabel.textAndMnemonic=Carpe&tas
-FileChooser.filesLabel.textAndMnemonic=&Archivos
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar cuadro de di\u00E1logo del selector de archivos.
-FileChooser.saveButtonToolTip.textAndMnemonic=Guardar el archivo seleccionado.
-FileChooser.openButtonToolTip.textAndMnemonic=Abrir el archivo seleccionado.
-
-FileChooser.renameFileDialog.textAndMnemonic=Cambiar el nombre del archivo "{0}" por
-FileChooser.renameFileError.titleAndMnemonic=Error
-FileChooser.renameFileError.textAndMnemonic=Error al cambiar el nombre del archivo "{0}" a "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&Aceptar
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Cancelar
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=Selector de Color para &GTK
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Mat:
+
+GTKColorChooserPanel.red.textAndMnemonic=Ro&jo:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Saturaci\u00F3n:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Verde:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Valor:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Azul:
+
+GTKColorChooserPanel.color.textAndMnemonic=&Nombre del Color:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
+FileChooser.newFolderButton.textAndMnemonic=&Nueva Carpeta
+FileChooser.newFolderDialog.textAndMnemonic=Nombre de la Carpeta:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error al crear el directorio "{0}": no existe dicho archivo o directorio
+FileChooser.deleteFileButton.textAndMnemonic=Su&primir Archivo
+FileChooser.renameFileButton.textAndMnemonic=Cambiar Nomb&re de Archivo
+FileChooser.cancelButton.textAndMnemonic=&Cancelar
+FileChooser.saveButton.textAndMnemonic=&Aceptar
+FileChooser.openButton.textAndMnemonic=&Aceptar
+FileChooser.saveDialogTitle.textAndMnemonic=Guardar
+FileChooser.openDialogTitle.textAndMnemonic=Abrir
+FileChooser.pathLabel.textAndMnemonic=&Selecci\u00F3n:
+FileChooser.filterLabel.textAndMnemonic=Filtro:
+FileChooser.foldersLabel.textAndMnemonic=Carpe&tas
+FileChooser.filesLabel.textAndMnemonic=&Archivos
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar cuadro de di\u00E1logo del selector de archivos.
+FileChooser.saveButtonToolTip.textAndMnemonic=Guardar el archivo seleccionado.
+FileChooser.openButtonToolTip.textAndMnemonic=Abrir el archivo seleccionado.
+
+FileChooser.renameFileDialog.textAndMnemonic=Cambiar el nombre del archivo "{0}" por
+FileChooser.renameFileError.titleAndMnemonic=Error
+FileChooser.renameFileError.textAndMnemonic=Error al cambiar el nombre del archivo "{0}" a "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=S\u00E9lecteur de couleurs GTK(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Teinte :
-
-GTKColorChooserPanel.red.textAndMnemonic=Rouge\u00A0(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation :
-
-GTKColorChooserPanel.green.textAndMnemonic=V&ert :
-
-GTKColorChooserPanel.value.textAndMnemonic=&Valeur :
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Bleu :
-
-GTKColorChooserPanel.color.textAndMnemonic=&Nom de couleur :
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
-FileChooser.newFolderButton.textAndMnemonic=&Nouveau dossier
-FileChooser.newFolderDialog.textAndMnemonic=Nom du dossier :
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erreur
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erreur lors de la cr\u00E9ation du r\u00E9pertoire "{0}" : ce fichier ou r\u00E9pertoire n''existe pas
-FileChooser.deleteFileButton.textAndMnemonic=Supprimer &le fichier
-FileChooser.renameFileButton.textAndMnemonic=&Renommer le fichier
-FileChooser.cancelButton.textAndMnemonic=&Annuler
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
-FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
-FileChooser.pathLabel.textAndMnemonic=S\u00E9lection (&S):
-FileChooser.filterLabel.textAndMnemonic=Filtre :
-FileChooser.foldersLabel.textAndMnemonic=&Dossiers
-FileChooser.filesLabel.textAndMnemonic=&Fichiers
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers.
-FileChooser.saveButtonToolTip.textAndMnemonic=Enregistre le fichier s\u00E9lectionn\u00E9.
-FileChooser.openButtonToolTip.textAndMnemonic=Ouvre le fichier s\u00E9lectionn\u00E9.
-
-FileChooser.renameFileDialog.textAndMnemonic=Renomme le fichier "{0}" en
-FileChooser.renameFileError.titleAndMnemonic=Erreur
-FileChooser.renameFileError.textAndMnemonic=Erreur lors du changement de nom du fichier "{0}" en "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Annuler
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=S\u00E9lecteur de couleurs &GTK
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Teinte :
+
+GTKColorChooserPanel.red.textAndMnemonic=Roug&e\u00A0:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation :
+
+GTKColorChooserPanel.green.textAndMnemonic=&Vert :
+
+GTKColorChooserPanel.value.textAndMnemonic=&Valeur :
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Bleu :
+
+GTKColorChooserPanel.color.textAndMnemonic=&Nom de couleur :
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
+FileChooser.newFolderButton.textAndMnemonic=&Nouveau dossier
+FileChooser.newFolderDialog.textAndMnemonic=Nom du dossier :
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erreur
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erreur lors de la cr\u00E9ation du r\u00E9pertoire "{0}" : ce fichier ou r\u00E9pertoire n''existe pas
+FileChooser.deleteFileButton.textAndMnemonic=Supprimer &le fichier
+FileChooser.renameFileButton.textAndMnemonic=&Renommer le fichier
+FileChooser.cancelButton.textAndMnemonic=&Annuler
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
+FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
+FileChooser.pathLabel.textAndMnemonic=&S\u00E9lection :
+FileChooser.filterLabel.textAndMnemonic=Filtre :
+FileChooser.foldersLabel.textAndMnemonic=&Dossiers
+FileChooser.filesLabel.textAndMnemonic=&Fichiers
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Ferme la bo\u00EEte de dialogue du s\u00E9lecteur de fichiers.
+FileChooser.saveButtonToolTip.textAndMnemonic=Enregistre le fichier s\u00E9lectionn\u00E9.
+FileChooser.openButtonToolTip.textAndMnemonic=Ouvre le fichier s\u00E9lectionn\u00E9.
+
+FileChooser.renameFileDialog.textAndMnemonic=Renomme le fichier "{0}" en
+FileChooser.renameFileError.titleAndMnemonic=Erreur
+FileChooser.renameFileError.textAndMnemonic=Erreur lors du changement de nom du fichier "{0}" en "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=Selezione colore &GTK
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Ton.:
-
-GTKColorChooserPanel.red.textAndMnemonic=R&osso:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=&Saturazione:
-
-GTKColorChooserPanel.green.textAndMnemonic=V&erde:
-
-GTKColorChooserPanel.value.textAndMnemonic=&Valore:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Blu:
-
-GTKColorChooserPanel.color.textAndMnemonic=&Nome colore:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
-FileChooser.newFolderButton.textAndMnemonic=&Nuova cartella
-FileChooser.newFolderDialog.textAndMnemonic=Nome della cartella:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Errore
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Errore durante la creazione della directory "{0}": file o directory inesistente
-FileChooser.deleteFileButton.textAndMnemonic=E&limina file
-FileChooser.renameFileButton.textAndMnemonic=&Rinomina file
-FileChooser.cancelButton.textAndMnemonic=&Annulla
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Salva
-FileChooser.openDialogTitle.textAndMnemonic=Apri
-FileChooser.pathLabel.textAndMnemonic=&Selezione:
-FileChooser.filterLabel.textAndMnemonic=Filtro:
-FileChooser.foldersLabel.textAndMnemonic=Car&telle
-FileChooser.filesLabel.textAndMnemonic=&File
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Chiude la finestra di dialogo di selezione file.
-FileChooser.saveButtonToolTip.textAndMnemonic=Salva il file selezionato.
-FileChooser.openButtonToolTip.textAndMnemonic=Apre il file selezionato.
-
-FileChooser.renameFileDialog.textAndMnemonic=Rinomina file "{0}" in
-FileChooser.renameFileError.titleAndMnemonic=Errore
-FileChooser.renameFileError.textAndMnemonic=Errore durante la ridenominazione del file "{0}" in "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Annulla
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=Selezione colore &GTK
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Ton.:
+
+GTKColorChooserPanel.red.textAndMnemonic=R&osso:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Saturazione:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Verde:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Valore:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Blu:
+
+GTKColorChooserPanel.color.textAndMnemonic=&Nome colore:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
+FileChooser.newFolderButton.textAndMnemonic=&Nuova cartella
+FileChooser.newFolderDialog.textAndMnemonic=Nome della cartella:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Errore
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Errore durante la creazione della directory "{0}": file o directory inesistente
+FileChooser.deleteFileButton.textAndMnemonic=E&limina file
+FileChooser.renameFileButton.textAndMnemonic=&Rinomina file
+FileChooser.cancelButton.textAndMnemonic=&Annulla
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Salva
+FileChooser.openDialogTitle.textAndMnemonic=Apri
+FileChooser.pathLabel.textAndMnemonic=&Selezione:
+FileChooser.filterLabel.textAndMnemonic=Filtro:
+FileChooser.foldersLabel.textAndMnemonic=Car&telle
+FileChooser.filesLabel.textAndMnemonic=&File
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Chiude la finestra di dialogo di selezione file.
+FileChooser.saveButtonToolTip.textAndMnemonic=Salva il file selezionato.
+FileChooser.openButtonToolTip.textAndMnemonic=Apre il file selezionato.
+
+FileChooser.renameFileDialog.textAndMnemonic=Rinomina file "{0}" in
+FileChooser.renameFileError.titleAndMnemonic=Errore
+FileChooser.renameFileError.textAndMnemonic=Errore durante la ridenominazione del file "{0}" in "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,55 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK\u30AB\u30E9\u30FC\u30FB\u30C1\u30E5\u30FC\u30B6(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u76F8(&H):
-
-GTKColorChooserPanel.red.textAndMnemonic=\u8D64(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=\u5F69\u5EA6(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=\u7DD1(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=\u5024(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=\u9752(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=\u8272\u540D(&N):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
-FileChooser.newFolderButton.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0(&N)
-FileChooser.newFolderDialog.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u30A8\u30E9\u30FC
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA"{0}"\u306E\u4F5C\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: \u3053\u306E\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
-FileChooser.deleteFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u524A\u9664(&L)
-FileChooser.renameFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u5909\u66F4(&R)
-FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
-FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F
-FileChooser.pathLabel.textAndMnemonic=\u9078\u629E(&S):
-FileChooser.filterLabel.textAndMnemonic=\u30D5\u30A3\u30EB\u30BF:
-FileChooser.foldersLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0(&D)
-FileChooser.filesLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB(&F)
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002
-FileChooser.saveButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u307E\u3059\u3002
-FileChooser.openButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3059\u3002
-
-FileChooser.renameFileDialog.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB"{0}"\u3092\u6B21\u306E\u540D\u524D\u306B\u5909\u66F4:
-FileChooser.renameFileError.titleAndMnemonic=\u30A8\u30E9\u30FC
-FileChooser.renameFileError.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB"{0}"\u306E"{1}"\u3078\u306E\u5909\u66F4\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
-
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=GTK\u30AB\u30E9\u30FC\u30FB\u30C1\u30E5\u30FC\u30B6(&G)
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u76F8(&H):
+
+GTKColorChooserPanel.red.textAndMnemonic=\u8D64(&E):
+
+GTKColorChooserPanel.saturation.textAndMnemonic=\u5F69\u5EA6(&S):
+
+GTKColorChooserPanel.green.textAndMnemonic=\u7DD1(&G):
+
+GTKColorChooserPanel.value.textAndMnemonic=\u5024(&V):
+
+GTKColorChooserPanel.blue.textAndMnemonic=\u9752(&B):
+
+GTKColorChooserPanel.color.textAndMnemonic=\u8272\u540D(&N):
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0(&N)
+FileChooser.newFolderDialog.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u30A8\u30E9\u30FC
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA"{0}"\u306E\u4F5C\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: \u3053\u306E\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
+FileChooser.deleteFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u524A\u9664(&L)
+FileChooser.renameFileButton.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u5909\u66F4(&R)
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
+FileChooser.saveButton.textAndMnemonic=OK(&O)
+FileChooser.openButton.textAndMnemonic=OK(&O)
+FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u958B\u304F
+FileChooser.pathLabel.textAndMnemonic=\u9078\u629E(&S):
+FileChooser.filterLabel.textAndMnemonic=\u30D5\u30A3\u30EB\u30BF:
+FileChooser.foldersLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0(&D)
+FileChooser.filesLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB(&F)
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u30FB\u30C1\u30E5\u30FC\u30B6\u30FB\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u7D42\u4E86\u3057\u307E\u3059\u3002
+FileChooser.saveButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u4FDD\u5B58\u3057\u307E\u3059\u3002
+FileChooser.openButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304D\u307E\u3059\u3002
+
+FileChooser.renameFileDialog.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB"{0}"\u3092\u6B21\u306E\u540D\u524D\u306B\u5909\u66F4:
+FileChooser.renameFileError.titleAndMnemonic=\u30A8\u30E9\u30FC
+FileChooser.renameFileError.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB"{0}"\u306E"{1}"\u3078\u306E\u5909\u66F4\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,55 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK \uC0C9\uC0C1 \uC120\uD0DD\uAE30(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=\uC0C9\uC870(&H):
-
-GTKColorChooserPanel.red.textAndMnemonic=\uBE68\uAC04\uC0C9(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=\uCC44\uB3C4(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=\uB179\uC0C9(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=\uAC12(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=\uD30C\uB780\uC0C9(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=\uC0C9\uC0C1 \uC774\uB984(&N):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=\uBAA8\uB4E0 \uD30C\uC77C
-FileChooser.newFolderButton.textAndMnemonic=\uC0C8 \uD3F4\uB354(&N)
-FileChooser.newFolderDialog.textAndMnemonic=\uD3F4\uB354 \uC774\uB984:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\uC624\uB958
-FileChooser.newFolderNoDirectoryError.textAndMnemonic="{0}" \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
-FileChooser.deleteFileButton.textAndMnemonic=\uD30C\uC77C \uC0AD\uC81C(&L)
-FileChooser.renameFileButton.textAndMnemonic=\uD30C\uC77C \uC774\uB984 \uBC14\uAFB8\uAE30(&R)
-FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C(&C)
-FileChooser.saveButton.textAndMnemonic=\uD655\uC778(&O)
-FileChooser.openButton.textAndMnemonic=\uD655\uC778(&O)
-FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5
-FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30
-FileChooser.pathLabel.textAndMnemonic=\uC120\uD0DD \uC0AC\uD56D(&S):
-FileChooser.filterLabel.textAndMnemonic=\uD544\uD130:
-FileChooser.foldersLabel.textAndMnemonic=\uD3F4\uB354(&D)
-FileChooser.filesLabel.textAndMnemonic=\uD30C\uC77C(&F)
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4.
-FileChooser.saveButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4.
-FileChooser.openButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4.
-
-FileChooser.renameFileDialog.textAndMnemonic="{0}" \uD30C\uC77C\uC758 \uC774\uB984 \uBC14\uAFB8\uAE30
-FileChooser.renameFileError.titleAndMnemonic=\uC624\uB958
-FileChooser.renameFileError.textAndMnemonic="{0}" \uD30C\uC77C\uC758 \uC774\uB984\uC744 "{1}"(\uC73C)\uB85C \uBC14\uAFB8\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
-
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=GTK \uC0C9\uC0C1 \uC120\uD0DD\uAE30(&G)
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=\uC0C9\uC870(&H):
+
+GTKColorChooserPanel.red.textAndMnemonic=\uBE68\uAC04\uC0C9(&E):
+
+GTKColorChooserPanel.saturation.textAndMnemonic=\uCC44\uB3C4(&S):
+
+GTKColorChooserPanel.green.textAndMnemonic=\uB179\uC0C9(&G):
+
+GTKColorChooserPanel.value.textAndMnemonic=\uAC12(&V):
+
+GTKColorChooserPanel.blue.textAndMnemonic=\uD30C\uB780\uC0C9(&B):
+
+GTKColorChooserPanel.color.textAndMnemonic=\uC0C9\uC0C1 \uC774\uB984(&N):
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=\uBAA8\uB4E0 \uD30C\uC77C
+FileChooser.newFolderButton.textAndMnemonic=\uC0C8 \uD3F4\uB354(&N)
+FileChooser.newFolderDialog.textAndMnemonic=\uD3F4\uB354 \uC774\uB984:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\uC624\uB958
+FileChooser.newFolderNoDirectoryError.textAndMnemonic="{0}" \uB514\uB809\uD1A0\uB9AC\uB97C \uC0DD\uC131\uD558\uB294 \uC911 \uC624\uB958 \uBC1C\uC0DD: \uD574\uB2F9 \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
+FileChooser.deleteFileButton.textAndMnemonic=\uD30C\uC77C \uC0AD\uC81C(&L)
+FileChooser.renameFileButton.textAndMnemonic=\uD30C\uC77C \uC774\uB984 \uBC14\uAFB8\uAE30(&R)
+FileChooser.cancelButton.textAndMnemonic=\uCDE8\uC18C(&C)
+FileChooser.saveButton.textAndMnemonic=\uD655\uC778(&O)
+FileChooser.openButton.textAndMnemonic=\uD655\uC778(&O)
+FileChooser.saveDialogTitle.textAndMnemonic=\uC800\uC7A5
+FileChooser.openDialogTitle.textAndMnemonic=\uC5F4\uAE30
+FileChooser.pathLabel.textAndMnemonic=\uC120\uD0DD \uC0AC\uD56D(&S):
+FileChooser.filterLabel.textAndMnemonic=\uD544\uD130:
+FileChooser.foldersLabel.textAndMnemonic=\uD3F4\uB354(&D)
+FileChooser.filesLabel.textAndMnemonic=\uD30C\uC77C(&F)
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=\uD30C\uC77C \uC120\uD0DD\uAE30 \uB300\uD654\uC0C1\uC790\uB97C \uC911\uB2E8\uD569\uB2C8\uB2E4.
+FileChooser.saveButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC800\uC7A5\uD569\uB2C8\uB2E4.
+FileChooser.openButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uD30C\uC77C\uC744 \uC5FD\uB2C8\uB2E4.
+
+FileChooser.renameFileDialog.textAndMnemonic="{0}" \uD30C\uC77C\uC758 \uC774\uB984 \uBC14\uAFB8\uAE30
+FileChooser.renameFileError.titleAndMnemonic=\uC624\uB958
+FileChooser.renameFileError.textAndMnemonic="{0}" \uD30C\uC77C\uC758 \uC774\uB984\uC744 "{1}"(\uC73C)\uB85C \uBC14\uAFB8\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=Seletor de Cores do &GTK
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Matiz:
-
-GTKColorChooserPanel.red.textAndMnemonic=V&ermelho:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=Satura\u00E7\u00E3o(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=Ver&de:
-
-GTKColorChooserPanel.value.textAndMnemonic=&Valor:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Azul:
-
-GTKColorChooserPanel.color.textAndMnemonic=&Nome da Cor:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Todos os Arquivos
-FileChooser.newFolderButton.textAndMnemonic=&Nova Pasta
-FileChooser.newFolderDialog.textAndMnemonic=Nome da pasta:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erro
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erro ao criar o diret\u00F3rio "{0}": N\u00E3o h\u00E1 arquivo ou diret\u00F3rio
-FileChooser.deleteFileButton.textAndMnemonic=De&letar Arquivo
-FileChooser.renameFileButton.textAndMnemonic=&Renomear Arquivo
-FileChooser.cancelButton.textAndMnemonic=&Cancelar
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Salvar
-FileChooser.openDialogTitle.textAndMnemonic=Abrir
-FileChooser.pathLabel.textAndMnemonic=Sele\u00E7\u00E3o(&S):
-FileChooser.filterLabel.textAndMnemonic=Filtro:
-FileChooser.foldersLabel.textAndMnemonic=&Pastas
-FileChooser.filesLabel.textAndMnemonic=&Arquivos
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar caixa de di\u00E1logo do seletor de arquivos.
-FileChooser.saveButtonToolTip.textAndMnemonic=Salvar arquivo selecionado.
-FileChooser.openButtonToolTip.textAndMnemonic=Abrir arquivo selecionado.
-
-FileChooser.renameFileDialog.textAndMnemonic=Renomear arquivo "{0}" por
-FileChooser.renameFileError.titleAndMnemonic=Erro
-FileChooser.renameFileError.textAndMnemonic=Erro ao renomear o arquivo "{0}" por "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Cancelar
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=Seletor de Cores do &GTK
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Matiz:
+
+GTKColorChooserPanel.red.textAndMnemonic=V&ermelho:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Satura\u00E7\u00E3o:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Verde:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Valor:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Azul:
+
+GTKColorChooserPanel.color.textAndMnemonic=&Nome da Cor:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Todos os Arquivos
+FileChooser.newFolderButton.textAndMnemonic=&Nova Pasta
+FileChooser.newFolderDialog.textAndMnemonic=Nome da pasta:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Erro
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Erro ao criar o diret\u00F3rio "{0}": N\u00E3o h\u00E1 arquivo ou diret\u00F3rio
+FileChooser.deleteFileButton.textAndMnemonic=De&letar Arquivo
+FileChooser.renameFileButton.textAndMnemonic=&Renomear Arquivo
+FileChooser.cancelButton.textAndMnemonic=&Cancelar
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Salvar
+FileChooser.openDialogTitle.textAndMnemonic=Abrir
+FileChooser.pathLabel.textAndMnemonic=&Sele\u00E7\u00E3o:
+FileChooser.filterLabel.textAndMnemonic=Filtro:
+FileChooser.foldersLabel.textAndMnemonic=&Pastas
+FileChooser.filesLabel.textAndMnemonic=&Arquivos
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar caixa de di\u00E1logo do seletor de arquivos.
+FileChooser.saveButtonToolTip.textAndMnemonic=Salvar arquivo selecionado.
+FileChooser.openButtonToolTip.textAndMnemonic=Abrir arquivo selecionado.
+
+FileChooser.renameFileDialog.textAndMnemonic=Renomear arquivo "{0}" por
+FileChooser.renameFileError.titleAndMnemonic=Erro
+FileChooser.renameFileError.textAndMnemonic=Erro ao renomear o arquivo "{0}" por "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,59 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK-f\u00E4rgv\u00E4ljaren(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Nyans:
-
-GTKColorChooserPanel.red.textAndMnemonic=R\u00F6d(&R):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=M\u00E4ttnad(&M):
-
-GTKColorChooserPanel.green.textAndMnemonic=Gr\u00F6n(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=V\u00E4rde(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=Bl\u00E5(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=F\u00E4rgnamn(&F):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
-FileChooser.newFolderButton.textAndMnemonic=&Ny mapp
-FileChooser.newFolderDialog.textAndMnemonic=Mapp:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fel
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6rs\u00F6k att skapa katalogen "{0}": Filen eller katalogen finns inte
-FileChooser.deleteFileButton.textAndMnemonic=Ta &bort fil
-FileChooser.renameFileButton.textAndMnemonic=\u00C4ndra namn p\u00E5 filen(&R)
-FileChooser.cancelButton.textAndMnemonic=&Avbryt
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Spara
-FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
-FileChooser.pathLabel.textAndMnemonic=&Urval:
-FileChooser.filterLabel.textAndMnemonic=Filter:
-FileChooser.foldersLabel.textAndMnemonic=Ma&ppar
-FileChooser.filesLabel.textAndMnemonic=&Filer
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Avbryt dialogrutan Filv\u00E4ljare.
-FileChooser.saveButtonToolTip.textAndMnemonic=Spara vald fil.
-FileChooser.openButtonToolTip.textAndMnemonic=\u00D6ppna vald fil.
-
-FileChooser.renameFileDialog.textAndMnemonic=Namn\u00E4ndra fil "{0}" till
-FileChooser.renameFileError.titleAndMnemonic=Fel
-FileChooser.renameFileError.textAndMnemonic=Fel vid namn\u00E4ndring av fil "{0}" till "{1}"
-
-# dummy resource added for translation automation
-OptionPane.okButton.textAndMnemonic=&OK
-# dummy resource added for translation automation
-OptionPane.cancelButton.textAndMnemonic=&Avbryt
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=&GTK-f\u00E4rgv\u00E4ljaren
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Nyans:
+
+GTKColorChooserPanel.red.textAndMnemonic=R&\u00F6d:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&M\u00E4ttnad:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Gr\u00F6n:
+
+GTKColorChooserPanel.value.textAndMnemonic=&V\u00E4rde:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Bl\u00E5:
+
+GTKColorChooserPanel.color.textAndMnemonic=F\u00E4rg&namn:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
+FileChooser.newFolderButton.textAndMnemonic=&Ny mapp
+FileChooser.newFolderDialog.textAndMnemonic=Mapp:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Fel
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6rs\u00F6k att skapa katalogen "{0}": Filen eller katalogen finns inte
+FileChooser.deleteFileButton.textAndMnemonic=Ta &bort fil
+FileChooser.renameFileButton.textAndMnemonic=&\u00C4ndra namn p\u00E5 filen
+FileChooser.cancelButton.textAndMnemonic=&Avbryt
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Spara
+FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
+FileChooser.pathLabel.textAndMnemonic=&Urval:
+FileChooser.filterLabel.textAndMnemonic=Filter:
+FileChooser.foldersLabel.textAndMnemonic=Map&par
+FileChooser.filesLabel.textAndMnemonic=&Filer
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Avbryt dialogrutan Filv\u00E4ljare.
+FileChooser.saveButtonToolTip.textAndMnemonic=Spara vald fil.
+FileChooser.openButtonToolTip.textAndMnemonic=\u00D6ppna vald fil.
+
+FileChooser.renameFileDialog.textAndMnemonic=Namn\u00E4ndra fil "{0}" till
+FileChooser.renameFileError.titleAndMnemonic=Fel
+FileChooser.renameFileError.textAndMnemonic=Fel vid namn\u00E4ndring av fil "{0}" till "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,55 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK \u989C\u8272\u9009\u62E9\u5668(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u8C03(&H):
-
-GTKColorChooserPanel.red.textAndMnemonic=\u7EA2\u8272(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=\u9971\u548C\u5EA6(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=\u7EFF\u8272(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=\u503C(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=\u84DD\u8272(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=\u989C\u8272\u540D(&N):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6587\u4EF6
-FileChooser.newFolderButton.textAndMnemonic=\u65B0\u6587\u4EF6\u5939(&N)
-FileChooser.newFolderDialog.textAndMnemonic=\u6587\u4EF6\u5939\u540D:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u9519\u8BEF
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u521B\u5EFA\u76EE\u5F55 "{0}" \u65F6\u51FA\u9519: \u6CA1\u6709\u6B64\u7C7B\u6587\u4EF6\u6216\u76EE\u5F55
-FileChooser.deleteFileButton.textAndMnemonic=\u5220\u9664\u6587\u4EF6(&L)
-FileChooser.renameFileButton.textAndMnemonic=\u91CD\u547D\u540D\u6587\u4EF6(&R)
-FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
-FileChooser.saveButton.textAndMnemonic=\u786E\u5B9A(&O)
-FileChooser.openButton.textAndMnemonic=\u786E\u5B9A(&O)
-FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
-FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
-FileChooser.pathLabel.textAndMnemonic=\u9009\u5B9A\u5185\u5BB9(&S):
-FileChooser.filterLabel.textAndMnemonic=\u7B5B\u9009\u5668:
-FileChooser.foldersLabel.textAndMnemonic=\u6587\u4EF6\u5939(&D)
-FileChooser.filesLabel.textAndMnemonic=\u6587\u4EF6(&F)
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002
-FileChooser.saveButtonToolTip.textAndMnemonic=\u4FDD\u5B58\u6240\u9009\u6587\u4EF6\u3002
-FileChooser.openButtonToolTip.textAndMnemonic=\u6253\u5F00\u6240\u9009\u6587\u4EF6\u3002
-
-FileChooser.renameFileDialog.textAndMnemonic=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A
-FileChooser.renameFileError.titleAndMnemonic=\u9519\u8BEF
-FileChooser.renameFileError.textAndMnemonic=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A "{1}" \u65F6\u51FA\u9519
-
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=GTK \u989C\u8272\u9009\u62E9\u5668(&G)
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u8C03(&H):
+
+GTKColorChooserPanel.red.textAndMnemonic=\u7EA2\u8272(&E):
+
+GTKColorChooserPanel.saturation.textAndMnemonic=\u9971\u548C\u5EA6(&S):
+
+GTKColorChooserPanel.green.textAndMnemonic=\u7EFF\u8272(&G):
+
+GTKColorChooserPanel.value.textAndMnemonic=\u503C(&V):
+
+GTKColorChooserPanel.blue.textAndMnemonic=\u84DD\u8272(&B):
+
+GTKColorChooserPanel.color.textAndMnemonic=\u989C\u8272\u540D(&N):
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6587\u4EF6
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u6587\u4EF6\u5939(&N)
+FileChooser.newFolderDialog.textAndMnemonic=\u6587\u4EF6\u5939\u540D: 
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u9519\u8BEF
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u521B\u5EFA\u76EE\u5F55 "{0}" \u65F6\u51FA\u9519: \u6CA1\u6709\u6B64\u7C7B\u6587\u4EF6\u6216\u76EE\u5F55
+FileChooser.deleteFileButton.textAndMnemonic=\u5220\u9664\u6587\u4EF6(&L)
+FileChooser.renameFileButton.textAndMnemonic=\u91CD\u547D\u540D\u6587\u4EF6(&R)
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
+FileChooser.saveButton.textAndMnemonic=\u786E\u5B9A(&O)
+FileChooser.openButton.textAndMnemonic=\u786E\u5B9A(&O)
+FileChooser.saveDialogTitle.textAndMnemonic=\u4FDD\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
+FileChooser.pathLabel.textAndMnemonic=\u9009\u5B9A\u5185\u5BB9(&S):
+FileChooser.filterLabel.textAndMnemonic=\u7B5B\u9009\u5668: 
+FileChooser.foldersLabel.textAndMnemonic=\u6587\u4EF6\u5939(&D)
+FileChooser.filesLabel.textAndMnemonic=\u6587\u4EF6(&F)
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002
+FileChooser.saveButtonToolTip.textAndMnemonic=\u4FDD\u5B58\u6240\u9009\u6587\u4EF6\u3002
+FileChooser.openButtonToolTip.textAndMnemonic=\u6253\u5F00\u6240\u9009\u6587\u4EF6\u3002
+
+FileChooser.renameFileDialog.textAndMnemonic=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A
+FileChooser.renameFileError.titleAndMnemonic=\u9519\u8BEF
+FileChooser.renameFileError.textAndMnemonic=\u5C06\u6587\u4EF6 "{0}" \u91CD\u547D\u540D\u4E3A "{1}" \u65F6\u51FA\u9519
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,55 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=GTK \u8272\u5F69\u9078\u64C7\u5668(&G)
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u8ABF(&H)\uFF1A
-
-GTKColorChooserPanel.red.textAndMnemonic=\u7D05(&E):
-
-GTKColorChooserPanel.saturation.textAndMnemonic=\u5F69\u5EA6(&S):
-
-GTKColorChooserPanel.green.textAndMnemonic=\u7DA0(&G):
-
-GTKColorChooserPanel.value.textAndMnemonic=\u503C(&V):
-
-GTKColorChooserPanel.blue.textAndMnemonic=\u85CD(&B):
-
-GTKColorChooserPanel.color.textAndMnemonic=\u984F\u8272\u540D\u7A31(&N):
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6A94\u6848
-FileChooser.newFolderButton.textAndMnemonic=\u65B0\u5EFA\u8CC7\u6599\u593E(&N)
-FileChooser.newFolderDialog.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u932F\u8AA4
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u5EFA\u7ACB\u76EE\u9304 "{0}" \u6642\u767C\u751F\u932F\u8AA4: \u6C92\u6709\u6B64\u6A94\u6848\u6216\u76EE\u9304
-FileChooser.deleteFileButton.textAndMnemonic=\u522A\u9664\u6A94\u6848(&L)
-FileChooser.renameFileButton.textAndMnemonic=\u91CD\u65B0\u547D\u540D\u6A94\u6848(&R)
-FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
-FileChooser.saveButton.textAndMnemonic=\u78BA\u5B9A(&O)
-FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A(&O)
-FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58
-FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F
-FileChooser.pathLabel.textAndMnemonic=\u9078\u53D6(&S):
-FileChooser.filterLabel.textAndMnemonic=\u7BE9\u9078:
-FileChooser.foldersLabel.textAndMnemonic=\u8CC7\u6599\u593E(&D)
-FileChooser.filesLabel.textAndMnemonic=\u6A94\u6848(&F)
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002
-FileChooser.saveButtonToolTip.textAndMnemonic=\u5132\u5B58\u9078\u53D6\u7684\u6A94\u6848\u3002
-FileChooser.openButtonToolTip.textAndMnemonic=\u958B\u555F\u9078\u53D6\u7684\u6A94\u6848\u3002
-
-FileChooser.renameFileDialog.textAndMnemonic=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA
-FileChooser.renameFileError.titleAndMnemonic=\u932F\u8AA4
-FileChooser.renameFileError.textAndMnemonic=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA "{1}" \u6642\u51FA\u73FE\u932F\u8AA4
-
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=GTK \u8272\u5F69\u9078\u64C7\u5668(&G)
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=\u8272\u8ABF(&H):
+
+GTKColorChooserPanel.red.textAndMnemonic=\u7D05(&E):
+
+GTKColorChooserPanel.saturation.textAndMnemonic=\u5F69\u5EA6(&S):
+
+GTKColorChooserPanel.green.textAndMnemonic=\u7DA0(&G):
+
+GTKColorChooserPanel.value.textAndMnemonic=\u503C(&V):
+
+GTKColorChooserPanel.blue.textAndMnemonic=\u85CD(&B):
+
+GTKColorChooserPanel.color.textAndMnemonic=\u984F\u8272\u540D\u7A31(&N):
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=\u6240\u6709\u6A94\u6848
+FileChooser.newFolderButton.textAndMnemonic=\u65B0\u5EFA\u8CC7\u6599\u593E(&N)
+FileChooser.newFolderDialog.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=\u932F\u8AA4
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=\u5EFA\u7ACB\u76EE\u9304 "{0}" \u6642\u767C\u751F\u932F\u8AA4: \u6C92\u6709\u6B64\u6A94\u6848\u6216\u76EE\u9304
+FileChooser.deleteFileButton.textAndMnemonic=\u522A\u9664\u6A94\u6848(&L)
+FileChooser.renameFileButton.textAndMnemonic=\u91CD\u65B0\u547D\u540D\u6A94\u6848(&R)
+FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88(&C)
+FileChooser.saveButton.textAndMnemonic=\u78BA\u5B9A(&O)
+FileChooser.openButton.textAndMnemonic=\u78BA\u5B9A(&O)
+FileChooser.saveDialogTitle.textAndMnemonic=\u5132\u5B58
+FileChooser.openDialogTitle.textAndMnemonic=\u958B\u555F
+FileChooser.pathLabel.textAndMnemonic=\u9078\u53D6(&S):
+FileChooser.filterLabel.textAndMnemonic=\u7BE9\u9078:
+FileChooser.foldersLabel.textAndMnemonic=\u8CC7\u6599\u593E(&D)
+FileChooser.filesLabel.textAndMnemonic=\u6A94\u6848(&F)
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6A94\u6848\u9078\u64C7\u5668\u5C0D\u8A71\u65B9\u584A\u3002
+FileChooser.saveButtonToolTip.textAndMnemonic=\u5132\u5B58\u9078\u53D6\u7684\u6A94\u6848\u3002
+FileChooser.openButtonToolTip.textAndMnemonic=\u958B\u555F\u9078\u53D6\u7684\u6A94\u6848\u3002
+
+FileChooser.renameFileDialog.textAndMnemonic=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA
+FileChooser.renameFileError.titleAndMnemonic=\u932F\u8AA4
+FileChooser.renameFileError.textAndMnemonic=\u5C07\u6A94\u6848 "{0}" \u91CD\u65B0\u547D\u540D\u70BA "{1}" \u6642\u51FA\u73FE\u932F\u8AA4
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -26,11 +26,11 @@
 FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
 FileChooser.updateButton.textAndMnemonic=Aktualisieren
 FileChooser.helpButton.textAndMnemonic=Hilfe
-FileChooser.pathLabel.textAndMnemonic=&Pfad- oder Ordnernamen eingeben:
+FileChooser.pathLabel.textAndMnemonic=&Pfad- oder Ordnername eingeben:
 FileChooser.filterLabel.textAndMnemonic=Filte&r
-FileChooser.foldersLabel.textAndMnemonic=Ordner(&L)
+FileChooser.foldersLabel.textAndMnemonic=Ord&ner
 FileChooser.filesLabel.textAndMnemonic=Date&ien
-FileChooser.enterFileNameLabel.textAndMnemonic=Datei&namen eingeben:
+FileChooser.enterFileNameLabel.textAndMnemonic=Dateiname ei&ngeben:
 FileChooser.enterFolderNameLabel.textAndMnemonic=Ordnernamen eingeben:
 
 FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -26,9 +26,9 @@
 FileChooser.openDialogTitle.textAndMnemonic=Abrir
 FileChooser.updateButton.textAndMnemonic=Actualizar
 FileChooser.helpButton.textAndMnemonic=Ayuda
-FileChooser.pathLabel.textAndMnemonic=Introducir nombre de la ruta de acceso o car&peta:
+FileChooser.pathLabel.textAndMnemonic=Introducir nombre de ruta de acceso o car&peta:
 FileChooser.filterLabel.textAndMnemonic=Filt&ro
-FileChooser.foldersLabel.textAndMnemonic=Carpetas(&L)
+FileChooser.foldersLabel.textAndMnemonic=Carpe&tas
 FileChooser.filesLabel.textAndMnemonic=Arch&ivos
 FileChooser.enterFileNameLabel.textAndMnemonic=I&ntroducir nombre de archivo:
 FileChooser.enterFolderNameLabel.textAndMnemonic=Introducir nombre de carpeta:
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -26,9 +26,9 @@
 FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
 FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jour
 FileChooser.helpButton.textAndMnemonic=Aide
-FileChooser.pathLabel.textAndMnemonic=Entrez le chemin ou le nom du dossier (&P):
+FileChooser.pathLabel.textAndMnemonic=Entrez le c&hemin ou le nom du dossier :
 FileChooser.filterLabel.textAndMnemonic=Filt&re
-FileChooser.foldersLabel.textAndMnemonic=Dossiers(&L)
+FileChooser.foldersLabel.textAndMnemonic=&Dossiers
 FileChooser.filesLabel.textAndMnemonic=F&ichiers
 FileChooser.enterFileNameLabel.textAndMnemonic=E&ntrez le nom du fichier :
 FileChooser.enterFolderNameLabel.textAndMnemonic=Entrez le nom du dossier :
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -28,9 +28,9 @@
 FileChooser.helpButton.textAndMnemonic=?
 FileChooser.pathLabel.textAndMnemonic=&Percorso o nome cartella:
 FileChooser.filterLabel.textAndMnemonic=Filt&ro
-FileChooser.foldersLabel.textAndMnemonic=Carte&lle
+FileChooser.foldersLabel.textAndMnemonic=Car&telle
 FileChooser.filesLabel.textAndMnemonic=F&ile
-FileChooser.enterFileNameLabel.textAndMnemonic=&Nome file:
+FileChooser.enterFileNameLabel.textAndMnemonic=Immettere il &nome file: 
 FileChooser.enterFolderNameLabel.textAndMnemonic=Nome cartella:
 
 FileChooser.cancelButtonToolTip.textAndMnemonic=Chiude la finestra di dialogo di selezione file.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -26,11 +26,11 @@
 FileChooser.openDialogTitle.textAndMnemonic=Abrir
 FileChooser.updateButton.textAndMnemonic=Atualizar
 FileChooser.helpButton.textAndMnemonic=Ajuda
-FileChooser.pathLabel.textAndMnemonic=Informar caminho ou nome da &pasta:
+FileChooser.pathLabel.textAndMnemonic=Informar &caminho ou nome da pasta:
 FileChooser.filterLabel.textAndMnemonic=Filt&ro
-FileChooser.foldersLabel.textAndMnemonic=Pastas(&L)
+FileChooser.foldersLabel.textAndMnemonic=Pa&stas
 FileChooser.filesLabel.textAndMnemonic=Arqu&ivos
-FileChooser.enterFileNameLabel.textAndMnemonic=I&nformar nome do arquivo:
+FileChooser.enterFileNameLabel.textAndMnemonic=I&nforme o nome do arquivo:
 FileChooser.enterFolderNameLabel.textAndMnemonic=Informar nome da pasta:
 
 FileChooser.cancelButtonToolTip.textAndMnemonic=Abortar caixa de di\u00E1logo do seletor de arquivos.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -26,9 +26,9 @@
 FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
 FileChooser.updateButton.textAndMnemonic=Uppdatera
 FileChooser.helpButton.textAndMnemonic=Hj\u00E4lp
-FileChooser.pathLabel.textAndMnemonic=Ange s\u00F6kv\u00E4g eller mappnamn(&P):
+FileChooser.pathLabel.textAndMnemonic=Ange &s\u00F6kv\u00E4g eller mappnamn:
 FileChooser.filterLabel.textAndMnemonic=Filte&r
-FileChooser.foldersLabel.textAndMnemonic=Mappar(&L)
+FileChooser.foldersLabel.textAndMnemonic=Ma&ppar
 FileChooser.filesLabel.textAndMnemonic=F&iler
 FileChooser.enterFileNameLabel.textAndMnemonic=A&nge filnamn:
 FileChooser.enterFolderNameLabel.textAndMnemonic=Ange ett mappnamn:
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/resources/motif_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -26,11 +26,11 @@
 FileChooser.openDialogTitle.textAndMnemonic=\u6253\u5F00
 FileChooser.updateButton.textAndMnemonic=\u66F4\u65B0
 FileChooser.helpButton.textAndMnemonic=\u5E2E\u52A9
-FileChooser.pathLabel.textAndMnemonic=\u952E\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D: (&P)
+FileChooser.pathLabel.textAndMnemonic=\u8F93\u5165\u8DEF\u5F84\u6216\u6587\u4EF6\u5939\u540D(&P):
 FileChooser.filterLabel.textAndMnemonic=\u7B5B\u9009\u5668(&R)
 FileChooser.foldersLabel.textAndMnemonic=\u6587\u4EF6\u5939(&L)
 FileChooser.filesLabel.textAndMnemonic=\u6587\u4EF6(&I)
-FileChooser.enterFileNameLabel.textAndMnemonic=\u952E\u5165\u6587\u4EF6\u540D: (&N)
+FileChooser.enterFileNameLabel.textAndMnemonic=\u8F93\u5165\u6587\u4EF6\u540D(&N):
 FileChooser.enterFolderNameLabel.textAndMnemonic=\u8F93\u5165\u6587\u4EF6\u5939\u540D:
 
 FileChooser.cancelButtonToolTip.textAndMnemonic=\u4E2D\u6B62\u6587\u4EF6\u9009\u62E9\u5668\u5BF9\u8BDD\u6846\u3002
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -20,9 +20,9 @@
 
 FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
 FileChooser.saveInLabel.textAndMnemonic=Speichern in:
-FileChooser.fileNameLabel.textAndMnemonic=Datei&name:
-FileChooser.folderNameLabel.textAndMnemonic=Ord&nername:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Da&teityp:
+FileChooser.fileNameLabel.textAndMnemonic=&Dateiname:
+FileChooser.folderNameLabel.textAndMnemonic=Ordner&name:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Datei&typ:
 FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her
 FileChooser.upFolderAccessibleName=Nach oben
 FileChooser.homeFolderToolTip.textAndMnemonic=Home
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,11 +18,11 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=Buscar en(&I):
+FileChooser.lookInLabel.textAndMnemonic=&Buscar en:
 FileChooser.saveInLabel.textAndMnemonic=Guardar en:
-FileChooser.fileNameLabel.textAndMnemonic=&Nombre de Archivo:
-FileChooser.folderNameLabel.textAndMnemonic=&Nombre de la Carpeta:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &Tipo:
+FileChooser.fileNameLabel.textAndMnemonic=&Nombre de archivo:
+FileChooser.folderNameLabel.textAndMnemonic=&Nombre de carpeta:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &tipo:
 FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel
 FileChooser.upFolderAccessibleName=Arriba
 FileChooser.homeFolderToolTip.textAndMnemonic=Inicio
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,11 +18,11 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=Rechercher dans (&I):
+FileChooser.lookInLabel.textAndMnemonic=Rechercher &dans :
 FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans :
 FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier :
 FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier :
-FileChooser.filesOfTypeLabel.textAndMnemonic=Fichiers de &type :
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Type de fichier :
 FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau.
 FileChooser.upFolderAccessibleName=Monter
 FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -21,7 +21,7 @@
 FileChooser.lookInLabel.textAndMnemonic=Cerca &in:
 FileChooser.saveInLabel.textAndMnemonic=Salva in:
 FileChooser.fileNameLabel.textAndMnemonic=&Nome file:
-FileChooser.folderNameLabel.textAndMnemonic=&Nome della cartella:
+FileChooser.folderNameLabel.textAndMnemonic=&Nome cartella:
 FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo file:
 FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore
 FileChooser.upFolderAccessibleName=Superiore
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,7 +18,7 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=\u53C2\u7167(&I):
+FileChooser.lookInLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240(&I):
 FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
 FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N):
 FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N):
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,7 +18,7 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=\uAC80\uC0C9 \uC704\uCE58(&I):
+FileChooser.lookInLabel.textAndMnemonic=\uCC3E\uB294 \uC704\uCE58(&I):
 FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58:
 FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N):
 FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N):
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,7 +18,7 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=Consultar em(&I):
+FileChooser.lookInLabel.textAndMnemonic=Pesquisar &em:
 FileChooser.saveInLabel.textAndMnemonic=Salvar em:
 FileChooser.fileNameLabel.textAndMnemonic=&Nome do arquivo:
 FileChooser.folderNameLabel.textAndMnemonic=&Nome da pasta:
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -21,8 +21,8 @@
 FileChooser.lookInLabel.textAndMnemonic=Leta &i:
 FileChooser.saveInLabel.textAndMnemonic=Spara i:
 FileChooser.fileNameLabel.textAndMnemonic=Fil&namn:
-FileChooser.folderNameLabel.textAndMnemonic=Mapp(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=Filforma&t:
+FileChooser.folderNameLabel.textAndMnemonic=Mapp&namn:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Filer av &typ:
 FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
 FileChooser.upFolderAccessibleName=Upp
 FileChooser.homeFolderToolTip.textAndMnemonic=Hem
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/resources/windows_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,11 +18,11 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=\u67E5\u770B: (&I)
+FileChooser.lookInLabel.textAndMnemonic=\u67E5\u627E(&I):
 FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58: 
-FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D: (&N)
-FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D: (&N)
-FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B: (&T)
+FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B(&T):
 FileChooser.upFolderToolTip.textAndMnemonic=\u5411\u4E0A\u4E00\u7EA7
 FileChooser.upFolderAccessibleName=\u5411\u4E0A
 FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u5F55
@@ -33,11 +33,11 @@
 FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868
 FileChooser.listViewButtonAccessibleName=\u5217\u8868
 FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u8D44\u6599
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u4FE1\u606F
 FileChooser.viewMenuButtonToolTipText = \u67E5\u770B\u83DC\u5355
 FileChooser.viewMenuButtonAccessibleName = \u67E5\u770B\u83DC\u5355
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
 FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0
 FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE
 FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/UnpackerImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -132,7 +132,12 @@
                 in0.close();
                 Utils.markJarFile(out);
             } else {
-                (new NativeUnpack(this)).run(in0, out);
+                try {
+                    (new NativeUnpack(this)).run(in0, out);
+                } catch (UnsatisfiedLinkError ule) {
+                    // failover to java implementation
+                    (new DoUnpack()).run(in0, out);
+                }
                 in0.close();
                 Utils.markJarFile(out);
             }
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -85,7 +85,7 @@
 webrowsetimpl.invalidrd = \uC77D\uAE30 \uD504\uB85C\uADF8\uB7A8\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
 
 #FilteredRowSetImpl exceptions
-filteredrowsetimpl.relative = \uC0C1\uB300: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+filteredrowsetimpl.relative = \uC0C1\uB300: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. 
 filteredrowsetimpl.absolute = \uC808\uB300: \uCEE4\uC11C \uC791\uC5C5\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
 filteredrowsetimpl.notallowed = \uC774 \uAC12\uC740 \uD544\uD130\uB97C \uD1B5\uACFC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
 
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -140,7 +140,7 @@
 #WebRowSetXmlReader exception
 wrsxmlreader.invalidcp = Fim de RowSet atingido. Posi\u00E7\u00E3o inv\u00E1lida do cursor
 wrsxmlreader.readxml = readXML : {0}
-wrsxmlreader.parseerr = ** Erro de Parse : {0} , linha : {1} , uri : {2}
+wrsxmlreader.parseerr = ** Erro de Parsing : {0} , linha : {1} , uri : {2}
 
 #WebRowSetXmlWriter exceptions
 wrsxmlwriter.ioex = IOException : {0}
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
--- a/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetResourceBundle_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java	Wed May 08 10:10:05 2013 +0100
@@ -45,7 +45,6 @@
     }
 
     protected GSSContext secCtx = null;
-    protected MessageProp msgProp;              // QOP and privacy for unwrap
     protected static final int JGSS_QOP = 0;    // unrelated to SASL QOP mask
 
     protected GssKrb5Base(Map<String, ?> props, String className)
@@ -74,6 +73,7 @@
         }
 
         try {
+            MessageProp msgProp = new MessageProp(JGSS_QOP, privacy);
             byte[] answer = secCtx.unwrap(incoming, start, len, msgProp);
             if (logger.isLoggable(Level.FINEST)) {
                 traceOutput(myClassName, "KRB501:Unwrap", "incoming: ",
@@ -99,6 +99,7 @@
 
         // Generate GSS token
         try {
+            MessageProp msgProp = new MessageProp(JGSS_QOP, privacy);
             byte[] answer = secCtx.wrap(outgoing, start, len, msgProp);
             if (logger.isLoggable(Level.FINEST)) {
                 traceOutput(myClassName, "KRB503:Wrap", "outgoing: ",
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java	Wed May 08 10:10:05 2013 +0100
@@ -320,7 +320,6 @@
             }
 
             completed = true;  // server authenticated
-            msgProp = new MessageProp(JGSS_QOP, privacy);
 
             return gssOutToken;
         } catch (GSSException e) {
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java	Wed May 08 10:10:05 2013 +0100
@@ -270,7 +270,6 @@
             } else if ((selectedQop&INTEGRITY_ONLY_PROTECTION) != 0) {
                 integrity = true;
             }
-            msgProp = new MessageProp(JGSS_QOP, privacy);
 
             // 2nd-4th octets specifies maximum buffer size expected by
             // client (in network byte order). This is the server's send
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -39,16 +39,16 @@
 FileChooser.newFolderParentDoesntExist.textAndMnemonic=Ordner kann nicht erstellt werden.\n\nSystem kann den angegebenen Pfad nicht finden.
 FileChooser.renameErrorTitle.textAndMnemonic=Fehler beim Umbenennen von Datei oder Ordner
 FileChooser.renameError.textAndMnemonic={0} kann nicht umbenannt werden
-FileChooser.renameErrorFileExists.textAndMnemonic={0} kann nicht umbenannt werden: Es ist bereits eine Datei mit dem angegebenen Namen vorhanden. Geben Sie einen anderen Dateinamen an.
+FileChooser.renameErrorFileExists.textAndMnemonic={0} kann nicht umbenannt werden: Es ist bereits eine Datei mit dem angegebenen Namen vorhanden. Geben Sie einen anderen Dateinamen an. 
 FileChooser.acceptAllFileFilter.textAndMnemonic=Alle Dateien
 FileChooser.cancelButton.textAndMnemonic=Abbrechen
 FileChooser.saveButton.textAndMnemonic=&Speichern
-FileChooser.openButton.textAndMnemonic=\u00D6ffnen(&F)
+FileChooser.openButton.textAndMnemonic=\u00D6&ffnen
 FileChooser.saveDialogTitle.textAndMnemonic=Speichern
 FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
 FileChooser.updateButton.textAndMnemonic=A&ktualisieren
 FileChooser.helpButton.textAndMnemonic=&Hilfe
-FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ffnen(&F)
+FileChooser.directoryOpenButton.textAndMnemonic=\u00D6&ffnen
 
 # File Size Units
 FileChooser.fileSizeKiloBytes={0} KB
@@ -70,14 +70,14 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser-Hilfe
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Ausgew\u00E4hltes Verzeichnis \u00F6ffnen
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Dateiliste
+FileChooser.filesDetailsAccessibleName=Dateidetails
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=Vorschau
 ColorChooser.ok.textAndMnemonic=OK
 ColorChooser.cancel.textAndMnemonic=Abbrechen
-ColorChooser.reset.textAndMnemonic=Zur\u00FCcksetzen(&Z)
+ColorChooser.reset.textAndMnemonic=&Zur\u00FCcksetzen
 ColorChooser.sample.textAndMnemonic=Beispieltext  Beispieltext
 ColorChooser.swatches.textAndMnemonic=&Swatches
 ColorChooser.swatchesRecent.textAndMnemonic=Aktuell:
@@ -93,7 +93,7 @@
 ColorChooser.hslTransparency.textAndMnemonic=Transparenz
 ColorChooser.rgb.textAndMnemonic=R&GB
 ColorChooser.rgbRed.textAndMnemonic=Ro&t
-ColorChooser.rgbGreen.textAndMnemonic=Gr\u00FCn(&N)
+ColorChooser.rgbGreen.textAndMnemonic=Gr\u00FC&n
 ColorChooser.rgbBlue.textAndMnemonic=&Blau
 ColorChooser.rgbAlpha.textAndMnemonic=Alpha
 ColorChooser.rgbHexCode.textAndMnemonic=&Farbcode
@@ -109,8 +109,10 @@
 # define mnemonics for any of the buttons.
 OptionPane.yesButton.textAndMnemonic=&Ja
 OptionPane.noButton.textAndMnemonic=&Nein
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Abbrechen
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Abbrechen
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=Option ausw\u00E4hlen
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -184,4 +186,3 @@
 InternalFrameTitlePane.iconifyButtonAccessibleName=Als Symbol darstellen
 InternalFrameTitlePane.maximizeButtonAccessibleName=Maximieren
 InternalFrameTitlePane.closeButtonAccessibleName=Schlie\u00DFen
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -38,11 +39,11 @@
 FileChooser.newFolderParentDoesntExist.textAndMnemonic=No se ha podido crear la carpeta.\n\nEl sistema no puede encontrar la ruta de acceso especificada.
 FileChooser.renameErrorTitle.textAndMnemonic=Error al cambiar el nombre del archivo o carpeta
 FileChooser.renameError.textAndMnemonic=No se puede cambiar el nombre de {0}
-FileChooser.renameErrorFileExists.textAndMnemonic=No se puede cambiar el nombre de {0}: ya existe un archivo con el nombre especificado. Especifique otro nombre de archivo.
+FileChooser.renameErrorFileExists.textAndMnemonic=No se puede cambiar el nombre de {0}: ya existe un archivo con el nombre especificado. Especifique otro nombre de archivo. 
 FileChooser.acceptAllFileFilter.textAndMnemonic=Todos los Archivos
 FileChooser.cancelButton.textAndMnemonic=Cancelar
 FileChooser.saveButton.textAndMnemonic=&Guardar
-FileChooser.openButton.textAndMnemonic=A&brir
+FileChooser.openButton.textAndMnemonic=&Abrir
 FileChooser.saveDialogTitle.textAndMnemonic=Guardar
 FileChooser.openDialogTitle.textAndMnemonic=Abrir
 FileChooser.updateButton.textAndMnemonic=Act&ualizar
@@ -69,11 +70,11 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=Ayuda del Selector de Archivos
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Abrir directorio seleccionado
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Lista de archivos
+FileChooser.filesDetailsAccessibleName=Detalles de archivos
 
 ############ COLOR CHOOSER STRINGS #############
-ColorChooser.preview.textAndMnemonic=Presentaci\u00F3n Preliminar
+ColorChooser.preview.textAndMnemonic=Vista Previa
 ColorChooser.ok.textAndMnemonic=Aceptar
 ColorChooser.cancel.textAndMnemonic=Cancelar
 ColorChooser.reset.textAndMnemonic=&Restablecer
@@ -95,7 +96,7 @@
 ColorChooser.rgbGreen.textAndMnemonic=&Verde
 ColorChooser.rgbBlue.textAndMnemonic=A&zul
 ColorChooser.rgbAlpha.textAndMnemonic=Alfa
-ColorChooser.rgbHexCode.textAndMnemonic=C\u00F3digo de Color(&C)
+ColorChooser.rgbHexCode.textAndMnemonic=&C\u00F3digo de Color
 ColorChooser.cmyk.textAndMnemonic=C&MYK
 ColorChooser.cmykCyan.textAndMnemonic=Cian
 ColorChooser.cmykMagenta.textAndMnemonic=Magenta
@@ -106,10 +107,12 @@
 ############ OPTION PANE STRINGS #############
 # We only define mnemonics for YES/NO, but for completeness you can
 # define mnemonics for any of the buttons.
-OptionPane.yesButton.textAndMnemonic=S\u00ED(&S)
+OptionPane.yesButton.textAndMnemonic=&S\u00ED
 OptionPane.noButton.textAndMnemonic=&No
-OptionPane.okButton.textAndMnemonic=Aceptar(&O)
-OptionPane.cancelButton.textAndMnemonic=&Cancelar
+OptionPane.okButton.textAndMnemonic=Aceptar
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Cancelar
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=Seleccionar una Opci\u00F3n
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -126,7 +129,7 @@
 
 # The following string will be formatted by a MessageFormat
 # and {0} will be replaced by page number being printed
-PrintingDialog.contentProgress.textAndMnemonic=P\u00E1gina impresa {0}...
+PrintingDialog.contentProgress.textAndMnemonic=P\u00E1gina {0} impresa...
 
 PrintingDialog.contentAborting.textAndMnemonic=Abortando la impresi\u00F3n...
 
@@ -183,4 +186,3 @@
 InternalFrameTitlePane.iconifyButtonAccessibleName=Convertir en Icono
 InternalFrameTitlePane.maximizeButtonAccessibleName=Maximizar
 InternalFrameTitlePane.closeButtonAccessibleName=Cerrar
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -38,14 +39,14 @@
 FileChooser.newFolderParentDoesntExist.textAndMnemonic=Impossible de cr\u00E9er le dossier.\n\nLe syst\u00E8me ne parvient pas \u00E0 trouver le chemin indiqu\u00E9.
 FileChooser.renameErrorTitle.textAndMnemonic=Erreur lors du changement de nom du fichier ou du dossier
 FileChooser.renameError.textAndMnemonic=Impossible de renommer {0}
-FileChooser.renameErrorFileExists.textAndMnemonic=Impossible de renommer {0} : il existe d\u00E9j\u00E0 un fichier portant le nom indiqu\u00E9. Indiquez-en un autre.
+FileChooser.renameErrorFileExists.textAndMnemonic=Impossible de renommer {0} : il existe d\u00E9j\u00E0 un fichier portant le nom indiqu\u00E9. Indiquez-en un autre. 
 FileChooser.acceptAllFileFilter.textAndMnemonic=Tous les fichiers
 FileChooser.cancelButton.textAndMnemonic=Annuler
 FileChooser.saveButton.textAndMnemonic=Enregi&strer
 FileChooser.openButton.textAndMnemonic=&Ouvrir
 FileChooser.saveDialogTitle.textAndMnemonic=Enregistrer
 FileChooser.openDialogTitle.textAndMnemonic=Ouvrir
-FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jour(&U)
+FileChooser.updateButton.textAndMnemonic=Mettre \u00E0 jo&ur
 FileChooser.helpButton.textAndMnemonic=&Aide
 FileChooser.directoryOpenButton.textAndMnemonic=&Ouvrir
 
@@ -69,14 +70,14 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=Aide du s\u00E9lecteur de fichiers
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Ouvre le r\u00E9pertoire s\u00E9lectionn\u00E9
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Liste des fichiers
+FileChooser.filesDetailsAccessibleName=D\u00E9tails des fichiers
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=Aper\u00E7u
 ColorChooser.ok.textAndMnemonic=OK
 ColorChooser.cancel.textAndMnemonic=Annuler
-ColorChooser.reset.textAndMnemonic=R\u00E9initialiser(&R)
+ColorChooser.reset.textAndMnemonic=&R\u00E9initialiser
 ColorChooser.sample.textAndMnemonic=Echantillon de texte  Echantillon de texte
 ColorChooser.swatches.textAndMnemonic=&Echantillons
 ColorChooser.swatchesRecent.textAndMnemonic=Dernier :
@@ -108,8 +109,10 @@
 # define mnemonics for any of the buttons.
 OptionPane.yesButton.textAndMnemonic=&Oui
 OptionPane.noButton.textAndMnemonic=&Non
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Annuler
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Annuler
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=S\u00E9lectionner une option
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
 InternalFrameTitlePane.iconifyButtonAccessibleName=R\u00E9duire
 InternalFrameTitlePane.maximizeButtonAccessibleName=Agrandir
 InternalFrameTitlePane.closeButtonAccessibleName=Fermer
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -38,15 +39,15 @@
 FileChooser.newFolderParentDoesntExist.textAndMnemonic=Impossibile creare la cartella.\n\nIl sistema non \u00E8 in grado di trovare il percorso specificato.
 FileChooser.renameErrorTitle.textAndMnemonic=Errore durante la ridenominazione del file o della cartella
 FileChooser.renameError.textAndMnemonic=Impossibile rinominare {0}
-FileChooser.renameErrorFileExists.textAndMnemonic=Impossibile rinominare {0}: esiste gi\u00E0 un file con il nome specificato. Specificare un altro nome.
+FileChooser.renameErrorFileExists.textAndMnemonic=Impossibile rinominare {0}: esiste gi\u00E0 un file con il nome specificato. Specificare un altro nome. 
 FileChooser.acceptAllFileFilter.textAndMnemonic=Tutti i file
 FileChooser.cancelButton.textAndMnemonic=Annulla
 FileChooser.saveButton.textAndMnemonic=Sal&va
-FileChooser.openButton.textAndMnemonic=A&pri
+FileChooser.openButton.textAndMnemonic=&Apri
 FileChooser.saveDialogTitle.textAndMnemonic=Salva
 FileChooser.openDialogTitle.textAndMnemonic=Apri
-FileChooser.updateButton.textAndMnemonic=A&ggiorna
-FileChooser.helpButton.textAndMnemonic=?(&H)
+FileChooser.updateButton.textAndMnemonic=Ag&giorna
+FileChooser.helpButton.textAndMnemonic=&?
 FileChooser.directoryOpenButton.textAndMnemonic=&Apri
 
 # File Size Units
@@ -69,8 +70,8 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=Guida FileChooser
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Apre la directory selezionata
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Lista dei file
+FileChooser.filesDetailsAccessibleName=Dettagli file
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=Anteprima
@@ -106,10 +107,12 @@
 ############ OPTION PANE STRINGS #############
 # We only define mnemonics for YES/NO, but for completeness you can
 # define mnemonics for any of the buttons.
-OptionPane.yesButton.textAndMnemonic=S\u00EC(&S)
+OptionPane.yesButton.textAndMnemonic=&S\u00EC
 OptionPane.noButton.textAndMnemonic=&No
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Annulla
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Annulla
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=Selezionare una opzione
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
 InternalFrameTitlePane.iconifyButtonAccessibleName=Riduci a icona
 InternalFrameTitlePane.maximizeButtonAccessibleName=Ingrandisci
 InternalFrameTitlePane.closeButtonAccessibleName=Chiudi
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -38,7 +39,7 @@
 FileChooser.newFolderParentDoesntExist.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002\n\n\u6307\u5B9A\u3057\u305F\u30D1\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
 FileChooser.renameErrorTitle.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u30D5\u30A9\u30EB\u30C0\u306E\u540D\u524D\u5909\u66F4\u30A8\u30E9\u30FC
 FileChooser.renameError.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093
-FileChooser.renameErrorFileExists.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093: \u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u5225\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+FileChooser.renameErrorFileExists.textAndMnemonic={0}\u306E\u540D\u524D\u3092\u5909\u66F4\u3067\u304D\u307E\u305B\u3093: \u6307\u5B9A\u3057\u305F\u540D\u524D\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059\u3002\u5225\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002 
 FileChooser.acceptAllFileFilter.textAndMnemonic=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB
 FileChooser.cancelButton.textAndMnemonic=\u53D6\u6D88
 FileChooser.saveButton.textAndMnemonic=\u4FDD\u5B58(&S)
@@ -69,8 +70,8 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser\u306E\u30D8\u30EB\u30D7\u3067\u3059
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u9078\u629E\u3057\u305F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u958B\u304D\u307E\u3059
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=\u30D5\u30A1\u30A4\u30EB\u30FB\u30EA\u30B9\u30C8
+FileChooser.filesDetailsAccessibleName=\u30D5\u30A1\u30A4\u30EB\u306E\u8A73\u7D30
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=\u30D7\u30EC\u30D3\u30E5\u30FC
@@ -80,17 +81,17 @@
 ColorChooser.sample.textAndMnemonic=\u30B5\u30F3\u30D7\u30EB\u30FB\u30C6\u30AD\u30B9\u30C8  \u30B5\u30F3\u30D7\u30EB\u30FB\u30C6\u30AD\u30B9\u30C8
 ColorChooser.swatches.textAndMnemonic=\u30B5\u30F3\u30D7\u30EB(&S)
 ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u65B0:
-ColorChooser.hsv.textAndMnemonic=&HSV
+ColorChooser.hsv.textAndMnemonic=HSV(&H)
 ColorChooser.hsvHue.textAndMnemonic=\u8272\u76F8
 ColorChooser.hsvSaturation.textAndMnemonic=\u5F69\u5EA6
 ColorChooser.hsvValue.textAndMnemonic=\u5024
 ColorChooser.hsvTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.hsl.textAndMnemonic=HS&L
+ColorChooser.hsl.textAndMnemonic=HSL(&L)
 ColorChooser.hslHue.textAndMnemonic=\u8272\u76F8
 ColorChooser.hslSaturation.textAndMnemonic=\u5F69\u5EA6
 ColorChooser.hslLightness.textAndMnemonic=\u660E\u5EA6
 ColorChooser.hslTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
 ColorChooser.rgbRed.textAndMnemonic=\u8D64(&D)
 ColorChooser.rgbGreen.textAndMnemonic=\u7DD1(&N)
 ColorChooser.rgbBlue.textAndMnemonic=\u9752(&B)
@@ -108,8 +109,10 @@
 # define mnemonics for any of the buttons.
 OptionPane.yesButton.textAndMnemonic=\u306F\u3044(&Y)
 OptionPane.noButton.textAndMnemonic=\u3044\u3044\u3048(&N)
-OptionPane.okButton.textAndMnemonic=&OK
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
 OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u9078\u629E
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
 InternalFrameTitlePane.iconifyButtonAccessibleName=\u30A2\u30A4\u30B3\u30F3\u5316
 InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
 InternalFrameTitlePane.closeButtonAccessibleName=\u9589\u3058\u308B
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -69,8 +70,8 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \uB3C4\uC6C0\uB9D0
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\uC120\uD0DD\uB41C \uB514\uB809\uD1A0\uB9AC \uC5F4\uAE30
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=\uD30C\uC77C \uBAA9\uB85D
+FileChooser.filesDetailsAccessibleName=\uD30C\uC77C \uC138\uBD80 \uC815\uBCF4
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=\uBBF8\uB9AC\uBCF4\uAE30
@@ -80,17 +81,17 @@
 ColorChooser.sample.textAndMnemonic=\uC0D8\uD50C \uD14D\uC2A4\uD2B8  \uC0D8\uD50C \uD14D\uC2A4\uD2B8
 ColorChooser.swatches.textAndMnemonic=\uACAC\uBCF8(&S)
 ColorChooser.swatchesRecent.textAndMnemonic=\uCD5C\uADFC \uBAA9\uB85D:
-ColorChooser.hsv.textAndMnemonic=&HSV
+ColorChooser.hsv.textAndMnemonic=HSV(&H)
 ColorChooser.hsvHue.textAndMnemonic=\uC0C9\uC870
 ColorChooser.hsvSaturation.textAndMnemonic=\uCC44\uB3C4
 ColorChooser.hsvValue.textAndMnemonic=\uAC12
 ColorChooser.hsvTransparency.textAndMnemonic=\uD22C\uBA85
-ColorChooser.hsl.textAndMnemonic=HS&L
+ColorChooser.hsl.textAndMnemonic=HSL(&L)
 ColorChooser.hslHue.textAndMnemonic=\uC0C9\uC870
 ColorChooser.hslSaturation.textAndMnemonic=\uCC44\uB3C4
 ColorChooser.hslLightness.textAndMnemonic=\uBC1D\uAE30
 ColorChooser.hslTransparency.textAndMnemonic=\uD22C\uBA85
-ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
 ColorChooser.rgbRed.textAndMnemonic=\uBE68\uAC04\uC0C9(&D)
 ColorChooser.rgbGreen.textAndMnemonic=\uB179\uC0C9(&N)
 ColorChooser.rgbBlue.textAndMnemonic=\uD30C\uB780\uC0C9(&B)
@@ -108,8 +109,10 @@
 # define mnemonics for any of the buttons.
 OptionPane.yesButton.textAndMnemonic=\uC608(&Y)
 OptionPane.noButton.textAndMnemonic=\uC544\uB2C8\uC624(&N)
-OptionPane.okButton.textAndMnemonic=\uD655\uC778(&O)
+OptionPane.okButton.textAndMnemonic=\uD655\uC778
+#OptionPane.okButtonMnemonic=0
 OptionPane.cancelButton.textAndMnemonic=\uCDE8\uC18C
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=\uC635\uC158 \uC120\uD0DD
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
 InternalFrameTitlePane.iconifyButtonAccessibleName=\uC544\uC774\uCF58\uD654
 InternalFrameTitlePane.maximizeButtonAccessibleName=\uCD5C\uB300\uD654
 InternalFrameTitlePane.closeButtonAccessibleName=\uB2EB\uAE30
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -69,8 +70,8 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=Ajuda do FileChooser
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=Abrir diret\u00F3rio selecionado
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Lista de Arquivos
+FileChooser.filesDetailsAccessibleName=Detalhes do Arquivo
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=Visualizar
@@ -95,7 +96,7 @@
 ColorChooser.rgbGreen.textAndMnemonic=&Verde
 ColorChooser.rgbBlue.textAndMnemonic=&Azul
 ColorChooser.rgbAlpha.textAndMnemonic=Alfa
-ColorChooser.rgbHexCode.textAndMnemonic=C\u00F3digo da Cor(&C)
+ColorChooser.rgbHexCode.textAndMnemonic=&C\u00F3digo da Cor
 ColorChooser.cmyk.textAndMnemonic=C&MYK
 ColorChooser.cmykCyan.textAndMnemonic=Ciano
 ColorChooser.cmykMagenta.textAndMnemonic=Magenta
@@ -107,9 +108,11 @@
 # We only define mnemonics for YES/NO, but for completeness you can
 # define mnemonics for any of the buttons.
 OptionPane.yesButton.textAndMnemonic=&Sim
-OptionPane.noButton.textAndMnemonic=N\u00E3o(&N)
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Cancelar
+OptionPane.noButton.textAndMnemonic=&N\u00E3o
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Cancelar
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=Selecionar uma Op\u00E7\u00E3o
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -171,7 +174,7 @@
 ComboBox.togglePopup.textAndMnemonic=togglePopup
 
 ############ Progress Monitor Strings ############
-ProgressMonitor.progress.textAndMnemonic=Progresso...
+ProgressMonitor.progress.textAndMnemonic=Andamento...
 
 ############ Split Pane Strings ############
 SplitPane.leftButton.textAndMnemonic=bot\u00E3o esquerdo
@@ -180,7 +183,6 @@
 IsindexView.prompt=Trata-se de um \u00EDndice pesquis\u00E1vel. Informe as palavras-chave de pesquisa:
 
 ############ InternalFrameTitlePane Strings ############
-InternalFrameTitlePane.iconifyButtonAccessibleName=Iconify
+InternalFrameTitlePane.iconifyButtonAccessibleName=Iconizar
 InternalFrameTitlePane.maximizeButtonAccessibleName=Maximizar
 InternalFrameTitlePane.closeButtonAccessibleName=Fechar
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -38,16 +39,16 @@
 FileChooser.newFolderParentDoesntExist.textAndMnemonic=Kan inte skapa mappen.\n\nSystemet kan inte hitta angiven s\u00F6kv\u00E4g.
 FileChooser.renameErrorTitle.textAndMnemonic=Ett fel intr\u00E4ffade vid f\u00F6rs\u00F6k att \u00E4ndra namn p\u00E5 fil eller mapp
 FileChooser.renameError.textAndMnemonic=Kan inte namn\u00E4ndra {0}
-FileChooser.renameErrorFileExists.textAndMnemonic=Kan inte namn\u00E4ndra {0}: En fil med angivet namn finns redan. Ange ett annat filnamn.
+FileChooser.renameErrorFileExists.textAndMnemonic=Kan inte namn\u00E4ndra {0}: En fil med angivet namn finns redan. Ange ett annat filnamn. 
 FileChooser.acceptAllFileFilter.textAndMnemonic=Alla filer
 FileChooser.cancelButton.textAndMnemonic=Avbryt
 FileChooser.saveButton.textAndMnemonic=&Spara
-FileChooser.openButton.textAndMnemonic=\u00D6ppna(&P)
+FileChooser.openButton.textAndMnemonic=&\u00D6ppna
 FileChooser.saveDialogTitle.textAndMnemonic=Spara
 FileChooser.openDialogTitle.textAndMnemonic=\u00D6ppna
 FileChooser.updateButton.textAndMnemonic=Upp&datera
-FileChooser.helpButton.textAndMnemonic=Hj\u00E4lp(&H)
-FileChooser.directoryOpenButton.textAndMnemonic=\u00D6ppna(&P)
+FileChooser.helpButton.textAndMnemonic=&Hj\u00E4lp
+FileChooser.directoryOpenButton.textAndMnemonic=&\u00D6ppna
 
 # File Size Units
 FileChooser.fileSizeKiloBytes={0} KB
@@ -69,14 +70,14 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=Hj\u00E4lp - Filv\u00E4ljare
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u00D6ppna vald katalog
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=Fillista
+FileChooser.filesDetailsAccessibleName=Fildetaljer
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=Granska
 ColorChooser.ok.textAndMnemonic=OK
 ColorChooser.cancel.textAndMnemonic=Avbryt
-ColorChooser.reset.textAndMnemonic=\u00C5terst\u00E4ll(&T)
+ColorChooser.reset.textAndMnemonic=&\u00C5terst\u00E4ll
 ColorChooser.sample.textAndMnemonic=Exempeltext  Exempeltext
 ColorChooser.swatches.textAndMnemonic=&Prov
 ColorChooser.swatchesRecent.textAndMnemonic=Senaste:
@@ -91,11 +92,11 @@
 ColorChooser.hslLightness.textAndMnemonic=Ljusstyrka
 ColorChooser.hslTransparency.textAndMnemonic=Transparens
 ColorChooser.rgb.textAndMnemonic=R&GB
-ColorChooser.rgbRed.textAndMnemonic=R\u00F6d(&D)
-ColorChooser.rgbGreen.textAndMnemonic=Gr\u00F6n(&N)
-ColorChooser.rgbBlue.textAndMnemonic=Bl\u00E5(&B)
+ColorChooser.rgbRed.textAndMnemonic=R\u00F6&d
+ColorChooser.rgbGreen.textAndMnemonic=Gr\u00F6&n
+ColorChooser.rgbBlue.textAndMnemonic=&Bl\u00E5
 ColorChooser.rgbAlpha.textAndMnemonic=Alfa
-ColorChooser.rgbHexCode.textAndMnemonic=F\u00E4rgkod(&F)
+ColorChooser.rgbHexCode.textAndMnemonic=&F\u00E4rgkod
 ColorChooser.cmyk.textAndMnemonic=C&MYK
 ColorChooser.cmykCyan.textAndMnemonic=Cyan
 ColorChooser.cmykMagenta.textAndMnemonic=Magenta
@@ -108,8 +109,10 @@
 # define mnemonics for any of the buttons.
 OptionPane.yesButton.textAndMnemonic=&Ja
 OptionPane.noButton.textAndMnemonic=&Nej
-OptionPane.okButton.textAndMnemonic=&OK
-OptionPane.cancelButton.textAndMnemonic=&Avbryt
+OptionPane.okButton.textAndMnemonic=OK
+#OptionPane.okButtonMnemonic=0
+OptionPane.cancelButton.textAndMnemonic=Avbryt
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=V\u00E4lj ett alternativ
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -183,4 +186,3 @@
 InternalFrameTitlePane.iconifyButtonAccessibleName=Minimera
 InternalFrameTitlePane.maximizeButtonAccessibleName=Maximera
 InternalFrameTitlePane.closeButtonAccessibleName=St\u00E4ng
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -30,7 +31,7 @@
 # @author Steve Wilson
 
 ############ FILE CHOOSER STRINGS #############
-FileChooser.fileDescription.textAndMnemonic=\u666E\u901A\u7684\u6587\u4EF6
+FileChooser.fileDescription.textAndMnemonic=\u901A\u7528\u6587\u4EF6
 FileChooser.directoryDescription.textAndMnemonic=\u76EE\u5F55
 FileChooser.newFolderError.textAndMnemonic=\u521B\u5EFA\u65B0\u7684\u6587\u4EF6\u5939\u65F6\u51FA\u9519
 FileChooser.newFolderErrorSeparator= :
@@ -69,8 +70,8 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=FileChooser \u5E2E\u52A9
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u6253\u5F00\u9009\u62E9\u7684\u76EE\u5F55
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=\u6587\u4EF6\u5217\u8868
+FileChooser.filesDetailsAccessibleName=\u6587\u4EF6\u8BE6\u7EC6\u4FE1\u606F
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=\u9884\u89C8
@@ -78,19 +79,19 @@
 ColorChooser.cancel.textAndMnemonic=\u53D6\u6D88
 ColorChooser.reset.textAndMnemonic=\u91CD\u7F6E(&R)
 ColorChooser.sample.textAndMnemonic=\u793A\u4F8B\u6587\u672C  \u793A\u4F8B\u6587\u672C
-ColorChooser.swatches.textAndMnemonic=\u793A\u4F8B(&S)
+ColorChooser.swatches.textAndMnemonic=\u6837\u672C(&S)
 ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u8FD1:
-ColorChooser.hsv.textAndMnemonic=&HSV
+ColorChooser.hsv.textAndMnemonic=HSV(&H)
 ColorChooser.hsvHue.textAndMnemonic=\u8272\u8C03
 ColorChooser.hsvSaturation.textAndMnemonic=\u9971\u548C\u5EA6
 ColorChooser.hsvValue.textAndMnemonic=\u503C
 ColorChooser.hsvTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.hsl.textAndMnemonic=HS&L
+ColorChooser.hsl.textAndMnemonic=HSL(&L)
 ColorChooser.hslHue.textAndMnemonic=\u8272\u8C03
 ColorChooser.hslSaturation.textAndMnemonic=\u9971\u548C\u5EA6
 ColorChooser.hslLightness.textAndMnemonic=\u4EAE\u5EA6
 ColorChooser.hslTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
 ColorChooser.rgbRed.textAndMnemonic=\u7EA2\u8272(&D)
 ColorChooser.rgbGreen.textAndMnemonic=\u7EFF\u8272(&N)
 ColorChooser.rgbBlue.textAndMnemonic=\u84DD\u8272(&B)
@@ -108,8 +109,10 @@
 # define mnemonics for any of the buttons.
 OptionPane.yesButton.textAndMnemonic=\u662F(&Y)
 OptionPane.noButton.textAndMnemonic=\u5426(&N)
-OptionPane.okButton.textAndMnemonic=\u786E\u5B9A(&O)
+OptionPane.okButton.textAndMnemonic=\u786E\u5B9A
+#OptionPane.okButtonMnemonic=0
 OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=\u9009\u62E9\u4E00\u4E2A\u9009\u9879
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -150,7 +153,7 @@
 ############ Text strings #############
 # Used for html forms
 FormView.submitButton.textAndMnemonic=\u63D0\u4EA4\u67E5\u8BE2
-FormView.resetButton.textAndMnemonic=\u91CD\u8BBE
+FormView.resetButton.textAndMnemonic=\u91CD\u7F6E
 FormView.browseFileButton.textAndMnemonic=\u6D4F\u89C8...
 
 ############ Abstract Document Strings ############
@@ -177,10 +180,9 @@
 SplitPane.leftButton.textAndMnemonic=\u5DE6\u952E
 SplitPane.rightButton.textAndMnemonic=\u53F3\u952E
 # Used for Isindex
-IsindexView.prompt=\u8FD9\u662F\u53EF\u641C\u7D22\u7D22\u5F15\u3002\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u5B57:
+IsindexView.prompt=\u8FD9\u662F\u53EF\u641C\u7D22\u7D22\u5F15\u3002\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u5B57: 
 
 ############ InternalFrameTitlePane Strings ############
 InternalFrameTitlePane.iconifyButtonAccessibleName=\u56FE\u6807\u5316
 InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
 InternalFrameTitlePane.closeButtonAccessibleName=\u5173\u95ED
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,6 +16,7 @@
 # Many of strings in this file are used by widgets that have a
 # mnemonic, for example:
 #   ColorChooser.rgbNameTextAndMnemonic=R&GB
+#
 # Indicates that the tab in the ColorChooser for RGB colors will have
 # the text 'RGB', further the mnemonic character will be 'g' and that
 # a decoration will be provided under the 'G'. This will typically
@@ -69,8 +70,8 @@
 FileChooser.helpButtonToolTip.textAndMnemonic=\u300C\u6A94\u6848\u9078\u64C7\u5668\u300D\u8AAA\u660E
 FileChooser.directoryOpenButtonToolTip.textAndMnemonic=\u958B\u555F\u9078\u53D6\u7684\u76EE\u9304
 
-FileChooser.filesListAccessibleName=Files List
-FileChooser.filesDetailsAccessibleName=Files Details
+FileChooser.filesListAccessibleName=\u6A94\u6848\u6E05\u55AE
+FileChooser.filesDetailsAccessibleName=\u6A94\u6848\u8A73\u7D30\u8CC7\u8A0A
 
 ############ COLOR CHOOSER STRINGS #############
 ColorChooser.preview.textAndMnemonic=\u9810\u89BD
@@ -80,17 +81,17 @@
 ColorChooser.sample.textAndMnemonic=\u7BC4\u4F8B\u6587\u5B57  \u7BC4\u4F8B\u6587\u5B57
 ColorChooser.swatches.textAndMnemonic=\u8ABF\u8272\u677F(&S)
 ColorChooser.swatchesRecent.textAndMnemonic=\u6700\u65B0\u9078\u64C7:
-ColorChooser.hsv.textAndMnemonic=&HSV
+ColorChooser.hsv.textAndMnemonic=HSV(&H)
 ColorChooser.hsvHue.textAndMnemonic=\u8272\u8ABF
 ColorChooser.hsvSaturation.textAndMnemonic=\u5F69\u5EA6
 ColorChooser.hsvValue.textAndMnemonic=\u6578\u503C
 ColorChooser.hsvTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.hsl.textAndMnemonic=HS&L
+ColorChooser.hsl.textAndMnemonic=HSL(&L)
 ColorChooser.hslHue.textAndMnemonic=\u8272\u8ABF
 ColorChooser.hslSaturation.textAndMnemonic=\u5F69\u5EA6
 ColorChooser.hslLightness.textAndMnemonic=\u4EAE\u5EA6
 ColorChooser.hslTransparency.textAndMnemonic=\u900F\u660E\u5EA6
-ColorChooser.rgb.textAndMnemonic=R&GB
+ColorChooser.rgb.textAndMnemonic=RGB(&G)
 ColorChooser.rgbRed.textAndMnemonic=\u7D05(&D)
 ColorChooser.rgbGreen.textAndMnemonic=\u7DA0(&N)
 ColorChooser.rgbBlue.textAndMnemonic=\u85CD(&B)
@@ -108,8 +109,10 @@
 # define mnemonics for any of the buttons.
 OptionPane.yesButton.textAndMnemonic=\u662F(&Y)
 OptionPane.noButton.textAndMnemonic=\u5426(&N)
-OptionPane.okButton.textAndMnemonic=\u78BA\u5B9A(&O)
+OptionPane.okButton.textAndMnemonic=\u78BA\u5B9A
+#OptionPane.okButtonMnemonic=0
 OptionPane.cancelButton.textAndMnemonic=\u53D6\u6D88
+#OptionPane.cancelButtonMnemonic=0
 OptionPane.title.textAndMnemonic=\u9078\u53D6\u4E00\u500B\u9078\u9805
 # Title for the dialog for the showInputDialog methods. Only used if
 # the developer uses one of the variants that doesn't take a title.
@@ -177,10 +180,9 @@
 SplitPane.leftButton.textAndMnemonic=\u5DE6\u6309\u9215
 SplitPane.rightButton.textAndMnemonic=\u53F3\u6309\u9215
 # Used for Isindex
-IsindexView.prompt=\u9019\u662F\u4E00\u500B\u53EF\u641C\u5C0B\u7684\u7D22\u5F15\u3002\u8F38\u5165\u641C\u5C0B\u95DC\u9375\u5B57:
+IsindexView.prompt=\u9019\u662F\u4E00\u500B\u53EF\u641C\u5C0B\u7684\u7D22\u5F15\u3002\u8F38\u5165\u641C\u5C0B\u95DC\u9375\u5B57: 
 
 ############ InternalFrameTitlePane Strings ############
 InternalFrameTitlePane.iconifyButtonAccessibleName=\u5716\u793A\u5316
 InternalFrameTitlePane.maximizeButtonAccessibleName=\u6700\u5927\u5316
 InternalFrameTitlePane.closeButtonAccessibleName=\u95DC\u9589
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -20,9 +20,9 @@
 
 FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
 FileChooser.saveInLabel.textAndMnemonic=Speichern in:
-FileChooser.fileNameLabel.textAndMnemonic=Datei&name:
-FileChooser.folderNameLabel.textAndMnemonic=Ord&nername:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Da&teityp:
+FileChooser.fileNameLabel.textAndMnemonic=&Dateiname:
+FileChooser.folderNameLabel.textAndMnemonic=Ordner&name:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Datei&typ:
 FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her
 FileChooser.upFolderAccessibleName=Nach oben
 FileChooser.homeFolderToolTip.textAndMnemonic=Home
@@ -50,5 +50,4 @@
 MetalTitlePane.restore.titleAndMnemonic=&Wiederherstellen
 MetalTitlePane.iconify.titleAndMnemonic=Minimie&ren
 MetalTitlePane.maximize.titleAndMnemonic=Ma&ximieren
-MetalTitlePane.close.titleAndMnemonic=Schlie\u00DFen(&S)
-
+MetalTitlePane.close.titleAndMnemonic=&Schlie\u00DFen
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,11 +18,11 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=Buscar en(&I):
+FileChooser.lookInLabel.textAndMnemonic=&Buscar en:
 FileChooser.saveInLabel.textAndMnemonic=Guardar en:
-FileChooser.fileNameLabel.textAndMnemonic=&Nombre de Archivo:
-FileChooser.folderNameLabel.textAndMnemonic=&Nombre de la Carpeta:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &Tipo:
+FileChooser.fileNameLabel.textAndMnemonic=&Nombre de archivo:
+FileChooser.folderNameLabel.textAndMnemonic=&Nombre de carpeta:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &tipo:
 FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel
 FileChooser.upFolderAccessibleName=Arriba
 FileChooser.homeFolderToolTip.textAndMnemonic=Inicio
@@ -51,4 +51,3 @@
 MetalTitlePane.iconify.titleAndMnemonic=Minimi&zar
 MetalTitlePane.maximize.titleAndMnemonic=Ma&ximizar
 MetalTitlePane.close.titleAndMnemonic=&Cerrar
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,11 +18,11 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=Rechercher dans (&I):
+FileChooser.lookInLabel.textAndMnemonic=Rechercher &dans :
 FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans :
 FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier :
 FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier :
-FileChooser.filesOfTypeLabel.textAndMnemonic=Fichiers de &type :
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Type de fichier :
 FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau.
 FileChooser.upFolderAccessibleName=Monter
 FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine
@@ -48,7 +48,6 @@
 
 ############ Used by MetalTitlePane if rendering window decorations############
 MetalTitlePane.restore.titleAndMnemonic=&Restaurer
-MetalTitlePane.iconify.titleAndMnemonic=R\u00E9duire(&D)
+MetalTitlePane.iconify.titleAndMnemonic=R\u00E9&duire
 MetalTitlePane.maximize.titleAndMnemonic=&Agrandir
 MetalTitlePane.close.titleAndMnemonic=&Fermer
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -21,8 +21,8 @@
 FileChooser.lookInLabel.textAndMnemonic=Cerca &in:
 FileChooser.saveInLabel.textAndMnemonic=Salva in:
 FileChooser.fileNameLabel.textAndMnemonic=&Nome file:
-FileChooser.folderNameLabel.textAndMnemonic=&Nome della cartella:
-FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo file:
+FileChooser.folderNameLabel.textAndMnemonic=&Nome cartella:
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo di file:
 FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore
 FileChooser.upFolderAccessibleName=Superiore
 FileChooser.homeFolderToolTip.textAndMnemonic=Home
@@ -51,4 +51,3 @@
 MetalTitlePane.iconify.titleAndMnemonic=Rid&uci a icona
 MetalTitlePane.maximize.titleAndMnemonic=In&grandisci
 MetalTitlePane.close.titleAndMnemonic=&Chiudi
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,7 +18,7 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=\u53C2\u7167(&I):
+FileChooser.lookInLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240(&I):
 FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
 FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N):
 FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N):
@@ -51,4 +51,3 @@
 MetalTitlePane.iconify.titleAndMnemonic=\u6700\u5C0F\u5316(&E)
 MetalTitlePane.maximize.titleAndMnemonic=\u6700\u5927\u5316(&X)
 MetalTitlePane.close.titleAndMnemonic=\u9589\u3058\u308B(&C)
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,7 +18,7 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=\uAC80\uC0C9 \uC704\uCE58(&I):
+FileChooser.lookInLabel.textAndMnemonic=\uCC3E\uB294 \uC704\uCE58(&I):
 FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58:
 FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N):
 FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N):
@@ -51,4 +51,3 @@
 MetalTitlePane.iconify.titleAndMnemonic=\uCD5C\uC18C\uD654(&E)
 MetalTitlePane.maximize.titleAndMnemonic=\uCD5C\uB300\uD654(&X)
 MetalTitlePane.close.titleAndMnemonic=\uB2EB\uAE30(&C)
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,7 +18,7 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=Consultar Em(&I):
+FileChooser.lookInLabel.textAndMnemonic=Pesquisar &em:
 FileChooser.saveInLabel.textAndMnemonic=Salvar Em:
 FileChooser.fileNameLabel.textAndMnemonic=&Nome do Arquivo:
 FileChooser.folderNameLabel.textAndMnemonic=&Nome da pasta:
@@ -51,4 +51,3 @@
 MetalTitlePane.iconify.titleAndMnemonic=&Minimizar
 MetalTitlePane.maximize.titleAndMnemonic=Ma&ximizar
 MetalTitlePane.close.titleAndMnemonic=&Fechar
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -21,8 +21,8 @@
 FileChooser.lookInLabel.textAndMnemonic=Leta &i:
 FileChooser.saveInLabel.textAndMnemonic=Spara i:
 FileChooser.fileNameLabel.textAndMnemonic=Fil&namn:
-FileChooser.folderNameLabel.textAndMnemonic=Mapp(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=Filforma&t:
+FileChooser.folderNameLabel.textAndMnemonic=Mapp&namn:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Mapp&namn:
 FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
 FileChooser.upFolderAccessibleName=Upp
 FileChooser.homeFolderToolTip.textAndMnemonic=Hem
@@ -47,8 +47,7 @@
 FileChooser.openButton.textAndMnemonic=\u00D6ppna
 
 ############ Used by MetalTitlePane if rendering window decorations############
-MetalTitlePane.restore.titleAndMnemonic=\u00C5terst\u00E4ll(&R)
+MetalTitlePane.restore.titleAndMnemonic=&\u00C5terst\u00E4ll
 MetalTitlePane.iconify.titleAndMnemonic=Minim&era
 MetalTitlePane.maximize.titleAndMnemonic=Ma&ximera
-MetalTitlePane.close.titleAndMnemonic=St\u00E4ng(&S)
-
+MetalTitlePane.close.titleAndMnemonic=&St\u00E4ng
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -18,8 +18,8 @@
 
 ############ FILE CHOOSER STRINGS #############
 
-FileChooser.lookInLabel.textAndMnemonic=\u67E5\u770B(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
+FileChooser.lookInLabel.textAndMnemonic=\u67E5\u627E(&I):
+FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58: 
 FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D(&N):
 FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D(&N):
 FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B(&T):
@@ -33,9 +33,9 @@
 FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868
 FileChooser.listViewButtonAccessibleName=\u5217\u8868
 FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
 FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0
 FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE
 FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0
@@ -51,4 +51,3 @@
 MetalTitlePane.iconify.titleAndMnemonic=\u6700\u5C0F\u5316(&E)
 MetalTitlePane.maximize.titleAndMnemonic=\u6700\u5927\u5316(&X)
 MetalTitlePane.close.titleAndMnemonic=\u5173\u95ED(&C)
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/metal/resources/metal_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -19,7 +19,7 @@
 ############ FILE CHOOSER STRINGS #############
 
 FileChooser.lookInLabel.textAndMnemonic=\u67E5\u8A62(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC:
+FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC: 
 FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848\u540D\u7A31(&N):
 FileChooser.folderNameLabel.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31(&N):
 FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u985E\u578B(&T):
@@ -51,4 +51,3 @@
 MetalTitlePane.iconify.titleAndMnemonic=\u6700\u5C0F\u5316(&E)
 MetalTitlePane.maximize.titleAndMnemonic=\u6700\u5927\u5316(&X)
 MetalTitlePane.close.titleAndMnemonic=\u95DC\u9589(&C)
-
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
-FileChooser.saveInLabel.textAndMnemonic=Speichern in:
-FileChooser.fileNameLabel.textAndMnemonic=Datei&name:
-FileChooser.folderNameLabel.textAndMnemonic=Ord&nername:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Da&teityp:
-FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her
-FileChooser.upFolderAccessibleName=Nach oben
-FileChooser.homeFolderToolTip.textAndMnemonic=Home
-FileChooser.homeFolderAccessibleName=Home
-FileChooser.newFolderToolTip.textAndMnemonic=Neuen Ordner erstellen
-FileChooser.newFolderAccessibleName=Neuer Ordner
-FileChooser.newFolderActionLabel.textAndMnemonic=Neuer Ordner
-FileChooser.listViewButtonToolTip.textAndMnemonic=Liste
-FileChooser.listViewButtonAccessibleName=Liste
-FileChooser.listViewActionLabel.textAndMnemonic=Liste
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details
-FileChooser.detailsViewButtonAccessibleName=Details
-FileChooser.detailsViewActionLabel.textAndMnemonic=Details
-FileChooser.refreshActionLabel.textAndMnemonic=Aktualisieren
-FileChooser.viewMenuLabel.textAndMnemonic=Ansicht
-FileChooser.fileNameHeader.textAndMnemonic=Name
-FileChooser.fileSizeHeader.textAndMnemonic=Gr\u00F6\u00DFe
-FileChooser.fileTypeHeader.textAndMnemonic=Typ
-FileChooser.fileDateHeader.textAndMnemonic=Ge\u00E4ndert
-FileChooser.fileAttrHeader.textAndMnemonic=Attribute
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Suchen &in:
+FileChooser.saveInLabel.textAndMnemonic=Speichern in:
+FileChooser.fileNameLabel.textAndMnemonic=&Dateiname:
+FileChooser.folderNameLabel.textAndMnemonic=&Ordnername:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Datei&typ:
+FileChooser.upFolderToolTip.textAndMnemonic=Eine Ebene h\u00F6her
+FileChooser.upFolderAccessibleName=Nach oben
+FileChooser.homeFolderToolTip.textAndMnemonic=Home
+FileChooser.homeFolderAccessibleName=Home
+FileChooser.newFolderToolTip.textAndMnemonic=Neuen Ordner erstellen
+FileChooser.newFolderAccessibleName=Neuer Ordner
+FileChooser.newFolderActionLabel.textAndMnemonic=Neuer Ordner
+FileChooser.listViewButtonToolTip.textAndMnemonic=Liste
+FileChooser.listViewButtonAccessibleName=Liste
+FileChooser.listViewActionLabel.textAndMnemonic=Liste
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details
+FileChooser.detailsViewButtonAccessibleName=Details
+FileChooser.detailsViewActionLabel.textAndMnemonic=Details
+FileChooser.refreshActionLabel.textAndMnemonic=Aktualisieren
+FileChooser.viewMenuLabel.textAndMnemonic=Ansicht
+FileChooser.fileNameHeader.textAndMnemonic=Name
+FileChooser.fileSizeHeader.textAndMnemonic=Gr\u00F6\u00DFe
+FileChooser.fileTypeHeader.textAndMnemonic=Typ
+FileChooser.fileDateHeader.textAndMnemonic=Ge\u00E4ndert
+FileChooser.fileAttrHeader.textAndMnemonic=Attribute
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Buscar en(&I):
-FileChooser.saveInLabel.textAndMnemonic=Guardar en:
-FileChooser.fileNameLabel.textAndMnemonic=&Nombre de Archivo:
-FileChooser.folderNameLabel.textAndMnemonic=&Nombre de la Carpeta:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &Tipo:
-FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel
-FileChooser.upFolderAccessibleName=Arriba
-FileChooser.homeFolderToolTip.textAndMnemonic=Inicio
-FileChooser.homeFolderAccessibleName=Inicio
-FileChooser.newFolderToolTip.textAndMnemonic=Crear Nueva Carpeta
-FileChooser.newFolderAccessibleName=Nueva Carpeta
-FileChooser.newFolderActionLabel.textAndMnemonic=Nueva Carpeta
-FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
-FileChooser.listViewButtonAccessibleName=Lista
-FileChooser.listViewActionLabel.textAndMnemonic=Lista
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalles
-FileChooser.detailsViewButtonAccessibleName=Detalles
-FileChooser.detailsViewActionLabel.textAndMnemonic=Detalles
-FileChooser.refreshActionLabel.textAndMnemonic=Refrescar
-FileChooser.viewMenuLabel.textAndMnemonic=Ver
-FileChooser.fileNameHeader.textAndMnemonic=Nombre
-FileChooser.fileSizeHeader.textAndMnemonic=Tama\u00F1o
-FileChooser.fileTypeHeader.textAndMnemonic=Tipo
-FileChooser.fileDateHeader.textAndMnemonic=Modificado
-FileChooser.fileAttrHeader.textAndMnemonic=Atributos
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=&Buscar en:
+FileChooser.saveInLabel.textAndMnemonic=Guardar en:
+FileChooser.fileNameLabel.textAndMnemonic=&Nombre de archivo:
+FileChooser.folderNameLabel.textAndMnemonic=&Nombre de carpeta:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Archivos de &tipo:
+FileChooser.upFolderToolTip.textAndMnemonic=Subir un Nivel
+FileChooser.upFolderAccessibleName=Arriba
+FileChooser.homeFolderToolTip.textAndMnemonic=Inicio
+FileChooser.homeFolderAccessibleName=Inicio
+FileChooser.newFolderToolTip.textAndMnemonic=Crear Nueva Carpeta
+FileChooser.newFolderAccessibleName=Nueva Carpeta
+FileChooser.newFolderActionLabel.textAndMnemonic=Nueva Carpeta
+FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
+FileChooser.listViewButtonAccessibleName=Lista
+FileChooser.listViewActionLabel.textAndMnemonic=Lista
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalles
+FileChooser.detailsViewButtonAccessibleName=Detalles
+FileChooser.detailsViewActionLabel.textAndMnemonic=Detalles
+FileChooser.refreshActionLabel.textAndMnemonic=Refrescar
+FileChooser.viewMenuLabel.textAndMnemonic=Ver
+FileChooser.fileNameHeader.textAndMnemonic=Nombre
+FileChooser.fileSizeHeader.textAndMnemonic=Tama\u00F1o
+FileChooser.fileTypeHeader.textAndMnemonic=Tipo
+FileChooser.fileDateHeader.textAndMnemonic=Modificado
+FileChooser.fileAttrHeader.textAndMnemonic=Atributos
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Rechercher dans (&I):
-FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans :
-FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier :
-FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier :
-FileChooser.filesOfTypeLabel.textAndMnemonic=Fichiers de &type :
-FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau.
-FileChooser.upFolderAccessibleName=Monter
-FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine
-FileChooser.homeFolderAccessibleName=R\u00E9pertoire d'origine
-FileChooser.newFolderToolTip.textAndMnemonic=Cr\u00E9e un dossier.
-FileChooser.newFolderAccessibleName=Nouveau dossier
-FileChooser.newFolderActionLabel.textAndMnemonic=Nouveau dossier
-FileChooser.listViewButtonToolTip.textAndMnemonic=Liste
-FileChooser.listViewButtonAccessibleName=Liste
-FileChooser.listViewActionLabel.textAndMnemonic=Liste
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=D\u00E9tails
-FileChooser.detailsViewButtonAccessibleName=D\u00E9tails
-FileChooser.detailsViewActionLabel.textAndMnemonic=D\u00E9tails
-FileChooser.refreshActionLabel.textAndMnemonic=Actualiser
-FileChooser.viewMenuLabel.textAndMnemonic=Affichage
-FileChooser.fileNameHeader.textAndMnemonic=Nom
-FileChooser.fileSizeHeader.textAndMnemonic=Taille
-FileChooser.fileTypeHeader.textAndMnemonic=Type
-FileChooser.fileDateHeader.textAndMnemonic=Modifi\u00E9
-FileChooser.fileAttrHeader.textAndMnemonic=Attributs
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Rechercher &dans :
+FileChooser.saveInLabel.textAndMnemonic=Enregistrer dans :
+FileChooser.fileNameLabel.textAndMnemonic=&Nom du fichier :
+FileChooser.folderNameLabel.textAndMnemonic=&Nom du dossier :
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Type de fichier :
+FileChooser.upFolderToolTip.textAndMnemonic=Remonte d'un niveau.
+FileChooser.upFolderAccessibleName=Monter
+FileChooser.homeFolderToolTip.textAndMnemonic=R\u00E9pertoire d'origine
+FileChooser.homeFolderAccessibleName=R\u00E9pertoire d'origine
+FileChooser.newFolderToolTip.textAndMnemonic=Cr\u00E9e un dossier.
+FileChooser.newFolderAccessibleName=Nouveau dossier
+FileChooser.newFolderActionLabel.textAndMnemonic=Nouveau dossier
+FileChooser.listViewButtonToolTip.textAndMnemonic=Liste
+FileChooser.listViewButtonAccessibleName=Liste
+FileChooser.listViewActionLabel.textAndMnemonic=Liste
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=D\u00E9tails
+FileChooser.detailsViewButtonAccessibleName=D\u00E9tails
+FileChooser.detailsViewActionLabel.textAndMnemonic=D\u00E9tails
+FileChooser.refreshActionLabel.textAndMnemonic=Actualiser
+FileChooser.viewMenuLabel.textAndMnemonic=Affichage
+FileChooser.fileNameHeader.textAndMnemonic=Nom
+FileChooser.fileSizeHeader.textAndMnemonic=Taille
+FileChooser.fileTypeHeader.textAndMnemonic=Type
+FileChooser.fileDateHeader.textAndMnemonic=Modifi\u00E9
+FileChooser.fileAttrHeader.textAndMnemonic=Attributs
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Cerca &in:
-FileChooser.saveInLabel.textAndMnemonic=Salva in:
-FileChooser.fileNameLabel.textAndMnemonic=&Nome file:
-FileChooser.folderNameLabel.textAndMnemonic=&Nome della cartella:
-FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo file:
-FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore
-FileChooser.upFolderAccessibleName=Superiore
-FileChooser.homeFolderToolTip.textAndMnemonic=Home
-FileChooser.homeFolderAccessibleName=Home
-FileChooser.newFolderToolTip.textAndMnemonic=Crea nuova cartella
-FileChooser.newFolderAccessibleName=Nuova cartella
-FileChooser.newFolderActionLabel.textAndMnemonic=Nuova cartella
-FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
-FileChooser.listViewButtonAccessibleName=Lista
-FileChooser.listViewActionLabel.textAndMnemonic=Lista
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Dettagli
-FileChooser.detailsViewButtonAccessibleName=Dettagli
-FileChooser.detailsViewActionLabel.textAndMnemonic=Dettagli
-FileChooser.refreshActionLabel.textAndMnemonic=Aggiorna
-FileChooser.viewMenuLabel.textAndMnemonic=Visualizza
-FileChooser.fileNameHeader.textAndMnemonic=Nome
-FileChooser.fileSizeHeader.textAndMnemonic=Dimensioni
-FileChooser.fileTypeHeader.textAndMnemonic=Tipo
-FileChooser.fileDateHeader.textAndMnemonic=Modificato
-FileChooser.fileAttrHeader.textAndMnemonic=Attributi
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Cerca &in:
+FileChooser.saveInLabel.textAndMnemonic=Salva in:
+FileChooser.fileNameLabel.textAndMnemonic=&Nome file:
+FileChooser.folderNameLabel.textAndMnemonic=&Nome cartella:
+FileChooser.filesOfTypeLabel.textAndMnemonic=&Tipo di file:
+FileChooser.upFolderToolTip.textAndMnemonic=Cartella superiore
+FileChooser.upFolderAccessibleName=Superiore
+FileChooser.homeFolderToolTip.textAndMnemonic=Home
+FileChooser.homeFolderAccessibleName=Home
+FileChooser.newFolderToolTip.textAndMnemonic=Crea nuova cartella
+FileChooser.newFolderAccessibleName=Nuova cartella
+FileChooser.newFolderActionLabel.textAndMnemonic=Nuova cartella
+FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
+FileChooser.listViewButtonAccessibleName=Lista
+FileChooser.listViewActionLabel.textAndMnemonic=Lista
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Dettagli
+FileChooser.detailsViewButtonAccessibleName=Dettagli
+FileChooser.detailsViewActionLabel.textAndMnemonic=Dettagli
+FileChooser.refreshActionLabel.textAndMnemonic=Aggiorna
+FileChooser.viewMenuLabel.textAndMnemonic=Visualizza
+FileChooser.fileNameHeader.textAndMnemonic=Nome
+FileChooser.fileSizeHeader.textAndMnemonic=Dimensioni
+FileChooser.fileTypeHeader.textAndMnemonic=Tipo
+FileChooser.fileDateHeader.textAndMnemonic=Modificato
+FileChooser.fileAttrHeader.textAndMnemonic=Attributi
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=\u53C2\u7167(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
-FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N):
-FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7(&T):
-FileChooser.upFolderToolTip.textAndMnemonic=1\u30EC\u30D9\u30EB\u4E0A\u3078
-FileChooser.upFolderAccessibleName=\u4E0A\u3078
-FileChooser.homeFolderToolTip.textAndMnemonic=\u30DB\u30FC\u30E0
-FileChooser.homeFolderAccessibleName=\u30DB\u30FC\u30E0
-FileChooser.newFolderToolTip.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210
-FileChooser.newFolderAccessibleName=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
-FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
-FileChooser.listViewButtonToolTip.textAndMnemonic=\u30EA\u30B9\u30C8
-FileChooser.listViewButtonAccessibleName=\u30EA\u30B9\u30C8
-FileChooser.listViewActionLabel.textAndMnemonic=\u30EA\u30B9\u30C8
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30
-FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30
-FileChooser.refreshActionLabel.textAndMnemonic=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5
-FileChooser.viewMenuLabel.textAndMnemonic=\u8868\u793A
-FileChooser.fileNameHeader.textAndMnemonic=\u540D\u524D
-FileChooser.fileSizeHeader.textAndMnemonic=\u30B5\u30A4\u30BA
-FileChooser.fileTypeHeader.textAndMnemonic=\u30BF\u30A4\u30D7
-FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6B63\u65E5
-FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240(&I):
+FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
+FileChooser.fileNameLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u540D(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\u30D5\u30A9\u30EB\u30C0\u540D(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u30D5\u30A1\u30A4\u30EB\u306E\u30BF\u30A4\u30D7(&T):
+FileChooser.upFolderToolTip.textAndMnemonic=1\u30EC\u30D9\u30EB\u4E0A\u3078
+FileChooser.upFolderAccessibleName=\u4E0A\u3078
+FileChooser.homeFolderToolTip.textAndMnemonic=\u30DB\u30FC\u30E0
+FileChooser.homeFolderAccessibleName=\u30DB\u30FC\u30E0
+FileChooser.newFolderToolTip.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0\u306E\u4F5C\u6210
+FileChooser.newFolderAccessibleName=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u898F\u30D5\u30A9\u30EB\u30C0
+FileChooser.listViewButtonToolTip.textAndMnemonic=\u30EA\u30B9\u30C8
+FileChooser.listViewButtonAccessibleName=\u30EA\u30B9\u30C8
+FileChooser.listViewActionLabel.textAndMnemonic=\u30EA\u30B9\u30C8
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30
+FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30
+FileChooser.refreshActionLabel.textAndMnemonic=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5
+FileChooser.viewMenuLabel.textAndMnemonic=\u8868\u793A
+FileChooser.fileNameHeader.textAndMnemonic=\u540D\u524D
+FileChooser.fileSizeHeader.textAndMnemonic=\u30B5\u30A4\u30BA
+FileChooser.fileTypeHeader.textAndMnemonic=\u30BF\u30A4\u30D7
+FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6B63\u65E5
+FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=\uAC80\uC0C9 \uC704\uCE58(&I):
-FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58:
-FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N):
-FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=\uD30C\uC77C \uC720\uD615(&T):
-FileChooser.upFolderToolTip.textAndMnemonic=\uD55C \uB808\uBCA8 \uC704\uB85C
-FileChooser.upFolderAccessibleName=\uC704\uB85C
-FileChooser.homeFolderToolTip.textAndMnemonic=\uD648
-FileChooser.homeFolderAccessibleName=\uD648
-FileChooser.newFolderToolTip.textAndMnemonic=\uC0C8 \uD3F4\uB354 \uC0DD\uC131
-FileChooser.newFolderAccessibleName=\uC0C8 \uD3F4\uB354
-FileChooser.newFolderActionLabel.textAndMnemonic=\uC0C8 \uD3F4\uB354
-FileChooser.listViewButtonToolTip.textAndMnemonic=\uBAA9\uB85D
-FileChooser.listViewButtonAccessibleName=\uBAA9\uB85D
-FileChooser.listViewActionLabel.textAndMnemonic=\uBAA9\uB85D
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4
-FileChooser.detailsViewButtonAccessibleName=\uC138\uBD80 \uC815\uBCF4
-FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4
-FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68
-FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30
-FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984
-FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30
-FileChooser.fileTypeHeader.textAndMnemonic=\uC720\uD615
-FileChooser.fileDateHeader.textAndMnemonic=\uC218\uC815 \uB0A0\uC9DC
-FileChooser.fileAttrHeader.textAndMnemonic=\uC18D\uC131
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=\uCC3E\uB294 \uC704\uCE58(&I):
+FileChooser.saveInLabel.textAndMnemonic=\uC800\uC7A5 \uC704\uCE58:
+FileChooser.fileNameLabel.textAndMnemonic=\uD30C\uC77C \uC774\uB984(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\uD3F4\uB354 \uC774\uB984(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\uD30C\uC77C \uC720\uD615(&T):
+FileChooser.upFolderToolTip.textAndMnemonic=\uD55C \uB808\uBCA8 \uC704\uB85C
+FileChooser.upFolderAccessibleName=\uC704\uB85C
+FileChooser.homeFolderToolTip.textAndMnemonic=\uD648
+FileChooser.homeFolderAccessibleName=\uD648
+FileChooser.newFolderToolTip.textAndMnemonic=\uC0C8 \uD3F4\uB354 \uC0DD\uC131
+FileChooser.newFolderAccessibleName=\uC0C8 \uD3F4\uB354
+FileChooser.newFolderActionLabel.textAndMnemonic=\uC0C8 \uD3F4\uB354
+FileChooser.listViewButtonToolTip.textAndMnemonic=\uBAA9\uB85D
+FileChooser.listViewButtonAccessibleName=\uBAA9\uB85D
+FileChooser.listViewActionLabel.textAndMnemonic=\uBAA9\uB85D
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4
+FileChooser.detailsViewButtonAccessibleName=\uC138\uBD80 \uC815\uBCF4
+FileChooser.detailsViewActionLabel.textAndMnemonic=\uC138\uBD80 \uC815\uBCF4
+FileChooser.refreshActionLabel.textAndMnemonic=\uC0C8\uB85C \uACE0\uCE68
+FileChooser.viewMenuLabel.textAndMnemonic=\uBCF4\uAE30
+FileChooser.fileNameHeader.textAndMnemonic=\uC774\uB984
+FileChooser.fileSizeHeader.textAndMnemonic=\uD06C\uAE30
+FileChooser.fileTypeHeader.textAndMnemonic=\uC720\uD615
+FileChooser.fileDateHeader.textAndMnemonic=\uC218\uC815 \uB0A0\uC9DC
+FileChooser.fileAttrHeader.textAndMnemonic=\uC18D\uC131
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Consultar Em(&I):
-FileChooser.saveInLabel.textAndMnemonic=Salvar Em:
-FileChooser.fileNameLabel.textAndMnemonic=&Nome do Arquivo:
-FileChooser.folderNameLabel.textAndMnemonic=&Nome da pasta:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Arquivos do &Tipo:
-FileChooser.upFolderToolTip.textAndMnemonic=Um N\u00EDvel Acima
-FileChooser.upFolderAccessibleName=Acima
-FileChooser.homeFolderToolTip.textAndMnemonic=In\u00EDcio
-FileChooser.homeFolderAccessibleName=In\u00EDcio
-FileChooser.newFolderToolTip.textAndMnemonic=Criar Nova Pasta
-FileChooser.newFolderAccessibleName=Nova Pasta
-FileChooser.newFolderActionLabel.textAndMnemonic=Nova Pasta
-FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
-FileChooser.listViewButtonAccessibleName=Lista
-FileChooser.listViewActionLabel.textAndMnemonic=Lista
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalhes
-FileChooser.detailsViewButtonAccessibleName=Detalhes
-FileChooser.detailsViewActionLabel.textAndMnemonic=Detalhes
-FileChooser.refreshActionLabel.textAndMnemonic=Atualizar
-FileChooser.viewMenuLabel.textAndMnemonic=Exibir
-FileChooser.fileNameHeader.textAndMnemonic=Nome
-FileChooser.fileSizeHeader.textAndMnemonic=Tamanho
-FileChooser.fileTypeHeader.textAndMnemonic=Tipo
-FileChooser.fileDateHeader.textAndMnemonic=Modificado
-FileChooser.fileAttrHeader.textAndMnemonic=Atributos
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Pesquisar &em:
+FileChooser.saveInLabel.textAndMnemonic=Salvar Em:
+FileChooser.fileNameLabel.textAndMnemonic=&Nome do Arquivo:
+FileChooser.folderNameLabel.textAndMnemonic=&Nome da Pasta:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Arquivos do &Tipo:
+FileChooser.upFolderToolTip.textAndMnemonic=Um N\u00EDvel Acima
+FileChooser.upFolderAccessibleName=Acima
+FileChooser.homeFolderToolTip.textAndMnemonic=In\u00EDcio
+FileChooser.homeFolderAccessibleName=In\u00EDcio
+FileChooser.newFolderToolTip.textAndMnemonic=Criar Nova Pasta
+FileChooser.newFolderAccessibleName=Nova Pasta
+FileChooser.newFolderActionLabel.textAndMnemonic=Nova Pasta
+FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
+FileChooser.listViewButtonAccessibleName=Lista
+FileChooser.listViewActionLabel.textAndMnemonic=Lista
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detalhes
+FileChooser.detailsViewButtonAccessibleName=Detalhes
+FileChooser.detailsViewActionLabel.textAndMnemonic=Detalhes
+FileChooser.refreshActionLabel.textAndMnemonic=Atualizar
+FileChooser.viewMenuLabel.textAndMnemonic=Exibir
+FileChooser.fileNameHeader.textAndMnemonic=Nome
+FileChooser.fileSizeHeader.textAndMnemonic=Tamanho
+FileChooser.fileTypeHeader.textAndMnemonic=Tipo
+FileChooser.fileDateHeader.textAndMnemonic=Modificado
+FileChooser.fileAttrHeader.textAndMnemonic=Atributos
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Leta &i:
-FileChooser.saveInLabel.textAndMnemonic=Spara i:
-FileChooser.fileNameLabel.textAndMnemonic=Fil&namn:
-FileChooser.folderNameLabel.textAndMnemonic=Mapp(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=Filforma&t:
-FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
-FileChooser.upFolderAccessibleName=Upp
-FileChooser.homeFolderToolTip.textAndMnemonic=Hem
-FileChooser.homeFolderAccessibleName=Hem
-FileChooser.newFolderToolTip.textAndMnemonic=Skapa ny mapp
-FileChooser.newFolderAccessibleName=Ny mapp
-FileChooser.newFolderActionLabel.textAndMnemonic=Ny mapp
-FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
-FileChooser.listViewButtonAccessibleName=Lista
-FileChooser.listViewActionLabel.textAndMnemonic=Lista
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detaljer
-FileChooser.detailsViewButtonAccessibleName=Detaljer
-FileChooser.detailsViewActionLabel.textAndMnemonic=Detaljer
-FileChooser.refreshActionLabel.textAndMnemonic=F\u00F6rnya
-FileChooser.viewMenuLabel.textAndMnemonic=Vy
-FileChooser.fileNameHeader.textAndMnemonic=Namn
-FileChooser.fileSizeHeader.textAndMnemonic=Storlek
-FileChooser.fileTypeHeader.textAndMnemonic=Typ
-FileChooser.fileDateHeader.textAndMnemonic=\u00C4ndrad
-FileChooser.fileAttrHeader.textAndMnemonic=Attribut
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Leta &i:
+FileChooser.saveInLabel.textAndMnemonic=Spara i:
+FileChooser.fileNameLabel.textAndMnemonic=Fil&namn:
+FileChooser.folderNameLabel.textAndMnemonic=Mapp&namn:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Filer av &typ:
+FileChooser.upFolderToolTip.textAndMnemonic=Upp en niv\u00E5
+FileChooser.upFolderAccessibleName=Upp
+FileChooser.homeFolderToolTip.textAndMnemonic=Hem
+FileChooser.homeFolderAccessibleName=Hem
+FileChooser.newFolderToolTip.textAndMnemonic=Skapa ny mapp
+FileChooser.newFolderAccessibleName=Ny mapp
+FileChooser.newFolderActionLabel.textAndMnemonic=Ny mapp
+FileChooser.listViewButtonToolTip.textAndMnemonic=Lista
+FileChooser.listViewButtonAccessibleName=Lista
+FileChooser.listViewActionLabel.textAndMnemonic=Lista
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Detaljer
+FileChooser.detailsViewButtonAccessibleName=Detaljer
+FileChooser.detailsViewActionLabel.textAndMnemonic=Detaljer
+FileChooser.refreshActionLabel.textAndMnemonic=F\u00F6rnya
+FileChooser.viewMenuLabel.textAndMnemonic=Vy
+FileChooser.fileNameHeader.textAndMnemonic=Namn
+FileChooser.fileSizeHeader.textAndMnemonic=Storlek
+FileChooser.fileTypeHeader.textAndMnemonic=Typ
+FileChooser.fileDateHeader.textAndMnemonic=\u00C4ndrad
+FileChooser.fileAttrHeader.textAndMnemonic=Attribut
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=\u67E5\u770B(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58:
-FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D(&N):
-FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B(&T):
-FileChooser.upFolderToolTip.textAndMnemonic=\u5411\u4E0A\u4E00\u7EA7
-FileChooser.upFolderAccessibleName=\u5411\u4E0A
-FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u5F55
-FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u5F55
-FileChooser.newFolderToolTip.textAndMnemonic=\u521B\u5EFA\u65B0\u6587\u4EF6\u5939
-FileChooser.newFolderAccessibleName=\u65B0\u5EFA\u6587\u4EF6\u5939
-FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939
-FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868
-FileChooser.listViewButtonAccessibleName=\u5217\u8868
-FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u8D44\u6599
-FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0
-FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE
-FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0
-FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
-FileChooser.fileTypeHeader.textAndMnemonic=\u7C7B\u578B
-FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
-FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=\u67E5\u627E(&I):
+FileChooser.saveInLabel.textAndMnemonic=\u4FDD\u5B58: 
+FileChooser.fileNameLabel.textAndMnemonic=\u6587\u4EF6\u540D(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\u6587\u4EF6\u5939\u540D(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6587\u4EF6\u7C7B\u578B(&T):
+FileChooser.upFolderToolTip.textAndMnemonic=\u5411\u4E0A\u4E00\u7EA7
+FileChooser.upFolderAccessibleName=\u5411\u4E0A
+FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u5F55
+FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u5F55
+FileChooser.newFolderToolTip.textAndMnemonic=\u521B\u5EFA\u65B0\u6587\u4EF6\u5939
+FileChooser.newFolderAccessibleName=\u65B0\u5EFA\u6587\u4EF6\u5939
+FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u5EFA\u6587\u4EF6\u5939
+FileChooser.listViewButtonToolTip.textAndMnemonic=\u5217\u8868
+FileChooser.listViewButtonAccessibleName=\u5217\u8868
+FileChooser.listViewActionLabel.textAndMnemonic=\u5217\u8868
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewButtonAccessibleName=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8BE6\u7EC6\u4FE1\u606F
+FileChooser.refreshActionLabel.textAndMnemonic=\u5237\u65B0
+FileChooser.viewMenuLabel.textAndMnemonic=\u89C6\u56FE
+FileChooser.fileNameHeader.textAndMnemonic=\u540D\u79F0
+FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
+FileChooser.fileTypeHeader.textAndMnemonic=\u7C7B\u578B
+FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
+FileChooser.fileAttrHeader.textAndMnemonic=\u5C5E\u6027
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=\u67E5\u8A62(&I):
-FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC:
-FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848\u540D\u7A31(&N):
-FileChooser.folderNameLabel.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31(&N):
-FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u985E\u578B(&T):
-FileChooser.upFolderToolTip.textAndMnemonic=\u5F80\u4E0A\u4E00\u5C64
-FileChooser.upFolderAccessibleName=\u5F80\u4E0A
-FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u9304
-FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u9304
-FileChooser.newFolderToolTip.textAndMnemonic=\u5EFA\u7ACB\u65B0\u8CC7\u6599\u593E
-FileChooser.newFolderAccessibleName=\u65B0\u8CC7\u6599\u593E
-FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u8CC7\u6599\u593E
-FileChooser.listViewButtonToolTip.textAndMnemonic=\u6E05\u55AE
-FileChooser.listViewButtonAccessibleName=\u6E05\u55AE
-FileChooser.listViewActionLabel.textAndMnemonic=\u6E05\u55AE
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A
-FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30\u8CC7\u8A0A
-FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A
-FileChooser.refreshActionLabel.textAndMnemonic=\u91CD\u65B0\u6574\u7406
-FileChooser.viewMenuLabel.textAndMnemonic=\u6AA2\u8996
-FileChooser.fileNameHeader.textAndMnemonic=\u540D\u7A31
-FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
-FileChooser.fileTypeHeader.textAndMnemonic=\u985E\u578B
-FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
-FileChooser.fileAttrHeader.textAndMnemonic=\u5C6C\u6027
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=\u67E5\u8A62(&I):
+FileChooser.saveInLabel.textAndMnemonic=\u5132\u5B58\u65BC: 
+FileChooser.fileNameLabel.textAndMnemonic=\u6A94\u6848\u540D\u7A31(&N):
+FileChooser.folderNameLabel.textAndMnemonic=\u8CC7\u6599\u593E\u540D\u7A31(&N):
+FileChooser.filesOfTypeLabel.textAndMnemonic=\u6A94\u6848\u985E\u578B(&T):
+FileChooser.upFolderToolTip.textAndMnemonic=\u5F80\u4E0A\u4E00\u5C64
+FileChooser.upFolderAccessibleName=\u5F80\u4E0A
+FileChooser.homeFolderToolTip.textAndMnemonic=\u4E3B\u76EE\u9304
+FileChooser.homeFolderAccessibleName=\u4E3B\u76EE\u9304
+FileChooser.newFolderToolTip.textAndMnemonic=\u5EFA\u7ACB\u65B0\u8CC7\u6599\u593E
+FileChooser.newFolderAccessibleName=\u65B0\u8CC7\u6599\u593E
+FileChooser.newFolderActionLabel.textAndMnemonic=\u65B0\u8CC7\u6599\u593E
+FileChooser.listViewButtonToolTip.textAndMnemonic=\u6E05\u55AE
+FileChooser.listViewButtonAccessibleName=\u6E05\u55AE
+FileChooser.listViewActionLabel.textAndMnemonic=\u6E05\u55AE
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A
+FileChooser.detailsViewButtonAccessibleName=\u8A73\u7D30\u8CC7\u8A0A
+FileChooser.detailsViewActionLabel.textAndMnemonic=\u8A73\u7D30\u8CC7\u8A0A
+FileChooser.refreshActionLabel.textAndMnemonic=\u91CD\u65B0\u6574\u7406
+FileChooser.viewMenuLabel.textAndMnemonic=\u6AA2\u8996
+FileChooser.fileNameHeader.textAndMnemonic=\u540D\u7A31
+FileChooser.fileSizeHeader.textAndMnemonic=\u5927\u5C0F
+FileChooser.fileTypeHeader.textAndMnemonic=\u985E\u578B
+FileChooser.fileDateHeader.textAndMnemonic=\u4FEE\u6539\u65E5\u671F
+FileChooser.fileAttrHeader.textAndMnemonic=\u5C6C\u6027
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java	Wed May 08 10:10:05 2013 +0100
@@ -201,7 +201,7 @@
         {"No class named", "\u540D\u524D''{0}''\u306E\u30AF\u30E9\u30B9\u304C\u3042\u308A\u307E\u305B\u3093"},
         {"No class specified.", "\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
         {"No classpath specified.", "\u30AF\u30E9\u30B9\u30D1\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
-        {"No code at line", "{1}\u306E\u884C{0,number,integer}\u306B\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
+        {"No code at line", "\u884C{0,number,integer} ({1}\u5185)\u306B\u30B3\u30FC\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
         {"No connect specification.", "\u63A5\u7D9A\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
         {"No connector named:", "\u540D\u524D{0}\u306E\u30B3\u30CD\u30AF\u30BF\u304C\u3042\u308A\u307E\u305B\u3093"},
         {"No current thread", "\u73FE\u5728\u306E\u30B9\u30EC\u30C3\u30C9\u304C\u3042\u308A\u307E\u305B\u3093"},
--- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java	Wed May 08 10:10:05 2013 +0100
@@ -325,7 +325,7 @@
         {"watch accesses of", "\u76D1\u89C6{0}.{1}\u7684\u8BBF\u95EE"},
         {"watch modification of", "\u76D1\u89C6{0}.{1}\u7684\u4FEE\u6539"},
         {"zz help text",
-             "** \u547D\u4EE4\u5217\u8868 **\nconnectors                -- \u5217\u51FA\u6B64 VM \u4E2D\u53EF\u7528\u7684\u8FDE\u63A5\u5668\u548C\u4F20\u8F93\n\nrun [class [args]]        -- \u5F00\u59CB\u6267\u884C\u5E94\u7528\u7A0B\u5E8F\u7684\u4E3B\u7C7B\n\nthreads [threadgroup]     -- \u5217\u51FA\u7EBF\u7A0B\nthread <thread id>        -- \u8BBE\u7F6E\u9ED8\u8BA4\u7EBF\u7A0B\nsuspend [thread id(s)]    -- \u6302\u8D77\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nresume [thread id(s)]     -- \u6062\u590D\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nwhere [<thread id> | all] -- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808\nwherei [<thread id> | all]-- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808, \u4EE5\u53CA pc \u4FE1\u606F\nup [n frames]             -- \u4E0A\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\ndown [n frames]           -- \u4E0B\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\nkill <thread id> <expr>   -- \u7EC8\u6B62\u5177\u6709\u7ED9\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u5BF9\u8C61\u7684\u7EBF\u7A0B\ninterrupt <thread id>     -- \u4E2D\u65AD\u7EBF\u7A0B\n\nprint <expr>              -- \u8F93\u51FA\u8868\u8FBE\u5F0F\u7684\u503C\ndump <expr>               -- \u8F93\u51FA\u6240\u6709\u5BF9\u8C61\u4FE1\u606F\neval <expr>               -- \u5BF9\u8868\u8FBE\u5F0F\u6C42\u503C (\u4E0E print \u76F8\u540C)\nset <lvalue> = <expr>     -- \u5411\u5B57\u6BB5/\u53D8\u91CF/\u6570\u7EC4\u5143\u7D20\u5206\u914D\u65B0\u503C\nlocals                    -- \u8F93\u51FA\u5F53\u524D\u5806\u6808\u5E27\u4E2D\u7684\u6240\u6709\u672C\u5730\u53D8\u91CF\n\nclasses                   -- \u5217\u51FA\u5F53\u524D\u5DF2\u77E5\u7684\u7C7B\nclass <class id>          -- \u663E\u793A\u5DF2\u547D\u540D\u7C7B\u7684\u8BE6\u7EC6\u8D44\u6599\nmethods <class id>        -- \u5217\u51FA\u7C7B\u7684\u65B9\u6CD5\nfields <class id>         -- \u5217\u51FA\u7C7B\u7684\u5B57\u6BB5\n\nthreadgroups              -- \u5217\u51FA\u7EBF\u7A0B\u7EC4\nthreadgroup <name>        -- \u8BBE\u7F6E\u5F53\u524D\u7EBF\u7A0B\u7EC4\n\nstop in <class id>.<method>[(argument_type,...)]\n                          -- \u5728\u65B9\u6CD5\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nstop at <class id>:<line> -- \u5728\u884C\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nclear <class id>.<method>[(argument_type,...)]\n                          -- \u6E05\u9664\u65B9\u6CD5\u4E2D\u7684\u65AD\u70B9\nclear <class id>:<line>   -- \u6E05\u9664\u884C\u4E2D\u7684\u65AD\u70B9\nclear                     -- \u5217\u51FA\u65AD\u70B9\ncatch [uncaught|caught|all] <class id>|<class pattern>\n                          -- \u51FA\u73B0\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u65F6\u4E2D\u65AD\nignore [uncaught|caught|all] <class id>|<class pattern>\n                          -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF, \u53D6\u6D88 'catch'\nwatch [access|all] <class id>.<field name>\n                          -- \u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\nunwatch [access|all] <class id>.<field name>\n                          -- \u505C\u6B62\u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\ntrace [go] methods [thread]\n                          -- \u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C\u9000\u51FA\u3002\n                          -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\ntrace [go] method exit | exits [thread]\n                          -- \u8DDF\u8E2A\u5F53\u524D\u65B9\u6CD5\u7684\u9000\u51FA, \u6216\u8005\u6240\u6709\u65B9\u6CD5\u7684\u9000\u51FA\n                          -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\nuntrace [methods]         -- \u505C\u6B62\u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C/\u6216\u9000\u51FA\nstep                      -- \u6267\u884C\u5F53\u524D\u884C\nstep up                   -- \u4E00\u76F4\u6267\u884C, \u76F4\u5230\u5F53\u524D\u65B9\u6CD5\u8FD4\u56DE\u5230\u5176\u8C03\u7528\u65B9\nstepi                     -- \u6267\u884C\u5F53\u524D\u6307\u4EE4\nnext                      -- \u6B65\u8FDB\u4E00\u884C (\u6B65\u8FC7\u8C03\u7528)\ncont                      -- \u4ECE\u65AD\u70B9\u5904\u7EE7\u7EED\u6267\u884C\n\nlist [line number|method] -- \u8F93\u51FA\u6E90\u4EE3\u7801\nuse (\u6216 sourcepath) [source file path]\n                          -- \u663E\u793A\u6216\u66F4\u6539\u6E90\u8DEF\u5F84\nexclude [<class pattern>, ... | \"none\"]\n                          -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u7C7B, \u4E0D\u62A5\u544A\u6B65\u9AA4\u6216\u65B9\u6CD5\u4E8B\u4EF6\nclasspath                 -- \u4ECE\u76EE\u6807 VM \u8F93\u51FA\u7C7B\u8DEF\u5F84\u4FE1\u606F\n\nmonitor <command>         -- \u6BCF\u6B21\u7A0B\u5E8F\u505C\u6B62\u65F6\u6267\u884C\u547D\u4EE4\nmonitor                   -- \u5217\u51FA\u76D1\u89C6\u5668\nunmonitor <monitor#>      -- \u5220\u9664\u76D1\u89C6\u5668\nread <filename>           -- \u8BFB\u53D6\u5E76\u6267\u884C\u547D\u4EE4\u6587\u4EF6\n\nlock <expr>               -- \u8F93\u51FA\u5BF9\u8C61\u7684\u9501\u4FE1\u606F\nthreadlocks [thread id]   -- \u8F93\u51FA\u7EBF\u7A0B\u7684\u9501\u4FE1\u606F\n\npop                       -- \u901A\u8FC7\u5F53\u524D\u5E27\u51FA\u6808, \u4E14\u5305\u542B\u5F53\u524D\u5E27\nreenter                   -- \u4E0E pop \u76F8\u540C, \u4F46\u91CD\u65B0\u8FDB\u5165\u5F53\u524D\u5E27\nredefine <class id> <class file name>\n                          -- \u91CD\u65B0\u5B9A\u4E49\u7C7B\u7684\u4EE3\u7801\n\ndisablegc <expr>          -- \u7981\u6B62\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\nenablegc <expr>           -- \u5141\u8BB8\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\n\n!!                        -- \u91CD\u590D\u6267\u884C\u6700\u540E\u4E00\u4E2A\u547D\u4EE4\n<n> <command>             -- \u5C06\u547D\u4EE4\u91CD\u590D\u6267\u884C n \u6B21\n# <command>               -- \u653E\u5F03 (\u65E0\u64CD\u4F5C)\nhelp (\u6216 ?)               -- \u5217\u51FA\u547D\u4EE4\nversion                   -- \u8F93\u51FA\u7248\u672C\u4FE1\u606F\nexit (\u6216 quit)            -- \u9000\u51FA\u8C03\u8BD5\u5668\n\n<class id>: \u5E26\u6709\u7A0B\u5E8F\u5305\u9650\u5B9A\u7B26\u7684\u5B8C\u6574\u7C7B\u540D\n<class pattern>: \u5E26\u6709\u524D\u5BFC\u6216\u5C3E\u968F\u901A\u914D\u7B26 ('*') \u7684\u7C7B\u540D\n<thread id>: 'threads' \u547D\u4EE4\u4E2D\u62A5\u544A\u7684\u7EBF\u7A0B\u7F16\u53F7\n<expr>: Java(TM) \u7F16\u7A0B\u8BED\u8A00\u8868\u8FBE\u5F0F\u3002\n\u652F\u6301\u5927\u591A\u6570\u5E38\u89C1\u8BED\u6CD5\u3002\n\n\u53EF\u4EE5\u5C06\u542F\u52A8\u547D\u4EE4\u7F6E\u4E8E \"jdb.ini\" \u6216 \".jdbrc\" \u4E2D\n\u4F4D\u4E8E user.home \u6216 user.dir \u4E2D"},
+             "** \u547D\u4EE4\u5217\u8868 **\nconnectors                -- \u5217\u51FA\u6B64 VM \u4E2D\u53EF\u7528\u7684\u8FDE\u63A5\u5668\u548C\u4F20\u8F93\n\nrun [class [args]]        -- \u5F00\u59CB\u6267\u884C\u5E94\u7528\u7A0B\u5E8F\u7684\u4E3B\u7C7B\n\nthreads [threadgroup]     -- \u5217\u51FA\u7EBF\u7A0B\nthread <thread id>        -- \u8BBE\u7F6E\u9ED8\u8BA4\u7EBF\u7A0B\nsuspend [thread id(s)]    -- \u6302\u8D77\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nresume [thread id(s)]     -- \u6062\u590D\u7EBF\u7A0B (\u9ED8\u8BA4\u503C: all)\nwhere [<thread id> | all] -- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808\nwherei [<thread id> | all]-- \u8F6C\u50A8\u7EBF\u7A0B\u7684\u5806\u6808, \u4EE5\u53CA pc \u4FE1\u606F\nup [n frames]             -- \u4E0A\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\ndown [n frames]           -- \u4E0B\u79FB\u7EBF\u7A0B\u7684\u5806\u6808\nkill <thread id> <expr>   -- \u7EC8\u6B62\u5177\u6709\u7ED9\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u5BF9\u8C61\u7684\u7EBF\u7A0B\ninterrupt <thread id>     -- \u4E2D\u65AD\u7EBF\u7A0B\n\nprint <expr>              -- \u8F93\u51FA\u8868\u8FBE\u5F0F\u7684\u503C\ndump <expr>               -- \u8F93\u51FA\u6240\u6709\u5BF9\u8C61\u4FE1\u606F\neval <expr>               -- \u5BF9\u8868\u8FBE\u5F0F\u6C42\u503C (\u4E0E print \u76F8\u540C)\nset <lvalue> = <expr>     -- \u5411\u5B57\u6BB5/\u53D8\u91CF/\u6570\u7EC4\u5143\u7D20\u5206\u914D\u65B0\u503C\nlocals                    -- \u8F93\u51FA\u5F53\u524D\u5806\u6808\u5E27\u4E2D\u7684\u6240\u6709\u672C\u5730\u53D8\u91CF\n\nclasses                   -- \u5217\u51FA\u5F53\u524D\u5DF2\u77E5\u7684\u7C7B\nclass <class id>          -- \u663E\u793A\u5DF2\u547D\u540D\u7C7B\u7684\u8BE6\u7EC6\u8D44\u6599\nmethods <class id>        -- \u5217\u51FA\u7C7B\u7684\u65B9\u6CD5\nfields <class id>         -- \u5217\u51FA\u7C7B\u7684\u5B57\u6BB5\n\nthreadgroups              -- \u5217\u51FA\u7EBF\u7A0B\u7EC4\nthreadgroup <name>        -- \u8BBE\u7F6E\u5F53\u524D\u7EBF\u7A0B\u7EC4\n\nstop in <class id>.<method>[(argument_type,...)]\n                          -- \u5728\u65B9\u6CD5\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nstop at <class id>:<line> -- \u5728\u884C\u4E2D\u8BBE\u7F6E\u65AD\u70B9\nclear <class id>.<method>[(argument_type,...)]\n                          -- \u6E05\u9664\u65B9\u6CD5\u4E2D\u7684\u65AD\u70B9\nclear <class id>:<line>   -- \u6E05\u9664\u884C\u4E2D\u7684\u65AD\u70B9\nclear                     -- \u5217\u51FA\u65AD\u70B9\ncatch [uncaught|caught|all] <class id>|<class pattern>\n                          -- \u51FA\u73B0\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF\u65F6\u4E2D\u65AD\nignore [uncaught|caught|all] <class id>|<class pattern>\n                          -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u5F02\u5E38\u9519\u8BEF, \u53D6\u6D88 'catch'\nwatch [access|all] <class id>.<field name>\n                          -- \u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\nunwatch [access|all] <class id>.<field name>\n                          -- \u505C\u6B62\u76D1\u89C6\u5BF9\u5B57\u6BB5\u7684\u8BBF\u95EE/\u4FEE\u6539\ntrace [go] methods [thread]\n                          -- \u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C\u9000\u51FA\u3002\n                          -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\ntrace [go] method exit | exits [thread]\n                          -- \u8DDF\u8E2A\u5F53\u524D\u65B9\u6CD5\u7684\u9000\u51FA, \u6216\u8005\u6240\u6709\u65B9\u6CD5\u7684\u9000\u51FA\n                          -- \u9664\u975E\u6307\u5B9A 'go', \u5426\u5219\u6302\u8D77\u6240\u6709\u7EBF\u7A0B\nuntrace [methods]         -- \u505C\u6B62\u8DDF\u8E2A\u65B9\u6CD5\u8FDB\u5165\u548C/\u6216\u9000\u51FA\nstep                      -- \u6267\u884C\u5F53\u524D\u884C\nstep up                   -- \u4E00\u76F4\u6267\u884C, \u76F4\u5230\u5F53\u524D\u65B9\u6CD5\u8FD4\u56DE\u5230\u5176\u8C03\u7528\u65B9\nstepi                     -- \u6267\u884C\u5F53\u524D\u6307\u4EE4\n\u4E0B\u4E00\u6B65                      -- \u6B65\u8FDB\u4E00\u884C (\u6B65\u8FC7\u8C03\u7528)\ncont                      -- \u4ECE\u65AD\u70B9\u5904\u7EE7\u7EED\u6267\u884C\n\nlist [line number|method] -- \u8F93\u51FA\u6E90\u4EE3\u7801\nuse (\u6216 sourcepath) [source file path]\n                          -- \u663E\u793A\u6216\u66F4\u6539\u6E90\u8DEF\u5F84\nexclude [<class pattern>, ... | \"none\"]\n                          -- \u5BF9\u4E8E\u6307\u5B9A\u7684\u7C7B, \u4E0D\u62A5\u544A\u6B65\u9AA4\u6216\u65B9\u6CD5\u4E8B\u4EF6\nclasspath                 -- \u4ECE\u76EE\u6807 VM \u8F93\u51FA\u7C7B\u8DEF\u5F84\u4FE1\u606F\n\nmonitor <command>         -- \u6BCF\u6B21\u7A0B\u5E8F\u505C\u6B62\u65F6\u6267\u884C\u547D\u4EE4\nmonitor                   -- \u5217\u51FA\u76D1\u89C6\u5668\nunmonitor <monitor#>      -- \u5220\u9664\u76D1\u89C6\u5668\nread <filename>           -- \u8BFB\u53D6\u5E76\u6267\u884C\u547D\u4EE4\u6587\u4EF6\n\nlock <expr>               -- \u8F93\u51FA\u5BF9\u8C61\u7684\u9501\u4FE1\u606F\nthreadlocks [thread id]   -- \u8F93\u51FA\u7EBF\u7A0B\u7684\u9501\u4FE1\u606F\n\npop                       -- \u901A\u8FC7\u5F53\u524D\u5E27\u51FA\u6808, \u4E14\u5305\u542B\u5F53\u524D\u5E27\nreenter                   -- \u4E0E pop \u76F8\u540C, \u4F46\u91CD\u65B0\u8FDB\u5165\u5F53\u524D\u5E27\nredefine <class id> <class file name>\n                          -- \u91CD\u65B0\u5B9A\u4E49\u7C7B\u7684\u4EE3\u7801\n\ndisablegc <expr>          -- \u7981\u6B62\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\nenablegc <expr>           -- \u5141\u8BB8\u5BF9\u8C61\u7684\u5783\u573E\u6536\u96C6\n\n!!                        -- \u91CD\u590D\u6267\u884C\u6700\u540E\u4E00\u4E2A\u547D\u4EE4\n<n> <command>             -- \u5C06\u547D\u4EE4\u91CD\u590D\u6267\u884C n \u6B21\n# <command>               -- \u653E\u5F03 (\u65E0\u64CD\u4F5C)\nhelp (\u6216 ?)               -- \u5217\u51FA\u547D\u4EE4\nversion                   -- \u8F93\u51FA\u7248\u672C\u4FE1\u606F\nexit (\u6216 quit)            -- \u9000\u51FA\u8C03\u8BD5\u5668\n\n<class id>: \u5E26\u6709\u7A0B\u5E8F\u5305\u9650\u5B9A\u7B26\u7684\u5B8C\u6574\u7C7B\u540D\n<class pattern>: \u5E26\u6709\u524D\u5BFC\u6216\u5C3E\u968F\u901A\u914D\u7B26 ('*') \u7684\u7C7B\u540D\n<thread id>: 'threads' \u547D\u4EE4\u4E2D\u62A5\u544A\u7684\u7EBF\u7A0B\u7F16\u53F7\n<expr>: Java(TM) \u7F16\u7A0B\u8BED\u8A00\u8868\u8FBE\u5F0F\u3002\n\u652F\u6301\u5927\u591A\u6570\u5E38\u89C1\u8BED\u6CD5\u3002\n\n\u53EF\u4EE5\u5C06\u542F\u52A8\u547D\u4EE4\u7F6E\u4E8E \"jdb.ini\" \u6216 \".jdbrc\" \u4E2D\n\u4F4D\u4E8E user.home \u6216 user.dir \u4E2D"},
         {"zz usage text",
              "\u7528\u6CD5: {0} <options> <class> <arguments>\n\n\u5176\u4E2D, \u9009\u9879\u5305\u62EC:\n    -help             \u8F93\u51FA\u6B64\u6D88\u606F\u5E76\u9000\u51FA\n    -sourcepath <\u7531 \"{1}\" \u5206\u9694\u7684\u76EE\u5F55>\n                      \u8981\u5728\u5176\u4E2D\u67E5\u627E\u6E90\u6587\u4EF6\u7684\u76EE\u5F55\n    -attach <address>\n                      \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u9644\u52A0\u5230\u6307\u5B9A\u5730\u5740\u5904\u6B63\u5728\u8FD0\u884C\u7684 VM\n    -listen <address>\n                      \u7B49\u5F85\u6B63\u5728\u8FD0\u884C\u7684 VM \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u5728\u6307\u5B9A\u5730\u5740\u5904\u8FDE\u63A5\n    -listenany\n                      \u7B49\u5F85\u6B63\u5728\u8FD0\u884C\u7684 VM \u4F7F\u7528\u6807\u51C6\u8FDE\u63A5\u5668\u5728\u4EFB\u4F55\u53EF\u7528\u5730\u5740\u5904\u8FDE\u63A5\n    -launch\n                      \u7ACB\u5373\u542F\u52A8 VM \u800C\u4E0D\u662F\u7B49\u5F85 ''run'' \u547D\u4EE4\n    -listconnectors   \u5217\u51FA\u6B64 VM \u4E2D\u7684\u53EF\u7528\u8FDE\u63A5\u5668\n    -connect <connector-name>:<name1>=<value1>,...\n                      \u4F7F\u7528\u6240\u5217\u53C2\u6570\u503C\u901A\u8FC7\u6307\u5B9A\u7684\u8FDE\u63A5\u5668\u8FDE\u63A5\u5230\u76EE\u6807 VM\n    -dbgtrace [flags] \u8F93\u51FA\u4FE1\u606F\u4F9B\u8C03\u8BD5{0}\n    -tclient          \u5728 HotSpot(TM) \u5BA2\u6237\u673A\u7F16\u8BD1\u5668\u4E2D\u8FD0\u884C\u5E94\u7528\u7A0B\u5E8F\n    -tserver          \u5728 HotSpot(TM) \u670D\u52A1\u5668\u7F16\u8BD1\u5668\u4E2D\u8FD0\u884C\u5E94\u7528\u7A0B\u5E8F\n\n\u8F6C\u53D1\u5230\u88AB\u8C03\u8BD5\u8FDB\u7A0B\u7684\u9009\u9879:\n    -v -verbose[:class|gc|jni]\n                      \u542F\u7528\u8BE6\u7EC6\u6A21\u5F0F\n    -D<name>=<value>  \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n    -classpath <\u7531 \"{1}\" \u5206\u9694\u7684\u76EE\u5F55>\n                      \u5217\u51FA\u8981\u5728\u5176\u4E2D\u67E5\u627E\u7C7B\u7684\u76EE\u5F55\n    -X<option>        \u975E\u6807\u51C6\u76EE\u6807 VM \u9009\u9879\n\n<class> \u662F\u8981\u5F00\u59CB\u8C03\u8BD5\u7684\u7C7B\u7684\u540D\u79F0\n<arguments> \u662F\u4F20\u9012\u5230 <class> \u7684 main() \u65B9\u6CD5\u7684\u53C2\u6570\n\n\u8981\u83B7\u5F97\u547D\u4EE4\u7684\u5E2E\u52A9, \u8BF7\u5728{0}\u63D0\u793A\u4E0B\u952E\u5165 ''help''"},
         // END OF MATERIAL TO LOCALIZE
--- a/jdk/src/share/classes/java/awt/Component.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/awt/Component.java	Wed May 08 10:10:05 2013 +0100
@@ -1051,11 +1051,11 @@
         return parent;
     }
 
-    // This method is overriden in the Window class to return null,
+    // This method is overridden in the Window class to return null,
     //    because the parent field of the Window object contains
     //    the owner of the window, not its parent.
     Container getContainer() {
-        return getParent();
+        return getParent_NoClientCode();
     }
 
     /**
@@ -8194,10 +8194,10 @@
      * Fetches the native container somewhere higher up in the component
      * tree that contains this component.
      */
-    Container getNativeContainer() {
-        Container p = parent;
+    final Container getNativeContainer() {
+        Container p = getContainer();
         while (p != null && p.peer instanceof LightweightPeer) {
-            p = p.getParent_NoClientCode();
+            p = p.getContainer();
         }
         return p;
     }
--- a/jdk/src/share/classes/java/awt/Window.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/awt/Window.java	Wed May 08 10:10:05 2013 +0100
@@ -3914,7 +3914,7 @@
 
     // ************************** MIXING CODE *******************************
 
-    // A window has a parent, but it does NOT have a container
+    // A window has an owner, but it does NOT have a container
     @Override
     final Container getContainer() {
         return null;
--- a/jdk/src/share/classes/java/beans/MetaData.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/beans/MetaData.java	Wed May 08 10:10:05 2013 +0100
@@ -69,8 +69,9 @@
  * @author Philip Milne
  * @author Steve Langley
  */
+class MetaData {
 
-class NullPersistenceDelegate extends PersistenceDelegate {
+static final class NullPersistenceDelegate extends PersistenceDelegate {
     // Note this will be called by all classes when they reach the
     // top of their superclass chain.
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
@@ -87,7 +88,7 @@
  *
  * @author Sergey A. Malenkov
  */
-class EnumPersistenceDelegate extends PersistenceDelegate {
+static final class EnumPersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance == newInstance;
     }
@@ -98,7 +99,7 @@
     }
 }
 
-class PrimitivePersistenceDelegate extends PersistenceDelegate {
+static final class PrimitivePersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -109,7 +110,7 @@
     }
 }
 
-class ArrayPersistenceDelegate extends PersistenceDelegate {
+static final class ArrayPersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return (newInstance != null &&
                 oldInstance.getClass() == newInstance.getClass() && // Also ensures the subtype is correct.
@@ -150,7 +151,7 @@
     }
 }
 
-class ProxyPersistenceDelegate extends PersistenceDelegate {
+static final class ProxyPersistenceDelegate extends PersistenceDelegate {
     protected Expression instantiate(Object oldInstance, Encoder out) {
         Class<?> type = oldInstance.getClass();
         java.lang.reflect.Proxy p = (java.lang.reflect.Proxy)oldInstance;
@@ -185,7 +186,7 @@
 }
 
 // Strings
-class java_lang_String_PersistenceDelegate extends PersistenceDelegate {
+static final class java_lang_String_PersistenceDelegate extends PersistenceDelegate {
     protected Expression instantiate(Object oldInstance, Encoder out) { return null; }
 
     public void writeObject(Object oldInstance, Encoder out) {
@@ -194,7 +195,7 @@
 }
 
 // Classes
-class java_lang_Class_PersistenceDelegate extends PersistenceDelegate {
+static final class java_lang_Class_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -228,7 +229,7 @@
 }
 
 // Fields
-class java_lang_reflect_Field_PersistenceDelegate extends PersistenceDelegate {
+static final class java_lang_reflect_Field_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -243,7 +244,7 @@
 }
 
 // Methods
-class java_lang_reflect_Method_PersistenceDelegate extends PersistenceDelegate {
+static final class java_lang_reflect_Method_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -267,7 +268,7 @@
  *
  * @author Sergey A. Malenkov
  */
-class java_util_Date_PersistenceDelegate extends PersistenceDelegate {
+static class java_util_Date_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         if (!super.mutatesTo(oldInstance, newInstance)) {
             return false;
@@ -290,7 +291,7 @@
  *
  * @author Sergey A. Malenkov
  */
-final class java_sql_Timestamp_PersistenceDelegate extends java_util_Date_PersistenceDelegate {
+static final class java_sql_Timestamp_PersistenceDelegate extends java_util_Date_PersistenceDelegate {
     private static final Method getNanosMethod = getNanosMethod();
 
     private static Method getNanosMethod() {
@@ -354,7 +355,7 @@
  *
  * @author Sergey A. Malenkov
  */
-abstract class java_util_Collections extends PersistenceDelegate {
+private static abstract class java_util_Collections extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         if (!super.mutatesTo(oldInstance, newInstance)) {
             return false;
@@ -367,6 +368,10 @@
         return (oldC.size() == newC.size()) && oldC.containsAll(newC);
     }
 
+    protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
+        // do not initialize these custom collections in default way
+    }
+
     static final class EmptyList_PersistenceDelegate extends java_util_Collections {
         protected Expression instantiate(Object oldInstance, Encoder out) {
             return new Expression(oldInstance, Collections.class, "emptyList", null);
@@ -569,7 +574,7 @@
  *
  * @author Sergey A. Malenkov
  */
-class java_util_EnumMap_PersistenceDelegate extends PersistenceDelegate {
+static final class java_util_EnumMap_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return super.mutatesTo(oldInstance, newInstance) && (getType(oldInstance) == getType(newInstance));
     }
@@ -588,7 +593,7 @@
  *
  * @author Sergey A. Malenkov
  */
-class java_util_EnumSet_PersistenceDelegate extends PersistenceDelegate {
+static final class java_util_EnumSet_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return super.mutatesTo(oldInstance, newInstance) && (getType(oldInstance) == getType(newInstance));
     }
@@ -603,7 +608,7 @@
 }
 
 // Collection
-class java_util_Collection_PersistenceDelegate extends DefaultPersistenceDelegate {
+static class java_util_Collection_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         java.util.Collection<?> oldO = (java.util.Collection)oldInstance;
         java.util.Collection<?> newO = (java.util.Collection)newInstance;
@@ -618,7 +623,7 @@
 }
 
 // List
-class java_util_List_PersistenceDelegate extends DefaultPersistenceDelegate {
+static class java_util_List_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         java.util.List<?> oldO = (java.util.List<?>)oldInstance;
         java.util.List<?> newO = (java.util.List<?>)newInstance;
@@ -653,7 +658,7 @@
 
 
 // Map
-class java_util_Map_PersistenceDelegate extends DefaultPersistenceDelegate {
+static class java_util_Map_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         // System.out.println("Initializing: " + newInstance);
         java.util.Map<?,?> oldMap = (java.util.Map)oldInstance;
@@ -691,14 +696,14 @@
     }
 }
 
-class java_util_AbstractCollection_PersistenceDelegate extends java_util_Collection_PersistenceDelegate {}
-class java_util_AbstractList_PersistenceDelegate extends java_util_List_PersistenceDelegate {}
-class java_util_AbstractMap_PersistenceDelegate extends java_util_Map_PersistenceDelegate {}
-class java_util_Hashtable_PersistenceDelegate extends java_util_Map_PersistenceDelegate {}
+static final class java_util_AbstractCollection_PersistenceDelegate extends java_util_Collection_PersistenceDelegate {}
+static final class java_util_AbstractList_PersistenceDelegate extends java_util_List_PersistenceDelegate {}
+static final class java_util_AbstractMap_PersistenceDelegate extends java_util_Map_PersistenceDelegate {}
+static final class java_util_Hashtable_PersistenceDelegate extends java_util_Map_PersistenceDelegate {}
 
 
 // Beans
-class java_beans_beancontext_BeanContextSupport_PersistenceDelegate extends java_util_Collection_PersistenceDelegate {}
+static final class java_beans_beancontext_BeanContextSupport_PersistenceDelegate extends java_util_Collection_PersistenceDelegate {}
 
 // AWT
 
@@ -709,7 +714,7 @@
  *
  * @author Sergey A. Malenkov
  */
-final class java_awt_Insets_PersistenceDelegate extends PersistenceDelegate {
+static final class java_awt_Insets_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -733,7 +738,7 @@
  *
  * @author Sergey A. Malenkov
  */
-final class java_awt_Font_PersistenceDelegate extends PersistenceDelegate {
+static final class java_awt_Font_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -802,7 +807,7 @@
  *
  * @author Sergey A. Malenkov
  */
-final class java_awt_AWTKeyStroke_PersistenceDelegate extends PersistenceDelegate {
+static final class java_awt_AWTKeyStroke_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -843,7 +848,7 @@
     }
 }
 
-class StaticFieldsPersistenceDelegate extends PersistenceDelegate {
+static class StaticFieldsPersistenceDelegate extends PersistenceDelegate {
     protected void installFields(Encoder out, Class<?> cls) {
         Field fields[] = cls.getFields();
         for(int i = 0; i < fields.length; i++) {
@@ -870,13 +875,13 @@
 }
 
 // SystemColor
-class java_awt_SystemColor_PersistenceDelegate extends StaticFieldsPersistenceDelegate {}
+static final class java_awt_SystemColor_PersistenceDelegate extends StaticFieldsPersistenceDelegate {}
 
 // TextAttribute
-class java_awt_font_TextAttribute_PersistenceDelegate extends StaticFieldsPersistenceDelegate {}
+static final class java_awt_font_TextAttribute_PersistenceDelegate extends StaticFieldsPersistenceDelegate {}
 
 // MenuShortcut
-class java_awt_MenuShortcut_PersistenceDelegate extends PersistenceDelegate {
+static final class java_awt_MenuShortcut_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -889,7 +894,7 @@
 }
 
 // Component
-class java_awt_Component_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_Component_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         java.awt.Component c = (java.awt.Component)oldInstance;
@@ -936,7 +941,7 @@
 }
 
 // Container
-class java_awt_Container_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_Container_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         // Ignore the children of a JScrollPane.
@@ -971,7 +976,7 @@
 }
 
 // Choice
-class java_awt_Choice_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_Choice_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         java.awt.Choice m = (java.awt.Choice)oldInstance;
@@ -983,7 +988,7 @@
 }
 
 // Menu
-class java_awt_Menu_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_Menu_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         java.awt.Menu m = (java.awt.Menu)oldInstance;
@@ -995,7 +1000,7 @@
 }
 
 // MenuBar
-class java_awt_MenuBar_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_MenuBar_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         java.awt.MenuBar m = (java.awt.MenuBar)oldInstance;
@@ -1007,7 +1012,7 @@
 }
 
 // List
-class java_awt_List_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_List_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         java.awt.List m = (java.awt.List)oldInstance;
@@ -1022,7 +1027,7 @@
 // LayoutManagers
 
 // BorderLayout
-class java_awt_BorderLayout_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_BorderLayout_PersistenceDelegate extends DefaultPersistenceDelegate {
     private static final String[] CONSTRAINTS = {
             BorderLayout.NORTH,
             BorderLayout.SOUTH,
@@ -1053,41 +1058,44 @@
 }
 
 // CardLayout
-class java_awt_CardLayout_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_CardLayout_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance,
                               Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
-        Hashtable<?,?> tab = (Hashtable<?,?>)ReflectionUtils.getPrivateField(oldInstance,
-                                                                   java.awt.CardLayout.class,
-                                                                   "tab",
-                                                                   out.getExceptionListener());
-        if (tab != null) {
-            for(Enumeration<?> e = tab.keys(); e.hasMoreElements();) {
-                Object child = e.nextElement();
-                invokeStatement(oldInstance, "addLayoutComponent",
-                                new Object[]{child, (String)tab.get(child)}, out);
+        if (getVector(newInstance).isEmpty()) {
+            for (Object card : getVector(oldInstance)) {
+                Object[] args = {MetaData.getPrivateFieldValue(card, "java.awt.CardLayout$Card.name"),
+                                 MetaData.getPrivateFieldValue(card, "java.awt.CardLayout$Card.comp")};
+                invokeStatement(oldInstance, "addLayoutComponent", args, out);
             }
         }
     }
+    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+        return super.mutatesTo(oldInstance, newInstance) && getVector(newInstance).isEmpty();
+    }
+    private static Vector<?> getVector(Object instance) {
+        return (Vector<?>) MetaData.getPrivateFieldValue(instance, "java.awt.CardLayout.vector");
+    }
 }
 
 // GridBagLayout
-class java_awt_GridBagLayout_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class java_awt_GridBagLayout_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance,
                               Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
-        Hashtable<?,?> comptable = (Hashtable<?,?>)ReflectionUtils.getPrivateField(oldInstance,
-                                                 java.awt.GridBagLayout.class,
-                                                 "comptable",
-                                                 out.getExceptionListener());
-        if (comptable != null) {
-            for(Enumeration<?> e = comptable.keys(); e.hasMoreElements();) {
-                Object child = e.nextElement();
-                invokeStatement(oldInstance, "addLayoutComponent",
-                                new Object[]{child, comptable.get(child)}, out);
+        if (getHashtable(newInstance).isEmpty()) {
+            for (Map.Entry<?,?> entry : getHashtable(oldInstance).entrySet()) {
+                Object[] args = {entry.getKey(), entry.getValue()};
+                invokeStatement(oldInstance, "addLayoutComponent", args, out);
             }
         }
     }
+    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+        return super.mutatesTo(oldInstance, newInstance) && getHashtable(newInstance).isEmpty();
+    }
+    private static Hashtable<?,?> getHashtable(Object instance) {
+        return (Hashtable<?,?>) MetaData.getPrivateFieldValue(instance, "java.awt.GridBagLayout.comptable");
+    }
 }
 
 // Swing
@@ -1095,7 +1103,7 @@
 // JFrame (If we do this for Window instead of JFrame, the setVisible call
 // will be issued before we have added all the children to the JFrame and
 // will appear blank).
-class javax_swing_JFrame_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class javax_swing_JFrame_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         java.awt.Window oldC = (java.awt.Window)oldInstance;
@@ -1115,7 +1123,7 @@
 // Models
 
 // DefaultListModel
-class javax_swing_DefaultListModel_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class javax_swing_DefaultListModel_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         // Note, the "size" property will be set here.
         super.initialize(type, oldInstance, newInstance, out);
@@ -1129,7 +1137,7 @@
 }
 
 // DefaultComboBoxModel
-class javax_swing_DefaultComboBoxModel_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class javax_swing_DefaultComboBoxModel_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         javax.swing.DefaultComboBoxModel<?> m = (javax.swing.DefaultComboBoxModel<?>)oldInstance;
@@ -1141,7 +1149,7 @@
 
 
 // DefaultMutableTreeNode
-class javax_swing_tree_DefaultMutableTreeNode_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class javax_swing_tree_DefaultMutableTreeNode_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object
                               newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
@@ -1157,7 +1165,7 @@
 }
 
 // ToolTipManager
-class javax_swing_ToolTipManager_PersistenceDelegate extends PersistenceDelegate {
+static final class javax_swing_ToolTipManager_PersistenceDelegate extends PersistenceDelegate {
     protected Expression instantiate(Object oldInstance, Encoder out) {
         return new Expression(oldInstance, javax.swing.ToolTipManager.class,
                               "sharedInstance", new Object[]{});
@@ -1165,7 +1173,7 @@
 }
 
 // JTabbedPane
-class javax_swing_JTabbedPane_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class javax_swing_JTabbedPane_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         javax.swing.JTabbedPane p = (javax.swing.JTabbedPane)oldInstance;
@@ -1180,7 +1188,7 @@
 }
 
 // Box
-class javax_swing_Box_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class javax_swing_Box_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return super.mutatesTo(oldInstance, newInstance) && getAxis(oldInstance).equals(getAxis(newInstance));
     }
@@ -1201,7 +1209,7 @@
 // Container will return all of the sub menu items that
 // need to be added to the menu item.
 // Not so for JMenu apparently.
-class javax_swing_JMenu_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class javax_swing_JMenu_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         javax.swing.JMenu m = (javax.swing.JMenu)oldInstance;
@@ -1219,7 +1227,7 @@
  *
  * @author Sergey A. Malenkov
  */
-final class javax_swing_border_MatteBorder_PersistenceDelegate extends PersistenceDelegate {
+static final class javax_swing_border_MatteBorder_PersistenceDelegate extends PersistenceDelegate {
     protected Expression instantiate(Object oldInstance, Encoder out) {
         MatteBorder border = (MatteBorder) oldInstance;
         Insets insets = border.getBorderInsets();
@@ -1239,7 +1247,7 @@
 }
 
 /* XXX - doens't seem to work. Debug later.
-class javax_swing_JMenu_PersistenceDelegate extends DefaultPersistenceDelegate {
+static final class javax_swing_JMenu_PersistenceDelegate extends DefaultPersistenceDelegate {
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
         super.initialize(type, oldInstance, newInstance, out);
         javax.swing.JMenu m = (javax.swing.JMenu)oldInstance;
@@ -1261,7 +1269,7 @@
  *
  * @author Sergey A. Malenkov
  */
-final class sun_swing_PrintColorUIResource_PersistenceDelegate extends PersistenceDelegate {
+static final class sun_swing_PrintColorUIResource_PersistenceDelegate extends PersistenceDelegate {
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         return oldInstance.equals(newInstance);
     }
@@ -1273,7 +1281,6 @@
     }
 }
 
-class MetaData {
     private static final Map<String,Field> fields = Collections.synchronizedMap(new WeakHashMap<String, Field>());
     private static Hashtable<String, PersistenceDelegate> internalPersistenceDelegates = new Hashtable<>();
 
@@ -1316,7 +1323,7 @@
         if (Enum.class.isAssignableFrom(type)) {
             return enumPersistenceDelegate;
         }
-        if (ReflectionUtils.isPrimitive(type)) {
+        if (null != XMLEncoder.primitiveTypeFor(type)) {
             return primitivePersistenceDelegate;
         }
         // The persistence delegate for arrays is non-trivial; instantiate it lazily.
@@ -1350,7 +1357,7 @@
             internalPersistenceDelegates.put(typeName, defaultPersistenceDelegate);
             try {
                 String name =  type.getName();
-                Class c = Class.forName("java.beans." + name.replace('.', '_')
+                Class c = Class.forName("java.beans.MetaData$" + name.replace('.', '_')
                                         + "_PersistenceDelegate");
                 pd = (PersistenceDelegate)c.newInstance();
                 internalPersistenceDelegates.put(typeName, pd);
--- a/jdk/src/share/classes/java/beans/ReflectionUtils.java	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2003, 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.  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 java.beans;
-
-import java.lang.reflect.Field;
-
-/**
- * A utility class for reflectively finding methods, constuctors and fields
- * using reflection.
- */
-class ReflectionUtils {
-
-    @SuppressWarnings("rawtypes")
-    public static boolean isPrimitive(Class type) {
-        return primitiveTypeFor(type) != null;
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static Class primitiveTypeFor(Class wrapper) {
-        if (wrapper == Boolean.class) return Boolean.TYPE;
-        if (wrapper == Byte.class) return Byte.TYPE;
-        if (wrapper == Character.class) return Character.TYPE;
-        if (wrapper == Short.class) return Short.TYPE;
-        if (wrapper == Integer.class) return Integer.TYPE;
-        if (wrapper == Long.class) return Long.TYPE;
-        if (wrapper == Float.class) return Float.TYPE;
-        if (wrapper == Double.class) return Double.TYPE;
-        if (wrapper == Void.class) return Void.TYPE;
-        return null;
-    }
-
-    /**
-     * Returns the value of a private field.
-     *
-     * @param instance object instance
-     * @param cls class
-     * @param name name of the field
-     * @param el an exception listener to handle exceptions; or null
-     * @return value of the field; null if not found or an error is encountered
-     */
-    @SuppressWarnings("rawtypes")
-    public static Object getPrivateField(Object instance, Class cls,
-                                         String name, ExceptionListener el) {
-        try {
-            Field f = cls.getDeclaredField(name);
-            f.setAccessible(true);
-            return f.get(instance);
-        }
-        catch (Exception e) {
-            if (el != null) {
-                el.exceptionThrown(e);
-            }
-        }
-        return null;
-    }
-}
--- a/jdk/src/share/classes/java/beans/XMLEncoder.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/beans/XMLEncoder.java	Wed May 08 10:10:05 2013 +0100
@@ -604,7 +604,7 @@
                 return;
             }
 
-            Class<?> primitiveType = ReflectionUtils.primitiveTypeFor(value.getClass());
+            Class<?> primitiveType = primitiveTypeFor(value.getClass());
             if (primitiveType != null && target == value.getClass() &&
                 methodName.equals("new")) {
                 String primitiveTypeName = primitiveType.getName();
@@ -778,4 +778,18 @@
         indentation--;
         writeln("</" + tag + ">");
     }
+
+    @SuppressWarnings("rawtypes")
+    static Class primitiveTypeFor(Class wrapper) {
+        if (wrapper == Boolean.class) return Boolean.TYPE;
+        if (wrapper == Byte.class) return Byte.TYPE;
+        if (wrapper == Character.class) return Character.TYPE;
+        if (wrapper == Short.class) return Short.TYPE;
+        if (wrapper == Integer.class) return Integer.TYPE;
+        if (wrapper == Long.class) return Long.TYPE;
+        if (wrapper == Float.class) return Float.TYPE;
+        if (wrapper == Double.class) return Double.TYPE;
+        if (wrapper == Void.class) return Void.TYPE;
+        return null;
+    }
 }
--- a/jdk/src/share/classes/java/lang/CharSequence.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/lang/CharSequence.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,13 @@
 
 package java.lang;
 
+import java.util.NoSuchElementException;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.IntConsumer;
+import java.util.stream.IntStream;
+import java.util.stream.StreamSupport;
 
 /**
  * A <tt>CharSequence</tt> is a readable sequence of <code>char</code> values. This
@@ -108,4 +115,95 @@
      */
     public String toString();
 
+    /**
+     * Returns a stream of {@code int} zero-extending the {@code char} values
+     * from this sequence.  Any char which maps to a <a
+     * href="{@docRoot}/java/lang/Character.html#unicode">surrogate code
+     * point</a> is passed through uninterpreted.
+     *
+     * <p>If the sequence is mutated while the stream is being read, the
+     * result is undefined.
+     *
+     * @return an IntStream of char values from this sequence
+     * @since 1.8
+     */
+    public default IntStream chars() {
+        class CharIterator implements PrimitiveIterator.OfInt {
+            int cur = 0;
+
+            public boolean hasNext() {
+                return cur < length();
+            }
+
+            public int nextInt() {
+                if (hasNext()) {
+                    return charAt(cur++);
+                } else {
+                    throw new NoSuchElementException();
+                }
+            }
+
+            @Override
+            public void forEachRemaining(IntConsumer block) {
+                for (; cur < length(); cur++) {
+                    block.accept(charAt(cur));
+                }
+            }
+        }
+
+        return StreamSupport.intStream(() ->
+                Spliterators.spliterator(
+                        new CharIterator(),
+                        length(),
+                        Spliterator.ORDERED),
+                Spliterator.SUBSIZED | Spliterator.SIZED | Spliterator.ORDERED);
+    }
+
+    /**
+     * Returns a stream of code point values from this sequence.  Any surrogate
+     * pairs encountered in the sequence are combined as if by {@linkplain
+     * Character#toCodePoint Character.toCodePoint} and the result is passed
+     * to the stream. Any other code units, including ordinary BMP characters,
+     * unpaired surrogates, and undefined code units, are zero-extended to
+     * {@code int} values which are then passed to the stream.
+     *
+     * <p>If the sequence is mutated while the stream is being read, the result
+     * is undefined.
+     *
+     * @return an IntStream of Unicode code points from this sequence
+     * @since 1.8
+     */
+    public default IntStream codePoints() {
+        class CodePointIterator implements PrimitiveIterator.OfInt {
+            int cur = 0;
+
+            @Override
+            public void forEachRemaining(IntConsumer block) {
+                while (cur < length()) {
+                    int cp = Character.codePointAt(CharSequence.this, cur);
+                    cur += Character.charCount(cp);
+                    block.accept(cp);
+                }
+            }
+
+            public boolean hasNext() {
+                return cur < length();
+            }
+
+            public int nextInt() {
+                if (!hasNext()) {
+                    throw new NoSuchElementException();
+                }
+                int cp = Character.codePointAt(CharSequence.this, cur);
+                cur += Character.charCount(cp);
+                return cp;
+            }
+        }
+
+        return StreamSupport.intStream(() ->
+                Spliterators.spliteratorUnknownSize(
+                        new CodePointIterator(),
+                        Spliterator.ORDERED),
+                Spliterator.SUBSIZED | Spliterator.SIZED | Spliterator.ORDERED);
+    }
 }
--- a/jdk/src/share/classes/java/lang/String.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/lang/String.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 import java.util.Formatter;
 import java.util.Locale;
 import java.util.Objects;
+import java.util.StringJoiner;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
@@ -131,7 +132,7 @@
      * string instance within the stream.
      */
     private static final ObjectStreamField[] serialPersistentFields =
-            new ObjectStreamField[0];
+        new ObjectStreamField[0];
 
     /**
      * Initializes a newly created {@code String} object so that it represents
@@ -970,7 +971,7 @@
             return true;
         }
         if (anObject instanceof String) {
-            String anotherString = (String) anObject;
+            String anotherString = (String)anObject;
             int n = value.length;
             if (n == anotherString.value.length) {
                 char v1[] = value;
@@ -978,7 +979,7 @@
                 int i = 0;
                 while (n-- != 0) {
                     if (v1[i] != v2[i])
-                            return false;
+                        return false;
                     i++;
                 }
                 return true;
@@ -1003,7 +1004,7 @@
      * @since  1.4
      */
     public boolean contentEquals(StringBuffer sb) {
-        return contentEquals((CharSequence) sb);
+        return contentEquals((CharSequence)sb);
     }
 
     private boolean nonSyncContentEquals(AbstractStringBuilder sb) {
@@ -1248,7 +1249,8 @@
      * argument.
      * <li>There is some nonnegative integer <i>k</i> less than {@code len}
      * such that:
-     * <code>this.charAt(toffset+<i>k</i>)&nbsp;!=&nbsp;other.charAt(ooffset+<i>k</i>)</code>
+     * {@code this.charAt(toffset + }<i>k</i>{@code ) != other.charAt(ooffset + }
+     * <i>k</i>{@code )}
      * </ul>
      *
      * @param   toffset   the starting offset of the subregion in this string.
@@ -1872,7 +1874,7 @@
         int min = sourceOffset + targetCount - 1;
         int i = min + fromIndex;
 
-        startSearchForLastChar:
+    startSearchForLastChar:
         while (true) {
             while (i >= min && source[i] != strLastChar) {
                 i--;
@@ -1973,7 +1975,7 @@
      * str.substring(begin,&nbsp;end)</pre></blockquote>
      *
      * This method is defined so that the {@code String} class can implement
-     * the {@link CharSequence} interface. </p>
+     * the {@link CharSequence} interface.
      *
      * @param   beginIndex   the begin index, inclusive.
      * @param   endIndex     the end index, exclusive.
@@ -2352,9 +2354,11 @@
 
             // Construct result
             int resultSize = list.size();
-            if (limit == 0)
-                while (resultSize > 0 && list.get(resultSize - 1).length() == 0)
+            if (limit == 0) {
+                while (resultSize > 0 && list.get(resultSize - 1).length() == 0) {
                     resultSize--;
+                }
+            }
             String[] result = new String[resultSize];
             return list.subList(0, resultSize).toArray(result);
         }
@@ -2404,6 +2408,90 @@
     }
 
     /**
+     * Returns a new String composed of copies of the
+     * {@code CharSequence elements} joined together with a copy of
+     * the specified {@code delimiter}.
+     *
+     * <blockquote>For example,
+     * <pre>{@code
+     *     String message = String.join("-", "Java", "is", "cool");
+     *     // message returned is: "Java-is-cool"
+     * }</pre></blockquote>
+     *
+     * Note that if an element is null, then {@code "null"} is added.
+     *
+     * @param  delimiter the delimiter that separates each element
+     * @param  elements the elements to join together.
+     *
+     * @return a new {@code String} that is composed of the {@code elements}
+     *         separated by the {@code delimiter}
+     *
+     * @throws NullPointerException If {@code delimiter} or {@code elements}
+     *         is {@code null}
+     *
+     * @see java.util.StringJoiner
+     * @since 1.8
+     */
+    public static String join(CharSequence delimiter, CharSequence... elements) {
+        Objects.requireNonNull(delimiter);
+        Objects.requireNonNull(elements);
+        // Number of elements not likely worth Arrays.stream overhead.
+        StringJoiner joiner = new StringJoiner(delimiter);
+        for (CharSequence cs: elements) {
+            joiner.add(cs);
+        }
+        return joiner.toString();
+    }
+
+    /**
+     * Returns a new {@code String} composed of copies of the
+     * {@code CharSequence elements} joined together with a copy of the
+     * specified {@code delimiter}.
+     *
+     * <blockquote>For example,
+     * <pre>{@code
+     *     List<String> strings = new LinkedList<>();
+     *     strings.add("Java");strings.add("is");
+     *     strings.add("cool");
+     *     String message = String.join(" ", strings);
+     *     //message returned is: "Java is cool"
+     *
+     *     Set<String> strings = new HashSet<>();
+     *     Strings.add("Java"); strings.add("is");
+     *     strings.add("very"); strings.add("cool");
+     *     String message = String.join("-", strings);
+     *     //message returned is: "Java-is-very-cool"
+     * }</pre></blockquote>
+     *
+     * Note that if an individual element is {@code null}, then {@code "null"} is added.
+     *
+     * @param  delimiter a sequence of characters that is used to separate each
+     *         of the {@code elements} in the resulting {@code String}
+     * @param  elements an {@code Iterable} that will have its {@code elements}
+     *         joined together.
+     *
+     * @return a new {@code String} that is composed from the {@code elements}
+     *         argument
+     *
+     * @throws NullPointerException If {@code delimiter} or {@code elements}
+     *         is {@code null}
+     *
+     * @see    #join(CharSequence,CharSequence...)
+     * @see    java.util.StringJoiner
+     * @since 1.8
+     */
+    public static String join(CharSequence delimiter,
+            Iterable<? extends CharSequence> elements) {
+        Objects.requireNonNull(delimiter);
+        Objects.requireNonNull(elements);
+        StringJoiner joiner = new StringJoiner(delimiter);
+        for (CharSequence cs: elements) {
+            joiner.add(cs);
+        }
+        return joiner.toString();
+    }
+
+    /**
      * Converts all of the characters in this {@code String} to lower
      * case using the rules of the given {@code Locale}.  Case mapping is based
      * on the Unicode Standard version specified by the {@link java.lang.Character Character}
@@ -2650,9 +2738,9 @@
             return this;
         }
 
+        /* result may grow, so i+resultOffset is the write location in result */
+        int resultOffset = 0;
         char[] result = new char[len]; /* may grow */
-        int resultOffset = 0;  /* result may grow, so i+resultOffset
-         * is the write location in result */
 
         /* Just copy the first few upperCase characters. */
         System.arraycopy(value, 0, result, 0, firstLower);
@@ -2757,7 +2845,7 @@
      * object is created, representing the substring of this string that
      * begins with the character at index <i>k</i> and ends with the
      * character at index <i>m</i>-that is, the result of
-     * <code>this.substring(<i>k</i>,&nbsp;<i>m</i>+1)</code>.
+     * {@code this.substring(k, m + 1)}.
      * <p>
      * This method may be used to trim whitespace (as defined above) from
      * the beginning and end of a string.
@@ -3143,8 +3231,8 @@
     *     programmer should be aware that producing distinct integer results
     *     for unequal objects may improve the performance of hash tables.
     * </ul>
-    * </p>
-     * The hash value will never be zero.
+    *
+    * The hash value will never be zero.
     *
     * @return  a hash code value for this object.
     * @see     java.lang.Object#equals(java.lang.Object)
--- a/jdk/src/share/classes/java/lang/Throwable.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/lang/Throwable.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -453,9 +453,10 @@
      */
     public synchronized Throwable initCause(Throwable cause) {
         if (this.cause != this)
-            throw new IllegalStateException("Can't overwrite cause");
+            throw new IllegalStateException("Can't overwrite cause with " +
+                                            Objects.toString(cause, "a null"), this);
         if (cause == this)
-            throw new IllegalArgumentException("Self-causation not permitted");
+            throw new IllegalArgumentException("Self-causation not permitted", this);
         this.cause = cause;
         return this;
     }
@@ -1039,7 +1040,7 @@
      */
     public final synchronized void addSuppressed(Throwable exception) {
         if (exception == this)
-            throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
+            throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE, exception);
 
         if (exception == null)
             throw new NullPointerException(NULL_CAUSE_MESSAGE);
--- a/jdk/src/share/classes/java/lang/reflect/Executable.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/lang/reflect/Executable.java	Wed May 08 10:10:05 2013 +0100
@@ -237,8 +237,8 @@
     public abstract Class<?>[] getParameterTypes();
 
     /**
-     * Returns the number of formal parameters (including any
-     * synthetic or synthesized parameters) for the executable
+     * Returns the number of formal parameters (whether explicitly
+     * declared or implicitly declared or neither) for the executable
      * represented by this object.
      *
      * @return The number of formal parameters for the executable this
--- a/jdk/src/share/classes/java/lang/reflect/Parameter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java	Wed May 08 10:10:05 2013 +0100
@@ -148,19 +148,15 @@
     }
 
     /**
-     * Returns the name of the parameter.  The names of the parameters
-     * of a single executable must all the be distinct.  When names
-     * from the originating source are available, they are returned.
-     * Otherwise, an implementation of this method is free to create a
-     * name of this parameter, subject to the unquiness requirments.
+     * Returns the name of the parameter.  If the parameter's name is
+     * defined in a class file, then that name will be returned by
+     * this method.  Otherwise, this method will synthesize a name of
+     * the form argN, where N is the index of the parameter.
      */
     public String getName() {
-        // As per the spec, if a parameter has no name, return argX,
-        // where x is the index.
-        //
-        // Note: spec updates now outlaw empty strings as parameter
-        // names.  The .equals("") is for compatibility with current
-        // JVM behavior.  It may be removed at some point.
+        // Note: empty strings as paramete names are now outlawed.
+        // The .equals("") is for compatibility with current JVM
+        // behavior.  It may be removed at some point.
         if(name == null || name.equals(""))
             return "arg" + index;
         else
@@ -311,6 +307,6 @@
                 declaredAnnotations.put(ann[i].annotationType(), ann[i]);
         }
         return declaredAnnotations;
-    }
+   }
 
 }
--- a/jdk/src/share/classes/java/lang/reflect/Proxy.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/lang/reflect/Proxy.java	Wed May 08 10:10:05 2013 +0100
@@ -25,18 +25,14 @@
 
 package java.lang.reflect;
 
-import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
+import java.util.IdentityHashMap;
 import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.WeakHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.BiFunction;
 import sun.misc.ProxyGenerator;
 import sun.misc.VM;
 import sun.reflect.CallerSensitive;
@@ -232,27 +228,15 @@
 
     private static final long serialVersionUID = -2222568056686623797L;
 
-    /** prefix for all proxy class names */
-    private final static String proxyClassNamePrefix = "$Proxy";
-
     /** parameter types of a proxy class constructor */
-    private final static Class[] constructorParams =
+    private static final Class<?>[] constructorParams =
         { InvocationHandler.class };
 
-    /** maps a class loader to the proxy class cache for that loader */
-    private static Map<ClassLoader, Map<List<String>, Object>> loaderToCache
-        = new WeakHashMap<>();
-
-    /** marks that a particular proxy class is currently being generated */
-    private static Object pendingGenerationMarker = new Object();
-
-    /** next number to use for generation of unique proxy class names */
-    private static long nextUniqueNumber = 0;
-    private static Object nextUniqueNumberLock = new Object();
-
-    /** set of all generated proxy classes, for isProxyClass implementation */
-    private static Map<Class<?>, Void> proxyClasses =
-        Collections.synchronizedMap(new WeakHashMap<Class<?>, Void>());
+    /**
+     * a cache of proxy classes
+     */
+    private static final WeakCache<ClassLoader, Class<?>[], Class<?>>
+        proxyClassCache = new WeakCache<>(new KeyFactory(), new ProxyClassFactory());
 
     /**
      * the invocation handler for this proxy instance.
@@ -423,131 +407,190 @@
             throw new IllegalArgumentException("interface limit exceeded");
         }
 
-        Class<?> proxyClass = null;
+        // If the proxy class defined by the given loader implementing
+        // the given interfaces exists, this will simply return the cached copy;
+        // otherwise, it will create the proxy class via the ProxyClassFactory
+        return proxyClassCache.get(loader, interfaces);
+    }
+
+    /*
+     * a key used for proxy class with 0 implemented interfaces
+     */
+    private static final Object key0 = new Object();
+
+    /*
+     * Key1 and Key2 are optimized for the common use of dynamic proxies
+     * that implement 1 or 2 interfaces.
+     */
 
-        /* collect interface names to use as key for proxy class cache */
-        String[] interfaceNames = new String[interfaces.length];
+    /*
+     * a key used for proxy class with 1 implemented interface
+     */
+    private static final class Key1 extends WeakReference<Class<?>> {
+        private final int hash;
+
+        Key1(Class<?> intf) {
+            super(intf);
+            this.hash = intf.hashCode();
+        }
 
-        // for detecting duplicates
-        Set<Class<?>> interfaceSet = new HashSet<>();
+        @Override
+        public int hashCode() {
+            return hash;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            Class<?> intf;
+            return this == obj ||
+                   obj != null &&
+                   obj.getClass() == Key1.class &&
+                   (intf = get()) != null &&
+                   intf == ((Key1) obj).get();
+        }
+    }
 
-        for (int i = 0; i < interfaces.length; i++) {
-            /*
-             * Verify that the class loader resolves the name of this
-             * interface to the same Class object.
-             */
-            String interfaceName = interfaces[i].getName();
-            Class<?> interfaceClass = null;
-            try {
-                interfaceClass = Class.forName(interfaceName, false, loader);
-            } catch (ClassNotFoundException e) {
+    /*
+     * a key used for proxy class with 2 implemented interfaces
+     */
+    private static final class Key2 extends WeakReference<Class<?>> {
+        private final int hash;
+        private final WeakReference<Class<?>> ref2;
+
+        Key2(Class<?> intf1, Class<?> intf2) {
+            super(intf1);
+            hash = 31 * intf1.hashCode() + intf2.hashCode();
+            ref2 = new WeakReference<Class<?>>(intf2);
+        }
+
+        @Override
+        public int hashCode() {
+            return hash;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            Class<?> intf1, intf2;
+            return this == obj ||
+                   obj != null &&
+                   obj.getClass() == Key2.class &&
+                   (intf1 = get()) != null &&
+                   intf1 == ((Key2) obj).get() &&
+                   (intf2 = ref2.get()) != null &&
+                   intf2 == ((Key2) obj).ref2.get();
+        }
+    }
+
+    /*
+     * a key used for proxy class with any number of implemented interfaces
+     * (used here for 3 or more only)
+     */
+    private static final class KeyX {
+        private final int hash;
+        private final WeakReference<Class<?>>[] refs;
+
+        KeyX(Class<?>[] interfaces) {
+            hash = Arrays.hashCode(interfaces);
+            refs = new WeakReference[interfaces.length];
+            for (int i = 0; i < interfaces.length; i++) {
+                refs[i] = new WeakReference<>(interfaces[i]);
             }
-            if (interfaceClass != interfaces[i]) {
-                throw new IllegalArgumentException(
-                    interfaces[i] + " is not visible from class loader");
-            }
-
-            /*
-             * Verify that the Class object actually represents an
-             * interface.
-             */
-            if (!interfaceClass.isInterface()) {
-                throw new IllegalArgumentException(
-                    interfaceClass.getName() + " is not an interface");
-            }
-
-            /*
-             * Verify that this interface is not a duplicate.
-             */
-            if (interfaceSet.contains(interfaceClass)) {
-                throw new IllegalArgumentException(
-                    "repeated interface: " + interfaceClass.getName());
-            }
-            interfaceSet.add(interfaceClass);
-
-            interfaceNames[i] = interfaceName;
         }
 
-        /*
-         * Using string representations of the proxy interfaces as
-         * keys in the proxy class cache (instead of their Class
-         * objects) is sufficient because we require the proxy
-         * interfaces to be resolvable by name through the supplied
-         * class loader, and it has the advantage that using a string
-         * representation of a class makes for an implicit weak
-         * reference to the class.
-         */
-        List<String> key = Arrays.asList(interfaceNames);
+        @Override
+        public int hashCode() {
+            return hash;
+        }
 
-        /*
-         * Find or create the proxy class cache for the class loader.
-         */
-        Map<List<String>, Object> cache;
-        synchronized (loaderToCache) {
-            cache = loaderToCache.get(loader);
-            if (cache == null) {
-                cache = new HashMap<>();
-                loaderToCache.put(loader, cache);
-            }
-            /*
-             * This mapping will remain valid for the duration of this
-             * method, without further synchronization, because the mapping
-             * will only be removed if the class loader becomes unreachable.
-             */
+        @Override
+        public boolean equals(Object obj) {
+            return this == obj ||
+                   obj != null &&
+                   obj.getClass() == KeyX.class &&
+                   equals(refs, ((KeyX) obj).refs);
         }
 
-        /*
-         * Look up the list of interfaces in the proxy class cache using
-         * the key.  This lookup will result in one of three possible
-         * kinds of values:
-         *     null, if there is currently no proxy class for the list of
-         *         interfaces in the class loader,
-         *     the pendingGenerationMarker object, if a proxy class for the
-         *         list of interfaces is currently being generated,
-         *     or a weak reference to a Class object, if a proxy class for
-         *         the list of interfaces has already been generated.
-         */
-        synchronized (cache) {
-            /*
-             * Note that we need not worry about reaping the cache for
-             * entries with cleared weak references because if a proxy class
-             * has been garbage collected, its class loader will have been
-             * garbage collected as well, so the entire cache will be reaped
-             * from the loaderToCache map.
-             */
-            do {
-                Object value = cache.get(key);
-                if (value instanceof Reference) {
-                    proxyClass = (Class<?>) ((Reference) value).get();
+        private static boolean equals(WeakReference<Class<?>>[] refs1,
+                                      WeakReference<Class<?>>[] refs2) {
+            if (refs1.length != refs2.length) {
+                return false;
+            }
+            for (int i = 0; i < refs1.length; i++) {
+                Class<?> intf = refs1[i].get();
+                if (intf == null || intf != refs2[i].get()) {
+                    return false;
                 }
-                if (proxyClass != null) {
-                    // proxy class already generated: return it
-                    return proxyClass;
-                } else if (value == pendingGenerationMarker) {
-                    // proxy class being generated: wait for it
-                    try {
-                        cache.wait();
-                    } catch (InterruptedException e) {
-                        /*
-                         * The class generation that we are waiting for should
-                         * take a small, bounded time, so we can safely ignore
-                         * thread interrupts here.
-                         */
-                    }
-                    continue;
-                } else {
-                    /*
-                     * No proxy class for this list of interfaces has been
-                     * generated or is being generated, so we will go and
-                     * generate it now.  Mark it as pending generation.
-                     */
-                    cache.put(key, pendingGenerationMarker);
-                    break;
+            }
+            return true;
+        }
+    }
+
+    /**
+     * A function that maps an array of interfaces to an optimal key where
+     * Class objects representing interfaces are weakly referenced.
+     */
+    private static final class KeyFactory
+        implements BiFunction<ClassLoader, Class<?>[], Object>
+    {
+        @Override
+        public Object apply(ClassLoader classLoader, Class<?>[] interfaces) {
+            switch (interfaces.length) {
+                case 1: return new Key1(interfaces[0]); // the most frequent
+                case 2: return new Key2(interfaces[0], interfaces[1]);
+                case 0: return key0;
+                default: return new KeyX(interfaces);
+            }
+        }
+    }
+
+    /**
+     * A factory function that generates, defines and returns the proxy class given
+     * the ClassLoader and array of interfaces.
+     */
+    private static final class ProxyClassFactory
+        implements BiFunction<ClassLoader, Class<?>[], Class<?>>
+    {
+        // prefix for all proxy class names
+        private static final String proxyClassNamePrefix = "$Proxy";
+
+        // next number to use for generation of unique proxy class names
+        private static final AtomicLong nextUniqueNumber = new AtomicLong();
+
+        @Override
+        public Class<?> apply(ClassLoader loader, Class<?>[] interfaces) {
+
+            Map<Class<?>, Boolean> interfaceSet = new IdentityHashMap<>(interfaces.length);
+            for (Class<?> intf : interfaces) {
+                /*
+                 * Verify that the class loader resolves the name of this
+                 * interface to the same Class object.
+                 */
+                Class<?> interfaceClass = null;
+                try {
+                    interfaceClass = Class.forName(intf.getName(), false, loader);
+                } catch (ClassNotFoundException e) {
                 }
-            } while (true);
-        }
+                if (interfaceClass != intf) {
+                    throw new IllegalArgumentException(
+                        intf + " is not visible from class loader");
+                }
+                /*
+                 * Verify that the Class object actually represents an
+                 * interface.
+                 */
+                if (!interfaceClass.isInterface()) {
+                    throw new IllegalArgumentException(
+                        interfaceClass.getName() + " is not an interface");
+                }
+                /*
+                 * Verify that this interface is not a duplicate.
+                 */
+                if (interfaceSet.put(interfaceClass, Boolean.TRUE) != null) {
+                    throw new IllegalArgumentException(
+                        "repeated interface: " + interfaceClass.getName());
+                }
+            }
 
-        try {
             String proxyPkg = null;     // package to define proxy class in
             int accessFlags = Modifier.PUBLIC | Modifier.FINAL;
 
@@ -556,11 +599,11 @@
              * proxy class will be defined in the same package.  Verify that
              * all non-public proxy interfaces are in the same package.
              */
-            for (int i = 0; i < interfaces.length; i++) {
-                int flags = interfaces[i].getModifiers();
+            for (Class<?> intf : interfaces) {
+                int flags = intf.getModifiers();
                 if (!Modifier.isPublic(flags)) {
                     accessFlags = Modifier.FINAL;
-                    String name = interfaces[i].getName();
+                    String name = intf.getName();
                     int n = name.lastIndexOf('.');
                     String pkg = ((n == -1) ? "" : name.substring(0, n + 1));
                     if (proxyPkg == null) {
@@ -577,60 +620,31 @@
                 proxyPkg = ReflectUtil.PROXY_PACKAGE + ".";
             }
 
-            {
+            /*
+             * Choose a name for the proxy class to generate.
+             */
+            long num = nextUniqueNumber.getAndIncrement();
+            String proxyName = proxyPkg + proxyClassNamePrefix + num;
+
+            /*
+             * Generate the specified proxy class.
+             */
+            byte[] proxyClassFile = ProxyGenerator.generateProxyClass(
+                proxyName, interfaces, accessFlags);
+            try {
+                return defineClass0(loader, proxyName,
+                                    proxyClassFile, 0, proxyClassFile.length);
+            } catch (ClassFormatError e) {
                 /*
-                 * Choose a name for the proxy class to generate.
-                 */
-                long num;
-                synchronized (nextUniqueNumberLock) {
-                    num = nextUniqueNumber++;
-                }
-                String proxyName = proxyPkg + proxyClassNamePrefix + num;
-                /*
-                 * Verify that the class loader hasn't already
-                 * defined a class with the chosen name.
-                 */
-
-                /*
-                 * Generate the specified proxy class.
+                 * A ClassFormatError here means that (barring bugs in the
+                 * proxy class generation code) there was some other
+                 * invalid aspect of the arguments supplied to the proxy
+                 * class creation (such as virtual machine limitations
+                 * exceeded).
                  */
-                byte[] proxyClassFile = ProxyGenerator.generateProxyClass(
-                    proxyName, interfaces, accessFlags);
-                try {
-                    proxyClass = defineClass0(loader, proxyName,
-                        proxyClassFile, 0, proxyClassFile.length);
-                } catch (ClassFormatError e) {
-                    /*
-                     * A ClassFormatError here means that (barring bugs in the
-                     * proxy class generation code) there was some other
-                     * invalid aspect of the arguments supplied to the proxy
-                     * class creation (such as virtual machine limitations
-                     * exceeded).
-                     */
-                    throw new IllegalArgumentException(e.toString());
-                }
-            }
-            // add to set of all generated proxy classes, for isProxyClass
-            proxyClasses.put(proxyClass, null);
-
-        } finally {
-            /*
-             * We must clean up the "pending generation" state of the proxy
-             * class cache entry somehow.  If a proxy class was successfully
-             * generated, store it in the cache (with a weak reference);
-             * otherwise, remove the reserved entry.  In all cases, notify
-             * all waiters on reserved entries in this cache.
-             */
-            synchronized (cache) {
-                if (proxyClass != null) {
-                    cache.put(key, new WeakReference<Class<?>>(proxyClass));
-                } else {
-                    cache.remove(key);
-                }
-                cache.notifyAll();
+                throw new IllegalArgumentException(e.toString());
             }
         }
-        return proxyClass;
     }
 
     /**
@@ -757,21 +771,6 @@
         }
     }
 
-    private static Object newInstance(Constructor<?> cons, InvocationHandler h) {
-        try {
-            return cons.newInstance(new Object[] {h} );
-        } catch (IllegalAccessException | InstantiationException e) {
-            throw new InternalError(e.toString(), e);
-        } catch (InvocationTargetException e) {
-            Throwable t = e.getCause();
-            if (t instanceof RuntimeException) {
-                throw (RuntimeException) t;
-            } else {
-                throw new InternalError(t.toString(), t);
-            }
-        }
-    }
-
     /**
      * Returns true if and only if the specified class was dynamically
      * generated to be a proxy class using the {@code getProxyClass}
@@ -787,11 +786,7 @@
      * @throws  NullPointerException if {@code cl} is {@code null}
      */
     public static boolean isProxyClass(Class<?> cl) {
-        if (cl == null) {
-            throw new NullPointerException();
-        }
-
-        return proxyClasses.containsKey(cl);
+        return Proxy.class.isAssignableFrom(cl) && proxyClassCache.containsValue(cl);
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/lang/reflect/WeakCache.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.lang.reflect;
+
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.BiFunction;
+import java.util.function.Supplier;
+
+/**
+ * Cache mapping pairs of {@code (key, sub-key) -> value}. Keys and values are
+ * weakly but sub-keys are strongly referenced.  Keys are passed directly to
+ * {@link #get} method which also takes a {@code parameter}. Sub-keys are
+ * calculated from keys and parameters using the {@code subKeyFactory} function
+ * passed to the constructor. Values are calculated from keys and parameters
+ * using the {@code valueFactory} function passed to the constructor.
+ * Keys can be {@code null} and are compared by identity while sub-keys returned by
+ * {@code subKeyFactory} or values returned by {@code valueFactory}
+ * can not be null. Sub-keys are compared using their {@link #equals} method.
+ * Entries are expunged from cache lazily on each invocation to {@link #get},
+ * {@link #containsValue} or {@link #size} methods when the WeakReferences to
+ * keys are cleared. Cleared WeakReferences to individual values don't cause
+ * expunging, but such entries are logically treated as non-existent and
+ * trigger re-evaluation of {@code valueFactory} on request for their
+ * key/subKey.
+ *
+ * @author Peter Levart
+ * @param <K> type of keys
+ * @param <P> type of parameters
+ * @param <V> type of values
+ */
+final class WeakCache<K, P, V> {
+
+    private final ReferenceQueue<K> refQueue
+        = new ReferenceQueue<>();
+    // the key type is Object for supporting null key
+    private final ConcurrentMap<Object, ConcurrentMap<Object, Supplier<V>>> map
+        = new ConcurrentHashMap<>();
+    private final ConcurrentMap<Supplier<V>, Boolean> reverseMap
+        = new ConcurrentHashMap<>();
+    private final BiFunction<K, P, ?> subKeyFactory;
+    private final BiFunction<K, P, V> valueFactory;
+
+    /**
+     * Construct an instance of {@code WeakCache}
+     *
+     * @param subKeyFactory a function mapping a pair of
+     *                      {@code (key, parameter) -> sub-key}
+     * @param valueFactory  a function mapping a pair of
+     *                      {@code (key, parameter) -> value}
+     * @throws NullPointerException if {@code subKeyFactory} or
+     *                              {@code valueFactory} is null.
+     */
+    public WeakCache(BiFunction<K, P, ?> subKeyFactory,
+                     BiFunction<K, P, V> valueFactory) {
+        this.subKeyFactory = Objects.requireNonNull(subKeyFactory);
+        this.valueFactory = Objects.requireNonNull(valueFactory);
+    }
+
+    /**
+     * Look-up the value through the cache. This always evaluates the
+     * {@code subKeyFactory} function and optionally evaluates
+     * {@code valueFactory} function if there is no entry in the cache for given
+     * pair of (key, subKey) or the entry has already been cleared.
+     *
+     * @param key       possibly null key
+     * @param parameter parameter used together with key to create sub-key and
+     *                  value (should not be null)
+     * @return the cached value (never null)
+     * @throws NullPointerException if {@code parameter} passed in or
+     *                              {@code sub-key} calculated by
+     *                              {@code subKeyFactory} or {@code value}
+     *                              calculated by {@code valueFactory} is null.
+     */
+    public V get(K key, P parameter) {
+        Objects.requireNonNull(parameter);
+
+        expungeStaleEntries();
+
+        Object cacheKey = CacheKey.valueOf(key, refQueue);
+
+        // lazily install the 2nd level valuesMap for the particular cacheKey
+        ConcurrentMap<Object, Supplier<V>> valuesMap = map.get(cacheKey);
+        if (valuesMap == null) {
+            ConcurrentMap<Object, Supplier<V>> oldValuesMap
+                = map.putIfAbsent(cacheKey,
+                                  valuesMap = new ConcurrentHashMap<>());
+            if (oldValuesMap != null) {
+                valuesMap = oldValuesMap;
+            }
+        }
+
+        // create subKey and retrieve the possible Supplier<V> stored by that
+        // subKey from valuesMap
+        Object subKey = Objects.requireNonNull(subKeyFactory.apply(key, parameter));
+        Supplier<V> supplier = valuesMap.get(subKey);
+        Factory factory = null;
+
+        while (true) {
+            if (supplier != null) {
+                // supplier might be a Factory or a CacheValue<V> instance
+                V value = supplier.get();
+                if (value != null) {
+                    return value;
+                }
+            }
+            // else no supplier in cache
+            // or a supplier that returned null (could be a cleared CacheValue
+            // or a Factory that wasn't successful in installing the CacheValue)
+
+            // lazily construct a Factory
+            if (factory == null) {
+                factory = new Factory(key, parameter, subKey, valuesMap);
+            }
+
+            if (supplier == null) {
+                supplier = valuesMap.putIfAbsent(subKey, factory);
+                if (supplier == null) {
+                    // successfully installed Factory
+                    supplier = factory;
+                }
+                // else retry with winning supplier
+            } else {
+                if (valuesMap.replace(subKey, supplier, factory)) {
+                    // successfully replaced
+                    // cleared CacheEntry / unsuccessful Factory
+                    // with our Factory
+                    supplier = factory;
+                } else {
+                    // retry with current supplier
+                    supplier = valuesMap.get(subKey);
+                }
+            }
+        }
+    }
+
+    /**
+     * Checks whether the specified non-null value is already present in this
+     * {@code WeakCache}. The check is made using identity comparison regardless
+     * of whether value's class overrides {@link Object#equals} or not.
+     *
+     * @param value the non-null value to check
+     * @return true if given {@code value} is already cached
+     * @throws NullPointerException if value is null
+     */
+    public boolean containsValue(V value) {
+        Objects.requireNonNull(value);
+
+        expungeStaleEntries();
+        return reverseMap.containsKey(new LookupValue<>(value));
+    }
+
+    /**
+     * Returns the current number of cached entries that
+     * can decrease over time when keys/values are GC-ed.
+     */
+    public int size() {
+        expungeStaleEntries();
+        return reverseMap.size();
+    }
+
+    private void expungeStaleEntries() {
+        CacheKey<K> cacheKey;
+        while ((cacheKey = (CacheKey<K>)refQueue.poll()) != null) {
+            cacheKey.expungeFrom(map, reverseMap);
+        }
+    }
+
+    /**
+     * A factory {@link Supplier} that implements the lazy synchronized
+     * construction of the value and installment of it into the cache.
+     */
+    private final class Factory implements Supplier<V> {
+
+        private final K key;
+        private final P parameter;
+        private final Object subKey;
+        private final ConcurrentMap<Object, Supplier<V>> valuesMap;
+
+        Factory(K key, P parameter, Object subKey,
+                ConcurrentMap<Object, Supplier<V>> valuesMap) {
+            this.key = key;
+            this.parameter = parameter;
+            this.subKey = subKey;
+            this.valuesMap = valuesMap;
+        }
+
+        @Override
+        public synchronized V get() { // serialize access
+            // re-check
+            Supplier<V> supplier = valuesMap.get(subKey);
+            if (supplier != this) {
+                // something changed while we were waiting:
+                // might be that we were replaced by a CacheValue
+                // or were removed because of failure ->
+                // return null to signal WeakCache.get() to retry
+                // the loop
+                return null;
+            }
+            // else still us (supplier == this)
+
+            // create new value
+            V value = null;
+            try {
+                value = Objects.requireNonNull(valueFactory.apply(key, parameter));
+            } finally {
+                if (value == null) { // remove us on failure
+                    valuesMap.remove(subKey, this);
+                }
+            }
+            // the only path to reach here is with non-null value
+            assert value != null;
+
+            // wrap value with CacheValue (WeakReference)
+            CacheValue<V> cacheValue = new CacheValue<>(value);
+
+            // try replacing us with CacheValue (this should always succeed)
+            if (valuesMap.replace(subKey, this, cacheValue)) {
+                // put also in reverseMap
+                reverseMap.put(cacheValue, Boolean.TRUE);
+            } else {
+                throw new AssertionError("Should not reach here");
+            }
+
+            // successfully replaced us with new CacheValue -> return the value
+            // wrapped by it
+            return value;
+        }
+    }
+
+    /**
+     * Common type of value suppliers that are holding a referent.
+     * The {@link #equals} and {@link #hashCode} of implementations is defined
+     * to compare the referent by identity.
+     */
+    private interface Value<V> extends Supplier<V> {}
+
+    /**
+     * An optimized {@link Value} used to look-up the value in
+     * {@link WeakCache#containsValue} method so that we are not
+     * constructing the whole {@link CacheValue} just to look-up the referent.
+     */
+    private static final class LookupValue<V> implements Value<V> {
+        private final V value;
+
+        LookupValue(V value) {
+            this.value = value;
+        }
+
+        @Override
+        public V get() {
+            return value;
+        }
+
+        @Override
+        public int hashCode() {
+            return System.identityHashCode(value); // compare by identity
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            return obj == this ||
+                   obj instanceof Value &&
+                   this.value == ((Value<?>) obj).get();  // compare by identity
+        }
+    }
+
+    /**
+     * A {@link Value} that weakly references the referent.
+     */
+    private static final class CacheValue<V>
+        extends WeakReference<V> implements Value<V>
+    {
+        private final int hash;
+
+        CacheValue(V value) {
+            super(value);
+            this.hash = System.identityHashCode(value); // compare by identity
+        }
+
+        @Override
+        public int hashCode() {
+            return hash;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            V value;
+            return obj == this ||
+                   obj instanceof Value &&
+                   // cleared CacheValue is only equal to itself
+                   (value = get()) != null &&
+                   value == ((Value<?>) obj).get(); // compare by identity
+        }
+    }
+
+    /**
+     * CacheKey containing a weakly referenced {@code key}. It registers
+     * itself with the {@code refQueue} so that it can be used to expunge
+     * the entry when the {@link WeakReference} is cleared.
+     */
+    private static final class CacheKey<K> extends WeakReference<K> {
+
+        // a replacement for null keys
+        private static final Object NULL_KEY = new Object();
+
+        static <K> Object valueOf(K key, ReferenceQueue<K> refQueue) {
+            return key == null
+                   // null key means we can't weakly reference it,
+                   // so we use a NULL_KEY singleton as cache key
+                   ? NULL_KEY
+                   // non-null key requires wrapping with a WeakReference
+                   : new CacheKey<>(key, refQueue);
+        }
+
+        private final int hash;
+
+        private CacheKey(K key, ReferenceQueue<K> refQueue) {
+            super(key, refQueue);
+            this.hash = System.identityHashCode(key);  // compare by identity
+        }
+
+        @Override
+        public int hashCode() {
+            return hash;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            K key;
+            return obj == this ||
+                   obj != null &&
+                   obj.getClass() == this.getClass() &&
+                   // cleared CacheKey is only equal to itself
+                   (key = this.get()) != null &&
+                   // compare key by identity
+                   key == ((CacheKey<K>) obj).get();
+        }
+
+        void expungeFrom(ConcurrentMap<?, ? extends ConcurrentMap<?, ?>> map,
+                         ConcurrentMap<?, Boolean> reverseMap) {
+            // removing just by key is always safe here because after a CacheKey
+            // is cleared and enqueue-ed it is only equal to itself
+            // (see equals method)...
+            ConcurrentMap<?, ?> valuesMap = map.remove(this);
+            // remove also from reverseMap if needed
+            if (valuesMap != null) {
+                for (Object cacheValue : valuesMap.values()) {
+                    reverseMap.remove(cacheValue);
+                }
+            }
+        }
+    }
+}
--- a/jdk/src/share/classes/java/net/Inet6Address.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/net/Inet6Address.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,6 +203,12 @@
      */
     private transient NetworkInterface scope_ifname;  // null
 
+    /**
+     * set if the object is constructed with a scoped
+     * interface instead of a numeric scope id.
+     */
+    private boolean scope_ifname_set; // false;
+
     private static final long serialVersionUID = 6880410070516793377L;
 
     // Perform native initialization
@@ -332,7 +338,7 @@
         }
     }
 
-    private void initif(String hostName, byte addr[],NetworkInterface nif)
+    private void initif(String hostName, byte addr[], NetworkInterface nif)
         throws UnknownHostException
     {
         holder().hostName = hostName;
@@ -344,6 +350,7 @@
             scope_ifname = nif;
             scope_id = deriveNumericScope(nif);
             scope_id_set = true;
+            scope_ifname_set = true;  // for consistency
         }
     }
 
@@ -431,6 +438,7 @@
             try {
                 scope_ifname = NetworkInterface.getByName(ifname);
                 if (scope_ifname != null) {
+                    scope_ifname_set = true;
                     try {
                         scope_id = deriveNumericScope(scope_ifname);
                     } catch (UnknownHostException e) {
@@ -438,6 +446,12 @@
                         // the machine being used for deserialization has
                         // the same interface name but without IPv6 configured.
                     }
+                } else {
+                    /* the interface does not exist on this system, so we clear
+                     * the scope information completely */
+                    scope_id_set = false;
+                    scope_ifname_set = false;
+                    scope_id = 0;
                 }
             } catch (SocketException e) {}
 
@@ -784,8 +798,10 @@
     private synchronized void writeObject(java.io.ObjectOutputStream s)
         throws IOException
     {
-        if (scope_ifname != null)
+        if (scope_ifname != null) {
             ifname = scope_ifname.getName();
+            scope_ifname_set = true;
+        }
         s.defaultWriteObject();
     }
 }
--- a/jdk/src/share/classes/java/nio/file/FileTreeWalker.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/nio/file/FileTreeWalker.java	Wed May 08 10:10:05 2013 +0100
@@ -25,27 +25,147 @@
 
 package java.nio.file;
 
-import java.nio.file.attribute.*;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.io.Closeable;
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayDeque;
+import java.util.Iterator;
+import java.util.Set;
 import sun.nio.fs.BasicFileAttributesHolder;
 
 /**
- * Simple file tree walker that works in a similar manner to nftw(3C).
+ * Walks a file tree, generating a sequence of events corresponding to the files
+ * in the tree.
+ *
+ * <pre>{@code
+ *     Path top = ...
+ *     Set<FileVisitOption> options = ...
+ *     int maxDepth = ...
+ *
+ *     try (FileTreeWalker walker = new FileTreeWalker(options, maxDepth)) {
+ *         FileTreeWalker.Event ev = walker.walk(top);
+ *         do {
+ *             process(ev);
+ *             ev = walker.next();
+ *         } while (ev != null);
+ *     }
+ * }</pre>
  *
  * @see Files#walkFileTree
  */
 
-class FileTreeWalker {
+class FileTreeWalker implements Closeable {
     private final boolean followLinks;
     private final LinkOption[] linkOptions;
-    private final FileVisitor<? super Path> visitor;
     private final int maxDepth;
+    private final ArrayDeque<DirectoryNode> stack = new ArrayDeque<>();
+    private boolean closed;
+
+    /**
+     * The element on the walking stack corresponding to a directory node.
+     */
+    private static class DirectoryNode {
+        private final Path dir;
+        private final Object key;
+        private final DirectoryStream<Path> stream;
+        private final Iterator<Path> iterator;
+        private boolean skipped;
+
+        DirectoryNode(Path dir, Object key, DirectoryStream<Path> stream) {
+            this.dir = dir;
+            this.key = key;
+            this.stream = stream;
+            this.iterator = stream.iterator();
+        }
+
+        Path directory() {
+            return dir;
+        }
+
+        Object key() {
+            return key;
+        }
+
+        DirectoryStream<Path> stream() {
+            return stream;
+        }
+
+        Iterator<Path> iterator() {
+            return iterator;
+        }
+
+        void skip() {
+            skipped = true;
+        }
+
+        boolean skipped() {
+            return skipped;
+        }
+    }
 
-    FileTreeWalker(Set<FileVisitOption> options,
-                   FileVisitor<? super Path> visitor,
-                   int maxDepth)
-    {
+    /**
+     * The event types.
+     */
+    static enum EventType {
+        /**
+         * Start of a directory
+         */
+        START_DIRECTORY,
+        /**
+         * End of a directory
+         */
+        END_DIRECTORY,
+        /**
+         * An entry in a directory
+         */
+        ENTRY;
+    }
+
+    /**
+     * Events returned by the {@link #walk} and {@link #next} methods.
+     */
+    static class Event {
+        private final EventType type;
+        private final Path file;
+        private final BasicFileAttributes attrs;
+        private final IOException ioe;
+
+        private Event(EventType type, Path file, BasicFileAttributes attrs, IOException ioe) {
+            this.type = type;
+            this.file = file;
+            this.attrs = attrs;
+            this.ioe = ioe;
+        }
+
+        Event(EventType type, Path file, BasicFileAttributes attrs) {
+            this(type, file, attrs, null);
+        }
+
+        Event(EventType type, Path file, IOException ioe) {
+            this(type, file, null, ioe);
+        }
+
+        EventType type() {
+            return type;
+        }
+
+        Path file() {
+            return file;
+        }
+
+        BasicFileAttributes attributes() {
+            return attrs;
+        }
+
+        IOException ioeException() {
+            return ioe;
+        }
+    }
+
+    /**
+     * Creates a {@code FileTreeWalker}.
+     */
+    FileTreeWalker(Set<FileVisitOption> options, int maxDepth) {
         boolean fl = false;
         for (FileVisitOption option: options) {
             // will throw NPE if options contains null
@@ -58,191 +178,236 @@
         this.followLinks = fl;
         this.linkOptions = (fl) ? new LinkOption[0] :
             new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
-        this.visitor = visitor;
         this.maxDepth = maxDepth;
     }
 
     /**
-     * Walk file tree starting at the given file
+     * Returns the attributes of the given file, taking into account whether
+     * the walk is following sym links is not. The {@code canUseCached}
+     * argument determines whether this method can use cached attributes.
      */
-    void walk(Path start) throws IOException {
-        FileVisitResult result = walk(start,
-                                      0,
-                                      new ArrayList<AncestorDirectory>());
-        Objects.requireNonNull(result, "FileVisitor returned null");
-    }
-
-    /**
-     * @param   file
-     *          the directory to visit
-     * @param   depth
-     *          depth remaining
-     * @param   ancestors
-     *          use when cycle detection is enabled
-     */
-    private FileVisitResult walk(Path file,
-                                 int depth,
-                                 List<AncestorDirectory> ancestors)
+    private BasicFileAttributes getAttributes(Path file, boolean canUseCached)
         throws IOException
     {
         // if attributes are cached then use them if possible
-        BasicFileAttributes attrs = null;
-        if ((depth > 0) &&
+        if (canUseCached &&
             (file instanceof BasicFileAttributesHolder) &&
             (System.getSecurityManager() == null))
         {
             BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get();
-            if (cached != null && (!followLinks || !cached.isSymbolicLink()))
-                attrs = cached;
-        }
-        IOException exc = null;
-
-        // attempt to get attributes of file. If fails and we are following
-        // links then a link target might not exist so get attributes of link
-        if (attrs == null) {
-            try {
-                try {
-                    attrs = Files.readAttributes(file, BasicFileAttributes.class, linkOptions);
-                } catch (IOException x1) {
-                    if (followLinks) {
-                        try {
-                            attrs = Files.readAttributes(file,
-                                                         BasicFileAttributes.class,
-                                                         LinkOption.NOFOLLOW_LINKS);
-                        } catch (IOException x2) {
-                            exc = x2;
-                        }
-                    } else {
-                        exc = x1;
-                    }
-                }
-            } catch (SecurityException x) {
-                // If access to starting file is denied then SecurityException
-                // is thrown, otherwise the file is ignored.
-                if (depth == 0)
-                    throw x;
-                return FileVisitResult.CONTINUE;
+            if (cached != null && (!followLinks || !cached.isSymbolicLink())) {
+                return cached;
             }
         }
 
-        // unable to get attributes of file
-        if (exc != null) {
-            return visitor.visitFileFailed(file, exc);
+        // attempt to get attributes of file. If fails and we are following
+        // links then a link target might not exist so get attributes of link
+        BasicFileAttributes attrs;
+        try {
+            attrs = Files.readAttributes(file, BasicFileAttributes.class, linkOptions);
+        } catch (IOException ioe) {
+            if (!followLinks)
+                throw ioe;
+
+            // attempt to get attrmptes without following links
+            attrs = Files.readAttributes(file,
+                                         BasicFileAttributes.class,
+                                         LinkOption.NOFOLLOW_LINKS);
+        }
+        return attrs;
+    }
+
+    /**
+     * Returns true if walking into the given directory would result in a
+     * file system loop/cycle.
+     */
+    private boolean wouldLoop(Path dir, Object key) {
+        // if this directory and ancestor has a file key then we compare
+        // them; otherwise we use less efficient isSameFile test.
+        for (DirectoryNode ancestor: stack) {
+            Object ancestorKey = ancestor.key();
+            if (key != null && ancestorKey != null) {
+                if (key.equals(ancestorKey)) {
+                    // cycle detected
+                    return true;
+                }
+            } else {
+                try {
+                    if (Files.isSameFile(dir, ancestor.directory())) {
+                        // cycle detected
+                        return true;
+                    }
+                } catch (IOException | SecurityException x) {
+                    // ignore
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Visits the given file, returning the {@code Event} corresponding to that
+     * visit.
+     *
+     * The {@code ignoreSecurityException} parameter determines whether
+     * any SecurityException should be ignored or not. If a SecurityException
+     * is thrown, and is ignored, then this method returns {@code null} to
+     * mean that there is no event corresponding to a visit to the file.
+     *
+     * The {@code canUseCached} parameter determines whether cached attributes
+     * for the file can be used or not.
+     */
+    private Event visit(Path entry, boolean ignoreSecurityException, boolean canUseCached) {
+        // need the file attributes
+        BasicFileAttributes attrs;
+        try {
+            attrs = getAttributes(entry, canUseCached);
+        } catch (IOException ioe) {
+            return new Event(EventType.ENTRY, entry, ioe);
+        } catch (SecurityException se) {
+            if (ignoreSecurityException)
+                return null;
+            throw se;
         }
 
         // at maximum depth or file is not a directory
+        int depth = stack.size();
         if (depth >= maxDepth || !attrs.isDirectory()) {
-            return visitor.visitFile(file, attrs);
+            return new Event(EventType.ENTRY, entry, attrs);
         }
 
         // check for cycles when following links
-        if (followLinks) {
-            Object key = attrs.fileKey();
+        if (followLinks && wouldLoop(entry, attrs.fileKey())) {
+            return new Event(EventType.ENTRY, entry,
+                             new FileSystemLoopException(entry.toString()));
+        }
+
+        // file is a directory, attempt to open it
+        DirectoryStream<Path> stream = null;
+        try {
+            stream = Files.newDirectoryStream(entry);
+        } catch (IOException ioe) {
+            return new Event(EventType.ENTRY, entry, ioe);
+        } catch (SecurityException se) {
+            if (ignoreSecurityException)
+                return null;
+            throw se;
+        }
+
+        // push a directory node to the stack and return an event
+        stack.push(new DirectoryNode(entry, attrs.fileKey(), stream));
+        return new Event(EventType.START_DIRECTORY, entry, attrs);
+    }
+
 
-            // if this directory and ancestor has a file key then we compare
-            // them; otherwise we use less efficient isSameFile test.
-            for (AncestorDirectory ancestor: ancestors) {
-                Object ancestorKey = ancestor.fileKey();
-                if (key != null && ancestorKey != null) {
-                    if (key.equals(ancestorKey)) {
-                        // cycle detected
-                        return visitor.visitFileFailed(file,
-                            new FileSystemLoopException(file.toString()));
+    /**
+     * Start walking from the given file.
+     */
+    Event walk(Path file) {
+        if (closed)
+            throw new IllegalStateException("Closed");
+
+        Event ev = visit(file,
+                         false,   // ignoreSecurityException
+                         false);  // canUseCached
+        assert ev != null;
+        return ev;
+    }
+
+    /**
+     * Returns the next Event or {@code null} if there are no more events or
+     * the walker is closed.
+     */
+    Event next() {
+        DirectoryNode top = stack.peek();
+        if (top == null)
+            return null;      // stack is empty, we are done
+
+        // continue iteration of the directory at the top of the stack
+        Event ev;
+        do {
+            Path entry = null;
+            IOException ioe = null;
+
+            // get next entry in the directory
+            if (!top.skipped()) {
+                Iterator<Path> iterator = top.iterator();
+                try {
+                    if (iterator.hasNext()) {
+                        entry = iterator.next();
                     }
-                } else {
-                    boolean isSameFile = false;
-                    try {
-                        isSameFile = Files.isSameFile(file, ancestor.file());
-                    } catch (IOException x) {
-                        // ignore
-                    } catch (SecurityException x) {
-                        // ignore
-                    }
-                    if (isSameFile) {
-                        // cycle detected
-                        return visitor.visitFileFailed(file,
-                            new FileSystemLoopException(file.toString()));
-                    }
+                } catch (DirectoryIteratorException x) {
+                    ioe = x.getCause();
                 }
             }
 
-            ancestors.add(new AncestorDirectory(file, key));
-        }
-
-        // visit directory
-        try {
-            DirectoryStream<Path> stream = null;
-            FileVisitResult result;
-
-            // open the directory
-            try {
-                stream = Files.newDirectoryStream(file);
-            } catch (IOException x) {
-                return visitor.visitFileFailed(file, x);
-            } catch (SecurityException x) {
-                // ignore, as per spec
-                return FileVisitResult.CONTINUE;
+            // no next entry so close and pop directory, creating corresponding event
+            if (entry == null) {
+                try {
+                    top.stream().close();
+                } catch (IOException e) {
+                    if (ioe != null) {
+                        ioe = e;
+                    } else {
+                        ioe.addSuppressed(e);
+                    }
+                }
+                stack.pop();
+                return new Event(EventType.END_DIRECTORY, top.directory(), ioe);
             }
 
-            // the exception notified to the postVisitDirectory method
-            IOException ioe = null;
+            // visit the entry
+            ev = visit(entry,
+                       true,   // ignoreSecurityException
+                       true);  // canUseCached
 
-            // invoke preVisitDirectory and then visit each entry
-            try {
-                result = visitor.preVisitDirectory(file, attrs);
-                if (result != FileVisitResult.CONTINUE) {
-                    return result;
-                }
+        } while (ev == null);
 
-                try {
-                    for (Path entry: stream) {
-                        result = walk(entry, depth+1, ancestors);
-
-                        // returning null will cause NPE to be thrown
-                        if (result == null || result == FileVisitResult.TERMINATE)
-                            return result;
+        return ev;
+    }
 
-                        // skip remaining siblings in this directory
-                        if (result == FileVisitResult.SKIP_SIBLINGS)
-                            break;
-                    }
-                } catch (DirectoryIteratorException e) {
-                    // IOException will be notified to postVisitDirectory
-                    ioe = e.getCause();
-                }
-            } finally {
-                try {
-                    stream.close();
-                } catch (IOException e) {
-                    // IOException will be notified to postVisitDirectory
-                    if (ioe == null)
-                        ioe = e;
-                }
-            }
-
-            // invoke postVisitDirectory last
-            return visitor.postVisitDirectory(file, ioe);
-
-        } finally {
-            // remove key from trail if doing cycle detection
-            if (followLinks) {
-                ancestors.remove(ancestors.size()-1);
-            }
+    /**
+     * Pops the directory node that is the current top of the stack so that
+     * there are no more events for the directory (including no END_DIRECTORY)
+     * event. This method is a no-op if the stack is empty or the walker is
+     * closed.
+     */
+    void pop() {
+        if (!stack.isEmpty()) {
+            DirectoryNode node = stack.pop();
+            try {
+                node.stream().close();
+            } catch (IOException ignore) { }
         }
     }
 
-    private static class AncestorDirectory {
-        private final Path dir;
-        private final Object key;
-        AncestorDirectory(Path dir, Object key) {
-            this.dir = dir;
-            this.key = key;
+    /**
+     * Skips the remaining entries in the directory at the top of the stack.
+     * This method is a no-op if the stack is empty or the walker is closed.
+     */
+    void skipRemainingSiblings() {
+        if (!stack.isEmpty()) {
+            stack.peek().skip();
         }
-        Path file() {
-            return dir;
-        }
-        Object fileKey() {
-            return key;
+    }
+
+    /**
+     * Returns {@code true} if the walker is open.
+     */
+    boolean isOpen() {
+        return !closed;
+    }
+
+    /**
+     * Closes/pops all directories on the stack.
+     */
+    @Override
+    public void close() {
+        if (!closed) {
+            while (!stack.isEmpty()) {
+                pop();
+            }
+            closed = true;
         }
     }
 }
--- a/jdk/src/share/classes/java/nio/file/Files.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/nio/file/Files.java	Wed May 08 10:10:05 2013 +0100
@@ -2589,7 +2589,60 @@
     {
         if (maxDepth < 0)
             throw new IllegalArgumentException("'maxDepth' is negative");
-        new FileTreeWalker(options, visitor, maxDepth).walk(start);
+
+        /**
+         * Create a FileTreeWalker to walk the file tree, invoking the visitor
+         * for each event.
+         */
+        try (FileTreeWalker walker = new FileTreeWalker(options, maxDepth)) {
+            FileTreeWalker.Event ev = walker.walk(start);
+            do {
+                FileVisitResult result;
+                switch (ev.type()) {
+                    case ENTRY :
+                        IOException ioe = ev.ioeException();
+                        if (ioe == null) {
+                            assert ev.attributes() != null;
+                            result = visitor.visitFile(ev.file(), ev.attributes());
+                        } else {
+                            result = visitor.visitFileFailed(ev.file(), ioe);
+                        }
+                        break;
+
+                    case START_DIRECTORY :
+                        result = visitor.preVisitDirectory(ev.file(), ev.attributes());
+
+                        // if SKIP_SIBLINGS and SKIP_SUBTREE is returned then
+                        // there shouldn't be any more events for the current
+                        // directory.
+                        if (result == FileVisitResult.SKIP_SUBTREE ||
+                            result == FileVisitResult.SKIP_SIBLINGS)
+                            walker.pop();
+                        break;
+
+                    case END_DIRECTORY :
+                        result = visitor.postVisitDirectory(ev.file(), ev.ioeException());
+
+                        // SKIP_SIBLINGS is a no-op for postVisitDirectory
+                        if (result == FileVisitResult.SKIP_SIBLINGS)
+                            result = FileVisitResult.CONTINUE;
+                        break;
+
+                    default :
+                        throw new AssertionError("Should not get here");
+                }
+
+                if (Objects.requireNonNull(result) != FileVisitResult.CONTINUE) {
+                    if (result == FileVisitResult.TERMINATE) {
+                        break;
+                    } else if (result == FileVisitResult.SKIP_SIBLINGS) {
+                        walker.skipRemainingSiblings();
+                    }
+                }
+                ev = walker.next();
+            } while (ev != null);
+        }
+
         return start;
     }
 
--- a/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java	Wed May 08 10:10:05 2013 +0100
@@ -147,11 +147,11 @@
      * this method has no effect.
      *
      * <p> <b>Usage Example:</b>
-     * Suppose we want to change a file's creation time.
+     * Suppose we want to change a file's last access time.
      * <pre>
      *    Path path = ...
      *    FileTime time = ...
-     *    Files.getFileAttributeView(path, BasicFileAttributeView.class).setTimes(null, null, time);
+     *    Files.getFileAttributeView(path, BasicFileAttributeView.class).setTimes(null, time, null);
      * </pre>
      *
      * @param   lastModifiedTime
--- a/jdk/src/share/classes/java/nio/file/attribute/FileTime.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/nio/file/attribute/FileTime.java	Wed May 08 10:10:05 2013 +0100
@@ -219,8 +219,8 @@
      *
      * <p> {@code FileTime} can store points on the time-line further in the
      * future and further in the past than {@code Instant}. Conversion
-     * from such further time points saturates to {@link Instant.MIN} if
-     * earlier than {@code Instant.MIN} or {@link Instant.MAX} if later
+     * from such further time points saturates to {@link Instant#MIN} if
+     * earlier than {@code Instant.MIN} or {@link Instant#MAX} if later
      * than {@code Instant.MAX}.
      *
      * @return  an instant representing the same point on the time-line as
--- a/jdk/src/share/classes/java/sql/Driver.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/sql/Driver.java	Wed May 08 10:10:05 2013 +0100
@@ -44,13 +44,16 @@
  *
  * <P>When a Driver class is loaded, it should create an instance of
  * itself and register it with the DriverManager. This means that a
- * user can load and register a driver by calling
- * <pre>
- *   <code>Class.forName("foo.bah.Driver")</code>
- * </pre>
- *
+ * user can load and register a driver by calling:
+ * <p>
+ * {@code Class.forName("foo.bah.Driver")}
+ * <p>
+ * A JDBC driver may create a {@linkplain DriverAction} implementation in order
+ * to receive notifications when {@linkplain DriverManager#deregisterDriver} has
+ * been called.
  * @see DriverManager
  * @see Connection
+ * @see DriverAction
  */
 public interface Driver {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/sql/DriverAction.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.sql;
+
+/**
+ * An interface that must be implemented when a {@linkplain Driver} wants to be
+ * notified by {@code DriverManager}.
+ *<P>
+ * A {@code DriverAction} implementation is not intended to be used
+ * directly by applications. A JDBC Driver  may choose
+ * to create its {@code DriverAction} implementation in a private class
+ * to avoid it being called directly.
+ * <o>
+ * The JDBC driver's static initialization block must call
+ * {@linkplain DriverManager#registerDriver(java.sql.Driver, java.sql.DriverAction) } in order
+ * to inform {@code DriverManager} which {@code DriverAction} implementation to
+ * call when the JDBC driver is de-registered.
+ * @since 1.8
+ */
+public interface DriverAction {
+    /**
+     * Method called by
+     * {@linkplain DriverManager#deregisterDriver(Driver) }
+     *  to notify the JDBC driver that it was de-registered.
+     * <p>
+     * The {@code deregister} method is intended only to be used by JDBC Drivers
+     * and not by applications.  JDBC drivers are recommended to not implement
+     * {@code DriverAction} in a public class.  If there are active
+     * connections to the database at the time that the {@code deregister}
+     * method is called, it is implementation specific as to whether the
+     * connections are closed or allowed to continue. Once this method is
+     * called, it is implementation specific as to whether the driver may
+     * limit the ability to create new connections to the database, invoke
+     * other {@code Driver} methods or throw a {@code SQLException}.
+     * Consult your JDBC driver's documentation for additional information
+     * on its behavior.
+     * @see DriverManager#registerDriver(java.sql.Driver, java.sql.DriverAction)
+     * @see DriverManager#deregisterDriver(Driver)
+     * @since 1.8
+     */
+    void deregister();
+
+}
--- a/jdk/src/share/classes/java/sql/DriverManager.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/sql/DriverManager.java	Wed May 08 10:10:05 2013 +0100
@@ -110,6 +110,14 @@
     final static SQLPermission SET_LOG_PERMISSION =
         new SQLPermission("setLog");
 
+    /**
+     * The {@code SQLPermission} constant that allows the
+     * un-register a registered JDBC driver.
+     * @since 1.8
+     */
+    final static SQLPermission DEREGISTER_DRIVER_PERMISSION =
+        new SQLPermission("deregisterDriver");
+
     //--------------------------JDBC 2.0-----------------------------
 
     /**
@@ -309,21 +317,42 @@
 
 
     /**
-     * Registers the given driver with the <code>DriverManager</code>.
+     * Registers the given driver with the {@code DriverManager}.
      * A newly-loaded driver class should call
-     * the method <code>registerDriver</code> to make itself
-     * known to the <code>DriverManager</code>.
+     * the method {@code registerDriver} to make itself
+     * known to the {@code DriverManager}. If the driver had previously been
+     * registered, no action is taken.
      *
      * @param driver the new JDBC Driver that is to be registered with the
-     *               <code>DriverManager</code>
+     *               {@code DriverManager}
      * @exception SQLException if a database access error occurs
      */
     public static synchronized void registerDriver(java.sql.Driver driver)
         throws SQLException {
 
+        registerDriver(driver, null);
+    }
+
+    /**
+     * Registers the given driver with the {@code DriverManager}.
+     * A newly-loaded driver class should call
+     * the method {@code registerDriver} to make itself
+     * known to the {@code DriverManager}. If the driver had previously been
+     * registered, no action is taken.
+     *
+     * @param driver the new JDBC Driver that is to be registered with the
+     *               {@code DriverManager}
+     * @param da     the {@code DriverAction} implementation to be used when
+     *               {@code DriverManager#deregisterDriver} is called
+     * @exception SQLException if a database access error occurs
+     */
+    public static synchronized void registerDriver(java.sql.Driver driver,
+            DriverAction da)
+        throws SQLException {
+
         /* Register the driver if it has not already been added to our list */
         if(driver != null) {
-            registeredDrivers.addIfAbsent(new DriverInfo(driver));
+            registeredDrivers.addIfAbsent(new DriverInfo(driver, da));
         } else {
             // This is for compatibility with the original DriverManager
             throw new NullPointerException();
@@ -334,11 +363,29 @@
     }
 
     /**
-     * Drops a driver from the <code>DriverManager</code>'s list.
-     *  Applets can only deregister drivers from their own classloaders.
+     * Removes the specified driver from the {@code DriverManager}'s list of
+     * registered drivers.
+     * <p>
+     * If a {@code null} value is specified for the driver to be removed, then no
+     * action is taken.
+     * <p>
+     * If a security manager exists and its {@code checkPermission} denies
+     * permission, then a {@code SecurityException} will be thrown.
+     * <p>
+     * If the specified driver is not found in the list of registered drivers,
+     * then no action is taken.  If the driver was found, it will be removed
+     * from the list of registered drivers.
+     * <p>
+     * If a {@code DriverAction} instance was specified when the JDBC driver was
+     * registered, its deregister method will be called
+     * prior to the driver being removed from the list of registered drivers.
      *
-     * @param driver the JDBC Driver to drop
+     * @param driver the JDBC Driver to remove
      * @exception SQLException if a database access error occurs
+     * @throws SecurityException if a security manager exists and its
+     * {@code checkPermission} method denies permission to deregister a driver.
+     *
+     * @see SecurityManager#checkPermission
      */
     @CallerSensitive
     public static synchronized void deregisterDriver(Driver driver)
@@ -347,11 +394,22 @@
             return;
         }
 
+        SecurityManager sec = System.getSecurityManager();
+        if (sec != null) {
+            sec.checkPermission(DEREGISTER_DRIVER_PERMISSION);
+        }
+
         println("DriverManager.deregisterDriver: " + driver);
 
-        DriverInfo aDriver = new DriverInfo(driver);
+        DriverInfo aDriver = new DriverInfo(driver, null);
         if(registeredDrivers.contains(aDriver)) {
             if (isDriverAllowed(driver, Reflection.getCallerClass())) {
+                DriverInfo di = registeredDrivers.get(registeredDrivers.indexOf(aDriver));
+                 // If a DriverAction was specified, Call it to notify the
+                 // driver that it has been deregistered
+                 if(di.action() != null) {
+                     di.action().deregister();
+                 }
                  registeredDrivers.remove(aDriver);
             } else {
                 // If the caller does not have permission to load the driver then
@@ -639,8 +697,10 @@
 class DriverInfo {
 
     final Driver driver;
-    DriverInfo(Driver driver) {
+    DriverAction da;
+    DriverInfo(Driver driver, DriverAction action) {
         this.driver = driver;
+        da = action;
     }
 
     @Override
@@ -658,4 +718,8 @@
     public String toString() {
         return ("driver[className="  + driver + "]");
     }
+
+    DriverAction action() {
+        return da;
+    }
 }
--- a/jdk/src/share/classes/java/sql/SQLPermission.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/sql/SQLPermission.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,9 @@
 
 /**
  * The permission for which the <code>SecurityManager</code> will check
- * when code that is running in an applet, or an application with a
+ * when code that is running an application with a
  * <code>SecurityManager</code> enabled, calls the
+ * {@code DriverManager.deregisterDriver} method,
  * <code>DriverManager.setLogWriter</code> method,
  * <code>DriverManager.setLogStream</code> (deprecated) method,
  * {@code SyncFactory.setJNDIContext} method,
@@ -95,14 +96,16 @@
  * <code>Connection</code> or
  * objects created from the <code>Connection</code>
  * will wait for the database to reply to any one request.</td>
+ * <tr>
+ * <td>deregisterDriver</td>
+ *   <td>Allows the invocation of the {@code DriverManager}
+ * method {@code deregisterDriver}</td>
+ *   <td>Permits an application to remove a JDBC driver from the list of
+ * registered Drivers and release its resources.</td>
+ * </tr>
  * </tr>
  * </table>
  *<p>
- * The person running an applet decides what permissions to allow
- * and will run the <code>Policy Tool</code> to create an
- * <code>SQLPermission</code> in a policy file.  A programmer does
- * not use a constructor directly to create an instance of <code>SQLPermission</code>
- * but rather uses a tool.
  * @since 1.3
  * @see java.security.BasicPermission
  * @see java.security.Permission
--- a/jdk/src/share/classes/java/text/CalendarBuilder.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/text/CalendarBuilder.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -91,6 +91,15 @@
         return field[index] > UNSET;
     }
 
+    CalendarBuilder clear(int index) {
+        if (index == ISO_DAY_OF_WEEK) {
+            index = DAY_OF_WEEK;
+        }
+        field[index] = UNSET;
+        field[MAX_FIELD + index] = 0;
+        return this;
+    }
+
     Calendar establish(Calendar cal) {
         boolean weekDate = isSet(WEEK_YEAR)
                             && field[WEEK_YEAR] > field[YEAR];
--- a/jdk/src/share/classes/java/text/SimpleDateFormat.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/text/SimpleDateFormat.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1719,7 +1719,7 @@
             // determine the local time. (6645292)
             int dstAmount = (nameIndex >= 3) ? tz.getDSTSavings() : 0;
             if (!(useSameName || (nameIndex >= 3 && dstAmount == 0))) {
-                calb.set(Calendar.DST_OFFSET, dstAmount);
+                calb.clear(Calendar.ZONE_OFFSET).set(Calendar.DST_OFFSET, dstAmount);
             }
             return (start + zoneNames[nameIndex].length());
         }
--- a/jdk/src/share/classes/java/util/ArrayDeque.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/ArrayDeque.java	Wed May 08 10:10:05 2013 +0100
@@ -33,7 +33,9 @@
  */
 
 package java.util;
-import java.io.*;
+
+import java.io.Serializable;
+import java.util.function.Consumer;
 
 /**
  * Resizable-array implementation of the {@link Deque} interface.  Array
@@ -44,16 +46,16 @@
  * {@link Stack} when used as a stack, and faster than {@link LinkedList}
  * when used as a queue.
  *
- * <p>Most <tt>ArrayDeque</tt> operations run in amortized constant time.
+ * <p>Most {@code ArrayDeque} operations run in amortized constant time.
  * Exceptions include {@link #remove(Object) remove}, {@link
  * #removeFirstOccurrence removeFirstOccurrence}, {@link #removeLastOccurrence
  * removeLastOccurrence}, {@link #contains contains}, {@link #iterator
  * iterator.remove()}, and the bulk operations, all of which run in linear
  * time.
  *
- * <p>The iterators returned by this class's <tt>iterator</tt> method are
+ * <p>The iterators returned by this class's {@code iterator} method are
  * <i>fail-fast</i>: If the deque is modified at any time after the iterator
- * is created, in any way except through the iterator's own <tt>remove</tt>
+ * is created, in any way except through the iterator's own {@code remove}
  * method, the iterator will generally throw a {@link
  * ConcurrentModificationException}.  Thus, in the face of concurrent
  * modification, the iterator fails quickly and cleanly, rather than risking
@@ -63,7 +65,7 @@
  * <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
  * as it is, generally speaking, impossible to make any hard guarantees in the
  * presence of unsynchronized concurrent modification.  Fail-fast iterators
- * throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
+ * throw {@code ConcurrentModificationException} on a best-effort basis.
  * Therefore, it would be wrong to write a program that depended on this
  * exception for its correctness: <i>the fail-fast behavior of iterators
  * should be used only to detect bugs.</i>
@@ -93,20 +95,20 @@
      * other.  We also guarantee that all array cells not holding
      * deque elements are always null.
      */
-    private transient E[] elements;
+    transient Object[] elements; // non-private to simplify nested class access
 
     /**
      * The index of the element at the head of the deque (which is the
      * element that would be removed by remove() or pop()); or an
      * arbitrary number equal to tail if the deque is empty.
      */
-    private transient int head;
+    transient int head;
 
     /**
      * The index at which the next element would be added to the tail
      * of the deque (via addLast(E), add(E), or push(E)).
      */
-    private transient int tail;
+    transient int tail;
 
     /**
      * The minimum capacity that we'll use for a newly created deque.
@@ -117,11 +119,10 @@
     // ******  Array allocation and resizing utilities ******
 
     /**
-     * Allocate empty array to hold the given number of elements.
+     * Allocates empty array to hold the given number of elements.
      *
      * @param numElements  the number of elements to hold
      */
-    @SuppressWarnings("unchecked")
     private void allocateElements(int numElements) {
         int initialCapacity = MIN_INITIAL_CAPACITY;
         // Find the best power of two to hold elements.
@@ -138,11 +139,11 @@
             if (initialCapacity < 0)   // Too many elements, must back off
                 initialCapacity >>>= 1;// Good luck allocating 2 ^ 30 elements
         }
-        elements = (E[]) new Object[initialCapacity];
+        elements = new Object[initialCapacity];
     }
 
     /**
-     * Double the capacity of this deque.  Call only when full, i.e.,
+     * Doubles the capacity of this deque.  Call only when full, i.e.,
      * when head and tail have wrapped around to become equal.
      */
     private void doubleCapacity() {
@@ -153,8 +154,7 @@
         int newCapacity = n << 1;
         if (newCapacity < 0)
             throw new IllegalStateException("Sorry, deque too big");
-        @SuppressWarnings("unchecked")
-        E[] a = (E[]) new Object[newCapacity];
+        Object[] a = new Object[newCapacity];
         System.arraycopy(elements, p, a, 0, r);
         System.arraycopy(elements, 0, a, r, p);
         elements = a;
@@ -184,9 +184,8 @@
      * Constructs an empty array deque with an initial capacity
      * sufficient to hold 16 elements.
      */
-    @SuppressWarnings("unchecked")
     public ArrayDeque() {
-        elements = (E[]) new Object[16];
+        elements = new Object[16];
     }
 
     /**
@@ -252,7 +251,7 @@
      * Inserts the specified element at the front of this deque.
      *
      * @param e the element to add
-     * @return <tt>true</tt> (as specified by {@link Deque#offerFirst})
+     * @return {@code true} (as specified by {@link Deque#offerFirst})
      * @throws NullPointerException if the specified element is null
      */
     public boolean offerFirst(E e) {
@@ -264,7 +263,7 @@
      * Inserts the specified element at the end of this deque.
      *
      * @param e the element to add
-     * @return <tt>true</tt> (as specified by {@link Deque#offerLast})
+     * @return {@code true} (as specified by {@link Deque#offerLast})
      * @throws NullPointerException if the specified element is null
      */
     public boolean offerLast(E e) {
@@ -294,7 +293,9 @@
 
     public E pollFirst() {
         int h = head;
-        E result = elements[h]; // Element is null if deque empty
+        @SuppressWarnings("unchecked")
+        E result = (E) elements[h];
+        // Element is null if deque empty
         if (result == null)
             return null;
         elements[h] = null;     // Must null out slot
@@ -304,7 +305,8 @@
 
     public E pollLast() {
         int t = (tail - 1) & (elements.length - 1);
-        E result = elements[t];
+        @SuppressWarnings("unchecked")
+        E result = (E) elements[t];
         if (result == null)
             return null;
         elements[t] = null;
@@ -316,48 +318,53 @@
      * @throws NoSuchElementException {@inheritDoc}
      */
     public E getFirst() {
-        E x = elements[head];
-        if (x == null)
+        @SuppressWarnings("unchecked")
+        E result = (E) elements[head];
+        if (result == null)
             throw new NoSuchElementException();
-        return x;
+        return result;
     }
 
     /**
      * @throws NoSuchElementException {@inheritDoc}
      */
     public E getLast() {
-        E x = elements[(tail - 1) & (elements.length - 1)];
-        if (x == null)
+        @SuppressWarnings("unchecked")
+        E result = (E) elements[(tail - 1) & (elements.length - 1)];
+        if (result == null)
             throw new NoSuchElementException();
-        return x;
+        return result;
     }
 
+    @SuppressWarnings("unchecked")
     public E peekFirst() {
-        return elements[head]; // elements[head] is null if deque empty
+        // elements[head] is null if deque empty
+        return (E) elements[head];
     }
 
+    @SuppressWarnings("unchecked")
     public E peekLast() {
-        return elements[(tail - 1) & (elements.length - 1)];
+        return (E) elements[(tail - 1) & (elements.length - 1)];
     }
 
     /**
      * Removes the first occurrence of the specified element in this
      * deque (when traversing the deque from head to tail).
      * If the deque does not contain the element, it is unchanged.
-     * More formally, removes the first element <tt>e</tt> such that
-     * <tt>o.equals(e)</tt> (if such an element exists).
-     * Returns <tt>true</tt> if this deque contained the specified element
+     * More formally, removes the first element {@code e} such that
+     * {@code o.equals(e)} (if such an element exists).
+     * Returns {@code true} if this deque contained the specified element
      * (or equivalently, if this deque changed as a result of the call).
      *
      * @param o element to be removed from this deque, if present
-     * @return <tt>true</tt> if the deque contained the specified element
+     * @return {@code true} if the deque contained the specified element
      */
     public boolean removeFirstOccurrence(Object o) {
         if (o == null)
             return false;
         int mask = elements.length - 1;
         int i = head;
-        E x;
+        Object x;
         while ( (x = elements[i]) != null) {
             if (o.equals(x)) {
                 delete(i);
@@ -372,20 +379,20 @@
      * Removes the last occurrence of the specified element in this
      * deque (when traversing the deque from head to tail).
      * If the deque does not contain the element, it is unchanged.
-     * More formally, removes the last element <tt>e</tt> such that
-     * <tt>o.equals(e)</tt> (if such an element exists).
-     * Returns <tt>true</tt> if this deque contained the specified element
+     * More formally, removes the last element {@code e} such that
+     * {@code o.equals(e)} (if such an element exists).
+     * Returns {@code true} if this deque contained the specified element
      * (or equivalently, if this deque changed as a result of the call).
      *
      * @param o element to be removed from this deque, if present
-     * @return <tt>true</tt> if the deque contained the specified element
+     * @return {@code true} if the deque contained the specified element
      */
     public boolean removeLastOccurrence(Object o) {
         if (o == null)
             return false;
         int mask = elements.length - 1;
         int i = (tail - 1) & mask;
-        E x;
+        Object x;
         while ( (x = elements[i]) != null) {
             if (o.equals(x)) {
                 delete(i);
@@ -404,7 +411,7 @@
      * <p>This method is equivalent to {@link #addLast}.
      *
      * @param e the element to add
-     * @return <tt>true</tt> (as specified by {@link Collection#add})
+     * @return {@code true} (as specified by {@link Collection#add})
      * @throws NullPointerException if the specified element is null
      */
     public boolean add(E e) {
@@ -418,7 +425,7 @@
      * <p>This method is equivalent to {@link #offerLast}.
      *
      * @param e the element to add
-     * @return <tt>true</tt> (as specified by {@link Queue#offer})
+     * @return {@code true} (as specified by {@link Queue#offer})
      * @throws NullPointerException if the specified element is null
      */
     public boolean offer(E e) {
@@ -443,12 +450,12 @@
     /**
      * Retrieves and removes the head of the queue represented by this deque
      * (in other words, the first element of this deque), or returns
-     * <tt>null</tt> if this deque is empty.
+     * {@code null} if this deque is empty.
      *
      * <p>This method is equivalent to {@link #pollFirst}.
      *
      * @return the head of the queue represented by this deque, or
-     *         <tt>null</tt> if this deque is empty
+     *         {@code null} if this deque is empty
      */
     public E poll() {
         return pollFirst();
@@ -470,12 +477,12 @@
 
     /**
      * Retrieves, but does not remove, the head of the queue represented by
-     * this deque, or returns <tt>null</tt> if this deque is empty.
+     * this deque, or returns {@code null} if this deque is empty.
      *
      * <p>This method is equivalent to {@link #peekFirst}.
      *
      * @return the head of the queue represented by this deque, or
-     *         <tt>null</tt> if this deque is empty
+     *         {@code null} if this deque is empty
      */
     public E peek() {
         return peekFirst();
@@ -530,7 +537,7 @@
      */
     private boolean delete(int i) {
         checkInvariants();
-        final E[] elements = this.elements;
+        final Object[] elements = this.elements;
         final int mask = elements.length - 1;
         final int h = head;
         final int t = tail;
@@ -579,9 +586,9 @@
     }
 
     /**
-     * Returns <tt>true</tt> if this deque contains no elements.
+     * Returns {@code true} if this deque contains no elements.
      *
-     * @return <tt>true</tt> if this deque contains no elements
+     * @return {@code true} if this deque contains no elements
      */
     public boolean isEmpty() {
         return head == tail;
@@ -628,7 +635,8 @@
         public E next() {
             if (cursor == fence)
                 throw new NoSuchElementException();
-            E result = elements[cursor];
+            @SuppressWarnings("unchecked")
+            E result = (E) elements[cursor];
             // This check doesn't catch all possible comodifications,
             // but does catch the ones that corrupt traversal
             if (tail != fence || result == null)
@@ -647,6 +655,20 @@
             }
             lastRet = -1;
         }
+
+        public void forEachRemaining(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+            Object[] a = elements;
+            int m = a.length - 1, f = fence, i = cursor;
+            cursor = f;
+            while (i != f) {
+                @SuppressWarnings("unchecked") E e = (E)a[i];
+                i = (i + 1) & m;
+                if (e == null)
+                    throw new ConcurrentModificationException();
+                action.accept(e);
+            }
+        }
     }
 
     private class DescendingIterator implements Iterator<E> {
@@ -667,7 +689,8 @@
             if (cursor == fence)
                 throw new NoSuchElementException();
             cursor = (cursor - 1) & (elements.length - 1);
-            E result = elements[cursor];
+            @SuppressWarnings("unchecked")
+            E result = (E) elements[cursor];
             if (head != fence || result == null)
                 throw new ConcurrentModificationException();
             lastRet = cursor;
@@ -686,19 +709,19 @@
     }
 
     /**
-     * Returns <tt>true</tt> if this deque contains the specified element.
-     * More formally, returns <tt>true</tt> if and only if this deque contains
-     * at least one element <tt>e</tt> such that <tt>o.equals(e)</tt>.
+     * Returns {@code true} if this deque contains the specified element.
+     * More formally, returns {@code true} if and only if this deque contains
+     * at least one element {@code e} such that {@code o.equals(e)}.
      *
      * @param o object to be checked for containment in this deque
-     * @return <tt>true</tt> if this deque contains the specified element
+     * @return {@code true} if this deque contains the specified element
      */
     public boolean contains(Object o) {
         if (o == null)
             return false;
         int mask = elements.length - 1;
         int i = head;
-        E x;
+        Object x;
         while ( (x = elements[i]) != null) {
             if (o.equals(x))
                 return true;
@@ -710,15 +733,15 @@
     /**
      * Removes a single instance of the specified element from this deque.
      * If the deque does not contain the element, it is unchanged.
-     * More formally, removes the first element <tt>e</tt> such that
-     * <tt>o.equals(e)</tt> (if such an element exists).
-     * Returns <tt>true</tt> if this deque contained the specified element
+     * More formally, removes the first element {@code e} such that
+     * {@code o.equals(e)} (if such an element exists).
+     * Returns {@code true} if this deque contained the specified element
      * (or equivalently, if this deque changed as a result of the call).
      *
-     * <p>This method is equivalent to {@link #removeFirstOccurrence}.
+     * <p>This method is equivalent to {@link #removeFirstOccurrence(Object)}.
      *
      * @param o element to be removed from this deque, if present
-     * @return <tt>true</tt> if this deque contained the specified element
+     * @return {@code true} if this deque contained the specified element
      */
     public boolean remove(Object o) {
         return removeFirstOccurrence(o);
@@ -770,22 +793,21 @@
      * <p>If this deque fits in the specified array with room to spare
      * (i.e., the array has more elements than this deque), the element in
      * the array immediately following the end of the deque is set to
-     * <tt>null</tt>.
+     * {@code null}.
      *
      * <p>Like the {@link #toArray()} method, this method acts as bridge between
      * array-based and collection-based APIs.  Further, this method allows
      * precise control over the runtime type of the output array, and may,
      * under certain circumstances, be used to save allocation costs.
      *
-     * <p>Suppose <tt>x</tt> is a deque known to contain only strings.
+     * <p>Suppose {@code x} is a deque known to contain only strings.
      * The following code can be used to dump the deque into a newly
-     * allocated array of <tt>String</tt>:
+     * allocated array of {@code String}:
      *
-     * <pre>
-     *     String[] y = x.toArray(new String[0]);</pre>
+     *  <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
      *
-     * Note that <tt>toArray(new Object[0])</tt> is identical in function to
-     * <tt>toArray()</tt>.
+     * Note that {@code toArray(new Object[0])} is identical in function to
+     * {@code toArray()}.
      *
      * @param a the array into which the elements of the deque are to
      *          be stored, if it is big enough; otherwise, a new array of the
@@ -818,28 +840,25 @@
     public ArrayDeque<E> clone() {
         try {
             @SuppressWarnings("unchecked")
-                ArrayDeque<E> result = (ArrayDeque<E>) super.clone();
+            ArrayDeque<E> result = (ArrayDeque<E>) super.clone();
             result.elements = Arrays.copyOf(elements, elements.length);
             return result;
-
         } catch (CloneNotSupportedException e) {
             throw new AssertionError();
         }
     }
 
-    /**
-     * Appease the serialization gods.
-     */
     private static final long serialVersionUID = 2340985798034038923L;
 
     /**
-     * Serialize this deque.
+     * Saves this deque to a stream (that is, serializes it).
      *
-     * @serialData The current size (<tt>int</tt>) of the deque,
+     * @serialData The current size ({@code int}) of the deque,
      * followed by all of its elements (each an object reference) in
      * first-to-last order.
      */
-    private void writeObject(ObjectOutputStream s) throws IOException {
+    private void writeObject(java.io.ObjectOutputStream s)
+            throws java.io.IOException {
         s.defaultWriteObject();
 
         // Write out size
@@ -852,11 +871,10 @@
     }
 
     /**
-     * Deserialize this deque.
+     * Reconstitutes this deque from a stream (that is, deserializes it).
      */
-    @SuppressWarnings("unchecked")
-    private void readObject(ObjectInputStream s)
-            throws IOException, ClassNotFoundException {
+    private void readObject(java.io.ObjectInputStream s)
+            throws java.io.IOException, ClassNotFoundException {
         s.defaultReadObject();
 
         // Read in size and allocate array
@@ -867,6 +885,88 @@
 
         // Read in all elements in the proper order.
         for (int i = 0; i < size; i++)
-            elements[i] = (E)s.readObject();
+            elements[i] = s.readObject();
+    }
+
+    public Spliterator<E> spliterator() {
+        return new DeqSpliterator<E>(this, -1, -1);
     }
+
+    static final class DeqSpliterator<E> implements Spliterator<E> {
+        private final ArrayDeque<E> deq;
+        private int fence;  // -1 until first use
+        private int index;  // current index, modified on traverse/split
+
+        /** Creates new spliterator covering the given array and range */
+        DeqSpliterator(ArrayDeque<E> deq, int origin, int fence) {
+            this.deq = deq;
+            this.index = origin;
+            this.fence = fence;
+        }
+
+        private int getFence() { // force initialization
+            int t;
+            if ((t = fence) < 0) {
+                t = fence = deq.tail;
+                index = deq.head;
+            }
+            return t;
+        }
+
+        public DeqSpliterator<E> trySplit() {
+            int t = getFence(), h = index, n = deq.elements.length;
+            if (h != t && ((h + 1) & (n - 1)) != t) {
+                if (h > t)
+                    t += n;
+                int m = ((h + t) >>> 1) & (n - 1);
+                return new DeqSpliterator<>(deq, h, index = m);
+            }
+            return null;
+        }
+
+        public void forEachRemaining(Consumer<? super E> consumer) {
+            if (consumer == null)
+                throw new NullPointerException();
+            Object[] a = deq.elements;
+            int m = a.length - 1, f = getFence(), i = index;
+            index = f;
+            while (i != f) {
+                @SuppressWarnings("unchecked") E e = (E)a[i];
+                i = (i + 1) & m;
+                if (e == null)
+                    throw new ConcurrentModificationException();
+                consumer.accept(e);
+            }
+        }
+
+        public boolean tryAdvance(Consumer<? super E> consumer) {
+            if (consumer == null)
+                throw new NullPointerException();
+            Object[] a = deq.elements;
+            int m = a.length - 1, f = getFence(), i = index;
+            if (i != fence) {
+                @SuppressWarnings("unchecked") E e = (E)a[i];
+                index = (i + 1) & m;
+                if (e == null)
+                    throw new ConcurrentModificationException();
+                consumer.accept(e);
+                return true;
+            }
+            return false;
+        }
+
+        public long estimateSize() {
+            int n = getFence() - index;
+            if (n < 0)
+                n += deq.elements.length;
+            return (long) n;
+        }
+
+        @Override
+        public int characteristics() {
+            return Spliterator.ORDERED | Spliterator.SIZED |
+                Spliterator.NONNULL | Spliterator.SUBSIZED;
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/util/ArrayList.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/ArrayList.java	Wed May 08 10:10:05 2013 +0100
@@ -25,6 +25,10 @@
 
 package java.util;
 
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+
 /**
  * Resizable-array implementation of the <tt>List</tt> interface.  Implements
  * all optional list operations, and permits all elements, including
@@ -120,7 +124,7 @@
      * empty ArrayList with elementData == EMPTY_ELEMENTDATA will be expanded to
      * DEFAULT_CAPACITY when the first element is added.
      */
-    private transient Object[] elementData;
+    transient Object[] elementData; // non-private to simplify nested class access
 
     /**
      * The size of the ArrayList (the number of elements it contains).
@@ -853,6 +857,27 @@
             }
         }
 
+        @Override
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super E> consumer) {
+            Objects.requireNonNull(consumer);
+            final int size = ArrayList.this.size;
+            int i = cursor;
+            if (i >= size) {
+                return;
+            }
+            final Object[] elementData = ArrayList.this.elementData;
+            if (i >= elementData.length) {
+                throw new ConcurrentModificationException();
+            }
+            while (i != size && modCount == expectedModCount) {
+                consumer.accept((E) elementData[i++]);
+            }
+            // update once at end of iteration to reduce heap write traffic
+            lastRet = cursor = i;
+            checkForComodification();
+        }
+
         final void checkForComodification() {
             if (modCount != expectedModCount)
                 throw new ConcurrentModificationException();
@@ -1088,6 +1113,26 @@
                     return (E) elementData[offset + (lastRet = i)];
                 }
 
+                @SuppressWarnings("unchecked")
+                public void forEachRemaining(Consumer<? super E> consumer) {
+                    Objects.requireNonNull(consumer);
+                    final int size = SubList.this.size;
+                    int i = cursor;
+                    if (i >= size) {
+                        return;
+                    }
+                    final Object[] elementData = ArrayList.this.elementData;
+                    if (offset + i >= elementData.length) {
+                        throw new ConcurrentModificationException();
+                    }
+                    while (i != size && modCount == expectedModCount) {
+                        consumer.accept((E) elementData[offset + (i++)]);
+                    }
+                    // update once at end of iteration to reduce heap write traffic
+                    lastRet = cursor = i;
+                    checkForComodification();
+                }
+
                 public int nextIndex() {
                     return cursor;
                 }
@@ -1167,5 +1212,217 @@
             if (ArrayList.this.modCount != this.modCount)
                 throw new ConcurrentModificationException();
         }
+
+        public Spliterator<E> spliterator() {
+            checkForComodification();
+            return new ArrayListSpliterator<E>(ArrayList.this, offset,
+                                               offset + this.size, this.modCount);
+        }
+    }
+
+    @Override
+    public void forEach(Consumer<? super E> action) {
+        Objects.requireNonNull(action);
+        final int expectedModCount = modCount;
+        @SuppressWarnings("unchecked")
+        final E[] elementData = (E[]) this.elementData;
+        final int size = this.size;
+        for (int i=0; modCount == expectedModCount && i < size; i++) {
+            action.accept(elementData[i]);
+        }
+        if (modCount != expectedModCount) {
+            throw new ConcurrentModificationException();
+        }
+    }
+
+    public Spliterator<E> spliterator() {
+        return new ArrayListSpliterator<>(this, 0, -1, 0);
+    }
+
+    /** Index-based split-by-two, lazily initialized Spliterator */
+    static final class ArrayListSpliterator<E> implements Spliterator<E> {
+
+        /*
+         * If ArrayLists were immutable, or structurally immutable (no
+         * adds, removes, etc), we could implement their spliterators
+         * with Arrays.spliterator. Instead we detect as much
+         * interference during traversal as practical without
+         * sacrificing much performance. We rely primarily on
+         * modCounts. These are not guaranteed to detect concurrency
+         * violations, and are sometimes overly conservative about
+         * within-thread interference, but detect enough problems to
+         * be worthwhile in practice. To carry this out, we (1) lazily
+         * initialize fence and expectedModCount until the latest
+         * point that we need to commit to the state we are checking
+         * against; thus improving precision.  (This doesn't apply to
+         * SubLists, that create spliterators with current non-lazy
+         * values).  (2) We perform only a single
+         * ConcurrentModificationException check at the end of forEach
+         * (the most performance-sensitive method). When using forEach
+         * (as opposed to iterators), we can normally only detect
+         * interference after actions, not before. Further
+         * CME-triggering checks apply to all other possible
+         * violations of assumptions for example null or too-small
+         * elementData array given its size(), that could only have
+         * occurred due to interference.  This allows the inner loop
+         * of forEach to run without any further checks, and
+         * simplifies lambda-resolution. While this does entail a
+         * number of checks, note that in the common case of
+         * list.stream().forEach(a), no checks or other computation
+         * occur anywhere other than inside forEach itself.  The other
+         * less-often-used methods cannot take advantage of most of
+         * these streamlinings.
+         */
+
+        private final ArrayList<E> list;
+        private int index; // current index, modified on advance/split
+        private int fence; // -1 until used; then one past last index
+        private int expectedModCount; // initialized when fence set
+
+        /** Create new spliterator covering the given  range */
+        ArrayListSpliterator(ArrayList<E> list, int origin, int fence,
+                             int expectedModCount) {
+            this.list = list; // OK if null unless traversed
+            this.index = origin;
+            this.fence = fence;
+            this.expectedModCount = expectedModCount;
+        }
+
+        private int getFence() { // initialize fence to size on first use
+            int hi; // (a specialized variant appears in method forEach)
+            ArrayList<E> lst;
+            if ((hi = fence) < 0) {
+                if ((lst = list) == null)
+                    hi = fence = 0;
+                else {
+                    expectedModCount = lst.modCount;
+                    hi = fence = lst.size;
+                }
+            }
+            return hi;
+        }
+
+        public ArrayListSpliterator<E> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid) ? null : // divide range in half unless too small
+                new ArrayListSpliterator<E>(list, lo, index = mid,
+                                            expectedModCount);
+        }
+
+        public boolean tryAdvance(Consumer<? super E> action) {
+            if (action == null)
+                throw new NullPointerException();
+            int hi = getFence(), i = index;
+            if (i < hi) {
+                index = i + 1;
+                @SuppressWarnings("unchecked") E e = (E)list.elementData[i];
+                action.accept(e);
+                if (list.modCount != expectedModCount)
+                    throw new ConcurrentModificationException();
+                return true;
+            }
+            return false;
+        }
+
+        public void forEachRemaining(Consumer<? super E> action) {
+            int i, hi, mc; // hoist accesses and checks from loop
+            ArrayList<E> lst; Object[] a;
+            if (action == null)
+                throw new NullPointerException();
+            if ((lst = list) != null && (a = lst.elementData) != null) {
+                if ((hi = fence) < 0) {
+                    mc = lst.modCount;
+                    hi = lst.size;
+                }
+                else
+                    mc = expectedModCount;
+                if ((i = index) >= 0 && (index = hi) <= a.length) {
+                    for (; i < hi; ++i) {
+                        @SuppressWarnings("unchecked") E e = (E) a[i];
+                        action.accept(e);
+                    }
+                    if (lst.modCount == mc)
+                        return;
+                }
+            }
+            throw new ConcurrentModificationException();
+        }
+
+        public long estimateSize() {
+            return (long) (getFence() - index);
+        }
+
+        public int characteristics() {
+            return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED;
+        }
+    }
+
+    @Override
+    public boolean removeIf(Predicate<? super E> filter) {
+        Objects.requireNonNull(filter);
+        // figure out which elements are to be removed
+        // any exception thrown from the filter predicate at this stage
+        // will leave the collection unmodified
+        int removeCount = 0;
+        final BitSet removeSet = new BitSet(size);
+        final int expectedModCount = modCount;
+        final int size = this.size;
+        for (int i=0; modCount == expectedModCount && i < size; i++) {
+            @SuppressWarnings("unchecked")
+            final E element = (E) elementData[i];
+            if (filter.test(element)) {
+                removeSet.set(i);
+                removeCount++;
+            }
+        }
+        if (modCount != expectedModCount) {
+            throw new ConcurrentModificationException();
+        }
+
+        // shift surviving elements left over the spaces left by removed elements
+        final boolean anyToRemove = removeCount > 0;
+        if (anyToRemove) {
+            final int newSize = size - removeCount;
+            for (int i=0, j=0; (i < size) && (j < newSize); i++, j++) {
+                i = removeSet.nextClearBit(i);
+                elementData[j] = elementData[i];
+            }
+            for (int k=newSize; k < size; k++) {
+                elementData[k] = null;  // Let gc do its work
+            }
+            this.size = newSize;
+            if (modCount != expectedModCount) {
+                throw new ConcurrentModificationException();
+            }
+            modCount++;
+        }
+
+        return anyToRemove;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public void replaceAll(UnaryOperator<E> operator) {
+        Objects.requireNonNull(operator);
+        final int expectedModCount = modCount;
+        final int size = this.size;
+        for (int i=0; modCount == expectedModCount && i < size; i++) {
+            elementData[i] = operator.apply((E) elementData[i]);
+        }
+        if (modCount != expectedModCount) {
+            throw new ConcurrentModificationException();
+        }
+        modCount++;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public void sort(Comparator<? super E> c) {
+        final int expectedModCount = modCount;
+        Arrays.sort((E[]) elementData, 0, size, c);
+        if (modCount != expectedModCount) {
+            throw new ConcurrentModificationException();
+        }
+        modCount++;
     }
 }
--- a/jdk/src/share/classes/java/util/Arrays.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/Arrays.java	Wed May 08 10:10:05 2013 +0100
@@ -25,7 +25,21 @@
 
 package java.util;
 
-import java.lang.reflect.*;
+import java.lang.reflect.Array;
+import java.util.concurrent.ForkJoinPool;
+import java.util.function.BinaryOperator;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.IntBinaryOperator;
+import java.util.function.IntFunction;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.LongBinaryOperator;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
 import static java.util.ArraysParallelSortHelpers.*;
 
 /**
@@ -4306,17 +4320,171 @@
         dejaVu.remove(a);
     }
 
+
     /**
-     * Creates a {@link Spliterator} covering all of the specified array.
+     * Set all elements of the specified array, using the provided
+     * generator function to compute each element.
+     *
+     * <p>If the generator function throws an exception, it is relayed to
+     * the caller and the array is left in an indeterminate state.
+     *
+     * @param <T> type of elements of the array
+     * @param array array to be initialized
+     * @param generator a function accepting an index and producing the desired
+     *        value for that position
+     * @throws NullPointerException if the generator is null
+     * @since 1.8
+     */
+    public static <T> void setAll(T[] array, IntFunction<? extends T> generator) {
+        Objects.requireNonNull(generator);
+        for (int i = 0; i < array.length; i++)
+            array[i] = generator.apply(i);
+    }
+
+    /**
+     * Set all elements of the specified array, in parallel, using the
+     * provided generator function to compute each element.
+     *
+     * <p>If the generator function throws an exception, an unchecked exception
+     * is thrown from {@code parallelSetAll} and the array is left in an
+     * indeterminate state.
+     *
+     * @param <T> type of elements of the array
+     * @param array array to be initialized
+     * @param generator a function accepting an index and producing the desired
+     *        value for that position
+     * @throws NullPointerException if the generator is null
+     * @since 1.8
+     */
+    public static <T> void parallelSetAll(T[] array, IntFunction<? extends T> generator) {
+        Objects.requireNonNull(generator);
+        IntStream.range(0, array.length).parallel().forEach(i -> { array[i] = generator.apply(i); });
+    }
+
+    /**
+     * Set all elements of the specified array, using the provided
+     * generator function to compute each element.
+     *
+     * <p>If the generator function throws an exception, it is relayed to
+     * the caller and the array is left in an indeterminate state.
+     *
+     * @param array array to be initialized
+     * @param generator a function accepting an index and producing the desired
+     *        value for that position
+     * @throws NullPointerException if the generator is null
+     * @since 1.8
+     */
+    public static void setAll(int[] array, IntUnaryOperator generator) {
+        Objects.requireNonNull(generator);
+        for (int i = 0; i < array.length; i++)
+            array[i] = generator.applyAsInt(i);
+    }
+
+    /**
+     * Set all elements of the specified array, in parallel, using the
+     * provided generator function to compute each element.
+     *
+     * <p>If the generator function throws an exception, an unchecked exception
+     * is thrown from {@code parallelSetAll} and the array is left in an
+     * indeterminate state.
+     *
+     * @param array array to be initialized
+     * @param generator a function accepting an index and producing the desired
+     * value for that position
+     * @throws NullPointerException if the generator is null
+     * @since 1.8
+     */
+    public static void parallelSetAll(int[] array, IntUnaryOperator generator) {
+        Objects.requireNonNull(generator);
+        IntStream.range(0, array.length).parallel().forEach(i -> { array[i] = generator.applyAsInt(i); });
+    }
+
+    /**
+     * Set all elements of the specified array, using the provided
+     * generator function to compute each element.
+     *
+     * <p>If the generator function throws an exception, it is relayed to
+     * the caller and the array is left in an indeterminate state.
+     *
+     * @param array array to be initialized
+     * @param generator a function accepting an index and producing the desired
+     *        value for that position
+     * @throws NullPointerException if the generator is null
+     * @since 1.8
+     */
+    public static void setAll(long[] array, IntToLongFunction generator) {
+        Objects.requireNonNull(generator);
+        for (int i = 0; i < array.length; i++)
+            array[i] = generator.applyAsLong(i);
+    }
+
+    /**
+     * Set all elements of the specified array, in parallel, using the
+     * provided generator function to compute each element.
+     *
+     * <p>If the generator function throws an exception, an unchecked exception
+     * is thrown from {@code parallelSetAll} and the array is left in an
+     * indeterminate state.
+     *
+     * @param array array to be initialized
+     * @param generator a function accepting an index and producing the desired
+     *        value for that position
+     * @throws NullPointerException if the generator is null
+     * @since 1.8
+     */
+    public static void parallelSetAll(long[] array, IntToLongFunction generator) {
+        Objects.requireNonNull(generator);
+        IntStream.range(0, array.length).parallel().forEach(i -> { array[i] = generator.applyAsLong(i); });
+    }
+
+    /**
+     * Set all elements of the specified array, using the provided
+     * generator function to compute each element.
+     *
+     * <p>If the generator function throws an exception, it is relayed to
+     * the caller and the array is left in an indeterminate state.
+     *
+     * @param array array to be initialized
+     * @param generator a function accepting an index and producing the desired
+     *        value for that position
+     * @throws NullPointerException if the generator is null
+     * @since 1.8
+     */
+    public static void setAll(double[] array, IntToDoubleFunction generator) {
+        Objects.requireNonNull(generator);
+        for (int i = 0; i < array.length; i++)
+            array[i] = generator.applyAsDouble(i);
+    }
+
+    /**
+     * Set all elements of the specified array, in parallel, using the
+     * provided generator function to compute each element.
+     *
+     * <p>If the generator function throws an exception, an unchecked exception
+     * is thrown from {@code parallelSetAll} and the array is left in an
+     * indeterminate state.
+     *
+     * @param array array to be initialized
+     * @param generator a function accepting an index and producing the desired
+     *        value for that position
+     * @throws NullPointerException if the generator is null
+     * @since 1.8
+     */
+    public static void parallelSetAll(double[] array, IntToDoubleFunction generator) {
+        Objects.requireNonNull(generator);
+        IntStream.range(0, array.length).parallel().forEach(i -> { array[i] = generator.applyAsDouble(i); });
+    }
+
+    /**
+     * Returns a {@link Spliterator} covering all of the specified array.
      *
      * <p>The spliterator reports {@link Spliterator#SIZED},
      * {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
      * {@link Spliterator#IMMUTABLE}.
      *
-     * @param <T> Type of elements
-     * @param array The array, assumed to be unmodified during use
-     * @return A spliterator from the array
-     * @throws NullPointerException if the specified array is {@code null}
+     * @param <T> type of elements
+     * @param array the array, assumed to be unmodified during use
+     * @return a spliterator for the array elements
      * @since 1.8
      */
     public static <T> Spliterator<T> spliterator(T[] array) {
@@ -4325,39 +4493,38 @@
     }
 
     /**
-     * Creates a {@link Spliterator} covering the specified range of the
+     * Returns a {@link Spliterator} covering the specified range of the
      * specified array.
      *
      * <p>The spliterator reports {@link Spliterator#SIZED},
      * {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
      * {@link Spliterator#IMMUTABLE}.
      *
-     * @param <T> Type of elements
-     * @param array The array, assumed to be unmodified during use
-     * @param fromIndex The least index (inclusive) to cover
-     * @param toIndex One past the greatest index to cover
-     * @return A spliterator from the array
-     * @throws NullPointerException if the specified array is {@code null}
-     * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
-     *         {@code toIndex} is less than {@code fromIndex}, or
-     *         {@code toIndex} is greater than the array size
+     * @param <T> type of elements
+     * @param array the array, assumed to be unmodified during use
+     * @param startInclusive the first index to cover, inclusive
+     * @param endExclusive index immediately past the last index to cover
+     * @return a spliterator for the array elements
+     * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+     *         negative, {@code endExclusive} is less than
+     *         {@code startInclusive}, or {@code endExclusive} is greater than
+     *         the array size
      * @since 1.8
      */
-    public static <T> Spliterator<T> spliterator(T[] array, int fromIndex, int toIndex) {
-        return Spliterators.spliterator(array, fromIndex, toIndex,
+    public static <T> Spliterator<T> spliterator(T[] array, int startInclusive, int endExclusive) {
+        return Spliterators.spliterator(array, startInclusive, endExclusive,
                                         Spliterator.ORDERED | Spliterator.IMMUTABLE);
     }
 
     /**
-     * Creates a {@link Spliterator.OfInt} covering all of the specified array.
+     * Returns a {@link Spliterator.OfInt} covering all of the specified array.
      *
      * <p>The spliterator reports {@link Spliterator#SIZED},
      * {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
      * {@link Spliterator#IMMUTABLE}.
      *
-     * @param array The array, assumed to be unmodified during use
-     * @return A spliterator from the array
-     * @throws NullPointerException if the specified array is {@code null}
+     * @param array the array, assumed to be unmodified during use
+     * @return a spliterator for the array elements
      * @since 1.8
      */
     public static Spliterator.OfInt spliterator(int[] array) {
@@ -4366,38 +4533,37 @@
     }
 
     /**
-     * Creates a {@link Spliterator.OfInt} covering the specified range of the
+     * Returns a {@link Spliterator.OfInt} covering the specified range of the
      * specified array.
      *
      * <p>The spliterator reports {@link Spliterator#SIZED},
      * {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
      * {@link Spliterator#IMMUTABLE}.
      *
-     * @param array The array, assumed to be unmodified during use
-     * @param fromIndex The least index (inclusive) to cover
-     * @param toIndex One past the greatest index to cover
-     * @return A spliterator from the array
-     * @throws NullPointerException if the specified array is {@code null}
-     * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
-     *         {@code toIndex} is less than {@code fromIndex}, or
-     *         {@code toIndex} is greater than the array size
+     * @param array the array, assumed to be unmodified during use
+     * @param startInclusive the first index to cover, inclusive
+     * @param endExclusive index immediately past the last index to cover
+     * @return a spliterator for the array elements
+     * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+     *         negative, {@code endExclusive} is less than
+     *         {@code startInclusive}, or {@code endExclusive} is greater than
+     *         the array size
      * @since 1.8
      */
-    public static Spliterator.OfInt spliterator(int[] array, int fromIndex, int toIndex) {
-        return Spliterators.spliterator(array, fromIndex, toIndex,
+    public static Spliterator.OfInt spliterator(int[] array, int startInclusive, int endExclusive) {
+        return Spliterators.spliterator(array, startInclusive, endExclusive,
                                         Spliterator.ORDERED | Spliterator.IMMUTABLE);
     }
 
     /**
-     * Creates a {@link Spliterator.OfLong} covering all of the specified array.
+     * Returns a {@link Spliterator.OfLong} covering all of the specified array.
      *
      * <p>The spliterator reports {@link Spliterator#SIZED},
      * {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
      * {@link Spliterator#IMMUTABLE}.
      *
-     * @param array The array, assumed to be unmodified during use
-     * @return A spliterator from the array
-     * @throws NullPointerException if the specified array is {@code null}
+     * @param array the array, assumed to be unmodified during use
+     * @return the spliterator for the array elements
      * @since 1.8
      */
     public static Spliterator.OfLong spliterator(long[] array) {
@@ -4406,39 +4572,38 @@
     }
 
     /**
-     * Creates a {@link Spliterator.OfLong} covering the specified range of the
+     * Returns a {@link Spliterator.OfLong} covering the specified range of the
      * specified array.
      *
      * <p>The spliterator reports {@link Spliterator#SIZED},
      * {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
      * {@link Spliterator#IMMUTABLE}.
      *
-     * @param array The array, assumed to be unmodified during use
-     * @param fromIndex The least index (inclusive) to cover
-     * @param toIndex One past the greatest index to cover
-     * @return A spliterator from the array
-     * @throws NullPointerException if the specified array is {@code null}
-     * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
-     *         {@code toIndex} is less than {@code fromIndex}, or
-     *         {@code toIndex} is greater than the array size
+     * @param array the array, assumed to be unmodified during use
+     * @param startInclusive the first index to cover, inclusive
+     * @param endExclusive index immediately past the last index to cover
+     * @return a spliterator for the array elements
+     * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+     *         negative, {@code endExclusive} is less than
+     *         {@code startInclusive}, or {@code endExclusive} is greater than
+     *         the array size
      * @since 1.8
      */
-    public static Spliterator.OfLong spliterator(long[] array, int fromIndex, int toIndex) {
-        return Spliterators.spliterator(array, fromIndex, toIndex,
+    public static Spliterator.OfLong spliterator(long[] array, int startInclusive, int endExclusive) {
+        return Spliterators.spliterator(array, startInclusive, endExclusive,
                                         Spliterator.ORDERED | Spliterator.IMMUTABLE);
     }
 
     /**
-     * Creates a {@link Spliterator.OfDouble} covering all of the specified
+     * Returns a {@link Spliterator.OfDouble} covering all of the specified
      * array.
      *
      * <p>The spliterator reports {@link Spliterator#SIZED},
      * {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
      * {@link Spliterator#IMMUTABLE}.
      *
-     * @param array The array, assumed to be unmodified during use
-     * @return A spliterator from the array
-     * @throws NullPointerException if the specified array is {@code null}
+     * @param array the array, assumed to be unmodified during use
+     * @return a spliterator for the array elements
      * @since 1.8
      */
     public static Spliterator.OfDouble spliterator(double[] array) {
@@ -4447,25 +4612,147 @@
     }
 
     /**
-     * Creates a {@link Spliterator.OfDouble} covering the specified range of
+     * Returns a {@link Spliterator.OfDouble} covering the specified range of
      * the specified array.
      *
      * <p>The spliterator reports {@link Spliterator#SIZED},
      * {@link Spliterator#SUBSIZED}, {@link Spliterator#ORDERED}, and
      * {@link Spliterator#IMMUTABLE}.
      *
+     * @param array the array, assumed to be unmodified during use
+     * @param startInclusive the first index to cover, inclusive
+     * @param endExclusive index immediately past the last index to cover
+     * @return a spliterator for the array elements
+     * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+     *         negative, {@code endExclusive} is less than
+     *         {@code startInclusive}, or {@code endExclusive} is greater than
+     *         the array size
+     * @since 1.8
+     */
+    public static Spliterator.OfDouble spliterator(double[] array, int startInclusive, int endExclusive) {
+        return Spliterators.spliterator(array, startInclusive, endExclusive,
+                                        Spliterator.ORDERED | Spliterator.IMMUTABLE);
+    }
+
+    /**
+     * Returns a sequential {@link Stream} with the specified array as its
+     * source.
+     *
+     * @param <T> The type of the array elements
      * @param array The array, assumed to be unmodified during use
-     * @param fromIndex The least index (inclusive) to cover
-     * @param toIndex One past the greatest index to cover
-     * @return A spliterator from the array
-     * @throws NullPointerException if the specified array is {@code null}
-     * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
-     *         {@code toIndex} is less than {@code fromIndex}, or
-     *         {@code toIndex} is greater than the array size
+     * @return a {@code Stream} for the array
+     * @since 1.8
+     */
+    public static <T> Stream<T> stream(T[] array) {
+        return stream(array, 0, array.length);
+    }
+
+    /**
+     * Returns a sequential {@link Stream} with the specified range of the
+     * specified array as its source.
+     *
+     * @param <T> the type of the array elements
+     * @param array the array, assumed to be unmodified during use
+     * @param startInclusive the first index to cover, inclusive
+     * @param endExclusive index immediately past the last index to cover
+     * @return a {@code Stream} for the array range
+     * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+     *         negative, {@code endExclusive} is less than
+     *         {@code startInclusive}, or {@code endExclusive} is greater than
+     *         the array size
+     * @since 1.8
+     */
+    public static <T> Stream<T> stream(T[] array, int startInclusive, int endExclusive) {
+        return StreamSupport.stream(spliterator(array, startInclusive, endExclusive));
+    }
+
+    /**
+     * Returns a sequential {@link IntStream} with the specified array as its
+     * source.
+     *
+     * @param array the array, assumed to be unmodified during use
+     * @return an {@code IntStream} for the array
      * @since 1.8
      */
-    public static Spliterator.OfDouble spliterator(double[] array, int fromIndex, int toIndex) {
-        return Spliterators.spliterator(array, fromIndex, toIndex,
-                                        Spliterator.ORDERED | Spliterator.IMMUTABLE);
+    public static IntStream stream(int[] array) {
+        return stream(array, 0, array.length);
+    }
+
+    /**
+     * Returns a sequential {@link IntStream} with the specified range of the
+     * specified array as its source.
+     *
+     * @param array the array, assumed to be unmodified during use
+     * @param startInclusive the first index to cover, inclusive
+     * @param endExclusive index immediately past the last index to cover
+     * @return an {@code IntStream} for the array range
+     * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+     *         negative, {@code endExclusive} is less than
+     *         {@code startInclusive}, or {@code endExclusive} is greater than
+     *         the array size
+     * @since 1.8
+     */
+    public static IntStream stream(int[] array, int startInclusive, int endExclusive) {
+        return StreamSupport.intStream(spliterator(array, startInclusive, endExclusive));
+    }
+
+    /**
+     * Returns a sequential {@link LongStream} with the specified array as its
+     * source.
+     *
+     * @param array the array, assumed to be unmodified during use
+     * @return a {@code LongStream} for the array
+     * @since 1.8
+     */
+    public static LongStream stream(long[] array) {
+        return stream(array, 0, array.length);
+    }
+
+    /**
+     * Returns a sequential {@link LongStream} with the specified range of the
+     * specified array as its source.
+     *
+     * @param array the array, assumed to be unmodified during use
+     * @param startInclusive the first index to cover, inclusive
+     * @param endExclusive index immediately past the last index to cover
+     * @return a {@code LongStream} for the array range
+     * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+     *         negative, {@code endExclusive} is less than
+     *         {@code startInclusive}, or {@code endExclusive} is greater than
+     *         the array size
+     * @since 1.8
+     */
+    public static LongStream stream(long[] array, int startInclusive, int endExclusive) {
+        return StreamSupport.longStream(spliterator(array, startInclusive, endExclusive));
+    }
+
+    /**
+     * Returns a sequential {@link DoubleStream} with the specified array as its
+     * source.
+     *
+     * @param array the array, assumed to be unmodified during use
+     * @return a {@code DoubleStream} for the array
+     * @since 1.8
+     */
+    public static DoubleStream stream(double[] array) {
+        return stream(array, 0, array.length);
+    }
+
+    /**
+     * Returns a sequential {@link DoubleStream} with the specified range of the
+     * specified array as its source.
+     *
+     * @param array the array, assumed to be unmodified during use
+     * @param startInclusive the first index to cover, inclusive
+     * @param endExclusive index immediately past the last index to cover
+     * @return a {@code DoubleStream} for the array range
+     * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
+     *         negative, {@code endExclusive} is less than
+     *         {@code startInclusive}, or {@code endExclusive} is greater than
+     *         the array size
+     * @since 1.8
+     */
+    public static DoubleStream stream(double[] array, int startInclusive, int endExclusive) {
+        return StreamSupport.doubleStream(spliterator(array, startInclusive, endExclusive));
     }
 }
--- a/jdk/src/share/classes/java/util/Base64.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/Base64.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,6 +139,9 @@
                  throw new IllegalArgumentException(
                      "Illegal base64 line separator character 0x" + Integer.toString(b, 16));
          }
+         if (lineLength <= 0) {
+             return Encoder.RFC4648;
+         }
          return new Encoder(false, lineSeparator, lineLength >> 2 << 2);
     }
 
--- a/jdk/src/share/classes/java/util/Collection.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/Collection.java	Wed May 08 10:10:05 2013 +0100
@@ -25,6 +25,10 @@
 
 package java.util;
 
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
 /**
  * The root interface in the <i>collection hierarchy</i>.  A collection
  * represents a group of objects, known as its <i>elements</i>.  Some
@@ -373,6 +377,40 @@
     boolean removeAll(Collection<?> c);
 
     /**
+     * Removes all of the elements of this collection that satisfy the given
+     * predicate.  Errors or runtime exceptions thrown by the predicate are
+     * relayed to the caller.
+     *
+     * @implSpec
+     * The default implementation traverses all elements of the collection using
+     * its {@link #iterator}.  Each matching element is removed using
+     * {@link Iterator#remove()}.  If the collection's iterator does not
+     * support removal then an {@code UnsupportedOperationException} will be
+     * thrown on the first matching element.
+     *
+     * @param filter a predicate which returns {@code true} for elements to be
+     *        removed
+     * @return {@code true} if any elements were removed
+     * @throws NullPointerException if the specified filter is null
+     * @throws UnsupportedOperationException if the {@code remove}
+     *         method is not supported by this collection's
+     *         {@link #iterator}
+     * @since 1.8
+     */
+    default boolean removeIf(Predicate<? super E> filter) {
+        Objects.requireNonNull(filter);
+        boolean removed = false;
+        final Iterator<E> each = iterator();
+        while (each.hasNext()) {
+            if (filter.test(each.next())) {
+                each.remove();
+                removed = true;
+            }
+        }
+        return removed;
+    }
+
+    /**
      * Retains only the elements in this collection that are contained in the
      * specified collection (optional operation).  In other words, removes from
      * this collection all of its elements that are not contained in the
@@ -463,9 +501,28 @@
     /**
      * Creates a {@link Spliterator} over the elements in this collection.
      *
-     * <p>The {@code Spliterator} reports {@link Spliterator#SIZED}.
-     * Implementations should document the reporting of additional
-     * characteristic values.
+     * <p>The returned {@code Spliterator} must report the characteristic
+     * {@link Spliterator#SIZED}; implementations should document any additional
+     * characteristic values reported by the returned Spliterator.
+     *
+     * <p>The default implementation should be overridden by subclasses that
+     * can return a more efficient spliterator.  In order to
+     * preserve expected laziness behavior for the {@link #stream()} and
+     * {@link #parallelStream()}} methods, spliterators should either have the
+     * characteristic of {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <em><a href="Spliterator.html#binding">late-binding</a></em>.
+     * If none of these is practical, the overriding class should describe the
+     * spliterator's documented policy of binding and structural interference,
+     * and should override the {@link #stream()} and {@link #parallelStream()}
+     * methods to create streams using a {@code Supplier} of the spliterator,
+     * as in:
+     * <pre>{@code
+     *     Stream<E> s = StreamSupport.stream(() -> spliterator(), spliteratorCharacteristics)
+     * }</pre>
+     * <p>These requirements ensure that streams produced by the
+     * {@link #stream()} and {@link #parallelStream()} methods will reflect the
+     * contents of the collection as of initiation of the terminal stream
+     * operation.
      *
      * @implSpec
      * The default implementation creates a
@@ -474,7 +531,7 @@
      * <em>fail-fast</em> properties of the collection's iterator.
      *
      * @implNote
-     * The created {@code Spliterator} additionally reports
+     * The returned {@code Spliterator} additionally reports
      * {@link Spliterator#SUBSIZED}.
      *
      * @return a {@code Spliterator} over the elements in this collection
@@ -483,4 +540,44 @@
     default Spliterator<E> spliterator() {
         return Spliterators.spliterator(this, 0);
     }
+
+    /**
+     * Returns a sequential {@code Stream} with this collection as its source.
+     *
+     * <p>This method should be overridden when the {@link #spliterator()}
+     * method cannot return a spliterator that is {@code IMMUTABLE},
+     * {@code CONCURRENT}, or <em>late-binding</em>. (See {@link #spliterator()}
+     * for details.)
+     *
+     * @implSpec
+     * The default implementation creates a sequential {@code Stream} from the
+     * collection's {@code Spliterator}.
+     *
+     * @return a sequential {@code Stream} over the elements in this collection
+     * @since 1.8
+     */
+    default Stream<E> stream() {
+        return StreamSupport.stream(spliterator());
+    }
+
+    /**
+     * Returns a possibly parallel {@code Stream} with this collection as its
+     * source.  It is allowable for this method to return a sequential stream.
+     *
+     * <p>This method should be overridden when the {@link #spliterator()}
+     * method cannot return a spliterator that is {@code IMMUTABLE},
+     * {@code CONCURRENT}, or <em>late-binding</em>. (See {@link #spliterator()}
+     * for details.)
+     *
+     * @implSpec
+     * The default implementation creates a parallel {@code Stream} from the
+     * collection's {@code Spliterator}.
+     *
+     * @return a possibly parallel {@code Stream} over the elements in this
+     * collection
+     * @since 1.8
+     */
+    default Stream<E> parallelStream() {
+        return StreamSupport.parallelStream(spliterator());
+    }
 }
--- a/jdk/src/share/classes/java/util/Collections.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/Collections.java	Wed May 08 10:10:05 2013 +0100
@@ -30,7 +30,10 @@
 import java.lang.reflect.Array;
 import java.util.function.BiConsumer;
 import java.util.function.BiFunction;
+import java.util.function.Consumer;
 import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
 
 /**
  * This class consists exclusively of static methods that operate on or return
@@ -1085,6 +1088,11 @@
                 public void remove() {
                     throw new UnsupportedOperationException();
                 }
+                @Override
+                public void forEachRemaining(Consumer<? super E> action) {
+                    // Use backing collection version
+                    i.forEachRemaining(action);
+                }
             };
         }
 
@@ -1110,6 +1118,21 @@
         public void clear() {
             throw new UnsupportedOperationException();
         }
+
+        // Override default methods in Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            c.forEach(action);
+        }
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public Spliterator<E> spliterator() {
+            return (Spliterator<E>)c.spliterator();
+        }
+
     }
 
     /**
@@ -1240,6 +1263,16 @@
         public boolean addAll(int index, Collection<? extends E> c) {
             throw new UnsupportedOperationException();
         }
+
+        @Override
+        public void replaceAll(UnaryOperator<E> operator) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public void sort(Comparator<? super E> c) {
+            throw new UnsupportedOperationException();
+        }
+
         public ListIterator<E> listIterator()   {return listIterator(0);}
 
         public ListIterator<E> listIterator(final int index) {
@@ -1263,6 +1296,11 @@
                 public void add(E e) {
                     throw new UnsupportedOperationException();
                 }
+
+                @Override
+                public void forEachRemaining(Consumer<? super E> action) {
+                    i.forEachRemaining(action);
+                }
             };
         }
 
@@ -1642,7 +1680,8 @@
      * through the returned collection.<p>
      *
      * It is imperative that the user manually synchronize on the returned
-     * collection when iterating over it:
+     * collection when traversing it via {@link Iterator} or
+     * {@link Spliterator}:
      * <pre>
      *  Collection c = Collections.synchronizedCollection(myCollection);
      *     ...
@@ -1739,6 +1778,19 @@
         public String toString() {
             synchronized (mutex) {return c.toString();}
         }
+        // Override default methods in Collection
+        @Override
+        public void forEach(Consumer<? super E> consumer) {
+            synchronized (mutex) {c.forEach(consumer);}
+        }
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            synchronized (mutex) {return c.removeIf(filter);}
+        }
+        @Override
+        public Spliterator<E> spliterator() {
+            return c.spliterator(); // Must be manually synched by user!
+        }
         private void writeObject(ObjectOutputStream s) throws IOException {
             synchronized (mutex) {s.defaultWriteObject();}
         }
@@ -1996,6 +2048,15 @@
             }
         }
 
+        @Override
+        public void replaceAll(UnaryOperator<E> operator) {
+            synchronized (mutex) {list.replaceAll(operator);}
+        }
+        @Override
+        public void sort(Comparator<? super E> c) {
+            synchronized (mutex) {list.sort(c);}
+        }
+
         /**
          * SynchronizedRandomAccessList instances are serialized as
          * SynchronizedList instances to allow them to be deserialized
@@ -2492,6 +2553,16 @@
             // element as we added it)
             return c.addAll(checkedCopyOf(coll));
         }
+
+        // Override default methods in Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {c.forEach(action);}
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            return c.removeIf(filter);
+        }
+        @Override
+        public Spliterator<E> spliterator() {return c.spliterator();}
     }
 
     /**
@@ -2747,12 +2818,26 @@
                     typeCheck(e);
                     i.add(e);
                 }
+
+                @Override
+                public void forEachRemaining(Consumer<? super E> action) {
+                    i.forEachRemaining(action);
+                }
             };
         }
 
         public List<E> subList(int fromIndex, int toIndex) {
             return new CheckedList<>(list.subList(fromIndex, toIndex), type);
         }
+
+        @Override
+        public void replaceAll(UnaryOperator<E> operator) {
+            list.replaceAll(operator);
+        }
+        @Override
+        public void sort(Comparator<? super E> c) {
+            list.sort(c);
+        }
     }
 
     /**
@@ -3276,6 +3361,10 @@
         public boolean hasNext() { return false; }
         public E next() { throw new NoSuchElementException(); }
         public void remove() { throw new IllegalStateException(); }
+        @Override
+        public void forEachRemaining(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+        }
     }
 
     /**
@@ -3416,6 +3505,19 @@
             return a;
         }
 
+        // Override default methods in Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+        }
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            Objects.requireNonNull(filter);
+            return false;
+        }
+        @Override
+        public Spliterator<E> spliterator() { return Spliterators.emptySpliterator(); }
+
         // Preserves singleton property
         private Object readResolve() {
             return EMPTY_SET;
@@ -3523,6 +3625,21 @@
         public E last() {
             throw new NoSuchElementException();
         }
+
+        // Override default methods in Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+        }
+
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            Objects.requireNonNull(filter);
+            return false;
+        }
+
+        @Override
+        public Spliterator<E> spliterator() { return Spliterators.emptySpliterator(); }
     }
 
     /**
@@ -3592,6 +3709,29 @@
 
         public int hashCode() { return 1; }
 
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            Objects.requireNonNull(filter);
+            return false;
+        }
+        @Override
+        public void replaceAll(UnaryOperator<E> operator) {
+            Objects.requireNonNull(operator);
+        }
+        @Override
+        public void sort(Comparator<? super E> c) {
+            Objects.requireNonNull(c);
+        }
+
+        // Override default methods in Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+        }
+
+        @Override
+        public Spliterator<E> spliterator() { return Spliterators.emptySpliterator(); }
+
         // Preserves singleton property
         private Object readResolve() {
             return EMPTY_LIST;
@@ -3747,6 +3887,60 @@
             public void remove() {
                 throw new UnsupportedOperationException();
             }
+            @Override
+            public void forEachRemaining(Consumer<? super E> action) {
+                Objects.requireNonNull(action);
+                if (hasNext) {
+                    action.accept(e);
+                    hasNext = false;
+                }
+            }
+        };
+    }
+
+    /**
+     * Creates a {@code Spliterator} with only the specified element
+     *
+     * @param <T> Type of elements
+     * @return A singleton {@code Spliterator}
+     */
+    static <T> Spliterator<T> singletonSpliterator(final T element) {
+        return new Spliterator<T>() {
+            long est = 1;
+
+            @Override
+            public Spliterator<T> trySplit() {
+                return null;
+            }
+
+            @Override
+            public boolean tryAdvance(Consumer<? super T> consumer) {
+                Objects.requireNonNull(consumer);
+                if (est > 0) {
+                    est--;
+                    consumer.accept(element);
+                    return true;
+                }
+                return false;
+            }
+
+            @Override
+            public void forEachRemaining(Consumer<? super T> consumer) {
+                tryAdvance(consumer);
+            }
+
+            @Override
+            public long estimateSize() {
+                return est;
+            }
+
+            @Override
+            public int characteristics() {
+                int value = (element != null) ? Spliterator.NONNULL : 0;
+
+                return value | Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.IMMUTABLE |
+                       Spliterator.DISTINCT | Spliterator.ORDERED;
+            }
         };
     }
 
@@ -3770,6 +3964,20 @@
         public int size() {return 1;}
 
         public boolean contains(Object o) {return eq(o, element);}
+
+        // Override default methods for Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            action.accept(element);
+        }
+        @Override
+        public Spliterator<E> spliterator() {
+            return singletonSpliterator(element);
+        }
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            throw new UnsupportedOperationException();
+        }
     }
 
     /**
@@ -3810,6 +4018,27 @@
               throw new IndexOutOfBoundsException("Index: "+index+", Size: 1");
             return element;
         }
+
+        // Override default methods for Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            action.accept(element);
+        }
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public void replaceAll(UnaryOperator<E> operator) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public void sort(Comparator<? super E> c) {
+        }
+        @Override
+        public Spliterator<E> spliterator() {
+            return singletonSpliterator(element);
+        }
     }
 
     /**
@@ -4408,6 +4637,19 @@
         public boolean retainAll(Collection<?> c)   {return s.retainAll(c);}
         // addAll is the only inherited implementation
 
+        // Override default methods in Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            s.forEach(action);
+        }
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            return s.removeIf(filter);
+        }
+
+        @Override
+        public Spliterator<E> spliterator() {return s.spliterator();}
+
         private static final long serialVersionUID = 2454657854757543876L;
 
         private void readObject(java.io.ObjectInputStream stream)
@@ -4466,5 +4708,15 @@
         public boolean removeAll(Collection<?> c)   {return q.removeAll(c);}
         public boolean retainAll(Collection<?> c)   {return q.retainAll(c);}
         // We use inherited addAll; forwarding addAll would be wrong
+
+        // Override default methods in Collection
+        @Override
+        public void forEach(Consumer<? super E> action) {q.forEach(action);}
+        @Override
+        public Spliterator<E> spliterator() {return q.spliterator();}
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            return q.removeIf(filter);
+        }
     }
 }
--- a/jdk/src/share/classes/java/util/Currency.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/Currency.java	Wed May 08 10:10:05 2013 +0100
@@ -47,9 +47,8 @@
 
 /**
  * Represents a currency. Currencies are identified by their ISO 4217 currency
- * codes. Visit the <a href="http://www.iso.org/iso/en/prods-services/popstds/currencycodes.html">
- * ISO web site</a> for more information, including a table of
- * currency codes.
+ * codes. Visit the <a href="http://www.iso.org/iso/home/standards/currency_codes.htm">
+ * ISO web site</a> for more information.
  * <p>
  * The class is designed so that there's never more than one
  * <code>Currency</code> instance for any given currency. Therefore, there's
--- a/jdk/src/share/classes/java/util/HashMap.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/HashMap.java	Wed May 08 10:10:05 2013 +0100
@@ -1230,6 +1230,14 @@
         public void clear() {
             HashMap.this.clear();
         }
+
+        public Spliterator<K> spliterator() {
+            if (HashMap.this.getClass() == HashMap.class)
+                return new KeySpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+            else
+                return Spliterators.spliterator
+                        (this, Spliterator.SIZED | Spliterator.DISTINCT);
+        }
     }
 
     /**
@@ -1263,6 +1271,14 @@
         public void clear() {
             HashMap.this.clear();
         }
+
+        public Spliterator<V> spliterator() {
+            if (HashMap.this.getClass() == HashMap.class)
+                return new ValueSpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+            else
+                return Spliterators.spliterator
+                        (this, Spliterator.SIZED);
+        }
     }
 
     /**
@@ -1310,6 +1326,14 @@
         public void clear() {
             HashMap.this.clear();
         }
+
+        public Spliterator<Map.Entry<K,V>> spliterator() {
+            if (HashMap.this.getClass() == HashMap.class)
+                return new EntrySpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+            else
+                return Spliterators.spliterator
+                        (this, Spliterator.SIZED | Spliterator.DISTINCT);
+        }
     }
 
     /**
@@ -1406,4 +1430,257 @@
     // These methods are used when serializing HashSets
     int   capacity()     { return table.length; }
     float loadFactor()   { return loadFactor;   }
+
+    /**
+     * Standin until HM overhaul; based loosely on Weak and Identity HM.
+     */
+    static class HashMapSpliterator<K,V> {
+        final HashMap<K,V> map;
+        HashMap.Entry<K,V> current; // current node
+        int index;                  // current index, modified on advance/split
+        int fence;                  // one past last index
+        int est;                    // size estimate
+        int expectedModCount;       // for comodification checks
+
+        HashMapSpliterator(HashMap<K,V> m, int origin,
+                               int fence, int est,
+                               int expectedModCount) {
+            this.map = m;
+            this.index = origin;
+            this.fence = fence;
+            this.est = est;
+            this.expectedModCount = expectedModCount;
+        }
+
+        final int getFence() { // initialize fence and size on first use
+            int hi;
+            if ((hi = fence) < 0) {
+                HashMap<K,V> m = map;
+                est = m.size;
+                expectedModCount = m.modCount;
+                hi = fence = m.table.length;
+            }
+            return hi;
+        }
+
+        public final long estimateSize() {
+            getFence(); // force init
+            return (long) est;
+        }
+    }
+
+    static final class KeySpliterator<K,V>
+        extends HashMapSpliterator<K,V>
+        implements Spliterator<K> {
+        KeySpliterator(HashMap<K,V> m, int origin, int fence, int est,
+                       int expectedModCount) {
+            super(m, origin, fence, est, expectedModCount);
+        }
+
+        public KeySpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid || current != null) ? null :
+                new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                        expectedModCount);
+        }
+
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super K> action) {
+            int i, hi, mc;
+            if (action == null)
+                throw new NullPointerException();
+            HashMap<K,V> m = map;
+            HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])m.table;
+            if ((hi = fence) < 0) {
+                mc = expectedModCount = m.modCount;
+                hi = fence = tab.length;
+            }
+            else
+                mc = expectedModCount;
+            if (tab.length >= hi && (i = index) >= 0 && i < (index = hi)) {
+                HashMap.Entry<K,V> p = current;
+                do {
+                    if (p == null)
+                        p = tab[i++];
+                    else {
+                        action.accept(p.getKey());
+                        p = p.next;
+                    }
+                } while (p != null || i < hi);
+                if (m.modCount != mc)
+                    throw new ConcurrentModificationException();
+            }
+        }
+
+        @SuppressWarnings("unchecked")
+        public boolean tryAdvance(Consumer<? super K> action) {
+            int hi;
+            if (action == null)
+                throw new NullPointerException();
+            HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])map.table;
+            if (tab.length >= (hi = getFence()) && index >= 0) {
+                while (current != null || index < hi) {
+                    if (current == null)
+                        current = tab[index++];
+                    else {
+                        K k = current.getKey();
+                        current = current.next;
+                        action.accept(k);
+                        if (map.modCount != expectedModCount)
+                            throw new ConcurrentModificationException();
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return (fence < 0 || est == map.size ? Spliterator.SIZED : 0) |
+                Spliterator.DISTINCT;
+        }
+    }
+
+    static final class ValueSpliterator<K,V>
+        extends HashMapSpliterator<K,V>
+        implements Spliterator<V> {
+        ValueSpliterator(HashMap<K,V> m, int origin, int fence, int est,
+                         int expectedModCount) {
+            super(m, origin, fence, est, expectedModCount);
+        }
+
+        public ValueSpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid || current != null) ? null :
+                new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                          expectedModCount);
+        }
+
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super V> action) {
+            int i, hi, mc;
+            if (action == null)
+                throw new NullPointerException();
+            HashMap<K,V> m = map;
+            HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])m.table;
+            if ((hi = fence) < 0) {
+                mc = expectedModCount = m.modCount;
+                hi = fence = tab.length;
+            }
+            else
+                mc = expectedModCount;
+            if (tab.length >= hi && (i = index) >= 0 && i < (index = hi)) {
+                HashMap.Entry<K,V> p = current;
+                do {
+                    if (p == null)
+                        p = tab[i++];
+                    else {
+                        action.accept(p.getValue());
+                        p = p.next;
+                    }
+                } while (p != null || i < hi);
+                if (m.modCount != mc)
+                    throw new ConcurrentModificationException();
+            }
+        }
+
+        @SuppressWarnings("unchecked")
+        public boolean tryAdvance(Consumer<? super V> action) {
+            int hi;
+            if (action == null)
+                throw new NullPointerException();
+            HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])map.table;
+            if (tab.length >= (hi = getFence()) && index >= 0) {
+                while (current != null || index < hi) {
+                    if (current == null)
+                        current = tab[index++];
+                    else {
+                        V v = current.getValue();
+                        current = current.next;
+                        action.accept(v);
+                        if (map.modCount != expectedModCount)
+                            throw new ConcurrentModificationException();
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return (fence < 0 || est == map.size ? Spliterator.SIZED : 0);
+        }
+    }
+
+    static final class EntrySpliterator<K,V>
+        extends HashMapSpliterator<K,V>
+        implements Spliterator<Map.Entry<K,V>> {
+        EntrySpliterator(HashMap<K,V> m, int origin, int fence, int est,
+                         int expectedModCount) {
+            super(m, origin, fence, est, expectedModCount);
+        }
+
+        public EntrySpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid || current != null) ? null :
+                new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                          expectedModCount);
+        }
+
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super Map.Entry<K,V>> action) {
+            int i, hi, mc;
+            if (action == null)
+                throw new NullPointerException();
+            HashMap<K,V> m = map;
+            HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])m.table;
+            if ((hi = fence) < 0) {
+                mc = expectedModCount = m.modCount;
+                hi = fence = tab.length;
+            }
+            else
+                mc = expectedModCount;
+            if (tab.length >= hi && (i = index) >= 0 && i < (index = hi)) {
+                HashMap.Entry<K,V> p = current;
+                do {
+                    if (p == null)
+                        p = tab[i++];
+                    else {
+                        action.accept(p);
+                        p = p.next;
+                    }
+                } while (p != null || i < hi);
+                if (m.modCount != mc)
+                    throw new ConcurrentModificationException();
+            }
+        }
+
+        @SuppressWarnings("unchecked")
+        public boolean tryAdvance(Consumer<? super Map.Entry<K,V>> action) {
+            int hi;
+            if (action == null)
+                throw new NullPointerException();
+            HashMap.Entry<K,V>[] tab = (HashMap.Entry<K,V>[])map.table;
+            if (tab.length >= (hi = getFence()) && index >= 0) {
+                while (current != null || index < hi) {
+                    if (current == null)
+                        current = tab[index++];
+                    else {
+                        HashMap.Entry<K,V> e = current;
+                        current = current.next;
+                        action.accept(e);
+                        if (map.modCount != expectedModCount)
+                            throw new ConcurrentModificationException();
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return (fence < 0 || est == map.size ? Spliterator.SIZED : 0) |
+                Spliterator.DISTINCT;
+        }
+    }
 }
--- a/jdk/src/share/classes/java/util/HashSet.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/HashSet.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -311,4 +311,8 @@
             map.put(e, PRESENT);
         }
     }
+
+    public Spliterator<E> spliterator() {
+        return new HashMap.KeySpliterator<E,Object>(map, 0, -1, 0, 0);
+    }
 }
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,10 @@
  */
 
 package java.util;
+
 import java.io.*;
 import java.lang.reflect.Array;
+import java.util.function.Consumer;
 
 /**
  * This class implements the <tt>Map</tt> interface with a hash table, using
@@ -162,19 +164,19 @@
     /**
      * The table, resized as necessary. Length MUST always be a power of two.
      */
-    private transient Object[] table;
+    transient Object[] table; // non-private to simplify nested class access
 
     /**
      * The number of key-value mappings contained in this identity hash map.
      *
      * @serial
      */
-    private int size;
+    int size;
 
     /**
      * The number of modifications, to support fast-fail iterators
      */
-    private transient int modCount;
+    transient int modCount;
 
     /**
      * The next size value at which to resize (capacity * load factor).
@@ -184,7 +186,7 @@
     /**
      * Value representing null keys inside tables.
      */
-    private static final Object NULL_KEY = new Object();
+    static final Object NULL_KEY = new Object();
 
     /**
      * Use NULL_KEY for key if it is null.
@@ -196,7 +198,7 @@
     /**
      * Returns internal representation of null key back to caller as null.
      */
-    private static Object unmaskNull(Object key) {
+    static final Object unmaskNull(Object key) {
         return (key == NULL_KEY ? null : key);
     }
 
@@ -1012,7 +1014,7 @@
             return result;
         }
         public Object[] toArray() {
-            return toArray(new Object[size()]);
+            return toArray(new Object[0]);
         }
         @SuppressWarnings("unchecked")
         public <T> T[] toArray(T[] a) {
@@ -1042,6 +1044,10 @@
             }
             return a;
         }
+
+        public Spliterator<K> spliterator() {
+            return new KeySpliterator<>(IdentityHashMap.this, 0, -1, 0, 0);
+        }
     }
 
     /**
@@ -1095,7 +1101,7 @@
             IdentityHashMap.this.clear();
         }
         public Object[] toArray() {
-            return toArray(new Object[size()]);
+            return toArray(new Object[0]);
         }
         @SuppressWarnings("unchecked")
         public <T> T[] toArray(T[] a) {
@@ -1124,6 +1130,10 @@
             }
             return a;
         }
+
+        public Spliterator<V> spliterator() {
+            return new ValueSpliterator<>(IdentityHashMap.this, 0, -1, 0, 0);
+        }
     }
 
     /**
@@ -1211,7 +1221,7 @@
         }
 
         public Object[] toArray() {
-            return toArray(new Object[size()]);
+            return toArray(new Object[0]);
         }
 
         @SuppressWarnings("unchecked")
@@ -1242,6 +1252,10 @@
             }
             return a;
         }
+
+        public Spliterator<Map.Entry<K,V>> spliterator() {
+            return new EntrySpliterator<>(IdentityHashMap.this, 0, -1, 0, 0);
+        }
     }
 
 
@@ -1322,4 +1336,223 @@
         tab[i] = k;
         tab[i + 1] = value;
     }
+
+    /**
+     * Similar form as array-based Spliterators, but skips blank elements,
+     * and guestimates size as decreasing by half per split.
+     */
+    static class IdentityHashMapSpliterator<K,V> {
+        final IdentityHashMap<K,V> map;
+        int index;             // current index, modified on advance/split
+        int fence;             // -1 until first use; then one past last index
+        int est;               // size estimate
+        int expectedModCount;  // initialized when fence set
+
+        IdentityHashMapSpliterator(IdentityHashMap<K,V> map, int origin,
+                                   int fence, int est, int expectedModCount) {
+            this.map = map;
+            this.index = origin;
+            this.fence = fence;
+            this.est = est;
+            this.expectedModCount = expectedModCount;
+        }
+
+        final int getFence() { // initialize fence and size on first use
+            int hi;
+            if ((hi = fence) < 0) {
+                est = map.size;
+                expectedModCount = map.modCount;
+                hi = fence = map.table.length;
+            }
+            return hi;
+        }
+
+        public final long estimateSize() {
+            getFence(); // force init
+            return (long) est;
+        }
+    }
+
+    static final class KeySpliterator<K,V>
+        extends IdentityHashMapSpliterator<K,V>
+        implements Spliterator<K> {
+        KeySpliterator(IdentityHashMap<K,V> map, int origin, int fence, int est,
+                       int expectedModCount) {
+            super(map, origin, fence, est, expectedModCount);
+        }
+
+        public KeySpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
+            return (lo >= mid) ? null :
+                new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                        expectedModCount);
+        }
+
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super K> action) {
+            if (action == null)
+                throw new NullPointerException();
+            int i, hi, mc; Object key;
+            IdentityHashMap<K,V> m; Object[] a;
+            if ((m = map) != null && (a = m.table) != null &&
+                (i = index) >= 0 && (index = hi = getFence()) <= a.length) {
+                for (; i < hi; i += 2) {
+                    if ((key = a[i]) != null)
+                        action.accept((K)unmaskNull(key));
+                }
+                if (m.modCount == expectedModCount)
+                    return;
+            }
+            throw new ConcurrentModificationException();
+        }
+
+        @SuppressWarnings("unchecked")
+        public boolean tryAdvance(Consumer<? super K> action) {
+            if (action == null)
+                throw new NullPointerException();
+            Object[] a = map.table;
+            int hi = getFence();
+            while (index < hi) {
+                Object key = a[index];
+                index += 2;
+                if (key != null) {
+                    action.accept((K)unmaskNull(key));
+                    if (map.modCount != expectedModCount)
+                        throw new ConcurrentModificationException();
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return (fence < 0 || est == map.size ? SIZED : 0) | Spliterator.DISTINCT;
+        }
+    }
+
+    static final class ValueSpliterator<K,V>
+        extends IdentityHashMapSpliterator<K,V>
+        implements Spliterator<V> {
+        ValueSpliterator(IdentityHashMap<K,V> m, int origin, int fence, int est,
+                         int expectedModCount) {
+            super(m, origin, fence, est, expectedModCount);
+        }
+
+        public ValueSpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
+            return (lo >= mid) ? null :
+                new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                          expectedModCount);
+        }
+
+        public void forEachRemaining(Consumer<? super V> action) {
+            if (action == null)
+                throw new NullPointerException();
+            int i, hi, mc;
+            IdentityHashMap<K,V> m; Object[] a;
+            if ((m = map) != null && (a = m.table) != null &&
+                (i = index) >= 0 && (index = hi = getFence()) <= a.length) {
+                for (; i < hi; i += 2) {
+                    if (a[i] != null) {
+                        @SuppressWarnings("unchecked") V v = (V)a[i+1];
+                        action.accept(v);
+                    }
+                }
+                if (m.modCount == expectedModCount)
+                    return;
+            }
+            throw new ConcurrentModificationException();
+        }
+
+        public boolean tryAdvance(Consumer<? super V> action) {
+            if (action == null)
+                throw new NullPointerException();
+            Object[] a = map.table;
+            int hi = getFence();
+            while (index < hi) {
+                Object key = a[index];
+                @SuppressWarnings("unchecked") V v = (V)a[index+1];
+                index += 2;
+                if (key != null) {
+                    action.accept(v);
+                    if (map.modCount != expectedModCount)
+                        throw new ConcurrentModificationException();
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return (fence < 0 || est == map.size ? SIZED : 0);
+        }
+
+    }
+
+    static final class EntrySpliterator<K,V>
+        extends IdentityHashMapSpliterator<K,V>
+        implements Spliterator<Map.Entry<K,V>> {
+        EntrySpliterator(IdentityHashMap<K,V> m, int origin, int fence, int est,
+                         int expectedModCount) {
+            super(m, origin, fence, est, expectedModCount);
+        }
+
+        public EntrySpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = ((lo + hi) >>> 1) & ~1;
+            return (lo >= mid) ? null :
+                new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                          expectedModCount);
+        }
+
+        public void forEachRemaining(Consumer<? super Map.Entry<K, V>> action) {
+            if (action == null)
+                throw new NullPointerException();
+            int i, hi, mc;
+            IdentityHashMap<K,V> m; Object[] a;
+            if ((m = map) != null && (a = m.table) != null &&
+                (i = index) >= 0 && (index = hi = getFence()) <= a.length) {
+                for (; i < hi; i += 2) {
+                    Object key = a[i];
+                    if (key != null) {
+                        @SuppressWarnings("unchecked") K k =
+                            (K)unmaskNull(key);
+                        @SuppressWarnings("unchecked") V v = (V)a[i+1];
+                        action.accept
+                            (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+
+                    }
+                }
+                if (m.modCount == expectedModCount)
+                    return;
+            }
+            throw new ConcurrentModificationException();
+        }
+
+        public boolean tryAdvance(Consumer<? super Map.Entry<K,V>> action) {
+            if (action == null)
+                throw new NullPointerException();
+            Object[] a = map.table;
+            int hi = getFence();
+            while (index < hi) {
+                Object key = a[index];
+                @SuppressWarnings("unchecked") V v = (V)a[index+1];
+                index += 2;
+                if (key != null) {
+                    @SuppressWarnings("unchecked") K k =
+                        (K)unmaskNull(key);
+                    action.accept
+                        (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+                    if (map.modCount != expectedModCount)
+                        throw new ConcurrentModificationException();
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return (fence < 0 || est == map.size ? SIZED : 0) | Spliterator.DISTINCT;
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/util/LinkedHashSet.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/LinkedHashSet.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -168,4 +168,18 @@
         super(Math.max(2*c.size(), 11), .75f, true);
         addAll(c);
     }
+
+    /**
+     * Creates a {@code Spliterator}, over the elements in this set, that
+     * reports {@code SIZED}, {@code DISTINCT} and {@code ORDERED}.
+     * Overriding implementations are expected to document if the
+     * {@code Spliterator} reports any additional and relevant characteristic
+     * values.
+     *
+     * @return a {@code Spliterator} over the elements in this set
+     */
+    @Override
+    public Spliterator<E> spliterator() {
+        return Spliterators.spliterator(this, Spliterator.DISTINCT | Spliterator.ORDERED);
+    }
 }
--- a/jdk/src/share/classes/java/util/LinkedList.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/LinkedList.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package java.util;
 
+import java.util.function.Consumer;
+
 /**
  * Doubly-linked list implementation of the {@code List} and {@code Deque}
  * interfaces.  Implements all optional list operations, and permits all
@@ -948,6 +950,17 @@
             expectedModCount++;
         }
 
+        public void forEachRemaining(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+            while (modCount == expectedModCount && nextIndex < size) {
+                action.accept(next.item);
+                next = next.next;
+                nextIndex++;
+            }
+            lastReturned = next;
+            checkForComodification();
+        }
+
         final void checkForComodification() {
             if (modCount != expectedModCount)
                 throw new ConcurrentModificationException();
@@ -1135,4 +1148,103 @@
         for (int i = 0; i < size; i++)
             linkLast((E)s.readObject());
     }
+
+    public Spliterator<E> spliterator() {
+        return new LLSpliterator<E>(this, -1, 0);
+    }
+
+    /** A customized variant of Spliterators.IteratorSpliterator */
+    static final class LLSpliterator<E> implements Spliterator<E> {
+        static final int BATCH_UNIT = 1 << 10;  // batch array size increment
+        static final int MAX_BATCH = 1 << 25;  // max batch array size;
+        final LinkedList<E> list; // null OK unless traversed
+        Node<E> current;      // current node; null until initialized
+        int est;              // size estimate; -1 until first needed
+        int expectedModCount; // initialized when est set
+        int batch;            // batch size for splits
+
+        LLSpliterator(LinkedList<E> list, int est, int expectedModCount) {
+            this.list = list;
+            this.est = est;
+            this.expectedModCount = expectedModCount;
+        }
+
+        final int getEst() {
+            int s; // force initialization
+            final LinkedList<E> lst;
+            if ((s = est) < 0) {
+                if ((lst = list) == null)
+                    s = est = 0;
+                else {
+                    expectedModCount = lst.modCount;
+                    current = lst.first;
+                    s = est = lst.size;
+                }
+            }
+            return s;
+        }
+
+        public long estimateSize() { return (long) getEst(); }
+
+        public Spliterator<E> trySplit() {
+            Node<E> p;
+            int s = getEst();
+            if (s > 1 && (p = current) != null) {
+                int n = batch + BATCH_UNIT;
+                if (n > s)
+                    n = s;
+                if (n > MAX_BATCH)
+                    n = MAX_BATCH;
+                Object[] a;
+                try {
+                    a = new Object[n];
+                } catch (OutOfMemoryError oome) {
+                    return null;
+                }
+                int j = 0;
+                do { a[j++] = p.item; } while ((p = p.next) != null && j < n);
+                current = p;
+                batch = j;
+                est = s - j;
+                return Spliterators.spliterator(a, 0, j, Spliterator.ORDERED);
+            }
+            return null;
+        }
+
+        public void forEachRemaining(Consumer<? super E> action) {
+            Node<E> p; int n;
+            if (action == null) throw new NullPointerException();
+            if ((n = getEst()) > 0 && (p = current) != null) {
+                current = null;
+                est = 0;
+                do {
+                    E e = p.item;
+                    p = p.next;
+                    action.accept(e);
+                } while (p != null && --n > 0);
+            }
+            if (list.modCount != expectedModCount)
+                throw new ConcurrentModificationException();
+        }
+
+        public boolean tryAdvance(Consumer<? super E> action) {
+            Node<E> p;
+            if (action == null) throw new NullPointerException();
+            if (getEst() > 0 && (p = current) != null) {
+                --est;
+                E e = p.item;
+                current = p.next;
+                action.accept(e);
+                if (list.modCount != expectedModCount)
+                    throw new ConcurrentModificationException();
+                return true;
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED;
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/util/List.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/List.java	Wed May 08 10:10:05 2013 +0100
@@ -25,6 +25,8 @@
 
 package java.util;
 
+import java.util.function.UnaryOperator;
+
 /**
  * An ordered collection (also known as a <i>sequence</i>).  The user of this
  * interface has precise control over where in the list each element is
@@ -375,6 +377,64 @@
     boolean retainAll(Collection<?> c);
 
     /**
+     * Replaces each element of this list with the result of applying the
+     * operator to that element.  Errors or runtime exceptions thrown by
+     * the operator are relayed to the caller.
+     *
+     * @implSpec
+     * The default implementation is equivalent to, for this {@code list}:
+     * <pre>
+     * final ListIterator<E> li = list.listIterator();
+     * while (li.hasNext()) {
+     *   li.set(operator.apply(li.next()));
+     * }
+     * </pre>
+     * If the list's list-iterator does not support the {@code set} operation
+     * then an {@code UnsupportedOperationException} will be thrown when
+     * replacing the first element.
+     *
+     * @param operator the operator to apply to each element
+     * @throws UnsupportedOperationException if the {@code set}
+     *         operation is not supported by this list
+     * @throws NullPointerException if the specified operator is null or
+     *         if the element is replaced with a null value and this list
+     *         does not permit null elements
+     *         (<a href="Collection.html#optional-restrictions">optional</a>)
+     * @since 1.8
+     */
+    default void replaceAll(UnaryOperator<E> operator) {
+        Objects.requireNonNull(operator);
+        final ListIterator<E> li = this.listIterator();
+        while (li.hasNext()) {
+            li.set(operator.apply(li.next()));
+        }
+    }
+
+    /**
+     * Sorts this list using the supplied {@code Comparator} to compare elements.
+     *
+     * @implSpec
+     * The default implementation is equivalent to, for this {@code list}:
+     * <pre>Collections.sort(list, c)</pre>
+     *
+     * @param c the {@code Comparator} used to compare list elements.
+     *          A {@code null} value indicates that the elements'
+     *          {@linkplain Comparable natural ordering} should be used
+     * @throws ClassCastException if the list contains elements that are not
+     *         <i>mutually comparable</i> using the specified comparator
+     * @throws UnsupportedOperationException if the list's list-iterator does
+     *         not support the {@code set} operation
+     * @throws IllegalArgumentException
+     *         (<a href="Collection.html#optional-restrictions">optional</a>)
+     *         if the comparator is found to violate the {@link Comparator}
+     *         contract
+     * @since 1.8
+     */
+    default void sort(Comparator<? super E> c) {
+        Collections.sort(this, c);
+    }
+
+    /**
      * Removes all of the elements from this list (optional operation).
      * The list will be empty after this call returns.
      *
--- a/jdk/src/share/classes/java/util/PriorityQueue.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/PriorityQueue.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package java.util;
 
+import java.util.function.Consumer;
+
 /**
  * An unbounded priority {@linkplain Queue queue} based on a priority heap.
  * The elements of the priority queue are ordered according to their
@@ -56,7 +58,7 @@
  * the priority queue in any particular order. If you need ordered
  * traversal, consider using {@code Arrays.sort(pq.toArray())}.
  *
- * <p> <strong>Note that this implementation is not synchronized.</strong>
+ * <p><strong>Note that this implementation is not synchronized.</strong>
  * Multiple threads should not access a {@code PriorityQueue}
  * instance concurrently if any of the threads modifies the queue.
  * Instead, use the thread-safe {@link
@@ -92,7 +94,7 @@
      * heap and each descendant d of n, n <= d.  The element with the
      * lowest value is in queue[0], assuming the queue is nonempty.
      */
-    private transient Object[] queue;
+    transient Object[] queue; // non-private to simplify nested class access
 
     /**
      * The number of elements in the priority queue.
@@ -109,7 +111,7 @@
      * The number of times this priority queue has been
      * <i>structurally modified</i>.  See AbstractList for gory details.
      */
-    private transient int modCount = 0;
+    transient int modCount = 0; // non-private to simplify nested class access
 
     /**
      * Creates a {@code PriorityQueue} with the default initial
@@ -332,9 +334,7 @@
 
     @SuppressWarnings("unchecked")
     public E peek() {
-        if (size == 0)
-            return null;
-        return (E) queue[0];
+        return (size == 0) ? null : (E) queue[0];
     }
 
     private int indexOf(Object o) {
@@ -431,15 +431,14 @@
      * precise control over the runtime type of the output array, and may,
      * under certain circumstances, be used to save allocation costs.
      *
-     * <p>Suppose <tt>x</tt> is a queue known to contain only strings.
+     * <p>Suppose {@code x} is a queue known to contain only strings.
      * The following code can be used to dump the queue into a newly
-     * allocated array of <tt>String</tt>:
+     * allocated array of {@code String}:
      *
-     * <pre>
-     *     String[] y = x.toArray(new String[0]);</pre>
+     *  <pre> {@code String[] y = x.toArray(new String[0]);}</pre>
      *
-     * Note that <tt>toArray(new Object[0])</tt> is identical in function to
-     * <tt>toArray()</tt>.
+     * Note that {@code toArray(new Object[0])} is identical in function to
+     * {@code toArray()}.
      *
      * @param a the array into which the elements of the queue are to
      *          be stored, if it is big enough; otherwise, a new array of the
@@ -452,6 +451,7 @@
      */
     @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
+        final int size = this.size;
         if (a.length < size)
             // Make a new array of a's runtime type, but my contents:
             return (T[]) Arrays.copyOf(queue, size, a.getClass());
@@ -569,15 +569,14 @@
         size = 0;
     }
 
+    @SuppressWarnings("unchecked")
     public E poll() {
         if (size == 0)
             return null;
         int s = --size;
         modCount++;
-        @SuppressWarnings("unchecked")
-            E result = (E) queue[0];
-        @SuppressWarnings("unchecked")
-            E x = (E) queue[s];
+        E result = (E) queue[0];
+        E x = (E) queue[s];
         queue[s] = null;
         if (s != 0)
             siftDown(0, x);
@@ -596,15 +595,15 @@
      * position before i. This fact is used by iterator.remove so as to
      * avoid missing traversing elements.
      */
+    @SuppressWarnings("unchecked")
     private E removeAt(int i) {
-        assert i >= 0 && i < size;
+        // assert i >= 0 && i < size;
         modCount++;
         int s = --size;
         if (s == i) // removed last element
             queue[i] = null;
         else {
-            @SuppressWarnings("unchecked")
-                E moved = (E) queue[s];
+            E moved = (E) queue[s];
             queue[s] = null;
             siftDown(i, moved);
             if (queue[i] == moved) {
@@ -649,12 +648,12 @@
         queue[k] = key;
     }
 
+    @SuppressWarnings("unchecked")
     private void siftUpUsingComparator(int k, E x) {
         while (k > 0) {
             int parent = (k - 1) >>> 1;
-            @SuppressWarnings("unchecked")
-                E e = (E) queue[parent];
-            if (comparator.compare(x, e) >= 0)
+            Object e = queue[parent];
+            if (comparator.compare(x, (E) e) >= 0)
                 break;
             queue[k] = e;
             k = parent;
@@ -738,8 +737,7 @@
     }
 
     /**
-     * Saves the state of the instance to a stream (that
-     * is, serializes it).
+     * Saves this queue to a stream (that is, serializes it).
      *
      * @serialData The length of the array backing the instance is
      *             emitted (int), followed by all of its elements
@@ -747,7 +745,7 @@
      * @param s the stream
      */
     private void writeObject(java.io.ObjectOutputStream s)
-        throws java.io.IOException{
+        throws java.io.IOException {
         // Write out element count, and any hidden stuff
         s.defaultWriteObject();
 
@@ -783,4 +781,99 @@
         // spec has never explained what that might be.
         heapify();
     }
+
+    public final Spliterator<E> spliterator() {
+        return new PriorityQueueSpliterator<E>(this, 0, -1, 0);
+    }
+
+    static final class PriorityQueueSpliterator<E> implements Spliterator<E> {
+        /*
+         * This is very similar to ArrayList Spliterator, except for
+         * extra null checks.
+         */
+        private final PriorityQueue<E> pq;
+        private int index;            // current index, modified on advance/split
+        private int fence;            // -1 until first use
+        private int expectedModCount; // initialized when fence set
+
+        /** Creates new spliterator covering the given range */
+        PriorityQueueSpliterator(PriorityQueue<E> pq, int origin, int fence,
+                             int expectedModCount) {
+            this.pq = pq;
+            this.index = origin;
+            this.fence = fence;
+            this.expectedModCount = expectedModCount;
+        }
+
+        private int getFence() { // initialize fence to size on first use
+            int hi;
+            if ((hi = fence) < 0) {
+                expectedModCount = pq.modCount;
+                hi = fence = pq.size;
+            }
+            return hi;
+        }
+
+        public PriorityQueueSpliterator<E> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid) ? null :
+                new PriorityQueueSpliterator<E>(pq, lo, index = mid,
+                                                expectedModCount);
+        }
+
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super E> action) {
+            int i, hi, mc; // hoist accesses and checks from loop
+            PriorityQueue<E> q; Object[] a;
+            if (action == null)
+                throw new NullPointerException();
+            if ((q = pq) != null && (a = q.queue) != null) {
+                if ((hi = fence) < 0) {
+                    mc = q.modCount;
+                    hi = q.size;
+                }
+                else
+                    mc = expectedModCount;
+                if ((i = index) >= 0 && (index = hi) <= a.length) {
+                    for (E e;; ++i) {
+                        if (i < hi) {
+                            if ((e = (E) a[i]) == null) // must be CME
+                                break;
+                            action.accept(e);
+                        }
+                        else if (q.modCount != mc)
+                            break;
+                        else
+                            return;
+                    }
+                }
+            }
+            throw new ConcurrentModificationException();
+        }
+
+        public boolean tryAdvance(Consumer<? super E> action) {
+            if (action == null)
+                throw new NullPointerException();
+            int hi = getFence(), lo = index;
+            if (lo >= 0 && lo < hi) {
+                index = lo + 1;
+                @SuppressWarnings("unchecked") E e = (E)pq.queue[lo];
+                if (e == null)
+                    throw new ConcurrentModificationException();
+                action.accept(e);
+                if (pq.modCount != expectedModCount)
+                    throw new ConcurrentModificationException();
+                return true;
+            }
+            return false;
+        }
+
+        public long estimateSize() {
+            return (long) (getFence() - index);
+        }
+
+        public int characteristics() {
+            return Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.NONNULL;
+        }
+    }
 }
--- a/jdk/src/share/classes/java/util/Spliterator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/Spliterator.java	Wed May 08 10:10:05 2013 +0100
@@ -438,7 +438,7 @@
     /**
      * If this Spliterator's source is {@link #SORTED} by a {@link Comparator},
      * returns that {@code Comparator}. If the source is {@code SORTED} in
-     * {@linkplain Comparable natural order, returns {@code null}.  Otherwise,
+     * {@linkplain Comparable natural order}, returns {@code null}.  Otherwise,
      * if the source is not {@code SORTED}, throws {@link IllegalStateException}.
      *
      * @implSpec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/StringJoiner.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util;
+
+/**
+ * {@code StringJoiner} is used to construct a sequence of characters separated
+ * by a delimiter and optionally starting with a supplied prefix
+ * and ending with a supplied suffix.
+ * <p>
+ * For example, the String {@code "[George:Sally:Fred]"} may
+ * be constructed as follows:
+ * <pre> {@code
+ *     StringJoiner sj = new StringJoiner(":", "[", "]");
+ *     sj.add("George").add("Sally").add("Fred");
+ *     String desiredString = sj.toString();
+ * }</pre>
+ * <p>
+ * Prior to adding something to the {@code StringJoiner}, its
+ * {@code sj.toString()} method will, by default, return {@code prefix + suffix}.
+ * However, if the {@code setEmptyValue} method is called, the {@code emptyValue}
+ * supplied will be returned instead. This can be used, for example, when
+ * creating a string using set notation to indicate an empty set, i.e.
+ * <code>"{}"</code>, where the {@code prefix} is <code>"{"</code>, the
+ * {@code suffix} is <code>"}"</code> and nothing has been added to the
+ * {@code StringJoiner}.
+ * <p>
+ * A {@code StringJoiner} may be employed to create formatted output from a
+ * collection using lambda expressions as shown in the following example.
+ *
+ * <pre> {@code
+ *     List<Person> people = ...
+ *     String commaSeparatedNames =
+ *         people.map(p -> p.getName()).into(new StringJoiner(", ")).toString();
+ * }</pre>
+ *
+ * @author Jim Gish
+ * @since  1.8
+*/
+public final class StringJoiner {
+    private final String prefix;
+    private final String delimiter;
+    private final String suffix;
+
+    /*
+     * StringBuilder value -- at any time, the characters constructed from the
+     * prefix, the added element separated by the delimiter, but without the
+     * suffix, so that we can more easily add elements without having to jigger
+     * the suffix each time.
+     */
+    private StringBuilder value;
+
+    /*
+     * By default, the string consisting of prefix+suffix, returned by
+     * toString(), or properties of value, when no elements have yet been added,
+     * i.e. when it is empty.  This may be overridden by the user to be some
+     * other value including the empty String.
+     */
+    private String emptyValue;
+
+    /**
+     * Constructs a {@code StringJoiner} with no characters in it, with no
+     * {@code prefix} or {@code suffix}, and a copy of the supplied
+     * {@code delimiter}.
+     * If no characters are added to the {@code StringJoiner} and methods
+     * accessing the value of it are invoked, it will not return a
+     * {@code prefix} or {@code suffix} (or properties thereof) in the result,
+     * unless {@code setEmptyValue} has first been called.
+     *
+     * @param  delimiter the sequence of characters to be used between each
+     *         element added to the {@code StringJoiner} value
+     * @throws NullPointerException if {@code delimiter} is {@code null}
+     */
+    public StringJoiner(CharSequence delimiter) {
+        this(delimiter, "", "");
+    }
+
+    /**
+     * Constructs a {@code StringJoiner} with no characters in it using copies
+     * of the supplied {@code prefix}, {@code delimiter} and {@code suffix}.
+     * If no characters are added to the {@code StringJoiner} and methods
+     * accessing the string value of it are invoked, it will return the
+     * {@code prefix + suffix} (or properties thereof) in the result, unless
+     * {@code setEmptyValue} has first been called.
+     *
+     * @param  delimiter the sequence of characters to be used between each
+     *         element added to the {@code StringJoiner}
+     * @param  prefix the sequence of characters to be used at the beginning
+     * @param  suffix the sequence of characters to be used at the end
+     * @throws NullPointerException if {@code prefix}, {@code delimiter}, or
+     *         {@code suffix} is {@code null}
+     */
+    public StringJoiner(CharSequence delimiter, CharSequence prefix,
+            CharSequence suffix) {
+        Objects.requireNonNull(prefix, "The prefix must not be null");
+        Objects.requireNonNull(delimiter, "The delimiter must not be null");
+        Objects.requireNonNull(suffix, "The suffix must not be null");
+        // make defensive copies of arguments
+        this.prefix = prefix.toString();
+        this.delimiter = delimiter.toString();
+        this.suffix = suffix.toString();
+        this.emptyValue = this.prefix + this.suffix;
+    }
+
+    /**
+     * Sets the sequence of characters to be used when determining the string
+     * representation of this {@code StringJoiner} and no elements have been
+     * added yet, i.e. when it is empty.  A copy of the {@code emptyValue}
+     * parameter is made for this purpose. Note that once an add method has been
+     * called, the {@code StringJoiner} is no longer considered empty, even if
+     * the element(s) added correspond to the empty {@code String}.
+     *
+     * @param  emptyValue the characters to return as the value of an empty
+     *         {@code StringJoiner}
+     * @return this {@code StringJoiner} itself so the calls may be chained
+     * @throws NullPointerException when the {@code emptyValue} parameter is
+     *         {@code null}
+     */
+    public StringJoiner setEmptyValue(CharSequence emptyValue) {
+        this.emptyValue = Objects.requireNonNull(emptyValue,
+            "The empty value must not be null").toString();
+        return this;
+    }
+
+    /**
+     * Returns the current value, consisting of the {@code prefix}, the values
+     * added so far separated by the {@code delimiter}, and the {@code suffix},
+     * unless no elements have been added in which case, the
+     * {@code prefix + suffix} or the {@code emptyValue} characters are returned
+     *
+     * @return the string representation of this {@code StringJoiner}
+     */
+    @Override
+    public String toString() {
+        if (value == null) {
+            return emptyValue;
+        } else {
+            if (suffix.equals("")) {
+                return value.toString();
+            } else {
+                int initialLength = value.length();
+                String result = value.append(suffix).toString();
+                // reset value to pre-append initialLength
+                value.setLength(initialLength);
+                return result;
+            }
+        }
+    }
+
+    /**
+     * Add the a copy of the supplied {@code CharSequence} value as the next
+     * element of the {@code StringJoiner} value. If {@code newElement} is
+     * {@code null}, then {@code "null"} is added.
+     *
+     * @param  newElement The element to add
+     * @return a reference to this {@code StringJoiner}
+     */
+    public StringJoiner add(CharSequence newElement) {
+        prepareBuilder().append(newElement);
+        return this;
+    }
+
+    private StringBuilder prepareBuilder() {
+        if (value != null) {
+            value.append(delimiter);
+        } else {
+            value = new StringBuilder().append(prefix);
+        }
+        return value;
+    }
+
+    /**
+     * The length of the {@code StringJoiner} value, i.e. the length of
+     * {@code String} representation of the {@code StringJoiner}. Note that if
+     * no add methods have been called, then the length of the {@code String}
+     * representation (either {@code prefix + suffix} or {@code emptyValue})
+     * will be returned. The value should be equivalent to
+     * {@code toString().length()}.
+     *
+     * @return the length of the current value of {@code StringJoiner}
+     */
+    public int length() {
+        // Remember that we never actually append the suffix unless we return
+        // the full (present) value or some sub-string or length of it, so that
+        // we can add on more if we need to.
+        return (value != null ? value.length() + suffix.length() :
+                emptyValue.length());
+    }
+}
--- a/jdk/src/share/classes/java/util/TreeMap.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/TreeMap.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package java.util;
 
+import java.util.function.Consumer;
+
 /**
  * A Red-Black tree based {@link NavigableMap} implementation.
  * The map is sorted according to the {@linkplain Comparable natural
@@ -971,6 +973,10 @@
         public void clear() {
             TreeMap.this.clear();
         }
+
+        public Spliterator<V> spliterator() {
+            return new ValueSpliterator<K,V>(TreeMap.this, null, null, 0, -1, 0);
+        }
     }
 
     class EntrySet extends AbstractSet<Map.Entry<K,V>> {
@@ -1007,6 +1013,10 @@
         public void clear() {
             TreeMap.this.clear();
         }
+
+        public Spliterator<Map.Entry<K,V>> spliterator() {
+            return new EntrySpliterator<K,V>(TreeMap.this, null, null, 0, -1, 0);
+        }
     }
 
     /*
@@ -1090,6 +1100,10 @@
         public NavigableSet<E> descendingSet() {
             return new KeySet<>(m.descendingMap());
         }
+
+        public Spliterator<E> spliterator() {
+            return keySpliteratorFor(m);
+        }
     }
 
     /**
@@ -1389,6 +1403,8 @@
         /** Returns ascending iterator from the perspective of this submap */
         abstract Iterator<K> keyIterator();
 
+        abstract Spliterator<K> keySpliterator();
+
         /** Returns descending iterator from the perspective of this submap */
         abstract Iterator<K> descendingKeyIterator();
 
@@ -1650,19 +1666,6 @@
             }
         }
 
-        final class SubMapKeyIterator extends SubMapIterator<K> {
-            SubMapKeyIterator(TreeMap.Entry<K,V> first,
-                              TreeMap.Entry<K,V> fence) {
-                super(first, fence);
-            }
-            public K next() {
-                return nextEntry().key;
-            }
-            public void remove() {
-                removeAscending();
-            }
-        }
-
         final class DescendingSubMapEntryIterator extends SubMapIterator<Map.Entry<K,V>> {
             DescendingSubMapEntryIterator(TreeMap.Entry<K,V> last,
                                           TreeMap.Entry<K,V> fence) {
@@ -1677,7 +1680,47 @@
             }
         }
 
-        final class DescendingSubMapKeyIterator extends SubMapIterator<K> {
+        // Implement minimal Spliterator as KeySpliterator backup
+        final class SubMapKeyIterator extends SubMapIterator<K>
+            implements Spliterator<K> {
+            SubMapKeyIterator(TreeMap.Entry<K,V> first,
+                              TreeMap.Entry<K,V> fence) {
+                super(first, fence);
+            }
+            public K next() {
+                return nextEntry().key;
+            }
+            public void remove() {
+                removeAscending();
+            }
+            public Spliterator<K> trySplit() {
+                return null;
+            }
+            public void forEachRemaining(Consumer<? super K> action) {
+                while (hasNext())
+                    action.accept(next());
+            }
+            public boolean tryAdvance(Consumer<? super K> action) {
+                if (hasNext()) {
+                    action.accept(next());
+                    return true;
+                }
+                return false;
+            }
+            public long estimateSize() {
+                return Long.MAX_VALUE;
+            }
+            public int characteristics() {
+                return Spliterator.DISTINCT | Spliterator.ORDERED |
+                    Spliterator.SORTED;
+            }
+            public final Comparator<? super K>  getComparator() {
+                return NavigableSubMap.this.comparator();
+            }
+        }
+
+        final class DescendingSubMapKeyIterator extends SubMapIterator<K>
+            implements Spliterator<K> {
             DescendingSubMapKeyIterator(TreeMap.Entry<K,V> last,
                                         TreeMap.Entry<K,V> fence) {
                 super(last, fence);
@@ -1688,6 +1731,26 @@
             public void remove() {
                 removeDescending();
             }
+            public Spliterator<K> trySplit() {
+                return null;
+            }
+            public void forEachRemaining(Consumer<? super K> action) {
+                while (hasNext())
+                    action.accept(next());
+            }
+            public boolean tryAdvance(Consumer<? super K> action) {
+                if (hasNext()) {
+                    action.accept(next());
+                    return true;
+                }
+                return false;
+            }
+            public long estimateSize() {
+                return Long.MAX_VALUE;
+            }
+            public int characteristics() {
+                return Spliterator.DISTINCT | Spliterator.ORDERED;
+            }
         }
     }
 
@@ -1747,6 +1810,10 @@
             return new SubMapKeyIterator(absLowest(), absHighFence());
         }
 
+        Spliterator<K> keySpliterator() {
+            return new SubMapKeyIterator(absLowest(), absHighFence());
+        }
+
         Iterator<K> descendingKeyIterator() {
             return new DescendingSubMapKeyIterator(absHighest(), absLowFence());
         }
@@ -1828,6 +1895,10 @@
             return new DescendingSubMapKeyIterator(absHighest(), absLowFence());
         }
 
+        Spliterator<K> keySpliterator() {
+            return new DescendingSubMapKeyIterator(absHighest(), absLowFence());
+        }
+
         Iterator<K> descendingKeyIterator() {
             return new SubMapKeyIterator(absLowest(), absHighFence());
         }
@@ -2444,4 +2515,407 @@
             level++;
         return level;
     }
+
+    /**
+     * Currently, we support Spliterator-based versions only for the
+     * full map, in either plain of descending form, otherwise relying
+     * on defaults because size estimation for submaps would dominate
+     * costs. The type tests needed to check these for key views are
+     * not very nice but avoid disrupting existing class
+     * structures. Callers must use plain default spliterators if this
+     * returns null.
+     */
+    static <K> Spliterator<K> keySpliteratorFor(NavigableMap<K,?> m) {
+        if (m instanceof TreeMap) {
+            @SuppressWarnings("unchecked") TreeMap<K,Object> t =
+                (TreeMap<K,Object>) m;
+            return t.keySpliterator();
+        }
+        if (m instanceof DescendingSubMap) {
+            @SuppressWarnings("unchecked") DescendingSubMap<K,?> dm =
+                (DescendingSubMap<K,?>) m;
+            TreeMap<K,?> tm = dm.m;
+            if (dm == tm.descendingMap) {
+                @SuppressWarnings("unchecked") TreeMap<K,Object> t =
+                    (TreeMap<K,Object>) tm;
+                return t.descendingKeySpliterator();
+            }
+        }
+        @SuppressWarnings("unchecked") NavigableSubMap<K,?> sm =
+            (NavigableSubMap<K,?>) m;
+        return sm.keySpliterator();
+    }
+
+    final Spliterator<K> keySpliterator() {
+        return new KeySpliterator<K,V>(this, null, null, 0, -1, 0);
+    }
+
+    final Spliterator<K> descendingKeySpliterator() {
+        return new DescendingKeySpliterator<K,V>(this, null, null, 0, -2, 0);
+    }
+
+    /**
+     * Base class for spliterators.  Iteration starts at a given
+     * origin and continues up to but not including a given fence (or
+     * null for end).  At top-level, for ascending cases, the first
+     * split uses the root as left-fence/right-origin. From there,
+     * right-hand splits replace the current fence with its left
+     * child, also serving as origin for the split-off spliterator.
+     * Left-hands are symmetric. Descending versions place the origin
+     * at the end and invert ascending split rules.  This base class
+     * is non-commital about directionality, or whether the top-level
+     * spliterator covers the whole tree. This means that the actual
+     * split mechanics are located in subclasses. Some of the subclass
+     * trySplit methods are identical (except for return types), but
+     * not nicely factorable.
+     *
+     * Currently, subclass versions exist only for the full map
+     * (including descending keys via its descendingMap).  Others are
+     * possible but currently not worthwhile because submaps require
+     * O(n) computations to determine size, which substantially limits
+     * potential speed-ups of using custom Spliterators versus default
+     * mechanics.
+     *
+     * To boostrap initialization, external constructors use
+     * negative size estimates: -1 for ascend, -2 for descend.
+     */
+    static class TreeMapSpliterator<K,V> {
+        final TreeMap<K,V> tree;
+        TreeMap.Entry<K,V> current; // traverser; initially first node in range
+        TreeMap.Entry<K,V> fence;   // one past last, or null
+        int side;                   // 0: top, -1: is a left split, +1: right
+        int est;                    // size estimate (exact only for top-level)
+        int expectedModCount;       // for CME checks
+
+        TreeMapSpliterator(TreeMap<K,V> tree,
+                           TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+                           int side, int est, int expectedModCount) {
+            this.tree = tree;
+            this.current = origin;
+            this.fence = fence;
+            this.side = side;
+            this.est = est;
+            this.expectedModCount = expectedModCount;
+        }
+
+        final int getEstimate() { // force initialization
+            int s; TreeMap<K,V> t;
+            if ((s = est) < 0) {
+                if ((t = tree) != null) {
+                    current = (s == -1) ? t.getFirstEntry() : t.getLastEntry();
+                    s = est = t.size;
+                    expectedModCount = t.modCount;
+                }
+                else
+                    s = est = 0;
+            }
+            return s;
+        }
+
+        public final long estimateSize() {
+            return (long)getEstimate();
+        }
+    }
+
+    static final class KeySpliterator<K,V>
+        extends TreeMapSpliterator<K,V>
+        implements Spliterator<K> {
+        KeySpliterator(TreeMap<K,V> tree,
+                       TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+                       int side, int est, int expectedModCount) {
+            super(tree, origin, fence, side, est, expectedModCount);
+        }
+
+        public KeySpliterator<K,V> trySplit() {
+            if (est < 0)
+                getEstimate(); // force initialization
+            int d = side;
+            TreeMap.Entry<K,V> e = current, f = fence,
+                s = ((e == null || e == f) ? null :      // empty
+                     (d == 0)              ? tree.root : // was top
+                     (d >  0)              ? e.right :   // was right
+                     (d <  0 && f != null) ? f.left :    // was left
+                     null);
+            if (s != null && s != e && s != f &&
+                tree.compare(e.key, s.key) < 0) {        // e not already past s
+                side = 1;
+                return new KeySpliterator<>
+                    (tree, e, current = s, -1, est >>>= 1, expectedModCount);
+            }
+            return null;
+        }
+
+        public void forEachRemaining(Consumer<? super K> action) {
+            if (action == null)
+                throw new NullPointerException();
+            if (est < 0)
+                getEstimate(); // force initialization
+            TreeMap.Entry<K,V> f = fence, e, p, pl;
+            if ((e = current) != null && e != f) {
+                current = f; // exhaust
+                do {
+                    action.accept(e.key);
+                    if ((p = e.right) != null) {
+                        while ((pl = p.left) != null)
+                            p = pl;
+                    }
+                    else {
+                        while ((p = e.parent) != null && e == p.right)
+                            e = p;
+                    }
+                } while ((e = p) != null && e != f);
+                if (tree.modCount != expectedModCount)
+                    throw new ConcurrentModificationException();
+            }
+        }
+
+        public boolean tryAdvance(Consumer<? super K> action) {
+            TreeMap.Entry<K,V> e;
+            if (action == null)
+                throw new NullPointerException();
+            if (est < 0)
+                getEstimate(); // force initialization
+            if ((e = current) == null || e == fence)
+                return false;
+            current = successor(e);
+            action.accept(e.key);
+            if (tree.modCount != expectedModCount)
+                throw new ConcurrentModificationException();
+            return true;
+        }
+
+        public int characteristics() {
+            return (side == 0 ? Spliterator.SIZED : 0) |
+                Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED;
+        }
+
+        public final Comparator<? super K>  getComparator() {
+            return tree.comparator;
+        }
+
+    }
+
+    static final class DescendingKeySpliterator<K,V>
+        extends TreeMapSpliterator<K,V>
+        implements Spliterator<K> {
+        DescendingKeySpliterator(TreeMap<K,V> tree,
+                                 TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+                                 int side, int est, int expectedModCount) {
+            super(tree, origin, fence, side, est, expectedModCount);
+        }
+
+        public DescendingKeySpliterator<K,V> trySplit() {
+            if (est < 0)
+                getEstimate(); // force initialization
+            int d = side;
+            TreeMap.Entry<K,V> e = current, f = fence,
+                    s = ((e == null || e == f) ? null :      // empty
+                         (d == 0)              ? tree.root : // was top
+                         (d <  0)              ? e.left :    // was left
+                         (d >  0 && f != null) ? f.right :   // was right
+                         null);
+            if (s != null && s != e && s != f &&
+                tree.compare(e.key, s.key) > 0) {       // e not already past s
+                side = 1;
+                return new DescendingKeySpliterator<>
+                        (tree, e, current = s, -1, est >>>= 1, expectedModCount);
+            }
+            return null;
+        }
+
+        public void forEachRemaining(Consumer<? super K> action) {
+            if (action == null)
+                throw new NullPointerException();
+            if (est < 0)
+                getEstimate(); // force initialization
+            TreeMap.Entry<K,V> f = fence, e, p, pr;
+            if ((e = current) != null && e != f) {
+                current = f; // exhaust
+                do {
+                    action.accept(e.key);
+                    if ((p = e.left) != null) {
+                        while ((pr = p.right) != null)
+                            p = pr;
+                    }
+                    else {
+                        while ((p = e.parent) != null && e == p.left)
+                            e = p;
+                    }
+                } while ((e = p) != null && e != f);
+                if (tree.modCount != expectedModCount)
+                    throw new ConcurrentModificationException();
+            }
+        }
+
+        public boolean tryAdvance(Consumer<? super K> action) {
+            TreeMap.Entry<K,V> e;
+            if (action == null)
+                throw new NullPointerException();
+            if (est < 0)
+                getEstimate(); // force initialization
+            if ((e = current) == null || e == fence)
+                return false;
+            current = predecessor(e);
+            action.accept(e.key);
+            if (tree.modCount != expectedModCount)
+                throw new ConcurrentModificationException();
+            return true;
+        }
+
+        public int characteristics() {
+            return (side == 0 ? Spliterator.SIZED : 0) |
+                Spliterator.DISTINCT | Spliterator.ORDERED;
+        }
+    }
+
+    static final class ValueSpliterator<K,V>
+            extends TreeMapSpliterator<K,V>
+            implements Spliterator<V> {
+        ValueSpliterator(TreeMap<K,V> tree,
+                         TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+                         int side, int est, int expectedModCount) {
+            super(tree, origin, fence, side, est, expectedModCount);
+        }
+
+        public ValueSpliterator<K,V> trySplit() {
+            if (est < 0)
+                getEstimate(); // force initialization
+            int d = side;
+            TreeMap.Entry<K,V> e = current, f = fence,
+                    s = ((e == null || e == f) ? null :      // empty
+                         (d == 0)              ? tree.root : // was top
+                         (d >  0)              ? e.right :   // was right
+                         (d <  0 && f != null) ? f.left :    // was left
+                         null);
+            if (s != null && s != e && s != f &&
+                tree.compare(e.key, s.key) < 0) {        // e not already past s
+                side = 1;
+                return new ValueSpliterator<>
+                        (tree, e, current = s, -1, est >>>= 1, expectedModCount);
+            }
+            return null;
+        }
+
+        public void forEachRemaining(Consumer<? super V> action) {
+            if (action == null)
+                throw new NullPointerException();
+            if (est < 0)
+                getEstimate(); // force initialization
+            TreeMap.Entry<K,V> f = fence, e, p, pl;
+            if ((e = current) != null && e != f) {
+                current = f; // exhaust
+                do {
+                    action.accept(e.value);
+                    if ((p = e.right) != null) {
+                        while ((pl = p.left) != null)
+                            p = pl;
+                    }
+                    else {
+                        while ((p = e.parent) != null && e == p.right)
+                            e = p;
+                    }
+                } while ((e = p) != null && e != f);
+                if (tree.modCount != expectedModCount)
+                    throw new ConcurrentModificationException();
+            }
+        }
+
+        public boolean tryAdvance(Consumer<? super V> action) {
+            TreeMap.Entry<K,V> e;
+            if (action == null)
+                throw new NullPointerException();
+            if (est < 0)
+                getEstimate(); // force initialization
+            if ((e = current) == null || e == fence)
+                return false;
+            current = successor(e);
+            action.accept(e.value);
+            if (tree.modCount != expectedModCount)
+                throw new ConcurrentModificationException();
+            return true;
+        }
+
+        public int characteristics() {
+            return (side == 0 ? Spliterator.SIZED : 0);
+        }
+    }
+
+    static final class EntrySpliterator<K,V>
+        extends TreeMapSpliterator<K,V>
+        implements Spliterator<Map.Entry<K,V>> {
+        EntrySpliterator(TreeMap<K,V> tree,
+                         TreeMap.Entry<K,V> origin, TreeMap.Entry<K,V> fence,
+                         int side, int est, int expectedModCount) {
+            super(tree, origin, fence, side, est, expectedModCount);
+        }
+
+        public EntrySpliterator<K,V> trySplit() {
+            if (est < 0)
+                getEstimate(); // force initialization
+            int d = side;
+            TreeMap.Entry<K,V> e = current, f = fence,
+                    s = ((e == null || e == f) ? null :      // empty
+                         (d == 0)              ? tree.root : // was top
+                         (d >  0)              ? e.right :   // was right
+                         (d <  0 && f != null) ? f.left :    // was left
+                         null);
+            if (s != null && s != e && s != f &&
+                tree.compare(e.key, s.key) < 0) {        // e not already past s
+                side = 1;
+                return new EntrySpliterator<>
+                        (tree, e, current = s, -1, est >>>= 1, expectedModCount);
+            }
+            return null;
+        }
+
+        public void forEachRemaining(Consumer<? super Map.Entry<K, V>> action) {
+            if (action == null)
+                throw new NullPointerException();
+            if (est < 0)
+                getEstimate(); // force initialization
+            TreeMap.Entry<K,V> f = fence, e, p, pl;
+            if ((e = current) != null && e != f) {
+                current = f; // exhaust
+                do {
+                    action.accept(e);
+                    if ((p = e.right) != null) {
+                        while ((pl = p.left) != null)
+                            p = pl;
+                    }
+                    else {
+                        while ((p = e.parent) != null && e == p.right)
+                            e = p;
+                    }
+                } while ((e = p) != null && e != f);
+                if (tree.modCount != expectedModCount)
+                    throw new ConcurrentModificationException();
+            }
+        }
+
+        public boolean tryAdvance(Consumer<? super Map.Entry<K,V>> action) {
+            TreeMap.Entry<K,V> e;
+            if (action == null)
+                throw new NullPointerException();
+            if (est < 0)
+                getEstimate(); // force initialization
+            if ((e = current) == null || e == fence)
+                return false;
+            current = successor(e);
+            action.accept(e);
+            if (tree.modCount != expectedModCount)
+                throw new ConcurrentModificationException();
+            return true;
+        }
+
+        public int characteristics() {
+            return (side == 0 ? Spliterator.SIZED : 0) |
+                   Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED;
+        }
+
+        @Override
+        public Comparator<? super Map.Entry<K, V>> getComparator() {
+            return tree.comparator != null ?
+                   Comparators.byKey(tree.comparator) : null;
+        }
+    }
 }
--- a/jdk/src/share/classes/java/util/TreeSet.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/TreeSet.java	Wed May 08 10:10:05 2013 +0100
@@ -533,5 +533,9 @@
         tm.readTreeSet(size, s, PRESENT);
     }
 
+    public Spliterator<E> spliterator() {
+        return TreeMap.keySpliteratorFor(m);
+    }
+
     private static final long serialVersionUID = -2479143000061671589L;
 }
--- a/jdk/src/share/classes/java/util/Vector.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/Vector.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,10 @@
 
 package java.util;
 
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+
 /**
  * The {@code Vector} class implements a growable array of
  * objects. Like an array, it contains components that can be
@@ -1151,6 +1155,28 @@
             lastRet = -1;
         }
 
+        @Override
+        public void forEachRemaining(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+            synchronized (Vector.this) {
+                final int size = elementCount;
+                int i = cursor;
+                if (i >= size) {
+                    return;
+                }
+                final Object[] elementData = Vector.this.elementData;
+                if (i >= elementData.length) {
+                    throw new ConcurrentModificationException();
+                }
+                while (i != size && modCount == expectedModCount) {
+                    action.accept((E) elementData[i++]);
+                }
+                // update once at end of iteration to reduce heap write traffic
+                lastRet = cursor = i;
+                checkForComodification();
+            }
+        }
+
         final void checkForComodification() {
             if (modCount != expectedModCount)
                 throw new ConcurrentModificationException();
@@ -1209,4 +1235,181 @@
             lastRet = -1;
         }
     }
+
+    @Override
+    public synchronized void forEach(Consumer<? super E> action) {
+        Objects.requireNonNull(action);
+        final int expectedModCount = modCount;
+        @SuppressWarnings("unchecked")
+        final E[] elementData = (E[]) this.elementData;
+        final int elementCount = this.elementCount;
+        for (int i=0; modCount == expectedModCount && i < elementCount; i++) {
+            action.accept(elementData[i]);
+        }
+        if (modCount != expectedModCount) {
+            throw new ConcurrentModificationException();
+        }
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public synchronized boolean removeIf(Predicate<? super E> filter) {
+        Objects.requireNonNull(filter);
+        // figure out which elements are to be removed
+        // any exception thrown from the filter predicate at this stage
+        // will leave the collection unmodified
+        int removeCount = 0;
+        final int size = elementCount;
+        final BitSet removeSet = new BitSet(size);
+        final int expectedModCount = modCount;
+        for (int i=0; modCount == expectedModCount && i < size; i++) {
+            @SuppressWarnings("unchecked")
+            final E element = (E) elementData[i];
+            if (filter.test(element)) {
+                removeSet.set(i);
+                removeCount++;
+            }
+        }
+        if (modCount != expectedModCount) {
+            throw new ConcurrentModificationException();
+        }
+
+        // shift surviving elements left over the spaces left by removed elements
+        final boolean anyToRemove = removeCount > 0;
+        if (anyToRemove) {
+            final int newSize = size - removeCount;
+            for (int i=0, j=0; (i < size) && (j < newSize); i++, j++) {
+                i = removeSet.nextClearBit(i);
+                elementData[j] = elementData[i];
+            }
+            for (int k=newSize; k < size; k++) {
+                elementData[k] = null;  // Let gc do its work
+            }
+            elementCount = newSize;
+            if (modCount != expectedModCount) {
+                throw new ConcurrentModificationException();
+            }
+            modCount++;
+        }
+
+        return anyToRemove;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public synchronized void replaceAll(UnaryOperator<E> operator) {
+        Objects.requireNonNull(operator);
+        final int expectedModCount = modCount;
+        final int size = elementCount;
+        for (int i=0; modCount == expectedModCount && i < size; i++) {
+            elementData[i] = operator.apply((E) elementData[i]);
+        }
+        if (modCount != expectedModCount) {
+            throw new ConcurrentModificationException();
+        }
+        modCount++;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public synchronized void sort(Comparator<? super E> c) {
+        final int expectedModCount = modCount;
+        Arrays.sort((E[]) elementData, 0, elementCount, c);
+        if (modCount != expectedModCount) {
+            throw new ConcurrentModificationException();
+        }
+        modCount++;
+    }
+
+    @Override
+    public Spliterator<E> spliterator() {
+        return new VectorSpliterator<>(this, null, 0, -1, 0);
+    }
+
+    /** Similar to ArrayList Spliterator */
+    static final class VectorSpliterator<E> implements Spliterator<E> {
+        private final Vector<E> list;
+        private Object[] array;
+        private int index; // current index, modified on advance/split
+        private int fence; // -1 until used; then one past last index
+        private int expectedModCount; // initialized when fence set
+
+        /** Create new spliterator covering the given  range */
+        VectorSpliterator(Vector<E> list, Object[] array, int origin, int fence,
+                          int expectedModCount) {
+            this.list = list;
+            this.array = array;
+            this.index = origin;
+            this.fence = fence;
+            this.expectedModCount = expectedModCount;
+        }
+
+        private int getFence() { // initialize on first use
+            int hi;
+            if ((hi = fence) < 0) {
+                synchronized(list) {
+                    array = list.elementData;
+                    expectedModCount = list.modCount;
+                    hi = fence = list.elementCount;
+                }
+            }
+            return hi;
+        }
+
+        public Spliterator<E> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid) ? null :
+                new VectorSpliterator<E>(list, array, lo, index = mid,
+                                         expectedModCount);
+        }
+
+        @SuppressWarnings("unchecked")
+        public boolean tryAdvance(Consumer<? super E> action) {
+            int i;
+            if (action == null)
+                throw new NullPointerException();
+            if (getFence() > (i = index)) {
+                index = i + 1;
+                action.accept((E)array[i]);
+                if (list.modCount != expectedModCount)
+                    throw new ConcurrentModificationException();
+                return true;
+            }
+            return false;
+        }
+
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super E> action) {
+            int i, hi; // hoist accesses and checks from loop
+            Vector<E> lst; Object[] a;
+            if (action == null)
+                throw new NullPointerException();
+            if ((lst = list) != null) {
+                if ((hi = fence) < 0) {
+                    synchronized(lst) {
+                        expectedModCount = lst.modCount;
+                        a = array = lst.elementData;
+                        hi = fence = lst.elementCount;
+                    }
+                }
+                else
+                    a = array;
+                if (a != null && (i = index) >= 0 && (index = hi) <= a.length) {
+                    while (i < hi)
+                        action.accept((E) a[i++]);
+                    if (lst.modCount == expectedModCount)
+                        return;
+                }
+            }
+            throw new ConcurrentModificationException();
+        }
+
+        public long estimateSize() {
+            return (long) (getFence() - index);
+        }
+
+        public int characteristics() {
+            return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED;
+        }
+    }
 }
--- a/jdk/src/share/classes/java/util/WeakHashMap.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/WeakHashMap.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,10 @@
  */
 
 package java.util;
+
 import java.lang.ref.WeakReference;
 import java.lang.ref.ReferenceQueue;
+import java.util.function.Consumer;
 
 
 /**
@@ -898,6 +900,10 @@
         public void clear() {
             WeakHashMap.this.clear();
         }
+
+        public Spliterator<K> spliterator() {
+            return new KeySpliterator<>(WeakHashMap.this, 0, -1, 0, 0);
+        }
     }
 
     /**
@@ -934,6 +940,10 @@
         public void clear() {
             WeakHashMap.this.clear();
         }
+
+        public Spliterator<V> spliterator() {
+            return new ValueSpliterator<>(WeakHashMap.this, 0, -1, 0, 0);
+        }
     }
 
     /**
@@ -994,5 +1004,288 @@
         public <T> T[] toArray(T[] a) {
             return deepCopy().toArray(a);
         }
+
+        public Spliterator<Map.Entry<K,V>> spliterator() {
+            return new EntrySpliterator<>(WeakHashMap.this, 0, -1, 0, 0);
+        }
     }
+
+    /**
+     * Similar form as other hash Spliterators, but skips dead
+     * elements.
+     */
+    static class WeakHashMapSpliterator<K,V> {
+        final WeakHashMap<K,V> map;
+        WeakHashMap.Entry<K,V> current; // current node
+        int index;             // current index, modified on advance/split
+        int fence;             // -1 until first use; then one past last index
+        int est;               // size estimate
+        int expectedModCount;  // for comodification checks
+
+        WeakHashMapSpliterator(WeakHashMap<K,V> m, int origin,
+                               int fence, int est,
+                               int expectedModCount) {
+            this.map = m;
+            this.index = origin;
+            this.fence = fence;
+            this.est = est;
+            this.expectedModCount = expectedModCount;
+        }
+
+        final int getFence() { // initialize fence and size on first use
+            int hi;
+            if ((hi = fence) < 0) {
+                WeakHashMap<K,V> m = map;
+                est = m.size();
+                expectedModCount = m.modCount;
+                hi = fence = m.table.length;
+            }
+            return hi;
+        }
+
+        public final long estimateSize() {
+            getFence(); // force init
+            return (long) est;
+        }
+    }
+
+    static final class KeySpliterator<K,V>
+        extends WeakHashMapSpliterator<K,V>
+        implements Spliterator<K> {
+        KeySpliterator(WeakHashMap<K,V> m, int origin, int fence, int est,
+                       int expectedModCount) {
+            super(m, origin, fence, est, expectedModCount);
+        }
+
+        public KeySpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid) ? null :
+                new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                        expectedModCount);
+        }
+
+        public void forEachRemaining(Consumer<? super K> action) {
+            int i, hi, mc;
+            if (action == null)
+                throw new NullPointerException();
+            WeakHashMap<K,V> m = map;
+            WeakHashMap.Entry<K,V>[] tab = m.table;
+            if ((hi = fence) < 0) {
+                mc = expectedModCount = m.modCount;
+                hi = fence = tab.length;
+            }
+            else
+                mc = expectedModCount;
+            if (tab.length >= hi && (i = index) >= 0 && i < hi) {
+                index = hi;
+                WeakHashMap.Entry<K,V> p = current;
+                do {
+                    if (p == null)
+                        p = tab[i++];
+                    else {
+                        Object x = p.get();
+                        p = p.next;
+                        if (x != null) {
+                            @SuppressWarnings("unchecked") K k =
+                                (K) WeakHashMap.unmaskNull(x);
+                            action.accept(k);
+                        }
+                    }
+                } while (p != null || i < hi);
+            }
+            if (m.modCount != mc)
+                throw new ConcurrentModificationException();
+        }
+
+        public boolean tryAdvance(Consumer<? super K> action) {
+            int hi;
+            if (action == null)
+                throw new NullPointerException();
+            WeakHashMap.Entry<K,V>[] tab = map.table;
+            if (tab.length >= (hi = getFence()) && index >= 0) {
+                while (current != null || index < hi) {
+                    if (current == null)
+                        current = tab[index++];
+                    else {
+                        Object x = current.get();
+                        current = current.next;
+                        if (x != null) {
+                            @SuppressWarnings("unchecked") K k =
+                                (K) WeakHashMap.unmaskNull(x);
+                            action.accept(k);
+                            if (map.modCount != expectedModCount)
+                                throw new ConcurrentModificationException();
+                            return true;
+                        }
+                    }
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return Spliterator.DISTINCT;
+        }
+    }
+
+    static final class ValueSpliterator<K,V>
+        extends WeakHashMapSpliterator<K,V>
+        implements Spliterator<V> {
+        ValueSpliterator(WeakHashMap<K,V> m, int origin, int fence, int est,
+                         int expectedModCount) {
+            super(m, origin, fence, est, expectedModCount);
+        }
+
+        public ValueSpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid) ? null :
+                new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                          expectedModCount);
+        }
+
+        public void forEachRemaining(Consumer<? super V> action) {
+            int i, hi, mc;
+            if (action == null)
+                throw new NullPointerException();
+            WeakHashMap<K,V> m = map;
+            WeakHashMap.Entry<K,V>[] tab = m.table;
+            if ((hi = fence) < 0) {
+                mc = expectedModCount = m.modCount;
+                hi = fence = tab.length;
+            }
+            else
+                mc = expectedModCount;
+            if (tab.length >= hi && (i = index) >= 0 && i < hi) {
+                index = hi;
+                WeakHashMap.Entry<K,V> p = current;
+                do {
+                    if (p == null)
+                        p = tab[i++];
+                    else {
+                        Object x = p.get();
+                        V v = p.value;
+                        p = p.next;
+                        if (x != null)
+                            action.accept(v);
+                    }
+                } while (p != null || i < hi);
+            }
+            if (m.modCount != mc)
+                throw new ConcurrentModificationException();
+        }
+
+        public boolean tryAdvance(Consumer<? super V> action) {
+            int hi;
+            if (action == null)
+                throw new NullPointerException();
+            WeakHashMap.Entry<K,V>[] tab = map.table;
+            if (tab.length >= (hi = getFence()) && index >= 0) {
+                while (current != null || index < hi) {
+                    if (current == null)
+                        current = tab[index++];
+                    else {
+                        Object x = current.get();
+                        V v = current.value;
+                        current = current.next;
+                        if (x != null) {
+                            action.accept(v);
+                            if (map.modCount != expectedModCount)
+                                throw new ConcurrentModificationException();
+                            return true;
+                        }
+                    }
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return 0;
+        }
+    }
+
+    static final class EntrySpliterator<K,V>
+        extends WeakHashMapSpliterator<K,V>
+        implements Spliterator<Map.Entry<K,V>> {
+        EntrySpliterator(WeakHashMap<K,V> m, int origin, int fence, int est,
+                       int expectedModCount) {
+            super(m, origin, fence, est, expectedModCount);
+        }
+
+        public EntrySpliterator<K,V> trySplit() {
+            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
+            return (lo >= mid) ? null :
+                new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                                          expectedModCount);
+        }
+
+
+        public void forEachRemaining(Consumer<? super Map.Entry<K, V>> action) {
+            int i, hi, mc;
+            if (action == null)
+                throw new NullPointerException();
+            WeakHashMap<K,V> m = map;
+            WeakHashMap.Entry<K,V>[] tab = m.table;
+            if ((hi = fence) < 0) {
+                mc = expectedModCount = m.modCount;
+                hi = fence = tab.length;
+            }
+            else
+                mc = expectedModCount;
+            if (tab.length >= hi && (i = index) >= 0 && i < hi) {
+                index = hi;
+                WeakHashMap.Entry<K,V> p = current;
+                do {
+                    if (p == null)
+                        p = tab[i++];
+                    else {
+                        Object x = p.get();
+                        V v = p.value;
+                        p = p.next;
+                        if (x != null) {
+                            @SuppressWarnings("unchecked") K k =
+                                (K) WeakHashMap.unmaskNull(x);
+                            action.accept
+                                (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+                        }
+                    }
+                } while (p != null || i < hi);
+            }
+            if (m.modCount != mc)
+                throw new ConcurrentModificationException();
+        }
+
+        public boolean tryAdvance(Consumer<? super Map.Entry<K,V>> action) {
+            int hi;
+            if (action == null)
+                throw new NullPointerException();
+            WeakHashMap.Entry<K,V>[] tab = map.table;
+            if (tab.length >= (hi = getFence()) && index >= 0) {
+                while (current != null || index < hi) {
+                    if (current == null)
+                        current = tab[index++];
+                    else {
+                        Object x = current.get();
+                        V v = current.value;
+                        current = current.next;
+                        if (x != null) {
+                            @SuppressWarnings("unchecked") K k =
+                                (K) WeakHashMap.unmaskNull(x);
+                            action.accept
+                                (new AbstractMap.SimpleImmutableEntry<K,V>(k, v));
+                            if (map.modCount != expectedModCount)
+                                throw new ConcurrentModificationException();
+                            return true;
+                        }
+                    }
+                }
+            }
+            return false;
+        }
+
+        public int characteristics() {
+            return Spliterator.DISTINCT;
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Wed May 08 10:10:05 2013 +0100
@@ -36,6 +36,9 @@
 package java.util.concurrent;
 import java.util.*;
 import java.util.concurrent.locks.ReentrantLock;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
 
 /**
  * A thread-safe variant of {@link java.util.ArrayList} in which all mutative
@@ -1056,6 +1059,17 @@
         public void add(E e) {
             throw new UnsupportedOperationException();
         }
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+            final int size = snapshot.length;
+            for (int i=cursor; i < size; i++) {
+                action.accept((E) snapshot[i]);
+            }
+            cursor = size;
+        }
     }
 
     /**
@@ -1260,9 +1274,58 @@
             }
         }
 
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            @SuppressWarnings("unchecked")
+            final E[] elements = (E[]) l.getArray();
+            checkForComodification();
+            l.forEach(action, elements, offset, offset + size);
+        }
+
+        @Override
+        public void sort(Comparator<? super E> c) {
+            final ReentrantLock lock = l.lock;
+            lock.lock();
+            try {
+                checkForComodification();
+                l.sort(c, offset, offset + size);
+                expectedArray = l.getArray();
+            } finally {
+                lock.unlock();
+            }
+        }
+
+        @Override
+        public boolean removeIf(Predicate<? super E> filter) {
+            Objects.requireNonNull(filter);
+            final ReentrantLock lock = l.lock;
+            lock.lock();
+            try {
+                checkForComodification();
+                final int removeCount =
+                        l.removeIf(filter, offset, offset + size);
+                expectedArray = l.getArray();
+                size -= removeCount;
+                return removeCount > 0;
+            } finally {
+                lock.unlock();
+            }
+        }
+
+        @Override
+        public void replaceAll(UnaryOperator<E> operator) {
+            final ReentrantLock lock = l.lock;
+            lock.lock();
+            try {
+                checkForComodification();
+                l.replaceAll(operator, offset, offset + size);
+                expectedArray = l.getArray();
+            } finally {
+                lock.unlock();
+            }
+        }
     }
 
-
     private static class COWSubListIterator<E> implements ListIterator<E> {
         private final ListIterator<E> it;
         private final int offset;
@@ -1315,6 +1378,15 @@
         public void add(E e) {
             throw new UnsupportedOperationException();
         }
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public void forEachRemaining(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+            while (nextIndex() < size) {
+                action.accept(it.next());
+            }
+        }
     }
 
     // Support for resetting lock while deserializing
@@ -1333,4 +1405,139 @@
             throw new Error(e);
         }
     }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public void forEach(Consumer<? super E> action) {
+        forEach(action, (E[]) getArray(), 0, size());
+    }
+
+    private void forEach(Consumer<? super E> action,
+                         final E[] elements,
+                         final int from, final int to) {
+        Objects.requireNonNull(action);
+        for (int i = from; i < to; i++) {
+            action.accept(elements[i]);
+        }
+    }
+
+    @Override
+    public void sort(Comparator<? super E> c) {
+        final ReentrantLock lock = this.lock;
+        lock.lock();
+        try {
+            sort(c, 0, size());
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    // must be called with this.lock held
+    @SuppressWarnings("unchecked")
+    private void sort(Comparator<? super E> c, final int from, final int to) {
+        final E[] elements = (E[]) getArray();
+        final E[] newElements = Arrays.copyOf(elements, elements.length);
+        // only elements [from, to) are sorted
+        Arrays.sort(newElements, from, to, c);
+        setArray(newElements);
+    }
+
+    @Override
+    public boolean removeIf(Predicate<? super E> filter) {
+        Objects.requireNonNull(filter);
+        final ReentrantLock lock = this.lock;
+        lock.lock();
+        try {
+            return removeIf(filter, 0, size()) > 0;
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    // must be called with this.lock held
+    private int removeIf(Predicate<? super E> filter, final int from, final int to) {
+        Objects.requireNonNull(filter);
+        final ReentrantLock lock = this.lock;
+        lock.lock();
+        try {
+            @SuppressWarnings("unchecked")
+            final E[] elements = (E[]) getArray();
+
+            // figure out which elements are to be removed
+            // any exception thrown from the filter predicate at this stage
+            // will leave the collection unmodified
+            int removeCount = 0;
+            final int range = to - from;
+            final BitSet removeSet = new BitSet(range);
+            for (int i = 0; i < range; i++) {
+                final E element = elements[from + i];
+                if (filter.test(element)) {
+                    // removeSet is zero-based to keep its size small
+                    removeSet.set(i);
+                    removeCount++;
+                }
+            }
+
+            // copy surviving elements into a new array
+            if (removeCount > 0) {
+                final int newSize = elements.length - removeCount;
+                final int newRange = newSize - from;
+                @SuppressWarnings("unchecked")
+                final E[] newElements = (E[]) new Object[newSize];
+                // copy elements before [from, to) unmodified
+                for (int i = 0; i < from; i++) {
+                    newElements[i] = elements[i];
+                }
+                // elements [from, to) are subject to removal
+                int j = 0;
+                for (int i = 0; (i < range) && (j < newRange); i++) {
+                    i = removeSet.nextClearBit(i);
+                    if (i >= range) {
+                        break;
+                    }
+                    newElements[from + (j++)] = elements[from + i];
+                }
+                // copy any remaining elements beyond [from, to)
+                j += from;
+                for (int i = to; (i < elements.length) && (j < newSize); i++) {
+                    newElements[j++] = elements[i];
+                }
+                setArray(newElements);
+            }
+
+            return removeCount;
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    @Override
+    public void replaceAll(UnaryOperator<E> operator) {
+        Objects.requireNonNull(operator);
+        final ReentrantLock lock = this.lock;
+        lock.lock();
+        try {
+            replaceAll(operator, 0, size());
+        } finally {
+            lock.unlock();
+        }
+    }
+
+    // must be called with this.lock held
+    @SuppressWarnings("unchecked")
+    private void replaceAll(UnaryOperator<E> operator, final int from, final int to) {
+        final E[] elements = (E[]) getArray();
+        final E[] newElements = (E[]) new Object[elements.length];
+        for (int i = 0; i < from; i++) {
+            newElements[i] = elements[i];
+        }
+        // the operator is only applied to elements [from, to)
+        for (int i = from; i < to; i++) {
+            newElements[i] = operator.apply(elements[i]);
+        }
+        for (int i = to; i < elements.length; i++) {
+            newElements[i] = elements[i];
+        }
+        setArray(newElements);
+    }
 }
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,10 +35,8 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.beans.PropertyChangeListener;
-import java.net.URL;
 import sun.misc.JavaAWTAccess;
 import sun.misc.SharedSecrets;
-import sun.security.action.GetPropertyAction;
 
 /**
  * There is a single global LogManager object that is used to
@@ -148,7 +146,6 @@
     // The global LogManager object
     private static LogManager manager;
 
-    private final static Handler[] emptyHandlers = { };
     private Properties props = new Properties();
     private final static Level defaultLevel = Level.INFO;
 
@@ -547,13 +544,10 @@
                 throw new NullPointerException();
             }
 
-            // cleanup some Loggers that have been GC'ed
-            manager.drainLoggerRefQueueBounded();
-
             LoggerWeakRef ref = namedLoggers.get(name);
             if (ref != null) {
                 if (ref.get() == null) {
-                    // It's possible that the Logger was GC'ed after the
+                    // It's possible that the Logger was GC'ed after a
                     // drainLoggerRefQueueBounded() call above so allow
                     // a new one to be registered.
                     removeLogger(name);
@@ -605,6 +599,8 @@
             return true;
         }
 
+        // note: all calls to removeLogger are synchronized on LogManager's
+        // intrinsic lock
         void removeLogger(String name) {
             namedLoggers.remove(name);
         }
@@ -887,6 +883,7 @@
         if (name == null) {
             throw new NullPointerException();
         }
+        drainLoggerRefQueueBounded();
         LoggerContext cx = getUserContext();
         if (cx.addLocalLogger(logger)) {
             // Do we have a per logger handler too?
--- a/jdk/src/share/classes/java/util/regex/Pattern.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java	Wed May 08 10:10:05 2013 +0100
@@ -4334,7 +4334,6 @@
                 info.deterministic = detm;
             else
                 info.deterministic = false;
-
             return next.study(info);
         }
     }
@@ -4415,6 +4414,8 @@
         }
         // Aggressive group match
         boolean match0(Matcher matcher, int i, int j, CharSequence seq) {
+            // don't back off passing the starting "j"
+            int min = j;
             int[] groups = matcher.groups;
             int save0 = 0;
             int save1 = 0;
@@ -4452,7 +4453,7 @@
                         break;
                     }
                 }
-                while (j > cmin) {
+                while (j > min) {
                     if (next.match(matcher, i, seq)) {
                         if (capture) {
                             groups[groupIndex+1] = i;
@@ -4544,7 +4545,6 @@
             } else {
                 info.deterministic = false;
             }
-
             return next.study(info);
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/AbstractPipeline.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,674 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.IntFunction;
+import java.util.function.Supplier;
+
+/**
+ * Abstract base class for "pipeline" classes, which are the core
+ * implementations of the Stream interface and its primitive specializations.
+ * Manages construction and evaluation of stream pipelines.
+ *
+ * <p>An {@code AbstractPipeline} represents an initial portion of a stream
+ * pipeline, encapsulating a stream source and zero or more intermediate
+ * operations.  The individual {@code AbstractPipeline} objects are often
+ * referred to as <em>stages</em>, where each stage describes either the stream
+ * source or an intermediate operation.
+ *
+ * <p>A concrete intermediate stage is generally built from an
+ * {@code AbstractPipeline}, a shape-specific pipeline class which extends it
+ * (e.g., {@code IntPipeline}) which is also abstract, and an operation-specific
+ * concrete class which extends that.  {@code AbstractPipeline} contains most of
+ * the mechanics of evaluating the pipeline, and implements methods that will be
+ * used by the operation; the shape-specific classes add helper methods for
+ * dealing with collection of results into the appropriate shape-specific
+ * containers.
+ *
+ * <p>After chaining a new intermediate operation, or executing a terminal
+ * operation, the stream is considered to be consumed, and no more intermediate
+ * or terminal operations are permitted on this stream instance.
+ *
+ * <p>{@code AbstractPipeline} implements a number of methods that are
+ * specified in {@link BaseStream}, though it does not implement
+ * {@code BaseStream} directly.  Subclasses of {@code AbstractPipeline}
+ * will generally implement {@code BaseStream}.
+ *
+ * @implNote
+ * <p>For sequential streams, and parallel streams without
+ * <a href="package-summary.html#StreamOps">stateful intermediate
+ * operations</a>, parallel streams, pipeline evaluation is done in a single
+ * pass that "jams" all the operations together.  For parallel streams with
+ * stateful operations, execution is divided into segments, where each
+ * stateful operations marks the end of a segment, and each segment is
+ * evaluated separately and the result used as the input to the next
+ * segment.  In all cases, the source data is not consumed until a terminal
+ * operation begins.
+ *
+ * @param <E_IN>  type of input elements
+ * @param <E_OUT> type of output elements
+ * @param <S> type of the subclass implementing {@code BaseStream}
+ * @since 1.8
+ */
+abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>>
+        extends PipelineHelper<E_OUT> {
+    /**
+     * Backlink to the head of the pipeline chain (self if this is the source
+     * stage).
+     */
+    private final AbstractPipeline sourceStage;
+
+    /**
+     * The "upstream" pipeline, or null if this is the source stage.
+     */
+    private final AbstractPipeline previousStage;
+
+    /**
+     * The operation flags for the intermediate operation represented by this
+     * pipeline object.
+     */
+    protected final int sourceOrOpFlags;
+
+    /**
+     * The next stage in the pipeline, or null if this is the last stage.
+     * Effectively final at the point of linking to the next pipeline.
+     */
+    private AbstractPipeline nextStage;
+
+    /**
+     * The number of intermediate operations between this pipeline object
+     * and the stream source if sequential, or the previous stateful if parallel.
+     * Valid at the point of pipeline preparation for evaluation.
+     */
+    private int depth;
+
+    /**
+     * The combined source and operation flags for the source and all operations
+     * up to and including the operation represented by this pipeline object.
+     * Valid at the point of pipeline preparation for evaluation.
+     */
+    private int combinedFlags;
+
+    /**
+     * The source spliterator. Only valid for the head pipeline.
+     * Before the pipeline is consumed if non-null then {@code sourceSupplier}
+     * must be null. After the pipeline is consumed if non-null then is set to
+     * null.
+     */
+    private Spliterator<?> sourceSpliterator;
+
+    /**
+     * The source supplier. Only valid for the head pipeline. Before the
+     * pipeline is consumed if non-null then {@code sourceSpliterator} must be
+     * null. After the pipeline is consumed if non-null then is set to null.
+     */
+    private Supplier<? extends Spliterator<?>> sourceSupplier;
+
+    /**
+     * True if this pipeline has been linked or consumed
+     */
+    private boolean linkedOrConsumed;
+
+    /**
+     * True if there are any stateful ops in the pipeline; only valid for the
+     * source stage.
+     */
+    private boolean sourceAnyStateful;
+
+    /**
+     * True if pipeline is parallel, otherwise the pipeline is sequential; only
+     * valid for the source stage.
+     */
+    private boolean parallel;
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Supplier<Spliterator>} describing the stream source
+     * @param sourceFlags The source flags for the stream source, described in
+     * {@link StreamOpFlag}
+     * @param parallel True if the pipeline is parallel
+     */
+    AbstractPipeline(Supplier<? extends Spliterator<?>> source,
+                     int sourceFlags, boolean parallel) {
+        this.previousStage = null;
+        this.sourceSupplier = source;
+        this.sourceStage = this;
+        this.sourceOrOpFlags = sourceFlags & StreamOpFlag.STREAM_MASK;
+        // The following is an optimization of:
+        // StreamOpFlag.combineOpFlags(sourceOrOpFlags, StreamOpFlag.INITIAL_OPS_VALUE);
+        this.combinedFlags = (~(sourceOrOpFlags << 1)) & StreamOpFlag.INITIAL_OPS_VALUE;
+        this.depth = 0;
+        this.parallel = parallel;
+    }
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Spliterator} describing the stream source
+     * @param sourceFlags the source flags for the stream source, described in
+     * {@link StreamOpFlag}
+     * @param parallel {@code true} if the pipeline is parallel
+     */
+    AbstractPipeline(Spliterator<?> source,
+                     int sourceFlags, boolean parallel) {
+        this.previousStage = null;
+        this.sourceSpliterator = source;
+        this.sourceStage = this;
+        this.sourceOrOpFlags = sourceFlags & StreamOpFlag.STREAM_MASK;
+        // The following is an optimization of:
+        // StreamOpFlag.combineOpFlags(sourceOrOpFlags, StreamOpFlag.INITIAL_OPS_VALUE);
+        this.combinedFlags = (~(sourceOrOpFlags << 1)) & StreamOpFlag.INITIAL_OPS_VALUE;
+        this.depth = 0;
+        this.parallel = parallel;
+    }
+
+    /**
+     * Constructor for appending an intermediate operation stage onto an
+     * existing pipeline.
+     *
+     * @param previousStage the upstream pipeline stage
+     * @param opFlags the operation flags for the new stage, described in
+     * {@link StreamOpFlag}
+     */
+    AbstractPipeline(AbstractPipeline<?, E_IN, ?> previousStage, int opFlags) {
+        if (previousStage.linkedOrConsumed)
+            throw new IllegalStateException("stream has already been operated upon");
+        previousStage.linkedOrConsumed = true;
+        previousStage.nextStage = this;
+
+        this.previousStage = previousStage;
+        this.sourceOrOpFlags = opFlags & StreamOpFlag.OP_MASK;
+        this.combinedFlags = StreamOpFlag.combineOpFlags(opFlags, previousStage.combinedFlags);
+        this.sourceStage = previousStage.sourceStage;
+        if (opIsStateful())
+            sourceStage.sourceAnyStateful = true;
+        this.depth = previousStage.depth + 1;
+    }
+
+
+    // Terminal evaluation methods
+
+    /**
+     * Evaluate the pipeline with a terminal operation to produce a result.
+     *
+     * @param <R> the type of result
+     * @param terminalOp the terminal operation to be applied to the pipeline.
+     * @return the result
+     */
+    final <R> R evaluate(TerminalOp<E_OUT, R> terminalOp) {
+        assert getOutputShape() == terminalOp.inputShape();
+        if (linkedOrConsumed)
+            throw new IllegalStateException("stream has already been operated upon");
+        linkedOrConsumed = true;
+
+        return isParallel()
+               ? (R) terminalOp.evaluateParallel(this, sourceSpliterator(terminalOp.getOpFlags()))
+               : (R) terminalOp.evaluateSequential(this, sourceSpliterator(terminalOp.getOpFlags()));
+    }
+
+    /**
+     * Collect the elements output from the pipeline stage.
+     *
+     * @param generator the array generator to be used to create array instances
+     * @return a flat array-backed Node that holds the collected output elements
+     */
+    final Node<E_OUT> evaluateToArrayNode(IntFunction<E_OUT[]> generator) {
+        if (linkedOrConsumed)
+            throw new IllegalStateException("stream has already been operated upon");
+        linkedOrConsumed = true;
+
+        // If the last intermediate operation is stateful then
+        // evaluate directly to avoid an extra collection step
+        if (isParallel() && previousStage != null && opIsStateful()) {
+            return opEvaluateParallel(previousStage, previousStage.sourceSpliterator(0), generator);
+        }
+        else {
+            return evaluate(sourceSpliterator(0), true, generator);
+        }
+    }
+
+    /**
+     * Gets the source stage spliterator if this pipeline stage is the source
+     * stage.  The pipeline is consumed after this method is called and
+     * returns successfully.
+     *
+     * @return the source stage spliterator
+     * @throws IllegalStateException if this pipeline stage is not the source
+     *         stage.
+     */
+    final Spliterator<E_OUT> sourceStageSpliterator() {
+        if (this != sourceStage)
+            throw new IllegalStateException();
+
+        if (linkedOrConsumed)
+            throw new IllegalStateException("stream has already been operated upon");
+        linkedOrConsumed = true;
+
+        if (sourceStage.sourceSpliterator != null) {
+            Spliterator<E_OUT> s = sourceStage.sourceSpliterator;
+            sourceStage.sourceSpliterator = null;
+            return s;
+        }
+        else if (sourceStage.sourceSupplier != null) {
+            Spliterator<E_OUT> s = (Spliterator<E_OUT>) sourceStage.sourceSupplier.get();
+            sourceStage.sourceSupplier = null;
+            return s;
+        }
+        else {
+            throw new IllegalStateException("source already consumed");
+        }
+    }
+
+    // BaseStream
+
+    /**
+     * Implements {@link BaseStream#sequential()}
+     */
+    public final S sequential() {
+        sourceStage.parallel = false;
+        return (S) this;
+    }
+
+    /**
+     * Implements {@link BaseStream#parallel()}
+     */
+    public final S parallel() {
+        sourceStage.parallel = true;
+        return (S) this;
+    }
+
+    // Primitive specialization use co-variant overrides, hence is not final
+    /**
+     * Implements {@link BaseStream#spliterator()}
+     */
+    public Spliterator<E_OUT> spliterator() {
+        if (linkedOrConsumed)
+            throw new IllegalStateException("stream has already been operated upon");
+        linkedOrConsumed = true;
+
+        if (this == sourceStage) {
+            if (sourceStage.sourceSpliterator != null) {
+                Spliterator<E_OUT> s = sourceStage.sourceSpliterator;
+                sourceStage.sourceSpliterator = null;
+                return s;
+            }
+            else if (sourceStage.sourceSupplier != null) {
+                Supplier<Spliterator<E_OUT>> s = sourceStage.sourceSupplier;
+                sourceStage.sourceSupplier = null;
+                return lazySpliterator(s);
+            }
+            else {
+                throw new IllegalStateException("source already consumed");
+            }
+        }
+        else {
+            return wrap(this, () -> sourceSpliterator(0), isParallel());
+        }
+    }
+
+    /**
+     * Implements {@link BaseStream#isParallel()}
+     */
+    public final boolean isParallel() {
+        return sourceStage.parallel;
+    }
+
+
+    /**
+     * Returns the composition of stream flags of the stream source and all
+     * intermediate operations.
+     *
+     * @return the composition of stream flags of the stream source and all
+     *         intermediate operations
+     * @see StreamOpFlag
+     */
+    final int getStreamFlags() {
+        return StreamOpFlag.toStreamFlags(combinedFlags);
+    }
+
+    /**
+     * Prepare the pipeline for a parallel execution.  As the pipeline is built,
+     * the flags and depth indicators are set up for a sequential execution.
+     * If the execution is parallel, and there are any stateful operations, then
+     * some of these need to be adjusted, as well as adjusting for flags from
+     * the terminal operation (such as back-propagating UNORDERED).
+     * Need not be called for a sequential execution.
+     *
+     * @param terminalFlags Operation flags for the terminal operation
+     */
+    private void parallelPrepare(int terminalFlags) {
+        AbstractPipeline backPropagationHead = sourceStage;
+        if (sourceStage.sourceAnyStateful) {
+            int depth = 1;
+            for (AbstractPipeline u = sourceStage, p = sourceStage.nextStage;
+                 p != null;
+                 u = p, p = p.nextStage) {
+                int thisOpFlags = p.sourceOrOpFlags;
+                if (p.opIsStateful()) {
+                    // If the stateful operation is a short-circuit operation
+                    // then move the back propagation head forwards
+                    // NOTE: there are no size-injecting ops
+                    if (StreamOpFlag.SHORT_CIRCUIT.isKnown(thisOpFlags)) {
+                        backPropagationHead = p;
+                    }
+
+                    depth = 0;
+                    // The following injects size, it is equivalent to:
+                    // StreamOpFlag.combineOpFlags(StreamOpFlag.IS_SIZED, p.combinedFlags);
+                    thisOpFlags = (thisOpFlags & ~StreamOpFlag.NOT_SIZED) | StreamOpFlag.IS_SIZED;
+                }
+                p.depth = depth++;
+                p.combinedFlags = StreamOpFlag.combineOpFlags(thisOpFlags, u.combinedFlags);
+            }
+        }
+
+        // Apply the upstream terminal flags
+        if (terminalFlags != 0) {
+            int upstreamTerminalFlags = terminalFlags & StreamOpFlag.UPSTREAM_TERMINAL_OP_MASK;
+            for (AbstractPipeline p = backPropagationHead; p.nextStage != null; p = p.nextStage) {
+                p.combinedFlags = StreamOpFlag.combineOpFlags(upstreamTerminalFlags, p.combinedFlags);
+            }
+
+            combinedFlags = StreamOpFlag.combineOpFlags(terminalFlags, combinedFlags);
+        }
+    }
+
+    /**
+     * Get the source spliterator for this pipeline stage.  For a sequential or
+     * stateless parallel pipeline, this is the source spliterator.  For a
+     * stateful parallel pipeline, this is a spliterator describing the results
+     * of all computations up to and including the most recent stateful
+     * operation.
+     */
+    private Spliterator<?> sourceSpliterator(int terminalFlags) {
+        // Get the source spliterator of the pipeline
+        Spliterator<?> spliterator = null;
+        if (sourceStage.sourceSpliterator != null) {
+            spliterator = sourceStage.sourceSpliterator;
+            sourceStage.sourceSpliterator = null;
+        }
+        else if (sourceStage.sourceSupplier != null) {
+            spliterator = (Spliterator<?>) sourceStage.sourceSupplier.get();
+            sourceStage.sourceSupplier = null;
+        }
+        else {
+            throw new IllegalStateException("source already consumed");
+        }
+
+        if (isParallel()) {
+            // @@@ Merge parallelPrepare with the loop below and use the
+            //     spliterator characteristics to determine if SIZED
+            //     should be injected
+            parallelPrepare(terminalFlags);
+
+            // Adapt the source spliterator, evaluating each stateful op
+            // in the pipeline up to and including this pipeline stage
+            for (AbstractPipeline u = sourceStage, p = sourceStage.nextStage, e = this;
+                 u != e;
+                 u = p, p = p.nextStage) {
+
+                if (p.opIsStateful()) {
+                    spliterator = p.opEvaluateParallelLazy(u, spliterator);
+                }
+            }
+        }
+        else if (terminalFlags != 0)  {
+            combinedFlags = StreamOpFlag.combineOpFlags(terminalFlags, combinedFlags);
+        }
+
+        return spliterator;
+    }
+
+
+    // PipelineHelper
+
+    @Override
+    final <P_IN> long exactOutputSizeIfKnown(Spliterator<P_IN> spliterator) {
+        return StreamOpFlag.SIZED.isKnown(getStreamAndOpFlags()) ? spliterator.getExactSizeIfKnown() : -1;
+    }
+
+    @Override
+    final <P_IN, S extends Sink<E_OUT>> S wrapAndCopyInto(S sink, Spliterator<P_IN> spliterator) {
+        copyInto(wrapSink(Objects.requireNonNull(sink)), spliterator);
+        return sink;
+    }
+
+    @Override
+    final <P_IN> void copyInto(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator) {
+        Objects.requireNonNull(wrappedSink);
+
+        if (!StreamOpFlag.SHORT_CIRCUIT.isKnown(getStreamAndOpFlags())) {
+            wrappedSink.begin(spliterator.getExactSizeIfKnown());
+            spliterator.forEachRemaining(wrappedSink);
+            wrappedSink.end();
+        }
+        else {
+            copyIntoWithCancel(wrappedSink, spliterator);
+        }
+    }
+
+    @Override
+    final <P_IN> void copyIntoWithCancel(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator) {
+        AbstractPipeline p = AbstractPipeline.this;
+        while (p.depth > 0) {
+            p = p.previousStage;
+        }
+        wrappedSink.begin(spliterator.getExactSizeIfKnown());
+        p.forEachWithCancel(spliterator, wrappedSink);
+        wrappedSink.end();
+    }
+
+    @Override
+    final int getStreamAndOpFlags() {
+        return combinedFlags;
+    }
+
+    final boolean isOrdered() {
+        return StreamOpFlag.ORDERED.isKnown(combinedFlags);
+    }
+
+    @Override
+    final <P_IN> Sink<P_IN> wrapSink(Sink<E_OUT> sink) {
+        Objects.requireNonNull(sink);
+
+        for (AbstractPipeline p=AbstractPipeline.this; p.depth > 0; p=p.previousStage) {
+            sink = p.opWrapSink(p.previousStage.combinedFlags, sink);
+        }
+        return (Sink<P_IN>) sink;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    final <P_IN> Node<E_OUT> evaluate(Spliterator<P_IN> spliterator,
+                                      boolean flatten,
+                                      IntFunction<E_OUT[]> generator) {
+        if (isParallel()) {
+            // @@@ Optimize if op of this pipeline stage is a stateful op
+            return evaluateToNode(this, spliterator, flatten, generator);
+        }
+        else {
+            Node.Builder<E_OUT> nb = makeNodeBuilder(
+                    exactOutputSizeIfKnown(spliterator), generator);
+            return wrapAndCopyInto(nb, spliterator).build();
+        }
+    }
+
+
+    // Shape-specific abstract methods, implemented by XxxPipeline classes
+
+    /**
+     * Get the output shape of the pipeline.  If the pipeline is the head,
+     * then it's output shape corresponds to the shape of the source.
+     * Otherwise, it's output shape corresponds to the output shape of the
+     * associated operation.
+     *
+     * @return the output shape
+     */
+    abstract StreamShape getOutputShape();
+
+    /**
+     * Collect elements output from a pipeline into a Node that holds elements
+     * of this shape.
+     *
+     * @param helper the pipeline helper describing the pipeline stages
+     * @param spliterator the source spliterator
+     * @param flattenTree true if the returned node should be flattened
+     * @param generator the array generator
+     * @return a Node holding the output of the pipeline
+     */
+    abstract <P_IN> Node<E_OUT> evaluateToNode(PipelineHelper<E_OUT> helper,
+                                               Spliterator<P_IN> spliterator,
+                                               boolean flattenTree,
+                                               IntFunction<E_OUT[]> generator);
+
+    /**
+     * Create a spliterator that wraps a source spliterator, compatible with
+     * this stream shape, and operations associated with a {@link
+     * PipelineHelper}.
+     *
+     * @param ph the pipeline helper describing the pipeline stages
+     * @param supplier the supplier of a spliterator
+     * @return a wrapping spliterator compatible with this shape
+     */
+    abstract <P_IN> Spliterator<E_OUT> wrap(PipelineHelper<E_OUT> ph,
+                                            Supplier<Spliterator<P_IN>> supplier,
+                                            boolean isParallel);
+
+    /**
+     * Create a lazy spliterator that wraps and obtains the supplied the
+     * spliterator when a method is invoked on the lazy spliterator.
+     * @param supplier the supplier of a spliterator
+     */
+    abstract Spliterator<E_OUT> lazySpliterator(Supplier<? extends Spliterator<E_OUT>> supplier);
+
+    /**
+     * Traverse the elements of a spliterator compatible with this stream shape,
+     * pushing those elements into a sink.   If the sink requests cancellation,
+     * no further elements will be pulled or pushed.
+     *
+     * @param spliterator the spliterator to pull elements from
+     * @param sink the sink to push elements to
+     */
+    abstract void forEachWithCancel(Spliterator<E_OUT> spliterator, Sink<E_OUT> sink);
+
+    /**
+     * Make a node builder compatible with this stream shape.
+     *
+     * @param exactSizeIfKnown if {@literal >=0}, then a node builder will be created that
+     * has a fixed capacity of at most sizeIfKnown elements. If {@literal < 0},
+     * then the node builder has an unfixed capacity. A fixed capacity node
+     * builder will throw exceptions if an element is added after builder has
+     * reached capacity, or is built before the builder has reached capacity.
+     * @param generator the array generator to be used to create instances of a
+     * T[] array. For implementations supporting primitive nodes, this parameter
+     * may be ignored.
+     * @return a node builder
+     */
+    abstract Node.Builder<E_OUT> makeNodeBuilder(long exactSizeIfKnown,
+                                                 IntFunction<E_OUT[]> generator);
+
+
+    // Op-specific abstract methods, implemented by the operation class
+
+    /**
+     * Returns whether this operation is stateful or not.  If it is stateful,
+     * then the method
+     * {@link #opEvaluateParallel(PipelineHelper, java.util.Spliterator, java.util.function.IntFunction)}
+     * must be overridden.
+     *
+     * @return {@code true} if this operation is stateful
+     */
+    abstract boolean opIsStateful();
+
+    /**
+     * Accepts a {@code Sink} which will receive the results of this operation,
+     * and return a {@code Sink} which accepts elements of the input type of
+     * this operation and which performs the operation, passing the results to
+     * the provided {@code Sink}.
+     *
+     * @apiNote
+     * The implementation may use the {@code flags} parameter to optimize the
+     * sink wrapping.  For example, if the input is already {@code DISTINCT},
+     * the implementation for the {@code Stream#distinct()} method could just
+     * return the sink it was passed.
+     *
+     * @param flags The combined stream and operation flags up to, but not
+     *        including, this operation
+     * @param sink sink to which elements should be sent after processing
+     * @return a sink which accepts elements, perform the operation upon
+     *         each element, and passes the results (if any) to the provided
+     *         {@code Sink}.
+     */
+    abstract Sink<E_IN> opWrapSink(int flags, Sink<E_OUT> sink);
+
+    /**
+     * Performs a parallel evaluation of the operation using the specified
+     * {@code PipelineHelper} which describes the upstream intermediate
+     * operations.  Only called on stateful operations.  If {@link
+     * #opIsStateful()} returns true then implementations must override the
+     * default implementation.
+     *
+     * @implSpec The default implementation always throw
+     * {@code UnsupportedOperationException}.
+     *
+     * @param helper the pipeline helper describing the pipeline stages
+     * @param spliterator the source {@code Spliterator}
+     * @param generator the array generator
+     * @return a {@code Node} describing the result of the evaluation
+     */
+    <P_IN> Node<E_OUT> opEvaluateParallel(PipelineHelper<E_OUT> helper,
+                                          Spliterator<P_IN> spliterator,
+                                          IntFunction<E_OUT[]> generator) {
+        throw new UnsupportedOperationException("Parallel evaluation is not supported");
+    }
+
+    /**
+     * Returns a {@code Spliterator} describing a parallel evaluation of the
+     * operation, using the specified {@code PipelineHelper} which describes the
+     * upstream intermediate operations.  Only called on stateful operations.
+     * It is not necessary (though acceptable) to do a full computation of the
+     * result here; it is preferable, if possible, to describe the result via a
+     * lazily evaluated spliterator.
+     *
+     * @implSpec The default implementation behaves as if:
+     * <pre>{@code
+     *     return evaluateParallel(helper, i -> (E_OUT[]) new
+     * Object[i]).spliterator();
+     * }</pre>
+     * and is suitable for implementations that cannot do better than a full
+     * synchronous evaluation.
+     *
+     * @param helper the pipeline helper
+     * @param spliterator the source {@code Spliterator}
+     * @return a {@code Spliterator} describing the result of the evaluation
+     */
+    <P_IN> Spliterator<E_OUT> opEvaluateParallelLazy(PipelineHelper<E_OUT> helper,
+                                                     Spliterator<P_IN> spliterator) {
+        return opEvaluateParallel(helper, spliterator, i -> (E_OUT[]) new Object[i]).spliterator();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/AbstractShortCircuitTask.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Spliterator;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Abstract class for fork-join tasks used to implement short-circuiting
+ * stream ops, which can produce a result without processing all elements of the
+ * stream.
+ *
+ * @param <P_IN> type of input elements to the pipeline
+ * @param <P_OUT> type of output elements from the pipeline
+ * @param <R> type of intermediate result, may be different from operation
+ *        result type
+ * @param <K> type of child and sibling tasks
+ * @since 1.8
+ */
+abstract class AbstractShortCircuitTask<P_IN, P_OUT, R,
+                                        K extends AbstractShortCircuitTask<P_IN, P_OUT, R, K>>
+        extends AbstractTask<P_IN, P_OUT, R, K> {
+    /**
+     * The result for this computation; this is shared among all tasks and set
+     * exactly once
+     */
+    protected final AtomicReference<R> sharedResult;
+
+    /**
+     * Indicates whether this task has been canceled.  Tasks may cancel other
+     * tasks in the computation under various conditions, such as in a
+     * find-first operation, a task that finds a value will cancel all tasks
+     * that are later in the encounter order.
+     */
+    protected volatile boolean canceled;
+
+    /**
+     * Constructor for root tasks.
+     *
+     * @param helper the {@code PipelineHelper} describing the stream pipeline
+     *               up to this operation
+     * @param spliterator the {@code Spliterator} describing the source for this
+     *                    pipeline
+     */
+    protected AbstractShortCircuitTask(PipelineHelper<P_OUT> helper,
+                                       Spliterator<P_IN> spliterator) {
+        super(helper, spliterator);
+        sharedResult = new AtomicReference<>(null);
+    }
+
+    /**
+     * Constructor for non-root nodes.
+     *
+     * @param parent parent task in the computation tree
+     * @param spliterator the {@code Spliterator} for the portion of the
+     *                    computation tree described by this task
+     */
+    protected AbstractShortCircuitTask(K parent,
+                                       Spliterator<P_IN> spliterator) {
+        super(parent, spliterator);
+        sharedResult = parent.sharedResult;
+    }
+
+    /**
+     * Returns the value indicating the computation completed with no task
+     * finding a short-circuitable result.  For example, for a "find" operation,
+     * this might be null or an empty {@code Optional}.
+     *
+     * @return the result to return when no task finds a result
+     */
+    protected abstract R getEmptyResult();
+
+    @Override
+    protected boolean canCompute() {
+        // Have we already found an answer?
+        if (sharedResult.get() != null) {
+            tryComplete();
+            return false;
+        } else if (taskCanceled()) {
+            setLocalResult(getEmptyResult());
+            tryComplete();
+            return false;
+        }
+        else {
+            return true;
+        }
+    }
+
+    /**
+     * Declares that a globally valid result has been found.  If another task has
+     * not already found the answer, the result is installed in
+     * {@code sharedResult}.  The {@code compute()} method will check
+     * {@code sharedResult} before proceeding with computation, so this causes
+     * the computation to terminate early.
+     *
+     * @param result the result found
+     */
+    protected void shortCircuit(R result) {
+        if (result != null)
+            sharedResult.compareAndSet(null, result);
+    }
+
+    /**
+     * Sets a local result for this task.  If this task is the root, set the
+     * shared result instead (if not already set).
+     *
+     * @param localResult The result to set for this task
+     */
+    @Override
+    protected void setLocalResult(R localResult) {
+        if (isRoot()) {
+            if (localResult != null)
+                sharedResult.compareAndSet(null, localResult);
+        }
+        else
+            super.setLocalResult(localResult);
+    }
+
+    /**
+     * Retrieves the local result for this task
+     */
+    @Override
+    public R getRawResult() {
+        return getLocalResult();
+    }
+
+    /**
+     * Retrieves the local result for this task.  If this task is the root,
+     * retrieves the shared result instead.
+     */
+    @Override
+    public R getLocalResult() {
+        if (isRoot()) {
+            R answer = sharedResult.get();
+            return (answer == null) ? getEmptyResult() : answer;
+        }
+        else
+            return super.getLocalResult();
+    }
+
+    /**
+     * Mark this task as canceled
+     */
+    protected void cancel() {
+        canceled = true;
+    }
+
+    /**
+     * Queries whether this task is canceled.  A task is considered canceled if
+     * it or any of its parents have been canceled.
+     *
+     * @return {@code true} if this task or any parent is canceled.
+     */
+    protected boolean taskCanceled() {
+        boolean cancel = canceled;
+        if (!cancel) {
+            for (K parent = getParent(); !cancel && parent != null; parent = parent.getParent())
+                cancel = parent.canceled;
+        }
+
+        return cancel;
+    }
+
+    /**
+     * Cancels all tasks which succeed this one in the encounter order.  This
+     * includes canceling all the current task's right sibling, as well as the
+     * later right siblings of all its parents.
+     */
+    protected void cancelLaterNodes() {
+        // Go up the tree, cancel right siblings of this node and all parents
+        for (K parent = getParent(), node = (K) this; parent != null;
+             node = parent, parent = parent.getParent()) {
+            // If node is a left child of parent, then has a right sibling
+            if (parent.leftChild == node) {
+                K rightSibling = parent.rightChild;
+                if (!rightSibling.canceled)
+                    rightSibling.cancel();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/AbstractSpinedBuffer.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+/**
+ * Base class for a data structure for gathering elements into a buffer and then
+ * iterating them. Maintains an array of increasingly sized arrays, so there is
+ * no copying cost associated with growing the data structure.
+ * @since 1.8
+ */
+abstract class AbstractSpinedBuffer {
+    /**
+     * Minimum power-of-two for the first chunk.
+     */
+    public static final int MIN_CHUNK_POWER = 4;
+
+    /**
+     * Minimum size for the first chunk.
+     */
+    public static final int MIN_CHUNK_SIZE = 1 << MIN_CHUNK_POWER;
+
+    /**
+     * Max power-of-two for chunks.
+     */
+    public static final int MAX_CHUNK_POWER = 30;
+
+    /**
+     * Minimum array size for array-of-chunks.
+     */
+    public static final int MIN_SPINE_SIZE = 8;
+
+
+    /**
+     * log2 of the size of the first chunk.
+     */
+    protected final int initialChunkPower;
+
+    /**
+     * Index of the *next* element to write; may point into, or just outside of,
+     * the current chunk.
+     */
+    protected int elementIndex;
+
+    /**
+     * Index of the *current* chunk in the spine array, if the spine array is
+     * non-null.
+     */
+    protected int spineIndex;
+
+    /**
+     * Count of elements in all prior chunks.
+     */
+    protected long[] priorElementCount;
+
+    /**
+     * Construct with an initial capacity of 16.
+     */
+    protected AbstractSpinedBuffer() {
+        this.initialChunkPower = MIN_CHUNK_POWER;
+    }
+
+    /**
+     * Construct with a specified initial capacity.
+     *
+     * @param initialCapacity The minimum expected number of elements
+     */
+    protected AbstractSpinedBuffer(int initialCapacity) {
+        if (initialCapacity < 0)
+            throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity);
+
+        this.initialChunkPower = Math.max(MIN_CHUNK_POWER,
+                                          Integer.SIZE - Integer.numberOfLeadingZeros(initialCapacity - 1));
+    }
+
+    /**
+     * Is the buffer currently empty?
+     */
+    public boolean isEmpty() {
+        return (spineIndex == 0) && (elementIndex == 0);
+    }
+
+    /**
+     * How many elements are currently in the buffer?
+     */
+    public long count() {
+        return (spineIndex == 0)
+               ? elementIndex
+               : priorElementCount[spineIndex] + elementIndex;
+    }
+
+    /**
+     * How big should the nth chunk be?
+     */
+    protected int chunkSize(int n) {
+        int power = (n == 0 || n == 1)
+                    ? initialChunkPower
+                    : Math.min(initialChunkPower + n - 1, AbstractSpinedBuffer.MAX_CHUNK_POWER);
+        return 1 << power;
+    }
+
+    /**
+     * Remove all data from the buffer
+     */
+    public abstract void clear();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/AbstractTask.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.concurrent.ForkJoinPool;
+
+/**
+ * Abstract base class for most fork-join tasks used to implement stream ops.
+ * Manages splitting logic, tracking of child tasks, and intermediate results.
+ * Each task is associated with a {@link Spliterator} that describes the portion
+ * of the input associated with the subtree rooted at this task.
+ * Tasks may be leaf nodes (which will traverse the elements of
+ * the {@code Spliterator}) or internal nodes (which split the
+ * {@code Spliterator} into multiple child tasks).
+ *
+ * @implNote
+ * <p>This class is based on {@link CountedCompleter}, a form of fork-join task
+ * where each task has a semaphore-like count of uncompleted children, and the
+ * task is implicitly completed and notified when its last child completes.
+ * Internal node tasks will likely override the {@code onCompletion} method from
+ * {@code CountedCompleter} to merge the results from child tasks into the
+ * current task's result.
+ *
+ * <p>Splitting and setting up the child task links is done by {@code compute()}
+ * for internal nodes.  At {@code compute()} time for leaf nodes, it is
+ * guaranteed that the parent's child-related fields (including sibling links
+ * for the parent's children) will be set up for all children.
+ *
+ * <p>For example, a task that performs a reduce would override {@code doLeaf()}
+ * to perform a reduction on that leaf node's chunk using the
+ * {@code Spliterator}, and override {@code onCompletion()} to merge the results
+ * of the child tasks for internal nodes:
+ *
+ * <pre>{@code
+ *     protected S doLeaf() {
+ *         spliterator.forEach(...);
+ *         return localReductionResult;
+ *     }
+ *
+ *     public void onCompletion(CountedCompleter caller) {
+ *         if (!isLeaf()) {
+ *             ReduceTask<P_IN, P_OUT, T, R> child = children;
+ *             R result = child.getLocalResult();
+ *             child = child.nextSibling;
+ *             for (; child != null; child = child.nextSibling)
+ *                 result = combine(result, child.getLocalResult());
+ *             setLocalResult(result);
+ *         }
+ *     }
+ * }</pre>
+ *
+ * @param <P_IN> Type of elements input to the pipeline
+ * @param <P_OUT> Type of elements output from the pipeline
+ * @param <R> Type of intermediate result, which may be different from operation
+ *        result type
+ * @param <K> Type of parent, child and sibling tasks
+ * @since 1.8
+ */
+abstract class AbstractTask<P_IN, P_OUT, R,
+                            K extends AbstractTask<P_IN, P_OUT, R, K>>
+        extends CountedCompleter<R> {
+
+    /**
+     * Default target factor of leaf tasks for parallel decomposition.
+     * To allow load balancing, we over-partition, currently to approximately
+     * four tasks per processor, which enables others to help out
+     * if leaf tasks are uneven or some processors are otherwise busy.
+     */
+    static final int LEAF_TARGET = ForkJoinPool.getCommonPoolParallelism() << 2;
+
+    /** The pipeline helper, common to all tasks in a computation */
+    protected final PipelineHelper<P_OUT> helper;
+
+    /**
+     * The spliterator for the portion of the input associated with the subtree
+     * rooted at this task
+     */
+    protected Spliterator<P_IN> spliterator;
+
+    /** Target leaf size, common to all tasks in a computation */
+    protected final long targetSize;
+
+    /**
+     * The left child.
+     * null if no children
+     * if non-null rightChild is non-null
+     */
+    protected K leftChild;
+
+    /**
+     * The right child.
+     * null if no children
+     * if non-null leftChild is non-null
+     */
+    protected K rightChild;
+
+    /** The result of this node, if completed */
+    private R localResult;
+
+    /**
+     * Constructor for root nodes.
+     *
+     * @param helper The {@code PipelineHelper} describing the stream pipeline
+     *               up to this operation
+     * @param spliterator The {@code Spliterator} describing the source for this
+     *                    pipeline
+     */
+    protected AbstractTask(PipelineHelper<P_OUT> helper,
+                           Spliterator<P_IN> spliterator) {
+        super(null);
+        this.helper = helper;
+        this.spliterator = spliterator;
+        this.targetSize = suggestTargetSize(spliterator.estimateSize());
+    }
+
+    /**
+     * Constructor for non-root nodes.
+     *
+     * @param parent this node's parent task
+     * @param spliterator {@code Spliterator} describing the subtree rooted at
+     *        this node, obtained by splitting the parent {@code Spliterator}
+     */
+    protected AbstractTask(K parent,
+                           Spliterator<P_IN> spliterator) {
+        super(parent);
+        this.spliterator = spliterator;
+        this.helper = parent.helper;
+        this.targetSize = parent.targetSize;
+    }
+
+    /**
+     * Constructs a new node of type T whose parent is the receiver; must call
+     * the AbstractTask(T, Spliterator) constructor with the receiver and the
+     * provided Spliterator.
+     *
+     * @param spliterator {@code Spliterator} describing the subtree rooted at
+     *        this node, obtained by splitting the parent {@code Spliterator}
+     * @return newly constructed child node
+     */
+    protected abstract K makeChild(Spliterator<P_IN> spliterator);
+
+    /**
+     * Computes the result associated with a leaf node.  Will be called by
+     * {@code compute()} and the result passed to @{code setLocalResult()}
+     *
+     * @return the computed result of a leaf node
+     */
+    protected abstract R doLeaf();
+
+    /**
+     * Returns a suggested target leaf size based on the initial size estimate.
+     *
+     * @return suggested target leaf size
+     */
+    public static long suggestTargetSize(long sizeEstimate) {
+        long est = sizeEstimate / LEAF_TARGET;
+        return est > 0L ? est : 1L;
+    }
+
+    /**
+     * Returns a suggestion whether it is advisable to split the provided
+     * spliterator based on target size and other considerations, such as pool
+     * state.
+      *
+     * @return {@code true} if a split is advised otherwise {@code false}
+     */
+    public static boolean suggestSplit(Spliterator spliterator,
+                                       long targetSize) {
+        long remaining = spliterator.estimateSize();
+        return (remaining > targetSize);
+        // @@@ May additionally want to fold in pool characteristics such as surplus task count
+    }
+
+    /**
+     * Returns a suggestion whether it is adviseable to split this task based on
+     * target size and other considerations.
+      *
+     *  @return {@code true} if a split is advised otherwise {@code false}
+     */
+    public boolean suggestSplit() {
+        return suggestSplit(spliterator, targetSize);
+    }
+
+    /**
+     * Returns the local result, if any. Subclasses should use
+     * {@link #setLocalResult(Object)} and {@link #getLocalResult()} to manage
+     * results.  This returns the local result so that calls from within the
+     * fork-join framework will return the correct result.
+     *
+     * @return local result for this node previously stored with
+     * {@link #setLocalResult}
+     */
+    @Override
+    public R getRawResult() {
+        return localResult;
+    }
+
+    /**
+     * Does nothing; instead, subclasses should use
+     * {@link #setLocalResult(Object)}} to manage results.
+     *
+     * @param result must be null, or an exception is thrown (this is a safety
+     *        tripwire to detect when {@code setRawResult()} is being used
+     *        instead of {@code setLocalResult()}
+     */
+    @Override
+    protected void setRawResult(R result) {
+        if (result != null)
+            throw new IllegalStateException();
+    }
+
+    /**
+     * Retrieves a result previously stored with {@link #setLocalResult}
+     *
+     * @return local result for this node previously stored with
+     * {@link #setLocalResult}
+     */
+    protected R getLocalResult() {
+        return localResult;
+    }
+
+    /**
+     * Associates the result with the task, can be retrieved with
+     * {@link #getLocalResult}
+     *
+     * @param localResult local result for this node
+     */
+    protected void setLocalResult(R localResult) {
+        this.localResult = localResult;
+    }
+
+    /**
+     * Indicates whether this task is a leaf node.  (Only valid after
+     * {@link #compute} has been called on this node).  If the node is not a
+     * leaf node, then children will be non-null and numChildren will be
+     * positive.
+     *
+     * @return {@code true} if this task is a leaf node
+     */
+    protected boolean isLeaf() {
+        return leftChild == null;
+    }
+
+    /**
+     * Indicates whether this task is the root node
+     *
+     * @return {@code true} if this task is the root node.
+     */
+    protected boolean isRoot() {
+        return getParent() == null;
+    }
+
+    /**
+     * Returns the parent of this task, or null if this task is the root
+     *
+     * @return the parent of this task, or null if this task is the root
+     */
+    @SuppressWarnings("unchecked")
+    protected K getParent() {
+        return (K) getCompleter();
+    }
+
+    /**
+     * Decides whether or not to split a task further or compute it directly. If
+     * computing directly, call {@code doLeaf} and pass the result to
+     * {@code setRawResult}.  If splitting, set up the child-related fields,
+     * create the child tasks, fork the leftmost (prefix) child tasks, and
+     * compute the rightmost (remaining) child tasks.
+     *
+     * <p>
+     * Computing will continue for rightmost tasks while a task can be computed
+     * as determined by {@link #canCompute()} and that task should and can be
+     * split into left and right tasks.
+     *
+     * <p>
+     * The rightmost tasks are computed in a loop rather than recursively to
+     * avoid potential stack overflows when computing with a right-balanced
+     * tree, such as that produced when splitting with a {@link Spliterator}
+     * created from an {@link java.util.Iterator}.
+     */
+    @Override
+    public final void compute() {
+        @SuppressWarnings("unchecked")
+        K task = (K) this;
+        while (task.canCompute()) {
+            Spliterator<P_IN> split;
+            if (!task.suggestSplit() || (split = task.spliterator.trySplit()) == null) {
+                task.setLocalResult(task.doLeaf());
+                task.tryComplete();
+                return;
+            }
+            else {
+                K l = task.leftChild = task.makeChild(split);
+                K r = task.rightChild = task.makeChild(task.spliterator);
+                task.setPendingCount(1);
+                l.fork();
+                task = r;
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @implNote
+     * Clears spliterator and children fields.  Overriders MUST call
+     * {@code super.onCompletion} as the last thing they do if they want these
+     * cleared.
+     */
+    @Override
+    public void onCompletion(CountedCompleter<?> caller) {
+        spliterator = null;
+        leftChild = rightChild = null;
+    }
+
+    /**
+     * Determines if the task can be computed.
+     *
+     * @implSpec The default always returns true
+     *
+     * @return {@code true} if this task can be computed to either calculate the
+     *         leaf via {@link #doLeaf()} or split, otherwise false if this task
+     *         cannot be computed, for example if this task has been canceled
+     *         and/or a result for the computation has been found by another
+     *         task.
+     */
+    protected boolean canCompute() {
+        return true;
+    }
+
+    /**
+     * Returns whether this node is a "leftmost" node -- whether the path from
+     * the root to this node involves only traversing leftmost child links.  For
+     * a leaf node, this means it is the first leaf node in the encounter order.
+     *
+     * @return {@code true} if this node is a "leftmost" node
+     */
+    protected boolean isLeftmostNode() {
+        @SuppressWarnings("unchecked")
+        K node = (K) this;
+        while (node != null) {
+            K parent = node.getParent();
+            if (parent != null && parent.leftChild != node)
+                return false;
+            node = parent;
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/BaseStream.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Iterator;
+import java.util.Spliterator;
+
+/**
+ * Base interface for stream types such as {@link Stream}, {@link IntStream},
+ * etc.  Contains methods common to all stream types.  Many of these methods
+ * are implemented by {@link AbstractPipeline}, even though
+ * {@code AbstractPipeline} does not directly implement {@code BaseStream}.
+ *
+ * @param <T> type of stream elements
+ * @param <S> type of stream implementing {@code BaseStream}
+ * @since 1.8
+ */
+interface BaseStream<T, S extends BaseStream<T, S>> {
+    /**
+     * Returns an iterator for the elements of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @return the element iterator for this stream
+     */
+    Iterator<T> iterator();
+
+    /**
+     * Returns a spliterator for the elements of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @return the element spliterator for this stream
+     */
+    Spliterator<T> spliterator();
+
+    /**
+     * Returns whether this stream, when executed, would execute in parallel
+     * (assuming no further modification of the stream, such as appending
+     * further intermediate operations or changing its parallelism).  Calling
+     * this method after invoking an intermediate or terminal stream operation
+     * method may yield unpredictable results.
+     *
+     * @return {@code true} if this stream would execute in parallel if executed
+     * without further modification otherwise {@code false}
+     */
+    boolean isParallel();
+
+    /**
+     * Returns an equivalent stream that is sequential.  May return
+     * itself, either because the stream was already sequential, or because
+     * the underlying stream state was modified to be sequential.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @return a sequential stream
+     */
+    S sequential();
+
+    /**
+     * Returns an equivalent stream that is parallel.  May return
+     * itself, either because the stream was already parallel, or because
+     * the underlying stream state was modified to be parallel.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @return a parallel stream
+     */
+    S parallel();
+
+    /**
+     * Returns an equivalent stream that is
+     * <a href="package-summary.html#Ordering">unordered</a>.  May return
+     * itself if the stream was already unordered.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @return an unordered stream
+     */
+    S unordered();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/CloseableStream.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+/**
+ * A {@code CloseableStream} is a {@code Stream} that can be closed.
+ * The close method is invoked to release resources that the object is
+ * holding (such as open files).
+ *
+ * @param <T> The type of stream elements
+ * @since 1.8
+ */
+public interface CloseableStream<T> extends Stream<T>, AutoCloseable {
+
+    /**
+     * Closes this resource, relinquishing any underlying resources.
+     * This method is invoked automatically on objects managed by the
+     * {@code try}-with-resources statement.  Does nothing if called when
+     * the resource has already been closed.
+     *
+     * This method does not allow throwing checked {@code Exception}s like
+     * {@link AutoCloseable#close() AutoCloseable.close()}. Cases where the
+     * close operation may fail require careful attention by implementers. It
+     * is strongly advised to relinquish the underlying resources and to
+     * internally <em>mark</em> the resource as closed. The {@code close}
+     * method is unlikely to be invoked more than once and so this ensures
+     * that the resources are released in a timely manner. Furthermore it
+     * reduces problems that could arise when the resource wraps, or is
+     * wrapped, by another resource.
+     *
+     * @see AutoCloseable#close()
+     */
+    void close();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Collector.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Supplier;
+
+/**
+ * A <a href="package-summary.html#Reduction">reduction operation</a> that
+ * supports folding input elements into a cumulative result.  The result may be
+ * a value or may be a mutable result container.  Examples of operations
+ * accumulating results into a mutable result container include: accumulating
+ * input elements into a {@code Collection}; concatenating strings into a
+ * {@code StringBuilder}; computing summary information about elements such as
+ * sum, min, max, or average; computing "pivot table" summaries such as "maximum
+ * valued transaction by seller", etc.  Reduction operations can be performed
+ * either sequentially or in parallel.
+ *
+ * <p>The following are examples of using the predefined {@code Collector}
+ * implementations in {@link Collectors} with the {@code Stream} API to perform
+ * mutable reduction tasks:
+ * <pre>{@code
+ *     // Accumulate elements into a List
+ *     List<String> list = stream.collect(Collectors.toList());
+ *
+ *     // Accumulate elements into a TreeSet
+ *     Set<String> list = stream.collect(Collectors.toCollection(TreeSet::new));
+ *
+ *     // Convert elements to strings and concatenate them, separated by commas
+ *     String joined = stream.map(Object::toString)
+ *                           .collect(Collectors.toStringJoiner(", "))
+ *                           .toString();
+ *
+ *     // Find highest-paid employee
+ *     Employee highestPaid = employees.stream()
+ *                                     .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)));
+ *
+ *     // Group employees by department
+ *     Map<Department, List<Employee>> byDept
+ *         = employees.stream()
+ *                    .collect(Collectors.groupingBy(Employee::getDepartment));
+ *
+ *     // Find highest-paid employee by department
+ *     Map<Department, Employee> highestPaidByDept
+ *         = employees.stream()
+ *                    .collect(Collectors.groupingBy(Employee::getDepartment,
+ *                                                   Collectors.maxBy(Comparators.comparing(Employee::getSalary))));
+ *
+ *     // Partition students into passing and failing
+ *     Map<Boolean, List<Student>> passingFailing =
+ *         students.stream()
+ *                 .collect(Collectors.partitioningBy(s -> s.getGrade() >= PASS_THRESHOLD);
+ *
+ * }</pre>
+ *
+ * <p>A {@code Collector} is specified by three functions that work together to
+ * manage a result or result container.  They are: creation of an initial
+ * result, incorporating a new data element into a result, and combining two
+ * results into one. The last function -- combining two results into one -- is
+ * used during parallel operations, where subsets of the input are accumulated
+ * in parallel, and then the subresults merged into a combined result. The
+ * result may be a mutable container or a value.  If the result is mutable, the
+ * accumulation and combination functions may either mutate their left argument
+ * and return that (such as adding elements to a collection), or return a new
+ * result, in which case it should not perform any mutation.
+ *
+ * <p>Collectors also have a set of characteristics, including
+ * {@link Characteristics#CONCURRENT} and
+ * {@link Characteristics#STRICTLY_MUTATIVE}.  These characteristics provide
+ * hints that can be used by a reduction implementation to provide better
+ * performance.
+ *
+ * <p>Libraries that implement reduction based on {@code Collector}, such as
+ * {@link Stream#collect(Collector)}, must adhere to the following constraints:
+ * <ul>
+ *     <li>The first argument passed to the accumulator function, and both
+ *     arguments passed to the combiner function, must be the result of a
+ *     previous invocation of {@link #resultSupplier()}, {@link #accumulator()},
+ *     or {@link #combiner()}.</li>
+ *     <li>The implementation should not do anything with the result of any of
+ *     the result supplier, accumulator, or combiner functions other than to
+ *     pass them again to the accumulator or combiner functions, or return them
+ *     to the caller of the reduction operation.</li>
+ *     <li>If a result is passed to the accumulator or combiner function, and
+ *     the same object is not returned from that function, it is never used
+ *     again.</li>
+ *     <li>Once a result is passed to the combiner function, it is never passed
+ *     to the accumulator function again.</li>
+ *     <li>For non-concurrent collectors, any result returned from the result
+ *     supplier, accumulator, or combiner functions must be serially
+ *     thread-confined.  This enables collection to occur in parallel without
+ *     the {@code Collector} needing to implement any additional synchronization.
+ *     The reduction implementation must manage that the input is properly
+ *     partitioned, that partitions are processed in isolation, and combining
+ *     happens only after accumulation is complete.</li>
+ *     <li>For concurrent collectors, an implementation is free to (but not
+ *     required to) implement reduction concurrently.  A concurrent reduction
+ *     is one where the accumulator function is called concurrently from
+ *     multiple threads, using the same concurrently-modifiable result container,
+ *     rather than keeping the result isolated during accumulation.
+ *     A concurrent reduction should only be applied if the collector has the
+ *     {@link Characteristics#UNORDERED} characteristics or if the
+ *     originating data is unordered.</li>
+ * </ul>
+ *
+ * @apiNote
+ * Performing a reduction operation with a {@code Collector} should produce a
+ * result equivalent to:
+ * <pre>{@code
+ *     BiFunction<R,T,R> accumulator = collector.accumulator();
+ *     R result = collector.resultSupplier().get();
+ *     for (T t : data)
+ *         result = accumulator.apply(result, t);
+ *     return result;
+ * }</pre>
+ *
+ * <p>However, the library is free to partition the input, perform the reduction
+ * on the partitions, and then use the combiner function to combine the partial
+ * results to achieve a parallel reduction.  Depending on the specific reduction
+ * operation, this may perform better or worse, depending on the relative cost
+ * of the accumulator and combiner functions.
+ *
+ * <p>An example of an operation that can be easily modeled by {@code Collector}
+ * is accumulating elements into a {@code TreeSet}. In this case, the {@code
+ * resultSupplier()} function is {@code () -> new Treeset<T>()}, the
+ * {@code accumulator} function is
+ * {@code (set, element) -> { set.add(element); return set; }}, and the combiner
+ * function is {@code (left, right) -> { left.addAll(right); return left; }}.
+ * (This behavior is implemented by
+ * {@code Collectors.toCollection(TreeSet::new)}).
+ *
+ * TODO Associativity and commutativity
+ *
+ * @see Stream#collect(Collector)
+ * @see Collectors
+ *
+ * @param <T> the type of input element to the collect operation
+ * @param <R> the result type of the collect operation
+ * @since 1.8
+ */
+public interface Collector<T, R> {
+    /**
+     * A function that creates and returns a new result that represents
+     * "no values".  If the accumulator or combiner functions may mutate their
+     * arguments, this must be a new, empty result container.
+     *
+     * @return a function which, when invoked, returns a result representing
+     * "no values"
+     */
+    Supplier<R> resultSupplier();
+
+    /**
+     * A function that folds a new value into a cumulative result.  The result
+     * may be a mutable result container or a value.  The accumulator function
+     * may modify a mutable container and return it, or create a new result and
+     * return that, but if it returns a new result object, it must not modify
+     * any of its arguments.
+     *
+     * <p>If the collector has the {@link Characteristics#STRICTLY_MUTATIVE}
+     * characteristic, then the accumulator function <em>must</em> always return
+     * its first argument, after possibly mutating its state.
+     *
+     * @return a function which folds a new value into a cumulative result
+     */
+    BiFunction<R, T, R> accumulator();
+
+    /**
+     * A function that accepts two partial results and merges them.  The
+     * combiner function may fold state from one argument into the other and
+     * return that, or may return a new result object, but if it returns
+     * a new result object, it must not modify the state of either of its
+     * arguments.
+     *
+     * <p>If the collector has the {@link Characteristics#STRICTLY_MUTATIVE}
+     * characteristic, then the combiner function <em>must</em> always return
+     * its first argument, after possibly mutating its state.
+     *
+     * @return a function which combines two partial results into a cumulative
+     * result
+     */
+    BinaryOperator<R> combiner();
+
+    /**
+     * Returns a {@code Set} of {@code Collector.Characteristics} indicating
+     * the characteristics of this Collector.  This set should be immutable.
+     *
+     * @return an immutable set of collector characteristics
+     */
+    Set<Characteristics> characteristics();
+
+    /**
+     * Characteristics indicating properties of a {@code Collector}, which can
+     * be used to optimize reduction implementations.
+     */
+    enum Characteristics {
+        /**
+         * Indicates that this collector is <em>concurrent</em>, meaning that
+         * the result container can support the accumulator function being
+         * called concurrently with the same result container from multiple
+         * threads. Concurrent collectors must also always have the
+         * {@code STRICTLY_MUTATIVE} characteristic.
+         *
+         * <p>If a {@code CONCURRENT} collector is not also {@code UNORDERED},
+         * then it should only be evaluated concurrently if applied to an
+         * unordered data source.
+         */
+        CONCURRENT,
+
+        /**
+         * Indicates that the result container has no intrinsic order, such as
+         * a {@link Set}.
+         */
+        UNORDERED,
+
+        /**
+         * Indicates that this collector operates by strict mutation of its
+         * result container. This means that the {@link #accumulator()} and
+         * {@link #combiner()} functions will always modify the state of and
+         * return their first argument, rather than returning a different result
+         * container.
+         */
+        STRICTLY_MUTATIVE
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,1320 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Comparators;
+import java.util.DoubleSummaryStatistics;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.IntSummaryStatistics;
+import java.util.Iterator;
+import java.util.List;
+import java.util.LongSummaryStatistics;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+import java.util.StringJoiner;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+
+/**
+ * Implementations of {@link Collector} that implement various useful reduction
+ * operations, such as accumulating elements into collections, summarizing
+ * elements according to various criteria, etc.
+ *
+ * <p>The following are examples of using the predefined {@code Collector}
+ * implementations in {@link Collectors} with the {@code Stream} API to perform
+ * mutable reduction tasks:
+ *
+ * <pre>{@code
+ *     // Accumulate elements into a List
+ *     List<Person> list = people.collect(Collectors.toList());
+ *
+ *     // Accumulate elements into a TreeSet
+ *     List<Person> list = people.collect(Collectors.toCollection(TreeSet::new));
+ *
+ *     // Convert elements to strings and concatenate them, separated by commas
+ *     String joined = stream.map(Object::toString)
+ *                           .collect(Collectors.toStringJoiner(", "))
+ *                           .toString();
+ *
+ *     // Find highest-paid employee
+ *     Employee highestPaid = employees.stream()
+ *                                     .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary)));
+ *
+ *     // Group employees by department
+ *     Map<Department, List<Employee>> byDept
+ *         = employees.stream()
+ *                    .collect(Collectors.groupingBy(Employee::getDepartment));
+ *
+ *     // Find highest-paid employee by department
+ *     Map<Department, Employee> highestPaidByDept
+ *         = employees.stream()
+ *                    .collect(Collectors.groupingBy(Employee::getDepartment,
+ *                                                   Collectors.maxBy(Comparators.comparing(Employee::getSalary))));
+ *
+ *     // Partition students into passing and failing
+ *     Map<Boolean, List<Student>> passingFailing =
+ *         students.stream()
+ *                 .collect(Collectors.partitioningBy(s -> s.getGrade() >= PASS_THRESHOLD);
+ *
+ * }</pre>
+ *
+ * TODO explanation of parallel collection
+ *
+ * @since 1.8
+ */
+public final class Collectors {
+
+    private static final Set<Collector.Characteristics> CH_CONCURRENT
+            = Collections.unmodifiableSet(EnumSet.of(Collector.Characteristics.CONCURRENT,
+                                                     Collector.Characteristics.STRICTLY_MUTATIVE,
+                                                     Collector.Characteristics.UNORDERED));
+    private static final Set<Collector.Characteristics> CH_STRICT
+            = Collections.unmodifiableSet(EnumSet.of(Collector.Characteristics.STRICTLY_MUTATIVE));
+    private static final Set<Collector.Characteristics> CH_STRICT_UNORDERED
+            = Collections.unmodifiableSet(EnumSet.of(Collector.Characteristics.STRICTLY_MUTATIVE,
+                                                     Collector.Characteristics.UNORDERED));
+
+    private Collectors() { }
+
+    /**
+     * Returns a merge function, suitable for use in
+     * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or
+     * {@link #toMap(Function, Function, BinaryOperator) toMap()}, which always
+     * throws {@code IllegalStateException}.  This can be used to enforce the
+     * assumption that the elements being collected are distinct.
+     *
+     * @param <T> the type of input arguments to the merge function
+     * @return a merge function which always throw {@code IllegalStateException}
+     *
+     * @see #firstWinsMerger()
+     * @see #lastWinsMerger()
+     */
+    public static <T> BinaryOperator<T> throwingMerger() {
+        return (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); };
+    }
+
+    /**
+     * Returns a merge function, suitable for use in
+     * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or
+     * {@link #toMap(Function, Function, BinaryOperator) toMap()},
+     * which implements a "first wins" policy.
+     *
+     * @param <T> the type of input arguments to the merge function
+     * @return a merge function which always returns its first argument
+     * @see #lastWinsMerger()
+     * @see #throwingMerger()
+     */
+    public static <T> BinaryOperator<T> firstWinsMerger() {
+        return (u,v) -> u;
+    }
+
+    /**
+     * Returns a merge function, suitable for use in
+     * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or
+     * {@link #toMap(Function, Function, BinaryOperator) toMap()},
+     * which implements a "last wins" policy.
+     *
+     * @param <T> the type of input arguments to the merge function
+     * @return a merge function which always returns its second argument
+     * @see #firstWinsMerger()
+     * @see #throwingMerger()
+     */
+    public static <T> BinaryOperator<T> lastWinsMerger() {
+        return (u,v) -> v;
+    }
+
+    /**
+     * Simple implementation class for {@code Collector}.
+     *
+     * @param <T> the type of elements to be collected
+     * @param <R> the type of the result
+     */
+    private static final class CollectorImpl<T, R> implements Collector<T,R> {
+        private final Supplier<R> resultSupplier;
+        private final BiFunction<R, T, R> accumulator;
+        private final BinaryOperator<R> combiner;
+        private final Set<Characteristics> characteristics;
+
+        CollectorImpl(Supplier<R> resultSupplier,
+                      BiFunction<R, T, R> accumulator,
+                      BinaryOperator<R> combiner,
+                      Set<Characteristics> characteristics) {
+            this.resultSupplier = resultSupplier;
+            this.accumulator = accumulator;
+            this.combiner = combiner;
+            this.characteristics = characteristics;
+        }
+
+        CollectorImpl(Supplier<R> resultSupplier,
+                      BiFunction<R, T, R> accumulator,
+                      BinaryOperator<R> combiner) {
+            this(resultSupplier, accumulator, combiner, Collections.emptySet());
+        }
+
+        @Override
+        public BiFunction<R, T, R> accumulator() {
+            return accumulator;
+        }
+
+        @Override
+        public Supplier<R> resultSupplier() {
+            return resultSupplier;
+        }
+
+        @Override
+        public BinaryOperator<R> combiner() {
+            return combiner;
+        }
+
+        @Override
+        public Set<Characteristics> characteristics() {
+            return characteristics;
+        }
+    }
+
+    /**
+     * Returns a {@code Collector} that accumulates the input elements into a
+     * new {@code Collection}, in encounter order.  The {@code Collection} is
+     * created by the provided factory.
+     *
+     * @param <T> the type of the input elements
+     * @param <C> the type of the resulting {@code Collection}
+     * @param collectionFactory a {@code Supplier} which returns a new, empty
+     * {@code Collection} of the appropriate type
+     * @return a {@code Collector} which collects all the input elements into a
+     * {@code Collection}, in encounter order
+     */
+    public static <T, C extends Collection<T>>
+    Collector<T, C> toCollection(Supplier<C> collectionFactory) {
+        return new CollectorImpl<>(collectionFactory,
+                                   (r, t) -> { r.add(t); return r; },
+                                   (r1, r2) -> { r1.addAll(r2); return r1; },
+                                   CH_STRICT);
+    }
+
+    /**
+     * Returns a {@code Collector} that accumulates the input elements into a
+     * new {@code List}. There are no guarantees on the type, mutability,
+     * serializability, or thread-safety of the {@code List} returned.
+     *
+     * @param <T> the type of the input elements
+     * @return a {@code Collector} which collects all the input elements into a
+     * {@code List}, in encounter order
+     */
+    public static <T>
+    Collector<T, List<T>> toList() {
+        BiFunction<List<T>, T, List<T>> accumulator = (list, t) -> {
+            switch (list.size()) {
+                case 0:
+                    return Collections.singletonList(t);
+                case 1:
+                    List<T> newList = new ArrayList<>();
+                    newList.add(list.get(0));
+                    newList.add(t);
+                    return newList;
+                default:
+                    list.add(t);
+                    return list;
+            }
+        };
+        BinaryOperator<List<T>> combiner = (left, right) -> {
+            switch (left.size()) {
+                case 0:
+                    return right;
+                case 1:
+                    List<T> newList = new ArrayList<>(left.size() + right.size());
+                    newList.addAll(left);
+                    newList.addAll(right);
+                    return newList;
+                default:
+                    left.addAll(right);
+                    return left;
+            }
+        };
+        return new CollectorImpl<>(Collections::emptyList, accumulator, combiner);
+    }
+
+    /**
+     * Returns a {@code Collector} that accumulates the input elements into a
+     * new {@code Set}. There are no guarantees on the type, mutability,
+     * serializability, or thread-safety of the {@code Set} returned.
+     *
+     * <p>This is an {@link Collector.Characteristics#UNORDERED unordered}
+     * Collector.
+     *
+     * @param <T> the type of the input elements
+     * @return a {@code Collector} which collects all the input elements into a
+     * {@code Set}
+     */
+    public static <T>
+    Collector<T, Set<T>> toSet() {
+        return new CollectorImpl<>((Supplier<Set<T>>) HashSet::new,
+                                   (r, t) -> { r.add(t); return r; },
+                                   (r1, r2) -> { r1.addAll(r2); return r1; },
+                                   CH_STRICT_UNORDERED);
+    }
+
+    /**
+     * Returns a {@code Collector} that concatenates the input elements into a
+     * new {@link StringBuilder}.
+     *
+     * @return a {@code Collector} which collects String elements into a
+     * {@code StringBuilder}, in encounter order
+     */
+    public static Collector<String, StringBuilder> toStringBuilder() {
+        return new CollectorImpl<>(StringBuilder::new,
+                                   (r, t) -> { r.append(t); return r; },
+                                   (r1, r2) -> { r1.append(r2); return r1; },
+                                   CH_STRICT);
+    }
+
+    /**
+     * Returns a {@code Collector} that concatenates the input elements into a
+     * new {@link StringJoiner}, using the specified delimiter.
+     *
+     * @param delimiter the delimiter to be used between each element
+     * @return A {@code Collector} which collects String elements into a
+     * {@code StringJoiner}, in encounter order
+     */
+    public static Collector<CharSequence, StringJoiner> toStringJoiner(CharSequence delimiter) {
+        BinaryOperator<StringJoiner> merger = (sj, other) -> {
+            if (other.length() > 0)
+                sj.add(other.toString());
+            return sj;
+        };
+        return new CollectorImpl<>(() -> new StringJoiner(delimiter),
+                                   (r, t) -> { r.add(t); return r; },
+                                   merger, CH_STRICT);
+    }
+
+    /**
+     * {@code BinaryOperator<Map>} that merges the contents of its right
+     * argument into its left argument, using the provided merge function to
+     * handle duplicate keys.
+     *
+     * @param <K> type of the map keys
+     * @param <V> type of the map values
+     * @param <M> type of the map
+     * @param mergeFunction A merge function suitable for
+     * {@link Map#merge(Object, Object, BiFunction) Map.merge()}
+     * @return a merge function for two maps
+     */
+    private static <K, V, M extends Map<K,V>>
+    BinaryOperator<M> mapMerger(BinaryOperator<V> mergeFunction) {
+        return (m1, m2) -> {
+            for (Map.Entry<K,V> e : m2.entrySet())
+                m1.merge(e.getKey(), e.getValue(), mergeFunction);
+            return m1;
+        };
+    }
+
+    /**
+     * Adapts a {@code Collector<U,R>} to a {@code Collector<T,R>} by applying
+     * a mapping function to each input element before accumulation.
+     *
+     * @apiNote
+     * The {@code mapping()} collectors are most useful when used in a
+     * multi-level reduction, downstream of {@code groupingBy} or
+     * {@code partitioningBy}.  For example, given a stream of
+     * {@code Person}, to accumulate the set of last names in each city:
+     * <pre>{@code
+     *     Map<City, Set<String>> lastNamesByCity
+     *         = people.stream().collect(groupingBy(Person::getCity,
+     *                                              mapping(Person::getLastName, toSet())));
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <U> type of elements accepted by downstream collector
+     * @param <R> result type of collector
+     * @param mapper a function to be applied to the input elements
+     * @param downstream a collector which will accept mapped values
+     * @return a collector which applies the mapping function to the input
+     * elements and provides the mapped results to the downstream collector
+     */
+    public static <T, U, R> Collector<T, R>
+    mapping(Function<? super T, ? extends U> mapper, Collector<? super U, R> downstream) {
+        BiFunction<R, ? super U, R> downstreamAccumulator = downstream.accumulator();
+        return new CollectorImpl<>(downstream.resultSupplier(),
+                                   (r, t) -> downstreamAccumulator.apply(r, mapper.apply(t)),
+                                   downstream.combiner(), downstream.characteristics());
+    }
+
+    /**
+     * Returns a {@code Collector<T, Long>} that counts the number of input
+     * elements.
+     *
+     * @implSpec
+     * This produces a result equivalent to:
+     * <pre>{@code
+     *     reducing(0L, e -> 1L, Long::sum)
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @return a {@code Collector} that counts the input elements
+     */
+    public static <T> Collector<T, Long>
+    counting() {
+        return reducing(0L, e -> 1L, Long::sum);
+    }
+
+    /**
+     * Returns a {@code Collector<T, T>} that produces the minimal element
+     * according to a given {@code Comparator}.
+     *
+     * @implSpec
+     * This produces a result equivalent to:
+     * <pre>{@code
+     *     reducing(Comparators.lesserOf(comparator))
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param comparator a {@code Comparator} for comparing elements
+     * @return a {@code Collector} that produces the minimal value
+     */
+    public static <T> Collector<T, T>
+    minBy(Comparator<? super T> comparator) {
+        return reducing(Comparators.lesserOf(comparator));
+    }
+
+    /**
+     * Returns a {@code Collector<T, T>} that produces the maximal element
+     * according to a given {@code Comparator}.
+     *
+     * @implSpec
+     * This produces a result equivalent to:
+     * <pre>{@code
+     *     reducing(Comparators.greaterOf(comparator))
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param comparator a {@code Comparator} for comparing elements
+     * @return a {@code Collector} that produces the maximal value
+     */
+    public static <T> Collector<T, T>
+    maxBy(Comparator<? super T> comparator) {
+        return reducing(Comparators.greaterOf(comparator));
+    }
+
+    /**
+     * Returns a {@code Collector<T, Long>} that produces the sum of a
+     * long-valued function applied to the input element.
+     *
+     * @implSpec
+     * This produces a result equivalent to:
+     * <pre>{@code
+     *     reducing(0L, mapper, Long::sum)
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param mapper a function extracting the property to be summed
+     * @return a {@code Collector} that produces the sum of a derived property
+     */
+    public static <T> Collector<T, Long>
+    sumBy(Function<? super T, Long> mapper) {
+        return reducing(0L, mapper, Long::sum);
+    }
+
+    /**
+     * Returns a {@code Collector<T,T>} which performs a reduction of its
+     * input elements under a specified {@code BinaryOperator}.
+     *
+     * @apiNote
+     * The {@code reducing()} collectors are most useful when used in a
+     * multi-level reduction, downstream of {@code groupingBy} or
+     * {@code partitioningBy}.  To perform a simple reduction on a stream,
+     * use {@link Stream#reduce(BinaryOperator)} instead.
+     *
+     * @param <T> element type for the input and output of the reduction
+     * @param identity the identity value for the reduction (also, the value
+     *                 that is returned when there are no input elements)
+     * @param op a {@code BinaryOperator<T>} used to reduce the input elements
+     * @return a {@code Collector} which implements the reduction operation
+     *
+     * @see #reducing(BinaryOperator)
+     * @see #reducing(Object, Function, BinaryOperator)
+     */
+    public static <T> Collector<T, T>
+    reducing(T identity, BinaryOperator<T> op) {
+        return new CollectorImpl<>(() -> identity, (r, t) -> (r == null ? t : op.apply(r, t)), op);
+    }
+
+    /**
+     * Returns a {@code Collector<T,T>} which performs a reduction of its
+     * input elements under a specified {@code BinaryOperator}.
+     *
+     * @apiNote
+     * The {@code reducing()} collectors are most useful when used in a
+     * multi-level reduction, downstream of {@code groupingBy} or
+     * {@code partitioningBy}.  To perform a simple reduction on a stream,
+     * use {@link Stream#reduce(BinaryOperator)} instead.
+     *
+     * <p>For example, given a stream of {@code Person}, to calculate tallest
+     * person in each city:
+     * <pre>{@code
+     *     Comparator<Person> byHeight = Comparators.comparing(Person::getHeight);
+     *     BinaryOperator<Person> tallerOf = Comparators.greaterOf(byHeight);
+     *     Map<City, Person> tallestByCity
+     *         = people.stream().collect(groupingBy(Person::getCity, reducing(tallerOf)));
+     * }</pre>
+     *
+     * @implSpec
+     * The default implementation is equivalent to:
+     * <pre>{@code
+     *     reducing(null, op);
+     * }</pre>
+     *
+     * @param <T> element type for the input and output of the reduction
+     * @param op a {@code BinaryOperator<T>} used to reduce the input elements
+     * @return a {@code Collector} which implements the reduction operation
+     *
+     * @see #reducing(Object, BinaryOperator)
+     * @see #reducing(Object, Function, BinaryOperator)
+     */
+    public static <T> Collector<T, T>
+    reducing(BinaryOperator<T> op) {
+        return reducing(null, op);
+    }
+
+    /**
+     * Returns a {@code Collector<T,U>} which performs a reduction of its
+     * input elements under a specified mapping function and
+     * {@code BinaryOperator}. This is a generalization of
+     * {@link #reducing(Object, BinaryOperator)} which allows a transformation
+     * of the elements before reduction.
+     *
+     * @apiNote
+     * The {@code reducing()} collectors are most useful when used in a
+     * multi-level reduction, downstream of {@code groupingBy} or
+     * {@code partitioningBy}.  To perform a simple reduction on a stream,
+     * use {@link Stream#reduce(BinaryOperator)} instead.
+     *
+     * <p>For example, given a stream of {@code Person}, to calculate the longest
+     * last name of residents in each city:
+     * <pre>{@code
+     *     Comparator<String> byLength = Comparators.comparing(String::length);
+     *     BinaryOperator<String> longerOf = Comparators.greaterOf(byLength);
+     *     Map<City, String> longestLastNameByCity
+     *         = people.stream().collect(groupingBy(Person::getCity,
+     *                                              reducing(Person::getLastName, longerOf)));
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <U> the type of the mapped values
+     * @param identity the identity value for the reduction (also, the value
+     *                 that is returned when there are no input elements)
+     * @param mapper a mapping function to apply to each input value
+     * @param op a {@code BinaryOperator<U>} used to reduce the mapped values
+     * @return a {@code Collector} implementing the map-reduce operation
+     *
+     * @see #reducing(Object, BinaryOperator)
+     * @see #reducing(BinaryOperator)
+     */
+    public static <T, U>
+    Collector<T, U> reducing(U identity,
+                             Function<? super T, ? extends U> mapper,
+                             BinaryOperator<U> op) {
+        return new CollectorImpl<>(() -> identity,
+                                   (r, t) -> (r == null ? mapper.apply(t) : op.apply(r, mapper.apply(t))),
+                                   op);
+    }
+
+    /**
+     * Returns a {@code Collector} implementing a "group by" operation on
+     * input elements of type {@code T}, grouping elements according to a
+     * classification function.
+     *
+     * <p>The classification function maps elements to some key type {@code K}.
+     * The collector produces a {@code Map<K, List<T>>} whose keys are the
+     * values resulting from applying the classification function to the input
+     * elements, and whose corresponding values are {@code List}s containing the
+     * input elements which map to the associated key under the classification
+     * function.
+     *
+     * <p>There are no guarantees on the type, mutability, serializability, or
+     * thread-safety of the {@code Map} or {@code List} objects returned.
+     * @implSpec
+     * This produces a result similar to:
+     * <pre>{@code
+     *     groupingBy(classifier, toList());
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the type of the keys
+     * @param classifier the classifier function mapping input elements to keys
+     * @return a {@code Collector} implementing the group-by operation
+     *
+     * @see #groupingBy(Function, Collector)
+     * @see #groupingBy(Function, Supplier, Collector)
+     * @see #groupingByConcurrent(Function)
+     */
+    public static <T, K>
+    Collector<T, Map<K, List<T>>> groupingBy(Function<? super T, ? extends K> classifier) {
+        return groupingBy(classifier, HashMap::new, toList());
+    }
+
+    /**
+     * Returns a {@code Collector} implementing a cascaded "group by" operation
+     * on input elements of type {@code T}, grouping elements according to a
+     * classification function, and then performing a reduction operation on
+     * the values associated with a given key using the specified downstream
+     * {@code Collector}.
+     *
+     * <p>The classification function maps elements to some key type {@code K}.
+     * The downstream collector operates on elements of type {@code T} and
+     * produces a result of type {@code D}. The resulting collector produces a
+     * {@code Map<K, D>}.
+     *
+     * <p>There are no guarantees on the type, mutability,
+     * serializability, or thread-safety of the {@code Map} returned.
+     *
+     * <p>For example, to compute the set of last names of people in each city:
+     * <pre>{@code
+     *     Map<City, Set<String>> namesByCity
+     *         = people.stream().collect(groupingBy(Person::getCity,
+     *                                              mapping(Person::getLastName, toSet())));
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the type of the keys
+     * @param <D> the result type of the downstream reduction
+     * @param classifier a classifier function mapping input elements to keys
+     * @param downstream a {@code Collector} implementing the downstream reduction
+     * @return a {@code Collector} implementing the cascaded group-by operation
+     * @see #groupingBy(Function)
+     *
+     * @see #groupingBy(Function, Supplier, Collector)
+     * @see #groupingByConcurrent(Function, Collector)
+     */
+    public static <T, K, D>
+    Collector<T, Map<K, D>> groupingBy(Function<? super T, ? extends K> classifier,
+                                       Collector<? super T, D> downstream) {
+        return groupingBy(classifier, HashMap::new, downstream);
+    }
+
+    /**
+     * Returns a {@code Collector} implementing a cascaded "group by" operation
+     * on input elements of type {@code T}, grouping elements according to a
+     * classification function, and then performing a reduction operation on
+     * the values associated with a given key using the specified downstream
+     * {@code Collector}.  The {@code Map} produced by the Collector is created
+     * with the supplied factory function.
+     *
+     * <p>The classification function maps elements to some key type {@code K}.
+     * The downstream collector operates on elements of type {@code T} and
+     * produces a result of type {@code D}. The resulting collector produces a
+     * {@code Map<K, D>}.
+     *
+     * <p>For example, to compute the set of last names of people in each city,
+     * where the city names are sorted:
+     * <pre>{@code
+     *     Map<City, Set<String>> namesByCity
+     *         = people.stream().collect(groupingBy(Person::getCity, TreeMap::new,
+     *                                              mapping(Person::getLastName, toSet())));
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the type of the keys
+     * @param <D> the result type of the downstream reduction
+     * @param <M> the type of the resulting {@code Map}
+     * @param classifier a classifier function mapping input elements to keys
+     * @param downstream a {@code Collector} implementing the downstream reduction
+     * @param mapFactory a function which, when called, produces a new empty
+     *                   {@code Map} of the desired type
+     * @return a {@code Collector} implementing the cascaded group-by operation
+     *
+     * @see #groupingBy(Function, Collector)
+     * @see #groupingBy(Function)
+     * @see #groupingByConcurrent(Function, Supplier, Collector)
+     */
+    public static <T, K, D, M extends Map<K, D>>
+    Collector<T, M> groupingBy(Function<? super T, ? extends K> classifier,
+                               Supplier<M> mapFactory,
+                               Collector<? super T, D> downstream) {
+        Supplier<D> downstreamSupplier = downstream.resultSupplier();
+        BiFunction<D, ? super T, D> downstreamAccumulator = downstream.accumulator();
+        BiFunction<M, T, M> accumulator = (m, t) -> {
+            K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
+            D oldContainer = m.computeIfAbsent(key, k -> downstreamSupplier.get());
+            D newContainer = downstreamAccumulator.apply(oldContainer, t);
+            if (newContainer != oldContainer)
+                m.put(key, newContainer);
+            return m;
+        };
+        return new CollectorImpl<>(mapFactory, accumulator, mapMerger(downstream.combiner()), CH_STRICT);
+    }
+
+    /**
+     * Returns a {@code Collector} implementing a concurrent "group by"
+     * operation on input elements of type {@code T}, grouping elements
+     * according to a classification function.
+     *
+     * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+     * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+     *
+     * <p>The classification function maps elements to some key type {@code K}.
+     * The collector produces a {@code ConcurrentMap<K, List<T>>} whose keys are the
+     * values resulting from applying the classification function to the input
+     * elements, and whose corresponding values are {@code List}s containing the
+     * input elements which map to the associated key under the classification
+     * function.
+     *
+     * <p>There are no guarantees on the type, mutability, or serializability
+     * of the {@code Map} or {@code List} objects returned, or of the
+     * thread-safety of the {@code List} objects returned.
+     * @implSpec
+     * This produces a result similar to:
+     * <pre>{@code
+     *     groupingByConcurrent(classifier, toList());
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the type of the keys
+     * @param classifier a classifier function mapping input elements to keys
+     * @return a {@code Collector} implementing the group-by operation
+     *
+     * @see #groupingBy(Function)
+     * @see #groupingByConcurrent(Function, Collector)
+     * @see #groupingByConcurrent(Function, Supplier, Collector)
+     */
+    public static <T, K>
+    Collector<T, ConcurrentMap<K, List<T>>> groupingByConcurrent(Function<? super T, ? extends K> classifier) {
+        return groupingByConcurrent(classifier, ConcurrentHashMap::new, toList());
+    }
+
+    /**
+     * Returns a {@code Collector} implementing a concurrent cascaded "group by"
+     * operation on input elements of type {@code T}, grouping elements
+     * according to a classification function, and then performing a reduction
+     * operation on the values associated with a given key using the specified
+     * downstream {@code Collector}.
+     *
+     * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+     * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+     *
+     * <p>The classification function maps elements to some key type {@code K}.
+     * The downstream collector operates on elements of type {@code T} and
+     * produces a result of type {@code D}. The resulting collector produces a
+     * {@code Map<K, D>}.
+     *
+     * <p>For example, to compute the set of last names of people in each city,
+     * where the city names are sorted:
+     * <pre>{@code
+     *     ConcurrentMap<City, Set<String>> namesByCity
+     *         = people.stream().collect(groupingByConcurrent(Person::getCity, TreeMap::new,
+     *                                                        mapping(Person::getLastName, toSet())));
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the type of the keys
+     * @param <D> the result type of the downstream reduction
+     * @param classifier a classifier function mapping input elements to keys
+     * @param downstream a {@code Collector} implementing the downstream reduction
+     * @return a {@code Collector} implementing the cascaded group-by operation
+     *
+     * @see #groupingBy(Function, Collector)
+     * @see #groupingByConcurrent(Function)
+     * @see #groupingByConcurrent(Function, Supplier, Collector)
+     */
+    public static <T, K, D>
+    Collector<T, ConcurrentMap<K, D>> groupingByConcurrent(Function<? super T, ? extends K> classifier,
+                                                           Collector<? super T, D> downstream) {
+        return groupingByConcurrent(classifier, ConcurrentHashMap::new, downstream);
+    }
+
+    /**
+     * Returns a concurrent {@code Collector} implementing a cascaded "group by"
+     * operation on input elements of type {@code T}, grouping elements
+     * according to a classification function, and then performing a reduction
+     * operation on the values associated with a given key using the specified
+     * downstream {@code Collector}.  The {@code ConcurrentMap} produced by the
+     * Collector is created with the supplied factory function.
+     *
+     * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+     * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+     *
+     * <p>The classification function maps elements to some key type {@code K}.
+     * The downstream collector operates on elements of type {@code T} and
+     * produces a result of type {@code D}. The resulting collector produces a
+     * {@code Map<K, D>}.
+     *
+     * <p>For example, to compute the set of last names of people in each city,
+     * where the city names are sorted:
+     * <pre>{@code
+     *     ConcurrentMap<City, Set<String>> namesByCity
+     *         = people.stream().collect(groupingBy(Person::getCity, ConcurrentSkipListMap::new,
+     *                                              mapping(Person::getLastName, toSet())));
+     * }</pre>
+     *
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the type of the keys
+     * @param <D> the result type of the downstream reduction
+     * @param <M> the type of the resulting {@code ConcurrentMap}
+     * @param classifier a classifier function mapping input elements to keys
+     * @param downstream a {@code Collector} implementing the downstream reduction
+     * @param mapFactory a function which, when called, produces a new empty
+     *                   {@code ConcurrentMap} of the desired type
+     * @return a {@code Collector} implementing the cascaded group-by operation
+     *
+     * @see #groupingByConcurrent(Function)
+     * @see #groupingByConcurrent(Function, Collector)
+     * @see #groupingBy(Function, Supplier, Collector)
+     */
+    public static <T, K, D, M extends ConcurrentMap<K, D>>
+    Collector<T, M> groupingByConcurrent(Function<? super T, ? extends K> classifier,
+                                         Supplier<M> mapFactory,
+                                         Collector<? super T, D> downstream) {
+        Supplier<D> downstreamSupplier = downstream.resultSupplier();
+        BiFunction<D, ? super T, D> downstreamAccumulator = downstream.accumulator();
+        BinaryOperator<M> combiner = mapMerger(downstream.combiner());
+        if (downstream.characteristics().contains(Collector.Characteristics.CONCURRENT)) {
+            BiFunction<M, T, M> accumulator = (m, t) -> {
+                K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
+                downstreamAccumulator.apply(m.computeIfAbsent(key, k -> downstreamSupplier.get()), t);
+                return m;
+            };
+            return new CollectorImpl<>(mapFactory, accumulator, combiner, CH_CONCURRENT);
+        } else if (downstream.characteristics().contains(Collector.Characteristics.STRICTLY_MUTATIVE)) {
+            BiFunction<M, T, M> accumulator = (m, t) -> {
+                K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
+                D resultContainer = m.computeIfAbsent(key, k -> downstreamSupplier.get());
+                synchronized (resultContainer) {
+                    downstreamAccumulator.apply(resultContainer, t);
+                }
+                return m;
+            };
+            return new CollectorImpl<>(mapFactory, accumulator, combiner, CH_CONCURRENT);
+        } else {
+            BiFunction<M, T, M> accumulator = (m, t) -> {
+                K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
+                do {
+                    D oldResult = m.computeIfAbsent(key, k -> downstreamSupplier.get());
+                    if (oldResult == null) {
+                        if (m.putIfAbsent(key, downstreamAccumulator.apply(null, t)) == null)
+                            return m;
+                    } else {
+                        synchronized (oldResult) {
+                            if (m.get(key) != oldResult)
+                                continue;
+                            D newResult = downstreamAccumulator.apply(oldResult, t);
+                            if (oldResult != newResult)
+                                m.put(key, newResult);
+                            return m;
+                        }
+                    }
+                } while (true);
+            };
+            return new CollectorImpl<>(mapFactory, accumulator, combiner, CH_CONCURRENT);
+        }
+    }
+
+    /**
+     * Returns a {@code Collector} which partitions the input elements according
+     * to a {@code Predicate}, and organizes them into a
+     * {@code Map<Boolean, List<T>>}.
+     *
+     * There are no guarantees on the type, mutability,
+     * serializability, or thread-safety of the {@code Map} returned.
+     *
+     * @param <T> the type of the input elements
+     * @param predicate a predicate used for classifying input elements
+     * @return a {@code Collector} implementing the partitioning operation
+     *
+     * @see #partitioningBy(Predicate, Collector)
+     */
+    public static <T>
+    Collector<T, Map<Boolean, List<T>>> partitioningBy(Predicate<? super T> predicate) {
+        return partitioningBy(predicate, toList());
+    }
+
+    /**
+     * Returns a {@code Collector} which partitions the input elements according
+     * to a {@code Predicate}, reduces the values in each partition according to
+     * another {@code Collector}, and organizes them into a
+     * {@code Map<Boolean, D>} whose values are the result of the downstream
+     * reduction.
+     *
+     * <p>There are no guarantees on the type, mutability,
+     * serializability, or thread-safety of the {@code Map} returned.
+     *
+     * @param <T> the type of the input elements
+     * @param <D> the result type of the downstream reduction
+     * @param predicate a predicate used for classifying input elements
+     * @param downstream a {@code Collector} implementing the downstream
+     *                   reduction
+     * @return a {@code Collector} implementing the cascaded partitioning
+     *         operation
+     *
+     * @see #partitioningBy(Predicate)
+     */
+    public static <T, D>
+    Collector<T, Map<Boolean, D>> partitioningBy(Predicate<? super T> predicate,
+                                                 Collector<? super T, D> downstream) {
+        BiFunction<D, ? super T, D> downstreamAccumulator = downstream.accumulator();
+        BiFunction<Map<Boolean, D>, T, Map<Boolean, D>> accumulator = (result, t) -> {
+            Partition<D> asPartition = ((Partition<D>) result);
+            if (predicate.test(t)) {
+                D newResult = downstreamAccumulator.apply(asPartition.forTrue, t);
+                if (newResult != asPartition.forTrue)
+                    asPartition.forTrue = newResult;
+            } else {
+                D newResult = downstreamAccumulator.apply(asPartition.forFalse, t);
+                if (newResult != asPartition.forFalse)
+                    asPartition.forFalse = newResult;
+            }
+            return result;
+        };
+        return new CollectorImpl<>(() -> new Partition<>(downstream.resultSupplier().get(),
+                                                         downstream.resultSupplier().get()),
+                                   accumulator, partitionMerger(downstream.combiner()), CH_STRICT);
+    }
+
+    /**
+     * Merge function for two partitions, given a merge function for the
+     * elements.
+     */
+    private static <D> BinaryOperator<Map<Boolean, D>> partitionMerger(BinaryOperator<D> op) {
+        return (m1, m2) -> {
+            Partition<D> left = (Partition<D>) m1;
+            Partition<D> right = (Partition<D>) m2;
+            if (left.forFalse == null)
+                left.forFalse = right.forFalse;
+            else if (right.forFalse != null)
+                left.forFalse = op.apply(left.forFalse, right.forFalse);
+            if (left.forTrue == null)
+                left.forTrue = right.forTrue;
+            else if (right.forTrue != null)
+                left.forTrue = op.apply(left.forTrue, right.forTrue);
+            return left;
+        };
+    }
+
+    /**
+     * Accumulate elements into a {@code Map} whose keys and values are the
+     * result of applying mapping functions to the input elements.
+     * If the mapped keys contains duplicates (according to
+     * {@link Object#equals(Object)}), an {@code IllegalStateException} is
+     * thrown when the collection operation is performed.  If the mapped keys
+     * may have duplicates, use {@link #toMap(Function, Function, BinaryOperator)}
+     * instead.
+     *
+     * @apiNote
+     * It is common for either the key or the value to be the input elements.
+     * In this case, the utility method
+     * {@link java.util.function.Function#identity()} may be helpful.
+     * For example, the following produces a {@code Map} mapping
+     * students to their grade point average:
+     * <pre>{@code
+     *     Map<Student, Double> studentToGPA
+     *         students.stream().collect(toMap(Functions.identity(),
+     *                                         student -> computeGPA(student)));
+     * }</pre>
+     * And the following produces a {@code Map} mapping a unique identifier to
+     * students:
+     * <pre>{@code
+     *     Map<String, Student> studentIdToStudent
+     *         students.stream().collect(toMap(Student::getId,
+     *                                         Functions.identity());
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the output type of the key mapping function
+     * @param <U> the output type of the value mapping function
+     * @param keyMapper a mapping function to produce keys
+     * @param valueMapper a mapping function to produce values
+     * @return a {@code Collector} which collects elements into a {@code Map}
+     * whose keys and values are the result of applying mapping functions to
+     * the input elements
+     *
+     * @see #toMap(Function, Function, BinaryOperator)
+     * @see #toMap(Function, Function, BinaryOperator, Supplier)
+     * @see #toConcurrentMap(Function, Function)
+     */
+    public static <T, K, U>
+    Collector<T, Map<K,U>> toMap(Function<? super T, ? extends K> keyMapper,
+                                 Function<? super T, ? extends U> valueMapper) {
+        return toMap(keyMapper, valueMapper, throwingMerger(), HashMap::new);
+    }
+
+    /**
+     * Accumulate elements into a {@code Map} whose keys and values are the
+     * result of applying mapping functions to the input elements. If the mapped
+     * keys contains duplicates (according to {@link Object#equals(Object)}),
+     * the value mapping function is applied to each equal element, and the
+     * results are merged using the provided merging function.
+     *
+     * @apiNote
+     * There are multiple ways to deal with collisions between multiple elements
+     * mapping to the same key.  There are some predefined merging functions,
+     * such as {@link #throwingMerger()}, {@link #firstWinsMerger()}, and
+     * {@link #lastWinsMerger()}, that implement common policies, or you can
+     * implement custom policies easily.  For example, if you have a stream
+     * of {@code Person}, and you want to produce a "phone book" mapping name to
+     * address, but it is possible that two persons have the same name, you can
+     * do as follows to gracefully deals with these collisions, and produce a
+     * {@code Map} mapping names to a concatenated list of addresses:
+     * <pre>{@code
+     *     Map<String, String> phoneBook
+     *         people.stream().collect(toMap(Person::getName,
+     *                                       Person::getAddress,
+     *                                       (s, a) -> s + ", " + a));
+     * }</pre>
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the output type of the key mapping function
+     * @param <U> the output type of the value mapping function
+     * @param keyMapper a mapping function to produce keys
+     * @param valueMapper a mapping function to produce values
+     * @param mergeFunction a merge function, used to resolve collisions between
+     *                      values associated with the same key, as supplied
+     *                      to {@link Map#merge(Object, Object, BiFunction)}
+     * @return a {@code Collector} which collects elements into a {@code Map}
+     * whose keys are the result of applying a key mapping function to the input
+     * elements, and whose values are the result of applying a value mapping
+     * function to all input elements equal to the key and combining them
+     * using the merge function
+     *
+     * @see #toMap(Function, Function)
+     * @see #toMap(Function, Function, BinaryOperator, Supplier)
+     * @see #toConcurrentMap(Function, Function, BinaryOperator)
+     */
+    public static <T, K, U>
+    Collector<T, Map<K,U>> toMap(Function<? super T, ? extends K> keyMapper,
+                                 Function<? super T, ? extends U> valueMapper,
+                                 BinaryOperator<U> mergeFunction) {
+        return toMap(keyMapper, valueMapper, mergeFunction, HashMap::new);
+    }
+
+    /**
+     * Accumulate elements into a {@code Map} whose keys and values are the
+     * result of applying mapping functions to the input elements. If the mapped
+     * keys contains duplicates (according to {@link Object#equals(Object)}),
+     * the value mapping function is applied to each equal element, and the
+     * results are merged using the provided merging function.  The {@code Map}
+     * is created by a provided supplier function.
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the output type of the key mapping function
+     * @param <U> the output type of the value mapping function
+     * @param <M> the type of the resulting {@code Map}
+     * @param keyMapper a mapping function to produce keys
+     * @param valueMapper a mapping function to produce values
+     * @param mergeFunction a merge function, used to resolve collisions between
+     *                      values associated with the same key, as supplied
+     *                      to {@link Map#merge(Object, Object, BiFunction)}
+     * @param mapSupplier a function which returns a new, empty {@code Map} into
+     *                    which the results will be inserted
+     * @return a {@code Collector} which collects elements into a {@code Map}
+     * whose keys are the result of applying a key mapping function to the input
+     * elements, and whose values are the result of applying a value mapping
+     * function to all input elements equal to the key and combining them
+     * using the merge function
+     *
+     * @see #toMap(Function, Function)
+     * @see #toMap(Function, Function, BinaryOperator)
+     * @see #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
+     */
+    public static <T, K, U, M extends Map<K, U>>
+    Collector<T, M> toMap(Function<? super T, ? extends K> keyMapper,
+                          Function<? super T, ? extends U> valueMapper,
+                          BinaryOperator<U> mergeFunction,
+                          Supplier<M> mapSupplier) {
+        BiFunction<M, T, M> accumulator
+                = (map, element) -> {
+                      map.merge(keyMapper.apply(element), valueMapper.apply(element), mergeFunction);
+                      return map;
+                  };
+        return new CollectorImpl<>(mapSupplier, accumulator, mapMerger(mergeFunction), CH_STRICT);
+    }
+
+    /**
+     * Accumulate elements into a {@code ConcurrentMap} whose keys and values
+     * are the result of applying mapping functions to the input elements.
+     * If the mapped keys contains duplicates (according to
+     * {@link Object#equals(Object)}), an {@code IllegalStateException} is
+     * thrown when the collection operation is performed.  If the mapped keys
+     * may have duplicates, use
+     * {@link #toConcurrentMap(Function, Function, BinaryOperator)} instead.
+     *
+     * @apiNote
+     * It is common for either the key or the value to be the input elements.
+     * In this case, the utility method
+     * {@link java.util.function.Function#identity()} may be helpful.
+     * For example, the following produces a {@code Map} mapping
+     * students to their grade point average:
+     * <pre>{@code
+     *     Map<Student, Double> studentToGPA
+     *         students.stream().collect(toMap(Functions.identity(),
+     *                                         student -> computeGPA(student)));
+     * }</pre>
+     * And the following produces a {@code Map} mapping a unique identifier to
+     * students:
+     * <pre>{@code
+     *     Map<String, Student> studentIdToStudent
+     *         students.stream().collect(toConcurrentMap(Student::getId,
+     *                                                   Functions.identity());
+     * }</pre>
+     *
+     * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+     * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the output type of the key mapping function
+     * @param <U> the output type of the value mapping function
+     * @param keyMapper the mapping function to produce keys
+     * @param valueMapper the mapping function to produce values
+     * @return a concurrent {@code Collector} which collects elements into a
+     * {@code ConcurrentMap} whose keys are the result of applying a key mapping
+     * function to the input elements, and whose values are the result of
+     * applying a value mapping function to the input elements
+     *
+     * @see #toMap(Function, Function)
+     * @see #toConcurrentMap(Function, Function, BinaryOperator)
+     * @see #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
+     */
+    public static <T, K, U>
+    Collector<T, ConcurrentMap<K,U>> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
+                                                     Function<? super T, ? extends U> valueMapper) {
+        return toConcurrentMap(keyMapper, valueMapper, throwingMerger(), ConcurrentHashMap::new);
+    }
+
+    /**
+     * Accumulate elements into a {@code ConcurrentMap} whose keys and values
+     * are the result of applying mapping functions to the input elements. If
+     * the mapped keys contains duplicates (according to {@link Object#equals(Object)}),
+     * the value mapping function is applied to each equal element, and the
+     * results are merged using the provided merging function.
+     *
+     * @apiNote
+     * There are multiple ways to deal with collisions between multiple elements
+     * mapping to the same key.  There are some predefined merging functions,
+     * such as {@link #throwingMerger()}, {@link #firstWinsMerger()}, and
+     * {@link #lastWinsMerger()}, that implement common policies, or you can
+     * implement custom policies easily.  For example, if you have a stream
+     * of {@code Person}, and you want to produce a "phone book" mapping name to
+     * address, but it is possible that two persons have the same name, you can
+     * do as follows to gracefully deals with these collisions, and produce a
+     * {@code Map} mapping names to a concatenated list of addresses:
+     * <pre>{@code
+     *     Map<String, String> phoneBook
+     *         people.stream().collect(toConcurrentMap(Person::getName,
+     *                                                 Person::getAddress,
+     *                                                 (s, a) -> s + ", " + a));
+     * }</pre>
+     *
+     * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+     * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the output type of the key mapping function
+     * @param <U> the output type of the value mapping function
+     * @param keyMapper a mapping function to produce keys
+     * @param valueMapper a mapping function to produce values
+     * @param mergeFunction a merge function, used to resolve collisions between
+     *                      values associated with the same key, as supplied
+     *                      to {@link Map#merge(Object, Object, BiFunction)}
+     * @return a concurrent {@code Collector} which collects elements into a
+     * {@code ConcurrentMap} whose keys are the result of applying a key mapping
+     * function to the input elements, and whose values are the result of
+     * applying a value mapping function to all input elements equal to the key
+     * and combining them using the merge function
+     *
+     * @see #toConcurrentMap(Function, Function)
+     * @see #toConcurrentMap(Function, Function, BinaryOperator, Supplier)
+     * @see #toMap(Function, Function, BinaryOperator)
+     */
+    public static <T, K, U>
+    Collector<T, ConcurrentMap<K,U>> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
+                                                     Function<? super T, ? extends U> valueMapper,
+                                                     BinaryOperator<U> mergeFunction) {
+        return toConcurrentMap(keyMapper, valueMapper, mergeFunction, ConcurrentHashMap::new);
+    }
+
+    /**
+     * Accumulate elements into a {@code ConcurrentMap} whose keys and values
+     * are the result of applying mapping functions to the input elements. If
+     * the mapped keys contains duplicates (according to {@link Object#equals(Object)}),
+     * the value mapping function is applied to each equal element, and the
+     * results are merged using the provided merging function.  The
+     * {@code ConcurrentMap} is created by a provided supplier function.
+     *
+     * <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
+     * {@link Collector.Characteristics#UNORDERED unordered} Collector.
+     *
+     * @param <T> the type of the input elements
+     * @param <K> the output type of the key mapping function
+     * @param <U> the output type of the value mapping function
+     * @param <M> the type of the resulting {@code ConcurrentMap}
+     * @param keyMapper a mapping function to produce keys
+     * @param valueMapper a mapping function to produce values
+     * @param mergeFunction a merge function, used to resolve collisions between
+     *                      values associated with the same key, as supplied
+     *                      to {@link Map#merge(Object, Object, BiFunction)}
+     * @param mapSupplier a function which returns a new, empty {@code Map} into
+     *                    which the results will be inserted
+     * @return a concurrent {@code Collector} which collects elements into a
+     * {@code ConcurrentMap} whose keys are the result of applying a key mapping
+     * function to the input elements, and whose values are the result of
+     * applying a value mapping function to all input elements equal to the key
+     * and combining them using the merge function
+     *
+     * @see #toConcurrentMap(Function, Function)
+     * @see #toConcurrentMap(Function, Function, BinaryOperator)
+     * @see #toMap(Function, Function, BinaryOperator, Supplier)
+     */
+    public static <T, K, U, M extends ConcurrentMap<K, U>>
+    Collector<T, M> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
+                                    Function<? super T, ? extends U> valueMapper,
+                                    BinaryOperator<U> mergeFunction,
+                                    Supplier<M> mapSupplier) {
+        BiFunction<M, T, M> accumulator = (map, element) -> {
+            map.merge(keyMapper.apply(element), valueMapper.apply(element), mergeFunction);
+            return map;
+        };
+        return new CollectorImpl<>(mapSupplier, accumulator, mapMerger(mergeFunction), CH_CONCURRENT);
+    }
+
+    /**
+     * Returns a {@code Collector} which applies an {@code int}-producing
+     * mapping function to each input element, and returns summary statistics
+     * for the resulting values.
+     *
+     * @param <T> the type of the input elements
+     * @param mapper a mapping function to apply to each element
+     * @return a {@code Collector} implementing the summary-statistics reduction
+     *
+     * @see #toDoubleSummaryStatistics(ToDoubleFunction)
+     * @see #toLongSummaryStatistics(ToLongFunction)
+     */
+    public static <T>
+    Collector<T, IntSummaryStatistics> toIntSummaryStatistics(ToIntFunction<? super T> mapper) {
+        return new CollectorImpl<>(IntSummaryStatistics::new,
+                                   (r, t) -> { r.accept(mapper.applyAsInt(t)); return r; },
+                                   (l, r) -> { l.combine(r); return l; }, CH_STRICT);
+    }
+
+    /**
+     * Returns a {@code Collector} which applies an {@code long}-producing
+     * mapping function to each input element, and returns summary statistics
+     * for the resulting values.
+     *
+     * @param <T> the type of the input elements
+     * @param mapper the mapping function to apply to each element
+     * @return a {@code Collector} implementing the summary-statistics reduction
+     *
+     * @see #toDoubleSummaryStatistics(ToDoubleFunction)
+     * @see #toIntSummaryStatistics(ToIntFunction)
+     */
+    public static <T>
+    Collector<T, LongSummaryStatistics> toLongSummaryStatistics(ToLongFunction<? super T> mapper) {
+        return new CollectorImpl<>(LongSummaryStatistics::new,
+                                   (r, t) -> { r.accept(mapper.applyAsLong(t)); return r; },
+                                   (l, r) -> { l.combine(r); return l; }, CH_STRICT);
+    }
+
+    /**
+     * Returns a {@code Collector} which applies an {@code double}-producing
+     * mapping function to each input element, and returns summary statistics
+     * for the resulting values.
+     *
+     * @param <T> the type of the input elements
+     * @param mapper a mapping function to apply to each element
+     * @return a {@code Collector} implementing the summary-statistics reduction
+     *
+     * @see #toLongSummaryStatistics(ToLongFunction)
+     * @see #toIntSummaryStatistics(ToIntFunction)
+     */
+    public static <T>
+    Collector<T, DoubleSummaryStatistics> toDoubleSummaryStatistics(ToDoubleFunction<? super T> mapper) {
+        return new CollectorImpl<>(DoubleSummaryStatistics::new,
+                                   (r, t) -> { r.accept(mapper.applyAsDouble(t)); return r; },
+                                   (l, r) -> { l.combine(r); return l; }, CH_STRICT);
+    }
+
+    /**
+     * Implementation class used by partitioningBy.
+     */
+    private static final class Partition<T>
+            extends AbstractMap<Boolean, T>
+            implements Map<Boolean, T> {
+        T forTrue;
+        T forFalse;
+
+        Partition(T forTrue, T forFalse) {
+            this.forTrue = forTrue;
+            this.forFalse = forFalse;
+        }
+
+        @Override
+        public Set<Map.Entry<Boolean, T>> entrySet() {
+            return new AbstractSet<Map.Entry<Boolean, T>>() {
+                @Override
+                public Iterator<Map.Entry<Boolean, T>> iterator() {
+
+                    return new Iterator<Map.Entry<Boolean, T>>() {
+                        int state = 0;
+
+                        @Override
+                        public boolean hasNext() {
+                            return state < 2;
+                        }
+
+                        @Override
+                        public Map.Entry<Boolean, T> next() {
+                            if (state >= 2)
+                                throw new NoSuchElementException();
+                            return (state++ == 0)
+                                   ? new SimpleImmutableEntry<>(false, forFalse)
+                                   : new SimpleImmutableEntry<>(true, forTrue);
+                        }
+                    };
+                }
+
+                @Override
+                public int size() {
+                    return 2;
+                }
+            };
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/DelegatingStream.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Spliterator;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.IntFunction;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+
+/**
+ * A {@code Stream} implementation that delegates operations to another {@code
+ * Stream}.
+ *
+ * @param <T> type of stream elements for this stream and underlying delegate
+ * stream
+ *
+ * @since 1.8
+ */
+public class DelegatingStream<T> implements Stream<T> {
+    final private Stream<T> delegate;
+
+    /**
+     * Construct a {@code Stream} that delegates operations to another {@code
+     * Stream}.
+     *
+     * @param delegate the underlying {@link Stream} to which we delegate all
+     *                 {@code Stream} methods
+     * @throws NullPointerException if the delegate is null
+     */
+    public DelegatingStream(Stream<T> delegate) {
+        this.delegate = Objects.requireNonNull(delegate);
+    }
+
+    // -- BaseStream methods --
+
+    @Override
+    public Spliterator<T> spliterator() {
+        return delegate.spliterator();
+    }
+
+    @Override
+    public boolean isParallel() {
+        return delegate.isParallel();
+    }
+
+    @Override
+    public Iterator<T> iterator() {
+        return delegate.iterator();
+    }
+
+    // -- Stream methods --
+
+    @Override
+    public Stream<T> filter(Predicate<? super T> predicate) {
+        return delegate.filter(predicate);
+    }
+
+    @Override
+    public <R> Stream<R> map(Function<? super T, ? extends R> mapper) {
+        return delegate.map(mapper);
+    }
+
+    @Override
+    public IntStream mapToInt(ToIntFunction<? super T> mapper) {
+        return delegate.mapToInt(mapper);
+    }
+
+    @Override
+    public LongStream mapToLong(ToLongFunction<? super T> mapper) {
+        return delegate.mapToLong(mapper);
+    }
+
+    @Override
+    public DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper) {
+        return delegate.mapToDouble(mapper);
+    }
+
+    @Override
+    public <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper) {
+        return delegate.flatMap(mapper);
+    }
+
+    @Override
+    public IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper) {
+        return delegate.flatMapToInt(mapper);
+    }
+
+    @Override
+    public LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper) {
+        return delegate.flatMapToLong(mapper);
+    }
+
+    @Override
+    public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) {
+        return delegate.flatMapToDouble(mapper);
+    }
+
+    @Override
+    public Stream<T> distinct() {
+        return delegate.distinct();
+    }
+
+    @Override
+    public Stream<T> sorted() {
+        return delegate.sorted();
+    }
+
+    @Override
+    public Stream<T> sorted(Comparator<? super T> comparator) {
+        return delegate.sorted(comparator);
+    }
+
+    @Override
+    public void forEach(Consumer<? super T> action) {
+        delegate.forEach(action);
+    }
+
+    @Override
+    public void forEachOrdered(Consumer<? super T> action) {
+        delegate.forEachOrdered(action);
+    }
+
+    @Override
+    public Stream<T> peek(Consumer<? super T> consumer) {
+        return delegate.peek(consumer);
+    }
+
+    @Override
+    public Stream<T> limit(long maxSize) {
+        return delegate.limit(maxSize);
+    }
+
+    @Override
+    public Stream<T> substream(long startingOffset) {
+        return delegate.substream(startingOffset);
+    }
+
+    @Override
+    public Stream<T> substream(long startingOffset, long endingOffset) {
+        return delegate.substream(startingOffset, endingOffset);
+    }
+
+    @Override
+    public <A> A[] toArray(IntFunction<A[]> generator) {
+        return delegate.toArray(generator);
+    }
+
+    @Override
+    public Object[] toArray() {
+        return delegate.toArray();
+    }
+
+    @Override
+    public T reduce(T identity, BinaryOperator<T> accumulator) {
+        return delegate.reduce(identity, accumulator);
+    }
+
+    @Override
+    public Optional<T> reduce(BinaryOperator<T> accumulator) {
+        return delegate.reduce(accumulator);
+    }
+
+    @Override
+    public <U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator,
+                        BinaryOperator<U> combiner) {
+        return delegate.reduce(identity, accumulator, combiner);
+    }
+
+    @Override
+    public <R> R collect(Supplier<R> resultFactory,
+                         BiConsumer<R, ? super T> accumulator,
+                         BiConsumer<R, R> combiner) {
+        return delegate.collect(resultFactory, accumulator, combiner);
+    }
+
+    @Override
+    public <R> R collect(Collector<? super T, R> collector) {
+        return delegate.collect(collector);
+    }
+
+    @Override
+    public Optional<T> max(Comparator<? super T> comparator) {
+        return delegate.max(comparator);
+    }
+
+    @Override
+    public Optional<T> min(Comparator<? super T> comparator) {
+        return delegate.min(comparator);
+    }
+
+    @Override
+    public long count() {
+        return delegate.count();
+    }
+
+    @Override
+    public boolean anyMatch(Predicate<? super T> predicate) {
+        return delegate.anyMatch(predicate);
+    }
+
+    @Override
+    public boolean allMatch(Predicate<? super T> predicate) {
+        return delegate.allMatch(predicate);
+    }
+
+    @Override
+    public boolean noneMatch(Predicate<? super T> predicate) {
+        return delegate.noneMatch(predicate);
+    }
+
+    @Override
+    public Optional<T> findFirst() {
+        return delegate.findFirst();
+    }
+
+    @Override
+    public Optional<T> findAny() {
+        return delegate.findAny();
+    }
+
+    @Override
+    public Stream<T> unordered() {
+        return delegate.unordered();
+    }
+
+    @Override
+    public Stream<T> sequential() {
+        return delegate.sequential();
+    }
+
+    @Override
+    public Stream<T> parallel() {
+        return delegate.parallel();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/DistinctOps.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Objects;
+import java.util.Set;
+import java.util.Spliterator;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.IntFunction;
+
+/**
+ * Factory methods for transforming streams into duplicate-free streams, using
+ * {@link Object#equals(Object)} to determine equality.
+ *
+ * @since 1.8
+ */
+final class DistinctOps {
+
+    private DistinctOps() { }
+
+    /**
+     * Appends a "distinct" operation to the provided stream, and returns the
+     * new stream.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     * @return the new stream
+     */
+    static <T> ReferencePipeline<T, T> makeRef(AbstractPipeline<?, T, ?> upstream) {
+        return new ReferencePipeline.StatefulOp<T, T>(upstream, StreamShape.REFERENCE,
+                                                      StreamOpFlag.IS_DISTINCT | StreamOpFlag.NOT_SIZED) {
+            @Override
+            <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
+                                              Spliterator<P_IN> spliterator,
+                                              IntFunction<T[]> generator) {
+                if (StreamOpFlag.DISTINCT.isKnown(helper.getStreamAndOpFlags())) {
+                    // No-op
+                    return helper.evaluate(spliterator, false, generator);
+                }
+                else if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    // If the stream is SORTED then it should also be ORDERED so the following will also
+                    // preserve the sort order
+                    TerminalOp<T, LinkedHashSet<T>> reduceOp
+                            = ReduceOps.<T, LinkedHashSet<T>>makeRef(LinkedHashSet::new, LinkedHashSet::add,
+                                                                     LinkedHashSet::addAll);
+                    return Nodes.node(reduceOp.evaluateParallel(helper, spliterator));
+                }
+                else {
+                    // Holder of null state since ConcurrentHashMap does not support null values
+                    AtomicBoolean seenNull = new AtomicBoolean(false);
+                    ConcurrentHashMap<T, Boolean> map = new ConcurrentHashMap<>();
+                    TerminalOp<T, Void> forEachOp = ForEachOps.makeRef(t -> {
+                        if (t == null)
+                            seenNull.set(true);
+                        else
+                            map.putIfAbsent(t, Boolean.TRUE);
+                    }, false);
+                    forEachOp.evaluateParallel(helper, spliterator);
+
+                    // If null has been seen then copy the key set into a HashSet that supports null values
+                    // and add null
+                    Set<T> keys = map.keySet();
+                    if (seenNull.get()) {
+                        // TODO Implement a more efficient set-union view, rather than copying
+                        keys = new HashSet<>(keys);
+                        keys.add(null);
+                    }
+                    return Nodes.node(keys);
+                }
+            }
+
+            @Override
+            Sink<T> opWrapSink(int flags, Sink<T> sink) {
+                Objects.requireNonNull(sink);
+
+                if (StreamOpFlag.DISTINCT.isKnown(flags)) {
+                    return sink;
+                } else if (StreamOpFlag.SORTED.isKnown(flags)) {
+                    return new Sink.ChainedReference<T>(sink) {
+                        boolean seenNull;
+                        T lastSeen;
+
+                        @Override
+                        public void begin(long size) {
+                            seenNull = false;
+                            lastSeen = null;
+                            downstream.begin(-1);
+                        }
+
+                        @Override
+                        public void end() {
+                            seenNull = false;
+                            lastSeen = null;
+                            downstream.end();
+                        }
+
+                        @Override
+                        public void accept(T t) {
+                            if (t == null) {
+                                if (!seenNull) {
+                                    seenNull = true;
+                                    downstream.accept(lastSeen = null);
+                                }
+                            } else if (lastSeen == null || !t.equals(lastSeen)) {
+                                downstream.accept(lastSeen = t);
+                            }
+                        }
+                    };
+                } else {
+                    return new Sink.ChainedReference<T>(sink) {
+                        Set<T> seen;
+
+                        @Override
+                        public void begin(long size) {
+                            seen = new HashSet<>();
+                            downstream.begin(-1);
+                        }
+
+                        @Override
+                        public void end() {
+                            seen = null;
+                            downstream.end();
+                        }
+
+                        @Override
+                        public void accept(T t) {
+                            if (!seen.contains(t)) {
+                                seen.add(t);
+                                downstream.accept(t);
+                            }
+                        }
+                    };
+                }
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,596 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.DoubleSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BinaryOperator;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.DoubleConsumer;
+import java.util.function.DoubleFunction;
+import java.util.function.DoublePredicate;
+import java.util.function.DoubleToIntFunction;
+import java.util.function.DoubleToLongFunction;
+import java.util.function.DoubleUnaryOperator;
+import java.util.function.IntFunction;
+import java.util.function.ObjDoubleConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Abstract base class for an intermediate pipeline stage or pipeline source
+ * stage implementing whose elements are of type {@code double}.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ *
+ * @since 1.8
+ */
+abstract class DoublePipeline<E_IN>
+        extends AbstractPipeline<E_IN, Double, DoubleStream>
+        implements DoubleStream {
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Supplier<Spliterator>} describing the stream source
+     * @param sourceFlags the source flags for the stream source, described in
+     * {@link StreamOpFlag}
+     */
+    DoublePipeline(Supplier<? extends Spliterator<Double>> source,
+                   int sourceFlags, boolean parallel) {
+        super(source, sourceFlags, parallel);
+    }
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Spliterator} describing the stream source
+     * @param sourceFlags the source flags for the stream source, described in
+     * {@link StreamOpFlag}
+     */
+    DoublePipeline(Spliterator<Double> source,
+                   int sourceFlags, boolean parallel) {
+        super(source, sourceFlags, parallel);
+    }
+
+    /**
+     * Constructor for appending an intermediate operation onto an existing
+     * pipeline.
+     *
+     * @param upstream the upstream element source.
+     * @param opFlags the operation flags
+     */
+    DoublePipeline(AbstractPipeline<?, E_IN, ?> upstream, int opFlags) {
+        super(upstream, opFlags);
+    }
+
+    /**
+     * Adapt a {@code Sink<Double> to a {@code DoubleConsumer}, ideally simply
+     * by casting.
+     */
+    private static DoubleConsumer adapt(Sink<Double> sink) {
+        if (sink instanceof DoubleConsumer) {
+            return (DoubleConsumer) sink;
+        } else {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(AbstractPipeline.class,
+                              "using DoubleStream.adapt(Sink<Double> s)");
+            return sink::accept;
+        }
+    }
+
+    /**
+     * Adapt a {@code Spliterator<Double>} to a {@code Spliterator.OfDouble}.
+     *
+     * @implNote
+     * The implementation attempts to cast to a Spliterator.OfDouble, and throws
+     * an exception if this cast is not possible.
+     */
+    private static Spliterator.OfDouble adapt(Spliterator<Double> s) {
+        if (s instanceof Spliterator.OfDouble) {
+            return (Spliterator.OfDouble) s;
+        } else {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(AbstractPipeline.class,
+                              "using DoubleStream.adapt(Spliterator<Double> s)");
+            throw new UnsupportedOperationException("DoubleStream.adapt(Spliterator<Double> s)");
+        }
+    }
+
+
+    // Shape-specific methods
+
+    @Override
+    final StreamShape getOutputShape() {
+        return StreamShape.DOUBLE_VALUE;
+    }
+
+    @Override
+    final <P_IN> Node<Double> evaluateToNode(PipelineHelper<Double> helper,
+                                             Spliterator<P_IN> spliterator,
+                                             boolean flattenTree,
+                                             IntFunction<Double[]> generator) {
+        return Nodes.collectDouble(helper, spliterator, flattenTree);
+    }
+
+    @Override
+    final <P_IN> Spliterator<Double> wrap(PipelineHelper<Double> ph,
+                                          Supplier<Spliterator<P_IN>> supplier,
+                                          boolean isParallel) {
+        return new StreamSpliterators.DoubleWrappingSpliterator<>(ph, supplier, isParallel);
+    }
+
+    @Override
+    final Spliterator.OfDouble lazySpliterator(Supplier<? extends Spliterator<Double>> supplier) {
+        return new StreamSpliterators.DelegatingSpliterator.OfDouble((Supplier<Spliterator.OfDouble>) supplier);
+    }
+
+    @Override
+    final void forEachWithCancel(Spliterator<Double> spliterator, Sink<Double> sink) {
+        Spliterator.OfDouble spl = adapt(spliterator);
+        DoubleConsumer adaptedSink = adapt(sink);
+        do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+    }
+
+    @Override
+    final  Node.Builder<Double> makeNodeBuilder(long exactSizeIfKnown, IntFunction<Double[]> generator) {
+        return Nodes.doubleBuilder(exactSizeIfKnown);
+    }
+
+
+    // DoubleStream
+
+    @Override
+    public final PrimitiveIterator.OfDouble iterator() {
+        return Spliterators.iteratorFromSpliterator(spliterator());
+    }
+
+    @Override
+    public final Spliterator.OfDouble spliterator() {
+        return adapt(super.spliterator());
+    }
+
+    // Stateless intermediate ops from DoubleStream
+
+    @Override
+    public final Stream<Double> boxed() {
+        return mapToObj(Double::valueOf);
+    }
+
+    @Override
+    public final DoubleStream map(DoubleUnaryOperator mapper) {
+        Objects.requireNonNull(mapper);
+        return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+                                       StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedDouble(sink) {
+                    @Override
+                    public void accept(double t) {
+                        downstream.accept(mapper.applyAsDouble(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final <U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper) {
+        Objects.requireNonNull(mapper);
+        return new ReferencePipeline.StatelessOp<Double, U>(this, StreamShape.DOUBLE_VALUE,
+                                                            StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<U> sink) {
+                return new Sink.ChainedDouble(sink) {
+                    @Override
+                    public void accept(double t) {
+                        downstream.accept(mapper.apply(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final IntStream mapToInt(DoubleToIntFunction mapper) {
+        Objects.requireNonNull(mapper);
+        return new IntPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+                                                   StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedDouble(sink) {
+                    @Override
+                    public void accept(double t) {
+                        downstream.accept(mapper.applyAsInt(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final LongStream mapToLong(DoubleToLongFunction mapper) {
+        Objects.requireNonNull(mapper);
+        return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+                                                    StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedDouble(sink) {
+                    @Override
+                    public void accept(double t) {
+                        downstream.accept(mapper.applyAsLong(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper) {
+        return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+                                        StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedDouble(sink) {
+                    public void accept(double t) {
+                        // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+                        DoubleStream result = mapper.apply(t);
+                        if (result != null)
+                            result.sequential().forEach(i -> downstream.accept(i));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public DoubleStream unordered() {
+        if (!isOrdered())
+            return this;
+        return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE, StreamOpFlag.NOT_ORDERED) {
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+                return sink;
+            }
+        };
+    }
+
+    @Override
+    public final DoubleStream filter(DoublePredicate predicate) {
+        Objects.requireNonNull(predicate);
+        return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+                                       StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedDouble(sink) {
+                    @Override
+                    public void accept(double t) {
+                        if (predicate.test(t))
+                            downstream.accept(t);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final DoubleStream peek(DoubleConsumer consumer) {
+        Objects.requireNonNull(consumer);
+        return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
+                                       0) {
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedDouble(sink) {
+                    @Override
+                    public void accept(double t) {
+                        consumer.accept(t);
+                        downstream.accept(t);
+                    }
+                };
+            }
+        };
+    }
+
+    // Stateful intermediate ops from DoubleStream
+
+    @Override
+    public final DoubleStream limit(long maxSize) {
+        if (maxSize < 0)
+            throw new IllegalArgumentException(Long.toString(maxSize));
+        return SliceOps.makeDouble(this, (long) 0, maxSize);
+    }
+
+    @Override
+    public final DoubleStream substream(long startingOffset) {
+        if (startingOffset < 0)
+            throw new IllegalArgumentException(Long.toString(startingOffset));
+        if (startingOffset == 0)
+            return this;
+        else {
+            long limit = -1;
+            return SliceOps.makeDouble(this, startingOffset, limit);
+        }
+    }
+
+    @Override
+    public final DoubleStream substream(long startingOffset, long endingOffset) {
+        if (startingOffset < 0 || endingOffset < startingOffset)
+            throw new IllegalArgumentException(String.format("substream(%d, %d)", startingOffset, endingOffset));
+        return SliceOps.makeDouble(this, startingOffset, endingOffset - startingOffset);
+    }
+
+    @Override
+    public final DoubleStream sorted() {
+        return SortedOps.makeDouble(this);
+    }
+
+    @Override
+    public final DoubleStream distinct() {
+        // While functional and quick to implement, this approach is not very efficient.
+        // An efficient version requires a double-specific map/set implementation.
+        return boxed().distinct().mapToDouble(i -> (double) i);
+    }
+
+    // Terminal ops from DoubleStream
+
+    @Override
+    public void forEach(DoubleConsumer consumer) {
+        evaluate(ForEachOps.makeDouble(consumer, false));
+    }
+
+    @Override
+    public void forEachOrdered(DoubleConsumer consumer) {
+        evaluate(ForEachOps.makeDouble(consumer, true));
+    }
+
+    @Override
+    public final double sum() {
+        // TODO: better algorithm to compensate for errors
+        return reduce(0.0, Double::sum);
+    }
+
+    @Override
+    public final OptionalDouble min() {
+        return reduce(Math::min);
+    }
+
+    @Override
+    public final OptionalDouble max() {
+        return reduce(Math::max);
+    }
+
+    @Override
+    public final OptionalDouble average() {
+        double[] avg = collect(() -> new double[2],
+                               (ll, i) -> {
+                                   ll[0]++;
+                                   ll[1] += i;
+                               },
+                               (ll, rr) -> {
+                                   ll[0] += rr[0];
+                                   ll[1] += rr[1];
+                               });
+        return avg[0] > 0
+               ? OptionalDouble.of(avg[1] / avg[0])
+               : OptionalDouble.empty();
+    }
+
+    @Override
+    public final long count() {
+        return mapToObj(e -> null).mapToInt(e -> 1).sum();
+    }
+
+    @Override
+    public final DoubleSummaryStatistics summaryStatistics() {
+        return collect(DoubleSummaryStatistics::new, DoubleSummaryStatistics::accept,
+                       DoubleSummaryStatistics::combine);
+    }
+
+    @Override
+    public final double reduce(double identity, DoubleBinaryOperator op) {
+        return evaluate(ReduceOps.makeDouble(identity, op));
+    }
+
+    @Override
+    public final OptionalDouble reduce(DoubleBinaryOperator op) {
+        return evaluate(ReduceOps.makeDouble(op));
+    }
+
+    @Override
+    public final <R> R collect(Supplier<R> resultFactory,
+                               ObjDoubleConsumer<R> accumulator,
+                               BiConsumer<R, R> combiner) {
+        BinaryOperator<R> operator = (left, right) -> {
+            combiner.accept(left, right);
+            return left;
+        };
+        return evaluate(ReduceOps.makeDouble(resultFactory, accumulator, operator));
+    }
+
+    @Override
+    public final boolean anyMatch(DoublePredicate predicate) {
+        return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.ANY));
+    }
+
+    @Override
+    public final boolean allMatch(DoublePredicate predicate) {
+        return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.ALL));
+    }
+
+    @Override
+    public final boolean noneMatch(DoublePredicate predicate) {
+        return evaluate(MatchOps.makeDouble(predicate, MatchOps.MatchKind.NONE));
+    }
+
+    @Override
+    public final OptionalDouble findFirst() {
+        return evaluate(FindOps.makeDouble(true));
+    }
+
+    @Override
+    public final OptionalDouble findAny() {
+        return evaluate(FindOps.makeDouble(false));
+    }
+
+    @Override
+    public final double[] toArray() {
+        return Nodes.flattenDouble((Node.OfDouble) evaluateToArrayNode(Double[]::new))
+                        .asDoubleArray();
+    }
+
+    //
+
+    /**
+     * Source stage of a DoubleStream
+     *
+     * @param <E_IN> type of elements in the upstream source
+     */
+    static class Head<E_IN> extends DoublePipeline<E_IN> {
+        /**
+         * Constructor for the source stage of a DoubleStream.
+         *
+         * @param source {@code Supplier<Spliterator>} describing the stream
+         *               source
+         * @param sourceFlags the source flags for the stream source, described
+         *                    in {@link StreamOpFlag}
+         * @param parallel {@code true} if the pipeline is parallel
+         */
+        Head(Supplier<? extends Spliterator<Double>> source,
+             int sourceFlags, boolean parallel) {
+            super(source, sourceFlags, parallel);
+        }
+
+        /**
+         * Constructor for the source stage of a DoubleStream.
+         *
+         * @param source {@code Spliterator} describing the stream source
+         * @param sourceFlags the source flags for the stream source, described
+         *                    in {@link StreamOpFlag}
+         * @param parallel {@code true} if the pipeline is parallel
+         */
+        Head(Spliterator<Double> source,
+             int sourceFlags, boolean parallel) {
+            super(source, sourceFlags, parallel);
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        final Sink<E_IN> opWrapSink(int flags, Sink<Double> sink) {
+            throw new UnsupportedOperationException();
+        }
+
+        // Optimized sequential terminal operations for the head of the pipeline
+
+        @Override
+        public void forEach(DoubleConsumer consumer) {
+            if (!isParallel()) {
+                adapt(sourceStageSpliterator()).forEachRemaining(consumer);
+            }
+            else {
+                super.forEach(consumer);
+            }
+        }
+
+        @Override
+        public void forEachOrdered(DoubleConsumer consumer) {
+            if (!isParallel()) {
+                adapt(sourceStageSpliterator()).forEachRemaining(consumer);
+            }
+            else {
+                super.forEachOrdered(consumer);
+            }
+        }
+
+    }
+
+    /**
+     * Base class for a stateless intermediate stage of a DoubleStream.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @since 1.8
+     */
+    abstract static class StatelessOp<E_IN> extends DoublePipeline<E_IN> {
+        /**
+         * Construct a new DoubleStream by appending a stateless intermediate
+         * operation to an existing stream.
+         *
+         * @param upstream the upstream pipeline stage
+         * @param inputShape the stream shape for the upstream pipeline stage
+         * @param opFlags operation flags for the new stage
+         */
+        StatelessOp(AbstractPipeline<?, E_IN, ?> upstream,
+                    StreamShape inputShape,
+                    int opFlags) {
+            super(upstream, opFlags);
+            assert upstream.getOutputShape() == inputShape;
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            return false;
+        }
+    }
+
+    /**
+     * Base class for a stateful intermediate stage of a DoubleStream.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @since 1.8
+     */
+    abstract static class StatefulOp<E_IN> extends DoublePipeline<E_IN> {
+        /**
+         * Construct a new DoubleStream by appending a stateful intermediate
+         * operation to an existing stream.
+         *
+         * @param upstream the upstream pipeline stage
+         * @param inputShape the stream shape for the upstream pipeline stage
+         * @param opFlags operation flags for the new stage
+         */
+        StatefulOp(AbstractPipeline<?, E_IN, ?> upstream,
+                   StreamShape inputShape,
+                   int opFlags) {
+            super(upstream, opFlags);
+            assert upstream.getOutputShape() == inputShape;
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            return true;
+        }
+
+        @Override
+        abstract <P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
+                                                        Spliterator<P_IN> spliterator,
+                                                        IntFunction<Double[]> generator);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,827 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Arrays;
+import java.util.DoubleSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.DoubleConsumer;
+import java.util.function.DoubleFunction;
+import java.util.function.DoublePredicate;
+import java.util.function.DoubleSupplier;
+import java.util.function.DoubleToIntFunction;
+import java.util.function.DoubleToLongFunction;
+import java.util.function.DoubleUnaryOperator;
+import java.util.function.Function;
+import java.util.function.ObjDoubleConsumer;
+import java.util.function.Supplier;
+
+/**
+ * A sequence of primitive double elements supporting sequential and parallel
+ * bulk operations. Streams support lazy intermediate operations (transforming
+ * a stream to another stream) such as {@code filter} and {@code map}, and terminal
+ * operations (consuming the contents of a stream to produce a result or
+ * side-effect), such as {@code forEach}, {@code findFirst}, and {@code
+ * iterator}.  Once an operation has been performed on a stream, it
+ * is considered <em>consumed</em> and no longer usable for other operations.
+ *
+ * <p>For sequential stream pipelines, all operations are performed in the
+ * <a href="package-summary.html#Ordering">encounter order</a> of the pipeline
+ * source, if the pipeline source has a defined encounter order.
+ *
+ * <p>For parallel stream pipelines, unless otherwise specified, intermediate
+ * stream operations preserve the <a href="package-summary.html#Ordering">
+ * encounter order</a> of their source, and terminal operations
+ * respect the encounter order of their source, if the source
+ * has an encounter order.  Provided that and parameters to stream operations
+ * satisfy the <a href="package-summary.html#NonInterference">non-interference
+ * requirements</a>, and excepting differences arising from the absence of
+ * a defined encounter order, the result of a stream pipeline should be the
+ * stable across multiple executions of the same operations on the same source.
+ * However, the timing and thread in which side-effects occur (for those
+ * operations which are allowed to produce side-effects, such as
+ * {@link #forEach(DoubleConsumer)}), are explicitly nondeterministic for parallel
+ * execution of stream pipelines.
+ *
+ * <p>Unless otherwise noted, passing a {@code null} argument to any stream
+ * method may result in a {@link NullPointerException}.
+ *
+ * @apiNote
+ * Streams are not data structures; they do not manage the storage for their
+ * elements, nor do they support access to individual elements.  However,
+ * you can use the {@link #iterator()} or {@link #spliterator()} operations to
+ * perform a controlled traversal.
+ *
+ * @since 1.8
+ * @see <a href="package-summary.html">java.util.stream</a>
+ */
+public interface DoubleStream extends BaseStream<Double, DoubleStream> {
+
+    /**
+     * Returns a stream consisting of the elements of this stream that match
+     * the given predicate.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">
+     *                  non-interfering, stateless</a> predicate to apply to
+     *                  each element to determine if it should be included
+     * @return the new stream
+     */
+    DoubleStream filter(DoublePredicate predicate);
+
+    /**
+     * Returns a stream consisting of the results of applying the given
+     * function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to
+     *               each element
+     * @return the new stream
+     */
+    DoubleStream map(DoubleUnaryOperator mapper);
+
+    /**
+     * Returns an object-valued {@code Stream} consisting of the results of
+     * applying the given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">
+     *     intermediate operation</a>.
+     *
+     * @param <U> the element type of the new stream
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    <U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper);
+
+    /**
+     * Returns an {@code IntStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    IntStream mapToInt(DoubleToIntFunction mapper);
+
+    /**
+     * Returns a {@code LongStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    LongStream mapToLong(DoubleToLongFunction mapper);
+
+    /**
+     * Returns a stream consisting of the results of replacing each element of
+     * this stream with the contents of the stream produced by applying the
+     * provided mapping function to each element.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @apiNote
+     * The {@code flatMap()} operation has the effect of applying a one-to-many
+     * tranformation to the elements of the stream, and then flattening the
+     * resulting elements into a new stream. For example, if {@code orders}
+     * is a stream of purchase orders, and each purchase order contains a
+     * collection of line items, then the following produces a stream of line
+     * items:
+     * <pre>{@code
+     *     orderStream.flatMap(order -> order.getLineItems().stream())...
+     * }</pre>
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to
+     *               each element which produces an {@code DoubleStream} of new
+     *               values
+     * @return the new stream
+     * @see Stream#flatMap(Function)
+     */
+    DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper);
+
+    /**
+     * Returns a stream consisting of the distinct elements of this stream. The
+     * elements are compared for equality according to
+     * {@link java.lang.Double#compare(double, double)}.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @return the result stream
+     */
+    DoubleStream distinct();
+
+    /**
+     * Returns a stream consisting of the elements of this stream in sorted
+     * order. The elements are compared for equality according to
+     * {@link java.lang.Double#compare(double, double)}.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @return the result stream
+     */
+    DoubleStream sorted();
+
+    /**
+     * Returns a stream consisting of the elements of this stream, additionally
+     * performing the provided action on each element as elements are consumed
+     * from the resulting stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * <p>For parallel stream pipelines, the action may be called at
+     * whatever time and in whatever thread the element is made available by the
+     * upstream operation.  If the action modifies shared state,
+     * it is responsible for providing the required synchronization.
+     *
+     * @apiNote This method exists mainly to support debugging, where you want
+     * to see the elements as they flow past a certain point in a pipeline:
+     * <pre>{@code
+     *     list.stream()
+     *         .filter(filteringFunction)
+     *         .peek(e -> {System.out.println("Filtered value: " + e); });
+     *         .map(mappingFunction)
+     *         .peek(e -> {System.out.println("Mapped value: " + e); });
+     *         .collect(Collectors.toDoubleSummaryStastistics());
+     * }</pre>
+     *
+     * @param consumer a <a href="package-summary.html#NonInterference">
+     *                 non-interfering</a> action to perform on the elements as
+     *                 they are consumed from the stream
+     * @return the new stream
+     */
+    DoubleStream peek(DoubleConsumer consumer);
+
+    /**
+     * Returns a stream consisting of the elements of this stream, truncated
+     * to be no longer than {@code maxSize} in length.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @param maxSize the number of elements the stream should be limited to
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code maxSize} is negative
+     */
+    DoubleStream limit(long maxSize);
+
+    /**
+     * Returns a stream consisting of the remaining elements of this stream
+     * after indexing {@code startInclusive} elements into the stream. If the
+     * {@code startInclusive} index lies past the end of this stream then an
+     * empty stream will be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @param startInclusive the number of leading elements to skip
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code startInclusive} is negative
+     */
+    DoubleStream substream(long startInclusive);
+
+    /**
+     * Returns a stream consisting of the remaining elements of this stream
+     * after indexing {@code startInclusive} elements into the stream and
+     * truncated to contain no more than {@code endExclusive - startInclusive}
+     * elements. If the {@code startInclusive} index lies past the end
+     * of this stream then an empty stream will be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @param startInclusive the starting position of the substream, inclusive
+     * @param endExclusive the ending position of the substream, exclusive
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code startInclusive} or
+     * {@code endExclusive} is negative or {@code startInclusive} is greater
+     * than {@code endExclusive}
+     */
+    DoubleStream substream(long startInclusive, long endExclusive);
+
+    /**
+     * Performs an action for each element of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * <p>For parallel stream pipelines, this operation does <em>not</em>
+     * guarantee to respect the encounter order of the stream, as doing so
+     * would sacrifice the benefit of parallelism.  For any given element, the
+     * action may be performed at whatever time and in whatever thread the
+     * library chooses.  If the action accesses shared state, it is
+     * responsible for providing the required synchronization.
+     *
+     * @param action a <a href="package-summary.html#NonInterference">
+     *               non-interfering</a> action to perform on the elements
+     */
+    void forEach(DoubleConsumer action);
+
+    /**
+     * Performs an action for each element of this stream, guaranteeing that
+     * each element is processed in encounter order for streams that have a
+     * defined encounter order.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param action a <a href="package-summary.html#NonInterference">
+     *               non-interfering</a> action to perform on the elements
+     * @see #forEach(DoubleConsumer)
+     */
+    void forEachOrdered(DoubleConsumer action);
+
+    /**
+     * Returns an array containing the elements of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @return an array containing the elements of this stream
+     */
+    double[] toArray();
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using the provided identity value and an
+     * <a href="package-summary.html#Associativity">associative</a>
+     * accumulation function, and returns the reduced value.  This is equivalent
+     * to:
+     * <pre>{@code
+     *     double result = identity;
+     *     for (double element : this stream)
+     *         result = accumulator.apply(result, element)
+     *     return result;
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code identity} value must be an identity for the accumulator
+     * function. This means that for all {@code x},
+     * {@code accumulator.apply(identity, x)} is equal to {@code x}.
+     * The {@code accumulator} function must be an
+     * <a href="package-summary.html#Associativity">associative</a> function.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @apiNote Sum, min, max, and average are all special cases of reduction.
+     * Summing a stream of numbers can be expressed as:
+
+     * <pre>{@code
+     *     double sum = numbers.reduce(0, (a, b) -> a+b);
+     * }</pre>
+     *
+     * or more compactly:
+     *
+     * <pre>{@code
+     *     double sum = numbers.reduce(0, Double::sum);
+     * }</pre>
+     *
+     * <p>While this may seem a more roundabout way to perform an aggregation
+     * compared to simply mutating a running total in a loop, reduction
+     * operations parallelize more gracefully, without needing additional
+     * synchronization and with greatly reduced risk of data races.
+     *
+     * @param identity the identity value for the accumulating function
+     * @param op an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for combining two values
+     * @return the result of the reduction
+     * @see #sum()
+     * @see #min()
+     * @see #max()
+     * @see #average()
+     */
+    double reduce(double identity, DoubleBinaryOperator op);
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using an
+     * <a href="package-summary.html#Associativity">associative</a> accumulation
+     * function, and returns an {@code OptionalDouble} describing the reduced
+     * value, if any. This is equivalent to:
+     * <pre>{@code
+     *     boolean foundAny = false;
+     *     double result = null;
+     *     for (double element : this stream) {
+     *         if (!foundAny) {
+     *             foundAny = true;
+     *             result = element;
+     *         }
+     *         else
+     *             result = accumulator.apply(result, element);
+     *     }
+     *     return foundAny ? OptionalDouble.of(result) : OptionalDouble.empty();
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code accumulator} function must be an
+     * <a href="package-summary.html#Associativity">associative</a> function.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param op an <a href="package-summary.html#Associativity">associative</a>
+     *           <a href="package-summary.html#NonInterference">non-interfering,
+     *           stateless</a> function for combining two values
+     * @return the result of the reduction
+     * @see #reduce(double, DoubleBinaryOperator)
+     */
+    OptionalDouble reduce(DoubleBinaryOperator op);
+
+    /**
+     * Performs a <a href="package-summary.html#MutableReduction">mutable
+     * reduction</a> operation on the elements of this stream.  A mutable
+     * reduction is one in which the reduced value is a mutable value holder,
+     * such as an {@code ArrayList}, and elements are incorporated by updating
+     * the state of the result, rather than by replacing the result.  This
+     * produces a result equivalent to:
+     * <pre>{@code
+     *     R result = resultFactory.get();
+     *     for (double element : this stream)
+     *         accumulator.accept(result, element);
+     *     return result;
+     * }</pre>
+     *
+     * <p>Like {@link #reduce(double, DoubleBinaryOperator)}, {@code collect}
+     * operations can be parallelized without requiring additional
+     * synchronization.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param <R> type of the result
+     * @param resultFactory a function that creates a new result container.
+     *                      For a parallel execution, this function may be
+     *                      called multiple times and must return a fresh value
+     *                      each time.
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for incorporating an additional
+     *                    element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+     *                 <a href="package-summary.html#NonInterference">non-interfering,
+     *                 stateless</a> function for combining two values, which
+     *                 must be compatible with the accumulator function
+     * @return the result of the reduction
+     * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
+     */
+    <R> R collect(Supplier<R> resultFactory,
+                  ObjDoubleConsumer<R> accumulator,
+                  BiConsumer<R, R> combiner);
+
+    /**
+     * Returns the sum of elements in this stream.  The sum returned can vary
+     * depending upon the order in which elements are encountered.  This is due
+     * to accumulated rounding error in addition of values of differing
+     * magnitudes. Elements sorted by increasing absolute magnitude tend to
+     * yield more accurate results.  If any stream element is a {@code NaN} or
+     * the sum is at any point a {@code NaN} then the sum will be {@code NaN}.
+     * This is a special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a> and is
+     * equivalent to:
+     * <pre>{@code
+     *     return reduce(0, Double::sum);
+     * }</pre>
+     *
+     * @return the sum of elements in this stream
+     */
+    double sum();
+
+    /**
+     * Returns an {@code OptionalDouble} describing the minimum element of this
+     * stream, or an empty OptionalDouble if this stream is empty.  The minimum
+     * element will be {@code Double.NaN} if any stream element was NaN. Unlike
+     * the numerical comparison operators, this method considers negative zero
+     * to be strictly smaller than positive zero. This is a special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a> and is
+     * equivalent to:
+     * <pre>{@code
+     *     return reduce(Double::min);
+     * }</pre>
+     *
+     * @return an {@code OptionalDouble} containing the minimum element of this
+     * stream, or an empty optional if the stream is empty
+     */
+    OptionalDouble min();
+
+    /**
+     * Returns an {@code OptionalDouble} describing the maximum element of this
+     * stream, or an empty OptionalDouble if this stream is empty.  The maximum
+     * element will be {@code Double.NaN} if any stream element was NaN. Unlike
+     * the numerical comparison operators, this method considers negative zero
+     * to be strictly smaller than positive zero. This is a
+     * special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a> and is
+     * equivalent to:
+     * <pre>{@code
+     *     return reduce(Double::max);
+     * }</pre>
+     *
+     * @return an {@code OptionalDouble} containing the maximum element of this
+     * stream, or an empty optional if the stream is empty
+     */
+    OptionalDouble max();
+
+    /**
+     * Returns the count of elements in this stream.  This is a special case of
+     * a <a href="package-summary.html#MutableReduction">reduction</a> and is
+     * equivalent to:
+     * <pre>{@code
+     *     return mapToLong(e -> 1L).sum();
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+     *
+     * @return the count of elements in this stream
+     */
+    long count();
+
+    /**
+     * Returns an {@code OptionalDouble} describing the average of elements of
+     * this stream, or an empty optional if this stream is empty.  The average
+     * returned can vary depending upon the order in which elements are
+     * encountered. This is due to accumulated rounding error in addition of
+     * elements of differing magnitudes. Elements sorted by increasing absolute
+     * magnitude tend to yield more accurate results. If any recorded value is
+     * a {@code NaN} or the sum is at any point a {@code NaN} then the average
+     * will be {@code NaN}. This is a special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a>.
+     *
+     * @return an {@code OptionalDouble} containing the average element of this
+     * stream, or an empty optional if the stream is empty
+     */
+    OptionalDouble average();
+
+    /**
+     * Returns a {@code DoubleSummaryStatistics} describing various summary data
+     * about the elements of this stream.  This is a special
+     * case of a <a href="package-summary.html#MutableReduction">reduction</a>.
+     *
+     * @return a {@code DoubleSummaryStatistics} describing various summary data
+     * about the elements of this stream
+     */
+    DoubleSummaryStatistics summaryStatistics();
+
+    /**
+     * Returns whether any elements of this stream match the provided
+     * predicate.  May not evaluate the predicate on all elements if not
+     * necessary for determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if any elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean anyMatch(DoublePredicate predicate);
+
+    /**
+     * Returns whether all elements of this stream match the provided predicate.
+     * May not evaluate the predicate on all elements if not necessary for
+     * determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if all elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean allMatch(DoublePredicate predicate);
+
+    /**
+     * Returns whether no elements of this stream match the provided predicate.
+     * May not evaluate the predicate on all elements if not necessary for
+     * determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if no elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean noneMatch(DoublePredicate predicate);
+
+    /**
+     * Returns an {@link OptionalDouble} describing the first element of this
+     * stream (in the encounter order), or an empty {@code OptionalDouble} if
+     * the stream is empty.  If the stream has no encounter order, than any
+     * element may be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @return an {@code OptionalDouble} describing the first element of this
+     * stream, or an empty {@code OptionalDouble} if the stream is empty
+     */
+    OptionalDouble findFirst();
+
+    /**
+     * Returns an {@link OptionalDouble} describing some element of the stream,
+     * or an empty {@code OptionalDouble} if the stream is empty.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * <p>The behavior of this operation is explicitly nondeterministic; it is
+     * free to select any element in the stream.  This is to allow for maximal
+     * performance in parallel operations; the cost is that multiple invocations
+     * on the same source may not return the same result.  (If the first element
+     * in the encounter order is desired, use {@link #findFirst()} instead.)
+     *
+     * @return an {@code OptionalDouble} describing some element of this stream,
+     * or an empty {@code OptionalDouble} if the stream is empty
+     * @see #findFirst()
+     */
+    OptionalDouble findAny();
+
+    /**
+     * Returns a {@code Stream} consisting of the elements of this stream,
+     * boxed to {@code Double}.
+     *
+     * @return a {@code Stream} consistent of the elements of this stream,
+     * each boxed to a {@code Double}
+     */
+    Stream<Double> boxed();
+
+    @Override
+    DoubleStream sequential();
+
+    @Override
+    DoubleStream parallel();
+
+    @Override
+    PrimitiveIterator.OfDouble iterator();
+
+    @Override
+    Spliterator.OfDouble spliterator();
+
+
+    // Static factories
+
+    /**
+     * Returns a builder for a {@code DoubleStream}.
+     *
+     * @return a stream builder
+     */
+    public static StreamBuilder.OfDouble builder() {
+        return new Streams.DoubleStreamBuilderImpl();
+    }
+
+    /**
+     * Returns an empty sequential {@code DoubleStream}.
+     *
+     * @return an empty sequential stream
+     */
+    public static DoubleStream empty() {
+        return StreamSupport.doubleStream(Spliterators.emptyDoubleSpliterator());
+    }
+
+    /**
+     * Returns a sequential {@code DoubleStream} containing a single element.
+     *
+     * @param t the single element
+     * @return a singleton sequential stream
+     */
+    public static DoubleStream of(double t) {
+        return StreamSupport.doubleStream(new Streams.DoubleStreamBuilderImpl(t));
+    }
+
+    /**
+     * Returns a sequential stream whose elements are the specified values.
+     *
+     * @param values the elements of the new stream
+     * @return the new stream
+     */
+    public static DoubleStream of(double... values) {
+        return Arrays.stream(values);
+    }
+
+    /**
+     * Returns an infinite sequential {@code DoubleStream} produced by iterative
+     * application of a function {@code f} to an initial element {@code seed},
+     * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
+     * {@code f(f(seed))}, etc.
+     *
+     * <p>The first element (position {@code 0}) in the {@code DoubleStream}
+     * will be the provided {@code seed}.  For {@code n > 0}, the element at
+     * position {@code n}, will be the result of applying the function {@code f}
+     *  to the element at position {@code n - 1}.
+     *
+     * @param seed the initial element
+     * @param f a function to be applied to to the previous element to produce
+     *          a new element
+     * @return a new sequential {@code DoubleStream}
+     */
+    public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) {
+        Objects.requireNonNull(f);
+        final PrimitiveIterator.OfDouble iterator = new PrimitiveIterator.OfDouble() {
+            double t = seed;
+
+            @Override
+            public boolean hasNext() {
+                return true;
+            }
+
+            @Override
+            public double nextDouble() {
+                double v = t;
+                t = f.applyAsDouble(t);
+                return v;
+            }
+        };
+        return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(
+                iterator,
+                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+    }
+
+    /**
+     * Returns a sequential {@code DoubleStream} where each element is
+     * generated by an {@code DoubleSupplier}.  This is suitable for generating
+     * constant streams, streams of random elements, etc.
+     *
+     * @param s the {@code DoubleSupplier} for generated elements
+     * @return a new sequential {@code DoubleStream}
+     */
+    public static DoubleStream generate(DoubleSupplier s) {
+        Objects.requireNonNull(s);
+        return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(
+                new PrimitiveIterator.OfDouble() {
+                    @Override
+                    public boolean hasNext() { return true; }
+
+                    @Override
+                    public double nextDouble() { return s.getAsDouble(); }
+                },
+                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+    }
+
+    /**
+     * Returns a sequential {@code DoubleStream} from {@code startInclusive} (inclusive)
+     * to {@code endExclusive} (exclusive) by an incremental step of 1.0.
+     *
+     * @implSpec
+     * The implementation behaves as if:
+     * <pre>{@code
+     *     doubleRange(startInclusive, endExclusive, 1.0);
+     * }</pre>
+     *
+     * @param startInclusive the (inclusive) initial value
+     * @param endExclusive the exclusive upper bound
+     * @return a sequential {@code DoubleStream} for the range of {@code double}
+     *         elements
+     */
+    public static DoubleStream range(double startInclusive, double endExclusive) {
+        return range(startInclusive, endExclusive, 1.0);
+    }
+
+    /**
+     * Returns a sequential {@code DoubleStream} from {@code startInclusive}
+     * (inclusive) to {@code endExclusive} (exclusive) by {@code step}. If
+     * {@code startInclusive} is greater than or equal to {@code
+     * endExclusive}, an empty stream is returned.
+     *
+     * An equivalent sequence of increasing values can be produced
+     * sequentially using a {@code for} loop as follows:
+     * <pre>{@code
+     *     long size = (long) Math.ceil((startInclusive - endExclusive) / step);
+     *     long i = 0
+     *     for (double v = startInclusive; i < size; i++, v = startInclusive + step * i) {
+     *         ...
+     *     }
+     * }</pre>
+     *
+     * @param startInclusive the (inclusive) initial value
+     * @param endExclusive the exclusive upper bound
+     * @param step the difference between consecutive values
+     * @return a sequential {@code DoubleStream} for tne range of {@code double}
+     *         elements
+     * @throws IllegalArgumentException if {@code step} is less than or equal to
+     *         0. is {@code NaN}, or the count of elements in the range would be
+     *         greater than {@code Long.MAX_VALUE}
+     */
+    public static DoubleStream range(double startInclusive, double endExclusive, double step) {
+        // @@@ Need to check for ranges that may not produce distinct values
+        //     such as when the step is very small
+        //     Also clarify the size of the range which may produce more or less
+        //     than expected
+        if (step <= 0 || Double.isNaN(step)) {
+            throw new IllegalArgumentException(String.format("Illegal step: %f", step));
+        } else {
+            double range = endExclusive - startInclusive;
+            if (range <= 0) {
+                return empty();
+            }
+            double size = Math.ceil((endExclusive - startInclusive) / step);
+            if (Double.isNaN(size)) {
+                throw new IllegalArgumentException(
+                        String.format("Illegal range: %f size is NaN", size));
+            } else if (size > Long.MAX_VALUE) {
+                throw new IllegalArgumentException(
+                        String.format("Illegal range: size %f > Long.MAX_VALUE", size));
+            } else {
+                return StreamSupport.doubleStream(
+                        new Streams.RangeDoubleSpliterator(
+                                startInclusive, endExclusive, step, 0, (long) size));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/FindOps.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+/**
+ * Factory for instances of a short-circuiting {@code TerminalOp} that searches
+ * for an element in a stream pipeline, and terminates when it finds one.
+ * Supported variants include find-first (find the first element in the
+ * encounter order) and find-any (find any element, may not be the first in
+ * encounter order.)
+ *
+ * @since 1.8
+ */
+final class FindOps {
+
+    private FindOps() { }
+
+    /**
+     * Constructs a {@code TerminalOp} for streams of objects.
+     *
+     * @param <T> the type of elements of the stream
+     * @param mustFindFirst whether the {@code TerminalOp} must produce the
+     *        first element in the encounter order
+     * @return a {@code TerminalOp} implementing the find operation
+     */
+    public static <T> TerminalOp<T, Optional<T>> makeRef(boolean mustFindFirst) {
+        return new FindOp<>(mustFindFirst, StreamShape.REFERENCE, Optional.empty(),
+                            Optional::isPresent, FindSink.OfRef::new);
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} for streams of ints.
+     *
+     * @param mustFindFirst whether the {@code TerminalOp} must produce the
+     *        first element in the encounter order
+     * @return a {@code TerminalOp} implementing the find operation
+     */
+    public static TerminalOp<Integer, OptionalInt> makeInt(boolean mustFindFirst) {
+        return new FindOp<>(mustFindFirst, StreamShape.INT_VALUE, OptionalInt.empty(),
+                            OptionalInt::isPresent, FindSink.OfInt::new);
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} for streams of longs.
+     *
+     * @param mustFindFirst whether the {@code TerminalOp} must produce the
+     *        first element in the encounter order
+     * @return a {@code TerminalOp} implementing the find operation
+     */
+    public static TerminalOp<Long, OptionalLong> makeLong(boolean mustFindFirst) {
+        return new FindOp<>(mustFindFirst, StreamShape.LONG_VALUE, OptionalLong.empty(),
+                            OptionalLong::isPresent, FindSink.OfLong::new);
+    }
+
+    /**
+     * Constructs a {@code FindOp} for streams of doubles.
+     *
+     * @param mustFindFirst whether the {@code TerminalOp} must produce the
+     *        first element in the encounter order
+     * @return a {@code TerminalOp} implementing the find operation
+     */
+    public static TerminalOp<Double, OptionalDouble> makeDouble(boolean mustFindFirst) {
+        return new FindOp<>(mustFindFirst, StreamShape.DOUBLE_VALUE, OptionalDouble.empty(),
+                            OptionalDouble::isPresent, FindSink.OfDouble::new);
+    }
+
+    /**
+     * A short-circuiting {@code TerminalOp} that searches for an element in a
+     * stream pipeline, and terminates when it finds one.  Implements both
+     * find-first (find the first element in the encounter order) and find-any
+     * (find any element, may not be the first in encounter order.)
+     *
+     * @param <T> the output type of the stream pipeline
+     * @param <O> the result type of the find operation, typically an optional
+     *        type
+     */
+    private static final class FindOp<T, O> implements TerminalOp<T, O> {
+        private final StreamShape shape;
+        final boolean mustFindFirst;
+        final O emptyValue;
+        final Predicate<O> presentPredicate;
+        final Supplier<TerminalSink<T, O>> sinkSupplier;
+
+        /**
+         * Constructs a {@code FindOp}.
+         *
+         * @param mustFindFirst if true, must find the first element in
+         *        encounter order, otherwise can find any element
+         * @param shape stream shape of elements to search
+         * @param emptyValue result value corresponding to "found nothing"
+         * @param presentPredicate {@code Predicate} on result value
+         *        corresponding to "found something"
+         * @param sinkSupplier supplier for a {@code TerminalSink} implementing
+         *        the matching functionality
+         */
+        FindOp(boolean mustFindFirst,
+                       StreamShape shape,
+                       O emptyValue,
+                       Predicate<O> presentPredicate,
+                       Supplier<TerminalSink<T, O>> sinkSupplier) {
+            this.mustFindFirst = mustFindFirst;
+            this.shape = shape;
+            this.emptyValue = emptyValue;
+            this.presentPredicate = presentPredicate;
+            this.sinkSupplier = sinkSupplier;
+        }
+
+        @Override
+        public int getOpFlags() {
+            return StreamOpFlag.IS_SHORT_CIRCUIT | (mustFindFirst ? 0 : StreamOpFlag.NOT_ORDERED);
+        }
+
+        @Override
+        public StreamShape inputShape() {
+            return shape;
+        }
+
+        @Override
+        public <S> O evaluateSequential(PipelineHelper<T> helper,
+                                        Spliterator<S> spliterator) {
+            O result = helper.wrapAndCopyInto(sinkSupplier.get(), spliterator).get();
+            return result != null ? result : emptyValue;
+        }
+
+        @Override
+        public <P_IN> O evaluateParallel(PipelineHelper<T> helper,
+                                         Spliterator<P_IN> spliterator) {
+            return new FindTask<>(this, helper, spliterator).invoke();
+        }
+    }
+
+    /**
+     * Implementation of @{code TerminalSink} that implements the find
+     * functionality, requesting cancellation when something has been found
+     *
+     * @param <T> The type of input element
+     * @param <O> The result type, typically an optional type
+     */
+    private static abstract class FindSink<T, O> implements TerminalSink<T, O> {
+        boolean hasValue;
+        T value;
+
+        FindSink() {} // Avoid creation of special accessor
+
+        @Override
+        public void accept(T value) {
+            if (!hasValue) {
+                hasValue = true;
+                this.value = value;
+            }
+        }
+
+        @Override
+        public boolean cancellationRequested() {
+            return hasValue;
+        }
+
+        /** Specialization of {@code FindSink} for reference streams */
+        static final class OfRef<T> extends FindSink<T, Optional<T>> {
+            @Override
+            public Optional<T> get() {
+                return hasValue ? Optional.of(value) : null;
+            }
+        }
+
+        /** Specialization of {@code FindSink} for int streams */
+        static final class OfInt extends FindSink<Integer, OptionalInt>
+                implements Sink.OfInt {
+            @Override
+            public void accept(int value) {
+                // Boxing is OK here, since few values will actually flow into the sink
+                accept((Integer) value);
+            }
+
+            @Override
+            public OptionalInt get() {
+                return hasValue ? OptionalInt.of(value) : null;
+            }
+        }
+
+        /** Specialization of {@code FindSink} for long streams */
+        static final class OfLong extends FindSink<Long, OptionalLong>
+                implements Sink.OfLong {
+            @Override
+            public void accept(long value) {
+                // Boxing is OK here, since few values will actually flow into the sink
+                accept((Long) value);
+            }
+
+            @Override
+            public OptionalLong get() {
+                return hasValue ? OptionalLong.of(value) : null;
+            }
+        }
+
+        /** Specialization of {@code FindSink} for double streams */
+        static final class OfDouble extends FindSink<Double, OptionalDouble>
+                implements Sink.OfDouble {
+            @Override
+            public void accept(double value) {
+                // Boxing is OK here, since few values will actually flow into the sink
+                accept((Double) value);
+            }
+
+            @Override
+            public OptionalDouble get() {
+                return hasValue ? OptionalDouble.of(value) : null;
+            }
+        }
+    }
+
+    /**
+     * {@code ForkJoinTask} implementing parallel short-circuiting search
+     * @param <P_IN> Input element type to the stream pipeline
+     * @param <P_OUT> Output element type from the stream pipeline
+     * @param <O> Result type from the find operation
+     */
+    private static final class FindTask<P_IN, P_OUT, O>
+            extends AbstractShortCircuitTask<P_IN, P_OUT, O, FindTask<P_IN, P_OUT, O>> {
+        private final FindOp<P_OUT, O> op;
+
+        FindTask(FindOp<P_OUT, O> op,
+                 PipelineHelper<P_OUT> helper,
+                 Spliterator<P_IN> spliterator) {
+            super(helper, spliterator);
+            this.op = op;
+        }
+
+        FindTask(FindTask<P_IN, P_OUT, O> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            this.op = parent.op;
+        }
+
+        @Override
+        protected FindTask<P_IN, P_OUT, O> makeChild(Spliterator<P_IN> spliterator) {
+            return new FindTask<>(this, spliterator);
+        }
+
+        @Override
+        protected O getEmptyResult() {
+            return op.emptyValue;
+        }
+
+        private void foundResult(O answer) {
+            if (isLeftmostNode())
+                shortCircuit(answer);
+            else
+                cancelLaterNodes();
+        }
+
+        @Override
+        protected O doLeaf() {
+            O result = helper.wrapAndCopyInto(op.sinkSupplier.get(), spliterator).get();
+            if (!op.mustFindFirst) {
+                if (result != null)
+                    shortCircuit(result);
+                return null;
+            }
+            else {
+                if (result != null) {
+                    foundResult(result);
+                    return result;
+                }
+                else
+                    return null;
+            }
+        }
+
+        @Override
+        public void onCompletion(CountedCompleter<?> caller) {
+            if (op.mustFindFirst) {
+                    for (FindTask<P_IN, P_OUT, O> child = leftChild, p = null; child != p;
+                         p = child, child = rightChild) {
+                    O result = child.getLocalResult();
+                    if (result != null && op.presentPredicate.test(result)) {
+                        setLocalResult(result);
+                        foundResult(result);
+                        break;
+                    }
+                }
+            }
+            super.onCompletion(caller);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/ForEachOps.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,396 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+
+/**
+ * Factory for creating instances of {@code TerminalOp} that perform an
+ * action for every element of a stream.  Supported variants include unordered
+ * traversal (elements are provided to the {@code Consumer} as soon as they are
+ * available), and ordered traversal (elements are provided to the
+ * {@code Consumer} in encounter order.)
+ *
+ * <p>Elements are provided to the {@code Consumer} on whatever thread and
+ * whatever order they become available.  For ordered traversals, it is
+ * guaranteed that processing an element <em>happens-before</em> processing
+ * subsequent elements in the encounter order.
+ *
+ * <p>Exceptions occurring as a result of sending an element to the
+ * {@code Consumer} will be relayed to the caller and traversal will be
+ * prematurely terminated.
+ *
+ * @since 1.8
+ */
+final class ForEachOps {
+
+    private ForEachOps() { }
+
+    /**
+     * Constructs a {@code TerminalOp} that perform an action for every element
+     * of a stream.
+     *
+     * @param action the {@code Consumer} that receives all elements of a
+     *        stream
+     * @param ordered whether an ordered traversal is requested
+     * @param <T> the type of the stream elements
+     * @return the {@code TerminalOp} instance
+     */
+    public static <T> TerminalOp<T, Void> makeRef(Consumer<? super T> action,
+                                                  boolean ordered) {
+        Objects.requireNonNull(action);
+        return new ForEachOp.OfRef<>(action, ordered);
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that perform an action for every element
+     * of an {@code IntStream}.
+     *
+     * @param action the {@code IntConsumer} that receives all elements of a
+     *        stream
+     * @param ordered whether an ordered traversal is requested
+     * @return the {@code TerminalOp} instance
+     */
+    public static TerminalOp<Integer, Void> makeInt(IntConsumer action,
+                                                    boolean ordered) {
+        Objects.requireNonNull(action);
+        return new ForEachOp.OfInt(action, ordered);
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that perform an action for every element
+     * of a {@code LongStream}.
+     *
+     * @param action the {@code LongConsumer} that receives all elements of a
+     *        stream
+     * @param ordered whether an ordered traversal is requested
+     * @return the {@code TerminalOp} instance
+     */
+    public static TerminalOp<Long, Void> makeLong(LongConsumer action,
+                                                  boolean ordered) {
+        Objects.requireNonNull(action);
+        return new ForEachOp.OfLong(action, ordered);
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that perform an action for every element
+     * of a {@code DoubleStream}.
+     *
+     * @param action the {@code DoubleConsumer} that receives all elements of
+     *        a stream
+     * @param ordered whether an ordered traversal is requested
+     * @return the {@code TerminalOp} instance
+     */
+    public static TerminalOp<Double, Void> makeDouble(DoubleConsumer action,
+                                                      boolean ordered) {
+        Objects.requireNonNull(action);
+        return new ForEachOp.OfDouble(action, ordered);
+    }
+
+    /**
+     * A {@code TerminalOp} that evaluates a stream pipeline and sends the
+     * output to itself as a {@code TerminalSink}.  Elements will be sent in
+     * whatever thread they become available.  If the traversal is unordered,
+     * they will be sent independent of the stream's encounter order.
+     *
+     * <p>This terminal operation is stateless.  For parallel evaluation, each
+     * leaf instance of a {@code ForEachTask} will send elements to the same
+     * {@code TerminalSink} reference that is an instance of this class.
+     *
+     * @param <T> the output type of the stream pipeline
+     */
+    private static abstract class ForEachOp<T>
+            implements TerminalOp<T, Void>, TerminalSink<T, Void> {
+        private final boolean ordered;
+
+        protected ForEachOp(boolean ordered) {
+            this.ordered = ordered;
+        }
+
+        // TerminalOp
+
+        @Override
+        public int getOpFlags() {
+            return ordered ? 0 : StreamOpFlag.NOT_ORDERED;
+        }
+
+        @Override
+        public <S> Void evaluateSequential(PipelineHelper<T> helper,
+                                           Spliterator<S> spliterator) {
+            return helper.wrapAndCopyInto(this, spliterator).get();
+        }
+
+        @Override
+        public <S> Void evaluateParallel(PipelineHelper<T> helper,
+                                         Spliterator<S> spliterator) {
+            if (ordered)
+                new ForEachOrderedTask<>(helper, spliterator, this).invoke();
+            else
+                new ForEachTask<>(helper, spliterator, helper.wrapSink(this)).invoke();
+            return null;
+        }
+
+        // TerminalSink
+
+        @Override
+        public Void get() {
+            return null;
+        }
+
+        // Implementations
+
+        /** Implementation class for reference streams */
+        private static class OfRef<T> extends ForEachOp<T> {
+            final Consumer<? super T> consumer;
+
+            OfRef(Consumer<? super T> consumer, boolean ordered) {
+                super(ordered);
+                this.consumer = consumer;
+            }
+
+            @Override
+            public void accept(T t) {
+                consumer.accept(t);
+            }
+        }
+
+        /** Implementation class for {@code IntStream} */
+        private static class OfInt extends ForEachOp<Integer>
+                implements Sink.OfInt {
+            final IntConsumer consumer;
+
+            OfInt(IntConsumer consumer, boolean ordered) {
+                super(ordered);
+                this.consumer = consumer;
+            }
+
+            @Override
+            public StreamShape inputShape() {
+                return StreamShape.INT_VALUE;
+            }
+
+            @Override
+            public void accept(int t) {
+                consumer.accept(t);
+            }
+        }
+
+        /** Implementation class for {@code LongStream} */
+        private static class OfLong extends ForEachOp<Long>
+                implements Sink.OfLong {
+            final LongConsumer consumer;
+
+            OfLong(LongConsumer consumer, boolean ordered) {
+                super(ordered);
+                this.consumer = consumer;
+            }
+
+            @Override
+            public StreamShape inputShape() {
+                return StreamShape.LONG_VALUE;
+            }
+
+            @Override
+            public void accept(long t) {
+                consumer.accept(t);
+            }
+        }
+
+        /** Implementation class for {@code DoubleStream} */
+        private static class OfDouble extends ForEachOp<Double>
+                implements Sink.OfDouble {
+            final DoubleConsumer consumer;
+
+            OfDouble(DoubleConsumer consumer, boolean ordered) {
+                super(ordered);
+                this.consumer = consumer;
+            }
+
+            @Override
+            public StreamShape inputShape() {
+                return StreamShape.DOUBLE_VALUE;
+            }
+
+            @Override
+            public void accept(double t) {
+                consumer.accept(t);
+            }
+        }
+    }
+
+    /** A {@code ForkJoinTask} for performing a parallel for-each operation */
+    private static class ForEachTask<S, T> extends CountedCompleter<Void> {
+        private Spliterator<S> spliterator;
+        private final Sink<S> sink;
+        private final PipelineHelper<T> helper;
+        private final long targetSize;
+
+        ForEachTask(PipelineHelper<T> helper,
+                    Spliterator<S> spliterator,
+                    Sink<S> sink) {
+            super(null);
+            this.spliterator = spliterator;
+            this.sink = sink;
+            this.targetSize = AbstractTask.suggestTargetSize(spliterator.estimateSize());
+            this.helper = helper;
+        }
+
+        ForEachTask(ForEachTask<S, T> parent, Spliterator<S> spliterator) {
+            super(parent);
+            this.spliterator = spliterator;
+            this.sink = parent.sink;
+            this.targetSize = parent.targetSize;
+            this.helper = parent.helper;
+        }
+
+        public void compute() {
+            boolean isShortCircuit = StreamOpFlag.SHORT_CIRCUIT.isKnown(helper.getStreamAndOpFlags());
+            while (true) {
+                if (isShortCircuit && sink.cancellationRequested()) {
+                    propagateCompletion();
+                    spliterator = null;
+                    return;
+                }
+
+                Spliterator<S> split;
+                if (!AbstractTask.suggestSplit(spliterator, targetSize)
+                    || (split = spliterator.trySplit()) == null) {
+                    helper.copyInto(sink, spliterator);
+                    propagateCompletion();
+                    spliterator = null;
+                    return;
+                }
+                else {
+                    addToPendingCount(1);
+                    new ForEachTask<>(this, split).fork();
+                }
+            }
+        }
+    }
+
+    /**
+     * A {@code ForkJoinTask} for performing a parallel for-each operation
+     * which visits the elements in encounter order
+     */
+    private static class ForEachOrderedTask<S, T> extends CountedCompleter<Void> {
+        private final PipelineHelper<T> helper;
+        private Spliterator<S> spliterator;
+        private final long targetSize;
+        private final ConcurrentHashMap<ForEachOrderedTask<S, T>, ForEachOrderedTask<S, T>> completionMap;
+        private final Sink<T> action;
+        private final Object lock;
+        private final ForEachOrderedTask<S, T> leftPredecessor;
+        private Node<T> node;
+
+        protected ForEachOrderedTask(PipelineHelper<T> helper,
+                                     Spliterator<S> spliterator,
+                                     Sink<T> action) {
+            super(null);
+            this.helper = helper;
+            this.spliterator = spliterator;
+            this.targetSize = AbstractTask.suggestTargetSize(spliterator.estimateSize());
+            this.completionMap = new ConcurrentHashMap<>();
+            this.action = action;
+            this.lock = new Object();
+            this.leftPredecessor = null;
+        }
+
+        ForEachOrderedTask(ForEachOrderedTask<S, T> parent,
+                           Spliterator<S> spliterator,
+                           ForEachOrderedTask<S, T> leftPredecessor) {
+            super(parent);
+            this.helper = parent.helper;
+            this.spliterator = spliterator;
+            this.targetSize = parent.targetSize;
+            this.completionMap = parent.completionMap;
+            this.action = parent.action;
+            this.lock = parent.lock;
+            this.leftPredecessor = leftPredecessor;
+        }
+
+        @Override
+        public final void compute() {
+            doCompute(this);
+        }
+
+        private static<S, T> void doCompute(ForEachOrderedTask<S, T> task) {
+            while (true) {
+                Spliterator<S> split;
+                if (!AbstractTask.suggestSplit(task.spliterator, task.targetSize)
+                    || (split = task.spliterator.trySplit()) == null) {
+                    if (task.getPendingCount() == 0) {
+                        task.helper.wrapAndCopyInto(task.action, task.spliterator);
+                    }
+                    else {
+                        Node.Builder<T> nb = task.helper.makeNodeBuilder(
+                                task.helper.exactOutputSizeIfKnown(task.spliterator),
+                                size -> (T[]) new Object[size]);
+                        task.node = task.helper.wrapAndCopyInto(nb, task.spliterator).build();
+                    }
+                    task.tryComplete();
+                    return;
+                }
+                else {
+                    ForEachOrderedTask<S, T> leftChild = new ForEachOrderedTask<>(task, split, task.leftPredecessor);
+                    ForEachOrderedTask<S, T> rightChild = new ForEachOrderedTask<>(task, task.spliterator, leftChild);
+                    task.completionMap.put(leftChild, rightChild);
+                    task.addToPendingCount(1); // forking
+                    rightChild.addToPendingCount(1); // right pending on left child
+                    if (task.leftPredecessor != null) {
+                        leftChild.addToPendingCount(1); // left pending on previous subtree, except left spine
+                        if (task.completionMap.replace(task.leftPredecessor, task, leftChild))
+                            task.addToPendingCount(-1);      // transfer my "right child" count to my left child
+                        else
+                            leftChild.addToPendingCount(-1); // left child is ready to go when ready
+                    }
+                    leftChild.fork();
+                    task = rightChild;
+                }
+            }
+        }
+
+        @Override
+        public void onCompletion(CountedCompleter<?> caller) {
+            spliterator = null;
+            if (node != null) {
+                // Dump any data from this leaf into the sink
+                synchronized (lock) {
+                    node.forEach(action);
+                }
+                node = null;
+            }
+            ForEachOrderedTask<S, T> victim = completionMap.remove(this);
+            if (victim != null)
+                victim.tryComplete();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/IntPipeline.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,631 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.IntSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BinaryOperator;
+import java.util.function.IntBinaryOperator;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.IntPredicate;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.ObjIntConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Abstract base class for an intermediate pipeline stage or pipeline source
+ * stage implementing whose elements are of type {@code int}.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+abstract class IntPipeline<E_IN>
+        extends AbstractPipeline<E_IN, Integer, IntStream>
+        implements IntStream {
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Supplier<Spliterator>} describing the stream source
+     * @param sourceFlags The source flags for the stream source, described in
+     *        {@link StreamOpFlag}
+     * @param parallel {@code true} if the pipeline is parallel
+     */
+    IntPipeline(Supplier<? extends Spliterator<Integer>> source,
+                int sourceFlags, boolean parallel) {
+        super(source, sourceFlags, parallel);
+    }
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Spliterator} describing the stream source
+     * @param sourceFlags The source flags for the stream source, described in
+     *        {@link StreamOpFlag}
+     * @param parallel {@code true} if the pipeline is parallel
+     */
+    IntPipeline(Spliterator<Integer> source,
+                int sourceFlags, boolean parallel) {
+        super(source, sourceFlags, parallel);
+    }
+
+    /**
+     * Constructor for appending an intermediate operation onto an existing
+     * pipeline.
+     *
+     * @param upstream the upstream element source
+     * @param opFlags the operation flags for the new operation
+     */
+    IntPipeline(AbstractPipeline<?, E_IN, ?> upstream, int opFlags) {
+        super(upstream, opFlags);
+    }
+
+    /**
+     * Adapt a {@code Sink<Integer> to an {@code IntConsumer}, ideally simply
+     * by casting.
+     */
+    private static IntConsumer adapt(Sink<Integer> sink) {
+        if (sink instanceof IntConsumer) {
+            return (IntConsumer) sink;
+        }
+        else {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(AbstractPipeline.class,
+                              "using IntStream.adapt(Sink<Integer> s)");
+            return sink::accept;
+        }
+    }
+
+    /**
+     * Adapt a {@code Spliterator<Integer>} to a {@code Spliterator.OfInt}.
+     *
+     * @implNote
+     * The implementation attempts to cast to a Spliterator.OfInt, and throws an
+     * exception if this cast is not possible.
+     */
+    private static Spliterator.OfInt adapt(Spliterator<Integer> s) {
+        if (s instanceof Spliterator.OfInt) {
+            return (Spliterator.OfInt) s;
+        }
+        else {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(AbstractPipeline.class,
+                              "using IntStream.adapt(Spliterator<Integer> s)");
+            throw new UnsupportedOperationException("IntStream.adapt(Spliterator<Integer> s)");
+        }
+    }
+
+
+    // Shape-specific methods
+
+    @Override
+    final StreamShape getOutputShape() {
+        return StreamShape.INT_VALUE;
+    }
+
+    @Override
+    final <P_IN> Node<Integer> evaluateToNode(PipelineHelper<Integer> helper,
+                                              Spliterator<P_IN> spliterator,
+                                              boolean flattenTree,
+                                              IntFunction<Integer[]> generator) {
+        return Nodes.collectInt(helper, spliterator, flattenTree);
+    }
+
+    @Override
+    final <P_IN> Spliterator<Integer> wrap(PipelineHelper<Integer> ph,
+                                           Supplier<Spliterator<P_IN>> supplier,
+                                           boolean isParallel) {
+        return new StreamSpliterators.IntWrappingSpliterator<>(ph, supplier, isParallel);
+    }
+
+    @Override
+    final Spliterator.OfInt lazySpliterator(Supplier<? extends Spliterator<Integer>> supplier) {
+        return new StreamSpliterators.DelegatingSpliterator.OfInt((Supplier<Spliterator.OfInt>) supplier);
+    }
+
+    @Override
+    final void forEachWithCancel(Spliterator<Integer> spliterator, Sink<Integer> sink) {
+        Spliterator.OfInt spl = adapt(spliterator);
+        IntConsumer adaptedSink = adapt(sink);
+        do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+    }
+
+    @Override
+    final Node.Builder<Integer> makeNodeBuilder(long exactSizeIfKnown,
+                                                IntFunction<Integer[]> generator) {
+        return Nodes.intBuilder(exactSizeIfKnown);
+    }
+
+
+    // IntStream
+
+    @Override
+    public final PrimitiveIterator.OfInt iterator() {
+        return Spliterators.iteratorFromSpliterator(spliterator());
+    }
+
+    @Override
+    public final Spliterator.OfInt spliterator() {
+        return adapt(super.spliterator());
+    }
+
+    // Stateless intermediate ops from IntStream
+
+    @Override
+    public final LongStream longs() {
+        return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+                                                     StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedInt(sink) {
+                    @Override
+                    public void accept(int t) {
+                        downstream.accept((long) t);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final DoubleStream doubles() {
+        return new DoublePipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+                                                       StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedInt(sink) {
+                    @Override
+                    public void accept(int t) {
+                        downstream.accept((double) t);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final Stream<Integer> boxed() {
+        return mapToObj(Integer::valueOf);
+    }
+
+    @Override
+    public final IntStream map(IntUnaryOperator mapper) {
+        Objects.requireNonNull(mapper);
+        return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+                                        StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedInt(sink) {
+                    @Override
+                    public void accept(int t) {
+                        downstream.accept(mapper.applyAsInt(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final <U> Stream<U> mapToObj(IntFunction<? extends U> mapper) {
+        Objects.requireNonNull(mapper);
+        return new ReferencePipeline.StatelessOp<Integer, U>(this, StreamShape.INT_VALUE,
+                                                             StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<U> sink) {
+                return new Sink.ChainedInt(sink) {
+                    @Override
+                    public void accept(int t) {
+                        downstream.accept(mapper.apply(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final LongStream mapToLong(IntToLongFunction mapper) {
+        Objects.requireNonNull(mapper);
+        return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+                                                     StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedInt(sink) {
+                    @Override
+                    public void accept(int t) {
+                        downstream.accept(mapper.applyAsLong(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final DoubleStream mapToDouble(IntToDoubleFunction mapper) {
+        Objects.requireNonNull(mapper);
+        return new DoublePipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+                                                       StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedInt(sink) {
+                    @Override
+                    public void accept(int t) {
+                        downstream.accept(mapper.applyAsDouble(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final IntStream flatMap(IntFunction<? extends IntStream> mapper) {
+        return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+                                        StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedInt(sink) {
+                    public void accept(int t) {
+                        // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+                        IntStream result = mapper.apply(t);
+                        if (result != null)
+                            result.sequential().forEach(i -> downstream.accept(i));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public IntStream unordered() {
+        if (!isOrdered())
+            return this;
+        return new StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_ORDERED) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+                return sink;
+            }
+        };
+    }
+
+    @Override
+    public final IntStream filter(IntPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+                                        StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedInt(sink) {
+                    @Override
+                    public void accept(int t) {
+                        if (predicate.test(t))
+                            downstream.accept(t);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final IntStream peek(IntConsumer consumer) {
+        Objects.requireNonNull(consumer);
+        return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
+                                        0) {
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedInt(sink) {
+                    @Override
+                    public void accept(int t) {
+                        consumer.accept(t);
+                        downstream.accept(t);
+                    }
+                };
+            }
+        };
+    }
+
+    // Stateful intermediate ops from IntStream
+
+    private IntStream slice(long skip, long limit) {
+        return SliceOps.makeInt(this, skip, limit);
+    }
+
+    @Override
+    public final IntStream limit(long maxSize) {
+        if (maxSize < 0)
+            throw new IllegalArgumentException(Long.toString(maxSize));
+        return slice(0, maxSize);
+    }
+
+    @Override
+    public final IntStream substream(long startingOffset) {
+        if (startingOffset < 0)
+            throw new IllegalArgumentException(Long.toString(startingOffset));
+        if (startingOffset == 0)
+            return this;
+        else
+            return slice(startingOffset, -1);
+    }
+
+    @Override
+    public final IntStream substream(long startingOffset, long endingOffset) {
+        if (startingOffset < 0 || endingOffset < startingOffset)
+            throw new IllegalArgumentException(String.format("substream(%d, %d)", startingOffset, endingOffset));
+        return slice(startingOffset, endingOffset - startingOffset);
+    }
+
+    @Override
+    public final IntStream sorted() {
+        return SortedOps.makeInt(this);
+    }
+
+    @Override
+    public final IntStream distinct() {
+        // While functional and quick to implement, this approach is not very efficient.
+        // An efficient version requires an int-specific map/set implementation.
+        return boxed().distinct().mapToInt(i -> i);
+    }
+
+    // Terminal ops from IntStream
+
+    @Override
+    public void forEach(IntConsumer action) {
+        evaluate(ForEachOps.makeInt(action, false));
+    }
+
+    @Override
+    public void forEachOrdered(IntConsumer action) {
+        evaluate(ForEachOps.makeInt(action, true));
+    }
+
+    @Override
+    public final int sum() {
+        return reduce(0, Integer::sum);
+    }
+
+    @Override
+    public final OptionalInt min() {
+        return reduce(Math::min);
+    }
+
+    @Override
+    public final OptionalInt max() {
+        return reduce(Math::max);
+    }
+
+    @Override
+    public final long count() {
+        return longs().map(e -> 1L).sum();
+    }
+
+    @Override
+    public final OptionalDouble average() {
+        long[] avg = collect(() -> new long[2],
+                             (ll, i) -> {
+                                 ll[0]++;
+                                 ll[1] += i;
+                             },
+                             (ll, rr) -> {
+                                 ll[0] += rr[0];
+                                 ll[1] += rr[1];
+                             });
+        return avg[0] > 0
+               ? OptionalDouble.of((double) avg[1] / avg[0])
+               : OptionalDouble.empty();
+    }
+
+    @Override
+    public final IntSummaryStatistics summaryStatistics() {
+        return collect(IntSummaryStatistics::new, IntSummaryStatistics::accept,
+                       IntSummaryStatistics::combine);
+    }
+
+    @Override
+    public final int reduce(int identity, IntBinaryOperator op) {
+        return evaluate(ReduceOps.makeInt(identity, op));
+    }
+
+    @Override
+    public final OptionalInt reduce(IntBinaryOperator op) {
+        return evaluate(ReduceOps.makeInt(op));
+    }
+
+    @Override
+    public final <R> R collect(Supplier<R> resultFactory,
+                               ObjIntConsumer<R> accumulator,
+                               BiConsumer<R, R> combiner) {
+        BinaryOperator<R> operator = (left, right) -> {
+            combiner.accept(left, right);
+            return left;
+        };
+        return evaluate(ReduceOps.makeInt(resultFactory, accumulator, operator));
+    }
+
+    @Override
+    public final boolean anyMatch(IntPredicate predicate) {
+        return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.ANY));
+    }
+
+    @Override
+    public final boolean allMatch(IntPredicate predicate) {
+        return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.ALL));
+    }
+
+    @Override
+    public final boolean noneMatch(IntPredicate predicate) {
+        return evaluate(MatchOps.makeInt(predicate, MatchOps.MatchKind.NONE));
+    }
+
+    @Override
+    public final OptionalInt findFirst() {
+        return evaluate(FindOps.makeInt(true));
+    }
+
+    @Override
+    public final OptionalInt findAny() {
+        return evaluate(FindOps.makeInt(false));
+    }
+
+    @Override
+    public final int[] toArray() {
+        return Nodes.flattenInt((Node.OfInt) evaluateToArrayNode(Integer[]::new))
+                        .asIntArray();
+    }
+
+    //
+
+    /**
+     * Source stage of an IntStream.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @since 1.8
+     */
+    static class Head<E_IN> extends IntPipeline<E_IN> {
+        /**
+         * Constructor for the source stage of an IntStream.
+         *
+         * @param source {@code Supplier<Spliterator>} describing the stream
+         *               source
+         * @param sourceFlags the source flags for the stream source, described
+         *                    in {@link StreamOpFlag}
+         * @param parallel {@code true} if the pipeline is parallel
+         */
+        Head(Supplier<? extends Spliterator<Integer>> source,
+             int sourceFlags, boolean parallel) {
+            super(source, sourceFlags, parallel);
+        }
+
+        /**
+         * Constructor for the source stage of an IntStream.
+         *
+         * @param source {@code Spliterator} describing the stream source
+         * @param sourceFlags the source flags for the stream source, described
+         *                    in {@link StreamOpFlag}
+         * @param parallel {@code true} if the pipeline is parallel
+         */
+        Head(Spliterator<Integer> source,
+             int sourceFlags, boolean parallel) {
+            super(source, sourceFlags, parallel);
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        final Sink<E_IN> opWrapSink(int flags, Sink<Integer> sink) {
+            throw new UnsupportedOperationException();
+        }
+
+        // Optimized sequential terminal operations for the head of the pipeline
+
+        @Override
+        public void forEach(IntConsumer action) {
+            if (!isParallel()) {
+                adapt(sourceStageSpliterator()).forEachRemaining(action);
+            }
+            else {
+                super.forEach(action);
+            }
+        }
+
+        @Override
+        public void forEachOrdered(IntConsumer action) {
+            if (!isParallel()) {
+                adapt(sourceStageSpliterator()).forEachRemaining(action);
+            }
+            else {
+                super.forEachOrdered(action);
+            }
+        }
+    }
+
+    /**
+     * Base class for a stateless intermediate stage of an IntStream
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @since 1.8
+     */
+    abstract static class StatelessOp<E_IN> extends IntPipeline<E_IN> {
+        /**
+         * Construct a new IntStream by appending a stateless intermediate
+         * operation to an existing stream.
+         * @param upstream The upstream pipeline stage
+         * @param inputShape The stream shape for the upstream pipeline stage
+         * @param opFlags Operation flags for the new stage
+         */
+        StatelessOp(AbstractPipeline<?, E_IN, ?> upstream,
+                    StreamShape inputShape,
+                    int opFlags) {
+            super(upstream, opFlags);
+            assert upstream.getOutputShape() == inputShape;
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            return false;
+        }
+    }
+
+    /**
+     * Base class for a stateful intermediate stage of an IntStream.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @since 1.8
+     */
+    abstract static class StatefulOp<E_IN> extends IntPipeline<E_IN> {
+        /**
+         * Construct a new IntStream by appending a stateful intermediate
+         * operation to an existing stream.
+         * @param upstream The upstream pipeline stage
+         * @param inputShape The stream shape for the upstream pipeline stage
+         * @param opFlags Operation flags for the new stage
+         */
+        StatefulOp(AbstractPipeline<?, E_IN, ?> upstream,
+                   StreamShape inputShape,
+                   int opFlags) {
+            super(upstream, opFlags);
+            assert upstream.getOutputShape() == inputShape;
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            return true;
+        }
+
+        @Override
+        abstract <P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
+                                                         Spliterator<P_IN> spliterator,
+                                                         IntFunction<Integer[]> generator);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/IntStream.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,808 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Arrays;
+import java.util.IntSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.IntBinaryOperator;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.IntPredicate;
+import java.util.function.IntSupplier;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.ObjIntConsumer;
+import java.util.function.Supplier;
+
+/**
+ * A sequence of primitive integer elements supporting sequential and parallel
+ * bulk operations. Streams support lazy intermediate operations (transforming
+ * a stream to another stream) such as {@code filter} and {@code map}, and terminal
+ * operations (consuming the contents of a stream to produce a result or
+ * side-effect), such as {@code forEach}, {@code findFirst}, and {@code
+ * iterator}.  Once an operation has been performed on a stream, it
+ * is considered <em>consumed</em> and no longer usable for other operations.
+ *
+ * <p>For sequential stream pipelines, all operations are performed in the
+ * <a href="package-summary.html#Ordering">encounter order</a> of the pipeline
+ * source, if the pipeline source has a defined encounter order.
+ *
+ * <p>For parallel stream pipelines, unless otherwise specified, intermediate
+ * stream operations preserve the <a href="package-summary.html#Ordering">
+ * encounter order</a> of their source, and terminal operations
+ * respect the encounter order of their source, if the source
+ * has an encounter order.  Provided that and parameters to stream operations
+ * satisfy the <a href="package-summary.html#NonInterference">non-interference
+ * requirements</a>, and excepting differences arising from the absence of
+ * a defined encounter order, the result of a stream pipeline should be the
+ * stable across multiple executions of the same operations on the same source.
+ * However, the timing and thread in which side-effects occur (for those
+ * operations which are allowed to produce side-effects, such as
+ * {@link #forEach(IntConsumer)}), are explicitly nondeterministic for parallel
+ * execution of stream pipelines.
+ *
+ * <p>Unless otherwise noted, passing a {@code null} argument to any stream
+ * method may result in a {@link NullPointerException}.
+ *
+ * @apiNote
+ * Streams are not data structures; they do not manage the storage for their
+ * elements, nor do they support access to individual elements.  However,
+ * you can use the {@link #iterator()} or {@link #spliterator()} operations to
+ * perform a controlled traversal.
+ *
+ * @since 1.8
+ * @see <a href="package-summary.html">java.util.stream</a>
+ */
+public interface IntStream extends BaseStream<Integer, IntStream> {
+
+    /**
+     * Returns a stream consisting of the elements of this stream that match
+     * the given predicate.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">
+     *                  non-interfering, stateless</a> predicate to apply to
+     *                  each element to determine if it should be included
+     * @return the new stream
+     */
+    IntStream filter(IntPredicate predicate);
+
+    /**
+     * Returns a stream consisting of the results of applying the given
+     * function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    IntStream map(IntUnaryOperator mapper);
+
+    /**
+     * Returns an object-valued {@code Stream} consisting of the results of
+     * applying the given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">
+     *     intermediate operation</a>.
+     *
+     * @param <U> the element type of the new stream
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    <U> Stream<U> mapToObj(IntFunction<? extends U> mapper);
+
+    /**
+     * Returns a {@code LongStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    LongStream mapToLong(IntToLongFunction mapper);
+
+    /**
+     * Returns a {@code DoubleStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    DoubleStream mapToDouble(IntToDoubleFunction mapper);
+
+    /**
+     * Returns a stream consisting of the results of replacing each element of
+     * this stream with the contents of the stream produced by applying the
+     * provided mapping function to each element.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @apiNote
+     * The {@code flatMap()} operation has the effect of applying a one-to-many
+     * tranformation to the elements of the stream, and then flattening the
+     * resulting elements into a new stream. For example, if {@code orders}
+     * is a stream of purchase orders, and each purchase order contains a
+     * collection of line items, then the following produces a stream of line
+     * items:
+     * <pre>{@code
+     *     orderStream.flatMap(order -> order.getLineItems().stream())...
+     * }</pre>
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to
+     *               each element which produces an {@code IntStream} of new
+     *               values
+     * @return the new stream
+     * @see Stream#flatMap(Function)
+     */
+    IntStream flatMap(IntFunction<? extends IntStream> mapper);
+
+    /**
+     * Returns a stream consisting of the distinct elements of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @return the new stream
+     */
+    IntStream distinct();
+
+    /**
+     * Returns a stream consisting of the elements of this stream in sorted
+     * order.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @return the new stream
+     */
+    IntStream sorted();
+
+    /**
+     * Returns a stream consisting of the elements of this stream, additionally
+     * performing the provided action on each element as elements are consumed
+     * from the resulting stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * <p>For parallel stream pipelines, the action may be called at
+     * whatever time and in whatever thread the element is made available by the
+     * upstream operation.  If the action modifies shared state,
+     * it is responsible for providing the required synchronization.
+     *
+     * @apiNote This method exists mainly to support debugging, where you want
+     * to see the elements as they flow past a certain point in a pipeline:
+     * <pre>{@code
+     *     list.stream()
+     *         .filter(filteringFunction)
+     *         .peek(e -> {System.out.println("Filtered value: " + e); });
+     *         .map(mappingFunction)
+     *         .peek(e -> {System.out.println("Mapped value: " + e); });
+     *         .collect(Collectors.toIntSummaryStastistics());
+     * }</pre>
+     *
+     * @param consumer a <a href="package-summary.html#NonInterference">
+     *                 non-interfering</a> action to perform on the elements as
+     *                 they are consumed from the stream
+     * @return the new stream
+     */
+    IntStream peek(IntConsumer consumer);
+
+    /**
+     * Returns a stream consisting of the elements of this stream, truncated
+     * to be no longer than {@code maxSize} in length.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @param maxSize the number of elements the stream should be limited to
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code maxSize} is negative
+     */
+    IntStream limit(long maxSize);
+
+    /**
+     * Returns a stream consisting of the remaining elements of this stream
+     * after indexing {@code startInclusive} elements into the stream. If the
+     * {@code startInclusive} index lies past the end of this stream then an
+     * empty stream will be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @param startInclusive the number of leading elements to skip
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code startInclusive} is negative
+     */
+    IntStream substream(long startInclusive);
+
+    /**
+     * Returns a stream consisting of the remaining elements of this stream
+     * after indexing {@code startInclusive} elements into the stream and
+     * truncated to contain no more than {@code endExclusive - startInclusive}
+     * elements. If the {@code startInclusive} index lies past the end
+     * of this stream then an empty stream will be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @param startInclusive the starting position of the substream, inclusive
+     * @param endExclusive the ending position of the substream, exclusive
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code startInclusive} or
+     * {@code endExclusive} is negative or {@code startInclusive} is greater
+     * than {@code endExclusive}
+     */
+    IntStream substream(long startInclusive, long endExclusive);
+
+    /**
+     * Performs an action for each element of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * <p>For parallel stream pipelines, this operation does <em>not</em>
+     * guarantee to respect the encounter order of the stream, as doing so
+     * would sacrifice the benefit of parallelism.  For any given element, the
+     * action may be performed at whatever time and in whatever thread the
+     * library chooses.  If the action accesses shared state, it is
+     * responsible for providing the required synchronization.
+     *
+     * @param action a <a href="package-summary.html#NonInterference">
+     *               non-interfering</a> action to perform on the elements
+     */
+    void forEach(IntConsumer action);
+
+    /**
+     * Performs an action for each element of this stream, guaranteeing that
+     * each element is processed in encounter order for streams that have a
+     * defined encounter order.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param action a <a href="package-summary.html#NonInterference">
+     *               non-interfering</a> action to perform on the elements
+     * @see #forEach(IntConsumer)
+     */
+    void forEachOrdered(IntConsumer action);
+
+    /**
+     * Returns an array containing the elements of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @return an array containing the elements of this stream
+     */
+    int[] toArray();
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using the provided identity value and an
+     * <a href="package-summary.html#Associativity">associative</a>
+     * accumulation function, and returns the reduced value.  This is equivalent
+     * to:
+     * <pre>{@code
+     *     int result = identity;
+     *     for (int element : this stream)
+     *         result = accumulator.apply(result, element)
+     *     return result;
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code identity} value must be an identity for the accumulator
+     * function. This means that for all {@code x},
+     * {@code accumulator.apply(identity, x)} is equal to {@code x}.
+     * The {@code accumulator} function must be an
+     * <a href="package-summary.html#Associativity">associative</a> function.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @apiNote Sum, min, max, and average are all special cases of reduction.
+     * Summing a stream of numbers can be expressed as:
+     *
+     * <pre>{@code
+     *     int sum = integers.reduce(0, (a, b) -> a+b);
+     * }</pre>
+     *
+     * or more compactly:
+     *
+     * <pre>{@code
+     *     int sum = integers.reduce(0, Integer::sum);
+     * }</pre>
+     *
+     * <p>While this may seem a more roundabout way to perform an aggregation
+     * compared to simply mutating a running total in a loop, reduction
+     * operations parallelize more gracefully, without needing additional
+     * synchronization and with greatly reduced risk of data races.
+     *
+     * @param identity the identity value for the accumulating function
+     * @param op an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for combining two values
+     * @return the result of the reduction
+     * @see #sum()
+     * @see #min()
+     * @see #max()
+     * @see #average()
+     */
+    int reduce(int identity, IntBinaryOperator op);
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using an
+     * <a href="package-summary.html#Associativity">associative</a> accumulation
+     * function, and returns an {@code OptionalInt} describing the reduced value,
+     * if any. This is equivalent to:
+     * <pre>{@code
+     *     boolean foundAny = false;
+     *     int result = null;
+     *     for (int element : this stream) {
+     *         if (!foundAny) {
+     *             foundAny = true;
+     *             result = element;
+     *         }
+     *         else
+     *             result = accumulator.apply(result, element);
+     *     }
+     *     return foundAny ? OptionalInt.of(result) : OptionalInt.empty();
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code accumulator} function must be an
+     * <a href="package-summary.html#Associativity">associative</a> function.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param op an <a href="package-summary.html#Associativity">associative</a>
+     *           <a href="package-summary.html#NonInterference">non-interfering,
+     *           stateless</a> function for combining two values
+     * @return the result of the reduction
+     * @see #reduce(int, IntBinaryOperator)
+     */
+    OptionalInt reduce(IntBinaryOperator op);
+
+    /**
+     * Performs a <a href="package-summary.html#MutableReduction">mutable
+     * reduction</a> operation on the elements of this stream.  A mutable
+     * reduction is one in which the reduced value is a mutable value holder,
+     * such as an {@code ArrayList}, and elements are incorporated by updating
+     * the state of the result, rather than by replacing the result.  This
+     * produces a result equivalent to:
+     * <pre>{@code
+     *     R result = resultFactory.get();
+     *     for (int element : this stream)
+     *         accumulator.accept(result, element);
+     *     return result;
+     * }</pre>
+     *
+     * <p>Like {@link #reduce(int, IntBinaryOperator)}, {@code collect} operations
+     * can be parallelized without requiring additional synchronization.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param <R> type of the result
+     * @param resultFactory a function that creates a new result container.
+     *                      For a parallel execution, this function may be
+     *                      called multiple times and must return a fresh value
+     *                      each time.
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for incorporating an additional
+     *                    element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+     *                 <a href="package-summary.html#NonInterference">non-interfering,
+     *                 stateless</a> function for combining two values, which
+     *                 must be compatible with the accumulator function
+     * @return the result of the reduction
+     * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
+     */
+    <R> R collect(Supplier<R> resultFactory,
+                  ObjIntConsumer<R> accumulator,
+                  BiConsumer<R, R> combiner);
+
+    /**
+     * Returns the sum of elements in this stream.  This is a special case
+     * of a <a href="package-summary.html#MutableReduction">reduction</a>
+     * and is equivalent to:
+     * <pre>{@code
+     *     return reduce(0, Integer::sum);
+     * }</pre>
+     *
+     * @return the sum of elements in this stream
+     */
+    int sum();
+
+    /**
+     * Returns an {@code OptionalInt} describing the minimum element of this
+     * stream, or an empty optional if this stream is empty.  This is a special
+     * case of a <a href="package-summary.html#MutableReduction">reduction</a>
+     * and is equivalent to:
+     * <pre>{@code
+     *     return reduce(Integer::min);
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+     *
+
+     * @return an {@code OptionalInt} containing the minimum element of this
+     * stream, or an empty {@code OptionalInt} if the stream is empty
+     */
+    OptionalInt min();
+
+    /**
+     * Returns an {@code OptionalInt} describing the maximum element of this
+     * stream, or an empty optional if this stream is empty.  This is a special
+     * case of a <a href="package-summary.html#MutableReduction">reduction</a>
+     * and is equivalent to:
+     * <pre>{@code
+     *     return reduce(Integer::max);
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @return an {@code OptionalInt} containing the maximum element of this
+     * stream, or an empty {@code OptionalInt} if the stream is empty
+     */
+    OptionalInt max();
+
+    /**
+     * Returns the count of elements in this stream.  This is a special case of
+     * a <a href="package-summary.html#MutableReduction">reduction</a> and is
+     * equivalent to:
+     * <pre>{@code
+     *     return mapToLong(e -> 1L).sum();
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+     *
+     * @return the count of elements in this stream
+     */
+    long count();
+
+    /**
+     * Returns an {@code OptionalDouble} describing the average of elements of
+     * this stream, or an empty optional if this stream is empty.  This is a
+     * special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a>.
+     *
+     * @return an {@code OptionalDouble} containing the average element of this
+     * stream, or an empty optional if the stream is empty
+     */
+    OptionalDouble average();
+
+    /**
+     * Returns an {@code IntSummaryStatistics} describing various
+     * summary data about the elements of this stream.  This is a special
+     * case of a <a href="package-summary.html#MutableReduction">reduction</a>.
+     *
+     * @return an {@code IntSummaryStatistics} describing various summary data
+     * about the elements of this stream
+     */
+    IntSummaryStatistics summaryStatistics();
+
+    /**
+     * Returns whether any elements of this stream match the provided
+     * predicate.  May not evaluate the predicate on all elements if not
+     * necessary for determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if any elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean anyMatch(IntPredicate predicate);
+
+    /**
+     * Returns whether all elements of this stream match the provided predicate.
+     * May not evaluate the predicate on all elements if not necessary for
+     * determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if all elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean allMatch(IntPredicate predicate);
+
+    /**
+     * Returns whether no elements of this stream match the provided predicate.
+     * May not evaluate the predicate on all elements if not necessary for
+     * determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if no elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean noneMatch(IntPredicate predicate);
+
+    /**
+     * Returns an {@link OptionalInt} describing the first element of this
+     * stream (in the encounter order), or an empty {@code OptionalInt} if the
+     * stream is empty.  If the stream has no encounter order, than any element
+     * may be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @return an {@code OptionalInt} describing the first element of this stream,
+     * or an empty {@code OptionalInt} if the stream is empty
+     */
+    OptionalInt findFirst();
+
+    /**
+     * Returns an {@link OptionalInt} describing some element of the stream, or
+     * an empty {@code OptionalInt} if the stream is empty.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * <p>The behavior of this operation is explicitly nondeterministic; it is
+     * free to select any element in the stream.  This is to allow for maximal
+     * performance in parallel operations; the cost is that multiple invocations
+     * on the same source may not return the same result.  (If the first element
+     * in the encounter order is desired, use {@link #findFirst()} instead.)
+     *
+     * @return an {@code OptionalInt} describing some element of this stream, or
+     * an empty {@code OptionalInt} if the stream is empty
+     * @see #findFirst()
+     */
+    OptionalInt findAny();
+
+    /**
+     * Returns a {@code LongStream} consisting of the elements of this stream,
+     * converted to {@code long}.
+     *
+     * @return a {@code LongStream} consisting of the elements of this stream,
+     * converted to {@code long}
+     */
+    LongStream longs();
+
+    /**
+     * Returns a {@code DoubleStream} consisting of the elements of this stream,
+     * converted to {@code double}.
+     *
+     * @return a {@code DoubleStream} consisting of the elements of this stream,
+     * converted to {@code double}
+     */
+    DoubleStream doubles();
+
+    /**
+     * Returns a {@code Stream} consisting of the elements of this stream,
+     * each boxed to an {@code Integer}.
+     *
+     * @return a {@code Stream} consistent of the elements of this stream,
+     * each boxed to an {@code Integer}
+     */
+    Stream<Integer> boxed();
+
+    @Override
+    IntStream sequential();
+
+    @Override
+    IntStream parallel();
+
+    @Override
+    PrimitiveIterator.OfInt iterator();
+
+    @Override
+    Spliterator.OfInt spliterator();
+
+    // Static factories
+
+    /**
+     * Returns a builder for an {@code IntStream}.
+     *
+     * @return a stream builder
+     */
+    public static StreamBuilder.OfInt builder() {
+        return new Streams.IntStreamBuilderImpl();
+    }
+
+    /**
+     * Returns an empty sequential {@code IntStream}.
+     *
+     * @return an empty sequential stream
+     */
+    public static IntStream empty() {
+        return StreamSupport.intStream(Spliterators.emptyIntSpliterator());
+    }
+
+    /**
+     * Returns a sequential {@code IntStream} containing a single element.
+     *
+     * @param t the single element
+     * @return a singleton sequential stream
+     */
+    public static IntStream of(int t) {
+        return StreamSupport.intStream(new Streams.IntStreamBuilderImpl(t));
+    }
+
+    /**
+     * Returns a sequential stream whose elements are the specified values.
+     *
+     * @param values the elements of the new stream
+     * @return the new stream
+     */
+    public static IntStream of(int... values) {
+        return Arrays.stream(values);
+    }
+
+    /**
+     * Returns an infinite sequential {@code IntStream} produced by iterative
+     * application of a function {@code f} to an initial element {@code seed},
+     * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
+     * {@code f(f(seed))}, etc.
+     *
+     * <p>The first element (position {@code 0}) in the {@code IntStream} will be
+     * the provided {@code seed}.  For {@code n > 0}, the element at position
+     * {@code n}, will be the result of applying the function {@code f} to the
+     * element at position {@code n - 1}.
+     *
+     * @param seed the initial element
+     * @param f a function to be applied to to the previous element to produce
+     *          a new element
+     * @return A new sequential {@code IntStream}
+     */
+    public static IntStream iterate(final int seed, final IntUnaryOperator f) {
+        Objects.requireNonNull(f);
+        final PrimitiveIterator.OfInt iterator = new PrimitiveIterator.OfInt() {
+            int t = seed;
+
+            @Override
+            public boolean hasNext() {
+                return true;
+            }
+
+            @Override
+            public int nextInt() {
+                int v = t;
+                t = f.applyAsInt(t);
+                return v;
+            }
+        };
+        return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(
+                iterator,
+                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+    }
+
+    /**
+     * Returns a sequential {@code IntStream} where each element is
+     * generated by an {@code IntSupplier}.  This is suitable for generating
+     * constant streams, streams of random elements, etc.
+     *
+     * @param s the {@code IntSupplier} for generated elements
+     * @return a new sequential {@code IntStream}
+     */
+    public static IntStream generate(IntSupplier s) {
+        Objects.requireNonNull(s);
+        return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(
+                new PrimitiveIterator.OfInt() {
+                    @Override
+                    public boolean hasNext() { return true; }
+
+                    @Override
+                    public int nextInt() { return s.getAsInt(); }
+                },
+                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+    }
+
+    /**
+     * Returns a sequential {@code IntStream} from {@code startInclusive}
+     * (inclusive) to {@code endExclusive} (exclusive) by an incremental step of
+     * 1.
+     *
+     * @implSpec
+     * The implementation behaves as if:
+     * <pre>{@code
+     *     intRange(startInclusive, endExclusive, 1);
+     * }</pre>
+     *
+     * @param startInclusive the (inclusive) initial value
+     * @param endExclusive the exclusive upper bound
+     * @return a sequential {@code IntStream} for the range of {@code int}
+     *         elements
+     */
+    public static IntStream range(int startInclusive, int endExclusive) {
+        return range(startInclusive, endExclusive, 1);
+    }
+
+    /**
+     * Returns a sequential {@code IntStream} from {@code startInclusive}
+     * (inclusive) to {@code endExclusive} (exclusive) by a positive {@code
+     * step}.  If {@code startInclusive} is greater than or equal to {@code
+     * endExclusive}, an empty stream is returned.
+     *
+     * <p>An equivalent sequence of increasing values can be produced
+     * sequentially using a {@code for} loop as follows:
+     * <pre>{@code
+     *     for (int i = startInclusive; i < endExclusive ; i += step) { ... }
+     * }</pre>
+     *
+     * @param startInclusive the (inclusive) initial value
+     * @param endExclusive the exclusive upper bound
+     * @param step the positive difference between consecutive values
+     * @return a sequential {@code IntStream} for the range of {@code int}
+     *         elements
+     * @throws IllegalArgumentException if {@code step} is less than or equal to
+     *                                  0
+     */
+    public static IntStream range(int startInclusive, int endExclusive, int step) {
+        if (step <= 0) {
+            throw new IllegalArgumentException(String.format("Illegal step: %d", step));
+        } else if (startInclusive >= endExclusive) {
+            return empty();
+        } else {
+            return StreamSupport.intStream(new Streams.RangeIntSpliterator(startInclusive, endExclusive, step));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/LongPipeline.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,610 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.LongSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.OptionalLong;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BinaryOperator;
+import java.util.function.IntFunction;
+import java.util.function.LongBinaryOperator;
+import java.util.function.LongConsumer;
+import java.util.function.LongFunction;
+import java.util.function.LongPredicate;
+import java.util.function.LongToDoubleFunction;
+import java.util.function.LongToIntFunction;
+import java.util.function.LongUnaryOperator;
+import java.util.function.ObjLongConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Abstract base class for an intermediate pipeline stage or pipeline source
+ * stage implementing whose elements are of type {@code long}.
+ *
+ * @param <E_IN> type of elements in the upstream source
+ * @since 1.8
+ */
+abstract class LongPipeline<E_IN>
+        extends AbstractPipeline<E_IN, Long, LongStream>
+        implements LongStream {
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Supplier<Spliterator>} describing the stream source
+     * @param sourceFlags the source flags for the stream source, described in
+     *        {@link StreamOpFlag}
+     * @param parallel {@code true} if the pipeline is parallel
+     */
+    LongPipeline(Supplier<? extends Spliterator<Long>> source,
+                 int sourceFlags, boolean parallel) {
+        super(source, sourceFlags, parallel);
+    }
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Spliterator} describing the stream source
+     * @param sourceFlags the source flags for the stream source, described in
+     *        {@link StreamOpFlag}
+     * @param parallel {@code true} if the pipeline is parallel
+     */
+    LongPipeline(Spliterator<Long> source,
+                 int sourceFlags, boolean parallel) {
+        super(source, sourceFlags, parallel);
+    }
+
+    /**
+     * Constructor for appending an intermediate operation onto an existing pipeline.
+     *
+     * @param upstream the upstream element source.
+     * @param opFlags the operation flags
+     */
+    LongPipeline(AbstractPipeline<?, E_IN, ?> upstream, int opFlags) {
+        super(upstream, opFlags);
+    }
+
+    /**
+     * Adapt a {@code Sink<Long> to an {@code LongConsumer}, ideally simply
+     * by casting.
+     */
+    private static LongConsumer adapt(Sink<Long> sink) {
+        if (sink instanceof LongConsumer) {
+            return (LongConsumer) sink;
+        } else {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(AbstractPipeline.class,
+                              "using LongStream.adapt(Sink<Long> s)");
+            return sink::accept;
+        }
+    }
+
+    /**
+     * Adapt a {@code Spliterator<Long>} to a {@code Spliterator.OfLong}.
+     *
+     * @implNote
+     * The implementation attempts to cast to a Spliterator.OfLong, and throws
+     * an exception if this cast is not possible.
+     */
+    private static Spliterator.OfLong adapt(Spliterator<Long> s) {
+        if (s instanceof Spliterator.OfLong) {
+            return (Spliterator.OfLong) s;
+        } else {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(AbstractPipeline.class,
+                              "using LongStream.adapt(Spliterator<Long> s)");
+            throw new UnsupportedOperationException("LongStream.adapt(Spliterator<Long> s)");
+        }
+    }
+
+
+    // Shape-specific methods
+
+    @Override
+    final StreamShape getOutputShape() {
+        return StreamShape.LONG_VALUE;
+    }
+
+    @Override
+    final <P_IN> Node<Long> evaluateToNode(PipelineHelper<Long> helper,
+                                           Spliterator<P_IN> spliterator,
+                                           boolean flattenTree,
+                                           IntFunction<Long[]> generator) {
+        return Nodes.collectLong(helper, spliterator, flattenTree);
+    }
+
+    @Override
+    final <P_IN> Spliterator<Long> wrap(PipelineHelper<Long> ph,
+                                        Supplier<Spliterator<P_IN>> supplier,
+                                        boolean isParallel) {
+        return new StreamSpliterators.LongWrappingSpliterator<>(ph, supplier, isParallel);
+    }
+
+    @Override
+    final Spliterator.OfLong lazySpliterator(Supplier<? extends Spliterator<Long>> supplier) {
+        return new StreamSpliterators.DelegatingSpliterator.OfLong((Supplier<Spliterator.OfLong>) supplier);
+    }
+
+    @Override
+    final void forEachWithCancel(Spliterator<Long> spliterator, Sink<Long> sink) {
+        Spliterator.OfLong spl = adapt(spliterator);
+        LongConsumer adaptedSink =  adapt(sink);
+        do { } while (!sink.cancellationRequested() && spl.tryAdvance(adaptedSink));
+    }
+
+    @Override
+    final Node.Builder<Long> makeNodeBuilder(long exactSizeIfKnown, IntFunction<Long[]> generator) {
+        return Nodes.longBuilder(exactSizeIfKnown);
+    }
+
+
+    // LongStream
+
+    @Override
+    public final PrimitiveIterator.OfLong iterator() {
+        return Spliterators.iteratorFromSpliterator(spliterator());
+    }
+
+    @Override
+    public final Spliterator.OfLong spliterator() {
+        return adapt(super.spliterator());
+    }
+
+    // Stateless intermediate ops from LongStream
+
+    @Override
+    public final DoubleStream doubles() {
+        return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+                                                    StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedLong(sink) {
+                    @Override
+                    public void accept(long t) {
+                        downstream.accept((double) t);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final Stream<Long> boxed() {
+        return mapToObj(Long::valueOf);
+    }
+
+    @Override
+    public final LongStream map(LongUnaryOperator mapper) {
+        Objects.requireNonNull(mapper);
+        return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+                                     StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedLong(sink) {
+                    @Override
+                    public void accept(long t) {
+                        downstream.accept(mapper.applyAsLong(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final <U> Stream<U> mapToObj(LongFunction<? extends U> mapper) {
+        Objects.requireNonNull(mapper);
+        return new ReferencePipeline.StatelessOp<Long, U>(this, StreamShape.LONG_VALUE,
+                                                          StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<U> sink) {
+                return new Sink.ChainedLong(sink) {
+                    @Override
+                    public void accept(long t) {
+                        downstream.accept(mapper.apply(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final IntStream mapToInt(LongToIntFunction mapper) {
+        Objects.requireNonNull(mapper);
+        return new IntPipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+                                                 StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedLong(sink) {
+                    @Override
+                    public void accept(long t) {
+                        downstream.accept(mapper.applyAsInt(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
+        Objects.requireNonNull(mapper);
+        return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+                                                    StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedLong(sink) {
+                    @Override
+                    public void accept(long t) {
+                        downstream.accept(mapper.applyAsDouble(t));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final LongStream flatMap(LongFunction<? extends LongStream> mapper) {
+        return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+                                     StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedLong(sink) {
+                    public void accept(long t) {
+                        // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+                        LongStream result = mapper.apply(t);
+                        if (result != null)
+                            result.sequential().forEach(i -> downstream.accept(i));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public LongStream unordered() {
+        if (!isOrdered())
+            return this;
+        return new StatelessOp<Long>(this, StreamShape.LONG_VALUE, StreamOpFlag.NOT_ORDERED) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+                return sink;
+            }
+        };
+    }
+
+    @Override
+    public final LongStream filter(LongPredicate predicate) {
+        Objects.requireNonNull(predicate);
+        return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+                                     StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedLong(sink) {
+                    @Override
+                    public void accept(long t) {
+                        if (predicate.test(t))
+                            downstream.accept(t);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final LongStream peek(LongConsumer consumer) {
+        Objects.requireNonNull(consumer);
+        return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
+                                     0) {
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedLong(sink) {
+                    @Override
+                    public void accept(long t) {
+                        consumer.accept(t);
+                        downstream.accept(t);
+                    }
+                };
+            }
+        };
+    }
+
+    // Stateful intermediate ops from LongStream
+
+    private LongStream slice(long skip, long limit) {
+        return SliceOps.makeLong(this, skip, limit);
+    }
+
+    @Override
+    public final LongStream limit(long maxSize) {
+        if (maxSize < 0)
+            throw new IllegalArgumentException(Long.toString(maxSize));
+        return slice(0, maxSize);
+    }
+
+    @Override
+    public final LongStream substream(long startingOffset) {
+        if (startingOffset < 0)
+            throw new IllegalArgumentException(Long.toString(startingOffset));
+        if (startingOffset == 0)
+            return this;
+        else
+            return slice(startingOffset, -1);
+    }
+
+    @Override
+    public final LongStream substream(long startingOffset, long endingOffset) {
+        if (startingOffset < 0 || endingOffset < startingOffset)
+            throw new IllegalArgumentException(String.format("substream(%d, %d)", startingOffset, endingOffset));
+        return slice(startingOffset, endingOffset - startingOffset);
+    }
+
+    @Override
+    public final LongStream sorted() {
+        return SortedOps.makeLong(this);
+    }
+
+    @Override
+    public final LongStream distinct() {
+        // While functional and quick to implement, this approach is not very efficient.
+        // An efficient version requires a long-specific map/set implementation.
+        return boxed().distinct().mapToLong(i -> (long) i);
+    }
+
+    // Terminal ops from LongStream
+
+    @Override
+    public void forEach(LongConsumer action) {
+        evaluate(ForEachOps.makeLong(action, false));
+    }
+
+    @Override
+    public void forEachOrdered(LongConsumer action) {
+        evaluate(ForEachOps.makeLong(action, true));
+    }
+
+    @Override
+    public final long sum() {
+        // use better algorithm to compensate for intermediate overflow?
+        return reduce(0, Long::sum);
+    }
+
+    @Override
+    public final OptionalLong min() {
+        return reduce(Math::min);
+    }
+
+    @Override
+    public final OptionalLong max() {
+        return reduce(Math::max);
+    }
+
+    @Override
+    public final OptionalDouble average() {
+        long[] avg = collect(() -> new long[2],
+                             (ll, i) -> {
+                                 ll[0]++;
+                                 ll[1] += i;
+                             },
+                             (ll, rr) -> {
+                                 ll[0] += rr[0];
+                                 ll[1] += rr[1];
+                             });
+        return avg[0] > 0
+               ? OptionalDouble.of((double) avg[1] / avg[0])
+               : OptionalDouble.empty();
+    }
+
+    @Override
+    public final long count() {
+        return map(e -> 1L).sum();
+    }
+
+    @Override
+    public final LongSummaryStatistics summaryStatistics() {
+        return collect(LongSummaryStatistics::new, LongSummaryStatistics::accept,
+                       LongSummaryStatistics::combine);
+    }
+
+    @Override
+    public final long reduce(long identity, LongBinaryOperator op) {
+        return evaluate(ReduceOps.makeLong(identity, op));
+    }
+
+    @Override
+    public final OptionalLong reduce(LongBinaryOperator op) {
+        return evaluate(ReduceOps.makeLong(op));
+    }
+
+    @Override
+    public final <R> R collect(Supplier<R> resultFactory,
+                               ObjLongConsumer<R> accumulator,
+                               BiConsumer<R, R> combiner) {
+        BinaryOperator<R> operator = (left, right) -> {
+            combiner.accept(left, right);
+            return left;
+        };
+        return evaluate(ReduceOps.makeLong(resultFactory, accumulator, operator));
+    }
+
+    @Override
+    public final boolean anyMatch(LongPredicate predicate) {
+        return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.ANY));
+    }
+
+    @Override
+    public final boolean allMatch(LongPredicate predicate) {
+        return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.ALL));
+    }
+
+    @Override
+    public final boolean noneMatch(LongPredicate predicate) {
+        return evaluate(MatchOps.makeLong(predicate, MatchOps.MatchKind.NONE));
+    }
+
+    @Override
+    public final OptionalLong findFirst() {
+        return evaluate(FindOps.makeLong(true));
+    }
+
+    @Override
+    public final OptionalLong findAny() {
+        return evaluate(FindOps.makeLong(false));
+    }
+
+    @Override
+    public final long[] toArray() {
+        return Nodes.flattenLong((Node.OfLong) evaluateToArrayNode(Long[]::new)).asLongArray();
+    }
+
+
+    //
+
+    /**
+     * Source stage of a LongPipeline.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @since 1.8
+     */
+    static class Head<E_IN> extends LongPipeline<E_IN> {
+        /**
+         * Constructor for the source stage of a LongStream.
+         *
+         * @param source {@code Supplier<Spliterator>} describing the stream
+         *               source
+         * @param sourceFlags the source flags for the stream source, described
+         *                    in {@link StreamOpFlag}
+         * @param parallel {@code true} if the pipeline is parallel
+         */
+        Head(Supplier<? extends Spliterator<Long>> source,
+             int sourceFlags, boolean parallel) {
+            super(source, sourceFlags, parallel);
+        }
+
+        /**
+         * Constructor for the source stage of a LongStream.
+         *
+         * @param source {@code Spliterator} describing the stream source
+         * @param sourceFlags the source flags for the stream source, described
+         *                    in {@link StreamOpFlag}
+         * @param parallel {@code true} if the pipeline is parallel
+         */
+        Head(Spliterator<Long> source,
+             int sourceFlags, boolean parallel) {
+            super(source, sourceFlags, parallel);
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        final Sink<E_IN> opWrapSink(int flags, Sink<Long> sink) {
+            throw new UnsupportedOperationException();
+        }
+
+        // Optimized sequential terminal operations for the head of the pipeline
+
+        @Override
+        public void forEach(LongConsumer action) {
+            if (!isParallel()) {
+                adapt(sourceStageSpliterator()).forEachRemaining(action);
+            } else {
+                super.forEach(action);
+            }
+        }
+
+        @Override
+        public void forEachOrdered(LongConsumer action) {
+            if (!isParallel()) {
+                adapt(sourceStageSpliterator()).forEachRemaining(action);
+            } else {
+                super.forEachOrdered(action);
+            }
+        }
+    }
+
+    /** Base class for a stateless intermediate stage of a LongStream.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @since 1.8
+     */
+    abstract static class StatelessOp<E_IN> extends LongPipeline<E_IN> {
+        /**
+         * Construct a new LongStream by appending a stateless intermediate
+         * operation to an existing stream.
+         * @param upstream The upstream pipeline stage
+         * @param inputShape The stream shape for the upstream pipeline stage
+         * @param opFlags Operation flags for the new stage
+         */
+        StatelessOp(AbstractPipeline<?, E_IN, ?> upstream,
+                    StreamShape inputShape,
+                    int opFlags) {
+            super(upstream, opFlags);
+            assert upstream.getOutputShape() == inputShape;
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            return false;
+        }
+    }
+
+    /**
+     * Base class for a stateful intermediate stage of a LongStream.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @since 1.8
+     */
+    abstract static class StatefulOp<E_IN> extends LongPipeline<E_IN> {
+        /**
+         * Construct a new LongStream by appending a stateful intermediate
+         * operation to an existing stream.
+         * @param upstream The upstream pipeline stage
+         * @param inputShape The stream shape for the upstream pipeline stage
+         * @param opFlags Operation flags for the new stage
+         */
+        StatefulOp(AbstractPipeline<?, E_IN, ?> upstream,
+                   StreamShape inputShape,
+                   int opFlags) {
+            super(upstream, opFlags);
+            assert upstream.getOutputShape() == inputShape;
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            return true;
+        }
+
+        @Override
+        abstract <P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
+                                                      Spliterator<P_IN> spliterator,
+                                                      IntFunction<Long[]> generator);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/LongStream.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,799 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Arrays;
+import java.util.LongSummaryStatistics;
+import java.util.Objects;
+import java.util.OptionalDouble;
+import java.util.OptionalLong;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.LongBinaryOperator;
+import java.util.function.LongConsumer;
+import java.util.function.LongFunction;
+import java.util.function.LongPredicate;
+import java.util.function.LongSupplier;
+import java.util.function.LongToDoubleFunction;
+import java.util.function.LongToIntFunction;
+import java.util.function.LongUnaryOperator;
+import java.util.function.ObjLongConsumer;
+import java.util.function.Supplier;
+
+/**
+ * A sequence of primitive long elements supporting sequential and parallel
+ * bulk operations. Streams support lazy intermediate operations (transforming
+ * a stream to another stream) such as {@code filter} and {@code map}, and terminal
+ * operations (consuming the contents of a stream to produce a result or
+ * side-effect), such as {@code forEach}, {@code findFirst}, and {@code
+ * iterator}.  Once an operation has been performed on a stream, it
+ * is considered <em>consumed</em> and no longer usable for other operations.
+ *
+ * <p>For sequential stream pipelines, all operations are performed in the
+ * <a href="package-summary.html#Ordering">encounter order</a> of the pipeline
+ * source, if the pipeline source has a defined encounter order.
+ *
+ * <p>For parallel stream pipelines, unless otherwise specified, intermediate
+ * stream operations preserve the <a href="package-summary.html#Ordering">
+ * encounter order</a> of their source, and terminal operations
+ * respect the encounter order of their source, if the source
+ * has an encounter order.  Provided that and parameters to stream operations
+ * satisfy the <a href="package-summary.html#NonInterference">non-interference
+ * requirements</a>, and excepting differences arising from the absence of
+ * a defined encounter order, the result of a stream pipeline should be the
+ * stable across multiple executions of the same operations on the same source.
+ * However, the timing and thread in which side-effects occur (for those
+ * operations which are allowed to produce side-effects, such as
+ * {@link #forEach(LongConsumer)}), are explicitly nondeterministic for parallel
+ * execution of stream pipelines.
+ *
+ * <p>Unless otherwise noted, passing a {@code null} argument to any stream
+ * method may result in a {@link NullPointerException}.
+ *
+ * @apiNote
+ * Streams are not data structures; they do not manage the storage for their
+ * elements, nor do they support access to individual elements.  However,
+ * you can use the {@link #iterator()} or {@link #spliterator()} operations to
+ * perform a controlled traversal.
+ *
+ * @since 1.8
+ * @see <a href="package-summary.html">java.util.stream</a>
+ */
+public interface LongStream extends BaseStream<Long, LongStream> {
+
+    /**
+     * Returns a stream consisting of the elements of this stream that match
+     * the given predicate.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">
+     *                  non-interfering, stateless</a> predicate to apply to
+     *                  each element to determine if it should be included
+     * @return the new stream
+     */
+    LongStream filter(LongPredicate predicate);
+
+    /**
+     * Returns a stream consisting of the results of applying the given
+     * function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    LongStream map(LongUnaryOperator mapper);
+
+    /**
+     * Returns an object-valued {@code Stream} consisting of the results of
+     * applying the given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">
+     *     intermediate operation</a>.
+     *
+     * @param <U> the element type of the new stream
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    <U> Stream<U> mapToObj(LongFunction<? extends U> mapper);
+
+    /**
+     * Returns an {@code IntStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    IntStream mapToInt(LongToIntFunction mapper);
+
+    /**
+     * Returns a {@code DoubleStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    DoubleStream mapToDouble(LongToDoubleFunction mapper);
+
+    /**
+     * Returns a stream consisting of the results of replacing each element of
+     * this stream with the contents of the stream produced by applying the
+     * provided mapping function to each element.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @apiNote
+     * The {@code flatMap()} operation has the effect of applying a one-to-many
+     * tranformation to the elements of the stream, and then flattening the
+     * resulting elements into a new stream. For example, if {@code orders}
+     * is a stream of purchase orders, and each purchase order contains a
+     * collection of line items, then the following produces a stream of line
+     * items:
+     * <pre>{@code
+     *     orderStream.flatMap(order -> order.getLineItems().stream())...
+     * }</pre>
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to
+     *               each element which produces an {@code LongStream} of new
+     *               values
+     * @return the new stream
+     * @see Stream#flatMap(Function)
+     */
+    LongStream flatMap(LongFunction<? extends LongStream> mapper);
+
+    /**
+     * Returns a stream consisting of the distinct elements of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @return the new stream
+     */
+    LongStream distinct();
+
+    /**
+     * Returns a stream consisting of the elements of this stream in sorted
+     * order.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @return the new stream
+     */
+    LongStream sorted();
+
+    /**
+     * Returns a stream consisting of the elements of this stream, additionally
+     * performing the provided action on each element as elements are consumed
+     * from the resulting stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * <p>For parallel stream pipelines, the action may be called at
+     * whatever time and in whatever thread the element is made available by the
+     * upstream operation.  If the action modifies shared state,
+     * it is responsible for providing the required synchronization.
+     *
+     * @apiNote This method exists mainly to support debugging, where you want
+     * to see the elements as they flow past a certain point in a pipeline:
+     * <pre>{@code
+     *     list.stream()
+     *         .filter(filteringFunction)
+     *         .peek(e -> {System.out.println("Filtered value: " + e); });
+     *         .map(mappingFunction)
+     *         .peek(e -> {System.out.println("Mapped value: " + e); });
+     *         .collect(Collectors.toLongSummaryStastistics());
+     * }</pre>
+     *
+     * @param consumer a <a href="package-summary.html#NonInterference">
+     *                 non-interfering</a> action to perform on the elements as
+     *                 they are consumed from the stream
+     * @return the new stream
+     */
+    LongStream peek(LongConsumer consumer);
+
+    /**
+     * Returns a stream consisting of the elements of this stream, truncated
+     * to be no longer than {@code maxSize} in length.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @param maxSize the number of elements the stream should be limited to
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code maxSize} is negative
+     */
+    LongStream limit(long maxSize);
+
+    /**
+     * Returns a stream consisting of the remaining elements of this stream
+     * after indexing {@code startInclusive} elements into the stream. If the
+     * {@code startInclusive} index lies past the end of this stream then an
+     * empty stream will be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @param startInclusive the number of leading elements to skip
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code startInclusive} is negative
+     */
+    LongStream substream(long startInclusive);
+
+    /**
+     * Returns a stream consisting of the remaining elements of this stream
+     * after indexing {@code startInclusive} elements into the stream and
+     * truncated to contain no more than {@code endExclusive - startInclusive}
+     * elements. If the {@code startInclusive} index lies past the end
+     * of this stream then an empty stream will be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @param startInclusive the starting position of the substream, inclusive
+     * @param endExclusive the ending position of the substream, exclusive
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code startInclusive} or
+     * {@code endExclusive} is negative or {@code startInclusive} is greater
+     * than {@code endExclusive}
+     */
+    LongStream substream(long startInclusive, long endExclusive);
+
+    /**
+     * Performs an action for each element of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * <p>For parallel stream pipelines, this operation does <em>not</em>
+     * guarantee to respect the encounter order of the stream, as doing so
+     * would sacrifice the benefit of parallelism.  For any given element, the
+     * action may be performed at whatever time and in whatever thread the
+     * library chooses.  If the action accesses shared state, it is
+     * responsible for providing the required synchronization.
+     *
+     * @param action a <a href="package-summary.html#NonInterference">
+     *               non-interfering</a> action to perform on the elements
+     */
+    void forEach(LongConsumer action);
+
+    /**
+     * Performs an action for each element of this stream, guaranteeing that
+     * each element is processed in encounter order for streams that have a
+     * defined encounter order.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param action a <a href="package-summary.html#NonInterference">
+     *               non-interfering</a> action to perform on the elements
+     * @see #forEach(LongConsumer)
+     */
+    void forEachOrdered(LongConsumer action);
+
+    /**
+     * Returns an array containing the elements of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @return an array containing the elements of this stream
+     */
+    long[] toArray();
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using the provided identity value and an
+     * <a href="package-summary.html#Associativity">associative</a>
+     * accumulation function, and returns the reduced value.  This is equivalent
+     * to:
+     * <pre>{@code
+     *     long result = identity;
+     *     for (long element : this stream)
+     *         result = accumulator.apply(result, element)
+     *     return result;
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code identity} value must be an identity for the accumulator
+     * function. This means that for all {@code x},
+     * {@code accumulator.apply(identity, x)} is equal to {@code x}.
+     * The {@code accumulator} function must be an
+     * <a href="package-summary.html#Associativity">associative</a> function.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @apiNote Sum, min, max, and average are all special cases of reduction.
+     * Summing a stream of numbers can be expressed as:
+     *
+     * <pre>{@code
+     *     long sum = integers.reduce(0, (a, b) -> a+b);
+     * }</pre>
+     *
+     * or more compactly:
+     *
+     * <pre>{@code
+     *     long sum = integers.reduce(0, Long::sum);
+     * }</pre>
+     *
+     * <p>While this may seem a more roundabout way to perform an aggregation
+     * compared to simply mutating a running total in a loop, reduction
+     * operations parallelize more gracefully, without needing additional
+     * synchronization and with greatly reduced risk of data races.
+     *
+     * @param identity the identity value for the accumulating function
+     * @param op an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for combining two values
+     * @return the result of the reduction
+     * @see #sum()
+     * @see #min()
+     * @see #max()
+     * @see #average()
+     */
+    long reduce(long identity, LongBinaryOperator op);
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using an
+     * <a href="package-summary.html#Associativity">associative</a> accumulation
+     * function, and returns an {@code OptionalLong} describing the reduced value,
+     * if any. This is equivalent to:
+     * <pre>{@code
+     *     boolean foundAny = false;
+     *     long result = null;
+     *     for (long element : this stream) {
+     *         if (!foundAny) {
+     *             foundAny = true;
+     *             result = element;
+     *         }
+     *         else
+     *             result = accumulator.apply(result, element);
+     *     }
+     *     return foundAny ? OptionalLong.of(result) : OptionalLong.empty();
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code accumulator} function must be an
+     * <a href="package-summary.html#Associativity">associative</a> function.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param op an <a href="package-summary.html#Associativity">associative</a>
+     *           <a href="package-summary.html#NonInterference">non-interfering,
+     *           stateless</a> function for combining two values
+     * @return the result of the reduction
+     * @see #reduce(long, LongBinaryOperator)
+     */
+    OptionalLong reduce(LongBinaryOperator op);
+
+    /**
+     * Performs a <a href="package-summary.html#MutableReduction">mutable
+     * reduction</a> operation on the elements of this stream.  A mutable
+     * reduction is one in which the reduced value is a mutable value holder,
+     * such as an {@code ArrayList}, and elements are incorporated by updating
+     * the state of the result, rather than by replacing the result.  This
+     * produces a result equivalent to:
+     * <pre>{@code
+     *     R result = resultFactory.get();
+     *     for (long element : this stream)
+     *         accumulator.accept(result, element);
+     *     return result;
+     * }</pre>
+     *
+     * <p>Like {@link #reduce(long, LongBinaryOperator)}, {@code collect} operations
+     * can be parallelized without requiring additional synchronization.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param <R> type of the result
+     * @param resultFactory a function that creates a new result container.
+     *                      For a parallel execution, this function may be
+     *                      called multiple times and must return a fresh value
+     *                      each time.
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for incorporating an additional
+     *                    element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+     *                 <a href="package-summary.html#NonInterference">non-interfering,
+     *                 stateless</a> function for combining two values, which
+     *                 must be compatible with the accumulator function
+     * @return the result of the reduction
+     * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
+     */
+    <R> R collect(Supplier<R> resultFactory,
+                  ObjLongConsumer<R> accumulator,
+                  BiConsumer<R, R> combiner);
+
+    /**
+     * Returns the sum of elements in this stream.  This is a special case
+     * of a <a href="package-summary.html#MutableReduction">reduction</a>
+     * and is equivalent to:
+     * <pre>{@code
+     *     return reduce(0, Long::sum);
+     * }</pre>
+     *
+     * @return the sum of elements in this stream
+     */
+    long sum();
+
+    /**
+     * Returns an {@code OptionalLong} describing the minimum element of this
+     * stream, or an empty optional if this stream is empty.  This is a special
+     * case of a <a href="package-summary.html#MutableReduction">reduction</a>
+     * and is equivalent to:
+     * <pre>{@code
+     *     return reduce(Long::min);
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+     *
+
+     * @return an {@code OptionalLong} containing the minimum element of this
+     * stream, or an empty {@code OptionalLong} if the stream is empty
+     */
+    OptionalLong min();
+
+    /**
+     * Returns an {@code OptionalLong} describing the maximum element of this
+     * stream, or an empty optional if this stream is empty.  This is a special
+     * case of a <a href="package-summary.html#MutableReduction">reduction</a>
+     * and is equivalent to:
+     * <pre>{@code
+     *     return reduce(Long::max);
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @return an {@code OptionalLong} containing the maximum element of this
+     * stream, or an empty {@code OptionalLong} if the stream is empty
+     */
+    OptionalLong max();
+
+    /**
+     * Returns the count of elements in this stream.  This is a special case of
+     * a <a href="package-summary.html#MutableReduction">reduction</a> and is
+     * equivalent to:
+     * <pre>{@code
+     *     return map(e -> 1L).sum();
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+     *
+     * @return the count of elements in this stream
+     */
+    long count();
+
+    /**
+     * Returns an {@code OptionalDouble} describing the average of elements of
+     * this stream, or an empty optional if this stream is empty.  This is a
+     * special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a>.
+     *
+     * @return an {@code OptionalDouble} containing the average element of this
+     * stream, or an empty optional if the stream is empty
+     */
+    OptionalDouble average();
+
+    /**
+     * Returns a {@code LongSummaryStatistics} describing various summary data
+     * about the elements of this stream.  This is a special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a>.
+     *
+     * @return a {@code LongSummaryStatistics} describing various summary data
+     * about the elements of this stream
+     */
+    LongSummaryStatistics summaryStatistics();
+
+    /**
+     * Returns whether any elements of this stream match the provided
+     * predicate.  May not evaluate the predicate on all elements if not
+     * necessary for determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if any elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean anyMatch(LongPredicate predicate);
+
+    /**
+     * Returns whether all elements of this stream match the provided predicate.
+     * May not evaluate the predicate on all elements if not necessary for
+     * determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if all elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean allMatch(LongPredicate predicate);
+
+    /**
+     * Returns whether no elements of this stream match the provided  predicate.
+     * May not evaluate the predicate on all elements if not necessary for
+     * determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if no elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean noneMatch(LongPredicate predicate);
+
+    /**
+     * Returns an {@link OptionalLong} describing the first element of this
+     * stream (in the encounter order), or an empty {@code OptionalLong} if the
+     * stream is empty.  If the stream has no encounter order, than any element
+     * may be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @return an {@code OptionalLong} describing the first element of this
+     * stream, or an empty {@code OptionalLong} if the stream is empty
+     */
+    OptionalLong findFirst();
+
+    /**
+     * Returns an {@link OptionalLong} describing some element of the stream, or
+     * an empty {@code OptionalLong} if the stream is empty.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * <p>The behavior of this operation is explicitly nondeterministic; it is
+     * free to select any element in the stream.  This is to allow for maximal
+     * performance in parallel operations; the cost is that multiple invocations
+     * on the same source may not return the same result.  (If the first element
+     * in the encounter order is desired, use {@link #findFirst()} instead.)
+     *
+     * @return an {@code OptionalLong} describing some element of this stream,
+     * or an empty {@code OptionalLong} if the stream is empty
+     * @see #findFirst()
+     */
+    OptionalLong findAny();
+
+    /**
+     * Returns a {@code DoubleStream} consisting of the elements of this stream,
+     * converted to {@code double}.
+     *
+     * @return a {@code DoubleStream} consisting of the elements of this stream,
+     * converted to {@code double}
+     */
+    DoubleStream doubles();
+
+    /**
+     * Returns a {@code Stream} consisting of the elements of this stream,
+     * each boxed to a {@code Long}.
+     *
+     * @return a {@code Stream} consistent of the elements of this stream,
+     * each boxed to {@code Long}
+     */
+    Stream<Long> boxed();
+
+    @Override
+    LongStream sequential();
+
+    @Override
+    LongStream parallel();
+
+    @Override
+    PrimitiveIterator.OfLong iterator();
+
+    @Override
+    Spliterator.OfLong spliterator();
+
+    // Static factories
+
+    /**
+     * Returns a builder for a {@code LongStream}.
+     *
+     * @return a stream builder
+     */
+    public static StreamBuilder.OfLong builder() {
+        return new Streams.LongStreamBuilderImpl();
+    }
+
+    /**
+     * Returns an empty sequential {@code LongStream}.
+     *
+     * @return an empty sequential stream
+     */
+    public static LongStream empty() {
+        return StreamSupport.longStream(Spliterators.emptyLongSpliterator());
+    }
+
+    /**
+     * Returns a sequential {@code LongStream} containing a single element.
+     *
+     * @param t the single element
+     * @return a singleton sequential stream
+     */
+    public static LongStream of(long t) {
+        return StreamSupport.longStream(new Streams.LongStreamBuilderImpl(t));
+    }
+
+    /**
+     * Returns a sequential stream whose elements are the specified values.
+     *
+     * @param values the elements of the new stream
+     * @return the new stream
+     */
+    public static LongStream of(long... values) {
+        return Arrays.stream(values);
+    }
+
+    /**
+     * Returns an infinite sequential {@code LongStream} produced by iterative
+     * application of a function {@code f} to an initial element {@code seed},
+     * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
+     * {@code f(f(seed))}, etc.
+     *
+     * <p>The first element (position {@code 0}) in the {@code LongStream} will
+     * be the provided {@code seed}.  For {@code n > 0}, the element at position
+     * {@code n}, will be the result of applying the function {@code f} to the
+     * element at position {@code n - 1}.
+     *
+     * @param seed the initial element
+     * @param f a function to be applied to to the previous element to produce
+     *          a new element
+     * @return a new sequential {@code LongStream}
+     */
+    public static LongStream iterate(final long seed, final LongUnaryOperator f) {
+        Objects.requireNonNull(f);
+        final PrimitiveIterator.OfLong iterator = new PrimitiveIterator.OfLong() {
+            long t = seed;
+
+            @Override
+            public boolean hasNext() {
+                return true;
+            }
+
+            @Override
+            public long nextLong() {
+                long v = t;
+                t = f.applyAsLong(t);
+                return v;
+            }
+        };
+        return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(
+                iterator,
+                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+    }
+
+    /**
+     * Returns a sequential {@code LongStream} where each element is generated
+     * by a {@code LongSupplier}.  This is suitable for generating constant
+     * streams, streams of random elements, etc.
+     *
+     * @param s the {@code LongSupplier} for generated elements
+     * @return a new sequential {@code LongStream}
+     */
+    public static LongStream generate(LongSupplier s) {
+        Objects.requireNonNull(s);
+        return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(
+                new PrimitiveIterator.OfLong() {
+                    @Override
+                    public boolean hasNext() { return true; }
+
+                    @Override
+                    public long nextLong() { return s.getAsLong(); }
+                },
+                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
+    }
+
+    /**
+     * Returns a sequential {@code LongStream} from {@code startInclusive}
+     * (inclusive) to {@code endExclusive} (exclusive) by an incremental step of
+     * 1.
+     *
+     * @implSpec
+     * The implementation behaves as if:
+     * <pre>{@code
+     *     longRange(startInclusive, endExclusive, 1);
+     * }</pre>
+     *
+     * @param startInclusive the (inclusive) initial value
+     * @param endExclusive the exclusive upper bound
+     * @return a sequential {@code LongStream} for the range of {@code long}
+     *         elements
+     */
+    public static LongStream range(long startInclusive, final long endExclusive) {
+        return range(startInclusive, endExclusive, 1);
+    }
+
+    /**
+     * Returns a sequential {@code LongStream} from {@code startInclusive}
+     * (inclusive) to {@code endExclusive} (exclusive) by {@code step}. If
+     * {@code startInclusive} is greater than or equal to {@code
+     * endExclusive}, an empty stream is returned.
+     *
+     * <p>An equivalent sequence of increasing values can be produced
+     * sequentially using a {@code for} loop as follows:
+     * <pre>{@code
+     *     for (long i = startInclusive; i < endExclusive ; i += step) { ... }
+     * }</pre>
+     *
+     * @param startInclusive the (inclusive) initial value
+     * @param endExclusive the exclusive upper bound
+     * @param step the difference between consecutive values
+     * @return a sequential {@code LongStream} for the range of {@code long}
+     *         elements
+     * @throws IllegalArgumentException if {@code step} is less than or equal to
+     *                                  0
+     */
+    public static LongStream range(long startInclusive, final long endExclusive, final long step) {
+        if (step <= 0) {
+            throw new IllegalArgumentException(String.format("Illegal step: %d", step));
+        } else if (startInclusive >= endExclusive) {
+            return empty();
+        } else {
+            return StreamSupport.longStream(new Streams.RangeLongSpliterator(startInclusive, endExclusive, step));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/MatchOps.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.DoublePredicate;
+import java.util.function.IntPredicate;
+import java.util.function.LongPredicate;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+/**
+ * Factory for instances of a short-circuiting {@code TerminalOp} that implement
+ * quantified predicate matching on the elements of a stream. Supported variants
+ * include match-all, match-any, and match-none.
+ *
+ * @since 1.8
+ */
+final class MatchOps {
+
+    private MatchOps() { }
+
+    /**
+     * Enum describing quantified match options -- all match, any match, none
+     * match.
+     */
+    enum MatchKind {
+        /** Do all elements match the predicate? */
+        ANY(true, true),
+
+        /** Do any elements match the predicate? */
+        ALL(false, false),
+
+        /** Do no elements match the predicate? */
+        NONE(true, false);
+
+        private final boolean stopOnPredicateMatches;
+        private final boolean shortCircuitResult;
+
+        private MatchKind(boolean stopOnPredicateMatches,
+                          boolean shortCircuitResult) {
+            this.stopOnPredicateMatches = stopOnPredicateMatches;
+            this.shortCircuitResult = shortCircuitResult;
+        }
+    }
+
+    /**
+     * Constructs a quantified predicate matcher for a Stream.
+     *
+     * @param <T> the type of stream elements
+     * @param predicate the {@code Predicate} to apply to stream elements
+     * @param matchKind the kind of quantified match (all, any, none)
+     * @return a {@code TerminalOp} implementing the desired quantified match
+     *         criteria
+     */
+    public static <T> TerminalOp<T, Boolean> makeRef(Predicate<? super T> predicate,
+            MatchKind matchKind) {
+        Objects.requireNonNull(predicate);
+        Objects.requireNonNull(matchKind);
+        class MatchSink extends BooleanTerminalSink<T> {
+            MatchSink() {
+                super(matchKind);
+            }
+
+            @Override
+            public void accept(T t) {
+                if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
+                    stop = true;
+                    value = matchKind.shortCircuitResult;
+                }
+            }
+        }
+
+        // @@@ Workaround for JDK-8011591 -- when fixed, replace s with constructor ref
+        Supplier<BooleanTerminalSink<T>> s = new Supplier<BooleanTerminalSink<T>>() {
+            @Override
+            public BooleanTerminalSink<T> get() {return new MatchSink();}
+        };
+        return new MatchOp<>(StreamShape.REFERENCE, matchKind, s);
+    }
+
+    /**
+     * Constructs a quantified predicate matcher for an {@code IntStream}.
+     *
+     * @param predicate the {@code Predicate} to apply to stream elements
+     * @param matchKind the kind of quantified match (all, any, none)
+     * @return a {@code TerminalOp} implementing the desired quantified match
+     *         criteria
+     */
+    public static TerminalOp<Integer, Boolean> makeInt(IntPredicate predicate,
+                                                       MatchKind matchKind) {
+        Objects.requireNonNull(predicate);
+        Objects.requireNonNull(matchKind);
+        class MatchSink extends BooleanTerminalSink<Integer> implements Sink.OfInt {
+            MatchSink() {
+                super(matchKind);
+            }
+
+            @Override
+            public void accept(int t) {
+                if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
+                    stop = true;
+                    value = matchKind.shortCircuitResult;
+                }
+            }
+        }
+
+        // @@@ Workaround for JDK-8011591 -- when fixed, replace s with constructor ref
+        Supplier<BooleanTerminalSink<Integer>> s = new Supplier<BooleanTerminalSink<Integer>>() {
+            @Override
+            public BooleanTerminalSink<Integer> get() {return new MatchSink();}
+        };
+        return new MatchOp<>(StreamShape.INT_VALUE, matchKind, s);
+    }
+
+    /**
+     * Constructs a quantified predicate matcher for a {@code LongStream}.
+     *
+     * @param predicate the {@code Predicate} to apply to stream elements
+     * @param matchKind the kind of quantified match (all, any, none)
+     * @return a {@code TerminalOp} implementing the desired quantified match
+     *         criteria
+     */
+    public static TerminalOp<Long, Boolean> makeLong(LongPredicate predicate,
+                                                     MatchKind matchKind) {
+        Objects.requireNonNull(predicate);
+        Objects.requireNonNull(matchKind);
+        class MatchSink extends BooleanTerminalSink<Long> implements Sink.OfLong {
+
+            MatchSink() {
+                super(matchKind);
+            }
+
+            @Override
+            public void accept(long t) {
+                if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
+                    stop = true;
+                    value = matchKind.shortCircuitResult;
+                }
+            }
+        }
+
+        // @@@ Workaround for JDK-8011591 -- when fixed, replace s with constructor ref
+        Supplier<BooleanTerminalSink<Long>> s = new Supplier<BooleanTerminalSink<Long>>() {
+            @Override
+            public BooleanTerminalSink<Long> get() {return new MatchSink();}
+        };
+        return new MatchOp<>(StreamShape.LONG_VALUE, matchKind, s);
+    }
+
+    /**
+     * Constructs a quantified predicate matcher for a {@code DoubleStream}.
+     *
+     * @param predicate the {@code Predicate} to apply to stream elements
+     * @param matchKind the kind of quantified match (all, any, none)
+     * @return a {@code TerminalOp} implementing the desired quantified match
+     *         criteria
+     */
+    public static TerminalOp<Double, Boolean> makeDouble(DoublePredicate predicate,
+                                                         MatchKind matchKind) {
+        Objects.requireNonNull(predicate);
+        Objects.requireNonNull(matchKind);
+        class MatchSink extends BooleanTerminalSink<Double> implements Sink.OfDouble {
+
+            MatchSink() {
+                super(matchKind);
+            }
+
+            @Override
+            public void accept(double t) {
+                if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
+                    stop = true;
+                    value = matchKind.shortCircuitResult;
+                }
+            }
+        }
+
+        // @@@ Workaround for JDK-8011591 -- when fixed, replace s with constructor ref
+        Supplier<BooleanTerminalSink<Double>> s = new Supplier<BooleanTerminalSink<Double>>() {
+            @Override
+            public BooleanTerminalSink<Double> get() {return new MatchSink();}
+        };
+        return new MatchOp<>(StreamShape.DOUBLE_VALUE, matchKind, s);
+    }
+
+    /**
+     * A short-circuiting {@code TerminalOp} that evaluates a predicate on the
+     * elements of a stream and determines whether all, any or none of those
+     * elements match the predicate.
+     *
+     * @param <T> the output type of the stream pipeline
+     */
+    private static final class MatchOp<T> implements TerminalOp<T, Boolean> {
+        private final StreamShape inputShape;
+        final MatchKind matchKind;
+        final Supplier<BooleanTerminalSink<T>> sinkSupplier;
+
+        /**
+         * Constructs a {@code MatchOp}.
+         *
+         * @param shape the output shape of the stream pipeline
+         * @param matchKind the kind of quantified match (all, any, none)
+         * @param sinkSupplier {@code Supplier} for a {@code Sink} of the
+         *        appropriate shape which implements the matching operation
+         */
+        MatchOp(StreamShape shape,
+                MatchKind matchKind,
+                Supplier<BooleanTerminalSink<T>> sinkSupplier) {
+            this.inputShape = shape;
+            this.matchKind = matchKind;
+            this.sinkSupplier = sinkSupplier;
+        }
+
+        @Override
+        public int getOpFlags() {
+            return StreamOpFlag.IS_SHORT_CIRCUIT | StreamOpFlag.NOT_ORDERED;
+        }
+
+        @Override
+        public StreamShape inputShape() {
+            return inputShape;
+        }
+
+        @Override
+        public <S> Boolean evaluateSequential(PipelineHelper<T> helper,
+                                              Spliterator<S> spliterator) {
+            return helper.wrapAndCopyInto(sinkSupplier.get(), spliterator).getAndClearState();
+        }
+
+        @Override
+        public <S> Boolean evaluateParallel(PipelineHelper<T> helper,
+                                            Spliterator<S> spliterator) {
+            // Approach for parallel implementation:
+            // - Decompose as per usual
+            // - run match on leaf chunks, call result "b"
+            // - if b == matchKind.shortCircuitOn, complete early and return b
+            // - else if we complete normally, return !shortCircuitOn
+
+            return new MatchTask<>(this, helper, spliterator).invoke();
+        }
+    }
+
+    /**
+     * Boolean specific terminal sink to avoid the boxing costs when returning
+     * results.  Subclasses implement the shape-specific functionality.
+     *
+     * @param <T> The output type of the stream pipeline
+     */
+    private static abstract class BooleanTerminalSink<T> implements Sink<T> {
+        boolean stop;
+        boolean value;
+
+        BooleanTerminalSink(MatchKind matchKind) {
+            value = !matchKind.shortCircuitResult;
+        }
+
+        public boolean getAndClearState() {
+            return value;
+        }
+
+        @Override
+        public boolean cancellationRequested() {
+            return stop;
+        }
+    }
+
+    /**
+     * ForkJoinTask implementation to implement a parallel short-circuiting
+     * quantified match
+     *
+     * @param <P_IN> the type of source elements for the pipeline
+     * @param <P_OUT> the type of output elements for the pipeline
+     */
+    private static final class MatchTask<P_IN, P_OUT>
+            extends AbstractShortCircuitTask<P_IN, P_OUT, Boolean, MatchTask<P_IN, P_OUT>> {
+        private final MatchOp<P_OUT> op;
+
+        /**
+         * Constructor for root node
+         */
+        MatchTask(MatchOp<P_OUT> op, PipelineHelper<P_OUT> helper,
+                  Spliterator<P_IN> spliterator) {
+            super(helper, spliterator);
+            this.op = op;
+        }
+
+        /**
+         * Constructor for non-root node
+         */
+        MatchTask(MatchTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            this.op = parent.op;
+        }
+
+        @Override
+        protected MatchTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+            return new MatchTask<>(this, spliterator);
+        }
+
+        @Override
+        protected Boolean doLeaf() {
+            boolean b = helper.wrapAndCopyInto(op.sinkSupplier.get(), spliterator).getAndClearState();
+            if (b == op.matchKind.shortCircuitResult)
+                shortCircuit(b);
+            return null;
+        }
+
+        @Override
+        protected Boolean getEmptyResult() {
+            return !op.matchKind.shortCircuitResult;
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Node.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,557 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Spliterator;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.LongConsumer;
+
+/**
+ * An immutable container for describing an ordered sequence of elements of some
+ * type {@code T}.
+ *
+ * <p>A {@code Node} contains a fixed number of elements, which can be accessed
+ * via the {@link #count}, {@link #spliterator}, {@link #forEach},
+ * {@link #asArray}, or {@link #copyInto} methods.  A {@code Node} may have zero
+ * or more child {@code Node}s; if it has no children (accessed via
+ * {@link #getChildCount} and {@link #getChild(int)}, it is considered <em>flat
+ * </em> or a <em>leaf</em>; if it has children, it is considered an
+ * <em>internal</em> node.  The size of an internal node is the sum of sizes of
+ * its children.
+ *
+ * @apiNote
+ * <p>A {@code Node} typically does not store the elements directly, but instead
+ * mediates access to one or more existing (effectively immutable) data
+ * structures such as a {@code Collection}, array, or a set of other
+ * {@code Node}s.  Commonly {@code Node}s are formed into a tree whose shape
+ * corresponds to the computation tree that produced the elements that are
+ * contained in the leaf nodes.  The use of {@code Node} within the stream
+ * framework is largely to avoid copying data unnecessarily during parallel
+ * operations.
+ *
+ * @param <T> the type of elements.
+ * @since 1.8
+ */
+interface Node<T> {
+
+    /**
+     * Returns a {@link Spliterator} describing the elements contained in this
+     * {@code Node}.
+     *
+     * @return a {@code Spliterator} describing the elements contained in this
+     *         {@code Node}
+     */
+    Spliterator<T> spliterator();
+
+    /**
+     * Traverses the elements of this node, and invoke the provided
+     * {@code Consumer} with each element.  Elements are provided in encounter
+     * order if the source for the {@code Node} has a defined encounter order.
+     *
+     * @param consumer a {@code Consumer} that is to be invoked with each
+     *        element in this {@code Node}
+     */
+    void forEach(Consumer<? super T> consumer);
+
+    /**
+     * Returns the number of child nodes of this node.
+     *
+     * @implSpec The default implementation returns zero.
+     *
+     * @return the number of child nodes
+     */
+    default int getChildCount() {
+        return 0;
+    }
+
+    /**
+     * Retrieves the child {@code Node} at a given index.
+     *
+     * @implSpec The default implementation always throws
+     * {@code IndexOutOfBoundsException}.
+     *
+     * @param i the index to the child node
+     * @return the child node
+     * @throws IndexOutOfBoundsException if the index is less than 0 or greater
+     *         than or equal to the number of child nodes
+     */
+    default Node<T> getChild(int i) {
+        throw new IndexOutOfBoundsException();
+    }
+
+    /**
+     * Provides an array view of the contents of this node.
+     *
+     * <p>Depending on the underlying implementation, this may return a
+     * reference to an internal array rather than a copy.  Since the returned
+     * array may be shared, the returned array should not be modified.  The
+     * {@code generator} function may be consulted to create the array if a new
+     * array needs to be created.
+     *
+     * @param generator a factory function which takes an integer parameter and
+     *        returns a new, empty array of that size and of the appropriate
+     *        array type
+     * @return an array containing the contents of this {@code Node}
+     */
+    T[] asArray(IntFunction<T[]> generator);
+
+    /**
+     * Copies the content of this {@code Node} into an array, starting at a
+     * given offset into the array.  It is the caller's responsibility to ensure
+     * there is sufficient room in the array.
+     *
+     * @param array the array into which to copy the contents of this
+     *       {@code Node}
+     * @param offset the starting offset within the array
+     * @throws IndexOutOfBoundsException if copying would cause access of data
+     *         outside array bounds
+     * @throws NullPointerException if {@code array} is {@code null}
+     */
+    void copyInto(T[] array, int offset);
+
+    /**
+     * Gets the {@code StreamShape} associated with this {@code Node}.
+     *
+     * @implSpec The default in {@code Node} returns
+     * {@code StreamShape.REFERENCE}
+     *
+     * @return the stream shape associated with this node
+     */
+    default StreamShape getShape() {
+        return StreamShape.REFERENCE;
+    }
+
+    /**
+     * Returns the number of elements contained in this node.
+     *
+     * @return the number of elements contained in this node
+     */
+    long count();
+
+    /**
+     * A mutable builder for a {@code Node} that implements {@link Sink}, which
+     * builds a flat node containing the elements that have been pushed to it.
+     */
+    interface Builder<T> extends Sink<T> {
+
+        /**
+         * Builds the node.  Should be called after all elements have been
+         * pushed and signalled with an invocation of {@link Sink#end()}.
+         *
+         * @return the resulting {@code Node}
+         */
+        Node<T> build();
+
+        /**
+         * Specialized @{code Node.Builder} for int elements
+         */
+        interface OfInt extends Node.Builder<Integer>, Sink.OfInt {
+            @Override
+            Node.OfInt build();
+        }
+
+        /**
+         * Specialized @{code Node.Builder} for long elements
+         */
+        interface OfLong extends Node.Builder<Long>, Sink.OfLong {
+            @Override
+            Node.OfLong build();
+        }
+
+        /**
+         * Specialized @{code Node.Builder} for double elements
+         */
+        interface OfDouble extends Node.Builder<Double>, Sink.OfDouble {
+            @Override
+            Node.OfDouble build();
+        }
+    }
+
+    /**
+     * Specialized {@code Node} for int elements
+     */
+    interface OfInt extends Node<Integer> {
+
+        /**
+         * {@inheritDoc}
+         *
+         * @return a {@link Spliterator.OfInt} describing the elements of this
+         *         node
+         */
+        @Override
+        Spliterator.OfInt spliterator();
+
+        /**
+         * {@inheritDoc}
+         *
+         * @param consumer a {@code Consumer} that is to be invoked with each
+         *        element in this {@code Node}.  If this is an
+         *        {@code IntConsumer}, it is cast to {@code IntConsumer} so the
+         *        elements may be processed without boxing.
+         */
+        @Override
+        default void forEach(Consumer<? super Integer> consumer) {
+            if (consumer instanceof IntConsumer) {
+                forEach((IntConsumer) consumer);
+            }
+            else {
+                if (Tripwire.ENABLED)
+                    Tripwire.trip(getClass(), "{0} calling Node.OfInt.forEachRemaining(Consumer)");
+                spliterator().forEachRemaining(consumer);
+            }
+        }
+
+        /**
+         * Traverses the elements of this node, and invoke the provided
+         * {@code IntConsumer} with each element.
+         *
+         * @param consumer a {@code IntConsumer} that is to be invoked with each
+         *        element in this {@code Node}
+         */
+        void forEach(IntConsumer consumer);
+
+        /**
+         * {@inheritDoc}
+         *
+         * @implSpec the default implementation invokes the generator to create
+         * an instance of an Integer[] array with a length of {@link #count()}
+         * and then invokes {@link #copyInto(Integer[], int)} with that
+         * Integer[] array at an offset of 0.  This is not efficient and it is
+         * recommended to invoke {@link #asIntArray()}.
+         */
+        @Override
+        default Integer[] asArray(IntFunction<Integer[]> generator) {
+            Integer[] boxed = generator.apply((int) count());
+            copyInto(boxed, 0);
+            return boxed;
+        }
+
+        /**
+         * {@inheritDoc}
+         *
+         * @implSpec the default implementation invokes {@link #asIntArray()} to
+         * obtain an int[] array then and copies the elements from that int[]
+         * array into the boxed Integer[] array.  This is not efficient and it
+         * is recommended to invoke {@link #copyInto(int[], int)}.
+         */
+        @Override
+        default void copyInto(Integer[] boxed, int offset) {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(getClass(), "{0} calling Node.OfInt.copyInto(Integer[], int)");
+
+            int[] array = asIntArray();
+            for (int i = 0; i < array.length; i++) {
+                boxed[offset + i] = array[i];
+            }
+        }
+
+        @Override
+        default Node.OfInt getChild(int i) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        /**
+         * Views this node as an int[] array.
+         *
+         * <p>Depending on the underlying implementation this may return a
+         * reference to an internal array rather than a copy.  It is the callers
+         * responsibility to decide if either this node or the array is utilized
+         * as the primary reference for the data.</p>
+         *
+         * @return an array containing the contents of this {@code Node}
+         */
+        int[] asIntArray();
+
+        /**
+         * Copies the content of this {@code Node} into an int[] array, starting
+         * at a given offset into the array.  It is the caller's responsibility
+         * to ensure there is sufficient room in the array.
+         *
+         * @param array the array into which to copy the contents of this
+         *              {@code Node}
+         * @param offset the starting offset within the array
+         * @throws IndexOutOfBoundsException if copying would cause access of
+         *         data outside array bounds
+         * @throws NullPointerException if {@code array} is {@code null}
+         */
+        void copyInto(int[] array, int offset);
+
+        /**
+         * {@inheritDoc}
+         * @implSpec The default in {@code Node.OfInt} returns
+         * {@code StreamShape.INT_VALUE}
+         */
+        default StreamShape getShape() {
+            return StreamShape.INT_VALUE;
+        }
+
+    }
+
+    /**
+     * Specialized {@code Node} for long elements
+     */
+    interface OfLong extends Node<Long> {
+
+        /**
+         * {@inheritDoc}
+         *
+         * @return a {@link Spliterator.OfLong} describing the elements of this
+         *         node
+         */
+        @Override
+        Spliterator.OfLong spliterator();
+
+        /**
+         * {@inheritDoc}
+         *
+         * @param consumer A {@code Consumer} that is to be invoked with each
+         *        element in this {@code Node}.  If this is an
+         *        {@code LongConsumer}, it is cast to {@code LongConsumer} so
+         *        the elements may be processed without boxing.
+         */
+        @Override
+        default void forEach(Consumer<? super Long> consumer) {
+            if (consumer instanceof LongConsumer) {
+                forEach((LongConsumer) consumer);
+            }
+            else {
+                if (Tripwire.ENABLED)
+                    Tripwire.trip(getClass(), "{0} calling Node.OfLong.forEachRemaining(Consumer)");
+                spliterator().forEachRemaining(consumer);
+            }
+        }
+
+        /**
+         * Traverses the elements of this node, and invoke the provided
+         * {@code LongConsumer} with each element.
+         *
+         * @param consumer a {@code LongConsumer} that is to be invoked with
+         *        each element in this {@code Node}
+         */
+        void forEach(LongConsumer consumer);
+
+        /**
+         * {@inheritDoc}
+         *
+         * @implSpec the default implementation invokes the generator to create
+         * an instance of a Long[] array with a length of {@link #count()} and
+         * then invokes {@link #copyInto(Long[], int)} with that Long[] array at
+         * an offset of 0.  This is not efficient and it is recommended to
+         * invoke {@link #asLongArray()}.
+         */
+        @Override
+        default Long[] asArray(IntFunction<Long[]> generator) {
+            Long[] boxed = generator.apply((int) count());
+            copyInto(boxed, 0);
+            return boxed;
+        }
+
+        /**
+         * {@inheritDoc}
+         *
+         * @implSpec the default implementation invokes {@link #asLongArray()}
+         * to obtain a long[] array then and copies the elements from that
+         * long[] array into the boxed Long[] array.  This is not efficient and
+         * it is recommended to invoke {@link #copyInto(long[], int)}.
+         */
+        @Override
+        default void copyInto(Long[] boxed, int offset) {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(getClass(), "{0} calling Node.OfInt.copyInto(Long[], int)");
+
+            long[] array = asLongArray();
+            for (int i = 0; i < array.length; i++) {
+                boxed[offset + i] = array[i];
+            }
+        }
+
+        @Override
+        default Node.OfLong getChild(int i) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        /**
+         * Views this node as a long[] array.
+         *
+         * <p/>Depending on the underlying implementation this may return a
+         * reference to an internal array rather than a copy. It is the callers
+         * responsibility to decide if either this node or the array is utilized
+         * as the primary reference for the data.
+         *
+         * @return an array containing the contents of this {@code Node}
+         */
+        long[] asLongArray();
+
+        /**
+         * Copies the content of this {@code Node} into a long[] array, starting
+         * at a given offset into the array.  It is the caller's responsibility
+         * to ensure there is sufficient room in the array.
+         *
+         * @param array the array into which to copy the contents of this
+         *        {@code Node}
+         * @param offset the starting offset within the array
+         * @throws IndexOutOfBoundsException if copying would cause access of
+         *         data outside array bounds
+         * @throws NullPointerException if {@code array} is {@code null}
+         */
+        void copyInto(long[] array, int offset);
+
+        /**
+         * {@inheritDoc}
+         * @implSpec The default in {@code Node.OfLong} returns
+         * {@code StreamShape.LONG_VALUE}
+         */
+        default StreamShape getShape() {
+            return StreamShape.LONG_VALUE;
+        }
+
+
+    }
+
+    /**
+     * Specialized {@code Node} for double elements
+     */
+    interface OfDouble extends Node<Double> {
+
+        /**
+         * {@inheritDoc}
+         *
+         * @return A {@link Spliterator.OfDouble} describing the elements of
+         *         this node
+         */
+        @Override
+        Spliterator.OfDouble spliterator();
+
+        /**
+         * {@inheritDoc}
+         *
+         * @param consumer A {@code Consumer} that is to be invoked with each
+         *        element in this {@code Node}.  If this is an
+         *        {@code DoubleConsumer}, it is cast to {@code DoubleConsumer}
+         *        so the elements may be processed without boxing.
+         */
+        @Override
+        default void forEach(Consumer<? super Double> consumer) {
+            if (consumer instanceof DoubleConsumer) {
+                forEach((DoubleConsumer) consumer);
+            }
+            else {
+                if (Tripwire.ENABLED)
+                    Tripwire.trip(getClass(), "{0} calling Node.OfLong.forEachRemaining(Consumer)");
+                spliterator().forEachRemaining(consumer);
+            }
+        }
+
+        /**
+         * Traverses the elements of this node, and invoke the provided
+         * {@code DoubleConsumer} with each element.
+         *
+         * @param consumer A {@code DoubleConsumer} that is to be invoked with
+         *        each element in this {@code Node}
+         */
+        void forEach(DoubleConsumer consumer);
+
+        //
+
+        /**
+         * {@inheritDoc}
+         *
+         * @implSpec the default implementation invokes the generator to create
+         * an instance of a Double[] array with a length of {@link #count()} and
+         * then invokes {@link #copyInto(Double[], int)} with that Double[]
+         * array at an offset of 0.  This is not efficient and it is recommended
+         * to invoke {@link #asDoubleArray()}.
+         */
+        @Override
+        default Double[] asArray(IntFunction<Double[]> generator) {
+            Double[] boxed = generator.apply((int) count());
+            copyInto(boxed, 0);
+            return boxed;
+        }
+
+        /**
+         * {@inheritDoc}
+         *
+         * @implSpec the default implementation invokes {@link #asDoubleArray()}
+         * to obtain a double[] array then and copies the elements from that
+         * double[] array into the boxed Double[] array.  This is not efficient
+         * and it is recommended to invoke {@link #copyInto(double[], int)}.
+         */
+        @Override
+        default void copyInto(Double[] boxed, int offset) {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(getClass(), "{0} calling Node.OfDouble.copyInto(Double[], int)");
+
+            double[] array = asDoubleArray();
+            for (int i = 0; i < array.length; i++) {
+                boxed[offset + i] = array[i];
+            }
+        }
+
+        @Override
+        default Node.OfDouble getChild(int i) {
+            throw new IndexOutOfBoundsException();
+        }
+
+        /**
+         * Views this node as a double[] array.
+         *
+         * <p/>Depending on the underlying implementation this may return a
+         * reference to an internal array rather than a copy.  It is the callers
+         * responsibility to decide if either this node or the array is utilized
+         * as the primary reference for the data.
+         *
+         * @return an array containing the contents of this {@code Node}
+         */
+        double[] asDoubleArray();
+
+        /**
+         * Copies the content of this {@code Node} into a double[] array, starting
+         * at a given offset into the array.  It is the caller's responsibility
+         * to ensure there is sufficient room in the array.
+         *
+         * @param array the array into which to copy the contents of this
+         *        {@code Node}
+         * @param offset the starting offset within the array
+         * @throws IndexOutOfBoundsException if copying would cause access of
+         *         data outside array bounds
+         * @throws NullPointerException if {@code array} is {@code null}
+         */
+        void copyInto(double[] array, int offset);
+
+        /**
+         * {@inheritDoc}
+         *
+         * @implSpec The default in {@code Node.OfDouble} returns
+         * {@code StreamShape.DOUBLE_VALUE}
+         */
+        default StreamShape getShape() {
+            return StreamShape.DOUBLE_VALUE;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Nodes.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,2467 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.ArrayDeque;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Deque;
+import java.util.List;
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.LongConsumer;
+
+/**
+ * Factory methods for constructing implementations of {@link Node} and
+ * {@link Node.Builder} and their primitive specializations.  Fork/Join tasks
+ * for collecting output from a {@link PipelineHelper} to a {@link Node} and
+ * flattening {@link Node}s.
+ *
+ * @since 1.8
+ */
+final class Nodes {
+
+    private Nodes() {
+        throw new Error("no instances");
+    }
+
+    /**
+     * The maximum size of an array that can be allocated.
+     */
+    static final long MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
+
+    private static final Node EMPTY_NODE = new EmptyNode.OfRef();
+    private static final Node.OfInt EMPTY_INT_NODE = new EmptyNode.OfInt();
+    private static final Node.OfLong EMPTY_LONG_NODE = new EmptyNode.OfLong();
+    private static final Node.OfDouble EMPTY_DOUBLE_NODE = new EmptyNode.OfDouble();
+
+    // General shape-based node creation methods
+
+    /**
+     * Produces an empty node whose count is zero, has no children and no content.
+     *
+     * @param <T> the type of elements of the created node
+     * @param shape the shape of the node to be created
+     * @return an empty node.
+     */
+    @SuppressWarnings("unchecked")
+    static <T> Node<T> emptyNode(StreamShape shape) {
+        switch (shape) {
+            case REFERENCE:    return (Node<T>) EMPTY_NODE;
+            case INT_VALUE:    return (Node<T>) EMPTY_INT_NODE;
+            case LONG_VALUE:   return (Node<T>) EMPTY_LONG_NODE;
+            case DOUBLE_VALUE: return (Node<T>) EMPTY_DOUBLE_NODE;
+            default:
+                throw new IllegalStateException("Unknown shape " + shape);
+        }
+    }
+
+    /**
+     * Produces a concatenated {@link Node} that has two or more children.
+     * <p>The count of the concatenated node is equal to the sum of the count
+     * of each child. Traversal of the concatenated node traverses the content
+     * of each child in encounter order of the list of children. Splitting a
+     * spliterator obtained from the concatenated node preserves the encounter
+     * order of the list of children.
+     *
+     * <p>The result may be a concatenated node, the input sole node if the size
+     * of the list is 1, or an empty node.
+     *
+     * @param <T> the type of elements of the concatenated node
+     * @param shape the shape of the concatenated node to be created
+     * @param nodes the input nodes
+     * @return a {@code Node} covering the elements of the input nodes
+     * @throws IllegalStateException if all {@link Node} elements of the list
+     * are an not instance of type supported by this factory.
+     */
+    @SuppressWarnings("unchecked")
+    static <T> Node<T> conc(StreamShape shape, List<? extends Node<T>> nodes) {
+        int size = nodes.size();
+        if (size == 0)
+            return emptyNode(shape);
+        else if (size == 1)
+            return nodes.get(0);
+        else {
+            // Create a right-balanced tree when there are more that 2 nodes
+            switch (shape) {
+                case REFERENCE: {
+                    List<Node<T>> refNodes = (List<Node<T>>) nodes;
+                    ConcNode<T> c = new ConcNode<>(refNodes.get(size - 2), refNodes.get(size - 1));
+                    for (int i = size - 3; i >= 0; i--) {
+                        c = new ConcNode<>(refNodes.get(i), c);
+                    }
+                    return c;
+                }
+                case INT_VALUE: {
+                    List<? extends Node.OfInt> intNodes = (List<? extends Node.OfInt>) nodes;
+                    IntConcNode c = new IntConcNode(intNodes.get(size - 2), intNodes.get(size - 1));
+                    for (int i = size - 3; i >= 0; i--) {
+                        c = new IntConcNode(intNodes.get(i), c);
+                    }
+                    return (Node<T>) c;
+                }
+                case LONG_VALUE: {
+                    List<? extends Node.OfLong> longNodes = (List<? extends Node.OfLong>) nodes;
+                    LongConcNode c = new LongConcNode(longNodes.get(size - 2), longNodes.get(size - 1));
+                    for (int i = size - 3; i >= 0; i--) {
+                        c = new LongConcNode(longNodes.get(i), c);
+                    }
+                    return (Node<T>) c;
+                }
+                case DOUBLE_VALUE: {
+                    List<? extends Node.OfDouble> doubleNodes = (List<? extends Node.OfDouble>) nodes;
+                    DoubleConcNode c = new DoubleConcNode(doubleNodes.get(size - 2), doubleNodes.get(size - 1));
+                    for (int i = size - 3; i >= 0; i--) {
+                        c = new DoubleConcNode(doubleNodes.get(i), c);
+                    }
+                    return (Node<T>) c;
+                }
+                default:
+                    throw new IllegalStateException("Unknown shape " + shape);
+            }
+        }
+
+    }
+
+    /**
+     * Truncate a {@link Node}, returning a node describing a subsequence of
+     * the contents of the input node.
+     *
+     * @param <T> the type of elements of the input node and truncated node
+     * @param input the input node
+     * @param from the starting offset to include in the truncated node (inclusive)
+     * @param to the ending offset ot include in the truncated node (exclusive)
+     * @param generator the array factory (only used for reference nodes)
+     * @return the truncated node
+     */
+    @SuppressWarnings("unchecked")
+    static <T> Node<T> truncateNode(Node<T> input, long from, long to, IntFunction<T[]> generator) {
+        StreamShape shape = input.getShape();
+        long size = truncatedSize(input.count(), from, to);
+        if (size == 0)
+            return emptyNode(shape);
+        else if (from == 0 && to >= input.count())
+            return input;
+
+        switch (shape) {
+            case REFERENCE: {
+                Spliterator<T> spliterator = input.spliterator();
+                Node.Builder<T> nodeBuilder = Nodes.builder(size, generator);
+                nodeBuilder.begin(size);
+                for (int i = 0; i < from && spliterator.tryAdvance(e -> { }); i++) { }
+                for (int i = 0; (i < size) && spliterator.tryAdvance(nodeBuilder); i++) { }
+                nodeBuilder.end();
+                return nodeBuilder.build();
+            }
+            case INT_VALUE: {
+                Spliterator.OfInt spliterator = ((Node.OfInt) input).spliterator();
+                Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size);
+                nodeBuilder.begin(size);
+                for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { }
+                for (int i = 0; (i < size) && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { }
+                nodeBuilder.end();
+                return (Node<T>) nodeBuilder.build();
+            }
+            case LONG_VALUE: {
+                Spliterator.OfLong spliterator = ((Node.OfLong) input).spliterator();
+                Node.Builder.OfLong nodeBuilder = Nodes.longBuilder(size);
+                nodeBuilder.begin(size);
+                for (int i = 0; i < from && spliterator.tryAdvance((LongConsumer) e -> { }); i++) { }
+                for (int i = 0; (i < size) && spliterator.tryAdvance((LongConsumer) nodeBuilder); i++) { }
+                nodeBuilder.end();
+                return (Node<T>) nodeBuilder.build();
+            }
+            case DOUBLE_VALUE: {
+                Spliterator.OfDouble spliterator = ((Node.OfDouble) input).spliterator();
+                Node.Builder.OfDouble nodeBuilder = Nodes.doubleBuilder(size);
+                nodeBuilder.begin(size);
+                for (int i = 0; i < from && spliterator.tryAdvance((DoubleConsumer) e -> { }); i++) { }
+                for (int i = 0; (i < size) && spliterator.tryAdvance((DoubleConsumer) nodeBuilder); i++) { }
+                nodeBuilder.end();
+                return (Node<T>) nodeBuilder.build();
+            }
+            default:
+                throw new IllegalStateException("Unknown shape " + shape);
+        }
+    }
+
+    private static long truncatedSize(long size, long from, long to) {
+        if (from >= 0)
+            size = Math.max(0, size - from);
+        long limit = to - from;
+        if (limit >= 0)
+            size = Math.min(size, limit);
+        return size;
+    }
+
+    // Reference-based node methods
+
+    /**
+     * Produces a {@link Node} describing an array.
+     *
+     * <p>The node will hold a reference to the array and will not make a copy.
+     *
+     * @param <T> the type of elements held by the node
+     * @param array the array
+     * @return a node holding an array
+     */
+    static <T> Node<T> node(T[] array) {
+        return new ArrayNode<>(array);
+    }
+
+    /**
+     * Produces a {@link Node} describing a {@link Collection}.
+     * <p>
+     * The node will hold a reference to the collection and will not make a copy.
+     *
+     * @param <T> the type of elements held by the node
+     * @param c the collection
+     * @return a node holding a collection
+     */
+    static <T> Node<T> node(Collection<T> c) {
+        return new CollectionNode<>(c);
+    }
+
+    /**
+     * Produces a {@link Node.Builder}.
+     *
+     * @param exactSizeIfKnown -1 if a variable size builder is requested,
+     * otherwise the exact capacity desired.  A fixed capacity builder will
+     * fail if the wrong number of elements are added to the builder.
+     * @param generator the array factory
+     * @param <T> the type of elements of the node builder
+     * @return a {@code Node.Builder}
+     */
+    static <T> Node.Builder<T> builder(long exactSizeIfKnown, IntFunction<T[]> generator) {
+        return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE)
+               ? new FixedNodeBuilder<>(exactSizeIfKnown, generator)
+               : builder();
+    }
+
+    /**
+     * Produces a variable size @{link Node.Builder}.
+     *
+     * @param <T> the type of elements of the node builder
+     * @return a {@code Node.Builder}
+     */
+    static <T> Node.Builder<T> builder() {
+        return new SpinedNodeBuilder<>();
+    }
+
+    // Int nodes
+
+    /**
+     * Produces a {@link Node.OfInt} describing an int[] array.
+     *
+     * <p>The node will hold a reference to the array and will not make a copy.
+     *
+     * @param array the array
+     * @return a node holding an array
+     */
+    static Node.OfInt node(int[] array) {
+        return new IntArrayNode(array);
+    }
+
+    /**
+     * Produces a {@link Node.Builder.OfInt}.
+     *
+     * @param exactSizeIfKnown -1 if a variable size builder is requested,
+     * otherwise the exact capacity desired.  A fixed capacity builder will
+     * fail if the wrong number of elements are added to the builder.
+     * @return a {@code Node.Builder.OfInt}
+     */
+    static Node.Builder.OfInt intBuilder(long exactSizeIfKnown) {
+        return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE)
+               ? new IntFixedNodeBuilder(exactSizeIfKnown)
+               : intBuilder();
+    }
+
+    /**
+     * Produces a variable size @{link Node.Builder.OfInt}.
+     *
+     * @return a {@code Node.Builder.OfInt}
+     */
+    static Node.Builder.OfInt intBuilder() {
+        return new IntSpinedNodeBuilder();
+    }
+
+    // Long nodes
+
+    /**
+     * Produces a {@link Node.OfLong} describing a long[] array.
+     * <p>
+     * The node will hold a reference to the array and will not make a copy.
+     *
+     * @param array the array
+     * @return a node holding an array
+     */
+    static Node.OfLong node(final long[] array) {
+        return new LongArrayNode(array);
+    }
+
+    /**
+     * Produces a {@link Node.Builder.OfLong}.
+     *
+     * @param exactSizeIfKnown -1 if a variable size builder is requested,
+     * otherwise the exact capacity desired.  A fixed capacity builder will
+     * fail if the wrong number of elements are added to the builder.
+     * @return a {@code Node.Builder.OfLong}
+     */
+    static Node.Builder.OfLong longBuilder(long exactSizeIfKnown) {
+        return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE)
+               ? new LongFixedNodeBuilder(exactSizeIfKnown)
+               : longBuilder();
+    }
+
+    /**
+     * Produces a variable size @{link Node.Builder.OfLong}.
+     *
+     * @return a {@code Node.Builder.OfLong}
+     */
+    static Node.Builder.OfLong longBuilder() {
+        return new LongSpinedNodeBuilder();
+    }
+
+    // Double nodes
+
+    /**
+     * Produces a {@link Node.OfDouble} describing a double[] array.
+     *
+     * <p>The node will hold a reference to the array and will not make a copy.
+     *
+     * @param array the array
+     * @return a node holding an array
+     */
+    static Node.OfDouble node(final double[] array) {
+        return new DoubleArrayNode(array);
+    }
+
+    /**
+     * Produces a {@link Node.Builder.OfDouble}.
+     *
+     * @param exactSizeIfKnown -1 if a variable size builder is requested,
+     * otherwise the exact capacity desired.  A fixed capacity builder will
+     * fail if the wrong number of elements are added to the builder.
+     * @return a {@code Node.Builder.OfDouble}
+     */
+    static Node.Builder.OfDouble doubleBuilder(long exactSizeIfKnown) {
+        return (exactSizeIfKnown >= 0 && exactSizeIfKnown < MAX_ARRAY_SIZE)
+               ? new DoubleFixedNodeBuilder(exactSizeIfKnown)
+               : doubleBuilder();
+    }
+
+    /**
+     * Produces a variable size @{link Node.Builder.OfDouble}.
+     *
+     * @return a {@code Node.Builder.OfDouble}
+     */
+    static Node.Builder.OfDouble doubleBuilder() {
+        return new DoubleSpinedNodeBuilder();
+    }
+
+    // Parallel evaluation of pipelines to nodes
+
+    /**
+     * Collect, in parallel, elements output from a pipeline and describe those
+     * elements with a {@link Node}.
+     *
+     * @implSpec
+     * If the exact size of the output from the pipeline is known and the source
+     * {@link Spliterator} has the {@link Spliterator#SUBSIZED} characteristic,
+     * then a flat {@link Node} will be returned whose content is an array,
+     * since the size is known the array can be constructed in advance and
+     * output elements can be placed into the array concurrently by leaf
+     * tasks at the correct offsets.  If the exact size is not known, output
+     * elements are collected into a conc-node whose shape mirrors that
+     * of the computation. This conc-node can then be flattened in
+     * parallel to produce a flat {@code Node} if desired.
+     *
+     * @param helper the pipeline helper describing the pipeline
+     * @param flattenTree whether a conc node should be flattened into a node
+     *                    describing an array before returning
+     * @param generator the array generator
+     * @return a {@link Node} describing the output elements
+     */
+    public static <P_IN, P_OUT> Node<P_OUT> collect(PipelineHelper<P_OUT> helper,
+                                                    Spliterator<P_IN> spliterator,
+                                                    boolean flattenTree,
+                                                    IntFunction<P_OUT[]> generator) {
+        long size = helper.exactOutputSizeIfKnown(spliterator);
+        if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+            if (size >= MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            P_OUT[] array = generator.apply((int) size);
+            new SizedCollectorTask.OfRef<>(spliterator, helper, array).invoke();
+            return node(array);
+        } else {
+            Node<P_OUT> node = new CollectorTask<>(helper, generator, spliterator).invoke();
+            return flattenTree ? flatten(node, generator) : node;
+        }
+    }
+
+    /**
+     * Collect, in parallel, elements output from an int-valued pipeline and
+     * describe those elements with a {@link Node.OfInt}.
+     *
+     * @implSpec
+     * If the exact size of the output from the pipeline is known and the source
+     * {@link Spliterator} has the {@link Spliterator#SUBSIZED} characteristic,
+     * then a flat {@link Node} will be returned whose content is an array,
+     * since the size is known the array can be constructed in advance and
+     * output elements can be placed into the array concurrently by leaf
+     * tasks at the correct offsets.  If the exact size is not known, output
+     * elements are collected into a conc-node whose shape mirrors that
+     * of the computation. This conc-node can then be flattened in
+     * parallel to produce a flat {@code Node.OfInt} if desired.
+     *
+     * @param <P_IN> the type of elements from the source Spliterator
+     * @param helper the pipeline helper describing the pipeline
+     * @param flattenTree whether a conc node should be flattened into a node
+     *                    describing an array before returning
+     * @return a {@link Node.OfInt} describing the output elements
+     */
+    public static <P_IN> Node.OfInt collectInt(PipelineHelper<Integer> helper,
+                                               Spliterator<P_IN> spliterator,
+                                               boolean flattenTree) {
+        long size = helper.exactOutputSizeIfKnown(spliterator);
+        if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+            if (size >= MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            int[] array = new int[(int) size];
+            new SizedCollectorTask.OfInt<>(spliterator, helper, array).invoke();
+            return node(array);
+        }
+        else {
+            Node.OfInt node = new IntCollectorTask<>(helper, spliterator).invoke();
+            return flattenTree ? flattenInt(node) : node;
+        }
+    }
+
+    /**
+     * Collect, in parallel, elements output from a long-valued pipeline and
+     * describe those elements with a {@link Node.OfLong}.
+     *
+     * @implSpec
+     * If the exact size of the output from the pipeline is known and the source
+     * {@link Spliterator} has the {@link Spliterator#SUBSIZED} characteristic,
+     * then a flat {@link Node} will be returned whose content is an array,
+     * since the size is known the array can be constructed in advance and
+     * output elements can be placed into the array concurrently by leaf
+     * tasks at the correct offsets.  If the exact size is not known, output
+     * elements are collected into a conc-node whose shape mirrors that
+     * of the computation. This conc-node can then be flattened in
+     * parallel to produce a flat {@code Node.OfLong} if desired.
+     *
+     * @param <P_IN> the type of elements from the source Spliterator
+     * @param helper the pipeline helper describing the pipeline
+     * @param flattenTree whether a conc node should be flattened into a node
+     *                    describing an array before returning
+     * @return a {@link Node.OfLong} describing the output elements
+     */
+    public static <P_IN> Node.OfLong collectLong(PipelineHelper<Long> helper,
+                                                 Spliterator<P_IN> spliterator,
+                                                 boolean flattenTree) {
+        long size = helper.exactOutputSizeIfKnown(spliterator);
+        if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+            if (size >= MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            long[] array = new long[(int) size];
+            new SizedCollectorTask.OfLong<>(spliterator, helper, array).invoke();
+            return node(array);
+        }
+        else {
+            Node.OfLong node = new LongCollectorTask<>(helper, spliterator).invoke();
+            return flattenTree ? flattenLong(node) : node;
+        }
+    }
+
+    /**
+     * Collect, in parallel, elements output from n double-valued pipeline and
+     * describe those elements with a {@link Node.OfDouble}.
+     *
+     * @implSpec
+     * If the exact size of the output from the pipeline is known and the source
+     * {@link Spliterator} has the {@link Spliterator#SUBSIZED} characteristic,
+     * then a flat {@link Node} will be returned whose content is an array,
+     * since the size is known the array can be constructed in advance and
+     * output elements can be placed into the array concurrently by leaf
+     * tasks at the correct offsets.  If the exact size is not known, output
+     * elements are collected into a conc-node whose shape mirrors that
+     * of the computation. This conc-node can then be flattened in
+     * parallel to produce a flat {@code Node.OfDouble} if desired.
+     *
+     * @param <P_IN> the type of elements from the source Spliterator
+     * @param helper the pipeline helper describing the pipeline
+     * @param flattenTree whether a conc node should be flattened into a node
+     *                    describing an array before returning
+     * @return a {@link Node.OfDouble} describing the output elements
+     */
+    public static <P_IN> Node.OfDouble collectDouble(PipelineHelper<Double> helper,
+                                                     Spliterator<P_IN> spliterator,
+                                                     boolean flattenTree) {
+        long size = helper.exactOutputSizeIfKnown(spliterator);
+        if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
+            if (size >= MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            double[] array = new double[(int) size];
+            new SizedCollectorTask.OfDouble<>(spliterator, helper, array).invoke();
+            return node(array);
+        }
+        else {
+            Node.OfDouble node = new DoubleCollectorTask<>(helper, spliterator).invoke();
+            return flattenTree ? flattenDouble(node) : node;
+        }
+    }
+
+    // Parallel flattening of nodes
+
+    /**
+     * Flatten, in parallel, a {@link Node}.  A flattened node is one that has
+     * no children.  If the node is already flat, it is simply returned.
+     *
+     * @implSpec
+     * If a new node is to be created, the generator is used to create an array
+     * whose length is {@link Node#count()}.  Then the node tree is traversed
+     * and leaf node elements are placed in the array concurrently by leaf tasks
+     * at the correct offsets.
+     *
+     * @param <T> type of elements contained by the node
+     * @param node the node to flatten
+     * @param generator the array factory used to create array instances
+     * @return a flat {@code Node}
+     */
+    public static <T> Node<T> flatten(Node<T> node, IntFunction<T[]> generator) {
+        if (node.getChildCount() > 0) {
+            T[] array = generator.apply((int) node.count());
+            new ToArrayTask.OfRef<>(node, array, 0).invoke();
+            return node(array);
+        } else {
+            return node;
+        }
+    }
+
+    /**
+     * Flatten, in parallel, a {@link Node.OfInt}.  A flattened node is one that
+     * has no children.  If the node is already flat, it is simply returned.
+     *
+     * @implSpec
+     * If a new node is to be created, a new int[] array is created whose length
+     * is {@link Node#count()}.  Then the node tree is traversed and leaf node
+     * elements are placed in the array concurrently by leaf tasks at the
+     * correct offsets.
+     *
+     * @param node the node to flatten
+     * @return a flat {@code Node.OfInt}
+     */
+    public static Node.OfInt flattenInt(Node.OfInt node) {
+        if (node.getChildCount() > 0) {
+            int[] array = new int[(int) node.count()];
+            new ToArrayTask.OfInt(node, array, 0).invoke();
+            return node(array);
+        } else {
+            return node;
+        }
+    }
+
+    /**
+     * Flatten, in parallel, a {@link Node.OfLong}.  A flattened node is one that
+     * has no children.  If the node is already flat, it is simply returned.
+     *
+     * @implSpec
+     * If a new node is to be created, a new long[] array is created whose length
+     * is {@link Node#count()}.  Then the node tree is traversed and leaf node
+     * elements are placed in the array concurrently by leaf tasks at the
+     * correct offsets.
+     *
+     * @param node the node to flatten
+     * @return a flat {@code Node.OfLong}
+     */
+    public static Node.OfLong flattenLong(Node.OfLong node) {
+        if (node.getChildCount() > 0) {
+            long[] array = new long[(int) node.count()];
+            new ToArrayTask.OfLong(node, array, 0).invoke();
+            return node(array);
+        } else {
+            return node;
+        }
+    }
+
+    /**
+     * Flatten, in parallel, a {@link Node.OfDouble}.  A flattened node is one that
+     * has no children.  If the node is already flat, it is simply returned.
+     *
+     * @implSpec
+     * If a new node is to be created, a new double[] array is created whose length
+     * is {@link Node#count()}.  Then the node tree is traversed and leaf node
+     * elements are placed in the array concurrently by leaf tasks at the
+     * correct offsets.
+     *
+     * @param node the node to flatten
+     * @return a flat {@code Node.OfDouble}
+     */
+    public static Node.OfDouble flattenDouble(Node.OfDouble node) {
+        if (node.getChildCount() > 0) {
+            double[] array = new double[(int) node.count()];
+            new ToArrayTask.OfDouble(node, array, 0).invoke();
+            return node(array);
+        } else {
+            return node;
+        }
+    }
+
+    // Implementations
+
+    private static abstract class EmptyNode<T, T_ARR, T_CONS> implements Node<T> {
+        EmptyNode() { }
+
+        @Override
+        public T[] asArray(IntFunction<T[]> generator) {
+            return generator.apply(0);
+        }
+
+        public void copyInto(T_ARR array, int offset) { }
+
+        @Override
+        public long count() {
+            return 0;
+        }
+
+        public void forEach(T_CONS consumer) { }
+
+        private static class OfRef<T> extends EmptyNode<T, T[], Consumer<? super T>> {
+            private OfRef() {
+                super();
+            }
+
+            @Override
+            public Spliterator<T> spliterator() {
+                return Spliterators.emptySpliterator();
+            }
+        }
+
+        private static final class OfInt
+                extends EmptyNode<Integer, int[], IntConsumer>
+                implements Node.OfInt {
+
+            OfInt() { } // Avoid creation of special accessor
+
+            @Override
+            public Spliterator.OfInt spliterator() {
+                return Spliterators.emptyIntSpliterator();
+            }
+
+            @Override
+            public int[] asIntArray() {
+                return EMPTY_INT_ARRAY;
+            }
+        }
+
+        private static final class OfLong
+                extends EmptyNode<Long, long[], LongConsumer>
+                implements Node.OfLong {
+
+            OfLong() { } // Avoid creation of special accessor
+
+            @Override
+            public Spliterator.OfLong spliterator() {
+                return Spliterators.emptyLongSpliterator();
+            }
+
+            @Override
+            public long[] asLongArray() {
+                return EMPTY_LONG_ARRAY;
+            }
+        }
+
+        private static final class OfDouble
+                extends EmptyNode<Double, double[], DoubleConsumer>
+                implements Node.OfDouble {
+
+            OfDouble() { } // Avoid creation of special accessor
+
+            @Override
+            public Spliterator.OfDouble spliterator() {
+                return Spliterators.emptyDoubleSpliterator();
+            }
+
+            @Override
+            public double[] asDoubleArray() {
+                return EMPTY_DOUBLE_ARRAY;
+            }
+        }
+    }
+
+    /** Node class for a reference array */
+    private static class ArrayNode<T> implements Node<T> {
+        final T[] array;
+        int curSize;
+
+        @SuppressWarnings("unchecked")
+        ArrayNode(long size, IntFunction<T[]> generator) {
+            if (size >= MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            this.array = generator.apply((int) size);
+            this.curSize = 0;
+        }
+
+        ArrayNode(T[] array) {
+            this.array = array;
+            this.curSize = array.length;
+        }
+
+        // Node
+
+        @Override
+        public Spliterator<T> spliterator() {
+            return Arrays.spliterator(array, 0, curSize);
+        }
+
+        @Override
+        public void copyInto(T[] dest, int destOffset) {
+            System.arraycopy(array, 0, dest, destOffset, curSize);
+        }
+
+        @Override
+        public T[] asArray(IntFunction<T[]> generator) {
+            if (array.length == curSize) {
+                return array;
+            } else {
+                throw new IllegalStateException();
+            }
+        }
+
+        @Override
+        public long count() {
+            return curSize;
+        }
+
+        // Traversable
+
+        @Override
+        public void forEach(Consumer<? super T> consumer) {
+            for (int i = 0; i < curSize; i++) {
+                consumer.accept(array[i]);
+            }
+        }
+
+        //
+
+        @Override
+        public String toString() {
+            return String.format("ArrayNode[%d][%s]",
+                                 array.length - curSize, Arrays.toString(array));
+        }
+    }
+
+    /** Node class for a Collection */
+    private static final class CollectionNode<T> implements Node<T> {
+        private final Collection<T> c;
+
+        CollectionNode(Collection<T> c) {
+            this.c = c;
+        }
+
+        // Node
+
+        @Override
+        public Spliterator<T> spliterator() {
+            return c.stream().spliterator();
+        }
+
+        @Override
+        public void copyInto(T[] array, int offset) {
+            for (T t : c)
+                array[offset++] = t;
+        }
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public T[] asArray(IntFunction<T[]> generator) {
+            return c.toArray(generator.apply(c.size()));
+        }
+
+        @Override
+        public long count() {
+            return c.size();
+        }
+
+        @Override
+        public void forEach(Consumer<? super T> consumer) {
+            c.forEach(consumer);
+        }
+
+        //
+
+        @Override
+        public String toString() {
+            return String.format("CollectionNode[%d][%s]", c.size(), c);
+        }
+    }
+
+    /**
+     * Node class for an internal node with two or more children
+     */
+    static final class ConcNode<T> implements Node<T> {
+        private final Node<T> left;
+        private final Node<T> right;
+
+        private final long size;
+
+        ConcNode(Node<T> left, Node<T> right) {
+            this.left = left;
+            this.right = right;
+            // The Node count will be required when the Node spliterator is
+            // obtained and it is cheaper to aggressively calculate bottom up
+            // as the tree is built rather than later on from the top down
+            // traversing the tree
+            this.size = left.count() + right.count();
+        }
+
+        // Node
+
+        @Override
+        public Spliterator<T> spliterator() {
+            return new Nodes.InternalNodeSpliterator.OfRef<>(this);
+        }
+
+        @Override
+        public int getChildCount() {
+            return 2;
+        }
+
+        @Override
+        public Node<T> getChild(int i) {
+            if (i == 0) return left;
+            if (i == 1) return right;
+            throw new IndexOutOfBoundsException();
+        }
+
+        @Override
+        public void copyInto(T[] array, int offset) {
+            Objects.requireNonNull(array);
+            left.copyInto(array, offset);
+            right.copyInto(array, offset + (int) left.count());
+        }
+
+        @Override
+        public T[] asArray(IntFunction<T[]> generator) {
+            T[] array = generator.apply((int) count());
+            copyInto(array, 0);
+            return array;
+        }
+
+        @Override
+        public long count() {
+            return size;
+        }
+
+        @Override
+        public void forEach(Consumer<? super T> consumer) {
+            left.forEach(consumer);
+            right.forEach(consumer);
+        }
+
+        @Override
+        public String toString() {
+            if (count() < 32) {
+                return String.format("ConcNode[%s.%s]", left, right);
+            } else {
+                return String.format("ConcNode[size=%d]", count());
+            }
+        }
+    }
+
+    /** Abstract class for spliterator for all internal node classes */
+    private static abstract class InternalNodeSpliterator<T,
+                                                          S extends Spliterator<T>,
+                                                          N extends Node<T>, C>
+            implements Spliterator<T> {
+        // Node we are pointing to
+        // null if full traversal has occurred
+        N curNode;
+
+        // next child of curNode to consume
+        int curChildIndex;
+
+        // The spliterator of the curNode if that node is last and has no children.
+        // This spliterator will be delegated to for splitting and traversing.
+        // null if curNode has children
+        S lastNodeSpliterator;
+
+        // spliterator used while traversing with tryAdvance
+        // null if no partial traversal has occurred
+        S tryAdvanceSpliterator;
+
+        // node stack used when traversing to search and find leaf nodes
+        // null if no partial traversal has occurred
+        Deque<N> tryAdvanceStack;
+
+        InternalNodeSpliterator(N curNode) {
+            this.curNode = curNode;
+        }
+
+        /**
+         * Initiate a stack containing, in left-to-right order, the child nodes
+         * covered by this spliterator
+         */
+        protected final Deque<N> initStack() {
+            // Bias size to the case where leaf nodes are close to this node
+            // 8 is the minimum initial capacity for the ArrayDeque implementation
+            Deque<N> stack = new ArrayDeque<>(8);
+            for (int i = curNode.getChildCount() - 1; i >= curChildIndex; i--)
+                stack.addFirst((N) curNode.getChild(i));
+            return stack;
+        }
+
+        /**
+         * Depth first search, in left-to-right order, of the node tree, using
+         * an explicit stack, to find the next non-empty leaf node.
+         */
+        protected final N findNextLeafNode(Deque<N> stack) {
+            N n = null;
+            while ((n = stack.pollFirst()) != null) {
+                if (n.getChildCount() == 0) {
+                    if (n.count() > 0)
+                        return n;
+                } else {
+                    for (int i = n.getChildCount() - 1; i >= 0; i--)
+                        stack.addFirst((N) n.getChild(i));
+                }
+            }
+
+            return null;
+        }
+
+        protected final boolean internalTryAdvance(C consumer) {
+            if (curNode == null)
+                return false;
+
+            if (tryAdvanceSpliterator == null) {
+                if (lastNodeSpliterator == null) {
+                    // Initiate the node stack
+                    tryAdvanceStack = initStack();
+                    N leaf = findNextLeafNode(tryAdvanceStack);
+                    if (leaf != null)
+                        tryAdvanceSpliterator = (S) leaf.spliterator();
+                    else {
+                        // A non-empty leaf node was not found
+                        // No elements to traverse
+                        curNode = null;
+                        return false;
+                    }
+                }
+                else
+                    tryAdvanceSpliterator = lastNodeSpliterator;
+            }
+
+            boolean hasNext = tryAdvance(tryAdvanceSpliterator, consumer);
+            if (!hasNext) {
+                if (lastNodeSpliterator == null) {
+                    // Advance to the spliterator of the next non-empty leaf node
+                    Node<T> leaf = findNextLeafNode(tryAdvanceStack);
+                    if (leaf != null) {
+                        tryAdvanceSpliterator = (S) leaf.spliterator();
+                        // Since the node is not-empty the spliterator can be advanced
+                        return tryAdvance(tryAdvanceSpliterator, consumer);
+                    }
+                }
+                // No more elements to traverse
+                curNode = null;
+            }
+            return hasNext;
+        }
+
+        protected abstract boolean tryAdvance(S spliterator, C consumer);
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public S trySplit() {
+            if (curNode == null || tryAdvanceSpliterator != null)
+                return null; // Cannot split if fully or partially traversed
+            else if (lastNodeSpliterator != null)
+                return (S) lastNodeSpliterator.trySplit();
+            else if (curChildIndex < curNode.getChildCount() - 1)
+                return (S) curNode.getChild(curChildIndex++).spliterator();
+            else {
+                curNode = (N) curNode.getChild(curChildIndex);
+                if (curNode.getChildCount() == 0) {
+                    lastNodeSpliterator = (S) curNode.spliterator();
+                    return (S) lastNodeSpliterator.trySplit();
+                }
+                else {
+                    curChildIndex = 0;
+                    return (S) curNode.getChild(curChildIndex++).spliterator();
+                }
+            }
+        }
+
+        @Override
+        public long estimateSize() {
+            if (curNode == null)
+                return 0;
+
+            // Will not reflect the effects of partial traversal.
+            // This is compliant with the specification
+            if (lastNodeSpliterator != null)
+                return lastNodeSpliterator.estimateSize();
+            else {
+                long size = 0;
+                for (int i = curChildIndex; i < curNode.getChildCount(); i++)
+                    size += curNode.getChild(i).count();
+                return size;
+            }
+        }
+
+        @Override
+        public int characteristics() {
+            return Spliterator.SIZED;
+        }
+
+        private static final class OfRef<T>
+                extends InternalNodeSpliterator<T, Spliterator<T>, Node<T>, Consumer<? super T>> {
+
+            OfRef(Node<T> curNode) {
+                super(curNode);
+            }
+
+            @Override
+            public boolean tryAdvance(Consumer<? super T> consumer) {
+                return internalTryAdvance(consumer);
+            }
+
+            @Override
+            protected boolean tryAdvance(Spliterator<T> spliterator,
+                                         Consumer<? super T> consumer) {
+                return spliterator.tryAdvance(consumer);
+            }
+
+            @Override
+            public void forEachRemaining(Consumer<? super T> consumer) {
+                if (curNode == null)
+                    return;
+
+                if (tryAdvanceSpliterator == null) {
+                    if (lastNodeSpliterator == null) {
+                        Deque<Node<T>> stack = initStack();
+                        Node<T> leaf;
+                        while ((leaf = findNextLeafNode(stack)) != null) {
+                            leaf.forEach(consumer);
+                        }
+                        curNode = null;
+                    }
+                    else
+                        lastNodeSpliterator.forEachRemaining(consumer);
+                }
+                else
+                    while(tryAdvance(consumer)) { }
+            }
+        }
+
+        private static final class OfInt
+                extends InternalNodeSpliterator<Integer, Spliterator.OfInt, Node.OfInt, IntConsumer>
+                implements Spliterator.OfInt {
+
+            OfInt(Node.OfInt cur) {
+                super(cur);
+            }
+
+            @Override
+            public boolean tryAdvance(IntConsumer consumer) {
+                return internalTryAdvance(consumer);
+            }
+
+            @Override
+            protected boolean tryAdvance(Spliterator.OfInt spliterator,
+                                         IntConsumer consumer) {
+                return spliterator.tryAdvance(consumer);
+            }
+
+            @Override
+            public void forEachRemaining(IntConsumer consumer) {
+                if (curNode == null)
+                    return;
+
+                if (tryAdvanceSpliterator == null) {
+                    if (lastNodeSpliterator == null) {
+                        Deque<Node.OfInt> stack = initStack();
+                        Node.OfInt leaf;
+                        while ((leaf = findNextLeafNode(stack)) != null) {
+                            leaf.forEach(consumer);
+                        }
+                        curNode = null;
+                    }
+                    else
+                        lastNodeSpliterator.forEachRemaining(consumer);
+                }
+                else
+                    while(tryAdvance(consumer)) { }
+            }
+        }
+
+        private static final class OfLong
+                extends InternalNodeSpliterator<Long, Spliterator.OfLong, Node.OfLong, LongConsumer>
+                implements Spliterator.OfLong {
+
+            OfLong(Node.OfLong cur) {
+                super(cur);
+            }
+
+            @Override
+            public boolean tryAdvance(LongConsumer consumer) {
+                return internalTryAdvance(consumer);
+            }
+
+            @Override
+            protected boolean tryAdvance(Spliterator.OfLong spliterator,
+                                         LongConsumer consumer) {
+                return spliterator.tryAdvance(consumer);
+            }
+
+            @Override
+            public void forEachRemaining(LongConsumer consumer) {
+                if (curNode == null)
+                    return;
+
+                if (tryAdvanceSpliterator == null) {
+                    if (lastNodeSpliterator == null) {
+                        Deque<Node.OfLong> stack = initStack();
+                        Node.OfLong leaf;
+                        while ((leaf = findNextLeafNode(stack)) != null) {
+                            leaf.forEach(consumer);
+                        }
+                        curNode = null;
+                    }
+                    else
+                        lastNodeSpliterator.forEachRemaining(consumer);
+                }
+                else
+                    while(tryAdvance(consumer)) { }
+            }
+        }
+
+        private static final class OfDouble
+                extends InternalNodeSpliterator<Double, Spliterator.OfDouble, Node.OfDouble, DoubleConsumer>
+                implements Spliterator.OfDouble {
+
+            OfDouble(Node.OfDouble cur) {
+                super(cur);
+            }
+
+            @Override
+            public boolean tryAdvance(DoubleConsumer consumer) {
+                return internalTryAdvance(consumer);
+            }
+
+            @Override
+            protected boolean tryAdvance(Spliterator.OfDouble spliterator,
+                                         DoubleConsumer consumer) {
+                return spliterator.tryAdvance(consumer);
+            }
+
+            @Override
+            public void forEachRemaining(DoubleConsumer consumer) {
+                if (curNode == null)
+                    return;
+
+                if (tryAdvanceSpliterator == null) {
+                    if (lastNodeSpliterator == null) {
+                        Deque<Node.OfDouble> stack = initStack();
+                        Node.OfDouble leaf;
+                        while ((leaf = findNextLeafNode(stack)) != null) {
+                            leaf.forEach(consumer);
+                        }
+                        curNode = null;
+                    }
+                    else
+                        lastNodeSpliterator.forEachRemaining(consumer);
+                }
+                else
+                    while(tryAdvance(consumer)) { }
+            }
+        }
+    }
+
+    /**
+     * Fixed-sized builder class for reference nodes
+     */
+    private static final class FixedNodeBuilder<T>
+            extends ArrayNode<T>
+            implements Node.Builder<T> {
+
+        FixedNodeBuilder(long size, IntFunction<T[]> generator) {
+            super(size, generator);
+            assert size < MAX_ARRAY_SIZE;
+        }
+
+        @Override
+        public Node<T> build() {
+            if (curSize < array.length)
+                throw new IllegalStateException(String.format("Current size %d is less than fixed size %d",
+                                                              curSize, array.length));
+            return this;
+        }
+
+        @Override
+        public void begin(long size) {
+            if (size != array.length)
+                throw new IllegalStateException(String.format("Begin size %d is not equal to fixed size %d",
+                                                              size, array.length));
+            curSize = 0;
+        }
+
+        @Override
+        public void accept(T t) {
+            if (curSize < array.length) {
+                array[curSize++] = t;
+            } else {
+                throw new IllegalStateException(String.format("Accept exceeded fixed size of %d",
+                                                              array.length));
+            }
+        }
+
+        @Override
+        public void end() {
+            if (curSize < array.length)
+                throw new IllegalStateException(String.format("End size %d is less than fixed size %d",
+                                                              curSize, array.length));
+        }
+
+        @Override
+        public String toString() {
+            return String.format("FixedNodeBuilder[%d][%s]",
+                                 array.length - curSize, Arrays.toString(array));
+        }
+    }
+
+    /**
+     * Variable-sized builder class for reference nodes
+     */
+    private static final class SpinedNodeBuilder<T>
+            extends SpinedBuffer<T>
+            implements Node<T>, Node.Builder<T> {
+        private boolean building = false;
+
+        SpinedNodeBuilder() {} // Avoid creation of special accessor
+
+        @Override
+        public Spliterator<T> spliterator() {
+            assert !building : "during building";
+            return super.spliterator();
+        }
+
+        @Override
+        public void forEach(Consumer<? super T> consumer) {
+            assert !building : "during building";
+            super.forEach(consumer);
+        }
+
+        //
+        @Override
+        public void begin(long size) {
+            assert !building : "was already building";
+            building = true;
+            clear();
+            ensureCapacity(size);
+        }
+
+        @Override
+        public void accept(T t) {
+            assert building : "not building";
+            super.accept(t);
+        }
+
+        @Override
+        public void end() {
+            assert building : "was not building";
+            building = false;
+            // @@@ check begin(size) and size
+        }
+
+        @Override
+        public void copyInto(T[] array, int offset) {
+            assert !building : "during building";
+            super.copyInto(array, offset);
+        }
+
+        @Override
+        public T[] asArray(IntFunction<T[]> arrayFactory) {
+            assert !building : "during building";
+            return super.asArray(arrayFactory);
+        }
+
+        @Override
+        public Node<T> build() {
+            assert !building : "during building";
+            return this;
+        }
+    }
+
+    //
+
+    private static final int[] EMPTY_INT_ARRAY = new int[0];
+    private static final long[] EMPTY_LONG_ARRAY = new long[0];
+    private static final double[] EMPTY_DOUBLE_ARRAY = new double[0];
+
+    private abstract static class AbstractPrimitiveConcNode<E, N extends Node<E>>
+            implements Node<E> {
+        final N left;
+        final N right;
+        final long size;
+
+        AbstractPrimitiveConcNode(N left, N right) {
+            this.left = left;
+            this.right = right;
+            // The Node count will be required when the Node spliterator is
+            // obtained and it is cheaper to aggressively calculate bottom up as
+            // the tree is built rather than later on by traversing the tree
+            this.size = left.count() + right.count();
+        }
+
+        @Override
+        public int getChildCount() {
+            return 2;
+        }
+
+        @Override
+        public N getChild(int i) {
+            if (i == 0) return left;
+            if (i == 1) return right;
+            throw new IndexOutOfBoundsException();
+        }
+
+        @Override
+        public long count() {
+            return size;
+        }
+
+        @Override
+        public String toString() {
+            if (count() < 32)
+                return String.format("%s[%s.%s]", this.getClass().getName(), left, right);
+            else
+                return String.format("%s[size=%d]", this.getClass().getName(), count());
+        }
+    }
+
+    private static class IntArrayNode implements Node.OfInt {
+        final int[] array;
+        int curSize;
+
+        IntArrayNode(long size) {
+            if (size >= MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            this.array = new int[(int) size];
+            this.curSize = 0;
+        }
+
+        IntArrayNode(int[] array) {
+            this.array = array;
+            this.curSize = array.length;
+        }
+
+        // Node
+
+        @Override
+        public Spliterator.OfInt spliterator() {
+            return Arrays.spliterator(array, 0, curSize);
+        }
+
+        @Override
+        public int[] asIntArray() {
+            if (array.length == curSize) {
+                return array;
+            } else {
+                return Arrays.copyOf(array, curSize);
+            }
+        }
+
+        @Override
+        public void copyInto(int[] dest, int destOffset) {
+            System.arraycopy(array, 0, dest, destOffset, curSize);
+        }
+
+        @Override
+        public long count() {
+            return curSize;
+        }
+
+        @Override
+        public void forEach(IntConsumer consumer) {
+            for (int i = 0; i < curSize; i++) {
+                consumer.accept(array[i]);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return String.format("IntArrayNode[%d][%s]",
+                                 array.length - curSize, Arrays.toString(array));
+        }
+    }
+
+    private static class LongArrayNode implements Node.OfLong {
+        final long[] array;
+        int curSize;
+
+        LongArrayNode(long size) {
+            if (size >= MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            this.array = new long[(int) size];
+            this.curSize = 0;
+        }
+
+        LongArrayNode(long[] array) {
+            this.array = array;
+            this.curSize = array.length;
+        }
+
+        @Override
+        public Spliterator.OfLong spliterator() {
+            return Arrays.spliterator(array, 0, curSize);
+        }
+
+        @Override
+        public long[] asLongArray() {
+            if (array.length == curSize) {
+                return array;
+            } else {
+                return Arrays.copyOf(array, curSize);
+            }
+        }
+
+        @Override
+        public void copyInto(long[] dest, int destOffset) {
+            System.arraycopy(array, 0, dest, destOffset, curSize);
+        }
+
+        @Override
+        public long count() {
+            return curSize;
+        }
+
+        @Override
+        public void forEach(LongConsumer consumer) {
+            for (int i = 0; i < curSize; i++) {
+                consumer.accept(array[i]);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return String.format("LongArrayNode[%d][%s]",
+                                 array.length - curSize, Arrays.toString(array));
+        }
+    }
+
+    private static class DoubleArrayNode implements Node.OfDouble {
+        final double[] array;
+        int curSize;
+
+        DoubleArrayNode(long size) {
+            if (size >= MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            this.array = new double[(int) size];
+            this.curSize = 0;
+        }
+
+        DoubleArrayNode(double[] array) {
+            this.array = array;
+            this.curSize = array.length;
+        }
+
+        @Override
+        public Spliterator.OfDouble spliterator() {
+            return Arrays.spliterator(array, 0, curSize);
+        }
+
+        @Override
+        public double[] asDoubleArray() {
+            if (array.length == curSize) {
+                return array;
+            } else {
+                return Arrays.copyOf(array, curSize);
+            }
+        }
+
+        @Override
+        public void copyInto(double[] dest, int destOffset) {
+            System.arraycopy(array, 0, dest, destOffset, curSize);
+        }
+
+        @Override
+        public long count() {
+            return curSize;
+        }
+
+        @Override
+        public void forEach(DoubleConsumer consumer) {
+            for (int i = 0; i < curSize; i++) {
+                consumer.accept(array[i]);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return String.format("DoubleArrayNode[%d][%s]",
+                                 array.length - curSize, Arrays.toString(array));
+        }
+    }
+
+    static final class IntConcNode
+            extends AbstractPrimitiveConcNode<Integer, Node.OfInt>
+            implements Node.OfInt {
+
+        IntConcNode(Node.OfInt left, Node.OfInt right) {
+            super(left, right);
+        }
+
+        @Override
+        public void forEach(IntConsumer consumer) {
+            left.forEach(consumer);
+            right.forEach(consumer);
+        }
+
+        @Override
+        public Spliterator.OfInt spliterator() {
+            return new InternalNodeSpliterator.OfInt(this);
+        }
+
+        @Override
+        public void copyInto(int[] array, int offset) {
+            left.copyInto(array, offset);
+            right.copyInto(array, offset + (int) left.count());
+        }
+
+        @Override
+        public int[] asIntArray() {
+            int[] array = new int[(int) count()];
+            copyInto(array, 0);
+            return array;
+        }
+    }
+
+    static final class LongConcNode
+            extends AbstractPrimitiveConcNode<Long, Node.OfLong>
+            implements Node.OfLong {
+
+        LongConcNode(Node.OfLong left, Node.OfLong right) {
+            super(left, right);
+        }
+
+        @Override
+        public void forEach(LongConsumer consumer) {
+            left.forEach(consumer);
+            right.forEach(consumer);
+        }
+
+        @Override
+        public Spliterator.OfLong spliterator() {
+            return new InternalNodeSpliterator.OfLong(this);
+        }
+
+        @Override
+        public void copyInto(long[] array, int offset) {
+            left.copyInto(array, offset);
+            right.copyInto(array, offset + (int) left.count());
+        }
+
+        @Override
+        public long[] asLongArray() {
+            long[] array = new long[(int) count()];
+            copyInto(array, 0);
+            return array;
+        }
+    }
+
+    static final class DoubleConcNode
+            extends AbstractPrimitiveConcNode<Double, Node.OfDouble>
+            implements Node.OfDouble {
+
+        DoubleConcNode(Node.OfDouble left, Node.OfDouble right) {
+            super(left, right);
+        }
+
+        @Override
+        public void forEach(DoubleConsumer consumer) {
+            left.forEach(consumer);
+            right.forEach(consumer);
+        }
+
+        @Override
+        public Spliterator.OfDouble spliterator() {
+            return new InternalNodeSpliterator.OfDouble(this);
+        }
+
+        @Override
+        public void copyInto(double[] array, int offset) {
+            left.copyInto(array, offset);
+            right.copyInto(array, offset + (int) left.count());
+        }
+
+        @Override
+        public double[] asDoubleArray() {
+            double[] array = new double[(int) count()];
+            copyInto(array, 0);
+            return array;
+        }
+    }
+
+    private static final class IntFixedNodeBuilder
+            extends IntArrayNode
+            implements Node.Builder.OfInt {
+
+        IntFixedNodeBuilder(long size) {
+            super(size);
+            assert size < MAX_ARRAY_SIZE;
+        }
+
+        @Override
+        public Node.OfInt build() {
+            if (curSize < array.length) {
+                throw new IllegalStateException(String.format("Current size %d is less than fixed size %d",
+                                                              curSize, array.length));
+            }
+
+            return this;
+        }
+
+        @Override
+        public void begin(long size) {
+            if (size != array.length) {
+                throw new IllegalStateException(String.format("Begin size %d is not equal to fixed size %d",
+                                                              size, array.length));
+            }
+
+            curSize = 0;
+        }
+
+        @Override
+        public void accept(int i) {
+            if (curSize < array.length) {
+                array[curSize++] = i;
+            } else {
+                throw new IllegalStateException(String.format("Accept exceeded fixed size of %d",
+                                                              array.length));
+            }
+        }
+
+        @Override
+        public void end() {
+            if (curSize < array.length) {
+                throw new IllegalStateException(String.format("End size %d is less than fixed size %d",
+                                                              curSize, array.length));
+            }
+        }
+
+        @Override
+        public String toString() {
+            return String.format("IntFixedNodeBuilder[%d][%s]",
+                                 array.length - curSize, Arrays.toString(array));
+        }
+    }
+
+    private static final class LongFixedNodeBuilder
+            extends LongArrayNode
+            implements Node.Builder.OfLong {
+
+        LongFixedNodeBuilder(long size) {
+            super(size);
+            assert size < MAX_ARRAY_SIZE;
+        }
+
+        @Override
+        public Node.OfLong build() {
+            if (curSize < array.length) {
+                throw new IllegalStateException(String.format("Current size %d is less than fixed size %d",
+                                                              curSize, array.length));
+            }
+
+            return this;
+        }
+
+        @Override
+        public void begin(long size) {
+            if (size != array.length) {
+                throw new IllegalStateException(String.format("Begin size %d is not equal to fixed size %d",
+                                                              size, array.length));
+            }
+
+            curSize = 0;
+        }
+
+        @Override
+        public void accept(long i) {
+            if (curSize < array.length) {
+                array[curSize++] = i;
+            } else {
+                throw new IllegalStateException(String.format("Accept exceeded fixed size of %d",
+                                                              array.length));
+            }
+        }
+
+        @Override
+        public void end() {
+            if (curSize < array.length) {
+                throw new IllegalStateException(String.format("End size %d is less than fixed size %d",
+                                                              curSize, array.length));
+            }
+        }
+
+        @Override
+        public String toString() {
+            return String.format("LongFixedNodeBuilder[%d][%s]",
+                                 array.length - curSize, Arrays.toString(array));
+        }
+    }
+
+    private static final class DoubleFixedNodeBuilder
+            extends DoubleArrayNode
+            implements Node.Builder.OfDouble {
+
+        DoubleFixedNodeBuilder(long size) {
+            super(size);
+            assert size < MAX_ARRAY_SIZE;
+        }
+
+        @Override
+        public Node.OfDouble build() {
+            if (curSize < array.length) {
+                throw new IllegalStateException(String.format("Current size %d is less than fixed size %d",
+                                                              curSize, array.length));
+            }
+
+            return this;
+        }
+
+        @Override
+        public void begin(long size) {
+            if (size != array.length) {
+                throw new IllegalStateException(String.format("Begin size %d is not equal to fixed size %d",
+                                                              size, array.length));
+            }
+
+            curSize = 0;
+        }
+
+        @Override
+        public void accept(double i) {
+            if (curSize < array.length) {
+                array[curSize++] = i;
+            } else {
+                throw new IllegalStateException(String.format("Accept exceeded fixed size of %d",
+                                                              array.length));
+            }
+        }
+
+        @Override
+        public void end() {
+            if (curSize < array.length) {
+                throw new IllegalStateException(String.format("End size %d is less than fixed size %d",
+                                                              curSize, array.length));
+            }
+        }
+
+        @Override
+        public String toString() {
+            return String.format("DoubleFixedNodeBuilder[%d][%s]",
+                                 array.length - curSize, Arrays.toString(array));
+        }
+    }
+
+    private static final class IntSpinedNodeBuilder
+            extends SpinedBuffer.OfInt
+            implements Node.OfInt, Node.Builder.OfInt {
+        private boolean building = false;
+
+        IntSpinedNodeBuilder() {} // Avoid creation of special accessor
+
+        @Override
+        public Spliterator.OfInt spliterator() {
+            assert !building : "during building";
+            return super.spliterator();
+        }
+
+        @Override
+        public void forEach(IntConsumer consumer) {
+            assert !building : "during building";
+            super.forEach(consumer);
+        }
+
+        //
+        @Override
+        public void begin(long size) {
+            assert !building : "was already building";
+            building = true;
+            clear();
+            ensureCapacity(size);
+        }
+
+        @Override
+        public void accept(int i) {
+            assert building : "not building";
+            super.accept(i);
+        }
+
+        @Override
+        public void end() {
+            assert building : "was not building";
+            building = false;
+            // @@@ check begin(size) and size
+        }
+
+        @Override
+        public void copyInto(int[] array, int offset) throws IndexOutOfBoundsException {
+            assert !building : "during building";
+            super.copyInto(array, offset);
+        }
+
+        @Override
+        public int[] asIntArray() {
+            assert !building : "during building";
+            return super.asIntArray();
+        }
+
+        @Override
+        public Node.OfInt build() {
+            assert !building : "during building";
+            return this;
+        }
+    }
+
+    private static final class LongSpinedNodeBuilder
+            extends SpinedBuffer.OfLong
+            implements Node.OfLong, Node.Builder.OfLong {
+        private boolean building = false;
+
+        LongSpinedNodeBuilder() {} // Avoid creation of special accessor
+
+        @Override
+        public Spliterator.OfLong spliterator() {
+            assert !building : "during building";
+            return super.spliterator();
+        }
+
+        @Override
+        public void forEach(LongConsumer consumer) {
+            assert !building : "during building";
+            super.forEach(consumer);
+        }
+
+        //
+        @Override
+        public void begin(long size) {
+            assert !building : "was already building";
+            building = true;
+            clear();
+            ensureCapacity(size);
+        }
+
+        @Override
+        public void accept(long i) {
+            assert building : "not building";
+            super.accept(i);
+        }
+
+        @Override
+        public void end() {
+            assert building : "was not building";
+            building = false;
+            // @@@ check begin(size) and size
+        }
+
+        @Override
+        public void copyInto(long[] array, int offset) {
+            assert !building : "during building";
+            super.copyInto(array, offset);
+        }
+
+        @Override
+        public long[] asLongArray() {
+            assert !building : "during building";
+            return super.asLongArray();
+        }
+
+        @Override
+        public Node.OfLong build() {
+            assert !building : "during building";
+            return this;
+        }
+    }
+
+    private static final class DoubleSpinedNodeBuilder
+            extends SpinedBuffer.OfDouble
+            implements Node.OfDouble, Node.Builder.OfDouble {
+        private boolean building = false;
+
+        DoubleSpinedNodeBuilder() {} // Avoid creation of special accessor
+
+        @Override
+        public Spliterator.OfDouble spliterator() {
+            assert !building : "during building";
+            return super.spliterator();
+        }
+
+        @Override
+        public void forEach(DoubleConsumer consumer) {
+            assert !building : "during building";
+            super.forEach(consumer);
+        }
+
+        //
+        @Override
+        public void begin(long size) {
+            assert !building : "was already building";
+            building = true;
+            clear();
+            ensureCapacity(size);
+        }
+
+        @Override
+        public void accept(double i) {
+            assert building : "not building";
+            super.accept(i);
+        }
+
+        @Override
+        public void end() {
+            assert building : "was not building";
+            building = false;
+            // @@@ check begin(size) and size
+        }
+
+        @Override
+        public void copyInto(double[] array, int offset) {
+            assert !building : "during building";
+            super.copyInto(array, offset);
+        }
+
+        @Override
+        public double[] asDoubleArray() {
+            assert !building : "during building";
+            return super.asDoubleArray();
+        }
+
+        @Override
+        public Node.OfDouble build() {
+            assert !building : "during building";
+            return this;
+        }
+    }
+
+    private static abstract class SizedCollectorTask<P_IN, P_OUT, T_SINK extends Sink<P_OUT>,
+                                                     K extends SizedCollectorTask<P_IN, P_OUT, T_SINK, K>>
+            extends CountedCompleter<Void>
+            implements Sink<P_OUT> {
+        protected final Spliterator<P_IN> spliterator;
+        protected final PipelineHelper<P_OUT> helper;
+        protected final long targetSize;
+        protected long offset;
+        protected long length;
+        // For Sink implementation
+        protected int index, fence;
+
+        SizedCollectorTask(Spliterator<P_IN> spliterator,
+                           PipelineHelper<P_OUT> helper,
+                           int arrayLength) {
+            assert spliterator.hasCharacteristics(Spliterator.SUBSIZED);
+            this.spliterator = spliterator;
+            this.helper = helper;
+            this.targetSize = AbstractTask.suggestTargetSize(spliterator.estimateSize());
+            this.offset = 0;
+            this.length = arrayLength;
+        }
+
+        SizedCollectorTask(K parent, Spliterator<P_IN> spliterator,
+                           long offset, long length, int arrayLength) {
+            super(parent);
+            assert spliterator.hasCharacteristics(Spliterator.SUBSIZED);
+            this.spliterator = spliterator;
+            this.helper = parent.helper;
+            this.targetSize = parent.targetSize;
+            this.offset = offset;
+            this.length = length;
+
+            if (offset < 0 || length < 0 || (offset + length - 1 >= arrayLength)) {
+                throw new IllegalArgumentException(
+                        String.format("offset and length interval [%d, %d + %d) is not within array size interval [0, %d)",
+                                      offset, offset, length, arrayLength));
+            }
+        }
+
+        @Override
+        public void compute() {
+            SizedCollectorTask<P_IN, P_OUT, T_SINK, K> task = this;
+            while (true) {
+                Spliterator<P_IN> leftSplit;
+                if (!AbstractTask.suggestSplit(task.spliterator, task.targetSize)
+                    || ((leftSplit = task.spliterator.trySplit()) == null)) {
+                    if (task.offset + task.length >= MAX_ARRAY_SIZE)
+                        throw new IllegalArgumentException("Stream size exceeds max array size");
+                    T_SINK sink = (T_SINK) task;
+                    task.helper.wrapAndCopyInto(sink, task.spliterator);
+                    task.propagateCompletion();
+                    return;
+                }
+                else {
+                    task.setPendingCount(1);
+                    long leftSplitSize = leftSplit.estimateSize();
+                    task.makeChild(leftSplit, task.offset, leftSplitSize).fork();
+                    task = task.makeChild(task.spliterator, task.offset + leftSplitSize,
+                                          task.length - leftSplitSize);
+                }
+            }
+        }
+
+        abstract K makeChild(Spliterator<P_IN> spliterator, long offset, long size);
+
+        @Override
+        public void begin(long size) {
+            if(size > length)
+                throw new IllegalStateException("size passed to Sink.begin exceeds array length");
+            index = (int) offset;
+            fence = (int) offset + (int) length;
+        }
+
+        static final class OfRef<P_IN, P_OUT>
+                extends SizedCollectorTask<P_IN, P_OUT, Sink<P_OUT>, OfRef<P_IN, P_OUT>>
+                implements Sink<P_OUT> {
+            private final P_OUT[] array;
+
+            OfRef(Spliterator<P_IN> spliterator, PipelineHelper<P_OUT> helper, P_OUT[] array) {
+                super(spliterator, helper, array.length);
+                this.array = array;
+            }
+
+            OfRef(OfRef<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator,
+                  long offset, long length) {
+                super(parent, spliterator, offset, length, parent.array.length);
+                this.array = parent.array;
+            }
+
+            @Override
+            OfRef<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator,
+                                         long offset, long size) {
+                return new OfRef<>(this, spliterator, offset, size);
+            }
+
+            @Override
+            public void accept(P_OUT value) {
+                if (index >= fence) {
+                    throw new IndexOutOfBoundsException(Integer.toString(index));
+                }
+                array[index++] = value;
+            }
+        }
+
+        static final class OfInt<P_IN>
+                extends SizedCollectorTask<P_IN, Integer, Sink.OfInt, OfInt<P_IN>>
+                implements Sink.OfInt {
+            private final int[] array;
+
+            OfInt(Spliterator<P_IN> spliterator, PipelineHelper<Integer> helper, int[] array) {
+                super(spliterator, helper, array.length);
+                this.array = array;
+            }
+
+            OfInt(SizedCollectorTask.OfInt<P_IN> parent, Spliterator<P_IN> spliterator,
+                  long offset, long length) {
+                super(parent, spliterator, offset, length, parent.array.length);
+                this.array = parent.array;
+            }
+
+            @Override
+            SizedCollectorTask.OfInt<P_IN> makeChild(Spliterator<P_IN> spliterator,
+                                                     long offset, long size) {
+                return new SizedCollectorTask.OfInt<>(this, spliterator, offset, size);
+            }
+
+            @Override
+            public void accept(int value) {
+                if (index >= fence) {
+                    throw new IndexOutOfBoundsException(Integer.toString(index));
+                }
+                array[index++] = value;
+            }
+        }
+
+        static final class OfLong<P_IN>
+                extends SizedCollectorTask<P_IN, Long, Sink.OfLong, OfLong<P_IN>>
+                implements Sink.OfLong {
+            private final long[] array;
+
+            OfLong(Spliterator<P_IN> spliterator, PipelineHelper<Long> helper, long[] array) {
+                super(spliterator, helper, array.length);
+                this.array = array;
+            }
+
+            OfLong(SizedCollectorTask.OfLong<P_IN> parent, Spliterator<P_IN> spliterator,
+                   long offset, long length) {
+                super(parent, spliterator, offset, length, parent.array.length);
+                this.array = parent.array;
+            }
+
+            @Override
+            SizedCollectorTask.OfLong<P_IN> makeChild(Spliterator<P_IN> spliterator,
+                                                      long offset, long size) {
+                return new SizedCollectorTask.OfLong<>(this, spliterator, offset, size);
+            }
+
+            @Override
+            public void accept(long value) {
+                if (index >= fence) {
+                    throw new IndexOutOfBoundsException(Integer.toString(index));
+                }
+                array[index++] = value;
+            }
+        }
+
+        static final class OfDouble<P_IN>
+                extends SizedCollectorTask<P_IN, Double, Sink.OfDouble, OfDouble<P_IN>>
+                implements Sink.OfDouble {
+            private final double[] array;
+
+            OfDouble(Spliterator<P_IN> spliterator, PipelineHelper<Double> helper, double[] array) {
+                super(spliterator, helper, array.length);
+                this.array = array;
+            }
+
+            OfDouble(SizedCollectorTask.OfDouble<P_IN> parent, Spliterator<P_IN> spliterator,
+                     long offset, long length) {
+                super(parent, spliterator, offset, length, parent.array.length);
+                this.array = parent.array;
+            }
+
+            @Override
+            SizedCollectorTask.OfDouble<P_IN> makeChild(Spliterator<P_IN> spliterator,
+                                                        long offset, long size) {
+                return new SizedCollectorTask.OfDouble<>(this, spliterator, offset, size);
+            }
+
+            @Override
+            public void accept(double value) {
+                if (index >= fence) {
+                    throw new IndexOutOfBoundsException(Integer.toString(index));
+                }
+                array[index++] = value;
+            }
+        }
+    }
+
+    private static abstract class ToArrayTask<T, T_NODE extends Node<T>,
+                                              K extends ToArrayTask<T, T_NODE, K>>
+            extends CountedCompleter<Void> {
+        protected final T_NODE node;
+        protected final int offset;
+
+        ToArrayTask(T_NODE node, int offset) {
+            this.node = node;
+            this.offset = offset;
+        }
+
+        ToArrayTask(K parent, T_NODE node, int offset) {
+            super(parent);
+            this.node = node;
+            this.offset = offset;
+        }
+
+        abstract void copyNodeToArray();
+
+        abstract K makeChild(int childIndex, int offset);
+
+        @Override
+        public void compute() {
+            ToArrayTask<T, T_NODE, K> task = this;
+            while (true) {
+                if (task.node.getChildCount() == 0) {
+                    task.copyNodeToArray();
+                    task.propagateCompletion();
+                    return;
+                }
+                else {
+                    task.setPendingCount(task.node.getChildCount() - 1);
+
+                    int size = 0;
+                    int i = 0;
+                    for (;i < task.node.getChildCount() - 1; i++) {
+                        K leftTask = task.makeChild(i, task.offset + size);
+                        size += leftTask.node.count();
+                        leftTask.fork();
+                    }
+                    task = task.makeChild(i, task.offset + size);
+                }
+            }
+        }
+
+        private static final class OfRef<T>
+                extends ToArrayTask<T, Node<T>, OfRef<T>> {
+            private final T[] array;
+
+            private OfRef(Node<T> node, T[] array, int offset) {
+                super(node, offset);
+                this.array = array;
+            }
+
+            private OfRef(OfRef<T> parent, Node<T> node, int offset) {
+                super(parent, node, offset);
+                this.array = parent.array;
+            }
+
+            @Override
+            OfRef<T> makeChild(int childIndex, int offset) {
+                return new OfRef<>(this, node.getChild(childIndex), offset);
+            }
+
+            @Override
+            void copyNodeToArray() {
+                node.copyInto(array, offset);
+            }
+        }
+
+        private static final class OfInt
+                extends ToArrayTask<Integer, Node.OfInt, OfInt> {
+            private final int[] array;
+
+            private OfInt(Node.OfInt node, int[] array, int offset) {
+                super(node, offset);
+                this.array = array;
+            }
+
+            private OfInt(OfInt parent, Node.OfInt node, int offset) {
+                super(parent, node, offset);
+                this.array = parent.array;
+            }
+
+            @Override
+            OfInt makeChild(int childIndex, int offset) {
+                return new OfInt(this, node.getChild(childIndex), offset);
+            }
+
+            @Override
+            void copyNodeToArray() {
+                node.copyInto(array, offset);
+            }
+        }
+
+        private static final class OfLong
+                extends ToArrayTask<Long, Node.OfLong, OfLong> {
+            private final long[] array;
+
+            private OfLong(Node.OfLong node, long[] array, int offset) {
+                super(node, offset);
+                this.array = array;
+            }
+
+            private OfLong(OfLong parent, Node.OfLong node, int offset) {
+                super(parent, node, offset);
+                this.array = parent.array;
+            }
+
+            @Override
+            OfLong makeChild(int childIndex, int offset) {
+                return new OfLong(this, node.getChild(childIndex), offset);
+            }
+
+            @Override
+            void copyNodeToArray() {
+                node.copyInto(array, offset);
+            }
+        }
+
+        private static final class OfDouble
+                extends ToArrayTask<Double, Node.OfDouble, OfDouble> {
+            private final double[] array;
+
+            private OfDouble(Node.OfDouble node, double[] array, int offset) {
+                super(node, offset);
+                this.array = array;
+            }
+
+            private OfDouble(OfDouble parent, Node.OfDouble node, int offset) {
+                super(parent, node, offset);
+                this.array = parent.array;
+            }
+
+            @Override
+            OfDouble makeChild(int childIndex, int offset) {
+                return new OfDouble(this, node.getChild(childIndex), offset);
+            }
+
+            @Override
+            void copyNodeToArray() {
+                node.copyInto(array, offset);
+            }
+        }
+    }
+
+    private static final class CollectorTask<P_IN, P_OUT>
+            extends AbstractTask<P_IN, P_OUT, Node<P_OUT>, CollectorTask<P_IN, P_OUT>> {
+        private final PipelineHelper<P_OUT> helper;
+        private final IntFunction<P_OUT[]> generator;
+
+        CollectorTask(PipelineHelper<P_OUT> helper,
+                      IntFunction<P_OUT[]> generator,
+                      Spliterator<P_IN> spliterator) {
+            super(helper, spliterator);
+            this.helper = helper;
+            this.generator = generator;
+        }
+
+        CollectorTask(CollectorTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            helper = parent.helper;
+            generator = parent.generator;
+        }
+
+        @Override
+        protected CollectorTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+            return new CollectorTask<>(this, spliterator);
+        }
+
+        @Override
+        protected Node<P_OUT> doLeaf() {
+            Node.Builder<P_OUT> builder
+                    = builder(helper.exactOutputSizeIfKnown(spliterator),
+                                    generator);
+            return helper.wrapAndCopyInto(builder, spliterator).build();
+        }
+
+        @Override
+        public void onCompletion(CountedCompleter caller) {
+            if (!isLeaf()) {
+                setLocalResult(new ConcNode<>(leftChild.getLocalResult(), rightChild.getLocalResult()));
+            }
+            super.onCompletion(caller);
+        }
+    }
+
+    private static final class IntCollectorTask<P_IN>
+            extends AbstractTask<P_IN, Integer, Node.OfInt, IntCollectorTask<P_IN>> {
+        private final PipelineHelper<Integer> helper;
+
+        IntCollectorTask(PipelineHelper<Integer> helper, Spliterator<P_IN> spliterator) {
+            super(helper, spliterator);
+            this.helper = helper;
+        }
+
+        IntCollectorTask(IntCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            helper = parent.helper;
+        }
+
+        @Override
+        protected IntCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
+            return new IntCollectorTask<>(this, spliterator);
+        }
+
+        @Override
+        protected Node.OfInt doLeaf() {
+            Node.Builder.OfInt builder = intBuilder(helper.exactOutputSizeIfKnown(spliterator));
+            return helper.wrapAndCopyInto(builder, spliterator).build();
+        }
+
+        @Override
+        public void onCompletion(CountedCompleter caller) {
+            if (!isLeaf()) {
+                setLocalResult(new IntConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+            }
+            super.onCompletion(caller);
+        }
+    }
+
+    private static final class LongCollectorTask<P_IN>
+            extends AbstractTask<P_IN, Long, Node.OfLong, LongCollectorTask<P_IN>> {
+        private final PipelineHelper<Long> helper;
+
+        LongCollectorTask(PipelineHelper<Long> helper, Spliterator<P_IN> spliterator) {
+            super(helper, spliterator);
+            this.helper = helper;
+        }
+
+        LongCollectorTask(LongCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            helper = parent.helper;
+        }
+
+        @Override
+        protected LongCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
+            return new LongCollectorTask<>(this, spliterator);
+        }
+
+        @Override
+        protected Node.OfLong doLeaf() {
+            Node.Builder.OfLong builder = longBuilder(helper.exactOutputSizeIfKnown(spliterator));
+            return helper.wrapAndCopyInto(builder, spliterator).build();
+        }
+
+        @Override
+        public void onCompletion(CountedCompleter caller) {
+            if (!isLeaf()) {
+                setLocalResult(new LongConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+            }
+            super.onCompletion(caller);
+        }
+    }
+
+    private static final class DoubleCollectorTask<P_IN>
+            extends AbstractTask<P_IN, Double, Node.OfDouble, DoubleCollectorTask<P_IN>> {
+        private final PipelineHelper<Double> helper;
+
+        DoubleCollectorTask(PipelineHelper<Double> helper, Spliterator<P_IN> spliterator) {
+            super(helper, spliterator);
+            this.helper = helper;
+        }
+
+        DoubleCollectorTask(DoubleCollectorTask<P_IN> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            helper = parent.helper;
+        }
+
+        @Override
+        protected DoubleCollectorTask<P_IN> makeChild(Spliterator<P_IN> spliterator) {
+            return new DoubleCollectorTask<>(this, spliterator);
+        }
+
+        @Override
+        protected Node.OfDouble doLeaf() {
+            Node.Builder.OfDouble builder
+                    = doubleBuilder(helper.exactOutputSizeIfKnown(spliterator));
+            return helper.wrapAndCopyInto(builder, spliterator).build();
+        }
+
+        @Override
+        public void onCompletion(CountedCompleter caller) {
+            if (!isLeaf()) {
+                setLocalResult(new DoubleConcNode(leftChild.getLocalResult(), rightChild.getLocalResult()));
+            }
+            super.onCompletion(caller);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/PipelineHelper.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Spliterator;
+import java.util.function.IntFunction;
+
+/**
+ * Helper class for executing <a href="package-summary.html#StreamPipelines">
+ * stream pipelines</a>, capturing all of the information about a stream
+ * pipeline (output shape, intermediate operations, stream flags, parallelism,
+ * etc) in one place.
+ *
+ * <p>
+ * A {@code PipelineHelper} describes the initial segment of a stream pipeline,
+ * including its source, intermediate operations, and may additionally
+ * incorporate information about the terminal (or stateful) operation which
+ * follows the last intermediate operation described by this
+ * {@code PipelineHelper}. The {@code PipelineHelper} is passed to the
+ * {@link TerminalOp#evaluateParallel(PipelineHelper, java.util.Spliterator)},
+ * {@link TerminalOp#evaluateSequential(PipelineHelper, java.util.Spliterator)},
+ * and {@link AbstractPipeline#opEvaluateParallel(PipelineHelper, java.util.Spliterator,
+ * java.util.function.IntFunction)}, methods, which can use the
+ * {@code PipelineHelper} to access information about the pipeline such as
+ * input shape, output shape, stream flags, and size, and use the helper methods
+ * such as {@link #wrapAndCopyInto(Sink, Spliterator)},
+ * {@link #copyInto(Sink, Spliterator)}, and {@link #wrapSink(Sink)} to execute
+ * pipeline operations.
+ *
+ * @param <P_OUT> type of output elements from the pipeline
+ * @since 1.8
+ */
+abstract class PipelineHelper<P_OUT> {
+
+    /**
+     * Gets the combined stream and operation flags for the output of the described
+     * pipeline.  This will incorporate stream flags from the stream source, all
+     * the intermediate operations and the terminal operation.
+     *
+     * @return the combined stream and operation flags
+     * @see StreamOpFlag
+     */
+    abstract int getStreamAndOpFlags();
+
+    /**
+     * Returns the exact output size of the portion of the output resulting from
+     * applying the pipeline stages described by this {@code PipelineHelper} to
+     * the the portion of the input described by the provided
+     * {@code Spliterator}, if known.  If not known or known infinite, will
+     * return {@code -1}.
+     *
+     * @apiNote
+     * The exact output size is known if the {@code Spliterator} has the
+     * {@code SIZED} characteristic, and the operation flags
+     * {@link StreamOpFlag#SIZED} is known on the combined stream and operation
+     * flags.
+     *
+     * @param spliterator the spliterator describing the relevant portion of the
+     *        source data
+     * @return the exact size if known, or -1 if infinite or unknown
+     */
+    abstract<P_IN> long exactOutputSizeIfKnown(Spliterator<P_IN> spliterator);
+
+    /**
+     * Applies the pipeline stages described by this {@code PipelineHelper} to
+     * the provided {@code Spliterator} and send the results to the provided
+     * {@code Sink}.
+     *
+     * @implSpec
+     * The implementation behaves as if:
+     * <pre>{@code
+     *     intoWrapped(wrapSink(sink), spliterator);
+     * }</pre>
+     *
+     * @param sink the {@code Sink} to receive the results
+     * @param spliterator the spliterator describing the source input to process
+     */
+    abstract<P_IN, S extends Sink<P_OUT>> S wrapAndCopyInto(S sink, Spliterator<P_IN> spliterator);
+
+    /**
+     * Pushes elements obtained from the {@code Spliterator} into the provided
+     * {@code Sink}.  If the stream pipeline is known to have short-circuiting
+     * stages in it (see {@link StreamOpFlag#SHORT_CIRCUIT}), the
+     * {@link Sink#cancellationRequested()} is checked after each
+     * element, stopping if cancellation is requested.
+     *
+     * @implSpec
+     * This method conforms to the {@code Sink} protocol of calling
+     * {@code Sink.begin} before pushing elements, via {@code Sink.accept}, and
+     * calling {@code Sink.end} after all elements have been pushed.
+     *
+     * @param wrappedSink the destination {@code Sink}
+     * @param spliterator the source {@code Spliterator}
+     */
+    abstract<P_IN> void copyInto(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator);
+
+    /**
+     * Pushes elements obtained from the {@code Spliterator} into the provided
+     * {@code Sink}, checking {@link Sink#cancellationRequested()} after each
+     * element, and stopping if cancellation is requested.
+     *
+     * @implSpec
+     * This method conforms to the {@code Sink} protocol of calling
+     * {@code Sink.begin} before pushing elements, via {@code Sink.accept}, and
+     * calling {@code Sink.end} after all elements have been pushed or if
+     * cancellation is requested.
+     *
+     * @param wrappedSink the destination {@code Sink}
+     * @param spliterator the source {@code Spliterator}
+     */
+    abstract <P_IN> void copyIntoWithCancel(Sink<P_IN> wrappedSink, Spliterator<P_IN> spliterator);
+
+    /**
+     * Takes a {@code Sink} that accepts elements of the output type of the
+     * {@code PipelineHelper}, and wrap it with a {@code Sink} that accepts
+     * elements of the input type and implements all the intermediate operations
+     * described by this {@code PipelineHelper}, delivering the result into the
+     * provided {@code Sink}.
+     *
+     * @param sink the {@code Sink} to receive the results
+     * @return a {@code Sink} that implements the pipeline stages and sends
+     *         results to the provided {@code Sink}
+     */
+    abstract<P_IN> Sink<P_IN> wrapSink(Sink<P_OUT> sink);
+
+    /**
+     * Constructs a @{link Node.Builder} compatible with the output shape of
+     * this {@code PipelineHelper}.
+     *
+     * @param exactSizeIfKnown if >=0 then a builder will be created that has a
+     *        fixed capacity of exactly sizeIfKnown elements; if < 0 then the
+     *        builder has variable capacity.  A fixed capacity builder will fail
+     *        if an element is added after the builder has reached capacity.
+     * @param generator a factory function for array instances
+     * @return a {@code Node.Builder} compatible with the output shape of this
+     *         {@code PipelineHelper}
+     */
+    abstract Node.Builder<P_OUT> makeNodeBuilder(long exactSizeIfKnown,
+                                                 IntFunction<P_OUT[]> generator);
+
+    /**
+     * Collects all output elements resulting from applying the pipeline stages
+     * to the source {@code Spliterator} into a {@code Node}.
+     *
+     * @implNote
+     * If the pipeline has no intermediate operations and the source is backed
+     * by a {@code Node} then that {@code Node} will be returned (or flattened
+     * and then returned). This reduces copying for a pipeline consisting of a
+     * stateful operation followed by a terminal operation that returns an
+     * array, such as:
+     * <pre>{@code
+     *     stream.sorted().toArray();
+     * }</pre>
+     *
+     * @param spliterator the source {@code Spliterator}
+     * @param flatten if true and the pipeline is a parallel pipeline then the
+     *        {@code Node} returned will contain no children, otherwise the
+     *        {@code Node} may represent the root in a tree that reflects the
+     *        shape of the computation tree.
+     * @param generator a factory function for array instances
+     * @return the {@code Node} containing all output elements
+     */
+    abstract<P_IN> Node<P_OUT> evaluate(Spliterator<P_IN> spliterator,
+                                        boolean flatten,
+                                        IntFunction<P_OUT[]> generator);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/ReduceOps.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,762 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Objects;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.IntBinaryOperator;
+import java.util.function.LongBinaryOperator;
+import java.util.function.ObjDoubleConsumer;
+import java.util.function.ObjIntConsumer;
+import java.util.function.ObjLongConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Factory for the creating instances of {@code TerminalOp) that implement
+ * reductions.
+ *
+ * @since 1.8
+ */
+final class ReduceOps {
+
+    private ReduceOps() { }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a functional reduce on
+     * reference values.
+     *
+     * @param <T> the type of the input elements
+     * @param <U> the type of the result
+     * @param seed the identity element for the reduction
+     * @param reducer the accumulating function that incorporates an additional
+     *        input element into the result
+     * @param combiner the combining function that combines two intermediate
+     *        results
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static <T, U> TerminalOp<T, U>
+    makeRef(U seed, BiFunction<U, ? super T, U> reducer, BinaryOperator<U> combiner) {
+        Objects.requireNonNull(reducer);
+        Objects.requireNonNull(combiner);
+        class ReducingSink extends Box<U> implements AccumulatingSink<T, U, ReducingSink> {
+            @Override
+            public void begin(long size) {
+                state = seed;
+            }
+
+            @Override
+            public void accept(T t) {
+                state = reducer.apply(state, t);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                state = combiner.apply(state, other.state);
+            }
+        }
+        return new ReduceOp<T, U, ReducingSink>(StreamShape.REFERENCE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a functional reduce on
+     * reference values producing an optional reference result.
+     *
+     * @param <T> The type of the input elements, and the type of the result
+     * @param operator The reducing function
+     * @return A {@code TerminalOp} implementing the reduction
+     */
+    public static <T> TerminalOp<T, Optional<T>>
+    makeRef(BinaryOperator<T> operator) {
+        Objects.requireNonNull(operator);
+        class ReducingSink
+                implements AccumulatingSink<T, Optional<T>, ReducingSink> {
+            private boolean empty;
+            private T state;
+
+            public void begin(long size) {
+                empty = true;
+                state = null;
+            }
+
+            @Override
+            public void accept(T t) {
+                if (empty) {
+                    empty = false;
+                    state = t;
+                } else {
+                    state = operator.apply(state, t);
+                }
+            }
+
+            @Override
+            public Optional<T> get() {
+                return empty ? Optional.empty() : Optional.of(state);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                if (!other.empty)
+                    accept(other.state);
+            }
+        }
+        return new ReduceOp<T, Optional<T>, ReducingSink>(StreamShape.REFERENCE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a mutable reduce on
+     * reference values.
+     *
+     * @param <T> the type of the input elements
+     * @param <R> the type of the result
+     * @param collector a {@code Collector} defining the reduction
+     * @return a {@code ReduceOp} implementing the reduction
+     */
+    public static <T,R> TerminalOp<T, R>
+    makeRef(Collector<? super T,R> collector) {
+        Supplier<R> supplier = Objects.requireNonNull(collector).resultSupplier();
+        BiFunction<R, ? super T, R> accumulator = collector.accumulator();
+        BinaryOperator<R> combiner = collector.combiner();
+        class ReducingSink extends Box<R>
+                implements AccumulatingSink<T, R, ReducingSink> {
+            @Override
+            public void begin(long size) {
+                state = supplier.get();
+            }
+
+            @Override
+            public void accept(T t) {
+                R newResult = accumulator.apply(state, t);
+                if (state != newResult)
+                    state = newResult;
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                state = combiner.apply(state, other.state);
+            }
+        }
+        return new ReduceOp<T, R, ReducingSink>(StreamShape.REFERENCE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+
+            @Override
+            public int getOpFlags() {
+                return collector.characteristics().contains(Collector.Characteristics.UNORDERED)
+                       ? StreamOpFlag.NOT_ORDERED
+                       : 0;
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a mutable reduce on
+     * reference values.
+     *
+     * @param <T> the type of the input elements
+     * @param <R> the type of the result
+     * @param seedFactory a factory to produce a new base accumulator
+     * @param accumulator a function to incorporate an element into an
+     *        accumulator
+     * @param reducer a function to combine an accumulator into another
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static <T, R> TerminalOp<T, R>
+    makeRef(Supplier<R> seedFactory,
+            BiConsumer<R, ? super T> accumulator,
+            BiConsumer<R,R> reducer) {
+        Objects.requireNonNull(seedFactory);
+        Objects.requireNonNull(accumulator);
+        Objects.requireNonNull(reducer);
+        class ReducingSink extends Box<R>
+                implements AccumulatingSink<T, R, ReducingSink> {
+            @Override
+            public void begin(long size) {
+                state = seedFactory.get();
+            }
+
+            @Override
+            public void accept(T t) {
+                accumulator.accept(state, t);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                reducer.accept(state, other.state);
+            }
+        }
+        return new ReduceOp<T, R, ReducingSink>(StreamShape.REFERENCE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a functional reduce on
+     * {@code int} values.
+     *
+     * @param identity the identity for the combining function
+     * @param operator the combining function
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static TerminalOp<Integer, Integer>
+    makeInt(int identity, IntBinaryOperator operator) {
+        Objects.requireNonNull(operator);
+        class ReducingSink
+                implements AccumulatingSink<Integer, Integer, ReducingSink>, Sink.OfInt {
+            private int state;
+
+            @Override
+            public void begin(long size) {
+                state = identity;
+            }
+
+            @Override
+            public void accept(int t) {
+                state = operator.applyAsInt(state, t);
+            }
+
+            @Override
+            public Integer get() {
+                return state;
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                accept(other.state);
+            }
+        }
+        return new ReduceOp<Integer, Integer, ReducingSink>(StreamShape.INT_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a functional reduce on
+     * {@code int} values, producing an optional integer result.
+     *
+     * @param operator the combining function
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static TerminalOp<Integer, OptionalInt>
+    makeInt(IntBinaryOperator operator) {
+        Objects.requireNonNull(operator);
+        class ReducingSink
+                implements AccumulatingSink<Integer, OptionalInt, ReducingSink>, Sink.OfInt {
+            private boolean empty;
+            private int state;
+
+            public void begin(long size) {
+                empty = true;
+                state = 0;
+            }
+
+            @Override
+            public void accept(int t) {
+                if (empty) {
+                    empty = false;
+                    state = t;
+                }
+                else {
+                    state = operator.applyAsInt(state, t);
+                }
+            }
+
+            @Override
+            public OptionalInt get() {
+                return empty ? OptionalInt.empty() : OptionalInt.of(state);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                if (!other.empty)
+                    accept(other.state);
+            }
+        }
+        return new ReduceOp<Integer, OptionalInt, ReducingSink>(StreamShape.INT_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a mutable reduce on
+     * {@code int} values.
+     *
+     * @param <R> The type of the result
+     * @param supplier a factory to produce a new accumulator of the result type
+     * @param accumulator a function to incorporate an int into an
+     *        accumulator
+     * @param combiner a function to combine an accumulator into another
+     * @return A {@code ReduceOp} implementing the reduction
+     */
+    public static <R> TerminalOp<Integer, R>
+    makeInt(Supplier<R> supplier,
+            ObjIntConsumer<R> accumulator,
+            BinaryOperator<R> combiner) {
+        Objects.requireNonNull(supplier);
+        Objects.requireNonNull(accumulator);
+        Objects.requireNonNull(combiner);
+        class ReducingSink extends Box<R>
+                implements AccumulatingSink<Integer, R, ReducingSink>, Sink.OfInt {
+            @Override
+            public void begin(long size) {
+                state = supplier.get();
+            }
+
+            @Override
+            public void accept(int t) {
+                accumulator.accept(state, t);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                state = combiner.apply(state, other.state);
+            }
+        }
+        return new ReduceOp<Integer, R, ReducingSink>(StreamShape.INT_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a functional reduce on
+     * {@code long} values.
+     *
+     * @param identity the identity for the combining function
+     * @param operator the combining function
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static TerminalOp<Long, Long>
+    makeLong(long identity, LongBinaryOperator operator) {
+        Objects.requireNonNull(operator);
+        class ReducingSink
+                implements AccumulatingSink<Long, Long, ReducingSink>, Sink.OfLong {
+            private long state;
+
+            @Override
+            public void begin(long size) {
+                state = identity;
+            }
+
+            @Override
+            public void accept(long t) {
+                state = operator.applyAsLong(state, t);
+            }
+
+            @Override
+            public Long get() {
+                return state;
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                accept(other.state);
+            }
+        }
+        return new ReduceOp<Long, Long, ReducingSink>(StreamShape.LONG_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a functional reduce on
+     * {@code long} values, producing an optional long result.
+     *
+     * @param operator the combining function
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static TerminalOp<Long, OptionalLong>
+    makeLong(LongBinaryOperator operator) {
+        Objects.requireNonNull(operator);
+        class ReducingSink
+                implements AccumulatingSink<Long, OptionalLong, ReducingSink>, Sink.OfLong {
+            private boolean empty;
+            private long state;
+
+            public void begin(long size) {
+                empty = true;
+                state = 0;
+            }
+
+            @Override
+            public void accept(long t) {
+                if (empty) {
+                    empty = false;
+                    state = t;
+                }
+                else {
+                    state = operator.applyAsLong(state, t);
+                }
+            }
+
+            @Override
+            public OptionalLong get() {
+                return empty ? OptionalLong.empty() : OptionalLong.of(state);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                if (!other.empty)
+                    accept(other.state);
+            }
+        }
+        return new ReduceOp<Long, OptionalLong, ReducingSink>(StreamShape.LONG_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a mutable reduce on
+     * {@code long} values.
+     *
+     * @param <R> the type of the result
+     * @param supplier a factory to produce a new accumulator of the result type
+     * @param accumulator a function to incorporate an int into an
+     *        accumulator
+     * @param combiner a function to combine an accumulator into another
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static <R> TerminalOp<Long, R>
+    makeLong(Supplier<R> supplier,
+             ObjLongConsumer<R> accumulator,
+             BinaryOperator<R> combiner) {
+        Objects.requireNonNull(supplier);
+        Objects.requireNonNull(accumulator);
+        Objects.requireNonNull(combiner);
+        class ReducingSink extends Box<R>
+                implements AccumulatingSink<Long, R, ReducingSink>, Sink.OfLong {
+            @Override
+            public void begin(long size) {
+                state = supplier.get();
+            }
+
+            @Override
+            public void accept(long t) {
+                accumulator.accept(state, t);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                state = combiner.apply(state, other.state);
+            }
+        }
+        return new ReduceOp<Long, R, ReducingSink>(StreamShape.LONG_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a functional reduce on
+     * {@code double} values.
+     *
+     * @param identity the identity for the combining function
+     * @param operator the combining function
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static TerminalOp<Double, Double>
+    makeDouble(double identity, DoubleBinaryOperator operator) {
+        Objects.requireNonNull(operator);
+        class ReducingSink
+                implements AccumulatingSink<Double, Double, ReducingSink>, Sink.OfDouble {
+            private double state;
+
+            @Override
+            public void begin(long size) {
+                state = identity;
+            }
+
+            @Override
+            public void accept(double t) {
+                state = operator.applyAsDouble(state, t);
+            }
+
+            @Override
+            public Double get() {
+                return state;
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                accept(other.state);
+            }
+        }
+        return new ReduceOp<Double, Double, ReducingSink>(StreamShape.DOUBLE_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a functional reduce on
+     * {@code double} values, producing an optional double result.
+     *
+     * @param operator the combining function
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static TerminalOp<Double, OptionalDouble>
+    makeDouble(DoubleBinaryOperator operator) {
+        Objects.requireNonNull(operator);
+        class ReducingSink
+                implements AccumulatingSink<Double, OptionalDouble, ReducingSink>, Sink.OfDouble {
+            private boolean empty;
+            private double state;
+
+            public void begin(long size) {
+                empty = true;
+                state = 0;
+            }
+
+            @Override
+            public void accept(double t) {
+                if (empty) {
+                    empty = false;
+                    state = t;
+                }
+                else {
+                    state = operator.applyAsDouble(state, t);
+                }
+            }
+
+            @Override
+            public OptionalDouble get() {
+                return empty ? OptionalDouble.empty() : OptionalDouble.of(state);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                if (!other.empty)
+                    accept(other.state);
+            }
+        }
+        return new ReduceOp<Double, OptionalDouble, ReducingSink>(StreamShape.DOUBLE_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * Constructs a {@code TerminalOp} that implements a mutable reduce on
+     * {@code double} values.
+     *
+     * @param <R> the type of the result
+     * @param supplier a factory to produce a new accumulator of the result type
+     * @param accumulator a function to incorporate an int into an
+     *        accumulator
+     * @param combiner a function to combine an accumulator into another
+     * @return a {@code TerminalOp} implementing the reduction
+     */
+    public static <R> TerminalOp<Double, R>
+    makeDouble(Supplier<R> supplier,
+               ObjDoubleConsumer<R> accumulator,
+               BinaryOperator<R> combiner) {
+        Objects.requireNonNull(supplier);
+        Objects.requireNonNull(accumulator);
+        Objects.requireNonNull(combiner);
+        class ReducingSink extends Box<R>
+                implements AccumulatingSink<Double, R, ReducingSink>, Sink.OfDouble {
+            @Override
+            public void begin(long size) {
+                state = supplier.get();
+            }
+
+            @Override
+            public void accept(double t) {
+                accumulator.accept(state, t);
+            }
+
+            @Override
+            public void combine(ReducingSink other) {
+                state = combiner.apply(state, other.state);
+            }
+        }
+        return new ReduceOp<Double, R, ReducingSink>(StreamShape.DOUBLE_VALUE) {
+            @Override
+            public ReducingSink makeSink() {
+                return new ReducingSink();
+            }
+        };
+    }
+
+    /**
+     * A type of {@code TerminalSink} that implements an associative reducing
+     * operation on elements of type {@code T} and producing a result of type
+     * {@code R}.
+     *
+     * @param <T> the type of input element to the combining operation
+     * @param <R> the result type
+     * @param <K> the type of the {@code AccumulatingSink}.
+     */
+    private interface AccumulatingSink<T, R, K extends AccumulatingSink<T, R, K>>
+            extends TerminalSink<T, R> {
+        public void combine(K other);
+    }
+
+    /**
+     * State box for a single state element, used as a base class for
+     * {@code AccumulatingSink} instances
+     *
+     * @param <U> The type of the state element
+     */
+    private static abstract class Box<U> {
+        U state;
+
+        Box() {} // Avoid creation of special accessor
+
+        public U get() {
+            return state;
+        }
+    }
+
+    /**
+     * A {@code TerminalOp} that evaluates a stream pipeline and sends the
+     * output into an {@code AccumulatingSink}, which performs a reduce
+     * operation. The {@code AccumulatingSink} must represent an associative
+     * reducing operation.
+     *
+     * @param <T> the output type of the stream pipeline
+     * @param <R> the result type of the reducing operation
+     * @param <S> the type of the {@code AccumulatingSink}
+     */
+    private static abstract class ReduceOp<T, R, S extends AccumulatingSink<T, R, S>>
+            implements TerminalOp<T, R> {
+        private final StreamShape inputShape;
+
+        /**
+         * Create a {@code ReduceOp} of the specified stream shape which uses
+         * the specified {@code Supplier} to create accumulating sinks.
+         *
+         * @param shape The shape of the stream pipeline
+         */
+        ReduceOp(StreamShape shape) {
+            inputShape = shape;
+        }
+
+        public abstract S makeSink();
+
+        @Override
+        public StreamShape inputShape() {
+            return inputShape;
+        }
+
+        @Override
+        public <P_IN> R evaluateSequential(PipelineHelper<T> helper,
+                                           Spliterator<P_IN> spliterator) {
+            return helper.wrapAndCopyInto(makeSink(), spliterator).get();
+        }
+
+        @Override
+        public <P_IN> R evaluateParallel(PipelineHelper<T> helper,
+                                         Spliterator<P_IN> spliterator) {
+            return new ReduceTask<>(this, helper, spliterator).invoke().get();
+        }
+    }
+
+    /**
+     * A {@code ForkJoinTask} for performing a parallel reduce operation.
+     */
+    private static final class ReduceTask<P_IN, P_OUT, R,
+                                          S extends AccumulatingSink<P_OUT, R, S>>
+            extends AbstractTask<P_IN, P_OUT, S, ReduceTask<P_IN, P_OUT, R, S>> {
+        private final ReduceOp<P_OUT, R, S> op;
+
+        ReduceTask(ReduceOp<P_OUT, R, S> op,
+                   PipelineHelper<P_OUT> helper,
+                   Spliterator<P_IN> spliterator) {
+            super(helper, spliterator);
+            this.op = op;
+        }
+
+        ReduceTask(ReduceTask<P_IN, P_OUT, R, S> parent,
+                   Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            this.op = parent.op;
+        }
+
+        @Override
+        protected ReduceTask<P_IN, P_OUT, R, S> makeChild(Spliterator<P_IN> spliterator) {
+            return new ReduceTask<>(this, spliterator);
+        }
+
+        @Override
+        protected S doLeaf() {
+            return helper.wrapAndCopyInto(op.makeSink(), spliterator);
+        }
+
+        @Override
+        public void onCompletion(CountedCompleter caller) {
+            if (!isLeaf()) {
+                S leftResult = leftChild.getLocalResult();
+                leftResult.combine(rightChild.getLocalResult());
+                setLocalResult(leftResult);
+            }
+            // GC spliterator, left and right child
+            super.onCompletion(caller);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/ReferencePipeline.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,632 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Comparator;
+import java.util.Comparators;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.Function;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.LongConsumer;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+
+/**
+ * Abstract base class for an intermediate pipeline stage or pipeline source
+ * stage implementing whose elements are of type {@code U}.
+ *
+ * @param <P_IN> type of elements in the upstream source
+ * @param <P_OUT> type of elements in produced by this stage
+ *
+ * @since 1.8
+ */
+abstract class ReferencePipeline<P_IN, P_OUT>
+        extends AbstractPipeline<P_IN, P_OUT, Stream<P_OUT>>
+        implements Stream<P_OUT>  {
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Supplier<Spliterator>} describing the stream source
+     * @param sourceFlags the source flags for the stream source, described in
+     *        {@link StreamOpFlag}
+     * @param parallel {@code true} if the pipeline is parallel
+     */
+    ReferencePipeline(Supplier<? extends Spliterator<?>> source,
+                      int sourceFlags, boolean parallel) {
+        super(source, sourceFlags, parallel);
+    }
+
+    /**
+     * Constructor for the head of a stream pipeline.
+     *
+     * @param source {@code Spliterator} describing the stream source
+     * @param sourceFlags The source flags for the stream source, described in
+     *        {@link StreamOpFlag}
+     * @param parallel {@code true} if the pipeline is parallel
+     */
+    ReferencePipeline(Spliterator<?> source,
+                      int sourceFlags, boolean parallel) {
+        super(source, sourceFlags, parallel);
+    }
+
+    /**
+     * Constructor for appending an intermediate operation onto an existing
+     * pipeline.
+     *
+     * @param upstream the upstream element source.
+     */
+    ReferencePipeline(AbstractPipeline<?, P_IN, ?> upstream, int opFlags) {
+        super(upstream, opFlags);
+    }
+
+    // Shape-specific methods
+
+    @Override
+    final StreamShape getOutputShape() {
+        return StreamShape.REFERENCE;
+    }
+
+    @Override
+    final <P_IN> Node<P_OUT> evaluateToNode(PipelineHelper<P_OUT> helper,
+                                        Spliterator<P_IN> spliterator,
+                                        boolean flattenTree,
+                                        IntFunction<P_OUT[]> generator) {
+        return Nodes.collect(helper, spliterator, flattenTree, generator);
+    }
+
+    @Override
+    final <P_IN> Spliterator<P_OUT> wrap(PipelineHelper<P_OUT> ph,
+                                     Supplier<Spliterator<P_IN>> supplier,
+                                     boolean isParallel) {
+        return new StreamSpliterators.WrappingSpliterator<>(ph, supplier, isParallel);
+    }
+
+    @Override
+    final Spliterator<P_OUT> lazySpliterator(Supplier<? extends Spliterator<P_OUT>> supplier) {
+        return new StreamSpliterators.DelegatingSpliterator<>(supplier);
+    }
+
+    @Override
+    final void forEachWithCancel(Spliterator<P_OUT> spliterator, Sink<P_OUT> sink) {
+        do { } while (!sink.cancellationRequested() && spliterator.tryAdvance(sink));
+    }
+
+    @Override
+    final Node.Builder<P_OUT> makeNodeBuilder(long exactSizeIfKnown, IntFunction<P_OUT[]> generator) {
+        return Nodes.builder(exactSizeIfKnown, generator);
+    }
+
+
+    // BaseStream
+
+    @Override
+    public final Iterator<P_OUT> iterator() {
+        return Spliterators.iteratorFromSpliterator(spliterator());
+    }
+
+
+    // Stream
+
+    // Stateless intermediate operations from Stream
+
+    @Override
+    public Stream<P_OUT> unordered() {
+        if (!isOrdered())
+            return this;
+        return new StatelessOp<P_OUT, P_OUT>(this, StreamShape.REFERENCE, StreamOpFlag.NOT_ORDERED) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<P_OUT> sink) {
+                return sink;
+            }
+        };
+    }
+
+    @Override
+    public final Stream<P_OUT> filter(Predicate<? super P_OUT> predicate) {
+        Objects.requireNonNull(predicate);
+        return new StatelessOp<P_OUT, P_OUT>(this, StreamShape.REFERENCE,
+                                     StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<P_OUT> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    @Override
+                    public void accept(P_OUT u) {
+                        if (predicate.test(u))
+                            downstream.accept(u);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final <R> Stream<R> map(Function<? super P_OUT, ? extends R> mapper) {
+        Objects.requireNonNull(mapper);
+        return new StatelessOp<P_OUT, R>(this, StreamShape.REFERENCE,
+                                     StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<R> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    @Override
+                    public void accept(P_OUT u) {
+                        downstream.accept(mapper.apply(u));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final IntStream mapToInt(ToIntFunction<? super P_OUT> mapper) {
+        Objects.requireNonNull(mapper);
+        return new IntPipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+                                              StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    @Override
+                    public void accept(P_OUT u) {
+                        downstream.accept(mapper.applyAsInt(u));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final LongStream mapToLong(ToLongFunction<? super P_OUT> mapper) {
+        Objects.requireNonNull(mapper);
+        return new LongPipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+                                      StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    @Override
+                    public void accept(P_OUT u) {
+                        downstream.accept(mapper.applyAsLong(u));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final DoubleStream mapToDouble(ToDoubleFunction<? super P_OUT> mapper) {
+        Objects.requireNonNull(mapper);
+        return new DoublePipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+                                        StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    @Override
+                    public void accept(P_OUT u) {
+                        downstream.accept(mapper.applyAsDouble(u));
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final <R> Stream<R> flatMap(Function<? super P_OUT, ? extends Stream<? extends R>> mapper) {
+        Objects.requireNonNull(mapper);
+        // We can do better than this, by polling cancellationRequested when stream is infinite
+        return new StatelessOp<P_OUT, R>(this, StreamShape.REFERENCE,
+                                     StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<R> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    public void accept(P_OUT u) {
+                        // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+                        Stream<? extends R> result = mapper.apply(u);
+                        if (result != null)
+                            result.sequential().forEach(downstream);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final IntStream flatMapToInt(Function<? super P_OUT, ? extends IntStream> mapper) {
+        Objects.requireNonNull(mapper);
+        // We can do better than this, by polling cancellationRequested when stream is infinite
+        return new IntPipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+                                              StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    IntConsumer downstreamAsInt = downstream::accept;
+                    public void accept(P_OUT u) {
+                        // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+                        IntStream result = mapper.apply(u);
+                        if (result != null)
+                            result.sequential().forEach(downstreamAsInt);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final DoubleStream flatMapToDouble(Function<? super P_OUT, ? extends DoubleStream> mapper) {
+        Objects.requireNonNull(mapper);
+        // We can do better than this, by polling cancellationRequested when stream is infinite
+        return new DoublePipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+                                                     StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    DoubleConsumer downstreamAsDouble = downstream::accept;
+                    public void accept(P_OUT u) {
+                        // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+                        DoubleStream result = mapper.apply(u);
+                        if (result != null)
+                            result.sequential().forEach(downstreamAsDouble);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final LongStream flatMapToLong(Function<? super P_OUT, ? extends LongStream> mapper) {
+        Objects.requireNonNull(mapper);
+        // We can do better than this, by polling cancellationRequested when stream is infinite
+        return new LongPipeline.StatelessOp<P_OUT>(this, StreamShape.REFERENCE,
+                                                   StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    LongConsumer downstreamAsLong = downstream::accept;
+                    public void accept(P_OUT u) {
+                        // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
+                        LongStream result = mapper.apply(u);
+                        if (result != null)
+                            result.sequential().forEach(downstreamAsLong);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public final Stream<P_OUT> peek(Consumer<? super P_OUT> tee) {
+        Objects.requireNonNull(tee);
+        return new StatelessOp<P_OUT, P_OUT>(this, StreamShape.REFERENCE,
+                                     0) {
+            @Override
+            Sink<P_OUT> opWrapSink(int flags, Sink<P_OUT> sink) {
+                return new Sink.ChainedReference<P_OUT>(sink) {
+                    @Override
+                    public void accept(P_OUT u) {
+                        tee.accept(u);
+                        downstream.accept(u);
+                    }
+                };
+            }
+        };
+    }
+
+    // Stateful intermediate operations from Stream
+
+    @Override
+    public final Stream<P_OUT> distinct() {
+        return DistinctOps.makeRef(this);
+    }
+
+    @Override
+    public final Stream<P_OUT> sorted() {
+        return SortedOps.makeRef(this);
+    }
+
+    @Override
+    public final Stream<P_OUT> sorted(Comparator<? super P_OUT> comparator) {
+        return SortedOps.makeRef(this, comparator);
+    }
+
+    private Stream<P_OUT> slice(long skip, long limit) {
+        return SliceOps.makeRef(this, skip, limit);
+    }
+
+    @Override
+    public final Stream<P_OUT> limit(long maxSize) {
+        if (maxSize < 0)
+            throw new IllegalArgumentException(Long.toString(maxSize));
+        return slice(0, maxSize);
+    }
+
+    @Override
+    public final Stream<P_OUT> substream(long startingOffset) {
+        if (startingOffset < 0)
+            throw new IllegalArgumentException(Long.toString(startingOffset));
+        if (startingOffset == 0)
+            return this;
+        else
+            return slice(startingOffset, -1);
+    }
+
+    @Override
+    public final Stream<P_OUT> substream(long startingOffset, long endingOffset) {
+        if (startingOffset < 0 || endingOffset < startingOffset)
+            throw new IllegalArgumentException(String.format("substream(%d, %d)", startingOffset, endingOffset));
+        return slice(startingOffset, endingOffset - startingOffset);
+    }
+
+    // Terminal operations from Stream
+
+    @Override
+    public void forEach(Consumer<? super P_OUT> action) {
+        evaluate(ForEachOps.makeRef(action, false));
+    }
+
+    @Override
+    public void forEachOrdered(Consumer<? super P_OUT> action) {
+        evaluate(ForEachOps.makeRef(action, true));
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public final <A> A[] toArray(IntFunction<A[]> generator) {
+        // Since A has no relation to U (not possible to declare that A is an upper bound of U)
+        // there will be no static type checking.
+        // Therefore use a raw type and assume A == U rather than propagating the separation of A and U
+        // throughout the code-base.
+        // The runtime type of U is never checked for equality with the component type of the runtime type of A[].
+        // Runtime checking will be performed when an element is stored in A[], thus if A is not a
+        // super type of U an ArrayStoreException will be thrown.
+        IntFunction rawGenerator = (IntFunction) generator;
+        return (A[]) Nodes.flatten(evaluateToArrayNode(rawGenerator), rawGenerator)
+                              .asArray(rawGenerator);
+    }
+
+    @Override
+    public final Object[] toArray() {
+        return toArray(Object[]::new);
+    }
+
+    @Override
+    public final boolean anyMatch(Predicate<? super P_OUT> predicate) {
+        return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.ANY));
+    }
+
+    @Override
+    public final boolean allMatch(Predicate<? super P_OUT> predicate) {
+        return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.ALL));
+    }
+
+    @Override
+    public final boolean noneMatch(Predicate<? super P_OUT> predicate) {
+        return evaluate(MatchOps.makeRef(predicate, MatchOps.MatchKind.NONE));
+    }
+
+    @Override
+    public final Optional<P_OUT> findFirst() {
+        return evaluate(FindOps.makeRef(true));
+    }
+
+    @Override
+    public final Optional<P_OUT> findAny() {
+        return evaluate(FindOps.makeRef(false));
+    }
+
+    @Override
+    public final P_OUT reduce(final P_OUT identity, final BinaryOperator<P_OUT> accumulator) {
+        return evaluate(ReduceOps.makeRef(identity, accumulator, accumulator));
+    }
+
+    @Override
+    public final Optional<P_OUT> reduce(BinaryOperator<P_OUT> accumulator) {
+        return evaluate(ReduceOps.makeRef(accumulator));
+    }
+
+    @Override
+    public final <R> R reduce(R identity, BiFunction<R, ? super P_OUT, R> accumulator, BinaryOperator<R> combiner) {
+        return evaluate(ReduceOps.makeRef(identity, accumulator, combiner));
+    }
+
+    @Override
+    public final <R> R collect(Collector<? super P_OUT, R> collector) {
+        if (isParallel()
+                && (collector.characteristics().contains(Collector.Characteristics.CONCURRENT))
+                && (!isOrdered() || collector.characteristics().contains(Collector.Characteristics.UNORDERED))) {
+            R container = collector.resultSupplier().get();
+            BiFunction<R, ? super P_OUT, R> accumulator = collector.accumulator();
+            forEach(u -> accumulator.apply(container, u));
+            return container;
+        }
+        return evaluate(ReduceOps.makeRef(collector));
+    }
+
+    @Override
+    public final <R> R collect(Supplier<R> resultFactory,
+                               BiConsumer<R, ? super P_OUT> accumulator,
+                               BiConsumer<R, R> combiner) {
+        return evaluate(ReduceOps.makeRef(resultFactory, accumulator, combiner));
+    }
+
+    @Override
+    public final Optional<P_OUT> max(Comparator<? super P_OUT> comparator) {
+        return reduce(Comparators.greaterOf(comparator));
+    }
+
+    @Override
+    public final Optional<P_OUT> min(Comparator<? super P_OUT> comparator) {
+        return reduce(Comparators.lesserOf(comparator));
+
+    }
+
+    @Override
+    public final long count() {
+        return mapToLong(e -> 1L).sum();
+    }
+
+
+    //
+
+    /**
+     * Source stage of a ReferencePipeline.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @param <E_OUT> type of elements in produced by this stage
+     * @since 1.8
+     */
+    static class Head<E_IN, E_OUT> extends ReferencePipeline<E_IN, E_OUT> {
+        /**
+         * Constructor for the source stage of a Stream.
+         *
+         * @param source {@code Supplier<Spliterator>} describing the stream
+         *               source
+         * @param sourceFlags the source flags for the stream source, described
+         *                    in {@link StreamOpFlag}
+         */
+        Head(Supplier<? extends Spliterator<?>> source,
+             int sourceFlags, boolean parallel) {
+            super(source, sourceFlags, parallel);
+        }
+
+        /**
+         * Constructor for the source stage of a Stream.
+         *
+         * @param source {@code Spliterator} describing the stream source
+         * @param sourceFlags the source flags for the stream source, described
+         *                    in {@link StreamOpFlag}
+         */
+        Head(Spliterator<?> source,
+             int sourceFlags, boolean parallel) {
+            super(source, sourceFlags, parallel);
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        final Sink<E_IN> opWrapSink(int flags, Sink<E_OUT> sink) {
+            throw new UnsupportedOperationException();
+        }
+
+        // Optimized sequential terminal operations for the head of the pipeline
+
+        @Override
+        public void forEach(Consumer<? super E_OUT> action) {
+            if (!isParallel()) {
+                sourceStageSpliterator().forEachRemaining(action);
+            }
+            else {
+                super.forEach(action);
+            }
+        }
+
+        @Override
+        public void forEachOrdered(Consumer<? super E_OUT> action) {
+            if (!isParallel()) {
+                sourceStageSpliterator().forEachRemaining(action);
+            }
+            else {
+                super.forEachOrdered(action);
+            }
+        }
+    }
+
+    /**
+     * Base class for a stateless intermediate stage of a Stream.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @param <E_OUT> type of elements in produced by this stage
+     * @since 1.8
+     */
+    abstract static class StatelessOp<E_IN, E_OUT>
+            extends ReferencePipeline<E_IN, E_OUT> {
+        /**
+         * Construct a new Stream by appending a stateless intermediate
+         * operation to an existing stream.
+         *
+         * @param upstream The upstream pipeline stage
+         * @param inputShape The stream shape for the upstream pipeline stage
+         * @param opFlags Operation flags for the new stage
+         */
+        StatelessOp(AbstractPipeline<?, E_IN, ?> upstream,
+                    StreamShape inputShape,
+                    int opFlags) {
+            super(upstream, opFlags);
+            assert upstream.getOutputShape() == inputShape;
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            return false;
+        }
+    }
+
+    /**
+     * Base class for a stateful intermediate stage of a Stream.
+     *
+     * @param <E_IN> type of elements in the upstream source
+     * @param <E_OUT> type of elements in produced by this stage
+     * @since 1.8
+     */
+    abstract static class StatefulOp<E_IN, E_OUT>
+            extends ReferencePipeline<E_IN, E_OUT> {
+        /**
+         * Construct a new Stream by appending a stateful intermediate operation
+         * to an existing stream.
+         * @param upstream The upstream pipeline stage
+         * @param inputShape The stream shape for the upstream pipeline stage
+         * @param opFlags Operation flags for the new stage
+         */
+        StatefulOp(AbstractPipeline<?, E_IN, ?> upstream,
+                   StreamShape inputShape,
+                   int opFlags) {
+            super(upstream, opFlags);
+            assert upstream.getOutputShape() == inputShape;
+        }
+
+        @Override
+        final boolean opIsStateful() {
+            return true;
+        }
+
+        @Override
+        abstract <P_IN> Node<E_OUT> opEvaluateParallel(PipelineHelper<E_OUT> helper,
+                                                       Spliterator<P_IN> spliterator,
+                                                       IntFunction<E_OUT[]> generator);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Sink.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Objects;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+
+/**
+ * An extension of {@link Consumer} used to conduct values through the stages of
+ * a stream pipeline, with additional methods to manage size information,
+ * control flow, etc.  Before calling the {@code accept()} method on a
+ * {@code Sink} for the first time, you must first call the {@code begin()}
+ * method to inform it that data is coming (optionally informing the sink how
+ * much data is coming), and after all data has been sent, you must call the
+ * {@code end()} method.  After calling {@code end()}, you should not call
+ * {@code accept()} without again calling {@code begin()}.  {@code Sink} also
+ * offers a mechanism by which the sink can cooperatively signal that it does
+ * not wish to receive any more data (the {@code cancellationRequested()}
+ * method), which a source can poll before sending more data to the
+ * {@code Sink}.
+ *
+ * <p>A sink may be in one of two states: an initial state and an active state.
+ * It starts out in the initial state; the {@code begin()} method transitions
+ * it to the active state, and the {@code end()} method transitions it back into
+ * the initial state, where it can be re-used.  Data-accepting methods (such as
+ * {@code accept()} are only valid in the active state.
+ *
+ * @apiNote
+ * A stream pipeline consists of a source, zero or more intermediate stages
+ * (such as filtering or mapping), and a terminal stage, such as reduction or
+ * for-each.  For concreteness, consider the pipeline:
+ *
+ * <pre>{@code
+ *     int longestStringLengthStartingWithA
+ *         = strings.stream()
+ *                  .filter(s -> s.startsWith("A"))
+ *                  .mapToInt(String::length)
+ *                  .max();
+ * }</pre>
+ *
+ * <p>Here, we have three stages, filtering, mapping, and reducing.  The
+ * filtering stage consumes strings and emits a subset of those strings; the
+ * mapping stage consumes strings and emits ints; the reduction stage consumes
+ * those ints and computes the maximal value.
+ *
+ * <p>A {@code Sink} instance is used to represent each stage of this pipeline,
+ * whether the stage accepts objects, ints, longs, or doubles.  Sink has entry
+ * points for {@code accept(Object)}, {@code accept(int)}, etc, so that we do
+ * not need a specialized interface for each primitive specialization.  (It
+ * might be called a "kitchen sink" for this omnivorous tendency.)  The entry
+ * point to the pipeline is the {@code Sink} for the filtering stage, which
+ * sends some elements "downstream" -- into the {@code Sink} for the mapping
+ * stage, which in turn sends integral values downstream into the {@code Sink}
+ * for the reduction stage. The {@code Sink} implementations associated with a
+ * given stage is expected to know the data type for the next stage, and call
+ * the correct {@code accept} method on its downstream {@code Sink}.  Similarly,
+ * each stage must implement the correct {@code accept} method corresponding to
+ * the data type it accepts.
+ *
+ * <p>The specialized subtypes such as {@link Sink.OfInt} override
+ * {@code accept(Object)} to call the appropriate primitive specialization of
+ * {@code accept}, implement the appropriate primitive specialization of
+ * {@code Consumer}, and re-abstract the appropriate primitive specialization of
+ * {@code accept}.
+ *
+ * <p>The chaining subtypes such as {@link ChainedInt} not only implement
+ * {@code Sink.OfInt}, but also maintain a {@code downstream} field which
+ * represents the downstream {@code Sink}, and implement the methods
+ * {@code begin()}, {@code end()}, and {@code cancellationRequested()} to
+ * delegate to the downstream {@code Sink}.  Most implementations of
+ * intermediate operations will use these chaining wrappers.  For example, the
+ * mapping stage in the above example would look like:
+ *
+ * <pre>{@code
+ *     IntSink is = new Sink.ChainedReference<U>(sink) {
+ *         public void accept(U u) {
+ *             downstream.accept(mapper.applyAsInt(u));
+ *         }
+ *     };
+ * }</pre>
+ *
+ * <p>Here, we implement {@code Sink.ChainedReference<U>}, meaning that we expect
+ * to receive elements of type {@code U} as input, and pass the downstream sink
+ * to the constructor.  Because the next stage expects to receive integers, we
+ * must call the {@code accept(int)} method when emitting values to the downstream.
+ * The {@code accept()} method applies the mapping function from {@code U} to
+ * {@code int} and passes the resulting value to the downstream {@code Sink}.
+ *
+ * @param <T> type of elements for value streams
+ * @since 1.8
+ */
+interface Sink<T> extends Consumer<T> {
+    /**
+     * Resets the sink state to receive a fresh data set.  This must be called
+     * before sending any data to the sink.  After calling {@link #end()},
+     * you may call this method to reset the sink for another calculation.
+     * @param size The exact size of the data to be pushed downstream, if
+     * known or {@code -1} if unknown or infinite.
+     *
+     * <p>Prior to this call, the sink must be in the initial state, and after
+     * this call it is in the active state.
+     */
+    default void begin(long size) {}
+
+    /**
+     * Indicates that all elements have been pushed.  If the {@code Sink} is
+     * stateful, it should send any stored state downstream at this time, and
+     * should clear any accumulated state (and associated resources).
+     *
+     * <p>Prior to this call, the sink must be in the active state, and after
+     * this call it is returned to the initial state.
+     */
+    default void end() {}
+
+    /**
+     * Indicates that this {@code Sink} does not wish to receive any more data.
+     *
+     * @implSpec The default implementation always returns false.
+     *
+     * @return true if cancellation is requested
+     */
+    default boolean cancellationRequested() {
+        return false;
+    }
+
+    /**
+     * Accepts an int value.
+     *
+     * @implSpec The default implementation throws IllegalStateException.
+     *
+     * @throws IllegalStateException if this sink does not accept int values
+     */
+    default void accept(int value) {
+        throw new IllegalStateException("called wrong accept method");
+    }
+
+    /**
+     * Accepts a long value.
+     *
+     * @implSpec The default implementation throws IllegalStateException.
+     *
+     * @throws IllegalStateException if this sink does not accept long values
+     */
+    default void accept(long value) {
+        throw new IllegalStateException("called wrong accept method");
+    }
+
+    /**
+     * Accepts a double value.
+     *
+     * @implSpec The default implementation throws IllegalStateException.
+     *
+     * @throws IllegalStateException if this sink does not accept double values
+     */
+    default void accept(double value) {
+        throw new IllegalStateException("called wrong accept method");
+    }
+
+    /**
+     * {@code Sink} that implements {@code Sink<Integer>}, re-abstracts
+     * {@code accept(int)}, and wires {@code accept(Integer)} to bridge to
+     * {@code accept(int)}.
+     */
+    interface OfInt extends Sink<Integer>, IntConsumer {
+        @Override
+        void accept(int value);
+
+        @Override
+        default void accept(Integer i) {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(getClass(), "{0} calling Sink.OfInt.accept(Integer)");
+            accept(i.intValue());
+        }
+    }
+
+    /**
+     * {@code Sink} that implements {@code Sink<Long>}, re-abstracts
+     * {@code accept(long)}, and wires {@code accept(Long)} to bridge to
+     * {@code accept(long)}.
+     */
+    interface OfLong extends Sink<Long>, LongConsumer {
+        @Override
+        void accept(long value);
+
+        @Override
+        default void accept(Long i) {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(getClass(), "{0} calling Sink.OfLong.accept(Long)");
+            accept(i.longValue());
+        }
+    }
+
+    /**
+     * {@code Sink} that implements {@code Sink<Double>}, re-abstracts
+     * {@code accept(double)}, and wires {@code accept(Double)} to bridge to
+     * {@code accept(double)}.
+     */
+    interface OfDouble extends Sink<Double>, DoubleConsumer {
+        @Override
+        void accept(double value);
+
+        @Override
+        default void accept(Double i) {
+            if (Tripwire.ENABLED)
+                Tripwire.trip(getClass(), "{0} calling Sink.OfDouble.accept(Double)");
+            accept(i.doubleValue());
+        }
+    }
+
+    /**
+     * Abstract {@code Sink} implementation for creating chains of
+     * sinks.  The {@code begin}, {@code end}, and
+     * {@code cancellationRequested} methods are wired to chain to the
+     * downstream {@code Sink}.  This implementation takes a downstream
+     * {@code Sink} of unknown input shape and produces a {@code Sink<T>}.  The
+     * implementation of the {@code accept()} method must call the correct
+     * {@code accept()} method on the downstream {@code Sink}.
+     */
+    static abstract class ChainedReference<T> implements Sink<T> {
+        protected final Sink downstream;
+
+        public ChainedReference(Sink downstream) {
+            this.downstream = Objects.requireNonNull(downstream);
+        }
+
+        @Override
+        public void begin(long size) {
+            downstream.begin(size);
+        }
+
+        @Override
+        public void end() {
+            downstream.end();
+        }
+
+        @Override
+        public boolean cancellationRequested() {
+            return downstream.cancellationRequested();
+        }
+    }
+
+    /**
+     * Abstract {@code Sink} implementation designed for creating chains of
+     * sinks.  The {@code begin}, {@code end}, and
+     * {@code cancellationRequested} methods are wired to chain to the
+     * downstream {@code Sink}.  This implementation takes a downstream
+     * {@code Sink} of unknown input shape and produces a {@code Sink.OfInt}.
+     * The implementation of the {@code accept()} method must call the correct
+     * {@code accept()} method on the downstream {@code Sink}.
+     */
+    static abstract class ChainedInt implements Sink.OfInt {
+        protected final Sink downstream;
+
+        public ChainedInt(Sink downstream) {
+            this.downstream = Objects.requireNonNull(downstream);
+        }
+
+        @Override
+        public void begin(long size) {
+            downstream.begin(size);
+        }
+
+        @Override
+        public void end() {
+            downstream.end();
+        }
+
+        @Override
+        public boolean cancellationRequested() {
+            return downstream.cancellationRequested();
+        }
+    }
+
+    /**
+     * Abstract {@code Sink} implementation designed for creating chains of
+     * sinks.  The {@code begin}, {@code end}, and
+     * {@code cancellationRequested} methods are wired to chain to the
+     * downstream {@code Sink}.  This implementation takes a downstream
+     * {@code Sink} of unknown input shape and produces a {@code Sink.OfLong}.
+     * The implementation of the {@code accept()} method must call the correct
+     * {@code accept()} method on the downstream {@code Sink}.
+     */
+    static abstract class ChainedLong implements Sink.OfLong {
+        protected final Sink downstream;
+
+        public ChainedLong(Sink downstream) {
+            this.downstream = Objects.requireNonNull(downstream);
+        }
+
+        @Override
+        public void begin(long size) {
+            downstream.begin(size);
+        }
+
+        @Override
+        public void end() {
+            downstream.end();
+        }
+
+        @Override
+        public boolean cancellationRequested() {
+            return downstream.cancellationRequested();
+        }
+    }
+
+    /**
+     * Abstract {@code Sink} implementation designed for creating chains of
+     * sinks.  The {@code begin}, {@code end}, and
+     * {@code cancellationRequested} methods are wired to chain to the
+     * downstream {@code Sink}.  This implementation takes a downstream
+     * {@code Sink} of unknown input shape and produces a {@code Sink.OfDouble}.
+     * The implementation of the {@code accept()} method must call the correct
+     * {@code accept()} method on the downstream {@code Sink}.
+     */
+    static abstract class ChainedDouble implements Sink.OfDouble {
+        protected final Sink downstream;
+
+        public ChainedDouble(Sink downstream) {
+            this.downstream = Objects.requireNonNull(downstream);
+        }
+
+        @Override
+        public void begin(long size) {
+            downstream.begin(size);
+        }
+
+        @Override
+        public void end() {
+            downstream.end();
+        }
+
+        @Override
+        public boolean cancellationRequested() {
+            return downstream.cancellationRequested();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/SliceOps.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,511 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Spliterator;
+import java.util.concurrent.CountedCompleter;
+import java.util.function.IntFunction;
+
+/**
+ * Factory for instances of a short-circuiting stateful intermediate operations
+ * that produce subsequences of their input stream.
+ *
+ * @since 1.8
+ */
+final class SliceOps {
+
+    // No instances
+    private SliceOps() { }
+
+    /**
+     * Appends a "slice" operation to the provided stream.  The slice operation
+     * may be may be skip-only, limit-only, or skip-and-limit.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     * @param skip the number of elements to skip.  Must be >= 0.
+     * @param limit the maximum size of the resulting stream, or -1 if no limit
+     *        is to be imposed
+     */
+    public static <T> Stream<T> makeRef(AbstractPipeline<?, T, ?> upstream,
+                                       long skip, long limit) {
+        if (skip < 0)
+            throw new IllegalArgumentException("Skip must be non-negative: " + skip);
+
+        return new ReferencePipeline.StatefulOp<T,T>(upstream, StreamShape.REFERENCE,
+                                                     flags(limit)) {
+            @Override
+            <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
+                                              Spliterator<P_IN> spliterator,
+                                              IntFunction<T[]> generator) {
+                return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+            }
+
+            @Override
+            Sink<T> opWrapSink(int flags, Sink<T> sink) {
+                return new Sink.ChainedReference<T>(sink) {
+                    long n = skip;
+                    long m = limit >= 0 ? limit : Long.MAX_VALUE;
+
+                    @Override
+                    public void accept(T t) {
+                        if (n == 0) {
+                            if (m > 0) {
+                                m--;
+                                downstream.accept(t);
+                            }
+                        }
+                        else {
+                            n--;
+                        }
+                    }
+
+                    @Override
+                    public boolean cancellationRequested() {
+                        return m == 0 || downstream.cancellationRequested();
+                    }
+                };
+            }
+        };
+    }
+
+    /**
+     * Appends a "slice" operation to the provided IntStream.  The slice
+     * operation may be may be skip-only, limit-only, or skip-and-limit.
+     *
+     * @param upstream An IntStream
+     * @param skip The number of elements to skip.  Must be >= 0.
+     * @param limit The maximum size of the resulting stream, or -1 if no limit
+     *        is to be imposed
+     */
+    public static IntStream makeInt(AbstractPipeline<?, Integer, ?> upstream,
+                                    long skip, long limit) {
+        if (skip < 0)
+            throw new IllegalArgumentException("Skip must be non-negative: " + skip);
+
+        return new IntPipeline.StatefulOp<Integer>(upstream, StreamShape.INT_VALUE,
+                                                   flags(limit)) {
+            @Override
+            <P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
+                                                    Spliterator<P_IN> spliterator,
+                                                    IntFunction<Integer[]> generator) {
+                return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+            }
+
+            @Override
+            Sink<Integer> opWrapSink(int flags, Sink<Integer> sink) {
+                return new Sink.ChainedInt(sink) {
+                    long n = skip;
+                    long m = limit >= 0 ? limit : Long.MAX_VALUE;
+
+                    @Override
+                    public void accept(int t) {
+                        if (n == 0) {
+                            if (m > 0) {
+                                m--;
+                                downstream.accept(t);
+                            }
+                        }
+                        else {
+                            n--;
+                        }
+                    }
+
+                    @Override
+                    public boolean cancellationRequested() {
+                        return m == 0 || downstream.cancellationRequested();
+                    }
+                };
+            }
+        };
+    }
+
+    /**
+     * Appends a "slice" operation to the provided LongStream.  The slice
+     * operation may be may be skip-only, limit-only, or skip-and-limit.
+     *
+     * @param upstream A LongStream
+     * @param skip The number of elements to skip.  Must be >= 0.
+     * @param limit The maximum size of the resulting stream, or -1 if no limit
+     *        is to be imposed
+     */
+    public static LongStream makeLong(AbstractPipeline<?, Long, ?> upstream,
+                                      long skip, long limit) {
+        if (skip < 0)
+            throw new IllegalArgumentException("Skip must be non-negative: " + skip);
+
+        return new LongPipeline.StatefulOp<Long>(upstream, StreamShape.LONG_VALUE,
+                                                 flags(limit)) {
+            @Override
+            <P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
+                                                 Spliterator<P_IN> spliterator,
+                                                 IntFunction<Long[]> generator) {
+                return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+            }
+
+            @Override
+            Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
+                return new Sink.ChainedLong(sink) {
+                    long n = skip;
+                    long m = limit >= 0 ? limit : Long.MAX_VALUE;
+
+                    @Override
+                    public void accept(long t) {
+                        if (n == 0) {
+                            if (m > 0) {
+                                m--;
+                                downstream.accept(t);
+                            }
+                        }
+                        else {
+                            n--;
+                        }
+                    }
+
+                    @Override
+                    public boolean cancellationRequested() {
+                        return m == 0 || downstream.cancellationRequested();
+                    }
+                };
+            }
+        };
+    }
+
+    /**
+     * Appends a "slice" operation to the provided DoubleStream.  The slice
+     * operation may be may be skip-only, limit-only, or skip-and-limit.
+     *
+     * @param upstream A DoubleStream
+     * @param skip The number of elements to skip.  Must be >= 0.
+     * @param limit The maximum size of the resulting stream, or -1 if no limit
+     *        is to be imposed
+     */
+    public static DoubleStream makeDouble(AbstractPipeline<?, Double, ?> upstream,
+                                          long skip, long limit) {
+        if (skip < 0)
+            throw new IllegalArgumentException("Skip must be non-negative: " + skip);
+
+        return new DoublePipeline.StatefulOp<Double>(upstream, StreamShape.DOUBLE_VALUE,
+                                                     flags(limit)) {
+            @Override
+            <P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
+                                                   Spliterator<P_IN> spliterator,
+                                                   IntFunction<Double[]> generator) {
+                return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke();
+            }
+
+            @Override
+            Sink<Double> opWrapSink(int flags, Sink<Double> sink) {
+                return new Sink.ChainedDouble(sink) {
+                    long n = skip;
+                    long m = limit >= 0 ? limit : Long.MAX_VALUE;
+
+                    @Override
+                    public void accept(double t) {
+                        if (n == 0) {
+                            if (m > 0) {
+                                m--;
+                                downstream.accept(t);
+                            }
+                        }
+                        else {
+                            n--;
+                        }
+                    }
+
+                    @Override
+                    public boolean cancellationRequested() {
+                        return m == 0 || downstream.cancellationRequested();
+                    }
+                };
+            }
+        };
+    }
+
+    private static int flags(long limit) {
+        return StreamOpFlag.NOT_SIZED | ((limit != -1) ? StreamOpFlag.IS_SHORT_CIRCUIT : 0);
+    }
+
+    // Parallel strategy -- two cases
+    // IF we have full size information
+    // - decompose, keeping track of each leaf's (offset, size)
+    // - calculate leaf only if intersection between (offset, size) and desired slice
+    // - Construct a Node containing the appropriate sections of the appropriate leaves
+    // IF we don't
+    // - decompose, and calculate size of each leaf
+    // - on complete of any node, compute completed initial size from the root, and if big enough, cancel later nodes
+    // - @@@ this can be significantly improved
+
+    // @@@ Currently we don't do the sized version at all
+
+    // @@@ Should take into account ORDERED flag; if not ORDERED, we can limit in temporal order instead
+
+    /**
+     * {@code ForkJoinTask} implementing slice computation.
+     *
+     * @param <P_IN> Input element type to the stream pipeline
+     * @param <P_OUT> Output element type from the stream pipeline
+     */
+    private static final class SliceTask<P_IN, P_OUT>
+            extends AbstractShortCircuitTask<P_IN, P_OUT, Node<P_OUT>, SliceTask<P_IN, P_OUT>> {
+        private final AbstractPipeline<P_OUT, P_OUT, ?> op;
+        private final IntFunction<P_OUT[]> generator;
+        private final long targetOffset, targetSize;
+        private long thisNodeSize;
+
+        private volatile boolean completed;
+
+        SliceTask(AbstractPipeline<?, P_OUT, ?> op,
+                  PipelineHelper<P_OUT> helper,
+                  Spliterator<P_IN> spliterator,
+                  IntFunction<P_OUT[]> generator,
+                  long offset, long size) {
+            super(helper, spliterator);
+            this.op = (AbstractPipeline<P_OUT, P_OUT, ?>) op;
+            this.generator = generator;
+            this.targetOffset = offset;
+            this.targetSize = size;
+        }
+
+        SliceTask(SliceTask<P_IN, P_OUT> parent, Spliterator<P_IN> spliterator) {
+            super(parent, spliterator);
+            this.op = parent.op;
+            this.generator = parent.generator;
+            this.targetOffset = parent.targetOffset;
+            this.targetSize = parent.targetSize;
+        }
+
+        @Override
+        protected SliceTask<P_IN, P_OUT> makeChild(Spliterator<P_IN> spliterator) {
+            return new SliceTask<>(this, spliterator);
+        }
+
+        @Override
+        protected final Node<P_OUT> getEmptyResult() {
+            return Nodes.emptyNode(op.getOutputShape());
+        }
+
+        @Override
+        protected final Node<P_OUT> doLeaf() {
+            if (isRoot()) {
+                long sizeIfKnown = StreamOpFlag.SIZED.isPreserved(op.sourceOrOpFlags)
+                                   ? op.exactOutputSizeIfKnown(spliterator)
+                                   : -1;
+                final Node.Builder<P_OUT> nb = op.makeNodeBuilder(sizeIfKnown, generator);
+                Sink<P_OUT> opSink = op.opWrapSink(op.sourceOrOpFlags, nb);
+
+                if (!StreamOpFlag.SHORT_CIRCUIT.isKnown(op.sourceOrOpFlags))
+                    helper.wrapAndCopyInto(opSink, spliterator);
+                else
+                    helper.copyIntoWithCancel(helper.wrapSink(opSink), spliterator);
+                return nb.build();
+            }
+            else {
+                Node<P_OUT> node = helper.wrapAndCopyInto(helper.makeNodeBuilder(-1, generator),
+                                                      spliterator).build();
+                thisNodeSize = node.count();
+                completed = true;
+                return node;
+            }
+        }
+
+        @Override
+        public final void onCompletion(CountedCompleter<?> caller) {
+            if (!isLeaf()) {
+                thisNodeSize = leftChild.thisNodeSize + rightChild.thisNodeSize;
+                completed = true;
+
+                if (isRoot()) {
+                    // Only collect nodes once absolute size information is known
+
+                    ArrayList<Node<P_OUT>> nodes = new ArrayList<>();
+                    visit(nodes, 0);
+                    Node<P_OUT> result;
+                    if (nodes.size() == 0)
+                        result = Nodes.emptyNode(op.getOutputShape());
+                    else if (nodes.size() == 1)
+                        result = nodes.get(0);
+                    else
+                        // This will create a tree of depth 1 and will not be a sub-tree
+                        // for leaf nodes within the require range
+                        result = Nodes.conc(op.getOutputShape(), nodes);
+                    setLocalResult(result);
+                }
+            }
+            if (targetSize >= 0) {
+                if (((SliceTask<P_IN, P_OUT>) getRoot()).leftSize() >= targetOffset + targetSize)
+                    cancelLaterNodes();
+            }
+            // Don't call super.onCompletion(), we don't look at the child nodes until farther up the tree
+        }
+
+        /** Compute the cumulative size of the longest leading prefix of completed children */
+        private long leftSize() {
+            if (completed)
+                return thisNodeSize;
+            else if (isLeaf())
+                return 0;
+            else {
+                long leftSize = 0;
+                for (SliceTask<P_IN, P_OUT> child = leftChild, p = null; child != p;
+                     p = child, child = rightChild) {
+                    if (child.completed)
+                        leftSize += child.thisNodeSize;
+                    else {
+                        leftSize += child.leftSize();
+                        break;
+                    }
+                }
+                return leftSize;
+            }
+        }
+
+        private void visit(List<Node<P_OUT>> results, int offset) {
+            if (!isLeaf()) {
+                for (SliceTask<P_IN, P_OUT> child = leftChild, p = null; child != p;
+                     p = child, child = rightChild) {
+                    child.visit(results, offset);
+                    offset += child.thisNodeSize;
+                }
+            }
+            else {
+                if (results.size() == 0) {
+                    if (offset + thisNodeSize >= targetOffset)
+                        results.add(truncateNode(getLocalResult(),
+                                                 Math.max(0, targetOffset - offset),
+                                                 targetSize >= 0 ? Math.max(0, offset + thisNodeSize - (targetOffset + targetSize)) : 0));
+                }
+                else {
+                    if (targetSize == -1 || offset < targetOffset + targetSize) {
+                        results.add(truncateNode(getLocalResult(),
+                                                 0,
+                                                 targetSize >= 0 ? Math.max(0, offset + thisNodeSize - (targetOffset + targetSize)) : 0));
+                    }
+                }
+            }
+        }
+
+        /**
+         * Return a new node describing the result of truncating an existing Node
+         * at the left and/or right.
+         */
+        private Node<P_OUT> truncateNode(Node<P_OUT> input,
+                                         long skipLeft, long skipRight) {
+            if (skipLeft == 0 && skipRight == 0)
+                return input;
+            else {
+                return Nodes.truncateNode(input, skipLeft, thisNodeSize - skipRight, generator);
+            }
+        }
+    }
+
+    // @@@ Currently unused -- optimization for when all sizes are known
+//    private static class SizedSliceTask<S, T> extends AbstractShortCircuitTask<S, T, Node<T>, SizedSliceTask<S, T>> {
+//        private final int targetOffset, targetSize;
+//        private final int offset, size;
+//
+//        private SizedSliceTask(ParallelPipelineHelper<S, T> helper, int offset, int size) {
+//            super(helper);
+//            targetOffset = offset;
+//            targetSize = size;
+//            this.offset = 0;
+//            this.size = spliterator.getSizeIfKnown();
+//        }
+//
+//        private SizedSliceTask(SizedSliceTask<S, T> parent, Spliterator<S> spliterator) {
+//            // Makes assumptions about order in which siblings are created and linked into parent!
+//            super(parent, spliterator);
+//            targetOffset = parent.targetOffset;
+//            targetSize = parent.targetSize;
+//            int siblingSizes = 0;
+//            for (SizedSliceTask<S, T> sibling = parent.children; sibling != null; sibling = sibling.nextSibling)
+//                siblingSizes += sibling.size;
+//            size = spliterator.getSizeIfKnown();
+//            offset = parent.offset + siblingSizes;
+//        }
+//
+//        @Override
+//        protected SizedSliceTask<S, T> makeChild(Spliterator<S> spliterator) {
+//            return new SizedSliceTask<>(this, spliterator);
+//        }
+//
+//        @Override
+//        protected Node<T> getEmptyResult() {
+//            return Nodes.emptyNode();
+//        }
+//
+//        @Override
+//        public boolean taskCanceled() {
+//            if (offset > targetOffset+targetSize || offset+size < targetOffset)
+//                return true;
+//            else
+//                return super.taskCanceled();
+//        }
+//
+//        @Override
+//        protected Node<T> doLeaf() {
+//            int skipLeft = Math.max(0, targetOffset - offset);
+//            int skipRight = Math.max(0, offset + size - (targetOffset + targetSize));
+//            if (skipLeft == 0 && skipRight == 0)
+//                return helper.into(Nodes.<T>makeBuilder(spliterator.getSizeIfKnown())).build();
+//            else {
+//                // If we're the first or last node that intersects the target range, peel off irrelevant elements
+//                int truncatedSize = size - skipLeft - skipRight;
+//                NodeBuilder<T> builder = Nodes.<T>makeBuilder(truncatedSize);
+//                Sink<S> wrappedSink = helper.wrapSink(builder);
+//                wrappedSink.begin(truncatedSize);
+//                Iterator<S> iterator = spliterator.iterator();
+//                for (int i=0; i<skipLeft; i++)
+//                    iterator.next();
+//                for (int i=0; i<truncatedSize; i++)
+//                    wrappedSink.apply(iterator.next());
+//                wrappedSink.end();
+//                return builder.build();
+//            }
+//        }
+//
+//        @Override
+//        public void onCompletion(CountedCompleter<?> caller) {
+//            if (!isLeaf()) {
+//                Node<T> result = null;
+//                for (SizedSliceTask<S, T> child = children.nextSibling; child != null; child = child.nextSibling) {
+//                    Node<T> childResult = child.getRawResult();
+//                    if (childResult == null)
+//                        continue;
+//                    else if (result == null)
+//                        result = childResult;
+//                    else
+//                        result = Nodes.node(result, childResult);
+//                }
+//                setRawResult(result);
+//                if (offset <= targetOffset && offset+size >= targetOffset+targetSize)
+//                    shortCircuit(result);
+//            }
+//        }
+//    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/SortedOps.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Comparators;
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.concurrent.ForkJoinTask;
+import java.util.function.IntFunction;
+
+
+/**
+ * Factory methods for transforming streams into sorted streams.
+ *
+ * @since 1.8
+ */
+final class SortedOps {
+
+    private SortedOps() { }
+
+    /**
+     * Appends a "sorted" operation to the provided stream.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     */
+    static <T> Stream<T> makeRef(AbstractPipeline<?, T, ?> upstream) {
+        return new OfRef<>(upstream);
+    }
+
+    /**
+     * Appends a "sorted" operation to the provided stream.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     * @param comparator the comparator to order elements by
+     */
+    static <T> Stream<T> makeRef(AbstractPipeline<?, T, ?> upstream,
+                                Comparator<? super T> comparator) {
+        return new OfRef<>(upstream, comparator);
+    }
+
+    /**
+     * Appends a "sorted" operation to the provided stream.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     */
+    static <T> IntStream makeInt(AbstractPipeline<?, Integer, ?> upstream) {
+        return new OfInt(upstream);
+    }
+
+    /**
+     * Appends a "sorted" operation to the provided stream.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     */
+    static <T> LongStream makeLong(AbstractPipeline<?, Long, ?> upstream) {
+        return new OfLong(upstream);
+    }
+
+    /**
+     * Appends a "sorted" operation to the provided stream.
+     *
+     * @param <T> the type of both input and output elements
+     * @param upstream a reference stream with element type T
+     */
+    static <T> DoubleStream makeDouble(AbstractPipeline<?, Double, ?> upstream) {
+        return new OfDouble(upstream);
+    }
+
+    /**
+     * Specialized subtype for sorting reference streams
+     */
+    private static final class OfRef<T> extends ReferencePipeline.StatefulOp<T, T> {
+        /**
+         * Comparator used for sorting
+         */
+        private final boolean isNaturalSort;
+        private final Comparator<? super T> comparator;
+
+        /**
+         * Sort using natural order of {@literal <T>} which must be
+         * {@code Comparable}.
+         */
+        OfRef(AbstractPipeline<?, T, ?> upstream) {
+            super(upstream, StreamShape.REFERENCE,
+                  StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
+            this.isNaturalSort = true;
+            // Will throw CCE when we try to sort if T is not Comparable
+            this.comparator = (Comparator<? super T>) Comparators.naturalOrder();
+        }
+
+        /**
+         * Sort using the provided comparator.
+         *
+         * @param comparator The comparator to be used to evaluate ordering.
+         */
+        OfRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) {
+            super(upstream, StreamShape.REFERENCE,
+                  StreamOpFlag.IS_ORDERED | StreamOpFlag.NOT_SORTED);
+            this.isNaturalSort = false;
+            this.comparator = Objects.requireNonNull(comparator);
+        }
+
+        @Override
+        public Sink<T> opWrapSink(int flags, Sink sink) {
+            Objects.requireNonNull(sink);
+
+            // If the input is already naturally sorted and this operation
+            // also naturally sorted then this is a no-op
+            if (StreamOpFlag.SORTED.isKnown(flags) && isNaturalSort)
+                return sink;
+            else if (StreamOpFlag.SIZED.isKnown(flags))
+                return new SizedRefSortingSink<>(sink, comparator);
+            else
+                return new RefSortingSink<>(sink, comparator);
+        }
+
+        @Override
+        public <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
+                                                 Spliterator<P_IN> spliterator,
+                                                 IntFunction<T[]> generator) {
+            // If the input is already naturally sorted and this operation
+            // naturally sorts then collect the output
+            if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags()) && isNaturalSort) {
+                return helper.evaluate(spliterator, false, generator);
+            }
+            else {
+                // @@@ Weak two-pass parallel implementation; parallel collect, parallel sort
+                T[] flattenedData = helper.evaluate(spliterator, true, generator).asArray(generator);
+                Arrays.parallelSort(flattenedData, comparator);
+                return Nodes.node(flattenedData);
+            }
+        }
+    }
+
+    /**
+     * Specialized subtype for sorting int streams.
+     */
+    private static final class OfInt extends IntPipeline.StatefulOp<Integer> {
+        OfInt(AbstractPipeline<?, Integer, ?> upstream) {
+            super(upstream, StreamShape.INT_VALUE,
+                  StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
+        }
+
+        @Override
+        public Sink<Integer> opWrapSink(int flags, Sink sink) {
+            Objects.requireNonNull(sink);
+
+            if (StreamOpFlag.SORTED.isKnown(flags))
+                return sink;
+            else if (StreamOpFlag.SIZED.isKnown(flags))
+                return new SizedIntSortingSink(sink);
+            else
+                return new IntSortingSink(sink);
+        }
+
+        @Override
+        public <P_IN> Node<Integer> opEvaluateParallel(PipelineHelper<Integer> helper,
+                                                       Spliterator<P_IN> spliterator,
+                                                       IntFunction<Integer[]> generator) {
+            if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
+                return helper.evaluate(spliterator, false, generator);
+            }
+            else {
+                Node.OfInt n = (Node.OfInt) helper.evaluate(spliterator, true, generator);
+
+                int[] content = n.asIntArray();
+                Arrays.parallelSort(content);
+
+                return Nodes.node(content);
+            }
+        }
+    }
+
+    /**
+     * Specialized subtype for sorting long streams.
+     */
+    private static final class OfLong extends LongPipeline.StatefulOp<Long> {
+        OfLong(AbstractPipeline<?, Long, ?> upstream) {
+            super(upstream, StreamShape.LONG_VALUE,
+                  StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
+        }
+
+        @Override
+        public Sink<Long> opWrapSink(int flags, Sink sink) {
+            Objects.requireNonNull(sink);
+
+            if (StreamOpFlag.SORTED.isKnown(flags))
+                return sink;
+            else if (StreamOpFlag.SIZED.isKnown(flags))
+                return new SizedLongSortingSink(sink);
+            else
+                return new LongSortingSink(sink);
+        }
+
+        @Override
+        public <P_IN> Node<Long> opEvaluateParallel(PipelineHelper<Long> helper,
+                                                    Spliterator<P_IN> spliterator,
+                                                    IntFunction<Long[]> generator) {
+            if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
+                return helper.evaluate(spliterator, false, generator);
+            }
+            else {
+                Node.OfLong n = (Node.OfLong) helper.evaluate(spliterator, true, generator);
+
+                long[] content = n.asLongArray();
+                Arrays.parallelSort(content);
+
+                return Nodes.node(content);
+            }
+        }
+    }
+
+    /**
+     * Specialized subtype for sorting double streams.
+     */
+    private static final class OfDouble extends DoublePipeline.StatefulOp<Double> {
+        OfDouble(AbstractPipeline<?, Double, ?> upstream) {
+            super(upstream, StreamShape.DOUBLE_VALUE,
+                  StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED);
+        }
+
+        @Override
+        public Sink<Double> opWrapSink(int flags, Sink sink) {
+            Objects.requireNonNull(sink);
+
+            if (StreamOpFlag.SORTED.isKnown(flags))
+                return sink;
+            else if (StreamOpFlag.SIZED.isKnown(flags))
+                return new SizedDoubleSortingSink(sink);
+            else
+                return new DoubleSortingSink(sink);
+        }
+
+        @Override
+        public <P_IN> Node<Double> opEvaluateParallel(PipelineHelper<Double> helper,
+                                                      Spliterator<P_IN> spliterator,
+                                                      IntFunction<Double[]> generator) {
+            if (StreamOpFlag.SORTED.isKnown(helper.getStreamAndOpFlags())) {
+                return helper.evaluate(spliterator, false, generator);
+            }
+            else {
+                Node.OfDouble n = (Node.OfDouble) helper.evaluate(spliterator, true, generator);
+
+                double[] content = n.asDoubleArray();
+                Arrays.parallelSort(content);
+
+                return Nodes.node(content);
+            }
+        }
+    }
+
+    /**
+     * {@link ForkJoinTask} for implementing sort on SIZED reference streams.
+     */
+    private static final class SizedRefSortingSink<T> extends Sink.ChainedReference<T> {
+        private final Comparator<? super T> comparator;
+        private T[] array;
+        private int offset;
+
+        SizedRefSortingSink(Sink sink, Comparator<? super T> comparator) {
+            super(sink);
+            this.comparator = comparator;
+        }
+
+        @Override
+        public void begin(long size) {
+            if (size >= Nodes.MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            array = (T[]) new Object[(int) size];
+        }
+
+        @Override
+        public void end() {
+            // Need to use offset rather than array.length since the downstream
+            // many be short-circuiting
+            // @@@ A better approach is to know if the downstream short-circuits
+            //     and check sink.cancellationRequested
+            Arrays.sort(array, 0, offset, comparator);
+            downstream.begin(offset);
+            for (int i = 0; i < offset; i++)
+                downstream.accept(array[i]);
+            downstream.end();
+            array = null;
+        }
+
+        @Override
+        public void accept(T t) {
+            array[offset++] = t;
+        }
+    }
+
+    /**
+     * {@link Sink} for implementing sort on reference streams.
+     */
+    private static final class RefSortingSink<T> extends Sink.ChainedReference<T> {
+        private final Comparator<? super T> comparator;
+        private ArrayList<T> list;
+
+        RefSortingSink(Sink sink, Comparator<? super T> comparator) {
+            super(sink);
+            this.comparator = comparator;
+        }
+
+        @Override
+        public void begin(long size) {
+            list = (size >= 0) ? new ArrayList<T>((int) size) : new ArrayList<T>();
+        }
+
+        @Override
+        public void end() {
+            list.sort(comparator);
+            downstream.begin(list.size());
+            list.forEach(downstream::accept);
+            downstream.end();
+            list = null;
+        }
+
+        @Override
+        public void accept(T t) {
+            list.add(t);
+        }
+    }
+
+    /**
+     * {@link Sink} for implementing sort on SIZED int streams.
+     */
+    private static final class SizedIntSortingSink extends Sink.ChainedInt {
+        private int[] array;
+        private int offset;
+
+        SizedIntSortingSink(Sink downstream) {
+            super(downstream);
+        }
+
+        @Override
+        public void begin(long size) {
+            if (size >= Nodes.MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            array = new int[(int) size];
+        }
+
+        @Override
+        public void end() {
+            Arrays.sort(array, 0, offset);
+            downstream.begin(offset);
+            for (int i = 0; i < offset; i++)
+                downstream.accept(array[i]);
+            downstream.end();
+            array = null;
+        }
+
+        @Override
+        public void accept(int t) {
+            array[offset++] = t;
+        }
+    }
+
+    /**
+     * {@link Sink} for implementing sort on int streams.
+     */
+    private static final class IntSortingSink extends Sink.ChainedInt {
+        private SpinedBuffer.OfInt b;
+
+        IntSortingSink(Sink sink) {
+            super(sink);
+        }
+
+        @Override
+        public void begin(long size) {
+            b = (size > 0) ? new SpinedBuffer.OfInt((int) size) : new SpinedBuffer.OfInt();
+        }
+
+        @Override
+        public void end() {
+            int[] ints = b.asIntArray();
+            Arrays.sort(ints);
+            downstream.begin(ints.length);
+            for (int anInt : ints)
+                downstream.accept(anInt);
+            downstream.end();
+        }
+
+        @Override
+        public void accept(int t) {
+            b.accept(t);
+        }
+    }
+
+    /**
+     * {@link Sink} for implementing sort on SIZED long streams.
+     */
+    private static final class SizedLongSortingSink extends Sink.ChainedLong {
+        private long[] array;
+        private int offset;
+
+        SizedLongSortingSink(Sink downstream) {
+            super(downstream);
+        }
+
+        @Override
+        public void begin(long size) {
+            if (size >= Nodes.MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            array = new long[(int) size];
+        }
+
+        @Override
+        public void end() {
+            Arrays.sort(array, 0, offset);
+            downstream.begin(offset);
+            for (int i = 0; i < offset; i++)
+                downstream.accept(array[i]);
+            downstream.end();
+            array = null;
+        }
+
+        @Override
+        public void accept(long t) {
+            array[offset++] = t;
+        }
+    }
+
+    /**
+     * {@link Sink} for implementing sort on long streams.
+     */
+    private static final class LongSortingSink extends Sink.ChainedLong {
+        private SpinedBuffer.OfLong b;
+
+        LongSortingSink(Sink sink) {
+            super(sink);
+        }
+
+        @Override
+        public void begin(long size) {
+            b = (size > 0) ? new SpinedBuffer.OfLong((int) size) : new SpinedBuffer.OfLong();
+        }
+
+        @Override
+        public void end() {
+            long[] longs = b.asLongArray();
+            Arrays.sort(longs);
+            downstream.begin(longs.length);
+            for (long aLong : longs)
+                downstream.accept(aLong);
+            downstream.end();
+        }
+
+        @Override
+        public void accept(long t) {
+            b.accept(t);
+        }
+    }
+
+    /**
+     * {@link Sink} for implementing sort on SIZED double streams.
+     */
+    private static final class SizedDoubleSortingSink extends Sink.ChainedDouble {
+        private double[] array;
+        private int offset;
+
+        SizedDoubleSortingSink(Sink downstream) {
+            super(downstream);
+        }
+
+        @Override
+        public void begin(long size) {
+            if (size >= Nodes.MAX_ARRAY_SIZE)
+                throw new IllegalArgumentException("Stream size exceeds max array size");
+            array = new double[(int) size];
+        }
+
+        @Override
+        public void end() {
+            Arrays.sort(array, 0, offset);
+            downstream.begin(offset);
+            for (int i = 0; i < offset; i++)
+                downstream.accept(array[i]);
+            downstream.end();
+            array = null;
+        }
+
+        @Override
+        public void accept(double t) {
+            array[offset++] = t;
+        }
+    }
+
+    /**
+     * {@link Sink} for implementing sort on double streams.
+     */
+    private static final class DoubleSortingSink extends Sink.ChainedDouble {
+        private SpinedBuffer.OfDouble b;
+
+        DoubleSortingSink(Sink sink) {
+            super(sink);
+        }
+
+        @Override
+        public void begin(long size) {
+            b = (size > 0) ? new SpinedBuffer.OfDouble((int) size) : new SpinedBuffer.OfDouble();
+        }
+
+        @Override
+        public void end() {
+            double[] doubles = b.asDoubleArray();
+            Arrays.sort(doubles);
+            downstream.begin(doubles.length);
+            for (double aDouble : doubles)
+                downstream.accept(aDouble);
+            downstream.end();
+        }
+
+        @Override
+        public void accept(double t) {
+            b.accept(t);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/SpinedBuffer.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,958 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.PrimitiveIterator;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
+import java.util.function.LongConsumer;
+
+/**
+ * An ordered collection of elements.  Elements can be added, but not removed.
+ * Goes through a building phase, during which elements can be added, and a
+ * traversal phase, during which elements can be traversed in order but no
+ * further modifications are possible.
+ *
+ * <p> One or more arrays are used to store elements. The use of a multiple
+ * arrays has better performance characteristics than a single array used by
+ * {@link ArrayList}, as when the capacity of the list needs to be increased
+ * no copying of elements is required.  This is usually beneficial in the case
+ * where the results will be traversed a small number of times.
+ *
+ * @param <E> the type of elements in this list
+ * @since 1.8
+ */
+class SpinedBuffer<E>
+        extends AbstractSpinedBuffer
+        implements Consumer<E>, Iterable<E> {
+
+    /*
+     * We optimistically hope that all the data will fit into the first chunk,
+     * so we try to avoid inflating the spine[] and priorElementCount[] arrays
+     * prematurely.  So methods must be prepared to deal with these arrays being
+     * null.  If spine is non-null, then spineIndex points to the current chunk
+     * within the spine, otherwise it is zero.  The spine and priorElementCount
+     * arrays are always the same size, and for any i <= spineIndex,
+     * priorElementCount[i] is the sum of the sizes of all the prior chunks.
+     *
+     * The curChunk pointer is always valid.  The elementIndex is the index of
+     * the next element to be written in curChunk; this may be past the end of
+     * curChunk so we have to check before writing. When we inflate the spine
+     * array, curChunk becomes the first element in it.  When we clear the
+     * buffer, we discard all chunks except the first one, which we clear,
+     * restoring it to the initial single-chunk state.
+     */
+
+    /**
+     * Chunk that we're currently writing into; may or may not be aliased with
+     * the first element of the spine.
+     */
+    protected E[] curChunk;
+
+    /**
+     * All chunks, or null if there is only one chunk.
+     */
+    protected E[][] spine;
+
+    /**
+     * Constructs an empty list with the specified initial capacity.
+     *
+     * @param  initialCapacity  the initial capacity of the list
+     * @throws IllegalArgumentException if the specified initial capacity
+     *         is negative
+     */
+    SpinedBuffer(int initialCapacity) {
+        super(initialCapacity);
+        curChunk = (E[]) new Object[1 << initialChunkPower];
+    }
+
+    /**
+     * Constructs an empty list with an initial capacity of sixteen.
+     */
+    SpinedBuffer() {
+        super();
+        curChunk = (E[]) new Object[1 << initialChunkPower];
+    }
+
+    /**
+     * Returns the current capacity of the buffer
+     */
+    protected long capacity() {
+        return (spineIndex == 0)
+               ? curChunk.length
+               : priorElementCount[spineIndex] + spine[spineIndex].length;
+    }
+
+    private void inflateSpine() {
+        if (spine == null) {
+            spine = (E[][]) new Object[MIN_SPINE_SIZE][];
+            priorElementCount = new long[MIN_SPINE_SIZE];
+            spine[0] = curChunk;
+        }
+    }
+
+    /**
+     * Ensure that the buffer has at least capacity to hold the target size
+     */
+    protected final void ensureCapacity(long targetSize) {
+        long capacity = capacity();
+        if (targetSize > capacity) {
+            inflateSpine();
+            for (int i=spineIndex+1; targetSize > capacity; i++) {
+                if (i >= spine.length) {
+                    int newSpineSize = spine.length * 2;
+                    spine = Arrays.copyOf(spine, newSpineSize);
+                    priorElementCount = Arrays.copyOf(priorElementCount, newSpineSize);
+                }
+                int nextChunkSize = chunkSize(i);
+                spine[i] = (E[]) new Object[nextChunkSize];
+                priorElementCount[i] = priorElementCount[i-1] + spine[i-1].length;
+                capacity += nextChunkSize;
+            }
+        }
+    }
+
+    /**
+     * Force the buffer to increase its capacity.
+     */
+    protected void increaseCapacity() {
+        ensureCapacity(capacity() + 1);
+    }
+
+    /**
+     * Retrieve the element at the specified index.
+     */
+    public E get(long index) {
+        // @@@ can further optimize by caching last seen spineIndex,
+        // which is going to be right most of the time
+        if (spineIndex == 0) {
+            if (index < elementIndex)
+                return curChunk[((int) index)];
+            else
+                throw new IndexOutOfBoundsException(Long.toString(index));
+        }
+
+        if (index >= count())
+            throw new IndexOutOfBoundsException(Long.toString(index));
+
+        for (int j=0; j <= spineIndex; j++)
+            if (index < priorElementCount[j] + spine[j].length)
+                return spine[j][((int) (index - priorElementCount[j]))];
+
+        throw new IndexOutOfBoundsException(Long.toString(index));
+    }
+
+    /**
+     * Copy the elements, starting at the specified offset, into the specified
+     * array.
+     */
+    public void copyInto(E[] array, int offset) {
+        long finalOffset = offset + count();
+        if (finalOffset > array.length || finalOffset < offset) {
+            throw new IndexOutOfBoundsException("does not fit");
+        }
+
+        if (spineIndex == 0)
+            System.arraycopy(curChunk, 0, array, offset, elementIndex);
+        else {
+            // full chunks
+            for (int i=0; i < spineIndex; i++) {
+                System.arraycopy(spine[i], 0, array, offset, spine[i].length);
+                offset += spine[i].length;
+            }
+            if (elementIndex > 0)
+                System.arraycopy(curChunk, 0, array, offset, elementIndex);
+        }
+    }
+
+    /**
+     * Create a new array using the specified array factory, and copy the
+     * elements into it.
+     */
+    public E[] asArray(IntFunction<E[]> arrayFactory) {
+        // @@@ will fail for size == MAX_VALUE
+        E[] result = arrayFactory.apply((int) count());
+
+        copyInto(result, 0);
+
+        return result;
+    }
+
+    @Override
+    public void clear() {
+        if (spine != null) {
+            curChunk = spine[0];
+            for (int i=0; i<curChunk.length; i++)
+                curChunk[i] = null;
+            spine = null;
+            priorElementCount = null;
+        }
+        else {
+            for (int i=0; i<elementIndex; i++)
+                curChunk[i] = null;
+        }
+        elementIndex = 0;
+        spineIndex = 0;
+    }
+
+    @Override
+    public Iterator<E> iterator() {
+        return Spliterators.iteratorFromSpliterator(spliterator());
+    }
+
+    @Override
+    public void forEach(Consumer<? super E> consumer) {
+        // completed chunks, if any
+        for (int j = 0; j < spineIndex; j++)
+            for (E t : spine[j])
+                consumer.accept(t);
+
+        // current chunk
+        for (int i=0; i<elementIndex; i++)
+            consumer.accept(curChunk[i]);
+    }
+
+    @Override
+    public void accept(E e) {
+        if (elementIndex == curChunk.length) {
+            inflateSpine();
+            if (spineIndex+1 >= spine.length || spine[spineIndex+1] == null)
+                increaseCapacity();
+            elementIndex = 0;
+            ++spineIndex;
+            curChunk = spine[spineIndex];
+        }
+        curChunk[elementIndex++] = e;
+    }
+
+    @Override
+    public String toString() {
+        List<E> list = new ArrayList<>();
+        forEach(list::add);
+        return "SpinedBuffer:" + list.toString();
+    }
+
+    private static final int SPLITERATOR_CHARACTERISTICS
+            = Spliterator.SIZED | Spliterator.ORDERED | Spliterator.SUBSIZED;
+
+    /**
+     * Return a {@link Spliterator} describing the contents of the buffer.
+     */
+    public Spliterator<E> spliterator() {
+        return new Spliterator<E>() {
+            // The current spine index
+            int splSpineIndex;
+
+            // The current element index into the current spine
+            int splElementIndex;
+
+            // When splSpineIndex >= spineIndex and splElementIndex >= elementIndex then
+            // this spliterator is fully traversed
+            // tryAdvance can set splSpineIndex > spineIndex if the last spine is full
+
+            // The current spine array
+            E[] splChunk = (spine == null) ? curChunk : spine[0];
+
+            @Override
+            public long estimateSize() {
+                return (spine == null)
+                       ? (elementIndex - splElementIndex)
+                       : count() - (priorElementCount[splSpineIndex] + splElementIndex);
+            }
+
+            @Override
+            public int characteristics() {
+                return SPLITERATOR_CHARACTERISTICS;
+            }
+
+            @Override
+            public boolean tryAdvance(Consumer<? super E> consumer) {
+                if (splSpineIndex < spineIndex
+                    || (splSpineIndex == spineIndex && splElementIndex < elementIndex)) {
+                    consumer.accept(splChunk[splElementIndex++]);
+
+                    if (splElementIndex == splChunk.length) {
+                        splElementIndex = 0;
+                        ++splSpineIndex;
+                        if (spine != null && splSpineIndex < spine.length)
+                            splChunk = spine[splSpineIndex];
+                    }
+                    return true;
+                }
+                return false;
+            }
+
+            @Override
+            public void forEachRemaining(Consumer<? super E> consumer) {
+                if (splSpineIndex < spineIndex
+                    || (splSpineIndex == spineIndex && splElementIndex < elementIndex)) {
+                    int i = splElementIndex;
+                    // completed chunks, if any
+                    for (int sp = splSpineIndex; sp < spineIndex; sp++) {
+                        E[] chunk = spine[sp];
+                        for (; i < chunk.length; i++) {
+                            consumer.accept(chunk[i]);
+                        }
+                        i = 0;
+                    }
+
+                    // current chunk
+                    E[] chunk = curChunk;
+                    int hElementIndex = elementIndex;
+                    for (; i < hElementIndex; i++) {
+                        consumer.accept(chunk[i]);
+                    }
+
+                    splSpineIndex = spineIndex;
+                    splElementIndex = elementIndex;
+                }
+            }
+
+            @Override
+            public Spliterator<E> trySplit() {
+                if (splSpineIndex < spineIndex) {
+                    Spliterator<E> ret = Arrays.spliterator(spine[splSpineIndex],
+                                                            splElementIndex, spine[splSpineIndex].length);
+                    splChunk = spine[++splSpineIndex];
+                    splElementIndex = 0;
+                    return ret;
+                }
+                else if (splSpineIndex == spineIndex) {
+                    int t = (elementIndex - splElementIndex) / 2;
+                    if (t == 0)
+                        return null;
+                    else {
+                        Spliterator<E> ret = Arrays.spliterator(curChunk, splElementIndex, splElementIndex + t);
+                        splElementIndex += t;
+                        return ret;
+                    }
+                }
+                else {
+                    return null;
+                }
+            }
+        };
+    }
+
+    /**
+     * An ordered collection of primitive values.  Elements can be added, but
+     * not removed. Goes through a building phase, during which elements can be
+     * added, and a traversal phase, during which elements can be traversed in
+     * order but no further modifications are possible.
+     *
+     * <p> One or more arrays are used to store elements. The use of a multiple
+     * arrays has better performance characteristics than a single array used by
+     * {@link ArrayList}, as when the capacity of the list needs to be increased
+     * no copying of elements is required.  This is usually beneficial in the case
+     * where the results will be traversed a small number of times.
+     *
+     * @param <E> the wrapper type for this primitive type
+     * @param <T_ARR> the array type for this primitive type
+     * @param <T_CONS> the Consumer type for this primitive type
+     */
+    abstract static class OfPrimitive<E, T_ARR, T_CONS>
+            extends AbstractSpinedBuffer implements Iterable<E> {
+
+        /*
+         * We optimistically hope that all the data will fit into the first chunk,
+         * so we try to avoid inflating the spine[] and priorElementCount[] arrays
+         * prematurely.  So methods must be prepared to deal with these arrays being
+         * null.  If spine is non-null, then spineIndex points to the current chunk
+         * within the spine, otherwise it is zero.  The spine and priorElementCount
+         * arrays are always the same size, and for any i <= spineIndex,
+         * priorElementCount[i] is the sum of the sizes of all the prior chunks.
+         *
+         * The curChunk pointer is always valid.  The elementIndex is the index of
+         * the next element to be written in curChunk; this may be past the end of
+         * curChunk so we have to check before writing. When we inflate the spine
+         * array, curChunk becomes the first element in it.  When we clear the
+         * buffer, we discard all chunks except the first one, which we clear,
+         * restoring it to the initial single-chunk state.
+         */
+
+        // The chunk we're currently writing into
+        T_ARR curChunk;
+
+        // All chunks, or null if there is only one chunk
+        T_ARR[] spine;
+
+        /**
+         * Constructs an empty list with the specified initial capacity.
+         *
+         * @param  initialCapacity  the initial capacity of the list
+         * @throws IllegalArgumentException if the specified initial capacity
+         *         is negative
+         */
+        OfPrimitive(int initialCapacity) {
+            super(initialCapacity);
+            curChunk = newArray(1 << initialChunkPower);
+        }
+
+        /**
+         * Constructs an empty list with an initial capacity of sixteen.
+         */
+        OfPrimitive() {
+            super();
+            curChunk = newArray(1 << initialChunkPower);
+        }
+
+        @Override
+        public abstract Iterator<E> iterator();
+
+        @Override
+        public abstract void forEach(Consumer<? super E> consumer);
+
+        /** Create a new array-of-array of the proper type and size */
+        protected abstract T_ARR[] newArrayArray(int size);
+
+        /** Create a new array of the proper type and size */
+        protected abstract T_ARR newArray(int size);
+
+        /** Get the length of an array */
+        protected abstract int arrayLength(T_ARR array);
+
+        /** Iterate an array with the provided consumer */
+        protected abstract void arrayForEach(T_ARR array, int from, int to,
+                                             T_CONS consumer);
+
+        protected long capacity() {
+            return (spineIndex == 0)
+                   ? arrayLength(curChunk)
+                   : priorElementCount[spineIndex] + arrayLength(spine[spineIndex]);
+        }
+
+        private void inflateSpine() {
+            if (spine == null) {
+                spine = newArrayArray(MIN_SPINE_SIZE);
+                priorElementCount = new long[MIN_SPINE_SIZE];
+                spine[0] = curChunk;
+            }
+        }
+
+        protected final void ensureCapacity(long targetSize) {
+            long capacity = capacity();
+            if (targetSize > capacity) {
+                inflateSpine();
+                for (int i=spineIndex+1; targetSize > capacity; i++) {
+                    if (i >= spine.length) {
+                        int newSpineSize = spine.length * 2;
+                        spine = Arrays.copyOf(spine, newSpineSize);
+                        priorElementCount = Arrays.copyOf(priorElementCount, newSpineSize);
+                    }
+                    int nextChunkSize = chunkSize(i);
+                    spine[i] = newArray(nextChunkSize);
+                    priorElementCount[i] = priorElementCount[i-1] + arrayLength(spine[i - 1]);
+                    capacity += nextChunkSize;
+                }
+            }
+        }
+
+        protected void increaseCapacity() {
+            ensureCapacity(capacity() + 1);
+        }
+
+        protected int chunkFor(long index) {
+            if (spineIndex == 0) {
+                if (index < elementIndex)
+                    return 0;
+                else
+                    throw new IndexOutOfBoundsException(Long.toString(index));
+            }
+
+            if (index >= count())
+                throw new IndexOutOfBoundsException(Long.toString(index));
+
+            for (int j=0; j <= spineIndex; j++)
+                if (index < priorElementCount[j] + arrayLength(spine[j]))
+                    return j;
+
+            throw new IndexOutOfBoundsException(Long.toString(index));
+        }
+
+        public void copyInto(T_ARR array, int offset) {
+            long finalOffset = offset + count();
+            if (finalOffset > arrayLength(array) || finalOffset < offset) {
+                throw new IndexOutOfBoundsException("does not fit");
+            }
+
+            if (spineIndex == 0)
+                System.arraycopy(curChunk, 0, array, offset, elementIndex);
+            else {
+                // full chunks
+                for (int i=0; i < spineIndex; i++) {
+                    System.arraycopy(spine[i], 0, array, offset, arrayLength(spine[i]));
+                    offset += arrayLength(spine[i]);
+                }
+                if (elementIndex > 0)
+                    System.arraycopy(curChunk, 0, array, offset, elementIndex);
+            }
+        }
+
+        public T_ARR asPrimitiveArray() {
+            // @@@ will fail for size == MAX_VALUE
+            T_ARR result = newArray((int) count());
+            copyInto(result, 0);
+            return result;
+        }
+
+        protected void preAccept() {
+            if (elementIndex == arrayLength(curChunk)) {
+                inflateSpine();
+                if (spineIndex+1 >= spine.length || spine[spineIndex+1] == null)
+                    increaseCapacity();
+                elementIndex = 0;
+                ++spineIndex;
+                curChunk = spine[spineIndex];
+            }
+        }
+
+        public void clear() {
+            if (spine != null) {
+                curChunk = spine[0];
+                spine = null;
+                priorElementCount = null;
+            }
+            elementIndex = 0;
+            spineIndex = 0;
+        }
+
+        public void forEach(T_CONS consumer) {
+            // completed chunks, if any
+            for (int j = 0; j < spineIndex; j++)
+                arrayForEach(spine[j], 0, arrayLength(spine[j]), consumer);
+
+            // current chunk
+            arrayForEach(curChunk, 0, elementIndex, consumer);
+        }
+
+        abstract class BaseSpliterator<T_SPLITER extends Spliterator<E>>
+                implements Spliterator<E> {
+            // The current spine index
+            int splSpineIndex;
+
+            // The current element index into the current spine
+            int splElementIndex;
+
+            // When splSpineIndex >= spineIndex and splElementIndex >= elementIndex then
+            // this spliterator is fully traversed
+            // tryAdvance can set splSpineIndex > spineIndex if the last spine is full
+
+            // The current spine array
+            T_ARR splChunk = (spine == null) ? curChunk : spine[0];
+
+            abstract void arrayForOne(T_ARR array, int index, T_CONS consumer);
+
+            abstract T_SPLITER arraySpliterator(T_ARR array, int offset, int len);
+
+            @Override
+            public long estimateSize() {
+                return (spine == null)
+                       ? (elementIndex - splElementIndex)
+                       : count() - (priorElementCount[splSpineIndex] + splElementIndex);
+            }
+
+            @Override
+            public int characteristics() {
+                return SPLITERATOR_CHARACTERISTICS;
+            }
+
+            public boolean tryAdvance(T_CONS consumer) {
+                if (splSpineIndex < spineIndex
+                    || (splSpineIndex == spineIndex && splElementIndex < elementIndex)) {
+                    arrayForOne(splChunk, splElementIndex++, consumer);
+
+                    if (splElementIndex == arrayLength(splChunk)) {
+                        splElementIndex = 0;
+                        ++splSpineIndex;
+                        if (spine != null && splSpineIndex < spine.length)
+                            splChunk = spine[splSpineIndex];
+                    }
+                    return true;
+                }
+                return false;
+            }
+
+            public void forEachRemaining(T_CONS consumer) {
+                if (splSpineIndex < spineIndex
+                    || (splSpineIndex == spineIndex && splElementIndex < elementIndex)) {
+                    int i = splElementIndex;
+                    // completed chunks, if any
+                    for (int sp = splSpineIndex; sp < spineIndex; sp++) {
+                        T_ARR chunk = spine[sp];
+                        arrayForEach(chunk, i, arrayLength(chunk), consumer);
+                        i = 0;
+                    }
+
+                    arrayForEach(curChunk, i, elementIndex, consumer);
+
+                    splSpineIndex = spineIndex;
+                    splElementIndex = elementIndex;
+                }
+            }
+
+            @Override
+            public T_SPLITER trySplit() {
+                if (splSpineIndex < spineIndex) {
+                    T_SPLITER ret = arraySpliterator(spine[splSpineIndex], splElementIndex,
+                                                     arrayLength(spine[splSpineIndex]) - splElementIndex);
+                    splChunk = spine[++splSpineIndex];
+                    splElementIndex = 0;
+                    return ret;
+                }
+                else if (splSpineIndex == spineIndex) {
+                    int t = (elementIndex - splElementIndex) / 2;
+                    if (t == 0)
+                        return null;
+                    else {
+                        T_SPLITER ret = arraySpliterator(curChunk, splElementIndex, t);
+                        splElementIndex += t;
+                        return ret;
+                    }
+                }
+                else {
+                    return null;
+                }
+            }
+        }
+    }
+
+    /**
+     * An ordered collection of {@code int} values.
+     */
+    static class OfInt extends SpinedBuffer.OfPrimitive<Integer, int[], IntConsumer>
+            implements IntConsumer {
+        OfInt() { }
+
+        OfInt(int initialCapacity) {
+            super(initialCapacity);
+        }
+
+        @Override
+        public void forEach(Consumer<? super Integer> consumer) {
+            if (consumer instanceof IntConsumer) {
+                forEach((IntConsumer) consumer);
+            }
+            else {
+                if (Tripwire.ENABLED)
+                    Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfInt.forEach(Consumer)");
+                spliterator().forEachRemaining(consumer);
+            }
+        }
+
+        @Override
+        protected int[][] newArrayArray(int size) {
+            return new int[size][];
+        }
+
+        @Override
+        protected int[] newArray(int size) {
+            return new int[size];
+        }
+
+        @Override
+        protected int arrayLength(int[] array) {
+            return array.length;
+        }
+
+        @Override
+        protected void arrayForEach(int[] array,
+                                    int from, int to,
+                                    IntConsumer consumer) {
+            for (int i = from; i < to; i++)
+                consumer.accept(array[i]);
+        }
+
+        @Override
+        public void accept(int i) {
+            preAccept();
+            curChunk[elementIndex++] = i;
+        }
+
+        public int get(long index) {
+            int ch = chunkFor(index);
+            if (spineIndex == 0 && ch == 0)
+                return curChunk[(int) index];
+            else
+                return spine[ch][(int) (index-priorElementCount[ch])];
+        }
+
+        public int[] asIntArray() {
+            return asPrimitiveArray();
+        }
+
+        @Override
+        public PrimitiveIterator.OfInt iterator() {
+            return Spliterators.iteratorFromSpliterator(spliterator());
+        }
+
+        public Spliterator.OfInt spliterator() {
+            class Splitr extends BaseSpliterator<Spliterator.OfInt>
+                    implements Spliterator.OfInt {
+
+                @Override
+                void arrayForOne(int[] array, int index, IntConsumer consumer) {
+                    consumer.accept(array[index]);
+                }
+
+                @Override
+                Spliterator.OfInt arraySpliterator(int[] array, int offset, int len) {
+                    return Arrays.spliterator(array, offset, offset+len);
+                }
+            };
+            return new Splitr();
+        }
+
+        @Override
+        public String toString() {
+            int[] array = asIntArray();
+            if (array.length < 200) {
+                return String.format("%s[length=%d, chunks=%d]%s",
+                                     getClass().getSimpleName(), array.length,
+                                     spineIndex, Arrays.toString(array));
+            }
+            else {
+                int[] array2 = Arrays.copyOf(array, 200);
+                return String.format("%s[length=%d, chunks=%d]%s...",
+                                     getClass().getSimpleName(), array.length,
+                                     spineIndex, Arrays.toString(array2));
+            }
+        }
+    }
+
+    /**
+     * An ordered collection of {@code long} values.
+     */
+    static class OfLong extends SpinedBuffer.OfPrimitive<Long, long[], LongConsumer>
+            implements LongConsumer {
+        OfLong() { }
+
+        OfLong(int initialCapacity) {
+            super(initialCapacity);
+        }
+
+        @Override
+        public void forEach(Consumer<? super Long> consumer) {
+            if (consumer instanceof LongConsumer) {
+                forEach((LongConsumer) consumer);
+            }
+            else {
+                if (Tripwire.ENABLED)
+                    Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfLong.forEach(Consumer)");
+                spliterator().forEachRemaining(consumer);
+            }
+        }
+
+        @Override
+        protected long[][] newArrayArray(int size) {
+            return new long[size][];
+        }
+
+        @Override
+        protected long[] newArray(int size) {
+            return new long[size];
+        }
+
+        @Override
+        protected int arrayLength(long[] array) {
+            return array.length;
+        }
+
+        @Override
+        protected void arrayForEach(long[] array,
+                                    int from, int to,
+                                    LongConsumer consumer) {
+            for (int i = from; i < to; i++)
+                consumer.accept(array[i]);
+        }
+
+        @Override
+        public void accept(long i) {
+            preAccept();
+            curChunk[elementIndex++] = i;
+        }
+
+        public long get(long index) {
+            int ch = chunkFor(index);
+            if (spineIndex == 0 && ch == 0)
+                return curChunk[(int) index];
+            else
+                return spine[ch][(int) (index-priorElementCount[ch])];
+        }
+
+        public long[] asLongArray() {
+            return asPrimitiveArray();
+        }
+
+        @Override
+        public PrimitiveIterator.OfLong iterator() {
+            return Spliterators.iteratorFromSpliterator(spliterator());
+        }
+
+
+        public Spliterator.OfLong spliterator() {
+            class Splitr extends BaseSpliterator<Spliterator.OfLong>
+                    implements Spliterator.OfLong {
+                @Override
+                void arrayForOne(long[] array, int index, LongConsumer consumer) {
+                    consumer.accept(array[index]);
+                }
+
+                @Override
+                Spliterator.OfLong arraySpliterator(long[] array, int offset, int len) {
+                    return Arrays.spliterator(array, offset, offset+len);
+                }
+            };
+            return new Splitr();
+        }
+
+        @Override
+        public String toString() {
+            long[] array = asLongArray();
+            if (array.length < 200) {
+                return String.format("%s[length=%d, chunks=%d]%s",
+                                     getClass().getSimpleName(), array.length,
+                                     spineIndex, Arrays.toString(array));
+            }
+            else {
+                long[] array2 = Arrays.copyOf(array, 200);
+                return String.format("%s[length=%d, chunks=%d]%s...",
+                                     getClass().getSimpleName(), array.length,
+                                     spineIndex, Arrays.toString(array2));
+            }
+        }
+    }
+
+    /**
+     * An ordered collection of {@code double} values.
+     */
+    static class OfDouble
+            extends SpinedBuffer.OfPrimitive<Double, double[], DoubleConsumer>
+            implements DoubleConsumer {
+        OfDouble() { }
+
+        OfDouble(int initialCapacity) {
+            super(initialCapacity);
+        }
+
+        @Override
+        public void forEach(Consumer<? super Double> consumer) {
+            if (consumer instanceof DoubleConsumer) {
+                forEach((DoubleConsumer) consumer);
+            }
+            else {
+                if (Tripwire.ENABLED)
+                    Tripwire.trip(getClass(), "{0} calling SpinedBuffer.OfDouble.forEach(Consumer)");
+                spliterator().forEachRemaining(consumer);
+            }
+        }
+
+        @Override
+        protected double[][] newArrayArray(int size) {
+            return new double[size][];
+        }
+
+        @Override
+        protected double[] newArray(int size) {
+            return new double[size];
+        }
+
+        @Override
+        protected int arrayLength(double[] array) {
+            return array.length;
+        }
+
+        @Override
+        protected void arrayForEach(double[] array,
+                                    int from, int to,
+                                    DoubleConsumer consumer) {
+            for (int i = from; i < to; i++)
+                consumer.accept(array[i]);
+        }
+
+        @Override
+        public void accept(double i) {
+            preAccept();
+            curChunk[elementIndex++] = i;
+        }
+
+        public double get(long index) {
+            int ch = chunkFor(index);
+            if (spineIndex == 0 && ch == 0)
+                return curChunk[(int) index];
+            else
+                return spine[ch][(int) (index-priorElementCount[ch])];
+        }
+
+        public double[] asDoubleArray() {
+            return asPrimitiveArray();
+        }
+
+        @Override
+        public PrimitiveIterator.OfDouble iterator() {
+            return Spliterators.iteratorFromSpliterator(spliterator());
+        }
+
+        public Spliterator.OfDouble spliterator() {
+            class Splitr extends BaseSpliterator<Spliterator.OfDouble>
+                    implements Spliterator.OfDouble {
+                @Override
+                void arrayForOne(double[] array, int index, DoubleConsumer consumer) {
+                    consumer.accept(array[index]);
+                }
+
+                @Override
+                Spliterator.OfDouble arraySpliterator(double[] array, int offset, int len) {
+                    return Arrays.spliterator(array, offset, offset+len);
+                }
+            }
+            return new Splitr();
+        }
+
+        @Override
+        public String toString() {
+            double[] array = asDoubleArray();
+            if (array.length < 200) {
+                return String.format("%s[length=%d, chunks=%d]%s",
+                                     getClass().getSimpleName(), array.length,
+                                     spineIndex, Arrays.toString(array));
+            }
+            else {
+                double[] array2 = Arrays.copyOf(array, 200);
+                return String.format("%s[length=%d, chunks=%d]%s...",
+                                     getClass().getSimpleName(), array.length,
+                                     spineIndex, Arrays.toString(array2));
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Stream.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,893 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.IntFunction;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.function.ToDoubleFunction;
+import java.util.function.ToIntFunction;
+import java.util.function.ToLongFunction;
+import java.util.function.UnaryOperator;
+
+// @@@ Specification to-do list @@@
+// - Describe the difference between sequential and parallel streams
+// - More general information about reduce, better definitions for associativity, more description of
+//   how reduce employs parallelism, more examples
+// - Role of stream flags in various operations, specifically ordering
+//   - Whether each op preserves encounter order
+// @@@ Specification to-do list @@@
+
+/**
+ * A sequence of elements supporting sequential and parallel bulk operations.
+ * Streams support lazy intermediate operations (transforming a stream to
+ * another stream) such as {@code filter} and {@code map}, and terminal
+ * operations (consuming the contents of a stream to produce a result or
+ * side-effect), such as {@code forEach}, {@code findFirst}, and {@code
+ * iterator}.  Once an operation has been performed on a stream, it
+ * is considered <em>consumed</em> and no longer usable for other operations.
+ *
+ * <p>For sequential stream pipelines, all operations are performed in the
+ * <a href="package-summary.html#Ordering">encounter order</a> of the pipeline
+ * source, if the pipeline source has a defined encounter order.
+ *
+ * <p>For parallel stream pipelines, unless otherwise specified, intermediate
+ * stream operations preserve the <a href="package-summary.html#Ordering">
+ * encounter order</a> of their source, and terminal operations
+ * respect the encounter order of their source, if the source
+ * has an encounter order.  Provided that and parameters to stream operations
+ * satisfy the <a href="package-summary.html#NonInterference">non-interference
+ * requirements</a>, and excepting differences arising from the absence of
+ * a defined encounter order, the result of a stream pipeline should be the
+ * stable across multiple executions of the same operations on the same source.
+ * However, the timing and thread in which side-effects occur (for those
+ * operations which are allowed to produce side-effects, such as
+ * {@link #forEach(Consumer)}), are explicitly nondeterministic for parallel
+ * execution of stream pipelines.
+ *
+ * <p>Unless otherwise noted, passing a {@code null} argument to any stream
+ * method may result in a {@link NullPointerException}.
+ *
+ * @apiNote
+ * Streams are not data structures; they do not manage the storage for their
+ * elements, nor do they support access to individual elements.  However,
+ * you can use the {@link #iterator()} or {@link #spliterator()} operations to
+ * perform a controlled traversal.
+ *
+ * @param <T> type of elements
+ * @since 1.8
+ * @see <a href="package-summary.html">java.util.stream</a>
+ */
+public interface Stream<T> extends BaseStream<T, Stream<T>> {
+
+    /**
+     * Returns a stream consisting of the elements of this stream that match
+     * the given predicate.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">
+     *                  non-interfering, stateless</a> predicate to apply to
+     *                  each element to determine if it should be included
+     * @return the new stream
+     */
+    Stream<T> filter(Predicate<? super T> predicate);
+
+    /**
+     * Returns a stream consisting of the results of applying the given
+     * function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param <R> The element type of the new stream
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    <R> Stream<R> map(Function<? super T, ? extends R> mapper);
+
+    /**
+     * Returns an {@code IntStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">
+     *     intermediate operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    IntStream mapToInt(ToIntFunction<? super T> mapper);
+
+    /**
+     * Returns a {@code LongStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    LongStream mapToLong(ToLongFunction<? super T> mapper);
+
+    /**
+     * Returns a {@code DoubleStream} consisting of the results of applying the
+     * given function to the elements of this stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element
+     * @return the new stream
+     */
+    DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper);
+
+    /**
+     * Returns a stream consisting of the results of replacing each element of
+     * this stream with the contents of the stream produced by applying the
+     * provided mapping function to each element.  If the result of the mapping
+     * function is {@code null}, this is treated as if the result is an empty
+     * stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @apiNote
+     * The {@code flatMap()} operation has the effect of applying a one-to-many
+     * tranformation to the elements of the stream, and then flattening the
+     * resulting elements into a new stream. For example, if {@code orders}
+     * is a stream of purchase orders, and each purchase order contains a
+     * collection of line items, then the following produces a stream of line
+     * items:
+     * <pre>{@code
+     *     orderStream.flatMap(order -> order.getLineItems().stream())...
+     * }</pre>
+     *
+     * @param <R> The element type of the new stream
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element which produces a stream of new values
+     * @return the new stream
+     */
+    <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper);
+
+    /**
+     * Returns an {@code IntStream} consisting of the results of replacing each
+     * element of this stream with the contents of the stream produced by
+     * applying the provided mapping function to each element.  If the result of
+     * the mapping function is {@code null}, this is treated as if the result is
+     * an empty stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element which produces a stream of new values
+     * @return the new stream
+     */
+    IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper);
+
+    /**
+     * Returns a {@code LongStream} consisting of the results of replacing each
+     * element of this stream with the contents of the stream produced
+     * by applying the provided mapping function to each element.  If the result
+     * of the mapping function is {@code null}, this is treated as if the
+     * result is an empty stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to
+     *               each element which produces a stream of new values
+     * @return the new stream
+     */
+    LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper);
+
+    /**
+     * Returns a {@code DoubleStream} consisting of the results of replacing each
+     * element of this stream with the contents of the stream produced
+     * by applying the provided mapping function to each element.  If the result
+     * of the mapping function is {@code null}, this is treated as if the result
+     * is an empty stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * @param mapper a <a href="package-summary.html#NonInterference">
+     *               non-interfering, stateless</a> function to apply to each
+     *               element which produces a stream of new values
+     * @return the new stream
+     */
+    DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper);
+
+    /**
+     * Returns a stream consisting of the distinct elements (according to
+     * {@link Object#equals(Object)}) of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @return the new stream
+     */
+    Stream<T> distinct();
+
+    /**
+     * Returns a stream consisting of the elements of this stream, sorted
+     * according to natural order.  If the elements of this stream are not
+     * {@code Comparable}, a {@code java.lang.ClassCastException} may be thrown
+     * when the stream pipeline is executed.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @return the new stream
+     */
+    Stream<T> sorted();
+
+    /**
+     * Returns a stream consisting of the elements of this stream, sorted
+     * according to the provided {@code Comparator}.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @param comparator a <a href="package-summary.html#NonInterference">
+     *                   non-interfering, stateless</a> {@code Comparator} to
+     *                   be used to compare stream elements
+     * @return the new stream
+     */
+    Stream<T> sorted(Comparator<? super T> comparator);
+
+    /**
+     * Returns a stream consisting of the elements of this stream, additionally
+     * performing the provided action on each element as elements are consumed
+     * from the resulting stream.
+     *
+     * <p>This is an <a href="package-summary.html#StreamOps">intermediate
+     * operation</a>.
+     *
+     * <p>For parallel stream pipelines, the action may be called at
+     * whatever time and in whatever thread the element is made available by the
+     * upstream operation.  If the action modifies shared state,
+     * it is responsible for providing the required synchronization.
+     *
+     * @apiNote This method exists mainly to support debugging, where you want
+     * to see the elements as they flow past a certain point in a pipeline:
+     * <pre>{@code
+     *     list.stream()
+     *         .filter(filteringFunction)
+     *         .peek(e -> {System.out.println("Filtered value: " + e); });
+     *         .map(mappingFunction)
+     *         .peek(e -> {System.out.println("Mapped value: " + e); });
+     *         .collect(Collectors.intoList());
+     * }</pre>
+     *
+     * @param consumer a <a href="package-summary.html#NonInterference">
+     *                 non-interfering</a> action to perform on the elements as
+     *                 they are consumed from the stream
+     * @return the new stream
+     */
+    Stream<T> peek(Consumer<? super T> consumer);
+
+    /**
+     * Returns a stream consisting of the elements of this stream, truncated
+     * to be no longer than {@code maxSize} in length.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @param maxSize the number of elements the stream should be limited to
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code maxSize} is negative
+     */
+    Stream<T> limit(long maxSize);
+
+    /**
+     * Returns a stream consisting of the remaining elements of this stream
+     * after indexing {@code startInclusive} elements into the stream. If the
+     * {@code startInclusive} index lies past the end of this stream then an
+     * empty stream will be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">stateful
+     * intermediate operation</a>.
+     *
+     * @param startInclusive the number of leading elements to skip
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code startInclusive} is negative
+     */
+    Stream<T> substream(long startInclusive);
+
+    /**
+     * Returns a stream consisting of the remaining elements of this stream
+     * after indexing {@code startInclusive} elements into the stream and
+     * truncated to contain no more than {@code endExclusive - startInclusive}
+     * elements. If the {@code startInclusive} index lies past the end
+     * of this stream then an empty stream will be returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * stateful intermediate operation</a>.
+     *
+     * @param startInclusive the starting position of the substream, inclusive
+     * @param endExclusive the ending position of the substream, exclusive
+     * @return the new stream
+     * @throws IllegalArgumentException if {@code startInclusive} or
+     * {@code endExclusive} is negative or {@code startInclusive} is greater
+     * than {@code endExclusive}
+     */
+    Stream<T> substream(long startInclusive, long endExclusive);
+
+    /**
+     * Performs an action for each element of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * <p>For parallel stream pipelines, this operation does <em>not</em>
+     * guarantee to respect the encounter order of the stream, as doing so
+     * would sacrifice the benefit of parallelism.  For any given element, the
+     * action may be performed at whatever time and in whatever thread the
+     * library chooses.  If the action accesses shared state, it is
+     * responsible for providing the required synchronization.
+     *
+     * @param action a <a href="package-summary.html#NonInterference">
+     *               non-interfering</a> action to perform on the elements
+     */
+    void forEach(Consumer<? super T> action);
+
+    /**
+     * Performs an action for each element of this stream, guaranteeing that
+     * each element is processed in encounter order for streams that have a
+     * defined encounter order.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param action a <a href="package-summary.html#NonInterference">
+     *               non-interfering</a> action to perform on the elements
+     * @see #forEach(Consumer)
+     */
+    void forEachOrdered(Consumer<? super T> action);
+
+    /**
+     * Returns an array containing the elements of this stream.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @return an array containing the elements of this stream
+     */
+    Object[] toArray();
+
+    /**
+     * Returns an array containing the elements of this stream, using the
+     * provided {@code generator} function to allocate the returned array.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param <A> the element type of the resulting array
+     * @param generator a function which produces a new array of the desired
+     *                  type and the provided length
+     * @return an array containing the elements in this stream
+     * @throws ArrayStoreException if the runtime type of the array returned
+     * from the array generator is not a supertype of the runtime type of every
+     * element in this stream
+     */
+    <A> A[] toArray(IntFunction<A[]> generator);
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using the provided identity value and an
+     * <a href="package-summary.html#Associativity">associative</a>
+     * accumulation function, and returns the reduced value.  This is equivalent
+     * to:
+     * <pre>{@code
+     *     T result = identity;
+     *     for (T element : this stream)
+     *         result = accumulator.apply(result, element)
+     *     return result;
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code identity} value must be an identity for the accumulator
+     * function. This means that for all {@code t},
+     * {@code accumulator.apply(identity, t)} is equal to {@code t}.
+     * The {@code accumulator} function must be an
+     * <a href="package-summary.html#Associativity">associative</a> function.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @apiNote Sum, min, max, average, and string concatenation are all special
+     * cases of reduction. Summing a stream of numbers can be expressed as:
+     *
+     * <pre>{@code
+     *     Integer sum = integers.reduce(0, (a, b) -> a+b);
+     * }</pre>
+     *
+     * or more compactly:
+     *
+     * <pre>{@code
+     *     Integer sum = integers.reduce(0, Integer::sum);
+     * }</pre>
+     *
+     * <p>While this may seem a more roundabout way to perform an aggregation
+     * compared to simply mutating a running total in a loop, reduction
+     * operations parallelize more gracefully, without needing additional
+     * synchronization and with greatly reduced risk of data races.
+     *
+     * @param identity the identity value for the accumulating function
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for combining two values
+     * @return the result of the reduction
+     */
+    T reduce(T identity, BinaryOperator<T> accumulator);
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using an
+     * <a href="package-summary.html#Associativity">associative</a> accumulation
+     * function, and returns an {@code Optional} describing the reduced value,
+     * if any. This is equivalent to:
+     * <pre>{@code
+     *     boolean foundAny = false;
+     *     T result = null;
+     *     for (T element : this stream) {
+     *         if (!foundAny) {
+     *             foundAny = true;
+     *             result = element;
+     *         }
+     *         else
+     *             result = accumulator.apply(result, element);
+     *     }
+     *     return foundAny ? Optional.of(result) : Optional.empty();
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code accumulator} function must be an
+     * <a href="package-summary.html#Associativity">associative</a> function.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for combining two values
+     * @return the result of the reduction
+     * @see #reduce(Object, BinaryOperator)
+     * @see #min(java.util.Comparator)
+     * @see #max(java.util.Comparator)
+     */
+    Optional<T> reduce(BinaryOperator<T> accumulator);
+
+    /**
+     * Performs a <a href="package-summary.html#Reduction">reduction</a> on the
+     * elements of this stream, using the provided identity, accumulation
+     * function, and a combining functions.  This is equivalent to:
+     * <pre>{@code
+     *     U result = identity;
+     *     for (T element : this stream)
+     *         result = accumulator.apply(result, element)
+     *     return result;
+     * }</pre>
+     *
+     * but is not constrained to execute sequentially.
+     *
+     * <p>The {@code identity} value must be an identity for the combiner
+     * function.  This means that for all {@code u}, {@code combiner(identity, u)}
+     * is equal to {@code u}.  Additionally, the {@code combiner} function
+     * must be compatible with the {@code accumulator} function; for all
+     * {@code u} and {@code t}, the following must hold:
+     * <pre>{@code
+     *     combiner.apply(u, accumulator.apply(identity, t)) == accumulator.apply(u, t)
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @apiNote Many reductions using this form can be represented more simply
+     * by an explicit combination of {@code map} and {@code reduce} operations.
+     * The {@code accumulator} function acts as a fused mapper and accumulator,
+     * which can sometimes be more efficient than separate mapping and reduction,
+     * such as in the case where knowing the previously reduced value allows you
+     * to avoid some computation.
+     *
+     * @param <U> The type of the result
+     * @param identity the identity value for the combiner function
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for incorporating an additional
+     *                    element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+     *                 <a href="package-summary.html#NonInterference">non-interfering,
+     *                 stateless</a> function for combining two values, which
+     *                 must be compatible with the accumulator function
+     * @return the result of the reduction
+     * @see #reduce(BinaryOperator)
+     * @see #reduce(Object, BinaryOperator)
+     */
+    <U> U reduce(U identity,
+                 BiFunction<U, ? super T, U> accumulator,
+                 BinaryOperator<U> combiner);
+
+    /**
+     * Performs a <a href="package-summary.html#MutableReduction">mutable
+     * reduction</a> operation on the elements of this stream.  A mutable
+     * reduction is one in which the reduced value is a mutable value holder,
+     * such as an {@code ArrayList}, and elements are incorporated by updating
+     * the state of the result, rather than by replacing the result.  This
+     * produces a result equivalent to:
+     * <pre>{@code
+     *     R result = resultFactory.get();
+     *     for (T element : this stream)
+     *         accumulator.accept(result, element);
+     *     return result;
+     * }</pre>
+     *
+     * <p>Like {@link #reduce(Object, BinaryOperator)}, {@code collect} operations
+     * can be parallelized without requiring additional synchronization.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @apiNote There are many existing classes in the JDK whose signatures are
+     * a good match for use as arguments to {@code collect()}.  For example,
+     * the following will accumulate strings into an ArrayList:
+     * <pre>{@code
+     *     List<String> asList = stringStream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll);
+     * }</pre>
+     *
+     * <p>The following will take a stream of strings and concatenates them into a
+     * single string:
+     * <pre>{@code
+     *     String concat = stringStream.collect(StringBuilder::new, StringBuilder::append,
+     *                                          StringBuilder::append)
+     *                                 .toString();
+     * }</pre>
+     *
+     * @param <R> type of the result
+     * @param resultFactory a function that creates a new result container.
+     *                      For a parallel execution, this function may be
+     *                      called multiple times and must return a fresh value
+     *                      each time.
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
+     *                    <a href="package-summary.html#NonInterference">non-interfering,
+     *                    stateless</a> function for incorporating an additional
+     *                    element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
+     *                 <a href="package-summary.html#NonInterference">non-interfering,
+     *                 stateless</a> function for combining two values, which
+     *                 must be compatible with the accumulator function
+     * @return the result of the reduction
+     */
+    <R> R collect(Supplier<R> resultFactory,
+                  BiConsumer<R, ? super T> accumulator,
+                  BiConsumer<R, R> combiner);
+
+    /**
+     * Performs a <a href="package-summary.html#MutableReduction">mutable
+     * reduction</a> operation on the elements of this stream using a
+     * {@code Collector} object to describe the reduction.  A {@code Collector}
+     * encapsulates the functions used as arguments to
+     * {@link #collect(Supplier, BiConsumer, BiConsumer)}, allowing for reuse of
+     * collection strategies, and composition of collect operations such as
+     * multiple-level grouping or partitioning.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * <p>When executed in parallel, multiple intermediate results may be
+     * instantiated, populated, and merged, so as to maintain isolation of
+     * mutable data structures.  Therefore, even when executed in parallel
+     * with non-thread-safe data structures (such as {@code ArrayList}), no
+     * additional synchronization is needed for a parallel reduction.
+     *
+     * @apiNote
+     * The following will accumulate strings into an ArrayList:
+     * <pre>{@code
+     *     List<String> asList = stringStream.collect(Collectors.toList());
+     * }</pre>
+     *
+     * <p>The following will classify {@code Person} objects by city:
+     * <pre>{@code
+     *     Map<String, Collection<Person>> peopleByCity
+     *         = personStream.collect(Collectors.groupBy(Person::getCity));
+     * }</pre>
+     *
+     * <p>The following will classify {@code Person} objects by state and city,
+     * cascading two {@code Collector}s together:
+     * <pre>{@code
+     *     Map<String, Map<String, Collection<Person>>> peopleByStateAndCity
+     *         = personStream.collect(Collectors.groupBy(Person::getState,
+     *                                                   Collectors.groupBy(Person::getCity)));
+     * }</pre>
+     *
+     * @param <R> the type of the result
+     * @param collector the {@code Collector} describing the reduction
+     * @return the result of the reduction
+     * @see #collect(Supplier, BiConsumer, BiConsumer)
+     * @see Collectors
+     */
+    <R> R collect(Collector<? super T, R> collector);
+
+    /**
+     * Returns the minimum element of this stream according to the provided
+     * {@code Comparator}.  This is a special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a>.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+     *
+     * @param comparator a <a href="package-summary.html#NonInterference">non-interfering,
+     *                   stateless</a> {@code Comparator} to use to compare
+     *                   elements of this stream
+     * @return an {@code Optional} describing the minimum element of this stream,
+     * or an empty {@code Optional} if the stream is empty
+     */
+    Optional<T> min(Comparator<? super T> comparator);
+
+    /**
+     * Returns the maximum element of this stream according to the provided
+     * {@code Comparator}.  This is a special case of a
+     * <a href="package-summary.html#MutableReduction">reduction</a>.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal
+     * operation</a>.
+     *
+     * @param comparator a <a href="package-summary.html#NonInterference">non-interfering,
+     *                   stateless</a> {@code Comparator} to use to compare
+     *                   elements of this stream
+     * @return an {@code Optional} describing the maximum element of this stream,
+     * or an empty {@code Optional} if the stream is empty
+     */
+    Optional<T> max(Comparator<? super T> comparator);
+
+    /**
+     * Returns the count of elements in this stream.  This is a special case of
+     * a <a href="package-summary.html#MutableReduction">reduction</a> and is
+     * equivalent to:
+     * <pre>{@code
+     *     return mapToLong(e -> 1L).sum();
+     * }</pre>
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
+     *
+     * @return the count of elements in this stream
+     */
+    long count();
+
+    /**
+     * Returns whether any elements of this stream match the provided
+     * predicate.  May not evaluate the predicate on all elements if not
+     * necessary for determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if any elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean anyMatch(Predicate<? super T> predicate);
+
+    /**
+     * Returns whether all elements of this stream match the provided predicate.
+     * May not evaluate the predicate on all elements if not necessary for
+     * determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if all elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean allMatch(Predicate<? super T> predicate);
+
+    /**
+     * Returns whether no elements of this stream match the provided predicate.
+     * May not evaluate the predicate on all elements if not necessary for
+     * determining the result.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
+     *                  stateless</a> predicate to apply to elements of this
+     *                  stream
+     * @return {@code true} if no elements of the stream match the provided
+     * predicate otherwise {@code false}
+     */
+    boolean noneMatch(Predicate<? super T> predicate);
+
+    /**
+     * Returns an {@link Optional} describing the first element of this stream
+     * (in the encounter order), or an empty {@code Optional} if the stream is
+     * empty.  If the stream has no encounter order, than any element may be
+     * returned.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * @return an {@code Optional} describing the first element of this stream,
+     * or an empty {@code Optional} if the stream is empty
+     * @throws NullPointerException if the element selected is null
+     */
+    Optional<T> findFirst();
+
+    /**
+     * Returns an {@link Optional} describing some element of the stream, or an
+     * empty {@code Optional} if the stream is empty.
+     *
+     * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
+     * terminal operation</a>.
+     *
+     * <p>The behavior of this operation is explicitly nondeterministic; it is
+     * free to select any element in the stream.  This is to allow for maximal
+     * performance in parallel operations; the cost is that multiple invocations
+     * on the same source may not return the same result.  (If the first element
+     * in the encounter order is desired, use {@link #findFirst()} instead.)
+     *
+     * @return an {@code Optional} describing some element of this stream, or an
+     * empty {@code Optional} if the stream is empty
+     * @throws NullPointerException if the element selected is null
+     * @see #findFirst()
+     */
+    Optional<T> findAny();
+
+    // Static factories
+
+    /**
+     * Returns a builder for a {@code Stream}.
+     *
+     * @param <T> type of elements
+     * @return a stream builder
+     */
+    public static<T> StreamBuilder<T> builder() {
+        return new Streams.StreamBuilderImpl<>();
+    }
+
+    /**
+     * Returns an empty sequential {@code Stream}.
+     *
+     * @param <T> the type of stream elements
+     * @return an empty sequential stream
+     */
+    public static<T> Stream<T> empty() {
+        return StreamSupport.stream(Spliterators.<T>emptySpliterator());
+    }
+
+    /**
+     * Returns a sequential {@code Stream} containing a single element.
+     *
+     * @param t the single element
+     * @param <T> the type of stream elements
+     * @return a singleton sequential stream
+     */
+    public static<T> Stream<T> of(T t) {
+        return StreamSupport.stream(new Streams.StreamBuilderImpl<>(t));
+    }
+
+    /**
+     * Returns a sequential stream whose elements are the specified values.
+     *
+     * @param <T> the type of stream elements
+     * @param values the elements of the new stream
+     * @return the new stream
+     */
+    @SafeVarargs
+    public static<T> Stream<T> of(T... values) {
+        return Arrays.stream(values);
+    }
+
+    /**
+     * Returns an infinite sequential {@code Stream} produced by iterative
+     * application of a function {@code f} to an initial element {@code seed},
+     * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)},
+     * {@code f(f(seed))}, etc.
+     *
+     * <p>The first element (position {@code 0}) in the {@code Stream} will be
+     * the provided {@code seed}.  For {@code n > 0}, the element at position
+     * {@code n}, will be the result of applying the function {@code f} to the
+     * element at position {@code n - 1}.
+     *
+     * @param <T> the type of stream elements
+     * @param seed the initial element
+     * @param f a function to be applied to to the previous element to produce
+     *          a new element
+     * @return a new sequential {@code Stream}
+     */
+    public static<T> Stream<T> iterate(final T seed, final UnaryOperator<T> f) {
+        Objects.requireNonNull(f);
+        final Iterator<T> iterator = new Iterator<T>() {
+            @SuppressWarnings("unchecked")
+            T t = (T) Streams.NONE;
+
+            @Override
+            public boolean hasNext() {
+                return true;
+            }
+
+            @Override
+            public T next() {
+                return t = (t == Streams.NONE) ? seed : f.apply(t);
+            }
+        };
+        return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
+                iterator,
+                Spliterator.ORDERED | Spliterator.IMMUTABLE));
+    }
+
+    /**
+     * Returns a sequential {@code Stream} where each element is
+     * generated by a {@code Supplier}.  This is suitable for generating
+     * constant streams, streams of random elements, etc.
+     *
+     * @param <T> the type of stream elements
+     * @param s the {@code Supplier} of generated elements
+     * @return a new sequential {@code Stream}
+     */
+    public static<T> Stream<T> generate(Supplier<T> s) {
+        Objects.requireNonNull(s);
+        return StreamSupport.stream(Spliterators.spliteratorUnknownSize(
+                new Iterator<T>() {
+                    @Override
+                    public boolean hasNext() { return true; }
+
+                    @Override
+                    public T next() { return s.get(); }
+                },
+                Spliterator.ORDERED | Spliterator.IMMUTABLE));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamBuilder.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+
+/**
+ * A mutable builder for a {@code Stream}.  This allows the creation of a
+ * {@code Stream} by generating elements individually and adding them to the
+ * {@code StreamBuilder} (without the copying overhead that comes from using
+ * an {@code ArrayList} as a temporary buffer.)
+ *
+ * <p>A {@code StreamBuilder} has a lifecycle, where it starts in a building
+ * phase, during which elements can be added, and then transitions to a built
+ * phase, after which elements may not be added.  The built phase begins
+ * when the {@link #build()}} method is called, which creates an ordered
+ * {@code Stream} whose elements are the elements that were added to the stream
+ * builder, in the order they were added.
+ *
+ * <p>Primitive specializations of {@code StreamBuilder} are provided
+ * for {@link OfInt int}, {@link OfLong long}, and {@link OfDouble double}
+ * values.
+ *
+ * @param <T> the type of stream elements
+ * @see Stream#builder()
+ * @since 1.8
+ */
+public interface StreamBuilder<T> extends Consumer<T> {
+
+    /**
+     * Adds an element to the stream being built.
+     *
+     * @throws IllegalStateException if the builder has already transitioned to
+     * the built state
+     */
+    @Override
+    void accept(T t);
+
+    /**
+     * Adds an element to the stream being built.
+     *
+     * @implSpec
+     * The default implementation behaves as if:
+     * <pre>{@code
+     *     accept(t)
+     *     return this;
+     * }</pre>
+     *
+     * @param t the element to add
+     * @return {@code this} builder
+     * @throws IllegalStateException if the builder has already transitioned to
+     * the built state
+     */
+    default StreamBuilder<T> add(T t) {
+        accept(t);
+        return this;
+    }
+
+    /**
+     * Builds the stream, transitioning this builder to the built state.
+     * An {@code IllegalStateException} is thrown if there are further attempts
+     * to operate on the builder after it has entered the built state.
+     *
+     * @return the built stream
+     * @throws IllegalStateException if the builder has already transitioned to
+     * the built state
+     */
+    Stream<T> build();
+
+    /**
+     * A mutable builder for an {@code IntStream}.
+     *
+     * <p>A stream builder has a lifecycle, where it starts in a building
+     * phase, during which elements can be added, and then transitions to a
+     * built phase, after which elements may not be added.  The built phase
+     * begins when the {@link #build()}} method is called, which creates an
+     * ordered stream whose elements are the elements that were added to the
+     * stream builder, in the order they were added.
+     *
+     * @see IntStream#builder()
+     * @since 1.8
+     */
+    interface OfInt extends IntConsumer {
+
+        /**
+         * Adds an element to the stream being built.
+         *
+         * @throws IllegalStateException if the builder has already transitioned
+         * to the built state
+         */
+        @Override
+        void accept(int t);
+
+        /**
+         * Adds an element to the stream being built.
+         *
+         * @implSpec
+         * The default implementation behaves as if:
+         * <pre>{@code
+         *     accept(t)
+         *     return this;
+         * }</pre>
+         *
+         * @param t the element to add
+         * @return {@code this} builder
+         * @throws IllegalStateException if the builder has already transitioned
+         * to the built state
+         */
+        default StreamBuilder.OfInt add(int t) {
+            accept(t);
+            return this;
+        }
+
+        /**
+         * Builds the stream, transitioning this builder to the built state.
+         * An {@code IllegalStateException} is thrown if there are further
+         * attempts to operate on the builder after it has entered the built
+         * state.
+         *
+         * @return the built stream
+         * @throws IllegalStateException if the builder has already transitioned to
+         * the built state
+         */
+        IntStream build();
+    }
+
+    /**
+     * A mutable builder for a {@code LongStream}.
+     *
+     * <p>A stream builder has a lifecycle, where it starts in a building
+     * phase, during which elements can be added, and then transitions to a
+     * built phase, after which elements may not be added.  The built phase
+     * begins when the {@link #build()}} method is called, which creates an
+     * ordered stream whose elements are the elements that were added to the
+     * stream builder, in the order they were added.
+     *
+     * @see LongStream#builder()
+     * @since 1.8
+     */
+    interface OfLong extends LongConsumer {
+
+        /**
+         * Adds an element to the stream being built.
+         *
+         * @throws IllegalStateException if the builder has already transitioned
+         * to the built state
+         */
+        @Override
+        void accept(long t);
+
+        /**
+         * Adds an element to the stream being built.
+         *
+         * @implSpec
+         * The default implementation behaves as if:
+         * <pre>{@code
+         *     accept(t)
+         *     return this;
+         * }</pre>
+         *
+         * @param t the element to add
+         * @return {@code this} builder
+         * @throws IllegalStateException if the builder has already transitioned
+         * to the built state
+         */
+        default StreamBuilder.OfLong add(long t) {
+            accept(t);
+            return this;
+        }
+
+        /**
+         * Builds the stream, transitioning this builder to the built state.
+         * An {@code IllegalStateException} is thrown if there are further
+         * attempts to operate on the builder after it has entered the built
+         * state.
+         *
+         * @return the built stream
+         * @throws IllegalStateException if the builder has already transitioned
+         * to the built state
+         */
+        LongStream build();
+    }
+
+    /**
+     * A mutable builder for a {@code DoubleStream}.
+     *
+     * @see LongStream#builder()
+     * @since 1.8
+     */
+    interface OfDouble extends DoubleConsumer {
+
+        /**
+         * Adds an element to the stream being built.
+         *
+         * <p>A stream builder  has a lifecycle, where it starts in a building
+         * phase, during which elements can be added, and then transitions to a
+         * built phase, after which elements may not be added.  The built phase
+         * begins when the {@link #build()}} method is called, which creates an
+         * ordered stream whose elements are the elements that were added to the
+         * stream builder, in the order they were added.
+         *
+         * @throws IllegalStateException if the builder has already transitioned
+         * to the built state
+         */
+        @Override
+        void accept(double t);
+
+        /**
+         * Adds an element to the stream being built.
+         *
+         * @implSpec
+         * The default implementation behaves as if:
+         * <pre>{@code
+         *     accept(t)
+         *     return this;
+         * }</pre>
+         *
+         * @param t the element to add
+         * @return {@code this} builder
+         * @throws IllegalStateException if the builder has already transitioned
+         * to the built state
+         */
+        default StreamBuilder.OfDouble add(double t) {
+            accept(t);
+            return this;
+        }
+
+        /**
+         * Builds the stream, transitioning this builder to the built state.
+         * An {@code IllegalStateException} is thrown if there are further
+         * attempts to operate on the builder after it has entered the built
+         * state.
+         *
+         * @return the built stream
+         * @throws IllegalStateException if the builder has already transitioned
+         * to the built state
+         */
+        DoubleStream build();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamOpFlag.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,753 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Spliterator;
+
+/**
+ * Flags corresponding to characteristics of streams and operations. Flags are
+ * utilized by the stream framework to control, specialize or optimize
+ * computation.
+ *
+ * <p>
+ * Stream flags may be used to describe characteristics of several different
+ * entities associated with streams: stream sources, intermediate operations,
+ * and terminal operations.  Not all stream flags are meaningful for all
+ * entities; the following table summarizes which flags are meaningful in what
+ * contexts:
+ *
+ * <div>
+ * <table>
+ *   <caption>Type Characteristics</caption>
+ *   <thead class="tableSubHeadingColor">
+ *     <tr>
+ *       <th colspan="2">&nbsp;</th>
+ *       <th>{@code DISTINCT}</th>
+ *       <th>{@code SORTED}</th>
+ *       <th>{@code ORDERED}</th>
+ *       <th>{@code SIZED}</th>
+ *       <th>{@code SHORT_CIRCUIT}</th>
+ *     </tr>
+ *   </thead>
+ *   <tbody>
+ *      <tr>
+ *        <th colspan="2" class="tableSubHeadingColor">Stream source</th>
+ *        <td>Y</td>
+ *        <td>Y</td>
+ *        <td>Y</td>
+ *        <td>Y</td>
+ *        <td>N</td>
+ *      </tr>
+ *      <tr>
+ *        <th colspan="2" class="tableSubHeadingColor">Intermediate operation</th>
+ *        <td>PCI</td>
+ *        <td>PCI</td>
+ *        <td>PCI</td>
+ *        <td>PC</td>
+ *        <td>PI</td>
+ *      </tr>
+ *      <tr>
+ *        <th colspan="2" class="tableSubHeadingColor">Terminal operation</th>
+ *        <td>N</td>
+ *        <td>N</td>
+ *        <td>PC</td>
+ *        <td>N</td>
+ *        <td>PI</td>
+ *      </tr>
+ *   </tbody>
+ *   <tfoot>
+ *       <tr>
+ *         <th class="tableSubHeadingColor" colspan="2">Legend</th>
+ *         <th colspan="6" rowspan="7">&nbsp;</th>
+ *       </tr>
+ *       <tr>
+ *         <th class="tableSubHeadingColor">Flag</th>
+ *         <th class="tableSubHeadingColor">Meaning</th>
+ *         <th colspan="6"></th>
+ *       </tr>
+ *       <tr><td>Y</td><td>Allowed</td></tr>
+ *       <tr><td>N</td><td>Invalid</td></tr>
+ *       <tr><td>P</td><td>Preserves</td></tr>
+ *       <tr><td>C</td><td>Clears</td></tr>
+ *       <tr><td>I</td><td>Injects</td></tr>
+ *   </tfoot>
+ * </table>
+ * </div>
+ *
+ * <p>In the above table, "PCI" means "may preserve, clear, or inject"; "PC"
+ * means "may preserve or clear", "PI" means "may preserve or inject", and "N"
+ * means "not valid".
+ *
+ * <p>Stream flags are represented by unioned bit sets, so that a single word
+ * may describe all the characteristics of a given stream entity, and that, for
+ * example, the flags for a stream source can be efficiently combined with the
+ * flags for later operations on that stream.
+ *
+ * <p>The bit masks {@link #STREAM_MASK}, {@link #OP_MASK}, and
+ * {@link #TERMINAL_OP_MASK} can be ANDed with a bit set of stream flags to
+ * produce a mask containing only the valid flags for that entity type.
+ *
+ * <p>When describing a stream source, one only need describe what
+ * characteristics that stream has; when describing a stream operation, one need
+ * describe whether the operation preserves, injects, or clears that
+ * characteristic.  Accordingly, two bits are used for each flag, so as to allow
+ * representing not only the presence of of a characteristic, but how an
+ * operation modifies that characteristic.  There are two common forms in which
+ * flag bits are combined into an {@code int} bit set.  <em>Stream flags</em>
+ * are a unioned bit set constructed by ORing the enum characteristic values of
+ * {@link #set()} (or, more commonly, ORing the corresponding static named
+ * constants prefixed with {@code IS_}).  <em>Operation flags</em> are a unioned
+ * bit set constructed by ORing the enum characteristic values of {@link #set()}
+ * or {@link #clear()} (to inject, or clear, respectively, the corresponding
+ * flag), or more commonly ORing the corresponding named constants prefixed with
+ * {@code IS_} or {@code NOT_}.  Flags that are not marked with {@code IS_} or
+ * {@code NOT_} are implicitly treated as preserved.  Care must be taken when
+ * combining bitsets that the correct combining operations are applied in the
+ * correct order.
+ *
+ * <p>
+ * With the exception of {@link #SHORT_CIRCUIT}, stream characteristics can be
+ * derived from the equivalent {@link java.util.Spliterator} characteristics:
+ * {@link java.util.Spliterator#DISTINCT}, {@link java.util.Spliterator#SORTED},
+ * {@link java.util.Spliterator#ORDERED}, and
+ * {@link java.util.Spliterator#SIZED}.  A spliterator characteristics bit set
+ * can be converted to stream flags using the method
+ * {@link #fromCharacteristics(java.util.Spliterator)} and converted back using
+ * {@link #toCharacteristics(int)}.  (The bit set
+ * {@link #SPLITERATOR_CHARACTERISTICS_MASK} is used to AND with a bit set to
+ * produce a valid spliterator characteristics bit set that can be converted to
+ * stream flags.)
+ *
+ * <p>
+ * The source of a stream encapsulates a spliterator. The characteristics of
+ * that source spliterator when transformed to stream flags will be a proper
+ * subset of stream flags of that stream.
+ * For example:
+ * <pre> {@code
+ *     Spliterator s = ...;
+ *     Stream stream = Streams.stream(s);
+ *     flagsFromSplitr = fromCharacteristics(s.characteristics());
+ *     assert(flagsFromSplitr & stream.getStreamFlags() == flagsFromSplitr);
+ * }</pre>
+ *
+ * <p>
+ * An intermediate operation, performed on an input stream to create a new
+ * output stream, may preserve, clear or inject stream or operation
+ * characteristics.  Similarly, a terminal operation, performed on an input
+ * stream to produce an output result may preserve, clear or inject stream or
+ * operation characteristics.  Preservation means that if that characteristic
+ * is present on the input, then it is also present on the output.  Clearing
+ * means that the characteristic is not present on the output regardless of the
+ * input.  Injection means that the characteristic is present on the output
+ * regardless of the input.  If a characteristic is not cleared or injected then
+ * it is implicitly preserved.
+ *
+ * <p>
+ * A pipeline consists of a stream source encapsulating a spliterator, one or
+ * more intermediate operations, and finally a terminal operation that produces
+ * a result.  At each stage of the pipeline, a combined stream and operation
+ * flags can be calculated, using {@link #combineOpFlags(int, int)}.  Such flags
+ * ensure that preservation, clearing and injecting information is retained at
+ * each stage.
+ *
+ * The combined stream and operation flags for the source stage of the pipeline
+ * is calculated as follows:
+ * <pre> {@code
+ *     int flagsForSourceStage = combineOpFlags(sourceFlags, INITIAL_OPS_VALUE);
+ * }</pre>
+ *
+ * The combined stream and operation flags of each subsequent intermediate
+ * operation stage in the pipeline is calculated as follows:
+ * <pre> {@code
+ *     int flagsForThisStage = combineOpFlags(flagsForPreviousStage, thisOpFlags);
+ * }</pre>
+ *
+ * Finally the flags output from the last intermediate operation of the pipeline
+ * are combined with the operation flags of the terminal operation to produce
+ * the flags output from the pipeline.
+ *
+ * <p>Those flags can then be used to apply optimizations. For example, if
+ * {@code SIZED.isKnown(flags)} returns true then the stream size remains
+ * constant throughout the pipeline, this information can be utilized to
+ * pre-allocate data structures and combined with
+ * {@link java.util.Spliterator#SUBSIZED} that information can be utilized to
+ * perform concurrent in-place updates into a shared array.
+ *
+ * For specific details see the {@link AbstractPipeline} constructors.
+ *
+ * @since 1.8
+ */
+enum StreamOpFlag {
+
+    /*
+     * Each characteristic takes up 2 bits in a bit set to accommodate
+     * preserving, clearing and setting/injecting information.
+     *
+     * This applies to stream flags, intermediate/terminal operation flags, and
+     * combined stream and operation flags. Even though the former only requires
+     * 1 bit of information per characteristic, is it more efficient when
+     * combining flags to align set and inject bits.
+     *
+     * Characteristics belong to certain types, see the Type enum. Bit masks for
+     * the types are constructed as per the following table:
+     *
+     *                        DISTINCT  SORTED  ORDERED  SIZED  SHORT_CIRCUIT
+     *          SPLITERATOR      01       01       01      01        00
+     *               STREAM      01       01       01      01        00
+     *                   OP      11       11       11      10        01
+     *          TERMINAL_OP      00       00       10      00        01
+     * UPSTREAM_TERMINAL_OP      00       00       10      00        00
+     *
+     * 01 = set/inject
+     * 10 = clear
+     * 11 = preserve
+     *
+     * Construction of the columns is performed using a simple builder for
+     * non-zero values.
+     */
+
+
+    // The following flags correspond to characteristics on Spliterator
+    // and the values MUST be equal.
+    //
+
+    /**
+     * Characteristic value signifying that, for each pair of
+     * encountered elements in a stream {@code x, y}, {@code !x.equals(y)}.
+     * <p>
+     * A stream may have this value or an intermediate operation can preserve,
+     * clear or inject this value.
+     */
+    // 0, 0x00000001
+    // Matches Spliterator.DISTINCT
+    DISTINCT(0,
+             set(Type.SPLITERATOR).set(Type.STREAM).setAndClear(Type.OP)),
+
+    /**
+     * Characteristic value signifying that encounter order follows a natural
+     * sort order of comparable elements.
+     * <p>
+     * A stream can have this value or an intermediate operation can preserve,
+     * clear or inject this value.
+     * <p>
+     * Note: The {@link java.util.Spliterator#SORTED} characteristic can define
+     * a sort order with an associated non-null comparator.  Augmenting flag
+     * state with addition properties such that those properties can be passed
+     * to operations requires some disruptive changes for a singular use-case.
+     * Furthermore, comparing comparators for equality beyond that of identity
+     * is likely to be unreliable.  Therefore the {@code SORTED} characteristic
+     * for a defined non-natural sort order is not mapped internally to the
+     * {@code SORTED} flag.
+     */
+    // 1, 0x00000004
+    // Matches Spliterator.SORTED
+    SORTED(1,
+           set(Type.SPLITERATOR).set(Type.STREAM).setAndClear(Type.OP)),
+
+    /**
+     * Characteristic value signifying that an encounter order is
+     * defined for stream elements.
+     * <p>
+     * A stream can have this value, an intermediate operation can preserve,
+     * clear or inject this value, or a terminal operation can preserve or clear
+     * this value.
+     */
+    // 2, 0x00000010
+    // Matches Spliterator.ORDERED
+    ORDERED(2,
+            set(Type.SPLITERATOR).set(Type.STREAM).setAndClear(Type.OP).clear(Type.TERMINAL_OP)
+                    .clear(Type.UPSTREAM_TERMINAL_OP)),
+
+    /**
+     * Characteristic value signifying that size of the stream
+     * is of a known finite size that is equal to the known finite
+     * size of the source spliterator input to the first stream
+     * in the pipeline.
+     * <p>
+     * A stream can have this value or an intermediate operation can preserve or
+     * clear this value.
+     */
+    // 3, 0x00000040
+    // Matches Spliterator.SIZED
+    SIZED(3,
+          set(Type.SPLITERATOR).set(Type.STREAM).clear(Type.OP)),
+
+    // The following Spliterator characteristics are not currently used but a
+    // gap in the bit set is deliberately retained to enable corresponding
+    // stream flags if//when required without modification to other flag values.
+    //
+    // 4, 0x00000100 NONNULL(4, ...
+    // 5, 0x00000400 IMMUTABLE(5, ...
+    // 6, 0x00001000 CONCURRENT(6, ...
+    // 7, 0x00004000 SUBSIZED(7, ...
+
+    // The following 4 flags are currently undefined and a free for any further
+    // spliterator characteristics.
+    //
+    //  8, 0x00010000
+    //  9, 0x00040000
+    // 10, 0x00100000
+    // 11, 0x00400000
+
+    // The following flags are specific to streams and operations
+    //
+
+    /**
+     * Characteristic value signifying that an operation may short-circuit the
+     * stream.
+     * <p>
+     * An intermediate operation can preserve or inject this value,
+     * or a terminal operation can preserve or inject this value.
+     */
+    // 12, 0x01000000
+    SHORT_CIRCUIT(12,
+                  set(Type.OP).set(Type.TERMINAL_OP));
+
+    // The following 2 flags are currently undefined and a free for any further
+    // stream flags if/when required
+    //
+    // 13, 0x04000000
+    // 14, 0x10000000
+    // 15, 0x40000000
+
+    /**
+     * Type of a flag
+     */
+    enum Type {
+        /**
+         * The flag is associated with spliterator characteristics.
+         */
+        SPLITERATOR,
+
+        /**
+         * The flag is associated with stream flags.
+         */
+        STREAM,
+
+        /**
+         * The flag is associated with intermediate operation flags.
+         */
+        OP,
+
+        /**
+         * The flag is associated with terminal operation flags.
+         */
+        TERMINAL_OP,
+
+        /**
+         * The flag is associated with terminal operation flags that are
+         * propagated upstream across the last stateful operation boundary
+         */
+        UPSTREAM_TERMINAL_OP
+    }
+
+    /**
+     * The bit pattern for setting/injecting a flag.
+     */
+    private static final int SET_BITS = 0b01;
+
+    /**
+     * The bit pattern for clearing a flag.
+     */
+    private static final int CLEAR_BITS = 0b10;
+
+    /**
+     * The bit pattern for preserving a flag.
+     */
+    private static final int PRESERVE_BITS = 0b11;
+
+    private static MaskBuilder set(Type t) {
+        return new MaskBuilder(new EnumMap<>(Type.class)).set(t);
+    }
+
+    private static class MaskBuilder {
+        final Map<Type, Integer> map;
+
+        MaskBuilder(Map<Type, Integer> map) {
+            this.map = map;
+        }
+
+        MaskBuilder mask(Type t, Integer i) {
+            map.put(t, i);
+            return this;
+        }
+
+        MaskBuilder set(Type t) {
+            return mask(t, SET_BITS);
+        }
+
+        MaskBuilder clear(Type t) {
+            return mask(t, CLEAR_BITS);
+        }
+
+        MaskBuilder setAndClear(Type t) {
+            return mask(t, PRESERVE_BITS);
+        }
+
+        Map<Type, Integer> build() {
+            for (Type t : Type.values()) {
+                map.putIfAbsent(t, 0b00);
+            }
+            return map;
+        }
+    }
+
+    /**
+     * The mask table for a flag, this is used to determine if a flag
+     * corresponds to a certain flag type and for creating mask constants.
+     */
+    private final Map<Type, Integer> maskTable;
+
+    /**
+     * The bit position in the bit mask.
+     */
+    private final int bitPosition;
+
+    /**
+     * The set 2 bit set offset at the bit position.
+     */
+    private final int set;
+
+    /**
+     * The clear 2 bit set offset at the bit position.
+     */
+    private final int clear;
+
+    /**
+     * The preserve 2 bit set offset at the bit position.
+     */
+    private final int preserve;
+
+    private StreamOpFlag(int position, MaskBuilder maskBuilder) {
+        this.maskTable = maskBuilder.build();
+        // Two bits per flag
+        position *= 2;
+        this.bitPosition = position;
+        this.set = SET_BITS << position;
+        this.clear = CLEAR_BITS << position;
+        this.preserve = PRESERVE_BITS << position;
+    }
+
+    /**
+     * Gets the bitmap associated with setting this characteristic.
+     *
+     * @return the bitmap for setting this characteristic
+     */
+    int set() {
+        return set;
+    }
+
+    /**
+     * Gets the bitmap associated with clearing this characteristic.
+     *
+     * @return the bitmap for clearing this characteristic
+     */
+    int clear() {
+        return clear;
+    }
+
+    /**
+     * Determines if this flag is a stream-based flag.
+     *
+     * @return true if a stream-based flag, otherwise false.
+     */
+    boolean isStreamFlag() {
+        return maskTable.get(Type.STREAM) > 0;
+    }
+
+    /**
+     * Checks if this flag is set on stream flags, injected on operation flags,
+     * and injected on combined stream and operation flags.
+     *
+     * @param flags the stream flags, operation flags, or combined stream and
+     *        operation flags
+     * @return true if this flag is known, otherwise false.
+     */
+    boolean isKnown(int flags) {
+        return (flags & preserve) == set;
+    }
+
+    /**
+     * Checks if this flag is cleared on operation flags or combined stream and
+     * operation flags.
+     *
+     * @param flags the operation flags or combined stream and operations flags.
+     * @return true if this flag is preserved, otherwise false.
+     */
+    boolean isCleared(int flags) {
+        return (flags & preserve) == clear;
+    }
+
+    /**
+     * Checks if this flag is preserved on combined stream and operation flags.
+     *
+     * @param flags the combined stream and operations flags.
+     * @return true if this flag is preserved, otherwise false.
+     */
+    boolean isPreserved(int flags) {
+        return (flags & preserve) == preserve;
+    }
+
+    /**
+     * Determines if this flag can be set for a flag type.
+     *
+     * @param t the flag type.
+     * @return true if this flag can be set for the flag type, otherwise false.
+     */
+    boolean canSet(Type t) {
+        return (maskTable.get(t) & SET_BITS) > 0;
+    }
+
+    /**
+     * The bit mask for spliterator characteristics
+     */
+    static final int SPLITERATOR_CHARACTERISTICS_MASK = createMask(Type.SPLITERATOR);
+
+    /**
+     * The bit mask for source stream flags.
+     */
+    static final int STREAM_MASK = createMask(Type.STREAM);
+
+    /**
+     * The bit mask for intermediate operation flags.
+     */
+    static final int OP_MASK = createMask(Type.OP);
+
+    /**
+     * The bit mask for terminal operation flags.
+     */
+    static final int TERMINAL_OP_MASK = createMask(Type.TERMINAL_OP);
+
+    /**
+     * The bit mask for upstream terminal operation flags.
+     */
+    static final int UPSTREAM_TERMINAL_OP_MASK = createMask(Type.UPSTREAM_TERMINAL_OP);
+
+    private static int createMask(Type t) {
+        int mask = 0;
+        for (StreamOpFlag flag : StreamOpFlag.values()) {
+            mask |= flag.maskTable.get(t) << flag.bitPosition;
+        }
+        return mask;
+    }
+
+    /**
+     * Complete flag mask.
+     */
+    private static final int FLAG_MASK = createFlagMask();
+
+    private static int createFlagMask() {
+        int mask = 0;
+        for (StreamOpFlag flag : StreamOpFlag.values()) {
+            mask |= flag.preserve;
+        }
+        return mask;
+    }
+
+    /**
+     * Flag mask for stream flags that are set.
+     */
+    private static final int FLAG_MASK_IS = STREAM_MASK;
+
+    /**
+     * Flag mask for stream flags that are cleared.
+     */
+    private static final int FLAG_MASK_NOT = STREAM_MASK << 1;
+
+    /**
+     * The initial value to be combined with the stream flags of the first
+     * stream in the pipeline.
+     */
+    static final int INITIAL_OPS_VALUE = FLAG_MASK_IS | FLAG_MASK_NOT;
+
+    /**
+     * The bit value to set or inject {@link #DISTINCT}.
+     */
+    static final int IS_DISTINCT = DISTINCT.set;
+
+    /**
+     * The bit value to clear {@link #DISTINCT}.
+     */
+    static final int NOT_DISTINCT = DISTINCT.clear;
+
+    /**
+     * The bit value to set or inject {@link #SORTED}.
+     */
+    static final int IS_SORTED = SORTED.set;
+
+    /**
+     * The bit value to clear {@link #SORTED}.
+     */
+    static final int NOT_SORTED = SORTED.clear;
+
+    /**
+     * The bit value to set or inject {@link #ORDERED}.
+     */
+    static final int IS_ORDERED = ORDERED.set;
+
+    /**
+     * The bit value to clear {@link #ORDERED}.
+     */
+    static final int NOT_ORDERED = ORDERED.clear;
+
+    /**
+     * The bit value to set {@link #SIZED}.
+     */
+    static final int IS_SIZED = SIZED.set;
+
+    /**
+     * The bit value to clear {@link #SIZED}.
+     */
+    static final int NOT_SIZED = SIZED.clear;
+
+    /**
+     * The bit value to inject {@link #SHORT_CIRCUIT}.
+     */
+    static final int IS_SHORT_CIRCUIT = SHORT_CIRCUIT.set;
+
+    private static int getMask(int flags) {
+        return (flags == 0)
+               ? FLAG_MASK
+               : ~(flags | ((FLAG_MASK_IS & flags) << 1) | ((FLAG_MASK_NOT & flags) >> 1));
+    }
+
+    /**
+     * Combines stream or operation flags with previously combined stream and
+     * operation flags to produce updated combined stream and operation flags.
+     * <p>
+     * A flag set on stream flags or injected on operation flags,
+     * and injected combined stream and operation flags,
+     * will be injected on the updated combined stream and operation flags.
+     *
+     * <p>
+     * A flag set on stream flags or injected on operation flags,
+     * and cleared on the combined stream and operation flags,
+     * will be cleared on the updated combined stream and operation flags.
+     *
+     * <p>
+     * A flag set on the stream flags or injected on operation flags,
+     * and preserved on the combined stream and operation flags,
+     * will be injected on the updated combined stream and operation flags.
+     *
+     * <p>
+     * A flag not set on the stream flags or cleared/preserved on operation
+     * flags, and injected on the combined stream and operation flags,
+     * will be injected on the updated combined stream and operation flags.
+     *
+     * <p>
+     * A flag not set on the stream flags or cleared/preserved on operation
+     * flags, and cleared on the combined stream and operation flags,
+     * will be cleared on the updated combined stream and operation flags.
+     *
+     * <p>
+     * A flag not set on the stream flags,
+     * and preserved on the combined stream and operation flags
+     * will be preserved on the updated combined stream and operation flags.
+     *
+     * <p>
+     * A flag cleared on operation flags,
+     * and preserved on the combined stream and operation flags
+     * will be cleared on the updated combined stream and operation flags.
+     *
+     * <p>
+     * A flag preserved on operation flags,
+     * and preserved on the combined stream and operation flags
+     * will be preserved on the updated combined stream and operation flags.
+     *
+     * @param newStreamOrOpFlags the stream or operation flags.
+     * @param prevCombOpFlags previously combined stream and operation flags.
+     *        The value {#link INITIAL_OPS_VALUE} must be used as the seed value.
+     * @return the updated combined stream and operation flags.
+     */
+    static int combineOpFlags(int newStreamOrOpFlags, int prevCombOpFlags) {
+        // 0x01 or 0x10 nibbles are transformed to 0x11
+        // 0x00 nibbles remain unchanged
+        // Then all the bits are flipped
+        // Then the result is logically or'ed with the operation flags.
+        return (prevCombOpFlags & StreamOpFlag.getMask(newStreamOrOpFlags)) | newStreamOrOpFlags;
+    }
+
+    /**
+     * Converts combined stream and operation flags to stream flags.
+     *
+     * <p>Each flag injected on the combined stream and operation flags will be
+     * set on the stream flags.
+     *
+     * @param combOpFlags the combined stream and operation flags.
+     * @return the stream flags.
+     */
+    static int toStreamFlags(int combOpFlags) {
+        // By flipping the nibbles 0x11 become 0x00 and 0x01 become 0x10
+        // Shift left 1 to restore set flags and mask off anything other than the set flags
+        return ((~combOpFlags) >> 1) & FLAG_MASK_IS & combOpFlags;
+    }
+
+    /**
+     * Converts stream flags to a spliterator characteristic bit set.
+     *
+     * @param streamFlags the stream flags.
+     * @return the spliterator characteristic bit set.
+     */
+    static int toCharacteristics(int streamFlags) {
+        return streamFlags & SPLITERATOR_CHARACTERISTICS_MASK;
+    }
+
+    /**
+     * Converts a spliterator characteristic bit set to stream flags.
+     *
+     * @implSpec
+     * If the spliterator is naturally {@code SORTED} (the associated
+     * {@code Comparator} is {@code null}) then the characteristic is converted
+     * to the {@link #SORTED} flag, otherwise the characteristic is not
+     * converted.
+     *
+     * @param spliterator the spliterator from which to obtain characteristic
+     *        bit set.
+     * @return the stream flags.
+     */
+    static int fromCharacteristics(Spliterator<?> spliterator) {
+        int characteristics = spliterator.characteristics();
+        if ((characteristics & Spliterator.SORTED) != 0 && spliterator.getComparator() != null) {
+            // Do not propagate the SORTED characteristic if it does not correspond
+            // to a natural sort order
+            return characteristics & SPLITERATOR_CHARACTERISTICS_MASK & ~Spliterator.SORTED;
+        }
+        else {
+            return characteristics & SPLITERATOR_CHARACTERISTICS_MASK;
+        }
+    }
+
+    /**
+     * Converts a spliterator characteristic bit set to stream flags.
+     *
+     * @param characteristics the spliterator characteristic bit set.
+     * @return the stream flags.
+     */
+    static int fromCharacteristics(int characteristics) {
+        return characteristics & SPLITERATOR_CHARACTERISTICS_MASK;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamShape.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+/**
+ * An enum describing the known shape specializations for stream abstractions.
+ * Each will correspond to a specific subinterface of {@link BaseStream}
+ * (e.g., {@code REFERENCE} corresponds to {@code Stream}, {@code INT_VALUE}
+ * corresponds to {@code IntStream}).  Each may also correspond to
+ * specializations of value-handling abstractions such as {@code Spliterator},
+ * {@code Consumer}, etc.
+ *
+ * @apiNote
+ * This enum is used by implementations to determine compatibility between
+ * streams and operations (i.e., if the output shape of a stream is compatible
+ * with the input shape of the next operation).
+ *
+ * <p>Some APIs require you to specify both a generic type and a stream shape
+ * for input or output elements, such as {@link TerminalOp} which has both
+ * generic type parameters for its input types, and a getter for the
+ * input shape.  When representing primitive streams in this way, the
+ * generic type parameter should correspond to the wrapper type for that
+ * primitive type.
+ *
+ * @since 1.8
+ */
+enum StreamShape {
+    /**
+     * The shape specialization corresponding to {@code Stream} and elements
+     * that are object references.
+     */
+    REFERENCE,
+    /**
+     * The shape specialization corresponding to {@code IntStream} and elements
+     * that are {@code int} values.
+     */
+    INT_VALUE,
+    /**
+     * The shape specialization corresponding to {@code LongStream} and elements
+     * that are {@code long} values.
+     */
+    LONG_VALUE,
+    /**
+     * The shape specialization corresponding to {@code DoubleStream} and
+     * elements that are {@code double} values.
+     */
+    DOUBLE_VALUE
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamSpliterators.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,636 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Comparator;
+import java.util.Spliterator;
+import java.util.function.BooleanSupplier;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+import java.util.function.Supplier;
+
+/**
+ * Spliterator implementations for wrapping and delegating spliterators, used
+ * in the implementation of the {@link Stream#spliterator()} method.
+ *
+ * @since 1.8
+ */
+class StreamSpliterators {
+
+    /**
+     * Abstract wrapping spliterator that binds to the spliterator of a
+     * pipeline helper on first operation.
+     *
+     * <p>This spliterator is not late-binding and will bind to the source
+     * spliterator when first operated on.
+     *
+     * <p>A wrapping spliterator produced from a sequential stream
+     * cannot be split if there are stateful operations present.
+     */
+    private static abstract class AbstractWrappingSpliterator<P_IN, P_OUT,
+                                                              T_BUFFER extends AbstractSpinedBuffer>
+            implements Spliterator<P_OUT> {
+
+        // @@@ Detect if stateful operations are present or not
+        //     If not then can split otherwise cannot
+
+        /**
+         * True if this spliterator supports splitting
+         */
+        final boolean isParallel;
+
+        final PipelineHelper<P_OUT> ph;
+
+        /**
+         * Supplier for the source spliterator.  Client provides either a
+         * spliterator or a supplier.
+         */
+        private Supplier<Spliterator<P_IN>> spliteratorSupplier;
+
+        /**
+         * Source spliterator.  Either provided from client or obtained from
+         * supplier.
+         */
+        Spliterator<P_IN> spliterator;
+
+        /**
+         * Sink chain for the downstream stages of the pipeline, ultimately
+         * leading to the buffer. Used during partial traversal.
+         */
+        Sink<P_IN> bufferSink;
+
+        /**
+         * A function that advances one element of the spliterator, pushing
+         * it to bufferSink.  Returns whether any elements were processed.
+         * Used during partial traversal.
+         */
+        BooleanSupplier pusher;
+
+        /** Next element to consume from the buffer, used during partial traversal */
+        long nextToConsume;
+
+        /** Buffer into which elements are pushed.  Used during partial traversal. */
+        T_BUFFER buffer;
+
+        /**
+         * True if full traversal has occurred (with possible cancelation).
+         * If doing a partial traversal, there may be still elements in buffer.
+         */
+        boolean finished;
+
+        /**
+         * Construct an AbstractWrappingSpliterator from a
+         * {@code Supplier<Spliterator>}.
+         */
+        AbstractWrappingSpliterator(PipelineHelper<P_OUT> ph,
+                                    Supplier<Spliterator<P_IN>> spliteratorSupplier,
+                                    boolean parallel) {
+            this.ph = ph;
+            this.spliteratorSupplier = spliteratorSupplier;
+            this.spliterator = null;
+            this.isParallel = parallel;
+        }
+
+        /**
+         * Construct an AbstractWrappingSpliterator from a
+         * {@code Spliterator}.
+         */
+        AbstractWrappingSpliterator(PipelineHelper<P_OUT> ph,
+                                    Spliterator<P_IN> spliterator,
+                                    boolean parallel) {
+            this.ph = ph;
+            this.spliteratorSupplier = null;
+            this.spliterator = spliterator;
+            this.isParallel = parallel;
+        }
+
+        /**
+         * Called before advancing to set up spliterator, if needed.
+         */
+        final void init() {
+            if (spliterator == null) {
+                spliterator = spliteratorSupplier.get();
+                spliteratorSupplier = null;
+            }
+        }
+
+        /**
+         * Get an element from the source, pushing it into the sink chain,
+         * setting up the buffer if needed
+         * @return whether there are elements to consume from the buffer
+         */
+        final boolean doAdvance() {
+            if (buffer == null) {
+                if (finished)
+                    return false;
+
+                init();
+                initPartialTraversalState();
+                nextToConsume = 0;
+                bufferSink.begin(spliterator.getExactSizeIfKnown());
+                return fillBuffer();
+            }
+            else {
+                ++nextToConsume;
+                boolean hasNext = nextToConsume < buffer.count();
+                if (!hasNext) {
+                    nextToConsume = 0;
+                    buffer.clear();
+                    hasNext = fillBuffer();
+                }
+                return hasNext;
+            }
+        }
+
+        /**
+         * Invokes the shape-specific constructor with the provided arguments
+         * and returns the result.
+         */
+        abstract AbstractWrappingSpliterator<P_IN, P_OUT, ?> wrap(Spliterator<P_IN> s);
+
+        /**
+         * Initializes buffer, sink chain, and pusher for a shape-specific
+         * implementation.
+         */
+        abstract void initPartialTraversalState();
+
+        @Override
+        public Spliterator<P_OUT> trySplit() {
+            if (isParallel && !finished) {
+                init();
+
+                Spliterator<P_IN> split = spliterator.trySplit();
+                return (split == null) ? null : wrap(split);
+            }
+            else
+                return null;
+        }
+
+        /**
+         * If the buffer is empty, push elements into the sink chain until
+         * the source is empty or cancellation is requested.
+         * @return whether there are elements to consume from the buffer
+         */
+        private boolean fillBuffer() {
+            while (buffer.count() == 0) {
+                if (bufferSink.cancellationRequested() || !pusher.getAsBoolean()) {
+                    if (finished)
+                        return false;
+                    else {
+                        bufferSink.end(); // might trigger more elements
+                        finished = true;
+                    }
+                }
+            }
+            return true;
+        }
+
+        @Override
+        public final long estimateSize() {
+            init();
+            return StreamOpFlag.SIZED.isKnown(ph.getStreamAndOpFlags())
+                   ? spliterator.estimateSize()
+                   : Long.MAX_VALUE;
+        }
+
+        @Override
+        public final long getExactSizeIfKnown() {
+            init();
+            return StreamOpFlag.SIZED.isKnown(ph.getStreamAndOpFlags())
+                   ? spliterator.getExactSizeIfKnown()
+                   : -1;
+        }
+
+        @Override
+        public final int characteristics() {
+            init();
+
+            // Get the characteristics from the pipeline
+            int c = StreamOpFlag.toCharacteristics(StreamOpFlag.toStreamFlags(ph.getStreamAndOpFlags()));
+
+            // Mask off the size and uniform characteristics and replace with
+            // those of the spliterator
+            // Note that a non-uniform spliterator can change from something
+            // with an exact size to an estimate for a sub-split, for example
+            // with HashSet where the size is known at the top level spliterator
+            // but for sub-splits only an estimate is known
+            if ((c & Spliterator.SIZED) != 0) {
+                c &= ~(Spliterator.SIZED | Spliterator.SUBSIZED);
+                c |= (spliterator.characteristics() & Spliterator.SIZED & Spliterator.SUBSIZED);
+            }
+
+            return c;
+        }
+
+        @Override
+        public Comparator<? super P_OUT> getComparator() {
+            if (!hasCharacteristics(SORTED))
+                throw new IllegalStateException();
+            return null;
+        }
+
+        @Override
+        public final String toString() {
+            return String.format("%s[%s]", getClass().getName(), spliterator);
+        }
+    }
+
+    static final class WrappingSpliterator<P_IN, P_OUT>
+            extends AbstractWrappingSpliterator<P_IN, P_OUT, SpinedBuffer<P_OUT>> {
+
+        WrappingSpliterator(PipelineHelper<P_OUT> ph,
+                            Supplier<Spliterator<P_IN>> supplier,
+                            boolean parallel) {
+            super(ph, supplier, parallel);
+        }
+
+        WrappingSpliterator(PipelineHelper<P_OUT> ph,
+                            Spliterator<P_IN> spliterator,
+                            boolean parallel) {
+            super(ph, spliterator, parallel);
+        }
+
+        @Override
+        WrappingSpliterator<P_IN, P_OUT> wrap(Spliterator<P_IN> s) {
+            return new WrappingSpliterator<>(ph, s, isParallel);
+        }
+
+        @Override
+        void initPartialTraversalState() {
+            SpinedBuffer<P_OUT> b = new SpinedBuffer<>();
+            buffer = b;
+            bufferSink = ph.wrapSink(b::accept);
+            pusher = () -> spliterator.tryAdvance(bufferSink);
+        }
+
+        @Override
+        public boolean tryAdvance(Consumer<? super P_OUT> consumer) {
+            boolean hasNext = doAdvance();
+            if (hasNext)
+                consumer.accept(buffer.get(nextToConsume));
+            return hasNext;
+        }
+
+        @Override
+        public void forEachRemaining(Consumer<? super P_OUT> consumer) {
+            if (buffer == null && !finished) {
+                init();
+
+                ph.wrapAndCopyInto((Sink<P_OUT>) consumer::accept, spliterator);
+                finished = true;
+            }
+            else {
+                while (tryAdvance(consumer)) { }
+            }
+        }
+    }
+
+    static final class IntWrappingSpliterator<P_IN>
+            extends AbstractWrappingSpliterator<P_IN, Integer, SpinedBuffer.OfInt>
+            implements Spliterator.OfInt {
+
+        IntWrappingSpliterator(PipelineHelper<Integer> ph,
+                               Supplier<Spliterator<P_IN>> supplier,
+                               boolean parallel) {
+            super(ph, supplier, parallel);
+        }
+
+        IntWrappingSpliterator(PipelineHelper<Integer> ph,
+                               Spliterator<P_IN> spliterator,
+                               boolean parallel) {
+            super(ph, spliterator, parallel);
+        }
+
+        @Override
+        AbstractWrappingSpliterator<P_IN, Integer, ?> wrap(Spliterator<P_IN> s) {
+            return new IntWrappingSpliterator<>(ph, s, isParallel);
+        }
+
+        @Override
+        void initPartialTraversalState() {
+            SpinedBuffer.OfInt b = new SpinedBuffer.OfInt();
+            buffer = b;
+            bufferSink = ph.wrapSink((Sink.OfInt) b::accept);
+            pusher = () -> spliterator.tryAdvance(bufferSink);
+        }
+
+        @Override
+        public Spliterator.OfInt trySplit() {
+            return (Spliterator.OfInt) super.trySplit();
+        }
+
+        @Override
+        public boolean tryAdvance(IntConsumer consumer) {
+            boolean hasNext = doAdvance();
+            if (hasNext)
+                consumer.accept(buffer.get(nextToConsume));
+            return hasNext;
+        }
+
+        @Override
+        public void forEachRemaining(IntConsumer consumer) {
+            if (buffer == null && !finished) {
+                init();
+
+                ph.wrapAndCopyInto((Sink.OfInt) consumer::accept, spliterator);
+                finished = true;
+            }
+            else {
+                while (tryAdvance(consumer)) { }
+            }
+        }
+    }
+
+    static final class LongWrappingSpliterator<P_IN>
+            extends AbstractWrappingSpliterator<P_IN, Long, SpinedBuffer.OfLong>
+            implements Spliterator.OfLong {
+
+        LongWrappingSpliterator(PipelineHelper<Long> ph,
+                                Supplier<Spliterator<P_IN>> supplier,
+                                boolean parallel) {
+            super(ph, supplier, parallel);
+        }
+
+        LongWrappingSpliterator(PipelineHelper<Long> ph,
+                                Spliterator<P_IN> spliterator,
+                                boolean parallel) {
+            super(ph, spliterator, parallel);
+        }
+
+        @Override
+        AbstractWrappingSpliterator<P_IN, Long, ?> wrap(Spliterator<P_IN> s) {
+            return new LongWrappingSpliterator<>(ph, s, isParallel);
+        }
+
+        @Override
+        void initPartialTraversalState() {
+            SpinedBuffer.OfLong b = new SpinedBuffer.OfLong();
+            buffer = b;
+            bufferSink = ph.wrapSink((Sink.OfLong) b::accept);
+            pusher = () -> spliterator.tryAdvance(bufferSink);
+        }
+
+        @Override
+        public Spliterator.OfLong trySplit() {
+            return (Spliterator.OfLong) super.trySplit();
+        }
+
+        @Override
+        public boolean tryAdvance(LongConsumer consumer) {
+            boolean hasNext = doAdvance();
+            if (hasNext)
+                consumer.accept(buffer.get(nextToConsume));
+            return hasNext;
+        }
+
+        @Override
+        public void forEachRemaining(LongConsumer consumer) {
+            if (buffer == null && !finished) {
+                init();
+
+                ph.wrapAndCopyInto((Sink.OfLong) consumer::accept, spliterator);
+                finished = true;
+            }
+            else {
+                while (tryAdvance(consumer)) { }
+            }
+        }
+    }
+
+    static final class DoubleWrappingSpliterator<P_IN>
+            extends AbstractWrappingSpliterator<P_IN, Double, SpinedBuffer.OfDouble>
+            implements Spliterator.OfDouble {
+
+        DoubleWrappingSpliterator(PipelineHelper<Double> ph,
+                                  Supplier<Spliterator<P_IN>> supplier,
+                                  boolean parallel) {
+            super(ph, supplier, parallel);
+        }
+
+        DoubleWrappingSpliterator(PipelineHelper<Double> ph,
+                                  Spliterator<P_IN> spliterator,
+                                  boolean parallel) {
+            super(ph, spliterator, parallel);
+        }
+
+        @Override
+        AbstractWrappingSpliterator<P_IN, Double, ?> wrap(Spliterator<P_IN> s) {
+            return new DoubleWrappingSpliterator<>(ph, s, isParallel);
+        }
+
+        @Override
+        void initPartialTraversalState() {
+            SpinedBuffer.OfDouble b = new SpinedBuffer.OfDouble();
+            buffer = b;
+            bufferSink = ph.wrapSink((Sink.OfDouble) b::accept);
+            pusher = () -> spliterator.tryAdvance(bufferSink);
+        }
+
+        @Override
+        public Spliterator.OfDouble trySplit() {
+            return (Spliterator.OfDouble) super.trySplit();
+        }
+
+        @Override
+        public boolean tryAdvance(DoubleConsumer consumer) {
+            boolean hasNext = doAdvance();
+            if (hasNext)
+                consumer.accept(buffer.get(nextToConsume));
+            return hasNext;
+        }
+
+        @Override
+        public void forEachRemaining(DoubleConsumer consumer) {
+            if (buffer == null && !finished) {
+                init();
+
+                ph.wrapAndCopyInto((Sink.OfDouble) consumer::accept, spliterator);
+                finished = true;
+            }
+            else {
+                while (tryAdvance(consumer)) { }
+            }
+        }
+    }
+
+    /**
+     * Spliterator implementation that delegates to an underlying spliterator,
+     * acquiring the spliterator from a {@code Supplier<Spliterator>} on the
+     * first call to any spliterator method.
+     * @param <T>
+     */
+    static class DelegatingSpliterator<T> implements Spliterator<T> {
+        private final Supplier<Spliterator<T>> supplier;
+
+        private Spliterator<T> s;
+
+        @SuppressWarnings("unchecked")
+        DelegatingSpliterator(Supplier<? extends Spliterator<T>> supplier) {
+            this.supplier = (Supplier<Spliterator<T>>) supplier;
+        }
+
+        Spliterator<T> get() {
+            if (s == null) {
+                s = supplier.get();
+            }
+            return s;
+        }
+
+        @Override
+        public Spliterator<T> trySplit() {
+            return get().trySplit();
+        }
+
+        @Override
+        public boolean tryAdvance(Consumer<? super T> consumer) {
+            return get().tryAdvance(consumer);
+        }
+
+        @Override
+        public void forEachRemaining(Consumer<? super T> consumer) {
+            get().forEachRemaining(consumer);
+        }
+
+        @Override
+        public long estimateSize() {
+            return get().estimateSize();
+        }
+
+        @Override
+        public int characteristics() {
+            return get().characteristics();
+        }
+
+        @Override
+        public Comparator<? super T> getComparator() {
+            return get().getComparator();
+        }
+
+        @Override
+        public long getExactSizeIfKnown() {
+            return get().getExactSizeIfKnown();
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getName() + "[" + get() + "]";
+        }
+
+        static final class OfInt extends DelegatingSpliterator<Integer> implements Spliterator.OfInt {
+            private Spliterator.OfInt s;
+
+            OfInt(Supplier<Spliterator.OfInt> supplier) {
+                super(supplier);
+            }
+
+            @Override
+            Spliterator.OfInt get() {
+                if (s == null) {
+                    s = (Spliterator.OfInt) super.get();
+                }
+                return s;
+            }
+
+            @Override
+            public Spliterator.OfInt trySplit() {
+                return get().trySplit();
+            }
+
+            @Override
+            public boolean tryAdvance(IntConsumer consumer) {
+                return get().tryAdvance(consumer);
+            }
+
+            @Override
+            public void forEachRemaining(IntConsumer consumer) {
+                get().forEachRemaining(consumer);
+            }
+        }
+
+        static final class OfLong extends DelegatingSpliterator<Long> implements Spliterator.OfLong {
+            private Spliterator.OfLong s;
+
+            OfLong(Supplier<Spliterator.OfLong> supplier) {
+                super(supplier);
+            }
+
+            @Override
+            Spliterator.OfLong get() {
+                if (s == null) {
+                    s = (Spliterator.OfLong) super.get();
+                }
+                return s;
+            }
+
+            @Override
+            public Spliterator.OfLong trySplit() {
+                return get().trySplit();
+            }
+
+            @Override
+            public boolean tryAdvance(LongConsumer consumer) {
+                return get().tryAdvance(consumer);
+            }
+
+            @Override
+            public void forEachRemaining(LongConsumer consumer) {
+                get().forEachRemaining(consumer);
+            }
+        }
+
+        static final class OfDouble extends DelegatingSpliterator<Double> implements Spliterator.OfDouble {
+            private Spliterator.OfDouble s;
+
+            OfDouble(Supplier<Spliterator.OfDouble> supplier) {
+                super(supplier);
+            }
+
+            @Override
+            Spliterator.OfDouble get() {
+                if (s == null) {
+                    s = (Spliterator.OfDouble) super.get();
+                }
+                return s;
+            }
+
+            @Override
+            public Spliterator.OfDouble trySplit() {
+                return get().trySplit();
+            }
+
+            @Override
+            public boolean tryAdvance(DoubleConsumer consumer) {
+                return get().tryAdvance(consumer);
+            }
+
+            @Override
+            public void forEachRemaining(DoubleConsumer consumer) {
+                get().forEachRemaining(consumer);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/StreamSupport.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,511 @@
+/*
+ * Copyright (c) 2012, 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 java.util.stream;
+
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.function.Supplier;
+
+/**
+ * Low-level utility methods for creating and manipulating streams.
+ *
+ * <p>This class is mostly for library writers presenting stream views
+ * of their data structures; most static stream methods for end users are in
+ * {@link Streams}.
+ *
+ * <p>Unless otherwise stated, streams are created as sequential
+ * streams.  A sequential stream can be transformed into a parallel stream by
+ * calling the {@code parallel()} method on the created stream.
+ *
+ * @since 1.8
+ */
+public class StreamSupport {
+    /**
+     * Creates a new sequential {@code Stream} from a {@code Spliterator}.
+     *
+     * <p>The spliterator is only traversed, split, or queried for estimated
+     * size after the terminal operation of the stream pipeline commences.
+     *
+     * <p>It is strongly recommended the spliterator report a characteristic of
+     * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <a href="Spliterator.html#binding">late-binding</a>.  Otherwise,
+     * {@link #stream(Supplier, int)} should be used to
+     * reduce the scope of potential interference with the source.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param <T> the type of stream elements
+     * @param spliterator a {@code Spliterator} describing the stream elements
+     * @return a new sequential {@code Stream}
+     */
+    public static <T> Stream<T> stream(Spliterator<T> spliterator) {
+        Objects.requireNonNull(spliterator);
+        return new ReferencePipeline.Head<>(spliterator,
+                                            StreamOpFlag.fromCharacteristics(spliterator),
+                                            false);
+    }
+
+    /**
+     * Creates a new parallel {@code Stream} from a {@code Spliterator}.
+     *
+     * <p>The spliterator is only traversed, split, or queried for estimated
+     * size after the terminal operation of the stream pipeline commences.
+     *
+     * <p>It is strongly recommended the spliterator report a characteristic of
+     * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <a href="Spliterator.html#binding">late-binding</a>.  Otherwise,
+     * {@link #stream(Supplier, int)} should be used to
+     * reduce the scope of potential interference with the source.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param <T> the type of stream elements
+     * @param spliterator a {@code Spliterator} describing the stream elements
+     * @return a new parallel {@code Stream}
+     */
+    public static <T> Stream<T> parallelStream(Spliterator<T> spliterator) {
+        Objects.requireNonNull(spliterator);
+        return new ReferencePipeline.Head<>(spliterator,
+                                            StreamOpFlag.fromCharacteristics(spliterator),
+                                            true);
+    }
+
+    /**
+     * Creates a new sequential {@code Stream} from a {@code Supplier} of
+     * {@code Spliterator}.
+     *
+     * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+     * more than once, and after the terminal operation of the stream pipeline
+     * commences.
+     *
+     * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+     * or {@code CONCURRENT}, or that are
+     * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+     * more efficient to use {@link #stream(java.util.Spliterator)} instead.
+     * The use of a {@code Supplier} in this form provides a level of
+     * indirection that reduces the scope of potential interference with the
+     * source.  Since the supplier is only invoked after the terminal operation
+     * commences, any modifications to the source up to the start of the
+     * terminal operation are reflected in the stream result.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param <T> the type of stream elements
+     * @param supplier a {@code Supplier} of a {@code Spliterator}
+     * @param characteristics Spliterator characteristics of the supplied
+     *        {@code Spliterator}.  The characteristics must be equal to
+     *        {@code source.get().getCharacteristics()}.
+     * @return a new sequential {@code Stream}
+     * @see #stream(Spliterator)
+     */
+    public static <T> Stream<T> stream(Supplier<? extends Spliterator<T>> supplier,
+                                      int characteristics) {
+        Objects.requireNonNull(supplier);
+        return new ReferencePipeline.Head<>(supplier,
+                                            StreamOpFlag.fromCharacteristics(characteristics),
+                                            false);
+    }
+
+    /**
+     * Creates a new parallel {@code Stream} from a {@code Supplier} of
+     * {@code Spliterator}.
+     *
+     * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+     * more than once, and after the terminal operation of the stream pipeline
+     * commences.
+     *
+     * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+     * or {@code CONCURRENT}, or that are
+     * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+     * more efficient to use {@link #stream(Spliterator)} instead.
+     * The use of a {@code Supplier} in this form provides a level of
+     * indirection that reduces the scope of potential interference with the
+     * source.  Since the supplier is only invoked after the terminal operation
+     * commences, any modifications to the source up to the start of the
+     * terminal operation are reflected in the stream result.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param <T> the type of stream elements
+     * @param supplier a {@code Supplier} of a {@code Spliterator}
+     * @param characteristics Spliterator characteristics of the supplied
+     *        {@code Spliterator}.  The characteristics must be equal to
+     *        {@code source.get().getCharacteristics()}
+     * @return a new parallel {@code Stream}
+     * @see #parallelStream(Spliterator)
+     */
+    public static <T> Stream<T> parallelStream(Supplier<? extends Spliterator<T>> supplier,
+                                              int characteristics) {
+        Objects.requireNonNull(supplier);
+        return new ReferencePipeline.Head<>(supplier,
+                                            StreamOpFlag.fromCharacteristics(characteristics),
+                                            true);
+    }
+
+    /**
+     * Creates a new sequential {@code IntStream} from a {@code Spliterator.OfInt}.
+     *
+     * <p>The spliterator is only traversed, split, or queried for estimated size
+     * after the terminal operation of the stream pipeline commences.
+     *
+     * <p>It is strongly recommended the spliterator report a characteristic of
+     * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <a href="Spliterator.html#binding">late-binding</a>.  Otherwise,
+     * {@link #stream(Supplier, int)}} should be used to
+     * reduce the scope of potential interference with the source.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param spliterator a {@code Spliterator.OfInt} describing the stream elements
+     * @return a new sequential {@code IntStream}
+     */
+    public static IntStream intStream(Spliterator.OfInt spliterator) {
+        return new IntPipeline.Head<>(spliterator,
+                                      StreamOpFlag.fromCharacteristics(spliterator),
+                                      false);
+    }
+
+    /**
+     * Creates a new parallel {@code IntStream} from a {@code Spliterator.OfInt}.
+     *
+     * <p>he spliterator is only traversed, split, or queried for estimated size
+     * after the terminal operation of the stream pipeline commences.
+     *
+     * <p>It is strongly recommended the spliterator report a characteristic of
+     * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <a href="Spliterator.html#binding">late-binding</a>.  Otherwise,
+     * {@link #stream(Supplier, int)}} should be used to
+     * reduce the scope of potential interference with the source.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param spliterator a {@code Spliterator.OfInt} describing the stream elements
+     * @return a new parallel {@code IntStream}
+     */
+    public static IntStream intParallelStream(Spliterator.OfInt spliterator) {
+        return new IntPipeline.Head<>(spliterator,
+                                      StreamOpFlag.fromCharacteristics(spliterator),
+                                      true);
+    }
+
+    /**
+     * Creates a new sequential {@code IntStream} from a {@code Supplier} of
+     * {@code Spliterator.OfInt}.
+     *
+     * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+     * more than once, and after the terminal operation of the stream pipeline
+     * commences.
+     *
+     * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+     * or {@code CONCURRENT}, or that are
+     * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+     * more efficient to use {@link #intStream(Spliterator.OfInt)} instead.
+     * The use of a {@code Supplier} in this form provides a level of
+     * indirection that reduces the scope of potential interference with the
+     * source.  Since the supplier is only invoked after the terminal operation
+     * commences, any modifications to the source up to the start of the
+     * terminal operation are reflected in the stream result.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param supplier a {@code Supplier} of a {@code Spliterator.OfInt}
+     * @param characteristics Spliterator characteristics of the supplied
+     *        {@code Spliterator.OfInt}.  The characteristics must be equal to
+     *        {@code source.get().getCharacteristics()}
+     * @return a new sequential {@code IntStream}
+     * @see #intStream(Spliterator.OfInt)
+     */
+    public static IntStream intStream(Supplier<? extends Spliterator.OfInt> supplier,
+                                      int characteristics) {
+        return new IntPipeline.Head<>(supplier,
+                                      StreamOpFlag.fromCharacteristics(characteristics),
+                                      false);
+    }
+
+    /**
+     * Creates a new parallel {@code IntStream} from a {@code Supplier} of
+     * {@code Spliterator.OfInt}.
+     *
+     * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+     * more than once, and after the terminal operation of the stream pipeline
+     * commences.
+     *
+     * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+     * or {@code CONCURRENT}, or that are
+     * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+     * more efficient to use {@link #intStream(Spliterator.OfInt)} instead.
+     * The use of a {@code Supplier} in this form provides a level of
+     * indirection that reduces the scope of potential interference with the
+     * source.  Since the supplier is only invoked after the terminal operation
+     * commences, any modifications to the source up to the start of the
+     * terminal operation are reflected in the stream result.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param supplier a {@code Supplier} of a {@code Spliterator.OfInt}
+     * @param characteristics Spliterator characteristics of the supplied
+     *        {@code Spliterator.OfInt}.  The characteristics must be equal to
+     *        {@code source.get().getCharacteristics()}
+     * @return a new parallel {@code IntStream}
+     * @see #intParallelStream(Spliterator.OfInt)
+     */
+    public static IntStream intParallelStream(Supplier<? extends Spliterator.OfInt> supplier,
+                                              int characteristics) {
+        return new IntPipeline.Head<>(supplier,
+                                      StreamOpFlag.fromCharacteristics(characteristics),
+                                      true);
+    }
+
+    /**
+     * Creates a new sequential {@code LongStream} from a {@code Spliterator.OfLong}.
+     *
+     * <p>The spliterator is only traversed, split, or queried for estimated
+     * size after the terminal operation of the stream pipeline commences.
+     *
+     * <p>It is strongly recommended the spliterator report a characteristic of
+     * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <a href="Spliterator.html#binding">late-binding</a>.  Otherwise,
+     * {@link #stream(Supplier, int)} should be used to
+     * reduce the scope of potential interference with the source.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param spliterator a {@code Spliterator.OfLong} describing the stream
+     * elements
+     * @return a new sequential {@code LongStream}
+     */
+    public static LongStream longStream(Spliterator.OfLong spliterator) {
+        return new LongPipeline.Head<>(spliterator,
+                                       StreamOpFlag.fromCharacteristics(spliterator),
+                                       false);
+    }
+
+    /**
+     * Creates a new parallel {@code LongStream} from a {@code Spliterator.OfLong}.
+     *
+     * <p>The spliterator is only traversed, split, or queried for estimated
+     * size after the terminal operation of the stream pipeline commences.
+     *
+     * <p>It is strongly recommended the spliterator report a characteristic of
+     * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <a href="Spliterator.html#binding">late-binding</a>.  Otherwise,
+     * {@link #stream(Supplier, int)} should be used to
+     * reduce the scope of potential interference with the source.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param spliterator a {@code Spliterator.OfLong} describing the stream elements
+     * @return a new parallel {@code LongStream}
+     */
+    public static LongStream longParallelStream(Spliterator.OfLong spliterator) {
+        return new LongPipeline.Head<>(spliterator,
+                                       StreamOpFlag.fromCharacteristics(spliterator),
+                                       true);
+    }
+
+    /**
+     * Creates a new sequential {@code LongStream} from a {@code Supplier} of
+     * {@code Spliterator.OfLong}.
+     *
+     * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+     * more than once, and after the terminal operation of the stream pipeline
+     * commences.
+     *
+     * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+     * or {@code CONCURRENT}, or that are
+     * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+     * more efficient to use {@link #longStream(Spliterator.OfLong)} instead.
+     * The use of a {@code Supplier} in this form provides a level of
+     * indirection that reduces the scope of potential interference with the
+     * source.  Since the supplier is only invoked after the terminal operation
+     * commences, any modifications to the source up to the start of the
+     * terminal operation are reflected in the stream result.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param supplier a {@code Supplier} of a {@code Spliterator.OfLong}
+     * @param characteristics Spliterator characteristics of the supplied
+     *        {@code Spliterator.OfLong}.  The characteristics must be equal to
+     *        {@code source.get().getCharacteristics()}
+     * @return a new sequential {@code LongStream}
+     * @see #longStream(Spliterator.OfLong)
+     */
+    public static LongStream longStream(Supplier<? extends Spliterator.OfLong> supplier,
+                                        int characteristics) {
+        return new LongPipeline.Head<>(supplier,
+                                       StreamOpFlag.fromCharacteristics(characteristics),
+                                       false);
+    }
+
+    /**
+     * Creates a new parallel {@code LongStream} from a {@code Supplier} of
+     * {@code Spliterator.OfLong}.
+     *
+     * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+     * more than once, and after the terminal operation of the stream pipeline
+     * commences.
+     *
+     * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+     * or {@code CONCURRENT}, or that are
+     * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+     * more efficient to use {@link #longStream(Spliterator.OfLong)} instead.
+     * The use of a {@code Supplier} in this form provides a level of
+     * indirection that reduces the scope of potential interference with the
+     * source.  Since the supplier is only invoked after the terminal operation
+     * commences, any modifications to the source up to the start of the
+     * terminal operation are reflected in the stream result.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param supplier A {@code Supplier} of a {@code Spliterator.OfLong}
+     * @param characteristics Spliterator characteristics of the supplied
+     *        {@code Spliterator.OfLong}.  The characteristics must be equal to
+     *        {@code source.get().getCharacteristics()}
+     * @return A new parallel {@code LongStream}
+     * @see #longParallelStream(Spliterator.OfLong)
+     */
+    public static LongStream longParallelStream(Supplier<? extends Spliterator.OfLong> supplier,
+                                                int characteristics) {
+        return new LongPipeline.Head<>(supplier,
+                                       StreamOpFlag.fromCharacteristics(characteristics),
+                                       true);
+    }
+
+    /**
+     * Creates a new sequential {@code DoubleStream} from a
+     * {@code Spliterator.OfDouble}.
+     *
+     * <p>The spliterator is only traversed, split, or queried for estimated size
+     * after the terminal operation of the stream pipeline commences.
+     *
+     * <p>It is strongly recommended the spliterator report a characteristic of
+     * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <a href="Spliterator.html#binding">late-binding</a>.  Otherwise,
+     * {@link #stream(Supplier, int)} should be used to
+     * reduce the scope of potential interference with the source.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param spliterator A {@code Spliterator.OfDouble} describing the stream elements
+     * @return A new sequential {@code DoubleStream}
+     */
+    public static DoubleStream doubleStream(Spliterator.OfDouble spliterator) {
+        return new DoublePipeline.Head<>(spliterator,
+                                         StreamOpFlag.fromCharacteristics(spliterator),
+                                         false);
+    }
+
+    /**
+     * Creates a new parallel {@code DoubleStream} from a
+     * {@code Spliterator.OfDouble}.
+     *
+     * <p>The spliterator is only traversed, split, or queried for estimated size
+     * after the terminal operation of the stream pipeline commences.
+     *
+     * <p>It is strongly recommended the spliterator report a characteristic of
+     * {@code IMMUTABLE} or {@code CONCURRENT}, or be
+     * <a href="Spliterator.html#binding">late-binding</a>.  Otherwise,
+     * {@link #stream(Supplier, int)} should be used to
+     * reduce the scope of potential interference with the source.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param spliterator A {@code Spliterator.OfDouble} describing the stream elements
+     * @return A new parallel {@code DoubleStream}
+     */
+    public static DoubleStream doubleParallelStream(Spliterator.OfDouble spliterator) {
+        return new DoublePipeline.Head<>(spliterator,
+                                         StreamOpFlag.fromCharacteristics(spliterator),
+                                         true);
+    }
+
+    /**
+     * Creates a new sequential {@code DoubleStream} from a {@code Supplier} of
+     * {@code Spliterator.OfDouble}.
+     * <p>
+     * The {@link Supplier#get()} method will be invoked on the supplier no
+     * more than once, and after the terminal operation of the stream pipeline
+     * commences.
+     * <p>
+     * For spliterators that report a characteristic of {@code IMMUTABLE}
+     * or {@code CONCURRENT}, or that are
+     * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+     * more efficient to use {@link #doubleStream(Spliterator.OfDouble)} instead.
+     * The use of a {@code Supplier} in this form provides a level of
+     * indirection that reduces the scope of potential interference with the
+     * source.  Since the supplier is only invoked after the terminal operation
+     * commences, any modifications to the source up to the start of the
+     * terminal operation are reflected in the stream result.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param supplier A {@code Supplier} of a {@code Spliterator.OfDouble}
+     * @param characteristics Spliterator characteristics of the supplied
+     *        {@code Spliterator.OfDouble}.  The characteristics must be equal to
+     *        {@code source.get().getCharacteristics()}
+     * @return A new sequential {@code DoubleStream}
+     * @see #doubleStream(Spliterator.OfDouble)
+     */
+    public static DoubleStream doubleStream(Supplier<? extends Spliterator.OfDouble> supplier,
+                                            int characteristics) {
+        return new DoublePipeline.Head<>(supplier,
+                                         StreamOpFlag.fromCharacteristics(characteristics),
+                                         false);
+    }
+
+    /**
+     * Creates a new parallel {@code DoubleStream} from a {@code Supplier} of
+     * {@code Spliterator.OfDouble}.
+     *
+     * <p>The {@link Supplier#get()} method will be invoked on the supplier no
+     * more than once, and after the terminal operation of the stream pipeline
+     * commences.
+     *
+     * <p>For spliterators that report a characteristic of {@code IMMUTABLE}
+     * or {@code CONCURRENT}, or that are
+     * <a href="Spliterator.html#binding">late-binding</a>, it is likely
+     * more efficient to use {@link #doubleStream(Spliterator.OfDouble)} instead.
+     * The use of a {@code Supplier} in this form provides a level of
+     * indirection that reduces the scope of potential interference with the
+     * source.  Since the supplier is only invoked after the terminal operation
+     * commences, any modifications to the source up to the start of the
+     * terminal operation are reflected in the stream result.  See
+     * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+     * more details.
+     *
+     * @param supplier a {@code Supplier} of a {@code Spliterator.OfDouble}
+     * @param characteristics Spliterator characteristics of the supplied
+     *        {@code Spliterator.OfDouble}.  The characteristics must be equal to
+     *        {@code source.get().getCharacteristics()}
+     * @return a new parallel {@code DoubleStream}
+     * @see #doubleParallelStream(Spliterator.OfDouble)
+     */
+    public static DoubleStream doubleParallelStream(Supplier<? extends Spliterator.OfDouble> supplier,
+                                                    int characteristics) {
+        return new DoublePipeline.Head<>(supplier,
+                                         StreamOpFlag.fromCharacteristics(characteristics),
+                                         true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Streams.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,656 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.BiFunction;
+import java.util.function.Consumer;
+import java.util.function.DoubleConsumer;
+import java.util.function.IntConsumer;
+import java.util.function.LongConsumer;
+
+/**
+ * Utility methods for operating on and creating streams.
+ *
+ * <p>Unless otherwise stated, streams are created as sequential streams.  A
+ * sequential stream can be transformed into a parallel stream by calling the
+ * {@code parallel()} method on the created stream.
+ *
+ * @since 1.8
+ */
+class Streams {
+
+    private Streams() {
+        throw new Error("no instances");
+    }
+
+    /**
+     * An object instance representing no value, that cannot be an actual
+     * data element of a stream.  Used when processing streams that can contain
+     * {@code null} elements to distinguish between a {@code null} value and no
+     * value.
+     */
+    static final Object NONE = new Object();
+
+    /**
+     * An {@code int} range spliterator.
+     */
+    static final class RangeIntSpliterator implements Spliterator.OfInt {
+        private int from;
+        private final int upTo;
+        private final int step;
+
+        RangeIntSpliterator(int from, int upTo, int step) {
+            this.from = from;
+            this.upTo = upTo;
+            this.step = step;
+        }
+
+        @Override
+        public boolean tryAdvance(IntConsumer consumer) {
+            boolean hasNext = from < upTo;
+            if (hasNext) {
+                consumer.accept(from);
+                from += step;
+            }
+            return hasNext;
+        }
+
+        @Override
+        public void forEachRemaining(IntConsumer consumer) {
+            int hUpTo = upTo;
+            int hStep = step; // hoist accesses and checks from loop
+            for (int i = from; i < hUpTo; i += hStep)
+                consumer.accept(i);
+            from = upTo;
+        }
+
+        @Override
+        public long estimateSize() {
+            int d = upTo - from;
+            return (d / step) + ((d % step == 0) ? 0 : 1);
+        }
+
+        @Override
+        public int characteristics() {
+            return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED |
+                   Spliterator.IMMUTABLE | Spliterator.NONNULL |
+                   Spliterator.DISTINCT | Spliterator.SORTED;
+        }
+
+        @Override
+        public Comparator<? super Integer> getComparator() {
+            return null;
+        }
+
+        @Override
+        public Spliterator.OfInt trySplit() {
+            return estimateSize() <= 1
+                   ? null
+                   : new RangeIntSpliterator(from, from = from + midPoint(), step);
+        }
+
+        private int midPoint() {
+            // Size is known to be >= 2
+            int bisection = (upTo - from) / 2;
+            // If bisection > step then round down to nearest multiple of step
+            // otherwise round up to step
+            return bisection > step ? bisection - bisection % step : step;
+        }
+    }
+
+    /**
+     * A {@code long} range spliterator.
+     */
+    static final class RangeLongSpliterator implements Spliterator.OfLong {
+        private long from;
+        private final long upTo;
+        private final long step;
+
+        RangeLongSpliterator(long from, long upTo, long step) {
+            this.from = from;
+            this.upTo = upTo;
+            this.step = step;
+        }
+
+        @Override
+        public boolean tryAdvance(LongConsumer consumer) {
+            boolean hasNext = from < upTo;
+            if (hasNext) {
+                consumer.accept(from);
+                from += step;
+            }
+            return hasNext;
+        }
+
+        @Override
+        public void forEachRemaining(LongConsumer consumer) {
+            long hUpTo = upTo;
+            long hStep = step; // hoist accesses and checks from loop
+            for (long i = from; i < hUpTo; i += hStep)
+                consumer.accept(i);
+            from = upTo;
+        }
+
+        @Override
+        public long estimateSize() {
+            long d = upTo - from;
+            return (d / step) + ((d % step == 0) ? 0 : 1);
+        }
+
+        @Override
+        public int characteristics() {
+            return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED |
+                   Spliterator.IMMUTABLE | Spliterator.NONNULL |
+                   Spliterator.DISTINCT | Spliterator.SORTED;
+        }
+
+        @Override
+        public Comparator<? super Long> getComparator() {
+            return null;
+        }
+
+        @Override
+        public Spliterator.OfLong trySplit() {
+            return estimateSize() <= 1
+                   ? null
+                   : new RangeLongSpliterator(from, from = from + midPoint(), step);
+        }
+
+        private long midPoint() {
+            // Size is known to be >= 2
+            long bisection = (upTo - from) / 2;
+            // If bisection > step then round down to nearest multiple of step
+            // otherwise round up to step
+            return bisection > step ? bisection - bisection % step : step;
+        }
+    }
+
+    /**
+     * A {@code double} range spliterator.
+     *
+     * <p>The traversing and splitting logic is equivalent to that of
+     * {@code RangeLongSpliterator} for increasing values with a {@code step} of
+     * {@code 1}.
+     *
+     *  <p>A {@code double} value is calculated from the function
+     * {@code start + i * step} where {@code i} is the absolute position of the
+     * value when traversing an instance of this class that has not been split.
+     * This ensures the same values are produced at the same absolute positions
+     * regardless of how an instance of this class is split or traversed.
+     */
+    static final class RangeDoubleSpliterator implements Spliterator.OfDouble {
+        private final double from;
+        private final double upTo;
+        private final double step;
+
+        private long lFrom;
+        private final long lUpTo;
+
+        RangeDoubleSpliterator(double from, double upTo, double step, long lFrom, long lUpTo) {
+            this.from = from;
+            this.upTo = upTo;
+            this.step = step;
+            this.lFrom = lFrom;
+            this.lUpTo = lUpTo;
+        }
+
+        @Override
+        public boolean tryAdvance(DoubleConsumer consumer) {
+            boolean hasNext = lFrom < lUpTo;
+            if (hasNext) {
+                consumer.accept(from + lFrom * step);
+                lFrom++;
+            }
+            return hasNext;
+        }
+
+        @Override
+        public void forEachRemaining(DoubleConsumer consumer) {
+            double hOrigin = from;
+            double hStep = step;
+            long hLUpTo = lUpTo;
+            long i = lFrom;
+            for (; i < hLUpTo; i++) {
+                consumer.accept(hOrigin + i * hStep);
+            }
+            lFrom = i;
+        }
+
+        @Override
+        public long estimateSize() {
+            return lUpTo - lFrom;
+        }
+
+        @Override
+        public int characteristics() {
+            return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED |
+                   Spliterator.IMMUTABLE | Spliterator.NONNULL |
+                   Spliterator.DISTINCT | Spliterator.SORTED;
+        }
+
+        @Override
+        public Comparator<? super Double> getComparator() {
+            return null;
+        }
+
+        @Override
+        public Spliterator.OfDouble trySplit() {
+            return estimateSize() <= 1
+                   ? null
+                   : new RangeDoubleSpliterator(from, upTo, step, lFrom, lFrom = lFrom + midPoint());
+        }
+
+        private long midPoint() {
+            // Size is known to be >= 2
+            return (lUpTo - lFrom) / 2;
+        }
+    }
+
+    private static abstract class AbstractStreamBuilderImpl<T, S extends Spliterator<T>> implements Spliterator<T> {
+        // >= 0 when building, < 0 when built
+        // -1 == no elements
+        // -2 == one element, held by first
+        // -3 == two or more elements, held by buffer
+        int count;
+
+        // Spliterator implementation for 0 or 1 element
+        // count == -1 for no elements
+        // count == -2 for one element held by first
+
+        @Override
+        public S trySplit() {
+            return null;
+        }
+
+        @Override
+        public long estimateSize() {
+            return -count - 1;
+        }
+
+        @Override
+        public int characteristics() {
+            return Spliterator.SIZED | Spliterator.SUBSIZED |
+                   Spliterator.ORDERED | Spliterator.IMMUTABLE;
+        }
+    }
+
+    static final class StreamBuilderImpl<T>
+            extends AbstractStreamBuilderImpl<T, Spliterator<T>>
+            implements StreamBuilder<T> {
+        // The first element in the stream
+        // valid if count == 1
+        T first;
+
+        // The first and subsequent elements in the stream
+        // non-null if count == 2
+        SpinedBuffer<T> buffer;
+
+        /**
+         * Constructor for building a stream of 0 or more elements.
+         */
+        StreamBuilderImpl() { }
+
+        /**
+         * Constructor for a singleton stream.
+         *
+         * @param t the single element
+         */
+        StreamBuilderImpl(T t) {
+            first = t;
+            count = -2;
+        }
+
+        // StreamBuilder implementation
+
+        @Override
+        public void accept(T t) {
+            if (count == 0) {
+                first = t;
+                count++;
+            }
+            else if (count > 0) {
+                if (buffer == null) {
+                    buffer = new SpinedBuffer<>();
+                    buffer.accept(first);
+                    count++;
+                }
+
+                buffer.accept(t);
+            }
+            else {
+                throw new IllegalStateException();
+            }
+        }
+
+        public StreamBuilder<T> add(T t) {
+            accept(t);
+            return this;
+        }
+
+        @Override
+        public Stream<T> build() {
+            int c = count;
+            if (c >= 0) {
+                // Switch count to negative value signalling the builder is built
+                count = -count - 1;
+                // Use this spliterator if 0 or 1 elements, otherwise use
+                // the spliterator of the spined buffer
+                return (c < 2) ? StreamSupport.stream(this) : StreamSupport.stream(buffer.spliterator());
+            }
+
+            throw new IllegalStateException();
+        }
+
+        // Spliterator implementation for 0 or 1 element
+        // count == -1 for no elements
+        // count == -2 for one element held by first
+
+        @Override
+        public boolean tryAdvance(Consumer<? super T> action) {
+            if (count == -2) {
+                action.accept(first);
+                count = -1;
+                return true;
+            }
+            else {
+                return false;
+            }
+        }
+
+        @Override
+        public void forEachRemaining(Consumer<? super T> action) {
+            if (count == -2) {
+                action.accept(first);
+                count = -1;
+            }
+        }
+    }
+
+    static final class IntStreamBuilderImpl
+            extends AbstractStreamBuilderImpl<Integer, Spliterator.OfInt>
+            implements StreamBuilder.OfInt, Spliterator.OfInt {
+        // The first element in the stream
+        // valid if count == 1
+        int first;
+
+        // The first and subsequent elements in the stream
+        // non-null if count == 2
+        SpinedBuffer.OfInt buffer;
+
+        /**
+         * Constructor for building a stream of 0 or more elements.
+         */
+        IntStreamBuilderImpl() { }
+
+        /**
+         * Constructor for a singleton stream.
+         *
+         * @param t the single element
+         */
+        IntStreamBuilderImpl(int t) {
+            first = t;
+            count = -2;
+        }
+
+        // StreamBuilder implementation
+
+        @Override
+        public void accept(int t) {
+            if (count == 0) {
+                first = t;
+                count++;
+            }
+            else if (count > 0) {
+                if (buffer == null) {
+                    buffer = new SpinedBuffer.OfInt();
+                    buffer.accept(first);
+                    count++;
+                }
+
+                buffer.accept(t);
+            }
+            else {
+                throw new IllegalStateException();
+            }
+        }
+
+        @Override
+        public IntStream build() {
+            int c = count;
+            if (c >= 0) {
+                // Switch count to negative value signalling the builder is built
+                count = -count - 1;
+                // Use this spliterator if 0 or 1 elements, otherwise use
+                // the spliterator of the spined buffer
+                return (c < 2) ? StreamSupport.intStream(this) : StreamSupport.intStream(buffer.spliterator());
+            }
+
+            throw new IllegalStateException();
+        }
+
+        // Spliterator implementation for 0 or 1 element
+        // count == -1 for no elements
+        // count == -2 for one element held by first
+
+        @Override
+        public boolean tryAdvance(IntConsumer action) {
+            if (count == -2) {
+                action.accept(first);
+                count = -1;
+                return true;
+            }
+            else {
+                return false;
+            }
+        }
+
+        @Override
+        public void forEachRemaining(IntConsumer action) {
+            if (count == -2) {
+                action.accept(first);
+                count = -1;
+            }
+        }
+    }
+
+    static final class LongStreamBuilderImpl
+            extends AbstractStreamBuilderImpl<Long, Spliterator.OfLong>
+            implements StreamBuilder.OfLong, Spliterator.OfLong {
+        // The first element in the stream
+        // valid if count == 1
+        long first;
+
+        // The first and subsequent elements in the stream
+        // non-null if count == 2
+        SpinedBuffer.OfLong buffer;
+
+        /**
+         * Constructor for building a stream of 0 or more elements.
+         */
+        LongStreamBuilderImpl() { }
+
+        /**
+         * Constructor for a singleton stream.
+         *
+         * @param t the single element
+         */
+        LongStreamBuilderImpl(long t) {
+            first = t;
+            count = -2;
+        }
+
+        // StreamBuilder implementation
+
+        @Override
+        public void accept(long t) {
+            if (count == 0) {
+                first = t;
+                count++;
+            }
+            else if (count > 0) {
+                if (buffer == null) {
+                    buffer = new SpinedBuffer.OfLong();
+                    buffer.accept(first);
+                    count++;
+                }
+
+                buffer.accept(t);
+            }
+            else {
+                throw new IllegalStateException();
+            }
+        }
+
+        @Override
+        public LongStream build() {
+            int c = count;
+            if (c >= 0) {
+                // Switch count to negative value signalling the builder is built
+                count = -count - 1;
+                // Use this spliterator if 0 or 1 elements, otherwise use
+                // the spliterator of the spined buffer
+                return (c < 2) ? StreamSupport.longStream(this) : StreamSupport.longStream(buffer.spliterator());
+            }
+
+            throw new IllegalStateException();
+        }
+
+        // Spliterator implementation for 0 or 1 element
+        // count == -1 for no elements
+        // count == -2 for one element held by first
+
+        @Override
+        public boolean tryAdvance(LongConsumer action) {
+            if (count == -2) {
+                action.accept(first);
+                count = -1;
+                return true;
+            }
+            else {
+                return false;
+            }
+        }
+
+        @Override
+        public void forEachRemaining(LongConsumer action) {
+            if (count == -2) {
+                action.accept(first);
+                count = -1;
+            }
+        }
+    }
+
+    static final class DoubleStreamBuilderImpl
+            extends AbstractStreamBuilderImpl<Double, Spliterator.OfDouble>
+            implements StreamBuilder.OfDouble, Spliterator.OfDouble {
+        // The first element in the stream
+        // valid if count == 1
+        double first;
+
+        // The first and subsequent elements in the stream
+        // non-null if count == 2
+        SpinedBuffer.OfDouble buffer;
+
+        /**
+         * Constructor for building a stream of 0 or more elements.
+         */
+        DoubleStreamBuilderImpl() { }
+
+        /**
+         * Constructor for a singleton stream.
+         *
+         * @param t the single element
+         */
+        DoubleStreamBuilderImpl(double t) {
+            first = t;
+            count = -2;
+        }
+
+        // StreamBuilder implementation
+
+        @Override
+        public void accept(double t) {
+            if (count == 0) {
+                first = t;
+                count++;
+            }
+            else if (count > 0) {
+                if (buffer == null) {
+                    buffer = new SpinedBuffer.OfDouble();
+                    buffer.accept(first);
+                    count++;
+                }
+
+                buffer.accept(t);
+            }
+            else {
+                throw new IllegalStateException();
+            }
+        }
+
+        @Override
+        public DoubleStream build() {
+            int c = count;
+            if (c >= 0) {
+                // Switch count to negative value signalling the builder is built
+                count = -count - 1;
+                // Use this spliterator if 0 or 1 elements, otherwise use
+                // the spliterator of the spined buffer
+                return (c < 2) ? StreamSupport.doubleStream(this) : StreamSupport.doubleStream(buffer.spliterator());
+            }
+
+            throw new IllegalStateException();
+        }
+
+        // Spliterator implementation for 0 or 1 element
+        // count == -1 for no elements
+        // count == -2 for one element held by first
+
+        @Override
+        public boolean tryAdvance(DoubleConsumer action) {
+            if (count == -2) {
+                action.accept(first);
+                count = -1;
+                return true;
+            }
+            else {
+                return false;
+            }
+        }
+
+        @Override
+        public void forEachRemaining(DoubleConsumer action) {
+            if (count == -2) {
+                action.accept(first);
+                count = -1;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/TerminalOp.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.Spliterator;
+
+/**
+ * An operation in a stream pipeline that takes a stream as input and produces
+ * a result or side-effect.  A {@code TerminalOp} has an input type and stream
+ * shape, and a result type.  A {@code TerminalOp} also has a set of
+ * <em>operation flags</em> that describes how the operation processes elements
+ * of the stream (such as short-circuiting or respecting encounter order; see
+ * {@link StreamOpFlag}).
+ *
+ * <p>A {@code TerminalOp} must provide a sequential and parallel implementation
+ * of the operation relative to a given stream source and set of intermediate
+ * operations.
+ *
+ * @param <E_IN> the type of input elements
+ * @param <R>    the type of the result
+ * @since 1.8
+ */
+interface TerminalOp<E_IN, R> {
+    /**
+     * Gets the shape of the input type of this operation.
+     *
+     * @implSpec The default returns {@code StreamShape.REFERENCE}.
+     *
+     * @return StreamShape of the input type of this operation
+     */
+    default StreamShape inputShape() { return StreamShape.REFERENCE; }
+
+    /**
+     * Gets the stream flags of the operation.  Terminal operations may set a
+     * limited subset of the stream flags defined in {@link StreamOpFlag}, and
+     * these flags are combined with the previously combined stream and
+     * intermediate operation flags for the pipeline.
+     *
+     * @implSpec The default implementation returns zero.
+     *
+     * @return the stream flags for this operation
+     * @see StreamOpFlag
+     */
+    default int getOpFlags() { return 0; }
+
+    /**
+     * Performs a parallel evaluation of the operation using the specified
+     * {@code PipelineHelper}, which describes the upstream intermediate
+     * operations.
+     *
+     * @implSpec The default performs a sequential evaluation of the operation
+     * using the specified {@code PipelineHelper}.
+     *
+     * @param helper the pipeline helper
+     * @param spliterator the source spliterator
+     * @return the result of the evaluation
+     */
+    default <P_IN> R evaluateParallel(PipelineHelper<E_IN> helper,
+                                      Spliterator<P_IN> spliterator) {
+        if (Tripwire.ENABLED)
+            Tripwire.trip(getClass(), "{0} triggering TerminalOp.evaluateParallel serial default");
+        return evaluateSequential(helper, spliterator);
+    }
+
+    /**
+     * Performs a sequential evaluation of the operation using the specified
+     * {@code PipelineHelper}, which describes the upstream intermediate
+     * operations.
+     *
+     * @param helper the pipeline helper
+     * @param spliterator the source spliterator
+     * @return the result of the evaluation
+     */
+    <P_IN> R evaluateSequential(PipelineHelper<E_IN> helper,
+                                Spliterator<P_IN> spliterator);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/TerminalSink.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.util.function.Supplier;
+
+/**
+ * A {@link Sink} which accumulates state as elements are accepted, and allows
+ * a result to be retrieved after the computation is finished.
+ *
+ * @param <T> the type of elements to be accepted
+ * @param <R> the type of the result
+ *
+ * @since 1.8
+ */
+interface TerminalSink<T, R> extends Sink<T>, Supplier<R> { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/Tripwire.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 java.util.stream;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import sun.util.logging.PlatformLogger;
+
+/**
+ * Utility class for detecting inadvertent uses of boxing in
+ * {@code java.util.stream} classes.  The detection is turned on or off based on
+ * whether the system property {@code org.openjdk.java.util.stream.tripwire} is
+ * considered {@code true} according to {@link Boolean#getBoolean(String)}.
+ * This should normally be turned off for production use.
+ *
+ * @apiNote
+ * Typical usage would be for boxing code to do:
+ * <pre>{@code
+ *     if (Tripwire.ENABLED)
+ *         Tripwire.trip(getClass(), "{0} calling Sink.OfInt.accept(Integer)");
+ * }</pre>
+ *
+ * @since 1.8
+ */
+final class Tripwire {
+    private static final String TRIPWIRE_PROPERTY = "org.openjdk.java.util.stream.tripwire";
+
+    /** Should debugging checks be enabled? */
+    static final boolean ENABLED = AccessController.doPrivileged(
+            (PrivilegedAction<Boolean>) () -> Boolean.getBoolean(TRIPWIRE_PROPERTY));
+
+    private Tripwire() { }
+
+    /**
+     * Produces a log warning, using {@code PlatformLogger.getLogger(className)},
+     * using the supplied message.  The class name of {@code trippingClass} will
+     * be used as the first parameter to the message.
+     *
+     * @param trippingClass Name of the class generating the message
+     * @param msg A message format string of the type expected by
+     * {@link PlatformLogger}
+     */
+    static void trip(Class<?> trippingClass, String msg) {
+        PlatformLogger.getLogger(trippingClass.getName()).warning(msg, trippingClass.getName());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/util/stream/package-info.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,566 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/**
+ * <h1>java.util.stream</h1>
+ *
+ * Classes to support functional-style operations on streams of values, as in the following:
+ *
+ * <pre>{@code
+ *     int sumOfWeights = blocks.stream().filter(b -> b.getColor() == RED)
+ *                                       .mapToInt(b -> b.getWeight())
+ *                                       .sum();
+ * }</pre>
+ *
+ * <p>Here we use {@code blocks}, which might be a {@code Collection}, as a source for a stream,
+ * and then perform a filter-map-reduce ({@code sum()} is an example of a <a href="package-summary.html#Reduction">reduction</a>
+ * operation) on the stream to obtain the sum of the weights of the red blocks.
+ *
+ * <p>The key abstraction used in this approach is {@link java.util.stream.Stream}, as well as its primitive
+ * specializations {@link java.util.stream.IntStream}, {@link java.util.stream.LongStream},
+ * and {@link java.util.stream.DoubleStream}.  Streams differ from Collections in several ways:
+ *
+ * <ul>
+ *     <li>No storage.  A stream is not a data structure that stores elements; instead, they
+ *     carry values from a source (which could be a data structure, a generator, an IO channel, etc)
+ *     through a pipeline of computational operations.</li>
+ *     <li>Functional in nature.  An operation on a stream produces a result, but does not modify
+ *     its underlying data source.  For example, filtering a {@code Stream} produces a new {@code Stream},
+ *     rather than removing elements from the underlying source.</li>
+ *     <li>Laziness-seeking.  Many stream operations, such as filtering, mapping, or duplicate removal,
+ *     can be implemented lazily, exposing opportunities for optimization.  (For example, "find the first
+ *     {@code String} matching a pattern" need not examine all the input strings.)  Stream operations
+ *     are divided into intermediate ({@code Stream}-producing) operations and terminal (value-producing)
+ *     operations; all intermediate operations are lazy.</li>
+ *     <li>Possibly unbounded.  While collections have a finite size, streams need not.  Operations
+ *     such as {@code limit(n)} or {@code findFirst()} can allow computations on infinite streams
+ *     to complete in finite time.</li>
+ * </ul>
+ *
+ * <h2><a name="StreamPipelines">Stream pipelines</a></h2>
+ *
+ * <p>Streams are used to create <em>pipelines</em> of <a href="package-summary.html#StreamOps">operations</a>.  A
+ * complete stream pipeline has several components: a source (which may be a {@code Collection},
+ * an array, a generator function, or an IO channel); zero or more <em>intermediate operations</em>
+ * such as {@code Stream.filter} or {@code Stream.map}; and a <em>terminal operation</em> such
+ * as {@code Stream.forEach} or {@code java.util.stream.Stream.reduce}.  Stream operations may take as parameters
+ * <em>function values</em> (which are often lambda expressions, but could be method references
+ * or objects) which parameterize the behavior of the operation, such as a {@code Predicate}
+ * passed to the {@code Stream#filter} method.
+ *
+ * <p>Intermediate operations return a new {@code Stream}.  They are lazy; executing an
+ * intermediate operation such as {@link java.util.stream.Stream#filter Stream.filter} does
+ * not actually perform any filtering, instead creating a new {@code Stream} that, when
+ * traversed, contains the elements of the initial {@code Stream} that match the
+ * given {@code Predicate}.  Consuming elements from the  stream source does not
+ * begin until the terminal operation is executed.
+ *
+ * <p>Terminal operations consume the {@code Stream} and produce a result or a side-effect.
+ * After a terminal operation is performed, the stream can no longer be used and you must
+ * return to the data source, or select a new data source, to get a new stream. For example,
+ * obtaining the sum of weights of all red blocks, and then of all blue blocks, requires a
+ * filter-map-reduce on two different streams:
+ * <pre>{@code
+ *     int sumOfRedWeights  = blocks.stream().filter(b -> b.getColor() == RED)
+ *                                           .mapToInt(b -> b.getWeight())
+ *                                           .sum();
+ *     int sumOfBlueWeights = blocks.stream().filter(b -> b.getColor() == BLUE)
+ *                                           .mapToInt(b -> b.getWeight())
+ *                                           .sum();
+ * }</pre>
+ *
+ * <p>However, there are other techniques that allow you to obtain both results in a single
+ * pass if multiple traversal is impractical or inefficient.  TODO provide link
+ *
+ * <h3><a name="StreamOps">Stream operations</a></h3>
+ *
+ * <p>Intermediate stream operation (such as {@code filter} or {@code sorted}) always produce a
+ * new {@code Stream}, and are always<em>lazy</em>.  Executing a lazy operations does not
+ * trigger processing of the stream contents; all processing is deferred until the terminal
+ * operation commences.  Processing streams lazily allows for significant efficiencies; in a
+ * pipeline such as the filter-map-sum example above, filtering, mapping, and addition can be
+ * fused into a single pass, with minimal intermediate state.  Laziness also enables us to avoid
+ * examining all the data when it is not necessary; for operations such as "find the first
+ * string longer than 1000 characters", one need not examine all the input strings, just enough
+ * to find one that has the desired characteristics.  (This behavior becomes even more important
+ * when the input stream is infinite and not merely large.)
+ *
+ * <p>Intermediate operations are further divided into <em>stateless</em> and <em>stateful</em>
+ * operations.  Stateless operations retain no state from previously seen values when processing
+ * a new value; examples of stateless intermediate operations include {@code filter} and
+ * {@code map}.  Stateful operations may incorporate state from previously seen elements in
+ * processing new values; examples of stateful intermediate operations include {@code distinct}
+ * and {@code sorted}.  Stateful operations may need to process the entire input before
+ * producing a result; for example, one cannot produce any results from sorting a stream until
+ * one has seen all elements of the stream.  As a result, under parallel computation, some
+ * pipelines containing stateful intermediate operations have to be executed in multiple passes.
+ * Pipelines containing exclusively stateless intermediate operations can be processed in a
+ * single pass, whether sequential or parallel.
+ *
+ * <p>Further, some operations are deemed <em>short-circuiting</em> operations.  An intermediate
+ * operation is short-circuiting if, when presented with infinite input, it may produce a
+ * finite stream as a result.  A terminal operation is short-circuiting if, when presented with
+ * infinite input, it may terminate in finite time.  (Having a short-circuiting operation is a
+ * necessary, but not sufficient, condition for the processing of an infinite stream to
+ * terminate normally in finite time.)
+ *
+ * Terminal operations (such as {@code forEach} or {@code findFirst}) are always eager
+ * (they execute completely before returning), and produce a non-{@code Stream} result, such
+ * as a primitive value or a {@code Collection}, or have side-effects.
+ *
+ * <h3>Parallelism</h3>
+ *
+ * <p>By recasting aggregate operations as a pipeline of operations on a stream of values, many
+ * aggregate operations can be more easily parallelized.  A {@code Stream} can execute either
+ * in serial or in parallel.  When streams are created, they are either created as sequential
+ * or parallel streams; the parallel-ness of streams can also be switched by the
+ * {@link java.util.stream Stream#sequential()} and {@link java.util.stream.Stream#parallel()}
+ * operations.  The {@code Stream} implementations in the JDK create serial streams unless
+ * parallelism is explicitly requested.  For example, {@code Collection} has methods
+ * {@link java.util.Collection#stream} and {@link java.util.Collection#parallelStream},
+ * which produce sequential and parallel streams respectively; other stream-bearing methods
+ * such as {@link java.util.stream.Streams#intRange(int, int)} produce sequential
+ * streams but these can be efficiently parallelized by calling {@code parallel()} on the
+ * result. The set of operations on serial and parallel streams is identical. To execute the
+ * "sum of weights of blocks" query in parallel, we would do:
+ *
+ * <pre>{@code
+ *     int sumOfWeights = blocks.parallelStream().filter(b -> b.getColor() == RED)
+ *                                               .mapToInt(b -> b.getWeight())
+ *                                               .sum();
+ * }</pre>
+ *
+ * <p>The only difference between the serial and parallel versions of this example code is
+ * the creation of the initial {@code Stream}.  Whether a {@code Stream} will execute in serial
+ * or parallel can be determined by the {@code Stream#isParallel} method.  When the terminal
+ * operation is initiated, the entire stream pipeline is either executed sequentially or in
+ * parallel, determined by the last operation that affected the stream's serial-parallel
+ * orientation (which could be the stream source, or the {@code sequential()} or
+ * {@code parallel()} methods.)
+ *
+ * <p>In order for the results of parallel operations to be deterministic and consistent with
+ * their serial equivalent, the function values passed into the various stream operations should
+ * be <a href="#NonInteference"><em>stateless</em></a>.
+ *
+ * <h3><a name="Ordering">Ordering</a></h3>
+ *
+ * <p>Streams may or may not have an <em>encounter order</em>.  An encounter
+ * order specifies the order in which elements are provided by the stream to the
+ * operations pipeline.  Whether or not there is an encounter order depends on
+ * the source, the intermediate  operations, and the terminal operation.
+ * Certain stream sources (such as {@code List} or arrays) are intrinsically
+ * ordered, whereas others (such as {@code HashSet}) are not.  Some intermediate
+ * operations may impose an encounter order on an otherwise unordered stream,
+ * such as {@link java.util.stream.Stream#sorted()}, and others may render an
+ * ordered stream unordered (such as {@link java.util.stream.Stream#unordered()}).
+ * Some terminal operations may ignore encounter order, such as
+ * {@link java.util.stream.Stream#forEach}.
+ *
+ * <p>If a Stream is ordered, most operations are constrained to operate on the
+ * elements in their encounter order; if the source of a stream is a {@code List}
+ * containing {@code [1, 2, 3]}, then the result of executing {@code map(x -> x*2)}
+ * must be {@code [2, 4, 6]}.  However, if the source has no defined encounter
+ * order, than any of the six permutations of the values {@code [2, 4, 6]} would
+ * be a valid result. Many operations can still be efficiently parallelized even
+ * under ordering constraints.
+ *
+ * <p>For sequential streams, ordering is only relevant to the determinism
+ * of operations performed repeatedly on the same source.  (An {@code ArrayList}
+ * is constrained to iterate elements in order; a {@code HashSet} is not, and
+ * repeated iteration might produce a different order.)
+ *
+ * <p>For parallel streams, relaxing the ordering constraint can enable
+ * optimized implementation for some operations.  For example, duplicate
+ * filtration on an ordered stream must completely process the first partition
+ * before it can return any elements from a subsequent partition, even if those
+ * elements are available earlier.  On the other hand, without the constraint of
+ * ordering, duplicate filtration can be done more efficiently by using
+ * a shared {@code ConcurrentHashSet}.  There will be cases where the stream
+ * is structurally ordered (the source is ordered and the intermediate
+ * operations are order-preserving), but the user does not particularly care
+ * about the encounter order.  In some cases, explicitly de-ordering the stream
+ * with the {@link java.util.stream.Stream#unordered()} method may result in
+ * improved parallel performance for some stateful or terminal operations.
+ *
+ * <h3><a name="Non-Interference">Non-interference</a></h3>
+ *
+ * The {@code java.util.stream} package enables you to execute possibly-parallel
+ * bulk-data operations over a variety of data sources, including even non-thread-safe
+ * collections such as {@code ArrayList}.  This is possible only if we can
+ * prevent <em>interference</em> with the data source during the execution of a
+ * stream pipeline.  (Execution begins when the terminal operation is invoked, and ends
+ * when the terminal operation completes.)  For most data sources, preventing interference
+ * means ensuring that the data source is <em>not modified at all</em> during the execution
+ * of the stream pipeline.  (Some data sources, such as concurrent collections, are
+ * specifically designed to handle concurrent modification.)
+ *
+ * <p>Accordingly, lambda expressions (or other objects implementing the appropriate functional
+ * interface) passed to stream methods should never modify the stream's data source.  An
+ * implementation is said to <em>interfere</em> with the data source if it modifies, or causes
+ * to be modified, the stream's data source.  The need for non-interference applies to all
+ * pipelines, not just parallel ones.  Unless the stream source is concurrent, modifying a
+ * stream's data source during execution of a stream pipeline can cause exceptions, incorrect
+ * answers, or nonconformant results.
+ *
+ * <p>Further, results may be nondeterministic or incorrect if the lambda expressions passed to
+ * stream operations are <em>stateful</em>.  A stateful lambda (or other object implementing the
+ * appropriate functional interface) is one whose result depends on any state which might change
+ * during the execution of the stream pipeline.  An example of a stateful lambda is:
+ * <pre>{@code
+ *     Set<Integer> seen = Collections.synchronizedSet(new HashSet<>());
+ *     stream.parallel().map(e -> { if (seen.add(e)) return 0; else return e; })...
+ * }</pre>
+ * Here, if the mapping operation is performed in parallel, the results for the same input
+ * could vary from run to run, due to thread scheduling differences, whereas, with a stateless
+ * lambda expression the results would always be the same.
+ *
+ * <h3>Side-effects</h3>
+ *
+ * <h2><a name="Reduction">Reduction operations</a></h2>
+ *
+ * A <em>reduction</em> operation takes a stream of elements and processes them in a way
+ * that reduces to a single value or summary description, such as finding the sum or maximum
+ * of a set of numbers.  (In more complex scenarios, the reduction operation might need to
+ * extract data from the elements before reducing that data to a single value, such as
+ * finding the sum of weights of a set of blocks.  This would require extracting the weight
+ * from each block before summing up the weights.)
+ *
+ * <p>Of course, such operations can be readily implemented as simple sequential loops, as in:
+ * <pre>{@code
+ *    int sum = 0;
+ *    for (int x : numbers) {
+ *       sum += x;
+ *    }
+ * }</pre>
+ * However, there may be a significant advantage to preferring a {@link java.util.stream.Stream#reduce reduce operation}
+ * over a mutative accumulation such as the above -- a properly constructed reduce operation is
+ * inherently parallelizable so long as the
+ * {@link java.util.function.BinaryOperator reduction operaterator}
+ * has the right characteristics. Specifically the operator must be
+ * <a href="#Associativity">associative</a>.  For example, given a
+ * stream of numbers for which we want to find the sum, we can write:
+ * <pre>{@code
+ *    int sum = numbers.reduce(0, (x,y) -> x+y);
+ * }</pre>
+ * or more succinctly:
+ * <pre>{@code
+ *    int sum = numbers.reduce(0, Integer::sum);
+ * }</pre>
+ *
+ * <p>(The primitive specializations of {@link java.util.stream.Stream}, such as
+ * {@link java.util.stream.IntStream}, even have convenience methods for common reductions,
+ * such as {@link java.util.stream.IntStream#sum() sum} and {@link java.util.stream.IntStream#max() max},
+ * which are implemented as simple wrappers around reduce.)
+ *
+ * <p>Reduction parallellizes well since the implementation of {@code reduce} can operate on
+ * subsets of the stream in parallel, and then combine the intermediate results to get the final
+ * correct answer.  Even if you were to use a parallelizable form of the
+ * {@link java.util.stream.Stream#forEach(Consumer) forEach()} method
+ * in place of the original for-each loop above, you would still have to provide thread-safe
+ * updates to the shared accumulating variable {@code sum}, and the required synchronization
+ * would likely eliminate any performance gain from parallelism. Using a {@code reduce} method
+ * instead removes all of the burden of parallelizing the reduction operation, and the library
+ * can provide an efficient parallel implementation with no additional synchronization needed.
+ *
+ * <p>The "blocks" examples shown earlier shows how reduction combines with other operations
+ * to replace for loops with bulk operations.  If {@code blocks} is a collection of {@code Block}
+ * objects, which have a {@code getWeight} method, we can find the heaviest block with:
+ * <pre>{@code
+ *     OptionalInt heaviest = blocks.stream()
+ *                                  .mapToInt(Block::getWeight)
+ *                                  .reduce(Integer::max);
+ * }</pre>
+ *
+ * <p>In its more general form, a {@code reduce} operation on elements of type {@code <T>}
+ * yielding a result of type {@code <U>} requires three parameters:
+ * <pre>{@code
+ * <U> U reduce(U identity,
+ *              BiFunction<U, ? super T, U> accumlator,
+ *              BinaryOperator<U> combiner);
+ * }</pre>
+ * Here, the <em>identity</em> element is both an initial seed for the reduction, and a default
+ * result if there are no elements. The <em>accumulator</em> function takes a partial result and
+ * the next element, and produce a new partial result. The <em>combiner</em> function combines
+ * the partial results of two accumulators to produce a new partial result, and eventually the
+ * final result.
+ *
+ * <p>This form is a generalization of the two-argument form, and is also a generalization of
+ * the map-reduce construct illustrated above.  If we wanted to re-cast the simple {@code sum}
+ * example using the more general form, {@code 0} would be the identity element, while
+ * {@code Integer::sum} would be both the accumulator and combiner. For the sum-of-weights
+ * example, this could be re-cast as:
+ * <pre>{@code
+ *     int sumOfWeights = blocks.stream().reduce(0,
+ *                                               (sum, b) -> sum + b.getWeight())
+ *                                               Integer::sum);
+ * }</pre>
+ * though the map-reduce form is more readable and generally preferable.  The generalized form
+ * is provided for cases where significant work can be optimized away by combining mapping and
+ * reducing into a single function.
+ *
+ * <p>More formally, the {@code identity} value must be an <em>identity</em> for the combiner
+ * function. This means that for all {@code u}, {@code combiner.apply(identity, u)} is equal
+ * to {@code u}. Additionally, the {@code combiner} function must be
+ * <a href="#Associativity">associative</a> and must be compatible with the {@code accumulator}
+ * function; for all {@code u} and {@code t}, the following must hold:
+ * <pre>{@code
+ *     combiner.apply(u, accumulator.apply(identity, t)) == accumulator.apply(u, t)
+ * }</pre>
+ *
+ * <h3><a name="MutableReduction">Mutable Reduction</a></h3>
+ *
+ * A <em>mutable</em> reduction operation is similar to an ordinary reduction, in that it reduces
+ * a stream of values to a single value, but instead of producing a distinct single-valued result, it
+ * mutates a general <em>result container</em>, such as a {@code Collection} or {@code StringBuilder},
+ * as it processes the elements in the stream.
+ *
+ * <p>For example, if we wanted to take a stream of strings and concatenate them into a single
+ * long string, we <em>could</em> achieve this with ordinary reduction:
+ * <pre>{@code
+ *     String concatenated = strings.reduce("", String::concat)
+ * }</pre>
+ *
+ * We would get the desired result, and it would even work in parallel.  However, we might not
+ * be happy about the performance!  Such an implementation would do a great deal of string
+ * copying, and the run time would be <em>O(n^2)</em> in the number of elements.  A more
+ * performant approach would be to accumulate the results into a {@link java.lang.StringBuilder}, which
+ * is a mutable container for accumulating strings.  We can use the same technique to
+ * parallelize mutable reduction as we do with ordinary reduction.
+ *
+ * <p>The mutable reduction operation is called {@link java.util.stream.Stream#collect(Collector) collect()}, as it
+ * collects together the desired results into a result container such as {@code StringBuilder}.
+ * A {@code collect} operation requires three things: a factory function which will construct
+ * new instances of the result container, an accumulating function that will update a result
+ * container by incorporating a new element, and a combining function that can take two
+ * result containers and merge their contents.  The form of this is very similar to the general
+ * form of ordinary reduction:
+ * <pre>{@code
+ * <R> R collect(Supplier<R> resultFactory,
+ *               BiConsumer<R, ? super T> accumulator,
+ *               BiConsumer<R, R> combiner);
+ * }</pre>
+ * As with {@code reduce()}, the benefit of expressing {@code collect} in this abstract way is
+ * that it is directly amenable to parallelization: we can accumulate partial results in parallel
+ * and then combine them.  For example, to collect the String representations of the elements
+ * in a stream into an {@code ArrayList}, we could write the obvious sequential for-each form:
+ * <pre>{@code
+ *     ArrayList<String> strings = new ArrayList<>();
+ *     for (T element : stream) {
+ *         strings.add(element.toString());
+ *     }
+ * }</pre>
+ * Or we could use a parallelizable collect form:
+ * <pre>{@code
+ *     ArrayList<String> strings = stream.collect(() -> new ArrayList<>(),
+ *                                                (c, e) -> c.add(e.toString()),
+ *                                                (c1, c2) -> c1.addAll(c2));
+ * }</pre>
+ * or, noting that we have buried a mapping operation inside the accumulator function, more
+ * succinctly as:
+ * <pre>{@code
+ *     ArrayList<String> strings = stream.map(Object::toString)
+ *                                       .collect(ArrayList::new, ArrayList::add, ArrayList::addAll);
+ * }</pre>
+ * Here, our supplier is just the {@link java.util.ArrayList#ArrayList() ArrayList constructor}, the
+ * accumulator adds the stringified element to an {@code ArrayList}, and the combiner simply
+ * uses {@link java.util.ArrayList#addAll addAll} to copy the strings from one container into the other.
+ *
+ * <p>As with the regular reduction operation, the ability to parallelize only comes if an
+ * <a href="package-summary.html#Associativity">associativity</a> condition is met. The {@code combiner} is associative
+ * if for result containers {@code r1}, {@code r2}, and {@code r3}:
+ * <pre>{@code
+ *    combiner.accept(r1, r2);
+ *    combiner.accept(r1, r3);
+ * }</pre>
+ * is equivalent to
+ * <pre>{@code
+ *    combiner.accept(r2, r3);
+ *    combiner.accept(r1, r2);
+ * }</pre>
+ * where equivalence means that {@code r1} is left in the same state (according to the meaning
+ * of {@link java.lang.Object#equals equals} for the element types). Similarly, the {@code resultFactory}
+ * must act as an <em>identity</em> with respect to the {@code combiner} so that for any result
+ * container {@code r}:
+ * <pre>{@code
+ *     combiner.accept(r, resultFactory.get());
+ * }</pre>
+ * does not modify the state of {@code r} (again according to the meaning of
+ * {@link java.lang.Object#equals equals}). Finally, the {@code accumulator} and {@code combiner} must be
+ * compatible such that for a result container {@code r} and element {@code t}:
+ * <pre>{@code
+ *    r2 = resultFactory.get();
+ *    accumulator.accept(r2, t);
+ *    combiner.accept(r, r2);
+ * }</pre>
+ * is equivalent to:
+ * <pre>{@code
+ *    accumulator.accept(r,t);
+ * }</pre>
+ * where equivalence means that {@code r} is left in the same state (again according to the
+ * meaning of {@link java.lang.Object#equals equals}).
+ *
+ * <p> The three aspects of {@code collect}: supplier, accumulator, and combiner, are often very
+ * tightly coupled, and it is convenient to introduce the notion of a {@link java.util.stream.Collector} as
+ * being an object that embodies all three aspects. There is a {@link java.util.stream.Stream#collect(Collector) collect}
+ * method that simply takes a {@code Collector} and returns the resulting container.
+ * The above example for collecting strings into a {@code List} can be rewritten using a
+ * standard {@code Collector} as:
+ * <pre>{@code
+ *     ArrayList<String> strings = stream.map(Object::toString)
+ *                                       .collect(Collectors.toList());
+ * }</pre>
+ *
+ * <h3><a name="ConcurrentReduction">Reduction, Concurrency, and Ordering</a></h3>
+ *
+ * With some complex reduction operations, for example a collect that produces a
+ * {@code Map}, such as:
+ * <pre>{@code
+ *     Map<Buyer, List<Transaction>> salesByBuyer
+ *         = txns.parallelStream()
+ *               .collect(Collectors.groupingBy(Transaction::getBuyer));
+ * }</pre>
+ * (where {@link java.util.stream.Collectors#groupingBy} is a utility function
+ * that returns a {@link java.util.stream.Collector} for grouping sets of elements based on some key)
+ * it may actually be counterproductive to perform the operation in parallel.
+ * This is because the combining step (merging one {@code Map} into another by key)
+ * can be expensive for some {@code Map} implementations.
+ *
+ * <p>Suppose, however, that the result container used in this reduction
+ * was a concurrently modifiable collection -- such as a
+ * {@link java.util.concurrent.ConcurrentHashMap ConcurrentHashMap}. In that case,
+ * the parallel invocations of the accumulator could actually deposit their results
+ * concurrently into the same shared result container, eliminating the need for the combiner to
+ * merge distinct result containers. This potentially provides a boost
+ * to the parallel execution performance. We call this a <em>concurrent</em> reduction.
+ *
+ * <p>A {@link java.util.stream.Collector} that supports concurrent reduction is marked with the
+ * {@link java.util.stream.Collector.Characteristics#CONCURRENT} characteristic.
+ * Having a concurrent collector is a necessary condition for performing a
+ * concurrent reduction, but that alone is not sufficient. If you imagine multiple
+ * accumulators depositing results into a shared container, the order in which
+ * results are deposited is non-deterministic. Consequently, a concurrent reduction
+ * is only possible if ordering is not important for the stream being processed.
+ * The {@link java.util.stream.Stream#collect(Collector)}
+ * implementation will only perform a concurrent reduction if
+ * <ul>
+ * <li>The stream is parallel;</li>
+ * <li>The collector has the
+ * {@link java.util.stream.Collector.Characteristics#CONCURRENT} characteristic,
+ * and;</li>
+ * <li>Either the stream is unordered, or the collector has the
+ * {@link java.util.stream.Collector.Characteristics#UNORDERED} characteristic.
+ * </ul>
+ * For example:
+ * <pre>{@code
+ *     Map<Buyer, List<Transaction>> salesByBuyer
+ *         = txns.parallelStream()
+ *               .unordered()
+ *               .collect(groupingByConcurrent(Transaction::getBuyer));
+ * }</pre>
+ * (where {@link java.util.stream.Collectors#groupingByConcurrent} is the concurrent companion
+ * to {@code groupingBy}).
+ *
+ * <p>Note that if it is important that the elements for a given key appear in the
+ * order they appear in the source, then we cannot use a concurrent reduction,
+ * as ordering is one of the casualties of concurrent insertion.  We would then
+ * be constrained to implement either a sequential reduction or a merge-based
+ * parallel reduction.
+ *
+ * <h2><a name="Associativity">Associativity</a></h2>
+ *
+ * An operator or function {@code op} is <em>associative</em> if the following holds:
+ * <pre>{@code
+ *     (a op b) op c == a op (b op c)
+ * }</pre>
+ * The importance of this to parallel evaluation can be seen if we expand this to four terms:
+ * <pre>{@code
+ *     a op b op c op d == (a op b) op (c op d)
+ * }</pre>
+ * So we can evaluate {@code (a op b)} in parallel with {@code (c op d)} and then invoke {@code op} on
+ * the results.
+ * TODO what does associative mean for mutative combining functions?
+ * FIXME: we described mutative associativity above.
+ *
+ * <h2><a name="StreamSources">Stream sources</a></h2>
+ * TODO where does this section go?
+ *
+ * XXX - change to section to stream construction gradually introducing more
+ *       complex ways to construct
+ *     - construction from Collection
+ *     - construction from Iterator
+ *     - construction from array
+ *     - construction from generators
+ *     - construction from spliterator
+ *
+ * XXX - the following is quite low-level but important aspect of stream constriction
+ *
+ * <p>A pipeline is initially constructed from a spliterator (see {@link java.util.Spliterator}) supplied by a stream source.
+ * The spliterator covers elements of the source and provides element traversal operations
+ * for a possibly-parallel computation.  See methods on {@link java.util.stream.Streams} for construction
+ * of pipelines using spliterators.
+ *
+ * <p>A source may directly supply a spliterator.  If so, the spliterator is traversed, split, or queried
+ * for estimated size after, and never before, the terminal operation commences. It is strongly recommended
+ * that the spliterator report a characteristic of {@code IMMUTABLE} or {@code CONCURRENT}, or be
+ * <em>late-binding</em> and not bind to the elements it covers until traversed, split or queried for
+ * estimated size.
+ *
+ * <p>If a source cannot directly supply a recommended spliterator then it may indirectly supply a spliterator
+ * using a {@code Supplier}.  The spliterator is obtained from the supplier after, and never before, the terminal
+ * operation of the stream pipeline commences.
+ *
+ * <p>Such requirements significantly reduce the scope of potential interference to the interval starting
+ * with the commencing of the terminal operation and ending with the producing a result or side-effect.  See
+ * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
+ * more details.
+ *
+ * XXX - move the following to the non-interference section
+ *
+ * <p>A source can be modified before the terminal operation commences and those modifications will be reflected in
+ * the covered elements.  Afterwards, and depending on the properties of the source, further modifications
+ * might not be reflected and the throwing of a {@code ConcurrentModificationException} may occur.
+ *
+ * <p>For example, consider the following code:
+ * <pre>{@code
+ *     List<String> l = new ArrayList(Arrays.asList("one", "two"));
+ *     Stream<String> sl = l.stream();
+ *     l.add("three");
+ *     String s = sl.collect(toStringJoiner(" ")).toString();
+ * }</pre>
+ * First a list is created consisting of two strings: "one"; and "two". Then a stream is created from that list.
+ * Next the list is modified by adding a third string: "three".  Finally the elements of the stream are collected
+ * and joined together.  Since the list was modified before the terminal {@code collect} operation commenced
+ * the result will be a string of "one two three". However, if the list is modified after the terminal operation
+ * commences, as in:
+ * <pre>{@code
+ *     List<String> l = new ArrayList(Arrays.asList("one", "two"));
+ *     Stream<String> sl = l.stream();
+ *     String s = sl.peek(s -> l.add("BAD LAMBDA")).collect(toStringJoiner(" ")).toString();
+ * }</pre>
+ * then a {@code ConcurrentModificationException} will be thrown since the {@code peek} operation will attempt
+ * to add the string "BAD LAMBDA" to the list after the terminal operation has commenced.
+ */
+
+package java.util.stream;
--- a/jdk/src/share/classes/javax/swing/JDesktopPane.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/javax/swing/JDesktopPane.java	Wed May 08 10:10:05 2013 +0100
@@ -428,6 +428,15 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void remove(Component comp) {
+        super.remove(comp);
+        updateFramesCache();
+    }
+
+    /**
      * Selects the next <code>JInternalFrame</code> in this desktop pane.
      *
      * @param forward a boolean indicating which direction to select in;
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_de.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_de.java	Wed May 08 10:10:05 2013 +0100
@@ -109,7 +109,7 @@
             {"appletclassloader.getresourceasstream.verbose", "Ressource {0} als Systemressource gefunden"},
             {"appletpanel.runloader.err", "Objekt oder Codeparameter."},
             {"appletpanel.runloader.exception", "Ausnahme beim Deserialisieren von {0}"},
-            {"appletpanel.destroyed", "Applet endg\u00FCltig gel\u00F6scht."},
+            {"appletpanel.destroyed", "Applet zerst\u00F6rt."},
             {"appletpanel.loaded", "Applet geladen."},
             {"appletpanel.started", "Applet gestartet."},
             {"appletpanel.inited", "Applet initialisiert."},
@@ -127,8 +127,8 @@
             {"appletpanel.notloaded", "Init.: Applet nicht geladen."},
             {"appletpanel.notinited", "Starten: Applet nicht initialisiert."},
             {"appletpanel.notstarted", "Stoppen: Applet nicht gestartet."},
-            {"appletpanel.notstopped", "Endg\u00FCltig l\u00F6schen: Applet nicht gestoppt."},
-            {"appletpanel.notdestroyed", "Verwerfen: Applet nicht endg\u00FCltig gel\u00F6scht."},
+            {"appletpanel.notstopped", "Zerst\u00F6ren: Applet nicht gestoppt."},
+            {"appletpanel.notdestroyed", "Verwerfen: Applet nicht zerst\u00F6rt."},
             {"appletpanel.notdisposed", "Laden: Applet nicht verworfen."},
             {"appletpanel.bail", "Unterbrochen: Zur\u00FCckziehen."},
             {"appletpanel.filenotfound", "Datei nicht gefunden beim Suchen nach: {0}"},
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_ja.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_ja.java	Wed May 08 10:10:05 2013 +0100
@@ -38,7 +38,7 @@
             {"appletviewer.menuitem.stop", "\u505C\u6B62"},
             {"appletviewer.menuitem.save", "\u4FDD\u5B58..."},
             {"appletviewer.menuitem.start", "\u958B\u59CB"},
-            {"appletviewer.menuitem.clone", "\u30AF\u30ED\u30FC\u30F3\u306E\u4F5C\u6210..."},
+            {"appletviewer.menuitem.clone", "\u30AF\u30ED\u30FC\u30F3..."},
             {"appletviewer.menuitem.tag", "\u30BF\u30B0..."},
             {"appletviewer.menuitem.info", "\u60C5\u5831..."},
             {"appletviewer.menuitem.edit", "\u7DE8\u96C6"},
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_pt_BR.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_pt_BR.java	Wed May 08 10:10:05 2013 +0100
@@ -87,7 +87,7 @@
             {"appletviewer.main.err.prop.cantsave", "N\u00E3o \u00E9 poss\u00EDvel salvar o arquivo de propriedades do usu\u00E1rio: {0}"},
             {"appletviewer.main.warn.nosecmgr", "Advert\u00EAncia: desativando a seguran\u00E7a."},
             {"appletviewer.main.debug.cantfinddebug", "N\u00E3o \u00E9 poss\u00EDvel localizar o depurador!"},
-            {"appletviewer.main.debug.cantfindmain", "N\u00E3o \u00E9 poss\u00EDvel localizar o m\u00E9todo principal no depurador!"},
+            {"appletviewer.main.debug.cantfindmain", "N\u00E3o \u00E9 poss\u00EDvel localizar o m\u00E9todo main no depurador!"},
             {"appletviewer.main.debug.exceptionindebug", "Exce\u00E7\u00E3o no depurador!"},
             {"appletviewer.main.debug.cantaccess", "N\u00E3o \u00E9 poss\u00EDvel acessar o depurador!"},
             {"appletviewer.main.nosecmgr", "Advert\u00EAncia: SecurityManager n\u00E3o instalado!"},
@@ -137,7 +137,7 @@
             {"appletpanel.fileexception", "exce\u00E7\u00E3o de {0} ao carregar: {1}"},
             {"appletpanel.filedeath", "{0} eliminado ao carregar: {1}"},
             {"appletpanel.fileerror", "erro de {0} ao carregar: {1}"},
-            {"appletpanel.badattribute.exception", "Parse de HTML: valor incorreto do atributo de largura/altura"},
+            {"appletpanel.badattribute.exception", "Parsing de HTML: valor incorreto do atributo de largura/altura"},
             {"appletillegalargumentexception.objectinputstream", "AppletObjectInputStream requer um carregador n\u00E3o nulo"},
             {"appletprops.title", "Propriedades do AppletViewer"},
             {"appletprops.label.http.server", "Servidor proxy Http:"},
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_sv.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_sv.java	Wed May 08 10:10:05 2013 +0100
@@ -98,11 +98,11 @@
             {"appletioexception.loadclass.throw.notloaded", "klass inte inl\u00E4st: {0}"},
             {"appletclassloader.loadcode.verbose", "\u00D6ppnar str\u00F6m till: {0} f\u00F6r h\u00E4mtning av {1}"},
             {"appletclassloader.filenotfound", "Hittade inte fil vid s\u00F6kning efter: {0}"},
-            {"appletclassloader.fileformat", "Undantag av filformat vid l\u00E4sning av: {0}"},
-            {"appletclassloader.fileioexception", "I/O-undantag vid l\u00E4sning: {0}"},
-            {"appletclassloader.fileexception", "{0} undantag vid l\u00E4sning: {1}"},
-            {"appletclassloader.filedeath", "{0} avslutad vid l\u00E4sning: {1}"},
-            {"appletclassloader.fileerror", "{0} fel vid l\u00E4sning: {1}"},
+            {"appletclassloader.fileformat", "Undantag av filformat vid laddning av: {0}"},
+            {"appletclassloader.fileioexception", "I/O-undantag vid laddning: {0}"},
+            {"appletclassloader.fileexception", "{0} undantag vid laddning: {1}"},
+            {"appletclassloader.filedeath", "{0} avslutad vid laddning: {1}"},
+            {"appletclassloader.fileerror", "{0} fel vid laddning: {1}"},
             {"appletclassloader.findclass.verbose.openstream", "\u00D6ppnar str\u00F6m till: {0} f\u00F6r h\u00E4mtning av {1}"},
             {"appletclassloader.getresource.verbose.forname", "AppletClassLoader.getResource f\u00F6r namnet: {0}"},
             {"appletclassloader.getresource.verbose.found", "Hittade resursen: {0} som systemresurs"},
@@ -132,11 +132,11 @@
             {"appletpanel.notdisposed", "Ladda: applet har inte kasserats."},
             {"appletpanel.bail", "Avbruten."},
             {"appletpanel.filenotfound", "Hittade inte fil vid s\u00F6kning efter: {0}"},
-            {"appletpanel.fileformat", "Undantag av filformat vid l\u00E4sning av: {0}"},
-            {"appletpanel.fileioexception", "I/O-undantag vid l\u00E4sning: {0}"},
-            {"appletpanel.fileexception", "{0} undantag vid l\u00E4sning: {1}"},
-            {"appletpanel.filedeath", "{0} avslutad vid l\u00E4sning: {1}"},
-            {"appletpanel.fileerror", "{0} fel vid l\u00E4sning: {1}"},
+            {"appletpanel.fileformat", "Undantag av filformat vid laddning av: {0}"},
+            {"appletpanel.fileioexception", "I/O-undantag vid laddning: {0}"},
+            {"appletpanel.fileexception", "{0} undantag vid laddning: {1}"},
+            {"appletpanel.filedeath", "{0} avslutad vid laddning: {1}"},
+            {"appletpanel.fileerror", "{0} fel vid laddning: {1}"},
             {"appletpanel.badattribute.exception", "HTML-tolkning: felaktigt v\u00E4rde f\u00F6r bredd-/h\u00F6jdattribut"},
             {"appletillegalargumentexception.objectinputstream", "AppletObjectInputStream kr\u00E4ver laddare med icke-null"},
             {"appletprops.title", "AppletViewer-egenskaper"},
--- a/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_zh_CN.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/applet/resources/MsgAppletViewer_zh_CN.java	Wed May 08 10:10:05 2013 +0100
@@ -87,7 +87,7 @@
             {"appletviewer.main.err.prop.cantsave", "\u65E0\u6CD5\u4FDD\u5B58\u7528\u6237\u5C5E\u6027\u6587\u4EF6: {0}"},
             {"appletviewer.main.warn.nosecmgr", "\u8B66\u544A: \u7981\u7528\u5B89\u5168\u3002"},
             {"appletviewer.main.debug.cantfinddebug", "\u627E\u4E0D\u5230\u8C03\u8BD5\u5668!"},
-            {"appletviewer.main.debug.cantfindmain", "\u5728\u8C03\u8BD5\u5668\u4E2D\u627E\u4E0D\u5230\u4E3B\u8981\u65B9\u6CD5!"},
+            {"appletviewer.main.debug.cantfindmain", "\u5728\u8C03\u8BD5\u5668\u4E2D\u627E\u4E0D\u5230 main \u65B9\u6CD5!"},
             {"appletviewer.main.debug.exceptionindebug", "\u8C03\u8BD5\u5668\u4E2D\u5B58\u5728\u5F02\u5E38\u9519\u8BEF!"},
             {"appletviewer.main.debug.cantaccess", "\u65E0\u6CD5\u8BBF\u95EE\u8C03\u8BD5\u5668!"},
             {"appletviewer.main.nosecmgr", "\u8B66\u544A: \u672A\u5B89\u88C5 SecurityManager!"},
@@ -154,7 +154,7 @@
             {"appletprops.choice.unsignedapplet.yes", "\u662F"},
             {"appletprops.button.apply", "\u5E94\u7528"},
             {"appletprops.button.cancel", "\u53D6\u6D88"},
-            {"appletprops.button.reset", "\u91CD\u8BBE"},
+            {"appletprops.button.reset", "\u91CD\u7F6E"},
             {"appletprops.apply.exception", "\u65E0\u6CD5\u4FDD\u5B58\u5C5E\u6027: {0}"},
             /* 4066432 */
             {"appletprops.title.invalidproxy", "\u6761\u76EE\u65E0\u6548"},
--- a/jdk/src/share/classes/sun/awt/resources/awt_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/awt/resources/awt_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -105,7 +105,7 @@
 AWT.colon=Doppelpunkt
 AWT.circumflex=Zirkumflex
 AWT.dollar=Dollarzeichen
-AWT.euro=Euro-Zeichen
+AWT.euro=Euro
 AWT.exclamationMark=Ausrufezeichen
 AWT.invertedExclamationMark=Umgekehrtes Ausrufezeichen
 AWT.leftParenthesis=Linke Klammer
--- a/jdk/src/share/classes/sun/awt/resources/awt_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/awt/resources/awt_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -4,7 +4,7 @@
 #
 
 # Modifier names
-AWT.shift=May\u00FAsculas
+AWT.shift=May\u00FAs
 AWT.control=Ctrl
 AWT.alt=Alt
 AWT.meta=Meta
--- a/jdk/src/share/classes/sun/awt/resources/awt_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/awt/resources/awt_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -44,7 +44,7 @@
 AWT.subtract=Teclado Num\u00E9rico -
 AWT.decimal=Teclado Num\u00E9rico .
 AWT.divide=Teclado Num\u00E9rico /
-AWT.delete=Delete
+AWT.delete=Deletar
 AWT.numLock=Num Lock
 AWT.scrollLock=Scroll Lock
 AWT.f1=F1
--- a/jdk/src/share/classes/sun/awt/resources/awt_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/awt/resources/awt_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -174,7 +174,7 @@
 AWT.InputMethodSelectionMenu=\u9009\u62E9\u8F93\u5165\u7A97\u53E3
 AWT.HostInputMethodDisplayName=\u7CFB\u7EDF\u8F93\u5165\u6CD5
 AWT.InputMethodLanguage.ja=\u65E5\u6587
-AWT.InputMethodLanguage.ko=\u97E9\u6587
+AWT.InputMethodLanguage.ko=\u671D\u9C9C\u6587
 AWT.InputMethodLanguage.zh=\u4E2D\u6587
 AWT.InputMethodLanguage.zh_CN=\u7B80\u4F53\u4E2D\u6587
 AWT.InputMethodLanguage.zh_TW=\u7E41\u4F53\u4E2D\u6587
--- a/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java	Wed May 08 10:10:05 2013 +0100
@@ -127,7 +127,7 @@
 
     private static byte[] theTile;
 
-    public synchronized static byte[] getAlphaTile(int len) {
+    private synchronized static byte[] getAlphaTile(int len) {
         byte[] t = theTile;
         if (t == null || t.length < len) {
             t = new byte[len];
@@ -137,7 +137,7 @@
         return t;
     }
 
-    public synchronized static void dropAlphaTile(byte[] t) {
+    private synchronized static void dropAlphaTile(byte[] t) {
         theTile = t;
     }
 
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   Verwendung: {0} [-options] class [args...]\n\           (zur Ausf\u00FChrung einer Klasse)\n   oder  {0} [-options] -jar jarfile [args...]\n\           (zur Ausf\u00FChrung einer JAR-Datei)\nwobei options Folgendes umfasst:\n
+java.launcher.opt.header  =   Verwendung: {0} [-options] class [args...]\n           (zur Ausf\u00FChrung einer Klasse)\n   oder  {0} [-options] -jar jarfile [args...]\n           (zur Ausf\u00FChrung einer JAR-Datei)\nwobei options Folgendes umfasst:\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  Verwendet ein {0}-Bit-Datenmodell, sofern verf\u00FCgbar\n
 java.launcher.opt.vmselect   =\    {0}\t  zur Auswahl der "{1}" VM\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  weil die Ausf\u00FChrung auf einem Server-Class-Rechner erfolgt.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <Class-Suchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n\    -classpath <Class-Suchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n\                  Eine durch {0} getrennte Liste mit Verzeichnissen, JAR-Archiven\n\                  und ZIP-Archiven zur Suche nach Klassendateien.\n\    -D<name>=<value>\n\                  Setzt eine Systemeigenschaft\n\    -verbose[:class|gc|jni]\n\                  Aktiviert die Verbose-Ausgabe\n\    -version      Druckt Produktversion und beendet das Programm\n\    -version:<value>\n\                  Erfordert die angegebene Version zur Ausf\u00FChrung\n\    -showversion  Druckt Produktversion und f\u00E4hrt fort\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  Bezieht private JREs des Benutzers in Versionssuche ein bzw. schlie\u00DFt sie aus\n\    -? -help      Druckt diese Hilfemeldung\n\    -X            Druckt Hilfe zu Nicht-Standardoptionen\n\    -ea[:<packagename>...|:<classname>]\n\    -enableassertions[:<packagename>...|:<classname>]\n\                  Aktiviert Assertionen mit angegebener Granularit\u00E4t\n\    -da[:<packagename>...|:<classname>]\n\    -disableassertions[:<packagename>...|:<classname>]\n\                  Deaktiviert Assertionen mit angegebener Granularit\u00E4t\n\    -esa | -enablesystemassertions\n\                  Aktiviert Systemassertionen\n\    -dsa | -disablesystemassertions\n\                  Deaktiviert Systemassertionen\n\    -agentlib:<libname>[=<options>]\n\                  L\u00E4dt native Agent Library <libname>, z.B. -agentlib:hprof\n\                  siehe auch, -agentlib:jdwp=help und -agentlib:hprof=help\n\    -agentpath:<pathname>[=<options>]\n\                  L\u00E4dt native Agent Library nach vollem Pfadnamen\n\    -javaagent:<jarpath>[=<options>]\n\                  L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n\    -splash:<imagepath>\n\                  Zeigt Startbildschirm mit angegebenem Bild\nWeitere Einzelheiten finden Sie unter http://java.sun.com/javase/reference.
+java.launcher.opt.footer     =\    -cp <Klassensuchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n    -classpath <Klassensuchpfad von Verzeichnissen und ZIP-/JAR-Dateien>\n                  Eine durch {0} getrennte Liste mit Verzeichnissen, JAR-Archiven\n                  und ZIP-Archiven zur Suche nach Klassendateien.\n    -D<name>=<value>\n                  Legt eine Systemeigenschaft fest\n    -verbose[:class|gc|jni]\n                  Aktiviert die Verbose-Ausgabe\n    -version      Druckt Produktversion und beendet das Programm\n    -version:<value>\n                  Erfordert die angegebene Version zur Ausf\u00FChrung\n    -showversion  Druckt Produktversion und f\u00E4hrt fort\n    -jre-restrict-search | -no-jre-restrict-search\n                  Bezieht private JREs des Benutzers in Versionssuche ein bzw. schlie\u00DFt sie aus\n    -? -help      Druckt diese Hilfemeldung\n    -X            Druckt Hilfe zu Nicht-Standardoptionen\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  Aktiviert Assertionen mit angegebener Granularit\u00E4t\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  Deaktiviert Assertionen mit angegebener Granularit\u00E4t\n    -esa | -enablesystemassertions\n                  Aktiviert Systemassertionen\n    -dsa | -disablesystemassertions\n                  Deaktiviert Systemassertionen\n    -agentlib:<libname>[=<options>]\n                  L\u00E4dt native Agent Library <libname>, z.B. -agentlib:hprof\n                  siehe auch -agentlib:jdwp=help und -agentlib:hprof=help\n    -agentpath:<pathname>[=<options>]\n                  L\u00E4dt native Agent Library nach vollem Pfadnamen\n    -javaagent:<jarpath>[=<options>]\n                  L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n    -splash:<imagepath>\n                  Zeigt Startbildschirm mit angegebenem Bild\nWeitere Einzelheiten finden Sie unter http://www.oracle.com/technetwork/java/javase/documentation/index.html
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           Ausf\u00FChrung im gemischten Modus (Standard)\n    -Xint             Nur Ausf\u00FChrung im interpretierten Modus\n    -Xbootclasspath:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n                      Legt Suchpfad f\u00FCr Bootstrap-Klassen und Ressourcen fest\n    -Xbootclasspath/a:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n                      H\u00E4ngt an das Ende des Bootstrap Classpath an\n    -Xbootclasspath/p:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n                      Stellt Bootstrap Classpath voran\n    -Xdiag            Zeigt zus\u00E4tzliche Diagnosemeldungen an\n    -Xnoclassgc       Deaktiviert Klassen-Garbage Collection\n    -Xincgc           Aktiviert inkrementelle Garbage Collection\n    -Xloggc:<file>    Loggt GC-Status in einer Datei mit Zeitstempeln\n    -Xbatch           Deaktiviert Hintergrundkompilierung\n    -Xms<size>        Legt anf\u00E4ngliche Java Heap-Gr\u00F6\u00DFe fest\n    -Xmx<size>        Legt maximale Java Heap-Gr\u00F6\u00DFe fest\n    -Xss<size>        Legt Java-Thread-Stack-Gr\u00F6\u00DFe fest\n    -Xprof            Gibt CPU-Profiling-Daten aus\n    -Xfuture          Aktiviert strengste Pr\u00FCfungen, antizipiert zuk\u00FCnftigen Standardwert\n    -Xrs              Reduziert Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n    -Xcheck:jni       F\u00FChrt zus\u00E4tzliche Pr\u00FCfungen f\u00FCr JNI-Funktionen durch\n    -Xshare:off       Kein Versuch, gemeinsame Klassendaten zu verwenden\n    -Xshare:auto      Verwendet gemeinsame Klassendaten, wenn m\u00F6glich (Standard)\n    -Xshare:on        Erfordert die Verwendung gemeinsamer Klassendaten, sonst verl\u00E4uft der Vorgang nicht erfolgreich.\n    -XshowSettings    Zeigt alle Einstellungen und f\u00E4hrt fort\n    -XshowSettings:all\n                      Zeigt alle Einstellungen und f\u00E4hrt fort\n    -XshowSettings:vm Zeigt alle VM-bezogenen Einstellungen und f\u00E4hrt fort\n    -XshowSettings:properties\n                      Zeigt alle Eigenschaftseinstellungen und f\u00E4hrt fort\n    -XshowSettings:locale\n                      Zeigt alle gebietsschemabezogenen Einstellungen und f\u00E4hrt fort\n\nDie -X-Optionen sind keine Standardoptionen und k\u00F6nnen ohne Vorank\u00FCndigung ge\u00E4ndert werden.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           Ausf\u00FChrung im gemischten Modus (Standard)\n\    -Xint             Nur Ausf\u00FChrung im interpretierten Modus\n\    -Xbootclasspath:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\                      Legt Suchpfad f\u00FCr Bootstrap-Klassen und Ressourcen fest\n\    -Xbootclasspath/a:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\                      H\u00E4ngt an das Ende des Bootstrap Classpath an\n\    -Xbootclasspath/p:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\                      Stellt Bootstrap Classpath voran\n\    -Xdiag            Zeigt zus\u00E4tzliche Diagnosemeldungen an\n\    -Xnoclassgc       Deaktiviert Klassen-Garbage Collection\n\    -Xincgc           Aktiviert inkrementelle Garbage Collection\n\    -Xloggc:<file>    Loggt GC-Status in einer Datei mit Zeitstempeln\n\    -Xbatch           Deaktiviert Hintergrundkompilierung\n\    -Xms<size>        Legt anf\u00E4ngliche Java Heap-Gr\u00F6\u00DFe fest\n\    -Xmx<size>        Legt maximale Java Heap-Gr\u00F6\u00DFe fest\n\    -Xss<size>        Legt Java-Thread-Stack-Gr\u00F6\u00DFe fest\n\    -Xprof            Gibt CPU-Profiling-Daten aus\n\    -Xfuture          Aktiviert strengste Pr\u00FCfungen, antizipiert zuk\u00FCnftigen Standardwert\n\    -Xrs              Reduziert Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n\    -Xcheck:jni       F\u00FChrt zus\u00E4tzliche Pr\u00FCfungen f\u00FCr JNI-Funktionen durch\n\    -Xshare:off       Kein Versuch, gemeinsame Klassendaten zu verwenden\n\    -Xshare:auto      Verwendet gemeinsame Klassendaten, wenn m\u00F6glich (Standard)\n\    -Xshare:on        Erfordert die Verwendung gemeinsamer Klassendaten, sonst verl\u00E4uft der Vorgang nicht erfolgreich.\n\    -XshowSettings    Zeigt alle Einstellungen und f\u00E4hrt fort\n\    -XshowSettings:all\n\                      Zeigt alle Einstellungen und f\u00E4hrt fort\n\    -XshowSettings:vm Zeigt alle VM-bezogenen Einstellungen und f\u00E4hrt fort\n\    -XshowSettings:properties\n\                      Zeigt alle Eigenschaftseinstellungen und f\u00E4hrt fort\n\    -XshowSettings:locale\n\                      Zeigt alle gebietsschemabezogenen Einstellungen und f\u00E4hrt fort\n\nDie -X-Optionen sind keine Standardoptionen und k\u00F6nnen ohne Vorank\u00FCndigung ge\u00E4ndert werden.\n
+java.launcher.X.macosx.usage=\nDie folgenden Optionen sind f\u00FCr Mac OS X spezifisch:\n    -XstartOnFirstThread\n                      f\u00FChrt die main()-Methode f\u00FCr den ersten (AppKit) Thread aus\n    -Xdock:name=<Anwendungsname>"\n                      \u00DCberschreibt den in der Uhr angezeigten Standardanwendungsnamen\n    -Xdock:icon=<Pfad zu Symboldatei>\n                      \u00DCberschreibt das in der Uhr angezeigte Standardsymbol\n\n
 
 java.launcher.cls.error1=Fehler: Hauptklasse {0} konnte nicht gefunden oder geladen werden
-java.launcher.cls.error2=Fehler: Hauptmethode ist nicht {0} in Klasse {1}. Definieren Sie die Hauptmethode als:\n\   public static void main(String[] args)
-java.launcher.cls.error3=Fehler: Hauptmethode muss einen Wert vom Typ void in Klasse {0} zur\u00FCckgeben. Definieren Sie \ndie Hauptmethode als:\n\   public static void main(String[] args)
-java.launcher.cls.error4=Fehler: Hauptmethode in Klasse {0} nicht gefunden. Definieren Sie die Hauptmethode als:\n\   public static void main(String[] args)
+java.launcher.cls.error2=Fehler: Hauptmethode ist nicht {0} in Klasse {1}. Definieren Sie die Hauptmethode als:\n   public static void main(String[] args)
+java.launcher.cls.error3=Fehler: Hauptmethode muss einen Wert vom Typ void in Klasse {0} zur\u00FCckgeben. Definieren Sie \ndie Hauptmethode als:\n   public static void main(String[] args)
+java.launcher.cls.error4=Fehler: Hauptmethode in Klasse {0} nicht gefunden. Definieren Sie die Hauptmethode als:\n   public static void main(String[] args):\noder eine JavaFX-Anwendung muss {1} erweitern
+java.launcher.cls.error5=Fehler: Zum Ausf\u00FChren dieser Anwendung ben\u00F6tigte JavaFX-Runtime-Komponenten fehlen
 java.launcher.jar.error1=Fehler: Beim Versuch, Datei {0} zu \u00F6ffnen, ist ein unerwarteter Fehler aufgetreten
 java.launcher.jar.error2=Manifest in {0} nicht gefunden
 java.launcher.jar.error3=kein Hauptmanifestattribut, in {0}
+java.launcher.init.error=Initialisierungsfehler
+java.launcher.javafx.error1=Fehler: Die JavaFX-Methode launchApplication hat die falsche Signatur, sie\nmuss als statisch deklariert werden und einen Wert vom Typ VOID zur\u00FCckgeben
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   Sintaxis: {0} [-options] class [args...]\n\           (para ejecutar una clase)\n   o  {0} [-options] -jar jarfile [args...]\n\           (para ejecutar un archivo jar)\ndonde las opciones incluyen:\n
+java.launcher.opt.header  =   Sintaxis: {0} [-options] class [args...]\n           (para ejecutar una clase)\n   o  {0} [-options] -jar jarfile [args...]\n           (para ejecutar un archivo jar)\ndonde las opciones incluyen:\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  usar un modelo de datos de {0} bits, si est\u00E1 disponible\n
 java.launcher.opt.vmselect   =\    {0}\t  para seleccionar la VM "{1}"\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  porque la ejecuci\u00F3n se est\u00E1 llevando a cabo en una m\u00E1quina de clase de servidor.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\    -classpath <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\                  Una lista separada por {0} de directorios, archivos JAR,\n\                  y archivos ZIP para buscar archivos de clase.\n\    -D<nombre>=<valor>\n\                  definir una propiedad del sistema\n\    -verbose[:class|gc|jni]\n\                  activar la salida verbose\n\    -version      imprimir la versi\u00F3n del producto y salir\n\    -version:<valor>\n\                  es necesario que se ejecute la versi\u00F3n especificada\n\    -showversion  imprimir la versi\u00F3n del producto y continuar\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  incluir/excluir JRE privados de usuario en la b\u00FAsqueda de versi\u00F3n\n\    -? -help      imprimir este mensaje de ayuda\n\    -X            imprimir la ayuda sobre las opciones que no sean est\u00E1ndar\n\    -ea[:<nombre_paquete>...|:<nombre_clase>]\n\    -enableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\                  activar afirmaciones con la granularidad especificada\n\    -da[:<nombre_paquete>...|:<nombre_clase>]\n\    -disableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\                  desactivar afirmaciones con la granularidad especificada\n\    -esa | -enablesystemassertions\n\                  activar afirmaciones del sistema\n\    -dsa | -disablesystemassertions\n\                  desactivar afirmaciones del sistema\n\    -agentlib:<nombre_bib>[=<opciones>]\n\                  cargar la biblioteca de agente nativa <nombre_bib>, como -agentlib:hprof\n\                  v\u00E9ase tambi\u00E9n -agentlib:jdwp=help y -agentlib:hprof=help\n\    -agentpath:<nombre_ruta_acceso>[=<opciones>]\n\                  cargar biblioteca de agente nativa con la ruta de acceso completa\n\    -javaagent:<ruta_acceso_jar>[=<opciones>]\n\                  cargar agente de lenguaje de programaci\u00F3n Java, v\u00E9ase java.lang.instrument\n\    -splash:<ruta_acceso_imagen>\n\                  mostrar una pantalla de presentaci\u00F3n con la imagen especificada\nConsulte http://java.sun.com/javase/reference para obtener m\u00E1s informaci\u00F3n.
+java.launcher.opt.footer     =\    -cp <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\\    -classpath <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\\                  Lista separada por {0} de directorios, archivos JAR\n\\                  y archivos ZIP para buscar archivos de clase.\n\\    -D<nombre>=<valor>\n\\                  definir una propiedad del sistema\n\\    -verbose:[class|gc|jni]\n\\                  activar la salida verbose\n\\    -version      imprimir la versi\u00F3n del producto y salir\n\\    -version:<valor>\n\\                  es necesario que se ejecute la versi\u00F3n especificada\n\\    -showversion  imprimir la versi\u00F3n del producto y continuar\n\\    -jre-restrict-search | -no-jre-restrict-search\n\\                  incluir/excluir JRE privados de usuario en la b\u00FAsqueda de versi\u00F3n\n\\    -? -help      imprimir este mensaje de ayuda\n\\    -X            imprimir la ayuda sobre las opciones que no sean est\u00E1ndar\n\\    -ea[:<nombre_paquete>...|:<nombre_clase>]\n\\    -enableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\\                  activar afirmaciones con la granularidad especificada\n\\    -da[:<nombre_paquete>...|:<nombre_clase>]\n\\    -disableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\\                  desactivar afirmaciones con la granularidad especificada\n\\    -esa | -enablesystemassertions\n\\                  activar afirmaciones del sistema\n\\    -dsa | -disablesystemassertions\n\\                  desactivar afirmaciones del sistema\n\\    -agentlib:<nombre_bib>[=<opciones>]\n\\                  cargar la biblioteca de agente nativa <nombre_bib>, como -agentlib:hprof\n\\                  v\u00E9ase tambi\u00E9n -agentlib:jdwp=help y -agentlib:hprof=help\n\\    -agentpath:<nombre_ruta_acceso>[=<opciones>]\n\\                  cargar biblioteca de agente nativa con el nombre de la ruta de acceso completa\n\\    -javaagent:<ruta_acceso_jar>[=<opciones>]\n\\                  cargar agente de lenguaje de programaci\u00F3n Java, v\u00E9ase java.lang.instrument\n\\    -splash:<ruta_acceso_imagen>\n\\                  mostrar una pantalla de presentaci\u00F3n con la imagen especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obtener m\u00E1s informaci\u00F3n.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           ejecuci\u00F3n de modo mixto (por defecto)\n    -Xint             s\u00F3lo ejecuci\u00F3n de modo interpretado\n    -Xbootclasspath:<directorios y archivos zip/jar separados por {0}>\n                      definir la ruta de acceso de b\u00FAsqueda para los recursos y clases de inicializaci\u00F3n de datos\n    -Xbootclasspath/a:<directorios y archivos zip/jar separados por {0}>\n                      agregar al final de la ruta de acceso de la clase de inicializaci\u00F3n de datos\n    -Xbootclasspath/p:<directorios y archivos zip/jar separados por {0}>\n                      anteponer a la ruta de acceso de la clase de inicializaci\u00F3n de datos\n    -Xdiag            mostrar mensajes de diagn\u00F3stico adicionales\n    -Xnoclassgc       desactivar la recolecci\u00F3n de basura de clases\n    -Xincgc           activar la recolecci\u00F3n de basura de clases\n    -Xloggc:<archivo>    registrar el estado de GC en un archivo con registros de hora\n    -Xbatch           desactivar compilaci\u00F3n en segundo plano\n    -Xms<tama\u00F1o>        definir tama\u00F1o de pila Java inicial\n    -Xmx<tama\u00F1o>        definir tama\u00F1o de pila Java m\u00E1ximo\n    -Xss<tama\u00F1o>        definir tama\u00F1o de la pila del thread de Java\n    -Xprof            datos de salida de creaci\u00F3n de perfil de CPU\n    -Xfuture          activar las comprobaciones m\u00E1s estrictas, anticip\u00E1ndose al futuro valor por defecto\n    -Xrs              reducir el uso de se\u00F1ales de sistema operativo por parte de Java/VM (consulte la documentaci\u00F3n)\n    -Xcheck:jni       realizar comprobaciones adicionales para las funciones de JNI\n    -Xshare:off       no intentar usar datos de clase compartidos\n    -Xshare:auto      usar datos de clase compartidos si es posible (valor por defecto)\n    -Xshare:on        es obligatorio el uso de datos de clase compartidos, de lo contrario se emitir\u00E1 un fallo.\n    -XshowSettings    mostrar todos los valores y continuar\n    -XshowSettings:all\n                      mostrar todos los valores y continuar\n    -XshowSettings:vm mostrar todos los valores de la VM y continuar\n    -XshowSettings:properties\n                      mostrar todos los valores de las propiedades y continuar\n    -XshowSettings:locale\n                      mostrar todos los valores relacionados con la configuraci\u00F3n regional y continuar\n\nLas opciones -X no son est\u00E1ndar, por lo que podr\u00EDan cambiarse sin previo aviso.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           ejecuci\u00F3n de modo mixto (por defecto)\n\    -Xint             s\u00F3lo ejecuci\u00F3n de modo interpretado\n\    -Xbootclasspath:<directorios y archivos zip/jar separados por {0}>\n\                      definir la ruta de acceso de b\u00FAsqueda para los recursos y clases de inicializaci\u00F3n de datos\n\    -Xbootclasspath/a:<directorios y archivos zip/jar separados por {0}>\n\                      agregar al final de la ruta de acceso de la clase de inicializaci\u00F3n de datos\n\    -Xbootclasspath/p:<directorios y archivos zip/jar separados por {0}>\n\                      anteponer a la ruta de acceso de la clase de inicializaci\u00F3n de datos\n\    -Xdiag            mostrar mensajes de diagn\u00F3stico adicionales\n\    -Xnoclassgc       desactivar la recolecci\u00F3n de basura de clases\n\    -Xincgc           activar la recolecci\u00F3n de basura de clases\n\    -Xloggc:<archivo>    registrar el estado de GC en un archivo con registros de hora\n\    -Xbatch           desactivar compilaci\u00F3n en segundo plano\n\    -Xms<tama\u00F1o>        definir tama\u00F1o de pila Java inicial\n\    -Xmx<tama\u00F1o>        definir tama\u00F1o de pila Java m\u00E1ximo\n\    -Xss<tama\u00F1o>        definir tama\u00F1o de la pila del thread de Java\n\    -Xprof            datos de salida de creaci\u00F3n de perfil de CPU\n\    -Xfuture          activar las comprobaciones m\u00E1s estrictas, anticip\u00E1ndose al futuro valor por defecto\n\    -Xrs              reducir el uso de se\u00F1ales de sistema operativo por parte de Java/VM (consulte la documentaci\u00F3n)\n\    -Xcheck:jni       realizar comprobaciones adicionales para las funciones de JNI\n\    -Xshare:off       no intentar usar datos de clase compartidos\n\    -Xshare:auto      usar datos de clase compartidos si es posible (valor por defecto)\n\    -Xshare:on        es obligatorio el uso de datos de clase compartidos, de lo contrario se emitir\u00E1 un fallo.\n\    -XshowSettings    mostrar todos los valores y continuar\n\    -XshowSettings:all\n\                      mostrar todos los valores y continuar\n\    -XshowSettings:vm mostrar todos los valores de la VM y continuar\n\    -XshowSettings:properties\n\                      mostrar todos los valores de las propiedades y continuar\n\    -XshowSettings:locale\n\                      mostrar todos los valores relacionados con la configuraci\u00F3n regional y continuar\n\nLas opciones -X no son est\u00E1ndar, por lo que podr\u00EDan cambiarse sin previo aviso.\n
+java.launcher.X.macosx.usage=\nLas siguientes opciones son espec\u00EDficas para Mac OS X:\n    -XstartOnFirstThread\n                      ejecuta el m\u00E9todo main() del primer thread (AppKit)\n    -Xdock:name=<nombre de aplicaci\u00F3n>"\n                      sustituye al nombre por defecto de la aplicaci\u00F3n que se muestra en el Dock\n    -Xdock:icon=<ruta de acceso a archivo de icono>\n                      sustituye al icono por defecto que se muestra en el Dock\n\n
 
 java.launcher.cls.error1=Error: no se ha encontrado o cargado la clase principal {0}
-java.launcher.cls.error2=Error: el m\u00E9todo principal no es {0} en la clase {1}, defina el m\u00E9todo principal del siguiente modo:\n\   public static void main(String[] args)
-java.launcher.cls.error3=Error: el m\u00E9todo principal debe devolver un valor del tipo void en la clase {0}, \ndefina el m\u00E9todo principal del siguiente modo:\n\   public static void main(String[] args)
-java.launcher.cls.error4=Error: no se ha encontrado el m\u00E9todo principal en la clase {0}, defina el m\u00E9todo principal del siguiente modo:\n\   public static void main(String[] args)
+java.launcher.cls.error2=Error: el m\u00E9todo principal no es {0} en la clase {1}, defina el m\u00E9todo principal del siguiente modo:\n   public static void main(String[] args)
+java.launcher.cls.error3=Error: el m\u00E9todo principal debe devolver un valor del tipo void en la clase {0}, \ndefina el m\u00E9todo principal del siguiente modo:\n   public static void main(String[] args)
+java.launcher.cls.error4=Error: no se ha encontrado el m\u00E9todo principal en la clase {0}, defina el m\u00E9todo principal del siguiente modo:\\n   public static void main(String[] args)\\nde lo contrario, se deber\u00E1 ampliar una clase de aplicaci\u00F3n JavaFX {1}
+java.launcher.cls.error5=Error: faltan los componentes de JavaFX runtime y son necesarios para ejecutar esta aplicaci\u00F3n
 java.launcher.jar.error1=Error: se ha producido un error inesperado al intentar abrir el archivo {0}
 java.launcher.jar.error2=no se ha encontrado el manifiesto en {0}
 java.launcher.jar.error3=no hay ning\u00FAn atributo de manifiesto principal en {0}
+java.launcher.init.error=error de inicializaci\u00F3n
+java.launcher.javafx.error1=Error: el m\u00E9todo launchApplication de JavaFX tiene una firma que no es correcta.\\nSe debe declarar est\u00E1tico y devolver un valor de tipo nulo
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   Syntaxe : {0} [-options] class [args...]\n\           (pour l''ex\u00E9cution d''une classe)\n   ou  {0} [-options] -jar jarfile [args...]\n\           (pour l''ex\u00E9cution d''un fichier JAR)\no\u00F9 les options comprennent :\n
+java.launcher.opt.header  =   Syntaxe : {0} [-options] class [args...]\n           (pour l''ex\u00E9cution d''une classe)\n   ou  {0} [-options] -jar jarfile [args...]\n           (pour l''ex\u00E9cution d''un fichier JAR)\no\u00F9 les options comprennent :\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  utilisez le mod\u00E8le de donn\u00E9es {0} bits s''il est disponible\n
 java.launcher.opt.vmselect   =\    {0}\t  pour s\u00E9lectionner la machine virtuelle "{1}"\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  car vous ex\u00E9cutez une machine de classe de serveur.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n\    -classpath <class search path of directories and zip/jar files>\n\                  Liste de r\u00E9pertoires, d''archives JAR et\n\                   d''archives ZIP s\u00E9par\u00E9s par des {0}, dans laquelle rechercher les fichiers de classe.\n\    -D<name>=<value>\n\                  d\u00E9finition d''une propri\u00E9t\u00E9 syst\u00E8me\n\    -verbose[:class|gc|jni]\n\                  activation de la sortie en mode verbose\n\    -version      impression de la version du produit et fin de l''op\u00E9ration\n\    -version:<value>\n\                  ex\u00E9cution de la version sp\u00E9cifi\u00E9e obligatoire\n\    -showversion  impression de la version du produit et poursuite de l''op\u00E9ration\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  inclusion/exclusion des environnements JRE priv\u00E9s de l''utilisateur dans la recherche de version\n\    -? -help      impression du message d''aide\n\    -X            impression de l''aide sur les options non standard\n\    -ea[:<packagename>...|:<classname>]\n\    -enableassertions[:<packagename>...|:<classname>]\n\                  activation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n\    -da[:<packagename>...|:<classname>]\n\    -disableassertions[:<packagename>...|:<classname>]\n\                  d\u00E9sactivation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n\    -esa | -enablesystemassertions\n\                  activation des assertions syst\u00E8me\n\    -dsa | -disablesystemassertions\n\                  d\u00E9sactivation des assertions syst\u00E8me\n\    -agentlib:<libname>[=<options>]\n\                  chargement de la biblioth\u00E8que d''agent natif <libname>, par exemple -agentlib:hprof\n\                  voir \u00E9galement, -agentlib:jdwp=help et -agentlib:hprof=help\n\    -agentpath:<pathname>[=<options>]\n\                  chargement de la biblioth\u00E8que d''agent natif via le chemin d''acc\u00E8s complet\n\    -javaagent:<jarpath>[=<options>]\n\                  chargement de l''agent du langage de programmation Java, voir java.lang.instrument\n\    -splash:<imagepath>\n\                  affichage de l''\u00E9cran d''accueil avec l''image sp\u00E9cifi\u00E9e\nVoir http://java.sun.com/javase/reference pour plus de d\u00E9tails.
+java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n    -classpath <class search path of directories and zip/jar files>\n                  Liste de r\u00E9pertoires, d''archives JAR et\n                   d''archives ZIP s\u00E9par\u00E9s par des {0}, dans laquelle rechercher les fichiers de classe.\n    -D<name>=<value>\n                  d\u00E9finition d''une propri\u00E9t\u00E9 syst\u00E8me\n    -verbose[:class|gc|jni]\n                  activation de la sortie en mode verbose\n    -version      impression de la version du produit et fin de l''op\u00E9ration\n    -version:<value>\n                  ex\u00E9cution de la version sp\u00E9cifi\u00E9e obligatoire\n    -showversion  impression de la version du produit et poursuite de l''op\u00E9ration\n    -jre-restrict-search | -no-jre-restrict-search\n                  inclusion/exclusion des environnements JRE priv\u00E9s de l''utilisateur dans la recherche de version\n    -? -help      impression du message d''aide\n    -X            impression de l''aide sur les options non standard\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  activation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  d\u00E9sactivation des assertions avec la granularit\u00E9 sp\u00E9cifi\u00E9e\n    -esa | -enablesystemassertions\n                  activation des assertions syst\u00E8me\n    -dsa | -disablesystemassertions\n                  d\u00E9sactivation des assertions syst\u00E8me\n    -agentlib:<libname>[=<options>]\n                  chargement de la biblioth\u00E8que d''agent natif <libname>, par exemple -agentlib:hprof\n                  voir \u00E9galement, -agentlib:jdwp=help et -agentlib:hprof=help\n    -agentpath:<pathname>[=<options>]\n                  chargement de la biblioth\u00E8que d''agent natif via le chemin d''acc\u00E8s complet\n    -javaagent:<jarpath>[=<options>]\n                  chargement de l''agent du langage de programmation Java, voir java.lang.instrument\n    -splash:<imagepath>\n                  affichage de l''\u00E9cran d''accueil avec l''image sp\u00E9cifi\u00E9e\nVoir http://www.oracle.com/technetwork/java/javase/documentation/index.html pour plus de d\u00E9tails.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           ex\u00E9cution en mode mixte (valeur par d\u00E9faut)\n    -Xint             ex\u00E9cution en mode interpr\u00E9t\u00E9 uniquement\n    -Xbootclasspath:<directories and zip/jar files separated by {0}>\n                      d\u00E9finition du chemin de recherche pour les ressources et classes bootstrap\n    -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n                      ajout \u00E0 la fin du chemin de classe bootstrap\n    -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n                      ajout au d\u00E9but du chemin de classe bootstrap\n    -Xdiag            affichage de messages de diagnostic suppl\u00E9mentaires\n    -Xnoclassgc       d\u00E9sactivation de l''op\u00E9ration de ramasse-miette (garbage collection) de la classe\n    -Xincgc           activation de l''op\u00E9ration de ramasse-miette (garbage collection) incr\u00E9mentielle\n    -Xloggc:<file>    journalisation du statut de l''op\u00E9ration de ramasse-miette (garbage collection) dans un fichier avec horodatages\n    -Xbatch           d\u00E9sactivation de la compilation en arri\u00E8re-plan\n    -Xms<size>        d\u00E9finition de la taille initiale des portions de m\u00E9moire Java\n    -Xmx<size>        d\u00E9finition de la taille maximale des portions de m\u00E9moire Java\n    -Xss<size>        d\u00E9finition de la taille de pile de thread Java\n    -Xprof            sortie des donn\u00E9es de profilage de l''unit\u00E9 centrale\n    -Xfuture          activation des contr\u00F4les les plus stricts en vue d''anticiper la future valeur par d\u00E9faut\n    -Xrs              r\u00E9duction de l''utilisation des signaux OS par Java/la machine virtuelle (voir documentation)\n    -Xcheck:jni       ex\u00E9cution de contr\u00F4les suppl\u00E9mentaires pour les fonctions JNI\n    -Xshare:off       aucune tentative d''utilisation des donn\u00E9es de classe partag\u00E9es\n    -Xshare:auto      utilisation des donn\u00E9es de classe partag\u00E9es si possible (valeur par d\u00E9faut)\n    -Xshare:on        utilisation des donn\u00E9es de classe partag\u00E9es obligatoire ou \u00E9chec de l''op\u00E9ration\n    -XshowSettings    affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n    -XshowSettings:all\n                      affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n    -XshowSettings:vm affichage de tous les param\u00E8tres de machine virtuelle et poursuite de l''op\u00E9ration\n    -XshowSettings:properties\n                      affichage de tous les param\u00E8tres de propri\u00E9t\u00E9 et poursuite de l''op\u00E9ration\n    -XshowSettings:locale\n                      affichage de tous les param\u00E8tres d''environnement local et poursuite de l''op\u00E9ration\n\nLes options -X ne sont pas des options standard et peuvent faire l''objet de modifications sans pr\u00E9avis.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           ex\u00E9cution en mode mixte (valeur par d\u00E9faut)\n\    -Xint             ex\u00E9cution en mode interpr\u00E9t\u00E9 uniquement\n\    -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\                      d\u00E9finition du chemin de recherche pour les ressources et classes bootstrap\n\    -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\                      ajout \u00E0 la fin du chemin de classe bootstrap\n\    -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\                      ajout au d\u00E9but du chemin de classe bootstrap\n\    -Xdiag            affichage de messages de diagnostic suppl\u00E9mentaires\n\    -Xnoclassgc       d\u00E9sactivation de l''op\u00E9ration de ramasse-miette (garbage collection) de la classe\n\    -Xincgc           activation de l''op\u00E9ration de ramasse-miette (garbage collection) incr\u00E9mentielle\n\    -Xloggc:<file>    journalisation du statut de l''op\u00E9ration de ramasse-miette (garbage collection) dans un fichier avec horodatages\n\    -Xbatch           d\u00E9sactivation de la compilation en arri\u00E8re-plan\n\    -Xms<size>        d\u00E9finition de la taille initiale des portions de m\u00E9moire Java\n\    -Xmx<size>        d\u00E9finition de la taille maximale des portions de m\u00E9moire Java\n\    -Xss<size>        d\u00E9finition de la taille de pile de thread Java\n\    -Xprof            sortie des donn\u00E9es de profilage de l''unit\u00E9 centrale\n\    -Xfuture          activation des contr\u00F4les les plus stricts en vue d''anticiper la future valeur par d\u00E9faut\n\    -Xrs              r\u00E9duction de l''utilisation des signaux OS par Java/la machine virtuelle (voir documentation)\n\    -Xcheck:jni       ex\u00E9cution de contr\u00F4les suppl\u00E9mentaires pour les fonctions JNI\n\    -Xshare:off       aucune tentative d''utilisation des donn\u00E9es de classe partag\u00E9es\n\    -Xshare:auto      utilisation des donn\u00E9es de classe partag\u00E9es si possible (valeur par d\u00E9faut)\n\    -Xshare:on        utilisation des donn\u00E9es de classe partag\u00E9es obligatoire ou \u00E9chec de l''op\u00E9ration\n\    -XshowSettings    affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n\    -XshowSettings:all\n\                      affichage de tous les param\u00E8tres et poursuite de l''op\u00E9ration\n\    -XshowSettings:vm affichage de tous les param\u00E8tres de machine virtuelle et poursuite de l''op\u00E9ration\n\    -XshowSettings:properties\n\                      affichage de tous les param\u00E8tres de propri\u00E9t\u00E9 et poursuite de l''op\u00E9ration\n\    -XshowSettings:locale\n\                      affichage de tous les param\u00E8tres d''environnement local et poursuite de l''op\u00E9ration\n\nLes options -X ne sont pas des options standard et peuvent faire l''objet de modifications sans pr\u00E9avis.\n
+java.launcher.X.macosx.usage=\nLes options suivantes sont propres \u00E0 Mac OS X :\n    -XstartOnFirstThread\n                      ex\u00E9cute la m\u00E9thode main() sur le premier thread (AppKit)\n    -Xdock:name=<application name>"\n                      remplace le nom d'application par d\u00E9faut affich\u00E9 dans l'ancrage\n    -Xdock:icon=<path to icon file>\n                      remplace l'ic\u00F4ne par d\u00E9faut affich\u00E9e dans l'ancrage\n\n
 
 java.launcher.cls.error1=Erreur : impossible de trouver ou charger la classe principale {0}
-java.launcher.cls.error2=Erreur : la m\u00E9thode principale n''est pas {0} dans la classe {1}, d\u00E9finissez la m\u00E9thode principale comme suit :\n\   public static void main(String[] args)
-java.launcher.cls.error3=Erreur : la m\u00E9thode principale doit renvoyer une valeur de type void dans la classe {0}, \nd\u00E9finissez la m\u00E9thode principale comme suit :\n\   public static void main(String[] args)
-java.launcher.cls.error4=Erreur : la m\u00E9thode principale est introuvable dans la classe {0}, d\u00E9finissez la m\u00E9thode principale comme suit :\n\   public static void main(String[] args)
+java.launcher.cls.error2=Erreur : la m\u00E9thode principale n''est pas {0} dans la classe {1}, d\u00E9finissez la m\u00E9thode principale comme suit :\n   public static void main(String[] args)
+java.launcher.cls.error3=Erreur : la m\u00E9thode principale doit renvoyer une valeur de type void dans la classe {0}, \nd\u00E9finissez la m\u00E9thode principale comme suit :\n   public static void main(String[] args)
+java.launcher.cls.error4=Erreur : la m\u00E9thode principale est introuvable dans la classe {0}, d\u00E9finissez la m\u00E9thode principale comme suit :\n   public static void main(String[] args)\nou une classe d''applications JavaFX doit \u00E9tendre {1}
+java.launcher.cls.error5=Erreur : des composants d'ex\u00E9cution JavaFX obligatoires pour ex\u00E9cuter cette application sont manquants.
 java.launcher.jar.error1=Erreur : une erreur inattendue est survenue lors de la tentative d''ouverture du fichier {0}
 java.launcher.jar.error2=fichier manifeste introuvable dans {0}
 java.launcher.jar.error3=aucun attribut manifest principal dans {0}
+java.launcher.init.error=erreur d'initialisation
+java.launcher.javafx.error1=Erreur : la signature de la m\u00E9thode launchApplication JavaFX est incorrecte, la\nm\u00E9thode doit \u00EAtre d\u00E9clar\u00E9e statique et renvoyer une valeur de type void
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   Uso: {0} [-opzioni] class [argomenti...]\n\           (per eseguire una classe)\n   oppure  {0} [-opzioni] -jar filejar [argomenti...]\n\           (per eseguire un file jar)\ndove le opzioni sono:\n
+java.launcher.opt.header  =   Uso: {0} [-opzioni] class [argomenti...]\n           (per eseguire una classe)\n   oppure  {0} [-opzioni] -jar filejar [argomenti...]\n           (per eseguire un file jar)\ndove le opzioni sono:\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  usare un modello di dati {0}-bit se disponibile\n
 java.launcher.opt.vmselect   =\    {0}\t  per selezionare la VM "{1}"\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  perch\u00E9 si utilizza un computer di classe server.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <classpath di ricerca di directory e file zip/jar>\n\    -classpath <classpath di ricerca di directory e file zip/jar>\n\                  Una lista separata da {0} di directory, archivi JAR\n\                  e archivi ZIP utilizzata per la ricerca di file di classe.\n\    -D<nome>=<valore>\n\                  imposta una propriet\u00E0 di sistema\n\    -verbose[:class|gc|jni]\n\                  abilita l''output descrittivo\n\    -version      stampa la versione del prodotto ed esce\n\    -version:<valore>\n\                  richiede l''esecuzione della versione specificata\n\    -showversion  stampa la versione del prodotto e continua\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  include/esclude gli ambienti JRE privati dell''utente nella ricerca della versione\n\    -? -help      stampa questo messaggio della Guida\n\    -X            stampa la Guida sulle opzioni non standard\n\    -ea[:<nomepackage>...|:<nomeclasse>]\n\    -enableassertions[:<nomepackage>...|:<nomeclasse>]\n\                  abilita le asserzioni con la granularit\u00E0 specificata\n\    -da[:<nomepackage>...|:<nomeclasse>]\n\    -disableassertions[:<nomepackage>...|:<nomeclasse>]\n\                  disabilita le asserzioni con la granularit\u00E0 specificata\n\    -esa | -enablesystemassertions\n\                  abilita le asserzioni di sistema\n\    -dsa | -disablesystemassertions\n\                  disabilita le asserzioni di sistema\n\    -agentlib:<nomelib>[=<opzioni>]\n\                  carica la libreria agenti nativa <nomelib>, ad esempio -agentlib:hprof\n\                  vedere anche -agentlib:jdwp=help and -agentlib:hprof=help\n\    -agentpath:<nomepercorso>[=<opzioni>]\n\                  carica la libreria agenti nativa con il percorso completo\n\    -javaagent:<percorsojar>[=<opzioni>]\n\                  carica l''agente del linguaggio di programmazione Java. Vedere java.lang.instrument\n\    -splash:<percorsoimmagine>\n\                  mostra la schermata iniziale con l''immagine specificata\nVedere http://java.sun.com/javase/reference per maggiori dettagli.
+java.launcher.opt.footer     =\    -cp <classpath di ricerca di directory e file zip/jar>\n\\    -classpath <classpath di ricerca di directory e file zip/jar>\n\\                  Una lista separata da {0} di directory, archivi JAR,\n\\                  e archivi ZIP utilizzata per la ricerca di file di classe.\n\\    -D<nome>=<valore>\n\\                  imposta una propriet\u00E0 di sistema\n\\    -verbose:[class|gc|jni]\n\\                  abilita l''output descrittivo\n\\    -version      stampa la versione del prodotto ed esce\n\\    -version:<valore>\n\\                  richiede l''esecuzione della versione specificata\n\\    -showversion  stampa la versione del prodotto e continua\n\\    -jre-restrict-search | -no-jre-restrict-search\n\\                  include/esclude gli ambienti JRE privati dell''utente nella ricerca della versione\n\\    -? -help      stampa questo messaggio della Guida\n\\    -X            stampa la Guida sulle opzioni non standard\n\\    -ea[:<nomepackage>...|:<nomeclasse>]\n\\    -enableassertions[:<nomepackage>...|:<nomeclasse>]\n\\                  abilita le asserzioni con la granularit\u00E0 specificata\n\\    -da[:<nomepackage>...|:<nomeclasse>]\n\\    -disableassertions[:<nomepackage>...|:<nomeclasse>]\n\\                  disabilita le asserzioni con la granularit\u00E0 specificata\n\\    -esa | -enablesystemassertions\n\\                  abilita le asserzioni di sistema\n\\    -dsa | -disablesystemassertions\n\\                  disabilita le asserzioni di sistema\n\\    -agentlib:<nomelib>[=<opzioni>]\n\\                  carica la libreria agenti nativa <nomelib>, ad esempio -agentlib:hprof\n\\                  vedere anche, -agentlib:jdwp=help and -agentlib:hprof=help\n\\    -agentpath:<nomepercorso>[=<opzioni>]\n\\                  carica la libreria agenti nativa con il percorso completo\n\\    -javaagent:<percorsojar>[=<opzioni>]\n\\                  carica l''agente del linguaggio di programmazione Java. Vedere java.lang.instrument\n\\    -splash:<percorsoimmagine>\n\\                  mostra la schermata iniziale con l''immagine specificata\nPer ulteriori dettagli, vedere http://www.oracle.com/technetwork/java/javase/documentation/index.html.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           esecuzione in modalit\u00E0 mista (impostazione predefinita)\n    -Xint             esecuzione solo in modalit\u00E0 convertita\n    -Xbootclasspath:<directory e file zip/jar separati da {0}>\n                      imposta il percorso di ricerca per le classi e le risorse di bootstrap\n    -Xbootclasspath/a:<directory e file zip/jar separati da {0}>\n                      aggiunge alla fine del classpath di bootstrap\n    -Xbootclasspath/p:<directory e file zip/jar separati da {0}>\n                      antepone al classpath di bootstrap\n    -Xdiag            mostra messaggi di diagnostica aggiuntivi\n    -Xnoclassgc       disabilita la garbage collection della classe\n    -Xincgc           abilita la garbage collection incrementale\n    -Xloggc:<file>    registra lo stato GC in un file di log con indicatori orari\n    -Xbatch           disabilita la compilazione in background\n    -Xms<dimensione>        imposta la dimensione heap Java iniziale\n    -Xmx<dimensione>        imposta la dimensione heap Java massima\n    -Xss<dimensione>        imposta la dimensione dello stack di thread Java\n    -Xprof            visualizza i dati di profilo della CPU\n    -Xfuture          abilita i controlli pi\u00F9 limitativi anticipando le impostazioni predefinite future\n    -Xrs              riduce l''uso di segnali del sistema operativo da Java/VM (vedere la documentazione)\n    -Xcheck:jni       esegue controlli aggiuntivi per le funzioni JNI\n    -Xshare:off       non tenta di utilizzare i dati della classe condivisi\n    -Xshare:auto      utilizza i dati di classe condivisi se possibile (impostazione predefinita)\n    -Xshare:on        richiede l''uso dei dati di classe condivisi, altrimenti l''esecuzione non riesce.\n    -XshowSettings    mostra tutte le impostazioni e continua\n    -XshowSettings:all\n                      mostra tutte le impostazioni e continua\n    -XshowSettings:vm mostra tutte le impostazioni correlate alla VM e continua\n    -XshowSettings:properties\n                      mostra tutte le impostazioni delle propriet\u00E0 e continua\n    -XshowSettings:locale\n                      mostra tutte le impostazioni correlate alle impostazioni nazionali e continua\n\nLe opzioni -X non sono opzioni standard e sono soggette a modifiche senza preavviso.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           esecuzione in modalit\u00E0 mista (impostazione predefinita)\n\    -Xint             esecuzione solo in modalit\u00E0 convertita\n\    -Xbootclasspath:<directory e file zip/jar separati da {0}>\n\                      imposta il percorso di ricerca per le classi e le risorse di bootstrap\n\    -Xbootclasspath/a:<directory e file zip/jar separati da {0}>\n\                      aggiunge alla fine del classpath di bootstrap\n\    -Xbootclasspath/p:<directory e file zip/jar separati da {0}>\n\                      antepone al classpath di bootstrap\n\    -Xdiag            mostra messaggi di diagnostica aggiuntivi\n\    -Xnoclassgc       disabilita la garbage collection della classe\n\    -Xincgc           abilita la garbage collection incrementale\n\    -Xloggc:<file>    registra lo stato GC in un file di log con indicatori orari\n\    -Xbatch           disabilita la compilazione in background\n\    -Xms<dimensione>        imposta la dimensione heap Java iniziale\n\    -Xmx<dimensione>        imposta la dimensione heap Java massima\n\    -Xss<dimensione>        imposta la dimensione dello stack di thread Java\n\    -Xprof            visualizza i dati di profilo della CPU\n\    -Xfuture          abilita i controlli pi\u00F9 limitativi anticipando le impostazioni predefinite future\n\    -Xrs              riduce l''uso di segnali del sistema operativo da Java/VM (vedere la documentazione)\n\    -Xcheck:jni       esegue controlli aggiuntivi per le funzioni JNI\n\    -Xshare:off       non tenta di utilizzare i dati della classe condivisi\n\    -Xshare:auto      utilizza i dati di classe condivisi se possibile (impostazione predefinita)\n\    -Xshare:on        richiede l''uso dei dati di classe condivisi, altrimenti l''esecuzione non riesce.\n\    -XshowSettings    mostra tutte le impostazioni e continua\n\    -XshowSettings:all\n\                      mostra tutte le impostazioni e continua\n\    -XshowSettings:vm mostra tutte le impostazioni correlate alla VM e continua\n\    -XshowSettings:properties\n\                      mostra tutte le impostazioni delle propriet\u00E0 e continua\n\    -XshowSettings:locale\n\                      mostra tutte le impostazioni correlate alle impostazioni nazionali e continua\n\nLe opzioni -X non sono opzioni standard e sono soggette a modifiche senza preavviso.\n
+java.launcher.X.macosx.usage=\nLe opzioni riportate di seguito sono specifiche del sistema operativo Mac OS X:\n    -XstartOnFirstThread\n                      Esegue il metodo main() sul primo thread (AppKit).\n    -Xdock:name=<nome applicazione>"\n                      Sostituisce il nome applicazione predefinito visualizzato nel dock\n    -Xdock:icon=<percorso file icona>\n                      Sostituisce l'icona predefinita visualizzata nel dock\n\n
 
 java.launcher.cls.error1=Errore: impossibile trovare o caricare la classe principale {0}
-java.launcher.cls.error2=Errore: il metodo principale non \u00E8 {0} nella classe {1}. Definire il metodo principale come:\n\   public static void main(String[] args)
-java.launcher.cls.error3=Errore: il metodo principale deve restituire un valore di tipo void nella classe {0}. \nDefinire il metodo principale come:\n\   public static void main(String[] args)
-java.launcher.cls.error4=Errore: il metodo principale non \u00E8 stato trovato nella classe {0}. Definire il metodo principale come:\n\   public static void main(String[] args)
+java.launcher.cls.error2=Errore: il metodo principale non \u00E8 {0} nella classe {1}. Definire il metodo principale come:\n   public static void main(String[] args)
+java.launcher.cls.error3=Errore: il metodo principale deve restituire un valore di tipo void nella classe {0}. \nDefinire il metodo principale come:\n   public static void main(String[] args)
+java.launcher.cls.error4=Errore: il metodo principale non \u00E8 stato trovato nella classe {0}. Definire il metodo principale come:\n   public static void main(String[] args)\naltrimenti una classe applicazione JavaFX deve estendere {1}
+java.launcher.cls.error5=Errore: non sono presenti i componenti runtime di JavaFX necessari per eseguire questa applicazione
 java.launcher.jar.error1=Errore: si \u00E8 verificato un errore imprevisto durante il tentativo di aprire il file {0}
 java.launcher.jar.error2=manifest non trovato in {0}
 java.launcher.jar.error3=nessun attributo manifest principale in {0}
+java.launcher.init.error=errore di inizializzazione
+java.launcher.javafx.error1=Errore: il metodo JavaFX launchApplication dispone di una firma errata, \nla firma deve essere dichiarata static e restituire un valore di tipo void
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   \u4F7F\u7528\u65B9\u6CD5: {0} [-options] class [args...]\n\           (\u30AF\u30E9\u30B9\u3092\u5B9F\u884C\u3059\u308B\u5834\u5408)\n   \u307E\u305F\u306F  {0} [-options] -jar jarfile [args...]\n\           (jar\u30D5\u30A1\u30A4\u30EB\u3092\u5B9F\u884C\u3059\u308B\u5834\u5408)\noptions\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n
+java.launcher.opt.header  =   \u4F7F\u7528\u65B9\u6CD5: {0} [-options] class [args...]\n           (\u30AF\u30E9\u30B9\u3092\u5B9F\u884C\u3059\u308B\u5834\u5408)\n   \u307E\u305F\u306F  {0} [-options] -jar jarfile [args...]\n           (jar\u30D5\u30A1\u30A4\u30EB\u3092\u5B9F\u884C\u3059\u308B\u5834\u5408)\noptions\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  \u4F7F\u7528\u53EF\u80FD\u306A\u5834\u5408\u306F{0}\u30D3\u30C3\u30C8\u306E\u30C7\u30FC\u30BF\u30FB\u30E2\u30C7\u30EB\u3092\u4F7F\u7528\u3059\u308B\n
 java.launcher.opt.vmselect   =\    {0}\t  "{1}" VM\u3092\u9078\u629E\u3059\u308B\u5834\u5408\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  \u3053\u308C\u306F\u30B5\u30FC\u30D0\u30FC\u30AF\u30E9\u30B9\u306E\u30DE\u30B7\u30F3\u3067\u5B9F\u884C\u3057\u3066\u3044\u308B\u305F\u3081\u3067\u3059\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n\    -classpath <class search path of directories and zip/jar files>\n\                  \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001\n\                  JAR\u30A2\u30FC\u30AB\u30A4\u30D6\u304A\u3088\u3073ZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3067\u3059\u3002\n\    -D<name>=<value>\n\                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n\    -verbose[:class|gc|jni]\n\                  \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n\    -version      \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n\    -version:<value>\n\                  \u6307\u5B9A\u3057\u305F\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5B9F\u884C\u306B\u5FC5\u9808\u306B\u3059\u308B\n\    -showversion  \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D9A\u884C\u3059\u308B\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  \u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8JRE\u3092\u30D0\u30FC\u30B8\u30E7\u30F3\u691C\u7D22\u306B\u542B\u3081\u308B/\u9664\u5916\u3059\u308B\n\    -? -help      \u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n\    -X            \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u95A2\u3059\u308B\u30D8\u30EB\u30D7\u3092\u51FA\u529B\u3059\u308B\n\    -ea[:<packagename>...|:<classname>]\n\    -enableassertions[:<packagename>...|:<classname>]\n\                  \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n\    -da[:<packagename>...|:<classname>]\n\    -disableassertions[:<packagename>...|:<classname>]\n\                  \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n\    -esa | -enablesystemassertions\n\                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n\    -dsa | -disablesystemassertions\n\                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n\    -agentlib:<libname>[=<options>]\n\                  \u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA<libname>\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002\u4F8B: -agentlib:hprof\n\                  -agentlib:jdwp=help\u3068-agentlib:hprof=help\u3082\u53C2\u7167\n\    -agentpath:<pathname>[=<options>]\n\                  \u30D5\u30EB\u30D1\u30B9\u540D\u3067\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\n\    -javaagent:<jarpath>[=<options>]\n\                  Java\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002java.lang.instrument\u3092\u53C2\u7167\n\    -splash:<imagepath>\n\                  \u6307\u5B9A\u3057\u305F\u30A4\u30E1\u30FC\u30B8\u3067\u30B9\u30D7\u30E9\u30C3\u30B7\u30E5\u753B\u9762\u3092\u8868\u793A\u3059\u308B\n\u8A73\u7D30\u306Fhttp://java.sun.com/javase/reference\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n    -classpath <class search path of directories and zip/jar files>\n                  \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001\n                  JAR\u30A2\u30FC\u30AB\u30A4\u30D6\u304A\u3088\u3073ZIP\u30A2\u30FC\u30AB\u30A4\u30D6\u306E{0}\u3067\u533A\u5207\u3089\u308C\u305F\u30EA\u30B9\u30C8\u3067\u3059\u3002\n    -D<name>=<value>\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u8A2D\u5B9A\u3059\u308B\n    -verbose:[class|gc|jni]\n                  \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n    -version      \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D42\u4E86\u3059\u308B\n    -version:<value>\n                  \u6307\u5B9A\u3057\u305F\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5B9F\u884C\u306B\u5FC5\u9808\u306B\u3059\u308B\n    -showversion  \u88FD\u54C1\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3057\u3066\u7D9A\u884C\u3059\u308B\n    -jre-restrict-search | -no-jre-restrict-search\n                  \u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30E9\u30A4\u30D9\u30FC\u30C8JRE\u3092\u30D0\u30FC\u30B8\u30E7\u30F3\u691C\u7D22\u306B\u542B\u3081\u308B/\u9664\u5916\u3059\u308B\n    -? -help      \u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B\n    -X            \u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u95A2\u3059\u308B\u30D8\u30EB\u30D7\u3092\u51FA\u529B\u3059\u308B\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  \u6307\u5B9A\u3057\u305F\u7C92\u5EA6\u3067\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n    -esa | -enablesystemassertions\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n    -dsa | -disablesystemassertions\n                  \u30B7\u30B9\u30C6\u30E0\u30FB\u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n    -agentlib:<libname>[=<options>]\n                  \u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA<libname>\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002\u4F8B: -agentlib:hprof\n                  -agentlib:jdwp=help\u3068-agentlib:hprof=help\u3082\u53C2\u7167\n    -agentpath:<pathname>[=<options>]\n                  \u30D5\u30EB\u30D1\u30B9\u540D\u3067\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u30ED\u30FC\u30C9\u3059\u308B\n    -javaagent:<jarpath>[=<options>]\n                  Java\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u3002java.lang.instrument\u3092\u53C2\u7167\n    -splash:<imagepath>\n                  \u6307\u5B9A\u3057\u305F\u30A4\u30E1\u30FC\u30B8\u3067\u30B9\u30D7\u30E9\u30C3\u30B7\u30E5\u753B\u9762\u3092\u8868\u793A\u3059\u308B\n\u8A73\u7D30\u306Fhttp://www.oracle.com/technetwork/java/javase/documentation/index.html\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           \u6DF7\u5408\u30E2\u30FC\u30C9\u306E\u5B9F\u884C(\u30C7\u30D5\u30A9\u30EB\u30C8)\n    -Xint             \u30A4\u30F3\u30BF\u30D7\u30EA\u30BF\u30FB\u30E2\u30FC\u30C9\u306E\u5B9F\u884C\u306E\u307F\n    -Xbootclasspath:<directories and zip/jar files separated by {0}>\n                      \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u306E\u30AF\u30E9\u30B9\u3068\u30EA\u30BD\u30FC\u30B9\u306E\u691C\u7D22\u30D1\u30B9\u3092\u8A2D\u5B9A\u3059\u308B\n    -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n                      \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u6700\u5F8C\u306B\u8FFD\u52A0\u3059\u308B\n    -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n                      \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u524D\u306B\u4ED8\u52A0\u3059\u308B\n    -Xdiag            \u8FFD\u52A0\u306E\u8A3A\u65AD\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3059\u308B\n    -Xnoclassgc       \u30AF\u30E9\u30B9\u306E\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n    -Xincgc           \u5897\u5206\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n    -Xloggc:<file>    \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u4ED8\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u306BGC\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30ED\u30B0\u3092\u8A18\u9332\u3059\u308B\n    -Xbatch           \u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u306E\u30B3\u30F3\u30D1\u30A4\u30EB\u3092\u7121\u52B9\u306B\u3059\u308B\n    -Xms<size>        Java\u306E\u521D\u671F\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n    -Xmx<size>        Java\u306E\u6700\u5927\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n    -Xss<size>        Java\u306E\u30B9\u30EC\u30C3\u30C9\u30FB\u30B9\u30BF\u30C3\u30AF\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n    -Xprof            CPU\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u30FB\u30C7\u30FC\u30BF\u3092\u51FA\u529B\u3059\u308B\n    -Xfuture          \u5C06\u6765\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u898B\u8D8A\u3057\u3066\u3001\u6700\u3082\u53B3\u5BC6\u306A\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B\n    -Xrs              Java/VM\u306B\u3088\u308BOS\u30B7\u30B0\u30CA\u30EB\u306E\u4F7F\u7528\u3092\u524A\u6E1B\u3059\u308B(\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167)\n    -Xcheck:jni       JNI\u95A2\u6570\u306B\u5BFE\u3059\u308B\u8FFD\u52A0\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u5B9F\u884C\u3059\u308B\n    -Xshare:off       \u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u3088\u3046\u3068\u3057\u306A\u3044\n    -Xshare:auto      \u53EF\u80FD\u3067\u3042\u308C\u3070\u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n    -Xshare:on        \u5171\u6709\u30AF\u30E9\u30B9\u30FB\u30C7\u30FC\u30BF\u306E\u4F7F\u7528\u3092\u5FC5\u9808\u306B\u3057\u3001\u3067\u304D\u306A\u3051\u308C\u3070\u5931\u6557\u3059\u308B\u3002\n    -XshowSettings    \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n    -XshowSettings:all\n                      \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n    -XshowSettings:vm \u3059\u3079\u3066\u306EVM\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n    -XshowSettings:properties\n                      \u3059\u3079\u3066\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n    -XshowSettings:locale\n                      \u3059\u3079\u3066\u306E\u30ED\u30B1\u30FC\u30EB\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\n-X\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u975E\u6A19\u6E96\u306A\u306E\u3067\u3001\u4E88\u544A\u306A\u304F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           \u6DF7\u5408\u30E2\u30FC\u30C9\u306E\u5B9F\u884C(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\    -Xint             \u30A4\u30F3\u30BF\u30D7\u30EA\u30BF\u30FB\u30E2\u30FC\u30C9\u306E\u5B9F\u884C\u306E\u307F\n\    -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\                      \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u306E\u30AF\u30E9\u30B9\u3068\u30EA\u30BD\u30FC\u30B9\u306E\u691C\u7D22\u30D1\u30B9\u3092\u8A2D\u5B9A\u3059\u308B\n\    -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\                      \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u6700\u5F8C\u306B\u8FFD\u52A0\u3059\u308B\n\    -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\                      \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u524D\u306B\u4ED8\u52A0\u3059\u308B\n\    -Xdiag            \u8FFD\u52A0\u306E\u8A3A\u65AD\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3059\u308B\n\    -Xnoclassgc       \u30AF\u30E9\u30B9\u306E\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u7121\u52B9\u306B\u3059\u308B\n\    -Xincgc           \u5897\u5206\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3092\u6709\u52B9\u306B\u3059\u308B\n\    -Xloggc:<file>    \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u304C\u4ED8\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u306BGC\u30B9\u30C6\u30FC\u30BF\u30B9\u306E\u30ED\u30B0\u3092\u8A18\u9332\u3059\u308B\n\    -Xbatch           \u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u306E\u30B3\u30F3\u30D1\u30A4\u30EB\u3092\u7121\u52B9\u306B\u3059\u308B\n\    -Xms<size>        Java\u306E\u521D\u671F\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n\    -Xmx<size>        Java\u306E\u6700\u5C0F\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n\    -Xss<size>        Java\u306E\u30B9\u30EC\u30C3\u30C9\u30FB\u30B9\u30BF\u30C3\u30AF\u30FB\u30B5\u30A4\u30BA\u3092\u8A2D\u5B9A\u3059\u308B\n\    -Xprof            CPU\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u30FB\u30C7\u30FC\u30BF\u3092\u51FA\u529B\u3059\u308B\n\    -Xfuture          \u5C06\u6765\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u898B\u8D8A\u3057\u3066\u3001\u6700\u3082\u53B3\u5BC6\u306A\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B\n\    -Xrs              Java/VM\u306B\u3088\u308BOS\u30B7\u30B0\u30CA\u30EB\u306E\u4F7F\u7528\u3092\u524A\u6E1B\u3059\u308B(\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167)\n\    -Xcheck:jni       JNI\u95A2\u6570\u306B\u5BFE\u3059\u308B\u8FFD\u52A0\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u5B9F\u884C\u3059\u308B\n\    -Xshare:off       \u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u3088\u3046\u3068\u3057\u306A\u3044\n\    -Xshare:auto      \u53EF\u80FD\u3067\u3042\u308C\u3070\u5171\u6709\u30AF\u30E9\u30B9\u306E\u30C7\u30FC\u30BF\u3092\u4F7F\u7528\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\    -Xshare:on        \u5171\u6709\u30AF\u30E9\u30B9\u30FB\u30C7\u30FC\u30BF\u306E\u4F7F\u7528\u3092\u5FC5\u9808\u306B\u3057\u3001\u3067\u304D\u306A\u3051\u308C\u3070\u5931\u6557\u3059\u308B\u3002\n\    -XshowSettings    \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\    -XshowSettings:all\n\                      \u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\    -XshowSettings:vm \u3059\u3079\u3066\u306EVM\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\    -XshowSettings:properties\n\                      \u3059\u3079\u3066\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\    -XshowSettings:locale\n\                      \u3059\u3079\u3066\u306E\u30ED\u30B1\u30FC\u30EB\u95A2\u9023\u306E\u8A2D\u5B9A\u3092\u8868\u793A\u3057\u3066\u7D9A\u884C\u3059\u308B\n\n-X\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u975E\u6A19\u6E96\u306A\u306E\u3067\u3001\u4E88\u544A\u306A\u304F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\n
+java.launcher.X.macosx.usage=\n\u6B21\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306FMac OS X\u56FA\u6709\u3067\u3059\u3002\n    -XstartOnFirstThread\n                      main()\u30E1\u30BD\u30C3\u30C9\u3092\u6700\u521D(AppKit)\u306E\u30B9\u30EC\u30C3\u30C9\u3067\u5B9F\u884C\u3059\u308B\n    -Xdock:name=<application name>"\n                      Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u540D\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n    -Xdock:icon=<path to icon file>\n                      Dock\u306B\u8868\u793A\u3055\u308C\u308B\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30A2\u30A4\u30B3\u30F3\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\n\n
 
 java.launcher.cls.error1=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u3089\u306A\u304B\u3063\u305F\u304B\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
-java.launcher.cls.error2=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{1}\u306E{0}\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n\   public static void main(String[] args)
-java.launcher.cls.error3=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u306F\u30AF\u30E9\u30B9{0}\u306Evoid\u578B\u306E\u5024\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n\   public static void main(String[] args)
-java.launcher.cls.error4=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{0}\u3067\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n\   public static void main(String[] args)
+java.launcher.cls.error2=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{1}\u306E{0}\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n   public static void main(String[] args)
+java.launcher.cls.error3=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u306F\u30AF\u30E9\u30B9{0}\u306Evoid\u578B\u306E\u5024\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n   public static void main(String[] args)
+java.launcher.cls.error4=\u30A8\u30E9\u30FC: \u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u30AF\u30E9\u30B9{0}\u3067\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u6B21\u306E\u3088\u3046\u306B\u30E1\u30A4\u30F3\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n   public static void main(String[] args)\n\u307E\u305F\u306FJavaFX\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30AF\u30E9\u30B9\u306F{1}\u3092\u62E1\u5F35\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+java.launcher.cls.error5=\u30A8\u30E9\u30FC: JavaFX\u30E9\u30F3\u30BF\u30A4\u30E0\u30FB\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u4E0D\u8DB3\u3057\u3066\u304A\u308A\u3001\u3053\u306E\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u5B9F\u884C\u306B\u5FC5\u8981\u3067\u3059
 java.launcher.jar.error1=\u30A8\u30E9\u30FC: \u30D5\u30A1\u30A4\u30EB{0}\u3092\u958B\u3053\u3046\u3068\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u3001\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
 java.launcher.jar.error2={0}\u306B\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
 java.launcher.jar.error3={0}\u306B\u30E1\u30A4\u30F3\u30FB\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093
+java.launcher.init.error=\u521D\u671F\u5316\u30A8\u30E9\u30FC
+java.launcher.javafx.error1=\u30A8\u30E9\u30FC: JavaFX launchApplication\u30E1\u30BD\u30C3\u30C9\u306B\u8AA4\u3063\u305F\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u3042\u308A\u3001\nstatic\u3092\u5BA3\u8A00\u3057\u3066void\u578B\u306E\u5024\u3092\u8FD4\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   \uC0AC\uC6A9\uBC95: {0} [-options] class [args...]\n\           (\uD074\uB798\uC2A4 \uC2E4\uD589)\n   \uB610\uB294  {0} [-options] -jar jarfile [args...]\n\           (jar \uD30C\uC77C \uC2E4\uD589)\n\uC5EC\uAE30\uC11C options\uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n
+java.launcher.opt.header  =   \uC0AC\uC6A9\uBC95: {0} [-options] class [args...]\n           (\uD074\uB798\uC2A4 \uC2E4\uD589)\n   \uB610\uB294  {0} [-options] -jar jarfile [args...]\n           (jar \uD30C\uC77C \uC2E4\uD589)\n\uC5EC\uAE30\uC11C options\uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uACBD\uC6B0 {0}\uBE44\uD2B8 \uB370\uC774\uD130 \uBAA8\uB378\uC744 \uC0AC\uC6A9\uD569\uB2C8\uB2E4.\n
 java.launcher.opt.vmselect   =\    {0}\t  "{1}" VM\uC744 \uC120\uD0DD\uD569\uB2C8\uB2E4.\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  \uC11C\uBC84\uAE09 \uC2DC\uC2A4\uD15C\uC5D0\uC11C \uC2E4\uD589 \uC911\uC774\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n\    -classpath <class search path of directories and zip/jar files>\n\                  \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n\                  JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n\    -D<name>=<value>\n\                  \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -verbose[:class|gc|jni]\n\                  \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -version      \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n\    -version:<value>\n\                  \uC2E4\uD589\uD560 \uBC84\uC804\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.\n\    -showversion  \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  \uBC84\uC804 \uAC80\uC0C9\uC5D0\uC11C \uC0AC\uC6A9\uC790 \uC804\uC6A9 JRE\uB97C \uD3EC\uD568/\uC81C\uC678\uD569\uB2C8\uB2E4.\n\    -? -help      \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\    -X            \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\    -ea[:<packagename>...|:<classname>]\n\    -enableassertions[:<packagename>...|:<classname>]\n\                  \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -da[:<packagename>...|:<classname>]\n\    -disableassertions[:<packagename>...|:<classname>]\n\                  \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -esa | -enablesystemassertions\n\                  \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -dsa | -disablesystemassertions\n\                  \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -agentlib:<libname>[=<options>]\n\                  <libname> \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:hprof).\n\                  -agentlib:jdwp=help \uBC0F -agentlib:hprof=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\    -agentpath:<pathname>[=<options>]\n\                  \uC804\uCCB4 \uACBD\uB85C\uBA85\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n\    -javaagent:<jarpath>[=<options>]\n\                  Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\    -splash:<imagepath>\n\                  \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://java.sun.com/javase/reference\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.
+java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n\\    -classpath <class search path of directories and zip/jar files>\n\\                  \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n\\                  JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n\\    -D<name>=<value>\n\\                  \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n\\    -verbose:[class|gc|jni]\n\\                  \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\    -version      \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n\\    -version:<value>\n\\                  \uC2E4\uD589\uD560 \uBC84\uC804\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.\n\\    -showversion  \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\\    -jre-restrict-search | -no-jre-restrict-search\n\\                  \uBC84\uC804 \uAC80\uC0C9\uC5D0\uC11C \uC0AC\uC6A9\uC790 \uC804\uC6A9 JRE\uB97C \uD3EC\uD568/\uC81C\uC678\uD569\uB2C8\uB2E4.\n\\    -? -help      \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\\    -X            \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\\    -ea[:<packagename>...|:<classname>]\n\\    -enableassertions[:<packagename>...|:<classname>]\n\\                  \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\    -da[:<packagename>...|:<classname>]\n\\    -disableassertions[:<packagename>...|:<classname>]\n\\                  \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\    -esa | -enablesystemassertions\n\\                  \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\    -dsa | -disablesystemassertions\n\\                  \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\    -agentlib:<libname>[=<options>]\n\\                  <libname> \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:hprof).\n\\                  -agentlib:jdwp=help \uBC0F -agentlib:hprof=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\\    -agentpath:<pathname>[=<options>]\n\\                  \uC804\uCCB4 \uACBD\uB85C\uBA85\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n\\    -javaagent:<jarpath>[=<options>]\n\\                  Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\\    -splash:<imagepath>\n\\                  \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://www.oracle.com/technetwork/java/javase/documentation/index.html\uC744 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           \uD63C\uD569 \uBAA8\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n    -Xint             \uD574\uC11D\uB41C \uBAA8\uB4DC\uB9CC \uC2E4\uD589\uD569\uB2C8\uB2E4.\n    -Xbootclasspath:<directories and zip/jar files separated by {0}>\n                      \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uAC80\uC0C9 \uACBD\uB85C\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n                      \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uB05D\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n    -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n                      \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uC55E\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n    -Xdiag            \uCD94\uAC00 \uC9C4\uB2E8 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n    -Xnoclassgc       \uD074\uB798\uC2A4\uC758 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -Xincgc           \uC99D\uBD84\uC801\uC778 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -Xloggc:<file>    \uC2DC\uAC04 \uAE30\uB85D\uACFC \uD568\uAED8 \uD30C\uC77C\uC5D0 GC \uC0C1\uD0DC\uB97C \uAE30\uB85D\uD569\uB2C8\uB2E4.\n    -Xbatch           \uBC31\uADF8\uB77C\uC6B4\uB4DC \uCEF4\uD30C\uC77C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -Xms<size>        \uCD08\uAE30 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -Xmx<size>        \uCD5C\uB300 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -Xss<size>        Java \uC2A4\uB808\uB4DC \uC2A4\uD0DD \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -Xprof            CPU \uD504\uB85C\uD30C\uC77C \uC791\uC131 \uB370\uC774\uD130\uB97C \uCD9C\uB825\uD569\uB2C8\uB2E4.\n    -Xfuture          \uBBF8\uB798 \uAE30\uBCF8\uAC12\uC744 \uC608\uCE21\uD558\uC5EC \uAC00\uC7A5 \uC5C4\uACA9\uD55C \uAC80\uC0AC\uB97C \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n    -Xrs              Java/VM\uC5D0 \uC758\uD55C OS \uC2E0\uD638 \uC0AC\uC6A9\uC744 \uC904\uC785\uB2C8\uB2E4(\uC124\uBA85\uC11C \uCC38\uC870).\n    -Xcheck:jni       JNI \uD568\uC218\uC5D0 \uB300\uD55C \uCD94\uAC00 \uAC80\uC0AC\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n    -Xshare:off       \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130 \uC0AC\uC6A9\uC744 \uC2DC\uB3C4\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -Xshare:auto      \uAC00\uB2A5\uD55C \uACBD\uC6B0 \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n    -Xshare:on        \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. \uADF8\uB807\uC9C0 \uC54A\uC744 \uACBD\uC6B0 \uC2E4\uD328\uD569\uB2C8\uB2E4.\n    -XshowSettings    \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n    -XshowSettings:all\n                      \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n    -XshowSettings:vm \uBAA8\uB4E0 VM \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n    -XshowSettings:properties\n                      \uBAA8\uB4E0 \uC18D\uC131 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n    -XshowSettings:locale\n                      \uBAA8\uB4E0 \uB85C\uCF00\uC77C \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\n-X \uC635\uC158\uC740 \uBE44\uD45C\uC900 \uC635\uC158\uC774\uBBC0\uB85C \uD1B5\uC9C0 \uC5C6\uC774 \uBCC0\uACBD\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           \uD63C\uD569 \uBAA8\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n\    -Xint             \uD574\uC11D\uB41C \uBAA8\uB4DC\uB9CC \uC2E4\uD589\uD569\uB2C8\uB2E4.\n\    -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\                      \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uAC80\uC0C9 \uACBD\uB85C\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\                      \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uB05D\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n\    -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\                      \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uC55E\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n\    -Xdiag            \uCD94\uAC00 \uC9C4\uB2E8 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\    -Xnoclassgc       \uD074\uB798\uC2A4\uC758 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -Xincgc           \uC99D\uBD84\uC801\uC778 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -Xloggc:<file>    \uC2DC\uAC04 \uAE30\uB85D\uACFC \uD568\uAED8 \uD30C\uC77C\uC5D0 GC \uC0C1\uD0DC\uB97C \uAE30\uB85D\uD569\uB2C8\uB2E4.\n\    -Xbatch           \uBC31\uADF8\uB77C\uC6B4\uB4DC \uCEF4\uD30C\uC77C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -Xms<size>        \uCD08\uAE30 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -Xmx<size>        \uCD5C\uB300 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -Xss<size>        Java \uC2A4\uB808\uB4DC \uC2A4\uD0DD \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -Xprof            CPU \uD504\uB85C\uD30C\uC77C \uC791\uC131 \uB370\uC774\uD130\uB97C \uCD9C\uB825\uD569\uB2C8\uB2E4.\n\    -Xfuture          \uBBF8\uB798 \uAE30\uBCF8\uAC12\uC744 \uC608\uCE21\uD558\uC5EC \uAC00\uC7A5 \uC5C4\uACA9\uD55C \uAC80\uC0AC\uB97C \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\    -Xrs              Java/VM\uC5D0 \uC758\uD55C OS \uC2E0\uD638 \uC0AC\uC6A9\uC744 \uC904\uC785\uB2C8\uB2E4(\uC124\uBA85\uC11C \uCC38\uC870).\n\    -Xcheck:jni       JNI \uD568\uC218\uC5D0 \uB300\uD55C \uCD94\uAC00 \uAC80\uC0AC\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n\    -Xshare:off       \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130 \uC0AC\uC6A9\uC744 \uC2DC\uB3C4\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\    -Xshare:auto      \uAC00\uB2A5\uD55C \uACBD\uC6B0 \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n\    -Xshare:on        \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. \uADF8\uB807\uC9C0 \uC54A\uC744 \uACBD\uC6B0 \uC2E4\uD328\uD569\uB2C8\uB2E4.\n\    -XshowSettings    \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\    -XshowSettings:all\n\                      \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\    -XshowSettings:vm \uBAA8\uB4E0 VM \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\    -XshowSettings:properties\n\                      \uBAA8\uB4E0 \uC18D\uC131 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\    -XshowSettings:locale\n\                      \uBAA8\uB4E0 \uB85C\uCF00\uC77C \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\n-X \uC635\uC158\uC740 \uBE44\uD45C\uC900 \uC635\uC158\uC774\uBBC0\uB85C \uD1B5\uC9C0 \uC5C6\uC774 \uBCC0\uACBD\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n
+java.launcher.X.macosx.usage=\n\uB2E4\uC74C\uC740 Mac OS X\uC5D0 \uD2B9\uC815\uB41C \uC635\uC158\uC785\uB2C8\uB2E4.\n    -XstartOnFirstThread\n                      \uCCAB\uBC88\uC9F8 (AppKit) \uC2A4\uB808\uB4DC\uC5D0 main() \uBA54\uC18C\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4.\n    -Xdock:name=<application name>"\n                      \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC774\uB984\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n    -Xdock:icon=<path to icon file>\n                      \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\n
 
 java.launcher.cls.error1=\uC624\uB958: \uAE30\uBCF8 \uD074\uB798\uC2A4 {0}\uC744(\uB97C) \uCC3E\uAC70\uB098 \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
-java.launcher.cls.error2=\uC624\uB958: {1} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uAC00 {0}\uC774(\uAC00) \uC544\uB2D9\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n\   public static void main(String[] args)
-java.launcher.cls.error3=\uC624\uB958: \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB294 {0} \uD074\uB798\uC2A4\uC5D0\uC11C void \uC720\uD615\uC758 \uAC12\uC744 \uBC18\uD658\uD574\uC57C \uD569\uB2C8\uB2E4. \n\uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n\   public static void main(String[] args)
-java.launcher.cls.error4=\uC624\uB958: {0} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n\   public static void main(String[] args)
+java.launcher.cls.error2=\uC624\uB958: {1} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uAC00 {0}\uC774(\uAC00) \uC544\uB2D9\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n   public static void main(String[] args)
+java.launcher.cls.error3=\uC624\uB958: \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB294 {0} \uD074\uB798\uC2A4\uC5D0\uC11C void \uC720\uD615\uC758 \uAC12\uC744 \uBC18\uD658\uD574\uC57C \uD569\uB2C8\uB2E4. \n\uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n   public static void main(String[] args)
+java.launcher.cls.error4=\uC624\uB958: {0} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\r\n   public static void main(String[] args)\r\n\uB610\uB294 JavaFX \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uD074\uB798\uC2A4\uB294 {1}\uC744(\uB97C) \uD655\uC7A5\uD574\uC57C \uD569\uB2C8\uB2E4.
+java.launcher.cls.error5=\uC624\uB958: \uC774 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC744 \uC2E4\uD589\uD558\uB294 \uB370 \uD544\uC694\uD55C JavaFX \uB7F0\uD0C0\uC784 \uAD6C\uC131 \uC694\uC18C\uAC00 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
 java.launcher.jar.error1=\uC624\uB958: {0} \uD30C\uC77C\uC744 \uC5F4\uB824\uACE0 \uC2DC\uB3C4\uD558\uB294 \uC911 \uC608\uC0C1\uCE58 \uC54A\uC740 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
 java.launcher.jar.error2={0}\uC5D0\uC11C Manifest\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
 java.launcher.jar.error3={0}\uC5D0 \uAE30\uBCF8 Manifest \uC18D\uC131\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
+java.launcher.init.error=\uCD08\uAE30\uD654 \uC624\uB958
+java.launcher.javafx.error1=\uC624\uB958: JavaFX launchApplication \uBA54\uC18C\uB4DC\uC5D0 \uC798\uBABB\uB41C \uC11C\uBA85\uC774 \uC788\uC2B5\uB2C8\uB2E4.\\n\uB530\uB77C\uC11C static\uC73C\uB85C \uC120\uC5B8\uD558\uACE0 void \uC720\uD615\uC758 \uAC12\uC744 \uBC18\uD658\uD574\uC57C \uD569\uB2C8\uB2E4.
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   Uso: {0} [-options] class [args...]\n\           (para executar uma classe)\n   ou  {0} [-options] -jar jarfile [args...]\n\           (para executar um arquivo jar)\nem que as op\u00E7\u00F5es incluem:\n
+java.launcher.opt.header  =   Uso: {0} [-options] class [args...]\n           (para executar uma classe)\n   ou  {0} [-options] -jar jarfile [args...]\n           (para executar um arquivo jar)\nem que as op\u00E7\u00F5es incluem:\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  usar um modelo de dados de {0} bits, se estiver dispon\u00EDvel\n
 java.launcher.opt.vmselect   =\    {0}\t  para selecionar a VM "{1}"\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  porque a execu\u00E7\u00E3o est\u00E1 sendo feita em uma m\u00E1quina de classe de servidor.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n\    -classpath <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n\                  Uma lista separada por {0} de diret\u00F3rios, archives JAR\n\                  e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n\    -D<nome>=<valor>\n\                  define uma propriedade do sistema\n\    -verbose[:classe|gc|jni]\n\                  ativa a sa\u00EDda detalhada\n\    -version      imprime a vers\u00E3o do produto e sai do programa\n\    -version:<valor>\n\                  requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n\    -showversion  imprime a vers\u00E3o do produto e continua\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n\    -? -help      imprime esta mensagem de ajuda\n\    -X            imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n\    -ea[:<nome do pacote>...|:<nome da classe>]\n\    -enableassertions[:<nome do pacote>...|:<nome da classe>]\n\                  ativa asser\u00E7\u00F5es com granularidade especificada\n\    -da[:<nome do pacote>...|:<nome da classe>]\n\    -disableassertions[:<nome do pacote>...|:<nome da classe>]\n\                  desativa asser\u00E7\u00F5es com granularidade especificada\n\    -esa | -enablesystemassertions\n\                  ativa asser\u00E7\u00F5es do sistema\n\    -dsa | -disablesystemassertions\n\                  desativa asser\u00E7\u00F5es do sistema\n\    -agentlib:<nome da biblioteca>[=<op\u00E7\u00F5es>]\n\                  carrega a biblioteca de agentes nativa <nome da biblioteca>, por exempl: -agentlib:hprof\n\                  consulte tamb\u00E9m: -agentlib:jdwp=help e -agentlib:hprof=help\n\    -agentpath:<nome do caminho>[=<op\u00E7\u00F5es>]\n\                  carrega a biblioteca de agentes nativa com base no nome do caminho completo\n\    -javaagent:<caminho do arquivo jar>[=<op\u00E7\u00F5es>]\n\                  carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n\    -splash:<caminho da imagem>\n\                  mostra a tela de abertura com a imagem especificada\nConsulte http://java.sun.com/javase/reference para obter mais detalhes.
+java.launcher.opt.footer     =\    -cp <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n    -classpath <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n                  Uma lista separada por {0} de diret\u00F3rios, archives JAR\n                  e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n    -D<nome>=<valor>\n                  define uma propriedade do sistema\n    -verbose[:classe|gc|jni]\n                  ativa a sa\u00EDda detalhada\n    -version      imprime a vers\u00E3o do produto e sai do programa\n    -version:<valor>\n                  requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n    -showversion  imprime a vers\u00E3o do produto e continua\n    -jre-restrict-search | -no-jre-restrict-search\n                  inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n    -? -help      imprime esta mensagem de ajuda\n    -X            imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n    -ea[:<nome do pacote>...|:<nome da classe>]\n    -enableassertions[:<nome do pacote>...|:<nome da classe>]\n                  ativa asser\u00E7\u00F5es com granularidade especificada\n    -da[:<nome do pacote>...|:<nome da classe>]\n    -disableassertions[:<nome do pacote>...|:<nome da classe>]\n                  desativa asser\u00E7\u00F5es com granularidade especificada\n    -esa | -enablesystemassertions\n                  ativa asser\u00E7\u00F5es do sistema\n    -dsa | -disablesystemassertions\n                  desativa asser\u00E7\u00F5es do sistema\n    -agentlib:<nome da biblioteca>[=<op\u00E7\u00F5es>]\n                  carrega a biblioteca de agentes nativa <nome da biblioteca>, por exemplo: -agentlib:hprof\n                  consulte tamb\u00E9m: -agentlib:jdwp=help e -agentlib:hprof=help\n    -agentpath:<nome do caminho>[=<op\u00E7\u00F5es>]\n                  carrega a biblioteca de agentes nativa com base no nome do caminho completo\n    -javaagent:<caminho do arquivo jar>[=<op\u00E7\u00F5es>]\n                  carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n    -splash:<caminho da imagem>\n                  mostra a tela de abertura com a imagem especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obter mais detalhes.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           execu\u00E7\u00E3o no modo misto (default)\n    -Xint             execu\u00E7\u00E3o somente no modo interpretado\n    -Xbootclasspath:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n                      define o caminho de pesquisa para classes e recursos de inicializa\u00E7\u00E3o\n    -Xbootclasspath/a:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n                      anexa no final do caminho da classe de inicializa\u00E7\u00E3o\n    -Xbootclasspath/p:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n                      anexa no in\u00EDcio do caminho da classe de inicializa\u00E7\u00E3o\n    -Xdiag            mostra mensagens de diagn\u00F3stico adicionais\n    -Xnoclassgc       desativa a coleta de lixo da classe\n    -Xincgc           ativa a coleta de lixo incremental\n    -Xloggc:<arquivo>    registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n    -Xbatch           desativa a compila\u00E7\u00E3o em segundo plano\n    -Xms<tamanho>        define o tamanho inicial do heap Java\n    -Xmx<tamanho>        define o tamanho m\u00E1ximo do heap Java\n    -Xss<tamanho>        define o tamanho da pilha de threads java\n    -Xprof            produz dados de perfil da cpu\n    -Xfuture          ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor default futuro\n    -Xrs              reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n    -Xcheck:jni       executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n    -Xshare:off       n\u00E3o tenta usar dados da classe compartilhada\n    -Xshare:auto      se poss\u00EDvel, usa dados da classe compartilhada (default)\n    -Xshare:on        requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n    -XshowSettings    mostra todas as defini\u00E7\u00F5es e continua\n    -XshowSettings:all\n                      mostra todas as defini\u00E7\u00F5es e continua\n    -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n    -XshowSettings:properties\n                      mostra todas as defini\u00E7\u00F5es da propriedade e continua\n    -XshowSettings:locale\n                      mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n\nAs -X options n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           execu\u00E7\u00E3o no modo misto (default)\n\    -Xint             execu\u00E7\u00E3o somente no modo interpretado\n\    -Xbootclasspath:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\                      define o caminho de pesquisa para classes e recursos de inicializa\u00E7\u00E3o\n\    -Xbootclasspath/a:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\                      anexa no final do caminho da classe de inicializa\u00E7\u00E3o\n\    -Xbootclasspath/p:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\                      anexa no in\u00EDcio do caminho da classe de inicializa\u00E7\u00E3o\n\    -Xdiag            mostra mensagens de diagn\u00F3stico adicionais\n\    -Xnoclassgc       desativa a coleta de lixo da classe\n\    -Xincgc           ativa a coleta de lixo incremental\n\    -Xloggc:<arquivo>    registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n\    -Xbatch           desativa a compila\u00E7\u00E3o em segundo plano\n\    -Xms<tamanho>        define o tamanho inicial do heap Java\n\    -Xmx<tamanho>        define o tamanho m\u00E1ximo do heap Java\n\    -Xss<tamanho>        define o tamanho da pilha de threads java\n\    -Xprof            produz dados de perfil da cpu\n\    -Xfuture          ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor default futuro\n\    -Xrs              reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n\    -Xcheck:jni       executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n\    -Xshare:off       n\u00E3o tenta usar dados da classe compartilhada\n\    -Xshare:auto      se poss\u00EDvel, usa dados da classe compartilhada (default)\n\    -Xshare:on        requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n\    -XshowSettings    mostra todas as defini\u00E7\u00F5es e continua\n\    -XshowSettings:all\n\                      mostra todas as defini\u00E7\u00F5es e continua\n\    -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n\    -XshowSettings:properties\n\                      mostra todas as defini\u00E7\u00F5es da propriedade e continua\n\    -XshowSettings:locale\n\                      mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n\nAs -X options n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n
+java.launcher.X.macosx.usage=\nAs op\u00E7\u00F5es a seguir s\u00E3o espec\u00EDficas para o Mac OS X:\n    -XstartOnFirstThread\n                      executa o m\u00E9todo main() no primeiro thread (AppKit)\n    -Xdock:name=<nome da aplica\u00E7\u00E3o>"\n                      substitui o nome da aplica\u00E7\u00E3o default exibido no encaixe\n    -Xdock:icon=<caminho para o arquivo do \u00EDcone>\n                      substitui o \u00EDcone exibido no encaixe\n\n
 
 java.launcher.cls.error1=Erro: N\u00E3o foi poss\u00EDvel localizar nem carregar a classe principal {0}
-java.launcher.cls.error2=Erro: O m\u00E9todo principal n\u00E3o \u00E9 {0} na classe {1}; defina o m\u00E9todo principal como:\n\   public static void main(String[] args)
-java.launcher.cls.error3=Erro: O m\u00E9todo principal deve retornar um valor do tipo void na classe {0}; \ndefina o m\u00E9todo principal como:\n\   public static void main(String[] args)
-java.launcher.cls.error4=Erro: O m\u00E9todo principal n\u00E3o foi encontrado na classe {0}; defina o m\u00E9todo principal como:\n\   public static void main(String[] args)
+java.launcher.cls.error2=Erro: o m\u00E9todo main n\u00E3o \u00E9 {0} na classe {1}; defina o m\u00E9todo main como:\n   public static void main(String[] args)
+java.launcher.cls.error3=Erro: o m\u00E9todo main deve retornar um valor do tipo void na classe {0}; \ndefina o m\u00E9todo main como:\n   public static void main(String[] args)
+java.launcher.cls.error4=Erro: o m\u00E9todo main n\u00E3o foi encontrado na classe {0}; defina o m\u00E9todo main como:\\n   public static void main(String[] args)\\nou uma classe da aplica\u00E7\u00E3o JavaFX deve expandir {1}
+java.launcher.cls.error5=Erro: os componentes de runtime do JavaFX n\u00E3o foram encontrados. Eles s\u00E3o obrigat\u00F3rios para executar esta aplica\u00E7\u00E3o
 java.launcher.jar.error1=Erro: ocorreu um erro inesperado ao tentar abrir o arquivo {0}
 java.launcher.jar.error2=manifesto n\u00E3o encontrado em {0}
 java.launcher.jar.error3=nenhum atributo de manifesto principal em {0}
+java.launcher.init.error=erro de inicializa\u00E7\u00E3o
+java.launcher.javafx.error1=Erro: O m\u00E9todo launchApplication do JavaFX tem a assinatura errada. Ele\\ndeve ser declarado como est\u00E1tico e retornar um valor do tipo void
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   Syntax: {0} [-alternativ] class [argument...]\n\           (f\u00F6r att k\u00F6ra en klass)\n   eller  {0} [-alternativ] -jar jarfile [argument...]\n\           (f\u00F6r att k\u00F6ra en jar-fil)\nd\u00E4r alternativen omfattar:\n
+java.launcher.opt.header  =   Syntax: {0} [-alternativ] class [argument...]\n           (f\u00F6r att k\u00F6ra en klass)\n   eller  {0} [-alternativ] -jar jarfile [argument...]\n           (f\u00F6r att k\u00F6ra en jar-fil)\nd\u00E4r alternativen omfattar:\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  anv\u00E4nd en {0}-bitsdatamodell om det finns\n
 java.launcher.opt.vmselect   =\    {0}\t  f\u00F6r att v\u00E4lja "{1}" VM\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  eftersom du k\u00F6r en serverklassmaskin.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <klass\u00F6kv\u00E4g f\u00F6r kataloger och zip-/jar-filer>\n\    -classpath <klass\u00F6kv\u00E4g f\u00F6r kataloger och zip-/jar-filer>\n\                  En {0}-avgr\u00E4nsad lista med kataloger, JAR-arkiv,\n\                  och ZIP-arkiv f\u00F6r s\u00F6kning efter klassfiler.\n\    -D<namn>=<v\u00E4rde>\n\                  ange en systemegenskap\n\    -verbose[:class|gc|jni]\n\                  aktivera utf\u00F6rliga utdata\n\    -version      skriv ut produktversionen och avsluta\n\    -version:<v\u00E4rde>\n\                  beg\u00E4r den specifika versionen som ska k\u00F6ras\n\    -showversion  skriv ut produktversionen och forts\u00E4tt\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  inkludera/exkludera anv\u00E4ndarprivata JRE:er i versions\u00F6kningen\n\    -? -help      skriv ut det h\u00E4r hj\u00E4lpmeddelandet\n\    -X            skriv ut hj\u00E4lp f\u00F6r icke-standardalternativ\n\    -ea[:<paket>...|:<klass>]\n\    -enableassertions[:<paket>...|:<klass>]\n\                  aktivera verifiering med angiven detaljgrad\n\    -da[:<packagename>...|:<klass>]\n\    -disableassertions[:<paket>...|:<klass>]\n\                  avaktivera verifiering med angiven detaljgrad\n\    -esa | -enablesystemassertions\n\                  aktivera systemverifieringar\n\    -dsa | -disablesystemassertions\n\                  avaktivera systemverifieringar\n\    -agentlib:<bibliotek>[=<alternativ>]\n\                  ladda ursprungligt agentbibliotek <bibliotek>, e.g. -agentlib:hprof\n\                  se \u00E4ven -agentlib:jdwp=help och -agentlib:hprof=help\n\    -agentpath:<s\u00F6kv\u00E4g>[=<alternativ>]\n\                  ladda ursprungligt agentbibliotek med helt s\u00F6kv\u00E4gsnamn\n\    -javaagent:<jar-s\u00F6kv\u00E4g>[=<alternativ>]\n\                  ladda Java-programspr\u00E5ksagent, se java.lang.instrument\n\    -splash:<bilds\u00F6kv\u00E4g>\n\                  visa v\u00E4lkomstsk\u00E4rm med angiven bild\nMer information finns p\u00E5 http://java.sun.com/javase/reference.
+java.launcher.opt.footer     =\    -cp <klass\u00F6kv\u00E4g f\u00F6r kataloger och zip-/jar-filer>\n    -classpath <klass\u00F6kv\u00E4g f\u00F6r kataloger och zip-/jar-filer>\n                  En {0}-separerad lista med kataloger, JAR-arkiv,\n                  och ZIP-arkiv f\u00F6r s\u00F6kning efter klassfiler.\n    -D<name>=<value>\n                  ange en systemegenskap\n    -verbose:[class|gc|jni]\n                  aktivera utf\u00F6rliga utdata\n    -version      skriv ut produktversionen och avsluta\n    -version:<value>\n                  beg\u00E4r den specifika versionen som ska k\u00F6ras\n    -showversion  skriv ut produktversionen och forts\u00E4tt\n    -jre-restrict-search | -no-jre-restrict-search\n                  inkludera/exkludera anv\u00E4ndarprivata JRE:er i versions\u00F6kningen\n    -? -help      skriv ut det h\u00E4r hj\u00E4lpmeddelandet\n    -X            skriv ut hj\u00E4lp f\u00F6r icke-standardalternativ\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  aktivera verifiering med angiven detaljgrad\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  avaktivera verifiering med angiven detaljgrad\n    -esa | -enablesystemassertions\n                  aktivera systemverifieringar\n    -dsa | -disablesystemassertions\n                  avaktivera systemverifieringar\n    -agentlib:<libname>[=<options>]\n                  ladda ursprungligt agentbibliotek <libname>, e.g. -agentlib:hprof\n                  se \u00E4ven -agentlib:jdwp=help och -agentlib:hprof=help\n    -agentpath:<pathname>[=<options>]\n                  ladda ursprungligt agentbibliotek med helt s\u00F6kv\u00E4gsnamn\n    -javaagent:<jarpath>[=<options>]\n                  ladda Java-programspr\u00E5ksagent, se java.lang.instrument\n    -splash:<imagepath>\n                  visa v\u00E4lkomstsk\u00E4rm med angiven bild\nMer information finns p\u00E5 http://www.oracle.com/technetwork/java/javase/documentation/index.html.
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           k\u00F6rning i blandat l\u00E4ge (standard)\n    -Xint             endast k\u00F6rning i tolkat l\u00E4ge\n    -Xbootclasspath:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n                      ange s\u00F6kv\u00E4g f\u00F6r programladdningsklasser och -resurser\n    -Xbootclasspath/a:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n                      l\u00E4gg till i slutet av programladdningsklassens s\u00F6kv\u00E4g\n    -Xbootclasspath/p:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n                      l\u00E4gg till i b\u00F6rjan av programladdningsklassens s\u00F6kv\u00E4g\n    -Xdiag            visa ytterligare diagnostiska meddelanden\n    -Xnoclassgc       avaktivera klassens skr\u00E4pinsamling\n    -Xincgc           aktivera inkrementell skr\u00E4pinsamling\n    -Xloggc:<fil>    logga GC-status till en fil med tidsst\u00E4mplar\n    -Xbatch           avaktivera bakgrundskompilering\n    -Xms<storlek>        ange ursprunglig storlek f\u00F6r Java-heap\n    -Xmx<storlek>        ange maximal storlek f\u00F6r Java-heap\n    -Xss<storlek>        ange storlek f\u00F6r java-tr\u00E5dsstack\n    -Xprof            utdata f\u00F6r processorprofilering\n    -Xfuture          aktivera str\u00E4ngaste kontroller, f\u00F6rv\u00E4ntad framtida standard\n    -Xrs              minska OS-signalanv\u00E4ndning av Java/VM (se dokumentation)\n    -Xcheck:jni       utf\u00F6r ytterligare kontroller f\u00F6r JNI-funktioner\n    -Xshare:off       anv\u00E4nd inte delade klassdata\n    -Xshare:auto      anv\u00E4nd delade klassdata om det g\u00E5r (standard)\n    -Xshare:on        kr\u00E4v att delade klassdata anv\u00E4nds, annars slutf\u00F6r inte.\n    -XshowSettings    visa alla inst\u00E4llningar och forts\u00E4tt\n    -XshowSettings:all\n                      visa alla inst\u00E4llningar och forts\u00E4tt\n    -XshowSettings:vm visa alla vm-relaterade inst\u00E4llningar och forts\u00E4tt\n    -XshowSettings:properties\n                      visa alla egenskapsinst\u00E4llningar och forts\u00E4tt\n    -XshowSettings:locale\n                      visa alla spr\u00E5krelaterade inst\u00E4llningar och forts\u00E4tt\n\n-X-alternativen \u00E4r inte standard och kan \u00E4ndras utan f\u00F6reg\u00E5ende meddelande.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           k\u00F6rning i blandat l\u00E4ge (standard)\n\    -Xint             endast k\u00F6rning i tolkat l\u00E4ge\n\    -Xbootclasspath:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n\                      ange s\u00F6kv\u00E4g f\u00F6r programladdningsklasser och -resurser\n\    -Xbootclasspath/a:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n\                      l\u00E4gg till i slutet av programladdningsklassens s\u00F6kv\u00E4g\n\    -Xbootclasspath/p:<kataloger och zip-/jar-filer avgr\u00E4nsas med {0}>\n\                      l\u00E4gg till i b\u00F6rjan av programladdningsklassens s\u00F6kv\u00E4g\n\    -Xdiag            visa ytterligare diagnostiska meddelanden\n\    -Xnoclassgc       avaktivera klassens skr\u00E4pinsamling\n\    -Xincgc           aktivera inkrementell skr\u00E4pinsamling\n\    -Xloggc:<fil>    logga GC-status till en fil med tidsst\u00E4mplar\n\    -Xbatch           avaktivera bakgrundskompilering\n\    -Xms<storlek>        ange ursprunglig storlek f\u00F6r Java-heap\n\    -Xmx<storlek>        ange maximal storlek f\u00F6r Java-heap\n\    -Xss<storlek>        ange storlek f\u00F6r java-tr\u00E5dsstack\n\    -Xprof            utdata f\u00F6r processorprofilering\n\    -Xfuture          aktivera str\u00E4ngaste kontroller, f\u00F6rv\u00E4ntad framtida standard\n\    -Xrs              minska OS-signalanv\u00E4ndning av Java/VM (se dokumentation)\n\    -Xcheck:jni       utf\u00F6r ytterligare kontroller f\u00F6r JNI-funktioner\n\    -Xshare:off       anv\u00E4nd inte delade klassdata\n\    -Xshare:auto      anv\u00E4nd delade klassdata om det g\u00E5r (standard)\n\    -Xshare:on        kr\u00E4v att delade klassdata anv\u00E4nds, annars slutf\u00F6r inte.\n\    -XshowSettings    visa alla inst\u00E4llningar och forts\u00E4tt\n\    -XshowSettings:all\n\                      visa alla inst\u00E4llningar och forts\u00E4tt\n\    -XshowSettings:vm visa alla vm-relaterade inst\u00E4llningar och forts\u00E4tt\n\    -XshowSettings:properties\n\                      visa alla egenskapsinst\u00E4llningar och forts\u00E4tt\n\    -XshowSettings:locale\n\                      visa alla spr\u00E5krelaterade inst\u00E4llningar och forts\u00E4tt\n\n-X-alternativen \u00E4r inte standard och kan \u00E4ndras utan f\u00F6reg\u00E5ende meddelande.\n
+java.launcher.X.macosx.usage=\nF\u00F6ljande alternativ \u00E4r specifika f\u00F6r Mac OS X:\n    -XstartOnFirstThread\n                      k\u00F6r huvudmetoden() p\u00E5 den f\u00F6rsta (AppKit) tr\u00E5den\n    -Xdock:name=<application name>"\n                      \u00E5sidosatt standardapplikationsnamn visas i docka\n    -Xdock:icon=<path to icon file>\n                      \u00E5sidosatt standardikon visas i docka\n\n
 
 java.launcher.cls.error1=Fel: Hittar inte eller kan inte ladda huvudklassen {0}
-java.launcher.cls.error2=Fel: Huvudmetoden \u00E4r inte {0} i klassen {1}, definiera huvudmetoden som:\n\   public static void main(String[] args)
-java.launcher.cls.error3=Fel: Huvudmetoden m\u00E5ste returnera ett v\u00E4rde av typen void i klassen {0}, \ndefiniera huvudmetoden som:\n\   public static void main(String[] args)
-java.launcher.cls.error4=Fel: Huvudmetoden finns inte i klassen {0}, definiera huvudmetoden som:\n\   public static void main(String[] args)
+java.launcher.cls.error2=Fel: Huvudmetoden \u00E4r inte {0} i klassen {1}, definiera huvudmetoden som:\n   public static void main(String[] args)
+java.launcher.cls.error3=Fel: Huvudmetoden m\u00E5ste returnera ett v\u00E4rde av typen void i klassen {0}, \ndefiniera huvudmetoden som:\n   public static void main(String[] args)
+java.launcher.cls.error4=Fel: Huvudmetoden finns inte i klassen {0}, definiera huvudmetoden som:\n   public static void main(String[] args)\neller s\u00E5 m\u00E5ste en JavaFX-applikationsklass ut\u00F6ka {1}
+java.launcher.cls.error5=Fel: JavaFX-k\u00F6rningskomponenter saknas, och de kr\u00E4vs f\u00F6r att kunna k\u00F6ra den h\u00E4r applikationen
 java.launcher.jar.error1=Fel: Ett ov\u00E4ntat fel intr\u00E4ffade n\u00E4r filen {0} skulle \u00F6ppnas
 java.launcher.jar.error2=manifest finns inte i {0}
 java.launcher.jar.error3=inget huvudmanifestattribut i {0}
+java.launcher.init.error=initieringsfel
+java.launcher.javafx.error1=Fel: JavaFX launchApplication-metoden har fel signatur, den \nm\u00E5ste ha deklarerats som statisk och returnera ett v\u00E4rde av typen void
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   \u7528\u6CD5: {0} [-options] class [args...]\n\           (\u6267\u884C\u7C7B)\n   \u6216  {0} [-options] -jar jarfile [args...]\n\           (\u6267\u884C jar \u6587\u4EF6)\n\u5176\u4E2D\u9009\u9879\u5305\u62EC:\n
+java.launcher.opt.header  =   \u7528\u6CD5: {0} [-options] class [args...]\n           (\u6267\u884C\u7C7B)\n   \u6216  {0} [-options] -jar jarfile [args...]\n           (\u6267\u884C jar \u6587\u4EF6)\n\u5176\u4E2D\u9009\u9879\u5305\u62EC:\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  \u4F7F\u7528 {0} \u4F4D\u6570\u636E\u6A21\u578B (\u5982\u679C\u53EF\u7528)\n
 java.launcher.opt.vmselect   =\    {0}\t  \u9009\u62E9 "{1}" VM\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  \u56E0\u4E3A\u60A8\u662F\u5728\u670D\u52A1\u5668\u7C7B\u8BA1\u7B97\u673A\u4E0A\u8FD0\u884C\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n\    -classpath <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n\                  \u7528 {0} \u5206\u9694\u7684\u76EE\u5F55, JAR \u6863\u6848\n\                  \u548C ZIP \u6863\u6848\u5217\u8868, \u7528\u4E8E\u641C\u7D22\u7C7B\u6587\u4EF6\u3002\n\    -D<name>=<value>\n\                  \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n\    -verbose[:class|gc|jni]\n\                  \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\    -version      \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u9000\u51FA\n\    -version:<value>\n\                  \u9700\u8981\u6307\u5B9A\u7684\u7248\u672C\u624D\u80FD\u8FD0\u884C\n\    -showversion  \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u7EE7\u7EED\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  \u5728\u7248\u672C\u641C\u7D22\u4E2D\u5305\u62EC/\u6392\u9664\u7528\u6237\u4E13\u7528 JRE\n\    -? -help      \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\n\    -X            \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u5E2E\u52A9\n\    -ea[:<packagename>...|:<classname>]\n\    -enableassertions[:<packagename>...|:<classname>]\n\                  \u6309\u6307\u5B9A\u7684\u7C92\u5EA6\u542F\u7528\u65AD\u8A00\n\    -da[:<packagename>...|:<classname>]\n\    -disableassertions[:<packagename>...|:<classname>]\n\                  \u7981\u7528\u5177\u6709\u6307\u5B9A\u7C92\u5EA6\u7684\u65AD\u8A00\n\    -esa | -enablesystemassertions\n\                  \u542F\u7528\u7CFB\u7EDF\u65AD\u8A00\n\    -dsa | -disablesystemassertions\n\                  \u7981\u7528\u7CFB\u7EDF\u65AD\u8A00\n\    -agentlib:<libname>[=<options>]\n\                  \u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93 <libname>, \u4F8B\u5982 -agentlib:hprof\n\                  \u53E6\u8BF7\u53C2\u9605 -agentlib:jdwp=help \u548C -agentlib:hprof=help\n\    -agentpath:<pathname>[=<options>]\n\                  \u6309\u5B8C\u6574\u8DEF\u5F84\u540D\u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93\n\    -javaagent:<jarpath>[=<options>]\n\                  \u52A0\u8F7D Java \u7F16\u7A0B\u8BED\u8A00\u4EE3\u7406, \u8BF7\u53C2\u9605 java.lang.instrument\n\    -splash:<imagepath>\n\                  \u4F7F\u7528\u6307\u5B9A\u7684\u56FE\u50CF\u663E\u793A\u542F\u52A8\u5C4F\u5E55\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605 http://java.sun.com/javase/reference\u3002
+java.launcher.opt.footer     =\    -cp <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n\\    -classpath <\u76EE\u5F55\u548C zip/jar \u6587\u4EF6\u7684\u7C7B\u641C\u7D22\u8DEF\u5F84>\n\\                  \u7528 {0} \u5206\u9694\u7684\u76EE\u5F55, JAR \u6863\u6848\n\\                  \u548C ZIP \u6863\u6848\u5217\u8868, \u7528\u4E8E\u641C\u7D22\u7C7B\u6587\u4EF6\u3002\n\\    -D<\u540D\u79F0>=<\u503C>\n\\                  \u8BBE\u7F6E\u7CFB\u7EDF\u5C5E\u6027\n\\    -verbose:[class|gc|jni]\n\\                  \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\\    -version      \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u9000\u51FA\n\\    -version:<\u503C>\n\\                  \u9700\u8981\u6307\u5B9A\u7684\u7248\u672C\u624D\u80FD\u8FD0\u884C\n\\    -showversion  \u8F93\u51FA\u4EA7\u54C1\u7248\u672C\u5E76\u7EE7\u7EED\n\\    -jre-restrict-search | -no-jre-restrict-search\n\\                  \u5728\u7248\u672C\u641C\u7D22\u4E2D\u5305\u62EC/\u6392\u9664\u7528\u6237\u4E13\u7528 JRE\n\\    -? -help      \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\n\\    -X            \u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u5E2E\u52A9\n\\    -ea[:<packagename>...|:<classname>]\n\\    -enableassertions[:<packagename>...|:<classname>]\n\\                  \u6309\u6307\u5B9A\u7684\u7C92\u5EA6\u542F\u7528\u65AD\u8A00\n\\    -da[:<packagename>...|:<classname>]\n\\    -disableassertions[:<packagename>...|:<classname>]\n\\                  \u7981\u7528\u5177\u6709\u6307\u5B9A\u7C92\u5EA6\u7684\u65AD\u8A00\n\\    -esa | -enablesystemassertions\n\\                  \u542F\u7528\u7CFB\u7EDF\u65AD\u8A00\n\\    -dsa | -disablesystemassertions\n\\                  \u7981\u7528\u7CFB\u7EDF\u65AD\u8A00\n\\    -agentlib:<libname>[=<\u9009\u9879>]\n\\                  \u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93 <libname>, \u4F8B\u5982 -agentlib:hprof\n\\                  \u53E6\u8BF7\u53C2\u9605 -agentlib:jdwp=help \u548C -agentlib:hprof=help\n\\    -agentpath:<pathname>[=<\u9009\u9879>]\n\\                  \u6309\u5B8C\u6574\u8DEF\u5F84\u540D\u52A0\u8F7D\u672C\u673A\u4EE3\u7406\u5E93\n\\    -javaagent:<jarpath>[=<\u9009\u9879>]\n\\                  \u52A0\u8F7D Java \u7F16\u7A0B\u8BED\u8A00\u4EE3\u7406, \u8BF7\u53C2\u9605 java.lang.instrument\n\\    -splash:<imagepath>\n\\                  \u4F7F\u7528\u6307\u5B9A\u7684\u56FE\u50CF\u663E\u793A\u542F\u52A8\u5C4F\u5E55\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605 http://www.oracle.com/technetwork/java/javase/documentation/index.html\u3002
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           \u6DF7\u5408\u6A21\u5F0F\u6267\u884C (\u9ED8\u8BA4)\n    -Xint             \u4EC5\u89E3\u91CA\u6A21\u5F0F\u6267\u884C\n    -Xbootclasspath:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n                      \u8BBE\u7F6E\u641C\u7D22\u8DEF\u5F84\u4EE5\u5F15\u5BFC\u7C7B\u548C\u8D44\u6E90\n    -Xbootclasspath/a:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n                      \u9644\u52A0\u5728\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u672B\u5C3E\n    -Xbootclasspath/p:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n                      \u7F6E\u4E8E\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u4E4B\u524D\n    -Xdiag            \u663E\u793A\u9644\u52A0\u8BCA\u65AD\u6D88\u606F\n    -Xnoclassgc       \u7981\u7528\u7C7B\u5783\u573E\u6536\u96C6\n    -Xincgc           \u542F\u7528\u589E\u91CF\u5783\u573E\u6536\u96C6\n    -Xloggc:<file>    \u5C06 GC \u72B6\u6001\u8BB0\u5F55\u5728\u6587\u4EF6\u4E2D (\u5E26\u65F6\u95F4\u6233)\n    -Xbatch           \u7981\u7528\u540E\u53F0\u7F16\u8BD1\n    -Xms<size>        \u8BBE\u7F6E\u521D\u59CB Java \u5806\u5927\u5C0F\n    -Xmx<size>        \u8BBE\u7F6E\u6700\u5927 Java \u5806\u5927\u5C0F\n    -Xss<size>        \u8BBE\u7F6E Java \u7EBF\u7A0B\u5806\u6808\u5927\u5C0F\n    -Xprof            \u8F93\u51FA cpu \u914D\u7F6E\u6587\u4EF6\u6570\u636E\n    -Xfuture          \u542F\u7528\u6700\u4E25\u683C\u7684\u68C0\u67E5, \u9884\u671F\u5C06\u6765\u7684\u9ED8\u8BA4\u503C\n    -Xrs              \u51CF\u5C11 Java/VM \u5BF9\u64CD\u4F5C\u7CFB\u7EDF\u4FE1\u53F7\u7684\u4F7F\u7528 (\u8BF7\u53C2\u9605\u6587\u6863)\n    -Xcheck:jni       \u5BF9 JNI \u51FD\u6570\u6267\u884C\u5176\u4ED6\u68C0\u67E5\n    -Xshare:off       \u4E0D\u5C1D\u8BD5\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E\n    -Xshare:auto      \u5728\u53EF\u80FD\u7684\u60C5\u51B5\u4E0B\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E (\u9ED8\u8BA4)\n    -Xshare:on        \u8981\u6C42\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E, \u5426\u5219\u5C06\u5931\u8D25\u3002\n    -XshowSettings    \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XshowSettings:all\n                      \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XshowSettings:vm \u663E\u793A\u6240\u6709\u4E0E vm \u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XshowSettings:properties\n                      \u663E\u793A\u6240\u6709\u5C5E\u6027\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n    -XshowSettings:locale\n                      \u663E\u793A\u6240\u6709\u4E0E\u533A\u57DF\u8BBE\u7F6E\u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\n-X \u9009\u9879\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           \u6DF7\u5408\u6A21\u5F0F\u6267\u884C (\u9ED8\u8BA4)\n\    -Xint             \u4EC5\u89E3\u91CA\u6A21\u5F0F\u6267\u884C\n\    -Xbootclasspath:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n\                      \u8BBE\u7F6E\u641C\u7D22\u8DEF\u5F84\u4EE5\u5F15\u5BFC\u7C7B\u548C\u8D44\u6E90\n\    -Xbootclasspath/a:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n\                      \u9644\u52A0\u5728\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u672B\u5C3E\n\    -Xbootclasspath/p:<\u7528 {0} \u5206\u9694\u7684\u76EE\u5F55\u548C zip/jar \u6587\u4EF6>\n\                      \u7F6E\u4E8E\u5F15\u5BFC\u7C7B\u8DEF\u5F84\u4E4B\u524D\n\    -Xdiag            \u663E\u793A\u9644\u52A0\u8BCA\u65AD\u6D88\u606F\n\    -Xnoclassgc       \u7981\u7528\u7C7B\u5783\u573E\u6536\u96C6\n\    -Xincgc           \u542F\u7528\u589E\u91CF\u5783\u573E\u6536\u96C6\n\    -Xloggc:<file>    \u5C06 GC \u72B6\u6001\u8BB0\u5F55\u5728\u6587\u4EF6\u4E2D (\u5E26\u65F6\u95F4\u6233)\n\    -Xbatch           \u7981\u7528\u540E\u53F0\u7F16\u8BD1\n\    -Xms<size>        \u8BBE\u7F6E\u521D\u59CB Java \u5806\u5927\u5C0F\n\    -Xmx<size>        \u8BBE\u7F6E\u6700\u5927 Java \u5806\u5927\u5C0F\n\    -Xss<size>        \u8BBE\u7F6E Java \u7EBF\u7A0B\u5806\u6808\u5927\u5C0F\n\    -Xprof            \u8F93\u51FA cpu \u914D\u7F6E\u6587\u4EF6\u6570\u636E\n\    -Xfuture          \u542F\u7528\u6700\u4E25\u683C\u7684\u68C0\u67E5, \u9884\u671F\u5C06\u6765\u7684\u9ED8\u8BA4\u503C\n\    -Xrs              \u51CF\u5C11 Java/VM \u5BF9\u64CD\u4F5C\u7CFB\u7EDF\u4FE1\u53F7\u7684\u4F7F\u7528 (\u8BF7\u53C2\u9605\u6587\u6863)\n\    -Xcheck:jni       \u5BF9 JNI \u51FD\u6570\u6267\u884C\u5176\u4ED6\u68C0\u67E5\n\    -Xshare:off       \u4E0D\u5C1D\u8BD5\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E\n\    -Xshare:auto      \u5728\u53EF\u80FD\u7684\u60C5\u51B5\u4E0B\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E (\u9ED8\u8BA4)\n\    -Xshare:on        \u8981\u6C42\u4F7F\u7528\u5171\u4EAB\u7C7B\u6570\u636E, \u5426\u5219\u5C06\u5931\u8D25\u3002\n\    -XshowSettings    \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\    -XshowSettings:all\n\                      \u663E\u793A\u6240\u6709\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\    -XshowSettings:vm \u663E\u793A\u6240\u6709\u4E0E vm \u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\    -XshowSettings:properties\n\                      \u663E\u793A\u6240\u6709\u5C5E\u6027\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\    -XshowSettings:locale\n\                      \u663E\u793A\u6240\u6709\u4E0E\u533A\u57DF\u8BBE\u7F6E\u76F8\u5173\u7684\u8BBE\u7F6E\u5E76\u7EE7\u7EED\n\n-X \u9009\u9879\u662F\u975E\u6807\u51C6\u9009\u9879, \u5982\u6709\u66F4\u6539, \u6055\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
+java.launcher.X.macosx.usage=\n\u4EE5\u4E0B\u9009\u9879\u4E3A Mac OS X \u7279\u5B9A\u7684\u9009\u9879:\n    -XstartOnFirstThread\n                      \u5728\u7B2C\u4E00\u4E2A (AppKit) \u7EBF\u7A0B\u4E0A\u8FD0\u884C main() \u65B9\u6CD5\n    -Xdock:name=<\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0>"\n                      \u8986\u76D6\u505C\u9760\u680F\u4E2D\u663E\u793A\u7684\u9ED8\u8BA4\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0\n    -Xdock:icon=<\u56FE\u6807\u6587\u4EF6\u7684\u8DEF\u5F84>\n                      \u8986\u76D6\u505C\u9760\u680F\u4E2D\u663E\u793A\u7684\u9ED8\u8BA4\u56FE\u6807\n\n
 
 java.launcher.cls.error1=\u9519\u8BEF: \u627E\u4E0D\u5230\u6216\u65E0\u6CD5\u52A0\u8F7D\u4E3B\u7C7B {0}
-java.launcher.cls.error2=\u9519\u8BEF: \u4E3B\u65B9\u6CD5\u4E0D\u662F\u7C7B {1} \u4E2D\u7684{0}, \u8BF7\u5C06\u4E3B\u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n\   public static void main(String[] args)
-java.launcher.cls.error3=\u9519\u8BEF: \u4E3B\u65B9\u6CD5\u5FC5\u987B\u8FD4\u56DE\u7C7B {0} \u4E2D\u7684\u7A7A\u7C7B\u578B\u503C, \u8BF7\n\u5C06\u4E3B\u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n\   public static void main(String[] args)
-java.launcher.cls.error4=\u9519\u8BEF: \u5728\u7C7B {0} \u4E2D\u627E\u4E0D\u5230\u4E3B\u65B9\u6CD5, \u8BF7\u5C06\u4E3B\u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n\   public static void main(String[] args)
+java.launcher.cls.error2=\u9519\u8BEF: main \u65B9\u6CD5\u4E0D\u662F\u7C7B {1} \u4E2D\u7684{0}, \u8BF7\u5C06 main \u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n   public static void main(String[] args)
+java.launcher.cls.error3=\u9519\u8BEF: main \u65B9\u6CD5\u5FC5\u987B\u8FD4\u56DE\u7C7B {0} \u4E2D\u7684\u7A7A\u7C7B\u578B\u503C, \u8BF7\n\u5C06 main \u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n   public static void main(String[] args)
+java.launcher.cls.error4=\u9519\u8BEF: \u5728\u7C7B {0} \u4E2D\u627E\u4E0D\u5230 main \u65B9\u6CD5, \u8BF7\u5C06 main \u65B9\u6CD5\u5B9A\u4E49\u4E3A:\n   public static void main(String[] args)\n\u5426\u5219 JavaFX \u5E94\u7528\u7A0B\u5E8F\u7C7B\u5FC5\u987B\u6269\u5C55{1}
+java.launcher.cls.error5=\u9519\u8BEF: \u7F3A\u5C11 JavaFX \u8FD0\u884C\u65F6\u7EC4\u4EF6, \u9700\u8981\u4F7F\u7528\u8BE5\u7EC4\u4EF6\u6765\u8FD0\u884C\u6B64\u5E94\u7528\u7A0B\u5E8F
 java.launcher.jar.error1=\u9519\u8BEF: \u5C1D\u8BD5\u6253\u5F00\u6587\u4EF6{0}\u65F6\u51FA\u73B0\u610F\u5916\u9519\u8BEF
 java.launcher.jar.error2=\u5728{0}\u4E2D\u627E\u4E0D\u5230\u6E05\u5355
 java.launcher.jar.error3={0}\u4E2D\u6CA1\u6709\u4E3B\u6E05\u5355\u5C5E\u6027
+java.launcher.init.error=\u521D\u59CB\u5316\u9519\u8BEF
+java.launcher.javafx.error1=\u9519\u8BEF: JavaFX launchApplication \u65B9\u6CD5\u5177\u6709\u9519\u8BEF\u7684\u7B7E\u540D, \u5FC5\u987B\n\u5C06\u65B9\u6CD5\u58F0\u660E\u4E3A\u9759\u6001\u65B9\u6CD5\u5E76\u8FD4\u56DE\u7A7A\u7C7B\u578B\u7684\u503C
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, 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,7 +24,7 @@
 #
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.header  =   \u7528\u6CD5: {0} [-options] class [args...]\n\           (\u57F7\u884C\u985E\u5225)\n   \u6216  {0} [-options] -jar jarfile [args...]\n\           (\u57F7\u884C jar \u6A94\u6848)\n\u9078\u9805\u5305\u62EC:\n
+java.launcher.opt.header  =   \u7528\u6CD5: {0} [-options] class [args...]\n           (\u57F7\u884C\u985E\u5225)\n   \u6216  {0} [-options] -jar jarfile [args...]\n           (\u57F7\u884C jar \u6A94\u6848)\n\u9078\u9805\u5305\u62EC:\n
 
 java.launcher.opt.datamodel  =\    -d{0}\t  \u4F7F\u7528 {0} \u4F4D\u5143\u8CC7\u6599\u6A21\u578B (\u5982\u679C\u6709\u7684\u8A71)\n
 java.launcher.opt.vmselect   =\    {0}\t  \u9078\u53D6 "{1}" VM\n
@@ -34,15 +34,21 @@
 java.launcher.ergo.message2  =\                  \u56E0\u70BA\u60A8\u6B63\u5728\u4F3A\u670D\u5668\u985E\u5225\u6A5F\u5668\u4E0A\u57F7\u884C\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n\    -classpath <class search path of directories and zip/jar files>\n\                  \u641C\u5C0B\u985E\u5225\u6A94\u6848\u4E4B\u76EE\u9304\u3001JAR \u5B58\u6A94\n\                  \u548C ZIP \u5B58\u6A94\u7684\u4EE5{0}\u5206\u9694\u7684\u6E05\u55AE\u3002\n\    -D<name>=<value>\n\                  \u8A2D\u5B9A\u7CFB\u7D71\u5C6C\u6027\n\    -verbose[:class|gc|jni]\n\                  \u555F\u7528\u8A73\u7D30\u8CC7\u8A0A\u8F38\u51FA\n\    -version      \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7D50\u675F\n\    -version:<value>\n\                  \u9700\u8981\u6307\u5B9A\u7684\u7248\u672C\u624D\u80FD\u57F7\u884C\n\    -showversion  \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7E7C\u7E8C\n\    -jre-restrict-search | -no-jre-restrict-search\n\                  \u5728\u7248\u672C\u641C\u5C0B\u4E2D\u5305\u62EC/\u6392\u9664\u4F7F\u7528\u8005\u5C08\u7528 JRE\n\    -? -help      \u5217\u5370\u6B64\u8AAA\u660E\u8A0A\u606F\n\    -X            \u5217\u5370\u975E\u6A19\u6E96\u9078\u9805\u7684\u8AAA\u660E\n\    -ea[:<packagename>...|:<classname>]\n\    -enableassertions[:<packagename>...|:<classname>]\n\                  \u555F\u7528\u5177\u6709\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n\    -da[:<packagename>...|:<classname>]\n\    -disableassertions[:<packagename>...|:<classname>]\n\                  \u505C\u7528\u5177\u6709\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n\    -esa | -enablesystemassertions\n\                  \u555F\u7528\u7CFB\u7D71\u5BA3\u544A\n\    -dsa | -disablesystemassertions\n\                  \u505C\u7528\u7CFB\u7D71\u5BA3\u544A\n\    -agentlib:<libname>[=<options>]\n\                  \u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB <libname>\uFF0C\u4F8B\u5982 -agentlib:hprof\n\                  \u53E6\u8ACB\u53C3\u95B1 -agentlib:jdwp=help \u8207 -agentlib:hprof=help\n\    -agentpath:<pathname>[=<options>]\n\                  \u4F7F\u7528\u5B8C\u6574\u8DEF\u5F91\u540D\u7A31\u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB\n\    -javaagent:<jarpath>[=<options>]\n\                  \u8F09\u5165 Java \u7A0B\u5F0F\u8A9E\u8A00\u4EE3\u7406\u7A0B\u5F0F\uFF0C\u8ACB\u53C3\u95B1 java.lang.instrument\n\    -splash:<imagepath>\n\                  \u986F\u793A\u6307\u5B9A\u5F71\u50CF\u7684\u8EDF\u9AD4\u8CC7\u8A0A\u756B\u9762\n\u8ACB\u53C3\u95B1 http://java.sun.com/javase/reference\uFF0C\u66B8\u89E3\u8A73\u7D30\u8CC7\u8A0A\u3002
+java.launcher.opt.footer     =\    -cp <class search path of directories and zip/jar files>\n    -classpath <class search path of directories and zip/jar files>\n                  \u4F7F\u7528 {0} \u5340\u9694\u7684\u76EE\u9304\u3001JAR \u5B58\u6A94\u4EE5\u53CA\n                  ZIP \u5B58\u6A94\u6E05\u55AE\u4F86\u641C\u5C0B\u985E\u5225\u6A94\u6848\u3002\n    -D<name>=<value>\n                  \u8A2D\u5B9A\u7CFB\u7D71\u5C6C\u6027\n    -verbose:[class|gc|jni]\n                  \u555F\u7528\u8A73\u7D30\u8CC7\u8A0A\u8F38\u51FA\n    -version      \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7D50\u675F\n    -version:<value>\n                  \u9700\u8981\u6307\u5B9A\u7684\u7248\u672C\u624D\u80FD\u57F7\u884C\n    -showversion  \u5217\u5370\u7522\u54C1\u7248\u672C\u4E26\u7E7C\u7E8C\n    -jre-restrict-search | -no-jre-restrict-search\n                  \u5728\u7248\u672C\u641C\u5C0B\u4E2D\u5305\u62EC/\u6392\u9664\u4F7F\u7528\u8005\u5C08\u7528 JRE\n    -? -help      \u5217\u5370\u6B64\u8AAA\u660E\u8A0A\u606F\n    -X            \u5217\u5370\u975E\u6A19\u6E96\u9078\u9805\u7684\u8AAA\u660E\n    -ea[:<packagename>...|:<classname>]\n    -enableassertions[:<packagename>...|:<classname>]\n                  \u555F\u7528\u542B\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n    -da[:<packagename>...|:<classname>]\n    -disableassertions[:<packagename>...|:<classname>]\n                  \u505C\u7528\u542B\u6307\u5B9A\u8A73\u7D30\u7A0B\u5EA6\u7684\u5BA3\u544A\n    -esa | -enablesystemassertions\n                  \u555F\u7528\u7CFB\u7D71\u5BA3\u544A\n    -dsa | -disablesystemassertions\n                  \u505C\u7528\u7CFB\u7D71\u5BA3\u544A\n    -agentlib:<libname>[=<options>]\n                  \u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB <libname>\uFF0C\u4F8B\u5982 -agentlib:hprof\n                  \u53E6\u8ACB\u53C3\u95B1 -agentlib:jdwp=help \u8207 -agentlib:hprof=help\n    -agentpath:<pathname>[=<options>]\n                  \u4F7F\u7528\u5B8C\u6574\u8DEF\u5F91\u540D\u7A31\u8F09\u5165\u539F\u751F\u4EE3\u7406\u7A0B\u5F0F\u7A0B\u5F0F\u5EAB\n    -javaagent:<jarpath>[=<options>]\n                  \u8F09\u5165 Java \u7A0B\u5F0F\u8A9E\u8A00\u4EE3\u7406\u7A0B\u5F0F\uFF0C\u8ACB\u53C3\u95B1 java.lang.instrument\n    -splash:<imagepath>\n                  \u986F\u793A\u6307\u5B9A\u5F71\u50CF\u7684\u8EDF\u9AD4\u8CC7\u8A0A\u756B\u9762\n\u8ACB\u53C3\u95B1 http://www.oracle.com/technetwork/java/javase/documentation/index.html \u66B8\u89E3\u8A73\u7D30\u8CC7\u8A0A\u3002
+
+# Translators please note do not translate the options themselves
+java.launcher.X.usage=\    -Xmixed           \u6DF7\u5408\u6A21\u5F0F\u57F7\u884C (\u9810\u8A2D)\n    -Xint             \u50C5\u9650\u89E3\u8B6F\u6A21\u5F0F\u57F7\u884C\n    -Xbootclasspath:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n                      \u8A2D\u5B9A\u555F\u52D5\u5B89\u88DD\u985E\u5225\u548C\u8CC7\u6E90\u7684\u641C\u5C0B\u8DEF\u5F91\n    -Xbootclasspath/a:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n                      \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u7D50\u5C3E\n    -Xbootclasspath/p:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n                      \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u524D\u9762\n    -Xdiag            \u986F\u793A\u5176\u4ED6\u7684\u8A3A\u65B7\u8A0A\u606F\n    -Xnoclassgc       \u505C\u7528\u985E\u5225\u8CC7\u6E90\u56DE\u6536\n    -Xincgc           \u555F\u7528\u6F38\u9032\u8CC7\u6E90\u56DE\u6536\n    -Xloggc:<file>    \u5229\u7528\u6642\u6233\u5C07 GC \u72C0\u614B\u8A18\u9304\u81F3\u6A94\u6848\u4E2D\n    -Xbatch           \u505C\u7528\u80CC\u666F\u7DE8\u8B6F\n    -Xms<size>        \u8A2D\u5B9A\u8D77\u59CB Java \u5806\u96C6\u5927\u5C0F\n    -Xmx<size>        \u8A2D\u5B9A Java \u5806\u96C6\u5927\u5C0F\u4E0A\u9650\n    -Xss<size>        \u8A2D\u5B9A Java \u57F7\u884C\u7DD2\u5806\u758A\u5927\u5C0F\n    -Xprof            \u8F38\u51FA CPU \u5206\u6790\u8CC7\u6599\n    -Xfuture          \u555F\u7528\u6700\u56B4\u683C\u7684\u6AA2\u67E5\uFF0C\u9810\u5148\u505A\u70BA\u5C07\u4F86\u7684\u9810\u8A2D\n    -Xrs              \u6E1B\u5C11 Java/VM \u4F7F\u7528\u4F5C\u696D\u7CFB\u7D71\u4FE1\u865F (\u8ACB\u53C3\u95B1\u6587\u4EF6)\n    -Xcheck:jni       \u57F7\u884C\u5176\u4ED6\u7684 JNI \u51FD\u6578\u6AA2\u67E5\n    -Xshare:off       \u4E0D\u5617\u8A66\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\n    -Xshare:auto      \u5118\u53EF\u80FD\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599 (\u9810\u8A2D)\n    -Xshare:on        \u9700\u8981\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\uFF0C\u5426\u5247\u5931\u6557\u3002\n    -XshowSettings    \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XshowSettings:all\n                      \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XshowSettings:vm \u986F\u793A\u6240\u6709 VM \u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XshowSettings:properties\n                      \u986F\u793A\u6240\u6709\u5C6C\u6027\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n    -XshowSettings:locale\n                      \u986F\u793A\u6240\u6709\u5730\u5340\u8A2D\u5B9A\u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\n -X \u9078\u9805\u4E0D\u662F\u6A19\u6E96\u9078\u9805\uFF0C\u82E5\u6709\u8B8A\u66F4\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
 
 # Translators please note do not translate the options themselves
-java.launcher.X.usage=\    -Xmixed           \u6DF7\u5408\u6A21\u5F0F\u57F7\u884C (\u9810\u8A2D)\n\    -Xint             \u50C5\u9650\u89E3\u8B6F\u6A21\u5F0F\u57F7\u884C\n\    -Xbootclasspath:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n\                      \u8A2D\u5B9A\u555F\u52D5\u5B89\u88DD\u985E\u5225\u548C\u8CC7\u6E90\u7684\u641C\u5C0B\u8DEF\u5F91\n\    -Xbootclasspath/a:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n\                      \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u7D50\u5C3E\n\    -Xbootclasspath/p:<\u4EE5 {0} \u5206\u9694\u7684\u76EE\u9304\u548C zip/jar \u6A94\u6848>\n\                      \u9644\u52A0\u5728\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8DEF\u5F91\u7684\u524D\u9762\n\    -Xdiag            \u986F\u793A\u5176\u4ED6\u7684\u8A3A\u65B7\u8A0A\u606F\n\    -Xnoclassgc       \u505C\u7528\u985E\u5225\u8CC7\u6E90\u56DE\u6536\n\    -Xincgc           \u555F\u7528\u6F38\u9032\u8CC7\u6E90\u56DE\u6536\n\    -Xloggc:<file>    \u5229\u7528\u6642\u6233\u5C07 GC \u72C0\u614B\u8A18\u9304\u81F3\u6A94\u6848\u4E2D\n\    -Xbatch           \u505C\u7528\u80CC\u666F\u7DE8\u8B6F\n\    -Xms<size>        \u8A2D\u5B9A\u8D77\u59CB Java \u5806\u96C6\u5927\u5C0F\n\    -Xmx<size>        \u8A2D\u5B9A Java \u5806\u96C6\u5927\u5C0F\u4E0A\u9650\n\    -Xss<size>        \u8A2D\u5B9A Java \u57F7\u884C\u7DD2\u5806\u758A\u5927\u5C0F\n\    -Xprof            \u8F38\u51FA CPU \u5206\u6790\u8CC7\u6599\n\    -Xfuture          \u555F\u7528\u6700\u56B4\u683C\u7684\u6AA2\u67E5\uFF0C\u9810\u5148\u505A\u70BA\u5C07\u4F86\u7684\u9810\u8A2D\n\    -Xrs              \u6E1B\u5C11 Java/VM \u4F7F\u7528\u4F5C\u696D\u7CFB\u7D71\u4FE1\u865F (\u8ACB\u53C3\u95B1\u6587\u4EF6)\n\    -Xcheck:jni       \u57F7\u884C\u5176\u4ED6\u7684 JNI \u51FD\u6578\u6AA2\u67E5\n\    -Xshare:off       \u4E0D\u5617\u8A66\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\n\    -Xshare:auto      \u5118\u53EF\u80FD\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599 (\u9810\u8A2D)\n\    -Xshare:on        \u9700\u8981\u4F7F\u7528\u5171\u7528\u985E\u5225\u8CC7\u6599\uFF0C\u5426\u5247\u5931\u6557\u3002\n\    -XshowSettings    \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\    -XshowSettings:all\n\                      \u986F\u793A\u6240\u6709\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\    -XshowSettings:vm \u986F\u793A\u6240\u6709 VM \u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\    -XshowSettings:properties\n\                      \u986F\u793A\u6240\u6709\u5C6C\u6027\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\    -XshowSettings:locale\n\                      \u986F\u793A\u6240\u6709\u5730\u5340\u8A2D\u5B9A\u76F8\u95DC\u8A2D\u5B9A\u503C\u4E26\u7E7C\u7E8C\n\n -X \u9078\u9805\u4E0D\u662F\u6A19\u6E96\u9078\u9805\uFF0C\u82E5\u6709\u8B8A\u66F4\u4E0D\u53E6\u884C\u901A\u77E5\u3002\n
+java.launcher.X.macosx.usage=\n\u4E0B\u5217\u662F Mac OS X \u7279\u5B9A\u9078\u9805:\n    -XstartOnFirstThread\n                      \u5728\u7B2C\u4E00\u500B (AppKit) \u57F7\u884C\u7DD2\u57F7\u884C main() \u65B9\u6CD5\n    -Xdock:name=<application name>"\n                      \u8986\u5BEB\u7D50\u5408\u8AAA\u660E\u756B\u9762\u4E2D\u986F\u793A\u7684\u9810\u8A2D\u61C9\u7528\u7A0B\u5F0F\u540D\u7A31\n    -Xdock:icon=<path to icon file>\n                      \u8986\u5BEB\u7D50\u5408\u8AAA\u660E\u756B\u9762\u4E2D\u986F\u793A\u7684\u9810\u8A2D\u5716\u793A\n\n
 
 java.launcher.cls.error1=\u932F\u8AA4: \u627E\u4E0D\u5230\u6216\u7121\u6CD5\u8F09\u5165\u4E3B\u8981\u985E\u5225 {0}
-java.launcher.cls.error2=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u4E0D\u662F\u985E\u5225 {1} \u4E2D\u7684 {0}\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n\   public static void main(String[] args)
-java.launcher.cls.error3=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u5FC5\u9808\u50B3\u56DE\u985E\u5225 {0} \u4E2D void \u985E\u578B\u7684\u503C\uFF0C \n\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n\   public static void main(String[] args)
-java.launcher.cls.error4=\u932F\u8AA4: \u5728\u985E\u5225 {0} \u4E2D\u627E\u4E0D\u5230\u4E3B\u8981\u65B9\u6CD5\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n\   public static void main(String[] args)
+java.launcher.cls.error2=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u4E0D\u662F\u985E\u5225 {1} \u4E2D\u7684 {0}\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n   public static void main(String[] args)
+java.launcher.cls.error3=\u932F\u8AA4: \u4E3B\u8981\u65B9\u6CD5\u5FC5\u9808\u50B3\u56DE\u985E\u5225 {0} \u4E2D void \u985E\u578B\u7684\u503C\uFF0C \n\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n   public static void main(String[] args)
+java.launcher.cls.error4=\u932F\u8AA4: \u5728\u985E\u5225 {0} \u4E2D\u627E\u4E0D\u5230\u4E3B\u8981\u65B9\u6CD5\uFF0C\u8ACB\u5B9A\u7FA9\u4E3B\u8981\u65B9\u6CD5\u70BA:\n   public static void main(String[] args)\n\u6216\u8005 JavaFX \u61C9\u7528\u7A0B\u5F0F\u985E\u5225\u5FC5\u9808\u64F4\u5145 {1}
+java.launcher.cls.error5=\u932F\u8AA4: \u907A\u6F0F\u57F7\u884C\u6B64\u61C9\u7528\u7A0B\u5F0F\u6240\u9700\u7684 JavaFX \u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C\u5143\u4EF6
 java.launcher.jar.error1=\u932F\u8AA4: \u5617\u8A66\u958B\u555F\u6A94\u6848 {0} \u6642\u767C\u751F\u672A\u9810\u671F\u7684\u932F\u8AA4
 java.launcher.jar.error2=\u5728 {0} \u4E2D\u627E\u4E0D\u5230\u8CC7\u8A0A\u6E05\u55AE
 java.launcher.jar.error3={0} \u4E2D\u6C92\u6709\u4E3B\u8981\u8CC7\u8A0A\u6E05\u55AE\u5C6C\u6027
+java.launcher.init.error=\u521D\u59CB\u5316\u932F\u8AA4
+java.launcher.javafx.error1=\u932F\u8AA4: JavaFX launchApplication \u65B9\u6CD5\u7684\u7C3D\u7AE0\u932F\u8AA4\uFF0C\u5B83\n\u5FC5\u9808\u5BA3\u544A\u70BA\u975C\u614B\u4E26\u50B3\u56DE void \u985E\u578B\u7684\u503C
--- a/jdk/src/share/classes/sun/management/AgentConfigurationError.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/AgentConfigurationError.java	Wed May 08 10:10:05 2013 +0100
@@ -128,19 +128,13 @@
     public AgentConfigurationError(String error, String... params) {
         super();
         this.error = error;
-        this.params = new String[params.length];
-        for (int i = 0; i < params.length; i++) {
-            this.params[i] = params[i];
-        }
+        this.params = params.clone();
     }
 
     public AgentConfigurationError(String error, Throwable cause, String... params) {
         super(cause);
         this.error = error;
-        this.params = new String[params.length];
-        for (int i = 0; i < params.length; i++) {
-            this.params[i] = params[i];
-        }
+        this.params = params.clone();
     }
 
     public String getError() {
@@ -148,7 +142,7 @@
     }
 
     public String[] getParams() {
-        return params;
+        return params.clone();
     }
 
     private static final long serialVersionUID = 1211605593516195475L;
--- a/jdk/src/share/classes/sun/management/resources/agent_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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,11 +40,12 @@
 
 agent.err.agentclass.notfound      = Management Agent-Klasse nicht gefunden
 agent.err.agentclass.failed        = Management Agent-Klasse nicht erfolgreich
-agent.err.premain.notfound         = premain(String) ist in Agentklasse nicht vorhanden
+agent.err.premain.notfound         = premain(String) ist in Agent-Klasse nicht vorhanden
 agent.err.agentclass.access.denied = Zugriff auf premain(String) wurde abgelehnt
 agent.err.invalid.agentclass       = Ung\u00FCltiger Eigenschaftswert f\u00FCr com.sun.management.agent.class
-
+agent.err.invalid.state            = Ung\u00FCltiger Agent-Zustand
 agent.err.invalid.jmxremote.port   = Ung\u00FCltige Nummer f\u00FCr com.sun.management.jmxremote.port
+agent.err.invalid.jmxremote.rmi.port = Ung\u00FCltige Nummer f\u00FCr com.sun.management.jmxremote.rmi.port
 
 agent.err.file.not.set               = Datei nicht angegeben
 agent.err.file.not.readable          = Datei nicht lesbar
@@ -52,13 +53,13 @@
 agent.err.file.not.found             = Datei wurde nicht gefunden
 agent.err.file.access.not.restricted = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden
 
-agent.err.password.file.notset     = Es wurde keine Kennwortdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf \"true\" gesetzt ist
+agent.err.password.file.notset     = Es wurde keine Kennwortdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf "true" gesetzt ist
 agent.err.password.file.not.readable = Kennwortdatei nicht lesbar
 agent.err.password.file.read.failed = Kennwortdatei konnte nicht gelesen werden
 agent.err.password.file.notfound   = Kennwortdatei nicht gefunden
 agent.err.password.file.access.notrestricted = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden
 
-agent.err.access.file.notset       = Es wurde keine Zugriffsdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf \"true\" gesetzt ist
+agent.err.access.file.notset       = Es wurde keine Zugriffsdatei angegeben, obwohl com.sun.management.jmxremote.authenticate auf "true" gesetzt ist
 agent.err.access.file.not.readable = Zugriffsdatei kann nicht gelesen werden
 agent.err.access.file.read.failed  = Zugriffsdatei konnte nicht gelesen werden
 agent.err.access.file.notfound     = Zugriffsdatei nicht gefunden
@@ -69,7 +70,7 @@
 agent.err.invalid.snmp.port        = Ung\u00FCltige Nummer f\u00FCr com.sun.management.snmp.port
 agent.err.invalid.snmp.trap.port   = Ung\u00FCltige Nummer f\u00FCr com.sun.management.snmp.trap
 agent.err.unknown.snmp.interface   = Unbekannte SNMP-Schnittstelle
-agent.err.acl.file.notset          = Es wurde keine SNMP-ACL-Datei angegeben, obwohl com.sun.management.snmp.acl auf \"true\" gesetzt ist
+agent.err.acl.file.notset          = Es wurde keine SNMP-ACL-Datei angegeben, obwohl com.sun.management.snmp.acl auf "true" gesetzt ist
 agent.err.acl.file.notfound        = SNMP-ACL-Datei konnte nicht gefunden werden
 agent.err.acl.file.not.readable    = SNMP-ACL-Datei kann nicht gelesen werden
 agent.err.acl.file.read.failed     = SNMP-ACL-Datei konnte nicht gelesen werden
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = Fehler beim Starten des SNMP-Adaptors mit Adresse
 agent.err.snmp.mib.init.failed     = Initialisierung von SNMP-MIB nicht erfolgreich mit Fehler
 
-jmxremote.ConnectorBootstrap.initialize = JMX-Connector-Server starten:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Keine Authentifizierung
-jmxremote.ConnectorBootstrap.initialize.ready = JMX-Connector bereit unter: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden: {0}
+jmxremote.ConnectorBootstrap.starting = JMX-Connector-Server starten:
+jmxremote.ConnectorBootstrap.noAuthentication = Keine Authentifizierung
+jmxremote.ConnectorBootstrap.ready = JMX-Connector bereit unter: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Lesezugriff auf Kennwortdatei muss eingeschr\u00E4nkt werden: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Lesezugriff auf Datei muss eingeschr\u00E4nkt werden: {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = ACL wird verarbeitet
 jmxremote.AdaptorBootstrap.getTargetList.adding = Ziel hinzuf\u00FCgen: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = premain(String) no existe en la clase del agente
 agent.err.agentclass.access.denied = Acceso denegado a premain(String)
 agent.err.invalid.agentclass       = Valor de propiedad com.sun.management.agent.class no v\u00E1lido
-
+agent.err.invalid.state            = Estado del agente no v\u00E1lido
 agent.err.invalid.jmxremote.port   = N\u00FAmero com.sun.management.jmxremote.port no v\u00E1lido
+agent.err.invalid.jmxremote.rmi.port = N\u00FAmero com.sun.management.jmxremote.rmi.port no v\u00E1lido
 
 agent.err.file.not.set               = Archivo no especificado
 agent.err.file.not.readable          = Archivo ilegible
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = Fallo al iniciar el adaptador de SNMP con la direcci\u00F3n
 agent.err.snmp.mib.init.failed     = Fallo al inicializar el MIB de SNMP con error
 
-jmxremote.ConnectorBootstrap.initialize = Iniciando servidor de conector JMX:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Sin autenticaci\u00F3n
-jmxremote.ConnectorBootstrap.initialize.ready = Conector JMX listo en: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = Se debe restringir el acceso de lectura al archivo de contrase\u00F1as: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = El acceso de lectura al archivo debe ser restringido: {0}
+jmxremote.ConnectorBootstrap.starting = Iniciando servidor de conector JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Sin autenticaci\u00F3n
+jmxremote.ConnectorBootstrap.ready = Conector JMX listo en: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Se debe restringir el acceso de lectura al archivo de contrase\u00F1as: {0}
+jmxremote.ConnectorBootstrap.file.readonly = El acceso de lectura al archivo debe ser restringido: {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = Procesando ACL
 jmxremote.AdaptorBootstrap.getTargetList.adding = Agregando destino: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = premain(String) n'existe pas dans la classe d'agents
 agent.err.agentclass.access.denied = Acc\u00E8s \u00E0 premain(String) refus\u00E9
 agent.err.invalid.agentclass       = Valeur de propri\u00E9t\u00E9 com.sun.management.agent.class incorrecte
-
+agent.err.invalid.state            = Etat de l'agent non valide
 agent.err.invalid.jmxremote.port   = Num\u00E9ro com.sun.management.jmxremote.port incorrect
+agent.err.invalid.jmxremote.rmi.port = Num\u00E9ro com.sun.management.jmxremote.rmi.port non valide
 
 agent.err.file.not.set               = Fichier non sp\u00E9cifi\u00E9
 agent.err.file.not.readable          = Fichier illisible
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = Impossible de d\u00E9marrer l'adaptateur SNMP avec l'adresse
 agent.err.snmp.mib.init.failed     = Impossible d'initialiser SNMP MIB avec l'erreur
 
-jmxremote.ConnectorBootstrap.initialize = D\u00E9marrage du serveur du connecteur JMX :
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Pas d'authentification
-jmxremote.ConnectorBootstrap.initialize.ready = Connecteur JMX pr\u00EAt \u00E0 : {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = L''acc\u00E8s en lecture au fichier de mots de passe doit \u00EAtre limit\u00E9 : {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = L''acc\u00E8s en lecture au fichier doit \u00EAtre limit\u00E9 : {0}
+jmxremote.ConnectorBootstrap.starting = D\u00E9marrage du serveur du connecteur JMX :
+jmxremote.ConnectorBootstrap.noAuthentication = Pas d'authentification
+jmxremote.ConnectorBootstrap.ready = Connecteur JMX pr\u00EAt \u00E0 : {0}
+jmxremote.ConnectorBootstrap.password.readonly = L''acc\u00E8s en lecture au fichier de mots de passe doit \u00EAtre limit\u00E9 : {0}
+jmxremote.ConnectorBootstrap.file.readonly = L''acc\u00E8s en lecture au fichier doit \u00EAtre limit\u00E9 : {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = Traitement de la liste de contr\u00F4le d'acc\u00E8s (ACL)
 jmxremote.AdaptorBootstrap.getTargetList.adding = Ajout de la cible : {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = premain(String) non esiste nella classe agente
 agent.err.agentclass.access.denied = Accesso negato a premain(String)
 agent.err.invalid.agentclass       = Valore propriet\u00E0 com.sun.management.agent.class non valido
-
+agent.err.invalid.state            = Stato agente non valido
 agent.err.invalid.jmxremote.port   = Numero com.sun.management.jmxremote.port non valido
+agent.err.invalid.jmxremote.rmi.port = Numero com.sun.management.jmxremote.rmi.port non valido
 
 agent.err.file.not.set               = File non specificato
 agent.err.file.not.readable          = File non leggibile
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = Impossibile avviare l'adattatore SNMP con indirizzo
 agent.err.snmp.mib.init.failed     = Impossibile inizializzare MIB SNMP con errore
 
-jmxremote.ConnectorBootstrap.initialize = Avvio del server connettore JMX:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Nessuna autenticazione
-jmxremote.ConnectorBootstrap.initialize.ready = Connettore JMX pronto in: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = Limitare l''accesso in lettura al password file: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = Limitare l''accesso in lettura al file: {0}
+jmxremote.ConnectorBootstrap.starting = Avvio del server connettore JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Nessuna autenticazione
+jmxremote.ConnectorBootstrap.ready = Connettore JMX pronto in: {0}
+jmxremote.ConnectorBootstrap.password.readonly = Limitare l''accesso in lettura al password file: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Limitare l''accesso in lettura al file: {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = Elaborazione ACL
 jmxremote.AdaptorBootstrap.getTargetList.adding = Aggiunta destinazione: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = premain(String)\u304C\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u30FB\u30AF\u30E9\u30B9\u306B\u5B58\u5728\u3057\u307E\u305B\u3093
 agent.err.agentclass.access.denied = premain(String)\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F
 agent.err.invalid.agentclass       = com.sun.management.agent.class\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5024\u304C\u7121\u52B9\u3067\u3059
-
+agent.err.invalid.state            = \u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306E\u72B6\u614B\u304C\u7121\u52B9\u3067\u3059
 agent.err.invalid.jmxremote.port   = com.sun.management.jmxremote.port\u306E\u756A\u53F7\u304C\u7121\u52B9\u3067\u3059
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port\u306E\u756A\u53F7\u304C\u7121\u52B9\u3067\u3059
 
 agent.err.file.not.set               = \u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
 agent.err.file.not.readable          = \u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u53D6\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = \u3053\u306E\u30A2\u30C9\u30EC\u30B9\u3067SNMP\u30A2\u30C0\u30D7\u30BF\u3092\u958B\u59CB\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
 agent.err.snmp.mib.init.failed     = \u30A8\u30E9\u30FC\u3067SNMP MIB\u3092\u521D\u671F\u5316\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
 
-jmxremote.ConnectorBootstrap.initialize = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30B5\u30FC\u30D0\u30FC\u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = \u8A8D\u8A3C\u306A\u3057
-jmxremote.ConnectorBootstrap.initialize.ready = JMX\u30B3\u30CD\u30AF\u30BF\u306E\u6E96\u5099\u304C\u3067\u304D\u307E\u3057\u305F: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
+jmxremote.ConnectorBootstrap.starting = JMX\u30B3\u30CD\u30AF\u30BF\u30FB\u30B5\u30FC\u30D0\u30FC\u3092\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059:
+jmxremote.ConnectorBootstrap.noAuthentication = \u8A8D\u8A3C\u306A\u3057
+jmxremote.ConnectorBootstrap.ready = JMX\u30B3\u30CD\u30AF\u30BF\u306E\u6E96\u5099\u304C\u3067\u304D\u307E\u3057\u305F: {0}
+jmxremote.ConnectorBootstrap.password.readonly = \u30D1\u30B9\u30EF\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u53D6\u308A\u30A2\u30AF\u30BB\u30B9\u306F\u5236\u9650\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = ACL\u3092\u51E6\u7406\u3057\u3066\u3044\u307E\u3059
 jmxremote.AdaptorBootstrap.getTargetList.adding = \u30BF\u30FC\u30B2\u30C3\u30C8\u3092\u8FFD\u52A0\u3057\u3066\u3044\u307E\u3059: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = \uC5D0\uC774\uC804\uD2B8 \uD074\uB798\uC2A4\uC5D0 premain(\uBB38\uC790\uC5F4)\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
 agent.err.agentclass.access.denied = premain(\uBB38\uC790\uC5F4)\uC5D0 \uB300\uD55C \uC561\uC138\uC2A4\uAC00 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
 agent.err.invalid.agentclass       = com.sun.management.agent.class \uC18D\uC131 \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
-
+agent.err.invalid.state            = \uBD80\uC801\uD569\uD55C \uC5D0\uC774\uC804\uD2B8 \uC0C1\uD0DC
 agent.err.invalid.jmxremote.port   = com.sun.management.jmxremote.port \uBC88\uD638\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+agent.err.invalid.jmxremote.rmi.port = \uBD80\uC801\uD569\uD55C com.sun.management.jmxremote.rmi.port \uBC88\uD638
 
 agent.err.file.not.set               = \uD30C\uC77C\uC774 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
 agent.err.file.not.readable          = \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = \uC8FC\uC18C\uAC00 \uC788\uB294 SNMP \uC5B4\uB311\uD130 \uC2DC\uC791\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
 agent.err.snmp.mib.init.failed     = \uC624\uB958\uB85C \uC778\uD574 SNMP MIB \uCD08\uAE30\uD654\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
 
-jmxremote.ConnectorBootstrap.initialize = JMX \uCEE4\uB125\uD130 \uC11C\uBC84\uB97C \uC2DC\uC791\uD558\uB294 \uC911:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = \uC778\uC99D \uC5C6\uC74C
-jmxremote.ConnectorBootstrap.initialize.ready = {0}\uC5D0\uC11C JMX \uCEE4\uB125\uD130\uAC00 \uC900\uBE44\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
-jmxremote.ConnectorBootstrap.initialize.password.readonly = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
+jmxremote.ConnectorBootstrap.starting = JMX \uCEE4\uB125\uD130 \uC11C\uBC84\uB97C \uC2DC\uC791\uD558\uB294 \uC911:
+jmxremote.ConnectorBootstrap.noAuthentication = \uC778\uC99D \uC5C6\uC74C
+jmxremote.ConnectorBootstrap.ready = {0}\uC5D0\uC11C JMX \uCEE4\uB125\uD130\uAC00 \uC900\uBE44\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+jmxremote.ConnectorBootstrap.password.readonly = \uBE44\uBC00\uBC88\uD638 \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \uD30C\uC77C \uC77D\uAE30 \uC561\uC138\uC2A4\uB294 \uC81C\uD55C\uB418\uC5B4\uC57C \uD568: {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = ACL\uC744 \uCC98\uB9AC\uD558\uB294 \uC911
 jmxremote.AdaptorBootstrap.getTargetList.adding = \uB300\uC0C1\uC744 \uCD94\uAC00\uD558\uB294 \uC911: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = premain(String) n\u00E3o existe na classe do agente
 agent.err.agentclass.access.denied = Acesso negado a premain(String)
 agent.err.invalid.agentclass       = Valor inv\u00E1lido da propriedade com.sun.management.agent.class
-
+agent.err.invalid.state            = Estado de agente inv\u00E1lido
 agent.err.invalid.jmxremote.port   = N\u00FAmero inv\u00E1lido de com.sun.management.jmxremote.port
+agent.err.invalid.jmxremote.rmi.port = N\u00FAmero inv\u00E1lido do com.sun.management.jmxremote.rmi.port
 
 agent.err.file.not.set               = Arquivo n\u00E3o especificado
 agent.err.file.not.readable          = Arquivo ileg\u00EDvel
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = Falha ao iniciar o adaptador SNMP com endere\u00E7o
 agent.err.snmp.mib.init.failed     = Falha ao inicializar o MIB SNMP com erro
 
-jmxremote.ConnectorBootstrap.initialize = Iniciando o Servidor do Conector JMX:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Sem autentica\u00E7\u00E3o
-jmxremote.ConnectorBootstrap.initialize.ready = Conector JMX pronto em: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = O acesso de leitura do arquivo de senha deve ser limitado: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = O acesso de leitura do arquivo deve ser limitado: {0}
+jmxremote.ConnectorBootstrap.starting = Iniciando o Servidor do Conector JMX:
+jmxremote.ConnectorBootstrap.noAuthentication = Sem autentica\u00E7\u00E3o
+jmxremote.ConnectorBootstrap.ready = Conector JMX pronto em: {0}
+jmxremote.ConnectorBootstrap.password.readonly = O acesso de leitura do arquivo de senha deve ser limitado: {0}
+jmxremote.ConnectorBootstrap.file.readonly = O acesso de leitura do arquivo deve ser limitado: {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = Processando ACL
 jmxremote.AdaptorBootstrap.getTargetList.adding = Adicionando destino: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = premain(String) finns inte i agentklassen
 agent.err.agentclass.access.denied = \u00C5tkomst till premain(String) nekad
 agent.err.invalid.agentclass       = Ogiltigt egenskapsv\u00E4rde f\u00F6r com.sun.management.agent.class
-
+agent.err.invalid.state            = Ogiltig agentstatus
 agent.err.invalid.jmxremote.port   = Ogiltigt com.sun.management.jmxremote.port-nummer
+agent.err.invalid.jmxremote.rmi.port = Ogiltigt com.sun.management.jmxremote.rmi.port-nummer
 
 agent.err.file.not.set               = Filen \u00E4r inte angiven
 agent.err.file.not.readable          = Filen \u00E4r inte l\u00E4sbar
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = Kunde inte starta SNMP-adaptern med adressen
 agent.err.snmp.mib.init.failed     = Kunde inte initiera SNMP MIB. Returnerade felet
 
-jmxremote.ConnectorBootstrap.initialize = Startar server f\u00F6r JMX-anslutning:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = Ingen autentisering
-jmxremote.ConnectorBootstrap.initialize.ready = JMX-anslutning redo p\u00E5: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = L\u00E4sbeh\u00F6righeten f\u00F6r l\u00F6senordsfilen m\u00E5ste begr\u00E4nsas: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas {0}
+jmxremote.ConnectorBootstrap.starting = Startar server f\u00F6r JMX-anslutning:
+jmxremote.ConnectorBootstrap.noAuthentication = Ingen autentisering
+jmxremote.ConnectorBootstrap.ready = JMX-anslutning redo p\u00E5: {0}
+jmxremote.ConnectorBootstrap.password.readonly = L\u00E4sbeh\u00F6righeten f\u00F6r l\u00F6senordsfilen m\u00E5ste begr\u00E4nsas: {0}
+jmxremote.ConnectorBootstrap.file.readonly = Fill\u00E4snings\u00E5tkomst m\u00E5ste begr\u00E4nsas {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = ACL bearbetas
 jmxremote.AdaptorBootstrap.getTargetList.adding = M\u00E5l l\u00E4ggs till: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = \u4EE3\u7406\u7C7B\u4E2D\u4E0D\u5B58\u5728 premain(String)
 agent.err.agentclass.access.denied = \u62D2\u7EDD\u8BBF\u95EE premain(String)
 agent.err.invalid.agentclass       = com.sun.management.agent.class \u5C5E\u6027\u503C\u65E0\u6548
-
+agent.err.invalid.state            = \u4EE3\u7406\u72B6\u6001\u65E0\u6548
 agent.err.invalid.jmxremote.port   = com.sun.management.jmxremote.port \u7F16\u53F7\u65E0\u6548
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port \u7F16\u53F7\u65E0\u6548
 
 agent.err.file.not.set               = \u672A\u6307\u5B9A\u6587\u4EF6
 agent.err.file.not.readable          = \u6587\u4EF6\u4E0D\u53EF\u8BFB\u53D6
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = \u65E0\u6CD5\u542F\u52A8\u5E26\u6709\u5730\u5740\u7684 SNMP \u9002\u914D\u5668
 agent.err.snmp.mib.init.failed     = \u65E0\u6CD5\u521D\u59CB\u5316\u5E26\u6709\u9519\u8BEF\u7684 SNMP MIB
 
-jmxremote.ConnectorBootstrap.initialize = \u6B63\u5728\u542F\u52A8 JMX \u8FDE\u63A5\u5668\u670D\u52A1\u5668: 
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = \u65E0\u9A8C\u8BC1
-jmxremote.ConnectorBootstrap.initialize.ready = \u4F4D\u4E8E{0}\u7684 JMX \u8FDE\u63A5\u5668\u5DF2\u5C31\u7EEA
-jmxremote.ConnectorBootstrap.initialize.password.readonly = \u5FC5\u987B\u9650\u5236\u53E3\u4EE4\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = \u5FC5\u987B\u9650\u5236\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
+jmxremote.ConnectorBootstrap.starting = \u6B63\u5728\u542F\u52A8 JMX \u8FDE\u63A5\u5668\u670D\u52A1\u5668: 
+jmxremote.ConnectorBootstrap.noAuthentication = \u65E0\u9A8C\u8BC1
+jmxremote.ConnectorBootstrap.ready = \u4F4D\u4E8E{0}\u7684 JMX \u8FDE\u63A5\u5668\u5DF2\u5C31\u7EEA
+jmxremote.ConnectorBootstrap.password.readonly = \u5FC5\u987B\u9650\u5236\u53E3\u4EE4\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u5FC5\u987B\u9650\u5236\u6587\u4EF6\u8BFB\u53D6\u8BBF\u95EE\u6743\u9650: {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = \u6B63\u5728\u5904\u7406 ACL
 jmxremote.AdaptorBootstrap.getTargetList.adding = \u6B63\u5728\u6DFB\u52A0\u76EE\u6807: {0}
--- a/jdk/src/share/classes/sun/management/resources/agent_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/management/resources/agent_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, 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
@@ -43,8 +43,9 @@
 agent.err.premain.notfound         = \u4EE3\u7406\u7A0B\u5F0F\u985E\u5225\u4E2D\u4E0D\u5B58\u5728 premain(String)
 agent.err.agentclass.access.denied = \u5B58\u53D6 premain(String) \u906D\u5230\u62D2\u7D55
 agent.err.invalid.agentclass       = com.sun.management.agent.class \u5C6C\u6027\u503C\u7121\u6548
-
+agent.err.invalid.state            = \u7121\u6548\u7684\u4EE3\u7406\u7A0B\u5F0F\u72C0\u614B
 agent.err.invalid.jmxremote.port   = com.sun.management.jmxremote.port \u865F\u78BC\u7121\u6548
+agent.err.invalid.jmxremote.rmi.port = com.sun.management.jmxremote.rmi.port \u865F\u78BC\u7121\u6548
 
 agent.err.file.not.set               = \u672A\u6307\u5B9A\u6A94\u6848
 agent.err.file.not.readable          = \u6A94\u6848\u7121\u6CD5\u8B80\u53D6
@@ -78,11 +79,11 @@
 agent.err.snmp.adaptor.start.failed = \u7121\u6CD5\u4F7F\u7528\u4F4D\u5740\u555F\u52D5 SNMP \u914D\u63A5\u5361
 agent.err.snmp.mib.init.failed     = \u7121\u6CD5\u521D\u59CB\u5316 SNMP MIB\uFF0C\u51FA\u73FE\u932F\u8AA4
 
-jmxremote.ConnectorBootstrap.initialize = \u6B63\u5728\u555F\u52D5 JMX \u9023\u63A5\u5668\u4F3A\u670D\u5668:
-jmxremote.ConnectorBootstrap.initialize.noAuthentication = \u7121\u8A8D\u8B49
-jmxremote.ConnectorBootstrap.initialize.ready = JMX \u9023\u63A5\u5668\u5C31\u7DD2\uFF0C\u4F4D\u65BC: {0}
-jmxremote.ConnectorBootstrap.initialize.password.readonly = \u5FC5\u9808\u9650\u5236\u5BC6\u78BC\u6A94\u6848\u8B80\u53D6\u5B58\u53D6: {0}
-jmxremote.ConnectorBootstrap.initialize.file.readonly = \u5FC5\u9808\u9650\u5236\u6A94\u6848\u8B80\u53D6\u5B58\u53D6\u6B0A: {0}
+jmxremote.ConnectorBootstrap.starting = \u6B63\u5728\u555F\u52D5 JMX \u9023\u63A5\u5668\u4F3A\u670D\u5668:
+jmxremote.ConnectorBootstrap.noAuthentication = \u7121\u8A8D\u8B49
+jmxremote.ConnectorBootstrap.ready = JMX \u9023\u63A5\u5668\u5C31\u7DD2\uFF0C\u4F4D\u65BC: {0}
+jmxremote.ConnectorBootstrap.password.readonly = \u5FC5\u9808\u9650\u5236\u5BC6\u78BC\u6A94\u6848\u8B80\u53D6\u5B58\u53D6: {0}
+jmxremote.ConnectorBootstrap.file.readonly = \u5FC5\u9808\u9650\u5236\u6A94\u6848\u8B80\u53D6\u5B58\u53D6\u6B0A: {0}
 
 jmxremote.AdaptorBootstrap.getTargetList.processing = \u6B63\u5728\u8655\u7406 ACL
 jmxremote.AdaptorBootstrap.getTargetList.adding = \u6B63\u5728\u65B0\u589E\u76EE\u6A19: {0}
--- a/jdk/src/share/classes/sun/misc/PerfCounter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/PerfCounter.java	Wed May 08 10:10:05 2013 +0100
@@ -62,7 +62,7 @@
 
     private PerfCounter(String name, int type) {
         this.name = name;
-        ByteBuffer bb = perf.createLong(name, U_None, type, 0L);
+        ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
         bb.order(ByteOrder.nativeOrder());
         this.lb = bb.asLongBuffer();
     }
--- a/jdk/src/share/classes/sun/misc/resources/Messages_de.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_de.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_es.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_es.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_fr.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_fr.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_it.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_it.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_ja.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_ja.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_ko.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_ko.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_pt_BR.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_pt_BR.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_sv.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_sv.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_zh_CN.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_zh_CN.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/misc/resources/Messages_zh_TW.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/misc/resources/Messages_zh_TW.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java	Wed May 08 10:10:05 2013 +0100
@@ -364,17 +364,18 @@
                         + ncfield
                         + ", uri=\"" + uri
                         + "\", response=\"" + response
-                        + "\", algorithm=\"" + algorithm;
+                        + "\", algorithm=" + algorithm;
         if (opaque != null) {
-            value = value + "\", opaque=\"" + opaque;
+            value = value + ", opaque=\"" + opaque;
+            value = value + "\"";
         }
         if (cnonce != null) {
-            value = value + "\", cnonce=\"" + cnonce;
+            value = value + ", cnonce=\"" + cnonce;
+            value = value + "\"";
         }
         if (qop) {
-            value = value + "\", qop=\"auth";
+            value = value + ", qop=auth";
         }
-        value = value + "\"";
         return value;
     }
 
--- a/jdk/src/share/classes/sun/print/resources/serviceui_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -16,9 +16,9 @@
 button.print=Drucken
 button.properties=E&igenschaften...
 #
-checkbox.collate=So&rtieren
+checkbox.collate=&Sortieren
 checkbox.jobsheets=&Bannerseite
-checkbox.printtofile=A&usgabe in Datei
+checkbox.printtofile=Ausgabe in &Datei
 #
 dialog.printtitle=Drucken
 dialog.pstitle=Seite einrichten
@@ -35,42 +35,42 @@
 label.psname=&Name:
 label.pstype=Typ:
 label.rangeto=Bis
-label.size=Gr\u00F6\u00DF&e:
-label.source=Q&uelle:
+label.size=G&r\u00F6\u00DFe:
+label.source=&Quelle:
 label.status=Status:
-label.username=Ben&utzername:
+label.username=&Benutzername:
 label.millimetres=(mm)
 label.inches=(Zoll)
 label.topmargin=&oben
-label.bottommargin=u&nten
+label.bottommargin=&unten
 label.leftmargin=&links
 label.rightmargin=&rechts
 #
 radiobutton.color=&Farbe
 radiobutton.draftq=Ent&wurf
-radiobutton.duplex=Du&plex
+radiobutton.duplex=&Duplex
 radiobutton.highq=&Hoch
 radiobutton.landscape=&Querformat
 radiobutton.monochrome=&Monochrom
 radiobutton.normalq=&Normal
 radiobutton.oneside=&Einseitig
-radiobutton.portrait=&Hochformat
+radiobutton.portrait=Hochfor&mat
 radiobutton.rangeall=A&lle
 radiobutton.rangepages=S&eiten
-radiobutton.revlandscape=U&mgekehrtes Querformat
-radiobutton.revportrait=Umge&kehrtes Hochformat
+radiobutton.revlandscape=Umgekehrtes Q&uerformat
+radiobutton.revportrait=Umgekehrtes &Hochformat
 radiobutton.tumble=&Kalenderdruck
 # The vkMnemonics correspond with the constants defined in KeyEvent, eg
 # 65 = KeyEvent.VK_A
 tab.appearance=&Darstellung
 tab.general=&Allgemein
-tab.pagesetup=&Seite einrichten
+tab.pagesetup=Seite &einrichten
 #
 error.pagerange=Ung\u00FCltiger Seitenbereich. Geben Sie die Werte erneut ein (Beispiel: 1-3,5,7-10)
 error.destination=Ung\u00FCltiger Dateiname. Wiederholen Sie den Vorgang
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=Kassette
 Form-Source=Formularquelle
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=Jobs annehmen
 not-accepting-jobs=Jobs nicht annehmen
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -17,7 +17,7 @@
 button.properties=P&ropiedades...
 #
 checkbox.collate=Inter&calar
-checkbox.jobsheets=P\u00E1gina d&e R\u00F3tulo
+checkbox.jobsheets=P\u00E1gina de R\u00F3tu&lo
 checkbox.printtofile=I&mprimir en Archivo
 #
 dialog.printtitle=Imprimir
@@ -29,19 +29,19 @@
 dialog.writeerror=No se puede escribir en el archivo:
 #
 label.info=Informaci\u00F3n:
-label.jobname=Nombre del &Trabajo:
-label.numcopies=N\u00FAmer&o de Copias:
-label.priority=Pr&ioridad:
+label.jobname=&Nombre del Trabajo:
+label.numcopies=N\u00FAmero de C&opias:
+label.priority=Prior&idad:
 label.psname=&Nombre:
 label.pstype=Tipo:
 label.rangeto=A
-label.size=&Tama\u00F1o:
-label.source=Origen:
+label.size=Tama&\u00F1o:
+label.source=Ori&gen:
 label.status=Estado:
-label.username=U&suario:
+label.username=&Usuario:
 label.millimetres=(mm)
 label.inches=(pulg.)
-label.topmargin=superior
+label.topmargin=&superior
 label.bottommargin=in&ferior
 label.leftmargin=iz&quierdo
 label.rightmargin=d&erecho
@@ -49,16 +49,16 @@
 radiobutton.color=&Color
 radiobutton.draftq=Bo&rrador
 radiobutton.duplex=&D\u00FAplex
-radiobutton.highq=A&lta
+radiobutton.highq=&Alta
 radiobutton.landscape=Hori&zontal
 radiobutton.monochrome=&Monocromo
 radiobutton.normalq=&Normal
-radiobutton.oneside=&Una Cara
+radiobutton.oneside=Una Ca&ra
 radiobutton.portrait=&Vertical
 radiobutton.rangeall=&Todo
 radiobutton.rangepages=P\u00E1&ginas
 radiobutton.revlandscape=&Horizontal Inverso
-radiobutton.revportrait=Ve&rtical Inverso
+radiobutton.revportrait=Vertical Inver&so
 radiobutton.tumble=Cam&bio de Cara
 # The vkMnemonics correspond with the constants defined in KeyEvent, eg
 # 65 = KeyEvent.VK_A
@@ -70,7 +70,7 @@
 error.destination=Nombre de archivo no v\u00E1lido; int\u00E9ntelo de nuevo
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=Casete
 Form-Source=Origen de Formulario
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=Aceptando trabajos
 not-accepting-jobs=No aceptando trabajos
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -30,7 +30,7 @@
 #
 label.info=Infos :
 label.jobname=Nom du &travail :
-label.numcopies=N&ombre de copies :
+label.numcopies=Nombre de c&opies :
 label.priority=P&riorit\u00E9 :
 label.psname=&Nom :
 label.pstype=Type :
@@ -38,7 +38,7 @@
 label.size=Tai&lle :
 label.source=Sour&ce :
 label.status=Statut :
-label.username=N&om utilisateur :
+label.username=Nom &utilisateur :
 label.millimetres=(mm)
 label.inches=(po)
 label.topmargin=&haut
@@ -46,11 +46,11 @@
 label.leftmargin=&gauche
 label.rightmargin=&droite
 #
-radiobutton.color=&Couleur
+radiobutton.color=Coule&ur
 radiobutton.draftq=Broui&llon
 radiobutton.duplex=&Duplex
 radiobutton.highq=Ma&x.
-radiobutton.landscape=Pa&ysage
+radiobutton.landscape=Pay&sage
 radiobutton.monochrome=&Monochrome
 radiobutton.normalq=&Normal
 radiobutton.oneside=&Un c\u00F4t\u00E9
@@ -58,7 +58,7 @@
 radiobutton.rangeall=&Tout
 radiobutton.rangepages=Pag&es
 radiobutton.revlandscape=Paysage i&nvers\u00E9
-radiobutton.revportrait=Portra&it invers\u00E9
+radiobutton.revportrait=Portrait &invers\u00E9
 radiobutton.tumble=&T\u00EAte-b\u00EAche
 # The vkMnemonics correspond with the constants defined in KeyEvent, eg
 # 65 = KeyEvent.VK_A
@@ -70,7 +70,7 @@
 error.destination=Nom de fichier non valide ; recommencez
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=Cassette
 Form-Source=Source du formulaire
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=Acceptation des t\u00E2ches
 not-accepting-jobs=Refus des t\u00E2ches
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -17,7 +17,7 @@
 button.properties=P&ropriet\u00E0...
 #
 checkbox.collate=Fascico&la
-checkbox.jobsheets=&Pagina banner
+checkbox.jobsheets=Pagina &banner
 checkbox.printtofile=Stampa su &file
 #
 dialog.printtitle=Stampa
@@ -30,8 +30,8 @@
 #
 label.info=Informazioni:
 label.jobname=Nome &job:
-label.numcopies=Numer&o di copie:
-label.priority=Pr&iorit\u00E0:
+label.numcopies=Numero di c&opie:
+label.priority=P&riorit\u00E0:
 label.psname=&Nome:
 label.pstype=Tipo:
 label.rangeto=A
@@ -51,7 +51,7 @@
 radiobutton.duplex=F&ronte retro
 radiobutton.highq=A&lta
 radiobutton.landscape=Orizzonta&le
-radiobutton.monochrome=&Monocromatico
+radiobutton.monochrome=Monocrom&atico
 radiobutton.normalq=&Normale
 radiobutton.oneside=Un lat&o
 radiobutton.portrait=&Verticale
@@ -70,7 +70,7 @@
 error.destination=Nome file non valido; riprovare
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=Cassetta
 Form-Source=Origine modulo
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=Accettazione job
 not-accepting-jobs=Rifiuto job
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -70,7 +70,7 @@
 error.destination=\u7121\u52B9\u306A\u30D5\u30A1\u30A4\u30EB\u540D\u3002\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=\u30AB\u30BB\u30C3\u30C8
 Form-Source=\u30D5\u30A9\u30FC\u30E0\u30FB\u30BD\u30FC\u30B9
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=\u30B8\u30E7\u30D6\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u3059
 not-accepting-jobs=\u30B8\u30E7\u30D6\u3092\u53D7\u3051\u4ED8\u3051\u307E\u305B\u3093
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -70,7 +70,7 @@
 error.destination=\uBD80\uC801\uD569\uD55C \uD30C\uC77C \uC774\uB984: \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC2ED\uC2DC\uC624.
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=\uCE74\uC138\uD2B8
 Form-Source=\uC591\uC2DD \uC18C\uC2A4
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=\uC791\uC5C5 \uC2B9\uC778
 not-accepting-jobs=\uC791\uC5C5 \uC2B9\uC778 \uC548\uD568
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -14,9 +14,9 @@
 button.cancel=Cancelar
 button.ok=OK
 button.print=Imprimir
-button.properties=Proprie&dades...
+button.properties=P&ropriedades...
 #
-checkbox.collate=Ag&rupar
+checkbox.collate=&Agrupar
 checkbox.jobsheets=P\u00E1gina com &Banner
 checkbox.printtofile=&Imprimir em Arquivo
 #
@@ -31,7 +31,7 @@
 label.info=Informa\u00E7\u00F5es:
 label.jobname=Nome do &Job:
 label.numcopies=N\u00FAmer&o de c\u00F3pias:
-label.priority=&Prioridade:
+label.priority=P&rioridade:
 label.psname=&Nome:
 label.pstype=Tipo:
 label.rangeto=At\u00E9
@@ -44,33 +44,33 @@
 label.topmargin=&superior
 label.bottommargin=&inferior
 label.leftmargin=es&querda:
-label.rightmargin=&direita
+label.rightmargin=di&reita
 #
 radiobutton.color=C&or
 radiobutton.draftq=&Rascunho
 radiobutton.duplex=&Duplex
-radiobutton.highq=Al&ta
+radiobutton.highq=&Alta
 radiobutton.landscape=&Paisagem
 radiobutton.monochrome=&Monocrom\u00E1tico
 radiobutton.normalq=&Normal
-radiobutton.oneside=Um &Lado
+radiobutton.oneside=Um Lad&o
 radiobutton.portrait=&Retrato
 radiobutton.rangeall=T&udo
 radiobutton.rangepages=&P\u00E1ginas
 radiobutton.revlandscape=Paisagem I&nvertida
-radiobutton.revportrait=R&etrato Invertido
+radiobutton.revportrait=Retrato &Invertido
 radiobutton.tumble=&Virar
 # The vkMnemonics correspond with the constants defined in KeyEvent, eg
 # 65 = KeyEvent.VK_A
 tab.appearance=&Apar\u00EAncia
 tab.general=&Geral
-tab.pagesetup=&Configura\u00E7\u00E3o de P\u00E1gina
+tab.pagesetup=Configura\u00E7\u00E3o de &P\u00E1gina
 #
 error.pagerange=Faixa de p\u00E1ginas inv\u00E1lida; insira novamente os valores (por exemplo, 1-3,5,7-10)
 error.destination=Nome de arquivo inv\u00E1lido; tente novamente
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=Cassete
 Form-Source=Origem do Formul\u00E1rio
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=Aceitando jobs
 not-accepting-jobs=N\u00E3o aceitando jobs
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -14,11 +14,11 @@
 button.cancel=Avbryt
 button.ok=OK
 button.print=Skriv ut
-button.properties=Egenskape&r...
+button.properties=&Egenskaper...
 #
-checkbox.collate=Sor&tera
-checkbox.jobsheets=F\u00F6&rs\u00E4ttsblad
-checkbox.printtofile=S&kriv ut till fil
+checkbox.collate=&Sortera
+checkbox.jobsheets=&F\u00F6rs\u00E4ttsblad
+checkbox.printtofile=Skriv ut till &fil
 #
 dialog.printtitle=Skriv ut
 dialog.pstitle=Utskriftsformat
@@ -35,42 +35,42 @@
 label.psname=&Namn:
 label.pstype=Typ:
 label.rangeto=Till
-label.size=St&orlek:
-label.source=&K\u00E4lla:
+label.size=Stor&lek:
+label.source=K\u00E4l&la:
 label.status=Status:
 label.username=A&nv\u00E4ndarnamn:
 label.millimetres=(mm)
 label.inches=(tum)
-label.topmargin=\u00F6ve&rkant
+label.topmargin=&\u00F6verkant
 label.bottommargin=&nederkant
-label.leftmargin=&v\u00E4nster
+label.leftmargin=v&\u00E4nster
 label.rightmargin=&h\u00F6ger
 #
-radiobutton.color=F\u00E4r&g
-radiobutton.draftq=Ut&kast
+radiobutton.color=&F\u00E4rg
+radiobutton.draftq=Utka&st
 radiobutton.duplex=&Dubbelsidig
 radiobutton.highq=&H\u00F6g
 radiobutton.landscape=&Liggande
 radiobutton.monochrome=&Monokrom
-radiobutton.normalq=N&ormal
+radiobutton.normalq=&Normal
 radiobutton.oneside=&Ensidig
-radiobutton.portrait=St\u00E5en&de
+radiobutton.portrait=&St\u00E5ende
 radiobutton.rangeall=A&lla
-radiobutton.rangepages=Si&dor
+radiobutton.rangepages=Sid&or
 radiobutton.revlandscape=Omv\u00E4nt li&ggande
-radiobutton.revportrait=O&mv\u00E4nt st\u00E5ende
+radiobutton.revportrait=Omv\u00E4nt st\u00E5en&de
 radiobutton.tumble=&V\u00E4nd
 # The vkMnemonics correspond with the constants defined in KeyEvent, eg
 # 65 = KeyEvent.VK_A
 tab.appearance=&Format
 tab.general=&Allm\u00E4nt
-tab.pagesetup=Ut&skriftsformat
+tab.pagesetup=Utskrifts&format
 #
 error.pagerange=Ogiltigt sidintervall. Skriv in v\u00E4rdena igen (t ex 1-3,5,7-10)
 error.destination=Ogiltigt filnamn. F\u00F6rs\u00F6k igen.
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=Kassett
 Form-Source=Formul\u00E4rk\u00E4lla
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=Accepterar jobb
 not-accepting-jobs=Accepterar inte jobb
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -28,16 +28,16 @@
 dialog.noprintermsg=\u627E\u4E0D\u5230\u6253\u5370\u670D\u52A1\u3002
 dialog.writeerror=\u65E0\u6CD5\u5199\u5165\u6587\u4EF6:
 #
-label.info=\u4FE1\u606F:
+label.info=\u4FE1\u606F: 
 label.jobname=\u4F5C\u4E1A\u540D(&J):
 label.numcopies=\u6253\u5370\u4EFD\u6570(&O):
 label.priority=\u4F18\u5148\u7EA7(&R):
 label.psname=\u540D\u79F0(&N):
-label.pstype=\u7C7B\u578B:
+label.pstype=\u7C7B\u578B: 
 label.rangeto=\u81F3
 label.size=\u5927\u5C0F(&Z):
 label.source=\u6765\u6E90(&C):
-label.status=\u72B6\u6001:
+label.status=\u72B6\u6001: 
 label.username=\u7528\u6237\u540D(&U):
 label.millimetres=(\u6BEB\u7C73)
 label.inches=(\u82F1\u5BF8)
@@ -70,7 +70,7 @@
 error.destination=\u65E0\u6548\u7684\u6587\u4EF6\u540D; \u8BF7\u91CD\u8BD5
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=\u7EB8\u76D2
 Form-Source=\u8868\u683C\u6765\u6E90
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=\u63A5\u53D7\u4F5C\u4E1A
 not-accepting-jobs=\u4E0D\u63A5\u53D7\u4F5C\u4E1A
-
--- a/jdk/src/share/classes/sun/print/resources/serviceui_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -28,16 +28,16 @@
 dialog.noprintermsg=\u627E\u4E0D\u5230\u5217\u5370\u670D\u52D9\u3002
 dialog.writeerror=\u7121\u6CD5\u5BEB\u5165\u81F3\u6A94\u6848:
 #
-label.info=\u8CC7\u8A0A:
+label.info=\u8CC7\u8A0A: 
 label.jobname=\u5DE5\u4F5C\u540D\u7A31(&J):
-label.numcopies=\u5217\u5370\u4EFD\u6578(&O):
+label.numcopies=\u5217\u5370\u4EFD\u6578(&O): 
 label.priority=\u512A\u5148\u6B0A(&R):
 label.psname=\u540D\u7A31(&N):
-label.pstype=\u985E\u578B:
+label.pstype=\u985E\u578B: 
 label.rangeto=\u81F3
 label.size=\u5927\u5C0F(&Z):
-label.source=\u4F86\u6E90(&C):
-label.status=\u72C0\u614B:
+label.source=\u4F86\u6E90(&C): 
+label.status=\u72C0\u614B: 
 label.username=\u4F7F\u7528\u8005\u540D\u7A31(&U):
 label.millimetres=(mm)
 label.inches=(in)
@@ -70,7 +70,7 @@
 error.destination=\u7121\u6548\u7684\u6A94\u540D; \u8ACB\u518D\u8A66\u4E00\u6B21
 #
 # The following keys match the Strings returned by MediaSizeName.toString()
-# (in some cases the space character is replaced by '-' and the pound
+# (in some cases the space character is replaced by '-' and the pound 
 # character is replaced with 'n')
 #
 iso-4a0=4A0 (ISO/DIN & JIS)
@@ -175,9 +175,8 @@
 Cassette=\u5361\u5F0F\u78C1\u5E36\u6A5F
 Form-Source=\u8868\u683C\u4F86\u6E90
 #
-# The following keys match the Strings returned by
+# The following keys match the Strings returned by 
 # PrinterIsAcceptingJobs.toString()
 #
 accepting-jobs=\u63A5\u53D7\u7684\u5DE5\u4F5C
 not-accepting-jobs=\u4E0D\u63A5\u53D7\u7684\u5DE5\u4F5C
-
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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,5 +24,5 @@
 # questions.
 #
 
-rmiregistry.usage=Utilizzo: {0} <opzioni> <porta>\n\ndove <opzioni> include:\n  -J<flag fase di esecuzione> Passa l''argomento all''interprete java
+rmiregistry.usage=Uso: {0} <opzioni> <porta>\n\ndove <opzioni> include:\n  -J<flag fase di esecuzione> Passa l''argomento all''interprete java
 rmiregistry.port.badnumber=l''argomento della porta, {0}, non \u00E8 un numero.
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/registry/resources/rmiregistry_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2001, 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
--- a/jdk/src/share/classes/sun/rmi/rmic/resources/rmic_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/rmic/resources/rmic_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 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
--- a/jdk/src/share/classes/sun/rmi/rmic/resources/rmic_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/rmic/resources/rmic_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1996, 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
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
 
 # "rmid", "-port", "-log", "-stop", "-C" and "-J" should not be translated,
 # because they are syntax
-rmid.usage=Utilizzo: {0} <opzioni>\n\ndove <opzioni> include:\n  -port <porta>       Specifica la porta usata da rmid\n  -log <directory>    Specifica la directory in cui rmid scrive il log\n  -stop              Arresta l''invocazione corrente di rmid (per la porta specificata)\n  -C<flag fase di esecuzione>    Passa l''argomento a ciascun processo figlio (gruppo di attivazione)\n  -J<flag fase di esecuzione>    Passa l''argomento all''interprete java\n
+rmid.usage=Uso: {0} <opzioni>\n\ndove <opzioni> include:\n  -port <porta>       Specifica la porta usata da rmid\n  -log <directory>    Specifica la directory in cui rmid scrive il log\n  -stop              Arresta l''invocazione corrente di rmid (per la porta specificata)\n  -C<flag fase di esecuzione>    Passa l''argomento a ciascun processo figlio (gruppo di attivazione)\n  -J<flag fase di esecuzione>    Passa l''argomento all''interprete java\n
 # This means "The currently running activation daemon has been shut down,
 # and is about to exit".
 rmid.daemon.shutdown=daemon di attivazione terminato
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/rmi/server/resources/rmid_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/rmi/server/resources/rmid_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS7.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/pkcs/PKCS7.java	Wed May 08 10:10:05 2013 +0100
@@ -784,6 +784,9 @@
      * @param signatureAlgorithm the name of the signature algorithm
      * @param tsaURI the URI of the Timestamping Authority; or null if no
      *         timestamp is requested
+     * @param tSAPolicyID the TSAPolicyID of the Timestamping Authority as a
+     *         numerical object identifier; or null if we leave the TSA server
+     *         to choose one. This argument is only used when tsaURI is provided
      * @return the bytes of the encoded PKCS #7 signed data message
      * @throws NoSuchAlgorithmException The exception is thrown if the signature
      *         algorithm is unrecognised.
@@ -798,7 +801,8 @@
                                             X509Certificate[] signerChain,
                                             byte[] content,
                                             String signatureAlgorithm,
-                                            URI tsaURI)
+                                            URI tsaURI,
+                                            String tSAPolicyID)
         throws CertificateException, IOException, NoSuchAlgorithmException
     {
 
@@ -807,7 +811,7 @@
         if (tsaURI != null) {
             // Timestamp the signature
             HttpTimestamper tsa = new HttpTimestamper(tsaURI);
-            byte[] tsToken = generateTimestampToken(tsa, signature);
+            byte[] tsToken = generateTimestampToken(tsa, tSAPolicyID, signature);
 
             // Insert the timestamp token into the PKCS #7 signer info element
             // (as an unsigned attribute)
@@ -851,14 +855,20 @@
      * set to true.
      *
      * @param tsa the timestamping authority to use
+     * @param tSAPolicyID the TSAPolicyID of the Timestamping Authority as a
+     *         numerical object identifier; or null if we leave the TSA server
+     *         to choose one
      * @param toBeTimestamped the token that is to be timestamped
      * @return the encoded timestamp token
      * @throws IOException The exception is thrown if an error occurs while
-     *                     communicating with the TSA.
+     *                     communicating with the TSA, or a non-null
+     *                     TSAPolicyID is specified in the request but it
+     *                     does not match the one in the reply
      * @throws CertificateException The exception is thrown if the TSA's
      *                     certificate is not permitted for timestamping.
      */
     private static byte[] generateTimestampToken(Timestamper tsa,
+                                                 String tSAPolicyID,
                                                  byte[] toBeTimestamped)
         throws IOException, CertificateException
     {
@@ -868,7 +878,7 @@
         try {
             // SHA-1 is always used.
             messageDigest = MessageDigest.getInstance("SHA-1");
-            tsQuery = new TSRequest(toBeTimestamped, messageDigest);
+            tsQuery = new TSRequest(tSAPolicyID, toBeTimestamped, messageDigest);
         } catch (NoSuchAlgorithmException e) {
             // ignore
         }
@@ -889,6 +899,12 @@
                 tsReply.getStatusCodeAsText() + " " +
                 tsReply.getFailureCodeAsText());
         }
+
+        if (tSAPolicyID != null &&
+                !tSAPolicyID.equals(tsReply.getTimestampToken().getPolicyID())) {
+            throw new IOException("TSAPolicyID changed in "
+                    + "timestamp token");
+        }
         PKCS7 tsToken = tsReply.getToken();
 
         TimestampToken tst = tsReply.getTimestampToken();
--- a/jdk/src/share/classes/sun/security/ssl/KerberosClientKeyExchange.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/ssl/KerberosClientKeyExchange.java	Wed May 08 10:10:05 2013 +0100
@@ -86,10 +86,10 @@
 
     public KerberosClientKeyExchange(ProtocolVersion protocolVersion,
         ProtocolVersion clientVersion, SecureRandom rand,
-        HandshakeInStream input, SecretKey[] serverKeys) throws IOException {
+        HandshakeInStream input, AccessControlContext acc, Object serverKeys) throws IOException {
 
         if (impl != null) {
-            init(protocolVersion, clientVersion, rand, input, serverKeys);
+            init(protocolVersion, clientVersion, rand, input, acc, serverKeys);
         } else {
             throw new IllegalStateException("Kerberos is unavailable");
         }
@@ -126,10 +126,10 @@
 
     public void init(ProtocolVersion protocolVersion,
         ProtocolVersion clientVersion, SecureRandom rand,
-        HandshakeInStream input, SecretKey[] serverKeys) throws IOException {
+        HandshakeInStream input, AccessControlContext acc, Object ServiceCreds) throws IOException {
 
         if (impl != null) {
-            impl.init(protocolVersion, clientVersion, rand, input, serverKeys);
+            impl.init(protocolVersion, clientVersion, rand, input, acc, ServiceCreds);
         }
     }
 
--- a/jdk/src/share/classes/sun/security/ssl/Krb5Helper.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/ssl/Krb5Helper.java	Wed May 08 10:10:05 2013 +0100
@@ -94,18 +94,18 @@
     /**
      * Returns the KerberosKeys for the default server-side principal.
      */
-    public static SecretKey[] getServerKeys(AccessControlContext acc)
+    public static Object getServiceCreds(AccessControlContext acc)
             throws LoginException {
         ensureAvailable();
-        return proxy.getServerKeys(acc);
+        return proxy.getServiceCreds(acc);
     }
 
     /**
      * Returns the server-side principal name associated with the KerberosKey.
      */
-    public static String getServerPrincipalName(SecretKey kerberosKey) {
+    public static String getServerPrincipalName(Object serviceCreds) {
         ensureAvailable();
-        return proxy.getServerPrincipalName(kerberosKey);
+        return proxy.getServerPrincipalName(serviceCreds);
     }
 
     /**
@@ -124,4 +124,12 @@
         ensureAvailable();
         return proxy.getServicePermission(principalName, action);
     }
+
+    /**
+     * Determines if the Subject might contain creds for princ.
+     */
+    public static boolean isRelated(Subject subject, Principal princ) {
+        ensureAvailable();
+        return proxy.isRelated(subject, princ);
+    }
 }
--- a/jdk/src/share/classes/sun/security/ssl/Krb5Proxy.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/ssl/Krb5Proxy.java	Wed May 08 10:10:05 2013 +0100
@@ -50,14 +50,14 @@
 
 
     /**
-     * Returns the KerberosKeys for the default server-side principal.
+     * Returns the Kerberos ServiceCreds for the default server-side principal.
      */
-    SecretKey[] getServerKeys(AccessControlContext acc) throws LoginException;
+    Object getServiceCreds(AccessControlContext acc) throws LoginException;
 
     /**
      * Returns the server-side principal name associated with the KerberosKey.
      */
-    String getServerPrincipalName(SecretKey kerberosKey);
+    String getServerPrincipalName(Object serviceCreds);
 
     /**
      * Returns the hostname embedded in the principal name.
@@ -68,4 +68,9 @@
      * Returns a ServicePermission for the principal name and action.
      */
     Permission getServicePermission(String principalName, String action);
+
+    /**
+     * Determines if the Subject might contain creds for princ.
+     */
+    boolean isRelated(Subject subject, Principal princ);
 }
--- a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Wed May 08 10:10:05 2013 +0100
@@ -62,7 +62,7 @@
     private X509Certificate[]   certs;
     private PrivateKey          privateKey;
 
-    private SecretKey[]       kerberosKeys;
+    private Object              serviceCreds;
 
     // flag to check for clientCertificateVerify message
     private boolean             needClientVerify = false;
@@ -200,7 +200,8 @@
                             clientRequestedVersion,
                             sslContext.getSecureRandom(),
                             input,
-                            kerberosKeys));
+                            this.getAccSE(),
+                            serviceCreds));
                     break;
                 case K_DHE_RSA:
                 case K_DHE_DSS:
@@ -543,18 +544,15 @@
 
                         if (subject != null) {
                             // Eliminate dependency on KerberosPrincipal
-                            Set<Principal> principals =
-                                subject.getPrincipals(Principal.class);
-                            if (!principals.contains(localPrincipal)) {
+                            if (Krb5Helper.isRelated(subject, localPrincipal)) {
+                                if (debug != null && Debug.isOn("session"))
+                                    System.out.println("Subject can" +
+                                            " provide creds for princ");
+                            } else {
                                 resumingSession = false;
-                                if (debug != null && Debug.isOn("session")) {
-                                    System.out.println("Subject identity" +
-                                                        " is not the same");
-                                }
-                            } else {
                                 if (debug != null && Debug.isOn("session"))
-                                    System.out.println("Subject identity" +
-                                                        " is same");
+                                    System.out.println("Subject cannot" +
+                                            " provide creds for princ");
                             }
                         } else {
                             resumingSession = false;
@@ -1316,49 +1314,51 @@
      * @return true if successful, false if not available or invalid
      */
     private boolean setupKerberosKeys() {
-        if (kerberosKeys != null) {
+        if (serviceCreds != null) {
             return true;
         }
         try {
             final AccessControlContext acc = getAccSE();
-            kerberosKeys = AccessController.doPrivileged(
+            serviceCreds = AccessController.doPrivileged(
                 // Eliminate dependency on KerberosKey
-                new PrivilegedExceptionAction<SecretKey[]>() {
+                new PrivilegedExceptionAction<Object>() {
                 @Override
-                public SecretKey[] run() throws Exception {
+                public Object run() throws Exception {
                     // get kerberos key for the default principal
-                    return Krb5Helper.getServerKeys(acc);
+                    return Krb5Helper.getServiceCreds(acc);
                         }});
 
             // check permission to access and use the secret key of the
             // Kerberized "host" service
-            if (kerberosKeys != null && kerberosKeys.length > 0) {
+            if (serviceCreds != null) {
                 if (debug != null && Debug.isOn("handshake")) {
-                    for (SecretKey k: kerberosKeys) {
-                        System.out.println("Using Kerberos key: " +
-                            k);
+                    System.out.println("Using Kerberos creds");
+                }
+                String serverPrincipal =
+                        Krb5Helper.getServerPrincipalName(serviceCreds);
+                if (serverPrincipal != null) {
+                    // When service is bound, we check ASAP. Otherwise,
+                    // will check after client request is received
+                    // in in Kerberos ClientKeyExchange
+                    SecurityManager sm = System.getSecurityManager();
+                    try {
+                        if (sm != null) {
+                            // Eliminate dependency on ServicePermission
+                            sm.checkPermission(Krb5Helper.getServicePermission(
+                                    serverPrincipal, "accept"), acc);
+                        }
+                    } catch (SecurityException se) {
+                        serviceCreds = null;
+                        // Do not destroy keys. Will affect Subject
+                        if (debug != null && Debug.isOn("handshake")) {
+                            System.out.println("Permission to access Kerberos"
+                                    + " secret key denied");
+                        }
+                        return false;
                     }
                 }
-
-                String serverPrincipal =
-                    Krb5Helper.getServerPrincipalName(kerberosKeys[0]);
-                SecurityManager sm = System.getSecurityManager();
-                try {
-                   if (sm != null) {
-                      // Eliminate dependency on ServicePermission
-                      sm.checkPermission(Krb5Helper.getServicePermission(
-                          serverPrincipal, "accept"), acc);
-                   }
-                } catch (SecurityException se) {
-                   kerberosKeys = null;
-                   // %%% destroy keys? or will that affect Subject?
-                   if (debug != null && Debug.isOn("handshake"))
-                      System.out.println("Permission to access Kerberos"
-                                + " secret key denied");
-                   return false;
-                }
             }
-            return (kerberosKeys != null && kerberosKeys.length > 0);
+            return serviceCreds != null;
         } catch (PrivilegedActionException e) {
             // Likely exception here is LoginExceptin
             if (debug != null && Debug.isOn("handshake")) {
--- a/jdk/src/share/classes/sun/security/ssl/krb5/KerberosClientKeyExchangeImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/ssl/krb5/KerberosClientKeyExchangeImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -33,8 +33,8 @@
 import java.security.PrivilegedActionException;
 import java.security.SecureRandom;
 import java.net.InetAddress;
+import java.security.PrivilegedAction;
 
-import javax.crypto.SecretKey;
 import javax.security.auth.kerberos.KerberosTicket;
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
@@ -44,18 +44,19 @@
 import sun.security.krb5.EncryptionKey;
 import sun.security.krb5.EncryptedData;
 import sun.security.krb5.PrincipalName;
-import sun.security.krb5.Realm;
 import sun.security.krb5.internal.Ticket;
 import sun.security.krb5.internal.EncTicketPart;
 import sun.security.krb5.internal.crypto.KeyUsage;
 
 import sun.security.jgss.krb5.Krb5Util;
+import sun.security.jgss.krb5.ServiceCreds;
 import sun.security.krb5.KrbException;
 import sun.security.krb5.internal.Krb5;
 
 import sun.security.ssl.Debug;
 import sun.security.ssl.HandshakeInStream;
 import sun.security.ssl.HandshakeOutStream;
+import sun.security.ssl.Krb5Helper;
 import sun.security.ssl.ProtocolVersion;
 
 /**
@@ -138,16 +139,15 @@
      * @param rand random number generator used for generating random
      *          premaster secret if ticket and/or premaster verification fails
      * @param input inputstream from which to get ASN.1-encoded KerberosWrapper
-     * @param serverKey server's master secret key
+     * @param acc the AccessControlContext of the handshaker
+     * @param serviceCreds server's creds
      */
     @Override
     public void init(ProtocolVersion protocolVersion,
         ProtocolVersion clientVersion,
-        SecureRandom rand, HandshakeInStream input, SecretKey[] secretKeys)
+        SecureRandom rand, HandshakeInStream input, AccessControlContext acc, Object serviceCreds)
         throws IOException {
 
-        KerberosKey[] serverKeys = (KerberosKey[])secretKeys;
-
         // Read ticket
         encodedTicket = input.getBytes16();
 
@@ -163,9 +163,42 @@
 
             EncryptedData encPart = t.encPart;
             PrincipalName ticketSname = t.sname;
-            Realm ticketRealm = t.sname.getRealm();
+
+            final ServiceCreds creds = (ServiceCreds)serviceCreds;
+            final KerberosPrincipal princ =
+                    new KerberosPrincipal(ticketSname.toString());
 
-            String serverPrincipal = serverKeys[0].getPrincipal().getName();
+            // For bound service, permission already checked at setup
+            if (creds.getName() == null) {
+                SecurityManager sm = System.getSecurityManager();
+                try {
+                    if (sm != null) {
+                        // Eliminate dependency on ServicePermission
+                        sm.checkPermission(Krb5Helper.getServicePermission(
+                                ticketSname.toString(), "accept"), acc);
+                    }
+                } catch (SecurityException se) {
+                    serviceCreds = null;
+                    // Do not destroy keys. Will affect Subject
+                    if (debug != null && Debug.isOn("handshake")) {
+                        System.out.println("Permission to access Kerberos"
+                                + " secret key denied");
+                    }
+                    throw new IOException("Kerberos service not allowedy");
+                }
+            }
+            KerberosKey[] serverKeys = AccessController.doPrivileged(
+                    new PrivilegedAction<KerberosKey[]>() {
+                        @Override
+                        public KerberosKey[] run() {
+                            return creds.getKKeys(princ);
+                        }
+                    });
+            if (serverKeys.length == 0) {
+                throw new IOException("Found no key for " + princ +
+                        (creds.getName() == null ? "" :
+                        (", this keytab is for " + creds.getName() + " only")));
+            }
 
             /*
              * permission to access and use the secret key of the Kerberized
@@ -174,17 +207,6 @@
              * before promising the client
              */
 
-            // Check that ticket Sname matches serverPrincipal
-            String ticketPrinc = ticketSname.toString();
-            if (!ticketPrinc.equals(serverPrincipal)) {
-                if (debug != null && Debug.isOn("handshake"))
-                   System.out.println("Service principal in Ticket does not"
-                        + " match associated principal in KerberosKey");
-                throw new IOException("Server principal is " +
-                    serverPrincipal + " but ticket is for " +
-                    ticketPrinc);
-            }
-
             // See if we have the right key to decrypt the ticket to get
             // the session key.
             int encPartKeyType = encPart.getEType();
@@ -198,9 +220,8 @@
             }
             if (dkey == null) {
                 // %%% Should print string repr of etype
-                throw new IOException(
-        "Cannot find key of appropriate type to decrypt ticket - need etype " +
-                                   encPartKeyType);
+                throw new IOException("Cannot find key of appropriate type" +
+                        " to decrypt ticket - need etype " + encPartKeyType);
             }
 
             EncryptionKey secretKey = new EncryptionKey(
@@ -222,7 +243,7 @@
             sessionKey = encTicketPart.key;
 
             if (debug != null && Debug.isOn("handshake")) {
-                System.out.println("server principal: " + serverPrincipal);
+                System.out.println("server principal: " + ticketSname);
                 System.out.println("cname: " + encTicketPart.cname.toString());
             }
         } catch (IOException e) {
@@ -382,12 +403,22 @@
             KerberosKey[] keys) throws KrbException {
         int ktype;
         boolean etypeFound = false;
+
+        // When no matched kvno is found, returns tke key of the same
+        // etype with the highest kvno
+        int kvno_found = 0;
+        KerberosKey key_found = null;
+
         for (int i = 0; i < keys.length; i++) {
             ktype = keys[i].getKeyType();
             if (etype == ktype) {
+                int kv = keys[i].getVersionNumber();
                 etypeFound = true;
-                if (versionMatches(version, keys[i].getVersionNumber())) {
+                if (versionMatches(version, kv)) {
                     return keys[i];
+                } else if (kv > kvno_found) {
+                    key_found = keys[i];
+                    kvno_found = kv;
                 }
             }
         }
@@ -399,18 +430,25 @@
                 ktype = keys[i].getKeyType();
                 if (ktype == EncryptedData.ETYPE_DES_CBC_CRC ||
                         ktype == EncryptedData.ETYPE_DES_CBC_MD5) {
+                    int kv = keys[i].getVersionNumber();
                     etypeFound = true;
-                    if (versionMatches(version, keys[i].getVersionNumber())) {
+                    if (versionMatches(version, kv)) {
                         return new KerberosKey(keys[i].getPrincipal(),
                             keys[i].getEncoded(),
                             etype,
-                            keys[i].getVersionNumber());
+                            kv);
+                    } else if (kv > kvno_found) {
+                        key_found = new KerberosKey(keys[i].getPrincipal(),
+                                keys[i].getEncoded(),
+                                etype,
+                                kv);
+                        kvno_found = kv;
                     }
                 }
             }
         }
         if (etypeFound) {
-            throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER);
+            return key_found;
         }
         return null;
     }
--- a/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/ssl/krb5/Krb5ProxyImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -28,9 +28,11 @@
 import java.security.AccessControlContext;
 import java.security.Permission;
 import java.security.Principal;
+import java.util.Set;
 import javax.crypto.SecretKey;
 import javax.security.auth.Subject;
 import javax.security.auth.kerberos.KerberosKey;
+import javax.security.auth.kerberos.KeyTab;
 import javax.security.auth.kerberos.ServicePermission;
 import javax.security.auth.login.LoginException;
 
@@ -61,17 +63,16 @@
     }
 
     @Override
-    public SecretKey[] getServerKeys(AccessControlContext acc)
+    public Object getServiceCreds(AccessControlContext acc)
             throws LoginException {
         ServiceCreds serviceCreds =
             Krb5Util.getServiceCreds(GSSCaller.CALLER_SSL_SERVER, null, acc);
-        return serviceCreds != null ? serviceCreds.getKKeys() :
-                                        new KerberosKey[0];
+        return serviceCreds;
     }
 
     @Override
-    public String getServerPrincipalName(SecretKey kerberosKey) {
-        return ((KerberosKey)kerberosKey).getPrincipal().getName();
+    public String getServerPrincipalName(Object serviceCreds) {
+        return ((ServiceCreds)serviceCreds).getName();
     }
 
     @Override
@@ -100,4 +101,21 @@
             String action) {
         return new ServicePermission(principalName, action);
     }
+
+    @Override
+    public boolean isRelated(Subject subject, Principal princ) {
+        if (princ == null) return false;
+        Set<Principal> principals =
+                subject.getPrincipals(Principal.class);
+        if (principals.contains(princ)) {
+            // bound to this principal
+            return true;
+        }
+        for (KeyTab pc: subject.getPrivateCredentials(KeyTab.class)) {
+            if (!pc.isBound()) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
--- a/jdk/src/share/classes/sun/security/timestamp/TSRequest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/timestamp/TSRequest.java	Wed May 08 10:10:05 2013 +0100
@@ -88,9 +88,10 @@
      * @param messageDigest The MessageDigest of the hash algorithm to use.
      * @throws NoSuchAlgorithmException if the hash algorithm is not supported
      */
-    public TSRequest(byte[] toBeTimeStamped, MessageDigest messageDigest)
+    public TSRequest(String tSAPolicyID, byte[] toBeTimeStamped, MessageDigest messageDigest)
         throws NoSuchAlgorithmException {
 
+        this.policyId = tSAPolicyID;
         this.hashAlgorithmId = AlgorithmId.get(messageDigest.getAlgorithm());
         this.hashValue = messageDigest.digest(toBeTimeStamped);
     }
--- a/jdk/src/share/classes/sun/security/timestamp/TimestampToken.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/timestamp/TimestampToken.java	Wed May 08 10:10:05 2013 +0100
@@ -115,6 +115,10 @@
         return nonce;
     }
 
+    public String getPolicyID() {
+        return policy.toString();
+    }
+
     /*
      * Parses the timestamp token info.
      *
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java	Wed May 08 10:10:05 2013 +0100
@@ -141,6 +141,7 @@
     String tsaUrl; // location of the Timestamping Authority
     String tsaAlias; // alias for the Timestamping Authority's certificate
     String altCertChain; // file to read alternative cert chain from
+    String tSAPolicyID;
     boolean verify = false; // verify the jar
     String verbose = null; // verbose output when signing/verifying
     boolean showcerts = false; // show certs when verifying
@@ -331,6 +332,9 @@
             } else if (collator.compare(flags, "-certchain") ==0) {
                 if (++n == args.length) usageNoArg();
                 altCertChain = args[n];
+            } else if (collator.compare(flags, "-tsapolicyid") ==0) {
+                if (++n == args.length) usageNoArg();
+                tSAPolicyID = args[n];
             } else if (collator.compare(flags, "-debug") ==0) {
                 debug = true;
             } else if (collator.compare(flags, "-keypass") ==0) {
@@ -531,6 +535,9 @@
                 (".tsacert.alias.public.key.certificate.for.Timestamping.Authority"));
         System.out.println();
         System.out.println(rb.getString
+                (".tsapolicyid.tsapolicyid.for.Timestamping.Authority"));
+        System.out.println();
+        System.out.println(rb.getString
                 (".altsigner.class.class.name.of.an.alternative.signing.mechanism"));
         System.out.println();
         System.out.println(rb.getString
@@ -1232,7 +1239,7 @@
             try {
                 block =
                     sf.generateBlock(privateKey, sigalg, certChain,
-                        externalSF, tsaUrl, tsaCert, signingMechanism, args,
+                        externalSF, tsaUrl, tsaCert, tSAPolicyID, signingMechanism, args,
                         zipFile);
             } catch (SocketTimeoutException e) {
                 // Provide a helpful message when TSA is beyond a firewall
@@ -2206,13 +2213,14 @@
                                X509Certificate[] certChain,
                                boolean externalSF, String tsaUrl,
                                X509Certificate tsaCert,
+                               String tSAPolicyID,
                                ContentSigner signingMechanism,
                                String[] args, ZipFile zipFile)
         throws NoSuchAlgorithmException, InvalidKeyException, IOException,
             SignatureException, CertificateException
     {
         return new Block(this, privateKey, sigalg, certChain, externalSF,
-                tsaUrl, tsaCert, signingMechanism, args, zipFile);
+                tsaUrl, tsaCert, tSAPolicyID, signingMechanism, args, zipFile);
     }
 
 
@@ -2226,7 +2234,7 @@
          */
         Block(SignatureFile sfg, PrivateKey privateKey, String sigalg,
             X509Certificate[] certChain, boolean externalSF, String tsaUrl,
-            X509Certificate tsaCert, ContentSigner signingMechanism,
+            X509Certificate tsaCert, String tSAPolicyID, ContentSigner signingMechanism,
             String[] args, ZipFile zipFile)
             throws NoSuchAlgorithmException, InvalidKeyException, IOException,
             SignatureException, CertificateException {
@@ -2309,7 +2317,7 @@
 
             // Assemble parameters for the signing mechanism
             ContentSignerParameters params =
-                new JarSignerParameters(args, tsaUri, tsaCert, signature,
+                new JarSignerParameters(args, tsaUri, tsaCert, tSAPolicyID, signature,
                     signatureAlgorithm, certChain, content, zipFile);
 
             // Generate the signature block
@@ -2353,11 +2361,13 @@
     private X509Certificate[] signerCertificateChain;
     private byte[] content;
     private ZipFile source;
+    private String tSAPolicyID;
 
     /**
      * Create a new object.
      */
     JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate,
+        String tSAPolicyID,
         byte[] signature, String signatureAlgorithm,
         X509Certificate[] signerCertificateChain, byte[] content,
         ZipFile source) {
@@ -2369,6 +2379,7 @@
         this.args = args;
         this.tsa = tsa;
         this.tsaCertificate = tsaCertificate;
+        this.tSAPolicyID = tSAPolicyID;
         this.signature = signature;
         this.signatureAlgorithm = signatureAlgorithm;
         this.signerCertificateChain = signerCertificateChain;
@@ -2403,6 +2414,10 @@
         return tsaCertificate;
     }
 
+    public String getTSAPolicyID() {
+        return tSAPolicyID;
+    }
+
     /**
      * Retrieves the signature.
      *
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources.java	Wed May 08 10:10:05 2013 +0100
@@ -86,6 +86,8 @@
                 "[-tsa <url>]                location of the Timestamping Authority"},
         {".tsacert.alias.public.key.certificate.for.Timestamping.Authority",
                 "[-tsacert <alias>]          public key certificate for Timestamping Authority"},
+        {".tsapolicyid.tsapolicyid.for.Timestamping.Authority",
+                "[-tsapolicyid <oid>]        TSAPolicyID for Timestamping Authority"},
         {".altsigner.class.class.name.of.an.alternative.signing.mechanism",
                 "[-altsigner <class>]        class name of an alternative signing mechanism"},
         {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Wed May 08 10:10:05 2013 +0100
@@ -73,7 +73,7 @@
         {".digestalg.algorithm.name.of.digest.algorithm",
                 "[-digestalg <algorithm>]  \u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
         {".sigalg.algorithm.name.of.signature.algorithm",
-                "[-sigalg <algorithm>]    \u7F72\u540D\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
+                "[-sigalg <algorithm>]    \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0\u306E\u540D\u524D"},
         {".verify.verify.a.signed.JAR.file",
                 "[-verify]            \u7F72\u540D\u4ED8\u304DJAR\u30D5\u30A1\u30A4\u30EB\u306E\u691C\u8A3C"},
         {".verbose.suboptions.verbose.output.when.signing.verifying.",
@@ -91,7 +91,7 @@
         {".altsignerpath.pathlist.location.of.an.alternative.signing.mechanism",
                 "[-altsignerpath <pathlist>]\u4EE3\u66FF\u7F72\u540D\u30E1\u30AB\u30CB\u30BA\u30E0\u306E\u4F4D\u7F6E"},
         {".internalsf.include.the.SF.file.inside.the.signature.block",
-                "[-internalsf]         \u7F72\u540D\u30D6\u30ED\u30C3\u30AF\u306B.SF\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B"},
+                "[-internalsf]         \u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30D6\u30ED\u30C3\u30AF\u306B.SF\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B"},
         {".sectionsonly.don.t.compute.hash.of.entire.manifest",
                 "[-sectionsonly]        \u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5168\u4F53\u306E\u30CF\u30C3\u30B7\u30E5\u306F\u8A08\u7B97\u3057\u306A\u3044"},
         {".protected.keystore.has.protected.authentication.path",
@@ -119,7 +119,7 @@
         {"i", "i"},
         {".and.d.more.", "(\u4ED6\u306B\u3082%d\u500B)"},
         {".s.signature.was.verified.",
-                "  s=\u7F72\u540D\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F "},
+                "  s=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F "},
         {".m.entry.is.listed.in.manifest",
                 "  m=\u30A8\u30F3\u30C8\u30EA\u304C\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5185\u306B\u30EA\u30B9\u30C8\u3055\u308C\u307E\u3059"},
         {".k.at.least.one.certificate.was.found.in.keystore",
@@ -129,14 +129,14 @@
         {".X.not.signed.by.specified.alias.es.",
                 "  X =\u6307\u5B9A\u3057\u305F\u5225\u540D\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
         {"no.manifest.", "\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002"},
-        {".Signature.related.entries.","(\u7F72\u540D\u95A2\u9023\u30A8\u30F3\u30C8\u30EA)"},
+        {".Signature.related.entries.","(\u30B7\u30B0\u30CD\u30C1\u30E3\u95A2\u9023\u30A8\u30F3\u30C8\u30EA)"},
         {".Unsigned.entries.", "(\u672A\u7F72\u540D\u306E\u30A8\u30F3\u30C8\u30EA)"},
         {"jar.is.unsigned.signatures.missing.or.not.parsable.",
-                "jar\u306F\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002(\u7F72\u540D\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u69CB\u6587\u89E3\u6790\u3067\u304D\u307E\u305B\u3093)"},
+                "jar\u306F\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002(\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u69CB\u6587\u89E3\u6790\u3067\u304D\u307E\u305B\u3093)"},
         {"jar.verified.", "jar\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F\u3002"},
         {"jarsigner.", "jarsigner: "},
         {"signature.filename.must.consist.of.the.following.characters.A.Z.0.9.or.",
-                "\u7F72\u540D\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u7528\u3067\u304D\u308B\u6587\u5B57\u306F\u3001A-Z\u30010-9\u3001_\u3001- \u306E\u307F\u3067\u3059\u3002"},
+                "\u30B7\u30B0\u30CD\u30C1\u30E3\u306E\u30D5\u30A1\u30A4\u30EB\u540D\u306B\u4F7F\u7528\u3067\u304D\u308B\u6587\u5B57\u306F\u3001A-Z\u30010-9\u3001_\u3001- \u306E\u307F\u3067\u3059\u3002"},
         {"unable.to.open.jar.file.", "\u6B21\u306Ejar\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093: "},
         {"unable.to.create.", "\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093: "},
         {".adding.", "   \u8FFD\u52A0\u4E2D: "},
@@ -177,7 +177,7 @@
         {"certificate.will.expire.on", "\u8A3C\u660E\u66F8\u306F{0}\u306B\u5931\u52B9\u3057\u307E\u3059"},
         {".CertPath.not.validated.", "[CertPath\u304C\u691C\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093: "},
         {"requesting.a.signature.timestamp",
-                "\u7F72\u540D\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306E\u30EA\u30AF\u30A8\u30B9\u30C8"},
+                "\u30B7\u30B0\u30CD\u30C1\u30E3\u30FB\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306E\u30EA\u30AF\u30A8\u30B9\u30C8"},
         {"TSA.location.", "TSA\u306E\u5834\u6240: "},
         {"TSA.certificate.", "TSA\u8A3C\u660E\u66F8: "},
         {"no.response.from.the.Timestamping.Authority.",
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java	Wed May 08 10:10:05 2013 +0100
@@ -53,9 +53,9 @@
         {"If.keystore.is.not.password.protected.then.storepass.and.keypass.must.not.be.specified",
                  "\u5982\u679C\u5BC6\u94A5\u5E93\u672A\u53D7\u53E3\u4EE4\u4FDD\u62A4, \u5219\u4E0D\u80FD\u6307\u5B9A -storepass \u548C -keypass"},
         {"Usage.jarsigner.options.jar.file.alias",
-                "\u7528\u6CD5: jarsigner [\u9009\u9879] jar\u6587\u4EF6 \u522B\u540D"},
+                "\u7528\u6CD5: jarsigner [\u9009\u9879] jar \u6587\u4EF6\u522B\u540D"},
         {".jarsigner.verify.options.jar.file.alias.",
-                "       jarsigner -verify [\u9009\u9879] jar\u6587\u4EF6 [\u522B\u540D...]"},
+                "       jarsigner -verify [options] jar-file [alias...]"},
         {".keystore.url.keystore.location",
                 "[-keystore <url>]           \u5BC6\u94A5\u5E93\u4F4D\u7F6E"},
         {".storepass.password.password.for.keystore.integrity",
@@ -65,7 +65,7 @@
         {".keypass.password.password.for.private.key.if.different.",
                 "[-keypass <\u53E3\u4EE4>]           \u79C1\u6709\u5BC6\u94A5\u7684\u53E3\u4EE4 (\u5982\u679C\u4E0D\u540C)"},
         {".certchain.file.name.of.alternative.certchain.file",
-                "[-certchain <\u6587\u4EF6>]         \u66FF\u4EE3\u8BC1\u4E66\u94FE\u6587\u4EF6\u7684\u540D\u79F0"},
+                "[-certchain <file>]         \u66FF\u4EE3 certchain \u6587\u4EF6\u7684\u540D\u79F0"},
         {".sigfile.file.name.of.SF.DSA.file",
                 "[-sigfile <\u6587\u4EF6>]           .SF/.DSA \u6587\u4EF6\u7684\u540D\u79F0"},
         {".signedjar.file.name.of.signed.JAR.file",
@@ -77,7 +77,7 @@
         {".verify.verify.a.signed.JAR.file",
                 "[-verify]                   \u9A8C\u8BC1\u5DF2\u7B7E\u540D\u7684 JAR \u6587\u4EF6"},
         {".verbose.suboptions.verbose.output.when.signing.verifying.",
-                "[-verbose[:\u5B50\u9009\u9879]]     \u7B7E\u540D/\u9A8C\u8BC1\u65F6\u8F93\u51FA\u8BE6\u7EC6\u4FE1\u606F\u3002"},
+                "[-verbose[:suboptions]]     \u7B7E\u540D/\u9A8C\u8BC1\u65F6\u8F93\u51FA\u8BE6\u7EC6\u4FE1\u606F\u3002"},
         {".suboptions.can.be.all.grouped.or.summary",
                 "                            \u5B50\u9009\u9879\u53EF\u4EE5\u662F all, grouped \u6216 summary"},
         {".certs.display.certificates.when.verbose.and.verifying",
@@ -106,7 +106,7 @@
                 "[-strict]                   \u5C06\u8B66\u544A\u89C6\u4E3A\u9519\u8BEF"},
         {"Option.lacks.argument", "\u9009\u9879\u7F3A\u5C11\u53C2\u6570"},
         {"Please.type.jarsigner.help.for.usage", "\u8BF7\u952E\u5165 jarsigner -help \u4EE5\u4E86\u89E3\u7528\u6CD5"},
-        {"Please.specify.jarfile.name", "\u8BF7\u6307\u5B9A jar \u6587\u4EF6\u7684\u540D\u79F0"},
+        {"Please.specify.jarfile.name", "\u8BF7\u6307\u5B9A jarfile \u540D\u79F0"},
         {"Please.specify.alias.name", "\u8BF7\u6307\u5B9A\u522B\u540D"},
         {"Only.one.alias.can.be.specified", "\u53EA\u80FD\u6307\u5B9A\u4E00\u4E2A\u522B\u540D"},
         {"This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es.",
@@ -153,11 +153,11 @@
         {"unable.to.instantiate.keystore.class.",
                 "\u65E0\u6CD5\u5B9E\u4F8B\u5316\u5BC6\u94A5\u5E93\u7C7B: "},
         {"Certificate.chain.not.found.for.alias.alias.must.reference.a.valid.KeyStore.key.entry.containing.a.private.key.and",
-                "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u94FE\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u79C1\u6709\u5BC6\u94A5\u548C\u76F8\u5E94\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u94FE\u7684\u6709\u6548 KeyStore \u5BC6\u94A5\u6761\u76EE\u3002"},
+                "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u94FE\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u79C1\u6709\u5BC6\u94A5\u548C\u76F8\u5E94\u7684\u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u94FE\u7684\u6709\u6548\u5BC6\u94A5\u5E93\u5BC6\u94A5\u6761\u76EE\u3002"},
         {"File.specified.by.certchain.does.not.exist",
                 "\u7531 -certchain \u6307\u5B9A\u7684\u6587\u4EF6\u4E0D\u5B58\u5728"},
         {"Cannot.restore.certchain.from.file.specified",
-                "\u65E0\u6CD5\u4ECE\u6307\u5B9A\u7684\u6587\u4EF6\u8FD8\u539F\u8BC1\u4E66\u94FE"},
+                "\u65E0\u6CD5\u4ECE\u6307\u5B9A\u7684\u6587\u4EF6\u8FD8\u539F certchain"},
         {"Certificate.chain.not.found.in.the.file.specified.",
                 "\u5728\u6307\u5B9A\u7684\u6587\u4EF6\u4E2D\u627E\u4E0D\u5230\u8BC1\u4E66\u94FE\u3002"},
         {"found.non.X.509.certificate.in.signer.s.chain",
@@ -184,7 +184,7 @@
                 "\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u6CA1\u6709\u54CD\u5E94\u3002\u5982\u679C\u8981\u4ECE\u9632\u706B\u5899\u540E\u9762\u8FDE\u63A5, \u5219\u53EF\u80FD\u9700\u8981\u6307\u5B9A HTTP \u6216 HTTPS \u4EE3\u7406\u3002\u8BF7\u4E3A jarsigner \u63D0\u4F9B\u4EE5\u4E0B\u9009\u9879: "},
         {"or", "\u6216"},
         {"Certificate.not.found.for.alias.alias.must.reference.a.valid.KeyStore.entry.containing.an.X.509.public.key.certificate.for.the",
-                "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 X.509 \u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u7684\u6709\u6548 KeyStore \u6761\u76EE\u3002"},
+                "\u627E\u4E0D\u5230{0}\u7684\u8BC1\u4E66\u3002{1}\u5FC5\u987B\u5F15\u7528\u5305\u542B\u65F6\u95F4\u6233\u9881\u53D1\u673A\u6784\u7684 X.509 \u516C\u5171\u5BC6\u94A5\u8BC1\u4E66\u7684\u6709\u6548\u5BC6\u94A5\u5E93\u6761\u76EE\u3002"},
         {"using.an.alternative.signing.mechanism",
                 "\u6B63\u5728\u4F7F\u7528\u66FF\u4EE3\u7684\u7B7E\u540D\u673A\u5236"},
         {"entry.was.signed.on", "\u6761\u76EE\u7684\u7B7E\u540D\u65E5\u671F\u4E3A {0}"},
@@ -229,7 +229,6 @@
         {"Cannot.find.environment.variable.",
                 "\u627E\u4E0D\u5230\u73AF\u5883\u53D8\u91CF: "},
         {"Cannot.find.file.", "\u627E\u4E0D\u5230\u6587\u4EF6: "},
-        {"Command.option.flag.needs.an.argument.", "\u547D\u4EE4\u9009\u9879{0}\u9700\u8981\u4E00\u4E2A\u53C2\u6570\u3002"},
     };
 
     /**
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java	Wed May 08 10:10:05 2013 +0100
@@ -133,7 +133,8 @@
             }
         }
         return PKCS7.generateSignedData(signature, signerChain, content,
-                                        params.getSignatureAlgorithm(), tsaURI);
+                                        params.getSignatureAlgorithm(), tsaURI,
+                                        params.getTSAPolicyID());
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/util/AuthResources_pt_BR.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/util/AuthResources_pt_BR.java	Wed May 08 10:10:05 2013 +0100
@@ -99,7 +99,7 @@
         /***    EVERYTHING BELOW IS DEPRECATED  ***/
 
         // com.sun.security.auth.PolicyFile
-        {".error.parsing.", ": erro de parse "},
+        {".error.parsing.", ": erro de parsing "},
         {"COLON", ": "},
         {".error.adding.Permission.", ": erro ao adicionar a Permiss\u00E3o "},
         {"SPACE", " "},
--- a/jdk/src/share/classes/sun/security/util/AuthResources_zh_TW.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/util/AuthResources_zh_TW.java	Wed May 08 10:10:05 2013 +0100
@@ -94,7 +94,7 @@
         {"Kerberos.username.defUsername.",
                 "Kerberos \u4F7F\u7528\u8005\u540D\u7A31 [{0}]: "},
         {"Kerberos.password.for.username.",
-                "Kerberos \u5BC6\u78BC [{0}]: "},
+                "Kerberos \u5BC6\u78BC {0}: "},
 
         /***    EVERYTHING BELOW IS DEPRECATED  ***/
 
--- a/jdk/src/share/classes/sun/security/util/Resources_es.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/util/Resources_es.java	Wed May 08 10:10:05 2013 +0100
@@ -146,7 +146,7 @@
 
         // sun.security.pkcs11.SunPKCS11
         {"PKCS11.Token.providerName.Password.",
-                "Contrase\u00F1a del Elemento PKCS11 [{0}]: "},
+                "Contrase\u00F1a del Token PKCS11 [{0}]: "},
 
         /* --- DEPRECATED --- */
         // javax.security.auth.Policy
--- a/jdk/src/share/classes/sun/security/util/Resources_pt_BR.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/security/util/Resources_pt_BR.java	Wed May 08 10:10:05 2013 +0100
@@ -105,7 +105,7 @@
         // sun.security.provider.PolicyFile
 
         {"java.security.policy.error.parsing.policy.message",
-                "java.security.policy: erro durante o parse de {0}:\n\t{1}"},
+                "java.security.policy: erro durante o parsing de {0}:\n\t{1}"},
         {"java.security.policy.error.adding.Permission.perm.message",
                 "java.security.policy: erro ao adicionar a permiss\u00E3o, {0}:\n\t{1}"},
         {"java.security.policy.error.adding.Entry.message",
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_de.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding={0} wird hinzugef\u00FCgt
 out.deflated=({0} % verkleinert)
 out.stored=(0 % gespeichert)
-out.create=\ \ erstellt: {0}
+out.create=\  erstellt: {0}
 out.extracted=extrahiert: {0}
 out.inflated=\ \\vergr\u00F6\u00DFert: {0}
 out.size=(ein = {0}) (aus = {1})
 
-usage=Verwendung: jar-Dateien {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOptionen:\n\ \   -c  Neues Archiv erstellen\n\ \   -t  Inhaltsverzeichnis f\u00FCr Archiv auflisten\n\ \   -x  Genannte (oder alle) Dateien aus Archiv extrahieren\n\ \   -u  Vorhandenes Archiv aktualisieren\n\ \   -v  Verbose-Ausgabe f\u00FCr Standardausgabe generieren\n\ \   -f  Namen der Archivdatei angeben\n\ \   -m  Manifest-Informationen von angegebener Manifest-Datei einschlie\u00DFen\n\ \   -e  Anwendungs-Einstiegspunkt f\u00FCr die \n\ \       in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelte Standalone-Anwendung angeben\n\ \   -0  Nur speichern (keine ZIP-Komprimierung)\n\ \   -M  Keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n\ \   -i  Indexinformationen f\u00FCr angegebenen JAR-Dateien erstellen\n\ \   -C  zum angegebenen Verzeichnis wechseln und folgende Datei einschlie\u00DFen\nFalls eine Datei ein Verzeichnis ist, wird dieses rekursiv verarbeitet.\nDer Name der Manifest-Datei, der Name der Archivdatei und der Name des Einstiegspunkts werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren Sie zwei Klassendateien in ein Archiv mit Namen "classes.jar": \n\ \      jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandenen Manifest-Datei "mymanifest", und archivieren Sie\n\ \          alle Dateien im Verzeichnis foo/ in "classes.jar": \n\ \      jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Verwendung: jar-Dateien {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOptionen:\n    -c  Neues Archiv erstellen\n    -t  Inhaltsverzeichnis f\u00FCr Archiv auflisten\n    -x  Genannte (oder alle) Dateien aus Archiv extrahieren\n    -u  Vorhandenes Archiv aktualisieren\n    -v  Verbose-Ausgabe f\u00FCr Standardausgabe generieren\n    -f  Namen der Archivdatei angeben\n    -m  Manifest-Informationen von angegebener Manifest-Datei einschlie\u00DFen\n    -e  Anwendungs-Einstiegspunkt f\u00FCr die \n        in einer ausf\u00FChrbaren JAR-Datei geb\u00FCndelte Standalone-Anwendung angeben\n    -0  Nur speichern (keine ZIP-Komprimierung)\n    -M  Keine Manifest-Datei f\u00FCr die Eintr\u00E4ge erstellen\n    -i  Indexinformationen f\u00FCr angegebenen JAR-Dateien erstellen\n    -C  zum angegebenen Verzeichnis wechseln und folgende Datei einschlie\u00DFen\nFalls eine Datei ein Verzeichnis ist, wird dieses rekursiv verarbeitet.\nDer Name der Manifest-Datei, der Name der Archivdatei und der Name des Einstiegspunkts werden\nin derselben Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Archivieren Sie zwei Klassendateien in ein Archiv mit Namen "classes.jar": \n       jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Verwenden Sie die vorhandenen Manifest-Datei "mymanifest", und archivieren Sie\n           alle Dateien im Verzeichnis foo/ in "classes.jar": \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding=agregando: {0}
 out.deflated=(desinflado {0}%)
 out.stored=(almacenado 0%)
-out.create=\ \ creado: {0}
+out.create=\  creado: {0}
 out.extracted=extra\u00EDdo: {0}
 out.inflated=\ \\inflado: {0}
 out.size=(entrada = {0}) (salida = {1})
 
-usage=Sintaxis: jar {ctxui}[vfm0Me] [archive-jar] [archive-manifiesto] [punto-entrada] [-C dir] archivos...\nOpciones:\n\ \   -c  crear nuevo archivo\n\ \   -t  crear la tabla de contenido del archivo\n\ \   -x extraer el archive mencionado (o todos) del archivo\n\ \   -u  actualizar archive existente\n\ \   -v  generar salida detallada de los datos de salida est\u00E1ndar\n\ \   -f  especificar nombre de archive de almacenamiento\n\ \   -m  incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n\ \   -e  especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n\ \       que se incluye dentro de un archive jar ejecutable\n\ \   -0  s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n\ \   -M  no crear un archive de manifiesto para las entradas\n\ \   -i  generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n\ \   -C  cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n\ \      jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n\ \          archivos del directorio foo/ en 'classes.jar': \n\ \      jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Sintaxis: jar {ctxui}[vfm0Me] [archive-jar] [archive-manifiesto] [punto-entrada] [-C dir] archivos...\nOpciones:\n    -c  crear nuevo archivo\n    -t  crear la tabla de contenido del archivo\n    -x extraer el archive mencionado (o todos) del archivo\n    -u  actualizar archive existente\n    -v  generar salida detallada de los datos de salida est\u00E1ndar\n    -f  especificar nombre de archive de almacenamiento\n    -m  incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n    -e  especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n        que se incluye dentro de un archive jar ejecutable\n    -0  s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n    -M  no crear un archive de manifiesto para las entradas\n    -i  generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n    -C  cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n           archivos del directorio foo/ en 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_fr.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding=ajout : {0}
 out.deflated=(compression : {0} %)
 out.stored=(stockage : 0 %)
-out.create=\ \ cr\u00E9\u00E9 : {0}
+out.create=\  cr\u00E9\u00E9 : {0}
 out.extracted=extrait : {0}
 out.inflated=\ \\d\u00E9compress\u00E9 : {0}
 out.size=(entr\u00E9e = {0}) (sortie = {1})
 
-usage=Syntaxe : jar {ctxui}[vfm0Me] [fichier-jar] [fichier-manifeste] [point-entr\u00E9e] [-C r\u00E9p] fichiers...\nOptions :\n\ \   -c  cr\u00E9e une archive\n\ \   -t  affiche la table des mati\u00E8res de l'archive\n\ \   -x  extrait les fichiers nomm\u00E9s (ou tous les fichiers) de l'archive\n\ \   -u  met \u00E0 jour l'archive existante\n\ \   -v  g\u00E9n\u00E8re une version d\u00E9taill\u00E9e d'une sortie standard\n\ \   -f  sp\u00E9cifie le nom du fichier archive\n\ \   -m  inclut les informations de manifeste \u00E0 partir du fichier de manifeste sp\u00E9cifi\u00E9\n\ \   -e  sp\u00E9cifie le point d'entr\u00E9e d'une application en mode autonome \n\ \       int\u00E9gr\u00E9e \u00E0 un fichier JAR ex\u00E9cutable\n\ \   -0  stockage uniquement, pas de compression ZIP\n\ \   -M  ne cr\u00E9e pas de fichier manifeste pour les entr\u00E9es\n\ \   -i  g\u00E9n\u00E8re les informations d'index des fichiers JAR sp\u00E9cifi\u00E9s\n\ \   -C  passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le fichier suivant\nSi l'un des fichiers est un r\u00E9pertoire, celui-ci est trait\u00E9 r\u00E9cursivement.\nLes noms du fichier manifeste, du fichier archive et du point d'entr\u00E9e sont\nsp\u00E9cifi\u00E9s dans le m\u00EAme ordre que celui des indicateurs m, f et e.\n\nExemple 1 : pour archiver deux fichiers de classe dans une archive intitul\u00E9e classes.jar : \n\ \      jar cvf classes.jar Foo.class Bar.class \nExemple 2 : pour utiliser un fichier manifeste existant 'monmanifeste', puis archiver tous les\n\ \          fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n\ \      jar cvfm classes.jar monmanifeste -C foo/ .\n
+usage=Syntaxe : jar {ctxui}[vfm0Me] [fichier-jar] [fichier-manifeste] [point-entr\u00E9e] [-C r\u00E9p] fichiers...\nOptions :\n    -c  cr\u00E9e une archive\n    -t  affiche la table des mati\u00E8res de l'archive\n    -x  extrait les fichiers nomm\u00E9s (ou tous les fichiers) de l'archive\n    -u  met \u00E0 jour l'archive existante\n    -v  g\u00E9n\u00E8re une version d\u00E9taill\u00E9e d'une sortie standard\n    -f  sp\u00E9cifie le nom du fichier archive\n    -m  inclut les informations de manifeste \u00E0 partir du fichier de manifeste sp\u00E9cifi\u00E9\n    -e  sp\u00E9cifie le point d'entr\u00E9e d'une application en mode autonome \n        int\u00E9gr\u00E9e \u00E0 un fichier JAR ex\u00E9cutable\n    -0  stockage uniquement, pas de compression ZIP\n    -M  ne cr\u00E9e pas de fichier manifeste pour les entr\u00E9es\n    -i  g\u00E9n\u00E8re les informations d'index des fichiers JAR sp\u00E9cifi\u00E9s\n    -C  passe au r\u00E9pertoire sp\u00E9cifi\u00E9 et inclut le fichier suivant\nSi l'un des fichiers est un r\u00E9pertoire, celui-ci est trait\u00E9 r\u00E9cursivement.\nLes noms du fichier manifeste, du fichier archive et du point d'entr\u00E9e sont\nsp\u00E9cifi\u00E9s dans le m\u00EAme ordre que celui des indicateurs m, f et e.\n\nExemple 1 : pour archiver deux fichiers de classe dans une archive intitul\u00E9e classes.jar : \n       jar cvf classes.jar Foo.class Bar.class \nExemple 2 : pour utiliser un fichier manifeste existant 'monmanifeste', puis archiver tous les\n           fichiers du r\u00E9pertoire foo/ dans 'classes.jar' : \n       jar cvfm classes.jar monmanifeste -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding=aggiunta in corso di: {0}
 out.deflated=(compresso {0}%)
 out.stored=(memorizzato 0%)
-out.create=\ \ \ \ \ creato: {0}
+out.create=\     creato: {0}
 out.extracted=estratto: {0}
 out.inflated=\ \\decompresso: {0}
 out.size=(in = {0}) (out = {1})
 
-usage=Utilizzo: jar {ctxui}[vfm0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n\ \   -c  crea un nuovo archivio\n\ \   -t  visualizza l'indice dell'archivio\n\ \   -x  estrae i file con nome (o tutti i file) dall'archivio\n\ \   -u  aggiorna l'archivio esistente\n\ \   -v  genera output commentato dall'output standard\n\ \   -f  specifica il nome file dell'archivio\n\ \   -m  include informazioni manifest dal file manifest specificato\n\ \   -e  specifica il punto di ingresso per l'applicazione stand-alone \n\ \       inclusa nel file jar eseguibile\n\ \   -0  solo memorizzazione; senza compressione ZIP\n\ \   -M  consente di non creare un file manifest per le voci\n\ \   -i  genera informazioni sull'indice per i file jar specificati\n\ \   -C  imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n\ \      jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n\ \          file della directory foo/ in 'classes.jar': \n\ \      jar cvfm classes.jar mymanifest -C foo/.\n
+usage=Uso: jar {ctxui}[vfm0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n    -c  crea un nuovo archivio\n    -t  visualizza l'indice dell'archivio\n    -x  estrae i file con nome (o tutti i file) dall'archivio\n    -u  aggiorna l'archivio esistente\n    -v  genera output commentato dall'output standard\n    -f  specifica il nome file dell'archivio\n    -m  include informazioni manifest dal file manifest specificato\n    -e  specifica il punto di ingresso per l'applicazione stand-alone \n        inclusa nel file jar eseguibile\n    -0  solo memorizzazione; senza compressione ZIP\n    -M  consente di non creare un file manifest per le voci\n    -i  genera informazioni sull'indice per i file jar specificati\n    -C  imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n           file della directory foo/ in 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/.\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding={0}\u3092\u8FFD\u52A0\u4E2D\u3067\u3059
 out.deflated=({0}%\u53CE\u7E2E\u3055\u308C\u307E\u3057\u305F)
 out.stored=(0%\u683C\u7D0D\u3055\u308C\u307E\u3057\u305F)
-out.create=\ \ {0}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F
+out.create=\  {0}\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F
 out.extracted={0}\u304C\u62BD\u51FA\u3055\u308C\u307E\u3057\u305F
 out.inflated=\ \\{0}\u304C\u5C55\u958B\u3055\u308C\u307E\u3057\u305F
 out.size=(\u5165={0})(\u51FA={1})
 
-usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n\\  -c \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n\\  -t \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n\\  -x \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n\\  -u \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n\\  -v \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n\\  -f \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n\\  -m \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n\\  -e \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\n\\     \u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n\\  -0 \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n\\  -M \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n\\  -i \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n\\  -C \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u4EE5\u4E0B\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B:\n\\    jar cvf classes.jar Foo.class Bar.class\n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n\\   \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B:\n\\    jar cvfm classes.jar mymanifest -C foo/ \n
+usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n   -c \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n   -t \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n   -x \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n   -u \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n   -v \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n   -f \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n   -m \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n   -e \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\n      \u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n   -0 \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n   -M \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n   -i \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n   -C \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u4EE5\u4E0B\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B:\n     jar cvf classes.jar Foo.class Bar.class\n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n    \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B:\n     jar cvfm classes.jar mymanifest -C foo/ \n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ko.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding=\uCD94\uAC00\uD558\uB294 \uC911: {0}
 out.deflated=({0}%\uB97C \uAC10\uC18C\uD568)
 out.stored=(0%\uB97C \uC800\uC7A5\uD568)
-out.create=\ \ \uC0DD\uC131\uB428: {0}
+out.create=\  \uC0DD\uC131\uB428: {0}
 out.extracted=\uCD94\uCD9C\uB428: {0}
 out.inflated=\ \\\uC99D\uAC00\uB428: {0}
 out.size=(\uC785\uB825 = {0}) (\uCD9C\uB825 = {1})
 
-usage=\uC0AC\uC6A9\uBC95: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n\ \   -c  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \   -t  \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n\ \   -x  \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n\ \   -u  \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uAC31\uC2E0\uD569\uB2C8\uB2E4.\n\ \   -v  \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \   -f  \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \   -m  \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\ \   -e  jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC758 \n\ \       \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \   -0  \uC800\uC7A5 \uC804\uC6A9: ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\ \   -M  \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\ \   -i  \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \   -C  \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n\ \      jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n\ \          foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n\ \      jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=\uC0AC\uC6A9\uBC95: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\uC635\uC158:\n    -c  \uC0C8 \uC544\uCE74\uC774\uBE0C\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -t  \uC544\uCE74\uC774\uBE0C\uC5D0 \uB300\uD55C \uBAA9\uCC28\uB97C \uB098\uC5F4\uD569\uB2C8\uB2E4.\n    -x  \uBA85\uBA85\uB41C(\uB610\uB294 \uBAA8\uB4E0) \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uC5D0\uC11C \uCD94\uCD9C\uD569\uB2C8\uB2E4.\n    -u  \uAE30\uC874 \uC544\uCE74\uC774\uBE0C\uB97C \uAC31\uC2E0\uD569\uB2C8\uB2E4.\n    -v  \uD45C\uC900 \uCD9C\uB825\uC5D0 \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -f  \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -m  \uC9C0\uC815\uB41C Manifest \uD30C\uC77C\uC758 Manifest \uC815\uBCF4\uB97C \uD3EC\uD568\uD569\uB2C8\uB2E4.\n    -e  jar \uC2E4\uD589 \uD30C\uC77C\uC5D0 \uBC88\uB4E4\uB85C \uC81C\uACF5\uB41C \uB3C5\uB9BD\uD615 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8\uC758 \n        \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC2DC\uC791 \uC9C0\uC810\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4.\n    -0  \uC800\uC7A5 \uC804\uC6A9: ZIP \uC555\uCD95\uC744 \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -M  \uD56D\uBAA9\uC5D0 \uB300\uD574 Manifest \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n    -i  \uC9C0\uC815\uB41C jar \uD30C\uC77C\uC5D0 \uB300\uD55C \uC778\uB371\uC2A4 \uC815\uBCF4\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4.\n    -C  \uC9C0\uC815\uB41C \uB514\uB809\uD1A0\uB9AC\uB85C \uBCC0\uACBD\uD558\uACE0 \uB2E4\uC74C \uD30C\uC77C\uC744 \uD3EC\uD568\uD569\uB2C8\uB2E4.\n\uD2B9\uC815 \uD30C\uC77C\uC774 \uB514\uB809\uD1A0\uB9AC\uC77C \uACBD\uC6B0 \uC21C\uD658\uC801\uC73C\uB85C \uCC98\uB9AC\uB429\uB2C8\uB2E4.\nManifest \uD30C\uC77C \uC774\uB984, \uC544\uCE74\uC774\uBE0C \uD30C\uC77C \uC774\uB984 \uBC0F \uC2DC\uC791 \uC9C0\uC810 \uC774\uB984\uC740\n'm', 'f' \uBC0F 'e' \uD50C\uB798\uADF8\uC640 \uB3D9\uC77C\uD55C \uC21C\uC11C\uB85C \uC9C0\uC815\uB429\uB2C8\uB2E4.\n\n\uC608 1: classes.jar\uB77C\uB294 \uC544\uCE74\uC774\uBE0C\uC5D0 \uB450 \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvf classes.jar Foo.class Bar.class \n\uC608 2: \uAE30\uC874 Manifest \uD30C\uC77C 'mymanifest'\uB97C \uC0AC\uC6A9\uD558\uC5EC\n           foo/ \uB514\uB809\uD1A0\uB9AC\uC758 \uBAA8\uB4E0 \uD30C\uC77C\uC744 'classes.jar'\uB85C \uC544\uCE74\uC774\uBE0C\uD558\uB294 \uBC29\uBC95: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_pt_BR.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding=adicionando: {0}
 out.deflated=(vazio {0}%)
 out.stored=(armazenado 0%)
-out.create=\ \ criado: {0}
+out.create=\  criado: {0}
 out.extracted=extra\u00EDdo: {0}
 out.inflated=\ \\cheio: {0}
 out.size=(dentro = {0}) (fora= {1})
 
-usage=Uso: arquivos jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOp\u00E7\u00F5es:\n\ \   -c  cria novo arquivo compactado\n\ \   -t  lista o sum\u00E1rio do arquivo compactado\n\ \   -x  extrai arquivos com o nome (ou todos) do arquivo compactado\n\ \   -u  atualizar o arquivo compactado existente\n\ \   -v  gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n\ \   -f  especifica o nome do arquivo do arquivo compactado\n\ \   -m  inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n\ \   -e  especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o independente \n\ \       empacotando em um arquivo jar execut\u00E1vel\n\ \   -0  armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n\ \   -M  n\u00E3o cria um arquivo de manifesto para as entradas\n\ \   -i  gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n\ \   -C  altera para o diret\u00F3rio e inclui o arquivo seguinte\nSe nenhum arquivo for um diret\u00F3rio, ent\u00E3o ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags  'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado com o nome classes.jar: \n\ \      jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n\ \          arquivos no diret\u00F3rio foo/ na 'classes.jar': \n\ \      jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Uso: arquivos jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] ...\nOp\u00E7\u00F5es:\n    -c  cria novo arquivo compactado\n    -t  lista o sum\u00E1rio do arquivo compactado\n    -x  extrai arquivos com o nome (ou todos) do arquivo compactado\n    -u  atualizar o arquivo compactado existente\n    -v  gera sa\u00EDda detalhada na sa\u00EDda padr\u00E3o\n    -f  especifica o nome do arquivo do arquivo compactado\n    -m  inclui as informa\u00E7\u00F5es do manifesto do arquivo de manifesto especificado\n    -e  especifica o ponto de entrada da aplica\u00E7\u00E3o para aplica\u00E7\u00E3o independente \n        empacotando em um arquivo jar execut\u00E1vel\n    -0  armazena somente; n\u00E3o usa compacta\u00E7\u00E3o ZIP\n    -M  n\u00E3o cria um arquivo de manifesto para as entradas\n    -i  gera informa\u00E7\u00F5es de \u00EDndice para os arquivos especificados\n    -C  altera para o diret\u00F3rio e inclui o arquivo seguinte\nSe nenhum arquivo for um diret\u00F3rio, ent\u00E3o ser\u00E1 processado repetidamente.\nO nome do arquivo de manifesto, o nome do arquivo compactado e o nome do ponto de entrada s\u00E3o\nespecificados na mesma ordem dos flags  'm', 'f' e 'e'.\n\nExemplo 1: para arquivar dois arquivos de classe em um arquivo compactado com o nome classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExemplo 2: use um arquivo de manifesto existente 'mymanifest' e arquive todos os\n           arquivos no diret\u00F3rio foo/ na 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding=l\u00E4gger till: {0}
 out.deflated=({0}% packat)
 out.stored=(0% lagrat)
-out.create=\ \ skapad: {0}
+out.create=\  skapad: {0}
 out.extracted=extraherat: {0}
-out.inflated=\\uppackat: {0}
+out.inflated=\ uppackat: {0}
 out.size=(in = {0}) (ut = {1})
 
-usage=Syntax: jar-filer {ctxui}[vfm0Me] [jar-fil] [manifestfil] [startpunkt] [-C-katalog] ...\nAlternativ:\n\ \   -c  skapa nytt arkiv\n\ \   -t  lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n\ \   -x  extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n\ \   -u  uppdatera befintligt arkiv\n\ \   -v  generera utf\u00F6rliga utdata vid standardutmatning\n\ \   -f  ange arkivfilens namn\n\ \   -m  inkludera manifestinformation fr\u00E5n angivet manifest\n\ \   -e  ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n\ \       som medf\u00F6ljer i en jar-programfil\n\ \   -0  endast lagra  (ingen zip-komprimering)\n\ \   -M  skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n\ \   -i  generera indexinformation f\u00F6r de angivna jar-filerna\n\ \   -C  \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges i samma\nordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n\ \      jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n\ \          filer fr\u00E5n katalogen foo/ i classes.jar: \n\ \      jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Syntax: jar-filer {ctxui}[vfm0Me] [jar-fil] [manifestfil] [startpunkt] [-C-katalog] ...\nAlternativ:\n    -c  skapa nytt arkiv\n    -t  lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n    -x  extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n    -u  uppdatera befintligt arkiv\n    -v  generera utf\u00F6rliga utdata vid standardutmatning\n    -f  ange arkivfilens namn\n    -m  inkludera manifestinformation fr\u00E5n angivet manifest\n    -e  ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n        som medf\u00F6ljer i en jar-programfil\n    -0  endast lagra  (ingen zip-komprimering)\n    -M  skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n    -i  generera indexinformation f\u00F6r de angivna jar-filerna\n    -C  \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges i samma\nordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n           filer fr\u00E5n katalogen foo/ i classes.jar: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding=\u6B63\u5728\u6DFB\u52A0: {0}
 out.deflated=(\u538B\u7F29\u4E86 {0}%)
 out.stored=(\u5B58\u50A8\u4E86 0%)
-out.create=\ \ \u5DF2\u521B\u5EFA: {0}
+out.create=\  \u5DF2\u521B\u5EFA: {0}
 out.extracted=\u5DF2\u63D0\u53D6: {0}
-out.inflated=\ \ \u5DF2\u89E3\u538B: {0}
+out.inflated=\  \u5DF2\u89E3\u538B: {0}
 out.size=(\u8F93\u5165 = {0}) (\u8F93\u51FA = {1})
 
-usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879\u5305\u62EC: \n\ \   -c  \u521B\u5EFA\u65B0\u7684\u5F52\u6863\u6587\u4EF6\n\ \   -t  \u5217\u51FA\u5F52\u6863\u76EE\u5F55\n\ \   -x  \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n\ \   -u  \u66F4\u65B0\u73B0\u6709\u7684\u5F52\u6863\u6587\u4EF6\n\ \   -v  \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n\ \   -f  \u6307\u5B9A\u5F52\u6863\u6587\u4EF6\u540D\n\ \   -m  \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n\ \   -e  \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n\ \       \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n\ \   -0  \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u60C5\u51B5\u4EFB\u4F55 ZIP \u538B\u7F29\n\ \   -M  \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n\ \   -i  \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n\ \   -C  \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u5176\u4E2D\u7684\u6587\u4EF6\n\u5982\u679C\u6709\u4EFB\u4F55\u76EE\u5F55\u6587\u4EF6, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u5F52\u6863\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u5F52\u6863\u6587\u4EF6\u4E2D: \n\ \      jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n\ \          \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n\ \      jar cvfm classes.jar mymanifest -C foo/\u3002\n
+usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879\u5305\u62EC: \n    -c  \u521B\u5EFA\u65B0\u7684\u5F52\u6863\u6587\u4EF6\n    -t  \u5217\u51FA\u5F52\u6863\u76EE\u5F55\n    -x  \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n    -u  \u66F4\u65B0\u73B0\u6709\u7684\u5F52\u6863\u6587\u4EF6\n    -v  \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n    -f  \u6307\u5B9A\u5F52\u6863\u6587\u4EF6\u540D\n    -m  \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n    -e  \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n        \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n    -0  \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u60C5\u51B5\u4EFB\u4F55 ZIP \u538B\u7F29\n    -M  \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n    -i  \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n    -C  \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u5176\u4E2D\u7684\u6587\u4EF6\n\u5982\u679C\u6709\u4EFB\u4F55\u76EE\u5F55\u6587\u4EF6, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u5F52\u6863\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u5F52\u6863\u6587\u4EF6\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n           \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/\u3002\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_TW.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2006, 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,9 +39,9 @@
 out.adding=\u65B0\u589E: {0}
 out.deflated=(\u58D3\u7E2E {0}%)
 out.stored=(\u5132\u5B58 0%)
-out.create=\ \ \u5EFA\u7ACB: {0}
+out.create=\  \u5EFA\u7ACB: {0}
 out.extracted=\u64F7\u53D6: {0}
 out.inflated=\ \\\u64F4\u5C55: {0}
 out.size=\ (\u8B80={0})(\u5BEB={1})
 
-usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n\ \   -c  \u5EFA\u7ACB\u65B0\u7684\u6B78\u6A94\n\ \   -t  \u5217\u51FA\u6B78\u6A94\u7684\u76EE\u9304\n\ \   -x  \u5F9E\u6B78\u6A94\u4E2D\u64F7\u53D6\u5DF2\u547D\u540D\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n\ \   -u  \u66F4\u65B0\u73FE\u6709\u6B78\u6A94\n\ \   -v  \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n\ \   -f  \u6307\u5B9A\u6B78\u6A94\u6A94\u6848\u540D\u7A31\n\ \   -m  \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n\ \   -e  \u70BA\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n\ \       \u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\n\ \   -0  \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n\ \   -M  \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n\ \   -i  \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n\ \   -C  \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u6B78\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u6B78\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u6B78\u6A94\u4E2D: \n\ \      jar cvf classes.jar Foo.class Bar.class\n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n\ \          foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u6B78\u6A94\u81F3 'classes.jar' \u4E2D: \n\ \      jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] \u6A94\u6848 ...\n\u9078\u9805:\n    -c  \u5EFA\u7ACB\u65B0\u7684\u6B78\u6A94\n    -t  \u5217\u51FA\u6B78\u6A94\u7684\u76EE\u9304\n    -x  \u5F9E\u6B78\u6A94\u4E2D\u64F7\u53D6\u5DF2\u547D\u540D\u7684 (\u6216\u6240\u6709) \u6A94\u6848\n    -u  \u66F4\u65B0\u73FE\u6709\u6B78\u6A94\n    -v  \u5728\u6A19\u6E96\u8F38\u51FA\u4E2D\u7522\u751F\u8A73\u7D30\u8F38\u51FA\n    -f  \u6307\u5B9A\u6B78\u6A94\u6A94\u6848\u540D\u7A31\n    -m  \u5305\u542B\u6307\u5B9A\u8CC7\u8A0A\u6E05\u55AE\u4E2D\u7684\u8CC7\u8A0A\u6E05\u55AE\u8CC7\u8A0A\n    -e  \u70BA\u7368\u7ACB\u61C9\u7528\u7A0B\u5F0F\u6307\u5B9A\u61C9\u7528\u7A0B\u5F0F\u9032\u5165\u9EDE\n        \u5DF2\u96A8\u9644\u65BC\u53EF\u57F7\u884C jar \u6A94\u6848\u4E2D\n    -0  \u50C5\u5132\u5B58; \u4E0D\u4F7F\u7528 ZIP \u58D3\u7E2E\u65B9\u5F0F\n    -M  \u4E0D\u70BA\u9805\u76EE\u5EFA\u7ACB\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848\n    -i  \u70BA\u6307\u5B9A\u7684 jar \u6A94\u6848\u7522\u751F\u7D22\u5F15\u8CC7\u8A0A\n    -C  \u8B8A\u66F4\u81F3\u6307\u5B9A\u76EE\u9304\u4E26\u5305\u542B\u5F8C\u9762\u6240\u5217\u7684\u6A94\u6848\n\u5982\u679C\u6709\u4EFB\u4F55\u6A94\u6848\u662F\u76EE\u9304\uFF0C\u5247\u6703\u5C0D\u5176\u9032\u884C\u905E\u8FF4\u8655\u7406\u3002\n\u6E05\u55AE\u6A94\u6848\u540D\u7A31\u3001\u6B78\u6A94\u6A94\u6848\u540D\u7A31\u548C\u9032\u5165\u9EDE\u540D\u7A31\n\u7684\u6307\u5B9A\u9806\u5E8F\u8207\u6307\u5B9A 'm' \u65D7\u6A19\u3001'f' \u65D7\u6A19\u548C 'e' \u65D7\u6A19\u7684\u9806\u5E8F\u76F8\u540C\u3002\n\n\u7BC4\u4F8B 1: \u5C07\u5169\u500B\u985E\u5225\u6A94\u6848\u6B78\u6A94\u81F3\u540D\u70BA classes.jar \u7684\u6B78\u6A94\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class\n\u7BC4\u4F8B 2: \u4F7F\u7528\u73FE\u6709\u8CC7\u8A0A\u6E05\u55AE\u6A94\u6848 'mymanifest' \u4E26\u5C07\n           foo/ \u76EE\u9304\u4E2D\u7684\u6240\u6709\u6A94\u6848\u6B78\u6A94\u81F3 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,15 +1,15 @@
-ONE_DAY=\ 1\u65e5
+ONE_DAY=\ 1\u65E5
 ONE_HOUR=\ 1\u6642\u9593
 ONE_MIN=\ 1\u5206
-ONE_MONTH=\ 1\u304b\u6708
-ONE_YEAR=\ 1\u5e74
+ONE_MONTH=\ 1\u304B\u6708
+ONE_YEAR=\ 1\u5E74
 TWO_HOURS=\ 2\u6642\u9593
 THREE_HOURS=\ 3\u6642\u9593
-THREE_MONTHS=\ 3\u304b\u6708
+THREE_MONTHS=\ 3\u304B\u6708
 FIVE_MIN=\ 5\u5206
 SIX_HOURS=\ 6\u6642\u9593
-SIX_MONTHS=\ 6\u304b\u6708
-SEVEN_DAYS=\ 7\u65e5
+SIX_MONTHS=\ 6\u304B\u6708
+SEVEN_DAYS=\ 7\u65E5
 TEN_MIN=10\u5206
 TWELVE_HOURS=12\u6642\u9593
 THIRTY_MIN=30\u5206
@@ -19,255 +19,255 @@
 ACTION_CAPITALIZED=ACTION
 ACTION_INFO_CAPITALIZED=ACTION_INFO
 ALL=\u3059\u3079\u3066
-ARCHITECTURE=\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3
-ATTRIBUTE=\u5c5e\u6027
-ATTRIBUTE_VALUE=\u5c5e\u6027\u5024
-ATTRIBUTE_VALUES=\u5c5e\u6027\u5024
-ATTRIBUTES=\u5c5e\u6027
-BLANK=\u30d6\u30e9\u30f3\u30af
-BLOCKED_COUNT_WAITED_COUNT=\u30d6\u30ed\u30c3\u30af\u6e08\u5408\u8a08: {0}  \u5f85\u6a5f\u6e08\u5408\u8a08: {1}\n
-BOOT_CLASS_PATH=\u30d6\u30fc\u30c8\u30fb\u30af\u30e9\u30b9\u30d1\u30b9
-BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP=\u8868\u793a\u3059\u308b\u60c5\u5831\u91cf\u3092\u5897\u6e1b\u3059\u308b\u30c8\u30b0\u30eb
-CPU_USAGE=CPU\u4f7f\u7528\u7387
-CPU_USAGE_FORMAT=CPU\u4f7f\u7528\u7387: {0}%
-CANCEL=\u53d6\u6d88
-CASCADE=\u91cd\u306d\u3066\u8868\u793a(&C)
-CHART_COLON=\u30c1\u30e3\u30fc\u30c8(&C):
-CLASS_PATH=\u30af\u30e9\u30b9\u30d1\u30b9
+ARCHITECTURE=\u30A2\u30FC\u30AD\u30C6\u30AF\u30C1\u30E3
+ATTRIBUTE=\u5C5E\u6027
+ATTRIBUTE_VALUE=\u5C5E\u6027\u5024
+ATTRIBUTE_VALUES=\u5C5E\u6027\u5024
+ATTRIBUTES=\u5C5E\u6027
+BLANK=\u30D6\u30E9\u30F3\u30AF
+BLOCKED_COUNT_WAITED_COUNT=\u30D6\u30ED\u30C3\u30AF\u6E08\u5408\u8A08: {0}  \u5F85\u6A5F\u6E08\u5408\u8A08: {1}\n
+BOOT_CLASS_PATH=\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9
+BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP=\u8868\u793A\u3059\u308B\u60C5\u5831\u91CF\u3092\u5897\u6E1B\u3059\u308B\u30C8\u30B0\u30EB
+CPU_USAGE=CPU\u4F7F\u7528\u7387
+CPU_USAGE_FORMAT=CPU\u4F7F\u7528\u7387: {0}%
+CANCEL=\u53D6\u6D88
+CASCADE=\u91CD\u306D\u3066\u8868\u793A(&C)
+CHART_COLON=\u30C1\u30E3\u30FC\u30C8(&C):
+CLASS_PATH=\u30AF\u30E9\u30B9\u30D1\u30B9
 CLASS_NAME=ClassName
-CLASS_TAB_INFO_LABEL_FORMAT=<html>\u30ed\u30fc\u30c9\u6e08: {0}    \u672a\u30ed\u30fc\u30c9: {1}    \u5408\u8a08: {2}</html>
-CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME=\u30ed\u30fc\u30c9\u6e08\u30af\u30e9\u30b9\u306e\u30c1\u30e3\u30fc\u30c8\u3002
-CLASSES=\u30af\u30e9\u30b9
-CLOSE=\u9589\u3058\u308b
-COLUMN_NAME=\u540d\u524d
+CLASS_TAB_INFO_LABEL_FORMAT=<html>\u30ED\u30FC\u30C9\u6E08: {0}    \u672A\u30ED\u30FC\u30C9: {1}    \u5408\u8A08: {2}</html>
+CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME=\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u306E\u30C1\u30E3\u30FC\u30C8\u3002
+CLASSES=\u30AF\u30E9\u30B9
+CLOSE=\u9589\u3058\u308B
+COLUMN_NAME=\u540D\u524D
 COLUMN_PID=PID
-COMMITTED_MEMORY=\u30b3\u30df\u30c3\u30c8\u6e08\u30e1\u30e2\u30ea\u30fc
-COMMITTED_VIRTUAL_MEMORY=\u30b3\u30df\u30c3\u30c8\u6e08\u4eee\u60f3\u30e1\u30e2\u30ea\u30fc
-COMMITTED=\u30b3\u30df\u30c3\u30c8\u6e08
-CONNECT=\u63a5\u7d9a(&C)
-CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP=Java\u4eee\u60f3\u30de\u30b7\u30f3\u306b\u63a5\u7d9a
-CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION=\u30ed\u30fc\u30ab\u30eb\u307e\u305f\u306f\u30ea\u30e2\u30fc\u30c8\u306eJava\u4eee\u60f3\u30de\u30b7\u30f3\u3078\u306e\u65b0\u898f\u63a5\u7d9a\u3092\u884c\u3046\u30c0\u30a4\u30a2\u30ed\u30b0
-CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u30de\u30b9\u30c8\u30d8\u30c3\u30c9\u56f3\u5f62
-CONNECT_DIALOG_MASTHEAD_TITLE=\u65b0\u898f\u63a5\u7d9a
-CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME=\u30b9\u30c6\u30fc\u30bf\u30b9\u30fb\u30d0\u30fc
-CONNECT_DIALOG_TITLE=JConsole: \u65b0\u898f\u63a5\u7d9a
-CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_=\u63a5\u7d9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u5207\u65ad\u3057\u307e\u3059\u3002
-CONNECTION_FAILED=\u63a5\u7d9a\u306b\u5931\u6557\u3057\u307e\u3057\u305f
-CONNECTION=\u63a5\u7d9a(&C)
-CONNECTION_NAME=\u63a5\u7d9a\u540d
-CONNECTION_NAME__DISCONNECTED_={0} (\u5207\u65ad\u6e08)
-CONSTRUCTOR=\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf
-CURRENT_CLASSES_LOADED=\u30ed\u30fc\u30c9\u6e08\u306e\u73fe\u5728\u306e\u30af\u30e9\u30b9
-CURRENT_HEAP_SIZE=\u73fe\u5728\u306e\u30d2\u30fc\u30d7\u30fb\u30b5\u30a4\u30ba
-CURRENT_VALUE=\u73fe\u5728\u5024: {0}
-CREATE=\u4f5c\u6210
-DAEMON_THREADS=\u30c7\u30fc\u30e2\u30f3\u30fb\u30b9\u30ec\u30c3\u30c9
-DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_=\u5207\u65ad\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u63a5\u7d9a\u3057\u307e\u3059\u3002
-DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE=\u5c55\u958b\u307e\u305f\u306f\u7e2e\u5c0f\u3059\u308b\u306b\u306f\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044
-DOUBLE_CLICK_TO_VISUALIZE=\u8996\u899a\u5316\u3059\u308b\u306b\u306f\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044
-DESCRIPTION=\u8aac\u660e
-DESCRIPTOR=\u8a18\u8ff0\u5b50
-DETAILS=\u8a73\u7d30
-DETECT_DEADLOCK=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af\u306e\u691c\u51fa(&D)
-DETECT_DEADLOCK_TOOLTIP=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af\u6e08\u30b9\u30ec\u30c3\u30c9\u306e\u691c\u51fa
-DIMENSION_IS_NOT_SUPPORTED_COLON=\u6b21\u5143\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093:
-DISCARD_CHART=\u30c1\u30e3\u30fc\u30c8\u306e\u7834\u68c4
-DURATION_DAYS_HOURS_MINUTES={0,choice,1#{0,number,integer}\u65e5|1.0<{0,number,integer}\u65e5}{1,choice,0<{1,number,integer}\u6642\u9593|1#{1,number,integer}\u6642\u9593|1<{1,number,integer}\u6642\u9593}{2,choice,0<{2,number,integer}\u5206|1#{2,number,integer}\u5206|1.0<{2,number,integer}\u5206}
+COMMITTED_MEMORY=\u30B3\u30DF\u30C3\u30C8\u6E08\u30E1\u30E2\u30EA\u30FC
+COMMITTED_VIRTUAL_MEMORY=\u30B3\u30DF\u30C3\u30C8\u6E08\u4EEE\u60F3\u30E1\u30E2\u30EA\u30FC
+COMMITTED=\u30B3\u30DF\u30C3\u30C8\u6E08
+CONNECT=\u63A5\u7D9A(&C)
+CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP=Java\u4EEE\u60F3\u30DE\u30B7\u30F3\u306B\u63A5\u7D9A
+CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION=\u30ED\u30FC\u30AB\u30EB\u307E\u305F\u306F\u30EA\u30E2\u30FC\u30C8\u306EJava\u4EEE\u60F3\u30DE\u30B7\u30F3\u3078\u306E\u65B0\u898F\u63A5\u7D9A\u3092\u884C\u3046\u30C0\u30A4\u30A2\u30ED\u30B0
+CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u30DE\u30B9\u30C8\u30D8\u30C3\u30C9\u56F3\u5F62
+CONNECT_DIALOG_MASTHEAD_TITLE=\u65B0\u898F\u63A5\u7D9A
+CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME=\u30B9\u30C6\u30FC\u30BF\u30B9\u30FB\u30D0\u30FC
+CONNECT_DIALOG_TITLE=JConsole: \u65B0\u898F\u63A5\u7D9A
+CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_=\u63A5\u7D9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u5207\u65AD\u3057\u307E\u3059\u3002
+CONNECTION_FAILED=\u63A5\u7D9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+CONNECTION=\u63A5\u7D9A(&C)
+CONNECTION_NAME=\u63A5\u7D9A\u540D
+CONNECTION_NAME__DISCONNECTED_={0} (\u5207\u65AD\u6E08)
+CONSTRUCTOR=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
+CURRENT_CLASSES_LOADED=\u30ED\u30FC\u30C9\u6E08\u306E\u73FE\u5728\u306E\u30AF\u30E9\u30B9
+CURRENT_HEAP_SIZE=\u73FE\u5728\u306E\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA
+CURRENT_VALUE=\u73FE\u5728\u5024: {0}
+CREATE=\u4F5C\u6210
+DAEMON_THREADS=\u30C7\u30FC\u30E2\u30F3\u30FB\u30B9\u30EC\u30C3\u30C9
+DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_=\u5207\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u63A5\u7D9A\u3057\u307E\u3059\u3002
+DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE=\u5C55\u958B\u307E\u305F\u306F\u7E2E\u5C0F\u3059\u308B\u306B\u306F\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044
+DOUBLE_CLICK_TO_VISUALIZE=\u8996\u899A\u5316\u3059\u308B\u306B\u306F\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044
+DESCRIPTION=\u8AAC\u660E
+DESCRIPTOR=\u8A18\u8FF0\u5B50
+DETAILS=\u8A73\u7D30
+DETECT_DEADLOCK=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u306E\u691C\u51FA(&D)
+DETECT_DEADLOCK_TOOLTIP=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u6E08\u30B9\u30EC\u30C3\u30C9\u306E\u691C\u51FA
+DIMENSION_IS_NOT_SUPPORTED_COLON=\u6B21\u5143\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093:
+DISCARD_CHART=\u30C1\u30E3\u30FC\u30C8\u306E\u7834\u68C4
+DURATION_DAYS_HOURS_MINUTES={0,choice,1#{0,number,integer}\u65E5|1.0<{0,number,integer}\u65E5}{1,choice,0<{1,number,integer}\u6642\u9593|1#{1,number,integer}\u6642\u9593|1<{1,number,integer}\u6642\u9593}{2,choice,0<{2,number,integer}\u5206|1#{2,number,integer}\u5206|1.0<{2,number,integer}\u5206}
 DURATION_HOURS_MINUTES={0,choice,1#{0,number,integer}\u6642\u9593|1<{0,number,integer}\u6642\u9593}{1,choice,0<{1,number,integer}\u5206|1#{1,number,integer}\u5206|1.0<{1,number,integer}\u5206}
 DURATION_MINUTES={0,choice,1#{0,number,integer}\u5206|1.0<{0,number,integer}\u5206}
-DURATION_SECONDS={0}\u79d2
-EMPTY_ARRAY=\u7a7a\u306e\u914d\u5217
-ERROR=\u30a8\u30e9\u30fc
-ERROR_COLON_MBEANS_ALREADY_EXIST=\u30a8\u30e9\u30fc: MBeans\u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059
-ERROR_COLON_MBEANS_DO_NOT_EXIST=\u30a8\u30e9\u30fc: MBeans\u306f\u5b58\u5728\u3057\u307e\u305b\u3093
-EVENT=\u30a4\u30d9\u30f3\u30c8
-EXIT=\u7d42\u4e86(&X)
-FAIL_TO_LOAD_PLUGIN=\u8b66\u544a: \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30ed\u30fc\u30c9\u306b\u5931\u6557\u3057\u307e\u3057\u305f: {0}
-FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION=\u53d6\u6d88
-FILE_CHOOSER_FILE_EXISTS_MESSAGE=<html><center>\u30d5\u30a1\u30a4\u30eb\u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u3066\u3044\u307e\u3059:<br>{0}<br>\u7f6e\u63db\u3057\u3066\u3082\u3088\u308d\u3057\u3044\u3067\u3059\u304b\u3002
-FILE_CHOOSER_FILE_EXISTS_OK_OPTION=\u7f6e\u63db
-FILE_CHOOSER_FILE_EXISTS_TITLE=\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u3059
-FILE_CHOOSER_SAVED_FILE=<html>\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3057\u307e\u3057\u305f:<br>{0}<br>({1}\u30d0\u30a4\u30c8)
-FILE_CHOOSER_SAVE_FAILED_MESSAGE=<html><center>\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u4fdd\u5b58\u306b\u5931\u6557\u3057\u307e\u3057\u305f:<br>{0}<br>{1}
-FILE_CHOOSER_SAVE_FAILED_TITLE=\u4fdd\u5b58\u306b\u5931\u6557\u3057\u307e\u3057\u305f
-FREE_PHYSICAL_MEMORY=\u7a7a\u304d\u7269\u7406\u30e1\u30e2\u30ea\u30fc
-FREE_SWAP_SPACE=\u7a7a\u304d\u30b9\u30ef\u30c3\u30d7\u30fb\u30b9\u30da\u30fc\u30b9
-GARBAGE_COLLECTOR=\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf
-GC_INFO=\u540d\u524d= ''{0}''\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3= {1,choice,-1#\u3042\u308a\u307e\u305b\u3093|0#{1,number,integer}\u500b}\u3001\u5408\u8a08\u6d88\u8cbb\u6642\u9593= {2}
+DURATION_SECONDS={0}\u79D2
+EMPTY_ARRAY=\u7A7A\u306E\u914D\u5217
+ERROR=\u30A8\u30E9\u30FC
+ERROR_COLON_MBEANS_ALREADY_EXIST=\u30A8\u30E9\u30FC: MBeans\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u307E\u3059
+ERROR_COLON_MBEANS_DO_NOT_EXIST=\u30A8\u30E9\u30FC: MBeans\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
+EVENT=\u30A4\u30D9\u30F3\u30C8
+EXIT=\u7D42\u4E86(&X)
+FAIL_TO_LOAD_PLUGIN=\u8B66\u544A: \u30D7\u30E9\u30B0\u30A4\u30F3\u306E\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F: {0}
+FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION=\u53D6\u6D88
+FILE_CHOOSER_FILE_EXISTS_MESSAGE=<html><center>\u30D5\u30A1\u30A4\u30EB\u306F\u3059\u3067\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059:<br>{0}<br>\u7F6E\u63DB\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\u3002
+FILE_CHOOSER_FILE_EXISTS_OK_OPTION=\u7F6E\u63DB
+FILE_CHOOSER_FILE_EXISTS_TITLE=\u30D5\u30A1\u30A4\u30EB\u304C\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
+FILE_CHOOSER_SAVED_FILE=<html>\u30D5\u30A1\u30A4\u30EB\u306B\u4FDD\u5B58\u3057\u307E\u3057\u305F:<br>{0}<br>({1}\u30D0\u30A4\u30C8)
+FILE_CHOOSER_SAVE_FAILED_MESSAGE=<html><center>\u30D5\u30A1\u30A4\u30EB\u3078\u306E\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F:<br>{0}<br>{1}
+FILE_CHOOSER_SAVE_FAILED_TITLE=\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+FREE_PHYSICAL_MEMORY=\u7A7A\u304D\u7269\u7406\u30E1\u30E2\u30EA\u30FC
+FREE_SWAP_SPACE=\u7A7A\u304D\u30B9\u30EF\u30C3\u30D7\u30FB\u30B9\u30DA\u30FC\u30B9
+GARBAGE_COLLECTOR=\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30BF
+GC_INFO=\u540D\u524D= ''{0}''\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3= {1,choice,-1#\u3042\u308A\u307E\u305B\u3093|0#{1,number,integer}\u500B}\u3001\u5408\u8A08\u6D88\u8CBB\u6642\u9593= {2}
 GC_TIME=GC\u6642\u9593
-GC_TIME_DETAILS={1}\u3067{0} ({2}\u500b\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3)
-HEAP_MEMORY_USAGE=\u30d2\u30fc\u30d7\u30fb\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387
-HEAP=\u30d2\u30fc\u30d7
-HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION=JConsole\u3068JDK\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3064\u3044\u3066\u306e\u60c5\u5831\u3092\u542b\u3080\u30c0\u30a4\u30a2\u30ed\u30b0
-HELP_ABOUT_DIALOG_JCONSOLE_VERSION=JConsole\u30d0\u30fc\u30b8\u30e7\u30f3:<br>{0}
-HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM\u30d0\u30fc\u30b8\u30e7\u30f3:<br>{0}
-HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u30de\u30b9\u30c8\u30d8\u30c3\u30c9\u56f3\u5f62
-HELP_ABOUT_DIALOG_MASTHEAD_TITLE=JConsole\u306b\u3064\u3044\u3066
-HELP_ABOUT_DIALOG_TITLE=JConsole: \u8a73\u7d30
-HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole\u30e6\u30fc\u30b6\u30fc\u30fb\u30ac\u30a4\u30c9(&U):<br>{0}
+GC_TIME_DETAILS={1}\u3067{0} ({2}\u500B\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3)
+HEAP_MEMORY_USAGE=\u30D2\u30FC\u30D7\u30FB\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387
+HEAP=\u30D2\u30FC\u30D7
+HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION=JConsole\u3068JDK\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306B\u3064\u3044\u3066\u306E\u60C5\u5831\u3092\u542B\u3080\u30C0\u30A4\u30A2\u30ED\u30B0
+HELP_ABOUT_DIALOG_JCONSOLE_VERSION=JConsole\u30D0\u30FC\u30B8\u30E7\u30F3:<br>{0}
+HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM\u30D0\u30FC\u30B8\u30E7\u30F3:<br>{0}
+HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u30DE\u30B9\u30C8\u30D8\u30C3\u30C9\u56F3\u5F62
+HELP_ABOUT_DIALOG_MASTHEAD_TITLE=JConsole\u306B\u3064\u3044\u3066
+HELP_ABOUT_DIALOG_TITLE=JConsole: \u8A73\u7D30
+HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole\u30E6\u30FC\u30B6\u30FC\u30FB\u30AC\u30A4\u30C9(&U):<br>{0}
 HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html
-HELP_MENU_ABOUT_TITLE=JConsole\u306b\u3064\u3044\u3066(&A)
-HELP_MENU_USER_GUIDE_TITLE=\u30aa\u30f3\u30e9\u30a4\u30f3\u30fb\u30e6\u30fc\u30b6\u30fc\u30fb\u30ac\u30a4\u30c9(&U)
-HELP_MENU_TITLE=\u30d8\u30eb\u30d7(&H)
+HELP_MENU_ABOUT_TITLE=JConsole\u306B\u3064\u3044\u3066(&A)
+HELP_MENU_USER_GUIDE_TITLE=\u30AA\u30F3\u30E9\u30A4\u30F3\u30FB\u30E6\u30FC\u30B6\u30FC\u30FB\u30AC\u30A4\u30C9(&U)
+HELP_MENU_TITLE=\u30D8\u30EB\u30D7(&H)
 HOTSPOT_MBEANS_ELLIPSIS=Hotspot MBeans(&H)...
-HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=Hotspot MBeans\u306e\u7ba1\u7406\u7528\u30c0\u30a4\u30a2\u30ed\u30b0
-IMPACT=\u5f71\u97ff
-INFO=\u60c5\u5831
-INFO_CAPITALIZED=\u60c5\u5831
-INVALID_PLUGIN_PATH=\u8b66\u544a: \u7121\u52b9\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u30fb\u30d1\u30b9: {0}
-INVALID_URL=\u7121\u52b9\u306aURL: {0}
-IS=\u6b21\u306b\u4e00\u81f4\u3059\u308b
+HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=Hotspot MBeans\u306E\u7BA1\u7406\u7528\u30C0\u30A4\u30A2\u30ED\u30B0
+IMPACT=\u5F71\u97FF
+INFO=\u60C5\u5831
+INFO_CAPITALIZED=INFO
+INVALID_PLUGIN_PATH=\u8B66\u544A: \u7121\u52B9\u306A\u30D7\u30E9\u30B0\u30A4\u30F3\u30FB\u30D1\u30B9: {0}
+INVALID_URL=\u7121\u52B9\u306AURL: {0}
+IS=\u6B21\u306B\u4E00\u81F4\u3059\u308B
 JAVA_MONITORING___MANAGEMENT_CONSOLE=Java Monitoring && Management Console
 JCONSOLE_COLON_=JConsole: {0}
-JCONSOLE_VERSION=JConsole\u30d0\u30fc\u30b8\u30e7\u30f3"{0}"
+JCONSOLE_VERSION=JConsole\u30D0\u30FC\u30B8\u30E7\u30F3"{0}"
 JCONSOLE_ACCESSIBLE_DESCRIPTION=Java Monitoring && Management Console
-JIT_COMPILER=JIT\u30b3\u30f3\u30d1\u30a4\u30e9
-LIBRARY_PATH=\u30e9\u30a4\u30d6\u30e9\u30ea\u30fb\u30d1\u30b9
-LIVE_THREADS=\u5b9f\u884c\u4e2d\u306e\u30b9\u30ec\u30c3\u30c9
-LOADED=\u30ed\u30fc\u30c9\u6e08
-LOCAL_PROCESS_COLON=\u30ed\u30fc\u30ab\u30eb\u30fb\u30d7\u30ed\u30bb\u30b9(&L):
+JIT_COMPILER=JIT\u30B3\u30F3\u30D1\u30A4\u30E9
+LIBRARY_PATH=\u30E9\u30A4\u30D6\u30E9\u30EA\u30FB\u30D1\u30B9
+LIVE_THREADS=\u5B9F\u884C\u4E2D\u306E\u30B9\u30EC\u30C3\u30C9
+LOADED=\u30ED\u30FC\u30C9\u6E08
+LOCAL_PROCESS_COLON=\u30ED\u30FC\u30AB\u30EB\u30FB\u30D7\u30ED\u30BB\u30B9(&L):
 MASTHEAD_FONT=Dialog-PLAIN-25
-MANAGEMENT_NOT_ENABLED=<b>\u6ce8\u610f</b>: \u7ba1\u7406\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306f\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u3067\u306f\u6709\u52b9\u5316\u3055\u308c\u307e\u305b\u3093\u3002
-MANAGEMENT_WILL_BE_ENABLED=<b>\u6ce8\u610f</b>: \u7ba1\u7406\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306f\u3053\u306e\u30d7\u30ed\u30bb\u30b9\u3067\u6709\u52b9\u5316\u3055\u308c\u307e\u3059\u3002
+MANAGEMENT_NOT_ENABLED=<b>\u6CE8\u610F</b>: \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306F\u3053\u306E\u30D7\u30ED\u30BB\u30B9\u3067\u306F\u6709\u52B9\u5316\u3055\u308C\u307E\u305B\u3093\u3002
+MANAGEMENT_WILL_BE_ENABLED=<b>\u6CE8\u610F</b>: \u7BA1\u7406\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u306F\u3053\u306E\u30D7\u30ED\u30BB\u30B9\u3067\u6709\u52B9\u5316\u3055\u308C\u307E\u3059\u3002
 MBEAN_ATTRIBUTE_INFO=MBeanAttributeInfo
 MBEAN_INFO=MBeanInfo
 MBEAN_NOTIFICATION_INFO=MBeanNotificationInfo
 MBEAN_OPERATION_INFO=MBeanOperationInfo
 MBEANS=MBeans
-MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u30af\u30ea\u30a2(&C)
-MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u901a\u77e5\u306e\u30af\u30ea\u30a2
-MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u30b3\u30f3\u30dd\u30b8\u30c3\u30c8\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3{0}/{1}
-MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u30b3\u30f3\u30dd\u30b8\u30c3\u30c8\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3
-MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5(&R)
-MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5c5e\u6027\u306e\u30ea\u30d5\u30ec\u30c3\u30b7\u30e5
-MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d6(&S)
-MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901a\u77e5\u30ea\u30b9\u30cb\u30f3\u30b0\u306e\u958b\u59cb
-MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u30bf\u30d6\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3{0}/{1}
-MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u30bf\u30d6\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3
-MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d6\u89e3\u9664(&U)
-MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901a\u77e5\u30ea\u30b9\u30cb\u30f3\u30b0\u306e\u505c\u6b62
-MANAGE_HOTSPOT_MBEANS_IN_COLON_=Hotspot MBeans\u306e\u7ba1\u7406:
+MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u30AF\u30EA\u30A2(&C)
+MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u306E\u30AF\u30EA\u30A2
+MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1}
+MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u30B3\u30F3\u30DD\u30B8\u30C3\u30C8\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3
+MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5(&R)
+MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5C5E\u6027\u306E\u30EA\u30D5\u30EC\u30C3\u30B7\u30E5
+MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D6(&S)
+MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u30EA\u30B9\u30CB\u30F3\u30B0\u306E\u958B\u59CB
+MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u30BF\u30D6\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3{0}/{1}
+MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u30BF\u30D6\u30FB\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3
+MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D6\u89E3\u9664(&U)
+MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u901A\u77E5\u30EA\u30B9\u30CB\u30F3\u30B0\u306E\u505C\u6B62
+MANAGE_HOTSPOT_MBEANS_IN_COLON_=Hotspot MBeans\u306E\u7BA1\u7406:
 MAX=\u6700\u5927
-MAXIMUM_HEAP_SIZE=\u6700\u5927\u30d2\u30fc\u30d7\u30fb\u30b5\u30a4\u30ba
-MEMORY=\u30e1\u30e2\u30ea\u30fc
-MEMORY_POOL_LABEL=\u30e1\u30e2\u30ea\u30fc\u30fb\u30d7\u30fc\u30eb"{0}"
-MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME=\u30d2\u30fc\u30d7\u7528\u306e\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387\u30c1\u30e3\u30fc\u30c8\u3002
-MEMORY_TAB_INFO_LABEL_FORMAT=<html>\u4f7f\u7528\u6e08: {0}    \u30b3\u30df\u30c3\u30c8\u6e08: {1}    \u6700\u5927: {2}</html>
-MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME=\u975e\u30d2\u30fc\u30d7\u7528\u306e\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387\u30c1\u30e3\u30fc\u30c8\u3002
-MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD={0}\u306e\u3057\u304d\u3044\u5024\u3088\u308a\u4e0a\u3067\u3059\u3002\n
-MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME=\u30e1\u30e2\u30ea\u30fc\u30fb\u30d7\u30fc\u30eb\u4f7f\u7528\u7387\u30c1\u30e3\u30fc\u30c8\u3002
-MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD={0}\u306e\u3057\u304d\u3044\u5024\u3088\u308a\u4e0b\u3067\u3059\u3002\n
-MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME={0}\u306e\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387\u30c1\u30e3\u30fc\u30c8\u3002
-MESSAGE=\u30e1\u30c3\u30bb\u30fc\u30b8
-METHOD_SUCCESSFULLY_INVOKED=\u30e1\u30bd\u30c3\u30c9\u304c\u6b63\u5e38\u306b\u8d77\u52d5\u3055\u308c\u307e\u3057\u305f
-MINIMIZE_ALL=\u3059\u3079\u3066\u6700\u5c0f\u5316(&M)
-MONITOR_LOCKED=\ \ \ - \u30ed\u30c3\u30af\u6e08{0}\n
-NAME=\u540d\u524d
-NAME_AND_BUILD={0} (\u30d3\u30eb\u30c9{1})
-NAME_STATE=\u540d\u524d: {0}\n\u72b6\u614b: {1}\n
-NAME_STATE_LOCK_NAME=\u540d\u524d: {0}\n\u72b6\u614b: {2}\u306e{1}\n
-NAME_STATE_LOCK_NAME_LOCK_OWNER=\u540d\u524d: {0}\n\u72b6\u614b: {2}\u306e{1}\u3001\u6240\u6709\u8005: {3}\n
-NEW_CONNECTION_ELLIPSIS=\u65b0\u898f\u63a5\u7d9a(&N)...
-NO_DEADLOCK_DETECTED=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af\u304c\u691c\u51fa\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f
-NON_HEAP_MEMORY_USAGE=\u975e\u30d2\u30fc\u30d7\u30fb\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387
-NON_HEAP=\u975e\u30d2\u30fc\u30d7
-NOTIFICATION=\u901a\u77e5
-NOTIFICATION_BUFFER=\u901a\u77e5\u30d0\u30c3\u30d5\u30a1
-NOTIFICATIONS=\u901a\u77e5
+MAXIMUM_HEAP_SIZE=\u6700\u5927\u30D2\u30FC\u30D7\u30FB\u30B5\u30A4\u30BA
+MEMORY=\u30E1\u30E2\u30EA\u30FC
+MEMORY_POOL_LABEL=\u30E1\u30E2\u30EA\u30FC\u30FB\u30D7\u30FC\u30EB"{0}"
+MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME=\u30D2\u30FC\u30D7\u7528\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002
+MEMORY_TAB_INFO_LABEL_FORMAT=<html>\u4F7F\u7528\u6E08: {0}    \u30B3\u30DF\u30C3\u30C8\u6E08: {1}    \u6700\u5927: {2}</html>
+MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME=\u975E\u30D2\u30FC\u30D7\u7528\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002
+MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD={0}\u306E\u3057\u304D\u3044\u5024\u3088\u308A\u4E0A\u3067\u3059\u3002\n
+MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME=\u30E1\u30E2\u30EA\u30FC\u30FB\u30D7\u30FC\u30EB\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002
+MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD={0}\u306E\u3057\u304D\u3044\u5024\u3088\u308A\u4E0B\u3067\u3059\u3002\n
+MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME={0}\u306E\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387\u30C1\u30E3\u30FC\u30C8\u3002
+MESSAGE=\u30E1\u30C3\u30BB\u30FC\u30B8
+METHOD_SUCCESSFULLY_INVOKED=\u30E1\u30BD\u30C3\u30C9\u304C\u6B63\u5E38\u306B\u8D77\u52D5\u3055\u308C\u307E\u3057\u305F
+MINIMIZE_ALL=\u3059\u3079\u3066\u6700\u5C0F\u5316(&M)
+MONITOR_LOCKED=\   - \u30ED\u30C3\u30AF\u6E08{0}\n
+NAME=\u540D\u524D
+NAME_AND_BUILD={0} (\u30D3\u30EB\u30C9{1})
+NAME_STATE=\u540D\u524D: {0}\n\u72B6\u614B: {1}\n
+NAME_STATE_LOCK_NAME=\u540D\u524D: {0}\n\u72B6\u614B: {2}\u306E{1}\n
+NAME_STATE_LOCK_NAME_LOCK_OWNER=\u540D\u524D: {0}\n\u72B6\u614B: {2}\u306E{1}\u3001\u6240\u6709\u8005: {3}\n
+NEW_CONNECTION_ELLIPSIS=\u65B0\u898F\u63A5\u7D9A(&N)...
+NO_DEADLOCK_DETECTED=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF\u304C\u691C\u51FA\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F
+NON_HEAP_MEMORY_USAGE=\u975E\u30D2\u30FC\u30D7\u30FB\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u7387
+NON_HEAP=\u975E\u30D2\u30FC\u30D7
+NOTIFICATION=\u901A\u77E5
+NOTIFICATION_BUFFER=\u901A\u77E5\u30D0\u30C3\u30D5\u30A1
+NOTIFICATIONS=\u901A\u77E5
 NOTIF_TYPES=NotifTypes
-NUMBER_OF_THREADS=\u30b9\u30ec\u30c3\u30c9\u6570
-NUMBER_OF_LOADED_CLASSES=\u30ed\u30fc\u30c9\u6e08\u30af\u30e9\u30b9\u6570
-NUMBER_OF_PROCESSORS=\u30d7\u30ed\u30bb\u30c3\u30b5\u6570
+NUMBER_OF_THREADS=\u30B9\u30EC\u30C3\u30C9\u6570
+NUMBER_OF_LOADED_CLASSES=\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u6570
+NUMBER_OF_PROCESSORS=\u30D7\u30ED\u30BB\u30C3\u30B5\u6570
 OBJECT_NAME=ObjectName
-OPERATING_SYSTEM=\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30fb\u30b7\u30b9\u30c6\u30e0
-OPERATION=\u64cd\u4f5c
-OPERATION_INVOCATION=\u64cd\u4f5c\u306e\u547c\u51fa\u3057
-OPERATION_RETURN_VALUE=\u64cd\u4f5c\u306e\u623b\u308a\u5024
-OPERATIONS=\u64cd\u4f5c
+OPERATING_SYSTEM=\u30AA\u30DA\u30EC\u30FC\u30C6\u30A3\u30F3\u30B0\u30FB\u30B7\u30B9\u30C6\u30E0
+OPERATION=\u64CD\u4F5C
+OPERATION_INVOCATION=\u64CD\u4F5C\u306E\u547C\u51FA\u3057
+OPERATION_RETURN_VALUE=\u64CD\u4F5C\u306E\u623B\u308A\u5024
+OPERATIONS=\u64CD\u4F5C
 OVERVIEW=\u6982\u8981
-OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME={0}\u306e\u30c1\u30e3\u30fc\u30c8\u3002
-PARAMETER=\u30d1\u30e9\u30e1\u30fc\u30bf
-PASSWORD_ACCESSIBLE_NAME=\u30d1\u30b9\u30ef\u30fc\u30c9
-PASSWORD_COLON_=\u30d1\u30b9\u30ef\u30fc\u30c9(P):
-PEAK=\u30d4\u30fc\u30af
-PERFORM_GC=GC\u306e\u5b9f\u884c(G)
-PERFORM_GC_TOOLTIP=\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30ea\u30af\u30a8\u30b9\u30c8
-PLOTTER_ACCESSIBLE_NAME=\u30c1\u30e3\u30fc\u30c8
+OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME={0}\u306E\u30C1\u30E3\u30FC\u30C8\u3002
+PARAMETER=\u30D1\u30E9\u30E1\u30FC\u30BF
+PASSWORD_ACCESSIBLE_NAME=\u30D1\u30B9\u30EF\u30FC\u30C9
+PASSWORD_COLON_=\u30D1\u30B9\u30EF\u30FC\u30C9(&P):
+PEAK=\u30D4\u30FC\u30AF
+PERFORM_GC=GC\u306E\u5B9F\u884C(&G)
+PERFORM_GC_TOOLTIP=\u30AC\u30D9\u30FC\u30B8\u30FB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u30EA\u30AF\u30A8\u30B9\u30C8
+PLOTTER_ACCESSIBLE_NAME=\u30C1\u30E3\u30FC\u30C8
 PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE={0}={1}\n
-PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u30c7\u30fc\u30bf\u304c\u30d7\u30ed\u30c3\u30c8\u3055\u308c\u307e\u305b\u3093\u3002
-PLOTTER_SAVE_AS_MENU_ITEM=\u540d\u524d\u3092\u4ed8\u3051\u3066\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58(&A)...
-PLOTTER_TIME_RANGE_MENU=\u6642\u9593\u7bc4\u56f2(&T)
-PROBLEM_ADDING_LISTENER=\u30ea\u30b9\u30ca\u30fc\u8ffd\u52a0\u4e2d\u306e\u554f\u984c
-PROBLEM_DISPLAYING_MBEAN=MBean\u8868\u793a\u4e2d\u306e\u554f\u984c
-PROBLEM_INVOKING=\u547c\u51fa\u3057\u4e2d\u306e\u554f\u984c
-PROBLEM_REMOVING_LISTENER=\u30ea\u30b9\u30ca\u30fc\u524a\u9664\u4e2d\u306e\u554f\u984c
-PROBLEM_SETTING_ATTRIBUTE=\u5c5e\u6027\u8a2d\u5b9a\u4e2d\u306e\u554f\u984c
-PROCESS_CPU_TIME=\u30d7\u30ed\u30bb\u30b9CPU\u6642\u9593
-READABLE=\u8aad\u53d6\u308a\u53ef\u80fd
-RECONNECT=\u518d\u63a5\u7d9a
-REMOTE_PROCESS_COLON=\u30ea\u30e2\u30fc\u30c8\u30fb\u30d7\u30ed\u30bb\u30b9(&R):
-REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME=\u30ea\u30e2\u30fc\u30c8\u30fb\u30d7\u30ed\u30bb\u30b9
-RESTORE_ALL=\u3059\u3079\u3066\u5fa9\u5143(&R)
+PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u30C7\u30FC\u30BF\u304C\u30D7\u30ED\u30C3\u30C8\u3055\u308C\u307E\u305B\u3093\u3002
+PLOTTER_SAVE_AS_MENU_ITEM=\u540D\u524D\u3092\u4ED8\u3051\u3066\u30C7\u30FC\u30BF\u3092\u4FDD\u5B58(&A)...
+PLOTTER_TIME_RANGE_MENU=\u6642\u9593\u7BC4\u56F2(&T)
+PROBLEM_ADDING_LISTENER=\u30EA\u30B9\u30CA\u30FC\u8FFD\u52A0\u4E2D\u306E\u554F\u984C
+PROBLEM_DISPLAYING_MBEAN=MBean\u8868\u793A\u4E2D\u306E\u554F\u984C
+PROBLEM_INVOKING=\u547C\u51FA\u3057\u4E2D\u306E\u554F\u984C
+PROBLEM_REMOVING_LISTENER=\u30EA\u30B9\u30CA\u30FC\u524A\u9664\u4E2D\u306E\u554F\u984C
+PROBLEM_SETTING_ATTRIBUTE=\u5C5E\u6027\u8A2D\u5B9A\u4E2D\u306E\u554F\u984C
+PROCESS_CPU_TIME=\u30D7\u30ED\u30BB\u30B9CPU\u6642\u9593
+READABLE=\u8AAD\u53D6\u308A\u53EF\u80FD
+RECONNECT=\u518D\u63A5\u7D9A
+REMOTE_PROCESS_COLON=\u30EA\u30E2\u30FC\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9(&R):
+REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME=\u30EA\u30E2\u30FC\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9
+RESTORE_ALL=\u3059\u3079\u3066\u5FA9\u5143(&R)
 RETURN_TYPE=ReturnType
 SEQ_NUM=SeqNum
-SIZE_BYTES={0,number,integer}\u30d0\u30a4\u30c8
+SIZE_BYTES={0,number,integer}\u30D0\u30A4\u30C8
 SIZE_GB={0} Gb
 SIZE_KB={0} Kb
 SIZE_MB={0} Mb
-SOURCE=\u30bd\u30fc\u30b9
-STACK_TRACE=\n\u30b9\u30bf\u30c3\u30af\u30fb\u30c8\u30ec\u30fc\u30b9: \n
+SOURCE=\u30BD\u30FC\u30B9
+STACK_TRACE=\n\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9: \n
 SUMMARY_TAB_HEADER_DATE_TIME_FORMAT=FULL,FULL
-SUMMARY_TAB_PENDING_FINALIZATION_LABEL=\u30d5\u30a1\u30a4\u30ca\u30e9\u30a4\u30ba\u306e\u30da\u30f3\u30c7\u30a3\u30f3\u30b0
-SUMMARY_TAB_PENDING_FINALIZATION_VALUE={0}\u500b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8
-SUMMARY_TAB_TAB_NAME=VM\u30b5\u30de\u30ea\u30fc
-SUMMARY_TAB_VM_VERSION={0}\u30d0\u30fc\u30b8\u30e7\u30f3{1}
-THREADS=\u30b9\u30ec\u30c3\u30c9
-THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u30b9\u30ec\u30c3\u30c9\u60c5\u5831
-THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u30b9\u30ec\u30c3\u30c9\u6570\u306e\u30c1\u30e3\u30fc\u30c8\u3002
-THRESHOLD=\u3057\u304d\u3044\u5024
-TILE=\u4e26\u3079\u3066\u8868\u793a(&T)
-TIME_RANGE_COLON=\u6642\u9593\u7bc4\u56f2(&T):
+SUMMARY_TAB_PENDING_FINALIZATION_LABEL=\u30D5\u30A1\u30A4\u30CA\u30E9\u30A4\u30BA\u306E\u30DA\u30F3\u30C7\u30A3\u30F3\u30B0
+SUMMARY_TAB_PENDING_FINALIZATION_VALUE={0}\u500B\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8
+SUMMARY_TAB_TAB_NAME=VM\u30B5\u30DE\u30EA\u30FC
+SUMMARY_TAB_VM_VERSION={0}\u30D0\u30FC\u30B8\u30E7\u30F3{1}
+THREADS=\u30B9\u30EC\u30C3\u30C9
+THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u30B9\u30EC\u30C3\u30C9\u60C5\u5831
+THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u30B9\u30EC\u30C3\u30C9\u6570\u306E\u30C1\u30E3\u30FC\u30C8\u3002
+THRESHOLD=\u3057\u304D\u3044\u5024
+TILE=\u4E26\u3079\u3066\u8868\u793A(&T)
+TIME_RANGE_COLON=\u6642\u9593\u7BC4\u56F2(&T):
 TIME=\u6642\u9593
 TIME_STAMP=TimeStamp
-TOTAL_LOADED=\u30ed\u30fc\u30c9\u6e08\u5408\u8a08
-TOTAL_CLASSES_LOADED=\u30ed\u30fc\u30c9\u6e08\u30af\u30e9\u30b9\u5408\u8a08
-TOTAL_CLASSES_UNLOADED=\u30a2\u30f3\u30ed\u30fc\u30c9\u6e08\u30af\u30e9\u30b9\u5408\u8a08
-TOTAL_COMPILE_TIME=\u5408\u8a08\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u9593
-TOTAL_PHYSICAL_MEMORY=\u5408\u8a08\u7269\u7406\u30e1\u30e2\u30ea\u30fc
-TOTAL_THREADS_STARTED=\u958b\u59cb\u6e08\u5408\u8a08\u30b9\u30ec\u30c3\u30c9
-TOTAL_SWAP_SPACE=\u5408\u8a08\u30b9\u30ef\u30c3\u30d7\u30fb\u30b9\u30da\u30fc\u30b9
-TYPE=\u578b
-UNAVAILABLE=\u5229\u7528\u4e0d\u53ef
+TOTAL_LOADED=\u30ED\u30FC\u30C9\u6E08\u5408\u8A08
+TOTAL_CLASSES_LOADED=\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u5408\u8A08
+TOTAL_CLASSES_UNLOADED=\u30A2\u30F3\u30ED\u30FC\u30C9\u6E08\u30AF\u30E9\u30B9\u5408\u8A08
+TOTAL_COMPILE_TIME=\u5408\u8A08\u30B3\u30F3\u30D1\u30A4\u30EB\u6642\u9593
+TOTAL_PHYSICAL_MEMORY=\u5408\u8A08\u7269\u7406\u30E1\u30E2\u30EA\u30FC
+TOTAL_THREADS_STARTED=\u958B\u59CB\u6E08\u5408\u8A08\u30B9\u30EC\u30C3\u30C9
+TOTAL_SWAP_SPACE=\u5408\u8A08\u30B9\u30EF\u30C3\u30D7\u30FB\u30B9\u30DA\u30FC\u30B9
+TYPE=\u30BF\u30A4\u30D7
+UNAVAILABLE=\u5229\u7528\u4E0D\u53EF
 UNKNOWN_CAPITALIZED=UNKNOWN
-UNKNOWN_HOST=\u4e0d\u660e\u306a\u30db\u30b9\u30c8: {0}
-UNREGISTER=\u767b\u9332\u89e3\u9664
-UPTIME=\u7a3c\u50cd\u6642\u9593
-USAGE_THRESHOLD=\u4f7f\u7528\u3057\u304d\u3044\u5024
-REMOTE_TF_USAGE=<b>\u4f7f\u7528\u65b9\u6cd5</b>: &lt;hostname&gt;:&lt;port&gt;\u307e\u305f\u306fservice:jmx:&lt;protocol&gt;:&lt;sap&gt;
-USED=\u4f7f\u7528\u6e08
-USERNAME_COLON_=\u30e6\u30fc\u30b6\u30fc\u540d(&U):
-USERNAME_ACCESSIBLE_NAME=\u30e6\u30fc\u30b6\u30fc\u540d
+UNKNOWN_HOST=\u4E0D\u660E\u306A\u30DB\u30B9\u30C8: {0}
+UNREGISTER=\u767B\u9332\u89E3\u9664
+UPTIME=\u7A3C\u50CD\u6642\u9593
+USAGE_THRESHOLD=\u4F7F\u7528\u3057\u304D\u3044\u5024
+REMOTE_TF_USAGE=<b>\u4F7F\u7528\u65B9\u6CD5</b>: &lt;hostname&gt;:&lt;port&gt;\u307E\u305F\u306Fservice:jmx:&lt;protocol&gt;:&lt;sap&gt;
+USED=\u4F7F\u7528\u6E08
+USERNAME_COLON_=\u30E6\u30FC\u30B6\u30FC\u540D(&U):
+USERNAME_ACCESSIBLE_NAME=\u30E6\u30FC\u30B6\u30FC\u540D
 USER_DATA=UserData
-VIRTUAL_MACHINE=\u4eee\u60f3\u30de\u30b7\u30f3
-VM_ARGUMENTS=VM\u5f15\u6570
-VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=Java\u4eee\u60f3\u30de\u30b7\u30f3\u306e\u30e2\u30cb\u30bf\u30fc\u7528\u306e\u5185\u90e8\u30d5\u30ec\u30fc\u30e0
+VIRTUAL_MACHINE=\u4EEE\u60F3\u30DE\u30B7\u30F3
+VM_ARGUMENTS=VM\u5F15\u6570
+VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=Java\u4EEE\u60F3\u30DE\u30B7\u30F3\u306E\u30E2\u30CB\u30BF\u30FC\u7528\u306E\u5185\u90E8\u30D5\u30EC\u30FC\u30E0
 VALUE=\u5024
-VENDOR=\u30d9\u30f3\u30c0\u30fc
-VERBOSE_OUTPUT=\u8a73\u7d30\u51fa\u529b
-VERBOSE_OUTPUT_TOOLTIP=\u30af\u30e9\u30b9\u8aad\u8fbc\u307f\u30b7\u30b9\u30c6\u30e0\u3067\u8a73\u7d30\u51fa\u529b\u3092\u6709\u52b9\u306b\u3059\u308b
-VIEW=\u8868\u793a
-WINDOW=\u30a6\u30a3\u30f3\u30c9\u30a6(&W)
-WINDOWS=\u30a6\u30a3\u30f3\u30c9\u30a6
-WRITABLE=\u66f8\u8fbc\u307f\u53ef\u80fd
-CONNECTION_FAILED1=\u63a5\u7d9a\u306b\u5931\u6557\u3057\u307e\u3057\u305f: \u518d\u8a66\u884c\u3057\u307e\u3059\u304b\u3002
-CONNECTION_FAILED2={0}\u3078\u306e\u63a5\u7d9a\u304c\u6210\u529f\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br>\u3082\u3046\u4e00\u5ea6\u8a66\u3057\u307e\u3059\u304b\u3002
-CONNECTION_LOST1=\u63a5\u7d9a\u304c\u5931\u308f\u308c\u307e\u3057\u305f: \u518d\u63a5\u7d9a\u3057\u307e\u3059\u304b\u3002
-CONNECTING_TO1={0}\u306b\u63a5\u7d9a\u4e2d
-CONNECTING_TO2={0}\u306b\u73fe\u5728\u63a5\u7d9a\u4e2d\u3067\u3059\u3002<br>\u3053\u308c\u306b\u306f\u6570\u5206\u304b\u304b\u308a\u307e\u3059\u3002
-DEADLOCK_TAB=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af
-DEADLOCK_TAB_N=\u30c7\u30c3\u30c9\u30ed\u30c3\u30af{0}
-EXPAND=\u5c55\u958b
+VENDOR=\u30D9\u30F3\u30C0\u30FC
+VERBOSE_OUTPUT=\u8A73\u7D30\u51FA\u529B
+VERBOSE_OUTPUT_TOOLTIP=\u30AF\u30E9\u30B9\u8AAD\u8FBC\u307F\u30B7\u30B9\u30C6\u30E0\u3067\u8A73\u7D30\u51FA\u529B\u3092\u6709\u52B9\u306B\u3059\u308B
+VIEW=\u8868\u793A
+WINDOW=\u30A6\u30A3\u30F3\u30C9\u30A6(&W)
+WINDOWS=\u30A6\u30A3\u30F3\u30C9\u30A6
+WRITABLE=\u66F8\u8FBC\u307F\u53EF\u80FD
+CONNECTION_FAILED1=\u63A5\u7D9A\u306B\u5931\u6557\u3057\u307E\u3057\u305F: \u518D\u8A66\u884C\u3057\u307E\u3059\u304B\u3002
+CONNECTION_FAILED2={0}\u3078\u306E\u63A5\u7D9A\u304C\u6210\u529F\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002<br>\u3082\u3046\u4E00\u5EA6\u8A66\u3057\u307E\u3059\u304B\u3002
+CONNECTION_LOST1=\u63A5\u7D9A\u304C\u5931\u308F\u308C\u307E\u3057\u305F: \u518D\u63A5\u7D9A\u3057\u307E\u3059\u304B\u3002
+CONNECTING_TO1={0}\u306B\u63A5\u7D9A\u4E2D
+CONNECTING_TO2={0}\u306B\u73FE\u5728\u63A5\u7D9A\u4E2D\u3067\u3059\u3002<br>\u3053\u308C\u306B\u306F\u6570\u5206\u304B\u304B\u308A\u307E\u3059\u3002
+DEADLOCK_TAB=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF
+DEADLOCK_TAB_N=\u30C7\u30C3\u30C9\u30ED\u30C3\u30AF{0}
+EXPAND=\u5C55\u958B
 KBYTES={0} KB
-PLOT=\u30d7\u30ed\u30c3\u30c8
-VISUALIZE=\u8996\u899a\u5316
-ZZ_USAGE_TEXT=\u4f7f\u7528\u65b9\u6cd5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n  -interval   \u66f4\u65b0\u9593\u9694\u3092n\u79d2\u306b\u8a2d\u5b9a\u3059\u308b(\u30c7\u30d5\u30a9\u30eb\u30c8\u306f4\u79d2)\n  -notile     \u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u6700\u521d\u306b\u4e26\u3079\u3066\u8868\u793a\u3057\u306a\u3044(2\u3064\u4ee5\u4e0a\u306e\u63a5\u7d9a\u306b\u3064\u3044\u3066)\n  -pluginpath JConsole\u304c\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u53c2\u7167\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\n  -version    \u30d7\u30ed\u30b0\u30e9\u30e0\u30fb\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5370\u5237\u3059\u308b\n\n  connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)\n  pid         \u30bf\u30fc\u30b2\u30c3\u30c8\u30fb\u30d7\u30ed\u30bb\u30b9\u306e\u30d7\u30ed\u30bb\u30b9ID\n  host        \u30ea\u30e2\u30fc\u30c8\u30fb\u30db\u30b9\u30c8\u540d\u307e\u305f\u306fIP\u30a2\u30c9\u30ec\u30b9\n  port        \u30ea\u30e2\u30fc\u30c8\u63a5\u7d9a\u7528\u306e\u30dd\u30fc\u30c8\u756a\u53f7\n\n  -J          JConsole\u304c\u5b9f\u884c\u4e2d\u306eJava\u4eee\u60f3\u30de\u30b7\u30f3\u3078\u306e\n              \u5165\u529b\u5f15\u6570\u3092\u6307\u5b9a\u3059\u308b
+PLOT=\u30D7\u30ED\u30C3\u30C8
+VISUALIZE=\u8996\u899A\u5316
+ZZ_USAGE_TEXT=\u4F7F\u7528\u65B9\u6CD5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n  -interval   \u66F4\u65B0\u9593\u9694\u3092n\u79D2\u306B\u8A2D\u5B9A\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8\u306F4\u79D2)\n  -notile     \u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u6700\u521D\u306B\u4E26\u3079\u3066\u8868\u793A\u3057\u306A\u3044(2\u3064\u4EE5\u4E0A\u306E\u63A5\u7D9A\u306B\u3064\u3044\u3066)\n  -pluginpath JConsole\u304C\u30D7\u30E9\u30B0\u30A4\u30F3\u3092\u53C2\u7167\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3059\u308B\u30D1\u30B9\u3092\u6307\u5B9A\u3059\u308B\n  -version    \u30D7\u30ED\u30B0\u30E9\u30E0\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5370\u5237\u3059\u308B\n\n  connection = pid || host:port || JMX URL (service:jmx:<protocol>://...)\n  pid         \u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30D7\u30ED\u30BB\u30B9\u306E\u30D7\u30ED\u30BB\u30B9ID\n  host        \u30EA\u30E2\u30FC\u30C8\u30FB\u30DB\u30B9\u30C8\u540D\u307E\u305F\u306FIP\u30A2\u30C9\u30EC\u30B9\n  port        \u30EA\u30E2\u30FC\u30C8\u63A5\u7D9A\u7528\u306E\u30DD\u30FC\u30C8\u756A\u53F7\n\n  -J          JConsole\u304C\u5B9F\u884C\u4E2D\u306EJava\u4EEE\u60F3\u30DE\u30B7\u30F3\u3078\u306E\n              \u5165\u529B\u5F15\u6570\u3092\u6307\u5B9A\u3059\u308B
--- a/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/jconsole/resources/messages_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,273 +1,273 @@
 ONE_DAY=\ 1 \u5929
-ONE_HOUR=\ 1 \u5c0f\u65f6
-ONE_MIN=\ 1 \u5206\u949f
-ONE_MONTH=\ 1 \u4e2a\u6708
-ONE_YEAR=\ 1 \u5e74
-TWO_HOURS=\ 2 \u5c0f\u65f6
-THREE_HOURS=\ 3 \u5c0f\u65f6
-THREE_MONTHS=\ 3 \u4e2a\u6708
-FIVE_MIN=\ 5 \u5206\u949f
-SIX_HOURS=\ 6 \u5c0f\u65f6
-SIX_MONTHS=\ 6 \u4e2a\u6708
+ONE_HOUR=\ 1 \u5C0F\u65F6
+ONE_MIN=\ 1 \u5206\u949F
+ONE_MONTH=\ 1 \u4E2A\u6708
+ONE_YEAR=\ 1 \u5E74
+TWO_HOURS=\ 2 \u5C0F\u65F6
+THREE_HOURS=\ 3 \u5C0F\u65F6
+THREE_MONTHS=\ 3 \u4E2A\u6708
+FIVE_MIN=\ 5 \u5206\u949F
+SIX_HOURS=\ 6 \u5C0F\u65F6
+SIX_MONTHS=\ 6 \u4E2A\u6708
 SEVEN_DAYS=\ 7 \u5929
-TEN_MIN=10 \u5206\u949f
-TWELVE_HOURS=12 \u5c0f\u65f6
-THIRTY_MIN=30 \u5206\u949f
+TEN_MIN=10 \u5206\u949F
+TWELVE_HOURS=12 \u5C0F\u65F6
+THIRTY_MIN=30 \u5206\u949F
 LESS_THAN=<
 A_LOT_LESS_THAN=<<
 GREATER_THAN=>
 ACTION_CAPITALIZED=ACTION
 ACTION_INFO_CAPITALIZED=ACTION_INFO
-ALL=\u5168\u90e8
-ARCHITECTURE=\u4f53\u7cfb\u7ed3\u6784
-ATTRIBUTE=\u5c5e\u6027
-ATTRIBUTE_VALUE=\u5c5e\u6027\u503c
-ATTRIBUTE_VALUES=\u5c5e\u6027\u503c
-ATTRIBUTES=\u5c5e\u6027
-BLANK=\u7a7a\u767d
-BLOCKED_COUNT_WAITED_COUNT=\u603b\u963b\u6b62\u6570: {0}, \u603b\u7b49\u5f85\u6570: {1}\n
-BOOT_CLASS_PATH=\u5f15\u5bfc\u7c7b\u8def\u5f84
-BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP=\u5207\u6362\u4ee5\u663e\u793a\u66f4\u591a\u6216\u66f4\u5c11\u4fe1\u606f
+ALL=\u5168\u90E8
+ARCHITECTURE=\u4F53\u7CFB\u7ED3\u6784
+ATTRIBUTE=\u5C5E\u6027
+ATTRIBUTE_VALUE=\u5C5E\u6027\u503C
+ATTRIBUTE_VALUES=\u5C5E\u6027\u503C
+ATTRIBUTES=\u5C5E\u6027
+BLANK=\u7A7A\u767D
+BLOCKED_COUNT_WAITED_COUNT=\u603B\u963B\u6B62\u6570: {0}, \u603B\u7B49\u5F85\u6570: {1}\n
+BOOT_CLASS_PATH=\u5F15\u5BFC\u7C7B\u8DEF\u5F84
+BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP=\u5207\u6362\u4EE5\u663E\u793A\u66F4\u591A\u6216\u66F4\u5C11\u4FE1\u606F
 CPU_USAGE=CPU \u5360\u7528\u7387
 CPU_USAGE_FORMAT=CPU \u5360\u7528\u7387: {0}%
-CANCEL=\u53d6\u6d88
-CASCADE=\u5c42\u53e0(&C)
-CHART_COLON=\u56fe\u8868(&C):
-CLASS_PATH=\u7c7b\u8def\u5f84
+CANCEL=\u53D6\u6D88
+CASCADE=\u5C42\u53E0(&C)
+CHART_COLON=\u56FE\u8868(&C):
+CLASS_PATH=\u7C7B\u8DEF\u5F84
 CLASS_NAME=ClassName
-CLASS_TAB_INFO_LABEL_FORMAT=<html>\u5df2\u52a0\u8f7d: {0}    \u5df2\u5378\u8f7d: {1}    \u603b\u8ba1: {2}</html>
-CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME=\u5df2\u52a0\u8f7d\u7c7b\u7684\u56fe\u8868\u3002
-CLASSES=\u7c7b
-CLOSE=\u5173\u95ed
-COLUMN_NAME=\u540d\u79f0
+CLASS_TAB_INFO_LABEL_FORMAT=<html>\u5DF2\u52A0\u8F7D: {0}    \u5DF2\u5378\u8F7D: {1}    \u603B\u8BA1: {2}</html>
+CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME=\u5DF2\u52A0\u8F7D\u7C7B\u7684\u56FE\u8868\u3002
+CLASSES=\u7C7B
+CLOSE=\u5173\u95ED
+COLUMN_NAME=\u540D\u79F0
 COLUMN_PID=PID
-COMMITTED_MEMORY=\u63d0\u4ea4\u7684\u5185\u5b58
-COMMITTED_VIRTUAL_MEMORY=\u63d0\u4ea4\u7684\u865a\u62df\u5185\u5b58
-COMMITTED=\u5df2\u63d0\u4ea4
-CONNECT=\u8fde\u63a5(&C)
-CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP=\u8fde\u63a5\u5230 Java \u865a\u62df\u673a
-CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4e8e\u4e0e\u672c\u5730\u6216\u8fdc\u7a0b Java \u865a\u62df\u673a\u5efa\u7acb\u65b0\u8fde\u63a5\u7684\u5bf9\u8bdd\u6846
-CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u62a5\u5934\u56fe
-CONNECT_DIALOG_MASTHEAD_TITLE=\u65b0\u5efa\u8fde\u63a5
-CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME=\u72b6\u6001\u680f
-CONNECT_DIALOG_TITLE=JConsole: \u65b0\u5efa\u8fde\u63a5
-CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_=\u5df2\u8fde\u63a5\u3002\u5355\u51fb\u53ef\u65ad\u5f00\u8fde\u63a5\u3002
-CONNECTION_FAILED=\u8fde\u63a5\u5931\u8d25
-CONNECTION=\u8fde\u63a5(&C)
-CONNECTION_NAME=\u8fde\u63a5\u540d\u79f0
-CONNECTION_NAME__DISCONNECTED_={0} (\u5df2\u65ad\u5f00\u8fde\u63a5)
+COMMITTED_MEMORY=\u63D0\u4EA4\u7684\u5185\u5B58
+COMMITTED_VIRTUAL_MEMORY=\u63D0\u4EA4\u7684\u865A\u62DF\u5185\u5B58
+COMMITTED=\u5DF2\u63D0\u4EA4
+CONNECT=\u8FDE\u63A5(&C)
+CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP=\u8FDE\u63A5\u5230 Java \u865A\u62DF\u673A
+CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4E8E\u4E0E\u672C\u5730\u6216\u8FDC\u7A0B Java \u865A\u62DF\u673A\u5EFA\u7ACB\u65B0\u8FDE\u63A5\u7684\u5BF9\u8BDD\u6846
+CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u62A5\u5934\u56FE
+CONNECT_DIALOG_MASTHEAD_TITLE=\u65B0\u5EFA\u8FDE\u63A5
+CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME=\u72B6\u6001\u680F
+CONNECT_DIALOG_TITLE=JConsole: \u65B0\u5EFA\u8FDE\u63A5
+CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_=\u5DF2\u8FDE\u63A5\u3002\u5355\u51FB\u53EF\u65AD\u5F00\u8FDE\u63A5\u3002
+CONNECTION_FAILED=\u8FDE\u63A5\u5931\u8D25
+CONNECTION=\u8FDE\u63A5(&C)
+CONNECTION_NAME=\u8FDE\u63A5\u540D\u79F0
+CONNECTION_NAME__DISCONNECTED_={0} (\u5DF2\u65AD\u5F00\u8FDE\u63A5)
 CONSTRUCTOR=\u6784\u9020\u5668
-CURRENT_CLASSES_LOADED=\u5df2\u52a0\u88c5\u5f53\u524d\u7c7b
-CURRENT_HEAP_SIZE=\u5f53\u524d\u5806\u5927\u5c0f
-CURRENT_VALUE=\u5f53\u524d\u503c: {0}
-CREATE=\u521b\u5efa
-DAEMON_THREADS=\u5b88\u62a4\u7a0b\u5e8f\u7ebf\u7a0b
-DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_=\u5df2\u65ad\u5f00\u8fde\u63a5\u3002\u5355\u51fb\u53ef\u8fde\u63a5\u3002
-DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE=\u53cc\u51fb\u4ee5\u5c55\u5f00/\u9690\u85cf
-DOUBLE_CLICK_TO_VISUALIZE=\u53cc\u51fb\u4ee5\u4f7f\u5176\u53ef\u89c1
-DESCRIPTION=\u8bf4\u660e
-DESCRIPTOR=\u63cf\u8ff0\u7b26
-DETAILS=\u8be6\u7ec6\u8d44\u6599
-DETECT_DEADLOCK=\u68c0\u6d4b\u6b7b\u9501(&D)
-DETECT_DEADLOCK_TOOLTIP=\u68c0\u6d4b\u5904\u4e8e\u6b7b\u9501\u72b6\u6001\u7684\u7ebf\u7a0b
-DIMENSION_IS_NOT_SUPPORTED_COLON=\u4e0d\u652f\u6301\u7ef4:
-DISCARD_CHART=\u653e\u5f03\u56fe\u8868
-DURATION_DAYS_HOURS_MINUTES={0,choice,1#{0,number,integer} \u5929 |1.0<{0,number,integer} \u5929 }{1,choice,0<{1,number,integer} \u5c0f\u65f6 |1#{1,number,integer} \u5c0f\u65f6 |1<{1,number,integer} \u5c0f\u65f6 }{2,choice,0<{2,number,integer} \u5206\u949f|1#{2,number,integer} \u5206\u949f|1.0<{2,number,integer} \u5206\u949f}
-DURATION_HOURS_MINUTES={0,choice,1#{0,number,integer} \u5c0f\u65f6 |1<{0,number,integer} \u5c0f\u65f6 }{1,choice,0<{1,number,integer} \u5206\u949f|1#{1,number,integer} \u5206\u949f|1.0<{1,number,integer} \u5206\u949f}
-DURATION_MINUTES={0,choice,1#{0,number,integer} \u5206\u949f|1.0<{0,number,integer} \u5206\u949f}
-DURATION_SECONDS={0} \u79d2
-EMPTY_ARRAY=\u7a7a\u6570\u7ec4
-ERROR=\u9519\u8bef
-ERROR_COLON_MBEANS_ALREADY_EXIST=\u9519\u8bef: MBean \u5df2\u5b58\u5728
-ERROR_COLON_MBEANS_DO_NOT_EXIST=\u9519\u8bef: MBean \u4e0d\u5b58\u5728
-EVENT=\u4e8b\u4ef6
-EXIT=\u9000\u51fa(&X)
-FAIL_TO_LOAD_PLUGIN=\u8b66\u544a: \u65e0\u6cd5\u52a0\u8f7d\u63d2\u4ef6: {0}
-FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION=\u53d6\u6d88
-FILE_CHOOSER_FILE_EXISTS_MESSAGE=<html><center>\u6587\u4ef6\u5df2\u5b58\u5728:<br>{0}<br>\u662f\u5426\u8981\u66ff\u6362?
-FILE_CHOOSER_FILE_EXISTS_OK_OPTION=\u66ff\u6362
-FILE_CHOOSER_FILE_EXISTS_TITLE=\u6587\u4ef6\u5df2\u5b58\u5728
-FILE_CHOOSER_SAVED_FILE=<html>\u5df2\u4fdd\u5b58\u5230\u6587\u4ef6:<br>{0}<br>({1} \u5b57\u8282)
-FILE_CHOOSER_SAVE_FAILED_MESSAGE=<html><center>\u672a\u80fd\u4fdd\u5b58\u5230\u6587\u4ef6:<br>{0}<br>{1}
-FILE_CHOOSER_SAVE_FAILED_TITLE=\u4fdd\u5b58\u5931\u8d25
-FREE_PHYSICAL_MEMORY=\u7a7a\u95f2\u7269\u7406\u5185\u5b58
-FREE_SWAP_SPACE=\u7a7a\u95f2\u4ea4\u6362\u7a7a\u95f4
-GARBAGE_COLLECTOR=\u5783\u573e\u6536\u96c6\u5668
-GC_INFO=\u540d\u79f0 = ''{0}'', \u6536\u96c6 = {1,choice,-1#Unavailable|0#{1,number,integer}}, \u603b\u82b1\u8d39\u65f6\u95f4 = {2}
-GC_TIME=GC \u65f6\u95f4
-GC_TIME_DETAILS={1}\u4e0a\u7684{0} ({2}\u6536\u96c6)
-HEAP_MEMORY_USAGE=\u5806\u5185\u5b58\u4f7f\u7528\u91cf
+CURRENT_CLASSES_LOADED=\u5DF2\u52A0\u88C5\u5F53\u524D\u7C7B
+CURRENT_HEAP_SIZE=\u5F53\u524D\u5806\u5927\u5C0F
+CURRENT_VALUE=\u5F53\u524D\u503C: {0}
+CREATE=\u521B\u5EFA
+DAEMON_THREADS=\u5B88\u62A4\u7A0B\u5E8F\u7EBF\u7A0B
+DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_=\u5DF2\u65AD\u5F00\u8FDE\u63A5\u3002\u5355\u51FB\u53EF\u8FDE\u63A5\u3002
+DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE=\u53CC\u51FB\u4EE5\u5C55\u5F00/\u9690\u85CF
+DOUBLE_CLICK_TO_VISUALIZE=\u53CC\u51FB\u4EE5\u4F7F\u5176\u53EF\u89C1
+DESCRIPTION=\u8BF4\u660E
+DESCRIPTOR=\u63CF\u8FF0\u7B26
+DETAILS=\u8BE6\u7EC6\u4FE1\u606F
+DETECT_DEADLOCK=\u68C0\u6D4B\u6B7B\u9501(&D)
+DETECT_DEADLOCK_TOOLTIP=\u68C0\u6D4B\u5904\u4E8E\u6B7B\u9501\u72B6\u6001\u7684\u7EBF\u7A0B
+DIMENSION_IS_NOT_SUPPORTED_COLON=\u4E0D\u652F\u6301\u7EF4:
+DISCARD_CHART=\u653E\u5F03\u56FE\u8868
+DURATION_DAYS_HOURS_MINUTES={0,choice,1#{0,number,integer} \u5929 |1.0<{0,number,integer} \u5929 }{1,choice,0<{1,number,integer} \u5C0F\u65F6 |1#{1,number,integer} \u5C0F\u65F6 |1<{1,number,integer} \u5C0F\u65F6 }{2,choice,0<{2,number,integer} \u5206\u949F|1#{2,number,integer} \u5206\u949F|1.0<{2,number,integer} \u5206\u949F}
+DURATION_HOURS_MINUTES={0,choice,1#{0,number,integer} \u5C0F\u65F6 |1<{0,number,integer} \u5C0F\u65F6 }{1,choice,0<{1,number,integer} \u5206\u949F|1#{1,number,integer} \u5206\u949F|1.0<{1,number,integer} \u5206\u949F}
+DURATION_MINUTES={0,choice,1#{0,number,integer} \u5206\u949F|1.0<{0,number,integer} \u5206\u949F}
+DURATION_SECONDS={0} \u79D2
+EMPTY_ARRAY=\u7A7A\u6570\u7EC4
+ERROR=\u9519\u8BEF
+ERROR_COLON_MBEANS_ALREADY_EXIST=\u9519\u8BEF: MBean \u5DF2\u5B58\u5728
+ERROR_COLON_MBEANS_DO_NOT_EXIST=\u9519\u8BEF: MBean \u4E0D\u5B58\u5728
+EVENT=\u4E8B\u4EF6
+EXIT=\u9000\u51FA(&X)
+FAIL_TO_LOAD_PLUGIN=\u8B66\u544A: \u65E0\u6CD5\u52A0\u8F7D\u63D2\u4EF6: {0}
+FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION=\u53D6\u6D88
+FILE_CHOOSER_FILE_EXISTS_MESSAGE=<html><center>\u6587\u4EF6\u5DF2\u5B58\u5728:<br>{0}<br>\u662F\u5426\u8981\u66FF\u6362?
+FILE_CHOOSER_FILE_EXISTS_OK_OPTION=\u66FF\u6362
+FILE_CHOOSER_FILE_EXISTS_TITLE=\u6587\u4EF6\u5DF2\u5B58\u5728
+FILE_CHOOSER_SAVED_FILE=<html>\u5DF2\u4FDD\u5B58\u5230\u6587\u4EF6:<br>{0}<br>({1} \u5B57\u8282)
+FILE_CHOOSER_SAVE_FAILED_MESSAGE=<html><center>\u672A\u80FD\u4FDD\u5B58\u5230\u6587\u4EF6:<br>{0}<br>{1}
+FILE_CHOOSER_SAVE_FAILED_TITLE=\u4FDD\u5B58\u5931\u8D25
+FREE_PHYSICAL_MEMORY=\u7A7A\u95F2\u7269\u7406\u5185\u5B58
+FREE_SWAP_SPACE=\u7A7A\u95F2\u4EA4\u6362\u7A7A\u95F4
+GARBAGE_COLLECTOR=\u5783\u573E\u6536\u96C6\u5668
+GC_INFO=\u540D\u79F0 = ''{0}'', \u6536\u96C6 = {1,choice,-1#Unavailable|0#{1,number,integer}}, \u603B\u82B1\u8D39\u65F6\u95F4 = {2}
+GC_TIME=GC \u65F6\u95F4
+GC_TIME_DETAILS={1}\u4E0A\u7684{0} ({2}\u6536\u96C6)
+HEAP_MEMORY_USAGE=\u5806\u5185\u5B58\u4F7F\u7528\u91CF
 HEAP=\u5806
-HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION=\u5305\u542b\u6709\u5173 JConsole \u548c JDK \u7248\u672c\u4fe1\u606f\u7684\u5bf9\u8bdd\u6846
-HELP_ABOUT_DIALOG_JCONSOLE_VERSION=JConsole \u7248\u672c:<br>{0}
-HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM \u7248\u672c:<br>{0}
-HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u62a5\u5934\u56fe
-HELP_ABOUT_DIALOG_MASTHEAD_TITLE=\u5173\u4e8e JConsole
-HELP_ABOUT_DIALOG_TITLE=JConsole: \u5173\u4e8e
+HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION=\u5305\u542B\u6709\u5173 JConsole \u548C JDK \u7248\u672C\u4FE1\u606F\u7684\u5BF9\u8BDD\u6846
+HELP_ABOUT_DIALOG_JCONSOLE_VERSION=JConsole \u7248\u672C:<br>{0}
+HELP_ABOUT_DIALOG_JAVA_VERSION=Java VM \u7248\u672C:<br>{0}
+HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME=\u62A5\u5934\u56FE
+HELP_ABOUT_DIALOG_MASTHEAD_TITLE=\u5173\u4E8E JConsole
+HELP_ABOUT_DIALOG_TITLE=JConsole: \u5173\u4E8E
 HELP_ABOUT_DIALOG_USER_GUIDE_LINK=JConsole \u7528\u6237\u6307\u5357(&U):<br>{0}
 HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL=http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html
-HELP_MENU_ABOUT_TITLE=\u5173\u4e8e JConsole(&A)
-HELP_MENU_USER_GUIDE_TITLE=\u8054\u673a\u7528\u6237\u6307\u5357(&U)
-HELP_MENU_TITLE=\u5e2e\u52a9(&H)
+HELP_MENU_ABOUT_TITLE=\u5173\u4E8E JConsole(&A)
+HELP_MENU_USER_GUIDE_TITLE=\u8054\u673A\u7528\u6237\u6307\u5357(&U)
+HELP_MENU_TITLE=\u5E2E\u52A9(&H)
 HOTSPOT_MBEANS_ELLIPSIS=HotSpot MBean(&H)...
-HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4e8e\u7ba1\u7406 HotSpot MBean \u7684\u5bf9\u8bdd\u6846
-IMPACT=\u5f71\u54cd
-INFO=\u4fe1\u606f
-INFO_CAPITALIZED=INFO
-INVALID_PLUGIN_PATH=\u8b66\u544a: \u63d2\u4ef6\u8def\u5f84\u65e0\u6548: {0}
-INVALID_URL=URL \u65e0\u6548: {0}
-IS=\u662f
-JAVA_MONITORING___MANAGEMENT_CONSOLE=Java \u76d1\u89c6\u548c\u7ba1\u7406\u63a7\u5236\u53f0
+HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION=\u7528\u4E8E\u7BA1\u7406 HotSpot MBean \u7684\u5BF9\u8BDD\u6846
+IMPACT=\u5F71\u54CD
+INFO=\u4FE1\u606F
+INFO_CAPITALIZED=\u4FE1\u606F
+INVALID_PLUGIN_PATH=\u8B66\u544A: \u63D2\u4EF6\u8DEF\u5F84\u65E0\u6548: {0}
+INVALID_URL=URL \u65E0\u6548: {0}
+IS=\u662F
+JAVA_MONITORING___MANAGEMENT_CONSOLE=Java \u76D1\u89C6\u548C\u7BA1\u7406\u63A7\u5236\u53F0
 JCONSOLE_COLON_=JConsole: {0}
-JCONSOLE_VERSION=JConsole \u7248\u672c "{0}"
-JCONSOLE_ACCESSIBLE_DESCRIPTION=Java \u76d1\u89c6\u548c\u7ba1\u7406\u63a7\u5236\u53f0
-JIT_COMPILER=JIT \u7f16\u8bd1\u5668
-LIBRARY_PATH=\u5e93\u8def\u5f84
-LIVE_THREADS=\u6d3b\u52a8\u7ebf\u7a0b
-LOADED=\u5df2\u52a0\u8f7d
-LOCAL_PROCESS_COLON=\u672c\u5730\u8fdb\u7a0b(&L):
+JCONSOLE_VERSION=JConsole \u7248\u672C "{0}"
+JCONSOLE_ACCESSIBLE_DESCRIPTION=Java \u76D1\u89C6\u548C\u7BA1\u7406\u63A7\u5236\u53F0
+JIT_COMPILER=JIT \u7F16\u8BD1\u5668
+LIBRARY_PATH=\u5E93\u8DEF\u5F84
+LIVE_THREADS=\u6D3B\u52A8\u7EBF\u7A0B
+LOADED=\u5DF2\u52A0\u8F7D
+LOCAL_PROCESS_COLON=\u672C\u5730\u8FDB\u7A0B(&L):
 MASTHEAD_FONT=Dialog-PLAIN-25
-MANAGEMENT_NOT_ENABLED=<b>\u6ce8</b>: \u672a\u5bf9\u6b64\u8fdb\u7a0b\u542f\u7528\u7ba1\u7406\u4ee3\u7406\u3002
-MANAGEMENT_WILL_BE_ENABLED=<b>\u6ce8</b>: \u5c06\u5bf9\u6b64\u8fdb\u7a0b\u542f\u7528\u7ba1\u7406\u4ee3\u7406\u3002
+MANAGEMENT_NOT_ENABLED=<b>\u6CE8</b>: \u672A\u5BF9\u6B64\u8FDB\u7A0B\u542F\u7528\u7BA1\u7406\u4EE3\u7406\u3002
+MANAGEMENT_WILL_BE_ENABLED=<b>\u6CE8</b>: \u5C06\u5BF9\u6B64\u8FDB\u7A0B\u542F\u7528\u7BA1\u7406\u4EE3\u7406\u3002
 MBEAN_ATTRIBUTE_INFO=MBeanAttributeInfo
 MBEAN_INFO=MBeanInfo
 MBEAN_NOTIFICATION_INFO=MBeanNotificationInfo
 MBEAN_OPERATION_INFO=MBeanOperationInfo
 MBEANS=MBean
-MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u6e05\u9664(&C)
-MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u6e05\u9664\u901a\u77e5
-MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u7ec4\u5408\u5bfc\u822a{0}/{1}
-MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u7ec4\u5408\u5bfc\u822a
-MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u5237\u65b0(&R)
-MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5237\u65b0\u5c5e\u6027
-MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u8ba2\u9605(&S)
-MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u5f00\u59cb\u76d1\u542c\u901a\u77e5
-MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u8868\u683c\u5f0f\u5bfc\u822a{0}/{1}
-MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u8868\u683c\u5f0f\u5bfc\u822a
-MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u53d6\u6d88\u8ba2\u9605(&U)
-MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u505c\u6b62\u76d1\u542c\u901a\u77e5
-MANAGE_HOTSPOT_MBEANS_IN_COLON_=\u7ba1\u7406\u4ee5\u4e0b\u4f4d\u7f6e\u7684 HotSpot MBean:
-MAX=\u6700\u5927\u503c
-MAXIMUM_HEAP_SIZE=\u6700\u5927\u5806\u5927\u5c0f
-MEMORY=\u5185\u5b58
-MEMORY_POOL_LABEL=\u5185\u5b58\u6c60 "{0}"
-MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME=\u5806\u7684\u5185\u5b58\u4f7f\u7528\u91cf\u56fe\u8868\u3002
-MEMORY_TAB_INFO_LABEL_FORMAT=<html>\u5df2\u7528: {0}    \u5df2\u63d0\u4ea4: {1}    \u6700\u5927: {2}</html>
-MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME=\u975e\u5806\u7684\u5185\u5b58\u4f7f\u7528\u91cf\u56fe\u8868\u3002
-MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD=\u5927\u4e8e{0}\u7684\u9608\u503c\u3002\n
-MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME=\u5185\u5b58\u6c60\u4f7f\u7528\u91cf\u56fe\u8868\u3002
-MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD=\u4f4e\u4e8e{0}\u7684\u9608\u503c\u3002\n
-MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME={0}\u7684\u5185\u5b58\u4f7f\u7528\u91cf\u56fe\u8868\u3002
-MESSAGE=\u6d88\u606f
-METHOD_SUCCESSFULLY_INVOKED=\u5df2\u6210\u529f\u8c03\u7528\u65b9\u6cd5
-MINIMIZE_ALL=\u5168\u90e8\u6700\u5c0f\u5316(&M)
-MONITOR_LOCKED=\ \ \ - \u5df2\u9501\u5b9a{0}\n
-NAME=\u540d\u79f0
-NAME_AND_BUILD={0} (\u5de5\u4f5c\u7248\u672c {1})
-NAME_STATE=\u540d\u79f0: {0}\n\u72b6\u6001: {1}\n
-NAME_STATE_LOCK_NAME=\u540d\u79f0: {0}\n\u72b6\u6001: {2}\u4e0a\u7684{1}\n
-NAME_STATE_LOCK_NAME_LOCK_OWNER=\u540d\u79f0: {0}\n\u72b6\u6001: {2}\u4e0a\u7684{1}, \u62e5\u6709\u8005: {3}\n
-NEW_CONNECTION_ELLIPSIS=\u65b0\u5efa\u8fde\u63a5(&N)...
-NO_DEADLOCK_DETECTED=\u672a\u68c0\u6d4b\u5230\u6b7b\u9501
-NON_HEAP_MEMORY_USAGE=\u975e\u5806\u5185\u5b58\u4f7f\u7528\u91cf
-NON_HEAP=\u975e\u5806
-NOTIFICATION=\u901a\u77e5
-NOTIFICATION_BUFFER=\u901a\u77e5\u7f13\u51b2\u533a
-NOTIFICATIONS=\u901a\u77e5
+MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON=\u6E05\u9664(&C)
+MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP=\u6E05\u9664\u901A\u77E5
+MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE=\u7EC4\u5408\u5BFC\u822A{0}/{1}
+MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE=\u7EC4\u5408\u5BFC\u822A
+MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON=\u5237\u65B0(&R)
+MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP=\u5237\u65B0\u5C5E\u6027
+MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON=\u8BA2\u9605(&S)
+MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u5F00\u59CB\u76D1\u542C\u901A\u77E5
+MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE=\u8868\u683C\u5F0F\u5BFC\u822A{0}/{1}
+MBEANS_TAB_TABULAR_NAVIGATION_SINGLE=\u8868\u683C\u5F0F\u5BFC\u822A
+MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON=\u53D6\u6D88\u8BA2\u9605(&U)
+MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP=\u505C\u6B62\u76D1\u542C\u901A\u77E5
+MANAGE_HOTSPOT_MBEANS_IN_COLON_=\u7BA1\u7406\u4EE5\u4E0B\u4F4D\u7F6E\u7684 HotSpot MBean: 
+MAX=\u6700\u5927\u503C
+MAXIMUM_HEAP_SIZE=\u6700\u5927\u5806\u5927\u5C0F
+MEMORY=\u5185\u5B58
+MEMORY_POOL_LABEL=\u5185\u5B58\u6C60 "{0}"
+MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME=\u5806\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002
+MEMORY_TAB_INFO_LABEL_FORMAT=<html>\u5DF2\u7528: {0}    \u5DF2\u63D0\u4EA4: {1}    \u6700\u5927: {2}</html>
+MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME=\u975E\u5806\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002
+MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD=\u5927\u4E8E{0}\u7684\u9608\u503C\u3002\n
+MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME=\u5185\u5B58\u6C60\u4F7F\u7528\u91CF\u56FE\u8868\u3002
+MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD=\u4F4E\u4E8E{0}\u7684\u9608\u503C\u3002\n
+MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME={0}\u7684\u5185\u5B58\u4F7F\u7528\u91CF\u56FE\u8868\u3002
+MESSAGE=\u6D88\u606F
+METHOD_SUCCESSFULLY_INVOKED=\u5DF2\u6210\u529F\u8C03\u7528\u65B9\u6CD5
+MINIMIZE_ALL=\u5168\u90E8\u6700\u5C0F\u5316(&M)
+MONITOR_LOCKED=\   - \u5DF2\u9501\u5B9A {0}\n
+NAME=\u540D\u79F0
+NAME_AND_BUILD={0} (\u5DE5\u4F5C\u7248\u672C {1})
+NAME_STATE=\u540D\u79F0: {0}\n\u72B6\u6001: {1}\n
+NAME_STATE_LOCK_NAME=\u540D\u79F0: {0}\n\u72B6\u6001: {2}\u4E0A\u7684{1}\n
+NAME_STATE_LOCK_NAME_LOCK_OWNER=\u540D\u79F0: {0}\n\u72B6\u6001: {2}\u4E0A\u7684{1}, \u62E5\u6709\u8005: {3}\n
+NEW_CONNECTION_ELLIPSIS=\u65B0\u5EFA\u8FDE\u63A5(&N)...
+NO_DEADLOCK_DETECTED=\u672A\u68C0\u6D4B\u5230\u6B7B\u9501
+NON_HEAP_MEMORY_USAGE=\u975E\u5806\u5185\u5B58\u4F7F\u7528\u91CF
+NON_HEAP=\u975E\u5806
+NOTIFICATION=\u901A\u77E5
+NOTIFICATION_BUFFER=\u901A\u77E5\u7F13\u51B2\u533A
+NOTIFICATIONS=\u901A\u77E5
 NOTIF_TYPES=NotifTypes
-NUMBER_OF_THREADS=\u7ebf\u7a0b\u6570
-NUMBER_OF_LOADED_CLASSES=\u5df2\u52a0\u8f7d\u7c7b\u6570
-NUMBER_OF_PROCESSORS=\u5904\u7406\u7a0b\u5e8f\u6570
+NUMBER_OF_THREADS=\u7EBF\u7A0B\u6570
+NUMBER_OF_LOADED_CLASSES=\u5DF2\u52A0\u8F7D\u7C7B\u6570
+NUMBER_OF_PROCESSORS=\u5904\u7406\u7A0B\u5E8F\u6570
 OBJECT_NAME=ObjectName
-OPERATING_SYSTEM=\u64cd\u4f5c\u7cfb\u7edf
-OPERATION=\u64cd\u4f5c
-OPERATION_INVOCATION=\u64cd\u4f5c\u8c03\u7528
-OPERATION_RETURN_VALUE=\u64cd\u4f5c\u8fd4\u56de\u503c
-OPERATIONS=\u64cd\u4f5c
-OVERVIEW=\u6982\u89c8
-OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME={0}\u7684\u56fe\u8868\u3002
-PARAMETER=\u53c2\u6570
-PASSWORD_ACCESSIBLE_NAME=\u53e3\u4ee4
-PASSWORD_COLON_=\u53e3\u4ee4(&P):
-PEAK=\u5cf0\u503c
-PERFORM_GC=\u6267\u884c &GC
-PERFORM_GC_TOOLTIP=\u8bf7\u6c42\u5783\u573e\u6536\u96c6
-PLOTTER_ACCESSIBLE_NAME=\u56fe\u8868
+OPERATING_SYSTEM=\u64CD\u4F5C\u7CFB\u7EDF
+OPERATION=\u64CD\u4F5C
+OPERATION_INVOCATION=\u64CD\u4F5C\u8C03\u7528
+OPERATION_RETURN_VALUE=\u64CD\u4F5C\u8FD4\u56DE\u503C
+OPERATIONS=\u64CD\u4F5C
+OVERVIEW=\u6982\u89C8
+OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME={0}\u7684\u56FE\u8868\u3002
+PARAMETER=\u53C2\u6570
+PASSWORD_ACCESSIBLE_NAME=\u53E3\u4EE4
+PASSWORD_COLON_=\u53E3\u4EE4(&P):
+PEAK=\u5CF0\u503C
+PERFORM_GC=\u6267\u884C GC(&G)
+PERFORM_GC_TOOLTIP=\u8BF7\u6C42\u5783\u573E\u6536\u96C6
+PLOTTER_ACCESSIBLE_NAME=\u56FE\u8868
 PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE={0}={1}\n
-PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u672a\u7ed8\u5236\u6570\u636e\u3002
-PLOTTER_SAVE_AS_MENU_ITEM=\u5c06\u6570\u636e\u53e6\u5b58\u4e3a(&A)...
-PLOTTER_TIME_RANGE_MENU=\u65f6\u95f4\u8303\u56f4(&T)
-PROBLEM_ADDING_LISTENER=\u6dfb\u52a0\u76d1\u542c\u7a0b\u5e8f\u65f6\u51fa\u73b0\u95ee\u9898
-PROBLEM_DISPLAYING_MBEAN=\u663e\u793a MBean \u65f6\u51fa\u73b0\u95ee\u9898
-PROBLEM_INVOKING=\u8c03\u7528\u65f6\u51fa\u73b0\u95ee\u9898
-PROBLEM_REMOVING_LISTENER=\u5220\u9664\u76d1\u542c\u7a0b\u5e8f\u65f6\u51fa\u73b0\u95ee\u9898
-PROBLEM_SETTING_ATTRIBUTE=\u8bbe\u7f6e\u5c5e\u6027\u65f6\u51fa\u73b0\u95ee\u9898
-PROCESS_CPU_TIME=\u8fdb\u7a0b CPU \u65f6\u95f4
-READABLE=\u53ef\u8bfb
-RECONNECT=\u91cd\u65b0\u8fde\u63a5
-REMOTE_PROCESS_COLON=\u8fdc\u7a0b\u8fdb\u7a0b(&R):
-REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME=\u8fdc\u7a0b\u8fdb\u7a0b
-RESTORE_ALL=\u5168\u90e8\u8fd8\u539f(&R)
+PLOTTER_ACCESSIBLE_NAME_NO_DATA=\u672A\u7ED8\u5236\u6570\u636E\u3002
+PLOTTER_SAVE_AS_MENU_ITEM=\u5C06\u6570\u636E\u53E6\u5B58\u4E3A(&A)...
+PLOTTER_TIME_RANGE_MENU=\u65F6\u95F4\u8303\u56F4(&T)
+PROBLEM_ADDING_LISTENER=\u6DFB\u52A0\u76D1\u542C\u7A0B\u5E8F\u65F6\u51FA\u73B0\u95EE\u9898
+PROBLEM_DISPLAYING_MBEAN=\u663E\u793A MBean \u65F6\u51FA\u73B0\u95EE\u9898
+PROBLEM_INVOKING=\u8C03\u7528\u65F6\u51FA\u73B0\u95EE\u9898
+PROBLEM_REMOVING_LISTENER=\u5220\u9664\u76D1\u542C\u7A0B\u5E8F\u65F6\u51FA\u73B0\u95EE\u9898
+PROBLEM_SETTING_ATTRIBUTE=\u8BBE\u7F6E\u5C5E\u6027\u65F6\u51FA\u73B0\u95EE\u9898
+PROCESS_CPU_TIME=\u8FDB\u7A0B CPU \u65F6\u95F4
+READABLE=\u53EF\u8BFB
+RECONNECT=\u91CD\u65B0\u8FDE\u63A5
+REMOTE_PROCESS_COLON=\u8FDC\u7A0B\u8FDB\u7A0B(&R):
+REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME=\u8FDC\u7A0B\u8FDB\u7A0B
+RESTORE_ALL=\u5168\u90E8\u8FD8\u539F(&R)
 RETURN_TYPE=ReturnType
 SEQ_NUM=SeqNum
-SIZE_BYTES={0,number,integer} \u5b57\u8282
-SIZE_GB={0} GB
-SIZE_KB={0} KB
-SIZE_MB={0} MB
-SOURCE=\u6e90
-STACK_TRACE=\n\u5806\u6808\u8ddf\u8e2a: \n
+SIZE_BYTES={0,number,integer} \u5B57\u8282
+SIZE_GB={0} Gb
+SIZE_KB={0} Kb
+SIZE_MB={0} Mb
+SOURCE=\u6E90
+STACK_TRACE=\n\u5806\u6808\u8DDF\u8E2A: \n
 SUMMARY_TAB_HEADER_DATE_TIME_FORMAT=FULL,FULL
-SUMMARY_TAB_PENDING_FINALIZATION_LABEL=\u6682\u6302\u6700\u7ec8\u5904\u7406
-SUMMARY_TAB_PENDING_FINALIZATION_VALUE={0}\u5bf9\u8c61
+SUMMARY_TAB_PENDING_FINALIZATION_LABEL=\u6682\u6302\u6700\u7EC8\u5904\u7406
+SUMMARY_TAB_PENDING_FINALIZATION_VALUE={0}\u5BF9\u8C61
 SUMMARY_TAB_TAB_NAME=VM \u6982\u8981
-SUMMARY_TAB_VM_VERSION={0}\u7248\u672c {1}
-THREADS=\u7ebf\u7a0b
-THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u7ebf\u7a0b\u4fe1\u606f
-THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u8868\u793a\u7ebf\u7a0b\u6570\u7684\u56fe\u8868\u3002
-THRESHOLD=\u9608\u503c
-TILE=\u5e73\u94fa(&T)
-TIME_RANGE_COLON=\u65f6\u95f4\u8303\u56f4(&T):
-TIME=\u65f6\u95f4
+SUMMARY_TAB_VM_VERSION={0}\u7248\u672C {1}
+THREADS=\u7EBF\u7A0B
+THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME=\u7EBF\u7A0B\u4FE1\u606F
+THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME=\u8868\u793A\u7EBF\u7A0B\u6570\u7684\u56FE\u8868\u3002
+THRESHOLD=\u9608\u503C
+TILE=\u5E73\u94FA(&T)
+TIME_RANGE_COLON=\u65F6\u95F4\u8303\u56F4(&T):
+TIME=\u65F6\u95F4
 TIME_STAMP=TimeStamp
-TOTAL_LOADED=\u52a0\u8f7d\u603b\u6570
-TOTAL_CLASSES_LOADED=\u5df2\u52a0\u8f7d\u7c7b\u603b\u6570
-TOTAL_CLASSES_UNLOADED=\u5df2\u5378\u8f7d\u7c7b\u603b\u6570
-TOTAL_COMPILE_TIME=\u603b\u7f16\u8bd1\u65f6\u95f4
-TOTAL_PHYSICAL_MEMORY=\u603b\u7269\u7406\u5185\u5b58
-TOTAL_THREADS_STARTED=\u542f\u52a8\u7684\u7ebf\u7a0b\u603b\u6570
-TOTAL_SWAP_SPACE=\u603b\u4ea4\u6362\u7a7a\u95f4
-TYPE=\u7c7b\u578b
-UNAVAILABLE=\u4e0d\u53ef\u7528
+TOTAL_LOADED=\u52A0\u8F7D\u603B\u6570
+TOTAL_CLASSES_LOADED=\u5DF2\u52A0\u8F7D\u7C7B\u603B\u6570
+TOTAL_CLASSES_UNLOADED=\u5DF2\u5378\u8F7D\u7C7B\u603B\u6570
+TOTAL_COMPILE_TIME=\u603B\u7F16\u8BD1\u65F6\u95F4
+TOTAL_PHYSICAL_MEMORY=\u603B\u7269\u7406\u5185\u5B58
+TOTAL_THREADS_STARTED=\u542F\u52A8\u7684\u7EBF\u7A0B\u603B\u6570
+TOTAL_SWAP_SPACE=\u603B\u4EA4\u6362\u7A7A\u95F4
+TYPE=\u7C7B\u578B
+UNAVAILABLE=\u4E0D\u53EF\u7528
 UNKNOWN_CAPITALIZED=UNKNOWN
-UNKNOWN_HOST=\u672a\u77e5\u4e3b\u673a: {0}
-UNREGISTER=\u6ce8\u9500
-UPTIME=\u8fd0\u884c\u65f6\u95f4
-USAGE_THRESHOLD=\u7528\u6cd5\u9608\u503c
-REMOTE_TF_USAGE=<b>\u7528\u6cd5</b>: &lt;hostname&gt;:&lt;port&gt; \u6216 service:jmx:&lt;protocol&gt;:&lt;sap&gt;
-USED=\u5df2\u7528
-USERNAME_COLON_=\u7528\u6237\u540d(&U):
-USERNAME_ACCESSIBLE_NAME=\u7528\u6237\u540d
+UNKNOWN_HOST=\u672A\u77E5\u4E3B\u673A: {0}
+UNREGISTER=\u6CE8\u9500
+UPTIME=\u8FD0\u884C\u65F6\u95F4
+USAGE_THRESHOLD=\u7528\u6CD5\u9608\u503C
+REMOTE_TF_USAGE=<b>\u7528\u6CD5</b>: &lt;hostname&gt;:&lt;port&gt; \u6216 service:jmx:&lt;protocol&gt;:&lt;sap&gt;
+USED=\u5DF2\u7528
+USERNAME_COLON_=\u7528\u6237\u540D(&U):
+USERNAME_ACCESSIBLE_NAME=\u7528\u6237\u540D
 USER_DATA=UserData
-VIRTUAL_MACHINE=\u865a\u62df\u673a
-VM_ARGUMENTS=VM \u53c2\u6570
-VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=\u7528\u4e8e\u76d1\u89c6 Java \u865a\u62df\u673a\u7684\u5185\u90e8\u6846\u67b6
-VALUE=\u503c
-VENDOR=\u5382\u5546
-VERBOSE_OUTPUT=\u8be6\u7ec6\u8f93\u51fa
-VERBOSE_OUTPUT_TOOLTIP=\u4e3a\u7c7b\u52a0\u8f7d\u7cfb\u7edf\u542f\u7528\u8be6\u7ec6\u8f93\u51fa
-VIEW=\u89c6\u56fe
-WINDOW=\u7a97\u53e3(&W)
-WINDOWS=Windows
-WRITABLE=\u53ef\u5199
-CONNECTION_FAILED1=\u8fde\u63a5\u5931\u8d25: \u662f\u5426\u91cd\u8bd5?
-CONNECTION_FAILED2=\u672a\u6210\u529f\u8fde\u63a5\u5230{0}\u3002<br>\u662f\u5426\u8981\u91cd\u8bd5?
-CONNECTION_LOST1=\u8fde\u63a5\u4e22\u5931: \u662f\u5426\u91cd\u65b0\u8fde\u63a5?
-CONNECTING_TO1=\u6b63\u5728\u8fde\u63a5\u5230{0}
-CONNECTING_TO2=\u60a8\u5f53\u524d\u6b63\u5728\u8fde\u63a5\u5230{0}\u3002<br>\u8fd9\u5c06\u9700\u8981\u51e0\u5206\u949f\u7684\u65f6\u95f4\u3002
-DEADLOCK_TAB=\u6b7b\u9501
-DEADLOCK_TAB_N=\u6b7b\u9501{0}
-EXPAND=\u5c55\u5f00
+VIRTUAL_MACHINE=\u865A\u62DF\u673A
+VM_ARGUMENTS=VM \u53C2\u6570
+VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION=\u7528\u4E8E\u76D1\u89C6 Java \u865A\u62DF\u673A\u7684\u5185\u90E8\u6846\u67B6
+VALUE=\u503C
+VENDOR=\u4F9B\u5E94\u5546
+VERBOSE_OUTPUT=\u8BE6\u7EC6\u8F93\u51FA
+VERBOSE_OUTPUT_TOOLTIP=\u4E3A\u7C7B\u52A0\u8F7D\u7CFB\u7EDF\u542F\u7528\u8BE6\u7EC6\u8F93\u51FA
+VIEW=\u89C6\u56FE
+WINDOW=\u7A97\u53E3(&W)
+WINDOWS=\u7A97\u53E3
+WRITABLE=\u53EF\u5199\u5165
+CONNECTION_FAILED1=\u8FDE\u63A5\u5931\u8D25: \u662F\u5426\u91CD\u8BD5?
+CONNECTION_FAILED2=\u672A\u6210\u529F\u8FDE\u63A5\u5230{0}\u3002<br>\u662F\u5426\u8981\u91CD\u8BD5?
+CONNECTION_LOST1=\u8FDE\u63A5\u4E22\u5931: \u662F\u5426\u91CD\u65B0\u8FDE\u63A5?
+CONNECTING_TO1=\u6B63\u5728\u8FDE\u63A5\u5230{0}
+CONNECTING_TO2=\u60A8\u5F53\u524D\u6B63\u5728\u8FDE\u63A5\u5230{0}\u3002<br>\u8FD9\u5C06\u9700\u8981\u51E0\u5206\u949F\u7684\u65F6\u95F4\u3002
+DEADLOCK_TAB=\u6B7B\u9501
+DEADLOCK_TAB_N=\u6B7B\u9501{0}
+EXPAND=\u5C55\u5F00
 KBYTES={0} KB
-PLOT=\u7ed8\u56fe
-VISUALIZE=\u53ef\u89c6\u5316
-ZZ_USAGE_TEXT=\u7528\u6cd5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n  -interval   \u5c06\u66f4\u65b0\u95f4\u9694\u8bbe\u7f6e\u4e3a n \u79d2 (\u9ed8\u8ba4\u503c\u4e3a 4 \u79d2)\n  -notile     \u521d\u59cb\u4e0d\u5e73\u94fa\u7a97\u53e3 (\u5bf9\u4e8e\u4e24\u4e2a\u6216\u591a\u4e2a\u8fde\u63a5)\n  -pluginpath \u6307\u5b9a jconsole \u7528\u4e8e\u67e5\u627e\u63d2\u4ef6\u7684\u8def\u5f84\n  -version    \u8f93\u51fa\u7a0b\u5e8f\u7248\u672c\n\n  connection = pid || host:port || JMX URL (service:jmx:<\u534f\u8bae>://...)\n  pid         \u76ee\u6807\u8fdb\u7a0b\u7684\u8fdb\u7a0b ID\n  host        \u8fdc\u7a0b\u4e3b\u673a\u540d\u6216 IP \u5730\u5740\n  port        \u8fdc\u7a0b\u8fde\u63a5\u7684\u7aef\u53e3\u53f7\n\n  -J          \u6307\u5b9a\u8fd0\u884c jconsole \u7684 Java \u865a\u62df\u673a\n              \u7684\u8f93\u5165\u53c2\u6570
+PLOT=\u7ED8\u56FE
+VISUALIZE=\u53EF\u89C6\u5316
+ZZ_USAGE_TEXT=\u7528\u6CD5: {0} [ -interval=n ] [ -notile ] [ -pluginpath <path> ] [ -version ] [ connection ... ]\n\n  -interval   \u5C06\u66F4\u65B0\u95F4\u9694\u8BBE\u7F6E\u4E3A n \u79D2 (\u9ED8\u8BA4\u503C\u4E3A 4 \u79D2)\n  -notile     \u521D\u59CB\u4E0D\u5E73\u94FA\u7A97\u53E3 (\u5BF9\u4E8E\u4E24\u4E2A\u6216\u591A\u4E2A\u8FDE\u63A5)\n  -pluginpath \u6307\u5B9A jconsole \u7528\u4E8E\u67E5\u627E\u63D2\u4EF6\u7684\u8DEF\u5F84\n  -version    \u8F93\u51FA\u7A0B\u5E8F\u7248\u672C\n\n  connection = pid || host:port || JMX URL (service:jmx:<\u534F\u8BAE>://...)\n  pid         \u76EE\u6807\u8FDB\u7A0B\u7684\u8FDB\u7A0B ID\n  host        \u8FDC\u7A0B\u4E3B\u673A\u540D\u6216 IP \u5730\u5740\n  port        \u8FDC\u7A0B\u8FDE\u63A5\u7684\u7AEF\u53E3\u53F7\n\n  -J          \u6307\u5B9A\u8FD0\u884C jconsole \u7684 Java \u865A\u62DF\u673A\n              \u7684\u8F93\u5165\u53C2\u6570
--- a/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_ja.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_ja.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
--- a/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_zh_CN.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii_zh_CN.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad_ja.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad_ja.properties	Wed May 08 10:10:05 2013 +0100
@@ -3,13 +3,6 @@
 
 Title=\u30E1\u30E2\u5E33
 ElementTreeFrameTitle=\u8981\u7D20
-ViewportBackingStore=false
-
-# menubar definition
-#
-# Each of the strings that follow form a key to be 
-# used to the actual menu definition.
-menubar=file edit debug
 
 # file Menu definition
 #
@@ -20,7 +13,7 @@
 # new  ->  Notepad.newAction
 # save ->  Notepad.saveAction
 # exit ->  Notepad.exitAction
-file=new open save - exit
+
 fileLabel=\u30D5\u30A1\u30A4\u30EB
 openLabel=\u958B\u304F
 openImage=resources/open.gif
@@ -36,29 +29,23 @@
 # cut   -> JTextComponent.cutAction
 # copy  -> JTextComponent.copyAction
 # paste -> JTextComponent.pasteAction
-edit=cut copy paste - undo redo
+
 editLabel=\u7DE8\u96C6
 cutLabel=\u5207\u53D6\u308A
-cutAction=cut-to-clipboard
 cutImage=resources/cut.gif
 copyLabel=\u30B3\u30D4\u30FC
-copyAction=copy-to-clipboard
 copyImage=resources/copy.gif
 pasteLabel=\u8CBC\u4ED8\u3051
-pasteAction=paste-from-clipboard
 pasteImage=resources/paste.gif
 undoLabel=\u5143\u306B\u623B\u3059
-undoAction=Undo
-redoLabel=\u518D\u5B9F\u884C
-redoAction=Redo
+redoLabel=\u3084\u308A\u76F4\u3057
 
 #
 # debug Menu definition
 #
-debug=dump showElementTree
+
 debugLabel=\u30C7\u30D0\u30C3\u30B0
 dumpLabel=\u30E2\u30C7\u30EB\u3092System.err\u306B\u30C0\u30F3\u30D7
-dumpAction=dump-model
 showElementTreeLabel=\u8981\u7D20\u306E\u8868\u793A
 
 # toolbar definition
@@ -67,7 +54,7 @@
 # used as the basis of the tool definition.  Actions
 # are of course sharable, and in this case are shared
 # with the menu items.
-toolbar=new open save - cut copy paste
+
 newTooltip=\u30D5\u30A1\u30A4\u30EB\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B
 openTooltip=\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F
 saveTooltip=\u30D5\u30A1\u30A4\u30EB\u306B\u4FDD\u5B58
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad_zh_CN.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad_zh_CN.properties	Wed May 08 10:10:05 2013 +0100
@@ -3,13 +3,6 @@
 
 Title=\u8BB0\u4E8B\u672C
 ElementTreeFrameTitle=\u5143\u7D20
-ViewportBackingStore=false
-
-# menubar definition
-#
-# Each of the strings that follow form a key to be 
-# used to the actual menu definition.
-menubar=file edit debug
 
 # file Menu definition
 #
@@ -20,7 +13,7 @@
 # new  ->  Notepad.newAction
 # save ->  Notepad.saveAction
 # exit ->  Notepad.exitAction
-file=new open save - exit
+
 fileLabel=\u6587\u4EF6
 openLabel=\u6253\u5F00
 openImage=resources/open.gif
@@ -36,29 +29,23 @@
 # cut   -> JTextComponent.cutAction
 # copy  -> JTextComponent.copyAction
 # paste -> JTextComponent.pasteAction
-edit=cut copy paste - undo redo
+
 editLabel=\u7F16\u8F91
 cutLabel=\u526A\u5207
-cutAction=cut-to-clipboard
 cutImage=resources/cut.gif
 copyLabel=\u590D\u5236
-copyAction=copy-to-clipboard
 copyImage=resources/copy.gif
 pasteLabel=\u7C98\u8D34
-pasteAction=paste-from-clipboard
 pasteImage=resources/paste.gif
 undoLabel=\u64A4\u6D88
-undoAction=Undo
 redoLabel=\u91CD\u505A
-redoAction=Redo
 
 #
 # debug Menu definition
 #
-debug=dump showElementTree
+
 debugLabel=\u8C03\u8BD5
 dumpLabel=\u5C06\u6A21\u578B\u8F6C\u50A8\u5230 System.err
-dumpAction=dump-model
 showElementTreeLabel=\u663E\u793A\u5143\u7D20
 
 # toolbar definition
@@ -67,7 +54,7 @@
 # used as the basis of the tool definition.  Actions
 # are of course sharable, and in this case are shared
 # with the menu items.
-toolbar=new open save - cut copy paste
+
 newTooltip=\u521B\u5EFA\u65B0\u6587\u4EF6
 openTooltip=\u6253\u5F00\u6587\u4EF6
 saveTooltip=\u4FDD\u5B58\u6587\u4EF6
--- a/jdk/src/solaris/bin/amd64/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/bin/amd64/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,3 @@
 #
 -server KNOWN
 -client IGNORE
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/solaris/bin/arm/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/bin/arm/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,4 @@
 #
 -client KNOWN
 -server KNOWN
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
 -minimal KNOWN
--- a/jdk/src/solaris/bin/i586/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/bin/i586/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,4 @@
 #
 -client IF_SERVER_CLASS -server
 -server KNOWN
--hotspot ALIASED_TO -client
--classic WARN
--native ERROR
--green ERROR
 -minimal KNOWN
--- a/jdk/src/solaris/bin/ia64/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/bin/ia64/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 #
 # 
 # 
-# Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,4 @@
 # and may not be available in a future release.
 #
 -server KNOWN
--hotspot ERROR
--classic WARN
 -client IGNORE
--native ERROR
--green ERROR
--- a/jdk/src/solaris/bin/ppc/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/bin/ppc/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,4 @@
 #
 -client KNOWN
 -server KNOWN
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
 -minimal KNOWN
--- a/jdk/src/solaris/bin/sparc/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/bin/sparc/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,4 @@
 #
 -client IF_SERVER_CLASS -server
 -server KNOWN
--hotspot ALIASED_TO -client
--classic WARN
--native ERROR
--green ERROR
 -minimal KNOWN
--- a/jdk/src/solaris/bin/sparcv9/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/bin/sparcv9/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -31,8 +31,4 @@
 # and may not be available in a future release.
 #
 -server KNOWN
--hotspot ERROR
--classic WARN
 -client IGNORE
--native ERROR
--green ERROR
--- a/jdk/src/solaris/bin/zero/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/bin/zero/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,3 @@
 #
 -server KNOWN
 -client IGNORE
--hotspot ERROR
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Wed May 08 10:10:05 2013 +0100
@@ -1887,7 +1887,9 @@
         switch (getWindowType())
         {
             case NORMAL:
-                typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_NORMAL;
+                typeAtom = (ownerPeer == null) ?
+                               protocol.XA_NET_WM_WINDOW_TYPE_NORMAL :
+                               protocol.XA_NET_WM_WINDOW_TYPE_DIALOG;
                 break;
             case UTILITY:
                 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY;
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java	Wed May 08 10:10:05 2013 +0100
@@ -84,7 +84,7 @@
                     }
                     continue;
                 }
-                if (option == LinkOption.NOFOLLOW_LINKS && supportsNoFollowLinks()) {
+                if (option == LinkOption.NOFOLLOW_LINKS && O_NOFOLLOW != 0) {
                     flags.noFollowLinks = true;
                     continue;
                 }
@@ -218,7 +218,7 @@
         // follow links by default
         boolean followLinks = true;
         if (!flags.createNew && (flags.noFollowLinks || flags.deleteOnClose)) {
-            if (flags.deleteOnClose && !supportsNoFollowLinks()) {
+            if (flags.deleteOnClose && O_NOFOLLOW == 0) {
                 try {
                     if (UnixFileAttributes.get(path, false).isSymbolicLink())
                         throw new UnixException("DELETE_ON_CLOSE specified and file is a symbolic link");
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java	Wed May 08 10:10:05 2013 +0100
@@ -189,7 +189,7 @@
             // copy time stamps last
             if (flags.copyBasicAttributes) {
                 try {
-                    if (dfd >= 0) {
+                    if (dfd >= 0 && futimesSupported()) {
                         futimes(dfd,
                                 attrs.lastAccessTime().to(TimeUnit.MICROSECONDS),
                                 attrs.lastModifiedTime().to(TimeUnit.MICROSECONDS));
@@ -269,9 +269,15 @@
                 // copy time attributes
                 if (flags.copyBasicAttributes) {
                     try {
-                        futimes(fo,
-                                attrs.lastAccessTime().to(TimeUnit.MICROSECONDS),
-                                attrs.lastModifiedTime().to(TimeUnit.MICROSECONDS));
+                        if (futimesSupported()) {
+                            futimes(fo,
+                                    attrs.lastAccessTime().to(TimeUnit.MICROSECONDS),
+                                    attrs.lastModifiedTime().to(TimeUnit.MICROSECONDS));
+                        } else {
+                            utimes(target,
+                                   attrs.lastAccessTime().to(TimeUnit.MICROSECONDS),
+                                   attrs.lastModifiedTime().to(TimeUnit.MICROSECONDS));
+                        }
                     } catch (UnixException x) {
                         if (flags.failIfUnableToCopyBasic)
                             x.rethrowAsIOException(target);
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java	Wed May 08 10:10:05 2013 +0100
@@ -73,6 +73,8 @@
 
             int fd = file.openForAttributeAccess(followLinks);
             try {
+                // assert followLinks || !UnixFileAttributes.get(fd).isSymbolicLink();
+
                 // if not changing both attributes then need existing attributes
                 if (lastModifiedTime == null || lastAccessTime == null) {
                     try {
@@ -92,9 +94,13 @@
 
                 boolean retry = false;
                 try {
-                    futimes(fd, accessValue, modValue);
+                    if (futimesSupported()) {
+                        futimes(fd, accessValue, modValue);
+                    } else {
+                        utimes(file, accessValue, modValue);
+                    }
                 } catch (UnixException x) {
-                    // if futimes fails with EINVAL and one/both of the times is
+                    // if futimes/utimes fails with EINVAL and one/both of the times is
                     // negative then we adjust the value to the epoch and retry.
                     if (x.errno() == UnixConstants.EINVAL &&
                         (modValue < 0L || accessValue < 0L)) {
@@ -107,7 +113,11 @@
                     if (modValue < 0L) modValue = 0L;
                     if (accessValue < 0L) accessValue= 0L;
                     try {
-                        futimes(fd, accessValue, modValue);
+                        if (futimesSupported()) {
+                            futimes(fd, accessValue, modValue);
+                        } else {
+                            utimes(file, accessValue, modValue);
+                        }
                     } catch (UnixException x) {
                         x.rethrowAsIOException(file);
                     }
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributes.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileAttributes.java	Wed May 08 10:10:05 2013 +0100
@@ -51,6 +51,7 @@
     private long    st_mtime_nsec;
     private long    st_ctime_sec;
     private long    st_ctime_nsec;
+    private long    st_birthtime_sec;
 
     // created lazily
     private volatile UserPrincipal owner;
@@ -139,7 +140,12 @@
 
     @Override
     public FileTime creationTime() {
-        return lastModifiedTime();
+        if (UnixNativeDispatcher.birthtimeSupported()) {
+            return FileTime.from(st_birthtime_sec, TimeUnit.SECONDS);
+        } else {
+            // return last modified when birth time not supported
+            return lastModifiedTime();
+        }
     }
 
     @Override
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java	Wed May 08 10:10:05 2013 +0100
@@ -394,9 +394,9 @@
         if (filter == null)
             throw new NullPointerException();
 
-        // can't return SecureDirectoryStream on kernels that don't support
-        // openat, etc.
-        if (!supportsAtSysCalls() || !supportsNoFollowLinks()) {
+        // can't return SecureDirectoryStream on kernels that don't support openat
+        // or O_NOFOLLOW
+        if (!openatSupported() || O_NOFOLLOW == 0) {
             try {
                 long ptr = opendir(dir);
                 return new UnixDirectoryStream(dir, ptr, filter);
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java	Wed May 08 10:10:05 2013 +0100
@@ -537,30 +537,42 @@
      */
     static native byte[] strerror(int errnum);
 
-    // indicates if openat, unlinkat, etc. is supported
-    private static final boolean hasAtSysCalls;
-    static boolean supportsAtSysCalls() {
-        return hasAtSysCalls;
+    /**
+     * Capabilities
+     */
+    private static final int SUPPORTS_OPENAT        = 1 << 1;    // syscalls
+    private static final int SUPPORTS_FUTIMES       = 1 << 2;
+    private static final int SUPPORTS_BIRTHTIME     = 1 << 16;   // other features
+    private static final int capabilities;
+
+    /**
+     * Supports openat and other *at calls.
+     */
+    static boolean openatSupported() {
+        return (capabilities & SUPPORTS_OPENAT) != 0;
     }
 
-    static boolean supportsNoFollowLinks() {
-        return UnixConstants.O_NOFOLLOW != 0;
+    /**
+     * Supports futimes or futimesat
+     */
+    static boolean futimesSupported() {
+        return (capabilities & SUPPORTS_FUTIMES) != 0;
     }
 
-    // initialize syscalls and fieldIDs
-    private static native int init();
+    /**
+     * Supports file birth (creation) time attribute
+     */
+    static boolean birthtimeSupported() {
+        return (capabilities & SUPPORTS_BIRTHTIME) != 0;
+    }
 
-    // flags returned by init to indicate capabilities
-    private static final int HAS_AT_SYSCALLS = 0x1;
-
+    private static native int init();
     static {
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
             public Void run() {
                 System.loadLibrary("nio");
                 return null;
         }});
-        int flags = init();
-
-        hasAtSysCalls = (flags & HAS_AT_SYSCALLS) > 0;
+        capabilities = init();
     }
 }
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Wed May 08 10:10:05 2013 +0100
@@ -769,7 +769,7 @@
     int openForAttributeAccess(boolean followLinks) throws IOException {
         int flags = O_RDONLY;
         if (!followLinks) {
-            if (!supportsNoFollowLinks())
+            if (O_NOFOLLOW == 0)
                 throw new IOException("NOFOLLOW_LINKS is not supported on this platform");
             flags |= O_NOFOLLOW;
         }
--- a/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	Wed May 08 10:10:05 2013 +0100
@@ -372,7 +372,7 @@
     size_t fds_size;
 
     kres = pid_for_task(mach_task_self(), &my_pid);
-    if (res != KERN_SUCCESS) {
+    if (kres != KERN_SUCCESS) {
         throw_internal_error(env, "pid_for_task failed");
         return -1;
     }
--- a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Wed May 08 10:10:05 2013 +0100
@@ -97,6 +97,10 @@
 static jfieldID attrs_st_ctime_sec;
 static jfieldID attrs_st_ctime_nsec;
 
+#ifdef _DARWIN_FEATURE_64_BIT_INODE
+static jfieldID attrs_st_birthtime_sec;
+#endif
+
 static jfieldID attrs_f_frsize;
 static jfieldID attrs_f_blocks;
 static jfieldID attrs_f_bfree;
@@ -171,7 +175,7 @@
 JNIEXPORT jint JNICALL
 Java_sun_nio_fs_UnixNativeDispatcher_init(JNIEnv* env, jclass this)
 {
-    jint flags = 0;
+    jint capabilities = 0;
     jclass clazz;
 
     clazz = (*env)->FindClass(env, "sun/nio/fs/UnixFileAttributes");
@@ -193,6 +197,10 @@
     attrs_st_ctime_sec = (*env)->GetFieldID(env, clazz, "st_ctime_sec", "J");
     attrs_st_ctime_nsec = (*env)->GetFieldID(env, clazz, "st_ctime_nsec", "J");
 
+#ifdef _DARWIN_FEATURE_64_BIT_INODE
+    attrs_st_birthtime_sec = (*env)->GetFieldID(env, clazz, "st_birthtime_sec", "J");
+#endif
+
     clazz = (*env)->FindClass(env, "sun/nio/fs/UnixFileStoreAttributes");
     if (clazz == NULL) {
         return 0;
@@ -233,14 +241,31 @@
         my_fstatat64_func = (fstatat64_func*)&fstatat64_wrapper;
 #endif
 
+    /* supports futimes or futimesat */
+
+#ifdef _ALLBSD_SOURCE
+    capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_FUTIMES;
+#else
+    if (my_futimesat_func != NULL)
+        capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_FUTIMES;
+#endif
+
+    /* supports openat, etc. */
+
     if (my_openat64_func != NULL &&  my_fstatat64_func != NULL &&
         my_unlinkat_func != NULL && my_renameat_func != NULL &&
         my_futimesat_func != NULL && my_fdopendir_func != NULL)
     {
-        flags |= sun_nio_fs_UnixNativeDispatcher_HAS_AT_SYSCALLS;
+        capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_OPENAT;
     }
 
-    return flags;
+    /* supports file birthtime */
+
+#ifdef _DARWIN_FEATURE_64_BIT_INODE
+    capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_BIRTHTIME;
+#endif
+
+    return capabilities;
 }
 
 JNIEXPORT jbyteArray JNICALL
@@ -405,6 +430,10 @@
     (*env)->SetLongField(env, attrs, attrs_st_mtime_sec, (jlong)buf->st_mtime);
     (*env)->SetLongField(env, attrs, attrs_st_ctime_sec, (jlong)buf->st_ctime);
 
+#ifdef _DARWIN_FEATURE_64_BIT_INODE
+    (*env)->SetLongField(env, attrs, attrs_st_birthtime_sec, (jlong)buf->st_birthtime);
+#endif
+
 #if (_POSIX_C_SOURCE >= 200809L) || defined(__solaris__)
     (*env)->SetLongField(env, attrs, attrs_st_atime_nsec, (jlong)buf->st_atim.tv_nsec);
     (*env)->SetLongField(env, attrs, attrs_st_mtime_nsec, (jlong)buf->st_mtim.tv_nsec);
--- a/jdk/src/windows/bin/amd64/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/bin/amd64/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 #
 # 
 # 
-# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,3 @@
 #
 -server KNOWN
 -client IGNORE
--hotspot ALIASED_TO -server
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/windows/bin/i586/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/bin/i586/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,3 @@
 #
 -client KNOWN
 -server KNOWN
--hotspot ALIASED_TO -client
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/windows/bin/ia64/jvm.cfg	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/bin/ia64/jvm.cfg	Wed May 08 10:10:05 2013 +0100
@@ -1,7 +1,7 @@
 #
 # 
 # 
-# Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,3 @@
 #
 -server KNOWN
 -client IGNORE
--hotspot ALIASED_TO -server
--classic WARN
--native ERROR
--green ERROR
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Wed May 08 10:10:05 2013 +0100
@@ -759,9 +759,7 @@
     WComponentPeer(Component target) {
         this.target = target;
         this.paintArea = new RepaintArea();
-        Container parent = WToolkit.getNativeContainer(target);
-        WComponentPeer parentPeer = (WComponentPeer) WToolkit.targetToPeer(parent);
-        create(parentPeer);
+        create(getNativeParent());
         // fix for 5088782: check if window object is created successfully
         checkCreation();
 
@@ -771,6 +769,17 @@
     }
     abstract void create(WComponentPeer parent);
 
+    /**
+     * Gets the native parent of this peer. We use the term "parent" explicitly,
+     * because we override the method in top-level window peer implementations.
+     *
+     * @return the parent container/owner of this peer.
+     */
+    WComponentPeer getNativeParent() {
+        Container parent = SunToolkit.getNativeContainer((Component) target);
+        return (WComponentPeer) WToolkit.targetToPeer(parent);
+    }
+
     protected void checkCreation()
     {
         if ((hwnd == 0) || (pData == 0))
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Wed May 08 10:10:05 2013 +0100
@@ -215,6 +215,12 @@
         createAwtWindow(parent);
     }
 
+    @Override
+    final WComponentPeer getNativeParent() {
+        final Container owner = ((Window) target).getOwner();
+        return (WComponentPeer) WToolkit.targetToPeer(owner);
+    }
+
     // should be overriden in WDialogPeer
     protected void realShow() {
         super.show();
--- a/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@
 import java.text.spi.NumberFormatProvider;
 import java.util.Calendar;
 import java.util.Collections;
+import java.util.Currency;
 import java.util.HashSet;
 import java.util.Locale;
 import java.util.Map;
@@ -48,6 +49,8 @@
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import java.util.spi.CalendarDataProvider;
 import java.util.spi.CalendarNameProvider;
+import java.util.spi.CurrencyNameProvider;
+import java.util.spi.LocaleNameProvider;
 import sun.util.spi.CalendarProvider;
 
 /**
@@ -72,6 +75,14 @@
     private static final int CD_FIRSTDAYOFWEEK = 0;
     private static final int CD_MINIMALDAYSINFIRSTWEEK = 1;
 
+    // Currency/Locale display name types
+    private static final int DN_CURRENCY_NAME   = 0;
+    private static final int DN_CURRENCY_SYMBOL = 1;
+    private static final int DN_LOCALE_LANGUAGE = 2;
+    private static final int DN_LOCALE_SCRIPT   = 3;
+    private static final int DN_LOCALE_REGION   = 4;
+    private static final int DN_LOCALE_VARIANT  = 5;
+
     // Native Calendar ID to LDML calendar type map
     private static final String[] calIDToLDML = {
         "",
@@ -96,15 +107,25 @@
     private static ConcurrentMap<Locale, SoftReference<DecimalFormatSymbols>> decimalFormatSymbolsCache = new ConcurrentHashMap<>();
 
     private static final Set<Locale> supportedLocaleSet;
+    private static final String nativeDisplayLanguage;
     static {
         Set<Locale> tmpSet = new HashSet<>();
         if (initialize()) {
             // Assuming the default locales do not include any extensions, so
             // no stripping is needed here.
-            Locale l = Locale.forLanguageTag(getDefaultLocale(CAT_FORMAT).replace('_', '-'));
-            tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
-            l = Locale.forLanguageTag(getDefaultLocale(CAT_DISPLAY).replace('_', '-'));
-            tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
+            Control c = Control.getNoFallbackControl(Control.FORMAT_DEFAULT);
+            String displayLocale = getDefaultLocale(CAT_DISPLAY);
+            Locale l = Locale.forLanguageTag(displayLocale.replace('_', '-'));
+            tmpSet.addAll(c.getCandidateLocales("", l));
+            nativeDisplayLanguage = l.getLanguage();
+
+            String formatLocale = getDefaultLocale(CAT_FORMAT);
+            if (!formatLocale.equals(displayLocale)) {
+                l = Locale.forLanguageTag(formatLocale.replace('_', '-'));
+                tmpSet.addAll(c.getCandidateLocales("", l));
+            }
+        } else {
+            nativeDisplayLanguage = "";
         }
         supportedLocaleSet = Collections.unmodifiableSet(tmpSet);
     }
@@ -392,6 +413,96 @@
         };
     }
 
+    public static CurrencyNameProvider getCurrencyNameProvider() {
+        return new CurrencyNameProvider() {
+            @Override
+            public Locale[] getAvailableLocales() {
+                return supportedLocale;
+            }
+
+            @Override
+            public boolean isSupportedLocale(Locale locale) {
+                // Ignore the extensions for now
+                return supportedLocaleSet.contains(locale.stripExtensions()) &&
+                       locale.getLanguage().equals(nativeDisplayLanguage);
+            }
+
+            @Override
+            public String getSymbol(String currencyCode, Locale locale) {
+                // Retrieves the currency symbol by calling
+                // GetLocaleInfoEx(LOCALE_SCURRENCY).
+                // It only works with the "locale"'s currency in its native
+                // language.
+                try {
+                    if (Currency.getInstance(locale).getCurrencyCode()
+                        .equals(currencyCode)) {
+                        return getDisplayString(locale.toLanguageTag(),
+                                DN_CURRENCY_SYMBOL, currencyCode);
+                    }
+                } catch (IllegalArgumentException iae) {}
+                return null;
+            }
+
+            @Override
+            public String getDisplayName(String currencyCode, Locale locale) {
+                // Retrieves the display name by calling
+                // GetLocaleInfoEx(LOCALE_SNATIVECURRNAME).
+                // It only works with the "locale"'s currency in its native
+                // language.
+                try {
+                    if (Currency.getInstance(locale).getCurrencyCode()
+                        .equals(currencyCode)) {
+                        return getDisplayString(locale.toLanguageTag(),
+                                DN_CURRENCY_NAME, currencyCode);
+                    }
+                } catch (IllegalArgumentException iae) {}
+                return null;
+            }
+        };
+    }
+
+    public static LocaleNameProvider getLocaleNameProvider() {
+        return new LocaleNameProvider() {
+            @Override
+            public Locale[] getAvailableLocales() {
+                return supportedLocale;
+            }
+
+            @Override
+            public boolean isSupportedLocale(Locale locale) {
+                return supportedLocaleSet.contains(locale.stripExtensions()) &&
+                       locale.getLanguage().equals(nativeDisplayLanguage);
+            }
+
+            @Override
+            public String getDisplayLanguage(String languageCode, Locale locale) {
+                // Retrieves the display language name by calling
+                // GetLocaleInfoEx(LOCALE_SLOCALIZEDLANGUAGENAME).
+                return getDisplayString(locale.toLanguageTag(),
+                            DN_LOCALE_LANGUAGE, languageCode);
+            }
+
+            @Override
+            public String getDisplayCountry(String countryCode, Locale locale) {
+                // Retrieves the display country name by calling
+                // GetLocaleInfoEx(LOCALE_SLOCALIZEDCOUNTRYNAME).
+                return getDisplayString(locale.toLanguageTag(),
+                            DN_LOCALE_REGION, nativeDisplayLanguage+"-"+countryCode);
+            }
+
+            @Override
+            public String getDisplayScript(String scriptCode, Locale locale) {
+                return null;
+            }
+
+            @Override
+            public String getDisplayVariant(String variantCode, Locale locale) {
+                return null;
+            }
+        };
+    }
+
+
     private static String convertDateTimePattern(String winPattern) {
         String ret = winPattern.replaceAll("dddd", "EEEE");
         ret = ret.replaceAll("ddd", "EEE");
@@ -413,12 +524,21 @@
     }
 
     private static boolean isSupportedCalendarLocale(Locale locale) {
-        Locale base = locale.stripExtensions();
+        Locale base = locale;
+
+        if (base.hasExtensions() || base.getVariant() != "") {
+            // strip off extensions and variant.
+            base = new Locale.Builder()
+                            .setLocale(locale)
+                            .clearExtensions()
+                            .build();
+        }
+
         if (!supportedLocaleSet.contains(base)) {
             return false;
         }
 
-        int calid = getCalendarID(locale.toLanguageTag());
+        int calid = getCalendarID(base.toLanguageTag());
         if (calid <= 0 || calid >= calIDToLDML.length) {
             return false;
         }
@@ -546,4 +666,7 @@
 
     // For CalendarDataProvider
     private static native int getCalendarDataValue(String langTag, int type);
+
+    // For Locale/CurrencyNameProvider
+    private static native String getDisplayString(String langTag, int key, String value);
 }
--- a/jdk/src/windows/native/java/net/NetworkInterface.c	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c	Wed May 08 10:10:05 2013 +0100
@@ -123,32 +123,44 @@
      */
     size = sizeof(MIB_IFTABLE);
     tableP = (MIB_IFTABLE *)malloc(size);
+    if(tableP == NULL)
+        return NULL;
+
     count = GetIfTable(tableP, &size, TRUE);
     if (count == ERROR_INSUFFICIENT_BUFFER || count == ERROR_BUFFER_OVERFLOW) {
-        tableP = (MIB_IFTABLE *)realloc(tableP, size);
+        MIB_IFTABLE* newTableP =  (MIB_IFTABLE *)realloc(tableP, size);
+        if (newTableP == NULL) {
+            free(tableP);
+            return NULL;
+        }
+        tableP = newTableP;
+
         count = GetIfTable(tableP, &size, TRUE);
     }
 
     if (count != NO_ERROR) {
-        if (tableP != NULL)
-            free(tableP);
+        free(tableP);
         return NULL;
     }
 
-    if (tableP != NULL) {
-      ifrowP = tableP->table;
-      for (i=0; i<tableP->dwNumEntries; i++) {
-        /*
-         * Warning the real index is obtained by GetFriendlyIfIndex()
-         */
+    {
+    ifrowP = tableP->table;
+    for (i=0; i<tableP->dwNumEntries; i++) {
+    /*
+     * Warning: the real index is obtained by GetFriendlyIfIndex()
+    */
         ifindex = GetFriendlyIfIndex(ifrowP->dwIndex);
         if (ifindex == index) {
           /*
            * Create a copy of the entry so that we can free the table.
            */
-          ret = (MIB_IFROW *) malloc(sizeof(MIB_IFROW));
-          memcpy(ret, ifrowP, sizeof(MIB_IFROW));
-          break;
+            ret = (MIB_IFROW *) malloc(sizeof(MIB_IFROW));
+            if (ret == NULL) {
+                free(tableP);
+                return NULL;
+            }
+            memcpy(ret, ifrowP, sizeof(MIB_IFROW));
+            break;
         }
 
         /* onto the next interface */
@@ -184,15 +196,25 @@
      */
     size = sizeof(MIB_IFTABLE);
     tableP = (MIB_IFTABLE *)malloc(size);
+    if (tableP == NULL) {
+        JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
+        return -1;
+    }
+
     ret = GetIfTable(tableP, &size, TRUE);
     if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) {
-        tableP = (MIB_IFTABLE *)realloc(tableP, size);
+        MIB_IFTABLE * newTableP = (MIB_IFTABLE *)realloc(tableP, size);
+        if (newTableP == NULL) {
+            free(tableP);
+            JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
+            return -1;
+        }
+        tableP = newTableP;
         ret = GetIfTable(tableP, &size, TRUE);
     }
 
     if (ret != NO_ERROR) {
-        if (tableP != NULL)
-            free(tableP);
+        free(tableP);
 
         JNU_ThrowByName(env, "java/lang/Error",
                 "IP Helper Library GetIfTable function failed");
@@ -370,10 +392,21 @@
      */
     size = sizeof(MIB_IPADDRTABLE);
     tableP = (MIB_IPADDRTABLE *)malloc(size);
+    if (tableP == NULL) {
+        JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
+        return -1;
+    }
 
     ret = GetIpAddrTable(tableP, &size, FALSE);
     if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) {
-        tableP = (MIB_IPADDRTABLE *)realloc(tableP, size);
+        MIB_IPADDRTABLE * newTableP = (MIB_IPADDRTABLE *)realloc(tableP, size);
+        if (newTableP == NULL) {
+            free(tableP);
+            JNU_ThrowOutOfMemoryError(env, "Native heap allocation failure");
+            return -1;
+        }
+        tableP = newTableP;
+
         ret = GetIpAddrTable(tableP, &size, FALSE);
     }
     if (ret != NO_ERROR) {
--- a/jdk/src/windows/native/java/net/NetworkInterface_winXP.c	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/native/java/net/NetworkInterface_winXP.c	Wed May 08 10:10:05 2013 +0100
@@ -74,7 +74,7 @@
 
 /*
  * return an array of IP_ADAPTER_ADDRESSES containing one element
- * for each apdapter on the system. Returned in *adapters.
+ * for each adapter on the system. Returned in *adapters.
  * Buffer is malloc'd and must be freed (unless error returned)
  */
 static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
@@ -82,22 +82,32 @@
     IP_ADAPTER_ADDRESSES *adapterInfo;
     ULONG len;
     adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
-    if (adapterInfo == 0) {
+
+    if (adapterInfo == NULL) {
+        JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
         return -1;
     }
+
     len = bufsize;
     flags = GAA_FLAG_SKIP_DNS_SERVER;
     flags |= GAA_FLAG_SKIP_MULTICAST;
     flags |= GAA_FLAG_INCLUDE_PREFIX;
     ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
+
     if (ret == ERROR_BUFFER_OVERFLOW) {
-        adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
-        if (adapterInfo == 0) {
+        IP_ADAPTER_ADDRESSES * newAdapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
+        if (newAdapterInfo == NULL) {
+            free(adapterInfo);
+            JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
             return -1;
         }
+
+        adapterInfo = newAdapterInfo;
+
         bufsize = len;
         ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     }
+
     if (ret != ERROR_SUCCESS) {
         free (adapterInfo);
         JNU_ThrowByName(env, "java/lang/Error",
@@ -110,7 +120,7 @@
 
 /*
  * return an array of IP_ADAPTER_ADDRESSES containing one element
- * for each apdapter on the system. Returned in *adapters.
+ * for each adapter on the system. Returned in *adapters.
  * Buffer is malloc'd and must be freed (unless error returned)
  */
 IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env,  jint index) {
@@ -118,8 +128,8 @@
     IP_ADAPTER_ADDRESSES *adapterInfo, *ptr, *ret;
     ULONG len;
     adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
-    if (adapterInfo == 0) {
-        JNU_ThrowByName(env, "java/lang/OutOfMemoryError", 0);
+    if (adapterInfo == NULL) {
+        JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
         return NULL;
     }
     len = bufsize;
@@ -128,14 +138,19 @@
     flags |= GAA_FLAG_INCLUDE_PREFIX;
     val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     if (val == ERROR_BUFFER_OVERFLOW) {
-        adapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
-        if (adapterInfo == 0) {
-            JNU_ThrowByName(env, "java/lang/OutOfMemoryError", 0);
+        IP_ADAPTER_ADDRESSES * newAdapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
+        if (newAdapterInfo == NULL) {
+            free(adapterInfo);
+            JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
             return NULL;
         }
+
+        adapterInfo = newAdapterInfo;
+
         bufsize = len;
         val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
     }
+
     if (val != ERROR_SUCCESS) {
         free (adapterInfo);
         JNU_ThrowByName(env, "java/lang/Error",
@@ -148,7 +163,15 @@
       // IPv4 interface
       if (ptr->Ipv6IfIndex == index) {
         ret = (IP_ADAPTER_ADDRESSES *) malloc(sizeof(IP_ADAPTER_ADDRESSES));
+        if (ret == NULL) {
+            free(adapterInfo);
+            JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
+            return NULL;
+        }
+
+        //copy the memory and break out of the while loop.
         memcpy(ret, ptr, sizeof(IP_ADAPTER_ADDRESSES));
+        break;
       }
       ptr=ptr->Next;
     }
@@ -163,12 +186,12 @@
 int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
 {
     DWORD ret;
-    IP_ADAPTER_ADDRESSES *ptr, *adapters=0;
+    IP_ADAPTER_ADDRESSES *ptr, *adapters=NULL;
     ULONG len=ipinflen, count=0;
-    netif *nif=0, *dup_nif, *last=0, *loopif=0, *curr;
+    netif *nif=NULL, *dup_nif, *last=NULL, *loopif=NULL, *curr;
     int tun=0, net=0;
 
-    *netifPP = 0;
+    *netifPP = NULL;
 
    /*
     * Get the IPv4 interfaces. This information is the same
@@ -183,7 +206,7 @@
     }
 
     /* locate the loopback (and the last) interface */
-    for (nif=*netifPP, last=nif; nif!=0; nif=nif->next) {
+    for (nif=*netifPP, last=nif; nif!=NULL; nif=nif->next) {
         if (nif->ifType == MIB_IF_TYPE_LOOPBACK) {
             loopif = nif;
         }
@@ -235,7 +258,7 @@
             int index = ptr->IfIndex;
             if (index != 0) {
                 /* This entry is associated with an IPv4 interface */
-                for (nif=*netifPP; nif!=0; nif=nif->next) {
+                for (nif=*netifPP; nif!=NULL; nif=nif->next) {
                     if (nif->index == index) {
                         /* found the interface entry
                          * set the index to the IPv6 index and add the
@@ -258,7 +281,7 @@
                  * if this is a duplicate (ipv6Index is the same)
                  */
                 dup_nif = 0;
-                for (nif0=*netifPP; nif0!=0; nif0=nif0->next) {
+                for (nif0=*netifPP; nif0!=NULL; nif0=nif0->next) {
                     if (nif0->hasIpv6Address &&
                                 ptr->Ipv6IfIndex == nif0->ipv6Index) {
                         dup_nif = nif0;
@@ -267,46 +290,46 @@
                 }
                 if (dup_nif == 0) {
                     /* new interface */
-                    nif = (netif *) calloc (1, sizeof(netif));
-                    if (nif == 0) {
-                        goto err;
-                    }
-                    if (ptr->IfType == IF_TYPE_TUNNEL) {
-                        sprintf (newname, "tun%d", tun);
-                        tun ++;
-                    } else {
-                        sprintf (newname, "net%d", net);
-                        net ++;
-                    }
-                    nif->name = malloc (strlen(newname)+1);
-                    nif->displayName = malloc (wcslen(ptr->FriendlyName)*2+2);
-                    if (nif->name == 0 || nif->displayName == 0) {
-                        goto err;
-                    }
-                    strcpy (nif->name, newname);
-                    wcscpy ((PWCHAR)nif->displayName, ptr->FriendlyName);
-                    nif->dNameIsUnicode = TRUE;
-                    nif->index = ptr->Ipv6IfIndex;
-                    nif->ipv6Index = ptr->Ipv6IfIndex;
-                    nif->hasIpv6Address = TRUE;
+                        nif = (netif *) calloc (1, sizeof(netif));
+                        if (nif == 0) {
+                            goto err;
+                        }
+                        if (ptr->IfType == IF_TYPE_TUNNEL) {
+                                sprintf (newname, "tun%d", tun);
+                                tun ++;
+                        } else {
+                                sprintf (newname, "net%d", net);
+                                net ++;
+                        }
+                        nif->name = malloc (strlen(newname)+1);
+                        nif->displayName = malloc (wcslen(ptr->FriendlyName)*2+2);
+                        if (nif->name == 0 || nif->displayName == 0) {
+                                goto err;
+                        }
+                        strcpy (nif->name, newname);
+                        wcscpy ((PWCHAR)nif->displayName, ptr->FriendlyName);
+                        nif->dNameIsUnicode = TRUE;
+                        nif->index = ptr->Ipv6IfIndex;
+                        nif->ipv6Index = ptr->Ipv6IfIndex;
+                        nif->hasIpv6Address = TRUE;
 
-                    last->next = nif;
-                    last = nif;
-                    count++;
-                    c = getAddrsFromAdapter(ptr, &nif->addrs);
-                    if (c == -1) {
-                        goto err;
-                    }
-                    nif->naddrs += c;
-                } else {
-                    /* add the addresses from this adapter to the
-                     * original (dup_nif)
-                     */
-                    c = getAddrsFromAdapter(ptr, &dup_nif->addrs);
-                    if (c == -1) {
-                        goto err;
-                    }
-                    dup_nif->naddrs += c;
+                        last->next = nif;
+                        last = nif;
+                        count++;
+                        c = getAddrsFromAdapter(ptr, &nif->addrs);
+                        if (c == -1) {
+                                goto err;
+                        }
+                        nif->naddrs += c;
+                 } else {
+                        /* add the addresses from this adapter to the
+                         * original (dup_nif)
+                         */
+                        c = getAddrsFromAdapter(ptr, &dup_nif->addrs);
+                        if (c == -1) {
+                                goto err;
+                        }
+                        dup_nif->naddrs += c;
                 }
             }
         }
@@ -335,45 +358,47 @@
  */
 
 static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP) {
-    LPSOCKADDR                   sock;
-    int                          count = 0;
-    netaddr                     *curr, *start=0, *prev=0;
-    PIP_ADAPTER_UNICAST_ADDRESS uni_addr;
-    PIP_ADAPTER_ANYCAST_ADDRESS any_addr;
-    PIP_ADAPTER_PREFIX prefix;
+        LPSOCKADDR sock;
+        int        count = 0;
+        netaddr    *curr, *start = NULL, *prev = NULL;
+        PIP_ADAPTER_UNICAST_ADDRESS uni_addr;
+        PIP_ADAPTER_ANYCAST_ADDRESS any_addr;
+        PIP_ADAPTER_PREFIX prefix;
 
-    /* If chain passed in, find end */
-    if (*netaddrPP != NULL) {
-        for (start=*netaddrPP; start->next!=NULL; start=start->next) {
+        /* If chain passed in, find end */
+        if (*netaddrPP != NULL) {
+            for (start=*netaddrPP; start->next!=NULL; start=start->next)
+                ;
+
+            prev=start;
         }
-        prev=start;
-    }
 
-    prefix = ptr->FirstPrefix;
-    /* Unicast */
-    uni_addr = ptr->FirstUnicastAddress;
-    while (uni_addr != NULL) {
+        prefix = ptr->FirstPrefix;
+        /* Unicast */
+        uni_addr = ptr->FirstUnicastAddress;
+        while (uni_addr != NULL) {
         /* address is only usable if dad state is preferred or deprecated */
-        if (uni_addr->DadState == IpDadStateDeprecated ||
-                uni_addr->DadState == IpDadStatePreferred) {
-            sock = uni_addr->Address.lpSockaddr;
+                if (uni_addr->DadState == IpDadStateDeprecated ||
+                                uni_addr->DadState == IpDadStatePreferred) {
+                        sock = uni_addr->Address.lpSockaddr;
 
-            // IPv4 addresses already retrieved with enumAddresses_win
-            if (sock->sa_family == AF_INET) {
-                uni_addr = uni_addr->Next;
-                continue;
-            }
+                        // IPv4 addresses already retrieved with enumAddresses_win
+                        if (sock->sa_family == AF_INET) {
+                                uni_addr = uni_addr->Next;
+                                continue;
+                        }
 
             curr = (netaddr *)calloc (1, sizeof (netaddr));
-            if (curr == 0) {
-                return -1;
-            }
-            if (start == NULL) {
+
+            if (curr == NULL)
+                goto freeAllocatedMemory;
+
+            if (start == NULL)
                 start = curr;
-            }
-            if (prev != NULL) {
-                prev->next = curr;
-            }
+
+            if (prev != NULL)
+               prev->next = curr;
+
             prev = curr;
             SOCKETADDRESS_COPY (&curr->addr, sock);
             if (prefix != NULL) {
@@ -388,15 +413,16 @@
     any_addr = ptr->FirstAnycastAddress;
     while (any_addr != NULL) {
         curr = (netaddr *)calloc (1, sizeof (netaddr));
-        if (curr == 0) {
-            return -1;
-        }
-        if (start == NULL) {
+
+        if (curr == NULL)
+            goto freeAllocatedMemory;
+
+        if (start == NULL)
             start = curr;
-        }
-        if (prev != NULL) {
+
+        if (prev != NULL)
             prev->next = curr;
-        }
+
         prev = curr;
         sock = any_addr->Address.lpSockaddr;
         SOCKETADDRESS_COPY (&curr->addr, sock);
@@ -407,6 +433,25 @@
         *netaddrPP = start;
     }
     return count;
+
+freeAllocatedMemory:
+
+    if (*netaddrPP != NULL) {
+        //N.B. the variable "start" cannot be NULL at this point because we started with an
+        //existing list.
+        curr=start->next;
+        start->next = NULL;
+        start = curr;
+    }
+    // otherwise, "start" points to the beginning of an incomplete list that we must deallocate.
+
+    while (start != NULL) {
+        curr = start->next;
+        free(start);
+        start = curr;
+    }
+
+    return -1;
 }
 
 /*
@@ -773,10 +818,12 @@
       ptr = getAdapter(env, index);
       if (ptr != NULL) {
         len = ptr->PhysicalAddressLength;
-        ret = (*env)->NewByteArray(env, len);
-        if (!IS_NULL(ret)) {
-          (*env)->SetByteArrayRegion(env, ret, 0, len,
-                                     (jbyte*) ptr->PhysicalAddress);
+        if (len > 0) {
+          ret = (*env)->NewByteArray(env, len);
+          if (!IS_NULL(ret)) {
+            (*env)->SetByteArrayRegion(env, ret, 0, len,
+                                       (jbyte*) ptr->PhysicalAddress);
+          }
         }
         free(ptr);
       }
--- a/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c	Wed May 08 10:10:05 2013 +0100
@@ -122,9 +122,18 @@
      */
     size = sizeof(IP_ADAPTER_INFO);
     adapterP = (IP_ADAPTER_INFO *)malloc(size);
+    if (adapterP == NULL) {
+        return -1;
+    }
     ret = GetAdaptersInfo(adapterP, &size);
     if (ret == ERROR_BUFFER_OVERFLOW) {
-        adapterP = (IP_ADAPTER_INFO *)realloc(adapterP, size);
+        IP_ADAPTER_INFO *newAdapterP = (IP_ADAPTER_INFO *)realloc(adapterP, size);
+        if (newAdapterP == NULL) {
+            free(adapterP);
+            return -1;
+        }
+        adapterP = newAdapterP;
+
         ret = GetAdaptersInfo(adapterP, &size);
     }
 
--- a/jdk/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/src/windows/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -196,7 +196,7 @@
             break;
     }
 
-    localeString = getJavaIDFromLangID(langid);
+    localeString = (char *)getJavaIDFromLangID(langid);
     ret = (*env)->NewStringUTF(env, localeString);
     free(localeString);
     return ret;
@@ -366,12 +366,14 @@
  */
 JNIEXPORT jboolean JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_isNativeDigit
   (JNIEnv *env, jclass cls, jstring jlangtag) {
-    WCHAR buf[BUFLEN];
+    DWORD num;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
-    int got = getLocaleInfoWrapper(langtag, LOCALE_IDIGITSUBSTITUTION, buf, BUFLEN);
+    int got = getLocaleInfoWrapper(langtag,
+        LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER,
+        (LPWSTR)&num, sizeof(num));
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
-    return got && buf[0] == L'2'; // 2: native digit substitution
+    return got && num == 2; // 2: native digit substitution
 }
 
 /*
@@ -590,25 +592,72 @@
  */
 JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getCalendarDataValue
   (JNIEnv *env, jclass cls, jstring jlangtag, jint type) {
-    WCHAR buf[BUFLEN];
+    DWORD num;
     const jchar *langtag = (*env)->GetStringChars(env, jlangtag, JNI_FALSE);
     int got = 0;
 
     switch (type) {
     case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CD_FIRSTDAYOFWEEK:
-        got = getLocaleInfoWrapper(langtag, LOCALE_IFIRSTDAYOFWEEK, buf, BUFLEN);
+        got = getLocaleInfoWrapper(langtag,
+            LOCALE_IFIRSTDAYOFWEEK | LOCALE_RETURN_NUMBER,
+            (LPWSTR)&num, sizeof(num));
         break;
     }
 
     (*env)->ReleaseStringChars(env, jlangtag, langtag);
 
     if (got) {
-        return _wtoi(buf);
+        return num;
     } else {
         return -1;
     }
 }
 
+/*
+ * Class:     sun_util_locale_provider_HostLocaleProviderAdapterImpl
+ * Method:    getDisplayString
+ * Signature: (Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterImpl_getDisplayString
+  (JNIEnv *env, jclass cls, jstring jlangtag, jint type, jstring jvalue) {
+    LCTYPE lcType;
+    jstring jStr;
+    const jchar * pjChar;
+    WCHAR buf[BUFLEN];
+    int got = 0;
+
+    switch (type) {
+        case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_CURRENCY_NAME:
+            lcType = LOCALE_SNATIVECURRNAME;
+            jStr = jlangtag;
+            break;
+        case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_CURRENCY_SYMBOL:
+            lcType = LOCALE_SCURRENCY;
+            jStr = jlangtag;
+            break;
+        case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_LANGUAGE:
+            lcType = LOCALE_SLOCALIZEDLANGUAGENAME;
+            jStr = jvalue;
+            break;
+        case sun_util_locale_provider_HostLocaleProviderAdapterImpl_DN_LOCALE_REGION:
+            lcType = LOCALE_SLOCALIZEDCOUNTRYNAME;
+            jStr = jvalue;
+            break;
+        default:
+            return NULL;
+    }
+
+    pjChar = (*env)->GetStringChars(env, jStr, JNI_FALSE);
+    got = getLocaleInfoWrapper(pjChar, lcType, buf, BUFLEN);
+    (*env)->ReleaseStringChars(env, jStr, pjChar);
+
+    if (got) {
+        return (*env)->NewString(env, buf, wcslen(buf));
+    } else {
+        return NULL;
+    }
+}
+
 int getLocaleInfoWrapper(const jchar *langtag, LCTYPE type, LPWSTR data, int buflen) {
     if (pGetLocaleInfoEx) {
         if (wcscmp(L"und", (LPWSTR)langtag) == 0) {
@@ -642,11 +691,13 @@
 }
 
 jint getCalendarID(const jchar *langtag) {
-    WCHAR type[BUFLEN];
-    int got = getLocaleInfoWrapper(langtag, LOCALE_ICALENDARTYPE, type, BUFLEN);
+    DWORD type;
+    int got = getLocaleInfoWrapper(langtag,
+        LOCALE_ICALENDARTYPE | LOCALE_RETURN_NUMBER,
+        (LPWSTR)&type, sizeof(type));
 
     if (got) {
-        return _wtoi(type);
+        return type;
     } else {
         return 0;
     }
@@ -691,28 +742,37 @@
 }
 
 void getNumberPart(const jchar * langtag, const jint numberStyle, WCHAR * number) {
-    WCHAR buf[BUFLEN];
+    DWORD digits = 0;
+    DWORD leadingZero = 0;
     WCHAR grouping[BUFLEN];
+    int groupingLen;
     WCHAR fractionPattern[BUFLEN];
     WCHAR * integerPattern = number;
-    int digits;
-    BOOL leadingZero;
     WCHAR * pDest;
-    int groupingLen;
 
     // Get info from Windows
-    if (numberStyle == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY) {
-        getLocaleInfoWrapper(langtag, LOCALE_ICURRDIGITS, buf, BUFLEN);
-    } else {
-        getLocaleInfoWrapper(langtag, LOCALE_IDIGITS, buf, BUFLEN);
+    switch (numberStyle) {
+        case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY:
+            getLocaleInfoWrapper(langtag,
+                LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER,
+                (LPWSTR)&digits, sizeof(digits));
+            break;
+
+        case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER:
+            break;
+
+        case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_NUMBER:
+        case sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT:
+        default:
+            getLocaleInfoWrapper(langtag,
+                LOCALE_IDIGITS | LOCALE_RETURN_NUMBER,
+                (LPWSTR)&digits, sizeof(digits));
+            break;
     }
-    if (numberStyle == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER) {
-        digits = 0;
-    } else {
-        digits = _wtoi(buf);
-    }
-    getLocaleInfoWrapper(langtag, LOCALE_ILZERO, buf, BUFLEN);
-    leadingZero = _wtoi(buf) != 0;
+
+    getLocaleInfoWrapper(langtag,
+        LOCALE_ILZERO | LOCALE_RETURN_NUMBER,
+        (LPWSTR)&leadingZero, sizeof(leadingZero));
     groupingLen = getLocaleInfoWrapper(langtag, LOCALE_SGROUPING, grouping, BUFLEN);
 
     // fraction pattern
@@ -749,7 +809,7 @@
         }
     }
 
-    if (leadingZero) {
+    if (leadingZero != 0) {
         *pDest++ = L'0';
     } else {
         *pDest++ = L'#';
@@ -760,29 +820,35 @@
 }
 
 void getFixPart(const jchar * langtag, const jint numberStyle, BOOL positive, BOOL prefix, WCHAR * ret) {
-    WCHAR buf[BUFLEN];
-    int pattern = 0;
+    DWORD pattern = 0;
     int style = numberStyle;
     int got = 0;
 
     if (positive) {
         if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY) {
-            got = getLocaleInfoWrapper(langtag, LOCALE_ICURRENCY, buf, BUFLEN);
+            got = getLocaleInfoWrapper(langtag,
+                LOCALE_ICURRENCY | LOCALE_RETURN_NUMBER,
+                (LPWSTR)&pattern, sizeof(pattern));
         } else if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT) {
-            got = getLocaleInfoWrapper(langtag, LOCALE_IPOSITIVEPERCENT, buf, BUFLEN);
+            got = getLocaleInfoWrapper(langtag,
+                LOCALE_IPOSITIVEPERCENT | LOCALE_RETURN_NUMBER,
+                (LPWSTR)&pattern, sizeof(pattern));
         }
     } else {
         if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_CURRENCY) {
-            got = getLocaleInfoWrapper(langtag, LOCALE_INEGCURR, buf, BUFLEN);
+            got = getLocaleInfoWrapper(langtag,
+                LOCALE_INEGCURR | LOCALE_RETURN_NUMBER,
+                (LPWSTR)&pattern, sizeof(pattern));
         } else if (style == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_PERCENT) {
-            got = getLocaleInfoWrapper(langtag, LOCALE_INEGATIVEPERCENT, buf, BUFLEN);
+            got = getLocaleInfoWrapper(langtag,
+                LOCALE_INEGATIVEPERCENT | LOCALE_RETURN_NUMBER,
+                (LPWSTR)&pattern, sizeof(pattern));
         } else {
-            got = getLocaleInfoWrapper(langtag, LOCALE_INEGNUMBER, buf, BUFLEN);
+            got = getLocaleInfoWrapper(langtag,
+                LOCALE_INEGNUMBER | LOCALE_RETURN_NUMBER,
+                (LPWSTR)&pattern, sizeof(pattern));
         }
     }
-    if (got) {
-        pattern = _wtoi(buf);
-    }
 
     if (numberStyle == sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_INTEGER) {
         style = sun_util_locale_provider_HostLocaleProviderAdapterImpl_NF_NUMBER;
--- a/jdk/test/Makefile	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/Makefile	Wed May 08 10:10:05 2013 +0100
@@ -502,7 +502,7 @@
 # Stable agentvm testruns (TestNG)
 JDK_DEFAULT_TARGETS += jdk_time
 jdk_time: $(call TestDirs, java/time)
-	$(call RunOthervmBatch)
+	$(call RunAgentvmBatch)
 
 # Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_other
--- a/jdk/test/ProblemList.txt	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/ProblemList.txt	Wed May 08 10:10:05 2013 +0100
@@ -122,6 +122,9 @@
 
 # jdk_lang
 
+# 8009615
+java/lang/instrument/IsModifiableClassAgent.java                generic-all
+
 # 6944188
 java/lang/management/ThreadMXBean/ThreadStateTest.java          generic-all
 
@@ -144,6 +147,9 @@
 
 # jdk_management
 
+# 8010897
+sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java	macosx-all 
+
 ############################################################################
 
 # jdk_jmx
--- a/jdk/test/java/awt/Focus/OverrideRedirectWindowActivationTest/OverrideRedirectWindowActivationTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2012, 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       6385277
- * @summary   Tests that override redirect window gets activated on click.
- * @author    anton.tarasov@sun.com: area=awt.focus
- * @library   ../../regtesthelpers
- * @build     Util
- * @run       main OverrideRedirectWindowActivationTest
- */
-import java.awt.*;
-import java.awt.event.*;
-import java.util.concurrent.Callable;
-import javax.swing.SwingUtilities;
-import sun.awt.SunToolkit;
-import test.java.awt.regtesthelpers.Util;
-
-public class OverrideRedirectWindowActivationTest {
-
-    private static Frame frame;
-    private static Window window;
-    private static Button fbutton;
-    private static Button wbutton;
-    private static Label label;
-    private static Robot robot;
-    private static SunToolkit toolkit;
-
-    public static void main(String[] args) throws Exception {
-
-        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
-            System.out.println("No testing on Motif. Test passed.");
-            return;
-        }
-
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        robot = new Robot();
-        robot.setAutoDelay(50);
-
-        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
-
-            public void eventDispatched(AWTEvent e) {
-                System.out.println(e);
-            }
-        }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK);
-
-        createAndShowWindow();
-        toolkit.realSync();
-
-        createAndShowFrame();
-        toolkit.realSync();
-
-        // click on Frame
-        clickOn(getClickPoint(frame));
-
-        if (!frame.isFocused()) {
-            throw new RuntimeException("Error: a frame couldn't be focused by click.");
-        }
-
-        //click on Label in Window
-        clickOn(getClickPoint(label));
-
-        if (!window.isFocused()) {
-            throw new RuntimeException("Test failed: the window couldn't be activated by click!");
-        }
-
-        // bring focus back to the frame
-        clickOn(getClickPoint(fbutton));
-
-        if (!frame.isFocused()) {
-            throw new RuntimeException("Error: a frame couldn't be focused by click.");
-        }
-
-        // Test 2. Verifies that clicking on a component of unfocusable Window
-        //         won't activate it.
-
-        window.setFocusableWindowState(false);
-        toolkit.realSync();
-
-
-        clickOn(getClickPoint(label));
-
-        if (window.isFocused()) {
-            throw new RuntimeException("Test failed: unfocusable window got activated by click!");
-        }
-        System.out.println("Test passed.");
-
-    }
-
-    private static void createAndShowWindow() {
-
-        frame = new Frame("Test Frame");
-        window = new Window(frame);
-        wbutton = new Button("wbutton");
-        label = new Label("label");
-
-        window.setBounds(800, 200, 200, 100);
-        window.setLayout(new FlowLayout());
-        window.add(wbutton);
-        window.add(label);
-        window.setVisible(true);
-
-    }
-
-    private static void createAndShowFrame() {
-        fbutton = new Button("fbutton");
-
-        frame.setBounds(800, 0, 200, 100);
-        frame.setLayout(new FlowLayout());
-        frame.add(fbutton);
-        frame.setVisible(true);
-
-    }
-
-    static void clickOn(Point point) {
-
-        robot.mouseMove(point.x, point.y);
-
-        robot.mousePress(InputEvent.BUTTON1_MASK);
-        robot.mouseRelease(InputEvent.BUTTON1_MASK);
-
-        toolkit.realSync();
-    }
-
-    static Point getClickPoint(Component c) {
-        Point p = c.getLocationOnScreen();
-        Dimension d = c.getSize();
-        return new Point(p.x + (int) (d.getWidth() / 2), p.y + (int) (d.getHeight() / 2));
-    }
-
-    static Point getClickPoint(Frame frame) {
-        Point p = frame.getLocationOnScreen();
-        Dimension d = frame.getSize();
-        return new Point(p.x + (int) (d.getWidth() / 2), p.y + (frame.getInsets().top / 2));
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug       6385277
+ * @summary   Tests that override redirect window gets activated on click.
+ * @author    anton.tarasov@sun.com: area=awt.focus
+ * @library   ../../regtesthelpers
+ * @build     Util
+ * @run       main SimpleWindowActivationTest
+ */
+import java.awt.*;
+import java.awt.event.*;
+import java.util.concurrent.Callable;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+import test.java.awt.regtesthelpers.Util;
+
+public class SimpleWindowActivationTest {
+
+    private static Frame frame;
+    private static Window window;
+    private static Button fbutton;
+    private static Button wbutton;
+    private static Label label;
+    private static Robot robot;
+    private static SunToolkit toolkit;
+
+    public static void main(String[] args) throws Exception {
+
+        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+            System.out.println("No testing on Motif. Test passed.");
+            return;
+        }
+
+        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        robot = new Robot();
+        robot.setAutoDelay(50);
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+
+            public void eventDispatched(AWTEvent e) {
+                System.out.println(e);
+            }
+        }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK);
+
+        createAndShowWindow();
+        toolkit.realSync();
+
+        createAndShowFrame();
+        toolkit.realSync();
+
+        // click on Frame
+        clickOn(getClickPoint(frame));
+
+        if (!frame.isFocused()) {
+            throw new RuntimeException("Error: a frame couldn't be focused by click.");
+        }
+
+        //click on Label in Window
+        clickOn(getClickPoint(label));
+
+        if (!window.isFocused()) {
+            throw new RuntimeException("Test failed: the window couldn't be activated by click!");
+        }
+
+        // bring focus back to the frame
+        clickOn(getClickPoint(fbutton));
+
+        if (!frame.isFocused()) {
+            throw new RuntimeException("Error: a frame couldn't be focused by click.");
+        }
+
+        // Test 2. Verifies that clicking on a component of unfocusable Window
+        //         won't activate it.
+
+        window.setFocusableWindowState(false);
+        toolkit.realSync();
+
+
+        clickOn(getClickPoint(label));
+
+        if (window.isFocused()) {
+            throw new RuntimeException("Test failed: unfocusable window got activated by click!");
+        }
+        System.out.println("Test passed.");
+
+    }
+
+    private static void createAndShowWindow() {
+
+        frame = new Frame("Test Frame");
+        window = new Window(frame);
+        wbutton = new Button("wbutton");
+        label = new Label("label");
+
+        window.setBounds(800, 200, 300, 100);
+        window.setLayout(new FlowLayout());
+        window.add(wbutton);
+        window.add(label);
+        window.setVisible(true);
+
+    }
+
+    private static void createAndShowFrame() {
+        fbutton = new Button("fbutton");
+
+        frame.setBounds(800, 0, 300, 100);
+        frame.setLayout(new FlowLayout());
+        frame.add(fbutton);
+        frame.setVisible(true);
+
+    }
+
+    static void clickOn(Point point) {
+
+        robot.mouseMove(point.x, point.y);
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        toolkit.realSync();
+    }
+
+    static Point getClickPoint(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+        return new Point(p.x + (int) (d.getWidth() / 2), p.y + (int) (d.getHeight() / 2));
+    }
+
+    static Point getClickPoint(Frame frame) {
+        Point p = frame.getLocationOnScreen();
+        Dimension d = frame.getSize();
+        return new Point(p.x + (int) (d.getWidth() / 2), p.y + (frame.getInsets().top / 2));
+    }
+}
--- a/jdk/test/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh	Wed May 08 10:10:05 2013 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,8 @@
 ${TESTJAVA}/bin/javac -cp ${TESTSRC} -d . ${TESTSRC}/BadDisplayTest.java
 
 
-export DISPLAY=
+DISPLAY=
+export DISPLAY
 
 OS=`uname -s`
 case "$OS" in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/WMSpecificTests/Metacity/FullscreenDialogModality.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8012586
+ * @summary verify that modal dialog will appeared above fullscreen window under Metacity WM.
+ * @run main FullscreenDialogModality
+ * @run main/othervm FullscreenDialogModality
+ * @author vkravets
+ */
+
+import test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+import java.lang.reflect.InvocationTargetException;
+
+public class FullscreenDialogModality extends Frame {
+
+    static Robot robot = null;
+
+    public void enterFS() {
+        GraphicsDevice gd = getGraphicsConfiguration().getDevice();
+        final boolean fs = gd.isFullScreenSupported();
+        System.out.println("FullscreenSupported: " + (fs ? "yes" : "no"));
+        gd.setFullScreenWindow(this);
+        try {
+            // Give the system time to set the FS window and display it
+            // properly
+            Thread.sleep(2000);
+        } catch (Exception e) {}
+    }
+
+    public void exitFS() {
+        GraphicsDevice gd = getGraphicsConfiguration().getDevice();
+        // reset window
+        gd.setFullScreenWindow(null);
+        try {
+            // Give the system time to set the FS window and display it
+            // properly
+            Thread.sleep(2000);
+        } catch (Exception e) {}
+    }
+
+    public void checkDialogModality() throws InvocationTargetException, InterruptedException {
+        // Dialog
+        final Dialog d = new Dialog(FullscreenDialogModality.this, "Modal dialog", Dialog.ModalityType.APPLICATION_MODAL);
+        d.setBounds(500, 500, 160, 160);
+        d.setModal(true);
+        d.setBackground(Color.red);
+        EventQueue.invokeLater(new Runnable()
+        {
+            public void run()
+            {
+                d.setVisible(true);
+            }
+        });
+        // Wait until the dialog is shown
+        EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                // Empty
+            }
+        });
+
+        Util.waitForIdle(robot);
+        try {
+            //Check color
+            Point checkPoint = new Point(d.getX() + d.getWidth() / 2, d.getY() + d.getHeight() / 2);
+            Color actual = robot.getPixelColor(checkPoint.x, checkPoint.y);
+            System.out.println("Color = " + actual);
+            if (actual.getRGB() == Color.GREEN.getRGB()) {
+                throw new RuntimeException("Test FAILED: Modal dialog shown below fullscreen window");
+            } else if (actual.getRGB() == Color.RED.getRGB()) {
+                System.out.println("Test PASSED: Modal dialog shown above fullscreen window");
+            } else {
+                System.out.println("pixelColor " +
+                        Integer.toHexString(actual.getRGB()) +
+                        " at coordinates (" + checkPoint.x + ", " + checkPoint.y + ")");
+                throw new RuntimeException("Test FAILED: Unexpected behavior");
+            }
+
+            robot.delay(2000);
+            Util.waitForIdle(robot);
+        } finally {
+            d.dispose();
+        }
+    }
+
+    public static void main(String args[]) throws InvocationTargetException, InterruptedException {
+        if (Util.getWMID() != Util.METACITY_WM) {
+            System.out.println("This test is only useful on Metacity");
+            return;
+        }
+        robot = Util.createRobot();
+        Util.waitForIdle(robot);
+        final FullscreenDialogModality frame = new FullscreenDialogModality();
+        frame.setUndecorated(true);
+        frame.setBackground(Color.green);
+        frame.setSize(500, 500);
+        frame.setVisible(true);
+        try {
+            robot.delay(100);
+            Util.waitForIdle(robot);
+
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    frame.enterFS();
+                }
+            });
+            robot.delay(200);
+            Util.waitForIdle(robot);
+
+            frame.checkDialogModality();
+
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    frame.exitFS();
+                }
+            });
+        } finally {
+            frame.dispose();
+        }
+    }
+}
--- a/jdk/test/java/beans/XMLEncoder/AbstractTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/beans/XMLEncoder/AbstractTest.java	Wed May 08 10:10:05 2013 +0100
@@ -30,8 +30,10 @@
 
 import java.nio.charset.Charset;
 
+import java.lang.reflect.Field;
+
 abstract class AbstractTest<T> implements ExceptionListener {
-    private final BeanValidator validator = new BeanValidator();
+    final BeanValidator validator = new BeanValidator();
 
     public final void exceptionThrown(Exception exception) {
         throw new Error("unexpected exception", exception);
@@ -59,7 +61,7 @@
     }
 
     /**
-     * This method should be overriden
+     * This method should be overridden
      * if specified encoder should be initialized.
      *
      * @param encoder  the XML encoder to initialize
@@ -68,7 +70,7 @@
     }
 
     /**
-     * This method should be overriden
+     * This method should be overridden
      * if specified decoder should be initialized.
      *
      * @param decoder  the XML decoder to initialize
@@ -77,7 +79,7 @@
     }
 
     /**
-     * This method should be overriden
+     * This method should be overridden
      * for test-specific comparison.
      *
      * @param before  the object before encoding
@@ -134,6 +136,7 @@
     private byte[] writeObject(Object object) {
         ByteArrayOutputStream output = new ByteArrayOutputStream();
         XMLEncoder encoder = new XMLEncoder(output);
+        encoder.setExceptionListener(this);
         initialize(encoder);
         encoder.writeObject(object);
         encoder.close();
@@ -143,9 +146,24 @@
     private Object readObject(byte[] array) {
         ByteArrayInputStream input = new ByteArrayInputStream(array);
         XMLDecoder decoder = new XMLDecoder(input);
+        decoder.setExceptionListener(this);
         initialize(decoder);
         Object object = decoder.readObject();
         decoder.close();
         return object;
     }
+
+    static Field getField(String name) {
+        try {
+            int index = name.lastIndexOf('.');
+            String className = name.substring(0, index);
+            String fieldName = name.substring(1 + index);
+            Field field = Class.forName(className).getDeclaredField(fieldName);
+            field.setAccessible(true);
+            return field;
+        }
+        catch (Exception exception) {
+            throw new Error(exception);
+        }
+    }
 }
--- a/jdk/test/java/beans/XMLEncoder/BeanValidator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/beans/XMLEncoder/BeanValidator.java	Wed May 08 10:10:05 2013 +0100
@@ -63,6 +63,15 @@
         }
         Class type = object1.getClass();
         if (!type.equals(object2.getClass())) {
+            // resolve different implementations of the Map.Entry interface
+            if ((object1 instanceof Map.Entry) && (object2 instanceof Map.Entry)) {
+                log("!!! special case", "Map.Entry");
+                Map.Entry entry1 = (Map.Entry) object1;
+                Map.Entry entry2 = (Map.Entry) object2;
+                validate(entry1.getKey(), entry2.getKey());
+                validate(entry1.getValue(), entry2.getValue());
+                return;
+            }
             throw new IllegalStateException("could not compare objects with different types");
         }
         // validate elements of arrays
@@ -82,10 +91,14 @@
             }
             return;
         }
+        // special case for collections: do not use equals
+        boolean ignore = Collection.class.isAssignableFrom(type)
+                || Map.Entry.class.isAssignableFrom(type)
+                || Map.class.isAssignableFrom(type);
         // validate objects using equals()
         // we assume that the method equals(Object) can be called,
         // if the class declares such method
-        if (isDefined(type, "equals", Object.class)) {
+        if (!ignore && isDefined(type, "equals", Object.class)) {
             if (object1.equals(object2)) {
                 return;
             }
@@ -205,27 +218,7 @@
     }
 
     private void validate(Map map1, Map map2, boolean sorted) {
-        if (map1.size() != map2.size()) {
-            throw new IllegalStateException("could not compare maps with different sizes");
-        }
-        if (sorted) {
-            Iterator first = map1.entrySet().iterator();
-            Iterator second = map2.entrySet().iterator();
-            int index = 0;
-            while (first.hasNext() && second.hasNext()) {
-                log("validate map entry", Integer.valueOf(index++));
-                validate(first.next(), second.next());
-            }
-            if (first.hasNext() || second.hasNext()) {
-                throw new IllegalStateException("one map contains more entries than another one");
-            }
-        } else {
-            // assume that equals() can be used for keys
-            for (Object key : map1.keySet()) {
-                log("validate map value for key", key);
-                validate(map1.get(key), map2.get(key));
-            }
-        }
+        validate(map1.entrySet(), map2.entrySet(), sorted);
     }
 
     private boolean isCyclic(Object object1, Object object2) {
--- a/jdk/test/java/beans/XMLEncoder/Test4631471.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/beans/XMLEncoder/Test4631471.java	Wed May 08 10:10:05 2013 +0100
@@ -28,7 +28,6 @@
  * @author Sergey Malenkov, Mark Davidson
  */
 
-import java.beans.XMLEncoder;
 import javax.swing.JTree;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
@@ -78,10 +77,6 @@
         // do not any validation
     }
 
-    protected final void initialize(XMLEncoder encoder) {
-        encoder.setExceptionListener(this);
-    }
-
     public static TreeNode getRoot() {
         DefaultMutableTreeNode node = new DefaultMutableTreeNode("root");
         DefaultMutableTreeNode first = new DefaultMutableTreeNode("first");
--- a/jdk/test/java/beans/XMLEncoder/Test4679556.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/beans/XMLEncoder/Test4679556.java	Wed May 08 10:10:05 2013 +0100
@@ -103,7 +103,6 @@
     }
 
     protected void initialize(XMLEncoder encoder) {
-        encoder.setExceptionListener(this);
         encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() {
             protected Expression instantiate(Object oldInstance, Encoder out) {
                 C c = (C) oldInstance;
--- a/jdk/test/java/beans/XMLEncoder/java_awt_BorderLayout.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/beans/XMLEncoder/java_awt_BorderLayout.java	Wed May 08 10:10:05 2013 +0100
@@ -68,11 +68,9 @@
     @Override
     protected void validate(BorderLayout before, BorderLayout after) {
         super.validate(before, after);
-
-        BeanValidator validator = new BeanValidator();
         for (String constraint : CONSTRAINTS) {
-            validator.validate(before.getLayoutComponent(constraint),
-                               after.getLayoutComponent(constraint));
+            super.validator.validate(before.getLayoutComponent(constraint),
+                                     after.getLayoutComponent(constraint));
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/java_awt_CardLayout.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8007458
+ * @summary Tests CardLayout encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.CardLayout;
+import java.lang.reflect.Field;
+import java.util.Vector;
+import javax.swing.JLabel;
+
+public final class java_awt_CardLayout extends AbstractTest<CardLayout> {
+    private static final Field VECTOR = getField("java.awt.CardLayout.vector");
+    private static final Field NAME = getField("java.awt.CardLayout$Card.name");
+    private static final Field COMP = getField("java.awt.CardLayout$Card.comp");
+
+    public static void main(String[] args) throws Exception {
+        new java_awt_CardLayout().test(true);
+    }
+
+    @Override
+    protected CardLayout getObject() {
+        CardLayout layout = new CardLayout();
+        layout.addLayoutComponent(new JLabel("a"), "a");
+        layout.addLayoutComponent(new JLabel("b"), "b");
+        layout.addLayoutComponent(new JLabel("c"), "c");
+        return layout;
+    }
+
+    @Override
+    protected CardLayout getAnotherObject() {
+        CardLayout layout = new CardLayout();
+        layout.addLayoutComponent(new JLabel("a"), "a");
+        layout.addLayoutComponent(new JLabel("b"), "b");
+        layout.addLayoutComponent(new JLabel("c"), "c");
+        layout.addLayoutComponent(new JLabel("d"), "d");
+        return layout;
+    }
+
+    @Override
+    protected void validate(CardLayout before, CardLayout after) {
+        super.validate(before, after);
+        try {
+            Vector a = (Vector) VECTOR.get(after);
+            Vector b = (Vector) VECTOR.get(before);
+            int size = a.size();
+            if (size != b.size()) {
+                throw new Error("different content");
+            }
+            for (int i = 0; i < size; i++) {
+                super.validator.validate(NAME.get(a.get(i)), NAME.get(b.get(i)));
+                super.validator.validate(COMP.get(a.get(i)), COMP.get(b.get(i)));
+            }
+        }
+        catch (Exception exception) {
+            throw new Error(exception);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/java_awt_GridBagLayout.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8007458
+ * @summary Tests GridBagLayout encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+import java.util.Map;
+import javax.swing.JLabel;
+
+public final class java_awt_GridBagLayout extends AbstractTest<GridBagLayout> {
+    private static final Field HASHTABLE = getField("java.awt.GridBagLayout.comptable");
+
+    public static void main(String[] args) {
+        new java_awt_GridBagLayout().test(true);
+    }
+
+    @Override
+    protected GridBagLayout getObject() {
+        GridBagLayout layout = new GridBagLayout();
+        update(layout, "1", 1, 1);
+        update(layout, "2", 2, 2);
+        update(layout, "3", 3, 3);
+        return layout;
+    }
+
+    @Override
+    protected GridBagLayout getAnotherObject() {
+        GridBagLayout layout = new GridBagLayout();
+        update(layout, "11", 1, 1);
+        update(layout, "12", 1, 2);
+        update(layout, "21", 2, 1);
+        update(layout, "22", 2, 2);
+        return layout;
+    }
+
+    @Override
+    protected void validate(GridBagLayout before, GridBagLayout after) {
+        super.validate(before, after);
+        try {
+            Hashtable a = (Hashtable) HASHTABLE.get(after);
+            Hashtable b = (Hashtable) HASHTABLE.get(before);
+            super.validator.validate(a, b);
+
+//            for (int i = 0; i < size; i++) {
+//                validator.validate(NAME.get(a.get(i)), NAME.get(b.get(i)));
+//                validator.validate(COMP.get(a.get(i)), COMP.get(b.get(i)));
+//            }
+        }
+        catch (Exception exception) {
+            throw new Error(exception);
+        }
+
+
+
+//        for (String name : names) {
+//            validator.validate(getConstraints(before, name), getConstraints(after, name));
+//        }
+    }
+
+    private static void update(GridBagLayout layout, String id, int x, int y) {
+        GridBagConstraints gbc = new GridBagConstraints();
+        gbc.gridx = x;
+        gbc.gridy = y;
+        layout.addLayoutComponent(new JLabel(id), gbc);
+    }
+
+/*
+    private static GridBagConstraints getConstraints(GridBagLayout layout, String id) {
+        return (layout == null) ? null : ((MyGridBagLayout) layout).getConstraints(id);
+    }
+*/
+}
--- a/jdk/test/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java	Wed May 08 10:10:05 2013 +0100
@@ -28,6 +28,7 @@
  * @author Sergey Malenkov
  */
 
+import java.beans.XMLEncoder;
 import javax.swing.DefaultCellEditor;
 import javax.swing.JTextField;
 import javax.swing.text.JTextComponent;
@@ -46,6 +47,11 @@
         // return new DefaultCellEditor(new JTextField("Second"));
     }
 
+    @Override
+    protected void initialize(XMLEncoder encoder) {
+        encoder.setExceptionListener(null); // TODO: ignore non-public listener because of 4808251
+    }
+
     protected void validate(DefaultCellEditor before, DefaultCellEditor after) {
         String text = ((JTextComponent) after.getComponent()).getText();
         if (!text.equals(((JTextComponent) before.getComponent()).getText()))
--- a/jdk/test/java/io/Serializable/accessConstants/AccessConstants.java	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1998, 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 4067964
-@clean AccessConstants
-@build AccessConstants
-@summary Verify that ObjectStreamConstants is public accessible.
-         This test will not compile pre-JDK 1.2.
-*/
-
-import java.io.ObjectStreamConstants;
-
-public class AccessConstants {
-    public static void main(String[] args) {
-        byte[] ref = new byte[4];
-        ref[0] = ObjectStreamConstants.TC_BASE;
-        ref[1] = ObjectStreamConstants.TC_NULL;
-        ref[2] = ObjectStreamConstants.TC_REFERENCE;
-        ref[3] = ObjectStreamConstants.TC_CLASSDESC;
-        int version = ObjectStreamConstants.PROTOCOL_VERSION_1;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/CharSequence/DefaultTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012 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.
+ */
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.PrimitiveIterator;
+import java.util.stream.Collectors;
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @summary Unit test for CharSequence default methods
+ * @bug 8012665
+ * @run testng DefaultTest
+ */
+
+@Test(groups = "lib")
+public class DefaultTest {
+
+    @Test(expectedExceptions = NoSuchElementException.class)
+    public void testEmptyChars() {
+        PrimitiveIterator.OfInt s = "".chars().iterator();
+        assertFalse(s.hasNext());
+        int ch = s.nextInt();
+    }
+
+    public void testSimpleChars() {
+        List<Integer> list = "abc".chars().boxed().collect(Collectors.toList());
+        assertEquals(list, Arrays.asList((int) 'a', (int) 'b', (int) 'c'));
+    }
+
+    @Test(expectedExceptions = NoSuchElementException.class)
+    public void testEmptyCodePoints() {
+        PrimitiveIterator.OfInt s = "".codePoints().iterator();
+        assertFalse(s.hasNext());
+        int cp = s.nextInt();
+    }
+
+    public void testSimpleCodePoints() {
+        List<Integer> list = "abc".codePoints().boxed().collect(Collectors.toList());
+        assertEquals(list, Arrays.asList((int)'a', (int)'b', (int)'c'));
+    }
+
+    public void testUndefCodePoints() {
+        List<Integer> list = "X\ufffeY".codePoints().boxed().collect(Collectors.toList());
+        assertEquals(list, Arrays.asList((int)'X', 0xFFFE, (int)'Y'));
+    }
+
+    public void testSurrogatePairing() {
+        // U+1D11E = MUSICAL SYMBOL G CLEF
+        // equivalent to surrogate pair U+D834 U+DD1E
+        List<Integer> list;
+        final int GCLEF = 0x1d11e;
+
+        list = "\ud834\udd1e".codePoints().boxed().collect(Collectors.toList());
+        assertEquals(list, Arrays.asList(GCLEF));
+        list = "A\ud834\udd1e".codePoints().boxed().collect(Collectors.toList());
+        assertEquals(list, Arrays.asList((int)'A', GCLEF));
+        list = "\ud834\udd1eB".codePoints().boxed().collect(Collectors.toList());
+        assertEquals(list, Arrays.asList(GCLEF, (int)'B'));
+        list = "X\ud834\udd1eY".codePoints().boxed().collect(Collectors.toList());
+        assertEquals(list, Arrays.asList((int)'X', GCLEF, (int)'Y'));
+    }
+
+    public void testUndefUnpaired() {
+        List<Integer> list = "W\udd1eX\ud834Y\ufffeZ".codePoints().boxed().collect(Collectors.toList());
+        assertEquals(list, Arrays.asList(
+            (int)'W', 0xdd1e, (int)'X', 0xd834, (int)'Y', 0xfffe, (int)'Z'));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/String/StringJoinTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * @test @bug 5015163
+ * @summary test String merge/join that is the inverse of String.split()
+ * @run testng StringJoinTest
+ * @author Jim Gish
+ */
+import java.util.ArrayList;
+import java.util.List;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+@Test(groups = {"unit","string","lang","libs"})
+public class StringJoinTest {
+    private final static String DASH = "-";
+    private final static String BEGIN = "Hi there";
+    private final static String JIM = "Jim";
+    private final static String JOHN = "John";
+    private final static String AND_JOE = "and Joe";
+    private final static String BILL = "Bill";
+    private final static String BOB = "Bob";
+    private final static String AND_BO = "and Bo";
+    private final static String ZEKE = "Zeke";
+    private final static String ZACK = "Zack";
+    private final static String AND_ZOE = "and Zoe";
+
+    /**
+     * Tests the join() methods on String
+     */
+    public void testJoinStringVarargs() {
+        // check a non-null join of String array (var-args) elements
+        String expectedResult = BEGIN + DASH + JIM + DASH + JOHN + DASH + AND_JOE;
+        String result = String.join(DASH, BEGIN, JIM, JOHN, AND_JOE);
+
+        assertEquals(result, expectedResult, "BEGIN.join(DASH, JIM, JOHN, AND_JOE)");
+        // test with just one element
+        assertEquals(String.join(DASH, BEGIN), BEGIN);
+    }
+
+    public void testJoinStringArray() {
+        // check a non-null join of Object[] with String elements
+        String[] theBs = {BILL, BOB, AND_BO};
+        String result = String.join(DASH, theBs);
+        String expectedResult = BILL + DASH + BOB + DASH + AND_BO;
+        assertEquals(result, expectedResult, "String.join(DASH, theBs)");
+    }
+
+    public void testJoinEmptyStringArray() {
+        // check a non-null join of Object[] with String elements
+        String[] empties = {};
+        String result = String.join(DASH, empties);
+        assertEquals(result, "", "String.join(DASH, empties)");
+    }
+
+    @Test(expectedExceptions = {NullPointerException.class})
+    public void testJoinNullStringArray() {
+        // check a non-null join of Object[] with String elements
+        String[] empties = null;
+        String result = String.join(DASH, empties);
+    }
+
+    @Test(expectedExceptions = {NullPointerException.class})
+    public void testJoinNullIterableStringList() {
+        // check join of an Iterables
+        List<CharSequence> theZsList = null;
+        String.join(DASH, theZsList);
+    }
+
+    public void testJoinIterableStringList() {
+        // check join of an Iterables
+        List<CharSequence> theZsList = new ArrayList<>();
+        theZsList.add(ZEKE);
+        theZsList.add(ZACK);
+        theZsList.add(AND_ZOE);
+        assertEquals(String.join(DASH, theZsList), ZEKE + DASH + ZACK + DASH
+                + AND_ZOE, "String.join(DASH, theZsList))");
+    }
+
+    public void testJoinNullStringList() {
+        List<CharSequence> nullList = null;
+        try {
+            assertEquals( String.join( DASH, nullList ), "null" );
+            fail("Null container should cause NPE");
+        } catch (NullPointerException npe) {}
+        assertEquals(String.join(DASH, null, null), "null" + DASH + "null");
+    }
+
+    @Test(expectedExceptions = {NullPointerException.class})
+    public void testJoinNullDelimiter() {
+        String.join(null, JIM, JOHN);
+    }
+}
--- a/jdk/test/java/lang/StringBuffer/TestSynchronization.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/lang/StringBuffer/TestSynchronization.java	Wed May 08 10:10:05 2013 +0100
@@ -96,6 +96,10 @@
         // the right thing.
         List<Method> methods = Arrays.asList(aClass.getDeclaredMethods());
         for (Method m : methods) {
+            // skip synthetic methods, like default interface methods and lambdas
+            if (m.isSynthetic()) {
+                continue;
+            }
             int modifiers = m.getModifiers();
             if (Modifier.isPublic(modifiers)
                     && !Modifier.isSynchronized(modifiers)) {
--- a/jdk/test/java/lang/Throwable/SuppressedExceptions.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/lang/Throwable/SuppressedExceptions.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 
 /*
  * @test
- * @bug     6911258 6962571 6963622 6991528 7005628
+ * @bug     6911258 6962571 6963622 6991528 7005628 8012044
  * @summary Basic tests of suppressed exceptions
  * @author  Joseph D. Darcy
  */
@@ -40,6 +40,7 @@
         serializationTest();
         selfReference();
         noModification();
+        initCausePlumbing();
     }
 
     private static void noSelfSuppression() {
@@ -48,7 +49,9 @@
             throwable.addSuppressed(throwable);
             throw new RuntimeException("IllegalArgumentException for self-suppresion not thrown.");
         } catch (IllegalArgumentException iae) {
-            ; // Expected
+            // Expected to be here
+            if (iae.getCause() != throwable)
+                throw new RuntimeException("Bad cause after self-suppresion.");
         }
     }
 
@@ -208,4 +211,36 @@
             super("The medium.", null, enableSuppression, true);
         }
     }
+
+    private static void initCausePlumbing() {
+        Throwable t1 = new Throwable();
+        Throwable t2 = new Throwable("message", t1);
+        Throwable t3 = new Throwable();
+
+        try {
+            t2.initCause(t3);
+            throw new RuntimeException("Shouldn't reach.");
+        } catch (IllegalStateException ise) {
+            if (ise.getCause() != t2)
+                throw new RuntimeException("Unexpected cause in ISE", ise);
+            Throwable[] suppressed = ise.getSuppressed();
+            if (suppressed.length !=  0)
+                throw new RuntimeException("Bad suppression in ISE", ise);
+        }
+
+        try {
+            t2.initCause(null);
+            throw new RuntimeException("Shouldn't reach.");
+        } catch (IllegalStateException ise) {
+            ; // Expected; don't want an NPE.
+        }
+
+        try {
+            t3.initCause(t3);
+            throw new RuntimeException("Shouldn't reach.");
+        } catch (IllegalArgumentException iae) {
+            if (iae.getCause() != t3)
+                throw new RuntimeException("Unexpected cause in ISE", iae);
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,1122 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.PrintStream;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * @test
+ * @bug 8007373
+ * @summary jdk7 backward compatibility serialization problem
+ */
+
+public class Inet6AddressSerializationTest {
+
+    static boolean failed;
+
+    public static final int LOOPBACK_SCOPE_ID = 0;
+
+    public static final byte[] IN6ADDR_ANY_INIT = { (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
+
+    public static final byte[] LOOPBACKIPV6ADDRESS = { (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 };
+
+    // fe80::21b:24ff:febd:f29c
+    public static final byte[] E1000G0IPV6ADDRESS = { (byte) 0xfe, (byte) 0x80,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x02, (byte) 0x1b, (byte) 0x24, (byte) 0xff,
+            (byte) 0xfe, (byte) 0xbd, (byte) 0xf2, (byte) 0x9c };
+
+    public static final String E1000G0HOSTNAME = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
+
+    public static final String LOCALHOSTNAME = "localhost";
+
+    public static final String NETWORK_IF_E1000G0 = "e1000g0";
+
+    public static final String NETWORK_IF_LO0 = "lo0";
+
+    public static final int SCOPE_ID_E1000G0 = 2;
+
+    public static final int SCOPE_ID_LO0 = 1;
+
+    public static final int SCOPE_ID_ZERO = 0;
+
+    public static void main(String[] args) throws Exception {
+        // args[0] == generate-loopback generates serial data for loopback if
+        // args[0] == generateAll generates serial data for interfaces with an
+        // IPV6 address binding
+
+        if (args.length != 0) {
+
+            if (args[0].equals("generate-loopback")) {
+
+                generateSerializedInet6AddressData(Inet6Address.getByAddress(
+                        InetAddress.getLoopbackAddress().getHostName(),
+                        LOOPBACKIPV6ADDRESS, LOOPBACK_SCOPE_ID), System.out,
+                        true);
+
+            } else {
+                generateAllInet6AddressSerializedData();
+            }
+        } else {
+            runTests();
+        }
+    }
+
+    private static void runTests() throws UnknownHostException, Exception,
+            IOException {
+        byte[] thisHostIPV6Address = null;
+        int scope_id = LOOPBACK_SCOPE_ID;
+
+        System.out.println("Hostname: "
+                + InetAddress.getLocalHost().getHostName());
+        System.out.println("LocalHost isLoopback : "
+                + InetAddress.getLocalHost().isLoopbackAddress());
+        thisHostIPV6Address = getThisHostIPV6Address(InetAddress.getLocalHost()
+                .getHostName());
+
+        if (thisHostIPV6Address == null) {
+            thisHostIPV6Address = IN6ADDR_ANY_INIT;
+        }
+
+        // testing JDK7 generated serialized loopback against locally generated
+        // loopback address
+        testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
+                .getLoopbackAddress().getHostName(), LOOPBACKIPV6ADDRESS,
+                scope_id), JDK7Inet6AddressSerialData);
+        // testing JDK8 generated serialized loopback against locally generated
+        // loopback address
+        testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
+                .getLoopbackAddress().getHostName(), LOOPBACKIPV6ADDRESS,
+                scope_id), JDK8Inet6AddressSerialData);
+        testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
+                .getLocalHost().getHostName(), IN6ADDR_ANY_INIT, scope_id),
+                null);
+        testInet6AddressSerialization(Inet6Address.getByAddress(InetAddress
+                .getLocalHost().getHostName(), thisHostIPV6Address, scope_id),
+                null);
+        testAllNetworkInterfaces();
+
+        // test against lo0
+        testSerializedLo0Inet6Address();
+
+        testSerializedE1000gInet6Address();
+
+        if (failed)
+            throw new RuntimeException("Some tests failed, check output");
+    }
+
+    private static byte[] getThisHostIPV6Address(String hostName)
+            throws Exception {
+        InetAddress[] thisHostIPAddresses = null;
+        try {
+            thisHostIPAddresses = InetAddress.getAllByName(InetAddress
+                    .getLocalHost().getHostName());
+        } catch (UnknownHostException uhEx) {
+            uhEx.printStackTrace();
+            throw uhEx;
+        }
+        byte[] thisHostIPV6Address = null;
+        for (InetAddress inetAddress : thisHostIPAddresses) {
+            if (inetAddress instanceof Inet6Address) {
+                if (inetAddress.getHostName().equals(hostName)) {
+                    thisHostIPV6Address = inetAddress.getAddress();
+                    break;
+                }
+            }
+        }
+        // System.err.println("getThisHostIPV6Address: address is "
+        // + Arrays.toString(thisHostIPV6Address));
+        return thisHostIPV6Address;
+    }
+
+    static void testAllNetworkInterfaces() throws Exception {
+        System.err.println("\n testAllNetworkInterfaces: \n ");
+        for (Enumeration<NetworkInterface> e = NetworkInterface
+                .getNetworkInterfaces(); e.hasMoreElements();) {
+            NetworkInterface netIF = e.nextElement();
+            for (Enumeration<InetAddress> iadrs = netIF.getInetAddresses(); iadrs
+                    .hasMoreElements();) {
+                InetAddress iadr = iadrs.nextElement();
+                if (iadr instanceof Inet6Address) {
+                    System.err.println("Test NetworkInterface:  " + netIF);
+                    Inet6Address i6adr = (Inet6Address) iadr;
+                    System.err.println("Testing with " + iadr);
+                    System.err.println(" scoped iface: "
+                            + i6adr.getScopedInterface());
+                    testInet6AddressSerialization(i6adr, null);
+                }
+            }
+        }
+    }
+
+    static void displayExpectedInet6Address(Inet6Address expectedInet6Address) {
+
+        String expectedHostName = expectedInet6Address.getHostName();
+        byte[] expectedAddress = expectedInet6Address.getAddress();
+        String expectedHostAddress = expectedInet6Address.getHostAddress();
+        int expectedScopeId = expectedInet6Address.getScopeId();
+        NetworkInterface expectedNetIf = expectedInet6Address
+                .getScopedInterface();
+
+        System.err.println("Excpected HostName: " + expectedHostName);
+        System.err.println("Expected Address: "
+                + Arrays.toString(expectedAddress));
+        System.err.println("Expected HostAddress: " + expectedHostAddress);
+        System.err.println("Expected Scope Id " + expectedScopeId);
+        System.err.println("Expected NetworkInterface " + expectedNetIf);
+        System.err.println("Expected Inet6Address " + expectedInet6Address);
+    }
+
+    // test serialization deserialization of Inet6Address
+    static void testInet6AddressSerialization(
+            Inet6Address expectedInet6Address, byte[] serializedAddress)
+            throws IOException {
+        System.err.println("\n testInet6AddressSerialization:  enter \n");
+
+        // displayExpectedInet6Address(expectedInet6Address);
+
+        byte[] serialData = serializedAddress != null ? serializedAddress
+                : generateSerializedInet6AddressData(expectedInet6Address,
+                        null, false);
+        try (ByteArrayInputStream bis = new ByteArrayInputStream(serialData);
+                ObjectInputStream oin = new ObjectInputStream(bis)) {
+            Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
+            System.err.println("Deserialized Inet6Address "
+                    + deserializedIPV6Addr);
+            assertHostNameEqual(expectedInet6Address.getHostName(),
+                    deserializedIPV6Addr.getHostName());
+            assertHostAddressEqual(expectedInet6Address.getHostAddress(),
+                    deserializedIPV6Addr.getHostAddress());
+            assertAddressEqual(expectedInet6Address.getAddress(),
+                    deserializedIPV6Addr.getAddress());
+            assertScopeIdEqual(expectedInet6Address.getScopeId(),
+                    deserializedIPV6Addr.getScopeId());
+            assertNetworkInterfaceEqual(
+                    expectedInet6Address.getScopedInterface(),
+                    deserializedIPV6Addr.getScopedInterface());
+        } catch (Exception e) {
+            System.err.println("Exception caught during deserialization");
+            failed = true;
+            e.printStackTrace();
+        }
+    }
+
+    static void testSerializedE1000gInet6Address() throws IOException {
+        System.err.println("\n testSerializedE1000gInet6Address:  enter \n");
+        boolean testWithNetIf = true;
+        boolean useMockInet6Address = false;
+
+        NetworkInterface testNetIf = NetworkInterface
+                .getByName(NETWORK_IF_E1000G0);
+        Inet6Address expectedInet6Address = null;
+        if (testNetIf != null) {
+            System.err
+                    .println("\n testSerializedE1000gInet6Address:  using netif \n");
+            try {
+                expectedInet6Address = Inet6Address.getByAddress(
+                        E1000G0HOSTNAME, E1000G0IPV6ADDRESS, testNetIf);
+            } catch (UnknownHostException ukhEx) {
+                ukhEx.printStackTrace();
+                testWithNetIf = true;
+                useMockInet6Address = true;
+            }
+        } else {
+            System.err
+                    .println("\n testSerializedE1000gInet6Address:  using index \n");
+            try {
+                expectedInet6Address = Inet6Address.getByAddress(
+                        E1000G0HOSTNAME, E1000G0IPV6ADDRESS, SCOPE_ID_ZERO);
+            } catch (UnknownHostException ukhEx1) {
+                ukhEx1.printStackTrace();
+                useMockInet6Address = true;
+            }
+            testWithNetIf = false;
+        }
+
+        byte[] serializedAddress = SerialData_ifname_e1000g0;
+
+        // displayExpectedInet6Address(expectedInet6Address);
+
+        try (ByteArrayInputStream bis = new ByteArrayInputStream(
+                serializedAddress);
+                ObjectInputStream oin = new ObjectInputStream(bis)) {
+            Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
+            System.err.println("Deserialized Inet6Address "
+                    + deserializedIPV6Addr);
+
+            if (!useMockInet6Address) {
+                assertHostNameEqual(expectedInet6Address.getHostName(),
+                        deserializedIPV6Addr.getHostName());
+                if (testWithNetIf) {
+                    assertHostAddressEqual(
+                            expectedInet6Address.getHostAddress(),
+                            deserializedIPV6Addr.getHostAddress());
+                } else {
+                    assertHostAddressEqual(
+                            MockE1000g0Inet6Address.getBareHostAddress(),
+                            deserializedIPV6Addr.getHostAddress());
+                }
+                assertAddressEqual(expectedInet6Address.getAddress(),
+                        deserializedIPV6Addr.getAddress());
+                assertScopeIdEqual(expectedInet6Address.getScopeId(),
+                        deserializedIPV6Addr.getScopeId());
+                if (testWithNetIf) {
+                    assertNetworkInterfaceEqual(
+                            expectedInet6Address.getScopedInterface(),
+                            deserializedIPV6Addr.getScopedInterface());
+                } else {
+                    assertNetworkInterfaceEqual(null,
+                            deserializedIPV6Addr.getScopedInterface());
+                }
+            } else { // use MockLo0Inet6Address
+                assertHostNameEqual(MockE1000g0Inet6Address.getHostName(),
+                        deserializedIPV6Addr.getHostName());
+                if (testWithNetIf) {
+                    assertHostAddressEqual(
+                            MockE1000g0Inet6Address.getHostAddress(),
+                            deserializedIPV6Addr.getHostAddress());
+                } else {
+                    assertHostAddressEqual(
+                            MockE1000g0Inet6Address.getHostAddressWithIndex(),
+                            deserializedIPV6Addr.getHostAddress());
+                }
+                assertAddressEqual(MockE1000g0Inet6Address.getAddress(),
+                        deserializedIPV6Addr.getAddress());
+                if (testWithNetIf) {
+                assertScopeIdEqual(MockE1000g0Inet6Address.getScopeId(),
+                        deserializedIPV6Addr.getScopeId());
+                } else {
+                    assertScopeIdEqual(MockE1000g0Inet6Address.getScopeZero(),
+                            deserializedIPV6Addr.getScopeId());
+                }
+                assertNetworkInterfaceNameEqual(
+                        MockE1000g0Inet6Address.getScopeIfName(),
+                        deserializedIPV6Addr.getScopedInterface());
+            }
+        } catch (Exception e) {
+            System.err.println("Exception caught during deserialization");
+            failed = true;
+            e.printStackTrace();
+        }
+    }
+
+    static void testSerializedLo0Inet6Address() throws IOException {
+        System.err.println("\n testSerializedLo0Inet6Address:  enter \n");
+        boolean testWithNetIf = true;
+        boolean useMockInet6Address = false;
+
+        NetworkInterface testNetIf = NetworkInterface.getByName(NETWORK_IF_LO0);
+        Inet6Address expectedInet6Address = null;
+        if (testNetIf != null) {
+            System.err
+                    .println("\n testSerializedLo0Inet6Address:  using netif \n");
+            try {
+                expectedInet6Address = Inet6Address.getByAddress(LOCALHOSTNAME,
+                        LOOPBACKIPV6ADDRESS, testNetIf);
+            } catch (UnknownHostException ukhEx) {
+                ukhEx.printStackTrace();
+                testWithNetIf = true;
+                useMockInet6Address = true;
+            }
+        } else {
+            System.err
+                    .println("\n testSerializedLo0Inet6Address:  using index \n");
+            try {
+                expectedInet6Address = Inet6Address.getByAddress(LOCALHOSTNAME,
+                        LOOPBACKIPV6ADDRESS, SCOPE_ID_ZERO);
+            } catch (UnknownHostException ukhEx1) {
+                ukhEx1.printStackTrace();
+                useMockInet6Address = true;
+            }
+            testWithNetIf = false;
+        }
+
+        // displayExpectedInet6Address(expectedInet6Address);
+
+        byte[] serializedAddress = SerialData_ifname_lo0;
+
+        try (ByteArrayInputStream bis = new ByteArrayInputStream(
+                serializedAddress);
+                ObjectInputStream oin = new ObjectInputStream(bis)) {
+            Inet6Address deserializedIPV6Addr = (Inet6Address) oin.readObject();
+            System.err.println("Deserialized Inet6Address "
+                    + deserializedIPV6Addr);
+            if (!useMockInet6Address) {
+                assertHostNameEqual(expectedInet6Address.getHostName(),
+                        deserializedIPV6Addr.getHostName());
+                if (testWithNetIf) {
+                    assertHostAddressEqual(
+                            expectedInet6Address.getHostAddress(),
+                            deserializedIPV6Addr.getHostAddress());
+                } else {
+                    assertHostAddressEqual(
+                            MockLo0Inet6Address.getBareHostAddress(),
+                            deserializedIPV6Addr.getHostAddress());
+                }
+                assertAddressEqual(expectedInet6Address.getAddress(),
+                        deserializedIPV6Addr.getAddress());
+                assertScopeIdEqual(expectedInet6Address.getScopeId(),
+                        deserializedIPV6Addr.getScopeId());
+                if (testWithNetIf) {
+                    assertNetworkInterfaceEqual(
+                            expectedInet6Address.getScopedInterface(),
+                            deserializedIPV6Addr.getScopedInterface());
+                } else {
+                    assertNetworkInterfaceEqual(null,
+                            deserializedIPV6Addr.getScopedInterface());
+                }
+            } else { // use MockLo0Inet6Address
+                assertHostNameEqual(MockLo0Inet6Address.getHostName(),
+                        deserializedIPV6Addr.getHostName());
+                if (testWithNetIf) {
+                    assertHostAddressEqual(
+                            MockLo0Inet6Address.getHostAddress(),
+                            deserializedIPV6Addr.getHostAddress());
+                } else {
+                    assertHostAddressEqual(
+                            MockLo0Inet6Address.getHostAddressWithIndex(),
+                            deserializedIPV6Addr.getHostAddress());
+                }
+                assertAddressEqual(MockLo0Inet6Address.getAddress(),
+                        deserializedIPV6Addr.getAddress());
+                if (testWithNetIf) {
+                assertScopeIdEqual(MockLo0Inet6Address.getScopeId(),
+                        deserializedIPV6Addr.getScopeId());
+                } else {
+                    assertScopeIdEqual(MockLo0Inet6Address.getScopeZero(),
+                            deserializedIPV6Addr.getScopeId());
+                }
+                assertNetworkInterfaceNameEqual(
+                        MockLo0Inet6Address.getScopeIfName(),
+                        deserializedIPV6Addr.getScopedInterface());
+            }
+        } catch (Exception e) {
+            System.err.println("Exception caught during deserialization");
+            failed = true;
+            e.printStackTrace();
+        }
+    }
+
+    static List<Inet6Address> getAllInet6Addresses() throws Exception {
+        // System.err.println("\n getAllInet6Addresses: \n ");
+        ArrayList<Inet6Address> inet6Addresses = new ArrayList<Inet6Address>();
+        for (Enumeration<NetworkInterface> e = NetworkInterface
+                .getNetworkInterfaces(); e.hasMoreElements();) {
+            NetworkInterface netIF = e.nextElement();
+            for (Enumeration<InetAddress> iadrs = netIF.getInetAddresses(); iadrs
+                    .hasMoreElements();) {
+                InetAddress iadr = iadrs.nextElement();
+                if (iadr instanceof Inet6Address) {
+                    System.err.println("Test NetworkInterface:  " + netIF);
+                    Inet6Address i6adr = (Inet6Address) iadr;
+                    System.err.println(" address " + iadr);
+                    System.err.println(" scoped iface: "
+                            + i6adr.getScopedInterface());
+                    // using this to actually set the hostName for an
+                    // InetAddress
+                    // created through the NetworkInterface
+                    // have found that the fabricated instances has a null
+                    // hostName
+                    System.err.println(" hostName: " + i6adr.getHostName());
+                    inet6Addresses.add(i6adr);
+                }
+            }
+        }
+        return inet6Addresses;
+    }
+
+    static void assertHostNameEqual(String expectedHostName,
+            String deserializedHostName) {
+        System.err
+                .println("Inet6AddressSerializationTest.assertHostNameEqual:");
+        if (expectedHostName == null) {
+            if (deserializedHostName == null) {
+                // ok, do nothing.
+            } else {
+                System.err.println("Error checking " + " HostName, expected:"
+                        + expectedHostName + ", got :" + deserializedHostName);
+                failed = true;
+            }
+        } else if (!expectedHostName.equals(deserializedHostName)) {
+            System.err.println("Error checking "
+                    + // versionStr +
+                    " HostName, expected:" + expectedHostName + ", got :"
+                    + deserializedHostName);
+            failed = true;
+        } else {
+            System.err.println("HostName equality "
+                    + // versionStr +
+                    " HostName, expected:" + expectedHostName + ", got :"
+                    + deserializedHostName);
+        }
+    }
+
+    static void assertHostAddressEqual(String expectedHostAddress,
+            String deserializedHostAddress) {
+        System.err
+                .println("Inet6AddressSerializationTest.assertHostAddressEqual:");
+        if (expectedHostAddress == null) {
+            if (deserializedHostAddress == null) {
+                // ok, do nothing.
+            } else {
+                System.err.println("Error checking "
+                        + " HostAddress, expected: " + expectedHostAddress
+                        + ", got: " + deserializedHostAddress);
+                failed = true;
+            }
+        } else if (!expectedHostAddress.equals(deserializedHostAddress)) {
+            System.err.println("Error checking "
+                    + // versionStr +
+                    " HostAddress, expected: " + expectedHostAddress
+                    + ", got: " + deserializedHostAddress);
+            failed = true;
+        } else {
+            System.err.println("HostAddress equality "
+                    + // versionStr +
+                    " HostAddress, expected: " + expectedHostAddress
+                    + ", got: " + deserializedHostAddress);
+        }
+    }
+
+    static void assertAddressEqual(byte[] expectedAddress,
+            byte[] deserializedAddress) {
+        System.err.println("Inet6AddressSerializationTest.assertAddressEqual:");
+        if (expectedAddress == null) {
+            if (deserializedAddress == null) {
+                // ok, do nothing.
+            } else {
+                System.err.println("Error checking " + " Address, expected:"
+                        + Arrays.toString(expectedAddress) + ", got: "
+                        + Arrays.toString(deserializedAddress));
+                failed = true;
+            }
+        } else if (!Arrays.equals(expectedAddress, deserializedAddress)) {
+            System.err.println("Error checking "
+                    + // versionStr +
+                    " Address, expected: " + Arrays.toString(expectedAddress)
+                    + ", got: " + Arrays.toString(deserializedAddress));
+            failed = true;
+        } else {
+            System.err.println("Address equality "
+                    + // versionStr +
+                    " Address, expected: " + Arrays.toString(expectedAddress)
+                    + ", got: " + Arrays.toString(deserializedAddress));
+        }
+    }
+
+    static void assertScopeIdEqual(int expectedScopeId, int deserializedScopeId) {
+        System.err.println("Inet6AddressSerializationTest.assertScopeIdEqual:");
+        if (expectedScopeId != deserializedScopeId) {
+            System.err.println("Error checking " + " ScopeId, expected:"
+                    + expectedScopeId + ", got: " + deserializedScopeId);
+            failed = true;
+        } else {
+            System.err.println("ScopeId equality "
+                    + // versionStr +
+                    " ScopeId, expected: " + expectedScopeId + ", got: "
+                    + deserializedScopeId);
+        }
+    }
+
+    static void assertNetworkInterfaceNameEqual(String expectedNetworkIfName,
+            NetworkInterface deserializedNetworkInterface) {
+
+        if (deserializedNetworkInterface != null) {
+            String deserializedNetworkIfName = deserializedNetworkInterface
+                    .getName();
+            System.err
+                    .println("Inet6AddressSerializationTest.assertHostNameEqual:");
+            if (expectedNetworkIfName == null) {
+                if (deserializedNetworkIfName == null) {
+                    // ok, do nothing.
+                } else {
+                    System.err.println("Error checking "
+                            + " NetworkIfName, expected: "
+                            + expectedNetworkIfName + ", got: "
+                            + deserializedNetworkIfName);
+                    failed = true;
+                }
+            } else if (!expectedNetworkIfName.equals(deserializedNetworkIfName)) {
+                System.err.println("Error checking "
+                        + " NetworkIfName, expected: " + expectedNetworkIfName
+                        + ", got: " + deserializedNetworkIfName);
+                failed = true;
+            } else {
+                System.err.println("NetworkIfName equality "
+                        + " NetworkIfName, expected: " + expectedNetworkIfName
+                        + ", got: " + deserializedNetworkIfName);
+            }
+        } else {
+            System.err
+                    .println("Warning "
+                            + " NetworkInterface  expected, but is null - ifname not relevant on deserializing host");
+        }
+    }
+
+    static void assertNetworkInterfaceEqual(
+            NetworkInterface expectedNetworkInterface,
+            NetworkInterface deserializedNetworkInterface) {
+        System.err
+                .println("Inet6AddressSerializationTest.assertNetworkInterfaceEqual:");
+        if (expectedNetworkInterface == null) {
+            if (deserializedNetworkInterface == null) {
+                // ok, do nothing.
+                System.err.println("Network Interface equality "
+                        + " NetworkInterface, expected:"
+                        + expectedNetworkInterface + ", got :"
+                        + deserializedNetworkInterface);
+            } else {
+                System.err.println("Error checking "
+                        + " NetworkInterface, expected:"
+                        + expectedNetworkInterface + ", got :"
+                        + deserializedNetworkInterface);
+                failed = true;
+            }
+        } else if (!expectedNetworkInterface
+                .equals(deserializedNetworkInterface)) {
+            System.err.println("Error checking "
+                    + // versionStr +
+                    " NetworkInterface, expected:" + expectedNetworkInterface
+                    + ", got :" + deserializedNetworkInterface);
+            failed = true;
+        } else {
+            System.err.println("Network Interface equality "
+                    + " NetworkInterface, expected:" + expectedNetworkInterface
+                    + ", got :" + deserializedNetworkInterface);
+        }
+    }
+
+    static void equal(Object expected, Object got) {
+        if (expected == null) {
+            if (got == null) {
+                // ok, do nothing.
+            } else {
+                System.err.println("Error checking "
+                        + " serial data, expected:" + expected + ", got :"
+                        + got);
+                failed = true;
+            }
+        } else if (!expected.equals(got)) {
+            System.err.println("Error checking " + // versionStr +
+                    " serial data, expected:" + expected + ", got :" + got);
+            failed = true;
+        }
+    }
+
+    // Used to generate serialData.
+    static byte[] generateSerializedInet6AddressData(Inet6Address addr,
+            PrintStream out, boolean outputToFile) throws IOException {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        try (ObjectOutputStream oos = new ObjectOutputStream(bos)) {
+            oos.writeObject(addr);
+        }
+
+        String ifname = getIfName(addr);
+        byte[] ba = bos.toByteArray();
+        if (out != null) {
+            out.format("static final byte[] SerialData" + ifname + " = {\n");
+            for (int i = 0; i < ba.length; i++) {
+                out.format(" (byte)0x%02X", ba[i]);
+                if (i != (ba.length - 1))
+                    out.format(",");
+                if (((i + 1) % 6) == 0)
+                    out.format("\n");
+            }
+            out.format(" };\n \n");
+        }
+        if (outputToFile) {
+            serializeInet6AddressToFile(addr);
+        }
+        return ba;
+    }
+
+    private static String getIfName(Inet6Address inet6Addr) {
+        String ifname;
+        if (inet6Addr.getScopedInterface() != null) {
+            ifname = "_ifname_" + inet6Addr.getScopedInterface().getName();
+        } else {
+            ifname = "_ifname_"
+                    + Integer.valueOf(inet6Addr.getScopeId()).toString();
+        }
+        return ifname;
+    }
+
+    static void generateAllInet6AddressSerializedData() throws IOException {
+        // System.err.println("generateAllInet6AddressSerializedData: enter ....");
+
+        List<Inet6Address> inet6Addresses;
+
+        try {
+            inet6Addresses = getAllInet6Addresses();
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new IOException(e);
+        }
+
+        for (Inet6Address inet6Address : inet6Addresses) {
+            generateSerializedInet6AddressData(inet6Address, System.out, true);
+        }
+    }
+
+    static void serializeInet6AddressToFile(Inet6Address inet6Addr) {
+
+        // System.err
+        // .println("serializeInet6AddressToIPV6AddressFile: enter ....");
+
+        FileOutputStream fOut = null;
+        String inet6AddressOutputFilename = null;
+        inet6AddressOutputFilename = createOutputFileName(inet6Addr);
+        try {
+            fOut = new FileOutputStream(inet6AddressOutputFilename);
+        } catch (FileNotFoundException fnfEx) {
+
+            fnfEx.printStackTrace();
+        }
+        ObjectOutputStream ooStream = null;
+        try {
+            if (fOut != null) {
+                ooStream = new ObjectOutputStream(fOut);
+            } else {
+                System.err.println("Problem initilising Object output stream ");
+                System.exit(-1);
+            }
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.exit(-1);
+        }
+
+        // serialise the last Inet6Address
+        /*
+         * System.err
+         * .println("serializeInet6AddressToIPV6AddressFile scoped iface:  \n" +
+         * inet6Addr.getScopedInterface());
+         */
+        try {
+            ooStream.writeObject(inet6Addr);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        }
+
+        try {
+            ooStream.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static String createOutputFileName(Inet6Address inet6Addr) {
+        String inet6AddressOutputFilename;
+        if (inet6Addr.getScopedInterface() != null) {
+            inet6AddressOutputFilename = "IPV6Address_"
+                    + inet6Addr.getScopedInterface().getName() + ".out";
+        } else {
+            inet6AddressOutputFilename = "IPV6Address_"
+                    + Integer.valueOf(inet6Addr.getScopeId()).toString()
+                    + ".out";
+        }
+        return inet6AddressOutputFilename;
+    }
+
+    // --- Generated data ---
+    // JDK7 output java Inet6AddressSerializationTest generate.
+
+    // loopback lo0 interface on Solaris 10
+
+    static final byte[] JDK7Inet6AddressSerialData = { (byte) 0xAC,
+            (byte) 0xED, (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72,
+            (byte) 0x00, (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
+            (byte) 0x61, (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
+            (byte) 0x2E, (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
+            (byte) 0x36, (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72,
+            (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C,
+            (byte) 0x20, (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80,
+            (byte) 0x21, (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49,
+            (byte) 0x00, (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
+            (byte) 0x5A, (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63,
+            (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
+            (byte) 0x64, (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74,
+            (byte) 0x5A, (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63,
+            (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
+            (byte) 0x66, (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
+            (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C,
+            (byte) 0x00, (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E,
+            (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00,
+            (byte) 0x12, (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
+            (byte) 0x61, (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E,
+            (byte) 0x67, (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72,
+            (byte) 0x69, (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B,
+            (byte) 0x00, (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61,
+            (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
+            (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
+            (byte) 0x42, (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14,
+            (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E,
+            (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49,
+            (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64,
+            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+            (byte) 0x2D, (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F,
+            (byte) 0xE3, (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00,
+            (byte) 0x03, (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61,
+            (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
+            (byte) 0x73, (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66,
+            (byte) 0x61, (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79,
+            (byte) 0x4C, (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F,
+            (byte) 0x73, (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D,
+            (byte) 0x65, (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00,
+            (byte) 0x01, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x02, (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C,
+            (byte) 0x6F, (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68,
+            (byte) 0x6F, (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x70,
+            (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
+            (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8,
+            (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02,
+            (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
+
+    // JDK8 output java Inet6AddressSerializationTest generate.
+    // loopback lo0 interface on Solaris 10
+
+    static final byte[] JDK8Inet6AddressSerialData = { (byte) 0xAC,
+            (byte) 0xED, (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72,
+            (byte) 0x00, (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
+            (byte) 0x61, (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
+            (byte) 0x2E, (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74,
+            (byte) 0x36, (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72,
+            (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C,
+            (byte) 0x20, (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80,
+            (byte) 0x21, (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49,
+            (byte) 0x00, (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
+            (byte) 0x5A, (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63,
+            (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
+            (byte) 0x64, (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74,
+            (byte) 0x5A, (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63,
+            (byte) 0x6F, (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69,
+            (byte) 0x66, (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
+            (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C,
+            (byte) 0x00, (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E,
+            (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00,
+            (byte) 0x12, (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76,
+            (byte) 0x61, (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E,
+            (byte) 0x67, (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72,
+            (byte) 0x69, (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B,
+            (byte) 0x00, (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61,
+            (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
+            (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
+            (byte) 0x42, (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14,
+            (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E,
+            (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49,
+            (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64,
+            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+            (byte) 0x2D, (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F,
+            (byte) 0xE3, (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00,
+            (byte) 0x03, (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61,
+            (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73,
+            (byte) 0x73, (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66,
+            (byte) 0x61, (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79,
+            (byte) 0x4C, (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F,
+            (byte) 0x73, (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D,
+            (byte) 0x65, (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00,
+            (byte) 0x01, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x02, (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C,
+            (byte) 0x6F, (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68,
+            (byte) 0x6F, (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x70,
+            (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B,
+            (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8,
+            (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02,
+            (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
+
+    // java Inet6AddressSerializationTest generateAll produces this inet6address
+    // serial data
+    // jdk8 generated serialization of on address fe80:0:0:0:21b:24ff:febd:f29c
+    // net if e1000g0
+
+    static final byte[] SerialData_ifname_e1000g0 = { (byte) 0xAC, (byte) 0xED,
+            (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72, (byte) 0x00,
+            (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
+            (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E,
+            (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x36,
+            (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65,
+            (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C, (byte) 0x20,
+            (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80, (byte) 0x21,
+            (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49, (byte) 0x00,
+            (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F, (byte) 0x70,
+            (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64, (byte) 0x5A,
+            (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
+            (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x5A,
+            (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x66,
+            (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x5F,
+            (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C, (byte) 0x00,
+            (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E, (byte) 0x61,
+            (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00, (byte) 0x12,
+            (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
+            (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E, (byte) 0x67,
+            (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72, (byte) 0x69,
+            (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B, (byte) 0x00,
+            (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61, (byte) 0x64,
+            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+            (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
+            (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14, (byte) 0x6A,
+            (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E, (byte) 0x6E,
+            (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49, (byte) 0x6E,
+            (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64, (byte) 0x64,
+            (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x2D,
+            (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F, (byte) 0xE3,
+            (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00, (byte) 0x03,
+            (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61, (byte) 0x64,
+            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+            (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66, (byte) 0x61,
+            (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79, (byte) 0x4C,
+            (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F, (byte) 0x73,
+            (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
+            (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00, (byte) 0x01,
+            (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02,
+            (byte) 0x74, (byte) 0x00, (byte) 0x25, (byte) 0x66, (byte) 0x65,
+            (byte) 0x38, (byte) 0x30, (byte) 0x3A, (byte) 0x30, (byte) 0x3A,
+            (byte) 0x30, (byte) 0x3A, (byte) 0x30, (byte) 0x3A, (byte) 0x32,
+            (byte) 0x31, (byte) 0x62, (byte) 0x3A, (byte) 0x32, (byte) 0x34,
+            (byte) 0x66, (byte) 0x66, (byte) 0x3A, (byte) 0x66, (byte) 0x65,
+            (byte) 0x62, (byte) 0x64, (byte) 0x3A, (byte) 0x66, (byte) 0x32,
+            (byte) 0x39, (byte) 0x63, (byte) 0x25, (byte) 0x65, (byte) 0x31,
+            (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x67, (byte) 0x30,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x01,
+            (byte) 0x01, (byte) 0x74, (byte) 0x00, (byte) 0x07, (byte) 0x65,
+            (byte) 0x31, (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x67,
+            (byte) 0x30, (byte) 0x75, (byte) 0x72, (byte) 0x00, (byte) 0x02,
+            (byte) 0x5B, (byte) 0x42, (byte) 0xAC, (byte) 0xF3, (byte) 0x17,
+            (byte) 0xF8, (byte) 0x06, (byte) 0x08, (byte) 0x54, (byte) 0xE0,
+            (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x70,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0xFE,
+            (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x1B, (byte) 0x24,
+            (byte) 0xFF, (byte) 0xFE, (byte) 0xBD, (byte) 0xF2, (byte) 0x9C,
+            (byte) 0x78 };
+
+    // jdk8 generated serialization of address 0::1 on net if lo0 hostname
+    // localhost scope_id 1
+
+    static final byte[] SerialData_ifname_lo0 = { (byte) 0xAC, (byte) 0xED,
+            (byte) 0x00, (byte) 0x05, (byte) 0x73, (byte) 0x72, (byte) 0x00,
+            (byte) 0x15, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
+            (byte) 0x2E, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x2E,
+            (byte) 0x49, (byte) 0x6E, (byte) 0x65, (byte) 0x74, (byte) 0x36,
+            (byte) 0x41, (byte) 0x64, (byte) 0x64, (byte) 0x72, (byte) 0x65,
+            (byte) 0x73, (byte) 0x73, (byte) 0x5F, (byte) 0x7C, (byte) 0x20,
+            (byte) 0x81, (byte) 0x52, (byte) 0x2C, (byte) 0x80, (byte) 0x21,
+            (byte) 0x03, (byte) 0x00, (byte) 0x05, (byte) 0x49, (byte) 0x00,
+            (byte) 0x08, (byte) 0x73, (byte) 0x63, (byte) 0x6F, (byte) 0x70,
+            (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64, (byte) 0x5A,
+            (byte) 0x00, (byte) 0x0C, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x64,
+            (byte) 0x5F, (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x5A,
+            (byte) 0x00, (byte) 0x10, (byte) 0x73, (byte) 0x63, (byte) 0x6F,
+            (byte) 0x70, (byte) 0x65, (byte) 0x5F, (byte) 0x69, (byte) 0x66,
+            (byte) 0x6E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x5F,
+            (byte) 0x73, (byte) 0x65, (byte) 0x74, (byte) 0x4C, (byte) 0x00,
+            (byte) 0x06, (byte) 0x69, (byte) 0x66, (byte) 0x6E, (byte) 0x61,
+            (byte) 0x6D, (byte) 0x65, (byte) 0x74, (byte) 0x00, (byte) 0x12,
+            (byte) 0x4C, (byte) 0x6A, (byte) 0x61, (byte) 0x76, (byte) 0x61,
+            (byte) 0x2F, (byte) 0x6C, (byte) 0x61, (byte) 0x6E, (byte) 0x67,
+            (byte) 0x2F, (byte) 0x53, (byte) 0x74, (byte) 0x72, (byte) 0x69,
+            (byte) 0x6E, (byte) 0x67, (byte) 0x3B, (byte) 0x5B, (byte) 0x00,
+            (byte) 0x09, (byte) 0x69, (byte) 0x70, (byte) 0x61, (byte) 0x64,
+            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+            (byte) 0x74, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
+            (byte) 0x78, (byte) 0x72, (byte) 0x00, (byte) 0x14, (byte) 0x6A,
+            (byte) 0x61, (byte) 0x76, (byte) 0x61, (byte) 0x2E, (byte) 0x6E,
+            (byte) 0x65, (byte) 0x74, (byte) 0x2E, (byte) 0x49, (byte) 0x6E,
+            (byte) 0x65, (byte) 0x74, (byte) 0x41, (byte) 0x64, (byte) 0x64,
+            (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x2D,
+            (byte) 0x9B, (byte) 0x57, (byte) 0xAF, (byte) 0x9F, (byte) 0xE3,
+            (byte) 0xEB, (byte) 0xDB, (byte) 0x02, (byte) 0x00, (byte) 0x03,
+            (byte) 0x49, (byte) 0x00, (byte) 0x07, (byte) 0x61, (byte) 0x64,
+            (byte) 0x64, (byte) 0x72, (byte) 0x65, (byte) 0x73, (byte) 0x73,
+            (byte) 0x49, (byte) 0x00, (byte) 0x06, (byte) 0x66, (byte) 0x61,
+            (byte) 0x6D, (byte) 0x69, (byte) 0x6C, (byte) 0x79, (byte) 0x4C,
+            (byte) 0x00, (byte) 0x08, (byte) 0x68, (byte) 0x6F, (byte) 0x73,
+            (byte) 0x74, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65,
+            (byte) 0x71, (byte) 0x00, (byte) 0x7E, (byte) 0x00, (byte) 0x01,
+            (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02,
+            (byte) 0x74, (byte) 0x00, (byte) 0x09, (byte) 0x6C, (byte) 0x6F,
+            (byte) 0x63, (byte) 0x61, (byte) 0x6C, (byte) 0x68, (byte) 0x6F,
+            (byte) 0x73, (byte) 0x74, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x74, (byte) 0x00,
+            (byte) 0x03, (byte) 0x6C, (byte) 0x6F, (byte) 0x30, (byte) 0x75,
+            (byte) 0x72, (byte) 0x00, (byte) 0x02, (byte) 0x5B, (byte) 0x42,
+            (byte) 0xAC, (byte) 0xF3, (byte) 0x17, (byte) 0xF8, (byte) 0x06,
+            (byte) 0x08, (byte) 0x54, (byte) 0xE0, (byte) 0x02, (byte) 0x00,
+            (byte) 0x00, (byte) 0x78, (byte) 0x70, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x78 };
+
+}
+
+class MockLo0Inet6Address {
+
+    private static final byte[] LOOPBACKIPV6ADDRESS = { (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 };
+
+    private static final String LOCALHOSTNAME = "localhost";
+
+    private static final String LO0HOSTADDRESS = "0:0:0:0:0:0:0:1%lo0";
+
+    private static final String BARE_LO0HOSTADDRESS = "0:0:0:0:0:0:0:1";
+
+    private static final String LO0HOSTADDRESS_WITHINDEX = "0:0:0:0:0:0:0:1%1";
+
+    private static final int SCOPE_ID_LO0 = 1;
+
+    private static final int SCOPE_ID_ZERO = 0;
+
+    public static final String NETWORK_IF_LO0 = "lo0";
+
+    static String getHostName() {
+        return LOCALHOSTNAME;
+    }
+
+    static String getHostAddress() {
+        return LO0HOSTADDRESS;
+    }
+
+    static String getBareHostAddress() {
+        return BARE_LO0HOSTADDRESS;
+    }
+
+    static String getHostAddressWithIndex() {
+        return LO0HOSTADDRESS_WITHINDEX;
+    }
+
+    static byte[] getAddress() {
+        return LOOPBACKIPV6ADDRESS;
+    }
+
+    static int getScopeId() {
+        return SCOPE_ID_LO0;
+    }
+
+    static int getScopeZero() {
+        return SCOPE_ID_ZERO;
+    }
+
+    static String getScopeIfName() {
+        return NETWORK_IF_LO0;
+    }
+
+}
+
+class MockE1000g0Inet6Address {
+
+    // fe80::21b:24ff:febd:f29c
+    private static final byte[] E1000G0IPV6ADDRESS = { (byte) 0xfe,
+            (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x1b, (byte) 0x24,
+            (byte) 0xff, (byte) 0xfe, (byte) 0xbd, (byte) 0xf2, (byte) 0x9c };
+
+    private static final String E1000G0HOSTNAME = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
+
+    private static final String BARE_E1000G0HOSTADDRESS = "fe80:0:0:0:21b:24ff:febd:f29c";
+
+    private static final String E1000G0HOSTADDRESS_WITHINDEX = "fe80:0:0:0:21b:24ff:febd:f29c%2";
+
+    private static final String E1000G0HOSTADDRESS = "fe80:0:0:0:21b:24ff:febd:f29c%e1000g0";
+
+    private static final String NETWORK_IF_E1000G0 = "e1000g0";
+
+    private static final int SCOPE_ID_E1000G0 = 2;
+
+    private static final int SCOPE_ID_ZERO = 0;
+
+    static String getHostName() {
+        return E1000G0HOSTNAME;
+    }
+
+    static String getHostAddress() {
+        return E1000G0HOSTADDRESS;
+    }
+
+    static String getHostAddressWithIndex() {
+        return E1000G0HOSTADDRESS_WITHINDEX;
+    }
+
+    static String getBareHostAddress() {
+        return BARE_E1000G0HOSTADDRESS;
+    }
+
+    static byte[] getAddress() {
+        return E1000G0IPV6ADDRESS;
+    }
+
+    static int getScopeId() {
+        return SCOPE_ID_E1000G0;
+    }
+
+    static int getScopeZero() {
+        return SCOPE_ID_ZERO;
+    }
+
+    static String getScopeIfName() {
+        return NETWORK_IF_E1000G0;
+    }
+
+}
--- a/jdk/test/java/net/NetworkInterface/Test.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/net/NetworkInterface/Test.java	Wed May 08 10:10:05 2013 +0100
@@ -21,9 +21,9 @@
  * questions.
  */
 
-/* @test 01/02/14
- * @bug 4405354
- * @summary Exercise java.net.NetworkInterface
+/* @test
+ * @bug 4405354 6594296
+ * @summary Basic tests for NetworkInterface
  */
 import java.net.NetworkInterface;
 import java.net.InetAddress;
@@ -69,6 +69,12 @@
                 throw new Exception("hashCode contract broken");
             }
             System.out.println("hashCode() test passed.");
+
+            byte[] ba = ni.getHardwareAddress();
+            if (ba != null && ba.length == 0) {
+                throw new Exception("getHardwareAddress returned 0 length byte array");
+            }
+            System.out.println("getHardwareAddress() test passed.");
         }
 
         // misc tests :-
--- a/jdk/test/java/nio/file/Files/walkFileTree/CreateFileTree.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/nio/file/Files/walkFileTree/CreateFileTree.java	Wed May 08 10:10:05 2013 +0100
@@ -32,9 +32,23 @@
 
 public class CreateFileTree {
 
-    static final Random rand = new Random();
+    private static final Random rand = new Random();
 
-    public static void main(String[] args) throws IOException {
+    private static boolean supportsLinks(Path dir) {
+        Path link = dir.resolve("testlink");
+        Path target = dir.resolve("testtarget");
+        try {
+            Files.createSymbolicLink(link, target);
+            Files.delete(link);
+            return true;
+        } catch (UnsupportedOperationException x) {
+            return false;
+        } catch (IOException x) {
+            return false;
+        }
+    }
+
+    static Path create() throws IOException {
         Path top = Files.createTempDirectory("tree");
         List<Path> dirs = new ArrayList<Path>();
 
@@ -53,7 +67,6 @@
                 dirs.add(subdir);
             }
         }
-        assert dirs.size() >= 2;
 
         // create a few regular files in the file tree
         int files = dirs.size() * 3;
@@ -64,20 +77,26 @@
         }
 
         // create a few sym links in the file tree so as to create cycles
-        int links = 1 + rand.nextInt(5);
-        for (int i=0; i<links; i++) {
-            int x = rand.nextInt(dirs.size());
-            int y;
-            do {
-                y = rand.nextInt(dirs.size());
-            } while (y != x);
-            String name = "link" + (i+1);
-            Path link = dirs.get(x).resolve(name);
-            Path target = dirs.get(y);
-            Files.createSymbolicLink(link, target);
+        if (supportsLinks(top)) {
+            int links = 1 + rand.nextInt(5);
+            for (int i=0; i<links; i++) {
+                int x = rand.nextInt(dirs.size());
+                int y;
+                do {
+                    y = rand.nextInt(dirs.size());
+                } while (y != x);
+                String name = "link" + (i+1);
+                Path link = dirs.get(x).resolve(name);
+                Path target = dirs.get(y);
+                Files.createSymbolicLink(link, target);
+            }
         }
 
-        // done
+         return top;
+    }
+
+    public static void main(String[] args) throws IOException {
+        Path top = create();
         System.out.println(top);
     }
 }
--- a/jdk/test/java/nio/file/Files/walkFileTree/MaxDepth.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/nio/file/Files/walkFileTree/MaxDepth.java	Wed May 08 10:10:05 2013 +0100
@@ -21,19 +21,30 @@
  * questions.
  */
 
+/*
+ * @test
+ * @summary Unit test for Files.walkFileTree to test maxDepth parameter
+ * @library ../..
+ * @compile MaxDepth.java CreateFileTree.java
+ * @run main MaxDepth
+ */
+
 import java.nio.file.*;
 import java.nio.file.attribute.*;
 import java.io.IOException;
 import java.util.*;
 
-/**
- * Unit test for Files.walkFileTree to test maxDepth parameter
- */
+public class MaxDepth {
+    public static void main(String[] args) throws IOException {
+        Path top = CreateFileTree.create();
+        try {
+            test(top);
+        } finally {
+            TestUtil.removeAll(top);
+        }
+    }
 
-public class MaxDepth {
-    public static void main(String[] args) throws Exception {
-        final Path top = Paths.get(args[0]);
-
+    static void test(final Path top) throws IOException {
         for (int i=0; i<5; i++) {
             Set<FileVisitOption> opts = Collections.emptySet();
             final int maxDepth = i;
--- a/jdk/test/java/nio/file/Files/walkFileTree/SkipSiblings.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/nio/file/Files/walkFileTree/SkipSiblings.java	Wed May 08 10:10:05 2013 +0100
@@ -21,15 +21,19 @@
  * questions.
  */
 
+/*
+ * @test
+ * @summary Unit test for Files.walkFileTree to test SKIP_SIBLINGS return value
+ * @library ../..
+ * @compile SkipSiblings.java CreateFileTree.java
+ * @run main SkipSiblings
+ */
+
 import java.nio.file.*;
 import java.nio.file.attribute.*;
 import java.io.IOException;
 import java.util.*;
 
-/**
- * Unit test for Files.walkFileTree to test SKIP_SIBLINGS return value.
- */
-
 public class SkipSiblings {
 
     static final Random rand = new Random();
@@ -52,9 +56,16 @@
     }
 
     public static void main(String[] args) throws Exception {
-        Path dir = Paths.get(args[0]);
+        Path top = CreateFileTree.create();
+        try {
+            test(top);
+        } finally {
+            TestUtil.removeAll(top);
+        }
+    }
 
-        Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+    static void test(final Path start) throws IOException {
+        Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
             @Override
             public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
                 check(dir);
@@ -74,7 +85,11 @@
                 if (x != null)
                     throw new RuntimeException(x);
                 check(dir);
-                return FileVisitResult.CONTINUE;
+                if (rand.nextBoolean()) {
+                    return FileVisitResult.CONTINUE;
+                } else {
+                    return FileVisitResult.SKIP_SIBLINGS;
+                }
             }
         });
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/file/Files/walkFileTree/SkipSubtree.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Unit test for Files.walkFileTree to test SKIP_SUBTREE return value
+ * @library ../..
+ * @compile SkipSubtree.java CreateFileTree.java
+ * @run main SkipSubtree
+ */
+import java.nio.file.*;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+public class SkipSubtree {
+
+    static final Random rand = new Random();
+    static final Set<Path> skipped = new HashSet<>();
+
+    // check if this path should have been skipped
+    static void check(Path path) {
+        do {
+            if (skipped.contains(path))
+                throw new RuntimeException(path + " should not have been visited");
+            path = path.getParent();
+        } while (path != null);
+    }
+
+    // indicates if the subtree should be skipped
+    static boolean skip(Path path) {
+        if (rand.nextInt(3) == 0) {
+            skipped.add(path);
+            return true;
+        }
+        return false;
+    }
+
+    public static void main(String[] args) throws Exception {
+        Path top = CreateFileTree.create();
+        try {
+            test(top);
+        } finally {
+            TestUtil.removeAll(top);
+        }
+    }
+
+    static void test(final Path start) throws IOException {
+        Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+                check(dir);
+                if (skip(dir))
+                    return FileVisitResult.SKIP_SUBTREE;
+                return FileVisitResult.CONTINUE;
+            }
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+                check(file);
+                return FileVisitResult.CONTINUE;
+            }
+            @Override
+            public FileVisitResult postVisitDirectory(Path dir, IOException x) {
+                if (x != null)
+                    throw new RuntimeException(x);
+                check(dir);
+                return FileVisitResult.CONTINUE;
+            }
+        });
+    }
+}
--- a/jdk/test/java/nio/file/Files/walkFileTree/TerminateWalk.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/nio/file/Files/walkFileTree/TerminateWalk.java	Wed May 08 10:10:05 2013 +0100
@@ -21,15 +21,19 @@
  * questions.
  */
 
+/*
+ * @test
+ * @summary Unit test for Files.walkFileTree to test TERMINATE return value
+ * @library ../..
+ * @compile TerminateWalk.java CreateFileTree.java
+ * @run main TerminateWalk
+ */
+
 import java.nio.file.*;
 import java.nio.file.attribute.*;
 import java.io.IOException;
 import java.util.*;
 
-/**
- * Unit test for Files.walkFileTree to test TERMINATE return value
- */
-
 public class TerminateWalk {
 
     static final Random rand = new Random();
@@ -47,9 +51,16 @@
     }
 
     public static void main(String[] args) throws Exception {
-        Path dir = Paths.get(args[0]);
+        Path top = CreateFileTree.create();
+        try {
+            test(top);
+        } finally {
+            TestUtil.removeAll(top);
+        }
+    }
 
-        Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+    static void test(Path start) throws IOException {
+        Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
             @Override
             public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
                 return maybeTerminate();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/file/Files/walkFileTree/find.sh	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,86 @@
+#
+# 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
+# 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 4313887 6907737
+# @summary Tests that walkFileTree is consistent with the native find program
+# @build CreateFileTree PrintFileTree
+# @run shell find.sh
+
+# if TESTJAVA isn't set then we assume an interactive run.
+
+if [ -z "$TESTJAVA" ]; then
+    TESTSRC=.
+    TESTCLASSES=.
+    JAVA=java
+else
+    JAVA="${TESTJAVA}/bin/java"
+fi
+
+OS=`uname -s`
+case "$OS" in
+    Windows_* | CYGWIN* )
+        echo "This test does not run on Windows" 
+        exit 0
+        ;;
+    * )
+        CLASSPATH=${TESTCLASSES}:${TESTSRC}
+        ;;
+esac
+export CLASSPATH
+
+# create the file tree
+ROOT=`$JAVA CreateFileTree`
+if [ $? != 0 ]; then exit 1; fi
+
+failures=0
+
+# print the file tree and compare output with find(1)
+$JAVA ${TESTVMOPTS} PrintFileTree "$ROOT" > out1
+find "$ROOT" > out2
+diff out1 out2
+if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
+
+# repeat test following links. Some versions of find(1) output
+# cycles (sym links to ancestor directories), other versions do
+# not. For that reason we run PrintFileTree with the -printCycles
+# option when the output without this option differs to find(1).
+find "$ROOT" -follow > out1
+$JAVA ${TESTVMOPTS} PrintFileTree -follow "$ROOT" > out2
+diff out1 out2
+if [ $? != 0 ];
+  then 
+    # re-run printing cycles to stdout
+    $JAVA ${TESTVMOPTS} PrintFileTree -follow -printCycles "$ROOT" > out2
+    diff out1 out2
+    if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
+  fi
+
+# clean-up
+rm -r "$ROOT"
+
+echo ''
+if [ $failures -gt 0 ];
+  then echo "$failures test(s) failed";
+  else echo "Test passed"; fi
+exit $failures
--- a/jdk/test/java/nio/file/Files/walkFileTree/walk_file_tree.sh	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-#
-# 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
-# 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 4313887 6907737
-# @summary Unit test for walkFileTree method
-# @build CreateFileTree PrintFileTree SkipSiblings TerminateWalk MaxDepth
-# @run shell walk_file_tree.sh
-
-# if TESTJAVA isn't set then we assume an interactive run.
-
-if [ -z "$TESTJAVA" ]; then
-    TESTSRC=.
-    TESTCLASSES=.
-    JAVA=java
-else
-    JAVA="${TESTJAVA}/bin/java"
-fi
-
-OS=`uname -s`
-case "$OS" in
-    Windows_* | CYGWIN* )
-        echo "This test does not run on Windows" 
-        exit 0
-        ;;
-    * )
-        CLASSPATH=${TESTCLASSES}:${TESTSRC}
-        ;;
-esac
-export CLASSPATH
-
-# create the file tree
-ROOT=`$JAVA CreateFileTree`
-if [ $? != 0 ]; then exit 1; fi
-
-failures=0
-
-# print the file tree and compare output with find(1)
-$JAVA ${TESTVMOPTS} PrintFileTree "$ROOT" > out1
-find "$ROOT" > out2
-diff out1 out2
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# repeat test following links. Some versions of find(1) output
-# cycles (sym links to ancestor directories), other versions do
-# not. For that reason we run PrintFileTree with the -printCycles
-# option when the output without this option differs to find(1).
-find "$ROOT" -follow > out1
-$JAVA ${TESTVMOPTS} PrintFileTree -follow "$ROOT" > out2
-diff out1 out2
-if [ $? != 0 ];
-  then 
-    # re-run printing cycles to stdout
-    $JAVA ${TESTVMOPTS} PrintFileTree -follow -printCycles "$ROOT" > out2
-    diff out1 out2
-    if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-  fi
-
-# test SKIP_SIBLINGS
-$JAVA ${TESTVMOPTS} SkipSiblings "$ROOT"
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# test TERMINATE
-$JAVA ${TESTVMOPTS} TerminateWalk "$ROOT"
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# test maxDepth
-$JAVA ${TESTVMOPTS} MaxDepth "$ROOT"
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# clean-up
-rm -r "$ROOT"
-
-echo ''
-if [ $failures -gt 0 ];
-  then echo "$failures test(s) failed";
-  else echo "Test passed"; fi
-exit $failures
--- a/jdk/test/java/nio/file/attribute/BasicFileAttributeView/Basic.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/nio/file/attribute/BasicFileAttributeView/Basic.java	Wed May 08 10:10:05 2013 +0100
@@ -70,22 +70,16 @@
         check(f.lastModified()/1000 == attrs.lastModifiedTime().to(TimeUnit.SECONDS),
               "last-modified time should be the same");
 
-        // copy last-modified time and file create time from directory to file,
+        // copy last-modified time from directory to file,
         // re-read attribtues, and check they match
         BasicFileAttributeView view =
             Files.getFileAttributeView(file, BasicFileAttributeView.class);
         BasicFileAttributes dirAttrs = Files.readAttributes(dir, BasicFileAttributes.class);
         view.setTimes(dirAttrs.lastModifiedTime(), null, null);
-        if (dirAttrs.creationTime() != null) {
-            view.setTimes(null, null, dirAttrs.creationTime());
-        }
+
         attrs = view.readAttributes();
         check(attrs.lastModifiedTime().equals(dirAttrs.lastModifiedTime()),
             "last-modified time should be equal");
-        if (dirAttrs.creationTime() != null) {
-            check(attrs.creationTime().equals(dirAttrs.creationTime()),
-                "create time should be the same");
-        }
 
         // security tests
         check (!(attrs instanceof PosixFileAttributes),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8011536
+ * @summary Basic test for creationTime attribute on platforms/file systems
+ *     that support it.
+ * @library ../..
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Files;
+import java.nio.file.attribute.*;
+import java.time.Instant;
+import java.io.IOException;
+
+public class CreationTime {
+
+    private static final java.io.PrintStream err = System.err;
+
+    /**
+     * Reads the creationTime attribute
+     */
+    private static FileTime creationTime(Path file) throws IOException {
+        return Files.readAttributes(file, BasicFileAttributes.class).creationTime();
+    }
+
+    /**
+     * Sets the creationTime attribute
+     */
+    private static void setCreationTime(Path file, FileTime time) throws IOException {
+        BasicFileAttributeView view =
+            Files.getFileAttributeView(file, BasicFileAttributeView.class);
+        view.setTimes(null, null, time);
+    }
+
+    static void test(Path top) throws IOException {
+        Path file = Files.createFile(top.resolve("foo"));
+
+        /**
+         * Check that creationTime reported
+         */
+        FileTime creationTime = creationTime(file);
+        Instant now = Instant.now();
+        if (Math.abs(creationTime.toMillis()-now.toEpochMilli()) > 10000L) {
+            err.println("File creation time reported as: " + creationTime);
+            throw new RuntimeException("Expected to be close to: " + now);
+        }
+
+        /**
+         * Is the creationTime attribute supported here?
+         */
+        boolean supportsCreationTimeRead = false;
+        boolean supportsCreationTimeWrite = false;
+        String os = System.getProperty("os.name");
+        if (os.contains("OS X") && Files.getFileStore(file).type().equals("hfs")) {
+            supportsCreationTimeRead = true;
+        } else if (os.startsWith("Windows")) {
+            String type = Files.getFileStore(file).type();
+            if (type.equals("NTFS") || type.equals("FAT")) {
+                supportsCreationTimeRead = true;
+                supportsCreationTimeWrite = true;
+            }
+        }
+
+        /**
+         * If the creation-time attribute is supported then change the file's
+         * last modified and check that it doesn't change the creation-time.
+         */
+        if (supportsCreationTimeRead) {
+            // change modified time by +1 hour
+            Instant plusHour = Instant.now().plusSeconds(60L * 60L);
+            Files.setLastModifiedTime(file, FileTime.from(plusHour));
+            FileTime current = creationTime(file);
+            if (!current.equals(creationTime))
+                throw new RuntimeException("Creation time should not have changed");
+        }
+
+        /**
+         * If the creation-time attribute is supported and can be changed then
+         * check that the change is effective.
+         */
+        if (supportsCreationTimeWrite) {
+            // change creation time by -1 hour
+            Instant minusHour = Instant.now().minusSeconds(60L * 60L);
+            creationTime = FileTime.from(minusHour);
+            setCreationTime(file, creationTime);
+            FileTime current = creationTime(file);
+            if (Math.abs(creationTime.toMillis()-current.toMillis()) > 1000L)
+                throw new RuntimeException("Creation time not changed");
+        }
+    }
+
+    public static void main(String[] args) throws IOException {
+        // create temporary directory to run tests
+        Path dir = TestUtil.createTemporaryDirectory();
+        try {
+            test(dir);
+        } finally {
+            TestUtil.removeAll(dir);
+        }
+    }
+}
--- a/jdk/test/java/text/Format/DateFormat/Bug7130335.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/text/Format/DateFormat/Bug7130335.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,34 +23,47 @@
 
 /**
  * @test
- * @bug 7130335
+ * @bug 7130335 7130335
  * @summary Make sure that round-trip conversion (format/parse) works
- *          with old timestamps in Europe/Moscow.
+ *          with old timestamps in Europe/Moscow and with multiple time zone letters.
  */
 import java.text.*;
 import java.util.*;
+import static java.util.GregorianCalendar.*;
 
 public class Bug7130335 {
     private static final TimeZone MOSCOW = TimeZone.getTimeZone("Europe/Moscow");
+    private static final TimeZone LONDON = TimeZone.getTimeZone("Europe/London");
+    private static final TimeZone LA = TimeZone.getTimeZone("America/Los_Angeles");
+    private static final TimeZone[] ZONES = {
+        MOSCOW, LONDON, LA
+    };
 
     public static void main(String[] args) throws Exception {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z", Locale.US);
         sdf.setTimeZone(MOSCOW);
-        Calendar cal = new GregorianCalendar(MOSCOW);
+        Calendar cal = new GregorianCalendar(MOSCOW, Locale.US);
         cal.clear();
         // Try both +03:00 and +02:00
-        cal.set(1922, Calendar.SEPTEMBER, 30);
+        cal.set(1922, SEPTEMBER, 30);
         test(sdf, cal);
-        cal.add(Calendar.DAY_OF_YEAR, 1);
+        cal.add(DAY_OF_YEAR, 1);
         test(sdf, cal);
-        cal.set(1991, Calendar.MARCH, 31);
+        cal.set(1991, MARCH, 31);
         // in daylight saving time
         test(sdf, cal);
-        cal.add(Calendar.DAY_OF_YEAR, 1);
+        cal.add(DAY_OF_YEAR, 1);
         test(sdf, cal);
         // Try the current timestamp
         cal.setTimeInMillis(System.currentTimeMillis());
         test(sdf, cal);
+
+        // tests for multiple time zone letters (8000529)
+        test8000529("yyyy-MM-dd HH:mm:ss.SSS Z (z)");
+        test8000529("yyyy-MM-dd HH:mm:ss.SSS Z (zzzz)");
+        test8000529("yyyy-MM-dd HH:mm:ss.SSS z (Z)");
+        test8000529("yyyy-MM-dd HH:mm:ss.SSS zzzz (Z)");
+
     }
 
     private static void test(SimpleDateFormat sdf, Calendar cal) throws Exception {
@@ -63,4 +76,19 @@
             throw new RuntimeException("format: " + f + ", parse: " + p);
         }
     }
+
+    private static void test8000529(String fmt) throws Exception {
+        for (TimeZone tz : ZONES) {
+            SimpleDateFormat sdf = new SimpleDateFormat(fmt, Locale.US);
+            sdf.setTimeZone(tz);
+            Calendar cal = new GregorianCalendar(tz, Locale.US);
+            cal.clear();
+            cal.set(2012, JUNE, 22);
+            test(sdf, cal);
+            cal.set(2012, DECEMBER, 22);
+            test(sdf, cal);
+            cal.setTimeInMillis(System.currentTimeMillis());
+            test(sdf, cal);
+        }
+    }
 }
--- a/jdk/test/java/time/TEST.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/time/TEST.properties	Wed May 08 10:10:05 2013 +0100
@@ -1,3 +1,3 @@
 # Threeten test uses TestNG
 TestNG.dirs = .
-
+othervm.dirs = tck/java/time/chrono test/java/time/chrono test/java/time/format
--- a/jdk/test/java/time/test/java/util/TestFormatter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/time/test/java/util/TestFormatter.java	Wed May 08 10:10:05 2013 +0100
@@ -25,6 +25,7 @@
 import java.time.Instant;
 import java.time.OffsetDateTime;
 import java.time.ZonedDateTime;
+import java.time.ZoneId;
 import java.time.temporal.ChronoField;
 
 import java.util.*;
@@ -34,6 +35,7 @@
 
 /* @test
  * @summary Unit test for j.u.Formatter threeten date/time support
+ * @bug 8003680 8012638
  */
 @Test
 public class TestFormatter {
@@ -64,25 +66,33 @@
         //locales = Locale.getAvailableLocales();
         Locale[] locales = new Locale[] {
            Locale.ENGLISH, Locale.FRENCH, Locale.JAPANESE, Locale.CHINESE};
-
         Random r = new Random();
-        ZonedDateTime  zdt = ZonedDateTime.now();
-        while (N-- > 0) {
-            zdt = zdt.withDayOfYear(r.nextInt(365) + 1)
-                     .with(ChronoField.SECOND_OF_DAY, r.nextInt(86400));
-            Instant instant = zdt.toInstant();
-            Calendar cal = Calendar.getInstance();
-            cal.setTimeInMillis(instant.toEpochMilli());
+        ZonedDateTime  zdt0 = ZonedDateTime.now();
+        ZonedDateTime[] zdts = new ZonedDateTime[] {
+            zdt0,
+            zdt0.withZoneSameLocal(ZoneId.of("UTC")),
+            zdt0.withZoneSameLocal(ZoneId.of("GMT")),
+            zdt0.withZoneSameLocal(ZoneId.of("UT")),
+        };
 
-            for (Locale locale : locales) {
+        while (N-- > 0) {
+            for (ZonedDateTime zdt : zdts) {
+                zdt = zdt.withDayOfYear(r.nextInt(365) + 1)
+                         .with(ChronoField.SECOND_OF_DAY, r.nextInt(86400));
+                Instant instant = zdt.toInstant();
+                Calendar cal = Calendar.getInstance();
+                cal.setTimeInMillis(instant.toEpochMilli());
+                cal.setTimeZone(TimeZone.getTimeZone(zdt.getZone()));
+                for (Locale locale : locales) {
                     for (String fmtStr : fmtStrDate) {
-                    testDate(fmtStr, locale, zdt, cal);
+                        testDate(fmtStr, locale, zdt, cal);
+                    }
+                    for (String fmtStr : fmtStrTime) {
+                        testTime(fmtStr, locale, zdt, cal);
+                    }
+                    testZoneId(locale, zdt, cal);
+                    testInstant(locale, instant, zdt, cal);
                 }
-                for (String fmtStr : fmtStrTime) {
-                    testTime(fmtStr, locale, zdt, cal);
-                }
-                testZoneId(locale, zdt, cal);
-                testInstant(locale, instant, zdt, cal);
             }
         }
         if (verbose) {
@@ -146,6 +156,10 @@
     }
 
     private String toZoneIdStr(String expected) {
+        return expected.replaceAll("(?:GMT|UTC)(?<off>[+\\-]?[0-9]{2}:[0-9]{2})", "${off}");
+    }
+
+    private String toZoneOffsetStr(String expected) {
         return expected.replaceAll("(?:GMT|UTC)(?<off>[+\\-]?[0-9]{2}:[0-9]{2})", "${off}")
                        .replaceAll("GMT|UTC|UT", "Z");
     }
@@ -159,7 +173,7 @@
         Calendar cal0 = Calendar.getInstance();
         cal0.setTimeInMillis(zdt.toInstant().toEpochMilli());
         cal0.setTimeZone(TimeZone.getTimeZone("GMT" + zdt.getOffset().getId()));
-        expected = toZoneIdStr(test(fmtStr, locale, null, cal0));
+        expected = toZoneOffsetStr(test(fmtStr, locale, null, cal0));
         test(fmtStr, locale, expected, zdt.toOffsetDateTime());
         test(fmtStr, locale, expected, zdt.toOffsetDateTime().toOffsetTime());
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Arrays/SetAllTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8012650
+ * @summary Unit test for setAll, parallelSetAll variants
+ * @run testng SetAllTest
+ */
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.function.IntFunction;
+import java.util.function.IntToDoubleFunction;
+import java.util.function.IntToLongFunction;
+import java.util.function.IntUnaryOperator;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertSame;
+import static org.testng.Assert.fail;
+
+@Test
+public class SetAllTest {
+    private static final IntFunction<String> toString = i -> "N" + Integer.valueOf(i);
+    private static final IntFunction<String> fillString = i -> "X";
+    private static final String[] r0 = {};
+    private static final String[] r1 = { "N0" };
+    private static final String[] r10 = { "N0", "N1", "N2", "N3", "N4", "N5", "N6", "N7", "N8", "N9" };
+
+    private Object[][] stringData = new Object[][] {
+        { "empty", 0, toString, r0 },
+        { "one", 1, toString, r1 },
+        { "ten", 10, toString, r10 },
+        { "fill", 3, fillString, new String[] { "X", "X", "X" }}
+    };
+
+    private static final IntUnaryOperator toInt = i -> i << 1;
+    private static final IntUnaryOperator fillInt = i -> 99;
+    private static final int[] ir0 = {};
+    private static final int[] ir1 = { 0 };
+    private static final int[] ir10 = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 };
+    private Object[][] intData = new Object[][] {
+        { "empty", 0, toInt, ir0 },
+        { "one", 1, toInt, ir1 },
+        { "ten", 10, toInt, ir10 },
+        { "fill", 3, fillInt, new int[] { 99, 99, 99 }}
+    };
+
+    private static final IntToLongFunction toLong = i -> i << 1;
+    private static final IntToLongFunction fillLong = i -> 9999L;
+    private static final long[] lr0 = {};
+    private static final long[] lr1 = { 0L };
+    private static final long[] lr10 = { 0L, 2L, 4L, 6L, 8L, 10L, 12L, 14L, 16L, 18L };
+    private Object[][] longData = new Object[][] {
+        { "empty", 0, toLong, lr0 },
+        { "one", 1, toLong, lr1 },
+        { "ten", 10, toLong, lr10 },
+        { "fill", 3, fillLong, new long[] { 9999L, 9999L, 9999L }}
+    };
+
+    private static final IntToDoubleFunction toDouble = i -> i * 1.1;
+    private static final IntToDoubleFunction fillDouble = i -> 3.14;
+    private static final double[] dr0 = {};
+    private static final double[] dr1 = { 0.0 };
+    private static final double[] dr10 = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9 };
+    private Object[][] doubleData = new Object[][] {
+        { "empty", 0, toDouble, dr0 },
+        { "one", 1, toDouble, dr1 },
+        { "ten", 10, toDouble, dr10 },
+        { "fill", 3, fillDouble, new double[] { 3.14, 3.14, 3.14 }}
+    };
+
+    @DataProvider(name="string")
+    public Object[][] stringTests() { return stringData; }
+
+    @DataProvider(name="int")
+    public Object[][] intTests() { return intData; }
+
+    @DataProvider(name="long")
+    public Object[][] longTests() { return longData; }
+
+    @DataProvider(name="double")
+    public Object[][] doubleTests() { return doubleData; }
+
+    @Test(dataProvider = "string")
+    public void testSetAllString(String name, int size, IntFunction<String> generator, String[] expected) {
+        String[] result = new String[size];
+        Arrays.setAll(result, generator);
+        assertEquals(result, expected, "setAll(String[], IntFunction<String>) case " + name + " failed.");
+
+        // ensure fresh array
+        result = new String[size];
+        Arrays.parallelSetAll(result, generator);
+        assertEquals(result, expected, "parallelSetAll(String[], IntFunction<String>) case " + name + " failed.");
+    }
+
+    @Test(dataProvider = "int")
+    public void testSetAllInt(String name, int size, IntUnaryOperator generator, int[] expected) {
+        int[] result = new int[size];
+        Arrays.setAll(result, generator);
+        assertEquals(result, expected, "setAll(int[], IntUnaryOperator) case " + name + " failed.");
+
+        // ensure fresh array
+        result = new int[size];
+        Arrays.parallelSetAll(result, generator);
+        assertEquals(result, expected, "parallelSetAll(int[], IntUnaryOperator) case " + name + " failed.");
+    }
+
+    @Test(dataProvider = "long")
+    public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) {
+        long[] result = new long[size];
+        Arrays.setAll(result, generator);
+        assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed.");
+
+        // ensure fresh array
+        result = new long[size];
+        Arrays.parallelSetAll(result, generator);
+        assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed.");
+    }
+
+    private void assertDoubleArrayEquals(double[] actual, double[] expected, double delta, String msg) {
+        if (actual.length != expected.length) {
+            fail(msg + ": length mismatch, expected " + expected.length + ", got " + actual.length);
+        }
+
+        for (int i = 0; i < actual.length; i++) {
+            assertEquals(actual[i], expected[i], delta, msg + "(mismatch at index " + i + ")");
+        }
+    }
+
+    @Test(dataProvider = "double")
+    public void testSetAllDouble(String name, int size, IntToDoubleFunction generator, double[] expected) {
+        double[] result = new double[size];
+        Arrays.setAll(result, generator);
+        assertDoubleArrayEquals(result, expected, 0.05, "setAll(double[], IntToDoubleFunction) case " + name + " failed.");
+
+        // ensure fresh array
+        result = new double[size];
+        Arrays.parallelSetAll(result, generator);
+        assertDoubleArrayEquals(result, expected, 0.05, "setAll(double[], IntToDoubleFunction) case " + name + " failed.");
+    }
+
+    @Test
+    public void testStringSetNulls() {
+        String[] ar = new String[2];
+        try {
+            Arrays.setAll(null, i -> "X");
+            fail("Arrays.setAll(null, foo) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.parallelSetAll(null, i -> "X");
+            fail("Arrays.parallelSetAll(null, foo) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.setAll(ar, null);
+            fail("Arrays.setAll(array, null) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.parallelSetAll(ar, null);
+            fail("Arrays.parallelSetAll(array, null) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testIntSetNulls() {
+        int[] ar = new int[2];
+        try {
+            Arrays.setAll(null, (IntUnaryOperator) i -> i);
+            fail("Arrays.setAll(null, foo) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.parallelSetAll(null, (IntUnaryOperator) i -> i);
+            fail("Arrays.parallelSetAll(null, foo) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.setAll(ar, null);
+            fail("Arrays.setAll(array, null) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.parallelSetAll(ar, null);
+            fail("Arrays.parallelSetAll(array, null) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testLongSetNulls() {
+        long[] ar = new long[2];
+        try {
+            Arrays.setAll(null, (IntToLongFunction) i -> Long.MAX_VALUE);
+            fail("Arrays.setAll(null, foo) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.parallelSetAll(null, (IntToLongFunction) i -> Long.MAX_VALUE);
+            fail("Arrays.parallelSetAll(null, foo) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.setAll(ar, null);
+            fail("Arrays.setAll(array, null) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.parallelSetAll(ar, null);
+            fail("Arrays.parallelSetAll(array, null) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testDoubleSetNulls() {
+        double[] ar = new double[2];
+        try {
+            Arrays.setAll(null, (IntToDoubleFunction) i -> Math.E);
+            fail("Arrays.setAll(null, foo) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.parallelSetAll(null, (IntToDoubleFunction) i -> Math.E);
+            fail("Arrays.parallelSetAll(null, foo) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.setAll(ar, null);
+            fail("Arrays.setAll(array, null) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+        try {
+            Arrays.parallelSetAll(ar, null);
+            fail("Arrays.parallelSetAll(array, null) should throw NPE");
+        } catch (NullPointerException npe) {
+            // expected
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Base64/Base64GetEncoderTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+import java.util.Base64;
+
+import static java.nio.charset.StandardCharsets.US_ASCII;
+
+/**
+ * @test
+ * @bug 8007799
+ * @summary test Encoder with linemax == 0, line separator should not appear in encoded data
+ */
+
+public class Base64GetEncoderTest {
+
+    public static void main(String args[]) throws Throwable {
+        final Base64.Encoder encoder = Base64.getEncoder(0, "$$$".getBytes(US_ASCII));
+
+        testEncodeToString(encoder);
+
+        testWrapEncode1(encoder);
+
+        testEncodeToStringWithLongInputData(encoder);
+
+        testWrapEncode2(encoder);
+
+        testEncodeWithByteBuffer(encoder);
+
+    }
+
+    private static void testEncodeWithByteBuffer(final Base64.Encoder encoder) {
+        System.err.println("\n\nEncoder.encode with ByteBuffer test  ");
+        final byte[] secondTestBuffer =
+                "api/java_util/Base64/index.html#GetEncoderMimeCustom[noLineSeparatorInEncodedString]"
+                .getBytes(US_ASCII);
+        String base64EncodedString;
+        ByteBuffer srcData = ByteBuffer.wrap(secondTestBuffer);
+        ByteBuffer dstData = ByteBuffer.allocate(secondTestBuffer.length * 2);
+
+        encoder.encode(srcData, dstData, 0);
+        dstData.flip();
+        if (dstData.hasArray()) {
+            System.err.println("\nByteBuffer test dstData is Base64 encoding = "
+                    + new String(dstData.array(), US_ASCII) + "\n");
+        }
+
+        base64EncodedString = new String(dstData.array(), US_ASCII);
+        if (base64EncodedString.contains("$$$")) {
+            throw new RuntimeException("Base64 encoding contains line separator after Encoder.encode ByteBuffer ... \n");
+        }
+    }
+
+    private static void testWrapEncode2(final Base64.Encoder encoder)
+            throws IOException {
+        System.err.println("\nEncoder.wrap test II ");
+        final byte[] secondTestBuffer =
+                "api/java_util/Base64/index.html#GetEncoderMimeCustom[noLineSeparatorInEncodedString]"
+                .getBytes(US_ASCII);
+        String base64EncodedString;
+        ByteArrayOutputStream secondEncodingStream = new ByteArrayOutputStream();
+        OutputStream base64EncodingStream = encoder.wrap(secondEncodingStream);
+        base64EncodingStream.write(secondTestBuffer);
+        base64EncodingStream.close();
+
+        final byte[] encodedByteArray = secondEncodingStream.toByteArray();
+
+        System.err.print("result = " + new String(encodedByteArray, US_ASCII)
+                + "  after wrap Base64 encoding of string");
+
+        base64EncodedString = new String(encodedByteArray, US_ASCII);
+
+        if (base64EncodedString.contains("$$$")) {
+            throw new RuntimeException(
+                    "Base64 encoding contains line separator after wrap 2 invoked  ... \n");
+        }
+    }
+
+    private static void testEncodeToStringWithLongInputData(
+            final Base64.Encoder encoder) {
+        System.err.println("\n\nEncoder.encodeToStringWithLongInputData test  ");
+
+        final byte[] secondTestBuffer =
+                "api/java_util/Base64/index.html#GetEncoderMimeCustom[noLineSeparatorInEncodedString]"
+                .getBytes(US_ASCII);
+        String base64EncodedString;
+        base64EncodedString = encoder.encodeToString(secondTestBuffer);
+
+        System.err.println("Second Base64 encoded string is "
+                + base64EncodedString);
+
+        if (base64EncodedString.contains("$$$")) {
+            throw new RuntimeException(
+                    "Base64 encoding contains line separator after encodeToString invoked  ... \n");
+        }
+    }
+
+    private static void testWrapEncode1(final Base64.Encoder encoder)
+            throws IOException {
+        System.err.println("\nEncoder.wrap test I ");
+
+        final byte[] bytesIn = "fo".getBytes(US_ASCII);
+        String base64EncodedString;
+        ByteArrayOutputStream encodingStream = new ByteArrayOutputStream();
+        OutputStream encoding = encoder.wrap(encodingStream);
+        encoding.write(bytesIn);
+        encoding.close();
+
+        final byte[] encodedBytes = encodingStream.toByteArray();
+
+        System.err.print("result = " + new String(encodedBytes, US_ASCII)
+                + "  after the Base64 encoding \n");
+
+        base64EncodedString = new String(encodedBytes, US_ASCII);
+
+        if (base64EncodedString.contains("$$$")) {
+            throw new RuntimeException(
+                    "Base64 encoding contains line separator after wrap I test ... \n");
+        }
+    }
+
+    private static void testEncodeToString(final Base64.Encoder encoder) {
+        final byte[] bytesIn = "fo".getBytes(US_ASCII);
+
+        System.err.println("\nEncoder.encodeToString test  ");
+
+        String base64EncodedString = encoder.encodeToString(bytesIn);
+
+        System.err.println("Base64 encoded string is " + base64EncodedString);
+
+        if (base64EncodedString.contains("$$$")) {
+            throw new RuntimeException("Base64 encoding contains line separator after Encoder.encodeToString invoked ... \n");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Collection/CollectionDefaults.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.function.Predicate;
+
+/**
+ * @test
+ * @library testlibrary
+ * @build CollectionAsserts CollectionSupplier
+ * @run testng CollectionDefaults
+ * @summary Unit tests for extension methods on Collection
+ */
+public class CollectionDefaults {
+
+    public static final Predicate<Integer> pEven = x -> 0 == x % 2;
+    public static final Predicate<Integer> pOdd = x -> 1 == x % 2;
+
+    private static final String[] SET_CLASSES = {
+        "java.util.HashSet",
+        "java.util.LinkedHashSet",
+        "java.util.TreeSet"
+    };
+
+    private static final int SIZE = 100;
+
+    @DataProvider(name="setProvider", parallel=true)
+    public static Object[][] setCases() {
+        final List<Object[]> cases = new LinkedList<>();
+        cases.add(new Object[] { new HashSet<>() });
+        cases.add(new Object[] { new LinkedHashSet<>() });
+        cases.add(new Object[] { new TreeSet<>() });
+
+        cases.add(new Object[] { Collections.newSetFromMap(new HashMap<>()) });
+        cases.add(new Object[] { Collections.newSetFromMap(new LinkedHashMap()) });
+        cases.add(new Object[] { Collections.newSetFromMap(new TreeMap<>()) });
+
+        cases.add(new Object[] { new HashSet(){{add(42);}} });
+        cases.add(new Object[] { new LinkedHashSet(){{add(42);}} });
+        cases.add(new Object[] { new TreeSet(){{add(42);}} });
+        return cases.toArray(new Object[0][cases.size()]);
+    }
+
+    @Test(dataProvider = "setProvider")
+    public void testProvidedWithNull(final Set<Integer> set) throws Exception {
+        try {
+            set.forEach(null);
+            fail("expected NPE not thrown");
+        } catch (NullPointerException npe) {}
+        try {
+            set.removeIf(null);
+            fail("expected NPE not thrown");
+        } catch (NullPointerException npe) {}
+    }
+
+    @Test
+    public void testForEach() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(SET_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final Set<Integer> original = ((Set<Integer>) test.original);
+            final Set<Integer> set = ((Set<Integer>) test.collection);
+
+            try {
+                set.forEach(null);
+                fail("expected NPE not thrown");
+            } catch (NullPointerException npe) {}
+            if (test.className.equals("java.util.HashSet")) {
+                CollectionAsserts.assertContentsUnordered(set, original);
+            } else {
+                CollectionAsserts.assertContents(set, original);
+            }
+
+            final List<Integer> actual = new LinkedList<>();
+            set.forEach(actual::add);
+            if (test.className.equals("java.util.HashSet")) {
+                CollectionAsserts.assertContentsUnordered(actual, set);
+                CollectionAsserts.assertContentsUnordered(actual, original);
+            } else {
+                CollectionAsserts.assertContents(actual, set);
+                CollectionAsserts.assertContents(actual, original);
+            }
+        }
+    }
+
+    @Test
+    public void testRemoveIf() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(SET_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final Set<Integer> original = ((Set<Integer>) test.original);
+            final Set<Integer> set = ((Set<Integer>) test.collection);
+
+            try {
+                set.removeIf(null);
+                fail("expected NPE not thrown");
+            } catch (NullPointerException npe) {}
+            if (test.className.equals("java.util.HashSet")) {
+                CollectionAsserts.assertContentsUnordered(set, original);
+            } else {
+                CollectionAsserts.assertContents(set, original);
+            }
+
+            set.removeIf(pEven);
+            for (int i : set) {
+                assertTrue((i % 2) == 1);
+            }
+            for (int i : original) {
+                if (i % 2 == 1) {
+                    assertTrue(set.contains(i));
+                }
+            }
+            set.removeIf(pOdd);
+            assertTrue(set.isEmpty());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Collection/ListDefaults.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,530 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Comparators;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Stack;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.Vector;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.lang.reflect.Constructor;
+import java.util.ConcurrentModificationException;
+import java.util.function.Predicate;
+
+/**
+ * @test
+ * @library testlibrary
+ * @build CollectionAsserts CollectionSupplier
+ * @run testng ListDefaults
+ * @summary Unit tests for extension methods on List
+ */
+public class ListDefaults {
+
+    private static final String[] LIST_CLASSES = {
+        "java.util.ArrayList",
+        "java.util.LinkedList",
+        "java.util.Vector",
+        "java.util.concurrent.CopyOnWriteArrayList"
+    };
+
+    private static final String[] LIST_CME_CLASSES = {
+        "java.util.ArrayList",
+        "java.util.Vector"
+    };
+
+    private static final Predicate<Integer> pEven = x -> 0 == x % 2;
+    private static final Predicate<Integer> pOdd = x -> 1 == x % 2;
+
+    private static final Comparator<Integer> BIT_COUNT_COMPARATOR =
+            (x, y) -> Integer.bitCount(x) - Integer.bitCount(y);
+
+    private static final Comparator<AtomicInteger> ATOMIC_INTEGER_COMPARATOR =
+            (x, y) -> x.intValue() - y.intValue();
+
+    private static final int SIZE = 100;
+    private static final int SUBLIST_FROM = 20;
+    private static final int SUBLIST_TO = SIZE - 5;
+    private static final int SUBLIST_SIZE = SUBLIST_TO - SUBLIST_FROM;
+
+    private static interface Callback {
+        void call(List<Integer> list);
+    }
+
+    // call the callback for each recursive subList
+    private void trimmedSubList(final List<Integer> list, final Callback callback) {
+        int size = list.size();
+        if (size > 1) {
+            // trim 1 element from both ends
+            final List<Integer> subList = list.subList(1, size - 1);
+            callback.call(subList);
+            trimmedSubList(subList, callback);
+        }
+    }
+
+    @DataProvider(name="listProvider", parallel=true)
+    public static Object[][] listCases() {
+        final List<Object[]> cases = new LinkedList<>();
+        cases.add(new Object[] { new ArrayList<>() });
+        cases.add(new Object[] { new LinkedList<>() });
+        cases.add(new Object[] { new Vector<>() });
+        cases.add(new Object[] { new Stack<>() });
+        cases.add(new Object[] { new CopyOnWriteArrayList<>() });
+
+        cases.add(new Object[] { new ArrayList(){{add(42);}} });
+        cases.add(new Object[] { new LinkedList(){{add(42);}} });
+        cases.add(new Object[] { new Vector(){{add(42);}} });
+        cases.add(new Object[] { new Stack(){{add(42);}} });
+        cases.add(new Object[] { new CopyOnWriteArrayList(){{add(42);}} });
+        return cases.toArray(new Object[0][cases.size()]);
+    }
+
+    @Test(dataProvider = "listProvider")
+    public void testProvidedWithNull(final List<Integer> list) throws Exception {
+        try {
+            list.forEach(null);
+            fail("expected NPE not thrown");
+        } catch (NullPointerException npe) {}
+        try {
+            list.replaceAll(null);
+            fail("expected NPE not thrown");
+        } catch (NullPointerException npe) {}
+        try {
+            list.removeIf(null);
+            fail("expected NPE not thrown");
+        } catch (NullPointerException npe) {}
+    }
+
+    @Test
+    public void testForEach() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(LIST_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> original = ((List<Integer>) test.original);
+            final List<Integer> list = ((List<Integer>) test.collection);
+        }
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> original = ((List<Integer>) test.original);
+            final List<Integer> list = ((List<Integer>) test.collection);
+
+            try {
+                list.forEach(null);
+                fail("expected NPE not thrown");
+            } catch (NullPointerException npe) {}
+            CollectionAsserts.assertContents(list, original);
+
+            final List<Integer> actual = new LinkedList<>();
+            list.forEach(actual::add);
+            CollectionAsserts.assertContents(actual, list);
+            CollectionAsserts.assertContents(actual, original);
+
+            if (original.size() > SUBLIST_SIZE) {
+                final List<Integer> subList = original.subList(SUBLIST_FROM, SUBLIST_TO);
+                final List<Integer> actualSubList = new LinkedList<>();
+                subList.forEach(actualSubList::add);
+                assertEquals(actualSubList.size(), SUBLIST_SIZE);
+                for (int i = 0; i < SUBLIST_SIZE; i++) {
+                    assertEquals(actualSubList.get(i), original.get(i + SUBLIST_FROM));
+                }
+            }
+
+            trimmedSubList(list, new Callback() {
+                @Override
+                public void call(final List<Integer> list) {
+                    final List<Integer> actual = new LinkedList<>();
+                    list.forEach(actual::add);
+                    CollectionAsserts.assertContents(actual, list);
+                }
+            });
+        }
+    }
+
+    @Test
+    public void testRemoveIf() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(LIST_CLASSES, SIZE);
+
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> original = ((List<Integer>) test.original);
+            final List<Integer> list = ((List<Integer>) test.collection);
+
+            try {
+                list.removeIf(null);
+                fail("expected NPE not thrown");
+            } catch (NullPointerException npe) {}
+            CollectionAsserts.assertContents(list, original);
+
+            final AtomicInteger offset = new AtomicInteger(1);
+            while (list.size() > 0) {
+                removeFirst(original, list, offset);
+            }
+        }
+
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> original = ((List<Integer>) test.original);
+            final List<Integer> list = ((List<Integer>) test.collection);
+            list.removeIf(pOdd);
+            for (int i : list) {
+                assertTrue((i % 2) == 0);
+            }
+            for (int i : original) {
+                if (i % 2 == 0) {
+                    assertTrue(list.contains(i));
+                }
+            }
+            list.removeIf(pEven);
+            assertTrue(list.isEmpty());
+        }
+
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> original = ((List<Integer>) test.original);
+            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> listCopy = new ArrayList<>(list);
+            if (original.size() > SUBLIST_SIZE) {
+                final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
+                final List<Integer> subListCopy = new ArrayList<>(subList);
+                listCopy.removeAll(subList);
+                subList.removeIf(pOdd);
+                for (int i : subList) {
+                    assertTrue((i % 2) == 0);
+                }
+                for (int i : subListCopy) {
+                    if (i % 2 == 0) {
+                        assertTrue(subList.contains(i));
+                    } else {
+                        assertFalse(subList.contains(i));
+                    }
+                }
+                subList.removeIf(pEven);
+                assertTrue(subList.isEmpty());
+                // elements outside the view should remain
+                CollectionAsserts.assertContents(list, listCopy);
+            }
+        }
+
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> list = ((List<Integer>) test.collection);
+            trimmedSubList(list, new Callback() {
+                @Override
+                public void call(final List<Integer> list) {
+                    final List<Integer> copy = new ArrayList<>(list);
+                    list.removeIf(pOdd);
+                    for (int i : list) {
+                        assertTrue((i % 2) == 0);
+                    }
+                    for (int i : copy) {
+                        if (i % 2 == 0) {
+                            assertTrue(list.contains(i));
+                        } else {
+                            assertFalse(list.contains(i));
+                        }
+                    }
+                }
+            });
+        }
+    }
+
+    // remove the first element
+    private void removeFirst(final List<Integer> original, final List<Integer> list, final AtomicInteger offset) {
+        final AtomicBoolean first = new AtomicBoolean(true);
+        list.removeIf(x -> first.getAndSet(false));
+        CollectionAsserts.assertContents(original.subList(offset.getAndIncrement(), original.size()), list);
+    }
+
+    @Test
+    public void testReplaceAll() throws Exception {
+        final int scale = 3;
+        final CollectionSupplier supplier = new CollectionSupplier(LIST_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> original = ((List<Integer>) test.original);
+            final List<Integer> list = ((List<Integer>) test.collection);
+
+            try {
+                list.replaceAll(null);
+                fail("expected NPE not thrown");
+            } catch (NullPointerException npe) {}
+            CollectionAsserts.assertContents(list, original);
+
+            list.replaceAll(x -> scale * x);
+            for (int i=0; i < original.size(); i++) {
+                assertTrue(list.get(i) == (scale * original.get(i)), "mismatch at index " + i);
+            }
+
+            if (original.size() > SUBLIST_SIZE) {
+                final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
+                subList.replaceAll(x -> x + 1);
+                // verify elements in view [from, to) were replaced
+                for (int i = 0; i < SUBLIST_SIZE; i++) {
+                    assertTrue(subList.get(i) == ((scale * original.get(i + SUBLIST_FROM)) + 1),
+                            "mismatch at sublist index " + i);
+                }
+                // verify that elements [0, from) remain unmodified
+                for (int i = 0; i < SUBLIST_FROM; i++) {
+                    assertTrue(list.get(i) == (scale * original.get(i)),
+                            "mismatch at original index " + i);
+                }
+                // verify that elements [to, size) remain unmodified
+                for (int i = SUBLIST_TO; i < list.size(); i++) {
+                    assertTrue(list.get(i) == (scale * original.get(i)),
+                            "mismatch at original index " + i);
+                }
+            }
+        }
+
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> list = ((List<Integer>) test.collection);
+            trimmedSubList(list, new Callback() {
+                @Override
+                public void call(final List<Integer> list) {
+                    final List<Integer> copy = new ArrayList<>(list);
+                    final int offset = 5;
+                    list.replaceAll(x -> offset + x);
+                    for (int i=0; i < copy.size(); i++) {
+                        assertTrue(list.get(i) == (offset + copy.get(i)), "mismatch at index " + i);
+                    }
+                }
+            });
+        }
+    }
+
+    @Test
+    public void testSort() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(LIST_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> original = ((List<Integer>) test.original);
+            final List<Integer> list = ((List<Integer>) test.collection);
+            CollectionSupplier.shuffle(list);
+            list.sort(Integer::compare);
+            CollectionAsserts.assertSorted(list, Integer::compare);
+            if (test.name.startsWith("reverse")) {
+                Collections.reverse(list);
+            }
+            CollectionAsserts.assertContents(list, original);
+
+            CollectionSupplier.shuffle(list);
+            list.sort(null);
+            CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+            if (test.name.startsWith("reverse")) {
+                Collections.reverse(list);
+            }
+            CollectionAsserts.assertContents(list, original);
+
+            CollectionSupplier.shuffle(list);
+            list.sort(Comparators.<Integer>naturalOrder());
+            CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+            if (test.name.startsWith("reverse")) {
+                Collections.reverse(list);
+            }
+            CollectionAsserts.assertContents(list, original);
+
+            CollectionSupplier.shuffle(list);
+            list.sort(Comparators.<Integer>reverseOrder());
+            CollectionAsserts.assertSorted(list, Comparators.<Integer>reverseOrder());
+            if (!test.name.startsWith("reverse")) {
+                Collections.reverse(list);
+            }
+            CollectionAsserts.assertContents(list, original);
+
+            CollectionSupplier.shuffle(list);
+            list.sort(BIT_COUNT_COMPARATOR);
+            CollectionAsserts.assertSorted(list, BIT_COUNT_COMPARATOR);
+            // check sort by verifying that bitCount increases and never drops
+            int minBitCount = 0;
+            int bitCount = 0;
+            for (final Integer i : list) {
+                bitCount = Integer.bitCount(i);
+                assertTrue(bitCount >= minBitCount);
+                minBitCount = bitCount;
+            }
+
+            @SuppressWarnings("unchecked")
+            final Class<? extends List<AtomicInteger>> type =
+                    (Class<? extends List<AtomicInteger>>) Class.forName(test.className);
+            final Constructor<? extends List<AtomicInteger>> defaultConstructor = type.getConstructor();
+            final List<AtomicInteger> incomparables = (List<AtomicInteger>) defaultConstructor.newInstance();
+
+            for (int i=0; i < test.original.size(); i++) {
+                incomparables.add(new AtomicInteger(i));
+            }
+            CollectionSupplier.shuffle(incomparables);
+            incomparables.sort(ATOMIC_INTEGER_COMPARATOR);
+            for (int i=0; i < test.original.size(); i++) {
+                assertEquals(i, incomparables.get(i).intValue());
+            }
+
+            if (original.size() > SUBLIST_SIZE) {
+                final List<Integer> copy = new ArrayList<>(list);
+                final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
+                CollectionSupplier.shuffle(subList);
+                subList.sort(Comparators.<Integer>naturalOrder());
+                CollectionAsserts.assertSorted(subList, Comparators.<Integer>naturalOrder());
+                // verify that elements [0, from) remain unmodified
+                for (int i = 0; i < SUBLIST_FROM; i++) {
+                    assertTrue(list.get(i) == copy.get(i),
+                            "mismatch at index " + i);
+                }
+                // verify that elements [to, size) remain unmodified
+                for (int i = SUBLIST_TO; i < list.size(); i++) {
+                    assertTrue(list.get(i) == copy.get(i),
+                            "mismatch at index " + i);
+                }
+            }
+        }
+
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> list = ((List<Integer>) test.collection);
+            trimmedSubList(list, new Callback() {
+                @Override
+                public void call(final List<Integer> list) {
+                    final List<Integer> copy = new ArrayList<>(list);
+                    CollectionSupplier.shuffle(list);
+                    list.sort(Comparators.<Integer>naturalOrder());
+                    CollectionAsserts.assertSorted(list, Comparators.<Integer>naturalOrder());
+                }
+            });
+        }
+    }
+
+    @Test
+    public void testForEachThrowsCME() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(LIST_CME_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> list = ((List<Integer>) test.collection);
+            if (list.size() <= 1) {
+                continue;
+            }
+            boolean gotException = false;
+            try {
+                // bad predicate that modifies its list, should throw CME
+                list.forEach((x) -> {list.add(x);});
+            } catch (ConcurrentModificationException cme) {
+                gotException = true;
+            }
+            if (!gotException) {
+                fail("expected CME was not thrown from " + test);
+            }
+        }
+    }
+
+    @Test
+    public void testRemoveIfThrowsCME() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(LIST_CME_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> list = ((List<Integer>) test.collection);
+            if (list.size() <= 1) {
+                continue;
+            }
+            boolean gotException = false;
+            try {
+                // bad predicate that modifies its list, should throw CME
+                list.removeIf((x) -> {return list.add(x);});
+            } catch (ConcurrentModificationException cme) {
+                gotException = true;
+            }
+            if (!gotException) {
+                fail("expected CME was not thrown from " + test);
+            }
+        }
+    }
+
+    @Test
+    public void testReplaceAllThrowsCME() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(LIST_CME_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> list = ((List<Integer>) test.collection);
+            if (list.size() <= 1) {
+                continue;
+            }
+            boolean gotException = false;
+            try {
+                // bad predicate that modifies its list, should throw CME
+                list.replaceAll(x -> {int n = 3 * x; list.add(n); return n;});
+            } catch (ConcurrentModificationException cme) {
+                gotException = true;
+            }
+            if (!gotException) {
+                fail("expected CME was not thrown from " + test);
+            }
+        }
+    }
+
+    @Test
+    public void testSortThrowsCME() throws Exception {
+        final CollectionSupplier supplier = new CollectionSupplier(LIST_CME_CLASSES, SIZE);
+        for (final CollectionSupplier.TestCase test : supplier.get()) {
+            final List<Integer> list = ((List<Integer>) test.collection);
+            if (list.size() <= 1) {
+                continue;
+            }
+            boolean gotException = false;
+            try {
+                // bad predicate that modifies its list, should throw CME
+                list.sort((x, y) -> {list.add(x); return x - y;});
+            } catch (ConcurrentModificationException cme) {
+                gotException = true;
+            }
+            if (!gotException) {
+                fail("expected CME was not thrown from " + test);
+            }
+        }
+    }
+
+    private static final List<Integer> SLICED_EXPECTED = Arrays.asList(0, 1, 2, 3, 5, 6, 7, 8, 9);
+    private static final List<Integer> SLICED_EXPECTED2 = Arrays.asList(0, 1, 2, 5, 6, 7, 8, 9);
+
+    @DataProvider(name="shortIntListProvider", parallel=true)
+    public static Object[][] intListCases() {
+        final Integer[] DATA = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+        final List<Object[]> cases = new LinkedList<>();
+        cases.add(new Object[] { new ArrayList<>(Arrays.asList(DATA)) });
+        cases.add(new Object[] { new LinkedList<>(Arrays.asList(DATA)) });
+        cases.add(new Object[] { new Vector<>(Arrays.asList(DATA)) });
+        cases.add(new Object[] { new CopyOnWriteArrayList<>(Arrays.asList(DATA)) });
+        return cases.toArray(new Object[0][cases.size()]);
+    }
+
+    @Test(dataProvider = "shortIntListProvider")
+    public void testRemoveIfFromSlice(final List<Integer> list) throws Exception {
+        final List<Integer> sublist = list.subList(3, 6);
+        assertTrue(sublist.removeIf(x -> x == 4));
+        CollectionAsserts.assertContents(list, SLICED_EXPECTED);
+
+        final List<Integer> sublist2 = list.subList(2, 5);
+        assertTrue(sublist2.removeIf(x -> x == 3));
+        CollectionAsserts.assertContents(list, SLICED_EXPECTED2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Collection/testlibrary/CollectionAsserts.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+/**
+ * @library
+ * CollectionAssert -- assertion methods for lambda test cases
+ */
+public class CollectionAsserts {
+
+    public static void assertCountSum(Iterable<? super Integer> it, int count, int sum) {
+        assertCountSum(it.iterator(), count, sum);
+    }
+
+    public static void assertCountSum(Iterator<? super Integer> it, int count, int sum) {
+        int c = 0;
+        int s = 0;
+        while (it.hasNext()) {
+            int i = (Integer) it.next();
+            c++;
+            s += i;
+        }
+
+        assertEquals(c, count);
+        assertEquals(s, sum);
+    }
+
+    public static void assertConcat(Iterator<Character> it, String result) {
+        StringBuilder sb = new StringBuilder();
+        while (it.hasNext()) {
+            sb.append(it.next());
+        }
+
+        assertEquals(result, sb.toString());
+    }
+
+    public static<T extends Comparable<? super T>> void assertSorted(Iterator<T> i) {
+        if (!i.hasNext())
+            return;
+        T last = i.next();
+        while (i.hasNext()) {
+            T t = i.next();
+            assertTrue(last.compareTo(t) <= 0);
+            assertTrue(t.compareTo(last) >= 0);
+            last = t;
+        }
+    }
+
+    public static<T> void assertSorted(Iterator<T> i, Comparator<? super T> comp) {
+        if (!i.hasNext())
+            return;
+        T last = i.next();
+        while (i.hasNext()) {
+            T t = i.next();
+            assertTrue(comp.compare(last, t) <= 0);
+            assertTrue(comp.compare(t, last) >= 0);
+            last = t;
+        }
+    }
+
+    public static<T extends Comparable<? super T>> void assertSorted(Iterable<T> iter) {
+        assertSorted(iter.iterator());
+    }
+
+    public static<T> void assertSorted(Iterable<T> iter, Comparator<? super T> comp) {
+        assertSorted(iter.iterator(), comp);
+    }
+
+    public static <T> void assertUnique(Iterable<T> iter) {
+        assertUnique(iter.iterator());
+    }
+
+    public static<T> void assertUnique(Iterator<T> iter) {
+        if (!iter.hasNext()) {
+            return;
+        }
+
+        Set<T> uniq = new HashSet<>();
+        while(iter.hasNext()) {
+            T each = iter.next();
+            assertTrue(!uniq.contains(each));
+            uniq.add(each);
+        }
+    }
+
+    public static<T> void assertContents(Iterable<T> actual, Iterable<T> expected) {
+        assertContents(actual.iterator(), expected.iterator());
+    }
+
+    public static<T> void assertContents(Iterator<T> actual, Iterator<T> expected) {
+        List<T> history = new ArrayList<>();
+
+        while (expected.hasNext()) {
+            if (!actual.hasNext()) {
+                List<T> expectedData = new ArrayList<>(history);
+                while (expected.hasNext())
+                    expectedData.add(expected.next());
+                fail(String.format("Premature end of data; expected=%s, found=%s", expectedData, history));
+            }
+            T a = actual.next();
+            T e = expected.next();
+            history.add(a);
+
+            if (!Objects.equals(a, e))
+                fail(String.format("Data mismatch; preceding=%s, nextExpected=%s, nextFound=%s", history, e, a));
+        }
+        if (actual.hasNext()) {
+            List<T> rest = new ArrayList<>();
+            while (actual.hasNext())
+                rest.add(actual.next());
+            fail(String.format("Unexpected data %s after %s", rest, history));
+        }
+    }
+
+    @SafeVarargs
+    @SuppressWarnings("varargs")
+    public static<T> void assertContents(Iterator<T> actual, T... expected) {
+        assertContents(actual, Arrays.asList(expected).iterator());
+    }
+
+    public static <T> boolean equalsContentsUnordered(Iterable<T> a, Iterable<T> b) {
+        Set<T> sa = new HashSet<>();
+        for (T t : a) {
+            sa.add(t);
+        }
+
+        Set<T> sb = new HashSet<>();
+        for (T t : b) {
+            sb.add(t);
+        }
+
+        return Objects.equals(sa, sb);
+    }
+
+    public static<T extends Comparable<? super T>> void assertContentsUnordered(Iterable<T> actual, Iterable<T> expected) {
+        ArrayList<T> one = new ArrayList<>();
+        for (T t : actual)
+            one.add(t);
+        ArrayList<T> two = new ArrayList<>();
+        for (T t : expected)
+            two.add(t);
+        Collections.sort(one);
+        Collections.sort(two);
+        assertContents(one, two);
+    }
+
+    static <T> void assertSplitContents(Iterable<Iterable<T>> splits, Iterable<T> list) {
+        Iterator<Iterable<T>> mI = splits.iterator();
+        Iterator<T> pI = null;
+        Iterator<T> lI = list.iterator();
+
+        while (lI.hasNext()) {
+            if (pI == null)
+                pI = mI.next().iterator();
+            while (!pI.hasNext()) {
+                if (!mI.hasNext()) {
+                    break;
+                }
+                else {
+                    pI = mI.next().iterator();
+                }
+            }
+            assertTrue(pI.hasNext());
+            T pT = pI.next();
+            T lT = lI.next();
+            assertEquals(pT, lT);
+        }
+
+        if (pI != null) {
+            assertTrue(!pI.hasNext());
+        }
+
+        while(mI.hasNext()) {
+            pI = mI.next().iterator();
+            assertTrue(!pI.hasNext());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Collection/testlibrary/CollectionSupplier.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.Exception;
+import java.lang.Integer;
+import java.lang.Iterable;
+import java.lang.Override;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+
+import org.testng.TestException;
+
+import static org.testng.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.function.Supplier;
+
+/**
+ * @library
+ * @summary A Supplier of test cases for Collection tests
+ */
+public final class CollectionSupplier implements Supplier<Iterable<CollectionSupplier.TestCase>> {
+
+    private final String[] classNames;
+    private final int size;
+
+    /**
+     * A Collection test case.
+     */
+    public static final class TestCase {
+
+        /**
+         * The name of the test case.
+         */
+        public final String name;
+
+        /**
+         * Class name of the instantiated Collection.
+         */
+        public final String className;
+
+        /**
+         * Unmodifiable reference collection, useful for comparisons.
+         */
+        public final Collection<Integer> original;
+
+        /**
+         * A modifiable test collection.
+         */
+        public final Collection<Integer> collection;
+
+        /**
+         * Create a Collection test case.
+         * @param name name of the test case
+         * @param className class name of the instantiated collection
+         * @param original reference collection
+         * @param collection the modifiable test collection
+         */
+        public TestCase(String name, String className,
+                Collection<Integer> original, Collection<Integer> collection) {
+            this.name = name;
+            this.className = className;
+            this.original =
+                    List.class.isAssignableFrom(original.getClass()) ?
+                    Collections.unmodifiableList((List<Integer>) original) :
+                    Set.class.isAssignableFrom(original.getClass()) ?
+                    Collections.unmodifiableSet((Set<Integer>) original) :
+                    Collections.unmodifiableCollection(original);
+            this.collection = collection;
+        }
+
+        @Override
+        public String toString() {
+            return name + " " + className +
+                    "\n original: " + original +
+                    "\n   target: " + collection;
+        }
+    }
+
+    /**
+     * Shuffle a list using a PRNG with known seed for repeatability
+     * @param list the list to be shuffled
+     */
+    public static <E> void shuffle(final List<E> list) {
+        // PRNG with known seed for repeatable tests
+        final Random prng = new Random(13);
+        final int size = list.size();
+        for (int i=0; i < size; i++) {
+            // random index in interval [i, size)
+            final int j = i + prng.nextInt(size - i);
+            // swap elements at indices i & j
+            final E e = list.get(i);
+            list.set(i, list.get(j));
+            list.set(j, e);
+        }
+    }
+
+    /**
+     * Create a {@code Supplier} that creates instances of specified collection
+     * classes of specified length.
+     *
+     * @param classNames class names that implement {@code Collection}
+     * @param size the desired size of each collection
+     */
+    public CollectionSupplier(String[] classNames, int size) {
+        this.classNames = Arrays.copyOf(classNames, classNames.length);
+        this.size = size;
+    }
+
+    @Override
+    public Iterable<TestCase> get() {
+        try {
+            return getThrows();
+        } catch (Exception e) {
+            throw new TestException(e);
+        }
+    }
+
+    private Iterable<TestCase> getThrows() throws Exception {
+        final Collection<TestCase> collections = new LinkedList<>();
+        for (final String className : classNames) {
+            @SuppressWarnings("unchecked")
+            final Class<? extends Collection<Integer>> type =
+                    (Class<? extends Collection<Integer>>) Class.forName(className);
+            final Constructor<? extends Collection<Integer>>
+                    defaultConstructor = type.getConstructor();
+            final Constructor<? extends Collection<Integer>>
+                    copyConstructor = type.getConstructor(Collection.class);
+
+            final Collection<Integer> empty = defaultConstructor.newInstance();
+            collections.add(new TestCase("empty",
+                    className,
+                    copyConstructor.newInstance(empty),
+                    empty));
+
+            final Collection<Integer> single = defaultConstructor.newInstance();
+            single.add(42);
+            collections.add(new TestCase("single",
+                    className,
+                    copyConstructor.newInstance(single),
+                    single));
+
+            final Collection<Integer> regular = defaultConstructor.newInstance();
+            for (int i=0; i < size; i++) {
+                regular.add(i);
+            }
+            collections.add(new TestCase("regular",
+                    className,
+                    copyConstructor.newInstance(regular),
+                    regular));
+
+            final Collection<Integer> reverse = defaultConstructor.newInstance();
+            for (int i=size; i >= 0; i--) {
+                reverse.add(i);
+            }
+            collections.add(new TestCase("reverse",
+                    className,
+                    copyConstructor.newInstance(reverse),
+                    reverse));
+
+            final Collection<Integer> odds = defaultConstructor.newInstance();
+            for (int i=0; i < size; i++) {
+                odds.add((i * 2) + 1);
+            }
+            collections.add(new TestCase("odds",
+                    className,
+                    copyConstructor.newInstance(odds),
+                    odds));
+
+            final Collection<Integer> evens = defaultConstructor.newInstance();
+            for (int i=0; i < size; i++) {
+                evens.add(i * 2);
+            }
+            collections.add(new TestCase("evens",
+                    className,
+                    copyConstructor.newInstance(evens),
+                    evens));
+
+            final Collection<Integer> fibonacci = defaultConstructor.newInstance();
+            int prev2 = 0;
+            int prev1 = 1;
+            for (int i=0; i < size; i++) {
+                final int n = prev1 + prev2;
+                if (n < 0) { // stop on overflow
+                    break;
+                }
+                fibonacci.add(n);
+                prev2 = prev1;
+                prev1 = n;
+            }
+            collections.add(new TestCase("fibonacci",
+                    className,
+                    copyConstructor.newInstance(fibonacci),
+                    fibonacci));
+
+            // variants where the size of the backing storage != reported size
+            // created by removing half of the elements
+
+            final Collection<Integer> emptyWithSlack = defaultConstructor.newInstance();
+            emptyWithSlack.add(42);
+            assertTrue(emptyWithSlack.remove(42));
+            collections.add(new TestCase("emptyWithSlack",
+                    className,
+                    copyConstructor.newInstance(emptyWithSlack),
+                    emptyWithSlack));
+
+            final Collection<Integer> singleWithSlack = defaultConstructor.newInstance();
+            singleWithSlack.add(42);
+            singleWithSlack.add(43);
+            assertTrue(singleWithSlack.remove(43));
+            collections.add(new TestCase("singleWithSlack",
+                    className,
+                    copyConstructor.newInstance(singleWithSlack),
+                    singleWithSlack));
+
+            final Collection<Integer> regularWithSlack = defaultConstructor.newInstance();
+            for (int i=0; i < (2 * size); i++) {
+                regularWithSlack.add(i);
+            }
+            assertTrue(regularWithSlack.removeIf((x) -> {return x >= size;}));
+            collections.add(new TestCase("regularWithSlack",
+                    className,
+                    copyConstructor.newInstance(regularWithSlack),
+                    regularWithSlack));
+
+            final Collection<Integer> reverseWithSlack = defaultConstructor.newInstance();
+            for (int i=2 * size; i >= 0; i--) {
+                reverseWithSlack.add(i);
+            }
+            assertTrue(reverseWithSlack.removeIf((x) -> {return x < size;}));
+            collections.add(new TestCase("reverseWithSlack",
+                    className,
+                    copyConstructor.newInstance(reverseWithSlack),
+                    reverseWithSlack));
+
+            final Collection<Integer> oddsWithSlack = defaultConstructor.newInstance();
+            for (int i = 0; i < 2 * size; i++) {
+                oddsWithSlack.add((i * 2) + 1);
+            }
+            assertTrue(oddsWithSlack.removeIf((x) -> {return x >= size;}));
+            collections.add(new TestCase("oddsWithSlack",
+                    className,
+                    copyConstructor.newInstance(oddsWithSlack),
+                    oddsWithSlack));
+
+            final Collection<Integer> evensWithSlack = defaultConstructor.newInstance();
+            for (int i = 0; i < 2 * size; i++) {
+                evensWithSlack.add(i * 2);
+            }
+            assertTrue(evensWithSlack.removeIf((x) -> {return x >= size;}));
+            collections.add(new TestCase("evensWithSlack",
+                    className,
+                    copyConstructor.newInstance(evensWithSlack),
+                    evensWithSlack));
+
+            final Collection<Integer> fibonacciWithSlack = defaultConstructor.newInstance();
+            prev2 = 0;
+            prev1 = 1;
+            for (int i=0; i < size; i++) {
+                final int n = prev1 + prev2;
+                if (n < 0) { // stop on overflow
+                    break;
+                }
+                fibonacciWithSlack.add(n);
+                prev2 = prev1;
+                prev1 = n;
+            }
+            assertTrue(fibonacciWithSlack.removeIf((x) -> {return x < 20;}));
+            collections.add(new TestCase("fibonacciWithSlack",
+                    className,
+                    copyConstructor.newInstance(fibonacciWithSlack),
+                    fibonacciWithSlack));
+
+        }
+
+        return collections;
+    }
+
+}
--- a/jdk/test/java/util/Locale/LocaleProviders.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/util/Locale/LocaleProviders.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 import java.text.*;
 import java.text.spi.*;
 import java.util.*;
+import java.util.spi.*;
 import sun.util.locale.provider.LocaleProviderAdapter;
 
 public class LocaleProviders {
@@ -55,6 +56,10 @@
                 bug8001440Test();
                 break;
 
+            case "bug8010666Test":
+                bug8010666Test();
+                break;
+
             default:
                 throw new RuntimeException("Test method '"+methodName+"' not found.");
         }
@@ -103,4 +108,38 @@
         NumberFormat nf = NumberFormat.getInstance(locale);
         String nu = nf.format(1234560);
     }
+
+    // This test assumes Windows localized language/country display names.
+    static void bug8010666Test() {
+        if (System.getProperty("os.name").startsWith("Windows")) {
+            NumberFormat nf = NumberFormat.getInstance(Locale.US);
+            try {
+                double ver = nf.parse(System.getProperty("os.version")).doubleValue();
+                System.out.printf("Windows version: %.1f\n", ver);
+                if (ver >= 6.0) {
+                    LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(LocaleNameProvider.class, Locale.ENGLISH);
+                    LocaleProviderAdapter.Type type = lda.getAdapterType();
+                    if (type == LocaleProviderAdapter.Type.HOST) {
+                        Locale mkmk = Locale.forLanguageTag("mk-MK");
+                        String result = mkmk.getDisplayLanguage(Locale.ENGLISH);
+                        if (!"Macedonian (FYROM)".equals(result)) {
+                            throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"mk\". Returned name was \"" + result + "\"");
+                        }
+                        result = Locale.US.getDisplayLanguage(Locale.ENGLISH);
+                        if (!"English".equals(result)) {
+                            throw new RuntimeException("Windows locale name provider did not return expected localized language name for \"en\". Returned name was \"" + result + "\"");
+                        }
+                        result = Locale.US.getDisplayCountry(Locale.ENGLISH);
+                        if (ver >= 6.1 && !"United States".equals(result)) {
+                            throw new RuntimeException("Windows locale name provider did not return expected localized country name for \"US\". Returned name was \"" + result + "\"");
+                        }
+                    } else {
+                        throw new RuntimeException("Windows Host LocaleProviderAdapter was not selected for English locale.");
+                    }
+                }
+            } catch (ParseException pe) {
+                throw new RuntimeException("Parsing Windows version failed: "+pe.toString());
+            }
+        }
+    }
 }
--- a/jdk/test/java/util/Locale/LocaleProviders.sh	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/util/Locale/LocaleProviders.sh	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 #!/bin/sh
 #
 # @test
-# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440
+# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8010666
 # @summary tests for "java.locale.providers" system property
 # @compile -XDignore.symbol.file LocaleProviders.java
 # @run shell/timeout=600 LocaleProviders.sh
@@ -258,4 +258,15 @@
 PARAM3=
 runTest
 
+# testing 8010666 fix.
+if [ "${DEFLANG}" = "en" ]
+then
+  METHODNAME=bug8010666Test
+  PREFLIST=HOST
+  PARAM1=
+  PARAM2=
+  PARAM3=
+  runTest
+fi
+
 exit $result
--- a/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java	Wed May 08 10:10:05 2013 +0100
@@ -184,6 +184,8 @@
 
                 @Override
                 public boolean tryAdvance(Consumer<? super Integer> action) {
+                    if (action == null)
+                        throw new NullPointerException();
                     if (it.hasNext()) {
                         action.accept(it.next());
                         return true;
@@ -193,7 +195,7 @@
                     }
                 }
             }
-            db.add("new Spliterators.AbstractAdvancingSpliterator()",
+            db.add("new Spliterators.AbstractSpliterator()",
                    () -> new SpliteratorFromIterator(exp.iterator(), exp.size()));
 
             // Collections
@@ -370,7 +372,28 @@
                 db.addCollection(c -> Collections.singletonList(exp.get(0)));
             }
 
-            // @@@ Collections.synchronized/unmodifiable/checked wrappers
+            // Collections.synchronized/unmodifiable/checked wrappers
+            db.addCollection(Collections::unmodifiableCollection);
+            db.addCollection(c -> Collections.unmodifiableSet(new HashSet<>(c)));
+            db.addCollection(c -> Collections.unmodifiableSortedSet(new TreeSet<>(c)));
+            db.addList(c -> Collections.unmodifiableList(new ArrayList<>(c)));
+            db.addMap(Collections::unmodifiableMap);
+            db.addMap(m -> Collections.unmodifiableSortedMap(new TreeMap<>(m)));
+
+            db.addCollection(Collections::synchronizedCollection);
+            db.addCollection(c -> Collections.synchronizedSet(new HashSet<>(c)));
+            db.addCollection(c -> Collections.synchronizedSortedSet(new TreeSet<>(c)));
+            db.addList(c -> Collections.synchronizedList(new ArrayList<>(c)));
+            db.addMap(Collections::synchronizedMap);
+            db.addMap(m -> Collections.synchronizedSortedMap(new TreeMap<>(m)));
+
+            db.addCollection(c -> Collections.checkedCollection(c, Integer.class));
+            db.addCollection(c -> Collections.checkedQueue(new ArrayDeque<>(c), Integer.class));
+            db.addCollection(c -> Collections.checkedSet(new HashSet<>(c), Integer.class));
+            db.addCollection(c -> Collections.checkedSortedSet(new TreeSet<>(c), Integer.class));
+            db.addList(c -> Collections.checkedList(new ArrayList<>(c), Integer.class));
+            db.addMap(c -> Collections.checkedMap(c, Integer.class, Integer.class));
+            db.addMap(m -> Collections.checkedSortedMap(new TreeMap<>(m), Integer.class, Integer.class));
 
             // Maps
 
@@ -402,6 +425,13 @@
 
     @Test(dataProvider = "Spliterator<Integer>")
     @SuppressWarnings({"unchecked", "rawtypes"})
+    public void testNullPointerException(String description, Collection exp, Supplier<Spliterator> s) {
+        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining(null));
+        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance(null));
+    }
+
+    @Test(dataProvider = "Spliterator<Integer>")
+    @SuppressWarnings({"unchecked", "rawtypes"})
     public void testForEach(String description, Collection exp, Supplier<Spliterator> s) {
         testForEach(exp, s, (Consumer<Object> b) -> b);
     }
@@ -507,6 +537,8 @@
 
                 @Override
                 public boolean tryAdvance(IntConsumer action) {
+                    if (action == null)
+                        throw new NullPointerException();
                     if (index < a.length) {
                         action.accept(a[index++]);
                         return true;
@@ -553,6 +585,12 @@
     }
 
     @Test(dataProvider = "Spliterator.OfInt")
+    public void testIntNullPointerException(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
+        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((IntConsumer) null));
+        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((IntConsumer) null));
+    }
+
+    @Test(dataProvider = "Spliterator.OfInt")
     public void testIntForEach(String description, Collection<Integer> exp, Supplier<Spliterator.OfInt> s) {
         testForEach(exp, s, intBoxingConsumer());
     }
@@ -652,6 +690,8 @@
 
                 @Override
                 public boolean tryAdvance(LongConsumer action) {
+                    if (action == null)
+                        throw new NullPointerException();
                     if (index < a.length) {
                         action.accept(a[index++]);
                         return true;
@@ -705,6 +745,12 @@
     }
 
     @Test(dataProvider = "Spliterator.OfLong")
+    public void testLongNullPointerException(String description, Collection<Long> exp, Supplier<Spliterator.OfLong> s) {
+        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((LongConsumer) null));
+        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((LongConsumer) null));
+    }
+
+    @Test(dataProvider = "Spliterator.OfLong")
     public void testLongForEach(String description, Collection<Long> exp, Supplier<Spliterator.OfLong> s) {
         testForEach(exp, s, longBoxingConsumer());
     }
@@ -804,6 +850,8 @@
 
                 @Override
                 public boolean tryAdvance(DoubleConsumer action) {
+                    if (action == null)
+                        throw new NullPointerException();
                     if (index < a.length) {
                         action.accept(a[index++]);
                         return true;
@@ -857,6 +905,12 @@
     }
 
     @Test(dataProvider = "Spliterator.OfDouble")
+    public void testDoubleNullPointerException(String description, Collection<Double> exp, Supplier<Spliterator.OfDouble> s) {
+        executeAndCatch(NullPointerException.class, () -> s.get().forEachRemaining((DoubleConsumer) null));
+        executeAndCatch(NullPointerException.class, () -> s.get().tryAdvance((DoubleConsumer) null));
+    }
+
+    @Test(dataProvider = "Spliterator.OfDouble")
     public void testDoubleForEach(String description, Collection<Double> exp, Supplier<Spliterator.OfDouble> s) {
         testForEach(exp, s, doubleBoxingConsumer());
     }
@@ -1057,8 +1111,8 @@
     }
 
     private static <T, S extends Spliterator<T>> void visit(int depth, int curLevel,
-                              List<T> dest, S spliterator, UnaryOperator<Consumer<T>> boxingAdapter,
-                              int rootCharacteristics, boolean useTryAdvance) {
+                                                            List<T> dest, S spliterator, UnaryOperator<Consumer<T>> boxingAdapter,
+                                                            int rootCharacteristics, boolean useTryAdvance) {
         if (curLevel < depth) {
             long beforeSize = spliterator.getExactSizeIfKnown();
             Spliterator<T> split = spliterator.trySplit();
@@ -1187,13 +1241,13 @@
                 assertTrue(leftSplit.estimateSize() < parentEstimateSize,
                            String.format("Left split size estimate %d >= parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
                 assertTrue(parentAndRightSplit.estimateSize() < parentEstimateSize,
-                            String.format("Right split size estimate %d >= parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
+                           String.format("Right split size estimate %d >= parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
             }
             else {
                 assertTrue(leftSplit.estimateSize() <= parentEstimateSize,
-                    String.format("Left split size estimate %d > parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
+                           String.format("Left split size estimate %d > parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
                 assertTrue(parentAndRightSplit.estimateSize() <= parentEstimateSize,
-                    String.format("Right split size estimate %d > parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
+                           String.format("Right split size estimate %d > parent split size estimate %d", leftSplit.estimateSize(), parentEstimateSize));
             }
 
             long leftSize = leftSplit.getExactSizeIfKnown();
@@ -1254,4 +1308,22 @@
         });
         return result;
     }
+
+    private void executeAndCatch(Class<? extends Exception> expected, Runnable r) {
+        Exception caught = null;
+        try {
+            r.run();
+        }
+        catch (Exception e) {
+            caught = e;
+        }
+
+        assertNotNull(caught,
+                      String.format("No Exception was thrown, expected an Exception of %s to be thrown",
+                                    expected.getName()));
+        assertTrue(expected.isInstance(caught),
+                   String.format("Exception thrown %s not an instance of %s",
+                                 caught.getClass().getName(), expected.getName()));
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/StringJoiner/StringJoinerTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,336 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * @test
+ * @bug 5015163 7172553
+ * @summary tests StringJoinerTest
+ * @run testng StringJoinerTest
+ * @author Jim Gish
+ */
+import java.util.StringJoiner;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
+
+@Test(groups = {"unit","string","util","libs"})
+public class StringJoinerTest {
+
+    private static final String EMPTY = "EMPTY";
+    private static final String ONE = "One";
+    private static final int ONE_LEN = ONE.length();
+    private static final String TWO = "Two";
+    private static final int TWO_LEN = TWO.length();
+    private static final String THREE = "Three";
+    private static final String FOUR = "Four";
+    private static final String FIVE = "Five";
+    private static final String DASH = "-";
+
+    /* Uncomment when we have streams
+    public void addAddAll() {
+        StringJoiner sj = new StringJoiner(DASH, "{", "}");
+        sj.add(ONE);
+
+        ArrayList<String> nextOne = new ArrayList<>();
+        nextOne.add(TWO);
+        nextOne.add(THREE);
+        nextOne.stream().forEach(sj::add);
+
+        String expected = "{"+ONE+DASH+TWO+DASH+THREE+"}";
+        assertEquals(sj.toString(), expected);
+    }
+
+    void addAlladd() {
+        StringJoiner sj = new StringJoiner(DASH, "{", "}");
+
+        ArrayList<String> firstOne = new ArrayList<>();
+        firstOne.add(ONE);
+        firstOne.add(TWO);
+        firstOne.stream().forEach(sj::add);
+
+        sj.add(THREE);
+
+        String expected = "{"+ONE+DASH+TWO+DASH+THREE+"}";
+        assertEquals(sj.toString(), expected);
+    }
+
+    // The following tests do two successive adds of different types
+    public void addAlladdAll() {
+        StringJoiner sj = new StringJoiner(DASH, "{", "}");
+        ArrayList<String> firstOne = new ArrayList<>();
+        firstOne.add(ONE);
+        firstOne.add(TWO);
+        firstOne.add(THREE);
+        firstOne.stream().forEach(sj::add);
+
+        ArrayList<String> nextOne = new ArrayList<>();
+        nextOne.add(FOUR);
+        nextOne.add(FIVE);
+        nextOne.stream().forEach(sj::add);
+
+        String expected = "{"+ONE+DASH+TWO+DASH+THREE+DASH+FOUR+DASH+FIVE+"}";
+        assertEquals(sj.toString(), expected);
+    }
+
+    public void testInto() {
+        ArrayList<String> list = new ArrayList<>();
+        list.add(ONE);
+        list.add(TWO);
+        list.add(THREE);
+
+        StringJoiner target = new StringJoiner(",", "{", "}");
+        assertEquals(target.toString(), "{" + ONE + "," + TWO + "," + THREE +
+            "}");
+    }
+    */
+
+    public void addCharSequence() {
+        StringJoiner sj = new StringJoiner(",");
+        CharSequence cs_one = ONE;
+        CharSequence cs_two = TWO;
+
+        sj.add(cs_one);
+        sj.add(cs_two);
+
+        assertEquals(sj.toString(), ONE + "," + TWO);
+
+        sj = new StringJoiner(DASH, "{", "}");
+        sj.add(cs_one);
+        sj.add(cs_two);
+
+        assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+
+        StringBuilder builder = new StringBuilder(ONE);
+        StringBuffer buffer = new StringBuffer(THREE);
+        sj = new StringJoiner(", ", "{ ", " }");
+        sj.add(builder).add(buffer);
+        builder.append(TWO);
+        buffer.append(FOUR);
+        assertEquals(sj.toString(), "{ " + ONE + ", " + THREE + " }",
+                "CharSequence is copied when add");
+        sj.add(builder);
+        assertEquals(sj.toString(), "{ " + ONE + ", " + THREE + ", " + ONE +
+                TWO + " }");
+    }
+
+    public void addCharSequenceWithEmptyValue() {
+        StringJoiner sj = new StringJoiner(",").setEmptyValue(EMPTY);
+        CharSequence cs_one = ONE;
+        CharSequence cs_two = TWO;
+
+        sj.add(cs_one);
+        sj.add(cs_two);
+
+        assertEquals(sj.toString(), ONE + "," + TWO);
+
+        sj = new StringJoiner(DASH, "{", "}");
+        sj.add(cs_one);
+        sj.add(cs_two);
+        assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+
+        sj = new StringJoiner(DASH, "{", "}");
+        assertEquals(sj.toString(), "{}");
+
+        sj = new StringJoiner("=", "{", "}").setEmptyValue("");
+        assertEquals(sj.toString(), "");
+
+        sj = new StringJoiner(DASH, "{", "}").setEmptyValue(EMPTY);
+        assertEquals(sj.toString(), EMPTY);
+
+        sj.add(cs_one);
+        sj.add(cs_two);
+        assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+    }
+
+    public void addString() {
+        StringJoiner sj = new StringJoiner(DASH);
+        sj.add(ONE);
+        assertEquals(sj.toString(), ONE);
+
+        sj = new StringJoiner(DASH, "{", "}");
+        sj.add(ONE);
+        assertEquals(sj.toString(), "{" + ONE + "}");
+
+        sj.add(TWO);
+        assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}");
+    }
+
+    public void lengthWithCustomEmptyValue() {
+        StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY);
+        assertEquals(sj.length(), EMPTY.length());
+        sj.add("");
+        assertEquals(sj.length(), "<>".length());
+        sj.add("");
+        assertEquals(sj.length(), "<->".length());
+        sj.add(ONE);
+        assertEquals(sj.length(), 4 + ONE_LEN);
+        assertEquals(sj.toString().length(), sj.length());
+        sj.add(TWO);
+        assertEquals(sj.length(), 5 + ONE_LEN + TWO_LEN);
+        assertEquals(sj.toString().length(), sj.length());
+        sj = new StringJoiner("||", "<", "-->");
+        assertEquals(sj.length(), 4);
+        assertEquals(sj.toString().length(), sj.length());
+        sj.add("abcdef");
+        assertEquals(sj.length(), 10);
+        assertEquals(sj.toString().length(), sj.length());
+        sj.add("xyz");
+        assertEquals(sj.length(), 15);
+        assertEquals(sj.toString().length(), sj.length());
+    }
+
+    public void noAddAndEmptyValue() {
+        StringJoiner sj = new StringJoiner(DASH, "", "").setEmptyValue(EMPTY);
+        assertEquals(sj.toString(), EMPTY);
+
+        sj = new StringJoiner(DASH, "<..", "");
+        assertEquals(sj.toString(), "<..");
+
+        sj = new StringJoiner(DASH, "<..", "");
+        assertEquals(sj.toString(), "<..");
+
+        sj = new StringJoiner(DASH, "", "==>");
+        assertEquals(sj.toString(), "==>");
+
+        sj = new StringJoiner(DASH, "{", "}");
+        assertEquals(sj.toString(), "{}");
+    }
+
+    @Test(expectedExceptions = {NullPointerException.class})
+    public void setEmptyValueNull() {
+        new StringJoiner(DASH, "{", "}").setEmptyValue(null);
+    }
+
+    @Test(expectedExceptions = {NullPointerException.class})
+    public void setDelimiterNull() {
+        new StringJoiner(null);
+    }
+
+    @Test(expectedExceptions = {NullPointerException.class})
+    public void setPrefixNull() {
+        new StringJoiner(DASH, null, "}");
+    }
+
+    @Test(expectedExceptions = {NullPointerException.class})
+    public void setSuffixNull() {
+        new StringJoiner(DASH, "{", null);
+    }
+
+    public void stringFromtoString() {
+        StringJoiner sj = new StringJoiner(", ");
+        assertEquals(sj.toString(), "");
+        sj = new StringJoiner(",", "{", "}");
+        assertEquals(sj.toString(), "{}");
+
+        sj = new StringJoiner(",");
+        sj.add(ONE);
+        assertEquals(sj.toString(), ONE);
+
+        sj.add(TWO);
+        assertEquals(sj.toString(), ONE + "," + TWO);
+
+        sj = new StringJoiner(",", "{--", "--}");
+        sj.add(ONE);
+        sj.add(TWO);
+        assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}");
+
+    }
+
+    public void stringFromtoStringWithEmptyValue() {
+        StringJoiner sj = new StringJoiner(" ", "", "");
+        assertEquals(sj.toString(), "");
+        sj = new StringJoiner(", ");
+        assertEquals(sj.toString(), "");
+        sj = new StringJoiner(",", "{", "}");
+        assertEquals(sj.toString(), "{}");
+
+        sj = new StringJoiner(",", "{", "}").setEmptyValue("");
+        assertEquals(sj.toString(), "");
+
+        sj = new StringJoiner(",");
+        sj.add(ONE);
+        assertEquals(sj.toString(), ONE);
+
+        sj.add(TWO);
+        assertEquals(sj.toString(), ONE + "," + TWO);
+
+        sj = new StringJoiner(",", "{--", "--}");
+        sj.add(ONE);
+        assertEquals(sj.toString(), "{--" + ONE + "--}" );
+
+        sj.add(TWO);
+        assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}");
+
+    }
+
+    public void toStringWithCustomEmptyValue() {
+        StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY);
+        assertEquals(sj.toString(), EMPTY);
+        sj.add("");
+        assertEquals(sj.toString(), "<>");
+        sj.add("");
+        assertEquals(sj.toString(), "<->");
+    }
+
+    private void testCombos(String infix, String prefix, String suffix) {
+        StringJoiner sj = new StringJoiner(infix, prefix, suffix);
+        assertEquals(sj.toString(), prefix + suffix);
+        assertEquals(sj.toString().length(), sj.length());
+        // EmptyValue
+        sj = new StringJoiner(infix, prefix, suffix).setEmptyValue("<NONE>");
+        assertEquals(sj.toString(), "<NONE>");
+        assertEquals(sj.toString().length(), sj.length());
+
+        // empty in front
+        sj.add("");
+        assertEquals(sj.toString(), prefix + suffix);
+        // empty in middle
+        sj.add("");
+        assertEquals(sj.toString(), prefix + infix + suffix);
+        sj.add("1");
+        assertEquals(sj.toString(), prefix + infix + infix + "1" + suffix);
+        // empty at end
+        sj.add("");
+        assertEquals(sj.toString(), prefix + infix + infix + "1" + infix + suffix);
+
+        sj = new StringJoiner(infix, prefix, suffix).setEmptyValue("<NONE>");
+        sj.add("1");
+        assertEquals(sj.toString(), prefix + "1" + suffix);
+        sj.add("2");
+        assertEquals(sj.toString(), prefix + "1" + infix + "2" + suffix);
+        sj.add("");
+        assertEquals(sj.toString(), prefix + "1" + infix + "2" +infix + suffix);
+        sj.add("3");
+        assertEquals(sj.toString(), prefix + "1" + infix + "2" +infix + infix + "3" + suffix);
+    }
+
+    public void testDelimiterCombinations() {
+        testCombos("", "", "");
+        testCombos("", "<", "");
+        testCombos("", "", ">");
+        testCombos("", "<", ">");
+        testCombos(",", "", "");
+        testCombos(",", "<", "");
+        testCombos(",", "", ">");
+        testCombos(",", "<", ">");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/DrainFindDeadlockTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.lang.Thread.State;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+import java.util.Map;
+
+/**
+ * @test
+ * @bug 8010939
+ * @summary check for deadlock between findLogger() and drainLoggerRefQueueBounded()
+ * @author jim.gish@oracle.com
+ * @build DrainFindDeadlockTest
+ * @run main/othervm/timeout=10 DrainFindDeadlockTest
+ */
+
+/**
+ * This test is checking for a deadlock between
+ * LogManager$LoggerContext.findLogger() and
+ * LogManager.drainLoggerRefQueueBounded() (which could happen by calling
+ * Logger.getLogger() and LogManager.readConfiguration() in different threads)
+ */
+public class DrainFindDeadlockTest {
+    private LogManager mgr = LogManager.getLogManager();
+    private final static int MAX_ITERATIONS = 100;
+
+    // Get a ThreadMXBean so we can check for deadlock.  N.B. this may
+    // not be supported on all platforms, which means we will have to
+    // resort to the traditional test timeout method. However, if
+    // we have the support we'll get the deadlock details if one
+    // is detected.
+    private final static ThreadMXBean threadMXBean =
+            ManagementFactory.getThreadMXBean();
+    private final boolean threadMXBeanDeadlockSupported =
+            threadMXBean.isSynchronizerUsageSupported();
+
+    public static void main(String... args) throws IOException, Exception {
+        new DrainFindDeadlockTest().testForDeadlock();
+    }
+
+    public static void randomDelay() {
+        int runs = (int) Math.random() * 1000000;
+        int c = 0;
+
+        for (int i=0; i<runs; ++i) {
+            c=c+i;
+        }
+    }
+
+    public void testForDeadlock() throws IOException, Exception {
+        System.out.println("Deadlock detection "
+                + (threadMXBeanDeadlockSupported ? "is" : "is not") +
+                            " available.");
+        Thread setup = new Thread(new SetupLogger(), "SetupLogger");
+        Thread readConfig = new Thread(new ReadConfig(), "ReadConfig");
+        Thread check = new Thread(new DeadlockChecker(setup, readConfig),
+                                   "DeadlockChecker");
+
+        // make the threads daemon threads so they will go away when the
+        // test exits
+        setup.setDaemon(true);
+        readConfig.setDaemon(true);
+        check.setDaemon(true);
+
+        check.start(); setup.start(); readConfig.start();
+        try {
+            check.join();
+        } catch (InterruptedException ex) {
+            ex.printStackTrace();
+        }
+        try {
+            readConfig.join();
+            setup.join();
+        } catch (InterruptedException ex) {
+            ex.printStackTrace();
+        }
+        System.out.println("Test passed");
+    }
+
+    class SetupLogger implements Runnable {
+        Logger logger = null;
+
+        @Override
+        public void run() {
+            System.out.println("Running " + Thread.currentThread().getName());
+
+            for (int i=0; i < MAX_ITERATIONS; i++) {
+                logger = Logger.getLogger("DrainFindDeadlockTest"+i);
+                DrainFindDeadlockTest.randomDelay();
+            }
+        }
+    }
+
+    class ReadConfig implements Runnable {
+        @Override
+        public void run() {
+            System.out.println("Running " + Thread.currentThread().getName());
+            for (int i=0; i < MAX_ITERATIONS; i++) {
+                try {
+                    mgr.readConfiguration();
+                } catch (IOException | SecurityException ex) {
+                    throw new RuntimeException("FAILED: test setup problem", ex);
+                }
+                DrainFindDeadlockTest.randomDelay();
+            }
+        }
+    }
+
+    class DeadlockChecker implements Runnable {
+        Thread t1, t2;
+
+        DeadlockChecker(Thread t1, Thread t2) {
+            this.t1 = t1;
+            this.t2 = t2;
+        }
+
+        void checkState(Thread x, Thread y) {
+            //            System.out.println("checkstate");
+            boolean isXblocked = x.getState().equals(State.BLOCKED);
+            boolean isYblocked = y.getState().equals(State.BLOCKED);
+            long[] deadlockedThreads = null;
+
+            if (isXblocked && isYblocked) {
+                System.out.println("threads blocked");
+                // they are both blocked, but this doesn't necessarily mean
+                // they are deadlocked
+                if (threadMXBeanDeadlockSupported) {
+                    System.out.println("checking for deadlock");
+                    deadlockedThreads = threadMXBean.findDeadlockedThreads();
+                } else {
+                    System.out.println("Can't check for deadlock");
+                }
+                if (deadlockedThreads != null) {
+                    System.out.println("We detected a deadlock! ");
+                    ThreadInfo[] threadInfos = threadMXBean.getThreadInfo(
+                            deadlockedThreads, true, true);
+                    for (ThreadInfo threadInfo: threadInfos) {
+                        System.out.println(threadInfo);
+                    }
+                    throw new RuntimeException("TEST FAILED: Deadlock detected");
+                }
+                System.out.println("We may have a deadlock");
+                Map<Thread, StackTraceElement[]> threadMap =
+                        Thread.getAllStackTraces();
+                dumpStack(threadMap.get(x), x);
+                dumpStack(threadMap.get(y), y);
+            }
+        }
+
+        private void dumpStack(StackTraceElement[] aStackElt, Thread aThread) {
+            if (aStackElt != null) {
+                 System.out.println("Thread:" + aThread.getName() + ": " +
+                                    aThread.getState());
+                 for (StackTraceElement element: aStackElt) {
+                    System.out.println("   " + element);
+                 }
+            }
+        }
+
+        @Override
+        public void run() {
+            System.out.println("Running " + Thread.currentThread().getName());
+            for (int i=0; i < MAX_ITERATIONS*2; i++) {
+                checkState(t1, t2);
+                try {
+                    Thread.sleep(10);
+                } catch (InterruptedException ex) {
+                };
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/ClassPathTestBundle_en.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,25 @@
+# 
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+sample1=translation #2 for sample1
+sample2=translation #2 for sample2
+supports-test=ResourceBundleSearchTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/IndirectlyLoadABundle.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Paths;
+
+/**
+ * This class is used to ensure that a resource bundle loadable by a classloader
+ * is on the caller's stack, but not on the classpath or TCCL to ensure that
+ * Logger.getLogger() can't load the bundle via a stack search
+ *
+ * @author Jim Gish
+ */
+public class IndirectlyLoadABundle {
+
+    private final static String rbName = "StackSearchableResource";
+
+    public boolean loadAndTest() throws Throwable {
+        // Find out where we are running from so we can setup the URLClassLoader URLs
+        // test.src and test.classes will be set if running in jtreg, but probably
+        // not otherwise
+        String testDir = System.getProperty("test.src", System.getProperty("user.dir"));
+        String testClassesDir = System.getProperty("test.classes",
+                System.getProperty("user.dir"));
+        String sep = System.getProperty("file.separator");
+
+        URL[] urls = new URL[2];
+
+        // Allow for both jtreg and standalone cases here
+        urls[0] = Paths.get(testDir, "resources").toUri().toURL();
+        urls[1] = Paths.get(testClassesDir).toUri().toURL();
+
+        System.out.println("INFO: urls[0] = " + urls[0]);
+        System.out.println("INFO: urls[1] = " + urls[1]);
+
+        // Make sure we can find it via the URLClassLoader
+        URLClassLoader yetAnotherResourceCL = new URLClassLoader(urls, null);
+        if (!testForValidResourceSetup(yetAnotherResourceCL)) {
+            throw new Exception("Couldn't directly load bundle " + rbName
+                    + " as expected. Test config problem");
+        }
+        // But it shouldn't be available via the system classloader
+        ClassLoader myCL = this.getClass().getClassLoader();
+        if (testForValidResourceSetup(myCL)) {
+            throw new Exception("Was able to directly load bundle " + rbName
+                    + " from " + myCL + " but shouldn't have been"
+                    + " able to. Test config problem");
+        }
+
+        Class<?> loadItUpClazz = Class.forName("LoadItUp", true, yetAnotherResourceCL);
+        ClassLoader actual = loadItUpClazz.getClassLoader();
+        if (actual != yetAnotherResourceCL) {
+            throw new Exception("LoadItUp was loaded by an unexpected CL: " + actual);
+        }
+        Object loadItUp = loadItUpClazz.newInstance();
+        Method testMethod = loadItUpClazz.getMethod("test", String.class);
+        try {
+            return (Boolean) testMethod.invoke(loadItUp, rbName);
+        } catch (InvocationTargetException ex) {
+            throw ex.getTargetException();
+        }
+    }
+
+    private boolean testForValidResourceSetup(ClassLoader cl) {
+        // First make sure the test environment is setup properly and the bundle actually
+        // exists
+        return ResourceBundleSearchTest.isOnClassPath(rbName, cl);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/LoadItUp.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.MissingResourceException;
+import java.util.logging.Logger;
+
+/*
+ * This class is loaded onto the call stack when the test method is called
+ * and then its classloader can be used to find a property bundle in the same
+ * directory as the class.  However, Logger is not allowed
+ * to find the bundle by looking up the stack for this classloader.
+ * We verify that this cannot happen.
+ *
+ * @author Jim Gish
+ */
+public class LoadItUp {
+
+    private final static boolean DEBUG = false;
+
+    public Boolean test(String rbName) throws Exception {
+        // we should not be able to find the resource in this directory via
+        // getLogger calls.  The only way that would be possible given this setup
+        // is that if Logger.getLogger searched up the call stack
+        return lookupBundle(rbName);
+    }
+
+    private boolean lookupBundle(String rbName) {
+        // See if Logger.getLogger can find the resource in this directory
+        try {
+            Logger aLogger = Logger.getLogger("NestedLogger", rbName);
+        } catch (MissingResourceException re) {
+            if (DEBUG) {
+                System.out.println(
+                    "As expected, LoadItUp.lookupBundle() did not find the bundle "
+                    + rbName);
+            }
+            return false;
+        }
+        System.out.println("FAILED: LoadItUp.lookupBundle() found the bundle "
+                + rbName + " using a stack search.");
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8002070
+ * @summary Remove the stack search for a resource bundle Logger to use
+ * @author  Jim Gish
+ * @build  ResourceBundleSearchTest IndirectlyLoadABundle LoadItUp
+ * @run main ResourceBundleSearchTest
+ */
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+public class ResourceBundleSearchTest {
+
+    private final static boolean DEBUG = false;
+    private final static String LOGGER_PREFIX = "myLogger.";
+    private static int loggerNum = 0;
+    private final static String PROP_RB_NAME = "ClassPathTestBundle";
+    private final static String TCCL_TEST_BUNDLE = "ContextClassLoaderTestBundle";
+
+    private static int numPass = 0;
+    private static int numFail = 0;
+    private static List<String> msgs = new ArrayList<>();
+
+    public static void main(String[] args) throws Throwable {
+        ResourceBundleSearchTest test = new ResourceBundleSearchTest();
+        test.runTests();
+    }
+
+    private void runTests() throws Throwable {
+        // ensure we are using en as the default Locale so we can find the resource
+        Locale.setDefault(Locale.ENGLISH);
+
+        String testClasses = System.getProperty("test.classes");
+        System.out.println( "test.classes = " + testClasses );
+
+        ClassLoader myClassLoader = ClassLoader.getSystemClassLoader();
+
+        // Find out where we are running from so we can setup the URLClassLoader URL
+        String userDir = System.getProperty("user.dir");
+        String testDir = System.getProperty("test.src", userDir);
+        String sep = System.getProperty("file.separator");
+
+        URL[] urls = new URL[1];
+
+        urls[0] = Paths.get(testDir, "resources").toUri().toURL();
+        URLClassLoader rbClassLoader = new URLClassLoader(urls);
+
+        // Test 1 - can we find a Logger bundle from doing a stack search?
+        // We shouldn't be able to
+        assertFalse(testGetBundleFromStackSearch(), "testGetBundleFromStackSearch");
+
+        // Test 2 - can we find a Logger bundle off of the Thread context class
+        // loader? We should be able to.
+        assertTrue(
+                testGetBundleFromTCCL(TCCL_TEST_BUNDLE, rbClassLoader),
+                "testGetBundleFromTCCL");
+
+        // Test 3 - Can we find a Logger bundle from the classpath?  We should be
+        // able to, but ....
+        // We check to see if the bundle is on the classpath or not so that this
+        // will work standalone.  In the case of jtreg/samevm,
+        // the resource bundles are not on the classpath.  Running standalone
+        // (or othervm), they are
+        if (isOnClassPath(PROP_RB_NAME, myClassLoader)) {
+            debug("We should be able to see " + PROP_RB_NAME + " on the classpath");
+            assertTrue(testGetBundleFromSystemClassLoader(PROP_RB_NAME),
+                    "testGetBundleFromSystemClassLoader");
+        } else {
+            debug("We should not be able to see " + PROP_RB_NAME + " on the classpath");
+            assertFalse(testGetBundleFromSystemClassLoader(PROP_RB_NAME),
+                    "testGetBundleFromSystemClassLoader");
+        }
+
+        report();
+    }
+
+    private void report() throws Exception {
+        System.out.println("Num passed = " + numPass + " Num failed = " + numFail);
+        if (numFail > 0) {
+            // We only care about the messages if they were errors
+            for (String msg : msgs) {
+                System.out.println(msg);
+            }
+            throw new Exception(numFail + " out of " + (numPass + numFail)
+                    + " tests failed.");
+        }
+    }
+
+    public void assertTrue(boolean testResult, String testName) {
+        if (testResult) {
+            numPass++;
+        } else {
+            numFail++;
+            System.out.println("FAILED: " + testName
+                    + " was supposed to return true but did NOT!");
+        }
+    }
+
+    public void assertFalse(boolean testResult, String testName) {
+        if (!testResult) {
+            numPass++;
+        } else {
+            numFail++;
+            System.out.println("FAILED: " + testName
+                    + " was supposed to return false but did NOT!");
+        }
+    }
+
+    public boolean testGetBundleFromStackSearch() throws Throwable {
+        // This should fail.  This was the old functionality to search up the
+        // caller's call stack
+        IndirectlyLoadABundle indirectLoader = new IndirectlyLoadABundle();
+        return indirectLoader.loadAndTest();
+    }
+
+    public boolean testGetBundleFromTCCL(String bundleName,
+            ClassLoader setOnTCCL) throws InterruptedException {
+        // This should succeed.  We should be able to get the bundle from the
+        // thread context class loader
+        debug("Looking for " + bundleName + " using TCCL");
+        LoggingThread lr = new LoggingThread(bundleName, setOnTCCL);
+        lr.start();
+        synchronized (lr) {
+            try {
+                lr.wait();
+            } catch (InterruptedException ex) {
+                throw ex;
+            }
+        }
+        msgs.add(lr.msg);
+        return lr.foundBundle;
+    }
+
+    /*
+     * @param String bundleClass
+     * @param ClassLoader to use for search
+     * @return true iff bundleClass is on system classpath
+     */
+    public static boolean isOnClassPath(String baseName, ClassLoader cl) {
+        ResourceBundle rb = null;
+        try {
+            rb = ResourceBundle.getBundle(baseName, Locale.getDefault(), cl);
+            System.out.println("INFO: Found bundle " + baseName + " on " + cl);
+        } catch (MissingResourceException e) {
+            System.out.println("INFO: Could not find bundle " + baseName + " on " + cl);
+            return false;
+        }
+        return (rb != null);
+    }
+
+    private static String newLoggerName() {
+        // we need a new logger name every time we attempt to find a bundle via
+        // the Logger.getLogger call, so we'll simply tack on an integer which
+        // we increment each time this is called
+        loggerNum++;
+        return LOGGER_PREFIX + loggerNum;
+    }
+
+    public boolean testGetBundleFromSystemClassLoader(String bundleName) {
+        // this should succeed if the bundle is on the system classpath.
+        try {
+            Logger aLogger = Logger.getLogger(ResourceBundleSearchTest.newLoggerName(),
+                    bundleName);
+        } catch (MissingResourceException re) {
+            msgs.add("INFO: testGetBundleFromSystemClassLoader() did not find bundle "
+                    + bundleName);
+            return false;
+        }
+        msgs.add("INFO: testGetBundleFromSystemClassLoader() found the bundle "
+                + bundleName);
+        return true;
+    }
+
+    public static class LoggingThread extends Thread {
+
+        boolean foundBundle = false;
+        String msg = null;
+        ClassLoader clToSetOnTCCL = null;
+        String bundleName = null;
+
+        public LoggingThread(String bundleName) {
+            this.bundleName = bundleName;
+        }
+
+        public LoggingThread(String bundleName, ClassLoader setOnTCCL) {
+            this.clToSetOnTCCL = setOnTCCL;
+            this.bundleName = bundleName;
+        }
+
+        public void run() {
+            boolean setTCCL = false;
+            try {
+                if (clToSetOnTCCL != null) {
+                    Thread.currentThread().setContextClassLoader(clToSetOnTCCL);
+                    setTCCL = true;
+                }
+                // this should succeed if the bundle is on the system classpath.
+                try {
+                    Logger aLogger = Logger.getLogger(ResourceBundleSearchTest.newLoggerName(),
+                            bundleName);
+                    msg = "INFO: LoggingRunnable() found the bundle " + bundleName
+                            + (setTCCL ? " with " : " without ") + "setting the TCCL";
+                    foundBundle = true;
+                } catch (MissingResourceException re) {
+                    msg = "INFO: LoggingRunnable() did not find the bundle " + bundleName
+                            + (setTCCL ? " with " : " without ") + "setting the TCCL";
+                    foundBundle = false;
+                }
+            } catch (Throwable e) {
+                e.printStackTrace();
+                System.exit(1);
+            }
+        }
+    }
+
+    private void debug(String msg) {
+        if (DEBUG) {
+            System.out.println(msg);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/resources/ContextClassLoaderTestBundle_en.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,25 @@
+# 
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+sample1=translation #3 for sample1
+sample2=translation #3 for sample2
+supports-test=ResourceBundleSearchTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/bundlesearch/resources/StackSearchableResource_en.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,25 @@
+# 
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+sample1=translation #4 for sample1
+sample2=translation #4 for sample2
+supports-test=ResourceBundleSearchTest
--- a/jdk/test/java/util/regex/RegExTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/java/util/regex/RegExTest.java	Wed May 08 10:10:05 2013 +0100
@@ -33,7 +33,7 @@
  * 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940
  * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
  * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
- * 7067045 7014640 7189363
+ * 7067045 7014640 7189363 8007395
  */
 
 import java.util.regex.*;
@@ -144,6 +144,7 @@
         horizontalAndVerticalWSTest();
         linebreakTest();
         branchTest();
+        groupCurlyNotFoundSuppTest();
         if (failure) {
             throw new
                 RuntimeException("RegExTest failed, 1st failure: " +
@@ -3947,4 +3948,27 @@
         report("branchTest");
     }
 
+    // This test is for 8007395
+    private static void groupCurlyNotFoundSuppTest() throws Exception {
+        String input = "test this as \ud83d\ude0d";
+        for (String pStr : new String[] { "test(.)+(@[a-zA-Z.]+)",
+                                          "test(.)*(@[a-zA-Z.]+)",
+                                          "test([^B])+(@[a-zA-Z.]+)",
+                                          "test([^B])*(@[a-zA-Z.]+)",
+                                          "test(\\P{IsControl})+(@[a-zA-Z.]+)",
+                                          "test(\\P{IsControl})*(@[a-zA-Z.]+)",
+                                        }) {
+            Matcher m = Pattern.compile(pStr, Pattern.CASE_INSENSITIVE)
+                               .matcher(input);
+            try {
+                if (m.find()) {
+                    failCount++;
+                }
+            } catch (Exception x) {
+                failCount++;
+            }
+        }
+        report("GroupCurly NotFoundSupp");
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /* @test
+    @bug 8012004
+    @summary JINTERNALFRAME NOT BEING FINALIZED AFTER CLOSING
+    @author mcherkas
+    @run main InternalFrameIsNotCollectedTest
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyVetoException;
+import java.util.Date;
+
+public class InternalFrameIsNotCollectedTest {
+
+    public static final int waitTime = 10000;
+    private static Robot robot;
+
+    public static void sync() {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+    }
+
+    public static void main(String[] args) throws Exception {
+        initRobot();
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                initUI();
+                try {
+                    closeInternalFrame();
+                } catch (PropertyVetoException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+        sync();
+        invokeGC();
+        Thread.sleep(1000); // it's better to wait 1 sec now then 10 sec later
+        Date startWaiting = new Date();
+        synchronized (CustomInternalFrame.waiter) {
+            // Sync with finalization thread.
+            Date now = new Date();
+            while (now.getTime() - startWaiting.getTime() < waitTime && !CustomInternalFrame.finalized) {
+                CustomInternalFrame.waiter.wait(waitTime);
+                now = new Date();
+            }
+        }
+        if (!CustomInternalFrame.finalized) {
+            throw new RuntimeException("Closed internal frame wasn't collected");
+        }
+    }
+
+    private static void initRobot() throws AWTException {
+        robot = new Robot();
+        robot.setAutoDelay(100);
+    }
+
+    private static void closeInternalFrame() throws PropertyVetoException {
+        robot.keyPress(KeyEvent.VK_CONTROL);
+        robot.keyPress(KeyEvent.VK_F4);
+        robot.keyRelease(KeyEvent.VK_F4);
+        robot.keyRelease(KeyEvent.VK_CONTROL);
+    }
+
+    private static void initUI() {
+        JFrame frame = new JFrame("Internal Frame Test");
+        frame.getContentPane().setLayout(new BorderLayout());
+        JDesktopPane desktopPane = new JDesktopPane();
+        desktopPane.setDesktopManager(new DefaultDesktopManager());
+        frame.getContentPane().add(desktopPane, BorderLayout.CENTER);
+
+        CustomInternalFrame iFrame = new CustomInternalFrame("Dummy Frame");
+
+        iFrame.setSize(200, 200);
+        iFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        desktopPane.add(iFrame);
+
+        frame.setSize(800, 600);
+        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        frame.setVisible(true);
+        iFrame.setVisible(true);
+    }
+
+    private static void invokeGC() {
+        System.out.println("Firing garbage collection!");
+        try {
+            StringBuilder sb = new StringBuilder();
+            while (true) {
+                sb.append("any string. some test. a little bit more text." + sb.toString());
+            }
+        } catch (Throwable e) {
+            // do nothing
+        }
+    }
+
+
+    public static class CustomInternalFrame extends JInternalFrame {
+        public static volatile boolean finalized = false;
+        public static Object waiter = new Object();
+
+        public CustomInternalFrame(String title) {
+            super(title, true, true, true, true);
+        }
+
+        protected void finalize() {
+            System.out.println("Finalized!");
+            finalized = true;
+            waiter.notifyAll();
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,43 +35,72 @@
 import javax.swing.*;
 
 public class ActionListenerCalledTwiceTest {
+    static String menuItems[] = { "Item1", "Item2" };
+    static KeyStroke keyStrokes[] = {
+        KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK),
+        KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)
+    };
+
     static volatile int listenerCallCounter = 0;
     public static void main(String[] args) throws Exception {
         if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
             System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
             return;
         }
+
         System.setProperty("apple.laf.useScreenMenuBar", "true");
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 createAndShowGUI();
             }
         });
+
         SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(100);
-        robot.keyPress(KeyEvent.VK_META);
-        robot.keyPress(KeyEvent.VK_E);
-        robot.keyRelease(KeyEvent.VK_E);
-        robot.keyRelease(KeyEvent.VK_META);
-        toolkit.realSync();
-        if (listenerCallCounter != 1) {
-            throw new Exception("Test failed: ActionListener called " + listenerCallCounter + " times instead of 1!");
+
+        for (int i = 0; i < menuItems.length; ++i) {
+            KeyStroke ks = keyStrokes[i];
+            int modKeyCode = getModKeyCode(ks.getModifiers());
+
+            if (modKeyCode != 0) {
+                robot.keyPress(modKeyCode);
+            }
+
+            robot.keyPress(ks.getKeyCode());
+            robot.keyRelease(ks.getKeyCode());
+
+            if (modKeyCode != 0) {
+                robot.keyRelease(modKeyCode);
+            }
+
+            toolkit.realSync();
+
+            if (listenerCallCounter != 1) {
+                throw new Exception("Test failed: ActionListener for " + menuItems[i] +
+                    " called " + listenerCallCounter + " times instead of 1!");
+            }
+
+            listenerCallCounter = 0;
         }
     }
 
     private static void createAndShowGUI() {
-        JMenuItem newItem = new JMenuItem("Exit");
-        newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK));
-        newItem.addActionListener(
-            new ActionListener(){
-                public void actionPerformed(ActionEvent e) {
-                    listenerCallCounter++;
+        JMenu menu = new JMenu("Menu");
+
+        for (int i = 0; i < menuItems.length; ++i) {
+            JMenuItem newItem = new JMenuItem(menuItems[i]);
+            newItem.setAccelerator(keyStrokes[i]);
+            newItem.addActionListener(
+                new ActionListener(){
+                    public void actionPerformed(ActionEvent e) {
+                        listenerCallCounter++;
+                    }
                 }
-            }
-        );
-        JMenu menu = new JMenu("Menu");
-        menu.add(newItem);
+            );
+            menu.add(newItem);
+        }
+
         JMenuBar bar = new JMenuBar();
         bar.add(menu);
         JFrame frame = new JFrame("Test");
@@ -80,4 +109,24 @@
         frame.pack();
         frame.setVisible(true);
     }
+
+    private static int getModKeyCode(int mod) {
+        if ((mod & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) {
+            return KeyEvent.VK_SHIFT;
+        }
+
+        if ((mod & (InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK)) != 0) {
+            return KeyEvent.VK_CONTROL;
+        }
+
+        if ((mod & (InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK)) != 0) {
+            return KeyEvent.VK_ALT;
+        }
+
+        if ((mod & (InputEvent.META_DOWN_MASK | InputEvent.META_MASK)) != 0) {
+            return KeyEvent.VK_META;
+        }
+
+        return 0;
+    }
 }
--- a/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java	Wed May 08 10:10:05 2013 +0100
@@ -46,10 +46,10 @@
  * @bug 8010117
  * @summary Verify if CallerSensitive methods are annotated with
  *          sun.reflect.CallerSensitive annotation
- * @build CallerSensitiveFinder MethodFinder
+ * @build CallerSensitiveFinder
  * @run main/othervm/timeout=900 -mx600m CallerSensitiveFinder
  */
-public class CallerSensitiveFinder extends MethodFinder {
+public class CallerSensitiveFinder {
     private static int numThreads = 3;
     private static boolean verbose = false;
     public static void main(String[] args) throws Exception {
@@ -71,8 +71,7 @@
         if (classes.isEmpty()) {
             classes.addAll(PlatformClassPath.getJREClasses());
         }
-        final String method = "sun/reflect/Reflection.getCallerClass";
-        CallerSensitiveFinder csfinder = new CallerSensitiveFinder(method);
+        CallerSensitiveFinder csfinder = new CallerSensitiveFinder();
 
         List<String> errors = csfinder.run(classes);
         if (!errors.isEmpty()) {
@@ -82,8 +81,46 @@
     }
 
     private final List<String> csMethodsMissingAnnotation = new ArrayList<>();
-    public CallerSensitiveFinder(String... methods) {
-        super(methods);
+    private final ReferenceFinder finder;
+    public CallerSensitiveFinder() {
+        this.finder = new ReferenceFinder(getFilter(), getVisitor());
+    }
+
+    private ReferenceFinder.Filter getFilter() {
+        final String classname = "sun/reflect/Reflection";
+        final String method = "getCallerClass";
+        return new ReferenceFinder.Filter() {
+            public boolean accept(ConstantPool cpool, CPRefInfo cpref) {
+                try {
+                    CONSTANT_NameAndType_info nat = cpref.getNameAndTypeInfo();
+                    return cpref.getClassName().equals(classname) && nat.getName().equals(method);
+                } catch (ConstantPoolException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        };
+    }
+
+    private ReferenceFinder.Visitor getVisitor() {
+        return new ReferenceFinder.Visitor() {
+            public void visit(ClassFile cf, Method m,  List<CPRefInfo> refs) {
+                try {
+                    String name = String.format("%s#%s %s", cf.getName(),
+                                                m.getName(cf.constant_pool),
+                                                m.descriptor.getValue(cf.constant_pool));
+                    if (!CallerSensitiveFinder.isCallerSensitive(m, cf.constant_pool)) {
+                        csMethodsMissingAnnotation.add(name);
+                        System.err.println("Missing @CallerSensitive: " + name);
+                    } else {
+                        if (verbose) {
+                            System.out.format("@CS  %s%n", name);
+                        }
+                    }
+                } catch (ConstantPoolException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        };
     }
 
     public List<String> run(List<Path> classes) throws IOException, InterruptedException,
@@ -125,27 +162,12 @@
         return false;
     }
 
-    public void referenceFound(ClassFile cf, Method m, Set<Integer> refs)
-            throws ConstantPoolException
-    {
-        String name = String.format("%s#%s %s", cf.getName(),
-                                    m.getName(cf.constant_pool),
-                                    m.descriptor.getValue(cf.constant_pool));
-        if (!CallerSensitiveFinder.isCallerSensitive(m, cf.constant_pool)) {
-            csMethodsMissingAnnotation.add(name);
-            System.err.println("Missing @CallerSensitive: " + name);
-        } else {
-            if (verbose) {
-                System.out.format("@CS  %s%n", name);
-            }
-        }
-    }
-
-    private final List<FutureTask<String>> tasks = new ArrayList<FutureTask<String>>();
-    private FutureTask<String> getTask(final ClassFile cf) {
-        FutureTask<String> task = new FutureTask<String>(new Callable<String>() {
-            public String call() throws Exception {
-                return parse(cf);
+    private final List<FutureTask<Void>> tasks = new ArrayList<FutureTask<Void>>();
+    private FutureTask<Void> getTask(final ClassFile cf) {
+        FutureTask<Void> task = new FutureTask<Void>(new Callable<Void>() {
+            public Void call() throws Exception {
+                finder.parse(cf);
+                return null;
             }
         });
         tasks.add(task);
@@ -153,8 +175,8 @@
     }
 
     private void waitForCompletion() throws InterruptedException, ExecutionException {
-        for (FutureTask<String> t : tasks) {
-            String s = t.get();
+        for (FutureTask<Void> t : tasks) {
+            t.get();
         }
         System.out.println("Parsed " + tasks.size() + " classfiles");
     }
--- a/jdk/test/sun/reflect/CallerSensitive/MethodFinder.java	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.util.*;
-import com.sun.tools.classfile.*;
-import static com.sun.tools.classfile.ConstantPool.*;
-import com.sun.tools.classfile.Instruction.TypeKind;
-
-/**
- * MethodFinder utility class to find references to the given methods.
- */
-public abstract class MethodFinder {
-    final List<String> methods;
-    public MethodFinder(String... methods) {
-        this.methods = Arrays.asList(methods);
-    }
-
-    /**
-     * A callback method will be invoked when a method referencing
-     * any of the lookup methods.
-     *
-     * @param cf ClassFile
-     * @param m Method
-     * @param refs Set of constant pool indices that reference the methods
-     *             matching the given lookup method names
-     */
-    public abstract void referenceFound(ClassFile cf, Method m, Set<Integer> refs)
-            throws ConstantPoolException;
-
-    public String parse(ClassFile cf) throws ConstantPoolException {
-        List<Integer> cprefs = new ArrayList<Integer>();
-        int index = 1;
-        for (ConstantPool.CPInfo cpInfo : cf.constant_pool.entries()) {
-            if (cpInfo.accept(cpVisitor, null)) {
-                cprefs.add(index);
-            }
-            index += cpInfo.size();
-        }
-
-        if (!cprefs.isEmpty()) {
-            for (Method m : cf.methods) {
-                Set<Integer> refs = new HashSet<Integer>();
-                Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code);
-                if (c_attr != null) {
-                    for (Instruction instr : c_attr.getInstructions()) {
-                        int idx = instr.accept(codeVisitor, cprefs);
-                        if (idx > 0) {
-                            refs.add(idx);
-                        }
-                    }
-                }
-                if (refs.size() > 0) {
-                    referenceFound(cf, m, refs);
-                }
-            }
-        }
-        return cprefs.isEmpty() ? "" : cf.getName();
-    }
-
-    private ConstantPool.Visitor<Boolean,Void> cpVisitor =
-            new ConstantPool.Visitor<Boolean,Void>()
-    {
-        private boolean matches(CPRefInfo info) {
-            try {
-                CONSTANT_NameAndType_info nat = info.getNameAndTypeInfo();
-                return matches(info.getClassName(), nat.getName(), nat.getType());
-            } catch (ConstantPoolException ex) {
-                return false;
-            }
-        }
-
-        private boolean matches(String cn, String name, String type) {
-            return methods.contains(cn + "." + name);
-        }
-
-        public Boolean visitClass(CONSTANT_Class_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
-            return matches(info);
-        }
-
-        public Boolean visitMethodref(CONSTANT_Methodref_info info, Void p) {
-            return matches(info);
-        }
-
-        public Boolean visitDouble(CONSTANT_Double_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitFieldref(CONSTANT_Fieldref_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitFloat(CONSTANT_Float_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitInteger(CONSTANT_Integer_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitLong(CONSTANT_Long_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitMethodType(CONSTANT_MethodType_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitString(CONSTANT_String_info info, Void p) {
-            return false;
-        }
-
-        public Boolean visitUtf8(CONSTANT_Utf8_info info, Void p) {
-            return false;
-        }
-    };
-
-    private Instruction.KindVisitor<Integer, List<Integer>> codeVisitor =
-            new Instruction.KindVisitor<Integer, List<Integer>>()
-    {
-        public Integer visitNoOperands(Instruction instr, List<Integer> p) {
-            return 0;
-        }
-
-        public Integer visitArrayType(Instruction instr, TypeKind kind, List<Integer> p) {
-            return 0;
-        }
-
-        public Integer visitBranch(Instruction instr, int offset, List<Integer> p) {
-            return 0;
-        }
-
-        public Integer visitConstantPoolRef(Instruction instr, int index, List<Integer> p) {
-            return p.contains(index) ? index : 0;
-        }
-
-        public Integer visitConstantPoolRefAndValue(Instruction instr, int index, int value, List<Integer> p) {
-            return p.contains(index) ? index : 0;
-        }
-
-        public Integer visitLocal(Instruction instr, int index, List<Integer> p) {
-            return 0;
-        }
-
-        public Integer visitLocalAndValue(Instruction instr, int index, int value, List<Integer> p) {
-            return 0;
-        }
-
-        public Integer visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, List<Integer> p) {
-            return 0;
-        }
-
-        public Integer visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, List<Integer> p) {
-            return 0;
-        }
-
-        public Integer visitValue(Instruction instr, int value, List<Integer> p) {
-            return 0;
-        }
-
-        public Integer visitUnknown(Instruction instr, List<Integer> p) {
-            return 0;
-        }
-    };
-}
-
--- a/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java	Wed May 08 10:10:05 2013 +0100
@@ -27,7 +27,7 @@
  * @bug 8010117
  * @summary Test CallerSensitiveFinder to find missing annotation
  * @compile -XDignore.symbol.file MissingCallerSensitive.java
- * @build CallerSensitiveFinder MethodFinder
+ * @build CallerSensitiveFinder
  * @run main MissingCallerSensitive
  */
 
@@ -40,8 +40,7 @@
         List<Path> classes = new ArrayList<>();
         classes.add(Paths.get(testclasses, "MissingCallerSensitive.class"));
 
-        final String method = "sun/reflect/Reflection.getCallerClass";
-        CallerSensitiveFinder csfinder = new CallerSensitiveFinder(method);
+        CallerSensitiveFinder csfinder = new CallerSensitiveFinder();
         List<String> errors = csfinder.run(classes);
         if (errors.size() != 1) {
             throw new RuntimeException("Unexpected number of methods found: " + errors.size());
--- a/jdk/test/sun/security/krb5/auto/SSL.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/sun/security/krb5/auto/SSL.java	Wed May 08 10:10:05 2013 +0100
@@ -23,10 +23,11 @@
 
 /*
  * @test
- * @bug 6894643 6913636
+ * @bug 6894643 6913636 8005523
  * @summary Test JSSE Kerberos ciphersuite
+
  * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA
- * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_MD5
+ * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA unbound
  * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA
  * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5
  * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_SHA
@@ -38,14 +39,17 @@
  */
 import java.io.*;
 import java.net.InetAddress;
+import java.security.AccessControlException;
+import java.security.Permission;
 import javax.net.ssl.*;
 import java.security.Principal;
 import java.util.Date;
+import javax.security.auth.kerberos.ServicePermission;
 import sun.security.jgss.GSSUtil;
 import sun.security.krb5.PrincipalName;
 import sun.security.krb5.internal.ktab.KeyTab;
 
-public class SSL {
+public class SSL extends SecurityManager {
 
     private static String krb5Cipher;
     private static final int LOOP_LIMIT = 3;
@@ -53,13 +57,32 @@
     private static volatile String server;
     private static volatile int port;
 
+    private static String permChecks = "";
+
     // 0-Not started, 1-Start OK, 2-Failure
     private static volatile int serverState = 0;
 
+    @Override
+    public void checkPermission(Permission perm, Object context) {
+        checkPermission(perm);
+    }
+
+    public void checkPermission(Permission perm) {
+        if (!(perm instanceof ServicePermission)) {
+            return;
+        }
+        ServicePermission p = (ServicePermission)perm;
+        permChecks = permChecks + p.getActions().toUpperCase().charAt(0);
+    }
+
     public static void main(String[] args) throws Exception {
 
         krb5Cipher = args[0];
 
+        boolean unbound = args.length > 1;
+
+        System.setSecurityManager(new SSL());
+
         KDC kdc = KDC.create(OneKDC.REALM);
         // Run this after KDC, so our own DNS service can be started
         try {
@@ -85,6 +108,7 @@
         // and use the middle one as the real key
         kdc.addPrincipal("host/" + server, "pass2".toCharArray());
 
+
         // JAAS config entry name ssl
         System.setProperty("java.security.auth.login.config", OneKDC.JAAS_CONF);
         File f = new File(OneKDC.JAAS_CONF);
@@ -92,7 +116,9 @@
         fos.write((
                 "ssl {\n" +
                 "    com.sun.security.auth.module.Krb5LoginModule required\n" +
-                "    principal=\"host/" + server + "\"\n" +
+                (unbound ?
+                    "    principal=*\n" :
+                    "    principal=\"host/" + server + "\"\n") +
                 "    useKeyTab=true\n" +
                 "    keyTab=" + OneKDC.KTAB + "\n" +
                 "    isInitiator=false\n" +
@@ -103,7 +129,6 @@
         Context c;
         final Context s = Context.fromJAAS("ssl");
 
-        // There's no keytab file when server starts.
         s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
 
         Thread server = new Thread(new Runnable() {
@@ -127,21 +152,6 @@
             throw new Exception("Server already failed");
         }
 
-        // Now create the keytab
-
-        /*
-        // Add 3 versions of keys into keytab
-        KeyTab ktab = KeyTab.create(OneKDC.KTAB);
-        PrincipalName service = new PrincipalName(
-                "host/" + server, PrincipalName.KRB_NT_SRV_HST);
-        ktab.addEntry(service, "pass1".toCharArray(), 1);
-        ktab.addEntry(service, "pass2".toCharArray(), 2);
-        ktab.addEntry(service, "pass3".toCharArray(), 3);
-        ktab.save();
-
-        // and use the middle one as the  real key
-        kdc.addPrincipal("host/" + server, "pass2".toCharArray());
-         */
         c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
         c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
         c.doAs(new JsseClientAction(), null);
@@ -157,20 +167,22 @@
         c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
         c.doAs(new JsseClientAction(), null);
 
-        // Revoke the old key
-        /*Thread.sleep(2000);
-        ktab = KeyTab.create(OneKDC.KTAB);
-        ktab.addEntry(service, "pass5".toCharArray(), 5, false);
-        ktab.save();
-
-        c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
-        c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
-        try {
-            c.doAs(new JsseClientAction(), null);
-            throw new Exception("Should fail this time.");
-        } catch (SSLException e) {
-            // Correct behavior.
-        }*/
+        // Permission checking check. Please note this is highly
+        // implementation related.
+        if (unbound) {
+            // For unbound, server does not know what name to check.
+            // Client checks "initiate", then server gets the name
+            // and checks "accept". Second connection resume.
+            if (!permChecks.equals("IA")) {
+                throw new Exception();
+            }
+        } else {
+            // For bound, JAAS checks "accept" once. Server checks again,
+            // client then checks "initiate". Second connection resume.
+            if (!permChecks.equals("AAI")) {
+                throw new Exception();
+            }
+        }
     }
 
     // Following codes copied from
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/SaslGSS.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8012082
+ * @summary SASL: auth-conf negotiated, but unencrypted data is accepted,
+  *         reset to unencrypt
+ * @compile -XDignore.symbol.file SaslGSS.java
+ * @run main/othervm SaslGSS
+ */
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.sasl.AuthorizeCallback;
+import javax.security.sasl.RealmCallback;
+import javax.security.sasl.Sasl;
+import javax.security.sasl.SaslServer;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Locale;
+import org.ietf.jgss.*;
+import sun.security.jgss.GSSUtil;
+
+public class SaslGSS {
+
+    public static void main(String[] args) throws Exception {
+
+        String name = "host." + OneKDC.REALM.toLowerCase(Locale.US);
+
+        new OneKDC(null).writeJAASConf();
+        System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
+
+        // Client in JGSS so that it can control wrap privacy mode
+        GSSManager m = GSSManager.getInstance();
+        GSSContext sc = m.createContext(
+                        m.createName(OneKDC.SERVER, GSSUtil.NT_GSS_KRB5_PRINCIPAL),
+                        GSSUtil.GSS_KRB5_MECH_OID,
+                        null,
+                        GSSContext.DEFAULT_LIFETIME);
+        sc.requestMutualAuth(false);
+
+        // Server in SASL
+        final HashMap props = new HashMap();
+        props.put(Sasl.QOP, "auth-conf");
+        SaslServer ss = Sasl.createSaslServer("GSSAPI", "server",
+                name, props,
+                new CallbackHandler() {
+                    public void handle(Callback[] callbacks)
+                            throws IOException, UnsupportedCallbackException {
+                        for (Callback cb : callbacks) {
+                            if (cb instanceof RealmCallback) {
+                                ((RealmCallback) cb).setText(OneKDC.REALM);
+                            } else if (cb instanceof AuthorizeCallback) {
+                                ((AuthorizeCallback) cb).setAuthorized(true);
+                            }
+                        }
+                    }
+                });
+
+        // Handshake
+        byte[] token = new byte[0];
+        token = sc.initSecContext(token, 0, token.length);
+        token = ss.evaluateResponse(token);
+        token = sc.unwrap(token, 0, token.length, new MessageProp(0, false));
+        token[0] = (byte)(((token[0] & 4) != 0) ? 4 : 2);
+        token = sc.wrap(token, 0, token.length, new MessageProp(0, false));
+        ss.evaluateResponse(token);
+
+        // Talk
+        // 1. Client sends a auth-int message
+        byte[] hello = "hello".getBytes();
+        MessageProp qop = new MessageProp(0, false);
+        token = sc.wrap(hello, 0, hello.length, qop);
+        // 2. Server accepts it anyway
+        ss.unwrap(token, 0, token.length);
+        // 3. Server sends a message
+        token = ss.wrap(hello, 0, hello.length);
+        // 4. Client accepts, should be auth-conf
+        sc.unwrap(token, 0, token.length, qop);
+        if (!qop.getPrivacy()) {
+            throw new Exception();
+        }
+    }
+}
--- a/jdk/test/sun/security/provider/SecureRandom/StrongSeedReader.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/sun/security/provider/SecureRandom/StrongSeedReader.java	Wed May 08 10:10:05 2013 +0100
@@ -49,7 +49,7 @@
 
         File file = null;
         try {
-            file = new File(System.getProperty("java.io.tmpdir") +
+            file = new File(System.getProperty("java.io.tmpdir"),
                     "StrongSeedReader.tmpdata");
 
             // write a bunch of 0's to the file.
--- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java	Wed May 08 10:10:05 2013 +0100
@@ -260,6 +260,8 @@
                 jarsigner(cmd, 7, false);   // tsbad2
                 jarsigner(cmd, 8, false);   // tsbad3
                 jarsigner(cmd, 9, false);   // no cert in timestamp
+                jarsigner(cmd + " -tsapolicyid 1.2.3.4", 0, true);
+                jarsigner(cmd + " -tsapolicyid 1.2.3.5", 0, false);
             } else {                        // Run as a standalone server
                 System.err.println("Press Enter to quit server");
                 System.in.read();
--- a/jdk/test/sun/security/tools/jarsigner/ts.sh	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/sun/security/tools/jarsigner/ts.sh	Wed May 08 10:10:05 2013 +0100
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 6543842 6543440 6939248
+# @bug 6543842 6543440 6939248 8009636
 # @summary checking response of timestamp
 #
 # @run shell/timeout=600 ts.sh
--- a/jdk/test/sun/security/tools/keytool/console.sh	Sun Apr 28 08:15:54 2013 +0100
+++ b/jdk/test/sun/security/tools/keytool/console.sh	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,3 @@
-#! /bin/sh
-
 #
 # Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -24,10 +22,11 @@
 #
 
 # @test
-# @bug 6418647
+# @bug 6418647 8005527
 # @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
 # @author Weijun Wang
-#
+# @ignore unable to test manual tools that have input from stdin,
+#               and output to stderr and stdout
 # @run shell/manual console.sh
 
 if [ "$ALT_PASS" = "" ]; then
--- a/langtools/.hgtags	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/.hgtags	Wed May 08 10:10:05 2013 +0100
@@ -209,3 +209,4 @@
 4a48f31735349782ad13980267358c97076adc66 jdk8-b85
 6ab578e141dfd17c4dc03869bb204aafa490c9f4 jdk8-b86
 1329f9c38d93c8caf339d7687df8371d06fe9e56 jdk8-b87
+a1e10f3adc47c8602a72e43a41403a642e73e0b1 jdk8-b88
--- a/langtools/make/Makefile-classic	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,396 +0,0 @@
-#
-# Copyright (c) 2007, 2012, 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 the langtools workspace.
-#
-
-#
-# On Solaris, the standard 'make' utility will not work with these makefiles.
-#    This little rule is only understood by Solaris make, and is harmless
-#    when seen by the GNU make tool. If using Solaris make, this causes the
-#    make command to fail.
-#
-SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
-
-#----- cancel implicit rules
-
-%: %.o
-%: %.obj
-%: %.dll
-%: %.c
-%: %.cc
-%: %.C
-%: %.p
-%: %.f
-%: %.s
-%: %.F
-%: %.r
-%: %.S
-%: %.mod
-%: %.sh
-%: %,v
-%: RCS/%,v
-
-#----- imports
-
-ifdef ALT_BOOT_JAVA_HOME
-  BOOT_JAVA_HOME = $(ALT_BOOT_JAVA_HOME)
-else 
-  ifdef ALT_BOOTDIR
-    BOOT_JAVA_HOME = $(ALT_BOOTDIR)
-  else
-    BOOT_JAVA_HOME=/java/re/jdk/1.5.0/archive/fcs/binaries/solaris-sparc
-  endif
-endif
-
-BOOT_JAVA=$(BOOT_JAVA_HOME)/bin/java
-BOOT_JAVAC=$(BOOT_JAVA_HOME)/bin/javac
-BOOTJAR=$(BOOT_JAVA_HOME)/bin/jar
-
-ifdef ALT_TESTJAVA_HOME
-  TESTJAVA_HOME = $(ALT_TESTJAVA_HOME)
-else
-  TESTJAVA_HOME=/java/re/jdk/1.6.0/archive/fcs/binaries/solaris-sparc
-endif
-
-TESTJAVA=$(TESTJAVA_HOME)/bin/java
-
-ifdef ALT_FINDBUGS_HOME
-  FINDBUGS_HOME = $(ALT_FINDBUGS_HOME)
-else
-  FINDBUGS_HOME = /java/devtools/share/findbugs/1.1.2-rc4
-endif
-
-FINDBUGS = $(FINDBUGS_HOME)/bin/findbugs
-
-#----- commands
-
-CHMOD = chmod
-CP = cp
-ECHO = echo # FIXME
-FIND = find
-MKDIR = mkdir
-SED = sed
-ZIP = zip
-
-#-----  locations and deliverables
-
-TOPDIR = ..
-SRC_BIN_DIR = $(TOPDIR)/src/share/bin
-SRC_CLASSES_DIR = $(TOPDIR)/src/share/classes
-
-BUILD_DIR = $(TOPDIR)/build
-
-CLASSES_DIR = $(BUILD_DIR)/classes
-GENSRC_DIR = $(BUILD_DIR)/gensrc
-
-DIST_DIR = $(TOPDIR)/dist
-BIN_DIR = $(DIST_DIR)/bin
-LIB_DIR = $(DIST_DIR)/lib
-
-JAVAC_JAR = $(LIB_DIR)/javac.jar
-JAVADOC_JAR = $(LIB_DIR)/javadoc.jar
-JAVAH_JAR = $(LIB_DIR)/javah.jar
-JAVAP_JAR = $(LIB_DIR)/javap.jar
-
-CLASSES_JAR = $(DIST_DIR)/classes.jar
-SRC_ZIP = $(DIST_DIR)/src.zip
-
-BUILDTOOLSRC_DIR = tools
-BUILDTOOLCLASSES_DIR = $(BUILD_DIR)/toolclasses
-
-#-----
-
-ifndef JDK_MAJOR_VERSION
-  JDK_MAJOR_VERSION = 1
-endif
-
-ifndef JDK_MINOR_VERSION
-  JDK_MINOR_VERSION = 7
-endif
-
-ifndef JDK_MICRO_VERSION
-  JDK_MICRO_VERSION = 0
-endif
-
-ifndef JDK_VERSION
-  JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
-endif
-
-ifndef MILESTONE
-  MILESTONE = internal
-endif
-
-# RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set
-ifneq ($(MILESTONE),fcs)
-  RELEASE      = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
-else
-  RELEASE      = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
-endif
-
-# FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
-ifdef BUILD_NUMBER
-  FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
-else
-  BUILD_NUMBER = b00
-  USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`)
-  FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
-endif
-
-#----- useful macros
-
-TOOLS =  javac javadoc javah javap
-
-SOURCE_LEVEL = 5
-BOOTSTRAP_TARGET_LEVEL = 5
-TARGET_LEVEL = 6
-
-ifndef TARGET_JAVA
-  TARGET_JAVA = java
-endif
-
-NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
-
-SELF = $(lastword $(MAKEFILE_LIST))
-
-#-----
-
-# the default is to generate the following:
-# dist/{bin,lib}: 
-# 	lang tools compiled to run on the target JDK
-
-default:  
-	$(MAKE) -f $(SELF) \
-		MILESTONE=bootstrap \
-		TARGET_LEVEL=$(BOOTSTRAP_TARGET_LEVEL) \
-		TARGET_JAVA=$(BOOT_JAVA_HOME)/bin/java \
-		GENSRC_DIR=$(BUILD_DIR)/bootstrap/gensrc \
-		CLASSES_DIR=$(BUILD_DIR)/bootstrap/classes \
-		BIN_DIR=$(BUILD_DIR)/bootstrap/bin \
-		LIB_DIR=$(BUILD_DIR)/bootstrap/lib \
-		$(BUILD_DIR)/bootstrap/lib/javac.jar \
-		$(BUILD_DIR)/bootstrap/bin/javac
-	$(MAKE) -f $(SELF) \
-		BOOT_JAVAC=$(BUILD_DIR)/bootstrap/bin/javac \
-		tools
-
-# for jdk, we generate the following:
-# dist/bootstrap/{bin,lib}:
-#	lang tools compiled to run on the boot JDK
-# dist/lib/classes.jar:
-#	lang tools recompiled to run on the target JDK,
-#	ready for inclusion in rt.jar and tools.jar
-# dist/lib/src.zip
-#	.properties and .java files for classes in classes.jar,
-#	ready for jdk src.zip 
-
-jdk:
-	$(MAKE) -f $(SELF) \
-		MILESTONE=bootstrap \
-		TARGET_LEVEL=$(BOOTSTRAP_TARGET_LEVEL) \
-		TARGET_JAVA=$(BOOT_JAVA_HOME)/bin/java \
-		GENSRC_DIR=$(BUILD_DIR)/bootstrap/gensrc \
-		CLASSES_DIR=$(BUILD_DIR)/bootstrap/classes \
-		BIN_DIR=$(DIST_DIR)/bootstrap/bin \
-		LIB_DIR=$(DIST_DIR)/bootstrap/lib \
-		tools
-	$(MAKE) -f $(SELF) \
-		BOOT_JAVAC=$(DIST_DIR)/bootstrap/bin/javac \
-		LIB_DIR=$(BUILD_DIR)/jdk/lib \
-		$(DIST_DIR)/lib/classes.jar \
-		$(DIST_DIR)/lib/src.zip
-
-tools: $(TOOLS:%=$(LIB_DIR)/%.jar) $(TOOLS:%=$(BIN_DIR)/%)
-
-clean:
-	$(RM) -r $(BUILD_DIR)
-
-really-clean: clean
-	$(RM) -r $(DIST_DIR)
-
-jprt_product_build \
-jprt_debug_build \
-jprt_fastdebug_build: lib
-
-#-----  javac
-
-JAVAC_DIRS = \
-	javax/annotation/processing \
-	javax/lang/model \
-	javax/tools \
-        jdk/ \
-	com/sun/source \
-	com/sun/tools/javac 
-
-JAVAC_RESOURCE_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAC_DIRS)) -name SCCS -prune -o -name \*.properties -print )
-
-JAVAC_JAVA_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAC_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
-	$(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAC_RESOURCE_FILES)) \
-	$(GENSRC_DIR)/com/sun/tools/javac/resources/version.java
-
-$(JAVAC_JAR): $(JAVAC_JAVA_FILES)
-	$(MKDIR) -p $(CLASSES_DIR) $(@D)
-	$(BOOT_JAVAC) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(NO_PROPRIETARY_API_WARNINGS) $(JAVAC_JAVA_FILES)
-	( $(ECHO) Main-Class: com.sun.tools.javac.Main ) > $(BUILD_DIR)/javac.mf
-	$(BOOTJAR) -cfm $@ $(BUILD_DIR)/javac.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAC_DIRS))
-
-#----- javadoc
-
-### FIXME -- javadoc has a couple of extra non-property resource files
-### that need to be included
-
-JAVADOC_DIRS = \
-	com/sun/javadoc \
-	com/sun/tools/doclets \
-	com/sun/tools/javadoc
-
-JAVADOC_RESOURCE_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVADOC_DIRS)) -name SCCS -prune -o -name \*.properties -print )
-
-JAVADOC_JAVA_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVADOC_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
-	$(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVADOC_RESOURCE_FILES))
- 
-$(JAVADOC_JAR): $(JAVADOC_JAVA_FILES) $(JAVAC_JAR)
-	$(MKDIR) -p $(CLASSES_DIR) $(@D)
-	$(BOOT_JAVAC) -sourcepath "" -classpath $(JAVAC_JAR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(JAVADOC_JAVA_FILES)
-	( $(ECHO) Main-Class: com.sun.tools.javadoc.Main ; $(ECHO) Class-Path: javac.jar ) > $(BUILD_DIR)/javadoc.mf
-	$(BOOTJAR) -cfm $@ $(BUILD_DIR)/javadoc.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVADOC_DIRS))
-
-#----- javah
-
-JAVAH_DIRS = \
-	com/sun/tools/javah
-
-JAVAH_RESOURCE_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAH_DIRS)) -name SCCS -prune -o -name \*.properties -print )
-
-JAVAH_JAVA_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAH_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
-	$(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAH_RESOURCE_FILES))
- 
-$(JAVAH_JAR): $(JAVAH_JAVA_FILES) $(JAVADOC_JAR)
-	$(MKDIR) -p $(CLASSES_DIR) $(@D)
-	$(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(JAVAH_JAVA_FILES)
-	( $(ECHO) Main-Class: com.sun.tools.javah.Main ; $(ECHO) Class-Path: javadoc.jar ) > $(BUILD_DIR)/javah.mf
-	$(BOOTJAR) -cfm $@ $(BUILD_DIR)/javah.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAH_DIRS))
-
-#----- javap
-
-JAVAP_DIRS = \
-	sun/tools/javap
-
-JAVAP_RESOURCE_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAP_DIRS)) -name SCCS -prune -o -name \*.properties -print )
-
-JAVAP_JAVA_FILES = \
-	$(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAP_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
-	$(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAP_RESOURCE_FILES))
- 
-$(JAVAP_JAR): $(JAVAP_JAVA_FILES) \
-		$(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAP_RESOURCE_FILES))
-	$(MKDIR) -p $(CLASSES_DIR)
-	$(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(JAVAP_JAVA_FILES)
-	( $(ECHO) Main-Class: sun.tools.javap.Main ) > $(BUILD_DIR)/javap.mf
-	$(BOOTJAR) -cfm $@ $(BUILD_DIR)/javap.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAP_DIRS))
-
-#-----
-
-build-tools: $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
-
-$(GENSRC_DIR)/%.java: $(SRC_CLASSES_DIR)/%.properties $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
-	$(MKDIR) -p $(@D)
-	$(BOOT_JAVA) -cp $(BUILDTOOLCLASSES_DIR)/CompileProperties CompileProperties $< $(patsubst $(CLASSES_DIR)/%.class,$(GENSRC_DIR)/%.java,$@)
-
-$(GENSRC_DIR)/%.java: $(GENSRC_DIR)/%.properties $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
-	$(MKDIR) -p $(@D)
-	$(BOOT_JAVA) -cp $(BUILDTOOLCLASSES_DIR)/CompileProperties CompileProperties $< $(patsubst $(CLASSES_DIR)/%.class,$(GENSRC_DIR)/%.java,$@)
-
-$(GENSRC_DIR)/%.properties: $(SRC_CLASSES_DIR)/%.properties-template
-	$(MKDIR) -p $(@D)
-	$(SED)  -e 's/$$(JDK_VERSION)/$(JDK_VERSION)/'  \
-		-e 's/$$(FULL_VERSION)/$(FULL_VERSION)/' \
-		-e 's/$$(RELEASE)/$(RELEASE)/' \
-		< $< > $@
-
-$(BUILDTOOLCLASSES_DIR)/%.class : $(BUILDTOOLSRC_DIR)/%.java
-	$(MKDIR) -p $(@D)
-	$(BOOT_JAVAC) -d $(@D) $<
-
-#----- all classes
-
-$(DIST_DIR)/%/classes.jar: $(JAVAC_JAR) $(JAVADOC_JAR) $(JAVAH_JAR) $(JAVAP_JAR)
-	$(MKDIR) -p $(@D)
-	$(BOOTJAR) -cf $@ -C $(CLASSES_DIR) .
-
-#----- src.zip
-
-SRC_ZIP_FILES = $(shell $(FIND) $(SRC_CLASSES_DIR) \( -name SCCS -o -name \*-template \) -prune -o -type f -print )
-
-$(DIST_DIR)/%/src.zip: $(SRC_ZIP_FILES)
-	abs_src_zip=`cd $(@D) ; pwd`/$(@F) ; \
-	( cd $(SRC_CLASSES_DIR) ; $(FIND) . \( -name SCCS -o -name \*-template \) -prune -o -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ; \
-	( cd $(SRC_CLASSES_DIR) ; $(FIND) . -name SCCS -prune -o -name \*-template -print | $(SED) -e 's/-template//' ) | ( cd $(GENSRC_DIR) ; $(ZIP) -q $$abs_src_zip -@ ) 
-
-#----- bin files
-
-$(BIN_DIR)/%: $(SRC_BIN_DIR)/launcher.sh-template
-	$(MKDIR) -p $(@D)
-	$(SED) -e 's|#PROGRAM#|$(@F)|' -e 's|#TARGET_JAVA#|$(TARGET_JAVA)|' $< > $@
-	$(CHMOD) +x $@
-
-#-----
-
-findbugs: $(BUILD_DIR)/findbugs.txt
-
-$(BUILD_DIR)/findbugs.txt: $(CLASSES_JAR)
-	$(MKDIR) -p $(@D)
-	$(FINDBUGS) -textui -javahome $(BOOT_JAVA_HOME) -high -emacs -outputFile $@ $<
-
-#-----
-
-quick-check: $(patsubst %, $(DIST_LIB_DIR)/%.jar, $(TOOLS))
-	$(TESTJAVA) -jar $(JAVAC_JAR) -version
-	- $(TESTJAVA) -jar $(JAVADOC_JAR) -version
-	$(TESTJAVA) -jar $(JAVAH_JAR) -version
-	- $(TESTJAVA) -jar $(JAVAP_JAR) -version
-
-#-----
-
-.PHONY: \
-	all \
-	build \
-	build-tools \
-	clean \
-	default \
-	findbugs \
-	jprt_product_build \
-	jprt_debug_build \
-	jprt_fastdebug_build \
-	tools
-
--- a/langtools/make/build.xml	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/make/build.xml	Wed May 08 10:10:05 2013 +0100
@@ -717,6 +717,29 @@
     <target name="sjavac" depends="build-sjavac,jtreg-sjavac,findbugs-sjavac"/>
 
     <!--
+    **** crules targets.
+    -->
+
+    <target name="build-crules" depends="-def-compilecrules,-def-build-jar-with-services">
+        <compilecrules/>
+        <build-jar-with-services
+                    name="crules"
+                    includes="crules/* crules/resources/*"
+                    classes.dir="${build.toolclasses.dir}"
+                    lib.dir="${build.toolclasses.dir}"
+                    jarmainclass=""
+                    jarclasspath="crules.jar"
+                    service.type="com.sun.source.util.Plugin"
+                    service.provider="crules.MutableFieldsAnalyzer"/>
+        <build-tool name="crules"/>
+    </target>
+
+    <target name="check-coding-rules" depends="build-bootstrap-javac,-create-import-jdk-stubs,build-crules">
+        <build-classes includes="${javac.includes}"
+            plugin.options="-J-Xbootclasspath/a:${build.toolclasses.dir}/crules.jar -Xplugin:mutable_fields_analyzer" />
+    </target>
+
+    <!--
     **** Create import JDK stubs.
     -->
 
@@ -811,6 +834,31 @@
         </macrodef>
     </target>
 
+    <target name="-def-build-jar-with-services">
+        <macrodef name="build-jar-with-services">
+            <attribute name="name"/>
+            <attribute name="includes"/>
+            <attribute name="classes.dir" default="${build.classes.dir}"/>
+            <attribute name="lib.dir" default="${dist.lib.dir}"/>
+            <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
+            <attribute name="jarclasspath" default=""/>
+            <attribute name="service.type" default=""/>
+            <attribute name="service.provider" default=""/>
+            <sequential>
+                <mkdir dir="${build.toolclasses.dir}"/>
+                <jar destfile="@{lib.dir}/@{name}.jar"
+                     basedir="@{classes.dir}"
+                     includes="@{includes}">
+                    <service type="@{service.type}" provider="@{service.provider}"/>
+                    <manifest>
+                        <attribute name="Main-Class" value="@{jarmainclass}"/>
+                        <attribute name="Class-Path" value="@{jarclasspath}"/>
+                    </manifest>
+                </jar>
+            </sequential>
+        </macrodef>
+    </target>
+
     <target name="-def-build-classes" depends="-def-pcompile">
         <macrodef name="build-classes">
             <attribute name="includes"/>
@@ -826,6 +874,7 @@
             <attribute name="target" default="${javac.target}"/>
             <attribute name="release" default="${release}"/>
             <attribute name="full.version" default="${full.version}"/>
+            <attribute name="plugin.options" default=""/>
             <sequential>
                 <echo level="verbose" message="build-classes: excludes=@{excludes}"/>
                 <echo level="verbose" message="build-classes: bootclasspath.opt=@{bootclasspath.opt}"/>
@@ -868,6 +917,7 @@
                     <compilerarg line="${javac.no.jdk.warnings}"/>
                     <compilerarg line="${javac.version.opt}"/>
                     <compilerarg line="${javac.lint.opts}"/>
+                    <compilerarg line="@{plugin.options}"/>
                 </javac>
                 <copy todir="@{classes.dir}" includeemptydirs="false">
                     <fileset dir="${src.classes.dir}" includes="@{includes}" excludes="@{excludes}">
@@ -935,6 +985,32 @@
                  classpath="${build.toolclasses.dir}/"/>
     </target>
 
+    <target name="-def-compilecrules">
+        <macrodef name="compilecrules">
+            <sequential>
+                <mkdir dir="${build.toolclasses.dir}"/>
+                <javac fork="true"
+                       source="${boot.javac.source}"
+                       target="${boot.javac.target}"
+                       executable="${boot.java.home}/bin/javac"
+                       srcdir="${make.tools.dir}"
+                       includes="crules/*"
+                       destdir="${build.toolclasses.dir}/"
+                       classpath="${ant.core.lib}"
+                       bootclasspath="${boot.java.home}/jre/lib/rt.jar"
+                       includeantruntime="false">
+                    <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
+                    <compilerarg line="${javac.lint.opts}"/>
+                </javac>
+                <copy todir="${build.toolclasses.dir}/" includeemptydirs="false">
+                    <fileset dir="${make.tools.dir}">
+                        <include name="**/*.properties"/>
+                    </fileset>
+                </copy>
+            </sequential>
+        </macrodef>
+    </target>
+
     <target name="-def-genstubs" depends="build-bootstrap-javac" if="require.import.jdk.stubs">
         <mkdir dir="${build.toolclasses.dir}"/>
         <javac fork="true"
--- a/langtools/make/netbeans/langtools/nbproject/project.xml	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/make/netbeans/langtools/nbproject/project.xml	Wed May 08 10:10:05 2013 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -67,7 +67,7 @@
             </folders>
             <ide-actions>
                 <!--
- Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -96,7 +96,7 @@
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
-                <!-- 
+                <!--
  This file defines the standard actions accepted by langtools projects.
  It is normally included as an entity into a project's project.xml file.
 
@@ -104,7 +104,7 @@
    - NetBeans: Setting Up Projects
      at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html
    - NetBeans: Advanced Freeform Project Configuration
-     at http://www.netbeans.org/kb/41/freeform-config.html 
+     at http://www.netbeans.org/kb/41/freeform-config.html
 -->
                 <action name="build">
                     <target>build</target>
@@ -144,7 +144,7 @@
                         </arity>
                     </context>
                 </action>
-                <!-- 
+                <!--
  Note: NetBeans does not appear to support context menu items
  on shell scripts :-(
 -->
@@ -178,7 +178,7 @@
                         </arity>
                     </context>
                 </action>
-                <!-- 
+                <!--
  Note: NetBeans does not appear to support context menu items
  on shell scripts :-(
 -->
@@ -239,10 +239,6 @@
                         <label>Build files</label>
                         <location>${root}/make</location>
                     </source-folder>
-                    <source-folder style="packages">
-                        <label>Source files</label>
-                        <location>${root}/src/share/classes</location>
-                    </source-folder>
                     <source-file>
                         <label>README</label>
                         <location>README</location>
@@ -250,7 +246,7 @@
                 </items>
                 <context-menu>
                     <!--
- Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013, 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
@@ -279,7 +275,7 @@
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
-                    <!-- 
+                    <!--
  This file defines the actions that will appear on the project's context
  menu, in the Projects viewer.
  It is normally included as an entity into a project's project.xml file.
@@ -288,7 +284,7 @@
    - NetBeans: Setting Up Projects
      at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html
    - NetBeans: Advanced Freeform Project Configuration
-     at http://www.netbeans.org/kb/41/freeform-config.html 
+     at http://www.netbeans.org/kb/41/freeform-config.html
 -->
                     <ide-action name="select-tool"/>
                     <separator/>
@@ -305,11 +301,11 @@
             </view>
             <subprojects/>
         </general-data>
-        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
+        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
             <compilation-unit>
                 <package-root>${root}/src/share/classes</package-root>
                 <built-to>${root}/build/classes</built-to>
-                <source-level>1.5</source-level>
+                <source-level>1.7</source-level>
             </compilation-unit>
         </java-data>
     </configuration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/tools/crules/AbstractCodingRulesAnalyzer.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package crules;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.lang.model.element.TypeElement;
+import javax.tools.JavaFileObject;
+
+import com.sun.source.tree.Tree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.Plugin;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.BasicJavacTask;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Log;
+
+import static com.sun.source.util.TaskEvent.Kind;
+
+public abstract class AbstractCodingRulesAnalyzer implements Plugin {
+
+    protected Log log;
+    protected Trees trees;
+    protected TreeScanner treeVisitor;
+    protected Kind eventKind;
+    protected Messages messages;
+
+    public void init(JavacTask task, String... args) {
+        BasicJavacTask impl = (BasicJavacTask)task;
+        Context context = impl.getContext();
+        log = Log.instance(context);
+        trees = Trees.instance(task);
+        messages = new Messages();
+        task.addTaskListener(new PostAnalyzeTaskListener());
+    }
+
+    public class PostAnalyzeTaskListener implements TaskListener {
+
+        @Override
+        public void started(TaskEvent taskEvent) {}
+
+        @Override
+        public void finished(TaskEvent taskEvent) {
+            if (taskEvent.getKind().equals(eventKind)) {
+                TypeElement typeElem = taskEvent.getTypeElement();
+                Tree tree = trees.getTree(typeElem);
+                if (tree != null) {
+                    JavaFileObject prevSource = log.currentSourceFile();
+                    try {
+                        log.useSource(taskEvent.getCompilationUnit().getSourceFile());
+                        treeVisitor.scan((JCTree)tree);
+                    } finally {
+                        log.useSource(prevSource);
+                    }
+                }
+            }
+        }
+    }
+
+    class Messages {
+        ResourceBundle bundle;
+
+        Messages() {
+            String name = getClass().getPackage().getName() + ".resources.crules";
+            bundle = ResourceBundle.getBundle(name, Locale.ENGLISH);
+        }
+
+        public void error(JCTree tree, String code, Object... args) {
+            String msg = (code == null) ? (String) args[0] : localize(code, args);
+            log.error(tree, "proc.messager", msg.toString());
+        }
+
+        private String localize(String code, Object... args) {
+            String msg = bundle.getString(code);
+            if (msg == null) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("message file broken: code=").append(code);
+                if (args.length > 0) {
+                    sb.append(" arguments={0}");
+                    for (int i = 1; i < args.length; i++) {
+                        sb.append(", {").append(i).append("}");
+                    }
+                }
+                msg = sb.toString();
+            }
+            return MessageFormat.format(msg, args);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/tools/crules/MutableFieldsAnalyzer.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package crules;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.tree.TreeScanner;
+
+import static com.sun.source.util.TaskEvent.Kind;
+import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.tree.JCTree.JCVariableDecl;
+
+public class MutableFieldsAnalyzer extends AbstractCodingRulesAnalyzer {
+
+    public MutableFieldsAnalyzer() {
+        treeVisitor = new MutableFieldsVisitor();
+        eventKind = Kind.ANALYZE;
+    }
+
+    public String getName() {
+        return "mutable_fields_analyzer";
+    }
+
+    private boolean ignoreField(String className, String field) {
+        List<String> currentFieldsToIgnore =
+                classFieldsToIgnoreMap.get(className);
+        if (currentFieldsToIgnore != null) {
+            for (String fieldToIgnore : currentFieldsToIgnore) {
+                if (field.equals(fieldToIgnore)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    class MutableFieldsVisitor extends TreeScanner {
+
+        @Override
+        public void visitVarDef(JCVariableDecl tree) {
+            boolean isJavacPack = tree.sym.outermostClass().fullname.toString()
+                    .contains(packageToCheck);
+            if (isJavacPack &&
+                (tree.sym.flags() & SYNTHETIC) == 0 &&
+                tree.sym.owner.kind == Kinds.TYP) {
+                if (!ignoreField(tree.sym.owner.flatName().toString(),
+                        tree.getName().toString())) {
+                    boolean enumClass = (tree.sym.owner.flags() & ENUM) != 0;
+                    boolean nonFinalStaticEnumField =
+                            (tree.sym.flags() & (ENUM | FINAL)) == 0;
+                    boolean nonFinalStaticField =
+                            (tree.sym.flags() & STATIC) != 0 &&
+                            (tree.sym.flags() & FINAL) == 0;
+                    if (enumClass ? nonFinalStaticEnumField : nonFinalStaticField) {
+                        messages.error(tree, "crules.err.var.must.be.final", tree);
+                    }
+                }
+            }
+            super.visitVarDef(tree);
+        }
+
+    }
+
+    private static final String packageToCheck = "com.sun.tools.javac";
+
+    private static final Map<String, List<String>> classFieldsToIgnoreMap =
+                new HashMap<String, List<String>>();
+
+    static {
+        classFieldsToIgnoreMap.
+                put("com.sun.tools.javac.util.JCDiagnostic",
+                    Arrays.asList("fragmentFormatter"));
+        classFieldsToIgnoreMap.
+                put("com.sun.tools.javac.util.JavacMessages",
+                    Arrays.asList("defaultBundle", "defaultMessages"));
+        classFieldsToIgnoreMap.
+                put("com.sun.tools.javac.file.ZipFileIndexCache",
+                    Arrays.asList("sharedInstance"));
+        classFieldsToIgnoreMap.
+                put("com.sun.tools.javac.main.JavaCompiler",
+                    Arrays.asList("versionRB"));
+        classFieldsToIgnoreMap.
+                put("com.sun.tools.javac.code.Type",
+                    Arrays.asList("moreInfo"));
+        classFieldsToIgnoreMap.
+                put("com.sun.tools.javac.util.SharedNameTable",
+                    Arrays.asList("freelist"));
+        classFieldsToIgnoreMap.
+                put("com.sun.tools.javac.util.Log",
+                    Arrays.asList("useRawMessages"));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/tools/crules/resources/crules.properties	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+# 0: symbol
+crules.err.var.must.be.final=\
+    Static variable {0} must be final
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/source/util/DocSourcePositions.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.source.util;
+
+import com.sun.source.doctree.DocCommentTree;
+import com.sun.source.doctree.DocTree;
+import com.sun.source.tree.CompilationUnitTree;
+
+/**
+ * Provides methods to obtain the position of a DocTree within a javadoc comment.
+ * A position is defined as a simple character offset from the start of a
+ * CompilationUnit where the first character is at offset 0.
+ *
+ * @since 1.8
+ */
+@jdk.Supported
+public interface DocSourcePositions extends SourcePositions {
+
+    /**
+     * Gets the starting position of the tree within the comment within the file.  If tree is not found within
+     * file, or if the starting position is not available,
+     * return {@link javax.tools.Diagnostic#NOPOS}.
+     * The given tree should be under the given comment tree, and the given documentation
+     * comment tree should be returned from a {@link DocTrees#getDocCommentTree(com.sun.source.util.TreePath) }
+     * for a tree under the given file.
+     * The returned position must be at the start of the yield of this tree, that
+     * is for any sub-tree of this tree, the following must hold:
+     *
+     * <p>
+     * {@code tree.getStartPosition() <= subtree.getStartPosition()} or <br>
+     * {@code tree.getStartPosition() == NOPOS} or <br>
+     * {@code subtree.getStartPosition() == NOPOS}
+     * </p>
+     *
+     * @param file CompilationUnit in which to find tree.
+     * @param comment the comment tree that encloses the tree for which the
+     *                position is being sought
+     * @param tree tree for which a position is sought.
+     * @return the start position of tree.
+     */
+    long getStartPosition(CompilationUnitTree file, DocCommentTree comment, DocTree tree);
+
+    /**
+     * Gets the ending position of the tree within the comment within the file.  If tree is not found within
+     * file, or if the ending position is not available,
+     * return {@link javax.tools.Diagnostic#NOPOS}.
+     * The given tree should be under the given comment tree, and the given documentation
+     * comment tree should be returned from a {@link DocTrees#getDocCommentTree(com.sun.source.util.TreePath) }
+     * for a tree under the given file.
+     * The returned position must be at the end of the yield of this tree,
+     * that is for any sub-tree of this tree, the following must hold:
+     *
+     * <p>
+     * {@code tree.getEndPosition() >= subtree.getEndPosition()} or <br>
+     * {@code tree.getEndPosition() == NOPOS} or <br>
+     * {@code subtree.getEndPosition() == NOPOS}
+     * </p>
+     *
+     * In addition, the following must hold:
+     *
+     * <p>
+     * {@code tree.getStartPosition() <= tree.getEndPosition()}  or <br>
+     * {@code tree.getStartPosition() == NOPOS} or <br>
+     * {@code tree.getEndPosition() == NOPOS}
+     * </p>
+     *
+     * @param file CompilationUnit in which to find tree.
+     * @param comment the comment tree that encloses the tree for which the
+     *                position is being sought
+     * @param tree tree for which a position is sought.
+     * @return the start position of tree.
+     */
+    long getEndPosition(CompilationUnitTree file, DocCommentTree comment, DocTree tree);
+
+}
--- a/langtools/src/share/classes/com/sun/source/util/DocTrees.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/source/util/DocTrees.java	Wed May 08 10:10:05 2013 +0100
@@ -72,6 +72,8 @@
      */
     public abstract Element getElement(TreePath path, ReferenceTree reference);
 
+    public abstract DocSourcePositions getSourcePositions();
+
     /**
      * Prints a message of the specified kind at the location of the
      * tree within the provided compilation unit
--- a/langtools/src/share/classes/com/sun/source/util/SourcePositions.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/source/util/SourcePositions.java	Wed May 08 10:10:05 2013 +0100
@@ -59,7 +59,7 @@
 
     /**
      * Gets the ending position of tree within file.  If tree is not found within
-     * file, or if the starting position is not available,
+     * file, or if the ending position is not available,
      * return {@link javax.tools.Diagnostic#NOPOS}.
      * The returned position must be at the end of the yield of this tree,
      * that is for any sub-tree of this tree, the following must hold:
--- a/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Dependencies.java	Wed May 08 10:10:05 2013 +0100
@@ -315,7 +315,7 @@
     static class SimpleLocation implements Location {
         public SimpleLocation(String name) {
             this.name = name;
-            this.className = name.replace('/', '.').replace('$', '.');
+            this.className = name.replace('/', '.');
         }
 
         public String getName() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ReferenceFinder.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.classfile;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import com.sun.tools.classfile.Instruction.TypeKind;
+import static com.sun.tools.classfile.ConstantPool.*;
+
+/**
+ * A utility class to find where in a ClassFile references
+ * a {@link CONSTANT_Methodref_info method},
+ * a {@link CONSTANT_InterfaceMethodref_info interface method,
+ * or a {@link CONSTANT_Fieldref_info field}.
+ */
+public final class ReferenceFinder {
+    /**
+     * Filter for ReferenceFinder of what constant pool entries for reference lookup.
+     */
+    public interface Filter {
+        /**
+         * Decides if the given CPRefInfo entry should be accepted or filtered.
+         *
+         * @param cpool  ConstantPool of the ClassFile being parsed
+         * @param cpref  constant pool entry representing a reference to
+         *               a fields method, and interface method.
+         * @return {@code true} if accepted; otherwise {@code false}
+         */
+        boolean accept(ConstantPool cpool, CPRefInfo cpref);
+    }
+
+    /**
+     * Visitor of individual method of a ClassFile that references the
+     * accepted field, method, or interface method references.
+     */
+    public interface Visitor {
+        /**
+         * Invoked for a method containing one or more accepted CPRefInfo entries
+         *
+         * @param cf      ClassFile
+         * @param method  Method that does the references the accepted references
+         * @param refs    Accepted constant pool method/field reference
+         */
+        void visit(ClassFile cf, Method method, List<CPRefInfo> refConstantPool);
+    }
+
+    private final Filter filter;
+    private final Visitor visitor;
+
+    /**
+     * Constructor.
+     */
+    public ReferenceFinder(Filter filter, Visitor visitor) {
+        this.filter = Objects.requireNonNull(filter);
+        this.visitor = Objects.requireNonNull(visitor);
+    }
+
+    /**
+     * Parses a given ClassFile and invoke the visitor if there is any reference
+     * to the constant pool entries referencing field, method, or
+     * interface method that are accepted. This method will return
+     * {@code true} if there is one or more accepted constant pool entries
+     * to lookup; otherwise, it will return {@code false}.
+     *
+     * @param  cf  ClassFile
+     * @return {@code true} if the given class file is processed to lookup
+     *         references
+     * @throws ConstantPoolException if an error of the constant pool
+     */
+    public boolean parse(ClassFile cf) throws ConstantPoolException {
+        List<Integer> cprefs = new ArrayList<Integer>();
+        int index = 1;
+        for (ConstantPool.CPInfo cpInfo : cf.constant_pool.entries()) {
+            if (cpInfo.accept(cpVisitor, cf.constant_pool)) {
+                cprefs.add(index);
+            }
+            index += cpInfo.size();
+        }
+
+        if (cprefs.isEmpty()) {
+            return false;
+        }
+
+        for (Method m : cf.methods) {
+            Set<Integer> ids = new HashSet<Integer>();
+            Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code);
+            if (c_attr != null) {
+                for (Instruction instr : c_attr.getInstructions()) {
+                    int idx = instr.accept(codeVisitor, cprefs);
+                    if (idx > 0) {
+                        ids.add(idx);
+                    }
+                }
+            }
+            if (ids.size() > 0) {
+                List<CPRefInfo> refInfos = new ArrayList<CPRefInfo>(ids.size());
+                for (int id : ids) {
+                    refInfos.add(CPRefInfo.class.cast(cf.constant_pool.get(id)));
+                }
+                visitor.visit(cf, m, refInfos);
+            }
+        }
+        return true;
+    }
+
+    private ConstantPool.Visitor<Boolean,ConstantPool> cpVisitor =
+            new ConstantPool.Visitor<Boolean,ConstantPool>()
+    {
+        public Boolean visitClass(CONSTANT_Class_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ConstantPool cpool) {
+            return filter.accept(cpool, info);
+        }
+
+        public Boolean visitMethodref(CONSTANT_Methodref_info info, ConstantPool cpool) {
+            return filter.accept(cpool, info);
+        }
+
+        public Boolean visitFieldref(CONSTANT_Fieldref_info info, ConstantPool cpool) {
+            return filter.accept(cpool, info);
+        }
+
+        public Boolean visitDouble(CONSTANT_Double_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitFloat(CONSTANT_Float_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitInteger(CONSTANT_Integer_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitLong(CONSTANT_Long_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitNameAndType(CONSTANT_NameAndType_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitMethodType(CONSTANT_MethodType_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitString(CONSTANT_String_info info, ConstantPool cpool) {
+            return false;
+        }
+
+        public Boolean visitUtf8(CONSTANT_Utf8_info info, ConstantPool cpool) {
+            return false;
+        }
+    };
+
+    private Instruction.KindVisitor<Integer, List<Integer>> codeVisitor =
+            new Instruction.KindVisitor<Integer, List<Integer>>()
+    {
+        public Integer visitNoOperands(Instruction instr, List<Integer> p) {
+            return 0;
+        }
+
+        public Integer visitArrayType(Instruction instr, TypeKind kind, List<Integer> p) {
+            return 0;
+        }
+
+        public Integer visitBranch(Instruction instr, int offset, List<Integer> p) {
+            return 0;
+        }
+
+        public Integer visitConstantPoolRef(Instruction instr, int index, List<Integer> p) {
+            return p.contains(index) ? index : 0;
+        }
+
+        public Integer visitConstantPoolRefAndValue(Instruction instr, int index, int value, List<Integer> p) {
+            return p.contains(index) ? index : 0;
+        }
+
+        public Integer visitLocal(Instruction instr, int index, List<Integer> p) {
+            return 0;
+        }
+
+        public Integer visitLocalAndValue(Instruction instr, int index, int value, List<Integer> p) {
+            return 0;
+        }
+
+        public Integer visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, List<Integer> p) {
+            return 0;
+        }
+
+        public Integer visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, List<Integer> p) {
+            return 0;
+        }
+
+        public Integer visitValue(Instruction instr, int value, List<Integer> p) {
+            return 0;
+        }
+
+        public Integer visitUnknown(Instruction instr, List<Integer> p) {
+            return 0;
+        }
+    };
+}
+
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,14 +43,16 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.source.doctree.DocCommentTree;
+import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.tree.CatchTree;
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.Scope;
 import com.sun.source.tree.Tree;
+import com.sun.source.util.DocSourcePositions;
+import com.sun.source.util.DocTreeScanner;
 import com.sun.source.util.DocTrees;
 import com.sun.source.util.JavacTask;
-import com.sun.source.util.SourcePositions;
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.code.Kinds;
@@ -76,8 +78,14 @@
 import com.sun.tools.javac.model.JavacElements;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.tree.DCTree;
+import com.sun.tools.javac.tree.DCTree.DCBlockTag;
 import com.sun.tools.javac.tree.DCTree.DCDocComment;
+import com.sun.tools.javac.tree.DCTree.DCEndPosTree;
+import com.sun.tools.javac.tree.DCTree.DCErroneous;
+import com.sun.tools.javac.tree.DCTree.DCIdentifier;
+import com.sun.tools.javac.tree.DCTree.DCParam;
 import com.sun.tools.javac.tree.DCTree.DCReference;
+import com.sun.tools.javac.tree.DCTree.DCText;
 import com.sun.tools.javac.tree.EndPosTable;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.*;
@@ -94,6 +102,7 @@
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Pair;
+import com.sun.tools.javac.util.Position;
 import static com.sun.tools.javac.code.TypeTag.*;
 
 /**
@@ -166,8 +175,8 @@
             javacTaskImpl = (JavacTaskImpl) t;
     }
 
-    public SourcePositions getSourcePositions() {
-        return new SourcePositions() {
+    public DocSourcePositions getSourcePositions() {
+        return new DocSourcePositions() {
                 public long getStartPosition(CompilationUnitTree file, Tree tree) {
                     return TreeInfo.getStartPos((JCTree) tree);
                 }
@@ -176,9 +185,80 @@
                     EndPosTable endPosTable = ((JCCompilationUnit) file).endPositions;
                     return TreeInfo.getEndPos((JCTree) tree, endPosTable);
                 }
+
+                public long getStartPosition(CompilationUnitTree file, DocCommentTree comment, DocTree tree) {
+                    return ((DCTree) tree).getSourcePosition((DCDocComment) comment);
+                }
+                @SuppressWarnings("fallthrough")
+                public long getEndPosition(CompilationUnitTree file, DocCommentTree comment, DocTree tree) {
+                    DCDocComment dcComment = (DCDocComment) comment;
+                    if (tree instanceof DCEndPosTree) {
+                        int endPos = ((DCEndPosTree) tree).getEndPos(dcComment);
+
+                        if (endPos != Position.NOPOS) {
+                            return endPos;
+                        }
+                    }
+                    int correction = 0;
+                    switch (tree.getKind()) {
+                        case TEXT:
+                            DCText text = (DCText) tree;
+
+                            return dcComment.comment.getSourcePos(text.pos + text.text.length());
+                        case ERRONEOUS:
+                            DCErroneous err = (DCErroneous) tree;
+
+                            return dcComment.comment.getSourcePos(err.pos + err.body.length());
+                        case IDENTIFIER:
+                            DCIdentifier ident = (DCIdentifier) tree;
+
+                            return dcComment.comment.getSourcePos(ident.pos + (ident.name != names.error ? ident.name.length() : 0));
+                        case PARAM:
+                            DCParam param = (DCParam) tree;
+
+                            if (param.isTypeParameter && param.getDescription().isEmpty()) {
+                                correction = 1;
+                            }
+                        case AUTHOR: case DEPRECATED: case RETURN: case SEE:
+                        case SERIAL: case SERIAL_DATA: case SERIAL_FIELD: case SINCE:
+                        case THROWS: case UNKNOWN_BLOCK_TAG: case VERSION: {
+                            DocTree last = getLastChild(tree);
+
+                            if (last != null) {
+                                return getEndPosition(file, comment, last) + correction;
+                            }
+
+                            DCBlockTag block = (DCBlockTag) tree;
+
+                            return dcComment.comment.getSourcePos(block.pos + block.getTagName().length() + 1);
+                        }
+                        default:
+                            DocTree last = getLastChild(tree);
+
+                            if (last != null) {
+                                return getEndPosition(file, comment, last);
+                            }
+                            break;
+                    }
+
+                    return Position.NOPOS;
+                }
             };
     }
 
+    private DocTree getLastChild(DocTree tree) {
+        final DocTree[] last = new DocTree[] {null};
+
+        tree.accept(new DocTreeScanner<Void, Void>() {
+            @Override public Void scan(DocTree node, Void p) {
+                if (node != null) last[0] = node;
+                return null;
+            }
+        }, null);
+
+        return last[0];
+    }
+
     public JCClassDecl getTree(TypeElement element) {
         return (JCClassDecl) getTree((Element) element);
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Wed May 08 10:10:05 2013 +0100
@@ -465,19 +465,12 @@
      * This is the implementation for {@code
      * javax.lang.model.element.Element.getAnnotationMirrors()}.
      */
-    public final List<? extends AnnotationMirror> getAnnotationMirrors() {
+    @Override
+    public List<Attribute.Compound> getAnnotationMirrors() {
         return getRawAttributes();
     }
 
     /**
-     * TODO: Should there be a {@code
-     * javax.lang.model.element.Element.getTypeAnnotationMirrors()}.
-     */
-    public final List<Attribute.TypeCompound> getTypeAnnotationMirrors() {
-        return getRawTypeAttributes();
-    }
-
-    /**
      * @deprecated this method should never be used by javac internally.
      */
     @Deprecated
@@ -657,6 +650,24 @@
         }
 
         @Override
+        public List<Attribute.Compound> getAnnotationMirrors() {
+            return onlyTypeVariableAnnotations(owner.getRawTypeAttributes());
+        }
+
+        private List<Attribute.Compound> onlyTypeVariableAnnotations(
+                List<Attribute.TypeCompound> candidates) {
+            // Declaration annotations on TypeParameters are stored in type attributes
+            List<Attribute.Compound> res = List.nil();
+            for (Attribute.TypeCompound a : candidates) {
+                if (a.position.type == TargetType.CLASS_TYPE_PARAMETER ||
+                    a.position.type == TargetType.METHOD_TYPE_PARAMETER)
+                    res = res.prepend(a);
+            }
+
+            return res = res.reverse();
+        }
+
+        @Override
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return v.visitTypeParameter(this, p);
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Wed May 08 10:10:05 2013 +0100
@@ -206,7 +206,7 @@
                     sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
                 // Make sure all type annotations from the symbol are also
                 // on the owner.
-                sym.owner.annotations.appendUniqueTypes(sym.getTypeAnnotationMirrors());
+                sym.owner.annotations.appendUniqueTypes(sym.getRawTypeAttributes());
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed May 08 10:10:05 2013 +0100
@@ -1078,7 +1078,8 @@
                 mask = MethodFlags;
             }
             // Imply STRICTFP if owner has STRICTFP set.
-            if (((flags|implicit) & Flags.ABSTRACT) == 0)
+            if (((flags|implicit) & Flags.ABSTRACT) == 0 ||
+                ((flags) & Flags.DEFAULT) != 0)
                 implicit |= sym.owner.flags_field & STRICTFP;
             break;
         case TYP:
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed May 08 10:10:05 2013 +0100
@@ -35,7 +35,6 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.comp.Resolve;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -277,6 +276,15 @@
     }
 
     /**
+     * Utility method to reset several Bits instances.
+     */
+    private void resetBits(Bits... bits) {
+        for (Bits b : bits) {
+            b.reset();
+        }
+    }
+
+    /**
      * Base visitor class for all visitors implementing dataflow analysis logic.
      * This class define the shared logic for handling jumps (break/continue statements).
      */
@@ -1294,11 +1302,11 @@
 
         /** The set of definitely assigned variables.
          */
-        Bits inits;
+        final Bits inits;
 
         /** The set of definitely unassigned variables.
          */
-        Bits uninits;
+        final Bits uninits;
 
         /** The set of variables that are definitely unassigned everywhere
          *  in current try block. This variable is maintained lazily; it is
@@ -1308,15 +1316,15 @@
          *  anywhere in current try block, intersect uninitsTry and
          *  uninits.
          */
-        Bits uninitsTry;
+        final Bits uninitsTry;
 
         /** When analyzing a condition, inits and uninits are null.
          *  Instead we have:
          */
-        Bits initsWhenTrue;
-        Bits initsWhenFalse;
-        Bits uninitsWhenTrue;
-        Bits uninitsWhenFalse;
+        final Bits initsWhenTrue;
+        final Bits initsWhenFalse;
+        final Bits uninitsWhenTrue;
+        final Bits uninitsWhenFalse;
 
         /** A mapping from addresses to variable symbols.
          */
@@ -1348,15 +1356,25 @@
         /** The starting position of the analysed tree */
         int startPos;
 
+        AssignAnalyzer() {
+            inits = new Bits();
+            uninits = new Bits();
+            uninitsTry = new Bits();
+            initsWhenTrue = new Bits(true);
+            initsWhenFalse = new Bits(true);
+            uninitsWhenTrue = new Bits(true);
+            uninitsWhenFalse = new Bits(true);
+        }
+
         class AssignPendingExit extends BaseAnalyzer.PendingExit {
 
-            Bits exit_inits;
-            Bits exit_uninits;
+            final Bits exit_inits = new Bits(true);
+            final Bits exit_uninits = new Bits(true);
 
-            AssignPendingExit(JCTree tree, Bits inits, Bits uninits) {
+            AssignPendingExit(JCTree tree, final Bits inits, final Bits uninits) {
                 super(tree);
-                this.exit_inits = inits.dup();
-                this.exit_uninits = uninits.dup();
+                this.exit_inits.assign(inits);
+                this.exit_uninits.assign(uninits);
             }
 
             void resolveJump() {
@@ -1476,19 +1494,20 @@
         /** Split (duplicate) inits/uninits into WhenTrue/WhenFalse sets
          */
         void split(boolean setToNull) {
-            initsWhenFalse = inits.dup();
-            uninitsWhenFalse = uninits.dup();
-            initsWhenTrue = inits;
-            uninitsWhenTrue = uninits;
-            if (setToNull)
-                inits = uninits = null;
+            initsWhenFalse.assign(inits);
+            uninitsWhenFalse.assign(uninits);
+            initsWhenTrue.assign(inits);
+            uninitsWhenTrue.assign(uninits);
+            if (setToNull) {
+                resetBits(inits, uninits);
+            }
         }
 
         /** Merge (intersect) inits/uninits from WhenTrue/WhenFalse sets.
          */
         void merge() {
-            inits = initsWhenFalse.andSet(initsWhenTrue);
-            uninits = uninitsWhenFalse.andSet(uninitsWhenTrue);
+            inits.assign(initsWhenFalse.andSet(initsWhenTrue));
+            uninits.assign(uninitsWhenFalse.andSet(uninitsWhenTrue));
         }
 
     /* ************************************************************************
@@ -1501,7 +1520,7 @@
         void scanExpr(JCTree tree) {
             if (tree != null) {
                 scan(tree);
-                if (inits == null) merge();
+                if (inits.isReset()) merge();
             }
         }
 
@@ -1518,28 +1537,29 @@
          */
         void scanCond(JCTree tree) {
             if (tree.type.isFalse()) {
-                if (inits == null) merge();
-                initsWhenTrue = inits.dup();
+                if (inits.isReset()) merge();
+                initsWhenTrue.assign(inits);
                 initsWhenTrue.inclRange(firstadr, nextadr);
-                uninitsWhenTrue = uninits.dup();
+                uninitsWhenTrue.assign(uninits);
                 uninitsWhenTrue.inclRange(firstadr, nextadr);
-                initsWhenFalse = inits;
-                uninitsWhenFalse = uninits;
+                initsWhenFalse.assign(inits);
+                uninitsWhenFalse.assign(uninits);
             } else if (tree.type.isTrue()) {
-                if (inits == null) merge();
-                initsWhenFalse = inits.dup();
+                if (inits.isReset()) merge();
+                initsWhenFalse.assign(inits);
                 initsWhenFalse.inclRange(firstadr, nextadr);
-                uninitsWhenFalse = uninits.dup();
+                uninitsWhenFalse.assign(uninits);
                 uninitsWhenFalse.inclRange(firstadr, nextadr);
-                initsWhenTrue = inits;
-                uninitsWhenTrue = uninits;
+                initsWhenTrue.assign(inits);
+                uninitsWhenTrue.assign(uninits);
             } else {
                 scan(tree);
-                if (inits != null)
+                if (!inits.isReset())
                     split(tree.type != syms.unknownType);
             }
-            if (tree.type != syms.unknownType)
-                inits = uninits = null;
+            if (tree.type != syms.unknownType) {
+                resetBits(inits, uninits);
+            }
         }
 
         /* ------------ Visitor methods for various sorts of trees -------------*/
@@ -1619,8 +1639,8 @@
         public void visitMethodDef(JCMethodDecl tree) {
             if (tree.body == null) return;
 
-            Bits initsPrev = inits.dup();
-            Bits uninitsPrev = uninits.dup();
+            final Bits initsPrev = new Bits(inits);
+            final Bits uninitsPrev = new Bits(uninits);
             int nextadrPrev = nextadr;
             int firstadrPrev = firstadr;
             int returnadrPrev = returnadr;
@@ -1658,14 +1678,14 @@
                     exits = exits.tail;
                     Assert.check(exit.tree.hasTag(RETURN), exit.tree);
                     if (isInitialConstructor) {
-                        inits = exit.exit_inits;
+                        inits.assign(exit.exit_inits);
                         for (int i = firstadr; i < nextadr; i++)
                             checkInit(exit.tree.pos(), vars[i]);
                     }
                 }
             } finally {
-                inits = initsPrev;
-                uninits = uninitsPrev;
+                inits.assign(initsPrev);
+                uninits.assign(uninitsPrev);
                 nextadr = nextadrPrev;
                 firstadr = firstadrPrev;
                 returnadr = returnadrPrev;
@@ -1698,31 +1718,31 @@
             ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
             FlowKind prevFlowKind = flowKind;
             flowKind = FlowKind.NORMAL;
-            Bits initsSkip = null;
-            Bits uninitsSkip = null;
+            final Bits initsSkip = new Bits(true);
+            final Bits uninitsSkip = new Bits(true);
             pendingExits = new ListBuffer<AssignPendingExit>();
             int prevErrors = log.nerrors;
             do {
-                Bits uninitsEntry = uninits.dup();
+                final Bits uninitsEntry = new Bits(uninits);
                 uninitsEntry.excludeFrom(nextadr);
                 scan(tree.body);
                 resolveContinues(tree);
                 scanCond(tree.cond);
                 if (!flowKind.isFinal()) {
-                    initsSkip = initsWhenFalse;
-                    uninitsSkip = uninitsWhenFalse;
+                    initsSkip.assign(initsWhenFalse);
+                    uninitsSkip.assign(uninitsWhenFalse);
                 }
                 if (log.nerrors !=  prevErrors ||
                     flowKind.isFinal() ||
-                    uninitsEntry.dup().diffSet(uninitsWhenTrue).nextBit(firstadr)==-1)
+                    new Bits(uninitsEntry).diffSet(uninitsWhenTrue).nextBit(firstadr)==-1)
                     break;
-                inits = initsWhenTrue;
-                uninits = uninitsEntry.andSet(uninitsWhenTrue);
+                inits.assign(initsWhenTrue);
+                uninits.assign(uninitsEntry.andSet(uninitsWhenTrue));
                 flowKind = FlowKind.SPECULATIVE_LOOP;
             } while (true);
             flowKind = prevFlowKind;
-            inits = initsSkip;
-            uninits = uninitsSkip;
+            inits.assign(initsSkip);
+            uninits.assign(uninitsSkip);
             resolveBreaks(tree, prevPendingExits);
         }
 
@@ -1730,34 +1750,34 @@
             ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
             FlowKind prevFlowKind = flowKind;
             flowKind = FlowKind.NORMAL;
-            Bits initsSkip = null;
-            Bits uninitsSkip = null;
+            final Bits initsSkip = new Bits(true);
+            final Bits uninitsSkip = new Bits(true);
             pendingExits = new ListBuffer<AssignPendingExit>();
             int prevErrors = log.nerrors;
-            Bits uninitsEntry = uninits.dup();
+            final Bits uninitsEntry = new Bits(uninits);
             uninitsEntry.excludeFrom(nextadr);
             do {
                 scanCond(tree.cond);
                 if (!flowKind.isFinal()) {
-                    initsSkip = initsWhenFalse;
-                    uninitsSkip = uninitsWhenFalse;
+                    initsSkip.assign(initsWhenFalse) ;
+                    uninitsSkip.assign(uninitsWhenFalse);
                 }
-                inits = initsWhenTrue;
-                uninits = uninitsWhenTrue;
+                inits.assign(initsWhenTrue);
+                uninits.assign(uninitsWhenTrue);
                 scan(tree.body);
                 resolveContinues(tree);
                 if (log.nerrors != prevErrors ||
                     flowKind.isFinal() ||
-                    uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
+                    new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1)
                     break;
-                uninits = uninitsEntry.andSet(uninits);
+                uninits.assign(uninitsEntry.andSet(uninits));
                 flowKind = FlowKind.SPECULATIVE_LOOP;
             } while (true);
             flowKind = prevFlowKind;
             //a variable is DA/DU after the while statement, if it's DA/DU assuming the
             //branch is not taken AND if it's DA/DU before any break statement
-            inits = initsSkip;
-            uninits = uninitsSkip;
+            inits.assign(initsSkip);
+            uninits.assign(uninitsSkip);
             resolveBreaks(tree, prevPendingExits);
         }
 
@@ -1767,25 +1787,25 @@
             flowKind = FlowKind.NORMAL;
             int nextadrPrev = nextadr;
             scan(tree.init);
-            Bits initsSkip = null;
-            Bits uninitsSkip = null;
+            final Bits initsSkip = new Bits(true);
+            final Bits uninitsSkip = new Bits(true);
             pendingExits = new ListBuffer<AssignPendingExit>();
             int prevErrors = log.nerrors;
             do {
-                Bits uninitsEntry = uninits.dup();
+                final Bits uninitsEntry = new Bits(uninits);
                 uninitsEntry.excludeFrom(nextadr);
                 if (tree.cond != null) {
                     scanCond(tree.cond);
                     if (!flowKind.isFinal()) {
-                        initsSkip = initsWhenFalse;
-                        uninitsSkip = uninitsWhenFalse;
+                        initsSkip.assign(initsWhenFalse);
+                        uninitsSkip.assign(uninitsWhenFalse);
                     }
-                    inits = initsWhenTrue;
-                    uninits = uninitsWhenTrue;
+                    inits.assign(initsWhenTrue);
+                    uninits.assign(uninitsWhenTrue);
                 } else if (!flowKind.isFinal()) {
-                    initsSkip = inits.dup();
+                    initsSkip.assign(inits);
                     initsSkip.inclRange(firstadr, nextadr);
-                    uninitsSkip = uninits.dup();
+                    uninitsSkip.assign(uninits);
                     uninitsSkip.inclRange(firstadr, nextadr);
                 }
                 scan(tree.body);
@@ -1793,16 +1813,16 @@
                 scan(tree.step);
                 if (log.nerrors != prevErrors ||
                     flowKind.isFinal() ||
-                    uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
+                    new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1)
                     break;
-                uninits = uninitsEntry.andSet(uninits);
+                uninits.assign(uninitsEntry.andSet(uninits));
                 flowKind = FlowKind.SPECULATIVE_LOOP;
             } while (true);
             flowKind = prevFlowKind;
             //a variable is DA/DU after a for loop, if it's DA/DU assuming the
             //branch is not taken AND if it's DA/DU before any break statement
-            inits = initsSkip;
-            uninits = uninitsSkip;
+            inits.assign(initsSkip);
+            uninits.assign(uninitsSkip);
             resolveBreaks(tree, prevPendingExits);
             nextadr = nextadrPrev;
         }
@@ -1815,27 +1835,27 @@
             flowKind = FlowKind.NORMAL;
             int nextadrPrev = nextadr;
             scan(tree.expr);
-            Bits initsStart = inits.dup();
-            Bits uninitsStart = uninits.dup();
+            final Bits initsStart = new Bits(inits);
+            final Bits uninitsStart = new Bits(uninits);
 
             letInit(tree.pos(), tree.var.sym);
             pendingExits = new ListBuffer<AssignPendingExit>();
             int prevErrors = log.nerrors;
             do {
-                Bits uninitsEntry = uninits.dup();
+                final Bits uninitsEntry = new Bits(uninits);
                 uninitsEntry.excludeFrom(nextadr);
                 scan(tree.body);
                 resolveContinues(tree);
                 if (log.nerrors != prevErrors ||
                     flowKind.isFinal() ||
-                    uninitsEntry.dup().diffSet(uninits).nextBit(firstadr) == -1)
+                    new Bits(uninitsEntry).diffSet(uninits).nextBit(firstadr) == -1)
                     break;
-                uninits = uninitsEntry.andSet(uninits);
+                uninits.assign(uninitsEntry.andSet(uninits));
                 flowKind = FlowKind.SPECULATIVE_LOOP;
             } while (true);
             flowKind = prevFlowKind;
-            inits = initsStart;
-            uninits = uninitsStart.andSet(uninits);
+            inits.assign(initsStart);
+            uninits.assign(uninitsStart.andSet(uninits));
             resolveBreaks(tree, prevPendingExits);
             nextadr = nextadrPrev;
         }
@@ -1852,12 +1872,12 @@
             pendingExits = new ListBuffer<AssignPendingExit>();
             int nextadrPrev = nextadr;
             scanExpr(tree.selector);
-            Bits initsSwitch = inits;
-            Bits uninitsSwitch = uninits.dup();
+            final Bits initsSwitch = new Bits(inits);
+            final Bits uninitsSwitch = new Bits(uninits);
             boolean hasDefault = false;
             for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
-                inits = initsSwitch.dup();
-                uninits = uninits.andSet(uninitsSwitch);
+                inits.assign(initsSwitch);
+                uninits.assign(uninits.andSet(uninitsSwitch));
                 JCCase c = l.head;
                 if (c.pat == null)
                     hasDefault = true;
@@ -1875,8 +1895,8 @@
         }
         // where
             /** Add any variables defined in stats to inits and uninits. */
-            private void addVars(List<JCStatement> stats, Bits inits,
-                                        Bits uninits) {
+            private void addVars(List<JCStatement> stats, final Bits inits,
+                                        final Bits uninits) {
                 for (;stats.nonEmpty(); stats = stats.tail) {
                     JCTree stat = stats.head;
                     if (stat.hasTag(VARDEF)) {
@@ -1889,11 +1909,11 @@
 
         public void visitTry(JCTry tree) {
             ListBuffer<JCVariableDecl> resourceVarDecls = ListBuffer.lb();
-            Bits uninitsTryPrev = uninitsTry;
+            final Bits uninitsTryPrev = new Bits(uninitsTry);
             ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
             pendingExits = new ListBuffer<AssignPendingExit>();
-            Bits initsTry = inits.dup();
-            uninitsTry = uninits.dup();
+            final Bits initsTry = new Bits(inits);
+            uninitsTry.assign(uninits);
             for (JCTree resource : tree.resources) {
                 if (resource instanceof JCVariableDecl) {
                     JCVariableDecl vdecl = (JCVariableDecl) resource;
@@ -1908,8 +1928,8 @@
             }
             scan(tree.body);
             uninitsTry.andSet(uninits);
-            Bits initsEnd = inits;
-            Bits uninitsEnd = uninits;
+            final Bits initsEnd = new Bits(inits);
+            final Bits uninitsEnd = new Bits(uninits);
             int nextadrCatch = nextadr;
 
             if (!resourceVarDecls.isEmpty() &&
@@ -1925,8 +1945,8 @@
 
             for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
                 JCVariableDecl param = l.head.param;
-                inits = initsTry.dup();
-                uninits = uninitsTry.dup();
+                inits.assign(initsTry);
+                uninits.assign(uninitsTry);
                 scan(param);
                 inits.incl(param.sym.adr);
                 uninits.excl(param.sym.adr);
@@ -1936,8 +1956,8 @@
                 nextadr = nextadrCatch;
             }
             if (tree.finalizer != null) {
-                inits = initsTry.dup();
-                uninits = uninitsTry.dup();
+                inits.assign(initsTry);
+                uninits.assign(uninitsTry);
                 ListBuffer<AssignPendingExit> exits = pendingExits;
                 pendingExits = prevPendingExits;
                 scan(tree.finalizer);
@@ -1958,8 +1978,8 @@
                     inits.orSet(initsEnd);
                 }
             } else {
-                inits = initsEnd;
-                uninits = uninitsEnd;
+                inits.assign(initsEnd);
+                uninits.assign(uninitsEnd);
                 ListBuffer<AssignPendingExit> exits = pendingExits;
                 pendingExits = prevPendingExits;
                 while (exits.nonEmpty()) pendingExits.append(exits.next());
@@ -1969,10 +1989,10 @@
 
         public void visitConditional(JCConditional tree) {
             scanCond(tree.cond);
-            Bits initsBeforeElse = initsWhenFalse;
-            Bits uninitsBeforeElse = uninitsWhenFalse;
-            inits = initsWhenTrue;
-            uninits = uninitsWhenTrue;
+            final Bits initsBeforeElse = new Bits(initsWhenFalse);
+            final Bits uninitsBeforeElse = new Bits(uninitsWhenFalse);
+            inits.assign(initsWhenTrue);
+            uninits.assign(uninitsWhenTrue);
             if (tree.truepart.type.hasTag(BOOLEAN) &&
                 tree.falsepart.type.hasTag(BOOLEAN)) {
                 // if b and c are boolean valued, then
@@ -1980,12 +2000,12 @@
                 //    v is (un)assigned after b when true and
                 //    v is (un)assigned after c when true
                 scanCond(tree.truepart);
-                Bits initsAfterThenWhenTrue = initsWhenTrue.dup();
-                Bits initsAfterThenWhenFalse = initsWhenFalse.dup();
-                Bits uninitsAfterThenWhenTrue = uninitsWhenTrue.dup();
-                Bits uninitsAfterThenWhenFalse = uninitsWhenFalse.dup();
-                inits = initsBeforeElse;
-                uninits = uninitsBeforeElse;
+                final Bits initsAfterThenWhenTrue = new Bits(initsWhenTrue);
+                final Bits initsAfterThenWhenFalse = new Bits(initsWhenFalse);
+                final Bits uninitsAfterThenWhenTrue = new Bits(uninitsWhenTrue);
+                final Bits uninitsAfterThenWhenFalse = new Bits(uninitsWhenFalse);
+                inits.assign(initsBeforeElse);
+                uninits.assign(uninitsBeforeElse);
                 scanCond(tree.falsepart);
                 initsWhenTrue.andSet(initsAfterThenWhenTrue);
                 initsWhenFalse.andSet(initsAfterThenWhenFalse);
@@ -1993,10 +2013,10 @@
                 uninitsWhenFalse.andSet(uninitsAfterThenWhenFalse);
             } else {
                 scanExpr(tree.truepart);
-                Bits initsAfterThen = inits.dup();
-                Bits uninitsAfterThen = uninits.dup();
-                inits = initsBeforeElse;
-                uninits = uninitsBeforeElse;
+                final Bits initsAfterThen = new Bits(inits);
+                final Bits uninitsAfterThen = new Bits(uninits);
+                inits.assign(initsBeforeElse);
+                uninits.assign(uninitsBeforeElse);
                 scanExpr(tree.falsepart);
                 inits.andSet(initsAfterThen);
                 uninits.andSet(uninitsAfterThen);
@@ -2005,16 +2025,16 @@
 
         public void visitIf(JCIf tree) {
             scanCond(tree.cond);
-            Bits initsBeforeElse = initsWhenFalse;
-            Bits uninitsBeforeElse = uninitsWhenFalse;
-            inits = initsWhenTrue;
-            uninits = uninitsWhenTrue;
+            final Bits initsBeforeElse = new Bits(initsWhenFalse);
+            final Bits uninitsBeforeElse = new Bits(uninitsWhenFalse);
+            inits.assign(initsWhenTrue);
+            uninits.assign(uninitsWhenTrue);
             scan(tree.thenpart);
             if (tree.elsepart != null) {
-                Bits initsAfterThen = inits.dup();
-                Bits uninitsAfterThen = uninits.dup();
-                inits = initsBeforeElse;
-                uninits = uninitsBeforeElse;
+                final Bits initsAfterThen = new Bits(inits);
+                final Bits uninitsAfterThen = new Bits(uninits);
+                inits.assign(initsBeforeElse);
+                uninits.assign(uninitsBeforeElse);
                 scan(tree.elsepart);
                 inits.andSet(initsAfterThen);
                 uninits.andSet(uninitsAfterThen);
@@ -2055,8 +2075,8 @@
 
         @Override
         public void visitLambda(JCLambda tree) {
-            Bits prevUninits = uninits;
-            Bits prevInits = inits;
+            final Bits prevUninits = new Bits(uninits);
+            final Bits prevInits = new Bits(inits);
             int returnadrPrev = returnadr;
             ListBuffer<AssignPendingExit> prevPending = pendingExits;
             try {
@@ -2076,8 +2096,8 @@
             }
             finally {
                 returnadr = returnadrPrev;
-                uninits = prevUninits;
-                inits = prevInits;
+                uninits.assign(prevUninits);
+                inits.assign(prevInits);
                 pendingExits = prevPending;
             }
         }
@@ -2088,17 +2108,17 @@
         }
 
         public void visitAssert(JCAssert tree) {
-            Bits initsExit = inits.dup();
-            Bits uninitsExit = uninits.dup();
+            final Bits initsExit = new Bits(inits);
+            final Bits uninitsExit = new Bits(uninits);
             scanCond(tree.cond);
             uninitsExit.andSet(uninitsWhenTrue);
             if (tree.detail != null) {
-                inits = initsWhenFalse;
-                uninits = uninitsWhenFalse;
+                inits.assign(initsWhenFalse);
+                uninits.assign(uninitsWhenFalse);
                 scanExpr(tree.detail);
             }
-            inits = initsExit;
-            uninits = uninitsExit;
+            inits.assign(initsExit);
+            uninits.assign(uninitsExit);
         }
 
         public void visitAssign(JCAssign tree) {
@@ -2120,12 +2140,12 @@
             switch (tree.getTag()) {
             case NOT:
                 scanCond(tree.arg);
-                Bits t = initsWhenFalse;
-                initsWhenFalse = initsWhenTrue;
-                initsWhenTrue = t;
-                t = uninitsWhenFalse;
-                uninitsWhenFalse = uninitsWhenTrue;
-                uninitsWhenTrue = t;
+                final Bits t = new Bits(initsWhenFalse);
+                initsWhenFalse.assign(initsWhenTrue);
+                initsWhenTrue.assign(t);
+                t.assign(uninitsWhenFalse);
+                uninitsWhenFalse.assign(uninitsWhenTrue);
+                uninitsWhenTrue.assign(t);
                 break;
             case PREINC: case POSTINC:
             case PREDEC: case POSTDEC:
@@ -2141,20 +2161,20 @@
             switch (tree.getTag()) {
             case AND:
                 scanCond(tree.lhs);
-                Bits initsWhenFalseLeft = initsWhenFalse;
-                Bits uninitsWhenFalseLeft = uninitsWhenFalse;
-                inits = initsWhenTrue;
-                uninits = uninitsWhenTrue;
+                final Bits initsWhenFalseLeft = new Bits(initsWhenFalse);
+                final Bits uninitsWhenFalseLeft = new Bits(uninitsWhenFalse);
+                inits.assign(initsWhenTrue);
+                uninits.assign(uninitsWhenTrue);
                 scanCond(tree.rhs);
                 initsWhenFalse.andSet(initsWhenFalseLeft);
                 uninitsWhenFalse.andSet(uninitsWhenFalseLeft);
                 break;
             case OR:
                 scanCond(tree.lhs);
-                Bits initsWhenTrueLeft = initsWhenTrue;
-                Bits uninitsWhenTrueLeft = uninitsWhenTrue;
-                inits = initsWhenFalse;
-                uninits = uninitsWhenFalse;
+                final Bits initsWhenTrueLeft = new Bits(initsWhenTrue);
+                final Bits uninitsWhenTrueLeft = new Bits(uninitsWhenTrue);
+                inits.assign(initsWhenFalse);
+                uninits.assign(uninitsWhenFalse);
                 scanCond(tree.rhs);
                 initsWhenTrue.andSet(initsWhenTrueLeft);
                 uninitsWhenTrue.andSet(uninitsWhenTrueLeft);
@@ -2200,11 +2220,7 @@
                 attrEnv = env;
                 Flow.this.make = make;
                 startPos = tree.pos().getStartPosition();
-                inits = new Bits();
-                uninits = new Bits();
-                uninitsTry = new Bits();
-                initsWhenTrue = initsWhenFalse =
-                    uninitsWhenTrue = uninitsWhenFalse = null;
+
                 if (vars == null)
                     vars = new VarSymbol[32];
                 else
@@ -2219,9 +2235,8 @@
             } finally {
                 // note that recursive invocations of this method fail hard
                 startPos = -1;
-                inits = uninits = uninitsTry = null;
-                initsWhenTrue = initsWhenFalse =
-                    uninitsWhenTrue = uninitsWhenFalse = null;
+                resetBits(inits, uninits, uninitsTry, initsWhenTrue,
+                        initsWhenFalse, uninitsWhenTrue, uninitsWhenFalse);
                 if (vars != null) for (int i=0; i<vars.length; i++)
                     vars[i] = null;
                 firstadr = 0;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed May 08 10:10:05 2013 +0100
@@ -40,10 +40,9 @@
 import com.sun.tools.javac.code.Symbol.VarSymbol;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ClassType;
 import com.sun.tools.javac.code.Type.MethodType;
 import com.sun.tools.javac.code.Types;
-import com.sun.tools.javac.comp.LambdaToMethod.LambdaAnalyzer.*;
+import com.sun.tools.javac.comp.LambdaToMethod.LambdaAnalyzerPreprocessor.*;
 import com.sun.tools.javac.comp.Lower.BasicFreeVarCollector;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.util.*;
@@ -81,7 +80,7 @@
     private Env<AttrContext> attrEnv;
 
     /** the analyzer scanner */
-    private LambdaAnalyzer analyzer;
+    private LambdaAnalyzerPreprocessor analyzer;
 
     /** map from lambda trees to translation contexts */
     private Map<JCTree, TranslationContext<?>> contextMap;
@@ -156,7 +155,7 @@
         make = TreeMaker.instance(context);
         types = Types.instance(context);
         transTypes = TransTypes.instance(context);
-        analyzer = new LambdaAnalyzer();
+        analyzer = new LambdaAnalyzerPreprocessor();
     }
     // </editor-fold>
 
@@ -206,7 +205,7 @@
     public void visitClassDef(JCClassDecl tree) {
         if (tree.sym.owner.kind == PCK) {
             //analyze class
-            analyzer.analyzeClass(tree);
+            tree = analyzer.analyzeAndPreprocessClass(tree);
         }
         KlassInfo prevKlassInfo = kInfo;
         try {
@@ -531,16 +530,25 @@
     /** Make an attributed class instance creation expression.
      *  @param ctype    The class type.
      *  @param args     The constructor arguments.
+     *  @param cons     The constructor symbol
      */
-    JCNewClass makeNewClass(Type ctype, List<JCExpression> args) {
+    JCNewClass makeNewClass(Type ctype, List<JCExpression> args, Symbol cons) {
         JCNewClass tree = make.NewClass(null,
             null, make.QualIdent(ctype.tsym), args, null);
-        tree.constructor = rs.resolveConstructor(
-            null, attrEnv, ctype, TreeInfo.types(args), List.<Type>nil());
+        tree.constructor = cons;
         tree.type = ctype;
         return tree;
     }
 
+    /** Make an attributed class instance creation expression.
+     *  @param ctype    The class type.
+     *  @param args     The constructor arguments.
+     */
+    JCNewClass makeNewClass(Type ctype, List<JCExpression> args) {
+        return makeNewClass(ctype, args,
+                rs.resolveConstructor(null, attrEnv, ctype, TreeInfo.types(args), List.<Type>nil()));
+     }
+
     private void addDeserializationCase(int implMethodKind, Symbol refSym, Type targetType, MethodSymbol samSym,
             DiagnosticPosition pos, List<Object> staticArgs, MethodType indyType) {
         String functionalInterfaceClass = classSig(targetType);
@@ -1019,8 +1027,9 @@
      * This visitor collects information about translation of a lambda expression.
      * More specifically, it keeps track of the enclosing contexts and captured locals
      * accessed by the lambda being translated (as well as other useful info).
+     * It also translates away problems for LambdaToMethod.
      */
-    class LambdaAnalyzer extends TreeScanner {
+    class LambdaAnalyzerPreprocessor extends TreeTranslator {
 
         /** the frame stack - used to reconstruct translation info about enclosing scopes */
         private List<Frame> frameStack;
@@ -1047,10 +1056,10 @@
         private Map<ClassSymbol, Symbol> clinits =
                 new HashMap<ClassSymbol, Symbol>();
 
-        private void analyzeClass(JCClassDecl tree) {
+        private JCClassDecl analyzeAndPreprocessClass(JCClassDecl tree) {
             frameStack = List.nil();
             localClassDefs = new HashMap<Symbol, JCClassDecl>();
-            scan(tree);
+            return translate(tree);
         }
 
         @Override
@@ -1154,7 +1163,7 @@
                     frameStack.head.addLocal(param.sym);
                 }
                 contextMap.put(tree, context);
-                scan(tree.body);
+                super.visitLambda(tree);
                 context.complete();
             }
             finally {
@@ -1220,12 +1229,47 @@
                     };
                     fvc.scan(localCDef);
                 }
-            }
+        }
 
+        /**
+         * Method references to local class constructors, may, if the local
+         * class references local variables, have implicit constructor
+         * parameters added in Lower; As a result, the invokedynamic bootstrap
+         * information added in the LambdaToMethod pass will have the wrong
+         * signature. Hooks between Lower and LambdaToMethod have been added to
+         * handle normal "new" in this case. This visitor converts potentially
+         * effected method references into a lambda containing a normal "new" of
+         * the class.
+         *
+         * @param tree
+         */
         @Override
         public void visitReference(JCMemberReference tree) {
-            scan(tree.getQualifierExpression());
-            contextMap.put(tree, makeReferenceContext(tree));
+            if (tree.getMode() == ReferenceMode.NEW
+                    && tree.kind != ReferenceKind.ARRAY_CTOR
+                    && tree.sym.owner.isLocal()) {
+                MethodSymbol consSym = (MethodSymbol) tree.sym;
+                List<Type> ptypes = ((MethodType) consSym.type).getParameterTypes();
+                Type classType = consSym.owner.type;
+
+                // Make new-class call
+                List<JCVariableDecl> params = make.Params(ptypes, owner());
+                JCNewClass nc = makeNewClass(classType, make.Idents(params));
+                nc.pos = tree.pos;
+
+                // Make lambda holding the new-class call
+                JCLambda slam = make.Lambda(params, nc);
+                slam.descriptorType = tree.descriptorType;
+                slam.targets = tree.targets;
+                slam.type = tree.type;
+                slam.pos = tree.pos;
+
+                // Now it is a lambda, process as such
+                visitLambda(slam);
+            } else {
+                super.visitReference(tree);
+                contextMap.put(tree, makeReferenceContext(tree));
+            }
         }
 
         @Override
@@ -1240,10 +1284,8 @@
                     }
                     localContext = localContext.prev;
                 }
-                scan(tree.selected);
-            } else {
-                super.visitSelect(tree);
             }
+            super.visitSelect(tree);
         }
 
         @Override
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed May 08 10:10:05 2013 +0100
@@ -1647,7 +1647,7 @@
         State dup() {
             try {
                 State state = (State)super.clone();
-                state.defined = defined.dup();
+                state.defined = new Bits(defined);
                 state.stack = stack.clone();
                 if (locks != null) state.locks = locks.clone();
                 if (debugCode) {
@@ -1775,7 +1775,7 @@
         }
 
         State join(State other) {
-            defined = defined.andSet(other.defined);
+            defined.andSet(other.defined);
             Assert.check(stacksize == other.stacksize
                     && nlocks == other.nlocks);
             for (int i=0; i<stacksize; ) {
@@ -1887,7 +1887,7 @@
     /** Set the current variable defined state. */
     public void setDefined(Bits newDefined) {
         if (alive && newDefined != state.defined) {
-            Bits diff = state.defined.dup().xorSet(newDefined);
+            Bits diff = new Bits(state.defined).xorSet(newDefined);
             for (int adr = diff.nextBit(0);
                  adr >= 0;
                  adr = diff.nextBit(adr+1)) {
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java	Wed May 08 10:10:05 2013 +0100
@@ -33,10 +33,13 @@
 import com.sun.tools.javac.code.Kinds;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.TypeVariableSymbol;
+import com.sun.tools.javac.code.TargetType;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.AnnotatedType;
 import com.sun.tools.javac.util.ListBuffer;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
+import com.sun.tools.javac.util.List;
 
 /**
  * Utility methods for operating on annotated constructs.
@@ -61,8 +64,12 @@
             throw new IllegalArgumentException("Not an annotation type: "
                                                + annoType);
         Attribute.Compound c;
-        if (annotated.kind == Kinds.TYP && annotated instanceof ClassSymbol) {
+        if (annotated.kind == Kinds.TYP &&
+                annotated instanceof ClassSymbol) {
             c = getAttributeOnClass((ClassSymbol)annotated, annoType);
+        } else if (annotated.kind == Kinds.TYP &&
+                   annotated instanceof TypeVariableSymbol) {
+            c = getAttributeOnTypeVariable((TypeVariableSymbol)annotated, annoType);
         } else {
             c = getAttribute(annotated, annoType);
         }
@@ -83,6 +90,24 @@
     }
 
     // Helper to getAnnotation[s]
+    private static <A extends Annotation> Attribute.Compound
+            getAttributeOnTypeVariable(TypeVariableSymbol annotated, Class<A> annoType) {
+        String name = annoType.getName();
+
+        // Declaration annotations on type variables are stored in type attributes
+        // on the owner of the TypeVariableSymbol
+        List<Attribute.Compound> res = List.nil();
+        List<Attribute.TypeCompound> candidates = annotated.owner.getRawTypeAttributes();
+        for (Attribute.TypeCompound anno : candidates)
+            if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
+                    anno.position.type == TargetType.METHOD_TYPE_PARAMETER)
+                if (name.equals(anno.type.tsym.flatName().toString()))
+                    return anno;
+
+        return null;
+    }
+
+    // Helper to getAnnotation[s]
     private static <A extends Annotation> Attribute.Compound getAttributeOnClass(ClassSymbol annotated,
                                                                 Class<A> annoType) {
         boolean inherited = annoType.isAnnotationPresent(Inherited.class);
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Wed May 08 10:10:05 2013 +0100
@@ -402,9 +402,10 @@
      * @param e  the element being examined
      * @return all annotations of the element
      */
+    @Override
     public List<Attribute.Compound> getAllAnnotationMirrors(Element e) {
         Symbol sym = cast(Symbol.class, e);
-        List<Attribute.Compound> annos = sym.getRawAttributes();
+        List<Attribute.Compound> annos = sym.getAnnotationMirrors();
         while (sym.getKind() == ElementKind.CLASS) {
             Type sup = ((ClassSymbol) sym).getSuperclass();
             if (!sup.hasTag(CLASS) || sup.isErroneous() ||
@@ -413,7 +414,7 @@
             }
             sym = sup.tsym;
             List<Attribute.Compound> oldAnnos = annos;
-            List<Attribute.Compound> newAnnos = sym.getRawAttributes();
+            List<Attribute.Compound> newAnnos = sym.getAnnotationMirrors();
             for (Attribute.Compound anno : newAnnos) {
                 if (isInherited(anno.type) &&
                         !containsAnnoOfType(oldAnnos, anno.type)) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Wed May 08 10:10:05 2013 +0100
@@ -41,6 +41,7 @@
 import com.sun.tools.javac.tree.DCTree.DCAttribute;
 import com.sun.tools.javac.tree.DCTree.DCDocComment;
 import com.sun.tools.javac.tree.DCTree.DCEndElement;
+import com.sun.tools.javac.tree.DCTree.DCEndPosTree;
 import com.sun.tools.javac.tree.DCTree.DCErroneous;
 import com.sun.tools.javac.tree.DCTree.DCIdentifier;
 import com.sun.tools.javac.tree.DCTree.DCReference;
@@ -336,12 +337,12 @@
                     DCTree text = inlineText();
                     if (text != null) {
                         nextChar();
-                        return m.at(p).UnknownInlineTag(name, List.of(text));
+                        return m.at(p).UnknownInlineTag(name, List.of(text)).setEndPos(bp);
                     }
                 } else if (tp.getKind() == TagParser.Kind.INLINE) {
-                    DCTree tree =  tp.parse(p);
+                    DCEndPosTree<?> tree = (DCEndPosTree<?>) tp.parse(p);
                     if (tree != null) {
-                        return tree;
+                        return tree.setEndPos(bp);
                     }
                 } else {
                     inlineText(); // skip content
@@ -509,7 +510,7 @@
             fac.log.popDiagnosticHandler(deferredDiagnosticHandler);
         }
 
-        return m.at(pos).Reference(sig, qualExpr, member, paramTypes);
+        return m.at(pos).Reference(sig, qualExpr, member, paramTypes).setEndPos(bp);
     }
 
     JCTree parseType(String s) throws ParseException {
@@ -741,7 +742,7 @@
                 }
                 if (ch == '>') {
                     nextChar();
-                    return m.at(p).StartElement(name, attrs, selfClosing);
+                    return m.at(p).StartElement(name, attrs, selfClosing).setEndPos(bp);
                 }
             }
         } else if (ch == '/') {
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Wed May 08 10:10:05 2013 +0100
@@ -36,6 +36,7 @@
 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Position;
 import java.io.IOException;
 import java.io.StringWriter;
 import javax.tools.JavaFileObject;
@@ -82,8 +83,24 @@
         return s.toString();
     }
 
+    public static abstract class DCEndPosTree<T extends DCEndPosTree<T>> extends DCTree {
+
+        private int endPos = Position.NOPOS;
+
+        public int getEndPos(DCDocComment dc) {
+            return dc.comment.getSourcePos(endPos);
+        }
+
+        @SuppressWarnings("unchecked")
+        public T setEndPos(int endPos) {
+            this.endPos = endPos;
+            return (T) this;
+        }
+
+    }
+
     public static class DCDocComment extends DCTree implements DocCommentTree {
-        final Comment comment; // required for the implicit source pos table
+        public final Comment comment; // required for the implicit source pos table
 
         public final List<DCTree> firstSentence;
         public final List<DCTree> body;
@@ -125,7 +142,7 @@
         }
     }
 
-    public static abstract class DCInlineTag extends DCTree implements InlineTagTree {
+    public static abstract class DCInlineTag extends DCEndPosTree<DCInlineTag> implements InlineTagTree {
         public String getTagName() {
             return getKind().tagName;
         }
@@ -345,6 +362,7 @@
         public int getEndPosition(EndPosTable endPosTable) {
             return pos + body.length();
         }
+
     }
 
     public static class DCIdentifier extends DCTree implements IdentifierTree {
@@ -478,7 +496,7 @@
         }
     }
 
-    public static class DCReference extends DCTree implements ReferenceTree {
+    public static class DCReference extends DCEndPosTree<DCReference> implements ReferenceTree {
         public final String signature;
 
         // The following are not directly exposed through ReferenceTree
@@ -663,7 +681,7 @@
         }
     }
 
-    public static class DCStartElement extends DCTree implements StartElementTree {
+    public static class DCStartElement extends DCEndPosTree<DCStartElement> implements StartElementTree {
         public final Name name;
         public final List<DCTree> attrs;
         public final boolean selfClosing;
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Bits.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Bits.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 
 import java.util.Arrays;
 
+import static com.sun.tools.javac.util.Bits.BitsOpKind.*;
+
 /** A class for extensible, mutable bit sets.
  *
  *  <p><b>This is NOT part of any supported API.
@@ -36,31 +38,114 @@
  */
 public class Bits {
 
+    public enum BitsOpKind {
+        INIT,
+        CLEAR,
+        INCL_BIT,
+        EXCL_BIT,
+        ASSIGN,
+        AND_SET,
+        OR_SET,
+        DIFF_SET,
+        XOR_SET,
+        INCL_RANGE,
+        EXCL_RANGE,
+    }
+
+    //       ____________      reset    _________
+    //      /  UNKNOWN   \   <-------- / UNINIT  \
+    //      \____________/       |     \_________/
+    //            |              |          |
+    //            |assign        |          | any
+    //            |        ___________      |
+    //            ------> /  NORMAL   \ <----
+    //                    \___________/     |
+    //                            |         |
+    //                            |         |
+    //                            -----------
+    //                               any
+    private enum BitsState {
+        /*  A Bits instance is in UNKNOWN state if it has been explicitly reset.
+         *  It is possible to get to this state from any other by calling the
+         *  reset method. An instance in the UNKNOWN state can pass to the
+         *  NORMAL state after being assigned another Bits instance.
+         */
+        UNKNOWN,
+        /*  A Bits instance is in UNINIT when it is created with the default
+         *  constructor but it isn't explicitly reset. The main objective of this
+         *  internal state is to save some memory.
+         */
+        UNINIT,
+        /*  The normal state is reached after creating a Bits instance from an
+         *  existing one or after applying any operation to an instance on UNINIT
+         *  or NORMAL state. From this state a bits instance can pass to the
+         *  UNKNOWN state by calling the reset method.
+         */
+        NORMAL;
+
+        static BitsState getState(int[] someBits, boolean reset) {
+            if (reset) {
+                return UNKNOWN;
+            } else {
+                if (someBits != unassignedBits) {
+                    return NORMAL;
+                } else {
+                    return UNINIT;
+                }
+            }
+        }
+
+    }
 
     private final static int wordlen = 32;
     private final static int wordshift = 5;
     private final static int wordmask = wordlen - 1;
 
-    private int[] bits;
+    public int[] bits = null;
+    // This field will store last version of bits after every change.
+    public int[] oldBits = null;
+
+    public BitsOpKind lastOperation = null;
+
+    private static final int[] unassignedBits = new int[0];
+
+    private BitsState currentState;
 
     /** Construct an initially empty set.
      */
     public Bits() {
-        this(new int[1]);
+        this(false);
+    }
+
+    public Bits(Bits someBits) {
+        this(someBits.dup().bits, BitsState.getState(someBits.bits, false));
+    }
+
+    public Bits(boolean reset) {
+        this(unassignedBits, BitsState.getState(unassignedBits, reset));
     }
 
     /** Construct a set consisting initially of given bit vector.
      */
-    public Bits(int[] bits) {
+    private Bits(int[] bits, BitsState initState) {
         this.bits = bits;
+        this.currentState = initState;
+        switch (initState) {
+            case UNKNOWN:
+                reset(); //this will also set current state;
+                break;
+            case NORMAL:
+                Assert.check(bits != unassignedBits);
+                lastOperation = INIT;
+                break;
+        }
     }
 
-    /** Construct a set consisting initially of given range.
+    /** This method will be called after any operation that causes a change to
+     *  the bits. Subclasses can thus override it in order to extract information
+     *  from the changes produced to the bits by the given operation.
      */
-    public Bits(int start, int limit) {
-        this();
-        inclRange(start, limit);
-    }
+    public void changed() {}
 
     private void sizeTo(int len) {
         if (bits.length < len) {
@@ -71,57 +156,110 @@
     /** This set = {}.
      */
     public void clear() {
+        Assert.check(currentState != BitsState.UNKNOWN);
+        oldBits = bits;
+        lastOperation = CLEAR;
         for (int i = 0; i < bits.length; i++) bits[i] = 0;
+        changed();
+        currentState = BitsState.NORMAL;
+    }
+
+    public void reset() {
+        bits = null;
+        oldBits = null;
+        currentState = BitsState.UNKNOWN;
+    }
+
+    public boolean isReset() {
+        return currentState == BitsState.UNKNOWN;
+    }
+
+    public Bits assign(Bits someBits) {
+        lastOperation = ASSIGN;
+        oldBits = bits;
+        bits = someBits.dup().bits;
+        changed();
+        currentState = BitsState.NORMAL;
+        return this;
     }
 
     /** Return a copy of this set.
      */
-    public Bits dup() {
-        int[] newbits = new int[bits.length];
-        System.arraycopy(bits, 0, newbits, 0, bits.length);
-        return new Bits(newbits);
+    private Bits dup() {
+        Assert.check(currentState != BitsState.UNKNOWN);
+        Bits tmp = new Bits();
+        if (currentState != BitsState.NORMAL) {
+            tmp.bits = bits;
+        } else {
+            tmp.bits = new int[bits.length];
+            System.arraycopy(bits, 0, tmp.bits, 0, bits.length);
+        }
+        currentState = BitsState.NORMAL;
+        return tmp;
     }
 
     /** Include x in this set.
      */
     public void incl(int x) {
+        Assert.check(currentState != BitsState.UNKNOWN);
         Assert.check(x >= 0);
+        oldBits = bits;
+        lastOperation = INCL_BIT;
         sizeTo((x >>> wordshift) + 1);
         bits[x >>> wordshift] = bits[x >>> wordshift] |
             (1 << (x & wordmask));
+        changed();
+        currentState = BitsState.NORMAL;
     }
 
 
     /** Include [start..limit) in this set.
      */
     public void inclRange(int start, int limit) {
+        Assert.check(currentState != BitsState.UNKNOWN);
+        oldBits = bits;
+        lastOperation = INCL_RANGE;
         sizeTo((limit >>> wordshift) + 1);
-        for (int x = start; x < limit; x++)
+        for (int x = start; x < limit; x++) {
             bits[x >>> wordshift] = bits[x >>> wordshift] |
                 (1 << (x & wordmask));
+        }
+        changed();
+        currentState = BitsState.NORMAL;
     }
 
     /** Exclude [start...end] from this set.
      */
     public void excludeFrom(int start) {
+        Assert.check(currentState != BitsState.UNKNOWN);
+        oldBits = bits;
+        lastOperation = EXCL_RANGE;
         Bits temp = new Bits();
         temp.sizeTo(bits.length);
         temp.inclRange(0, start);
-        andSet(temp);
+        internalAndSet(temp);
+        changed();
+        currentState = BitsState.NORMAL;
     }
 
     /** Exclude x from this set.
      */
     public void excl(int x) {
+        Assert.check(currentState != BitsState.UNKNOWN);
         Assert.check(x >= 0);
+        oldBits = bits;
+        lastOperation = EXCL_BIT;
         sizeTo((x >>> wordshift) + 1);
         bits[x >>> wordshift] = bits[x >>> wordshift] &
             ~(1 << (x & wordmask));
+        changed();
+        currentState = BitsState.NORMAL;
     }
 
     /** Is x an element of this set?
      */
     public boolean isMember(int x) {
+        Assert.check(currentState != BitsState.UNKNOWN);
         return
             0 <= x && x < (bits.length << wordshift) &&
             (bits[x >>> wordshift] & (1 << (x & wordmask))) != 0;
@@ -130,38 +268,66 @@
     /** {@literal this set = this set & xs}.
      */
     public Bits andSet(Bits xs) {
+        Assert.check(currentState != BitsState.UNKNOWN);
+        oldBits = bits;
+        lastOperation = AND_SET;
+        internalAndSet(xs);
+        changed();
+        currentState = BitsState.NORMAL;
+        return this;
+    }
+
+    private void internalAndSet(Bits xs) {
+        Assert.check(currentState != BitsState.UNKNOWN);
         sizeTo(xs.bits.length);
-        for (int i = 0; i < xs.bits.length; i++)
+        for (int i = 0; i < xs.bits.length; i++) {
             bits[i] = bits[i] & xs.bits[i];
-        return this;
+        }
     }
 
     /** this set = this set | xs.
      */
     public Bits orSet(Bits xs) {
+        Assert.check(currentState != BitsState.UNKNOWN);
+        oldBits = bits;
+        lastOperation = OR_SET;
         sizeTo(xs.bits.length);
-        for (int i = 0; i < xs.bits.length; i++)
+        for (int i = 0; i < xs.bits.length; i++) {
             bits[i] = bits[i] | xs.bits[i];
+        }
+        changed();
+        currentState = BitsState.NORMAL;
         return this;
     }
 
     /** this set = this set \ xs.
      */
     public Bits diffSet(Bits xs) {
+        Assert.check(currentState != BitsState.UNKNOWN);
+        oldBits = bits;
+        lastOperation = DIFF_SET;
         for (int i = 0; i < bits.length; i++) {
             if (i < xs.bits.length) {
                 bits[i] = bits[i] & ~xs.bits[i];
             }
         }
+        changed();
+        currentState = BitsState.NORMAL;
         return this;
     }
 
     /** this set = this set ^ xs.
      */
     public Bits xorSet(Bits xs) {
+        Assert.check(currentState != BitsState.UNKNOWN);
+        oldBits = bits;
+        lastOperation = XOR_SET;
         sizeTo(xs.bits.length);
-        for (int i = 0; i < xs.bits.length; i++)
+        for (int i = 0; i < xs.bits.length; i++) {
             bits[i] = bits[i] ^ xs.bits[i];
+        }
+        changed();
+        currentState = BitsState.NORMAL;
         return this;
     }
 
@@ -187,6 +353,7 @@
      *  }</pre>
      */
     public int nextBit(int x) {
+        Assert.check(currentState != BitsState.UNKNOWN);
         int windex = x >>> wordshift;
         if (windex >= bits.length) return -1;
         int word = bits[windex] & ~((1 << (x & wordmask))-1);
@@ -202,17 +369,20 @@
     /** a string representation of this set.
      */
     public String toString() {
-        char[] digits = new char[bits.length * wordlen];
-        for (int i = 0; i < bits.length * wordlen; i++)
-            digits[i] = isMember(i) ? '1' : '0';
-        return new String(digits);
+        if (bits.length > 0) {
+            char[] digits = new char[bits.length * wordlen];
+            for (int i = 0; i < bits.length * wordlen; i++)
+                digits[i] = isMember(i) ? '1' : '0';
+            return new String(digits);
+        } else {
+            return "[]";
+        }
     }
 
     /** Test Bits.nextBit(int). */
     public static void main(String[] args) {
         java.util.Random r = new java.util.Random();
         Bits bits = new Bits();
-        int dupCount = 0;
         for (int i=0; i<125; i++) {
             int k;
             do {
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -341,9 +341,14 @@
      * </pre>
      */
     public String name() {
-        return getClassName(tsym, false);
+        if (name == null) {
+            name = getClassName(tsym, false);
+        }
+        return name;
     }
 
+    private String name;
+
     /**
      * Return the qualified class name as a String.
      * <pre>
@@ -354,9 +359,14 @@
      * </pre>
      */
     public String qualifiedName() {
-        return getClassName(tsym, true);
+        if (qualifiedName == null) {
+            qualifiedName = getClassName(tsym, true);
+        }
+        return qualifiedName;
     }
 
+    private String qualifiedName;
+
     /**
      * Return unqualified name of type excluding any dimension information.
      * <p>
@@ -380,9 +390,14 @@
      * Return the simple name of this type.
      */
     public String simpleTypeName() {
-        return tsym.name.toString();
+        if (simpleTypeName == null) {
+            simpleTypeName = tsym.name.toString();
+        }
+        return simpleTypeName;
     }
 
+    private String simpleTypeName;
+
     /**
      * Return the qualified name and any type parameters.
      * Each parameter is a type variable with optional bounds.
--- a/langtools/src/share/classes/com/sun/tools/javadoc/FieldDocImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/FieldDocImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -252,13 +252,23 @@
     }
 
     public String name() {
-        return sym.name.toString();
+        if (name == null) {
+            name = sym.name.toString();
+        }
+        return name;
     }
 
+    private String name;
+
     public String qualifiedName() {
-        return sym.enclClass().getQualifiedName() + "." + name();
+        if (qualifiedName == null) {
+            qualifiedName = sym.enclClass().getQualifiedName() + "." + name();
+        }
+        return qualifiedName;
     }
 
+    private String qualifiedName;
+
     /**
      * Return the source position of the entity, or null if
      * no position is available.
--- a/langtools/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,13 +203,23 @@
 
 
     public String name() {
-        return sym.name.toString();
+        if (name == null) {
+            name = sym.name.toString();
+        }
+        return name;
     }
 
+    private String name;
+
     public String qualifiedName() {
-        return sym.enclClass().getQualifiedName() + "." + sym.name;
+        if (qualifiedName == null) {
+            qualifiedName =  sym.enclClass().getQualifiedName() + "." + sym.name;
+        }
+        return qualifiedName;
     }
 
+    private String qualifiedName;
+
     /**
      * Returns a string representation of this method.  Includes the
      * qualified signature, the qualified method name, and any type
--- a/langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -334,12 +334,17 @@
      * Get package name.
      */
     public String qualifiedName() {
-        Name fullname = sym.getQualifiedName();
-        // Some bogus tests depend on the interned "" being returned.
-        // See 6457276.
-        return fullname.isEmpty() ? "" : fullname.toString();
+        if (qualifiedName == null) {
+            Name fullname = sym.getQualifiedName();
+            // Some bogus tests depend on the interned "" being returned.
+            // See 6457276.
+            qualifiedName = fullname.isEmpty() ? "" : fullname.toString();
+        }
+        return qualifiedName;
     }
 
+    private String qualifiedName;
+
     /**
      * set doc path for an unzipped directory
      */
--- a/langtools/test/tools/javac/api/TestJavacTaskScanner.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/langtools/test/tools/javac/api/TestJavacTaskScanner.java	Wed May 08 10:10:05 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
         System.out.println("#allMembers: " + numAllMembers);
 
         check(numTokens, "#Tokens", 1222);
-        check(numParseTypeElements, "#parseTypeElements", 136);
+        check(numParseTypeElements, "#parseTypeElements", 158);
         check(numAllMembers, "#allMembers", 52);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/*
+ * @test
+ * @bug 8012723
+ * @summary strictfp interface misses strictfp modifer on default method
+ * @run main CheckACC_STRICTFlagOnDefaultMethodTest
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.File;
+import java.io.IOException;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Method;
+
+import static com.sun.tools.classfile.AccessFlags.ACC_STRICT;
+
+public class CheckACC_STRICTFlagOnDefaultMethodTest {
+    private static final String AssertionErrorMessage =
+        "All methods should have the ACC_STRICT access flag " +
+        "please check output";
+    private static final String offendingMethodErrorMessage =
+        "Method %s of class %s doesn't have the ACC_STRICT access flag";
+
+    private List<String> errors = new ArrayList<>();
+
+    public static void main(String[] args)
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        new CheckACC_STRICTFlagOnDefaultMethodTest().run();
+    }
+
+    private void run()
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        String testClasses = System.getProperty("test.classes");
+        check(testClasses,
+                "CheckACC_STRICTFlagOnDefaultMethodTest$StrictfpInterface.class");
+        if (errors.size() > 0) {
+            for (String error: errors) {
+                System.err.println(error);
+            }
+            throw new AssertionError(AssertionErrorMessage);
+        }
+    }
+
+    void check(String dir, String... fileNames)
+        throws
+            IOException,
+            ConstantPoolException,
+            Descriptor.InvalidDescriptor {
+        for (String fileName : fileNames) {
+            ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName));
+
+            for (Method method : classFileToCheck.methods) {
+                if ((method.access_flags.flags & ACC_STRICT) == 0) {
+                    errors.add(String.format(offendingMethodErrorMessage,
+                            method.getName(classFileToCheck.constant_pool),
+                            classFileToCheck.getName()));
+                }
+            }
+        }
+    }
+
+    strictfp interface StrictfpInterface {
+        default void default_interface_method() {}
+        static void static_interface_method() {}
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doctree/positions/TestPosition.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8008174
+ * @summary proper source positions for doc comments
+ * @build TestPosition
+ * @compile/ref=TestPosition.out -processor TestPosition -proc:only TestPositionSource.java
+ */
+
+import com.sun.source.doctree.DocCommentTree;
+import com.sun.source.doctree.DocTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.util.DocSourcePositions;
+import com.sun.source.util.DocTreeScanner;
+import com.sun.source.util.DocTrees;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.TreePathScanner;
+import java.io.IOException;
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+
+@SupportedAnnotationTypes("*")
+public class TestPosition extends AbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        TypeElement source = processingEnv.getElementUtils().getTypeElement("TestPositionSource");
+
+        if (source == null) throw new IllegalStateException();
+
+        if (!roundEnv.getRootElements().contains(source)) return false;
+
+        final DocTrees trees = DocTrees.instance(processingEnv);
+        final TreePath testElement = trees.getPath(source);
+
+        if (testElement == null) throw new IllegalStateException();
+
+        String code;
+
+        try {
+            code = testElement.getCompilationUnit().getSourceFile().getCharContent(false).toString();
+        } catch ( IOException ex) {
+            throw new IllegalStateException(ex);
+        }
+
+        new TreePathScanner<Void, Void>() {
+            @Override public Void visitMethod(MethodTree node, Void p) {
+                final DocCommentTree docCommentTree = trees.getDocCommentTree(getCurrentPath());
+
+                if (docCommentTree != null) {
+                    System.out.println(node.getName() + ":");
+                    new DocTreeScanner<Void, Void>() {
+                        @Override public Void scan(DocTree node, Void p) {
+                            if (node != null) {
+                                DocSourcePositions sp = (DocSourcePositions) trees.getSourcePositions(); //XXX: the cast???
+                                int start = (int) sp.getStartPosition(testElement.getCompilationUnit(), docCommentTree, node);
+                                int end   = (int) sp.getEndPosition(testElement.getCompilationUnit(), docCommentTree, node);
+                                String snippet = code.substring(start, end).replace(" \n", "!trailing-whitespace!\n");
+
+                                if (snippet.endsWith(" ")) {
+                                    snippet = snippet.substring(0, snippet.length() - 1) + "!trailing-whitespace!";
+                                }
+                                System.out.println(node.getKind().name() + ":" + snippet);
+                            }
+                            return super.scan(node, p);
+                        }
+                    }.scan(docCommentTree, null);
+                }
+
+                return super.visitMethod(node, p);
+            }
+        }.scan(testElement, null);
+
+        return false;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doctree/positions/TestPosition.out	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,99 @@
+valid:
+DOC_COMMENT:First sentence.
+     *
+     * <p>Description with {@link java.io.InputStream link}
+     *
+     * @param first description
+     * @param second description
+     * @return whatever
+     * @throws IllegalStateException why?
+     * @since 1.15
+     * @see java.util.List
+TEXT:First sentence.
+START_ELEMENT:<p>
+TEXT:Description with!trailing-whitespace!
+LINK:{@link java.io.InputStream link}
+REFERENCE:java.io.InputStream
+TEXT:link
+PARAM:@param first description
+IDENTIFIER:first
+TEXT:description
+PARAM:@param second description
+IDENTIFIER:second
+TEXT:description
+RETURN:@return whatever
+TEXT:whatever
+THROWS:@throws IllegalStateException why?
+REFERENCE:IllegalStateException
+TEXT:why?
+SINCE:@since 1.15
+TEXT:1.15
+SEE:@see java.util.List
+REFERENCE:java.util.List
+erroneous:
+DOC_COMMENT:First sentence.
+     *
+     * <p>Description with {@link}, {@link java.util.List}, {@link
+     *
+     * @param
+     * @param second
+     * @return
+     * @throws
+     * @throws IllegalStateException
+     * @since
+     * @see
+TEXT:First sentence.
+START_ELEMENT:<p>
+TEXT:Description with!trailing-whitespace!
+LINK:{@link}
+TEXT:,!trailing-whitespace!
+LINK:{@link java.util.List}
+REFERENCE:java.util.List
+TEXT:,!trailing-whitespace!
+ERRONEOUS:{@link
+ERRONEOUS:@param
+PARAM:@param second
+IDENTIFIER:second
+RETURN:@return
+ERRONEOUS:@throws
+THROWS:@throws IllegalStateException
+REFERENCE:IllegalStateException
+SINCE:@since
+ERRONEOUS:@see
+withWhiteSpaces:
+DOC_COMMENT:First sentence.
+     *
+     * <p>Description with {@link    }, {@link java.util.List#add(   int   )},
+     * {@link java.util.List#add(   int   ) some   text   with   whitespaces}, {@link
+     *
+     * @param     first
+     * @param     second   some   text   with trailing whitespace
+     * @return      some   return
+     * @throws      java.lang.IllegalStateException
+     * @throws   java.lang.IllegalStateException some     text
+TEXT:First sentence.
+START_ELEMENT:<p>
+TEXT:Description with!trailing-whitespace!
+LINK:{@link    }
+TEXT:,!trailing-whitespace!
+LINK:{@link java.util.List#add(   int   )}
+REFERENCE:java.util.List#add(   int   )
+TEXT:,
+     *!trailing-whitespace!
+LINK:{@link java.util.List#add(   int   ) some   text   with   whitespaces}
+REFERENCE:java.util.List#add(   int   )
+TEXT:some   text   with   whitespaces
+TEXT:,!trailing-whitespace!
+ERRONEOUS:{@link
+PARAM:@param     first
+IDENTIFIER:first
+PARAM:@param     second   some   text   with trailing whitespace
+IDENTIFIER:second
+TEXT:some   text   with trailing whitespace
+RETURN:@return      some   return
+TEXT:some   return
+THROWS:@throws      java.lang.IllegalStateException
+REFERENCE:java.lang.IllegalStateException
+THROWS:@throws   java.lang.IllegalStateException some     text
+REFERENCE:java.lang.IllegalStateException
+TEXT:some     text
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doctree/positions/TestPositionSource.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+public class TestPositionSource {
+
+    /**First sentence.
+     *
+     * <p>Description with {@link java.io.InputStream link}
+     *
+     * @param first description
+     * @param second description
+     * @return whatever
+     * @throws IllegalStateException why?
+     * @since 1.15
+     * @see java.util.List
+     */
+    public boolean valid(int first, int second) throws IllegalStateException {
+        return true;
+    }
+
+    /**First sentence.
+     *
+     * <p>Description with {@link}, {@link java.util.List}, {@link
+     *
+     * @param
+     * @param second
+     * @return
+     * @throws
+     * @throws IllegalStateException
+     * @since
+     * @see
+     */
+    public boolean erroneous(int first, int second) throws IllegalStateException {
+        return true;
+    }
+
+    /**First sentence.
+     *
+     * <p>Description with {@link    }, {@link java.util.List#add(   int   )},
+     * {@link java.util.List#add(   int   ) some   text   with   whitespaces}, {@link
+     *
+     * @param     first
+     * @param     second   some   text   with trailing whitespace
+     * @return      some   return
+     * @throws      java.lang.IllegalStateException
+     * @throws   java.lang.IllegalStateException some     text
+     */
+    public boolean withWhiteSpaces(int first, int second) throws IllegalStateException {
+        return true;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestNewInnerImplicitArgs.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/**
+ * @test
+ * @bug 8011591
+ * @summary BootstrapMethodError when capturing constructor ref to local classes
+ * @run testng MethodReferenceTestNewInnerImplicitArgs
+ */
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Test the case that a constructor has implicit parameters added to
+ * access local variables and that this constructor is used in a
+ * method reference.
+ * @author Robert Field
+ */
+
+@Test
+public class MethodReferenceTestNewInnerImplicitArgs {
+
+
+    static class S {
+        String b;
+        S(String s, String s2) { b = s + s2; }
+    }
+
+    interface I {
+        S m();
+    }
+
+    interface I2 {
+        S m(int i, int j);
+    }
+
+    public static void testConstructorReferenceImplicitParameters() {
+        String title = "Hey";
+        String a2 = "!!!";
+        class MS extends S {
+            MS() {
+                super(title, a2);
+            }
+        }
+
+        I result = MS::new;
+        assertEquals(result.m().b, "Hey!!!");
+
+        class MS2 extends S {
+            MS2(int x, int y) {
+                super(title+x, a2+y);
+            }
+        }
+
+        I2 result2 = MS2::new;
+        assertEquals(result2.m(8, 4).b, "Hey8!!!4");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/element/TestTypeParameterAnnotations.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8011027
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor TestTypeParameterAnnotations
+ * @compile -processor TestTypeParameterAnnotations -proc:only TestTypeParameterAnnotations.java
+ */
+
+import java.util.*;
+import java.lang.annotation.*;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.*;
+import javax.tools.*;
+
+public class TestTypeParameterAnnotations<@Foo @Bar @Baz T> extends JavacTestingAbstractProcessor {
+    int round = 0;
+
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (++round == 1) {
+            int found = (new Scanner()).scan(roundEnv.getRootElements(), null);
+            if (found == expect) {
+                ; //nop
+            } else {
+                error("unexpected number of results: expected " + expect
+                        + ", found " + found);
+            }
+
+        }
+        return true;
+    }
+
+    class Scanner extends JavacTestingAbstractProcessor.ElementScanner<Integer,Void> {
+        @Override
+        public Integer visitExecutable(ExecutableElement e, Void p) {
+            super.visitExecutable(e, p);
+            found += check(e, e.getTypeParameters());
+            return found;
+        }
+
+        @Override
+        public Integer visitType(TypeElement e, Void p) {
+            super.visitType(e, p);
+            found += check(e, e.getTypeParameters());
+            return found;
+        }
+
+        int found;
+    }
+
+    int check(Element e, List<? extends TypeParameterElement> typarams) {
+        if (typarams.isEmpty())
+            return 0;
+        if (typarams.size() != 1)
+            return 0;
+
+        for (TypeParameterElement tpe: typarams) {
+            boolean b1 = checkAnnotationMirrors(tpe, tpe.getAnnotationMirrors());
+            boolean b2 = checkAnnotationMirrors(tpe, elements.getAllAnnotationMirrors(tpe));
+            boolean b3 = checkGetAnnotation(tpe);
+            boolean b4 = checkGetAnnotations(tpe);
+            return b1 && b2 && b3 && b4 ? 1 : 0;
+        }
+        return 0;
+    }
+
+    boolean checkAnnotationMirrors(TypeParameterElement tpe, List<? extends AnnotationMirror> l) {
+        if (l.size() != 3) {
+            error("To few annotations, got " + l.size() +
+                    ", should be 3", tpe);
+            return false;
+        }
+
+        AnnotationMirror m = l.get(0);
+        if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Foo"))) {
+            error("Wrong type of annotation, was expecting @Foo", m.getAnnotationType().asElement());
+            return false;
+        }
+        m = l.get(1);
+        if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Bar"))) {
+            error("Wrong type of annotation, was expecting @Bar", m.getAnnotationType().asElement());
+            return false;
+        }
+        m = l.get(2);
+        if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Baz"))) {
+            error("Wrong type of annotation, was expecting @Baz", m.getAnnotationType().asElement());
+            return false;
+        }
+        return true;
+    }
+
+    boolean checkGetAnnotation(TypeParameterElement tpe) {
+        Foo f = tpe.getAnnotation(Foo.class);
+        if (f == null)
+            error("Expecting @Foo to be present in getAnnotation()", tpe);
+
+        Bar b = tpe.getAnnotation(Bar.class);
+        if (b == null)
+            error("Expecting @Bar to be present in getAnnotation()", tpe);
+
+        Baz z = tpe.getAnnotation(Baz.class);
+        if (z == null)
+            error("Expecting @Baz to be present in getAnnotation()", tpe);
+
+        return f != null &&
+            b != null &&
+            z != null;
+    }
+
+    boolean checkGetAnnotations(TypeParameterElement tpe) {
+        Foo[] f = tpe.getAnnotationsByType(Foo.class);
+        if (f.length != 1) {
+            error("Expecting 1 @Foo to be present in getAnnotationsByType()", tpe);
+            return false;
+        }
+
+        Bar[] b = tpe.getAnnotationsByType(Bar.class);
+        if (b.length != 1) {
+            error("Expecting 1 @Bar to be present in getAnnotationsByType()", tpe);
+            return false;
+        }
+
+        Baz[] z = tpe.getAnnotationsByType(Baz.class);
+        if (z.length != 1) {
+            error("Expecting 1 @Baz to be present in getAnnotationsByType()", tpe);
+            return false;
+        }
+
+        return true;
+    }
+
+    void note(String msg) {
+        messager.printMessage(Diagnostic.Kind.NOTE, msg);
+    }
+
+    void note(String msg, Element e) {
+        messager.printMessage(Diagnostic.Kind.NOTE, msg, e);
+    }
+
+    void error(String msg, Element e) {
+        messager.printMessage(Diagnostic.Kind.ERROR, msg, e);
+    }
+
+    void error(String msg) {
+        messager.printMessage(Diagnostic.Kind.ERROR, msg);
+    }
+
+    // additional generic elements to test
+    <@Foo @Bar @Baz X> X m(X x) { return x; }
+
+    interface Intf<@Foo @Bar @Baz X> { X m() ; }
+
+    class Class<@Foo @Bar @Baz X> {
+        <@Foo @Bar @Baz Y> Class() { }
+    }
+
+    final int expect = 5;  // top level class, plus preceding examples
+}
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface Foo {}
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface Bar {}
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface Baz {}
--- a/nashorn/.hgtags	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/.hgtags	Wed May 08 10:10:05 2013 +0100
@@ -197,3 +197,4 @@
 e0378f0a50dafdcfb7b04f6401d320f89884baa1 jdk8-b85
 002ad9d6735f36d1204e133324c73058c8abb1b0 jdk8-b86
 774aeaa89bc15f4365e3c2fc36f6a3a0da70ba28 jdk8-b87
+40c107d1ae6f81a62e35dfe618b827897405e9b2 jdk8-b88
--- a/nashorn/bin/verbose_octane.sh	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/bin/verbose_octane.sh	Wed May 08 10:10:05 2013 +0100
@@ -26,7 +26,7 @@
     ITERS=7
 fi
 NASHORN_JAR=dist/nashorn.jar
-JVM_FLAGS="-XX:+UnlockDiagnosticVMOptions -Dnashorn.unstable.relink.threshold=8 -Xms2G -Xmx2G -XX:+TieredCompilation -server -jar ${NASHORN_JAR}"
+JVM_FLAGS="-Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -XX:+UnlockDiagnosticVMOptions -Dnashorn.unstable.relink.threshold=8 -Xms2G -Xmx2G -XX:+TieredCompilation -server -jar ${NASHORN_JAR}"
 JVM_FLAGS7="-Xbootclasspath/p:${NASHORN_JAR} ${JVM_FLAGS}"
 OCTANE_ARGS="--verbose --iterations ${ITERS}"
 
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java	Wed May 08 10:10:05 2013 +0100
@@ -38,7 +38,6 @@
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_FIELD_NAME;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_TYPE;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPE;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_TYPE;
@@ -47,6 +46,8 @@
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_TYPE;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETPROTOTYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETPROTOTYPE_DESC;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_TYPE;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_INIT_DESC;
 import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_TYPE;
@@ -238,7 +239,7 @@
             mi.loadThis();
             mi.invokeStatic(PROTOTYPEOBJECT_TYPE, PROTOTYPEOBJECT_SETCONSTRUCTOR,
                     PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC);
-            mi.putField(SCRIPTFUNCTION_TYPE, PROTOTYPE, OBJECT_DESC);
+            mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETPROTOTYPE, SCRIPTFUNCTION_SETPROTOTYPE_DESC);
         }
     }
 
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java	Wed May 08 10:10:05 2013 +0100
@@ -55,7 +55,6 @@
     static final Type TYPE_SCRIPTFUNCTIONIMPL = Type.getType(ScriptFunctionImpl.class);
     static final Type TYPE_SCRIPTOBJECT       = Type.getType(ScriptObject.class);
 
-    static final String PROTOTYPE = "prototype";
     static final String PROTOTYPE_SUFFIX = "$Prototype";
     static final String CONSTRUCTOR_SUFFIX = "$Constructor";
     // This field name is known to Nashorn runtime (Context).
@@ -88,6 +87,8 @@
         Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_PROPERTYMAP, TYPE_METHODHANDLE_ARRAY);
     static final String SCRIPTFUNCTION_SETARITY = "setArity";
     static final String SCRIPTFUNCTION_SETARITY_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.INT_TYPE);
+    static final String SCRIPTFUNCTION_SETPROTOTYPE = "setPrototype";
+    static final String SCRIPTFUNCTION_SETPROTOTYPE_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_OBJECT);
     static final String PROTOTYPEOBJECT_TYPE = TYPE_PROTOTYPEOBJECT.getInternalName();
     static final String PROTOTYPEOBJECT_SETCONSTRUCTOR = "setConstructor";
     static final String PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_OBJECT, TYPE_OBJECT);
--- a/nashorn/make/build-nasgen.xml	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/make/build-nasgen.xml	Wed May 08 10:10:05 2013 +0100
@@ -37,6 +37,7 @@
                 <pathelement location="${basedir}/buildtools/nasgen/dist/nasgen.jar"/>
                 <pathelement path="${basedir}/build/classes"/>
             </classpath>
+            <jvmarg value="-Djava.ext.dirs="/>
             <arg value="${basedir}/build/classes"/>
             <arg value="jdk.nashorn.internal.objects"/>
             <arg value="${basedir}/build/classes"/>
--- a/nashorn/make/project.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/make/project.properties	Wed May 08 10:10:05 2013 +0100
@@ -214,7 +214,7 @@
 
 #  -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMethods
 # add '-Dtest.js.outofprocess' to run each test in a new sub-process
-run.test.jvmargs.main=-server -Xmx${run.test.xmx} -XX:-TieredCompilation -esa -ea -Dnashorn.debug=true -Dfile.encoding=UTF-8
+run.test.jvmargs.main=-server -Xmx${run.test.xmx} -XX:-TieredCompilation -ea -Dnashorn.debug=true -Dfile.encoding=UTF-8
 #-XX:+HeapDumpOnOutOfMemoryError -XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M  
 run.test.jvmargs.octane.main=-Xms${run.test.xms} ${run.test.jvmargs.main}
 
--- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassIntrospector.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassIntrospector.java	Wed May 08 10:10:05 2013 +0100
@@ -106,7 +106,11 @@
 
     @Override
     MethodHandle editMethodHandle(MethodHandle mh) {
-        MethodHandle newHandle = MethodHandles.dropArguments(mh, 0, Object.class);
+        return dropReceiver(mh, Object.class);
+    }
+
+    static MethodHandle dropReceiver(final MethodHandle mh, final Class<?> receiverClass) {
+        MethodHandle newHandle = MethodHandles.dropArguments(mh, 0, receiverClass);
         // NOTE: this is a workaround for the fact that dropArguments doesn't preserve vararg collector state.
         if(mh.isVarargsCollector() && !newHandle.isVarargsCollector()) {
             final MethodType type = mh.type();
--- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java	Wed May 08 10:10:05 2013 +0100
@@ -144,7 +144,7 @@
         }
 
         private static MethodHandle drop(MethodHandle mh) {
-            return MethodHandles.dropArguments(mh, 0, StaticClass.class);
+            return StaticClassIntrospector.dropReceiver(mh, StaticClass.class);
         }
 
         @Override
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Wed May 08 10:10:05 2013 +0100
@@ -397,10 +397,7 @@
             }
 
             setContextVariables(ctxt);
-            final Object val = ctxt.getAttribute(ScriptEngine.FILENAME);
-            final String fileName = (val != null) ? val.toString() : "<eval>";
-            Object res = ScriptRuntime.apply(script, ctxtGlobal);
-            return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(res, ctxtGlobal));
+            return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(ScriptRuntime.apply(script, ctxtGlobal), ctxtGlobal));
         } catch (final Exception e) {
             throwAsScriptException(e);
             throw new AssertionError("should not reach here");
--- a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java	Wed May 08 10:10:05 2013 +0100
@@ -25,14 +25,16 @@
 
 package jdk.nashorn.internal.codegen;
 
+import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.CALLEE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.EXCEPTION_PREFIX;
 import static jdk.nashorn.internal.codegen.CompilerConstants.ITERATOR_PREFIX;
+import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
 import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
-import static jdk.nashorn.internal.codegen.CompilerConstants.SCRIPT_RETURN;
 import static jdk.nashorn.internal.codegen.CompilerConstants.SWITCH_TAG_PREFIX;
 import static jdk.nashorn.internal.codegen.CompilerConstants.THIS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.VARARGS;
+import static jdk.nashorn.internal.ir.Symbol.IS_FUNCTION_SELF;
 import static jdk.nashorn.internal.ir.Symbol.IS_GLOBAL;
 import static jdk.nashorn.internal.ir.Symbol.IS_INTERNAL;
 import static jdk.nashorn.internal.ir.Symbol.IS_LET;
@@ -42,18 +44,18 @@
 import static jdk.nashorn.internal.ir.Symbol.IS_VAR;
 import static jdk.nashorn.internal.ir.Symbol.KINDMASK;
 
+import java.util.ArrayDeque;
 import java.util.ArrayList;
+import java.util.Deque;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.ListIterator;
 import java.util.Set;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
 import jdk.nashorn.internal.ir.CallNode;
-import jdk.nashorn.internal.ir.CallNode.EvalArgs;
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
 import jdk.nashorn.internal.ir.ForNode;
@@ -62,6 +64,7 @@
 import jdk.nashorn.internal.ir.IdentNode;
 import jdk.nashorn.internal.ir.IndexNode;
 import jdk.nashorn.internal.ir.LexicalContext;
+import jdk.nashorn.internal.ir.LexicalContextNode;
 import jdk.nashorn.internal.ir.LiteralNode;
 import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
 import jdk.nashorn.internal.ir.Node;
@@ -76,6 +79,7 @@
 import jdk.nashorn.internal.ir.TryNode;
 import jdk.nashorn.internal.ir.UnaryNode;
 import jdk.nashorn.internal.ir.VarNode;
+import jdk.nashorn.internal.ir.WithNode;
 import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.TokenType;
@@ -105,21 +109,22 @@
  */
 
 final class Attr extends NodeOperatorVisitor {
+
     /**
      * Local definitions in current block (to discriminate from function
      * declarations always defined in the function scope. This is for
      * "can be undefined" analysis.
      */
-    private Set<String> localDefs;
+    private final Deque<Set<String>> localDefs;
 
     /**
      * Local definitions in current block to guard against cases like
      * NASHORN-467 when things can be undefined as they are used before
      * their local var definition. *sigh* JavaScript...
      */
-    private Set<String> localUses;
+    private final Deque<Set<String>> localUses;
 
-    private final LexicalContext lexicalContext = new LexicalContext();
+    private final Deque<Type> returnTypes;
 
     private static final DebugLogger LOG   = new DebugLogger("attr");
     private static final boolean     DEBUG = LOG.isEnabled();
@@ -128,10 +133,13 @@
      * Constructor.
      */
     Attr() {
+        localDefs = new ArrayDeque<>();
+        localUses = new ArrayDeque<>();
+        returnTypes = new ArrayDeque<>();
     }
 
     @Override
-    protected Node enterDefault(final Node node) {
+    protected boolean enterDefault(final Node node) {
         return start(node);
     }
 
@@ -142,217 +150,47 @@
 
     @Override
     public Node leaveAccessNode(final AccessNode accessNode) {
-        newTemporary(Type.OBJECT, accessNode);  //While Object type is assigned here, Access Specialization in FinalizeTypes may narrow this
+        ensureSymbol(Type.OBJECT, accessNode);  //While Object type is assigned here, Access Specialization in FinalizeTypes may narrow this
         end(accessNode);
         return accessNode;
     }
 
-    @Override
-    public Node enterBlock(final Block block) {
-        lexicalContext.push(block);
-        start(block);
-
-        final Set<String> savedLocalDefs = localDefs;
-        final Set<String> savedLocalUses = localUses;
-
-        block.setFrame(getCurrentFunctionNode().pushFrame());
-
-        try {
-            // a block starts out by copying the local defs and local uses
-            // from the outer level. But we need the copies, as when we
-            // leave the block the def and use sets given upon entry must
-            // be restored
-            localDefs = new HashSet<>(savedLocalDefs);
-            localUses = new HashSet<>(savedLocalUses);
-
-            block.visitStatements(this);
-        } finally {
-            localDefs = savedLocalDefs;
-            localUses = savedLocalUses;
-
-            getCurrentFunctionNode().popFrame();
-        }
-
-        end(block);
-
-        lexicalContext.pop(block);
-        return null;
-    }
-
-    @Override
-    public Node enterCallNode(final CallNode callNode) {
-        start(callNode);
-
-        callNode.getFunction().accept(this);
-
-        final List<Node> acceptedArgs = new ArrayList<>(callNode.getArgs().size());
-        for (final Node arg : callNode.getArgs()) {
-            LOG.info("Doing call arg " + arg);
-            acceptedArgs.add(arg.accept(this));
-        }
-        callNode.setArgs(acceptedArgs);
+    private void enterFunctionBody() {
 
-        final EvalArgs evalArgs = callNode.getEvalArgs();
-        if (evalArgs != null) {
-            evalArgs.setCode(evalArgs.getCode().accept(this));
-
-            final IdentNode thisNode = new IdentNode(getCurrentFunctionNode().getThisNode());
-            assert thisNode.getSymbol() != null; //should copy attributed symbol and that's it
-            evalArgs.setThis(thisNode);
-        }
-
-        newTemporary(callNode.getType(), callNode); // access specialization in FinalizeTypes may narrow it further later
-
-        end(callNode);
-
-        return null;
-    }
-
-    @Override
-    public Node enterCatchNode(final CatchNode catchNode) {
-        final IdentNode exception = catchNode.getException();
-        final Block     block     = getCurrentBlock();
-
-        start(catchNode);
-
-        // define block-local exception variable
-        final Symbol def = defineSymbol(block, exception.getName(), IS_VAR | IS_LET, exception);
-        newType(def, Type.OBJECT);
-        addLocalDef(exception.getName());
-
-        return catchNode;
-    }
-
-    /**
-     * Declare the definition of a new symbol.
-     *
-     * @param name         Name of symbol.
-     * @param symbolFlags  Symbol flags.
-     * @param node         Defining Node.
-     *
-     * @return Symbol for given name or null for redefinition.
-     */
-    private Symbol defineSymbol(final Block block, final String name, final int symbolFlags, final Node node) {
-        int    flags  = symbolFlags;
-        Symbol symbol = findSymbol(block, name); // Locate symbol.
-
-        if ((flags & KINDMASK) == IS_GLOBAL) {
-            flags |= IS_SCOPE;
+        final FunctionNode functionNode = getLexicalContext().getCurrentFunction();
+        final Block body = getLexicalContext().getCurrentBlock();
+        initCallee(body);
+        initThis(body);
+        if (functionNode.isVarArg()) {
+            initVarArg(body, functionNode.needsArguments());
         }
 
-        final FunctionNode function = lexicalContext.getFunction(block);
-        if (symbol != null) {
-            // Symbol was already defined. Check if it needs to be redefined.
-            if ((flags & KINDMASK) == IS_PARAM) {
-                if (!isLocal(function, symbol)) {
-                    // Not defined in this function. Create a new definition.
-                    symbol = null;
-                } else if (symbol.isParam()) {
-                    // Duplicate parameter. Null return will force an error.
-                    assert false : "duplicate parameter";
-                    return null;
-                }
-            } else if ((flags & KINDMASK) == IS_VAR) {
-                if ((flags & IS_INTERNAL) == IS_INTERNAL || (flags & IS_LET) == IS_LET) {
-                    assert !((flags & IS_LET) == IS_LET && symbol.getBlock() == block) : "duplicate let variable in block";
-                    // Always create a new definition.
-                    symbol = null;
-                } else {
-                    // Not defined in this function. Create a new definition.
-                    if (!isLocal(function, symbol) || symbol.less(IS_VAR)) {
-                        symbol = null;
-                    }
-                }
-            }
-        }
-
-        if (symbol == null) {
-            // If not found, then create a new one.
-            Block symbolBlock;
-
-            // Determine where to create it.
-            if ((flags & Symbol.KINDMASK) == IS_VAR && ((flags & IS_INTERNAL) == IS_INTERNAL || (flags & IS_LET) == IS_LET)) {
-                symbolBlock = block;
-            } else {
-                symbolBlock = function;
-            }
-
-            // Create and add to appropriate block.
-            symbol = new Symbol(name, flags, node, symbolBlock);
-            symbolBlock.putSymbol(name, symbol);
-
-            if ((flags & Symbol.KINDMASK) != IS_GLOBAL) {
-                symbolBlock.getFrame().addSymbol(symbol);
-                symbol.setNeedsSlot(true);
-            }
-        } else if (symbol.less(flags)) {
-            symbol.setFlags(flags);
-        }
-
-        if (node != null) {
-            node.setSymbol(symbol);
-        }
-
-        return symbol;
-    }
-
-    @Override
-    public Node enterFunctionNode(final FunctionNode functionNode) {
-        start(functionNode, false);
-        if (functionNode.isLazy()) {
-            LOG.info("LAZY: " + functionNode.getName() + " => Promoting to OBJECT");
-            newTemporary(lexicalContext.getCurrentFunction(), Type.OBJECT, functionNode);
-            functionNode.setReturnType(Type.OBJECT);
-            end(functionNode);
-            return null;
-        }
-
-        lexicalContext.push(functionNode);
-
-        clearLocalDefs();
-        clearLocalUses();
-
-        functionNode.setFrame(functionNode.pushFrame());
-
-        initCallee(functionNode);
-        initThis(functionNode);
-        if (functionNode.isVarArg()) {
-            initVarArg(functionNode);
-        }
-
-        initParameters(functionNode);
-        initScope(functionNode);
-        initReturn(functionNode);
-
-        // Add all nested declared functions as symbols in this function
-        for (final FunctionNode nestedFunction : functionNode.getDeclaredFunctions()) {
-            final IdentNode ident = nestedFunction.getIdent();
-            if (ident != null) {
-                assert nestedFunction.isDeclared();
-                final Symbol functionSymbol = defineSymbol(functionNode, ident.getName(), IS_VAR, nestedFunction);
-                newType(functionSymbol, Type.typeFor(ScriptFunction.class));
-            }
-        }
+        initParameters(functionNode, body);
+        initScope(body);
+        initReturn(body);
 
         if (functionNode.isProgram()) {
-            initFromPropertyMap(functionNode);
-        }
+            initFromPropertyMap(body);
+        } else if(!functionNode.isDeclared()) {
+            // It's neither declared nor program - it's a function expression then; assign it a self-symbol.
 
-        // Add function name as local symbol
-        if (!functionNode.isDeclared() && !functionNode.isProgram()) {
-            if(functionNode.getSymbol() != null) {
+            if (functionNode.getSymbol() != null) {
                 // a temporary left over from an earlier pass when the function was lazy
                 assert functionNode.getSymbol().isTemp();
                 // remove it
                 functionNode.setSymbol(null);
             }
-            final Symbol selfSymbol;
-            if(functionNode.isAnonymous()) {
-                selfSymbol = newTemporary(functionNode, Type.OBJECT, functionNode);
+            final boolean anonymous = functionNode.isAnonymous();
+            final String name = anonymous ? null : functionNode.getIdent().getName();
+            if (anonymous || body.getExistingSymbol(name) != null) {
+                // The function is either anonymous, or another local identifier already trumps its name on entry:
+                // either it has the same name as one of its parameters, or is named "arguments" and also references the
+                // "arguments" identifier in its body.
+                ensureSymbol(functionNode, Type.typeFor(ScriptFunction.class), functionNode);
             } else {
-                selfSymbol = defineSymbol(functionNode, functionNode.getIdent().getName(), IS_VAR, functionNode);
+                final Symbol selfSymbol = defineSymbol(body, name, IS_VAR | IS_FUNCTION_SELF, functionNode);
+                assert selfSymbol.isFunctionSelf();
                 newType(selfSymbol, Type.OBJECT);
-                selfSymbol.setNode(functionNode);
             }
         }
 
@@ -373,73 +211,243 @@
          * @see NASHORN-73
          */
 
-        final List<Symbol> declaredSymbols = new ArrayList<>();
         // This visitor will assign symbol to all declared variables, except function declarations (which are taken care
         // in a separate step above) and "var" declarations in for loop initializers.
-        functionNode.accept(new NodeOperatorVisitor() {
+        body.accept(new NodeOperatorVisitor() {
             @Override
-            public Node enterFunctionNode(FunctionNode nestedFn) {
-                // Don't descend into nested functions
-                return nestedFn == functionNode ? nestedFn : null;
+            public boolean enterFunctionNode(final FunctionNode nestedFn) {
+                return false;
             }
+
             @Override
-            public Node enterVarNode(VarNode varNode) {
-                if(varNode.isStatement() && !varNode.isFunctionDeclaration()) {
+            public boolean enterVarNode(final VarNode varNode) {
+
+                // any declared symbols that aren't visited need to be typed as well, hence the list
+
+                if (varNode.isStatement()) {
+
                     final IdentNode ident = varNode.getName();
-                    // any declared symbols that aren't visited need to be typed as well, hence the list
-                    declaredSymbols.add(defineSymbol(functionNode, ident.getName(), IS_VAR, new IdentNode(ident)));
+                    final Symbol symbol = defineSymbol(body, ident.getName(), IS_VAR, new IdentNode(ident));
+                    functionNode.addDeclaredSymbol(symbol);
+                    if (varNode.isFunctionDeclaration()) {
+                        newType(symbol, FunctionNode.FUNCTION_TYPE);
+                    }
                 }
-                return null;
+                return false;
             }
         });
+    }
 
-        visitFunctionStatements(functionNode);
+    @Override
+    public boolean enterBlock(final Block block) {
+        start(block);
+
+        if (getLexicalContext().isFunctionBody()) {
+            enterFunctionBody();
+        }
+        pushLocalsBlock();
+
+        return true;
+    }
+
+    @Override
+    public Node leaveBlock(final Block block) {
+        popLocals();
+        return end(block);
+    }
+
+    @Override
+    public Node leaveCallNode(final CallNode callNode) {
+        ensureSymbol(callNode.getType(), callNode);
+        return end(callNode);
+    }
+
+    @Override
+    public boolean enterCallNode(final CallNode callNode) {
+        return start(callNode);
+    }
+
+    @Override
+    public boolean enterCatchNode(final CatchNode catchNode) {
+        final IdentNode exception = catchNode.getException();
+        final Block     block     = getLexicalContext().getCurrentBlock();
+
+        start(catchNode);
+
+        // define block-local exception variable
+        final Symbol def = defineSymbol(block, exception.getName(), IS_VAR | IS_LET, exception);
+        newType(def, Type.OBJECT);
+        addLocalDef(exception.getName());
+
+        return true;
+    }
+
+    /**
+     * Declare the definition of a new symbol.
+     *
+     * @param name         Name of symbol.
+     * @param symbolFlags  Symbol flags.
+     * @param node         Defining Node.
+     *
+     * @return Symbol for given name or null for redefinition.
+     */
+    private Symbol defineSymbol(final Block block, final String name, final int symbolFlags, final Node node) {
+        int    flags  = symbolFlags;
+        Symbol symbol = findSymbol(block, name); // Locate symbol.
+
+        if ((flags & KINDMASK) == IS_GLOBAL) {
+            flags |= IS_SCOPE;
+        }
+
+        final FunctionNode function = getLexicalContext().getFunction(block);
+        if (symbol != null) {
+            // Symbol was already defined. Check if it needs to be redefined.
+            if ((flags & KINDMASK) == IS_PARAM) {
+                if (!isLocal(function, symbol)) {
+                    // Not defined in this function. Create a new definition.
+                    symbol = null;
+                } else if (symbol.isParam()) {
+                    // Duplicate parameter. Null return will force an error.
+                    assert false : "duplicate parameter";
+                    return null;
+                }
+            } else if ((flags & KINDMASK) == IS_VAR) {
+                if ((flags & IS_INTERNAL) == IS_INTERNAL || (flags & IS_LET) == IS_LET) {
+                    // Always create a new definition.
+                    symbol = null;
+                } else {
+                    // Not defined in this function. Create a new definition.
+                    if (!isLocal(function, symbol) || symbol.less(IS_VAR)) {
+                        symbol = null;
+                    }
+                }
+            }
+        }
+
+        if (symbol == null) {
+            // If not found, then create a new one.
+            Block symbolBlock;
+
+            // Determine where to create it.
+            if ((flags & Symbol.KINDMASK) == IS_VAR && ((flags & IS_INTERNAL) == IS_INTERNAL || (flags & IS_LET) == IS_LET)) {
+                symbolBlock = block; //internal vars are always defined in the block closest to them
+            } else {
+                symbolBlock = getLexicalContext().getFunctionBody(function);
+            }
+
+            // Create and add to appropriate block.
+            symbol = new Symbol(name, flags);
+            symbolBlock.putSymbol(name, symbol);
+
+            if ((flags & Symbol.KINDMASK) != IS_GLOBAL) {
+                symbol.setNeedsSlot(true);
+            }
+        } else if (symbol.less(flags)) {
+            symbol.setFlags(flags);
+        }
+
+        if (node != null) {
+            node.setSymbol(symbol);
+        }
+
+        return symbol;
+    }
+
+    @Override
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
+        start(functionNode, false);
+
+        if (functionNode.isDeclared()) {
+            final Iterator<Block> blocks = getLexicalContext().getBlocks();
+            if (blocks.hasNext()) {
+                defineSymbol(
+                    blocks.next(),
+                    functionNode.getIdent().getName(),
+                    IS_VAR,
+                    functionNode);
+            } else {
+                // Q: What's an outermost function in a lexical context that is not a program?
+                // A: It's a function being compiled lazily!
+                assert getLexicalContext().getOutermostFunction() == functionNode && !functionNode.isProgram();
+            }
+        }
+
+        if (functionNode.isLazy()) {
+            LOG.info("LAZY: ", functionNode.getName(), " => Promoting to OBJECT");
+            ensureSymbol(getLexicalContext().getCurrentFunction(), Type.OBJECT, functionNode);
+            end(functionNode);
+            return false;
+        }
+
+        returnTypes.push(functionNode.getReturnType());
+        pushLocalsFunction();
+        return true;
+    }
+
+    @Override
+    public Node leaveFunctionNode(final FunctionNode functionNode) {
+        FunctionNode newFunctionNode = functionNode;
+
+        final LexicalContext lc = getLexicalContext();
 
         //unknown parameters are promoted to object type.
-        finalizeParameters(functionNode);
-        finalizeTypes(functionNode);
-        for (final Symbol symbol : declaredSymbols) {
+        finalizeParameters(newFunctionNode);
+        finalizeTypes(newFunctionNode);
+        for (final Symbol symbol : newFunctionNode.getDeclaredSymbols()) {
             if (symbol.getSymbolType().isUnknown()) {
                 symbol.setType(Type.OBJECT);
                 symbol.setCanBeUndefined();
             }
         }
 
-        if (functionNode.getReturnType().isUnknown()) {
-            LOG.info("Unknown return type promoted to object");
-            functionNode.setReturnType(Type.OBJECT);
-        }
+        final Block body = newFunctionNode.getBody();
 
-        if (functionNode.getSelfSymbolInit() != null) {
-            LOG.info("Accepting self symbol init " + functionNode.getSelfSymbolInit() + " for " + functionNode.getName());
-            final Node init = functionNode.getSelfSymbolInit();
-            final List<Node> newStatements = new ArrayList<>();
-            newStatements.add(init);
-            newStatements.addAll(functionNode.getStatements());
-            functionNode.setStatements(newStatements);
-            functionNode.setNeedsSelfSymbol(functionNode.getSelfSymbolInit().accept(this));
+        if (newFunctionNode.hasLazyChildren()) {
+            //the final body has already been assigned as we have left the function node block body by now
+            objectifySymbols(body);
         }
 
-        if (functionNode.hasLazyChildren()) {
-            objectifySymbols(functionNode);
+        if (body.getFlag(Block.NEEDS_SELF_SYMBOL)) {
+            final IdentNode callee = compilerConstant(CALLEE);
+            final VarNode selfInit =
+                new VarNode(
+                    newFunctionNode.getSource(),
+                    newFunctionNode.getToken(),
+                    newFunctionNode.getFinish(),
+                    newFunctionNode.getIdent(),
+                    callee);
+
+            LOG.info("Accepting self symbol init ", selfInit, " for ", newFunctionNode.getName());
+
+            final List<Node> newStatements = new ArrayList<>();
+            newStatements.add(selfInit);
+            assert callee.getSymbol() != null && callee.getSymbol().hasSlot();
+
+            final IdentNode name       = selfInit.getName();
+            final Symbol    nameSymbol = body.getExistingSymbol(name.getName());
+
+            assert nameSymbol != null;
+
+            name.setSymbol(nameSymbol);
+            selfInit.setSymbol(nameSymbol);
+
+            newStatements.addAll(body.getStatements());
+            newFunctionNode = newFunctionNode.setBody(lc, body.setStatements(lc, newStatements));
         }
 
-        functionNode.popFrame();
-
-        functionNode.setState(CompilationState.ATTR);
-
-        end(functionNode, false);
-        lexicalContext.pop(functionNode);
+        if (returnTypes.peek().isUnknown()) {
+            LOG.info("Unknown return type promoted to object");
+            newFunctionNode = newFunctionNode.setReturnType(lc, Type.OBJECT);
+        }
+        final Type returnType = returnTypes.pop();
+        newFunctionNode = newFunctionNode.setReturnType(lc, returnType.isUnknown() ? Type.OBJECT : returnType);
+        newFunctionNode = newFunctionNode.setState(lc, CompilationState.ATTR);
 
-        return null;
-    }
+        popLocals();
 
-    private void visitFunctionStatements(final FunctionNode functionNode) {
-        final List<Node> newStatements = new ArrayList<>(functionNode.getStatements());
-        for(ListIterator<Node> stmts = newStatements.listIterator(); stmts.hasNext();) {
-            stmts.set(stmts.next().accept(this));
-        }
-        functionNode.setStatements(newStatements);
+        end(newFunctionNode, false);
+
+        return newFunctionNode; //.setFlag(lc, lc.getFlags(functionNode));
     }
 
     @Override
@@ -450,7 +458,7 @@
     }
 
     @Override
-    public Node enterIdentNode(final IdentNode identNode) {
+    public boolean enterIdentNode(final IdentNode identNode) {
         final String name = identNode.getName();
 
         start(identNode);
@@ -458,31 +466,28 @@
         if (identNode.isPropertyName()) {
             // assign a pseudo symbol to property name
             final Symbol pseudoSymbol = pseudoSymbol(name);
-            LOG.info("IdentNode is property name -> assigning pseudo symbol " + pseudoSymbol);
+            LOG.info("IdentNode is property name -> assigning pseudo symbol ", pseudoSymbol);
             LOG.unindent();
             identNode.setSymbol(pseudoSymbol);
-            return null;
+            return false;
         }
 
-        final Block  block     = getCurrentBlock();
-        final Symbol oldSymbol = identNode.getSymbol();
+        final LexicalContext lc        = getLexicalContext();
+        final Block          block     = lc.getCurrentBlock();
+        final Symbol         oldSymbol = identNode.getSymbol();
 
         Symbol symbol = findSymbol(block, name);
 
         //If an existing symbol with the name is found, use that otherwise, declare a new one
         if (symbol != null) {
-            LOG.info("Existing symbol = " + symbol);
-            if (isFunctionExpressionSelfReference(symbol)) {
-                final FunctionNode functionNode = (FunctionNode)symbol.getNode();
-                assert functionNode.getCalleeNode() != null;
-
-                final VarNode var = new VarNode(functionNode.getSource(), functionNode.getToken(), functionNode.getFinish(), functionNode.getIdent(), functionNode.getCalleeNode());
-                //newTemporary(Type.OBJECT, var); //ScriptFunction? TODO
-
-                functionNode.setNeedsSelfSymbol(var);
-            }
-
-            if (!identNode.isInitializedHere()) { // NASHORN-448
+            LOG.info("Existing symbol = ", symbol);
+            if (symbol.isFunctionSelf()) {
+                final FunctionNode functionNode = lc.getDefiningFunction(symbol);
+                assert functionNode != null;
+                assert lc.getFunctionBody(functionNode).getExistingSymbol(CALLEE.symbolName()) != null;
+                lc.setFlag(functionNode.getBody(), Block.NEEDS_SELF_SYMBOL);
+                newType(symbol, FunctionNode.FUNCTION_TYPE);
+            } else if (!identNode.isInitializedHere()) { // NASHORN-448
                 // here is a use outside the local def scope
                 if (!isLocalDef(name)) {
                     newType(symbol, Type.OBJECT);
@@ -491,26 +496,18 @@
             }
 
             identNode.setSymbol(symbol);
-            // non-local: we need to put symbol in scope (if it isn't already)
-            if (!isLocal(getCurrentFunctionNode(), symbol) && !symbol.isScope()) {
-                symbol.setIsScope();
-            }
+            // if symbol is non-local or we're in a with block, we need to put symbol in scope (if it isn't already)
+            maybeForceScope(symbol);
         } else {
-            LOG.info("No symbol exists. Declare undefined: " + symbol);
-            symbol = useSymbol(block, name, identNode);
+            LOG.info("No symbol exists. Declare undefined: ", symbol);
+            symbol = defineSymbol(block, name, IS_GLOBAL, identNode);
             // we have never seen this before, it can be undefined
             newType(symbol, Type.OBJECT); // TODO unknown -we have explicit casts anyway?
             symbol.setCanBeUndefined();
-            symbol.setIsScope();
+            Symbol.setSymbolIsScope(lc, symbol);
         }
 
-        assert symbol != null;
-        if(symbol.isGlobal()) {
-            setUsesGlobalSymbol();
-        } else if(symbol.isScope()) {
-            final Iterator<Block> blocks = lexicalContext.getBlocks();
-            blocks.next().setUsesScopeSymbol(symbol, blocks);
-        }
+        setBlockScope(name, symbol);
 
         if (symbol != oldSymbol && !identNode.isInitializedHere()) {
             symbol.increaseUseCount();
@@ -519,7 +516,81 @@
 
         end(identNode);
 
-        return null;
+        return false;
+    }
+
+    /**
+     * If the symbol isn't already a scope symbol, and it is either not local to the current function, or it is being
+     * referenced from within a with block, we force it to be a scope symbol.
+     * @param symbol the symbol that might be scoped
+     */
+    private void maybeForceScope(final Symbol symbol) {
+        if(!symbol.isScope() && symbolNeedsToBeScope(symbol)) {
+            Symbol.setSymbolIsScope(getLexicalContext(), symbol);
+        }
+    }
+
+    private boolean symbolNeedsToBeScope(Symbol symbol) {
+        if(symbol.isThis() || symbol.isInternal()) {
+            return false;
+        }
+        boolean previousWasBlock = false;
+        for(final Iterator<LexicalContextNode> it = getLexicalContext().getAllNodes(); it.hasNext();) {
+            final LexicalContextNode node = it.next();
+            if(node instanceof FunctionNode) {
+                // We reached the function boundary without seeing a definition for the symbol - it needs to be in
+                // scope.
+                return true;
+            } else if(node instanceof WithNode) {
+                if(previousWasBlock) {
+                    // We reached a WithNode; the symbol must be scoped. Note that if the WithNode was not immediately
+                    // preceded by a block, this means we're currently processing its expression, not its body,
+                    // therefore it doesn't count.
+                    return true;
+                }
+                previousWasBlock = false;
+            } else if(node instanceof Block) {
+                if(((Block)node).getExistingSymbol(symbol.getName()) == symbol) {
+                    // We reached the block that defines the symbol without reaching either the function boundary, or a
+                    // WithNode. The symbol need not be scoped.
+                    return false;
+                }
+                previousWasBlock = true;
+            } else {
+                previousWasBlock = false;
+            }
+        }
+        throw new AssertionError();
+    }
+
+    private void setBlockScope(final String name, final Symbol symbol) {
+        assert symbol != null;
+        if (symbol.isGlobal()) {
+            setUsesGlobalSymbol();
+            return;
+        }
+
+        if (symbol.isScope()) {
+            final LexicalContext lc = getLexicalContext();
+
+            Block scopeBlock = null;
+            for (final Iterator<LexicalContextNode> contextNodeIter = getLexicalContext().getAllNodes(); contextNodeIter.hasNext(); ) {
+                final LexicalContextNode node = contextNodeIter.next();
+                if (node instanceof Block) {
+                    if (((Block)node).getExistingSymbol(name) != null) {
+                        scopeBlock = (Block)node;
+                        break;
+                    }
+                } else if (node instanceof FunctionNode) {
+                    lc.setFlag(node, FunctionNode.USES_ANCESTOR_SCOPE);
+                }
+            }
+
+            if (scopeBlock != null) {
+                assert getLexicalContext().contains(scopeBlock);
+                lc.setFlag(scopeBlock, Block.NEEDS_SCOPE);
+            }
+        }
     }
 
     /**
@@ -528,35 +599,12 @@
      * @see #needsParentScope()
      */
     private void setUsesGlobalSymbol() {
-        for(final Iterator<FunctionNode> fns = lexicalContext.getFunctions(); fns.hasNext();) {
-            fns.next().setUsesAncestorScope();
+        for (final Iterator<FunctionNode> fns = getLexicalContext().getFunctions(); fns.hasNext();) {
+            getLexicalContext().setFlag(fns.next(), FunctionNode.USES_ANCESTOR_SCOPE);
         }
     }
 
     /**
-     * Declare the use of a symbol in a block.
-     *
-     * @param block block in which the symbol is used
-     * @param name Name of symbol.
-     * @param node Using node
-     *
-     * @return Symbol for given name.
-     */
-    private Symbol useSymbol(final Block block, final String name, final Node node) {
-        Symbol symbol = findSymbol(block, name);
-
-        if (symbol == null) {
-            // If not found, declare as a free var.
-            symbol = defineSymbol(block, name, IS_GLOBAL, node);
-        } else {
-            node.setSymbol(symbol);
-        }
-
-        return symbol;
-    }
-
-
-    /**
      * Search for symbol in the lexical context starting from the given block.
      * @param name Symbol name.
      * @return Found symbol or null if not found.
@@ -564,7 +612,7 @@
     private Symbol findSymbol(final Block block, final String name) {
         // Search up block chain to locate symbol.
 
-        for(final Iterator<Block> blocks = lexicalContext.getBlocks(block); blocks.hasNext();) {
+        for(final Iterator<Block> blocks = getLexicalContext().getBlocks(block); blocks.hasNext();) {
             // Find name.
             final Symbol symbol = blocks.next().getExistingSymbol(name);
             // If found then we are good.
@@ -577,13 +625,13 @@
 
     @Override
     public Node leaveIndexNode(final IndexNode indexNode) {
-        newTemporary(Type.OBJECT, indexNode); //TODO
+        ensureSymbol(Type.OBJECT, indexNode); //TODO
         return indexNode;
     }
 
     @SuppressWarnings("rawtypes")
     @Override
-    public Node enterLiteralNode(final LiteralNode literalNode) {
+    public boolean enterLiteralNode(final LiteralNode literalNode) {
         try {
             start(literalNode);
             assert !literalNode.isTokenType(TokenType.THIS) : "tokentype for " + literalNode + " is this"; //guard against old dead code case. literal nodes should never inherit tokens
@@ -604,26 +652,33 @@
                 assert !(literalNode.getValue() instanceof Node) : "literals with Node values not supported";
             }
 
-            getCurrentFunctionNode().newLiteral(literalNode);
+            getLexicalContext().getCurrentFunction().newLiteral(literalNode);
         } finally {
             end(literalNode);
         }
-        return null;
+
+        return false;
+    }
+
+    @Override
+    public boolean enterObjectNode(final ObjectNode objectNode) {
+        return start(objectNode);
     }
 
     @Override
     public Node leaveObjectNode(final ObjectNode objectNode) {
-        newTemporary(Type.OBJECT, objectNode);
-        end(objectNode);
-        return objectNode;
+        ensureSymbol(Type.OBJECT, objectNode);
+        return end(objectNode);
     }
 
+    //TODO is this correct why not leave?
     @Override
-    public Node enterPropertyNode(final PropertyNode propertyNode) {
+    public boolean enterPropertyNode(final PropertyNode propertyNode) {
         // assign a pseudo symbol to property name, see NASHORN-710
+        start(propertyNode);
         propertyNode.setSymbol(new Symbol(propertyNode.getKeyName(), 0, Type.OBJECT));
         end(propertyNode);
-        return propertyNode;
+        return true;
     }
 
     @Override
@@ -636,8 +691,10 @@
             if (expr.getType().isUnknown() && symbol.isParam()) {
                 symbol.setType(Type.OBJECT);
             }
-            getCurrentFunctionNode().setReturnType(Type.widest(getCurrentFunctionNode().getReturnType(), symbol.getSymbolType()));
-            LOG.info("Returntype is now " + getCurrentFunctionNode().getReturnType());
+
+            final Type returnType = Type.widest(returnTypes.pop(), symbol.getSymbolType());
+            returnTypes.push(returnType);
+            LOG.info("Returntype is now ", returnType);
         }
 
         end(returnNode);
@@ -649,25 +706,29 @@
     public Node leaveSwitchNode(final SwitchNode switchNode) {
         Type type = Type.UNKNOWN;
 
+        final List<CaseNode> newCases = new ArrayList<>();
         for (final CaseNode caseNode : switchNode.getCases()) {
             final Node test = caseNode.getTest();
+
+            CaseNode newCaseNode = caseNode;
             if (test != null) {
                 if (test instanceof LiteralNode) {
                     //go down to integers if we can
                     final LiteralNode<?> lit = (LiteralNode<?>)test;
                     if (lit.isNumeric() && !(lit.getValue() instanceof Integer)) {
                         if (JSType.isRepresentableAsInt(lit.getNumber())) {
-                            caseNode.setTest(LiteralNode.newInstance(lit, lit.getInt32()).accept(this));
+                            newCaseNode = caseNode.setTest(LiteralNode.newInstance(lit, lit.getInt32()).accept(this));
                         }
                     }
                 } else {
                     // the "all integer" case that CodeGenerator optimizes for currently assumes literals only
                     type = Type.OBJECT;
-                    break;
                 }
 
-                type = Type.widest(type, caseNode.getTest().getType());
+                type = Type.widest(type, newCaseNode.getTest().getType());
             }
+
+            newCases.add(newCaseNode);
         }
 
         //only optimize for all integers
@@ -675,11 +736,11 @@
             type = Type.OBJECT;
         }
 
-        switchNode.setTag(newInternal(getCurrentFunctionNode().uniqueName(SWITCH_TAG_PREFIX.tag()), type));
+        switchNode.setTag(newInternal(getLexicalContext().getCurrentFunction().uniqueName(SWITCH_TAG_PREFIX.symbolName()), type));
 
         end(switchNode);
 
-        return switchNode;
+        return switchNode.setCases(getLexicalContext(), newCases);
     }
 
     @Override
@@ -696,25 +757,25 @@
     }
 
     @Override
-    public Node enterVarNode(final VarNode varNode) {
+    public boolean enterVarNode(final VarNode varNode) {
         start(varNode);
 
         final IdentNode ident = varNode.getName();
         final String    name  = ident.getName();
 
-        final Symbol symbol = defineSymbol(getCurrentBlock(), name, IS_VAR, ident);
+        final Symbol symbol = defineSymbol(getLexicalContext().getCurrentBlock(), name, IS_VAR, ident);
         assert symbol != null;
 
-        LOG.info("VarNode " + varNode + " set symbol " + symbol);
+        LOG.info("VarNode ", varNode, " set symbol ", symbol);
         varNode.setSymbol(symbol);
 
         // NASHORN-467 - use before definition of vars - conservative
-        if (localUses.contains(ident.getName())) {
+        if (isLocalUse(ident.getName())) {
             newType(symbol, Type.OBJECT);
             symbol.setCanBeUndefined();
         }
 
-        return varNode;
+        return true;
     }
 
     @Override
@@ -734,7 +795,7 @@
         addLocalDef(name);
 
         final Symbol  symbol   = varNode.getSymbol();
-        final boolean isScript = lexicalContext.getFunction(symbol.getBlock()).isProgram(); //see NASHORN-56
+        final boolean isScript = getLexicalContext().getDefiningFunction(symbol).isProgram(); //see NASHORN-56
         if ((init.getType().isNumeric() || init.getType().isBoolean()) && !isScript) {
             // Forbid integers as local vars for now as we have no way to treat them as undefined
             newType(symbol, init.getType());
@@ -751,14 +812,14 @@
 
     @Override
     public Node leaveADD(final UnaryNode unaryNode) {
-        newTemporary(arithType(), unaryNode);
+        ensureSymbol(arithType(), unaryNode);
         end(unaryNode);
         return unaryNode;
     }
 
     @Override
     public Node leaveBIT_NOT(final UnaryNode unaryNode) {
-        newTemporary(Type.INT, unaryNode);
+        ensureSymbol(Type.INT, unaryNode);
         end(unaryNode);
         return unaryNode;
     }
@@ -766,30 +827,29 @@
     @Override
     public Node leaveDECINC(final UnaryNode unaryNode) {
         // @see assignOffset
-        ensureAssignmentSlots(getCurrentFunctionNode(), unaryNode.rhs());
+        ensureAssignmentSlots(getLexicalContext().getCurrentFunction(), unaryNode.rhs());
         final Type type = arithType();
         newType(unaryNode.rhs().getSymbol(), type);
-        newTemporary(type, unaryNode);
+        ensureSymbol(type, unaryNode);
         end(unaryNode);
         return unaryNode;
     }
 
     @Override
     public Node leaveDELETE(final UnaryNode unaryNode) {
-        final FunctionNode   currentFunctionNode = getCurrentFunctionNode();
-        final boolean        strictMode          = currentFunctionNode.isStrictMode();
+        final FunctionNode   currentFunctionNode = getLexicalContext().getCurrentFunction();
+        final boolean        strictMode          = currentFunctionNode.isStrict();
         final Node           rhs                 = unaryNode.rhs();
         final Node           strictFlagNode      = LiteralNode.newInstance(unaryNode, strictMode).accept(this);
 
         Request request = Request.DELETE;
-        final RuntimeNode runtimeNode;
         final List<Node> args = new ArrayList<>();
 
         if (rhs instanceof IdentNode) {
             // If this is a declared variable or a function parameter, delete always fails (except for globals).
             final String name = ((IdentNode)rhs).getName();
 
-            final boolean failDelete = strictMode || rhs.getSymbol().isParam() || (rhs.getSymbol().isVar() && !rhs.getSymbol().isTopLevel());
+            final boolean failDelete = strictMode || rhs.getSymbol().isParam() || (rhs.getSymbol().isVar() && !isProgramLevelSymbol(name));
 
             if (failDelete && rhs.getSymbol().isThis()) {
                 return LiteralNode.newInstance(unaryNode, true).accept(this);
@@ -797,7 +857,7 @@
             final Node literalNode = LiteralNode.newInstance(unaryNode, name).accept(this);
 
             if (!failDelete) {
-                args.add(currentFunctionNode.getScopeNode());
+                args.add(compilerConstant(SCOPE));
             }
             args.add(literalNode);
             args.add(strictFlagNode);
@@ -825,42 +885,62 @@
             return LiteralNode.newInstance(unaryNode, true).accept(this);
         }
 
-        runtimeNode = new RuntimeNode(unaryNode, request, args);
-        assert runtimeNode.getSymbol() == unaryNode.getSymbol(); //clone constructor should do this
+        final RuntimeNode runtimeNode = new RuntimeNode(unaryNode, request, args);
+        assert runtimeNode.getSymbol() == unaryNode.getSymbol(); //unary parent constructor should do this
 
         return leaveRuntimeNode(runtimeNode);
     }
 
+    /**
+     * Is the symbol denoted by the specified name in the current lexical context defined in the program level
+     * @param name the name of the symbol
+     * @return true if the symbol denoted by the specified name in the current lexical context defined in the program level.
+     */
+    private boolean isProgramLevelSymbol(final String name) {
+        for(final Iterator<Block> it = getLexicalContext().getBlocks(); it.hasNext();) {
+            final Block next = it.next();
+            if(next.getExistingSymbol(name) != null) {
+                return next == getLexicalContext().getFunctionBody(getLexicalContext().getOutermostFunction());
+            }
+        }
+        throw new AssertionError("Couldn't find symbol " + name + " in the context");
+    }
+
     @Override
     public Node leaveNEW(final UnaryNode unaryNode) {
-        newTemporary(Type.OBJECT, unaryNode);
+        ensureSymbol(Type.OBJECT, unaryNode);
         end(unaryNode);
         return unaryNode;
     }
 
     @Override
     public Node leaveNOT(final UnaryNode unaryNode) {
-        newTemporary(Type.BOOLEAN, unaryNode);
+        ensureSymbol(Type.BOOLEAN, unaryNode);
         end(unaryNode);
         return unaryNode;
     }
 
+    private IdentNode compilerConstant(CompilerConstants cc) {
+        final FunctionNode functionNode = getLexicalContext().getCurrentFunction();
+        final IdentNode node = new IdentNode(functionNode.getSource(), functionNode.getToken(), functionNode.getFinish(), cc.symbolName());
+        node.setSymbol(functionNode.compilerConstant(cc));
+        return node;
+    }
+
     @Override
     public Node leaveTYPEOF(final UnaryNode unaryNode) {
-        final Node rhs    = unaryNode.rhs();
-
-        RuntimeNode runtimeNode;
+        final Node rhs = unaryNode.rhs();
 
         List<Node> args = new ArrayList<>();
         if (rhs instanceof IdentNode && !rhs.getSymbol().isParam() && !rhs.getSymbol().isVar()) {
-            args.add(getCurrentFunctionNode().getScopeNode());
+            args.add(compilerConstant(SCOPE));
             args.add(LiteralNode.newInstance(rhs, ((IdentNode)rhs).getName()).accept(this)); //null
         } else {
             args.add(rhs);
             args.add(LiteralNode.newInstance(unaryNode).accept(this)); //null, do not reuse token of identifier rhs, it can be e.g. 'this'
         }
 
-        runtimeNode = new RuntimeNode(unaryNode, Request.TYPEOF, args);
+        RuntimeNode runtimeNode = new RuntimeNode(unaryNode, Request.TYPEOF, args);
         assert runtimeNode.getSymbol() == unaryNode.getSymbol();
 
         runtimeNode = (RuntimeNode)leaveRuntimeNode(runtimeNode);
@@ -872,21 +952,20 @@
 
     @Override
     public Node leaveRuntimeNode(final RuntimeNode runtimeNode) {
-        newTemporary(runtimeNode.getRequest().getReturnType(), runtimeNode);
+        ensureSymbol(runtimeNode.getRequest().getReturnType(), runtimeNode);
         return runtimeNode;
     }
 
     @Override
     public Node leaveSUB(final UnaryNode unaryNode) {
-        newTemporary(arithType(), unaryNode);
+        ensureSymbol(arithType(), unaryNode);
         end(unaryNode);
         return unaryNode;
     }
 
     @Override
     public Node leaveVOID(final UnaryNode unaryNode) {
-        final RuntimeNode runtimeNode = new RuntimeNode(unaryNode, Request.VOID);
-        runtimeNode.accept(this);
+        final RuntimeNode runtimeNode = (RuntimeNode)new RuntimeNode(unaryNode, Request.VOID).accept(this);
         assert runtimeNode.getSymbol().getSymbolType().isObject();
         end(unaryNode);
         return runtimeNode;
@@ -903,7 +982,7 @@
 
         ensureTypeNotUnknown(lhs);
         ensureTypeNotUnknown(rhs);
-        newTemporary(Type.widest(lhs.getType(), rhs.getType()), binaryNode);
+        ensureSymbol(Type.widest(lhs.getType(), rhs.getType()), binaryNode);
 
         end(binaryNode);
 
@@ -912,7 +991,7 @@
 
     @Override
     public Node leaveAND(final BinaryNode binaryNode) {
-        newTemporary(Type.OBJECT, binaryNode);
+        ensureSymbol(Type.OBJECT, binaryNode);
         end(binaryNode);
         return binaryNode;
     }
@@ -921,39 +1000,39 @@
      * This is a helper called before an assignment.
      * @param binaryNode assignment node
      */
-    private Node enterAssignmentNode(final BinaryNode binaryNode) {
+    private boolean enterAssignmentNode(final BinaryNode binaryNode) {
         start(binaryNode);
 
         final Node lhs = binaryNode.lhs();
 
         if (lhs instanceof IdentNode) {
-            final Block     block = getCurrentBlock();
+            final Block     block = getLexicalContext().getCurrentBlock();
             final IdentNode ident = (IdentNode)lhs;
             final String    name  = ident.getName();
 
-            Symbol symbol = findSymbol(getCurrentBlock(), name);
+            Symbol symbol = findSymbol(block, name);
 
             if (symbol == null) {
                 symbol = defineSymbol(block, name, IS_GLOBAL, ident);
                 binaryNode.setSymbol(symbol);
-            } else if (!isLocal(getCurrentFunctionNode(), symbol)) {
-                symbol.setIsScope();
+            } else {
+                maybeForceScope(symbol);
             }
 
             addLocalDef(name);
         }
 
-        return binaryNode;
+        return true;
     }
 
     private boolean isLocal(FunctionNode function, Symbol symbol) {
-        final Block block = symbol.getBlock();
-        // some temp symbols have no block, so can be assumed local
-        return block == null || lexicalContext.getFunction(block) == function;
+        final FunctionNode definingFn = getLexicalContext().getDefiningFunction(symbol);
+        // Temp symbols are not assigned to a block, so their defining fn is null; those can be assumed local
+        return definingFn == null || definingFn == function;
     }
 
     @Override
-    public Node enterASSIGN(final BinaryNode binaryNode) {
+    public boolean enterASSIGN(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -963,7 +1042,7 @@
     }
 
     @Override
-    public Node enterASSIGN_ADD(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_ADD(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -978,7 +1057,7 @@
     }
 
     @Override
-    public Node enterASSIGN_BIT_AND(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_AND(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -988,7 +1067,7 @@
     }
 
     @Override
-    public Node enterASSIGN_BIT_OR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_OR(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -998,7 +1077,7 @@
     }
 
     @Override
-    public Node enterASSIGN_BIT_XOR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_XOR(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -1008,7 +1087,7 @@
     }
 
     @Override
-    public Node enterASSIGN_DIV(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_DIV(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -1018,7 +1097,7 @@
     }
 
     @Override
-    public Node enterASSIGN_MOD(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_MOD(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -1028,7 +1107,7 @@
     }
 
     @Override
-    public Node enterASSIGN_MUL(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_MUL(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -1038,7 +1117,7 @@
     }
 
     @Override
-    public Node enterASSIGN_SAR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SAR(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -1048,7 +1127,7 @@
     }
 
     @Override
-    public Node enterASSIGN_SHL(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SHL(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -1058,7 +1137,7 @@
     }
 
     @Override
-    public Node enterASSIGN_SHR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SHR(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -1068,7 +1147,7 @@
     }
 
     @Override
-    public Node enterASSIGN_SUB(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SUB(final BinaryNode binaryNode) {
         return enterAssignmentNode(binaryNode);
     }
 
@@ -1094,13 +1173,13 @@
 
     @Override
     public Node leaveCOMMARIGHT(final BinaryNode binaryNode) {
-        newTemporary(binaryNode.rhs().getType(), binaryNode);
+        ensureSymbol(binaryNode.rhs().getType(), binaryNode);
         return binaryNode;
     }
 
     @Override
     public Node leaveCOMMALEFT(final BinaryNode binaryNode) {
-        newTemporary(binaryNode.lhs().getType(), binaryNode);
+        ensureSymbol(binaryNode.lhs().getType(), binaryNode);
         return binaryNode;
     }
 
@@ -1113,7 +1192,7 @@
         final Node lhs = binaryNode.lhs();
         final Node rhs = binaryNode.rhs();
 
-        newTemporary(Type.BOOLEAN, binaryNode);
+        ensureSymbol(Type.BOOLEAN, binaryNode);
         ensureTypeNotUnknown(lhs);
         ensureTypeNotUnknown(rhs);
 
@@ -1131,7 +1210,7 @@
 
         //newType(binaryNode.lhs().getSymbol(), operandType);
         //newType(binaryNode.rhs().getSymbol(), operandType);
-        newTemporary(destType, binaryNode);
+        ensureSymbol(destType, binaryNode);
         return binaryNode;
     }
 
@@ -1216,7 +1295,7 @@
 
     @Override
     public Node leaveOR(final BinaryNode binaryNode) {
-        newTemporary(Type.OBJECT, binaryNode);
+        ensureSymbol(Type.OBJECT, binaryNode);
         end(binaryNode);
         return binaryNode;
     }
@@ -1244,7 +1323,7 @@
     @Override
     public Node leaveForNode(final ForNode forNode) {
         if (forNode.isForIn()) {
-            forNode.setIterator(newInternal(getCurrentFunctionNode().uniqueName(ITERATOR_PREFIX.tag()), Type.OBJECT)); //NASHORN-73
+            forNode.setIterator(newInternal(getLexicalContext().getCurrentFunction().uniqueName(ITERATOR_PREFIX.symbolName()), Type.OBJECT)); //NASHORN-73
             /*
              * Iterators return objects, so we need to widen the scope of the
              * init variable if it, for example, has been assigned double type
@@ -1267,65 +1346,50 @@
         ensureTypeNotUnknown(rhs);
 
         final Type type = Type.widest(lhs.getType(), rhs.getType());
-        newTemporary(type, ternaryNode);
+        ensureSymbol(type, ternaryNode);
 
         end(ternaryNode);
+        assert ternaryNode.getSymbol() != null;
 
         return ternaryNode;
     }
 
-    private void initThis(final FunctionNode functionNode) {
-        final Symbol thisSymbol = defineSymbol(functionNode, THIS.tag(), IS_PARAM | IS_THIS, null);
+    private void initThis(final Block block) {
+        final Symbol thisSymbol = defineSymbol(block, THIS.symbolName(), IS_PARAM | IS_THIS, null);
         newType(thisSymbol, Type.OBJECT);
         thisSymbol.setNeedsSlot(true);
-        functionNode.getThisNode().setSymbol(thisSymbol);
-        LOG.info("Initialized scope symbol: " + thisSymbol);
     }
 
-    private void initScope(final FunctionNode functionNode) {
-        final Symbol scopeSymbol = defineSymbol(functionNode, SCOPE.tag(), IS_VAR | IS_INTERNAL, null);
+    private void initScope(final Block block) {
+        final Symbol scopeSymbol = defineSymbol(block, SCOPE.symbolName(), IS_VAR | IS_INTERNAL, null);
         newType(scopeSymbol, Type.typeFor(ScriptObject.class));
         scopeSymbol.setNeedsSlot(true);
-        functionNode.getScopeNode().setSymbol(scopeSymbol);
-        LOG.info("Initialized scope symbol: " + scopeSymbol);
     }
 
-    private void initReturn(final FunctionNode functionNode) {
-        final Symbol returnSymbol = defineSymbol(functionNode, SCRIPT_RETURN.tag(), IS_VAR | IS_INTERNAL, null);
+    private void initReturn(final Block block) {
+        final Symbol returnSymbol = defineSymbol(block, RETURN.symbolName(), IS_VAR | IS_INTERNAL, null);
         newType(returnSymbol, Type.OBJECT);
         returnSymbol.setNeedsSlot(true);
-        functionNode.getResultNode().setSymbol(returnSymbol);
-        LOG.info("Initialized return symbol: " + returnSymbol);
         //return symbol is always object as it's the __return__ thing. What returnType is is another matter though
     }
 
-    private void initVarArg(final FunctionNode functionNode) {
-        if (functionNode.isVarArg()) {
-            final Symbol varArgsSymbol = defineSymbol(functionNode, VARARGS.tag(), IS_PARAM | IS_INTERNAL, null);
-            varArgsSymbol.setTypeOverride(Type.OBJECT_ARRAY);
-            varArgsSymbol.setNeedsSlot(true);
-            functionNode.getVarArgsNode().setSymbol(varArgsSymbol);
-            LOG.info("Initialized varargs symbol: " + varArgsSymbol);
+    private void initVarArg(final Block block, final boolean needsArguments) {
+        final Symbol varArgsSymbol = defineSymbol(block, VARARGS.symbolName(), IS_PARAM | IS_INTERNAL, null);
+        varArgsSymbol.setTypeOverride(Type.OBJECT_ARRAY);
+        varArgsSymbol.setNeedsSlot(true);
 
-            if (functionNode.needsArguments()) {
-                final String    argumentsName   = functionNode.getArgumentsNode().getName();
-                final Symbol    argumentsSymbol = defineSymbol(functionNode, argumentsName, IS_VAR | IS_INTERNAL, null);
-                newType(argumentsSymbol, Type.typeFor(ScriptObject.class));
-                argumentsSymbol.setNeedsSlot(true);
-                functionNode.getArgumentsNode().setSymbol(argumentsSymbol);
-                addLocalDef(argumentsName);
-                LOG.info("Initialized vararg varArgsSymbol=" + varArgsSymbol + " argumentsSymbol=" + argumentsSymbol);
-            }
+        if (needsArguments) {
+            final Symbol    argumentsSymbol = defineSymbol(block, ARGUMENTS.symbolName(), IS_VAR | IS_INTERNAL, null);
+            newType(argumentsSymbol, Type.typeFor(ScriptObject.class));
+            argumentsSymbol.setNeedsSlot(true);
+            addLocalDef(ARGUMENTS.symbolName());
         }
     }
 
-    private void initCallee(final FunctionNode functionNode) {
-        assert functionNode.getCalleeNode() != null : functionNode + " has no callee";
-        final Symbol calleeSymbol = defineSymbol(functionNode, CALLEE.tag(), IS_PARAM | IS_INTERNAL, null);
-        newType(calleeSymbol, Type.typeFor(ScriptFunction.class));
+    private void initCallee(final Block block) {
+        final Symbol calleeSymbol = defineSymbol(block, CALLEE.symbolName(), IS_PARAM | IS_INTERNAL, null);
+        newType(calleeSymbol, FunctionNode.FUNCTION_TYPE);
         calleeSymbol.setNeedsSlot(true);
-        functionNode.getCalleeNode().setSymbol(calleeSymbol);
-        LOG.info("Initialized callee symbol " + calleeSymbol);
     }
 
     /**
@@ -1334,25 +1398,19 @@
      *
      * @param functionNode the function node
      */
-    private void initParameters(final FunctionNode functionNode) {
-        //If a function is specialized, we don't need to tag either it return
-        // type or its parameters with the widest (OBJECT) type for safety.
-        functionNode.setReturnType(Type.UNKNOWN);
-
+    private void initParameters(final FunctionNode functionNode, final Block body) {
         for (final IdentNode param : functionNode.getParameters()) {
             addLocalDef(param.getName());
-            final Symbol paramSymbol = defineSymbol(functionNode, param.getName(), IS_PARAM, param);
+            final Symbol paramSymbol = defineSymbol(body, param.getName(), IS_PARAM, param);
             if (paramSymbol != null) {
                 final Type callSiteParamType = functionNode.getSpecializedType(param);
                 if (callSiteParamType != null) {
-                    LOG.info("Param " + paramSymbol + " has a callsite type " + callSiteParamType + ". Using that.");
-
-                    System.err.println("Param " + param + " has a callsite type " + callSiteParamType + ". Using that.");
+                    LOG.info("Param ", paramSymbol, " has a callsite type ", callSiteParamType, ". Using that.");
                 }
                 newType(paramSymbol, callSiteParamType == null ? Type.UNKNOWN : callSiteParamType);
             }
 
-            LOG.info("Initialized param " + paramSymbol);
+            LOG.info("Initialized param ", paramSymbol);
         }
     }
 
@@ -1378,7 +1436,7 @@
             // this function, we can tell the runtime system that no matter what the
             // call site is, use this information. TODO
             if (!paramSymbol.getSymbolType().isObject()) {
-                LOG.finest("Parameter " + ident + " could profit from specialization to " + paramSymbol.getSymbolType());
+                LOG.finest("Parameter ", ident, " could profit from specialization to ", paramSymbol.getSymbolType());
             }
 
             newType(paramSymbol, Type.widest(type, paramSymbol.getSymbolType()));
@@ -1392,19 +1450,18 @@
 
     /**
      * Move any properties from a global map into the scope of this method
-     * @param functionNode the function node for which to init scope vars
+     * @param block the function node body for which to init scope vars
      */
-    private void initFromPropertyMap(final FunctionNode functionNode) {
+    private void initFromPropertyMap(final Block block) {
         // For a script, add scope symbols as defined in the property map
-        assert functionNode.isProgram();
 
         final PropertyMap map = Context.getGlobalMap();
 
         for (final Property property : map.getProperties()) {
             final String key    = property.getKey();
-            final Symbol symbol = defineSymbol(functionNode, key, IS_GLOBAL, null);
+            final Symbol symbol = defineSymbol(block, key, IS_GLOBAL, null);
             newType(symbol, Type.OBJECT);
-            LOG.info("Added global symbol from property map " + symbol);
+            LOG.info("Added global symbol from property map ", symbol);
         }
     }
 
@@ -1412,7 +1469,7 @@
 
         final Symbol symbol = node.getSymbol();
 
-        LOG.info("Ensure type not unknown for: " + symbol);
+        LOG.info("Ensure type not unknown for: ", symbol);
 
         /*
          * Note that not just unknowns, but params need to be blown
@@ -1452,7 +1509,7 @@
     }
 
     private Symbol exceptionSymbol() {
-        return newInternal(getCurrentFunctionNode().uniqueName(EXCEPTION_PREFIX.tag()), Type.typeFor(ECMAException.class));
+        return newInternal(getLexicalContext().getCurrentFunction().uniqueName(EXCEPTION_PREFIX.symbolName()), Type.typeFor(ECMAException.class));
     }
 
     /**
@@ -1512,15 +1569,15 @@
                     }
                     Type from = node.getType();
                     if (!Type.areEquivalent(from, to) && Type.widest(from, to) == to) {
-                        LOG.fine("Had to post pass widen '" + node + "' " + Debug.id(node) + " from " + node.getType() + " to " + to);
+                        LOG.fine("Had to post pass widen '", node, "' " + Debug.id(node), " from ", node.getType(), " to ", to);
                         newType(node.getSymbol(), to);
                         changed.add(node);
                     }
                 }
 
                 @Override
-                public Node enterFunctionNode(final FunctionNode node) {
-                    return node.isLazy() ? null : node;
+                public boolean enterFunctionNode(final FunctionNode node) {
+                    return !node.isLazy();
                 }
 
                 /**
@@ -1574,7 +1631,7 @@
         } else {
             type = Type.OBJECT; //force lhs to be an object if not numeric assignment, e.g. strings too.
         }
-        newTemporary(type, binaryNode);
+        ensureSymbol(type, binaryNode);
         newType(lhs.getSymbol(), type);
         end(binaryNode);
         return binaryNode;
@@ -1589,32 +1646,25 @@
         final Node lhs = binaryNode.lhs();
 
         newType(lhs.getSymbol(), destType); //may not narrow if dest is already wider than destType
-        newTemporary(destType, binaryNode); //for OP= nodes, the node can carry a narrower types than its lhs rhs. This is perfectly fine
+        ensureSymbol(destType, binaryNode); //for OP= nodes, the node can carry a narrower types than its lhs rhs. This is perfectly fine
 
-        ensureAssignmentSlots(getCurrentFunctionNode(), binaryNode);
+        ensureAssignmentSlots(getLexicalContext().getCurrentFunction(), binaryNode);
 
         end(binaryNode);
         return binaryNode;
     }
 
-    private static boolean isFunctionExpressionSelfReference(final Symbol symbol) {
-        if (symbol.isVar() && symbol.getNode() == symbol.getBlock() && symbol.getNode() instanceof FunctionNode) {
-            return ((FunctionNode)symbol.getNode()).getIdent().getName().equals(symbol.getName());
-        }
-        return false;
+    private Symbol ensureSymbol(final FunctionNode functionNode, final Type type, final Node node) {
+        LOG.info("New TEMPORARY added to ", functionNode.getName(), " type=", type);
+        return functionNode.ensureSymbol(getLexicalContext().getCurrentBlock(), type, node);
     }
 
-    private static Symbol newTemporary(final FunctionNode functionNode, final Type type, final Node node) {
-        LOG.info("New TEMPORARY added to " + functionNode.getName() + " type=" + type);
-        return functionNode.newTemporary(type, node);
-    }
-
-    private Symbol newTemporary(final Type type, final Node node) {
-        return newTemporary(getCurrentFunctionNode(), type, node);
+    private Symbol ensureSymbol(final Type type, final Node node) {
+        return ensureSymbol(getLexicalContext().getCurrentFunction(), type, node);
     }
 
     private Symbol newInternal(final String name, final Type type) {
-        final Symbol iter = defineSymbol(getCurrentFunctionNode(), name, IS_VAR | IS_INTERNAL, null);
+        final Symbol iter = defineSymbol(getLexicalContext().getCurrentBlock(), name, IS_VAR | IS_INTERNAL, null);
         iter.setType(type); // NASHORN-73
         return iter;
     }
@@ -1624,40 +1674,51 @@
         symbol.setType(type);
 
         if (symbol.getSymbolType() != oldType) {
-            LOG.info("New TYPE " + type + " for " + symbol + " (was " + oldType + ")");
+            LOG.info("New TYPE ", type, " for ", symbol," (was ", oldType, ")");
         }
 
         if (symbol.isParam()) {
             symbol.setType(type);
-            LOG.info("Param type change " + symbol);
+            LOG.info("Param type change ", symbol);
         }
     }
 
-    private void clearLocalDefs() {
-        localDefs = new HashSet<>();
+    private void pushLocalsFunction() {
+        localDefs.push(new HashSet<String>());
+        localUses.push(new HashSet<String>());
+    }
+
+    private void pushLocalsBlock() {
+        localDefs.push(localDefs.isEmpty() ? new HashSet<String>() : new HashSet<>(localDefs.peek()));
+        localUses.push(localUses.isEmpty() ? new HashSet<String>() : new HashSet<>(localUses.peek()));
+    }
+
+    private void popLocals() {
+        localDefs.pop();
+        localUses.pop();
     }
 
     private boolean isLocalDef(final String name) {
-        return localDefs.contains(name);
+        return localDefs.peek().contains(name);
     }
 
     private void addLocalDef(final String name) {
-        LOG.info("Adding local def of symbol: '" + name + "'");
-        localDefs.add(name);
+        LOG.info("Adding local def of symbol: '", name, "'");
+        localDefs.peek().add(name);
     }
 
     private void removeLocalDef(final String name) {
-        LOG.info("Removing local def of symbol: '" + name + "'");
-        localDefs.remove(name);
+        LOG.info("Removing local def of symbol: '", name, "'");
+        localDefs.peek().remove(name);
     }
 
-    private void clearLocalUses() {
-        localUses = new HashSet<>();
+    private boolean isLocalUse(final String name) {
+        return localUses.peek().contains(name);
     }
 
     private void addLocalUse(final String name) {
-        LOG.info("Adding local use of symbol: '" + name + "'");
-        localUses.add(name);
+        LOG.info("Adding local use of symbol: '", name, "'");
+        localUses.peek().add(name);
     }
 
     /**
@@ -1665,30 +1726,28 @@
      * This is done when the function contains unevaluated black boxes such as
      * lazy sub-function nodes that have not been compiled.
      *
-     * @param functionNode function node in whose scope symbols should conservatively be made objects
+     * @param body body for the function node we are leaving
      */
-    private static void objectifySymbols(final FunctionNode functionNode) {
-        functionNode.accept(new NodeVisitor() {
+    private static void objectifySymbols(final Block body) {
+        body.accept(new NodeVisitor() {
             private void toObject(final Block block) {
                 for (final Iterator<Symbol> iter = block.symbolIterator(); iter.hasNext();) {
                     final Symbol symbol = iter.next();
-                    newType(symbol, Type.OBJECT);
+                    if (!symbol.isTemp()) {
+                        newType(symbol, Type.OBJECT);
+                    }
                 }
             }
 
             @Override
-            public Node enterBlock(final Block block) {
+            public boolean enterBlock(final Block block) {
                 toObject(block);
-                return block;
+                return true;
             }
 
             @Override
-            public Node enterFunctionNode(final FunctionNode node) {
-                toObject(node);
-                if (node.isLazy()) {
-                    return null;
-                }
-                return node;
+            public boolean enterFunctionNode(final FunctionNode node) {
+                return false;
             }
         });
     }
@@ -1702,11 +1761,11 @@
         return cn.substring(lastDot + 1);
     }
 
-    private Node start(final Node node) {
+    private boolean start(final Node node) {
         return start(node, true);
     }
 
-    private Node start(final Node node, final boolean printNode) {
+    private boolean start(final Node node, final boolean printNode) {
         if (DEBUG) {
             final StringBuilder sb = new StringBuilder();
 
@@ -1715,13 +1774,13 @@
                 append("] ").
                 append(printNode ? node.toString() : "").
                 append(" in '").
-                append(getCurrentFunctionNode().getName()).
+                append(getLexicalContext().getCurrentFunction().getName()).
                 append("'");
-            LOG.info(sb.toString());
+            LOG.info(sb);
             LOG.indent();
         }
 
-        return node;
+        return true;
     }
 
     private Node end(final Node node) {
@@ -1737,7 +1796,7 @@
                 append("] ").
                 append(printNode ? node.toString() : "").
                 append(" in '").
-                append(getCurrentFunctionNode().getName());
+                append(getLexicalContext().getCurrentFunction().getName());
 
             if (node.getSymbol() == null) {
                 sb.append(" <NO SYMBOL>");
@@ -1746,7 +1805,7 @@
             }
 
             LOG.unindent();
-            LOG.info(sb.toString());
+            LOG.info(sb);
         }
 
         return node;
--- a/nashorn/src/jdk/nashorn/internal/codegen/ClassEmitter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/ClassEmitter.java	Wed May 08 10:10:05 2013 +0100
@@ -58,12 +58,14 @@
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
+
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.org.objectweb.asm.util.TraceClassVisitor;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.FunctionNode;
+import jdk.nashorn.internal.ir.SplitNode;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -219,14 +221,14 @@
     private void defineCommonStatics(final boolean strictMode) {
         // source - used to store the source data (text) for this script.  Shared across
         // compile units.  Set externally by the compiler.
-        field(EnumSet.of(Flag.PRIVATE, Flag.STATIC), SOURCE.tag(), Source.class);
+        field(EnumSet.of(Flag.PRIVATE, Flag.STATIC), SOURCE.symbolName(), Source.class);
 
         // constants - used to the constants array for this script.  Shared across
         // compile units.  Set externally by the compiler.
-        field(EnumSet.of(Flag.PRIVATE, Flag.STATIC), CONSTANTS.tag(), Object[].class);
+        field(EnumSet.of(Flag.PRIVATE, Flag.STATIC), CONSTANTS.symbolName(), Object[].class);
 
         // strictMode - was this script compiled in strict mode.  Set externally by the compiler.
-        field(EnumSet.of(Flag.PUBLIC, Flag.STATIC, Flag.FINAL), STRICT_MODE.tag(), boolean.class, strictMode);
+        field(EnumSet.of(Flag.PUBLIC, Flag.STATIC, Flag.FINAL), STRICT_MODE.symbolName(), boolean.class, strictMode);
     }
 
     /**
@@ -238,9 +240,9 @@
 
         if (constantMethodNeeded.contains(String.class)) {
             // $getString - get the ith entry from the constants table and cast to String.
-            final MethodEmitter getStringMethod = method(EnumSet.of(Flag.PRIVATE, Flag.STATIC), GET_STRING.tag(), String.class, int.class);
+            final MethodEmitter getStringMethod = method(EnumSet.of(Flag.PRIVATE, Flag.STATIC), GET_STRING.symbolName(), String.class, int.class);
             getStringMethod.begin();
-            getStringMethod.getStatic(unitClassName, CONSTANTS.tag(), CONSTANTS.descriptor())
+            getStringMethod.getStatic(unitClassName, CONSTANTS.symbolName(), CONSTANTS.descriptor())
                         .load(Type.INT, 0)
                         .arrayload()
                         .checkcast(String.class)
@@ -250,7 +252,7 @@
 
         if (constantMethodNeeded.contains(PropertyMap.class)) {
             // $getMap - get the ith entry from the constants table and cast to PropertyMap.
-            final MethodEmitter getMapMethod = method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), GET_MAP.tag(), PropertyMap.class, int.class);
+            final MethodEmitter getMapMethod = method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), GET_MAP.symbolName(), PropertyMap.class, int.class);
             getMapMethod.begin();
             getMapMethod.loadConstants()
                         .load(Type.INT, 0)
@@ -260,7 +262,7 @@
             getMapMethod.end();
 
             // $setMap - overwrite an existing map.
-            final MethodEmitter setMapMethod = method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), SET_MAP.tag(), void.class, int.class, PropertyMap.class);
+            final MethodEmitter setMapMethod = method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), SET_MAP.symbolName(), void.class, int.class, PropertyMap.class);
             setMapMethod.begin();
             setMapMethod.loadConstants()
                         .load(Type.INT, 0)
@@ -289,7 +291,7 @@
         final MethodEmitter getArrayMethod = method(EnumSet.of(Flag.PRIVATE, Flag.STATIC), methodName, cls, int.class);
 
         getArrayMethod.begin();
-        getArrayMethod.getStatic(unitClassName, CONSTANTS.tag(), CONSTANTS.descriptor())
+        getArrayMethod.getStatic(unitClassName, CONSTANTS.symbolName(), CONSTANTS.descriptor())
                       .load(Type.INT, 0)
                       .arrayload()
                       .checkcast(cls)
@@ -307,7 +309,7 @@
      */
     static String getArrayMethodName(final Class<?> cls) {
         assert cls.isArray();
-        return GET_ARRAY_PREFIX.tag() + cls.getComponentType().getSimpleName() + GET_ARRAY_SUFFIX.tag();
+        return GET_ARRAY_PREFIX.symbolName() + cls.getComponentType().getSimpleName() + GET_ARRAY_SUFFIX.symbolName();
     }
 
     /**
@@ -409,6 +411,10 @@
         methodsStarted.remove(method);
     }
 
+    SplitMethodEmitter method(final SplitNode splitNode, final String methodName, final Class<?> rtype, final Class<?>... ptypes) {
+        return new SplitMethodEmitter(this, methodVisitor(EnumSet.of(Flag.PUBLIC, Flag.STATIC), methodName, rtype, ptypes), splitNode);
+    }
+
     /**
      * Add a new method to the class - defaults to public method
      *
@@ -433,7 +439,7 @@
      * @return method emitter to use for weaving this method
      */
     MethodEmitter method(final EnumSet<Flag> methodFlags, final String methodName, final Class<?> rtype, final Class<?>... ptypes) {
-        return new MethodEmitter(this, cw.visitMethod(Flag.getValue(methodFlags), methodName, methodDescriptor(rtype, ptypes), null, null));
+        return new MethodEmitter(this, methodVisitor(methodFlags, methodName, rtype, ptypes));
     }
 
     /**
@@ -484,7 +490,7 @@
      * @return method emitter to use for weaving <clinit>
      */
     MethodEmitter clinit() {
-        return method(EnumSet.of(Flag.STATIC), CLINIT.tag(), void.class);
+        return method(EnumSet.of(Flag.STATIC), CLINIT.symbolName(), void.class);
     }
 
     /**
@@ -493,7 +499,7 @@
      * @return method emitter to use for weaving <init>()V
      */
     MethodEmitter init() {
-        return method(INIT.tag(), void.class);
+        return method(INIT.symbolName(), void.class);
     }
 
     /**
@@ -503,7 +509,7 @@
      * @return method emitter to use for weaving <init>()V
      */
     MethodEmitter init(final Class<?>... ptypes) {
-        return method(INIT.tag(), void.class, ptypes);
+        return method(INIT.symbolName(), void.class, ptypes);
     }
 
     /**
@@ -515,7 +521,7 @@
      * @return method emitter to use for weaving <init>(...)V
      */
     MethodEmitter init(final EnumSet<Flag> flags, final Class<?>... ptypes) {
-        return method(flags, INIT.tag(), void.class, ptypes);
+        return method(flags, INIT.symbolName(), void.class, ptypes);
     }
 
     /**
@@ -628,4 +634,9 @@
             return v;
         }
     }
+
+    private MethodVisitor methodVisitor(EnumSet<Flag> flags, final String methodName, final Class<?> rtype, final Class<?>... ptypes) {
+        return cw.visitMethod(Flag.getValue(flags), methodName, methodDescriptor(rtype, ptypes), null, null);
+    }
+
 }
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Wed May 08 10:10:05 2013 +0100
@@ -27,14 +27,18 @@
 
 import static jdk.nashorn.internal.codegen.ClassEmitter.Flag.PRIVATE;
 import static jdk.nashorn.internal.codegen.ClassEmitter.Flag.STATIC;
+import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS;
+import static jdk.nashorn.internal.codegen.CompilerConstants.CALLEE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.GET_MAP;
 import static jdk.nashorn.internal.codegen.CompilerConstants.GET_STRING;
-import static jdk.nashorn.internal.codegen.CompilerConstants.LEAF;
 import static jdk.nashorn.internal.codegen.CompilerConstants.QUICK_PREFIX;
 import static jdk.nashorn.internal.codegen.CompilerConstants.REGEX_PREFIX;
+import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
 import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.SPLIT_ARRAY_ARG;
 import static jdk.nashorn.internal.codegen.CompilerConstants.SPLIT_PREFIX;
+import static jdk.nashorn.internal.codegen.CompilerConstants.THIS;
+import static jdk.nashorn.internal.codegen.CompilerConstants.VARARGS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup;
 import static jdk.nashorn.internal.codegen.CompilerConstants.interfaceCallNoLookup;
 import static jdk.nashorn.internal.codegen.CompilerConstants.methodDescriptor;
@@ -48,8 +52,10 @@
 import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_STRICT;
 
 import java.io.PrintWriter;
+import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Deque;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -67,11 +73,11 @@
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
 import jdk.nashorn.internal.ir.BreakNode;
+import jdk.nashorn.internal.ir.BreakableNode;
 import jdk.nashorn.internal.ir.CallNode;
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
 import jdk.nashorn.internal.ir.ContinueNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
 import jdk.nashorn.internal.ir.EmptyNode;
 import jdk.nashorn.internal.ir.ExecuteNode;
 import jdk.nashorn.internal.ir.ForNode;
@@ -81,10 +87,12 @@
 import jdk.nashorn.internal.ir.IfNode;
 import jdk.nashorn.internal.ir.IndexNode;
 import jdk.nashorn.internal.ir.LexicalContext;
+import jdk.nashorn.internal.ir.LexicalContextNode;
 import jdk.nashorn.internal.ir.LineNumberNode;
 import jdk.nashorn.internal.ir.LiteralNode;
 import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
 import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode.ArrayUnit;
+import jdk.nashorn.internal.ir.LoopNode;
 import jdk.nashorn.internal.ir.Node;
 import jdk.nashorn.internal.ir.ObjectNode;
 import jdk.nashorn.internal.ir.PropertyNode;
@@ -107,8 +115,10 @@
 import jdk.nashorn.internal.parser.Lexer.RegexToken;
 import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.Debug;
 import jdk.nashorn.internal.runtime.DebugLogger;
 import jdk.nashorn.internal.runtime.ECMAException;
+import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.RecompilableScriptFunctionData;
@@ -157,14 +167,29 @@
     /** How many regexp fields have been emitted */
     private int regexFieldCount;
 
-    /** Used for temporary signaling between enterCallNode and enterFunctionNode to handle the special case of calling
-     * a just-defined anonymous function expression. */
-    private boolean functionNodeIsCallee;
-
     /** Map of shared scope call sites */
     private final Map<SharedScopeCall, SharedScopeCall> scopeCalls = new HashMap<>();
 
-    private final LexicalContext lexicalContext = new LexicalContext();
+    /** Compile unit stack - every time we start a sub method (e.g. a split) we push one */
+    private final Deque<CompileUnit> compileUnits = new ArrayDeque<>();
+
+    /** Method emitter stack - every time we start a sub method (e.g. a split) we push one */
+    private final Deque<MethodEmitter> methodEmitters = new ArrayDeque<>();
+
+    /** The discard stack - whenever we enter a discard node we keep track of its return value status -
+     *  i.e. should we keep it or throw it away */
+    private final Deque<Node> discard = new ArrayDeque<>();
+
+    // A stack tracking the next free local variable slot in the blocks. There's one entry for every block
+    // currently on the lexical context stack.
+    private int[] nextFreeSlots = new int[16];
+    private int nextFreeSlotsSize = 0;
+
+    /** Current method emitter */
+    private MethodEmitter method;
+
+    /** Current compile unit */
+    private CompileUnit unit;
 
     /** When should we stop caching regexp expressions in fields to limit bytecode size? */
     private static final int MAX_REGEX_FIELDS = 2 * 1024;
@@ -177,6 +202,7 @@
      * @param compiler
      */
     CodeGenerator(final Compiler compiler) {
+        super(new DynamicScopeTrackingLexicalContext());
         this.compiler      = compiler;
         this.callSiteFlags = compiler.getEnv()._callsite_flags;
     }
@@ -188,7 +214,37 @@
      * @return the correct flags for a call site in the current function
      */
     int getCallSiteFlags() {
-        return getCurrentFunctionNode().isStrictMode() ? callSiteFlags | CALLSITE_STRICT : callSiteFlags;
+        return getLexicalContext().getCurrentFunction().isStrict() ? callSiteFlags | CALLSITE_STRICT : callSiteFlags;
+    }
+
+    private void pushMethodEmitter(final MethodEmitter newMethod) {
+        methodEmitters.push(newMethod);
+        this.method = newMethod;
+    }
+
+    private void popMethodEmitter(final MethodEmitter oldMethod) {
+        assert methodEmitters.peek() == oldMethod;
+        methodEmitters.pop();
+        if (!methodEmitters.isEmpty()) {
+            this.method = methodEmitters.peek();
+        } else {
+            this.method = null;
+        }
+    }
+
+    private void push(final CompileUnit newUnit) {
+        compileUnits.push(newUnit);
+        this.unit = newUnit;
+    }
+
+    private void pop(final CompileUnit oldUnit) {
+        assert compileUnits.peek() == oldUnit;
+        compileUnits.pop();
+        if (!compileUnits.isEmpty()) {
+            this.unit = compileUnits.peek();
+        } else {
+            this.unit = null;
+        }
     }
 
     /**
@@ -217,7 +273,7 @@
             assert identNode.getSymbol().isScope() : identNode + " is not in scope!";
 
             final int flags = CALLSITE_SCOPE | getCallSiteFlags();
-            method.loadScope();
+            method.loadCompilerConstant(SCOPE);
 
             if (isFastScope(symbol)) {
                 // Only generate shared scope getter for fast-scope symbols so we know we can dial in correct scope.
@@ -231,27 +287,103 @@
     }
 
     /**
+     * A lexical context that also tracks if we have any dynamic scopes in the context. Such scopes can have new
+     * variables introduced into them at run time - a with block or a function directly containing an eval call.
+     */
+    private static class DynamicScopeTrackingLexicalContext extends LexicalContext {
+        int dynamicScopeCount = 0;
+
+        @Override
+        public <T extends LexicalContextNode> T push(T node) {
+            if(isDynamicScopeBoundary(node)) {
+                ++dynamicScopeCount;
+            }
+            return super.push(node);
+        }
+
+        @Override
+        public <T extends LexicalContextNode> T pop(T node) {
+            final T popped = super.pop(node);
+            if(isDynamicScopeBoundary(popped)) {
+                --dynamicScopeCount;
+            }
+            return popped;
+        }
+
+        private boolean isDynamicScopeBoundary(LexicalContextNode node) {
+            if(node instanceof Block) {
+                // Block's immediate parent is a with node. Note we aren't testing for a WithNode, as that'd capture
+                // processing of WithNode.expression too, but it should be unaffected.
+                return !isEmpty() && peek() instanceof WithNode;
+            } else if(node instanceof FunctionNode) {
+                // Function has a direct eval in it (so a top-level "var ..." in the eval code can introduce a new
+                // variable into the function's scope), and it isn't strict (as evals in strict functions get an
+                // isolated scope).
+                return isFunctionDynamicScope((FunctionNode)node);
+            }
+            return false;
+        }
+    }
+
+    boolean inDynamicScope() {
+        return ((DynamicScopeTrackingLexicalContext)getLexicalContext()).dynamicScopeCount > 0;
+    }
+
+    static boolean isFunctionDynamicScope(FunctionNode fn) {
+        return fn.hasEval() && !fn.isStrict();
+    }
+
+    /**
      * Check if this symbol can be accessed directly with a putfield or getfield or dynamic load
      *
      * @param function function to check for fast scope
      * @return true if fast scope
      */
     private boolean isFastScope(final Symbol symbol) {
-        if (!symbol.isScope() || !symbol.getBlock().needsScope()) {
+        if(!symbol.isScope()) {
+            return false;
+        }
+        final LexicalContext lc = getLexicalContext();
+        if(!inDynamicScope()) {
+            // If there's no with or eval in context, and the symbol is marked as scoped, it is fast scoped. Such a
+            // symbol must either be global, or its defining block must need scope.
+            assert symbol.isGlobal() || lc.getDefiningBlock(symbol).needsScope() : symbol.getName();
+            return true;
+        }
+        if(symbol.isGlobal()) {
+            // Shortcut: if there's a with or eval in context, globals can't be fast scoped
             return false;
         }
-        // Allow fast scope access if no function contains with or eval
-        for(final Iterator<FunctionNode> it = lexicalContext.getFunctions(getCurrentFunctionNode()); it.hasNext();) {
-            final FunctionNode func = it.next();
-            if (func.hasWith() || func.hasEval()) {
-                return false;
+        // Otherwise, check if there's a dynamic scope between use of the symbol and its definition
+        final String name = symbol.getName();
+        boolean previousWasBlock = false;
+        for (final Iterator<LexicalContextNode> it = lc.getAllNodes(); it.hasNext();) {
+            final LexicalContextNode node = it.next();
+            if(node instanceof Block) {
+                // If this block defines the symbol, then we can fast scope the symbol.
+                final Block block = (Block)node;
+                if(block.getExistingSymbol(name) == symbol) {
+                    assert block.needsScope();
+                    return true;
+                }
+                previousWasBlock = true;
+            } else {
+                if((node instanceof WithNode && previousWasBlock) || (node instanceof FunctionNode && isFunctionDynamicScope((FunctionNode)node))) {
+                    // If we hit a scope that can have symbols introduced into it at run time before finding the defining
+                    // block, the symbol can't be fast scoped. A WithNode only counts if we've immediately seen a block
+                    // before - its block. Otherwise, we are currently processing the WithNode's expression, and that's
+                    // obviously not subjected to introducing new symbols.
+                    return false;
+                }
+                previousWasBlock = false;
             }
         }
-        return true;
+        // Should've found the symbol defined in a block
+        throw new AssertionError();
     }
 
     private MethodEmitter loadSharedScopeVar(final Type valueType, final Symbol symbol, final int flags) {
-        method.load(isFastScope(symbol) ? getScopeProtoDepth(getCurrentBlock(), symbol) : -1);
+        method.load(isFastScope(symbol) ? getScopeProtoDepth(getLexicalContext().getCurrentBlock(), symbol) : -1);
         final SharedScopeCall scopeCall = getScopeGet(valueType, symbol, flags | CALLSITE_FAST_SCOPE);
         scopeCall.generateInvoke(method);
         return method;
@@ -271,10 +403,10 @@
 
     private int getScopeProtoDepth(final Block startingBlock, final Symbol symbol) {
         int depth = 0;
-        final Block definingBlock = symbol.getBlock();
-        for(final Iterator<Block> blocks = lexicalContext.getBlocks(startingBlock); blocks.hasNext();) {
+        final String name = symbol.getName();
+        for(final Iterator<Block> blocks = getLexicalContext().getBlocks(startingBlock); blocks.hasNext();) {
             final Block currentBlock = blocks.next();
-            if (currentBlock == definingBlock) {
+            if (currentBlock.getExistingSymbol(name) == symbol) {
                 return depth;
             }
             if (currentBlock.needsScope()) {
@@ -285,9 +417,9 @@
     }
 
     private void loadFastScopeProto(final Symbol symbol, final boolean swap) {
-        final int depth = getScopeProtoDepth(getCurrentBlock(), symbol);
+        final int depth = getScopeProtoDepth(getLexicalContext().getCurrentBlock(), symbol);
         assert depth != -1;
-        if(depth > 0) {
+        if (depth > 0) {
             if (swap) {
                 method.swap();
             }
@@ -328,46 +460,46 @@
          */
         final CodeGenerator codegen = this;
 
-        node.accept(new NodeVisitor(getCurrentCompileUnit(), method) {
+        node.accept(new NodeVisitor() {
             @Override
-            public Node enterIdentNode(final IdentNode identNode) {
+            public boolean enterIdentNode(final IdentNode identNode) {
                 loadIdent(identNode);
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterAccessNode(final AccessNode accessNode) {
+            public boolean enterAccessNode(final AccessNode accessNode) {
                 if (!baseAlreadyOnStack) {
                     load(accessNode.getBase()).convert(Type.OBJECT);
                 }
                 assert method.peekType().isObject();
                 method.dynamicGet(node.getType(), accessNode.getProperty().getName(), getCallSiteFlags(), accessNode.isFunction());
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterIndexNode(final IndexNode indexNode) {
+            public boolean enterIndexNode(final IndexNode indexNode) {
                 if (!baseAlreadyOnStack) {
                     load(indexNode.getBase()).convert(Type.OBJECT);
                     load(indexNode.getIndex());
                 }
                 method.dynamicGetIndex(node.getType(), getCallSiteFlags(), indexNode.isFunction());
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterFunctionNode(FunctionNode functionNode) {
+            public boolean enterFunctionNode(FunctionNode functionNode) {
                 // function nodes will always leave a constructed function object on stack, no need to load the symbol
                 // separately as in enterDefault()
                 functionNode.accept(codegen);
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterDefault(final Node otherNode) {
+            public boolean enterDefault(final Node otherNode) {
                 otherNode.accept(codegen); // generate code for whatever we are looking at.
                 method.load(symbol); // load the final symbol to the stack (or nop if no slot, then result is already there)
-                return null;
+                return false;
             }
         });
 
@@ -375,14 +507,9 @@
     }
 
     @Override
-    public Node enterAccessNode(final AccessNode accessNode) {
-        if (accessNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterAccessNode(final AccessNode accessNode) {
         load(accessNode);
-
-        return null;
+        return false;
     }
 
     /**
@@ -407,7 +534,7 @@
             final boolean isInternal = symbol.isParam() || symbol.isInternal() || symbol.isThis() || !symbol.canBeUndefined();
 
             if (symbol.hasSlot() && !isInternal) {
-                assert symbol.getSymbolType().isNumber() || symbol.getSymbolType().isObject() : "no potentially undefined narrower local vars than doubles are allowed: " + symbol + " in " + getCurrentFunctionNode();
+                assert symbol.getSymbolType().isNumber() || symbol.getSymbolType().isObject() : "no potentially undefined narrower local vars than doubles are allowed: " + symbol + " in " + getLexicalContext().getCurrentFunction();
                 if (symbol.getSymbolType().isNumber()) {
                     numbers.add(symbol);
                 } else if (symbol.getSymbolType().isObject()) {
@@ -441,22 +568,20 @@
      * @param block block containing symbols.
      */
     private void symbolInfo(final Block block) {
-        for (final Symbol symbol : block.getFrame().getSymbols()) {
-            method.localVariable(symbol, block.getEntryLabel(), block.getBreakLabel());
+        for (final Iterator<Symbol> iter = block.symbolIterator(); iter.hasNext(); ) {
+            final Symbol symbol = iter.next();
+            if (symbol.hasSlot()) {
+                method.localVariable(symbol, block.getEntryLabel(), block.getBreakLabel());
+            }
         }
     }
 
     @Override
-    public Node enterBlock(final Block block) {
-        if (block.testResolved()) {
-            return null;
-        }
-        lexicalContext.push(block);
-
+    public boolean enterBlock(final Block block) {
         method.label(block.getEntryLabel());
         initLocals(block);
 
-        return block;
+        return true;
     }
 
     @Override
@@ -464,10 +589,10 @@
         method.label(block.getBreakLabel());
         symbolInfo(block);
 
-        if (block.needsScope()) {
+        if (block.needsScope() && !block.isTerminal()) {
             popBlockScope(block);
         }
-        lexicalContext.pop(block);
+        --nextFreeSlotsSize;
         return block;
     }
 
@@ -477,34 +602,30 @@
         final Label skipLabel     = new Label("skip_catch");
 
         /* pop scope a la try-finally */
-        method.loadScope();
+        method.loadCompilerConstant(SCOPE);
         method.invoke(ScriptObject.GET_PROTO);
-        method.storeScope();
+        method.storeCompilerConstant(SCOPE);
         method._goto(skipLabel);
         method.label(exitLabel);
 
         method._catch(recoveryLabel);
-        method.loadScope();
+        method.loadCompilerConstant(SCOPE);
         method.invoke(ScriptObject.GET_PROTO);
-        method.storeScope();
+        method.storeCompilerConstant(SCOPE);
         method.athrow();
         method.label(skipLabel);
         method._try(block.getEntryLabel(), exitLabel, recoveryLabel, Throwable.class);
     }
 
     @Override
-    public Node enterBreakNode(final BreakNode breakNode) {
-        if (breakNode.testResolved()) {
-            return null;
-        }
-
-        for (int i = 0; i < breakNode.getScopeNestingLevel(); i++) {
+    public boolean enterBreakNode(final BreakNode breakNode) {
+        final BreakableNode breakFrom = getLexicalContext().getBreakable(breakNode.getLabel());
+        for (int i = 0; i < getLexicalContext().getScopeNestingLevelTo(breakFrom); i++) {
             closeWith();
         }
-
-        method.splitAwareGoto(breakNode.getTargetLabel());
-
-        return null;
+        method.splitAwareGoto(getLexicalContext(), breakFrom.getBreakLabel());
+
+        return false;
     }
 
     private int loadArgs(final List<Node> args) {
@@ -541,21 +662,17 @@
     }
 
     @Override
-    public Node enterCallNode(final CallNode callNode) {
-        if (callNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterCallNode(final CallNode callNode) {
         final List<Node>   args            = callNode.getArgs();
         final Node         function        = callNode.getFunction();
-        final Block        currentBlock    = getCurrentBlock();
-
-        function.accept(new NodeVisitor(getCurrentCompileUnit(), method) {
+        final Block        currentBlock    = getLexicalContext().getCurrentBlock();
+
+        function.accept(new NodeVisitor() {
 
             private void sharedScopeCall(final IdentNode identNode, final int flags) {
                 final Symbol symbol = identNode.getSymbol();
                 int    scopeCallFlags = flags;
-                method.loadScope();
+                method.loadCompilerConstant(SCOPE);
                 if (isFastScope(symbol)) {
                     method.load(getScopeProtoDepth(currentBlock, symbol));
                     scopeCallFlags |= CALLSITE_FAST_SCOPE;
@@ -591,7 +708,7 @@
                 // We don't need ScriptFunction object for 'eval'
                 method.pop();
 
-                method.loadScope(); // Load up self (scope).
+                method.loadCompilerConstant(SCOPE); // Load up self (scope).
 
                 final CallNode.EvalArgs evalArgs = callNode.getEvalArgs();
                 // load evaluated code
@@ -618,7 +735,7 @@
             }
 
             @Override
-            public Node enterIdentNode(final IdentNode node) {
+            public boolean enterIdentNode(final IdentNode node) {
                 final Symbol symbol = node.getSymbol();
 
                 if (symbol.isScope()) {
@@ -626,27 +743,27 @@
                     final int useCount = symbol.getUseCount();
 
                     // Threshold for generating shared scope callsite is lower for fast scope symbols because we know
-                    // we can dial in the correct scope. However, we als need to enable it for non-fast scopes to
+                    // we can dial in the correct scope. However, we also need to enable it for non-fast scopes to
                     // support huge scripts like mandreel.js.
                     if (callNode.isEval()) {
                         evalCall(node, flags);
                     } else if (useCount <= SharedScopeCall.FAST_SCOPE_CALL_THRESHOLD
                             || (!isFastScope(symbol) && useCount <= SharedScopeCall.SLOW_SCOPE_CALL_THRESHOLD)
-                            || callNode.inWithBlock()) {
+                            || CodeGenerator.this.inDynamicScope()) {
                         scopeCall(node, flags);
                     } else {
                         sharedScopeCall(node, flags);
                     }
-                    assert method.peekType().equals(callNode.getType());
+                    assert method.peekType().equals(callNode.getType()) : method.peekType() + "!=" + callNode.getType();
                 } else {
                     enterDefault(node);
                 }
 
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterAccessNode(final AccessNode node) {
+            public boolean enterAccessNode(final AccessNode node) {
                 load(node.getBase());
                 method.convert(Type.OBJECT);
                 method.dup();
@@ -655,35 +772,34 @@
                 method.dynamicCall(callNode.getType(), 2 + loadArgs(args), getCallSiteFlags());
                 assert method.peekType().equals(callNode.getType());
 
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterFunctionNode(final FunctionNode callee) {
+            public boolean enterFunctionNode(final FunctionNode origCallee) {
+                // NOTE: visiting the callee will leave a constructed ScriptFunction object on the stack if
+                // callee.needsCallee() == true
+                final FunctionNode callee = (FunctionNode)origCallee.accept(CodeGenerator.this);
+
                 final boolean      isVarArg = callee.isVarArg();
                 final int          argCount = isVarArg ? -1 : callee.getParameters().size();
 
                 final String signature = new FunctionSignature(true, callee.needsCallee(), callee.getReturnType(), isVarArg ? null : callee.getParameters()).toString();
 
-                if (callee.needsCallee()) {
-                    newFunctionObject(callee);
-                }
-
-                if (callee.isStrictMode()) { // self is undefined
+                if (callee.isStrict()) { // self is undefined
                     method.loadUndefined(Type.OBJECT);
                 } else { // get global from scope (which is the self)
                     globalInstance();
                 }
                 loadArgs(args, signature, isVarArg, argCount);
+                assert callee.getCompileUnit() != null : "no compile unit for " + callee.getName() + " " + Debug.id(callee) + " " + callNode;
                 method.invokestatic(callee.getCompileUnit().getUnitClassName(), callee.getName(), signature);
                 assert method.peekType().equals(callee.getReturnType()) : method.peekType() + " != " + callee.getReturnType();
-                functionNodeIsCallee = true;
-                callee.accept(CodeGenerator.this);
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterIndexNode(final IndexNode node) {
+            public boolean enterIndexNode(final IndexNode node) {
                 load(node.getBase());
                 method.convert(Type.OBJECT);
                 method.dup();
@@ -697,11 +813,11 @@
                 method.dynamicCall(callNode.getType(), 2 + loadArgs(args), getCallSiteFlags());
                 assert method.peekType().equals(callNode.getType());
 
-                return null;
+                return false;
             }
 
             @Override
-            protected Node enterDefault(final Node node) {
+            protected boolean enterDefault(final Node node) {
                 // Load up function.
                 load(function);
                 method.convert(Type.OBJECT); //TODO, e.g. booleans can be used as functions
@@ -709,58 +825,41 @@
                 method.dynamicCall(callNode.getType(), 2 + loadArgs(args), getCallSiteFlags() | CALLSITE_SCOPE);
                 assert method.peekType().equals(callNode.getType());
 
-                return null;
+                return false;
             }
         });
 
         method.store(callNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterContinueNode(final ContinueNode continueNode) {
-        if (continueNode.testResolved()) {
-            return null;
-        }
-
-        for (int i = 0; i < continueNode.getScopeNestingLevel(); i++) {
+    public boolean enterContinueNode(final ContinueNode continueNode) {
+        final LoopNode continueTo = getLexicalContext().getContinueTo(continueNode.getLabel());
+        for (int i = 0; i < getLexicalContext().getScopeNestingLevelTo(continueTo); i++) {
             closeWith();
         }
-
-        method.splitAwareGoto(continueNode.getTargetLabel());
-
-        return null;
+        method.splitAwareGoto(getLexicalContext(), continueTo.getContinueLabel());
+
+        return false;
     }
 
     @Override
-    public Node enterDoWhileNode(final DoWhileNode doWhileNode) {
-        return enterWhileNode(doWhileNode);
-    }
-
-    @Override
-    public Node enterEmptyNode(final EmptyNode emptyNode) {
-        return null;
+    public boolean enterEmptyNode(final EmptyNode emptyNode) {
+        return false;
     }
 
     @Override
-    public Node enterExecuteNode(final ExecuteNode executeNode) {
-        if (executeNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterExecuteNode(final ExecuteNode executeNode) {
         final Node expression = executeNode.getExpression();
         expression.accept(this);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterForNode(final ForNode forNode) {
-        if (forNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterForNode(final ForNode forNode) {
         final Node  test   = forNode.getTest();
         final Block body   = forNode.getBody();
         final Node  modify = forNode.getModify();
@@ -790,6 +889,10 @@
 
             new Store<Node>(init) {
                 @Override
+                protected void storeNonDiscard() {
+                    return;
+                }
+                @Override
                 protected void evaluate() {
                     method.load(iter);
                     method.invoke(interfaceCallNoLookup(Iterator.class, "next", Object.class));
@@ -829,7 +932,19 @@
             method.label(breakLabel);
         }
 
-        return null;
+        return false;
+    }
+
+    private static int assignSlots(final Block block, final int firstSlot) {
+        int nextSlot = firstSlot;
+        for (final Iterator<Symbol> iter = block.symbolIterator(); iter.hasNext(); ) {
+            final Symbol next = iter.next();
+            if (next.hasSlot()) {
+                next.setSlot(nextSlot);
+                nextSlot += next.slotCount();
+            }
+        }
+        return nextSlot;
     }
 
     /**
@@ -838,21 +953,26 @@
      * @param block block with local vars.
      */
     private void initLocals(final Block block) {
-        final FunctionNode function       = lexicalContext.getFunction(block);
-        final boolean      isFunctionNode = block == function;
-
-        /*
-         * Get the symbols from the frame and realign the frame so that all
-         * slots get correct numbers. The slot numbering is not fixed until
-         * after initLocals has been run
-         */
-        final Frame        frame   = block.getFrame();
-        final List<Symbol> symbols = frame.getSymbols();
-
-        /* Fix the predefined slots so they have numbers >= 0, like varargs. */
-        frame.realign();
-
-        if (isFunctionNode) {
+        final boolean isFunctionBody = getLexicalContext().isFunctionBody();
+
+        final int nextFreeSlot;
+        if (isFunctionBody) {
+            // On entry to function, start with slot 0
+            nextFreeSlot = 0;
+        } else {
+            // Otherwise, continue from previous block's first free slot
+            nextFreeSlot = nextFreeSlots[nextFreeSlotsSize - 1];
+        }
+        if(nextFreeSlotsSize == nextFreeSlots.length) {
+            final int[] newNextFreeSlots = new int[nextFreeSlotsSize * 2];
+            System.arraycopy(nextFreeSlots, 0, newNextFreeSlots, 0, nextFreeSlotsSize);
+            nextFreeSlots = newNextFreeSlots;
+        }
+        nextFreeSlots[nextFreeSlotsSize++] = assignSlots(block, nextFreeSlot);
+
+        final FunctionNode function = getLexicalContext().getCurrentFunction();
+        if (isFunctionBody) {
+            /* Fix the predefined slots so they have numbers >= 0, like varargs. */
             if (function.needsParentScope()) {
                 initParentScope();
             }
@@ -876,14 +996,18 @@
             final List<String> nameList = new ArrayList<>();
             final List<Symbol> locals   = new ArrayList<>();
 
-
             // Initalize symbols and values
             final List<Symbol> newSymbols = new ArrayList<>();
             final List<Symbol> values     = new ArrayList<>();
 
             final boolean hasArguments = function.needsArguments();
-            for (final Symbol symbol : symbols) {
-                if (symbol.isInternal() || symbol.isThis()) {
+
+            final Iterator<Symbol> symbols = block.symbolIterator();
+
+            while (symbols.hasNext()) {
+                final Symbol symbol = symbols.next();
+
+                if (symbol.isInternal() || symbol.isThis() || symbol.isTemp()) {
                     continue;
                 }
 
@@ -907,9 +1031,6 @@
                 }
             }
 
-            /* Correct slot numbering again */
-            frame.realign();
-
             // we may have locals that need to be initialized
             initSymbols(locals);
 
@@ -931,7 +1052,7 @@
                 @Override
                 protected void loadScope(MethodEmitter m) {
                     if(function.needsParentScope()) {
-                        m.loadScope();
+                        m.loadCompilerConstant(SCOPE);
                     } else {
                         m.loadNull();
                     }
@@ -940,118 +1061,102 @@
             foc.makeObject(method);
 
             // runScript(): merge scope into global
-            if (isFunctionNode && function.isProgram()) {
+            if (isFunctionBody && function.isProgram()) {
                 method.invoke(ScriptRuntime.MERGE_SCOPE);
             }
 
-            method.storeScope();
+            method.storeCompilerConstant(SCOPE);
         } else {
             // Since we don't have a scope, parameters didn't get assigned array indices by the FieldObjectCreator, so
             // we need to assign them separately here.
             int nextParam = 0;
-            if (isFunctionNode && function.isVarArg()) {
+            if (isFunctionBody && function.isVarArg()) {
                 for (final IdentNode param : function.getParameters()) {
                     param.getSymbol().setFieldIndex(nextParam++);
                 }
             }
+
+            final Iterator<Symbol> iter = block.symbolIterator();
+            final List<Symbol> symbols = new ArrayList<>();
+            while (iter.hasNext()) {
+                symbols.add(iter.next());
+            }
             initSymbols(symbols);
         }
 
         // Debugging: print symbols? @see --print-symbols flag
-        printSymbols(block, (isFunctionNode ? "Function " : "Block in ") + (function.getIdent() == null ? "<anonymous>" : function.getIdent().getName()));
+        printSymbols(block, (isFunctionBody ? "Function " : "Block in ") + (function.getIdent() == null ? "<anonymous>" : function.getIdent().getName()));
     }
 
     private void initArguments(final FunctionNode function) {
-        method.loadVarArgs();
+        method.loadCompilerConstant(VARARGS);
         if(function.needsCallee()) {
-            method.loadCallee();
+            method.loadCompilerConstant(CALLEE);
         } else {
             // If function is strict mode, "arguments.callee" is not populated, so we don't necessarily need the
             // caller.
-            assert function.isStrictMode();
+            assert function.isStrict();
             method.loadNull();
         }
         method.load(function.getParameters().size());
         globalAllocateArguments();
-        method.storeArguments();
+        method.storeCompilerConstant(ARGUMENTS);
     }
 
     private void initParentScope() {
-        method.loadCallee();
+        method.loadCompilerConstant(CALLEE);
         method.invoke(ScriptFunction.GET_SCOPE);
-        method.storeScope();
+        method.storeCompilerConstant(SCOPE);
     }
 
     @Override
-    public Node enterFunctionNode(final FunctionNode functionNode) {
-        final boolean isCallee = functionNodeIsCallee;
-        functionNodeIsCallee = false;
-
-        if (functionNode.testResolved()) {
-            return null;
-        }
-
-        if(!(isCallee || functionNode == compiler.getFunctionNode())) {
-            newFunctionObject(functionNode);
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
+        if (functionNode.isLazy()) {
+            // Must do it now; can't postpone it until leaveFunctionNode()
+            newFunctionObject(functionNode, functionNode);
+            return false;
         }
 
-        if (functionNode.isLazy()) {
-            return null;
-        }
-
-        LOG.info("=== BEGIN " + functionNode.getName());
-        lexicalContext.push(functionNode);
-
-        setCurrentCompileUnit(functionNode.getCompileUnit());
-        assert getCurrentCompileUnit() != null;
-
-        setCurrentMethodEmitter(getCurrentCompileUnit().getClassEmitter().method(functionNode));
-        functionNode.setMethodEmitter(method);
+        LOG.info("=== BEGIN ", functionNode.getName());
+
+        assert functionNode.getCompileUnit() != null : "no compile unit for " + functionNode.getName() + " " + Debug.id(functionNode);
+        push(functionNode.getCompileUnit());
+        assert !compileUnits.isEmpty();
+
+        pushMethodEmitter(unit.getClassEmitter().method(functionNode));
         // Mark end for variable tables.
         method.begin();
-        method.label(functionNode.getEntryLabel());
-
-        initLocals(functionNode);
-        functionNode.setState(CompilationState.EMITTED);
-
-        return functionNode;
+
+        return true;
     }
 
     @Override
     public Node leaveFunctionNode(final FunctionNode functionNode) {
-        // Mark end for variable tables.
-        method.label(functionNode.getBreakLabel());
-
-        if (!functionNode.needsScope()) {
-            method.markerVariable(LEAF.tag(), functionNode.getEntryLabel(), functionNode.getBreakLabel());
-        }
-
-        symbolInfo(functionNode);
         try {
             method.end(); // wrap up this method
+            pop(functionNode.getCompileUnit());
+            popMethodEmitter(method);
+            LOG.info("=== END ", functionNode.getName());
+
+            final FunctionNode newFunctionNode = functionNode.setState(getLexicalContext(), CompilationState.EMITTED);
+
+            newFunctionObject(newFunctionNode, functionNode);
+            return newFunctionNode;
         } catch (final Throwable t) {
             Context.printStackTrace(t);
             final VerifyError e = new VerifyError("Code generation bug in \"" + functionNode.getName() + "\": likely stack misaligned: " + t + " " + functionNode.getSource().getName());
             e.initCause(t);
             throw e;
         }
-
-        lexicalContext.pop(functionNode);
-        LOG.info("=== END " + functionNode.getName());
-        return functionNode;
     }
 
     @Override
-    public Node enterIdentNode(final IdentNode identNode) {
-        return null;
+    public boolean enterIdentNode(final IdentNode identNode) {
+        return false;
     }
 
     @Override
-    public Node enterIfNode(final IfNode ifNode) {
-        if (ifNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterIfNode(final IfNode ifNode) {
         final Node  test = ifNode.getTest();
         final Block pass = ifNode.getPass();
         final Block fail = ifNode.getFail();
@@ -1082,30 +1187,21 @@
             method.label(afterLabel);
         }
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterIndexNode(final IndexNode indexNode) {
-        if (indexNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterIndexNode(final IndexNode indexNode) {
         load(indexNode);
-
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterLineNumberNode(final LineNumberNode lineNumberNode) {
-        if (lineNumberNode.testResolved()) {
-            return null;
-        }
-
-        final Label label = new Label("line:" + lineNumberNode.getLineNumber() + " (" + getCurrentFunctionNode().getName() + ")");
+    public boolean enterLineNumberNode(final LineNumberNode lineNumberNode) {
+        final Label label = new Label((String)null);
         method.label(label);
         method.lineNumber(lineNumberNode.getLineNumber(), label);
-        return null;
+        return false;
     }
 
     /**
@@ -1131,43 +1227,43 @@
         final Type elementType = arrayType.getElementType();
 
         if (units != null) {
-            final CompileUnit   savedCompileUnit = getCurrentCompileUnit();
-            final MethodEmitter savedMethod      = getCurrentMethodEmitter();
-
-            try {
-                for (final ArrayUnit unit : units) {
-                    setCurrentCompileUnit(unit.getCompileUnit());
-
-                    final String className = getCurrentCompileUnit().getUnitClassName();
-                    final String name      = getCurrentFunctionNode().uniqueName(SPLIT_PREFIX.tag());
-                    final String signature = methodDescriptor(type, Object.class, ScriptFunction.class, ScriptObject.class, type);
-
-                    setCurrentMethodEmitter(getCurrentCompileUnit().getClassEmitter().method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), name, signature));
-                    method.setFunctionNode(getCurrentFunctionNode());
-                    method.begin();
-
-                    fixScopeSlot();
-
-                    method.load(arrayType, SPLIT_ARRAY_ARG.slot());
-
-                    for (int i = unit.getLo(); i < unit.getHi(); i++) {
-                        storeElement(nodes, elementType, postsets[i]);
-                    }
-
-                    method._return();
-                    method.end();
-
-                    savedMethod.loadThis();
-                    savedMethod.swap();
-                    savedMethod.loadCallee();
-                    savedMethod.swap();
-                    savedMethod.loadScope();
-                    savedMethod.swap();
-                    savedMethod.invokestatic(className, name, signature);
+            final MethodEmitter savedMethod = method;
+
+            for (final ArrayUnit arrayUnit : units) {
+                push(arrayUnit.getCompileUnit());
+
+                final String className = unit.getUnitClassName();
+                final String name      = getLexicalContext().getCurrentFunction().uniqueName(SPLIT_PREFIX.symbolName());
+                final String signature = methodDescriptor(type, Object.class, ScriptFunction.class, ScriptObject.class, type);
+
+                final MethodEmitter me = unit.getClassEmitter().method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), name, signature);
+                pushMethodEmitter(me);
+
+                method.setFunctionNode(getLexicalContext().getCurrentFunction());
+                method.begin();
+
+                fixScopeSlot();
+
+                method.load(arrayType, SPLIT_ARRAY_ARG.slot());
+
+                for (int i = arrayUnit.getLo(); i < arrayUnit.getHi(); i++) {
+                    storeElement(nodes, elementType, postsets[i]);
                 }
-            } finally {
-                setCurrentCompileUnit(savedCompileUnit);
-                setCurrentMethodEmitter(savedMethod);
+
+                method._return();
+                method.end();
+                popMethodEmitter(me);
+
+                assert method == savedMethod;
+                method.loadCompilerConstant(THIS);
+                method.swap();
+                method.loadCompilerConstant(CALLEE);
+                method.swap();
+                method.loadCompilerConstant(SCOPE);
+                method.swap();
+                method.invokestatic(className, name, signature);
+
+                pop(unit);
             }
 
             return method;
@@ -1217,12 +1313,12 @@
      * @param string string to load
      */
     void loadConstant(final String string) {
-        final String       unitClassName = getCurrentCompileUnit().getUnitClassName();
-        final ClassEmitter classEmitter  = getCurrentCompileUnit().getClassEmitter();
+        final String       unitClassName = unit.getUnitClassName();
+        final ClassEmitter classEmitter  = unit.getClassEmitter();
         final int          index         = compiler.getConstantData().add(string);
 
         method.load(index);
-        method.invokestatic(unitClassName, GET_STRING.tag(), methodDescriptor(String.class, int.class));
+        method.invokestatic(unitClassName, GET_STRING.symbolName(), methodDescriptor(String.class, int.class));
         classEmitter.needGetConstantMethod(String.class);
     }
 
@@ -1233,14 +1329,14 @@
      * @param object object to load
      */
     void loadConstant(final Object object) {
-        final String       unitClassName = getCurrentCompileUnit().getUnitClassName();
-        final ClassEmitter classEmitter  = getCurrentCompileUnit().getClassEmitter();
+        final String       unitClassName = unit.getUnitClassName();
+        final ClassEmitter classEmitter  = unit.getClassEmitter();
         final int          index         = compiler.getConstantData().add(object);
         final Class<?>     cls           = object.getClass();
 
         if (cls == PropertyMap.class) {
             method.load(index);
-            method.invokestatic(unitClassName, GET_MAP.tag(), methodDescriptor(PropertyMap.class, int.class));
+            method.invokestatic(unitClassName, GET_MAP.symbolName(), methodDescriptor(PropertyMap.class, int.class));
             classEmitter.needGetConstantMethod(PropertyMap.class);
         } else if (cls.isArray()) {
             method.load(index);
@@ -1303,14 +1399,14 @@
             return loadRegexToken(regexToken);
         }
         // emit field
-        final String       regexName    = getCurrentFunctionNode().uniqueName(REGEX_PREFIX.tag());
-        final ClassEmitter classEmitter = getCurrentCompileUnit().getClassEmitter();
+        final String       regexName    = getLexicalContext().getCurrentFunction().uniqueName(REGEX_PREFIX.symbolName());
+        final ClassEmitter classEmitter = unit.getClassEmitter();
 
         classEmitter.field(EnumSet.of(PRIVATE, STATIC), regexName, Object.class);
         regexFieldCount++;
 
         // get field, if null create new regex, finally clone regex object
-        method.getStatic(getCurrentCompileUnit().getUnitClassName(), regexName, typeDescriptor(Object.class));
+        method.getStatic(unit.getUnitClassName(), regexName, typeDescriptor(Object.class));
         method.dup();
         final Label cachedLabel = new Label("cached");
         method.ifnonnull(cachedLabel);
@@ -1318,7 +1414,7 @@
         method.pop();
         loadRegexToken(regexToken);
         method.dup();
-        method.putStatic(getCurrentCompileUnit().getUnitClassName(), regexName, typeDescriptor(Object.class));
+        method.putStatic(unit.getUnitClassName(), regexName, typeDescriptor(Object.class));
 
         method.label(cachedLabel);
         globalRegExpCopy();
@@ -1328,18 +1424,14 @@
 
     @SuppressWarnings("rawtypes")
     @Override
-    public Node enterLiteralNode(final LiteralNode literalNode) {
+    public boolean enterLiteralNode(final LiteralNode literalNode) {
         assert literalNode.getSymbol() != null : literalNode + " has no symbol";
         load(literalNode).store(literalNode.getSymbol());
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterObjectNode(final ObjectNode objectNode) {
-        if (objectNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterObjectNode(final ObjectNode objectNode) {
         final List<Node> elements = objectNode.getElements();
         final int        size     = elements.size();
 
@@ -1404,14 +1496,14 @@
 
         if (!hasGettersSetters) {
             method.store(objectNode.getSymbol());
-            return null;
+            return false;
         }
 
         for (final Node element : elements) {
             final PropertyNode propertyNode = (PropertyNode)element;
             final Object       key          = propertyNode.getKey();
-            final FunctionNode getter       = (FunctionNode)propertyNode.getGetter();
-            final FunctionNode setter       = (FunctionNode)propertyNode.getSetter();
+            final FunctionNode getter       = propertyNode.getGetter();
+            final FunctionNode setter       = propertyNode.getSetter();
 
             if (getter == null && setter == null) {
                 continue;
@@ -1436,35 +1528,25 @@
 
         method.store(objectNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterReturnNode(final ReturnNode returnNode) {
-        if (returnNode.testResolved()) {
-            return null;
-        }
-
-        // Set the split return flag in the scope if this is a split method fragment.
-        if (method.getSplitNode() != null) {
-            assert method.getSplitNode().hasReturn() : "unexpected return in split node";
-
-            method.loadScope();
-            method.checkcast(Scope.class);
-            method.load(0);
-            method.invoke(Scope.SET_SPLIT_STATE);
-        }
+    public boolean enterReturnNode(final ReturnNode returnNode) {
+        method.registerReturn();
+
+        final Type returnType = getLexicalContext().getCurrentFunction().getReturnType();
 
         final Node expression = returnNode.getExpression();
         if (expression != null) {
             load(expression);
         } else {
-            method.loadUndefined(getCurrentFunctionNode().getReturnType());
+            method.loadUndefined(returnType);
         }
 
-        method._return(getCurrentFunctionNode().getReturnType());
-
-        return null;
+        method._return(returnType);
+
+        return false;
     }
 
     private static boolean isNullLiteral(final Node node) {
@@ -1542,19 +1624,20 @@
         }
 
         assert args.size() == 2;
-        final Node lhs = args.get(0);
-        final Node rhs = args.get(1);
-
         final Type returnType = node.getType();
-        load(lhs);
-        load(rhs);
+
+        load(args.get(0));
+        load(args.get(1));
 
         Request finalRequest = request;
 
+        //if the request is a comparison, i.e. one that can be reversed
+        //it keeps its semantic, but make sure that the object comes in
+        //last
         final Request reverse = Request.reverse(request);
-        if (method.peekType().isObject() && reverse != null) {
-            if (!method.peekType(1).isObject()) {
-                method.swap();
+        if (method.peekType().isObject() && reverse != null) { //rhs is object
+            if (!method.peekType(1).isObject()) { //lhs is not object
+                method.swap(); //prefer object as lhs
                 finalRequest = reverse;
             }
         }
@@ -1581,11 +1664,7 @@
     }
 
     @Override
-    public Node enterRuntimeNode(final RuntimeNode runtimeNode) {
-        if (runtimeNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterRuntimeNode(final RuntimeNode runtimeNode) {
         /*
          * First check if this should be something other than a runtime node
          * AccessSpecializer might have changed the type
@@ -1624,7 +1703,7 @@
                 method.add();
                 method.convert(type);
                 method.store(symbol);
-                return null;
+                return false;
             default:
                 // it's ok to send this one on with only primitive arguments, maybe INSTANCEOF(true, true) or similar
                 // assert false : runtimeNode + " has all primitive arguments. This is an inconsistent state";
@@ -1636,11 +1715,11 @@
         final List<Node> args = runtimeNode.getArgs();
 
         if (nullCheck(runtimeNode, args, new FunctionSignature(false, false, runtimeNode.getType(), args).toString())) {
-            return null;
+            return false;
         }
 
         if (!runtimeNode.isFinal() && specializationCheck(runtimeNode.getRequest(), runtimeNode, args)) {
-            return null;
+            return false;
         }
 
         for (final Node arg : runtimeNode.getArgs()) {
@@ -1658,129 +1737,146 @@
         method.convert(runtimeNode.getType());
         method.store(runtimeNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterSplitNode(final SplitNode splitNode) {
-        if (splitNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterSplitNode(final SplitNode splitNode) {
         final CompileUnit splitCompileUnit = splitNode.getCompileUnit();
 
-        final FunctionNode fn   = getCurrentFunctionNode();
+        final FunctionNode fn   = getLexicalContext().getCurrentFunction();
         final String className  = splitCompileUnit.getUnitClassName();
         final String name       = splitNode.getName();
 
-        final Class<?>   rtype  = fn.getReturnType().getTypeClass();
-        final boolean needsArguments = fn.needsArguments();
-        final Class<?>[] ptypes = needsArguments ?
+        final Class<?>   rtype          = fn.getReturnType().getTypeClass();
+        final boolean    needsArguments = fn.needsArguments();
+        final Class<?>[] ptypes         = needsArguments ?
                 new Class<?>[] {ScriptFunction.class, Object.class, ScriptObject.class, Object.class} :
                 new Class<?>[] {ScriptFunction.class, Object.class, ScriptObject.class};
 
-        setCurrentCompileUnit(splitCompileUnit);
-        splitNode.setCompileUnit(splitCompileUnit);
+        final MethodEmitter caller = method;
+        push(splitCompileUnit);
 
         final Call splitCall = staticCallNoLookup(
             className,
             name,
             methodDescriptor(rtype, ptypes));
 
-        setCurrentMethodEmitter(
-            splitCompileUnit.getClassEmitter().method(
-                EnumSet.of(Flag.PUBLIC, Flag.STATIC),
-                name,
-                rtype,
-                ptypes));
+        final MethodEmitter splitEmitter =
+                splitCompileUnit.getClassEmitter().method(
+                        splitNode,
+                        name,
+                        rtype,
+                        ptypes);
+
+        pushMethodEmitter(splitEmitter);
 
         method.setFunctionNode(fn);
-        method.setSplitNode(splitNode);
-        splitNode.setMethodEmitter(method);
-
-        final MethodEmitter caller = splitNode.getCaller();
-        if(fn.needsCallee()) {
-            caller.loadCallee();
+
+        if (fn.needsCallee()) {
+            caller.loadCompilerConstant(CALLEE);
         } else {
             caller.loadNull();
         }
-        caller.loadThis();
-        caller.loadScope();
+        caller.loadCompilerConstant(THIS);
+        caller.loadCompilerConstant(SCOPE);
         if (needsArguments) {
-            caller.loadArguments();
+            caller.loadCompilerConstant(ARGUMENTS);
         }
         caller.invoke(splitCall);
-        caller.storeResult();
+        caller.storeCompilerConstant(RETURN);
 
         method.begin();
 
         method.loadUndefined(fn.getReturnType());
-        method.storeResult();
+        method.storeCompilerConstant(RETURN);
 
         fixScopeSlot();
 
-        return splitNode;
+        return true;
     }
 
     private void fixScopeSlot() {
-        if (getCurrentFunctionNode().getScopeNode().getSymbol().getSlot() != SCOPE.slot()) {
+        if (getLexicalContext().getCurrentFunction().compilerConstant(SCOPE).getSlot() != SCOPE.slot()) {
             // TODO hack to move the scope to the expected slot (that's needed because split methods reuse the same slots as the root method)
             method.load(Type.typeFor(ScriptObject.class), SCOPE.slot());
-            method.storeScope();
+            method.storeCompilerConstant(SCOPE);
         }
     }
 
     @Override
     public Node leaveSplitNode(final SplitNode splitNode) {
+        assert method instanceof SplitMethodEmitter;
+        final boolean     hasReturn = method.hasReturn();
+        final List<Label> targets   = method.getExternalTargets();
+
         try {
             // Wrap up this method.
-            method.loadResult();
-            method._return(getCurrentFunctionNode().getReturnType());
+
+            method.loadCompilerConstant(RETURN);
+            method._return(getLexicalContext().getCurrentFunction().getReturnType());
             method.end();
+
+            pop(splitNode.getCompileUnit());
+            popMethodEmitter(method);
+
         } catch (final Throwable t) {
             Context.printStackTrace(t);
-            final VerifyError e = new VerifyError("Code generation bug in \"" + splitNode.getName() + "\": likely stack misaligned: " + t + " " + getCurrentFunctionNode().getSource().getName());
+            final VerifyError e = new VerifyError("Code generation bug in \"" + splitNode.getName() + "\": likely stack misaligned: " + t + " " + getLexicalContext().getCurrentFunction().getSource().getName());
             e.initCause(t);
             throw e;
         }
 
         // Handle return from split method if there was one.
-        final MethodEmitter caller      = splitNode.getCaller();
-        final List<Label>   targets     = splitNode.getExternalTargets();
-        final int           targetCount = targets.size();
-
-        if (splitNode.hasReturn() || targetCount > 0) {
-
-            caller.loadScope();
-            caller.checkcast(Scope.class);
-            caller.invoke(Scope.GET_SPLIT_STATE);
-
-            // Split state is -1 for no split state, 0 for return, 1..n+1 for break/continue
-            final Label   breakLabel = new Label("no_split_state");
-            final int     low        = splitNode.hasReturn() ? 0 : 1;
-            final int     labelCount = targetCount + 1 - low;
-            final Label[] labels     = new Label[labelCount];
+        final MethodEmitter caller = method;
+        final int     targetCount = targets.size();
+
+        //no external jump targets or return in switch node
+        if (!hasReturn && targets.isEmpty()) {
+            return splitNode;
+        }
+
+        caller.loadCompilerConstant(SCOPE);
+        caller.checkcast(Scope.class);
+        caller.invoke(Scope.GET_SPLIT_STATE);
+
+        final Label breakLabel = new Label("no_split_state");
+        // Split state is -1 for no split state, 0 for return, 1..n+1 for break/continue
+
+        //the common case is that we don't need a switch
+        if (targetCount == 0) {
+            assert hasReturn;
+            caller.ifne(breakLabel);
+            //has to be zero
+            caller.label(new Label("split_return"));
+            method.loadCompilerConstant(RETURN);
+            caller._return(getLexicalContext().getCurrentFunction().getReturnType());
+            caller.label(breakLabel);
+        } else {
+            assert !targets.isEmpty();
+
+            final int     low         = hasReturn ? 0 : 1;
+            final int     labelCount  = targetCount + 1 - low;
+            final Label[] labels      = new Label[labelCount];
 
             for (int i = 0; i < labelCount; i++) {
-                labels[i] = new Label("split_state_" + i);
+                labels[i] = new Label(i == 0 ? "split_return" : "split_" + targets.get(i - 1));
             }
-
             caller.tableswitch(low, targetCount, breakLabel, labels);
             for (int i = low; i <= targetCount; i++) {
                 caller.label(labels[i - low]);
                 if (i == 0) {
-                    caller.loadResult();
-                    caller._return(getCurrentFunctionNode().getReturnType());
+                    caller.loadCompilerConstant(RETURN);
+                    caller._return(getLexicalContext().getCurrentFunction().getReturnType());
                 } else {
                     // Clear split state.
-                    caller.loadScope();
+                    caller.loadCompilerConstant(SCOPE);
                     caller.checkcast(Scope.class);
                     caller.load(-1);
                     caller.invoke(Scope.SET_SPLIT_STATE);
-                    caller.splitAwareGoto(targets.get(i - 1));
+                    caller.splitAwareGoto(getLexicalContext(), targets.get(i - 1));
                 }
             }
-
             caller.label(breakLabel);
         }
 
@@ -1788,11 +1884,7 @@
     }
 
     @Override
-    public Node enterSwitchNode(final SwitchNode switchNode) {
-        if (switchNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterSwitchNode(final SwitchNode switchNode) {
         final Node           expression  = switchNode.getExpression();
         final Symbol         tag         = switchNode.getTag();
         final boolean        allInteger  = tag.getSymbolType().isInteger();
@@ -1810,7 +1902,7 @@
 
         if (cases.isEmpty()) {
             method.label(breakLabel);
-            return null;
+            return false;
         }
 
         if (allInteger) {
@@ -1916,15 +2008,11 @@
             method.label(breakLabel);
         }
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterThrowNode(final ThrowNode throwNode) {
-        if (throwNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterThrowNode(final ThrowNode throwNode) {
         method._new(ECMAException.class).dup();
 
         final Node   expression = throwNode.getExpression();
@@ -1943,15 +2031,11 @@
 
         method.athrow();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterTryNode(final TryNode tryNode) {
-        if (tryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterTryNode(final TryNode tryNode) {
         final Block       body        = tryNode.getBody();
         final List<Block> catchBlocks = tryNode.getCatchBlocks();
         final Symbol      symbol      = tryNode.getException();
@@ -1974,74 +2058,68 @@
         method.store(symbol);
 
         for (int i = 0; i < catchBlocks.size(); i++) {
-            final Block saveBlock = getCurrentBlock();
             final Block catchBlock = catchBlocks.get(i);
 
-            setCurrentBlock(catchBlock);
-
-            try {
-                enterBlock(catchBlock);
-
-                final CatchNode catchNode          = (CatchNode)catchBlocks.get(i).getStatements().get(0);
-                final IdentNode exception          = catchNode.getException();
-                final Node      exceptionCondition = catchNode.getExceptionCondition();
-                final Block     catchBody          = catchNode.getBody();
-
-                if (catchNode.isSyntheticRethrow()) {
-                    // Generate catch body (inlined finally) and rethrow exception
-                    catchBody.accept(this);
-                    method.load(symbol).athrow();
-                    lexicalContext.pop(catchBlock);
-                    continue;
+            //TODO this is very ugly - try not to call enter/leave methods directly
+            //better to use the implicit lexical context scoping given by the visitor's
+            //accept method.
+            getLexicalContext().push(catchBlock);
+            enterBlock(catchBlock);
+
+            final CatchNode catchNode          = (CatchNode)catchBlocks.get(i).getStatements().get(0);
+            final IdentNode exception          = catchNode.getException();
+            final Node      exceptionCondition = catchNode.getExceptionCondition();
+            final Block     catchBody          = catchNode.getBody();
+
+            new Store<IdentNode>(exception) {
+                @Override
+                protected void storeNonDiscard() {
+                    return;
                 }
-
-                new Store<IdentNode>(exception) {
-                    @Override
-                    protected void evaluate() {
-                        /*
-                         * If caught object is an instance of ECMAException, then
-                         * bind obj.thrown to the script catch var. Or else bind the
-                         * caught object itself to the script catch var.
-                         */
-                        final Label notEcmaException = new Label("no_ecma_exception");
-
-                        method.load(symbol).dup()._instanceof(ECMAException.class).ifeq(notEcmaException);
-                        method.checkcast(ECMAException.class); //TODO is this necessary?
-                        method.getField(ECMAException.THROWN);
-                        method.label(notEcmaException);
-                    }
-                }.store();
-
-                final Label next;
-
-                if (exceptionCondition != null) {
-                    next = new Label("next");
-                    load(exceptionCondition).convert(Type.BOOLEAN).ifeq(next);
+                @Override
+                protected void evaluate() {
+                    /*
+                     * If caught object is an instance of ECMAException, then
+                     * bind obj.thrown to the script catch var. Or else bind the
+                     * caught object itself to the script catch var.
+                     */
+                    final Label notEcmaException = new Label("no_ecma_exception");
+
+                    method.load(symbol).dup()._instanceof(ECMAException.class).ifeq(notEcmaException);
+                    method.checkcast(ECMAException.class); //TODO is this necessary?
+                    method.getField(ECMAException.THROWN);
+                    method.label(notEcmaException);
+                }
+            }.store();
+
+            final Label next;
+
+            if (exceptionCondition != null) {
+                next = new Label("next");
+                load(exceptionCondition).convert(Type.BOOLEAN).ifeq(next);
+            } else {
+                next = null;
+            }
+
+            catchBody.accept(this);
+
+            if (i + 1 != catchBlocks.size() && !catchBody.hasTerminalFlags()) {
+                method._goto(skip);
+            }
+
+            if (next != null) {
+                if (i + 1 == catchBlocks.size()) {
+                    // no next catch block - rethrow if condition failed
+                    method._goto(skip);
+                    method.label(next);
+                    method.load(symbol).athrow();
                 } else {
-                    next = null;
-                }
-
-                catchBody.accept(this);
-
-                if (i + 1 != catchBlocks.size() && !catchBody.hasTerminalFlags()) {
-                    method._goto(skip);
+                    method.label(next);
                 }
-
-                if (next != null) {
-                    if (i + 1 == catchBlocks.size()) {
-                        // no next catch block - rethrow if condition failed
-                        method._goto(skip);
-                        method.label(next);
-                        method.load(symbol).athrow();
-                    } else {
-                        method.label(next);
-                    }
-                }
-
-                leaveBlock(catchBlock);
-            } finally {
-                setCurrentBlock(saveBlock);
             }
+
+            leaveBlock(catchBlock);
+            getLexicalContext().pop(catchBlock);
         }
 
         method.label(skip);
@@ -2049,15 +2127,15 @@
 
         // Finally body is always inlined elsewhere so it doesn't need to be emitted
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterVarNode(final VarNode varNode) {
+    public boolean enterVarNode(final VarNode varNode) {
         final Node init = varNode.getInit();
 
-        if (varNode.testResolved() || init == null) {
-            return null;
+        if (init == null) {
+            return false;
         }
 
         final Symbol varSymbol = varNode.getSymbol();
@@ -2067,7 +2145,7 @@
 
         final boolean needsScope = varSymbol.isScope();
         if (needsScope) {
-            method.loadScope();
+            method.loadCompilerConstant(SCOPE);
         }
         load(init);
 
@@ -2087,22 +2165,18 @@
             method.store(varSymbol);
         }
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterWhileNode(final WhileNode whileNode) {
-        if (whileNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterWhileNode(final WhileNode whileNode) {
         final Node  test          = whileNode.getTest();
         final Block body          = whileNode.getBody();
         final Label breakLabel    = whileNode.getBreakLabel();
         final Label continueLabel = whileNode.getContinueLabel();
         final Label loopLabel     = new Label("loop");
 
-        if (!(whileNode instanceof DoWhileNode)) {
+        if (!whileNode.isDoWhile()) {
             method._goto(continueLabel);
         }
 
@@ -2114,90 +2188,95 @@
             method.label(breakLabel);
         }
 
-        return null;
+        return false;
     }
 
     private void closeWith() {
-        method.loadScope();
-        method.invoke(ScriptRuntime.CLOSE_WITH);
-        method.storeScope();
+        if(method.hasScope()) {
+            method.loadCompilerConstant(SCOPE);
+            method.invoke(ScriptRuntime.CLOSE_WITH);
+            method.storeCompilerConstant(SCOPE);
+        }
     }
 
     @Override
-    public Node enterWithNode(final WithNode withNode) {
-        if (withNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterWithNode(final WithNode withNode) {
         final Node expression = withNode.getExpression();
         final Node body       = withNode.getBody();
 
-        final Label tryLabel   = new Label("with_try");
-        final Label endLabel   = new Label("with_end");
-        final Label catchLabel = new Label("with_catch");
-        final Label exitLabel  = new Label("with_exit");
-
-        method.label(tryLabel);
-
-        method.loadScope();
+        // It is possible to have a "pathological" case where the with block does not reference *any* identifiers. It's
+        // pointless, but legal. In that case, if nothing else in the method forced the assignment of a slot to the
+        // scope object, its' possible that it won't have a slot assigned. In this case we'll only evaluate expression
+        // for its side effect and visit the body, and not bother opening and closing a WithObject.
+        final boolean hasScope = method.hasScope();
+
+        final Label tryLabel;
+        if(hasScope) {
+            tryLabel = new Label("with_try");
+            method.label(tryLabel);
+            method.loadCompilerConstant(SCOPE);
+        } else {
+            tryLabel = null;
+        }
+
         load(expression);
-
         assert expression.getType().isObject() : "with expression needs to be object: " + expression;
 
-        method.invoke(ScriptRuntime.OPEN_WITH);
-        method.storeScope();
-
+        if(hasScope) {
+            // Construct a WithObject if we have a scope
+            method.invoke(ScriptRuntime.OPEN_WITH);
+            method.storeCompilerConstant(SCOPE);
+        } else {
+            // We just loaded the expression for its side effect; discard it
+            method.pop();
+        }
+
+
+        // Always process body
         body.accept(this);
 
-        if (!body.isTerminal()) {
+        if(hasScope) {
+            // Ensure we always close the WithObject
+            final Label endLabel   = new Label("with_end");
+            final Label catchLabel = new Label("with_catch");
+            final Label exitLabel  = new Label("with_exit");
+
+            if (!body.isTerminal()) {
+                closeWith();
+                method._goto(exitLabel);
+            }
+
+            method.label(endLabel);
+
+            method._catch(catchLabel);
             closeWith();
-            method._goto(exitLabel);
+            method.athrow();
+
+            method.label(exitLabel);
+
+            method._try(tryLabel, endLabel, catchLabel);
         }
-
-        method.label(endLabel);
-
-        method._catch(catchLabel);
-        closeWith();
-        method.athrow();
-
-        method.label(exitLabel);
-
-        method._try(tryLabel, endLabel, catchLabel);
-
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterADD(final UnaryNode unaryNode) {
-        if (unaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterADD(final UnaryNode unaryNode) {
         load(unaryNode.rhs());
         assert unaryNode.rhs().getType().isNumber();
         method.store(unaryNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterBIT_NOT(final UnaryNode unaryNode) {
-        if (unaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterBIT_NOT(final UnaryNode unaryNode) {
         load(unaryNode.rhs()).convert(Type.INT).load(-1).xor().store(unaryNode.getSymbol());
-
-        return null;
+        return false;
     }
 
     // do this better with convert calls to method. TODO
     @Override
-    public Node enterCONVERT(final UnaryNode unaryNode) {
-        if (unaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterCONVERT(final UnaryNode unaryNode) {
         final Node rhs = unaryNode.rhs();
         final Type to  = unaryNode.getType();
 
@@ -2230,15 +2309,11 @@
 
         method.store(unaryNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterDECINC(final UnaryNode unaryNode) {
-        if (unaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterDECINC(final UnaryNode unaryNode) {
         final Node      rhs         = unaryNode.rhs();
         final Type      type        = unaryNode.getType();
         final TokenType tokenType   = unaryNode.tokenType();
@@ -2282,32 +2357,28 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterDISCARD(final UnaryNode unaryNode) {
-        if (unaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterDISCARD(final UnaryNode unaryNode) {
         final Node rhs = unaryNode.rhs();
 
+       // System.err.println("**** Enter discard " + unaryNode);
+        discard.push(rhs);
         load(rhs);
 
-        if (rhs.shouldDiscard()) {
+        if (discard.peek() == rhs) {
+            assert !rhs.isAssignment();
             method.pop();
+            discard.pop();
         }
-
-        return null;
+       // System.err.println("**** Leave discard " + unaryNode);
+        return false;
     }
 
     @Override
-    public Node enterNEW(final UnaryNode unaryNode) {
-        if (unaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterNEW(final UnaryNode unaryNode) {
         final CallNode callNode = (CallNode)unaryNode.rhs();
         final List<Node> args   = callNode.getArgs();
 
@@ -2317,15 +2388,11 @@
         method.dynamicNew(1 + loadArgs(args), getCallSiteFlags());
         method.store(unaryNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterNOT(final UnaryNode unaryNode) {
-        if (unaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterNOT(final UnaryNode unaryNode) {
         final Node rhs = unaryNode.rhs();
 
         load(rhs);
@@ -2342,18 +2409,14 @@
         method.label(afterLabel);
         method.store(unaryNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterSUB(final UnaryNode unaryNode) {
-        if (unaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterSUB(final UnaryNode unaryNode) {
         load(unaryNode.rhs()).neg().store(unaryNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     private Node enterNumericAdd(final Node lhs, final Node rhs, final Type type, final Symbol symbol) {
@@ -2366,11 +2429,7 @@
     }
 
     @Override
-    public Node enterADD(final BinaryNode binaryNode) {
-        if (binaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterADD(final BinaryNode binaryNode) {
         final Node lhs = binaryNode.lhs();
         final Node rhs = binaryNode.rhs();
 
@@ -2384,14 +2443,10 @@
             method.store(binaryNode.getSymbol());
         }
 
-        return null;
+        return false;
     }
 
-    private Node enterAND_OR(final BinaryNode binaryNode) {
-        if (binaryNode.testResolved()) {
-            return null;
-        }
-
+    private boolean enterAND_OR(final BinaryNode binaryNode) {
         final Node lhs = binaryNode.lhs();
         final Node rhs = binaryNode.rhs();
 
@@ -2410,20 +2465,16 @@
         method.label(skip);
         method.store(binaryNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterAND(final BinaryNode binaryNode) {
+    public boolean enterAND(final BinaryNode binaryNode) {
         return enterAND_OR(binaryNode);
     }
 
     @Override
-    public Node enterASSIGN(final BinaryNode binaryNode) {
-        if (binaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterASSIGN(final BinaryNode binaryNode) {
         final Node lhs = binaryNode.lhs();
         final Node rhs = binaryNode.rhs();
 
@@ -2442,7 +2493,7 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     /**
@@ -2473,14 +2524,6 @@
             this.opType = opType;
         }
 
-        @Override
-        public void store() {
-            if (assignNode.testResolved()) {
-                return;
-            }
-            super.store();
-        }
-
         protected abstract void op();
 
         @Override
@@ -2493,35 +2536,43 @@
     }
 
     @Override
-    public Node enterASSIGN_ADD(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_ADD(final BinaryNode binaryNode) {
         assert RuntimeNode.Request.ADD.canSpecialize();
+        final Type lhsType = binaryNode.lhs().getType();
+        final Type rhsType = binaryNode.rhs().getType();
         final boolean specialize = binaryNode.getType() == Type.OBJECT;
 
         new AssignOp(binaryNode) {
-            @Override
-            protected boolean isSelfModifying() {
-                return !specialize;
-            }
 
             @Override
             protected void op() {
-                method.add();
+                if (specialize) {
+                    method.dynamicRuntimeCall(
+                            new SpecializedRuntimeNode(
+                                Request.ADD,
+                                new Type[] {
+                                    lhsType,
+                                    rhsType,
+                                },
+                                Type.OBJECT).getInitialName(),
+                            Type.OBJECT,
+                            Request.ADD);
+                } else {
+                    method.add();
+                }
             }
 
             @Override
             protected void evaluate() {
-                if (specialize && specializationCheck(Request.ADD, assignNode, Arrays.asList(assignNode.lhs(), assignNode.rhs()))) {
-                    return;
-                }
                 super.evaluate();
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_BIT_AND(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_AND(final BinaryNode binaryNode) {
         new AssignOp(Type.INT, binaryNode) {
             @Override
             protected void op() {
@@ -2529,11 +2580,11 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_BIT_OR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_OR(final BinaryNode binaryNode) {
         new AssignOp(Type.INT, binaryNode) {
             @Override
             protected void op() {
@@ -2541,11 +2592,11 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_BIT_XOR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_XOR(final BinaryNode binaryNode) {
         new AssignOp(Type.INT, binaryNode) {
             @Override
             protected void op() {
@@ -2553,11 +2604,11 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_DIV(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_DIV(final BinaryNode binaryNode) {
         new AssignOp(binaryNode) {
             @Override
             protected void op() {
@@ -2565,11 +2616,11 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_MOD(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_MOD(final BinaryNode binaryNode) {
         new AssignOp(binaryNode) {
             @Override
             protected void op() {
@@ -2577,11 +2628,11 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_MUL(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_MUL(final BinaryNode binaryNode) {
         new AssignOp(binaryNode) {
             @Override
             protected void op() {
@@ -2589,11 +2640,11 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_SAR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SAR(final BinaryNode binaryNode) {
         new AssignOp(Type.INT, binaryNode) {
             @Override
             protected void op() {
@@ -2601,11 +2652,11 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_SHL(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SHL(final BinaryNode binaryNode) {
         new AssignOp(Type.INT, binaryNode) {
             @Override
             protected void op() {
@@ -2613,24 +2664,24 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_SHR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SHR(final BinaryNode binaryNode) {
         new AssignOp(Type.INT, binaryNode) {
             @Override
             protected void op() {
                 method.shr();
-                method.convert(Type.LONG).load(0xffff_ffffL).and();
+                method.convert(Type.LONG).load(JSType.MAX_UINT).and();
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterASSIGN_SUB(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SUB(final BinaryNode binaryNode) {
         new AssignOp(binaryNode) {
             @Override
             protected void op() {
@@ -2638,7 +2689,7 @@
             }
         }.store();
 
-        return null;
+        return false;
     }
 
     /**
@@ -2649,9 +2700,6 @@
         protected abstract void op();
 
         protected void evaluate(final BinaryNode node) {
-            if (node.testResolved()) {
-                return;
-            }
             load(node.lhs());
             load(node.rhs());
             op();
@@ -2660,7 +2708,7 @@
     }
 
     @Override
-    public Node enterBIT_AND(final BinaryNode binaryNode) {
+    public boolean enterBIT_AND(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2668,11 +2716,11 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterBIT_OR(final BinaryNode binaryNode) {
+    public boolean enterBIT_OR(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2680,11 +2728,11 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterBIT_XOR(final BinaryNode binaryNode) {
+    public boolean enterBIT_XOR(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2692,14 +2740,10 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
-    private Node enterComma(final BinaryNode binaryNode) {
-        if (binaryNode.testResolved()) {
-            return null;
-        }
-
+    private boolean enterComma(final BinaryNode binaryNode) {
         final Node lhs = binaryNode.lhs();
         final Node rhs = binaryNode.rhs();
 
@@ -2707,21 +2751,21 @@
         load(rhs);
         method.store(binaryNode.getSymbol());
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterCOMMARIGHT(final BinaryNode binaryNode) {
+    public boolean enterCOMMARIGHT(final BinaryNode binaryNode) {
         return enterComma(binaryNode);
     }
 
     @Override
-    public Node enterCOMMALEFT(final BinaryNode binaryNode) {
+    public boolean enterCOMMALEFT(final BinaryNode binaryNode) {
         return enterComma(binaryNode);
     }
 
     @Override
-    public Node enterDIV(final BinaryNode binaryNode) {
+    public boolean enterDIV(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2729,10 +2773,10 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
-    private Node enterCmp(final Node lhs, final Node rhs, final Condition cond, final Type type, final Symbol symbol) {
+    private boolean enterCmp(final Node lhs, final Node rhs, final Condition cond, final Type type, final Symbol symbol) {
         final Type lhsType = lhs.getType();
         final Type rhsType = rhs.getType();
 
@@ -2758,48 +2802,45 @@
         method.convert(type);
         method.store(symbol);
 
-        return null;
+        return false;
     }
 
-    private Node enterCmp(final BinaryNode binaryNode, final Condition cond) {
-        if (binaryNode.testResolved()) {
-            return null;
-        }
+    private boolean enterCmp(final BinaryNode binaryNode, final Condition cond) {
         return enterCmp(binaryNode.lhs(), binaryNode.rhs(), cond, binaryNode.getType(), binaryNode.getSymbol());
     }
 
     @Override
-    public Node enterEQ(final BinaryNode binaryNode) {
+    public boolean enterEQ(final BinaryNode binaryNode) {
         return enterCmp(binaryNode, Condition.EQ);
     }
 
     @Override
-    public Node enterEQ_STRICT(final BinaryNode binaryNode) {
+    public boolean enterEQ_STRICT(final BinaryNode binaryNode) {
         return enterCmp(binaryNode, Condition.EQ);
     }
 
     @Override
-    public Node enterGE(final BinaryNode binaryNode) {
+    public boolean enterGE(final BinaryNode binaryNode) {
         return enterCmp(binaryNode, Condition.GE);
     }
 
     @Override
-    public Node enterGT(final BinaryNode binaryNode) {
+    public boolean enterGT(final BinaryNode binaryNode) {
         return enterCmp(binaryNode, Condition.GT);
     }
 
     @Override
-    public Node enterLE(final BinaryNode binaryNode) {
+    public boolean enterLE(final BinaryNode binaryNode) {
         return enterCmp(binaryNode, Condition.LE);
     }
 
     @Override
-    public Node enterLT(final BinaryNode binaryNode) {
+    public boolean enterLT(final BinaryNode binaryNode) {
         return enterCmp(binaryNode, Condition.LT);
     }
 
     @Override
-    public Node enterMOD(final BinaryNode binaryNode) {
+    public boolean enterMOD(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2807,11 +2848,11 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterMUL(final BinaryNode binaryNode) {
+    public boolean enterMUL(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2819,26 +2860,26 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterNE(final BinaryNode binaryNode) {
+    public boolean enterNE(final BinaryNode binaryNode) {
         return enterCmp(binaryNode, Condition.NE);
     }
 
     @Override
-    public Node enterNE_STRICT(final BinaryNode binaryNode) {
+    public boolean enterNE_STRICT(final BinaryNode binaryNode) {
         return enterCmp(binaryNode, Condition.NE);
     }
 
     @Override
-    public Node enterOR(final BinaryNode binaryNode) {
+    public boolean enterOR(final BinaryNode binaryNode) {
         return enterAND_OR(binaryNode);
     }
 
     @Override
-    public Node enterSAR(final BinaryNode binaryNode) {
+    public boolean enterSAR(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2846,11 +2887,11 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterSHL(final BinaryNode binaryNode) {
+    public boolean enterSHL(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2858,24 +2899,24 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterSHR(final BinaryNode binaryNode) {
+    public boolean enterSHR(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
                 method.shr();
-                method.convert(Type.LONG).load(0xffff_ffffL).and();
+                method.convert(Type.LONG).load(JSType.MAX_UINT).and();
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterSUB(final BinaryNode binaryNode) {
+    public boolean enterSUB(final BinaryNode binaryNode) {
         new BinaryArith() {
             @Override
             protected void op() {
@@ -2883,18 +2924,11 @@
             }
         }.evaluate(binaryNode);
 
-        return null;
+        return false;
     }
 
-    /*
-     * Ternary visits.
-     */
     @Override
-    public Node enterTernaryNode(final TernaryNode ternaryNode) {
-        if (ternaryNode.testResolved()) {
-            return null;
-        }
-
+    public boolean enterTernaryNode(final TernaryNode ternaryNode) {
         final Node lhs   = ternaryNode.lhs();
         final Node rhs   = ternaryNode.rhs();
         final Node third = ternaryNode.third();
@@ -2926,7 +2960,7 @@
         method.label(exitLabel);
         method.store(symbol);
 
-        return null;
+        return false;
     }
 
     /**
@@ -2955,7 +2989,7 @@
         if (scopeCalls.containsKey(scopeCall)) {
             return scopeCalls.get(scopeCall);
         }
-        scopeCall.setClassAndName(getCurrentCompileUnit(), getCurrentFunctionNode().uniqueName("scopeCall"));
+        scopeCall.setClassAndName(unit, getLexicalContext().getCurrentFunction().uniqueName("scopeCall"));
         scopeCalls.put(scopeCall, scopeCall);
         return scopeCall;
     }
@@ -2974,7 +3008,7 @@
         if (scopeCalls.containsKey(scopeCall)) {
             return scopeCalls.get(scopeCall);
         }
-        scopeCall.setClassAndName(getCurrentCompileUnit(), getCurrentFunctionNode().uniqueName("scopeCall"));
+        scopeCall.setClassAndName(unit, getLexicalContext().getCurrentFunction().uniqueName("scopeCall"));
         scopeCalls.put(scopeCall, scopeCall);
         return scopeCall;
     }
@@ -3037,9 +3071,6 @@
         /** The target node to store to, e.g. x */
         private final Node target;
 
-        /** Should the result always be discarded, no matter what? */
-        private final boolean alwaysDiscard;
-
         /** How deep on the stack do the arguments go if this generates an indy call */
         private int depth;
 
@@ -3055,7 +3086,6 @@
         protected Store(final T assignNode, final Node target) {
             this.assignNode = assignNode;
             this.target = target;
-            this.alwaysDiscard = assignNode == target;
         }
 
         /**
@@ -3077,21 +3107,21 @@
 
         private void prologue() {
             final Symbol targetSymbol = target.getSymbol();
-            final Symbol scopeSymbol  = getCurrentFunctionNode().getScopeNode().getSymbol();
+            final Symbol scopeSymbol  = getLexicalContext().getCurrentFunction().compilerConstant(SCOPE);
 
             /**
              * This loads the parts of the target, e.g base and index. they are kept
              * on the stack throughout the store and used at the end to execute it
              */
 
-            target.accept(new NodeVisitor(getCurrentCompileUnit(), method) {
+            target.accept(new NodeVisitor() {
                 @Override
-                public Node enterIdentNode(final IdentNode node) {
+                public boolean enterIdentNode(final IdentNode node) {
                     if (targetSymbol.isScope()) {
                         method.load(scopeSymbol);
                         depth++;
                     }
-                    return null;
+                    return false;
                 }
 
                 private void enterBaseNode() {
@@ -3109,13 +3139,13 @@
                 }
 
                 @Override
-                public Node enterAccessNode(final AccessNode node) {
+                public boolean enterAccessNode(final AccessNode node) {
                     enterBaseNode();
-                    return null;
+                    return false;
                 }
 
                 @Override
-                public Node enterIndexNode(final IndexNode node) {
+                public boolean enterIndexNode(final IndexNode node) {
                     enterBaseNode();
 
                     final Node index = node.getIndex();
@@ -3131,14 +3161,14 @@
                         method.dup(1);
                     }
 
-                    return null;
+                    return false;
                 }
 
             });
         }
 
         private Symbol quickSymbol(final Type type) {
-            return quickSymbol(type, QUICK_PREFIX.tag());
+            return quickSymbol(type, QUICK_PREFIX.symbolName());
         }
 
         /**
@@ -3151,22 +3181,28 @@
          * @return the quick symbol
          */
         private Symbol quickSymbol(final Type type, final String prefix) {
-            final String name = getCurrentFunctionNode().uniqueName(prefix);
-            final Symbol symbol = new Symbol(name, IS_TEMP | IS_INTERNAL, null, null);
+            final String name = getLexicalContext().getCurrentFunction().uniqueName(prefix);
+            final Symbol symbol = new Symbol(name, IS_TEMP | IS_INTERNAL);
 
             symbol.setType(type);
-            symbol.setSlot(getCurrentBlock().getFrame().getSlotCount());
+            final int quickSlot = nextFreeSlots[nextFreeSlotsSize - 1];
+            nextFreeSlots[nextFreeSlotsSize - 1] = quickSlot + symbol.slotCount();
+            symbol.setSlot(quickSlot);
 
             return symbol;
         }
 
         // store the result that "lives on" after the op, e.g. "i" in i++ postfix.
         protected void storeNonDiscard() {
-            if (assignNode.shouldDiscard() || alwaysDiscard) {
-                assignNode.setDiscard(false);
+            if (discard.peek() == assignNode) {
+                assert assignNode.isAssignment();
+                discard.pop();
                 return;
             }
 
+            //System.err.println("Store with out discard that shouldn't just return " + assignNode);
+            //new Throwable().printStackTrace();
+
             final Symbol symbol = assignNode.getSymbol();
             if (symbol.hasSlot()) {
                 method.dup().store(symbol);
@@ -3191,22 +3227,22 @@
              */
             method.convert(target.getType());
 
-            target.accept(new NodeVisitor(getCurrentCompileUnit(), method) {
+            target.accept(new NodeVisitor() {
                 @Override
-                protected Node enterDefault(Node node) {
+                protected boolean enterDefault(Node node) {
                     throw new AssertionError("Unexpected node " + node + " in store epilogue");
                 }
 
                 @Override
-                public Node enterUnaryNode(final UnaryNode node) {
-                    if(node.tokenType() == TokenType.CONVERT && node.getSymbol() != null) {
+                public boolean enterUnaryNode(final UnaryNode node) {
+                    if (node.tokenType() == TokenType.CONVERT && node.getSymbol() != null) {
                         method.convert(node.rhs().getType());
                     }
-                    return node;
+                    return true;
                 }
 
                 @Override
-                public Node enterIdentNode(final IdentNode node) {
+                public boolean enterIdentNode(final IdentNode node) {
                     final Symbol symbol = node.getSymbol();
                     assert symbol != null;
                     if (symbol.isScope()) {
@@ -3218,20 +3254,20 @@
                     } else {
                         method.store(symbol);
                     }
-                    return null;
+                    return false;
 
                 }
 
                 @Override
-                public Node enterAccessNode(final AccessNode node) {
+                public boolean enterAccessNode(final AccessNode node) {
                     method.dynamicSet(node.getProperty().getType(), node.getProperty().getName(), getCallSiteFlags());
-                    return null;
+                    return false;
                 }
 
                 @Override
-                public Node enterIndexNode(final IndexNode node) {
+                public boolean enterIndexNode(final IndexNode node) {
                     method.dynamicSetIndex(getCallSiteFlags());
-                    return null;
+                    return false;
                 }
             });
 
@@ -3250,10 +3286,23 @@
                 method.load(quick);
             }
         }
-
     }
 
-    private void newFunctionObject(final FunctionNode functionNode) {
+    private void newFunctionObject(final FunctionNode functionNode, final FunctionNode originalFunctionNode) {
+        final LexicalContext lc = getLexicalContext();
+        assert lc.peek() == functionNode;
+        // We don't emit a ScriptFunction on stack for:
+        // 1. the outermost compiled function (as there's no code being generated in its outer context that'd need it
+        //    as a callee), and
+        // 2. for functions that are immediately called upon definition and they don't need a callee, e.g. (function(){})().
+        //    Such immediately-called functions are invoked using INVOKESTATIC (see enterFunctionNode() of the embedded
+        //    visitor of enterCallNode() for details), and if they don't need a callee, they don't have it on their
+        //    static method's parameter list.
+        if(lc.getOutermostFunction() == functionNode ||
+                (!functionNode.needsCallee()) && lc.isFunctionDefinedInCurrentCall(originalFunctionNode)) {
+            return;
+        }
+
         final boolean isLazy  = functionNode.isLazy();
 
         new ObjectCreator(this, new ArrayList<String>(), new ArrayList<Symbol>(), false, false) {
@@ -3265,7 +3314,7 @@
                 loadConstant(new RecompilableScriptFunctionData(functionNode, compiler.getCodeInstaller(), Compiler.binaryName(getClassName()), makeMap()));
 
                 if (isLazy || functionNode.needsParentScope()) {
-                    m.loadScope();
+                    m.loadCompilerConstant(SCOPE);
                 } else {
                     m.loadNull();
                 }
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java	Wed May 08 10:10:05 2013 +0100
@@ -15,6 +15,7 @@
 import java.util.HashSet;
 import java.util.Set;
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.Block;
 import jdk.nashorn.internal.ir.CallNode;
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
@@ -29,8 +30,8 @@
 import jdk.nashorn.internal.runtime.Timing;
 
 /**
- * A compilation phase is a step in the processes of turning a JavaScript FunctionNode
- * into bytecode. It has an optional return value.
+ * A compilation phase is a step in the processes of turning a JavaScript
+ * FunctionNode into bytecode. It has an optional return value.
  */
 enum CompilationPhase {
 
@@ -41,77 +42,87 @@
      */
     LAZY_INITIALIZATION_PHASE(EnumSet.of(INITIALIZED, PARSED)) {
         @Override
-        void transform(final Compiler compiler, final FunctionNode fn) {
+        FunctionNode transform(final Compiler compiler, final FunctionNode fn0) {
 
             /*
-             * For lazy compilation, we might be given a node previously marked as lazy
-             * to compile as the outermost function node in the compiler. Unmark it
-             * so it can be compiled and not cause recursion. Make sure the return type
-             * is unknown so it can be correctly deduced. Return types are always
-             * Objects in Lazy nodes as we haven't got a change to generate code for
-             * them and decude its parameter specialization
+             * For lazy compilation, we might be given a node previously marked
+             * as lazy to compile as the outermost function node in the
+             * compiler. Unmark it so it can be compiled and not cause
+             * recursion. Make sure the return type is unknown so it can be
+             * correctly deduced. Return types are always Objects in Lazy nodes
+             * as we haven't got a change to generate code for them and decude
+             * its parameter specialization
              *
-             * TODO: in the future specializations from a callsite will be passed here
-             * so we can generate a better non-lazy version of a function from a trampoline
+             * TODO: in the future specializations from a callsite will be
+             * passed here so we can generate a better non-lazy version of a
+             * function from a trampoline
              */
-            //compute the signature from the callsite - todo - now just clone object params
+
             final FunctionNode outermostFunctionNode = compiler.getFunctionNode();
-            outermostFunctionNode.setIsLazy(false);
-            outermostFunctionNode.setReturnType(Type.UNKNOWN);
+            assert outermostFunctionNode == fn0;
 
             final Set<FunctionNode> neverLazy = new HashSet<>();
-            final Set<FunctionNode> lazy = new HashSet<>();
+            final Set<FunctionNode> lazy      = new HashSet<>();
+
+            FunctionNode newFunctionNode = outermostFunctionNode;
 
-            outermostFunctionNode.accept(new NodeVisitor() {
-                // self references are done with invokestatic and thus cannot have trampolines - never lazy
+            newFunctionNode = (FunctionNode)newFunctionNode.accept(new NodeVisitor() {
+                // self references are done with invokestatic and thus cannot
+                // have trampolines - never lazy
                 @Override
-                public Node enterCallNode(final CallNode node) {
+                public boolean enterCallNode(final CallNode node) {
                     final Node callee = node.getFunction();
                     if (callee instanceof FunctionNode) {
                         neverLazy.add(((FunctionNode)callee));
-                        return null;
+                        return false;
                     }
-                    return node;
+                    return true;
                 }
 
+                //any function that isn't the outermost one must be marked as lazy
                 @Override
-                public Node enterFunctionNode(final FunctionNode node) {
-                    if (node == outermostFunctionNode) {
-                        return node;
-                    }
+                public boolean enterFunctionNode(final FunctionNode node) {
                     assert compiler.isLazy();
                     lazy.add(node);
-
-                    //also needs scope, potentially needs arguments etc etc
-
-                    return node;
+                    return true;
                 }
             });
 
+            //at least one method is non lazy - the outermost one
+            neverLazy.add(newFunctionNode);
+
             for (final FunctionNode node : neverLazy) {
-                Compiler.LOG.fine("Marking " + node.getName() + " as non lazy, as it's a self reference");
-                node.setIsLazy(false);
+                Compiler.LOG.fine(
+                        "Marking ",
+                        node.getName(),
+                        " as non lazy, as it's a self reference");
                 lazy.remove(node);
             }
 
-            outermostFunctionNode.accept(new NodeOperatorVisitor() {
-                private final LexicalContext lexicalContext = new LexicalContext();
+            newFunctionNode = (FunctionNode)newFunctionNode.accept(new NodeOperatorVisitor() {
                 @Override
-                public Node enterFunctionNode(FunctionNode functionNode) {
-                    lexicalContext.push(functionNode);
-                    if(lazy.contains(functionNode)) {
-                        Compiler.LOG.fine("Marking " + functionNode.getName() + " as lazy");
-                        functionNode.setIsLazy(true);
-                        lexicalContext.getParentFunction(functionNode).setHasLazyChildren();
+                public Node leaveFunctionNode(final FunctionNode functionNode) {
+                    final LexicalContext lc = getLexicalContext();
+                    if (lazy.contains(functionNode)) {
+                        Compiler.LOG.fine(
+                                "Marking ",
+                                functionNode.getName(),
+                                " as lazy");
+                        final FunctionNode parent = lc.getParentFunction(functionNode);
+                        assert parent != null;
+                        lc.setFlag(parent, FunctionNode.HAS_LAZY_CHILDREN);
+                        lc.setFlag(parent.getBody(), Block.NEEDS_SCOPE);
+                        lc.setFlag(functionNode, FunctionNode.IS_LAZY);
+                        return functionNode;
                     }
-                    return functionNode;
-                }
-                @Override
-                public Node leaveFunctionNode(FunctionNode functionNode) {
-                    lexicalContext.pop(functionNode);
-                    return functionNode;
+
+                    return functionNode.
+                        clearFlag(lc, FunctionNode.IS_LAZY).
+                        setReturnType(lc, Type.UNKNOWN);
                 }
             });
+
+            return newFunctionNode;
         }
 
         @Override
@@ -121,13 +132,13 @@
     },
 
     /*
-     * Constant folding pass
-     *   Simple constant folding that will make elementary constructs go away
+     * Constant folding pass Simple constant folding that will make elementary
+     * constructs go away
      */
     CONSTANT_FOLDING_PHASE(EnumSet.of(INITIALIZED, PARSED)) {
         @Override
-        void transform(final Compiler compiler, final FunctionNode fn) {
-            fn.accept(new FoldConstants());
+        FunctionNode transform(final Compiler compiler, final FunctionNode fn) {
+            return (FunctionNode)fn.accept(new FoldConstants());
         }
 
         @Override
@@ -137,18 +148,16 @@
     },
 
     /*
-     * Lower (Control flow pass)
-     *   Finalizes the control flow. Clones blocks for finally constructs and
-     *   similar things. Establishes termination criteria for nodes
-     *   Guarantee return instructions to method making sure control flow
-     *   cannot fall off the end. Replacing high level nodes with lower such
-     *   as runtime nodes where applicable.
-     *
+     * Lower (Control flow pass) Finalizes the control flow. Clones blocks for
+     * finally constructs and similar things. Establishes termination criteria
+     * for nodes Guarantee return instructions to method making sure control
+     * flow cannot fall off the end. Replacing high level nodes with lower such
+     * as runtime nodes where applicable.
      */
     LOWERING_PHASE(EnumSet.of(INITIALIZED, PARSED, CONSTANT_FOLDED)) {
         @Override
-        void transform(final Compiler compiler, final FunctionNode fn) {
-            fn.accept(new Lower());
+        FunctionNode transform(final Compiler compiler, final FunctionNode fn) {
+            return (FunctionNode)fn.accept(new Lower());
         }
 
         @Override
@@ -158,13 +167,27 @@
     },
 
     /*
-     * Attribution
-     *   Assign symbols and types to all nodes.
+     * Attribution Assign symbols and types to all nodes.
      */
     ATTRIBUTION_PHASE(EnumSet.of(INITIALIZED, PARSED, CONSTANT_FOLDED, LOWERED)) {
         @Override
-        void transform(final Compiler compiler, final FunctionNode fn) {
-            fn.accept(new Attr());
+        FunctionNode transform(final Compiler compiler, final FunctionNode fn) {
+            return (FunctionNode)initReturnTypes(fn).accept(new Attr());
+        }
+
+        /**
+         * Pessimistically set all lazy functions' return types to Object
+         * @param functionNode node where to start iterating
+         */
+        private FunctionNode initReturnTypes(final FunctionNode functionNode) {
+            return (FunctionNode)functionNode.accept(new NodeVisitor() {
+                @Override
+                public Node leaveFunctionNode(final FunctionNode node) {
+                    return node.isLazy() ?
+                           node.setReturnType(getLexicalContext(), Type.OBJECT) :
+                           node.setReturnType(getLexicalContext(), Type.UNKNOWN);
+                }
+            });
         }
 
         @Override
@@ -174,25 +197,35 @@
     },
 
     /*
-     * Splitter
-     *   Split the AST into several compile units based on a size heuristic
-     *   Splitter needs attributed AST for weight calculations (e.g. is
-     *   a + b a ScriptRuntime.ADD with call overhead or a dadd with much
-     *   less). Split IR can lead to scope information being changed.
+     * Splitter Split the AST into several compile units based on a size
+     * heuristic Splitter needs attributed AST for weight calculations (e.g. is
+     * a + b a ScriptRuntime.ADD with call overhead or a dadd with much less).
+     * Split IR can lead to scope information being changed.
      */
     SPLITTING_PHASE(EnumSet.of(INITIALIZED, PARSED, CONSTANT_FOLDED, LOWERED, ATTR)) {
         @Override
-        void transform(final Compiler compiler, final FunctionNode fn) {
+        FunctionNode transform(final Compiler compiler, final FunctionNode fn) {
             final CompileUnit outermostCompileUnit = compiler.addCompileUnit(compiler.firstCompileUnitName());
 
-            new Splitter(compiler, fn, outermostCompileUnit).split();
+            final FunctionNode newFunctionNode = new Splitter(compiler, fn, outermostCompileUnit).split(fn);
 
-            assert fn.getCompileUnit() == outermostCompileUnit : "fn.compileUnit (" + fn.getCompileUnit() + ") != " + outermostCompileUnit;
+            assert newFunctionNode.getCompileUnit() == outermostCompileUnit : "fn.compileUnit (" + newFunctionNode.getCompileUnit() + ") != " + outermostCompileUnit;
 
-            if (fn.isStrictMode()) {
+            if (newFunctionNode.isStrict()) {
                 assert compiler.getStrictMode();
                 compiler.setStrictMode(true);
             }
+
+            /*
+            newFunctionNode.accept(new NodeVisitor() {
+                @Override
+                public boolean enterFunctionNode(final FunctionNode functionNode) {
+                    assert functionNode.getCompileUnit() != null : functionNode.getName() + " " + Debug.id(functionNode) + " has no compile unit";
+                    return true;
+                }
+            });*/
+
+            return newFunctionNode;
         }
 
         @Override
@@ -204,30 +237,32 @@
     /*
      * FinalizeTypes
      *
-     *   This pass finalizes the types for nodes. If Attr created wider types than
-     *   known during the first pass, convert nodes are inserted or access nodes
-     *   are specialized where scope accesses.
+     * This pass finalizes the types for nodes. If Attr created wider types than
+     * known during the first pass, convert nodes are inserted or access nodes
+     * are specialized where scope accesses.
      *
-     *   Runtime nodes may be removed and primitivized or reintroduced depending
-     *   on information that was established in Attr.
+     * Runtime nodes may be removed and primitivized or reintroduced depending
+     * on information that was established in Attr.
      *
      * Contract: all variables must have slot assignments and scope assignments
      * before type finalization.
      */
     TYPE_FINALIZATION_PHASE(EnumSet.of(INITIALIZED, PARSED, CONSTANT_FOLDED, LOWERED, ATTR, SPLIT)) {
         @Override
-        void transform(final Compiler compiler, final FunctionNode fn) {
+        FunctionNode transform(final Compiler compiler, final FunctionNode fn) {
             final ScriptEnvironment env = compiler.getEnv();
 
-            fn.accept(new FinalizeTypes());
+            final FunctionNode newFunctionNode = (FunctionNode)fn.accept(new FinalizeTypes());
 
             if (env._print_lower_ast) {
-                env.getErr().println(new ASTWriter(fn));
+                env.getErr().println(new ASTWriter(newFunctionNode));
             }
 
             if (env._print_lower_parse) {
-                env.getErr().println(new PrintVisitor(fn));
-           }
+                env.getErr().println(new PrintVisitor(newFunctionNode));
+            }
+
+            return newFunctionNode;
         }
 
         @Override
@@ -239,31 +274,21 @@
     /*
      * Bytecode generation:
      *
-     *   Generate the byte code class(es) resulting from the compiled FunctionNode
+     * Generate the byte code class(es) resulting from the compiled FunctionNode
      */
     BYTECODE_GENERATION_PHASE(EnumSet.of(INITIALIZED, PARSED, CONSTANT_FOLDED, LOWERED, ATTR, SPLIT, FINALIZED)) {
         @Override
-        void transform(final Compiler compiler, final FunctionNode fn) {
+        FunctionNode transform(final Compiler compiler, final FunctionNode fn) {
             final ScriptEnvironment env = compiler.getEnv();
+            FunctionNode newFunctionNode = fn;
 
             try {
                 final CodeGenerator codegen = new CodeGenerator(compiler);
-                fn.accept(codegen);
+                newFunctionNode = (FunctionNode)newFunctionNode.accept(codegen);
                 codegen.generateScopeCalls();
-                fn.accept(new NodeOperatorVisitor() {
-                    @Override
-                    public Node enterFunctionNode(FunctionNode functionNode) {
-                        if(functionNode.isLazy()) {
-                            functionNode.resetResolved();
-                            return null;
-                        }
-                        return fn;
-                    }
-                });
-
             } catch (final VerifyError e) {
                 if (env._verify_code || env._print_code) {
-                    env.getErr().println(e.getClass().getSimpleName() + ": " + e.getMessage());
+                    env.getErr().println(e.getClass().getSimpleName() + ": "  + e.getMessage());
                     if (env._dump_on_error) {
                         e.printStackTrace(env.getErr());
                     }
@@ -283,25 +308,25 @@
 
                 compiler.addClass(className, bytecode);
 
-                //should could be printed to stderr for generate class?
+                // should could be printed to stderr for generate class?
                 if (env._print_code) {
                     final StringBuilder sb = new StringBuilder();
-                    sb.append("class: " + className).
-                        append('\n').
-                        append(ClassEmitter.disassemble(bytecode)).
-                        append("=====");
+                    sb.append("class: " + className).append('\n')
+                            .append(ClassEmitter.disassemble(bytecode))
+                            .append("=====");
                     env.getErr().println(sb);
                 }
 
-                //should we verify the generated code?
+                // should we verify the generated code?
                 if (env._verify_code) {
                     compiler.getCodeInstaller().verify(bytecode);
                 }
 
-                //should code be dumped to disk - only valid in compile_only mode?
+                // should code be dumped to disk - only valid in compile_only
+                // mode?
                 if (env._dest_dir != null && env._compile_only) {
                     final String fileName = className.replace('.', File.separatorChar) + ".class";
-                    final int    index    = fileName.lastIndexOf(File.separatorChar);
+                    final int index = fileName.lastIndexOf(File.separatorChar);
 
                     if (index != -1) {
                         final File dir = new File(fileName.substring(0, index));
@@ -314,11 +339,18 @@
                                 fos.write(bytecode);
                             }
                         } catch (final IOException e) {
-                            Compiler.LOG.warning("Skipping class dump for " + className + ": " + ECMAErrors.getMessage("io.error.cant.write", dir.toString()));
+                            Compiler.LOG.warning("Skipping class dump for ",
+                                    className,
+                                    ": ",
+                                    ECMAErrors.getMessage(
+                                        "io.error.cant.write",
+                                        dir.toString()));
                         }
                     }
                 }
             }
+
+            return newFunctionNode;
         }
 
         @Override
@@ -340,26 +372,28 @@
         return functionNode.hasState(pre);
     }
 
-    protected void begin(final FunctionNode functionNode) {
+    protected FunctionNode begin(final FunctionNode functionNode) {
         if (pre != null) {
-            //check that everything in pre is present
+            // check that everything in pre is present
             for (final CompilationState state : pre) {
                 assert functionNode.hasState(state);
             }
-            //check that nothing else is present
+            // check that nothing else is present
             for (final CompilationState state : CompilationState.values()) {
                 assert !(functionNode.hasState(state) && !pre.contains(state));
             }
         }
 
         startTime = System.currentTimeMillis();
+        return functionNode;
     }
 
-    protected void end(final FunctionNode functionNode) {
+    protected FunctionNode end(final FunctionNode functionNode) {
         endTime = System.currentTimeMillis();
         Timing.accumulateTime(toString(), endTime - startTime);
 
         isFinished = true;
+        return functionNode;
     }
 
     boolean isFinished() {
@@ -374,15 +408,13 @@
         return endTime;
     }
 
-    abstract void transform(final Compiler compiler, final FunctionNode functionNode) throws CompilationException;
+    abstract FunctionNode transform(final Compiler compiler, final FunctionNode functionNode) throws CompilationException;
 
-    final void apply(final Compiler compiler, final FunctionNode functionNode) throws CompilationException {
+    final FunctionNode apply(final Compiler compiler, final FunctionNode functionNode) throws CompilationException {
         if (!isApplicable(functionNode)) {
-            throw new CompilationException("compile phase not applicable: " + this);
+            throw new CompilationException("compile phase not applicable: " + this + " to " + functionNode.getName() + " state=" + functionNode.getState());
         }
-        begin(functionNode);
-        transform(compiler, functionNode);
-        end(functionNode);
+        return end(transform(compiler, begin(functionNode)));
     }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java	Wed May 08 10:10:05 2013 +0100
@@ -25,12 +25,16 @@
 
 package jdk.nashorn.internal.codegen;
 
+import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS;
+import static jdk.nashorn.internal.codegen.CompilerConstants.CALLEE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.CONSTANTS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.DEFAULT_SCRIPT_NAME;
 import static jdk.nashorn.internal.codegen.CompilerConstants.LAZY;
+import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
 import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.SOURCE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.THIS;
+import static jdk.nashorn.internal.codegen.CompilerConstants.VARARGS;
 
 import java.io.File;
 import java.lang.reflect.Field;
@@ -46,13 +50,12 @@
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.logging.Level;
+
 import jdk.internal.dynalink.support.NameCodec;
 import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
-import jdk.nashorn.internal.ir.Node;
-import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.CodeInstaller;
 import jdk.nashorn.internal.runtime.DebugLogger;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
@@ -80,8 +83,6 @@
 
     private final ConstantData constantData;
 
-    private final FunctionNode functionNode;
-
     private final CompilationSequence sequence;
 
     private final ScriptEnvironment env;
@@ -90,6 +91,8 @@
 
     private boolean strict;
 
+    private FunctionNode functionNode;
+
     private CodeInstaller<ScriptEnvironment> installer;
 
     /** logger for compiler, trampolines, splits and related code generation events
@@ -103,8 +106,12 @@
      * during a compile.
      */
     private static String[] RESERVED_NAMES = {
-        SCOPE.tag(),
-        THIS.tag()
+        SCOPE.symbolName(),
+        THIS.symbolName(),
+        RETURN.symbolName(),
+        CALLEE.symbolName(),
+        VARARGS.symbolName(),
+        ARGUMENTS.symbolName()
     };
 
     /**
@@ -186,7 +193,7 @@
 
     private static String lazyTag(final FunctionNode functionNode) {
         if (functionNode.isLazy()) {
-            return '$' + LAZY.tag() + '$' + functionNode.getName();
+            return '$' + LAZY.symbolName() + '$' + functionNode.getName();
         }
         return "";
     }
@@ -205,13 +212,13 @@
         this.functionNode  = functionNode;
         this.sequence      = sequence;
         this.installer     = installer;
-        this.strict        = strict || functionNode.isStrictMode();
+        this.strict        = strict || functionNode.isStrict();
         this.constantData  = new ConstantData();
         this.compileUnits  = new HashSet<>();
         this.bytecode      = new HashMap<>();
 
         final StringBuilder sb = new StringBuilder();
-        sb.append(functionNode.uniqueName(DEFAULT_SCRIPT_NAME.tag() + lazyTag(functionNode))).
+        sb.append(functionNode.uniqueName(DEFAULT_SCRIPT_NAME.symbolName() + lazyTag(functionNode))).
                 append('$').
                 append(safeSourceName(functionNode.getSource()));
 
@@ -253,9 +260,9 @@
      * Execute the compilation this Compiler was created with
      * @params param types if known, for specialization
      * @throws CompilationException if something goes wrong
-     * @return this compiler, for possible chaining
+     * @return function node that results from code transforms
      */
-    public Compiler compile() throws CompilationException {
+    public FunctionNode compile() throws CompilationException {
         return compile(null);
     }
 
@@ -263,9 +270,9 @@
      * Execute the compilation this Compiler was created with
      * @param paramTypes param types if known, for specialization
      * @throws CompilationException if something goes wrong
-     * @return this compiler, for possible chaining
+     * @return function node that results from code transforms
      */
-    public Compiler compile(final Class<?> paramTypes) throws CompilationException {
+    public FunctionNode compile(final Class<?> paramTypes) throws CompilationException {
         for (final String reservedName : RESERVED_NAMES) {
             functionNode.uniqueName(reservedName);
         }
@@ -276,7 +283,7 @@
         long time = 0L;
 
         for (final CompilationPhase phase : sequence) {
-            phase.apply(this, functionNode);
+            this.functionNode = phase.apply(this, functionNode);
 
             final long duration = Timing.isEnabled() ? (phase.getEndTime() - phase.getStartTime()) : 0L;
             time += duration;
@@ -295,7 +302,7 @@
                         append(" ms ");
                 }
 
-                LOG.fine(sb.toString());
+                LOG.fine(sb);
             }
         }
 
@@ -311,14 +318,14 @@
                     append(" ms");
             }
 
-            LOG.info(sb.toString());
+            LOG.info(sb);
         }
 
-        return this;
+        return functionNode;
     }
 
     private Class<?> install(final String className, final byte[] code) {
-        LOG.fine("Installing class " + className);
+        LOG.fine("Installing class ", className);
 
         final Class<?> clazz = installer.install(Compiler.binaryName(className), code);
 
@@ -330,8 +337,8 @@
                 @Override
                 public Void run() throws Exception {
                     //use reflection to write source and constants table to installed classes
-                    final Field sourceField    = clazz.getDeclaredField(SOURCE.tag());
-                    final Field constantsField = clazz.getDeclaredField(CONSTANTS.tag());
+                    final Field sourceField    = clazz.getDeclaredField(SOURCE.symbolName());
+                    final Field constantsField = clazz.getDeclaredField(CONSTANTS.symbolName());
                     sourceField.setAccessible(true);
                     constantsField.setAccessible(true);
                     sourceField.set(null, source);
@@ -380,17 +387,6 @@
             unit.setCode(installedClasses.get(unit.getUnitClassName()));
         }
 
-        functionNode.accept(new NodeVisitor() {
-            @Override
-            public Node enterFunctionNode(final FunctionNode node) {
-                if (node.isLazy()) {
-                    return null;
-                }
-                node.setState(CompilationState.INSTALLED);
-                return node;
-            }
-        });
-
         final StringBuilder sb;
         if (LOG.isEnabled()) {
             sb = new StringBuilder();
@@ -416,7 +412,7 @@
         }
 
         if (sb != null) {
-            LOG.info(sb.toString());
+            LOG.info(sb);
         }
 
         return rootClass;
@@ -495,7 +491,7 @@
     private CompileUnit addCompileUnit(final String unitClassName, final long initialWeight) {
         final CompileUnit compileUnit = initCompileUnit(unitClassName, initialWeight);
         compileUnits.add(compileUnit);
-        LOG.fine("Added compile unit " + compileUnit);
+        LOG.fine("Added compile unit ", compileUnit);
         return compileUnit;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java	Wed May 08 10:10:05 2013 +0100
@@ -52,9 +52,6 @@
     /** lazy prefix for classes of jitted methods */
     LAZY("Lazy"),
 
-    /** leaf tag used for functions that require no scope */
-    LEAF("__leaf__"),
-
     /** constructor name */
     INIT("<init>"),
 
@@ -90,55 +87,55 @@
     THIS("this"),
 
     /** this debugger symbol */
-    THIS_DEBUGGER("__this__"),
+    THIS_DEBUGGER(":this"),
 
     /** scope name, type and slot */
-    SCOPE("__scope__", ScriptObject.class, 2),
+    SCOPE(":scope", ScriptObject.class, 2),
 
     /** the return value variable name were intermediate results are stored for scripts */
-    SCRIPT_RETURN("__return__"),
+    RETURN(":return"),
 
     /** the callee value variable when necessary */
-    CALLEE("__callee__", ScriptFunction.class),
+    CALLEE(":callee", ScriptFunction.class),
 
     /** the varargs variable when necessary */
-    VARARGS("__varargs__"),
+    VARARGS(":varargs"),
 
     /** the arguments vector when necessary and the slot */
     ARGUMENTS("arguments", Object.class, 2),
 
     /** prefix for iterators for for (x in ...) */
-    ITERATOR_PREFIX("$iter"),
+    ITERATOR_PREFIX(":iter"),
 
     /** prefix for tag variable used for switch evaluation */
-    SWITCH_TAG_PREFIX("$tag"),
+    SWITCH_TAG_PREFIX(":tag"),
 
     /** prefix for all exceptions */
-    EXCEPTION_PREFIX("$exception"),
+    EXCEPTION_PREFIX(":exception"),
 
     /** prefix for quick slots generated in Store */
-    QUICK_PREFIX("$quick"),
+    QUICK_PREFIX(":quick"),
 
     /** prefix for temporary variables */
-    TEMP_PREFIX("$temp"),
+    TEMP_PREFIX(":temp"),
 
     /** prefix for literals */
-    LITERAL_PREFIX("$lit"),
-
-    /** prefix for map */
-    MAP("$map", 1),
+    LITERAL_PREFIX(":lit"),
 
     /** prefix for regexps */
-    REGEX_PREFIX("$regex"),
+    REGEX_PREFIX(":regex"),
 
     /** "this" used in non-static Java methods; always in slot 0 */
-    JAVA_THIS("this", 0),
+    JAVA_THIS(null, 0),
+
+    /** Map parameter in scope object constructors; always in slot 1 */
+    INIT_MAP(null, 1),
 
-    /** init scope */
-    INIT_SCOPE("$scope", 2),
+    /** Parent scope parameter in scope object constructors; always in slot 2 */
+    INIT_SCOPE(null, 2),
 
-    /** init arguments */
-    INIT_ARGUMENTS("$arguments", 3),
+    /** Arguments parameter in scope object constructors; in slot 3 when present */
+    INIT_ARGUMENTS(null, 3),
 
     /** prefix for all ScriptObject subclasses with fields, @see ObjectGenerator */
     JS_OBJECT_PREFIX("JO"),
@@ -167,30 +164,30 @@
     /** get array suffix */
     GET_ARRAY_SUFFIX("$array");
 
-    private final String tag;
+    private final String symbolName;
     private final Class<?> type;
     private final int slot;
 
     private CompilerConstants() {
-        this.tag = name();
+        this.symbolName = name();
         this.type = null;
         this.slot = -1;
     }
 
-    private CompilerConstants(final String tag) {
-        this(tag, -1);
+    private CompilerConstants(final String symbolName) {
+        this(symbolName, -1);
     }
 
-    private CompilerConstants(final String tag, final int slot) {
-        this(tag, null, slot);
+    private CompilerConstants(final String symbolName, final int slot) {
+        this(symbolName, null, slot);
     }
 
-    private CompilerConstants(final String tag, final Class<?> type) {
-        this(tag, type, -1);
+    private CompilerConstants(final String symbolName, final Class<?> type) {
+        this(symbolName, type, -1);
     }
 
-    private CompilerConstants(final String tag, final Class<?> type, final int slot) {
-        this.tag  = tag;
+    private CompilerConstants(final String symbolName, final Class<?> type, final int slot) {
+        this.symbolName  = symbolName;
         this.type = type;
         this.slot = slot;
     }
@@ -202,8 +199,8 @@
      *
      * @return the tag
      */
-    public final String tag() {
-        return tag;
+    public final String symbolName() {
+        return symbolName;
     }
 
     /**
@@ -277,7 +274,7 @@
      * @return Call representing void constructor for type
      */
     public static Call constructorNoLookup(final Class<?> clazz) {
-        return specialCallNoLookup(clazz, INIT.tag(), void.class);
+        return specialCallNoLookup(clazz, INIT.symbolName(), void.class);
     }
 
     /**
@@ -290,7 +287,7 @@
      * @return Call representing constructor for type
      */
     public static Call constructorNoLookup(final String className, final Class<?>... ptypes) {
-        return specialCallNoLookup(className, INIT.tag(), methodDescriptor(void.class, ptypes));
+        return specialCallNoLookup(className, INIT.symbolName(), methodDescriptor(void.class, ptypes));
     }
 
     /**
@@ -303,7 +300,7 @@
      * @return Call representing constructor for type
      */
     public static Call constructorNoLookup(final Class<?> clazz, final Class<?>... ptypes) {
-        return specialCallNoLookup(clazz, INIT.tag(), void.class, ptypes);
+        return specialCallNoLookup(clazz, INIT.symbolName(), void.class, ptypes);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FieldObjectCreator.java	Wed May 08 10:10:05 2013 +0100
@@ -26,6 +26,7 @@
 package jdk.nashorn.internal.codegen;
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS;
+import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup;
 import static jdk.nashorn.internal.codegen.CompilerConstants.typeDescriptor;
 import static jdk.nashorn.internal.codegen.types.Type.OBJECT;
@@ -86,7 +87,7 @@
      * @param method the method emitter to use
      */
     protected void loadScope(final MethodEmitter method) {
-        method.loadScope();
+        method.loadCompilerConstant(SCOPE);
     }
 
     /**
@@ -105,7 +106,7 @@
             loadScope(method);
 
             if (hasArguments()) {
-                method.loadArguments();
+                method.loadCompilerConstant(ARGUMENTS);
                 method.invoke(constructorNoLookup(getClassName(), PropertyMap.class, ScriptObject.class, ARGUMENTS.type()));
             } else {
                 method.invoke(constructorNoLookup(getClassName(), PropertyMap.class, ScriptObject.class));
--- a/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java	Wed May 08 10:10:05 2013 +0100
@@ -25,7 +25,12 @@
 
 package jdk.nashorn.internal.codegen;
 
+import static jdk.nashorn.internal.codegen.CompilerConstants.CALLEE;
+import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
+
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.AccessNode;
@@ -33,10 +38,8 @@
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
 import jdk.nashorn.internal.ir.CallNode;
-import jdk.nashorn.internal.ir.CallNode.EvalArgs;
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
 import jdk.nashorn.internal.ir.ExecuteNode;
 import jdk.nashorn.internal.ir.ForNode;
 import jdk.nashorn.internal.ir.FunctionNode;
@@ -85,18 +88,11 @@
 
     private static final DebugLogger LOG = new DebugLogger("finalize");
 
-    private final LexicalContext lexicalContext = new LexicalContext();
-
     FinalizeTypes() {
     }
 
     @Override
     public Node leaveCallNode(final CallNode callNode) {
-        final EvalArgs evalArgs = callNode.getEvalArgs();
-        if (evalArgs != null) {
-            evalArgs.setCode(evalArgs.getCode().accept(this));
-        }
-
         // AccessSpecializer - call return type may change the access for this location
         final Node function = callNode.getFunction();
         if (function instanceof FunctionNode) {
@@ -133,8 +129,7 @@
     @Override
     public Node leaveNEW(final UnaryNode unaryNode) {
         assert unaryNode.getSymbol() != null && unaryNode.getSymbol().getSymbolType().isObject();
-        ((CallNode)unaryNode.rhs()).setIsNew();
-        return unaryNode;
+        return unaryNode.setRHS(((CallNode)unaryNode.rhs()).setIsNew());
     }
 
     @Override
@@ -254,7 +249,7 @@
     @Override
     public Node leaveCOMMALEFT(final BinaryNode binaryNode) {
         assert binaryNode.getSymbol() != null;
-        final BinaryNode newBinaryNode = (BinaryNode)binaryNode.setRHS(discard(binaryNode.rhs()));
+        final BinaryNode newBinaryNode = binaryNode.setRHS(discard(binaryNode.rhs()));
         // AccessSpecializer - the type of lhs, which is the remaining value of this node may have changed
         // in that case, update the node type as well
         propagateType(newBinaryNode, newBinaryNode.lhs().getType());
@@ -354,41 +349,30 @@
     }
 
     @Override
-    public Node enterBlock(final Block block) {
-        lexicalContext.push(block);
+    public boolean enterBlock(final Block block) {
         updateSymbols(block);
-        return block;
+        return true;
     }
 
+    /*
     @Override
-    public Node leaveBlock(Block block) {
-        lexicalContext.pop(block);
-        return super.leaveBlock(block);
-    }
+    public Node leaveBlock(final Block block) {
+        final LexicalContext lc = getLexicalContext();
+        return block;//.setFlag(lc, lc.getFlags(block));
+    }*/
 
     @Override
     public Node leaveCatchNode(final CatchNode catchNode) {
         final Node exceptionCondition = catchNode.getExceptionCondition();
         if (exceptionCondition != null) {
-            catchNode.setExceptionCondition(convert(exceptionCondition, Type.BOOLEAN));
+            return catchNode.setExceptionCondition(convert(exceptionCondition, Type.BOOLEAN));
         }
         return catchNode;
     }
 
     @Override
-    public Node enterDoWhileNode(final DoWhileNode doWhileNode) {
-        return enterWhileNode(doWhileNode);
-    }
-
-    @Override
-    public Node leaveDoWhileNode(final DoWhileNode doWhileNode) {
-        return leaveWhileNode(doWhileNode);
-    }
-
-    @Override
     public Node leaveExecuteNode(final ExecuteNode executeNode) {
-        executeNode.setExpression(discard(executeNode.getExpression()));
-        return executeNode;
+        return executeNode.setExpression(discard(executeNode.getExpression()));
     }
 
     @Override
@@ -397,69 +381,54 @@
         final Node test   = forNode.getTest();
         final Node modify = forNode.getModify();
 
-        if (forNode.isForIn()) {
-            forNode.setModify(convert(forNode.getModify(), Type.OBJECT)); // NASHORN-400
-            return forNode;
-        }
-
-        if (init != null) {
-            forNode.setInit(discard(init));
-        }
+        final LexicalContext lc = getLexicalContext();
 
-        if (test != null) {
-            forNode.setTest(convert(test, Type.BOOLEAN));
-        } else {
-            assert forNode.hasGoto() : "forNode " + forNode + " needs goto and is missing it in " + getCurrentFunctionNode();
+        if (forNode.isForIn()) {
+            return forNode.setModify(lc, convert(forNode.getModify(), Type.OBJECT)); // NASHORN-400
         }
+        assert test != null || forNode.hasGoto() : "forNode " + forNode + " needs goto and is missing it in " + getLexicalContext().getCurrentFunction();
 
-        if (modify != null) {
-            forNode.setModify(discard(modify));
-        }
-
-        return forNode;
+        return forNode.
+            setInit(lc, init == null ? null : discard(init)).
+            setTest(lc, test == null ? null : convert(test, Type.BOOLEAN)).
+            setModify(lc, modify == null ? null : discard(modify));
     }
 
     @Override
-    public Node enterFunctionNode(final FunctionNode functionNode) {
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
         if (functionNode.isLazy()) {
-            return null;
+            return false;
         }
 
-        lexicalContext.push(functionNode);
         // If the function doesn't need a callee, we ensure its __callee__ symbol doesn't get a slot. We can't do
         // this earlier, as access to scoped variables, self symbol, etc. in previous phases can all trigger the
         // need for the callee.
         if (!functionNode.needsCallee()) {
-            functionNode.getCalleeNode().getSymbol().setNeedsSlot(false);
+            functionNode.compilerConstant(CALLEE).setNeedsSlot(false);
         }
         // Similar reasoning applies to __scope__ symbol: if the function doesn't need either parent scope or its
         // own scope, we ensure it doesn't get a slot, but we can't determine whether it needs a scope earlier than
         // this phase.
-        if (!(functionNode.needsScope() || functionNode.needsParentScope())) {
-            functionNode.getScopeNode().getSymbol().setNeedsSlot(false);
+        if (!(functionNode.getBody().needsScope() || functionNode.needsParentScope())) {
+            functionNode.compilerConstant(SCOPE).setNeedsSlot(false);
         }
 
-        updateSymbols(functionNode);
-        functionNode.setState(CompilationState.FINALIZED);
-
-        return functionNode;
+        return true;
     }
 
     @Override
-    public Node leaveFunctionNode(FunctionNode functionNode) {
-        lexicalContext.pop(functionNode);
-        return super.leaveFunctionNode(functionNode);
+    public Node leaveFunctionNode(final FunctionNode functionNode) {
+        return functionNode.setState(getLexicalContext(), CompilationState.FINALIZED);
     }
 
     @Override
     public Node leaveIfNode(final IfNode ifNode) {
-        ifNode.setTest(convert(ifNode.getTest(), Type.BOOLEAN));
-        return ifNode;
+        return ifNode.setTest(convert(ifNode.getTest(), Type.BOOLEAN));
     }
 
     @SuppressWarnings("rawtypes")
     @Override
-    public Node enterLiteralNode(final LiteralNode literalNode) {
+    public boolean enterLiteralNode(final LiteralNode literalNode) {
         if (literalNode instanceof ArrayLiteralNode) {
             final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode;
             final Node[]           array            = arrayLiteralNode.getValue();
@@ -473,14 +442,14 @@
             }
         }
 
-        return null;
+        return false;
     }
 
     @Override
     public Node leaveReturnNode(final ReturnNode returnNode) {
         final Node expr = returnNode.getExpression();
         if (expr != null) {
-            returnNode.setExpression(convert(expr, getCurrentFunctionNode().getReturnType()));
+            return returnNode.setExpression(convert(expr, getLexicalContext().getCurrentFunction().getReturnType()));
         }
         return returnNode;
     }
@@ -496,21 +465,24 @@
 
     @Override
     public Node leaveSwitchNode(final SwitchNode switchNode) {
+        final boolean allInteger = switchNode.getTag().getSymbolType().isInteger();
+
+        if (allInteger) {
+            return switchNode;
+        }
+
         final Node           expression  = switchNode.getExpression();
         final List<CaseNode> cases       = switchNode.getCases();
-        final boolean        allInteger  = switchNode.getTag().getSymbolType().isInteger();
+        final List<CaseNode> newCases    = new ArrayList<>();
 
-        if (!allInteger) {
-            switchNode.setExpression(convert(expression, Type.OBJECT));
-            for (final CaseNode caseNode : cases) {
-                final Node test = caseNode.getTest();
-                if (test != null) {
-                    caseNode.setTest(convert(test, Type.OBJECT));
-                }
-            }
+        for (final CaseNode caseNode : cases) {
+            final Node test = caseNode.getTest();
+            newCases.add(test != null ? caseNode.setTest(convert(test, Type.OBJECT)) : caseNode);
         }
 
-        return switchNode;
+        return switchNode.
+            setExpression(getLexicalContext(), convert(expression, Type.OBJECT)).
+            setCases(getLexicalContext(), newCases);
     }
 
     @Override
@@ -520,8 +492,7 @@
 
     @Override
     public Node leaveThrowNode(final ThrowNode throwNode) {
-        throwNode.setExpression(convert(throwNode.getExpression(), Type.OBJECT));
-        return throwNode;
+        return throwNode.setExpression(convert(throwNode.getExpression(), Type.OBJECT));
     }
 
     @Override
@@ -544,23 +515,24 @@
     public Node leaveWhileNode(final WhileNode whileNode) {
         final Node test = whileNode.getTest();
         if (test != null) {
-            whileNode.setTest(convert(test, Type.BOOLEAN));
+            return whileNode.setTest(getLexicalContext(), convert(test, Type.BOOLEAN));
         }
         return whileNode;
     }
 
     @Override
     public Node leaveWithNode(final WithNode withNode) {
-        withNode.setExpression(convert(withNode.getExpression(), Type.OBJECT));
-        return withNode;
+        return withNode.setExpression(getLexicalContext(), convert(withNode.getExpression(), Type.OBJECT));
     }
 
     private static void updateSymbolsLog(final FunctionNode functionNode, final Symbol symbol, final boolean loseSlot) {
-        if (!symbol.isScope()) {
-            LOG.finest("updateSymbols: " + symbol + " => scope, because all vars in " + functionNode.getName() + " are in scope");
-        }
-        if (loseSlot && symbol.hasSlot()) {
-            LOG.finest("updateSymbols: " + symbol + " => no slot, because all vars in " + functionNode.getName() + " are in scope");
+        if (LOG.isEnabled()) {
+            if (!symbol.isScope()) {
+                LOG.finest("updateSymbols: ", symbol, " => scope, because all vars in ", functionNode.getName(), " are in scope");
+            }
+            if (loseSlot && symbol.hasSlot()) {
+                LOG.finest("updateSymbols: ", symbol, " => no slot, because all vars in ", functionNode.getName(), " are in scope");
+            }
         }
     }
 
@@ -574,29 +546,28 @@
             return; // nothing to do
         }
 
-        final FunctionNode functionNode = lexicalContext.getFunction(block);
-        assert !(block instanceof FunctionNode) || functionNode == block;
+        final LexicalContext lc             = getLexicalContext();
+        final FunctionNode   functionNode   = lc.getFunction(block);
+        final boolean        allVarsInScope = functionNode.allVarsInScope();
+        final boolean        isVarArg       = functionNode.isVarArg();
 
-        final List<Symbol> symbols        = block.getFrame().getSymbols();
-        final boolean      allVarsInScope = functionNode.allVarsInScope();
-        final boolean      isVarArg       = functionNode.isVarArg();
-
-        for (final Symbol symbol : symbols) {
-            if (symbol.isInternal() || symbol.isThis()) {
+        for (final Iterator<Symbol> iter = block.symbolIterator(); iter.hasNext(); ) {
+            final Symbol symbol = iter.next();
+            if (symbol.isInternal() || symbol.isThis() || symbol.isTemp()) {
                 continue;
             }
 
             if (symbol.isVar()) {
                 if (allVarsInScope || symbol.isScope()) {
                     updateSymbolsLog(functionNode, symbol, true);
-                    symbol.setIsScope();
+                    Symbol.setSymbolIsScope(lc, symbol);
                     symbol.setNeedsSlot(false);
                 } else {
                     assert symbol.hasSlot() : symbol + " should have a slot only, no scope";
                 }
             } else if (symbol.isParam() && (allVarsInScope || isVarArg || symbol.isScope())) {
                 updateSymbolsLog(functionNode, symbol, isVarArg);
-                symbol.setIsScope();
+                Symbol.setSymbolIsScope(lc, symbol);
                 symbol.setNeedsSlot(!isVarArg);
             }
         }
@@ -636,11 +607,7 @@
             //fallthru
         default:
             if (newRuntimeNode || widest.isObject()) {
-                final RuntimeNode runtimeNode = new RuntimeNode(binaryNode, request);
-                if (finalized) {
-                    runtimeNode.setIsFinal();
-                }
-                return runtimeNode;
+                return new RuntimeNode(binaryNode, request).setIsFinal(finalized);
             }
             break;
         }
@@ -667,7 +634,8 @@
     }
 
     private Node leaveBinary(final BinaryNode binaryNode, final Type lhsType, final Type rhsType) {
-        return binaryNode.setLHS(convert(binaryNode.lhs(), lhsType)).setRHS(convert(binaryNode.rhs(), rhsType));
+        Node b =  binaryNode.setLHS(convert(binaryNode.lhs(), lhsType)).setRHS(convert(binaryNode.rhs(), rhsType));
+        return b;
     }
 
     /**
@@ -683,28 +651,28 @@
 
         node.accept(new NodeVisitor() {
             private void setCanBePrimitive(final Symbol symbol) {
-                LOG.info("*** can be primitive symbol " + symbol + " " + Debug.id(symbol));
+                LOG.info("*** can be primitive symbol ", symbol, " ", Debug.id(symbol));
                 symbol.setCanBePrimitive(to);
             }
 
             @Override
-            public Node enterIdentNode(final IdentNode identNode) {
+            public boolean enterIdentNode(final IdentNode identNode) {
                 if (!exclude.contains(identNode)) {
                     setCanBePrimitive(identNode.getSymbol());
                 }
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterAccessNode(final AccessNode accessNode) {
+            public boolean enterAccessNode(final AccessNode accessNode) {
                 setCanBePrimitive(accessNode.getProperty().getSymbol());
-                return null;
+                return false;
             }
 
             @Override
-            public Node enterIndexNode(final IndexNode indexNode) {
+            public boolean enterIndexNode(final IndexNode indexNode) {
                 exclude.add(indexNode.getBase()); //prevent array base node to be flagged as primitive, but k in a[k++] is fine
-                return indexNode;
+                return true;
             }
         });
     }
@@ -785,12 +753,12 @@
     private static <T extends Node> T setTypeOverride(final T node, final Type to) {
         final Type from = node.getType();
         if (!node.getType().equals(to)) {
-            LOG.info("Changing call override type for '" + node + "' from " + node.getType() + " to " + to);
+            LOG.info("Changing call override type for '", node, "' from ", node.getType(), " to ", to);
             if (!to.isObject() && from.isObject()) {
                 setCanBePrimitive(node, to);
             }
         }
-        LOG.info("Type override for lhs in '" + node + "' => " + to);
+        LOG.info("Type override for lhs in '", node, "' => ", to);
         return ((TypeOverride<T>)node).setType(to);
     }
 
@@ -814,8 +782,8 @@
     private Node convert(final Node node, final Type to) {
         assert !to.isUnknown() : "unknown type for " + node + " class=" + node.getClass();
         assert node != null : "node is null";
-        assert node.getSymbol() != null : "node " + node + " has no symbol!";
-        assert node.tokenType() != TokenType.CONVERT : "assert convert in convert " + node + " in " + getCurrentFunctionNode();
+        assert node.getSymbol() != null : "node " + node + " " + node.getClass() + " has no symbol! " + getLexicalContext().getCurrentFunction() + " " + node.getSource();
+        assert node.tokenType() != TokenType.CONVERT : "assert convert in convert " + node + " in " + getLexicalContext().getCurrentFunction();
 
         final Type from = node.getType();
 
@@ -842,23 +810,23 @@
             resultNode = new UnaryNode(node.getSource(), Token.recast(node.getToken(), TokenType.CONVERT), node);
         }
 
-        LOG.info("CONVERT('" + node + "', " + to + ") => '" + resultNode + "'");
+        LOG.info("CONVERT('", node, "', ", to, ") => '", resultNode, "'");
 
+        final LexicalContext lc = getLexicalContext();
         //This is the only place in this file that can create new temporaries
         //FinalizeTypes may not introduce ANY node that is not a conversion.
-        getCurrentFunctionNode().newTemporary(getCurrentBlock().getFrame(), to, resultNode);
-        resultNode.copyTerminalFlags(node);
+        lc.getCurrentFunction().ensureSymbol(lc.getCurrentBlock(), to, resultNode);
+
+        assert !node.isTerminal();
 
         return resultNode;
     }
 
     private static Node discard(final Node node) {
-        node.setDiscard(true);
-
         if (node.getSymbol() != null) {
             final Node discard = new UnaryNode(node.getSource(), Token.recast(node.getToken(), TokenType.DISCARD), node);
             //discard never has a symbol in the discard node - then it would be a nop
-            discard.copyTerminalFlags(node);
+            assert !node.isTerminal();
             return discard;
         }
 
@@ -883,7 +851,7 @@
         final Symbol symbol = node.getSymbol();
         if (symbol.isTemp()) {
             symbol.setTypeOverride(to);
-            LOG.info("Type override for temporary in '" + node + "' => " + to);
+            LOG.info("Type override for temporary in '", node, "' => ", to);
         }
     }
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java	Wed May 08 10:10:05 2013 +0100
@@ -57,7 +57,7 @@
     public Node leaveUnaryNode(final UnaryNode unaryNode) {
         final LiteralNode<?> literalNode = new UnaryNodeConstantEvaluator(unaryNode).eval();
         if (literalNode != null) {
-            LOG.info("Unary constant folded " + unaryNode + " to " + literalNode);
+            LOG.info("Unary constant folded ", unaryNode, " to ", literalNode);
             return literalNode;
         }
         return unaryNode;
@@ -67,24 +67,20 @@
     public Node leaveBinaryNode(final BinaryNode binaryNode) {
         final LiteralNode<?> literalNode = new BinaryNodeConstantEvaluator(binaryNode).eval();
         if (literalNode != null) {
-            LOG.info("Binary constant folded " + binaryNode + " to " + literalNode);
+            LOG.info("Binary constant folded ", binaryNode, " to ", literalNode);
             return literalNode;
         }
         return binaryNode;
     }
 
     @Override
-    public Node enterFunctionNode(final FunctionNode functionNode) {
-        if (functionNode.isLazy()) {
-            return null;
-        }
-        return functionNode;
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
+        return !functionNode.isLazy();
     }
 
     @Override
     public Node leaveFunctionNode(final FunctionNode functionNode) {
-        functionNode.setState(CompilationState.CONSTANT_FOLDED);
-        return functionNode;
+        return functionNode.setState(getLexicalContext(), CompilationState.CONSTANT_FOLDED);
     }
 
     @Override
@@ -251,7 +247,7 @@
                 value = lhs.getNumber() - rhs.getNumber();
                 break;
             case SHR:
-                return LiteralNode.newInstance(source, token, finish, (lhs.getInt32() >>> rhs.getInt32()) & 0xffff_ffffL);
+                return LiteralNode.newInstance(source, token, finish, (lhs.getInt32() >>> rhs.getInt32()) & JSType.MAX_UINT);
             case SAR:
                 return LiteralNode.newInstance(source, token, finish, lhs.getInt32() >> rhs.getInt32());
             case SHL:
--- a/nashorn/src/jdk/nashorn/internal/codegen/Frame.java	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.codegen;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import jdk.nashorn.internal.ir.Symbol;
-
-/**
- * Tracks the variable area state.
- *
- */
-public final class Frame {
-    /** Previous frame. */
-    private Frame previous;
-
-    /** Current variables. */
-    private final ArrayList<Symbol> symbols;
-
-    /** Number of slots in previous frame. */
-    private int baseCount;
-
-    /** Number of slots in this frame. */
-    private int count;
-
-    /**
-     * Constructor.
-     *
-     * @param previous frame, the parent variable frame
-     */
-    public Frame(final Frame previous) {
-        this.previous  = previous;
-        this.symbols   = new ArrayList<>();
-        this.baseCount = getBaseCount();
-        this.count     = 0;
-    }
-
-    /**
-     * Copy constructor
-     * @param frame
-     * @param symbols
-     */
-    private Frame(final Frame frame, final List<Symbol> symbols) {
-        this.previous  = frame.getPrevious() == null ? null : new Frame(frame.getPrevious(), frame.getPrevious().getSymbols());
-        this.symbols   = new ArrayList<>(frame.getSymbols());
-        this.baseCount = frame.getBaseCount();
-        this.count     = frame.getCount();
-    }
-
-    /**
-     * Copy the frame
-     *
-     * @return a new frame with the identical contents
-     */
-    public Frame copy() {
-        return new Frame(this, getSymbols());
-    }
-
-    /**
-     * Add a new variable to the frame.
-     * @param symbol Symbol representing variable.
-     */
-    public void addSymbol(final Symbol symbol) {
-        final int slot = symbol.getSlot();
-        if (slot < 0) {
-            symbols.add(symbol);
-            count += symbol.slotCount();
-        }
-    }
-
-    /**
-     * Realign slot numbering prior to code generation.
-     * @return Number of slots in frame.
-     */
-    public int realign() {
-        baseCount = getBaseCount();
-        count     = 0;
-
-        for (final Symbol symbol : symbols) {
-            if (symbol.hasSlot()) {
-                symbol.setSlot(baseCount + count);
-                count += symbol.slotCount();
-            }
-        }
-
-        return count;
-    }
-
-    /**
-     * Return the slot count of previous frames.
-     * @return Number of slots in previous frames.
-     */
-    private int getBaseCount() {
-        return previous != null ? previous.getSlotCount() : 0;
-    }
-
-    /**
-     * Determine the number of slots to top of frame.
-     * @return Number of slots in total.
-     */
-    public int getSlotCount() {
-        return baseCount + count;
-    }
-
-    @Override
-    public String toString() {
-        final StringBuilder sb = new StringBuilder();
-        Frame f = this;
-        boolean hasPrev = false;
-        int pos = 0;
-
-        do {
-            if (hasPrev) {
-                sb.append("\n");
-            }
-
-            sb.append("#").
-                append(pos++).
-                append(" {baseCount:").
-                append(baseCount).
-                append(", ").
-                append("count:").
-                append(count).
-                append("} ");
-
-            for (final Symbol var : f.getSymbols()) {
-                sb.append('[').
-                    append(var.toString()).
-                    append(' ').
-                    append(var.hashCode()).
-                    append("] ");
-            }
-
-            f = f.getPrevious();
-            hasPrev = true;
-        } while (f != null);
-
-        return sb.toString();
-    }
-
-    /**
-     * Get variable count for this frame
-     * @return variable count
-     */
-    public int getCount() {
-        return count;
-    }
-
-    /**
-     * Get previous frame
-     * @return previous frame
-     */
-    public Frame getPrevious() {
-        return previous;
-    }
-
-    /**
-     * Set previous frame
-     * @param previous previous frame
-     */
-    public void setPrevious(final Frame previous) {
-        this.previous = previous;
-    }
-
-    /**
-     * Get symbols in frame
-     * @return a list of symbols in this frame
-     */
-    public List<Symbol> getSymbols() {
-        return Collections.unmodifiableList(symbols);
-    }
- }
--- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Wed May 08 10:10:05 2013 +0100
@@ -25,29 +25,21 @@
 
 package jdk.nashorn.internal.codegen;
 
-import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS;
-import static jdk.nashorn.internal.codegen.CompilerConstants.CALLEE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.EVAL;
-import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
-import static jdk.nashorn.internal.codegen.CompilerConstants.SCRIPT_RETURN;
+import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
 import static jdk.nashorn.internal.codegen.CompilerConstants.THIS;
-import static jdk.nashorn.internal.codegen.CompilerConstants.VARARGS;
 
-import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Deque;
-import java.util.Iterator;
 import java.util.List;
 import jdk.nashorn.internal.ir.BaseNode;
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
+import jdk.nashorn.internal.ir.BlockLexicalContext;
 import jdk.nashorn.internal.ir.BreakNode;
 import jdk.nashorn.internal.ir.CallNode;
-import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
 import jdk.nashorn.internal.ir.ContinueNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
 import jdk.nashorn.internal.ir.EmptyNode;
 import jdk.nashorn.internal.ir.ExecuteNode;
 import jdk.nashorn.internal.ir.ForNode;
@@ -56,10 +48,10 @@
 import jdk.nashorn.internal.ir.IdentNode;
 import jdk.nashorn.internal.ir.IfNode;
 import jdk.nashorn.internal.ir.LabelNode;
-import jdk.nashorn.internal.ir.LabeledNode;
 import jdk.nashorn.internal.ir.LexicalContext;
 import jdk.nashorn.internal.ir.LineNumberNode;
 import jdk.nashorn.internal.ir.LiteralNode;
+import jdk.nashorn.internal.ir.LoopNode;
 import jdk.nashorn.internal.ir.Node;
 import jdk.nashorn.internal.ir.ReturnNode;
 import jdk.nashorn.internal.ir.SwitchNode;
@@ -90,356 +82,167 @@
 
 final class Lower extends NodeOperatorVisitor {
 
-    /**
-     * Nesting level stack. Currently just used for loops to avoid the problem
-     * with terminal bodies that end with throw/return but still do continues to
-     * outer loops or same loop.
-     */
-    private final Deque<Node> nesting;
-
     private static final DebugLogger LOG = new DebugLogger("lower");
 
-    private Node lastStatement;
-
-    private List<Node> statements;
-
-    private LexicalContext lexicalContext = new LexicalContext();
-
     /**
      * Constructor.
      *
      * @param compiler the compiler
      */
     Lower() {
-        this.nesting    = new ArrayDeque<>();
-        this.statements = new ArrayList<>();
+        super(new BlockLexicalContext() {
+
+            @Override
+            public List<Node> popStatements() {
+                List<Node> newStatements = new ArrayList<>();
+                boolean terminated = false;
+
+                final List<Node> statements = super.popStatements();
+                for (final Node statement : statements) {
+                    if (!terminated) {
+                        newStatements.add(statement);
+                        if (statement.isTerminal()) {
+                            terminated = true;
+                        }
+                    } else {
+                        if (statement instanceof VarNode) {
+                            newStatements.add(((VarNode)statement).setInit(null));
+                        }
+                    }
+                }
+                return newStatements;
+            }
+        });
+    }
+
+    @Override
+    public boolean enterBlock(final Block block) {
+        final LexicalContext lc = getLexicalContext();
+        if (lc.isFunctionBody() && lc.getCurrentFunction().isProgram() && !lc.getCurrentFunction().hasDeclaredFunctions()) {
+            new ExecuteNode(block.getSource(), block.getToken(), block.getFinish(), LiteralNode.newInstance(block, ScriptRuntime.UNDEFINED)).accept(this);
+        }
+        return true;
     }
 
     @Override
-    public Node enterBlock(final Block block) {
-        final Node       savedLastStatement = lastStatement;
-        final List<Node> savedStatements    = statements;
-        lexicalContext.push(block);
-        try {
-            this.statements = new ArrayList<>();
-            NodeVisitor visitor = this;
-            for (final Node statement : block.getStatements()) {
-                statement.accept(visitor);
-                /*
-                 * This is slightly unsound, for example if we have a loop with
-                 * a guarded statement like if (x) continue in the body and the
-                 * body ends with TERMINAL, e.g. return; we removed the continue
-                 * before we had the loop stack, as all we cared about was a
-                 * return last in the loop.
-                 *
-                 * @see NASHORN-285
-                 */
-                if (lastStatement != null && lastStatement.isTerminal()) {
-                    copyTerminal(block, lastStatement);
-                    visitor = new DeadCodeVarDeclarationVisitor();
-                }
-            }
-            block.setStatements(statements);
+    public Node leaveBlock(final Block block) {
+        //now we have committed the entire statement list to the block, but we need to truncate
+        //whatever is after the last terminal. block append won't append past it
+
+        final BlockLexicalContext lc = (BlockLexicalContext)getLexicalContext();
+
+        Node last = lc.getLastStatement();
 
-        } finally {
-            this.statements = savedStatements;
-            this.lastStatement = savedLastStatement;
-            lexicalContext.pop(block);
+        if (lc.isFunctionBody()) {
+            final FunctionNode currentFunction = getLexicalContext().getCurrentFunction();
+            final boolean isProgram = currentFunction.isProgram();
+            final ReturnNode returnNode = new ReturnNode(
+                currentFunction.getSource(),
+                currentFunction.getToken(),
+                currentFunction.getFinish(),
+                isProgram ?
+                    compilerConstant(RETURN) :
+                    LiteralNode.newInstance(block, ScriptRuntime.UNDEFINED));
+
+            last = returnNode.accept(this);
         }
 
-        return null;
+        if (last != null && last.isTerminal()) {
+            return block.setIsTerminal(lc, true);
+        }
+
+        return block;
     }
 
     @Override
-    public Node enterBreakNode(final BreakNode breakNode) {
-        return enterBreakOrContinue(breakNode);
+    public boolean enterBreakNode(final BreakNode breakNode) {
+        addStatement(breakNode);
+        return false;
     }
 
     @Override
-    public Node enterCallNode(final CallNode callNode) {
-        final Node function = markerFunction(callNode.getFunction());
-        callNode.setFunction(function);
-        checkEval(callNode); //check if this is an eval call and store the information
-        return callNode;
-    }
-
-    @Override
-    public Node leaveCaseNode(final CaseNode caseNode) {
-        caseNode.copyTerminalFlags(caseNode.getBody());
-        return caseNode;
+    public Node leaveCallNode(final CallNode callNode) {
+        return checkEval(callNode.setFunction(markerFunction(callNode.getFunction())));
     }
 
     @Override
     public Node leaveCatchNode(final CatchNode catchNode) {
-        catchNode.copyTerminalFlags(catchNode.getBody());
-        addStatement(catchNode);
-        return catchNode;
-    }
-
-    @Override
-    public Node enterContinueNode(final ContinueNode continueNode) {
-        return enterBreakOrContinue(continueNode);
+        return addStatement(catchNode);
     }
 
     @Override
-    public Node enterDoWhileNode(final DoWhileNode doWhileNode) {
-        return enterWhileNode(doWhileNode);
+    public boolean enterContinueNode(final ContinueNode continueNode) {
+        addStatement(continueNode);
+        return false;
     }
 
     @Override
-    public Node leaveDoWhileNode(final DoWhileNode doWhileNode) {
-        return leaveWhileNode(doWhileNode);
-    }
-
-    @Override
-    public Node enterEmptyNode(final EmptyNode emptyNode) {
-        return null;
+    public boolean enterEmptyNode(final EmptyNode emptyNode) {
+        return false;
     }
 
     @Override
     public Node leaveExecuteNode(final ExecuteNode executeNode) {
         final Node expr = executeNode.getExpression();
+        ExecuteNode node = executeNode;
 
-        if (getCurrentFunctionNode().isProgram()) {
+        final FunctionNode currentFunction = getLexicalContext().getCurrentFunction();
+
+        if (currentFunction.isProgram()) {
             if (!(expr instanceof Block) || expr instanceof FunctionNode) { // it's not a block, but can be a function
                 if (!isInternalExpression(expr) && !isEvalResultAssignment(expr)) {
-                    executeNode.setExpression(new BinaryNode(executeNode.getSource(), Token.recast(executeNode.getToken(), TokenType.ASSIGN),
-                            getCurrentFunctionNode().getResultNode(),
-                            expr));
+                    node = executeNode.setExpression(
+                        new BinaryNode(
+                            executeNode.getSource(),
+                            Token.recast(
+                                executeNode.getToken(),
+                                TokenType.ASSIGN),
+                            compilerConstant(RETURN),
+                        expr));
                 }
             }
         }
 
-        copyTerminal(executeNode, executeNode.getExpression());
-        addStatement(executeNode);
-
-        return executeNode;
-    }
-
-    @Override
-    public Node enterForNode(final ForNode forNode) {
-        nest(forNode);
-        return forNode;
+        return addStatement(node);
     }
 
     @Override
     public Node leaveForNode(final ForNode forNode) {
-        final Node  test = forNode.getTest();
-        final Block body = forNode.getBody();
+        ForNode newForNode = forNode;
 
-        if (!forNode.isForIn() && test == null) {
-            setHasGoto(forNode);
-        }
-
-        final boolean escapes = controlFlowEscapes(body);
-        if (escapes) {
-            setTerminal(body, false);
+        final Node  test = forNode.getTest();
+        if (!forNode.isForIn() && conservativeAlwaysTrue(test)) {
+            newForNode = forNode.setTest(getLexicalContext(), null);
         }
 
-        // pop the loop from the loop context
-        unnest(forNode);
-
-        if (!forNode.isForIn() && conservativeAlwaysTrue(test)) {
-            forNode.setTest(null);
-            setHasGoto(forNode);
-            setTerminal(forNode, !escapes);
-        }
-
-        addStatement(forNode);
-
-        return forNode;
+        return addStatement(checkEscape(newForNode));
     }
 
     @Override
-    public Node enterFunctionNode(final FunctionNode functionNode) {
-        LOG.info("START FunctionNode: " + functionNode.getName());
-
-        if (functionNode.isLazy()) {
-            LOG.info("LAZY: " + functionNode.getName());
-            return null;
-        }
-        lexicalContext.push(functionNode);
-        initFunctionNode(functionNode);
-
-        nest(functionNode);
-
-        /*
-         * As we are evaluating a nested structure, we need to store the
-         * statement list for the surrounding block and restore it when the
-         * function is done
-         */
-        final List<Node> savedStatements = statements;
-        final Node savedLastStatement = lastStatement;
-
-        statements    = new ArrayList<>();
-        lastStatement = null;
-
-        if (functionNode.needsSelfSymbol()) {
-            //function needs to start with var funcIdent = __callee_;
-            statements.add(functionNode.getSelfSymbolInit().accept(this));
-        }
-
-        NodeVisitor visitor = this;
-        try {
-            //do the statements - this fills the block with code
-            boolean needsInitialEvalResult = functionNode.isProgram();
-            for (final Node statement : functionNode.getStatements()) {
-                // If this function is a program, then insert an assignment to the initial eval result after all
-                // function declarations.
-                if(needsInitialEvalResult && !(statement instanceof LineNumberNode || (statement instanceof VarNode && ((VarNode)statement).isFunctionDeclaration()))) {
-                    addInitialEvalResult(functionNode);
-                    needsInitialEvalResult = false;
-                }
-                statement.accept(visitor);
-                //If there are unused terminated endpoints in the function, we need
-                // to add a "return undefined" in those places for correct semantics
-                LOG.info("Checking lastStatement="+lastStatement+" for terminal flags");
-                if (lastStatement != null && lastStatement.hasTerminalFlags()) {
-                    copyTerminal(functionNode, lastStatement);
-                    assert !needsInitialEvalResult;
-                    visitor = new DeadCodeVarDeclarationVisitor();
-                }
-            }
-            if(needsInitialEvalResult) {
-                addInitialEvalResult(functionNode);
-            }
-            functionNode.setStatements(statements);
-
-            if (!functionNode.isTerminal()) {
-                guaranteeReturn(functionNode);
-            }
-        } finally {
-            statements    = savedStatements;
-            lastStatement = savedLastStatement;
-        }
-
-        LOG.info("END FunctionNode: " + functionNode.getName());
-        unnest(functionNode);
-        lexicalContext.pop(functionNode);
-
-        functionNode.setState(CompilationState.LOWERED);
-
-        return null;
-    }
-
-    /**
-     * This visitor is used to go over statements after a terminal statement. Those statements are dead code, but the
-     * var declarations in them still have the effect of declaring a local variable on the function level. Therefore,
-     * they aren't really dead code and must be preserved. Note that they're only preserved as no-op declarations; their
-     * initializers are wiped out as those are, in fact, dead code.
-     */
-    private class DeadCodeVarDeclarationVisitor extends NodeOperatorVisitor {
-        DeadCodeVarDeclarationVisitor() {
-        }
-
-        @Override
-        public Node enterVarNode(VarNode varNode) {
-            // Can't ever see a function declaration, as this visitor is only ever used after a terminal statement was
-            // encountered, and all function declarations precede any terminal statements.
-            assert !varNode.isFunctionDeclaration();
-            if(varNode.getInit() == null) {
-                // No initializer, just pass it to Lower.
-                return varNode.accept(Lower.this);
-            }
-            // Wipe out the initializer and then pass it to Lower.
-            return varNode.setInit(null).accept(Lower.this);
-        }
-    }
-
-    private void addInitialEvalResult(final FunctionNode functionNode) {
-        new ExecuteNode(functionNode.getSource(), functionNode.getFirstToken(), functionNode.getFinish(),
-                getInitialEvalResult(functionNode)).accept(this);
-    }
-
-    /**
-     * Result of initial result of evaluating a particular program, which is either the last function it declares, or
-     * undefined if it doesn't declare any functions.
-     * @param program
-     * @return the initial result of evaluating the program
-     */
-    private static Node getInitialEvalResult(final FunctionNode program) {
-        IdentNode lastFnName = null;
-        for (final FunctionNode fn : program.getDeclaredFunctions()) {
-            assert fn.isDeclared();
-            final IdentNode fnName = fn.getIdent();
-            if(fnName != null) {
-                lastFnName = fnName;
-            }
-        }
-        return lastFnName != null ? new IdentNode(lastFnName) : LiteralNode.newInstance(program, ScriptRuntime.UNDEFINED);
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
+        return !functionNode.isLazy();
     }
 
     @Override
-    public Node enterIfNode(final IfNode ifNode) {
-        return nest(ifNode);
+    public Node leaveFunctionNode(final FunctionNode functionNode) {
+        LOG.info("END FunctionNode: ", functionNode.getName());
+        return functionNode.setState(getLexicalContext(), CompilationState.LOWERED);
     }
 
     @Override
     public Node leaveIfNode(final IfNode ifNode) {
-        final Node pass = ifNode.getPass();
-        final Node fail = ifNode.getFail();
-
-        if (pass.isTerminal() && fail != null && fail.isTerminal()) {
-            setTerminal(ifNode,  true);
-        }
-
-        addStatement(ifNode);
-        unnest(ifNode);
-
-        return ifNode;
-    }
-
-    @Override
-    public Node enterLabelNode(LabelNode labelNode) {
-        final Block body = labelNode.getBody();
-        body.accept(this);
-        copyTerminal(labelNode, body);
-        addStatement(labelNode);
-        return null;
-    }
-
-    @Override
-    public Node enterLineNumberNode(final LineNumberNode lineNumberNode) {
-        addStatement(lineNumberNode, false); // don't put it in lastStatement cache
-        return null;
+        return addStatement(ifNode);
     }
 
     @Override
-    public Node enterReturnNode(final ReturnNode returnNode) {
-        final TryNode tryNode = returnNode.getTryChain();
-        final Node    expr    = returnNode.getExpression();
-
-        if (tryNode != null) {
-            //we are inside a try block - we don't necessarily have a result node yet. attr will do that.
-            if (expr != null) {
-                final Source source = getCurrentFunctionNode().getSource();
-
-                //we need to evaluate the result of the return in case it is complex while
-                //still in the try block, store it in a result value and return it afterwards
-                final long token        = returnNode.getToken();
-                final Node resultNode   = new IdentNode(getCurrentFunctionNode().getResultNode());
-                final Node assignResult = new BinaryNode(source, Token.recast(token, TokenType.ASSIGN), resultNode, expr);
-
-                //add return_in_try = expr; to try block
-                new ExecuteNode(source, token, Token.descPosition(token), assignResult).accept(this);
+    public Node leaveLabelNode(final LabelNode labelNode) {
+        return addStatement(labelNode);
+    }
 
-                //splice in the finally code, inlining it here
-                if (copyFinally(tryNode, null)) {
-                    return null;
-                }
-
-                //make sure that the return node now returns 'return_in_try'
-                returnNode.setExpression(resultNode);
-            } else if (copyFinally(tryNode, null)) {
-                return null;
-            }
-        } else if (expr != null) {
-            returnNode.setExpression(expr.accept(this));
-        }
-
-        addStatement(returnNode);
-
-        return null;
+    @Override
+    public boolean enterLineNumberNode(final LineNumberNode lineNumberNode) {
+        addStatement(lineNumberNode); // don't put it in lastStatement cache
+        return false;
     }
 
     @Override
@@ -448,31 +251,10 @@
         return returnNode;
     }
 
-    @Override
-    public Node enterSwitchNode(final SwitchNode switchNode) {
-        nest(switchNode);
-        return switchNode;
-    }
 
     @Override
     public Node leaveSwitchNode(final SwitchNode switchNode) {
-        unnest(switchNode);
-
-        final List<CaseNode> cases       = switchNode.getCases();
-        final CaseNode       defaultCase = switchNode.getDefaultCase();
-
-        boolean allTerminal = !cases.isEmpty();
-        for (final CaseNode caseNode : switchNode.getCases()) {
-            allTerminal &= caseNode.isTerminal();
-        }
-
-        if (allTerminal && defaultCase != null && defaultCase.isTerminal()) {
-            setTerminal(switchNode, true);
-        }
-
-        addStatement(switchNode);
-
-        return switchNode;
+        return addStatement(switchNode);
     }
 
     @Override
@@ -481,208 +263,234 @@
         return throwNode;
     }
 
-    @Override
-    public Node enterTryNode(final TryNode tryNode) {
-        final Block  finallyBody = tryNode.getFinallyBody();
-        final long   token       = tryNode.getToken();
-        final int    finish      = tryNode.getFinish();
+    private static Node ensureUniqueLabelsIn(final Node node) {
+        return node.accept(new NodeVisitor() {
+           @Override
+           public Node leaveDefault(final Node labelledNode) {
+               return labelledNode.ensureUniqueLabels(getLexicalContext());
+           }
+        });
+    }
+
+    private static List<Node> copyFinally(final Block finallyBody) {
+        final List<Node> newStatements = new ArrayList<>();
+        for (final Node statement : finallyBody.getStatements()) {
+            newStatements.add(ensureUniqueLabelsIn(statement));
+            if (statement.hasTerminalFlags()) {
+                return newStatements;
+            }
+        }
+        return newStatements;
+    }
+
+    private Block catchAllBlock(final TryNode tryNode) {
+        final Source source = tryNode.getSource();
+        final long   token  = tryNode.getToken();
+        final int    finish = tryNode.getFinish();
+
+        final IdentNode exception = new IdentNode(source, token, finish, getLexicalContext().getCurrentFunction().uniqueName("catch_all"));
+
+        final Block catchBody = new Block(source, token, finish, new ThrowNode(source, token, finish, new IdentNode(exception))).
+                setIsTerminal(getLexicalContext(), true); //ends with throw, so terminal
+
+        final CatchNode catchAllNode  = new CatchNode(source, token, finish, new IdentNode(exception), null, catchBody);
+        final Block     catchAllBlock = new Block(source, token, finish, catchAllNode);
+
+        //catchallblock -> catchallnode (catchnode) -> exception -> throw
+
+        return (Block)catchAllBlock.accept(this); //not accepted. has to be accepted by lower
+    }
+
+    private IdentNode compilerConstant(final CompilerConstants cc) {
+        final FunctionNode functionNode = getLexicalContext().getCurrentFunction();
+        return new IdentNode(functionNode.getSource(), functionNode.getToken(), functionNode.getFinish(), cc.symbolName());
+    }
+
+    private static boolean isTerminal(final List<Node> statements) {
+        return !statements.isEmpty() && statements.get(statements.size() - 1).hasTerminalFlags();
+    }
+
+    /**
+     * Splice finally code into all endpoints of a trynode
+     * @param tryNode the try node
+     * @param list of rethrowing throw nodes from synthetic catch blocks
+     * @param finallyBody the code in the original finally block
+     * @return new try node after splicing finally code (same if nop)
+     */
+    private Node spliceFinally(final TryNode tryNode, final List<ThrowNode> rethrows, final Block finallyBody) {
+        final Source source = tryNode.getSource();
+        final int    finish = tryNode.getFinish();
+
+        assert tryNode.getFinallyBody() == null;
+
+        final TryNode newTryNode = (TryNode)tryNode.accept(new NodeVisitor() {
+            final List<Node> insideTry = new ArrayList<>();
 
-        nest(tryNode);
+            @Override
+            public boolean enterDefault(final Node node) {
+                insideTry.add(node);
+                return true;
+            }
+
+            @Override
+            public boolean enterFunctionNode(final FunctionNode functionNode) {
+                // do not enter function nodes - finally code should not be inlined into them
+                return false;
+            }
+
+            @Override
+            public Node leaveThrowNode(final ThrowNode throwNode) {
+                if (rethrows.contains(throwNode)) {
+                    final List<Node> newStatements = copyFinally(finallyBody);
+                    if (!isTerminal(newStatements)) {
+                        newStatements.add(throwNode);
+                    }
+                    return new Block(source, throwNode.getToken(), throwNode.getFinish(), newStatements);
+                }
+                return throwNode;
+            }
+
+            @Override
+            public Node leaveBreakNode(final BreakNode breakNode) {
+                return copy(breakNode, Lower.this.getLexicalContext().getBreakable(breakNode.getLabel()));
+            }
+
+            @Override
+            public Node leaveContinueNode(final ContinueNode continueNode) {
+                return copy(continueNode, Lower.this.getLexicalContext().getContinueTo(continueNode.getLabel()));
+            }
 
-        if (finallyBody == null) {
-            //do nothing if no finally exists
-            return tryNode;
+            @Override
+            public Node leaveReturnNode(final ReturnNode returnNode) {
+                final Node  expr  = returnNode.getExpression();
+                final List<Node> newStatements = new ArrayList<>();
+
+                final Node resultNode;
+                if (expr != null) {
+                    //we need to evaluate the result of the return in case it is complex while
+                    //still in the try block, store it in a result value and return it afterwards
+                    resultNode = new IdentNode(Lower.this.compilerConstant(RETURN));
+                    newStatements.add(new ExecuteNode(new BinaryNode(source, Token.recast(returnNode.getToken(), TokenType.ASSIGN), resultNode, expr)));
+                } else {
+                    resultNode = null;
+                }
+
+                newStatements.addAll(copyFinally(finallyBody));
+                if (!isTerminal(newStatements)) {
+                    newStatements.add(expr == null ? returnNode : returnNode.setExpression(resultNode));
+                }
+
+                return new ExecuteNode(new Block(source, returnNode.getToken(), getLexicalContext().getCurrentBlock().getFinish(), newStatements));
+            }
+
+            private Node copy(final Node endpoint, final Node targetNode) {
+                if (!insideTry.contains(targetNode)) {
+                    final List<Node> newStatements = copyFinally(finallyBody);
+                    if (!isTerminal(newStatements)) {
+                        newStatements.add(endpoint);
+                    }
+                    return new ExecuteNode(new Block(source, endpoint.getToken(), finish, newStatements));
+                }
+                return endpoint;
+            }
+        });
+
+        addStatement(newTryNode);
+        for (final Node statement : finallyBody.getStatements()) {
+            addStatement(statement);
         }
 
-        /*
-         * We have a finally clause.
-         *
-         * Transform to do finally tail duplication as follows:
-         *
-         * <pre>
-         *  try {
-         *    try_body
-         *  } catch e1 {
-         *    catchbody_1
-         *  }
-         *  ...
-         *  } catch en {
-         *    catchbody_n
-         *  } finally {
-         *    finally_body
-         *  }
-         *
-         *  (where e1 ... en are optional)
-         *
-         *  turns into
-         *
-         *  try {
-         *    try {
-         *      try_body
-         *    } catch e1 {
-         *      catchbody1
-         *      //nothing inlined explicitly here, return, break other
-         *      //terminals may inline the finally body
-         *      ...
-         *    } catch en {
-         *      catchbody2
-         *      //nothing inlined explicitly here, return, break other
-         *      //terminals may inline the finally body
-         *    }
-         *  } catch all ex {
-         *      finally_body_inlined
-         *      rethrow ex
-         *  }
-         *  finally_body_inlined
-         * </pre>
-         *
-         * If tries are catches are terminal, visitors for return, break &
-         * continue will handle the tail duplications. Throw needs to be
-         * treated specially with the catchall as described in the above
-         * ASCII art.
-         *
-         * If the try isn't terminal we do the finally_body_inlined at the
-         * end. If the try is terminated with continue/break/return the
-         * existing visitor logic will inline the finally before that
-         * operation. if the try is terminated with a throw, the catches e1
-         * ... en will have a chance to process the exception. If the
-         * appropriate catch e1..en is non terminal we fall through to the
-         * last finally_body_inlined. if the catch e1...en IS terminal with
-         * continue/break/return existing visitor logic will fix it. If they
-         * are terminal with another throw it goes to the catchall and the
-         * finally_body_inlined marked (*) will fix it before rethrowing
-         * whatever problem there was for identical semantic.
-         */
-        final Source source = getCurrentFunctionNode().getSource();
-
-        // if try node does not contain a catch we can skip creation of a new
-        // try node and just append our synthetic catch to the existing try node.
-        if (!tryNode.getCatchBlocks().isEmpty()) {
-            // insert an intermediate try-catch* node, where we move the body and all catch blocks.
-            // the original try node become a try-finally container for the new try-catch* node.
-            // because we don't clone (to avoid deep copy), we have to fix the block chain in the end.
-            final TryNode innerTryNode;
-            innerTryNode = new TryNode(source, token, finish, tryNode.getNext());
-            innerTryNode.setBody(tryNode.getBody());
-            innerTryNode.setCatchBlocks(tryNode.getCatchBlocks());
-
-            // set outer tryNode's body to innerTryNode
-            final Block outerBody;
-            outerBody = new Block(source, token, finish);
-            outerBody.setStatements(new ArrayList<Node>(Arrays.asList(innerTryNode)));
-            tryNode.setBody(outerBody);
-            tryNode.setCatchBlocks(null);
-        }
-
-        // create a catch-all that inlines finally and rethrows
-
-        final Block catchBlock      = new Block(source, token, finish);
-        //this catch block should get define symbol
-
-        final Block catchBody       = new Block(source, token, finish);
-        final Node  catchAllFinally = finallyBody.copy();
-
-        catchBody.addStatement(new ExecuteNode(source, finallyBody.getToken(), finallyBody.getFinish(), catchAllFinally));
-        setTerminal(catchBody, true);
-
-        final CatchNode catchAllNode;
-        final IdentNode exception;
-
-        exception    = new IdentNode(source, token, finish, getCurrentFunctionNode().uniqueName("catch_all"));
-        catchAllNode = new CatchNode(source, token, finish, new IdentNode(exception), null, catchBody);
-        catchAllNode.setIsSyntheticRethrow();
-
-        catchBlock.addStatement(catchAllNode);
-
-        // replace all catches of outer tryNode with the catch-all
-        tryNode.setCatchBlocks(new ArrayList<>(Arrays.asList(catchBlock)));
-
-        /*
-         * We leave the finally block for the original try in place for now
-         * so that children visitations will work. It is removed and placed
-         * afterwards in the else case below, after all children are visited
-         */
-
-        return tryNode;
+        return newTryNode;
     }
 
     @Override
     public Node leaveTryNode(final TryNode tryNode) {
-        final Block finallyBody   = tryNode.getFinallyBody();
+        final Block finallyBody = tryNode.getFinallyBody();
 
-        boolean allTerminal = tryNode.getBody().isTerminal() && (finallyBody == null || finallyBody.isTerminal());
-
-        for (final Block catchBlock : tryNode.getCatchBlocks()) {
-            allTerminal &= catchBlock.isTerminal();
+        if (finallyBody == null) {
+            return addStatement(tryNode);
         }
 
-        tryNode.setIsTerminal(allTerminal);
-
-        addStatement(tryNode);
-        unnest(tryNode);
+        /*
+         * create a new trynode
+         *    if we have catches:
+         *
+         *    try            try
+         *       x              try
+         *    catch               x
+         *       y              catch
+         *    finally z           y
+         *                   catchall
+         *                        rethrow
+         *
+         *   otheriwse
+         *
+         *   try              try
+         *      x               x
+         *   finally          catchall
+         *      y               rethrow
+         *
+         *
+         *   now splice in finally code wherever needed
+         *
+         */
+        TryNode newTryNode;
 
-        // if finally body is present, place it after the tryNode
-        if (finallyBody != null) {
-            tryNode.setFinallyBody(null);
-            addStatement(finallyBody);
+        final Block catchAll = catchAllBlock(tryNode);
+
+        final List<ThrowNode> rethrows = new ArrayList<>();
+        catchAll.accept(new NodeVisitor() {
+            @Override
+            public boolean enterThrowNode(final ThrowNode throwNode) {
+                rethrows.add(throwNode);
+                return true;
+            }
+        });
+        assert rethrows.size() == 1;
+
+        if (tryNode.getCatchBlocks().isEmpty()) {
+            newTryNode = tryNode.setFinallyBody(null);
+        } else {
+            Block outerBody = new Block(tryNode.getSource(), tryNode.getToken(), tryNode.getFinish(), new ArrayList<Node>(Arrays.asList(tryNode.setFinallyBody(null))));
+            newTryNode = tryNode.setBody(outerBody).setCatchBlocks(null);
         }
 
-        return tryNode;
+        newTryNode = newTryNode.setCatchBlocks(Arrays.asList(catchAll)).setFinallyBody(null);
+
+        /*
+         * Now that the transform is done, we have to go into the try and splice
+         * the finally block in front of any statement that is outside the try
+         */
+        return spliceFinally(newTryNode, rethrows, finallyBody);
     }
 
     @Override
     public Node leaveVarNode(final VarNode varNode) {
         addStatement(varNode);
+        if (varNode.getFlag(VarNode.IS_LAST_FUNCTION_DECLARATION) && getLexicalContext().getCurrentFunction().isProgram()) {
+            new ExecuteNode(varNode.getSource(), varNode.getToken(), varNode.getFinish(), new IdentNode(varNode.getName())).accept(this);
+        }
         return varNode;
     }
 
     @Override
-    public Node enterWhileNode(final WhileNode whileNode) {
-        return nest(whileNode);
-    }
-
-    @Override
     public Node leaveWhileNode(final WhileNode whileNode) {
         final Node test = whileNode.getTest();
-
-        if (test == null) {
-            setHasGoto(whileNode);
-        }
+        final Block body = whileNode.getBody();
 
-        final Block   body    = whileNode.getBody();
-        final boolean escapes = controlFlowEscapes(body);
-        if (escapes) {
-            setTerminal(body, false);
+        if (conservativeAlwaysTrue(test)) {
+            //turn it into a for node without a test.
+            final ForNode forNode = (ForNode)new ForNode(whileNode.getSource(), whileNode.getToken(), whileNode.getFinish(), null, null, body, null, ForNode.IS_FOR).accept(this);
+            getLexicalContext().replace(whileNode, forNode);
+            return forNode;
         }
 
-        Node node = whileNode;
-
-        if (body.isTerminal()) {
-            if (whileNode instanceof DoWhileNode) {
-                setTerminal(whileNode, true);
-            } else if (conservativeAlwaysTrue(test)) {
-                node = new ForNode(whileNode.getSource(), whileNode.getToken(), whileNode.getFinish());
-                ((ForNode)node).setBody(body);
-                node.accept(this);
-                setTerminal(node, !escapes);
-            }
-        }
-
-        // pop the loop from the loop context
-        unnest(whileNode);
-        addStatement(node);
-
-        return node;
+         return addStatement(checkEscape(whileNode));
     }
 
     @Override
     public Node leaveWithNode(final WithNode withNode) {
-        if (withNode.getBody().isTerminal()) {
-            setTerminal(withNode,  true);
-        }
-        addStatement(withNode);
-
-        return withNode;
+        return addStatement(withNode);
     }
 
     @Override
@@ -741,23 +549,25 @@
      *
      * @param callNode call node to check if it's an eval
      */
-    private void checkEval(final CallNode callNode) {
+    private CallNode checkEval(final CallNode callNode) {
         if (callNode.getFunction() instanceof IdentNode) {
 
             final List<Node> args   = callNode.getArgs();
             final IdentNode  callee = (IdentNode)callNode.getFunction();
 
             // 'eval' call with at least one argument
-            if (args.size() >= 1 && EVAL.tag().equals(callee.getName())) {
-                final CallNode.EvalArgs evalArgs =
+            if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) {
+                final FunctionNode currentFunction = getLexicalContext().getCurrentFunction();
+                return callNode.setEvalArgs(
                     new CallNode.EvalArgs(
-                        args.get(0).copy().accept(this), //clone as we use this for the "is eval case". original evaluated separately for "is not eval case"
-                        getCurrentFunctionNode().getThisNode(),
+                        ensureUniqueLabelsIn(args.get(0)).accept(this),
+                        compilerConstant(THIS),
                         evalLocation(callee),
-                        getCurrentFunctionNode().isStrictMode());
-                callNode.setEvalArgs(evalArgs);
+                        currentFunction.isStrict()));
             }
         }
+
+        return callNode;
     }
 
     private static boolean conservativeAlwaysTrue(final Node node) {
@@ -773,7 +583,7 @@
      * @param loopBody the loop body to check
      * @return true if control flow may escape the loop
      */
-    private boolean controlFlowEscapes(final Node loopBody) {
+    private static boolean controlFlowEscapes(final LexicalContext lex, final Block loopBody) {
         final List<Node> escapes = new ArrayList<>();
 
         loopBody.accept(new NodeVisitor() {
@@ -786,7 +596,7 @@
             @Override
             public Node leaveContinueNode(final ContinueNode node) {
                 // all inner loops have been popped.
-                if (nesting.contains(node.getTargetNode())) {
+                if (lex.contains(lex.getContinueTo(node.getLabel()))) {
                     escapes.add(node);
                 }
                 return node;
@@ -796,136 +606,24 @@
         return !escapes.isEmpty();
     }
 
-    private void guaranteeReturn(final FunctionNode functionNode) {
-        Node resultNode;
-
-        if (functionNode.isProgram()) {
-            resultNode = functionNode.getResultNode(); // the eval result, symbol assigned in Attr
-        } else {
-            if (lastStatement != null && lastStatement.isTerminal() || lastStatement instanceof ReturnNode) {
-                return; //already in place or not needed, as it should be for a non-undefined returning function
-            }
-            resultNode = LiteralNode.newInstance(functionNode, ScriptRuntime.UNDEFINED);
+    private LoopNode checkEscape(final LoopNode loopNode) {
+        final LexicalContext lc = getLexicalContext();
+        final boolean escapes = controlFlowEscapes(lc, loopNode.getBody());
+        if (escapes) {
+            return loopNode.
+                setBody(lc, loopNode.getBody().setIsTerminal(lc, false)).
+                setControlFlowEscapes(lc, escapes);
         }
-
-        //create a return statement
-        final Node returnNode = new ReturnNode(functionNode.getSource(), functionNode.getLastToken(), functionNode.getFinish(), resultNode, null);
-        returnNode.accept(this);
+        return loopNode;
     }
 
 
-    private Node nest(final Node node) {
-        LOG.info("Nesting: " + node);
-        LOG.indent();
-        nesting.push(node);
-        return node;
-    }
-
-    private void unnest(final Node node) {
-        LOG.unindent();
-        assert nesting.getFirst() == node : "inconsistent nesting order : " + nesting.getFirst() + " != " + node;
-        LOG.info("Unnesting: " + nesting);
-        nesting.pop();
-    }
-
-    private static void setTerminal(final Node node, final boolean isTerminal) {
-        LOG.info("terminal = " + isTerminal + " for " + node);
-        node.setIsTerminal(isTerminal);
-    }
-
-    private static void setHasGoto(final Node node) { //, final boolean hasGoto) {
-        LOG.info("hasGoto = true for " + node);
-        node.setHasGoto();
-    }
-
-    private static void copyTerminal(final Node node, final Node sourceNode) {
-        LOG.info("copy terminal flags " + sourceNode + " -> " + node);
-        node.copyTerminalFlags(sourceNode);
-    }
-
-    private void addStatement(final Node statement, final boolean storeInLastStatement) {
-        LOG.info("add statement = " + statement + " (lastStatement = " + lastStatement + ")");
-        statements.add(statement);
-        if (storeInLastStatement) {
-            lastStatement = statement;
-        }
-    }
-
-    private void addStatement(final Node statement) {
-        addStatement(statement, true);
+    private Node addStatement(final Node statement) {
+        ((BlockLexicalContext)getLexicalContext()).appendStatement(statement);
+        return statement;
     }
 
     /**
-     * Determine if Try block is inside target block.
-     *
-     * @param tryNode Try node to test.
-     * @param target  Target block.
-     *
-     * @return true if try block is inside the target, false otherwise.
-     */
-    private boolean isNestedTry(final TryNode tryNode, final Block target) {
-        for(Iterator<Block> blocks = lexicalContext.getBlocks(getCurrentBlock()); blocks.hasNext();) {
-            final Block block = blocks.next();
-            if(block == target) {
-                return false;
-            }
-            if(tryNode.isChildBlock(block)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Clones the body of the try finallys up to the target block.
-     *
-     * @param node       first try node in the chain.
-     * @param targetNode target block of the break/continue statement or null for return
-     *
-     * @return true if terminates.
-     */
-    private boolean copyFinally(final TryNode node, final Node targetNode) {
-        Block target = null;
-
-        if (targetNode instanceof Block) {
-            target = (Block)targetNode;
-        }
-
-        for (TryNode tryNode = node; tryNode != null; tryNode = tryNode.getNext()) {
-            if (target != null && !isNestedTry(tryNode, target)) {
-                return false;
-            }
-
-            Block finallyBody = tryNode.getFinallyBody();
-            if (finallyBody == null) {
-                continue;
-            }
-
-            finallyBody = (Block)finallyBody.copy();
-            final boolean hasTerminalFlags = finallyBody.hasTerminalFlags();
-
-            new ExecuteNode(finallyBody.getSource(), finallyBody.getToken(), finallyBody.getFinish(), finallyBody).accept(this);
-
-            if (hasTerminalFlags) {
-                getCurrentBlock().copyTerminalFlags(finallyBody);
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    private Node enterBreakOrContinue(final LabeledNode labeledNode) {
-        final TryNode tryNode = labeledNode.getTryChain();
-        if (tryNode != null && copyFinally(tryNode, labeledNode.getTargetNode())) {
-            return null;
-        }
-        addStatement(labeledNode);
-        return null;
-    }
-
-
-    /**
      * An internal expression has a symbol that is tagged internal. Check if
      * this is such a node
      *
@@ -939,40 +637,21 @@
 
     /**
      * Is this an assignment to the special variable that hosts scripting eval
-     * results?
+     * results, i.e. __return__?
      *
      * @param expression expression to check whether it is $evalresult = X
      * @return true if an assignment to eval result, false otherwise
      */
-    private boolean isEvalResultAssignment(final Node expression) {
+    private static boolean isEvalResultAssignment(final Node expression) {
         Node e = expression;
-        if (e.tokenType() == TokenType.DISCARD) {
-            e = ((UnaryNode)expression).rhs();
-        }
-        final Node resultNode = getCurrentFunctionNode().getResultNode();
-        return e instanceof BinaryNode && ((BinaryNode)e).lhs().equals(resultNode);
-    }
-
-    /**
-     * Prepare special function nodes.
-     * TODO : only create those that are needed.
-     * TODO : make sure slot numbering is not hardcoded in {@link CompilerConstants} - now creation order is significant
-     */
-    private static void initFunctionNode(final FunctionNode functionNode) {
-        final Source source = functionNode.getSource();
-        final long token    = functionNode.getToken();
-        final int  finish   = functionNode.getFinish();
-
-        functionNode.setThisNode(new IdentNode(source, token, finish, THIS.tag()));
-        functionNode.setScopeNode(new IdentNode(source, token, finish, SCOPE.tag()));
-        functionNode.setResultNode(new IdentNode(source, token, finish, SCRIPT_RETURN.tag()));
-        functionNode.setCalleeNode(new IdentNode(source, token, finish, CALLEE.tag()));
-        if (functionNode.isVarArg()) {
-            functionNode.setVarArgsNode(new IdentNode(source, token, finish, VARARGS.tag()));
-            if (functionNode.needsArguments()) {
-                functionNode.setArgumentsNode(new IdentNode(source, token, finish, ARGUMENTS.tag()));
+        assert e.tokenType() != TokenType.DISCARD; //there are no discards this early anymore
+        if (e instanceof BinaryNode) {
+            final Node lhs = ((BinaryNode)e).lhs();
+            if (lhs instanceof IdentNode) {
+                return ((IdentNode)lhs).getName().equals(RETURN.symbolName());
             }
         }
+        return false;
     }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Wed May 08 10:10:05 2013 +0100
@@ -53,9 +53,12 @@
 import static jdk.internal.org.objectweb.asm.Opcodes.PUTFIELD;
 import static jdk.internal.org.objectweb.asm.Opcodes.PUTSTATIC;
 import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
+import static jdk.nashorn.internal.codegen.CompilerConstants.ARGUMENTS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.CONSTANTS;
+import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.THIS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.THIS_DEBUGGER;
+import static jdk.nashorn.internal.codegen.CompilerConstants.VARARGS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.className;
 import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup;
 import static jdk.nashorn.internal.codegen.CompilerConstants.methodDescriptor;
@@ -67,6 +70,7 @@
 import java.util.ArrayDeque;
 import java.util.EnumSet;
 import java.util.Iterator;
+import java.util.List;
 import jdk.internal.dynalink.support.NameCodec;
 import jdk.internal.org.objectweb.asm.Handle;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
@@ -79,14 +83,14 @@
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.IdentNode;
+import jdk.nashorn.internal.ir.LexicalContext;
 import jdk.nashorn.internal.ir.LiteralNode;
 import jdk.nashorn.internal.ir.RuntimeNode;
-import jdk.nashorn.internal.ir.SplitNode;
 import jdk.nashorn.internal.ir.Symbol;
 import jdk.nashorn.internal.runtime.ArgumentSetter;
+import jdk.nashorn.internal.runtime.Debug;
 import jdk.nashorn.internal.runtime.DebugLogger;
 import jdk.nashorn.internal.runtime.JSType;
-import jdk.nashorn.internal.runtime.Scope;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
@@ -116,10 +120,10 @@
     private final ClassEmitter classEmitter;
 
     /** FunctionNode representing this method, or null if none exists */
-    private FunctionNode functionNode;
+    protected FunctionNode functionNode;
 
-    /** SplitNode representing the current split, or null if none exists */
-    private SplitNode splitNode;
+    /** Check whether this emitter ever has a function return point */
+    private boolean hasReturn;
 
     /** The script environment */
     private final ScriptEnvironment env;
@@ -203,7 +207,7 @@
 
     @Override
     public String toString() {
-        return "methodEmitter: " + (functionNode == null ? method : functionNode.getName()).toString() + ' ' + stack;
+        return "methodEmitter: " + (functionNode == null ? method : functionNode.getName()).toString() + ' ' + Debug.id(this);
     }
 
     /**
@@ -476,8 +480,8 @@
 
         String name = symbol.getName();
 
-        if (name.equals(THIS.tag())) {
-            name = THIS_DEBUGGER.tag();
+        if (name.equals(THIS.symbolName())) {
+            name = THIS_DEBUGGER.symbolName();
         }
 
         method.visitLocalVariable(name, symbol.getSymbolType().getDescriptor(), null, start, end, symbol.getSlot());
@@ -654,7 +658,7 @@
      * @return this method emitter
      */
     MethodEmitter loadConstants() {
-        getStatic(classEmitter.getUnitClassName(), CONSTANTS.tag(), CONSTANTS.descriptor());
+        getStatic(classEmitter.getUnitClassName(), CONSTANTS.symbolName(), CONSTANTS.descriptor());
         assert peekType().isArray() : peekType();
         return this;
     }
@@ -669,7 +673,7 @@
      * @return the method emitter
      */
     MethodEmitter loadUndefined(final Type type) {
-        debug("load undefined " + type);
+        debug("load undefined ", type);
         pushType(type.loadUndefined(method));
         return this;
     }
@@ -681,7 +685,7 @@
      * @return the method emitter
      */
     MethodEmitter loadEmpty(final Type type) {
-        debug("load empty " + type);
+        debug("load empty ", type);
         pushType(type.loadEmpty(method));
         return this;
     }
@@ -814,7 +818,7 @@
     }
 
     /**
-     * Push an local variable to the stack. If the symbol representing
+     * Push a local variable to the stack. If the symbol representing
      * the local variable doesn't have a slot, this is a NOP
      *
      * @param symbol the symbol representing the local variable.
@@ -835,13 +839,13 @@
             if (functionNode.needsArguments()) {
                 // ScriptObject.getArgument(int) on arguments
                 debug("load symbol", symbol.getName(), " arguments index=", index);
-                loadArguments();
+                loadCompilerConstant(ARGUMENTS);
                 load(index);
                 ScriptObject.GET_ARGUMENT.invoke(this);
             } else {
                 // array load from __varargs__
                 debug("load symbol", symbol.getName(), " array index=", index);
-                loadVarArgs();
+                loadCompilerConstant(VARARGS);
                 load(symbol.getFieldIndex());
                 arrayload();
             }
@@ -870,48 +874,13 @@
         if(functionNode == null) {
             return slot == CompilerConstants.JAVA_THIS.slot();
         }
-        final int thisSlot = functionNode.getThisNode().getSymbol().getSlot();
+        final int thisSlot = compilerConstant(THIS).getSlot();
         assert !functionNode.needsCallee() || thisSlot == 1; // needsCallee -> thisSlot == 1
         assert functionNode.needsCallee() || thisSlot == 0; // !needsCallee -> thisSlot == 0
         return slot == thisSlot;
     }
 
     /**
-     * Push the this object to the stack.
-     *
-     * @return the method emitter
-     */
-    MethodEmitter loadThis() {
-        load(functionNode.getThisNode().getSymbol());
-        return this;
-    }
-
-    /**
-     * Push the scope object to the stack.
-     *
-     * @return the method emitter
-     */
-    MethodEmitter loadScope() {
-        if (peekType() == Type.SCOPE) {
-            dup();
-            return this;
-        }
-        load(functionNode.getScopeNode().getSymbol());
-        return this;
-    }
-
-    /**
-     * Push the return object to the stack.
-     *
-     * @return the method emitter
-     */
-    MethodEmitter loadResult() {
-        load(functionNode.getResultNode().getSymbol());
-        return this;
-    }
-
-
-    /**
      * Push a method handle to the stack
      *
      * @param className  class name
@@ -927,62 +896,33 @@
         return this;
     }
 
-    /**
-     * Push the varargs object to the stack
-     *
-     * @return the method emitter
-     */
-    MethodEmitter loadVarArgs() {
-        debug("load var args " + functionNode.getVarArgsNode().getSymbol());
-        return load(functionNode.getVarArgsNode().getSymbol());
-    }
-
-    /**
-     * Push the arguments array to the stack
-     *
-     * @return the method emitter
-     */
-    MethodEmitter loadArguments() {
-        debug("load arguments ", functionNode.getArgumentsNode().getSymbol());
-        assert functionNode.getArgumentsNode().getSymbol().getSlot() != 0;
-        return load(functionNode.getArgumentsNode().getSymbol());
+    private Symbol compilerConstant(final CompilerConstants cc) {
+        return functionNode.getBody().getExistingSymbol(cc.symbolName());
     }
 
     /**
-     * Push the callee object to the stack
-     *
-     * @return the method emitter
+     * True if this method has a slot allocated for the scope variable (meaning, something in the method actually needs
+     * the scope).
+     * @return if this method has a slot allocated for the scope variable.
      */
-    MethodEmitter loadCallee() {
-        final Symbol calleeSymbol = functionNode.getCalleeNode().getSymbol();
-        debug("load callee ", calleeSymbol);
-        assert calleeSymbol.getSlot() == 0 : "callee has wrong slot " + calleeSymbol.getSlot() + " in " + functionNode.getName();
-
-        return load(calleeSymbol);
+    boolean hasScope() {
+        return compilerConstant(SCOPE).hasSlot();
     }
 
-    /**
-     * Pop the scope from the stack and store it in its predefined slot
-     */
-    void storeScope() {
-        debug("store scope");
-        store(functionNode.getScopeNode().getSymbol());
+    MethodEmitter loadCompilerConstant(final CompilerConstants cc) {
+        final Symbol symbol = compilerConstant(cc);
+        if (cc == SCOPE && peekType() == Type.SCOPE) {
+            dup();
+            return this;
+        }
+        debug("load compiler constant ", symbol);
+        return load(symbol);
     }
 
-    /**
-     * Pop the return from the stack and store it in its predefined slot
-     */
-    void storeResult() {
-        debug("store result");
-        store(functionNode.getResultNode().getSymbol());
-    }
-
-    /**
-     * Pop the arguments array from the stack and store it in its predefined slot
-     */
-    void storeArguments() {
-        debug("store arguments");
-        store(functionNode.getArgumentsNode().getSymbol());
+    void storeCompilerConstant(final CompilerConstants cc) {
+        final Symbol symbol = compilerConstant(cc);
+        debug("store compiler constant ", symbol);
+        store(symbol);
     }
 
     /**
@@ -1030,13 +970,13 @@
             final int index = symbol.getFieldIndex();
             if (functionNode.needsArguments()) {
                 debug("store symbol", symbol.getName(), " arguments index=", index);
-                loadArguments();
+                loadCompilerConstant(ARGUMENTS);
                 load(index);
                 ArgumentSetter.SET_ARGUMENT.invoke(this);
             } else {
                 // varargs without arguments object - just do array store to __varargs__
                 debug("store symbol", symbol.getName(), " array index=", index);
-                loadVarArgs();
+                loadCompilerConstant(VARARGS);
                 load(index);
                 ArgumentSetter.SET_ARRAY_ELEMENT.invoke(this);
             }
@@ -1144,7 +1084,7 @@
      * @return the method emitter
      */
     MethodEmitter newarray(final ArrayType arrayType) {
-        debug("newarray ", "arrayType=" + arrayType);
+        debug("newarray ", "arrayType=", arrayType);
         popType(Type.INT); //LENGTH
         pushType(arrayType.newarray(method));
         return this;
@@ -1223,7 +1163,7 @@
      * @return the method emitter
      */
     MethodEmitter invokespecial(final String className, final String methodName, final String methodDescriptor) {
-        debug("invokespecial", className + "." + methodName + methodDescriptor);
+        debug("invokespecial", className, ".", methodName, methodDescriptor);
         return invoke(INVOKESPECIAL, className, methodName, methodDescriptor, true);
     }
 
@@ -1237,7 +1177,7 @@
      * @return the method emitter
      */
     MethodEmitter invokevirtual(final String className, final String methodName, final String methodDescriptor) {
-        debug("invokevirtual", className + "." + methodName + methodDescriptor + " " + stack);
+        debug("invokevirtual", className, ".", methodName, methodDescriptor, " ", stack);
         return invoke(INVOKEVIRTUAL, className, methodName, methodDescriptor, true);
     }
 
@@ -1251,7 +1191,7 @@
      * @return the method emitter
      */
     MethodEmitter invokestatic(final String className, final String methodName, final String methodDescriptor) {
-        debug("invokestatic", className + "." + methodName + methodDescriptor);
+        debug("invokestatic", className, ".", methodName, methodDescriptor);
         invoke(INVOKESTATIC, className, methodName, methodDescriptor, false);
         return this;
     }
@@ -1284,7 +1224,7 @@
      * @return the method emitter
      */
     MethodEmitter invokeinterface(final String className, final String methodName, final String methodDescriptor) {
-        debug("invokeinterface", className + "." + methodName + methodDescriptor);
+        debug("invokeinterface", className, ".", methodName, methodDescriptor);
         return invoke(INVOKEINTERFACE, className, methodName, methodDescriptor, true);
     }
 
@@ -1336,15 +1276,20 @@
      */
     void conditionalJump(final Condition cond, final boolean isCmpG, final Label trueLabel) {
         if (peekType().isCategory2()) {
-            debug("[ld]cmp isCmpG=" + isCmpG);
+            debug("[ld]cmp isCmpG=", isCmpG);
             pushType(get2n().cmp(method, isCmpG));
             jump(Condition.toUnary(cond), trueLabel, 1);
         } else {
-            debug("if" + cond);
+            debug("if", cond);
             jump(Condition.toBinary(cond, peekType().isObject()), trueLabel, 2);
         }
     }
 
+    MethodEmitter registerReturn() {
+        this.hasReturn = true;
+        return this;
+    }
+
     /**
      * Perform a non void return, popping the type from the stack
      *
@@ -1385,22 +1330,7 @@
      *
      * @param label destination label
      */
-    void splitAwareGoto(final Label label) {
-
-        if (splitNode != null) {
-            final int index = splitNode.getExternalTargets().indexOf(label);
-
-            if (index > -1) {
-                loadScope();
-                checkcast(Scope.class);
-                load(index + 1);
-                invoke(Scope.SET_SPLIT_STATE);
-                loadUndefined(Type.OBJECT);
-                _return(functionNode.getReturnType());
-                return;
-            }
-        }
-
+    void splitAwareGoto(final LexicalContext lc, final Label label) {
         _goto(label);
     }
 
@@ -1595,7 +1525,7 @@
      */
     private void mergeStackTo(final Label label) {
         final ArrayDeque<Type> labelStack = label.getStack();
-        //debug(labelStack == null ? " >> Control flow - first visit " + label : " >> Control flow - JOIN with " + labelStack + " at " + label);
+        //debug(labelStack == null ? " >> Control flow - first visit ", label : " >> Control flow - JOIN with ", labelStack, " at ", label);
         if (labelStack == null) {
             assert stack != null;
             label.setStack(stack.clone());
@@ -1788,7 +1718,7 @@
      * @return the method emitter
      */
     MethodEmitter dynamicNew(final int argCount, final int flags) {
-        debug("dynamic_new", "argcount=" + argCount);
+        debug("dynamic_new", "argcount=", argCount);
         final String signature = getDynamicSignature(Type.OBJECT, argCount);
         method.visitInvokeDynamicInsn("dyn:new", signature, LINKERBOOTSTRAP, flags);
         pushType(Type.OBJECT); //TODO fix result type
@@ -1805,7 +1735,7 @@
      * @return the method emitter
      */
     MethodEmitter dynamicCall(final Type returnType, final int argCount, final int flags) {
-        debug("dynamic_call", "args=" + argCount, "returnType=" + returnType);
+        debug("dynamic_call", "args=", argCount, "returnType=", returnType);
         final String signature = getDynamicSignature(returnType, argCount); // +1 because the function itself is the 1st parameter for dynamic calls (what you call - call target)
         debug("   signature", signature);
         method.visitInvokeDynamicInsn("dyn:call", signature, LINKERBOOTSTRAP, flags);
@@ -1824,7 +1754,7 @@
      * @return the method emitter
      */
     MethodEmitter dynamicRuntimeCall(final String name, final Type returnType, final RuntimeNode.Request request) {
-        debug("dynamic_runtime_call", name, "args=" + request.getArity(), "returnType=" + returnType);
+        debug("dynamic_runtime_call", name, "args=", request.getArity(), "returnType=", returnType);
         final String signature = getDynamicSignature(returnType, request.getArity());
         debug("   signature", signature);
         method.visitInvokeDynamicInsn(name, signature, RUNTIMEBOOTSTRAP);
@@ -1895,7 +1825,7 @@
      * @return the method emitter
      */
     MethodEmitter dynamicGetIndex(final Type result, final int flags, final boolean isMethod) {
-        debug("dynamic_get_index", peekType(1) + "[" + peekType() + "]");
+        debug("dynamic_get_index", peekType(1), "[", peekType(), "]");
 
         Type resultType = result;
         if (result.isBoolean()) {
@@ -1931,7 +1861,7 @@
      * @param flags call site flags for setter
      */
     void dynamicSetIndex(final int flags) {
-        debug("dynamic_set_index", peekType(2) + "[" + peekType(1) + "] =", peekType());
+        debug("dynamic_set_index", peekType(2), "[", peekType(1), "] =", peekType());
 
         Type value = peekType();
         if (value.isObject() || value.isBoolean()) {
@@ -2031,7 +1961,7 @@
      * @return the method emitter
      */
     MethodEmitter getField(final String className, final String fieldName, final String fieldDescriptor) {
-        debug("getfield", "receiver=" + peekType(), className + "." + fieldName + fieldDescriptor);
+        debug("getfield", "receiver=", peekType(), className, ".", fieldName, fieldDescriptor);
         final Type receiver = popType();
         assert receiver.isObject();
         method.visitFieldInsn(GETFIELD, className, fieldName, fieldDescriptor);
@@ -2049,7 +1979,7 @@
      * @return the method emitter
      */
     MethodEmitter getStatic(final String className, final String fieldName, final String fieldDescriptor) {
-        debug("getstatic", className + "." + fieldName + "." + fieldDescriptor);
+        debug("getstatic", className, ".", fieldName, ".", fieldDescriptor);
         method.visitFieldInsn(GETSTATIC, className, fieldName, fieldDescriptor);
         pushType(fieldType(fieldDescriptor));
         return this;
@@ -2063,7 +1993,7 @@
      * @param fieldDescriptor field descriptor
      */
     void putField(final String className, final String fieldName, final String fieldDescriptor) {
-        debug("putfield", "receiver=" + peekType(1), "value=" + peekType());
+        debug("putfield", "receiver=", peekType(1), "value=", peekType());
         popType(fieldType(fieldDescriptor));
         popType(Type.OBJECT);
         method.visitFieldInsn(PUTFIELD, className, fieldName, fieldDescriptor);
@@ -2077,7 +2007,7 @@
      * @param fieldDescriptor field descriptor
      */
     void putStatic(final String className, final String fieldName, final String fieldDescriptor) {
-        debug("putfield", "value=" + peekType());
+        debug("putfield", "value=", peekType());
         popType(fieldType(fieldDescriptor));
         method.visitFieldInsn(PUTSTATIC, className, fieldName, fieldDescriptor);
     }
@@ -2237,7 +2167,7 @@
             }
 
             if (env != null) { //early bootstrap code doesn't have inited context yet
-                LOG.info(sb.toString());
+                LOG.info(sb);
                 if (DEBUG_TRACE_LINE == linePrefix) {
                     new Throwable().printStackTrace(LOG.getOutputStream());
                 }
@@ -2254,21 +2184,12 @@
         this.functionNode = functionNode;
     }
 
-    /**
-     * Get the split node for this method emitter, if this is code
-     * generation due to splitting large methods
-     *
-     * @return split node
-     */
-    SplitNode getSplitNode() {
-        return splitNode;
+    boolean hasReturn() {
+        return hasReturn;
     }
 
-    /**
-     * Set the split node for this method emitter
-     * @param splitNode split node
-     */
-    void setSplitNode(final SplitNode splitNode) {
-        this.splitNode = splitNode;
+    List<Label> getExternalTargets() {
+        return null;
     }
+
 }
--- a/nashorn/src/jdk/nashorn/internal/codegen/Namespace.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Namespace.java	Wed May 08 10:10:05 2013 +0100
@@ -53,7 +53,7 @@
      */
     public Namespace(final Namespace parent) {
         this.parent    = parent;
-        directory = new HashMap<>();
+        this.directory = new HashMap<>();
     }
 
     /**
@@ -65,10 +65,6 @@
         return parent;
     }
 
-    private HashMap<String, Integer> getDirectory() {
-        return directory;
-    }
-
     /**
      * Create a uniqueName name in the namespace in the form base$n where n varies
      * .
@@ -78,7 +74,7 @@
      */
     public String uniqueName(final String base) {
         for (Namespace namespace = this; namespace != null; namespace = namespace.getParent()) {
-            final HashMap<String, Integer> namespaceDirectory = namespace.getDirectory();
+            final HashMap<String, Integer> namespaceDirectory = namespace.directory;
             final Integer                  counter            = namespaceDirectory.get(base);
 
             if (counter != null) {
--- a/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Wed May 08 10:10:05 2013 +0100
@@ -28,10 +28,10 @@
 import static jdk.nashorn.internal.codegen.Compiler.SCRIPTS_PACKAGE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.ALLOCATE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_ARGUMENTS;
+import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_MAP;
 import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_SCOPE;
 import static jdk.nashorn.internal.codegen.CompilerConstants.JAVA_THIS;
 import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_PREFIX;
-import static jdk.nashorn.internal.codegen.CompilerConstants.MAP;
 import static jdk.nashorn.internal.codegen.CompilerConstants.className;
 import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
@@ -204,8 +204,8 @@
      * @return The class name.
      */
     public static String getClassName(final int fieldCount) {
-        return fieldCount != 0 ? SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.tag() + fieldCount :
-                                 SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.tag();
+        return fieldCount != 0 ? SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName() + fieldCount :
+                                 SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName();
     }
 
     /**
@@ -218,7 +218,23 @@
      * @return The class name.
      */
     public static String getClassName(final int fieldCount, final int paramCount) {
-        return SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.tag() + fieldCount + SCOPE_MARKER + paramCount;
+        return SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName() + fieldCount + SCOPE_MARKER + paramCount;
+    }
+
+    /**
+     * Returns the number of fields in the JavaScript scope class. Its name had to be generated using either
+     * {@link #getClassName(int)} or {@link #getClassName(int, int)}.
+     * @param clazz the JavaScript scope class.
+     * @return the number of fields in the scope class.
+     */
+    public static int getFieldCount(Class<?> clazz) {
+        final String name = clazz.getSimpleName();
+        final String prefix = JS_OBJECT_PREFIX.symbolName();
+        if(prefix.equals(name)) {
+            return 0;
+        }
+        final int scopeMarker = name.indexOf(SCOPE_MARKER);
+        return Integer.parseInt(scopeMarker == -1 ? name.substring(prefix.length()) : name.substring(prefix.length(), scopeMarker));
     }
 
     /**
@@ -387,7 +403,7 @@
         final MethodEmitter init = classEmitter.init(PropertyMap.class);
         init.begin();
         init.load(Type.OBJECT, JAVA_THIS.slot());
-        init.load(Type.OBJECT, MAP.slot());
+        init.load(Type.OBJECT, INIT_MAP.slot());
         init.invoke(constructorNoLookup(ScriptObject.class, PropertyMap.class));
 
         return init;
@@ -402,7 +418,7 @@
         final MethodEmitter init = classEmitter.init(PropertyMap.class, ScriptObject.class);
         init.begin();
         init.load(Type.OBJECT, JAVA_THIS.slot());
-        init.load(Type.OBJECT, MAP.slot());
+        init.load(Type.OBJECT, INIT_MAP.slot());
         init.load(Type.OBJECT, INIT_SCOPE.slot());
         init.invoke(constructorNoLookup(FunctionScope.class, PropertyMap.class, ScriptObject.class));
 
@@ -418,7 +434,7 @@
         final MethodEmitter init = classEmitter.init(PropertyMap.class, ScriptObject.class, Object.class);
         init.begin();
         init.load(Type.OBJECT, JAVA_THIS.slot());
-        init.load(Type.OBJECT, MAP.slot());
+        init.load(Type.OBJECT, INIT_MAP.slot());
         init.load(Type.OBJECT, INIT_SCOPE.slot());
         init.load(Type.OBJECT, INIT_ARGUMENTS.slot());
         init.invoke(constructorNoLookup(FunctionScope.class, PropertyMap.class, ScriptObject.class, Object.class));
@@ -449,7 +465,7 @@
      * @param className    Name of JavaScript class.
      */
     private static void newAllocate(final ClassEmitter classEmitter, final String className) {
-        final MethodEmitter allocate = classEmitter.method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), ALLOCATE.tag(), ScriptObject.class, PropertyMap.class);
+        final MethodEmitter allocate = classEmitter.method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), ALLOCATE.symbolName(), ScriptObject.class, PropertyMap.class);
         allocate.begin();
         allocate._new(className);
         allocate.dup();
--- a/nashorn/src/jdk/nashorn/internal/codegen/ObjectCreator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/ObjectCreator.java	Wed May 08 10:10:05 2013 +0100
@@ -36,7 +36,7 @@
 public abstract class ObjectCreator {
 
     /** Compile unit for this ObjectCreator, see CompileUnit */
-    protected final CompileUnit   compileUnit;
+    //protected final CompileUnit   compileUnit;
 
     /** List of keys to initiate in this ObjectCreator */
     protected final List<String>  keys;
@@ -66,7 +66,6 @@
      */
     protected ObjectCreator(final CodeGenerator codegen, final List<String> keys, final List<Symbol> symbols, final boolean isScope, final boolean hasArguments) {
         this.codegen       = codegen;
-        this.compileUnit   = codegen.getCurrentCompileUnit();
         this.keys          = keys;
         this.symbols       = symbols;
         this.isScope       = isScope;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/codegen/SplitMethodEmitter.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.codegen;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
+
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.LexicalContext;
+import jdk.nashorn.internal.ir.SplitNode;
+import jdk.nashorn.internal.runtime.Scope;
+
+/**
+ * Emitter used for splitting methods. Needs to keep track of if there are jump targets
+ * outside the current split node. All external jump targets encountered at method
+ * emission are logged, and {@code CodeGenerator#leaveSplitNode(SplitNode)} creates
+ * an appropriate jump table when the SplitNode has been iterated through
+ */
+public class SplitMethodEmitter extends MethodEmitter {
+
+    private final SplitNode splitNode;
+
+    private final List<Label> externalTargets = new ArrayList<>();
+
+    SplitMethodEmitter(final ClassEmitter classEmitter, final MethodVisitor mv, SplitNode splitNode) {
+        super(classEmitter, mv);
+        this.splitNode = splitNode;
+    }
+
+    @Override
+    void splitAwareGoto(final LexicalContext lc, final Label label) {
+        assert splitNode != null;
+        final int index = findExternalTarget(lc, label);
+        if (index >= 0) {
+            loadCompilerConstant(SCOPE);
+            checkcast(Scope.class);
+            load(index + 1);
+            invoke(Scope.SET_SPLIT_STATE);
+            loadUndefined(Type.OBJECT);
+            _return(functionNode.getReturnType());
+            return;
+        }
+        super.splitAwareGoto(lc, label);
+    }
+
+    private int findExternalTarget(final LexicalContext lc, final Label label) {
+        final int index = externalTargets.indexOf(label);
+
+        if (index >= 0) {
+            return index;
+        }
+
+        if (lc.isExternalTarget(splitNode, label)) {
+             externalTargets.add(label);
+             return externalTargets.size() - 1;
+         }
+         return -1;
+    }
+
+    @Override
+    MethodEmitter registerReturn() {
+        super.registerReturn();
+        loadCompilerConstant(SCOPE);
+        checkcast(Scope.class);
+        load(0);
+        invoke(Scope.SET_SPLIT_STATE);
+        return this;
+    }
+
+    @Override
+    final List<Label> getExternalTargets() {
+        return externalTargets;
+    }
+}
--- a/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java	Wed May 08 10:10:05 2013 +0100
@@ -28,29 +28,18 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.SPLIT_PREFIX;
 
 import java.util.ArrayList;
-import java.util.Deque;
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import jdk.nashorn.internal.ir.Block;
-import jdk.nashorn.internal.ir.BreakNode;
-import jdk.nashorn.internal.ir.ContinueNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
-import jdk.nashorn.internal.ir.ForNode;
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
-import jdk.nashorn.internal.ir.LabelNode;
 import jdk.nashorn.internal.ir.LexicalContext;
 import jdk.nashorn.internal.ir.LiteralNode;
 import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
 import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode.ArrayUnit;
 import jdk.nashorn.internal.ir.Node;
-import jdk.nashorn.internal.ir.ReturnNode;
 import jdk.nashorn.internal.ir.SplitNode;
-import jdk.nashorn.internal.ir.SwitchNode;
-import jdk.nashorn.internal.ir.WhileNode;
-import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.DebugLogger;
 import jdk.nashorn.internal.runtime.Source;
@@ -64,7 +53,7 @@
     private final Compiler compiler;
 
     /** IR to be broken down. */
-    private final FunctionNode functionNode;
+    private FunctionNode outermost;
 
     /** Compile unit for the main script. */
     private final CompileUnit outermostCompileUnit;
@@ -72,8 +61,6 @@
     /** Cache for calculated block weights. */
     private final Map<Node, Long> weightCache = new HashMap<>();
 
-    private final LexicalContext lexicalContext = new LexicalContext();
-
     /** Weight threshold for when to start a split. */
     public static final long SPLIT_THRESHOLD = Options.getIntProperty("nashorn.compiler.splitter.threshold", 32 * 1024);
 
@@ -88,70 +75,92 @@
      */
     public Splitter(final Compiler compiler, final FunctionNode functionNode, final CompileUnit outermostCompileUnit) {
         this.compiler             = compiler;
-        this.functionNode         = functionNode;
+        this.outermost = functionNode;
         this.outermostCompileUnit = outermostCompileUnit;
     }
 
     /**
      * Execute the split
      */
-    void split() {
+    FunctionNode split(final FunctionNode fn) {
+        FunctionNode functionNode = fn;
+
         if (functionNode.isLazy()) {
-            LOG.finest("Postponing split of '" + functionNode.getName() + "' as it's lazy");
-            return;
+            LOG.finest("Postponing split of '", functionNode.getName(), "' as it's lazy");
+            return functionNode;
         }
 
-        LOG.finest("Initiating split of '" + functionNode.getName() + "'");
+        LOG.finest("Initiating split of '", functionNode.getName(), "'");
+
+        final LexicalContext lc = getLexicalContext();
 
         long weight = WeighNodes.weigh(functionNode);
+        final boolean top = compiler.getFunctionNode() == outermost;
 
         if (weight >= SPLIT_THRESHOLD) {
-            LOG.finest("Splitting '" + functionNode.getName() + "' as its weight " + weight + " exceeds split threshold " + SPLIT_THRESHOLD);
-
-            functionNode.accept(this);
+            LOG.finest("Splitting '", functionNode.getName(), "' as its weight ", weight, " exceeds split threshold ", SPLIT_THRESHOLD);
+            functionNode = (FunctionNode)functionNode.accept(this);
 
             if (functionNode.isSplit()) {
                 // Weight has changed so weigh again, this time using block weight cache
                 weight = WeighNodes.weigh(functionNode, weightCache);
+                functionNode = functionNode.setBody(lc, functionNode.getBody().setNeedsScope(lc));
             }
 
             if (weight >= SPLIT_THRESHOLD) {
-                weight = splitBlock(functionNode, functionNode);
-            }
-
-            if (functionNode.isSplit()) {
-                functionNode.accept(new SplitFlowAnalyzer());
+                functionNode = functionNode.setBody(lc, splitBlock(functionNode.getBody(), functionNode));
+                weight = WeighNodes.weigh(functionNode.getBody(), weightCache);
             }
         }
 
-        assert functionNode.getCompileUnit() == null : "compile unit already set";
+        assert functionNode.getCompileUnit() == null : "compile unit already set for " + functionNode.getName();
 
-        if (compiler.getFunctionNode() == functionNode) { //functionNode.isScript()) {
+        if (top) {
             assert outermostCompileUnit != null : "outermost compile unit is null";
-
-            functionNode.setCompileUnit(outermostCompileUnit);
+            functionNode = functionNode.setCompileUnit(lc, outermostCompileUnit);
             outermostCompileUnit.addWeight(weight + WeighNodes.FUNCTION_WEIGHT);
         } else {
-            functionNode.setCompileUnit(findUnit(weight));
+            functionNode = functionNode.setCompileUnit(lc, findUnit(weight));
         }
 
-        // Recursively split nested functions
-        functionNode.accept(new NodeOperatorVisitor() {
+        final Block body = functionNode.getBody();
+        final List<FunctionNode> dc = directChildren(functionNode);
+
+        final Block newBody = (Block)body.accept(new NodeVisitor() {
+                @Override
+                public boolean enterFunctionNode(final FunctionNode nestedFunction) {
+                    return dc.contains(nestedFunction);
+                }
+
+                @Override
+                public Node leaveFunctionNode(final FunctionNode nestedFunction) {
+                    FunctionNode split = new Splitter(compiler, nestedFunction, outermostCompileUnit).split(nestedFunction);
+                    getLexicalContext().replace(nestedFunction, split);
+                    return split;
+                }
+            });
+        functionNode = functionNode.setBody(lc, newBody);
+
+        assert functionNode.getCompileUnit() != null;
+
+        return functionNode.setState(lc, CompilationState.SPLIT);
+    }
+
+    private static List<FunctionNode> directChildren(final FunctionNode functionNode) {
+        final List<FunctionNode> dc = new ArrayList<>();
+        functionNode.accept(new NodeVisitor() {
             @Override
-            public Node enterFunctionNode(FunctionNode function) {
-                if(function == functionNode) {
-                    // Don't process outermost function (it was already processed) but descend into it to find nested
-                    // functions.
-                    return function;
+            public boolean enterFunctionNode(final FunctionNode child) {
+                if (child == functionNode) {
+                    return true;
                 }
-                // Process a nested function
-                new Splitter(compiler, function, outermostCompileUnit).split();
-                // Don't descend into a a nested function; Splitter.split() has taken care of nested-in-nested functions.
-                return null;
+                if (getLexicalContext().getParentFunction(child) == functionNode) {
+                    dc.add(child);
+                }
+                return false;
             }
         });
-
-        functionNode.setState(CompilationState.SPLIT);
+        return dc;
     }
 
     /**
@@ -170,8 +179,8 @@
      *
      * @return new weight for the resulting block.
      */
-    private long splitBlock(final Block block, final FunctionNode function) {
-        functionNode.setIsSplit();
+    private Block splitBlock(final Block block, final FunctionNode function) {
+        getLexicalContext().setFlag(getLexicalContext().getCurrentFunction(), FunctionNode.IS_SPLIT);
 
         final List<Node> splits = new ArrayList<>();
         List<Node> statements = new ArrayList<>();
@@ -186,7 +195,6 @@
                     statements = new ArrayList<>();
                     statementsWeight = 0;
                 }
-
             }
 
             if (statement.isTerminal()) {
@@ -201,9 +209,7 @@
             splits.add(createBlockSplitNode(block, function, statements, statementsWeight));
         }
 
-        block.setStatements(splits);
-
-        return WeighNodes.weigh(block, weightCache);
+        return block.setStatements(getLexicalContext(), splits);
     }
 
     /**
@@ -218,51 +224,44 @@
         final Source source = parent.getSource();
         final long   token  = parent.getToken();
         final int    finish = parent.getFinish();
-        final String name   = function.uniqueName(SPLIT_PREFIX.tag());
-
-        final Block newBlock = new Block(source, token, finish);
-        newBlock.setFrame(new Frame(parent.getFrame()));
-        newBlock.setStatements(statements);
+        final String name   = function.uniqueName(SPLIT_PREFIX.symbolName());
 
-        final SplitNode splitNode = new SplitNode(name, functionNode, newBlock);
+        final Block newBlock = new Block(source, token, finish, statements);
 
-        splitNode.setCompileUnit(compiler.findUnit(weight + WeighNodes.FUNCTION_WEIGHT));
-
-        return splitNode;
+        return new SplitNode(name, newBlock, compiler.findUnit(weight + WeighNodes.FUNCTION_WEIGHT));
     }
 
     @Override
-    public Node enterBlock(final Block block) {
+    public boolean enterBlock(final Block block) {
         if (block.isCatchBlock()) {
-            return null;
+            return false;
         }
-        lexicalContext.push(block);
 
         final long weight = WeighNodes.weigh(block, weightCache);
 
         if (weight < SPLIT_THRESHOLD) {
             weightCache.put(block, weight);
-            lexicalContext.pop(block);
-            return null;
+            return false;
         }
 
-        return block;
+        return true;
     }
 
     @Override
     public Node leaveBlock(final Block block) {
         assert !block.isCatchBlock();
 
+        Block newBlock = block;
+
         // Block was heavier than SLIT_THRESHOLD in enter, but a sub-block may have
         // been split already, so weigh again before splitting.
         long weight = WeighNodes.weigh(block, weightCache);
         if (weight >= SPLIT_THRESHOLD) {
-            weight = splitBlock(block, lexicalContext.getFunction(block));
+            newBlock = splitBlock(block, getLexicalContext().getFunction(block));
+            weight   = WeighNodes.weigh(newBlock, weightCache);
         }
-        weightCache.put(block, weight);
-
-        lexicalContext.pop(block);
-        return block;
+        weightCache.put(newBlock, weight);
+        return newBlock;
     }
 
     @SuppressWarnings("rawtypes")
@@ -274,7 +273,7 @@
             return literal;
         }
 
-        functionNode.setIsSplit();
+        getLexicalContext().setFlag(getLexicalContext().getCurrentFunction(), FunctionNode.IS_SPLIT);
 
         if (literal instanceof ArrayLiteralNode) {
             final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode) literal;
@@ -312,123 +311,12 @@
     }
 
     @Override
-    public Node enterFunctionNode(final FunctionNode node) {
-        if(node == functionNode && !node.isLazy()) {
-            lexicalContext.push(node);
-            node.visitStatements(this);
-            lexicalContext.pop(node);
-        }
-        return null;
-    }
-
-    static class SplitFlowAnalyzer extends NodeVisitor {
-
-        /** Stack of visited Split nodes, deepest node first. */
-        private final Deque<SplitNode> splitStack;
-
-        /** Map of possible jump targets to containing split node */
-        private final Map<Node,SplitNode> targetNodes = new HashMap<>();
-
-        SplitFlowAnalyzer() {
-            this.splitStack = new LinkedList<>();
-        }
-
-        @Override
-        public Node enterLabelNode(final LabelNode labelNode) {
-            registerJumpTarget(labelNode.getBreakNode());
-            registerJumpTarget(labelNode.getContinueNode());
-            return labelNode;
-        }
-
-        @Override
-        public Node enterWhileNode(final WhileNode whileNode) {
-            registerJumpTarget(whileNode);
-            return whileNode;
-        }
-
-        @Override
-        public Node enterDoWhileNode(final DoWhileNode doWhileNode) {
-            registerJumpTarget(doWhileNode);
-            return doWhileNode;
-        }
-
-        @Override
-        public Node enterForNode(final ForNode forNode) {
-            registerJumpTarget(forNode);
-            return forNode;
-        }
-
-        @Override
-        public Node enterSwitchNode(final SwitchNode switchNode) {
-            registerJumpTarget(switchNode);
-            return switchNode;
-        }
-
-        @Override
-        public Node enterReturnNode(final ReturnNode returnNode) {
-            for (final SplitNode split : splitStack) {
-                split.setHasReturn(true);
-            }
-            return returnNode;
+    public boolean enterFunctionNode(final FunctionNode node) {
+        //only go into the function node for this splitter. any subfunctions are rejected
+        if (node == outermost && !node.isLazy()) {
+            return true;
         }
-
-        @Override
-        public Node enterContinueNode(final ContinueNode continueNode) {
-            searchJumpTarget(continueNode.getTargetNode(), continueNode.getTargetLabel());
-            return continueNode;
-        }
-
-        @Override
-        public Node enterBreakNode(final BreakNode breakNode) {
-            searchJumpTarget(breakNode.getTargetNode(), breakNode.getTargetLabel());
-            return breakNode;
-        }
-
-        @Override
-        public Node enterSplitNode(final SplitNode splitNode) {
-            splitStack.addFirst(splitNode);
-            return splitNode;
-        }
-
-        @Override
-        public Node leaveSplitNode(final SplitNode splitNode) {
-            assert splitNode == splitStack.peekFirst();
-            splitStack.removeFirst();
-            return splitNode;
-        }
-
-        /**
-         * Register the split node containing a potential jump target.
-         * @param targetNode a potential target node.
-         */
-        private void registerJumpTarget(final Node targetNode) {
-            final SplitNode splitNode = splitStack.peekFirst();
-            if (splitNode != null) {
-                targetNodes.put(targetNode, splitNode);
-            }
-        }
-
-        /**
-         * Check if a jump target is outside the current split node and its parent split nodes.
-         * @param targetNode the jump target node.
-         * @param targetLabel the jump target label.
-         */
-        private void searchJumpTarget(final Node targetNode, final Label targetLabel) {
-
-            final SplitNode targetSplit = targetNodes.get(targetNode);
-            // Note that targetSplit may be null, indicating that targetNode is in top level method.
-            // In this case we have to add the external jump target to all split nodes.
-
-            for (final SplitNode split : splitStack) {
-                if (split == targetSplit) {
-                    break;
-                }
-                final List<Label> externalTargets = split.getExternalTargets();
-                if (!externalTargets.contains(targetLabel)) {
-                    split.addExternalTarget(targetLabel);
-                }
-            }
-        }
+        return false;
     }
 }
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java	Wed May 08 10:10:05 2013 +0100
@@ -35,7 +35,6 @@
 import jdk.nashorn.internal.ir.CallNode;
 import jdk.nashorn.internal.ir.CatchNode;
 import jdk.nashorn.internal.ir.ContinueNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
 import jdk.nashorn.internal.ir.ExecuteNode;
 import jdk.nashorn.internal.ir.ForNode;
 import jdk.nashorn.internal.ir.FunctionNode;
@@ -101,7 +100,7 @@
      * @param weightCache cache of already calculated block weights
      */
     private WeighNodes(FunctionNode topFunction, final Map<Node, Long> weightCache) {
-        super(null, null);
+        super();
         this.topFunction = topFunction;
         this.weightCache = weightCache;
     }
@@ -123,13 +122,13 @@
     }
 
     @Override
-    public Node enterBlock(final Block block) {
+    public boolean enterBlock(final Block block) {
         if (weightCache != null && weightCache.containsKey(block)) {
             weight += weightCache.get(block);
-            return null;
+            return false;
         }
 
-        return block;
+        return true;
     }
 
     @Override
@@ -157,12 +156,6 @@
     }
 
     @Override
-    public Node leaveDoWhileNode(final DoWhileNode doWhileNode) {
-        weight += LOOP_WEIGHT;
-        return doWhileNode;
-    }
-
-    @Override
     public Node leaveExecuteNode(final ExecuteNode executeNode) {
         return executeNode;
     }
@@ -174,15 +167,15 @@
     }
 
     @Override
-    public Node enterFunctionNode(final FunctionNode functionNode) {
-        if(functionNode == topFunction) {
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
+        if (functionNode == topFunction) {
             // the function being weighted; descend into its statements
-            functionNode.visitStatements(this);
-        } else {
-            // just a reference to inner function from outer function
-            weight += FUNC_EXPR_WEIGHT;
+            return true;
+//            functionNode.visitStatements(this);
         }
-        return null;
+        // just a reference to inner function from outer function
+        weight += FUNC_EXPR_WEIGHT;
+        return false;
     }
 
     @Override
@@ -205,7 +198,7 @@
 
     @SuppressWarnings("rawtypes")
     @Override
-    public Node enterLiteralNode(final LiteralNode literalNode) {
+    public boolean enterLiteralNode(final LiteralNode literalNode) {
         weight += LITERAL_WEIGHT;
 
         if (literalNode instanceof ArrayLiteralNode) {
@@ -224,10 +217,10 @@
                 }
             }
 
-            return null;
+            return false;
         }
 
-        return literalNode;
+        return true;
     }
 
     @Override
@@ -249,9 +242,9 @@
     }
 
     @Override
-    public Node enterSplitNode(final SplitNode splitNode) {
+    public boolean enterSplitNode(final SplitNode splitNode) {
         weight += SPLIT_WEIGHT;
-        return null;
+        return false;
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/BooleanType.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/BooleanType.java	Wed May 08 10:10:05 2013 +0100
@@ -93,12 +93,6 @@
     }
 
     @Override
-    public Type loadEmpty(final MethodVisitor method) {
-        assert false : "unsupported operation";
-        return null;
-    }
-
-    @Override
     public void _return(final MethodVisitor method) {
         method.visitInsn(IRETURN);
     }
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/IntType.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/IntType.java	Wed May 08 10:10:05 2013 +0100
@@ -241,12 +241,6 @@
     }
 
     @Override
-    public Type loadEmpty(final MethodVisitor method) {
-        assert false : "unsupported operation";
-        return null;
-    }
-
-    @Override
     public Type cmp(final MethodVisitor method, final boolean isCmpG) {
         assert false : "unsupported operation";
         return null;
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/LongType.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/LongType.java	Wed May 08 10:10:05 2013 +0100
@@ -217,12 +217,6 @@
     }
 
     @Override
-    public Type loadEmpty(final MethodVisitor method) {
-        assert false : "unsupported operation";
-        return null;
-    }
-
-    @Override
     public Type cmp(final MethodVisitor method, final boolean isCmpG) {
         return cmp(method);
     }
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/NumberType.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/NumberType.java	Wed May 08 10:10:05 2013 +0100
@@ -89,12 +89,6 @@
     }
 
     @Override
-    public Type loadEmpty(final MethodVisitor method) {
-        assert false : "unsupported operation";
-        return null;
-    }
-
-    @Override
     public Type ldc(final MethodVisitor method, final Object c) {
         assert c instanceof Double;
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java	Wed May 08 10:10:05 2013 +0100
@@ -616,6 +616,12 @@
         return this;
     }
 
+    @Override
+    public Type loadEmpty(final MethodVisitor method) {
+        assert false : "unsupported operation";
+        return null;
+    }
+
     /**
      * Superclass logic for pop for all types
      *
@@ -663,7 +669,6 @@
                 method.visitInsn(SWAP);
             }
         }
-
     }
 
     /**
@@ -841,12 +846,6 @@
         }
 
         @Override
-        public Type loadEmpty(final MethodVisitor method) {
-            assert false : "unsupported operation";
-            return null;
-        }
-
-        @Override
         public Type convert(final MethodVisitor method, final Type to) {
             assert false : "unsupported operation";
             return null;
--- a/nashorn/src/jdk/nashorn/internal/ir/AccessNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/AccessNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,23 +25,18 @@
 
 package jdk.nashorn.internal.ir;
 
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.DEBUG_FIELDS;
-
-import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation of a property access (period operator.)
- *
  */
-public class AccessNode extends BaseNode implements TypeOverride<AccessNode> {
+@Immutable
+public final class AccessNode extends BaseNode {
     /** Property ident. */
-    private IdentNode property;
-
-    /** Does this node have a type override */
-    private boolean hasCallSiteType;
+    private final IdentNode property;
 
     /**
      * Constructor
@@ -53,49 +48,13 @@
      * @param property  property
      */
     public AccessNode(final Source source, final long token, final int finish, final Node base, final IdentNode property) {
-        super(source, token, finish, base);
-
-        this.start    = base.getStart();
+        super(source, token, finish, base, false, false);
         this.property = property.setIsPropertyName();
     }
 
-    /**
-     * Copy constructor
-     *
-     * @param accessNode  source node
-     */
-    public AccessNode(final AccessNode accessNode) {
-        this(accessNode, new CopyState());
-    }
-
-    /**
-     * Internal copy constructor
-     *
-     * @param accessNode  source node
-     * @param cs          copy state
-     */
-    protected AccessNode(final AccessNode accessNode, final CopyState cs) {
-        super(accessNode, cs);
-        this.property = (IdentNode)cs.existingOrCopy(accessNode.getProperty());
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new AccessNode(this, cs);
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-        if (!super.equals(other)) {
-            return false;
-        }
-        final AccessNode accessNode = (AccessNode)other;
-        return property.equals(accessNode.getProperty());
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode() ^ property.hashCode();
+    private AccessNode(final AccessNode accessNode, final Node base, final IdentNode property, final boolean isFunction, final boolean hasCallSiteType) {
+        super(accessNode, base, isFunction, hasCallSiteType);
+        this.property = property;
     }
 
     /**
@@ -104,12 +63,11 @@
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterAccessNode(this) != null) {
-            base = base.accept(visitor);
-            property = (IdentNode)property.accept(visitor);
-            return visitor.leaveAccessNode(this);
+        if (visitor.enterAccessNode(this)) {
+            return visitor.leaveAccessNode(
+                setBase(base.accept(visitor)).
+                setProperty((IdentNode)property.accept(visitor)));
         }
-
         return this;
     }
 
@@ -117,7 +75,7 @@
     public void toString(final StringBuilder sb) {
         final boolean needsParen = tokenType().needsParens(getBase().tokenType(), true);
 
-        if (hasCallSiteType) {
+        if (hasCallSiteType()) {
             sb.append('{');
             final String desc = getType().getDescriptor();
             sb.append(desc.charAt(desc.length() - 1) == ';' ? "O" : getType().getDescriptor());
@@ -147,19 +105,34 @@
         return property;
     }
 
-    @Override
-    public AccessNode setType(final Type type) {
-        if (DEBUG_FIELDS && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
-            ObjectClassGenerator.LOG.info(getClass().getName() + " " + this + " => " + type + " instead of " + getType());
+    private AccessNode setBase(final Node base) {
+        if (this.base == base) {
+            return this;
         }
-        property = property.setType(type);
-        getSymbol().setTypeOverride(type); //always a temp so this is fine.
-        hasCallSiteType = true;
-        return this;
+        return new AccessNode(this, base, property, isFunction(), hasCallSiteType());
+    }
+
+
+    private AccessNode setProperty(final IdentNode property) {
+        if (this.property == property) {
+            return this;
+        }
+        return new AccessNode(this, base, property, isFunction(), hasCallSiteType());
     }
 
     @Override
-    public boolean canHaveCallSiteType() {
-        return true; //carried by the symbol and always the same nodetype==symboltype
+    public AccessNode setType(final Type type) {
+        logTypeChange(type);
+        getSymbol().setTypeOverride(type); //always a temp so this is fine.
+        return new AccessNode(this, base, property.setType(type), isFunction(), hasCallSiteType());
     }
+
+    @Override
+    public BaseNode setIsFunction() {
+        if (isFunction()) {
+            return this;
+        }
+        return new AccessNode(this, base, property, true, hasCallSiteType());
+    }
+
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/BaseNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/BaseNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,6 +25,10 @@
 
 package jdk.nashorn.internal.ir;
 
+import static jdk.nashorn.internal.codegen.ObjectClassGenerator.DEBUG_FIELDS;
+import jdk.nashorn.internal.codegen.ObjectClassGenerator;
+import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
@@ -33,12 +37,15 @@
  * @see AccessNode
  * @see IndexNode
  */
-public abstract class BaseNode extends Node implements FunctionCall {
+@Immutable
+public abstract class BaseNode extends Node implements FunctionCall, TypeOverride<BaseNode> {
 
     /** Base Node. */
-    protected Node base;
+    protected final Node base;
 
-    private boolean function;
+    private final boolean isFunction;
+
+    private final boolean hasCallSiteType;
 
     /**
      * Constructor
@@ -47,37 +54,28 @@
      * @param token  token
      * @param finish finish
      * @param base   base node
+     * @param isFunction is this a function
+     * @param hasCallSiteType does this access have a callsite type
      */
-    public BaseNode(final Source source, final long token, final int finish, final Node base) {
-        super(source, token, finish);
-        this.base = base;
-        setStart(base.getStart());
+    public BaseNode(final Source source, final long token, final int finish, final Node base, final boolean isFunction, final boolean hasCallSiteType) {
+        super(source, token, base.getStart(), finish);
+        this.base            = base;
+        this.isFunction      = isFunction;
+        this.hasCallSiteType = hasCallSiteType;
     }
 
     /**
-     * Copy constructor
-     *
-     * @param baseNode the base node
-     * @param cs       a copy state
+     * Copy constructor for immutable nodes
+     * @param baseNode node to inherit from
+     * @param base base
+     * @param isFunction is this a function
+     * @param hasCallSiteType does this access have a callsite type
      */
-    protected BaseNode(final BaseNode baseNode, final CopyState cs) {
+    protected BaseNode(final BaseNode baseNode, final Node base, final boolean isFunction, final boolean hasCallSiteType) {
         super(baseNode);
-        this.base = cs.existingOrCopy(baseNode.getBase());
-        setStart(base.getStart());
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-        if (!super.equals(other)) {
-            return false;
-        }
-        final BaseNode baseNode = (BaseNode)other;
-        return base.equals(baseNode.getBase());
-    }
-
-    @Override
-    public int hashCode() {
-        return base.hashCode();
+        this.base            = base;
+        this.isFunction      = isFunction;
+        this.hasCallSiteType = hasCallSiteType;
     }
 
     /**
@@ -88,25 +86,37 @@
         return base;
     }
 
-    /**
-     * Reset the base node for this access
-     * @param base new base node
-     */
-    public void setBase(final Node base) {
-        this.base = base;
-    }
-
     @Override
     public boolean isFunction() {
-        return function;
+        return isFunction;
     }
 
     /**
      * Mark this node as being the callee operand of a {@link CallNode}.
      * @return a base node identical to this one in all aspects except with its function flag set.
      */
-    public BaseNode setIsFunction() {
-        function = true;
-        return this;
+    public abstract BaseNode setIsFunction();
+
+    @Override
+    public boolean canHaveCallSiteType() {
+        return true; //carried by the symbol and always the same nodetype==symboltype
+    }
+
+    /**
+     * Does the access have a call site type override?
+     * @return true if overridden
+     */
+    protected boolean hasCallSiteType() {
+        return hasCallSiteType;
+    }
+
+    /**
+     * Debug type change
+     * @param type new type
+     */
+    protected final void logTypeChange(final Type type) {
+        if (DEBUG_FIELDS && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
+            ObjectClassGenerator.LOG.info(getClass().getName(), " ", this, " => ", type, " instead of ", getType());
+        }
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/BinaryNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/BinaryNode.java	Wed May 08 10:10:05 2013 +0100
@@ -26,6 +26,7 @@
 package jdk.nashorn.internal.ir;
 
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.Source;
@@ -33,9 +34,12 @@
 /**
  * BinaryNode nodes represent two operand operations.
  */
-public class BinaryNode extends UnaryNode {
+@Immutable
+public final class BinaryNode extends Node implements Assignment<Node> {
     /** Left hand side argument. */
-    private Node lhs;
+    private final Node lhs;
+
+    private final Node rhs;
 
     /**
      * Constructor
@@ -46,28 +50,15 @@
      * @param rhs    right hand side
      */
     public BinaryNode(final Source source, final long token, final Node lhs, final Node rhs) {
-        super(source, token, rhs);
-
-        start  = lhs.getStart();
-        finish = rhs.getFinish();
-
-        this.lhs = lhs;
+        super(source, token, lhs.getStart(), rhs.getFinish());
+        this.lhs   = lhs;
+        this.rhs   = rhs;
     }
 
-    /**
-     * Copy constructor
-     *
-     * @param binaryNode the binary node
-     * @param cs         copy state
-     */
-    protected BinaryNode(final BinaryNode binaryNode, final CopyState cs) {
-        super(binaryNode, cs);
-        lhs = cs.existingOrCopy(binaryNode.lhs);
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new BinaryNode(this, cs);
+    private BinaryNode(final BinaryNode binaryNode, final Node lhs, final Node rhs) {
+        super(binaryNode);
+        this.lhs = lhs;
+        this.rhs = rhs;
     }
 
     /**
@@ -149,28 +140,14 @@
         return rhs();
     }
 
-    @Override
-    public boolean equals(final Object other) {
-        if (!super.equals(other)) {
-            return false;
-        }
-        return lhs.equals(((BinaryNode)other).lhs());
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode() ^ lhs().hashCode();
-    }
-
     /**
      * Assist in IR navigation.
      * @param visitor IR navigating visitor.
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterBinaryNode(this) != null) {
-            // TODO: good cause for a separate visitMembers: we could delegate to UnaryNode.visitMembers
-            return visitor.leaveBinaryNode((BinaryNode)setLHS(lhs.accept(visitor)).setRHS(rhs().accept(visitor)));
+        if (visitor.enterBinaryNode(this)) {
+            return visitor.leaveBinaryNode(setLHS(lhs.accept(visitor)).setRHS(rhs.accept(visitor)));
         }
 
         return this;
@@ -231,14 +208,35 @@
     }
 
     /**
+     * Get the right hand side expression for this node
+     * @return the left hand side expression
+     */
+    public Node rhs() {
+        return rhs;
+    }
+
+    /**
      * Set the left hand side expression for this node
      * @param lhs new left hand side expression
      * @return a node equivalent to this one except for the requested change.
      */
     public BinaryNode setLHS(final Node lhs) {
-        if(this.lhs == lhs) return this;
-        final BinaryNode n = (BinaryNode)clone();
-        n.lhs = lhs;
-        return n;
+        if (this.lhs == lhs) {
+            return this;
+        }
+        return new BinaryNode(this, lhs, rhs);
     }
+
+    /**
+     * Set the right hand side expression for this node
+     * @param rhs new left hand side expression
+     * @return a node equivalent to this one except for the requested change.
+     */
+    public BinaryNode setRHS(final Node rhs) {
+        if (this.rhs == rhs) {
+            return this;
+        }
+        return new BinaryNode(this, lhs, rhs);
+    }
+
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/Block.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/Block.java	Wed May 08 10:10:05 2013 +0100
@@ -27,14 +27,15 @@
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
-import java.util.ListIterator;
-import jdk.nashorn.internal.codegen.Frame;
+import java.util.Map;
 import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
@@ -42,97 +43,79 @@
  * IR representation for a list of statements and functions. All provides the
  * basis for script body.
  */
-public class Block extends Node {
+@Immutable
+public class Block extends BreakableNode implements Flags<Block> {
     /** List of statements */
-    protected List<Node> statements;
+    protected final List<Node> statements;
 
-    /** Symbol table. */
-    protected final HashMap<String, Symbol> symbols;
-
-    /** Variable frame. */
-    protected Frame frame;
+    /** Symbol table - keys must be returned in the order they were put in. */
+    protected final Map<String, Symbol> symbols;
 
     /** Entry label. */
     protected final Label entryLabel;
 
-    /** Break label. */
-    protected final Label breakLabel;
+    /** Does the block/function need a new scope? */
+    protected final int flags;
+
+    /** Flag indicating that this block needs scope */
+    public static final int NEEDS_SCOPE = 1 << 0;
 
-    /** Does the block/function need a new scope? */
-    protected boolean needsScope;
+    /**
+     * Flag indicating whether this block needs
+     * self symbol assignment at the start. This is used only for
+     * blocks that are the bodies of function nodes who refer to themselves
+     * by name. It causes codegen to insert a var [fn_name] = __callee__
+     * at the start of the body
+     */
+    public static final int NEEDS_SELF_SYMBOL = 1 << 1;
+
+    /**
+     * Is this block tagged as terminal based on its contents
+     * (usually the last statement)
+     */
+    public static final int IS_TERMINAL = 1 << 2;
 
     /**
      * Constructor
      *
-     * @param source   source code
-     * @param token    token
-     * @param finish   finish
+     * @param source     source code
+     * @param token      token
+     * @param finish     finish
+     * @param statements statements
      */
-    public Block(final Source source, final long token, final int finish) {
-        super(source, token, finish);
+    public Block(final Source source, final long token, final int finish, final Node... statements) {
+        super(source, token, finish, new Label("block_break"));
 
-        this.statements = new ArrayList<>();
-        this.symbols    = new HashMap<>();
+        this.statements = Arrays.asList(statements);
+        this.symbols    = new LinkedHashMap<>();
         this.entryLabel = new Label("block_entry");
-        this.breakLabel = new Label("block_break");
+        this.flags     =  0;
     }
 
     /**
-     * Internal copy constructor
+     * Constructor
      *
-     * @param block the source block
-     * @param cs    the copy state
+     * @param source     source code
+     * @param token      token
+     * @param finish     finish
+     * @param statements statements
      */
-    protected Block(final Block block, final CopyState cs) {
-        super(block);
+    public Block(final Source source, final long token, final int finish, final List<Node> statements) {
+        this(source, token, finish, statements.toArray(new Node[statements.size()]));
+    }
 
-        this.statements = new ArrayList<>();
-        for (final Node statement : block.getStatements()) {
-            statements.add(cs.existingOrCopy(statement));
-        }
-        this.symbols    = new HashMap<>();
-        this.frame      = block.frame == null ? null : block.frame.copy();
+    private Block(final Block block, final int finish, final List<Node> statements, final int flags) {
+        super(block);
+        this.statements = statements;
+        this.flags      = flags;
+        this.symbols    = block.symbols; //todo - symbols have no dependencies on any IR node and can as far as we understand it be shallow copied now
         this.entryLabel = new Label(block.entryLabel);
-        this.breakLabel = new Label(block.breakLabel);
-
-        assert block.symbols.isEmpty() : "must not clone with symbols";
+        this.finish = finish;
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new Block(this, cs);
-    }
-
-    /**
-     * Add a new statement to the statement list.
-     *
-     * @param statement Statement node to add.
-     */
-    public void addStatement(final Node statement) {
-        if (statement != null) {
-            statements.add(statement);
-            if (getFinish() < statement.getFinish()) {
-                setFinish(statement.getFinish());
-            }
-        }
-    }
-
-    /**
-     * Prepend statements to the statement list
-     *
-     * @param prepended statement to add
-     */
-    public void prependStatements(final List<Node> prepended) {
-        statements.addAll(0, prepended);
-    }
-
-    /**
-     * Add a list of statements to the statement list.
-     *
-     * @param statementList Statement nodes to add.
-     */
-    public void addStatements(final List<Node> statementList) {
-        statements.addAll(statementList);
+    public Node ensureUniqueLabels(final LexicalContext lc) {
+        return Node.replaceInLexicalContext(lc, this, new Block(this, finish, statements, flags));
     }
 
     /**
@@ -142,19 +125,9 @@
      * @return new or same node
      */
     @Override
-    public Node accept(final NodeVisitor visitor) {
-        final Block saveBlock = visitor.getCurrentBlock();
-        visitor.setCurrentBlock(this);
-
-        try {
-            // Ignore parent to avoid recursion.
-
-            if (visitor.enterBlock(this) != null) {
-                visitStatements(visitor);
-                return visitor.leaveBlock(this);
-            }
-        } finally {
-            visitor.setCurrentBlock(saveBlock);
+    public Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterBlock(this)) {
+            return visitor.leaveBlock(setStatements(lc, Node.accept(visitor, Node.class, statements)));
         }
 
         return this;
@@ -222,11 +195,18 @@
     }
 
     /**
-     * Get the break label for this block
-     * @return the break label
+     * Tag block as terminal or non terminal
+     * @param lc          lexical context
+     * @param isTerminal is block terminal
+     * @return same block, or new if flag changed
      */
-    public Label getBreakLabel() {
-        return breakLabel;
+    public Block setIsTerminal(final LexicalContext lc, final boolean isTerminal) {
+        return isTerminal ? setFlag(lc, IS_TERMINAL) : clearFlag(lc, IS_TERMINAL);
+    }
+
+    @Override
+    public boolean isTerminal() {
+        return getFlag(IS_TERMINAL);
     }
 
     /**
@@ -238,23 +218,6 @@
     }
 
     /**
-     * Get the frame for this block
-     * @return the frame
-     */
-    public Frame getFrame() {
-        return frame;
-    }
-
-    /**
-     * Reset the frame for this block
-     *
-     * @param frame  the new frame
-     */
-    public void setFrame(final Frame frame) {
-        this.frame = frame;
-    }
-
-    /**
      * Get the list of statements in this block
      *
      * @return a list of statements
@@ -264,21 +227,21 @@
     }
 
     /**
-     * Applies the specified visitor to all statements in the block.
-     * @param visitor the visitor.
-     */
-    public void visitStatements(NodeVisitor visitor) {
-        for (ListIterator<Node> stmts = statements.listIterator(); stmts.hasNext();) {
-            stmts.set(stmts.next().accept(visitor));
-        }
-    }
-    /**
      * Reset the statement list for this block
      *
-     * @param statements  new statement list
+     * @param lc lexical context
+     * @param statements new statement list
+     * @return new block if statements changed, identity of statements == block.statements
      */
-    public void setStatements(final List<Node> statements) {
-        this.statements = statements;
+    public Block setStatements(final LexicalContext lc, final List<Node> statements) {
+        if (this.statements == statements) {
+            return this;
+        }
+        int lastFinish = 0;
+        if (!statements.isEmpty()) {
+            lastFinish = statements.get(statements.size() - 1).getFinish();
+        }
+        return Node.replaceInLexicalContext(lc, this, new Block(this, Math.max(finish, lastFinish), statements, flags));
     }
 
     /**
@@ -297,39 +260,65 @@
      * @return true if this function needs a scope
      */
     public boolean needsScope() {
-        return needsScope;
+        return (flags & NEEDS_SCOPE) == NEEDS_SCOPE;
+    }
+
+    @Override
+    public Block setFlags(final LexicalContext lc, int flags) {
+        if (this.flags == flags) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new Block(this, finish, statements, flags));
+    }
+
+    @Override
+    public Block clearFlag(final LexicalContext lc, int flag) {
+        return setFlags(lc, flags & ~flag);
+    }
+
+    @Override
+    public Block setFlag(final LexicalContext lc, int flag) {
+        return setFlags(lc, flags | flag);
+    }
+
+    @Override
+    public boolean getFlag(final int flag) {
+        return (flags & flag) == flag;
     }
 
     /**
      * Set the needs scope flag.
+     * @param lc lexicalContext
+     * @return new block if state changed, otherwise this
      */
-    public void setNeedsScope() {
-        needsScope = true;
+    public Block setNeedsScope(final LexicalContext lc) {
+        if (needsScope()) {
+            return this;
+        }
+
+        return Node.replaceInLexicalContext(lc, this, new Block(this, finish, statements, flags | NEEDS_SCOPE));
     }
 
     /**
-     * Marks this block as using a specified scoped symbol. The block and its parent blocks up to but not
-     * including the block defining the symbol will be marked as needing parent scope. The block defining the symbol
-     * will be marked as one that needs to have its own scope.
-     * @param symbol the symbol being used.
-     * @param ancestors the iterator over block's containing lexical context
+     * Computationally determine the next slot for this block,
+     * indexed from 0. Use this as a relative base when computing
+     * frames
+     * @return next slot
      */
-    public void setUsesScopeSymbol(final Symbol symbol, Iterator<Block> ancestors) {
-        if(symbol.getBlock() == this) {
-            setNeedsScope();
-        } else {
-            setUsesParentScopeSymbol(symbol, ancestors);
+    public int nextSlot() {
+        final Iterator<Symbol> iter = symbolIterator();
+        int next = 0;
+        while (iter.hasNext()) {
+        final Symbol symbol = iter.next();
+        if (symbol.hasSlot()) {
+            next += symbol.slotCount();
         }
+        }
+        return next;
     }
 
-    /**
-     * Invoked when this block uses a scope symbol defined in one of its ancestors.
-     * @param symbol the scope symbol being used
-     * @param ancestors iterator over ancestor blocks
-     */
-    void setUsesParentScopeSymbol(final Symbol symbol, Iterator<Block> ancestors) {
-        if(ancestors.hasNext()) {
-            ancestors.next().setUsesScopeSymbol(symbol, ancestors);
-        }
+    @Override
+    protected boolean isBreakableWithoutLabel() {
+        return false;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/ir/BlockLexicalContext.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.ir;
+
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.List;
+import java.util.ListIterator;
+
+/**
+ * This is a subclass of lexical context used for filling
+ * blocks (and function nodes) with statements. When popping
+ * a block from the lexical context, any statements that have
+ * been generated in it are commited to the block. This saves
+ * unnecessary object mutations and lexical context replacement
+ */
+public class BlockLexicalContext extends LexicalContext {
+    /** statement stack, each block on the lexical context maintains one of these, which is
+     *  committed to the block on pop */
+    private Deque<List<Node>> sstack = new ArrayDeque<>();
+
+    /** Last non debug statement emitted in this context */
+    protected Node lastStatement;
+
+    @Override
+    public <T extends LexicalContextNode> T push(final T node) {
+        T pushed = super.push(node);
+        if (node instanceof Block) {
+            sstack.push(new ArrayList<Node>());
+        }
+        return pushed;
+    }
+
+    /**
+     * Get the statement list from the stack, possibly filtered
+     * @return statement list
+     */
+    protected List<Node> popStatements() {
+        return sstack.pop();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T extends LexicalContextNode> T pop(final T node) {
+        T expected = node;
+        if (node instanceof Block) {
+            final List<Node> newStatements = popStatements();
+            expected = (T)((Block)node).setStatements(this, newStatements);
+            if (!sstack.isEmpty()) {
+                lastStatement = lastStatement(sstack.peek());
+            }
+        }
+        return super.pop(expected);
+    }
+
+    /**
+     * Append a statement to the block being generated
+     * @param statement statement to add
+     */
+    public void appendStatement(final Node statement) {
+        assert statement != null;
+        sstack.peek().add(statement);
+        if (!statement.isDebug()) {
+            lastStatement = statement;
+        }
+    }
+
+    /**
+     * Prepend a statement to the block being generated
+     * @param statement statement to prepend
+     * @return the prepended statement
+     */
+    public Node prependStatement(final Node statement) {
+        assert statement != null;
+        sstack.peek().add(0, statement);
+        return statement;
+    }
+
+    /**
+     * Get the last (non debug) statement that was emitted into a block
+     * @return the last statement emitted
+     */
+    public Node getLastStatement() {
+        return lastStatement;
+    }
+
+    private static Node lastStatement(final List<Node> statements) {
+        for (final ListIterator<Node> iter = statements.listIterator(statements.size()); iter.hasPrevious(); ) {
+            final Node node = iter.previous();
+            if (!node.isDebug()) {
+                return node;
+            }
+        }
+        return null;
+    }
+}
--- a/nashorn/src/jdk/nashorn/internal/ir/BreakNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/BreakNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,37 +25,34 @@
 
 package jdk.nashorn.internal.ir;
 
-import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for {@code break} statements.
  */
-public class BreakNode extends LabeledNode {
+@Immutable
+public final class BreakNode extends Node {
 
-     /**
+    private final IdentNode label;
+
+    /**
      * Constructor
      *
-     * @param source     source code
-     * @param token      token
-     * @param finish     finish
-     * @param labelNode  break label
-     * @param targetNode node to break to
-     * @param tryChain   surrounding try chain
+     * @param source source code
+     * @param token  token
+     * @param finish finish
+     * @param label  label for break or null if none
      */
-    public BreakNode(final Source source, final long token, final int finish, final LabelNode labelNode, final Node targetNode, final TryNode tryChain) {
-        super(source, token, finish, labelNode, targetNode, tryChain);
-        setHasGoto();
-    }
-
-    private BreakNode(final BreakNode breakNode, final CopyState cs) {
-        super(breakNode, cs);
+    public BreakNode(final Source source, final long token, final int finish, final IdentNode label) {
+        super(source, token, finish);
+        this.label = label;
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new BreakNode(this, cs);
+    public boolean hasGoto() {
+        return true;
     }
 
     /**
@@ -64,7 +61,7 @@
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterBreakNode(this) != null) {
+        if (visitor.enterBreakNode(this)) {
             return visitor.leaveBreakNode(this);
         }
 
@@ -72,26 +69,20 @@
     }
 
     /**
-     * Return the target label of this break node.
-     * @return the target label.
+     * Get the label for this break node
+     * @return label, or null if none
      */
-    public Label getTargetLabel() {
-        if (targetNode instanceof BreakableNode) {
-            return ((BreakableNode)targetNode).getBreakLabel();
-        } else if (targetNode instanceof Block) {
-            return ((Block)targetNode).getBreakLabel();
-        }
-
-        throw new AssertionError("Invalid break target " + targetNode.getClass());
+    public IdentNode getLabel() {
+        return label;
     }
 
     @Override
     public void toString(final StringBuilder sb) {
         sb.append("break");
 
-        if (labelNode != null) {
+        if (label != null) {
             sb.append(' ');
-            labelNode.getLabel().toString(sb);
+            label.toString(sb);
         }
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/BreakableNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/BreakableNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,27 +25,34 @@
 
 package jdk.nashorn.internal.ir;
 
+import java.util.Arrays;
+import java.util.List;
+
 import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * This class represents a node from which control flow can execute
  * a {@code break} statement
  */
-public abstract class BreakableNode extends Node {
+@Immutable
+public abstract class BreakableNode extends LexicalContextNode {
 
     /** break label. */
-    protected Label breakLabel;
+    protected final Label breakLabel;
 
     /**
      * Constructor
      *
-     * @param source   source code
-     * @param token    token
-     * @param finish   finish
+     * @param source     source code
+     * @param token      token
+     * @param finish     finish
+     * @param breakLabel break label
      */
-    public BreakableNode(final Source source, final long token, final int finish) {
+    protected BreakableNode(final Source source, final long token, final int finish, final Label breakLabel) {
         super(source, token, finish);
+        this.breakLabel = breakLabel;
     }
 
     /**
@@ -55,6 +62,19 @@
      */
     protected BreakableNode(final BreakableNode breakableNode) {
         super(breakableNode);
+        this.breakLabel = new Label(breakableNode.getBreakLabel());
+    }
+
+    @Override
+    public abstract Node ensureUniqueLabels(final LexicalContext lc);
+
+    /**
+     * Check whether this can be broken out from without using a label,
+     * e.g. everything but Blocks, basically
+     * @return true if breakable without label
+     */
+    protected boolean isBreakableWithoutLabel() {
+        return true;
     }
 
     /**
@@ -65,4 +85,14 @@
         return breakLabel;
     }
 
+    /**
+     * Return the labels associated with this node. Breakable nodes that
+     * aren't LoopNodes only have a break label -> the location immediately
+     * afterwards the node in code
+     * @return list of labels representing locations around this node
+     */
+    public List<Label> getLabels() {
+        return Arrays.asList(breakLabel);
+    }
+
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/CallNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/CallNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,49 +25,48 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Ignore;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for a function call.
- *
  */
-public class CallNode extends Node implements TypeOverride<CallNode> {
+@Immutable
+public final class CallNode extends LexicalContextNode implements TypeOverride<CallNode> {
 
-    private Type type;
+    private final Type type;
 
     /** Function identifier or function body. */
-    private Node function;
+    private final Node function;
 
     /** Call arguments. */
-    private List<Node> args;
+    private final List<Node> args;
 
-    /** flag - is new expression */
-    private boolean isNew;
+    /** Is this a "new" operation */
+    public static final int IS_NEW        = 0x1;
 
-    /** flag - is in with block */
-    private boolean inWithBlock;
+    private final int flags;
 
     /**
      * Arguments to be passed to builtin {@code eval} function
      */
     public static class EvalArgs {
         /** evaluated code */
-        private Node code;
+        private final Node code;
 
         /** 'this' passed to evaluated code */
-        private IdentNode evalThis;
+        private final IdentNode evalThis;
 
         /** location string for the eval call */
-        final private String location;
+        private final String location;
 
         /** is this call from a strict context? */
-        final private boolean strictMode;
+        private final boolean strictMode;
 
         /**
          * Constructor
@@ -92,12 +91,11 @@
             return code;
         }
 
-        /**
-         * Set the code that is to be eval.ed by this eval function
-         * @param code the code as an AST node
-         */
-        public void setCode(final Node code) {
-            this.code = code;
+        private EvalArgs setCode(final Node code) {
+            if (this.code == code) {
+                return this;
+            }
+            return new EvalArgs(code, evalThis, location, strictMode);
         }
 
         /**
@@ -108,12 +106,11 @@
             return this.evalThis;
         }
 
-        /**
-         * Set the {@code this} symbol used to invoke this eval call
-         * @param evalThis the {@code this} symbol
-         */
-        public void setThis(final IdentNode evalThis) {
-            this.evalThis = evalThis;
+        private EvalArgs setThis(final IdentNode evalThis) {
+            if (this.evalThis == evalThis) {
+                return this;
+            }
+            return new EvalArgs(code, evalThis, location, strictMode);
         }
 
         /**
@@ -135,7 +132,7 @@
 
     /** arguments for 'eval' call. Non-null only if this call node is 'eval' */
     @Ignore
-    private EvalArgs evalArgs;
+    private final EvalArgs evalArgs;
 
     /**
      * Constructors
@@ -149,28 +146,22 @@
     public CallNode(final Source source, final long token, final int finish, final Node function, final List<Node> args) {
         super(source, token, finish);
 
-        setStart(function.getStart());
-
-        this.function     = function;
-        this.args         = args;
+        this.function = function;
+        this.args     = args;
+        this.flags    = 0;
+        this.type     = null;
+        this.evalArgs = null;
     }
 
-    private CallNode(final CallNode callNode, final CopyState cs) {
+    private CallNode(final CallNode callNode, final Node function, final List<Node> args, final int flags, final Type type, final EvalArgs evalArgs) {
         super(callNode);
-
-        final List<Node> newArgs = new ArrayList<>();
-
-        for (final Node arg : callNode.args) {
-            newArgs.add(cs.existingOrCopy(arg));
-        }
-
-        this.function     = cs.existingOrCopy(callNode.function);     //TODO existing or same?
-        this.args         = newArgs;
-        this.isNew        = callNode.isNew;
-        this.inWithBlock  = callNode.inWithBlock;
+        this.function = function;
+        this.args = args;
+        this.flags = flags;
+        this.type = type;
+        this.evalArgs = evalArgs;
     }
 
-
     @Override
     public Type getType() {
         if (hasCallSiteType()) {
@@ -181,8 +172,10 @@
 
     @Override
     public CallNode setType(final Type type) {
-        this.type = type;
-        return this;
+        if (this.type == type) {
+            return this;
+        }
+        return new CallNode(this, function, args, flags, type, evalArgs);
     }
 
     private boolean hasCallSiteType() {
@@ -194,11 +187,6 @@
         return true;
     }
 
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new CallNode(this, cs);
-    }
-
     /**
      * Assist in IR navigation.
      *
@@ -207,15 +195,22 @@
      * @return node or replacement
      */
     @Override
-    public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterCallNode(this) != null) {
-            function = function.accept(visitor);
-
-            for (int i = 0, count = args.size(); i < count; i++) {
-                args.set(i, args.get(i).accept(visitor));
+    public Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterCallNode(this)) {
+            final CallNode newCallNode = (CallNode)visitor.leaveCallNode(
+                    setFunction(function.accept(visitor)).
+                    setArgs(Node.accept(visitor, Node.class, args)).
+                    setFlags(flags).
+                    setType(type).
+                    setEvalArgs(evalArgs == null ?
+                            null :
+                            evalArgs.setCode(evalArgs.getCode().accept(visitor)).
+                                setThis((IdentNode)evalArgs.getThis().accept(visitor))));
+            // Theoretically, we'd need to instead pass lc to every setter and do a replacement on each. In practice,
+            // setType from TypeOverride can't accept a lc, and we don't necessarily want to go there now.
+            if(this != newCallNode) {
+                return Node.replaceInLexicalContext(lc, this, newCallNode);
             }
-
-            return visitor.leaveCallNode(this);
         }
 
         return this;
@@ -226,7 +221,7 @@
         if (hasCallSiteType()) {
             sb.append('{');
             final String desc = getType().getDescriptor();
-            sb.append(desc.charAt(desc.length() - 1) == ';' ? "O" : getType().getDescriptor());
+            sb.append(desc.charAt(desc.length() - 1) == ';' ? 'O' : getType().getDescriptor());
             sb.append('}');
         }
 
@@ -261,8 +256,11 @@
      * Reset the arguments for the call
      * @param args new arguments list
      */
-    public void setArgs(final List<Node> args) {
-        this.args = args;
+    private CallNode setArgs(final List<Node> args) {
+        if (this.args == args) {
+            return this;
+        }
+        return new CallNode(this, function, args, flags, type, evalArgs);
     }
 
     /**
@@ -278,9 +276,13 @@
      * {@code eval}
      *
      * @param evalArgs eval args
+     * @return same node or new one on state change
      */
-    public void setEvalArgs(final EvalArgs evalArgs) {
-        this.evalArgs = evalArgs;
+    public CallNode setEvalArgs(final EvalArgs evalArgs) {
+        if (this.evalArgs == evalArgs) {
+            return this;
+        }
+        return new CallNode(this, function, args, flags, type, evalArgs);
     }
 
     /**
@@ -301,10 +303,14 @@
 
     /**
      * Reset the function expression that this call invokes
-     * @param node the function
+     * @param function the function
+     * @return same node or new one on state change
      */
-    public void setFunction(final Node node) {
-        function = node;
+    public CallNode setFunction(final Node function) {
+        if (this.function == function) {
+            return this;
+        }
+        return new CallNode(this, function, args, flags, type, evalArgs);
     }
 
     /**
@@ -312,28 +318,21 @@
      * @return true if this a new operation
      */
     public boolean isNew() {
-        return isNew;
+        return (flags & IS_NEW) == IS_NEW;
     }
 
     /**
      * Flag this call as a new operation
+     * @return same node or new one on state change
      */
-    public void setIsNew() {
-        this.isNew = true;
+    public CallNode setIsNew() {
+        return setFlags(IS_NEW);
     }
 
-    /**
-     * Check if this call is inside a {@code with} block
-     * @return true if the call is inside a {@code with} block
-     */
-    public boolean inWithBlock() {
-        return inWithBlock;
-    }
-
-    /**
-     * Flag this call to be inside a {@code with} block
-     */
-    public void setInWithBlock() {
-        this.inWithBlock = true;
+    private CallNode setFlags(final int flags) {
+        if (this.flags == flags) {
+            return this;
+        }
+        return new CallNode(this, function, args, flags, type, evalArgs);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/CaseNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/CaseNode.java	Wed May 08 10:10:05 2013 +0100
@@ -26,19 +26,21 @@
 package jdk.nashorn.internal.ir;
 
 import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation of CASE clause.
- *
+ * Case nodes are not BreakableNodes, but the SwitchNode is
  */
-public class CaseNode extends BreakableNode {
+@Immutable
+public final class CaseNode extends Node {
     /** Test expression. */
-    private Node test;
+    private final Node test;
 
     /** Statements. */
-    private Block body;
+    private final Block body;
 
     /** Case entry label. */
     private final Label entry;
@@ -60,17 +62,17 @@
         this.entry = new Label("entry");
     }
 
-    private CaseNode(final CaseNode caseNode, final CopyState cs) {
+    CaseNode(final CaseNode caseNode, final Node test, final Block body) {
         super(caseNode);
 
-        this.test  = cs.existingOrCopy(caseNode.test);
-        this.body  = (Block)cs.existingOrCopy(caseNode.body);
+        this.test  = test;
+        this.body  = body;
         this.entry = new Label(caseNode.entry);
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new CaseNode(this, cs);
+    public boolean isTerminal() {
+        return body.isTerminal();
     }
 
     /**
@@ -79,15 +81,11 @@
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterCaseNode(this) != null) {
-            if (test != null) {
-                test = test.accept(visitor);
-            }
-            if (body != null) {
-                body = (Block)body.accept(visitor);
-            }
+        if (visitor.enterCaseNode(this)) {
+            final Node  newTest = test == null ? null : test.accept(visitor);
+            final Block newBody = body == null ? null : (Block)body.accept(visitor);
 
-            return visitor.leaveCaseNode(this);
+            return visitor.leaveCaseNode(setTest(newTest).setBody(newBody));
         }
 
         return this;
@@ -131,8 +129,19 @@
     /**
      * Reset the test expression for this case node
      * @param test new test expression
+     * @return new or same CaseNode
      */
-    public void setTest(final Node test) {
-        this.test = test;
+    public CaseNode setTest(final Node test) {
+        if (this.test == test) {
+            return this;
+        }
+        return new CaseNode(this, test, body);
+    }
+
+    private CaseNode setBody(final Block body) {
+        if (this.body == body) {
+            return this;
+        }
+        return new CaseNode(this, test, body);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/CatchNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/CatchNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,26 +25,23 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation of a catch clause.
- *
  */
-public class CatchNode extends Node {
+@Immutable
+public final class CatchNode extends Node {
     /** Exception identifier. */
-    private IdentNode exception;
+    private final IdentNode exception;
 
     /** Exception condition. */
-    private Node exceptionCondition;
+    private final Node exceptionCondition;
 
     /** Catch body. */
-    private Block body;
-
-    /** Is rethrow - e.g. synthetic catch block for e.g. finallies, the parser case where
-     * there has to be at least on catch for syntactic validity */
-    private boolean isSyntheticRethrow;
+    private final Block body;
 
     /**
      * Constructors
@@ -64,18 +61,12 @@
         this.body               = body;
     }
 
-    private CatchNode(final CatchNode catchNode, final CopyState cs) {
+    private CatchNode(final CatchNode catchNode, final IdentNode exception, final Node exceptionCondition, final Block body) {
         super(catchNode);
 
-        this.exception          = (IdentNode)cs.existingOrCopy(catchNode.exception);
-        this.exceptionCondition = cs.existingOrCopy(catchNode.exceptionCondition);
-        this.body               = (Block)cs.existingOrCopy(catchNode.body);
-        this.isSyntheticRethrow = catchNode.isSyntheticRethrow;
-     }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new CatchNode(this, cs);
+        this.exception          = exception;
+        this.exceptionCondition = exceptionCondition;
+        this.body               = body;
     }
 
     /**
@@ -84,21 +75,22 @@
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterCatchNode(this) != null) {
-            exception = (IdentNode)exception.accept(visitor);
-
-            if (exceptionCondition != null) {
-                exceptionCondition = exceptionCondition.accept(visitor);
-            }
-
-            body = (Block)body.accept(visitor);
-            return visitor.leaveCatchNode(this);
+        if (visitor.enterCatchNode(this)) {
+            return visitor.leaveCatchNode(
+                setException((IdentNode)exception.accept(visitor)).
+                setExceptionCondition(exceptionCondition == null ? null : exceptionCondition.accept(visitor)).
+                setBody((Block)body.accept(visitor)));
         }
 
         return this;
     }
 
     @Override
+    public boolean isTerminal() {
+        return body.isTerminal();
+    }
+
+    @Override
     public void toString(final StringBuilder sb) {
         sb.append(" catch (");
         exception.toString(sb);
@@ -111,23 +103,6 @@
     }
 
     /**
-     * Check if this catch is a synthetic rethrow
-     * @return true if this is a synthetic rethrow
-     */
-    public boolean isSyntheticRethrow() {
-        return isSyntheticRethrow;
-    }
-
-    /**
-     * Flag this as deliberatly generated catch all that rethrows the
-     * caught exception. This is used for example for generating finally
-     * expressions
-     */
-    public void setIsSyntheticRethrow() {
-        this.isSyntheticRethrow = true;
-    }
-
-    /**
      * Get the identifier representing the exception thrown
      * @return the exception identifier
      */
@@ -146,9 +121,13 @@
     /**
      * Reset the exception condition for this catch block
      * @param exceptionCondition the new exception condition
+     * @return new or same CatchNode
      */
-    public void setExceptionCondition(final Node exceptionCondition) {
-        this.exceptionCondition = exceptionCondition;
+    public CatchNode setExceptionCondition(final Node exceptionCondition) {
+        if (this.exceptionCondition == exceptionCondition) {
+            return this;
+        }
+        return new CatchNode(this, exception, exceptionCondition, body);
     }
 
     /**
@@ -158,4 +137,18 @@
     public Block getBody() {
         return body;
     }
+
+    private CatchNode setException(final IdentNode exception) {
+        if (this.exception == exception) {
+            return this;
+        }
+        return new CatchNode(this, exception, exceptionCondition, body);
+    }
+
+    private CatchNode setBody(final Block body) {
+        if (this.body == body) {
+            return this;
+        }
+        return new CatchNode(this, exception, exceptionCondition, body);
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/ContinueNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/ContinueNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,43 +25,39 @@
 
 package jdk.nashorn.internal.ir;
 
-import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for CONTINUE statements.
- *
  */
-public class ContinueNode extends LabeledNode {
+@Immutable
+public class ContinueNode extends Node {
+
+    private IdentNode label;
 
     /**
      * Constructor
      *
-     * @param source     the source
-     * @param token      token
-     * @param finish     finish
-     * @param labelNode  the continue label
-     * @param targetNode node to continue to
-     * @param tryChain   surrounding try chain
+     * @param source source code
+     * @param token  token
+     * @param finish finish
+     * @param label  label for break or null if none
      */
-    public ContinueNode(final Source source, final long token, final int finish, final LabelNode labelNode, final Node targetNode, final TryNode tryChain) {
-        super(source, token, finish, labelNode, targetNode, tryChain);
-        setHasGoto();
-    }
-
-    private ContinueNode(final ContinueNode continueNode, final CopyState cs) {
-        super(continueNode, cs);
+    public ContinueNode(final Source source, final long token, final int finish, final IdentNode label) {
+        super(source, token, finish);
+        this.label = label;
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new ContinueNode(this, cs);
+    public boolean hasGoto() {
+        return true;
     }
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterContinueNode(this) != null) {
+        if (visitor.enterContinueNode(this)) {
             return visitor.leaveContinueNode(this);
         }
 
@@ -69,21 +65,20 @@
     }
 
     /**
-     * Return the target label of this continue node.
-     * @return the target label.
+     * Get the label for this break node
+     * @return label, or null if none
      */
-    public Label getTargetLabel() {
-        assert targetNode instanceof WhileNode : "continue target must be a while node";
-        return ((WhileNode)targetNode).getContinueLabel();
+    public IdentNode getLabel() {
+        return label;
     }
 
     @Override
     public void toString(final StringBuilder sb) {
         sb.append("continue");
 
-        if (labelNode != null) {
+        if (label != null) {
             sb.append(' ');
-            labelNode.getLabel().toString(sb);
+            label.toString(sb);
         }
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/DoWhileNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.ir;
-
-import jdk.nashorn.internal.ir.visitor.NodeVisitor;
-import jdk.nashorn.internal.runtime.Source;
-
-/**
- * Loop representing do while loops. This is mostly split from WhileNode
- * because of the different order of the Phi Traversals
- *
- */
-public class DoWhileNode extends WhileNode {
-
-    /**
-     * Constructor
-     *
-     * @param source     the source
-     * @param token      token
-     * @param finish     finish
-     */
-    public DoWhileNode(final Source source, final long token, final int finish) {
-        super(source, token, finish);
-    }
-
-    /**
-     * Copy constructor
-     *
-     * @param doWhileNode source node
-     * @param cs          copy state
-     */
-    protected DoWhileNode(final DoWhileNode doWhileNode, final CopyState cs) {
-        super(doWhileNode, cs);
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new DoWhileNode(this, cs);
-    }
-
-    @Override
-    public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterDoWhileNode(this) != null) {
-            body = (Block)body.accept(visitor);
-            test = test.accept(visitor);
-
-            return visitor.leaveDoWhileNode(this);
-        }
-
-        return this;
-    }
-
-    @Override
-    public void toString(final StringBuilder sb) {
-        sb.append("while (");
-        test.toString(sb);
-        sb.append(')');
-    }
-}
--- a/nashorn/src/jdk/nashorn/internal/ir/EmptyNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/EmptyNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,14 +25,15 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for an empty statement.
- *
  */
-public class EmptyNode extends Node {
+@Immutable
+public final class EmptyNode extends Node {
 
     /**
      * Constructor
@@ -57,7 +58,7 @@
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterEmptyNode(this) != null) {
+        if (visitor.enterEmptyNode(this)) {
             return visitor.leaveEmptyNode(this);
         }
         return this;
--- a/nashorn/src/jdk/nashorn/internal/ir/ExecuteNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/ExecuteNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
@@ -33,9 +34,10 @@
  * node means "this code will be executed" and evaluating it results in
  * statements being added to the IR
  */
-public class ExecuteNode extends Node {
+@Immutable
+public final class ExecuteNode extends Node {
     /** Expression to execute. */
-    private Node expression;
+    private final Node expression;
 
     /**
      * Constructor
@@ -50,6 +52,11 @@
         this.expression = expression;
     }
 
+    private ExecuteNode(final ExecuteNode executeNode, final Node expression) {
+        super(executeNode);
+        this.expression = expression;
+    }
+
     /**
      * Constructor
      *
@@ -60,34 +67,15 @@
         this.expression = expression;
     }
 
-    private ExecuteNode(final ExecuteNode executeNode, final CopyState cs) {
-        super(executeNode);
-        this.expression = cs.existingOrCopy(executeNode.expression);
-    }
-
     @Override
-    protected Node copy(final CopyState cs) {
-        return new ExecuteNode(this, cs);
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-        if (!super.equals(other)) {
-            return false;
-        }
-        return expression.equals(((ExecuteNode)other).getExpression());
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode() ^ expression.hashCode();
+    public boolean isTerminal() {
+        return expression.isTerminal();
     }
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterExecuteNode(this) != null) {
-            setExpression(expression.accept(visitor));
-            return visitor.leaveExecuteNode(this);
+        if (visitor.enterExecuteNode(this)) {
+            return visitor.leaveExecuteNode(setExpression(expression.accept(visitor)));
         }
 
         return this;
@@ -109,8 +97,12 @@
     /**
      * Reset the expression to be executed
      * @param expression the expression
+     * @return new or same execute node
      */
-    public void setExpression(final Node expression) {
-        this.expression = expression;
+    public ExecuteNode setExpression(final Node expression) {
+        if (this.expression == expression) {
+            return this;
+        }
+        return new ExecuteNode(this, expression);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/ir/Flags.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.ir;
+
+/**
+ * Interface implemented by all nodes that have flags in
+ * a lexical context. This is needed as we sometimes have to save
+ * the setting of flags in the lexical context until a block
+ * is completely finished and its final version (after multiple
+ * copy on writes) is placed in the lexical context
+ *
+ * @param <T> lexical context node that can have flags set during code generation
+ */
+public interface Flags<T extends LexicalContextNode> {
+
+    /**
+     * Check if a flag is set in a lexical context node
+     * @param flag flag to check
+     * @return flags
+     */
+    public boolean getFlag(int flag);
+
+    /**
+     * Clear a flag of a LexicalContextNode
+     * @param lc lexical context
+     * @param flag flag to clear
+     * @return the new LexicalContext node if flags were changed, same otherwise
+     */
+    public T clearFlag(final LexicalContext lc, int flag);
+
+    /**
+     * Set a flag of a LexicalContextNode
+     * @param lc lexical context
+     * @param flag flag to set
+     * @return the new LexicalContext node if flags were changed, same otherwise
+     */
+    public T setFlag(final LexicalContext lc, int flag);
+
+    /**
+     * Set all flags of a LexicalContextNode, overwriting previous flags
+     * @param lc lexical context
+     * @param flags new flags value
+     * @return the new LexicalContext node if flags were changed, same otherwise
+     */
+    public T setFlags(final LexicalContext lc, int flags);
+}
--- a/nashorn/src/jdk/nashorn/internal/ir/ForNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/ForNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,73 +25,75 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representing a FOR statement.
- *
  */
-public class ForNode extends WhileNode {
+@Immutable
+public final class ForNode extends LoopNode {
     /** Initialize expression. */
-    private Node init;
+    private final Node init;
 
     /** Test expression. */
-    private Node modify;
+    private final Node modify;
 
     /** Iterator symbol. */
     private Symbol iterator;
 
-    /** is for in */
-    private boolean isForIn;
+    /** Is this a normal for loop? */
+    public static final int IS_FOR      = 1 << 0;
 
-    /** is for each */
-    private boolean isForEach;
+    /** Is this a normal for in loop? */
+    public static final int IS_FOR_IN   = 1 << 1;
+
+    /** Is this a normal for each in loop? */
+    public static final int IS_FOR_EACH = 1 << 2;
+
+    private final int flags;
 
     /**
      * Constructor
      *
-     * @param source     the source
-     * @param token      token
-     * @param finish     finish
+     * @param source the source
+     * @param token  token
+     * @param finish finish
+     * @param init   init
+     * @param test   test
+     * @param body   body
+     * @param modify modify
+     * @param flags  flags
      */
-    public ForNode(final Source source, final long token, final int finish) {
-        super(source, token, finish);
+    public ForNode(final Source source, final long token, final int finish, final Node init, final Node test, final Block body, final Node modify, final int flags) {
+        super(source, token, finish, test, body, false);
+        this.init   = init;
+        this.modify = modify;
+        this.flags  = flags;
     }
 
-    private ForNode(final ForNode forNode, final CopyState cs) {
-        super(forNode, cs);
-
-        this.init      = cs.existingOrCopy(forNode.init);
-        this.modify    = cs.existingOrCopy(forNode.modify);
-        this.iterator  = forNode.iterator;
-        this.isForIn   = forNode.isForIn;
-        this.isForEach = forNode.isForEach;
+    private ForNode(final ForNode forNode, final Node init, final Node test, final Block body, final Node modify, final int flags, final boolean controlFlowEscapes) {
+        super(forNode, test, body, controlFlowEscapes);
+        this.init   = init;
+        this.modify = modify;
+        this.flags  = flags;
+        this.iterator = forNode.iterator; //TODO is this acceptable? symbols are never cloned, just copied as references
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new ForNode(this, cs);
+    public Node ensureUniqueLabels(LexicalContext lc) {
+        return Node.replaceInLexicalContext(lc, this, new ForNode(this, init, test, body, modify, flags, controlFlowEscapes));
     }
 
     @Override
-    public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterForNode(this) != null) {
-            if (init != null) {
-                init = init.accept(visitor);
-            }
-
-            if (test != null) {
-                test = test.accept(visitor);
-            }
-
-            if (modify != null) {
-                modify = modify.accept(visitor);
-            }
-
-            body = (Block)body.accept(visitor);
-
-            return visitor.leaveForNode(this);
+    protected Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterForNode(this)) {
+            return visitor.leaveForNode(
+                setInit(lc, init == null ? null : init.accept(visitor)).
+                setTest(lc, test == null ? null : test.accept(visitor)).
+                setModify(lc, modify == null ? null : modify.accept(visitor)).
+                setBody(lc, (Block)body.accept(visitor)));
         }
 
         return this;
@@ -122,6 +124,19 @@
         sb.append(')');
     }
 
+    @Override
+    public boolean hasGoto() {
+        return !isForIn() && test == null;
+    }
+
+    @Override
+    public boolean mustEnter() {
+        if (isForIn()) {
+            return false; //may be an empty set to iterate over, then we skip the loop
+        }
+        return test == null;
+    }
+
     /**
      * Get the initialization expression for this for loop
      * @return the initialization expression
@@ -132,10 +147,15 @@
 
     /**
      * Reset the initialization expression for this for loop
+     * @param lc lexical context
      * @param init new initialization expression
+     * @return new for node if changed or existing if not
      */
-    public void setInit(final Node init) {
-        this.init = init;
+    public ForNode setInit(final LexicalContext lc, final Node init) {
+        if (this.init == init) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new ForNode(this, init, test, body, modify, flags, controlFlowEscapes));
     }
 
     /**
@@ -143,14 +163,16 @@
      * @return true if this is a for in constructor
      */
     public boolean isForIn() {
-        return isForIn;
+        return (flags & IS_FOR_IN) != 0;
     }
 
     /**
      * Flag this to be a for in construct
+     * @param lc lexical context
+     * @return new for node if changed or existing if not
      */
-    public void setIsForIn() {
-        this.isForIn = true;
+    public ForNode setIsForIn(final LexicalContext lc) {
+        return setFlags(lc, flags | IS_FOR_IN);
     }
 
     /**
@@ -159,14 +181,16 @@
      * @return true if this is a for each construct
      */
     public boolean isForEach() {
-        return isForEach;
+        return (flags & IS_FOR_EACH) != 0;
     }
 
     /**
      * Flag this to be a for each construct
+     * @param lc lexical context
+     * @return new for node if changed or existing if not
      */
-    public void setIsForEach() {
-        this.isForEach = true;
+    public ForNode setIsForEach(final LexicalContext lc) {
+        return setFlags(lc, flags | IS_FOR_EACH);
     }
 
     /**
@@ -195,10 +219,15 @@
 
     /**
      * Reset the modification expression for this ForNode
+     * @param lc lexical context
      * @param modify new modification expression
+     * @return new for node if changed or existing if not
      */
-    public void setModify(final Node modify) {
-        this.modify = modify;
+    public ForNode setModify(final LexicalContext lc, final Node modify) {
+        if (this.modify == modify) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new ForNode(this, init, test, body, modify, flags, controlFlowEscapes));
     }
 
     @Override
@@ -207,7 +236,39 @@
     }
 
     @Override
-    public void setTest(final Node test) {
-        this.test = test;
+    public ForNode setTest(final LexicalContext lc, final Node test) {
+        if (this.test == test) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new ForNode(this, init, test, body, modify, flags, controlFlowEscapes));
+    }
+
+    @Override
+    public Block getBody() {
+        return body;
     }
+
+    @Override
+    public ForNode setBody(final LexicalContext lc, final Block body) {
+        if (this.body == body) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new ForNode(this, init, test, body, modify, flags, controlFlowEscapes));
+    }
+
+    @Override
+    public ForNode setControlFlowEscapes(final LexicalContext lc, final boolean controlFlowEscapes) {
+        if (this.controlFlowEscapes == controlFlowEscapes) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new ForNode(this, init, test, body, modify, flags, controlFlowEscapes));
+    }
+
+    private ForNode setFlags(final LexicalContext lc, final int flags) {
+        if (this.flags == flags) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new ForNode(this, init, test, body, modify, flags, controlFlowEscapes));
+    }
+
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Wed May 08 10:10:05 2013 +0100
@@ -30,23 +30,19 @@
 import static jdk.nashorn.internal.ir.Symbol.IS_CONSTANT;
 import static jdk.nashorn.internal.ir.Symbol.IS_TEMP;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Iterator;
+import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
-import java.util.Stack;
+import java.util.Set;
 import jdk.nashorn.internal.codegen.CompileUnit;
 import jdk.nashorn.internal.codegen.Compiler;
-import jdk.nashorn.internal.codegen.Frame;
-import jdk.nashorn.internal.codegen.MethodEmitter;
+import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.codegen.Namespace;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Ignore;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
-import jdk.nashorn.internal.parser.Parser;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.UserAccessorProperty;
@@ -55,9 +51,11 @@
 /**
  * IR representation for function (or script.)
  */
-public class FunctionNode extends Block {
+@Immutable
+public final class FunctionNode extends LexicalContextNode implements Flags<FunctionNode> {
 
-    private static final Type FUNCTION_TYPE = Type.typeFor(ScriptFunction.class);
+    /** Type used for all FunctionNodes */
+    public static final Type FUNCTION_TYPE = Type.typeFor(ScriptFunction.class);
 
     /** Function kinds */
     public enum Kind {
@@ -90,134 +88,106 @@
         /** method has had its types finalized */
         FINALIZED,
         /** method has been emitted to bytecode */
-        EMITTED,
-        /** code installed in a class loader */
-        INSTALLED
+        EMITTED
     }
 
     /** External function identifier. */
     @Ignore
-    private IdentNode ident;
+    private final IdentNode ident;
+
+    /** The body of the function node */
+    private final Block body;
 
     /** Internal function name. */
-    private String name;
+    private final String name;
 
     /** Compilation unit. */
-    private CompileUnit compileUnit;
-
-    /** Method emitter for current method. */
-    private MethodEmitter method;
+    private final CompileUnit compileUnit;
 
     /** Function kind. */
-    private Kind kind;
+    private final Kind kind;
 
     /** List of parameters. */
-    private List<IdentNode> parameters;
+    private final List<IdentNode> parameters;
 
     /** First token of function. **/
-    private long firstToken;
+    private final long firstToken;
 
     /** Last token of function. **/
-    private long lastToken;
+    private final long lastToken;
 
-    /** Variable frames. */
-    private Frame frames;
+    /** Declared symbols in this function node */
+    @Ignore
+    private final Set<Symbol> declaredSymbols;
 
     /** Method's namespace. */
     private final Namespace namespace;
 
-    /** Node representing current this. */
-    @Ignore
-    private IdentNode thisNode;
-
-    /** Node representing current scope. */
-    @Ignore
-    private IdentNode scopeNode;
-
-    /** Node representing return value. */
-    @Ignore
-    private IdentNode resultNode;
-
-    /** Node representing current arguments. */
-    @Ignore
-    private IdentNode argumentsNode;
-
-    /** Node representing callee */
-    @Ignore
-    private IdentNode calleeNode;
-
-    /** Node representing varargs */
-    @Ignore
-    private IdentNode varArgsNode;
-
-    /** Pending label list. */
-    private final Stack<LabelNode> labelStack;
-
-    /** Pending control list. */
-    private final Stack<Node> controlStack;
-
-    /** VarNode for this function statement */
-    @Ignore //this is explicit code anyway and should not be traversed after lower
-    private VarNode funcVarNode;
-
-    /** Line number for function declaration */
-    @Ignore
-    private LineNumberNode funcVarLineNumberNode;
-
-    /** Initializer var func = __callee__, where applicable */
-    @Ignore
-    private Node selfSymbolInit;
-
     /** Current compilation state */
     @Ignore
     private final EnumSet<CompilationState> compilationState;
 
-    /** Type hints, e.g based on parameters at call site */
-    private final Map<IdentNode, Type> specializedTypes;
-
     /** Function flags. */
-    private int flags;
+    private final int flags;
 
     /** Is anonymous function flag. */
-    private static final int IS_ANONYMOUS                = 1 << 0;
+    public static final int IS_ANONYMOUS                = 1 << 0;
+
     /** Is the function created in a function declaration (as opposed to a function expression) */
-    private static final int IS_DECLARED                 = 1 << 1;
+    public static final int IS_DECLARED                 = 1 << 1;
+
     /** is this a strict mode function? */
-    private static final int IS_STRICT_MODE              = 1 << 2;
+    public static final int IS_STRICT                   = 1 << 2;
+
     /** Does the function use the "arguments" identifier ? */
-    private static final int USES_ARGUMENTS              = 1 << 3;
-    /** Are we lowered ? */
-    private static final int IS_LOWERED                  = 1 << 4;
+    public static final int USES_ARGUMENTS              = 1 << 3;
+
     /** Has this node been split because it was too large? */
-    private static final int IS_SPLIT                    = 1 << 5;
-    /** Does the function call eval? */
-    private static final int HAS_EVAL                    = 1 << 6;
-    /** Does the function contain a with block ? */
-    private static final int HAS_WITH                    = 1 << 7;
-    /** Does a descendant function contain a with or eval? */
-    private static final int HAS_DESCENDANT_WITH_OR_EVAL = 1 << 8;
-    /** Does the function define "arguments" identifier as a parameter of nested function name? */
-    private static final int DEFINES_ARGUMENTS           = 1 << 9;
-    /** Does the function need a self symbol? */
-    private static final int NEEDS_SELF_SYMBOL           = 1 << 10;
+    public static final int IS_SPLIT                    = 1 << 4;
+
+    /** Does the function call eval? If it does, then all variables in this function might be get/set by it and it can
+     * introduce new variables into this function's scope too.*/
+    public static final int HAS_EVAL                    = 1 << 5;
+
+    /** Does a nested function contain eval? If it does, then all variables in this function might be get/set by it. */
+    public static final int HAS_NESTED_EVAL = 1 << 6;
+
+    /**
+     * Flag this function as one that defines the identifier "arguments" as a function parameter or nested function
+     * name. This precludes it from needing to have an Arguments object defined as "arguments" local variable. Note that
+     * defining a local variable named "arguments" still requires construction of the Arguments object (see
+     * ECMAScript 5.1 Chapter 10.5).
+     * @see #needsArguments()
+     */
+    public static final int DEFINES_ARGUMENTS           = 1 << 8;
+
     /** Does this function or any of its descendants use variables from an ancestor function's scope (incl. globals)? */
-    private static final int USES_ANCESTOR_SCOPE         = 1 << 11;
+    public static final int USES_ANCESTOR_SCOPE         = 1 << 9;
+
     /** Is this function lazily compiled? */
-    private static final int IS_LAZY                     = 1 << 12;
+    public static final int IS_LAZY                     = 1 << 10;
+
     /** Does this function have lazy, yet uncompiled children */
-    private static final int HAS_LAZY_CHILDREN           = 1 << 13;
+    public static final int HAS_LAZY_CHILDREN           = 1 << 11;
+
     /** Does this function have lazy, yet uncompiled children */
-    private static final int IS_PROGRAM                   = 1 << 14;
+    public static final int IS_PROGRAM                  = 1 << 12;
+
+    /** Does this function have nested declarations? */
+    public static final int HAS_FUNCTION_DECLARATIONS   = 1 << 13;
 
-    /** Does this function or any nested functions contain a with or an eval? */
-    private static final int HAS_DEEP_WITH_OR_EVAL = HAS_EVAL | HAS_WITH | HAS_DESCENDANT_WITH_OR_EVAL;
+    /** Does this function or any nested functions contain an eval? */
+    private static final int HAS_DEEP_EVAL = HAS_EVAL | HAS_NESTED_EVAL;
+
     /** Does this function need to store all its variables in scope? */
-    private static final int HAS_ALL_VARS_IN_SCOPE = HAS_DEEP_WITH_OR_EVAL | IS_SPLIT | HAS_LAZY_CHILDREN;
+    private static final int HAS_ALL_VARS_IN_SCOPE = HAS_DEEP_EVAL | IS_SPLIT | HAS_LAZY_CHILDREN;
+
     /** Does this function potentially need "arguments"? Note that this is not a full test, as further negative check of REDEFINES_ARGS is needed. */
     private static final int MAYBE_NEEDS_ARGUMENTS = USES_ARGUMENTS | HAS_EVAL;
-    /** Does this function need the parent scope? It needs it if either it or its descendants use variables from it, or have a deep with or eval.
+
+    /** Does this function need the parent scope? It needs it if either it or its descendants use variables from it, or have a deep eval.
      *  We also pessimistically need a parent scope if we have lazy children that have not yet been compiled */
-    private static final int NEEDS_PARENT_SCOPE = USES_ANCESTOR_SCOPE | HAS_DEEP_WITH_OR_EVAL | HAS_LAZY_CHILDREN;
+    private static final int NEEDS_PARENT_SCOPE = USES_ANCESTOR_SCOPE | HAS_DEEP_EVAL | HAS_LAZY_CHILDREN;
 
     /** What is the return type of this function? */
     private Type returnType = Type.UNKNOWN;
@@ -225,107 +195,77 @@
     /**
      * Constructor
      *
-     * @param source    the source
-     * @param token     token
-     * @param finish    finish
-     * @param namespace the namespace
-     * @param ident     the identifier
-     * @param name      the name of the function
+     * @param source     the source
+     * @param token      token
+     * @param finish     finish
+     * @param firstToken first token of the funtion node (including the function declaration)
+     * @param namespace  the namespace
+     * @param ident      the identifier
+     * @param name       the name of the function
+     * @param parameters parameter list
+     * @param kind       kind of function as in {@link FunctionNode.Kind}
+     * @param flags      initial flags
      */
-    public FunctionNode(final Source source, final long token, final int finish, final Namespace namespace, final IdentNode ident, final String name) {
+    public FunctionNode(
+        final Source source,
+        final long token,
+        final int finish,
+        final long firstToken,
+        final Namespace namespace,
+        final IdentNode ident,
+        final String name,
+        final List<IdentNode> parameters,
+        final FunctionNode.Kind kind,
+        final int flags) {
         super(source, token, finish);
 
         this.ident             = ident;
         this.name              = name;
-        this.kind              = Kind.NORMAL;
-        this.parameters        = new ArrayList<>();
-        this.firstToken        = token;
+        this.kind              = kind;
+        this.parameters        = parameters;
+        this.firstToken        = firstToken;
         this.lastToken         = token;
         this.namespace         = namespace;
-        this.labelStack        = new Stack<>();
-        this.controlStack      = new Stack<>();
         this.compilationState  = EnumSet.of(CompilationState.INITIALIZED);
-        this.specializedTypes  = new HashMap<>();
+        this.declaredSymbols   = new HashSet<>();
+        this.flags             = flags;
+        this.compileUnit       = null;
+        this.body              = null;
     }
 
-    private FunctionNode(final FunctionNode functionNode, final CopyState cs) {
-        super(functionNode, cs);
-
-        this.ident = (IdentNode)cs.existingOrCopy(functionNode.ident);
-        this.name  = functionNode.name;
-        this.kind  = functionNode.kind;
-
-        this.parameters = new ArrayList<>();
-        for (final IdentNode param : functionNode.getParameters()) {
-            this.parameters.add((IdentNode)cs.existingOrCopy(param));
-        }
+    private FunctionNode(final FunctionNode functionNode, final long lastToken, final int flags, final Type returnType, final CompileUnit compileUnit, final EnumSet<CompilationState> compilationState, final Block body) {
+        super(functionNode);
+        this.flags = flags;
+        this.returnType = returnType;
+        this.compileUnit = compileUnit;
+        this.lastToken = lastToken;
+        this.compilationState = compilationState;
+        this.body  = body;
 
-        this.firstToken        = functionNode.firstToken;
-        this.lastToken         = functionNode.lastToken;
-        this.namespace         = functionNode.getNamespace();
-        this.thisNode          = (IdentNode)cs.existingOrCopy(functionNode.thisNode);
-        this.scopeNode         = (IdentNode)cs.existingOrCopy(functionNode.scopeNode);
-        this.resultNode        = (IdentNode)cs.existingOrCopy(functionNode.resultNode);
-        this.argumentsNode     = (IdentNode)cs.existingOrCopy(functionNode.argumentsNode);
-        this.varArgsNode       = (IdentNode)cs.existingOrCopy(functionNode.varArgsNode);
-        this.calleeNode        = (IdentNode)cs.existingOrCopy(functionNode.calleeNode);
-        this.labelStack        = new Stack<>();
-        this.controlStack      = new Stack<>();
-
-        this.flags = functionNode.flags;
-
-        this.funcVarNode = (VarNode)cs.existingOrCopy(functionNode.funcVarNode);
-        /** VarNode for this function statement */
-
-        this.compilationState = EnumSet.copyOf(functionNode.compilationState);
-        this.specializedTypes = new HashMap<>();
+        // the fields below never change - they are final and assigned in constructor
+        this.name = functionNode.name;
+        this.ident = functionNode.ident;
+        this.namespace = functionNode.namespace;
+        this.declaredSymbols = functionNode.declaredSymbols;
+        this.kind  = functionNode.kind;
+        this.parameters = functionNode.parameters;
+        this.firstToken = functionNode.firstToken;
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        // deep clone all parent blocks
-        return new FunctionNode(this, cs);
-    }
-
-    @Override
-    public Node accept(final NodeVisitor visitor) {
-        final FunctionNode  saveFunctionNode  = visitor.getCurrentFunctionNode();
-        final Block         saveBlock         = visitor.getCurrentBlock();
-        final MethodEmitter saveMethodEmitter = visitor.getCurrentMethodEmitter();
-        final CompileUnit   saveCompileUnit   = visitor.getCurrentCompileUnit();
-
-        visitor.setCurrentFunctionNode(this);
-        visitor.setCurrentBlock(this);
-
-        try {
-            if (visitor.enterFunctionNode(this) != null) {
-                if (ident != null) {
-                    ident = (IdentNode)ident.accept(visitor);
-                }
-
-                for (int i = 0, count = parameters.size(); i < count; i++) {
-                    parameters.set(i, (IdentNode)parameters.get(i).accept(visitor));
-                }
-
-                for (int i = 0, count = statements.size(); i < count; i++) {
-                    statements.set(i, statements.get(i).accept(visitor));
-                }
-
-                return visitor.leaveFunctionNode(this);
-            }
-        } finally {
-            visitor.setCurrentBlock(saveBlock);
-            visitor.setCurrentFunctionNode(saveFunctionNode);
-            visitor.setCurrentCompileUnit(saveCompileUnit);
-            visitor.setCurrentMethodEmitter(saveMethodEmitter);
+    public Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterFunctionNode(this)) {
+            return visitor.leaveFunctionNode(setBody(lc, (Block)body.accept(visitor)));
         }
-
         return this;
     }
 
-    @Override
-    public boolean needsScope() {
-        return super.needsScope() || isProgram();
+    /**
+     * Get the compilation state of this function
+     * @return the compilation state
+     */
+    public EnumSet<CompilationState> getState() {
+        return compilationState;
     }
 
     /**
@@ -357,62 +297,17 @@
      * FunctionNode has been lowered, the compiler will add
      * {@code CompilationState#LOWERED} to the state vector
      *
+     * @param lc lexical context
      * @param state {@link CompilationState} to add
-     */
-    public void setState(final CompilationState state) {
-        compilationState.add(state);
-    }
-
-    /*
-     * Frame management.
-     */
-
-    /**
-     * Push a new block frame.
-     *
-     * @return the new frame
-     */
-    public final Frame pushFrame() {
-        frames = new Frame(frames);
-        return frames;
-    }
-
-    /**
-     * Pop a block frame.
+     * @return function node or a new one if state was changed
      */
-    public final void popFrame() {
-        frames = frames.getPrevious();
-    }
-
-    /**
-     * Create a temporary variable to the current frame.
-     *
-     * @param currentFrame Frame to add to - defaults to current function frame
-     * @param type  Strong type of symbol.
-     * @param node  Primary node to use symbol.
-     *
-     * @return Symbol used.
-     */
-    public Symbol newTemporary(final Frame currentFrame, final Type type, final Node node) {
-        assert currentFrame != null;
-        Symbol symbol = node.getSymbol();
-
-        // If no symbol already present.
-        if (symbol == null) {
-            final String uname = uniqueName(TEMP_PREFIX.tag());
-            symbol = new Symbol(uname, IS_TEMP, type);
-            symbol.setNode(node);
+    public FunctionNode setState(final LexicalContext lc, final CompilationState state) {
+        if (this.compilationState.equals(state)) {
+            return this;
         }
-
-        // Assign a slot if it doesn't have one.
-        if (!symbol.hasSlot()) {
-            currentFrame.addSymbol(symbol);
-        }
-
-        // Set symbol to node.
-        node.setSymbol(symbol);
-
-        return symbol;
+        final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
+        newState.add(state);
+        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, newState, body));
     }
 
     /**
@@ -425,18 +320,6 @@
     }
 
     /**
-     * Add a new temporary variable to the current frame
-     *
-     * @param type Strong type of symbol
-     * @param node Primary node to use symbol
-     *
-     * @return symbol used
-     */
-    public Symbol newTemporary(final Type type, final Node node) {
-        return newTemporary(frames, type, node);
-    }
-
-    /**
      * Create a virtual symbol for a literal.
      *
      * @param literalNode Primary node to use symbol.
@@ -444,9 +327,8 @@
      * @return Symbol used.
      */
     public Symbol newLiteral(final LiteralNode<?> literalNode) {
-        final String uname = uniqueName(LITERAL_PREFIX.tag());
+        final String uname = uniqueName(LITERAL_PREFIX.symbolName());
         final Symbol symbol = new Symbol(uname, IS_CONSTANT, literalNode.getType());
-        symbol.setNode(literalNode);
         literalNode.setSymbol(symbol);
 
         return symbol;
@@ -482,29 +364,35 @@
         sb.append(')');
     }
 
+    @Override
+    public boolean getFlag(final int flag) {
+        return (flags & flag) != 0;
+    }
+
+    @Override
+    public FunctionNode setFlags(final LexicalContext lc, int flags) {
+        if (this.flags == flags) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body));
+    }
+
+    @Override
+    public FunctionNode clearFlag(final LexicalContext lc, final int flag) {
+        return setFlags(lc, flags & ~flag);
+    }
+
+    @Override
+    public FunctionNode setFlag(final LexicalContext lc, final int flag) {
+        return setFlags(lc, flags | flag);
+    }
+
     /**
      * Returns true if the function is the top-level program.
      * @return True if this function node represents the top-level program.
      */
     public boolean isProgram() {
-        return (flags & IS_PROGRAM) != 0;
-    }
-
-    /**
-     * Marks the function as representing the top-level program.
-     */
-    public void setProgram() {
-        flags |= IS_PROGRAM;
-    }
-
-    /**
-     * Get the control stack. Used when parsing to establish nesting depths of
-     * different control structures
-     *
-     * @return the control stack
-     */
-    public Stack<Node> getControlStack() {
-        return controlStack;
+        return getFlag(IS_PROGRAM);
     }
 
     /**
@@ -512,54 +400,7 @@
      * @return true if lazy
      */
     public boolean isLazy() {
-        return (flags & IS_LAZY) != 0;
-    }
-
-    /**
-     * Set if this function should be lazily generated
-     * @param isLazy is lazy
-     */
-    public void setIsLazy(final boolean isLazy) {
-        this.flags = isLazy ? flags | IS_LAZY : flags & ~IS_LAZY;
-    }
-
-    /**
-     * Check if the {@code with} keyword is used in this function
-     *
-     * @return true if {@code with} is used
-     */
-    public boolean hasWith() {
-        return (flags & HAS_WITH) != 0;
-    }
-
-    /**
-     * Flag this function as using the {@code with} keyword
-     * @param ancestors the iterator over functions in this functions's containing lexical context
-     */
-    public void setHasWith(final Iterator<FunctionNode> ancestors) {
-        if(!hasWith()) {
-            this.flags |= HAS_WITH;
-            // with requires scope in parents.
-            // TODO: refine this. with should not force all variables in parents to be in scope, only those that are
-            // actually referenced as identifiers by name
-            markParentForWithOrEval(ancestors);
-        }
-    }
-
-    private void markParentForWithOrEval(final Iterator<FunctionNode> ancestors) {
-        // If this is invoked, then either us or a descendant uses with or eval, meaning we must have our own scope.
-        setNeedsScope();
-
-        if(ancestors.hasNext()) {
-            ancestors.next().setDescendantHasWithOrEval(ancestors);
-        }
-    }
-
-    private void setDescendantHasWithOrEval(final Iterator<FunctionNode> ancestors) {
-        if((flags & HAS_DESCENDANT_WITH_OR_EVAL) == 0) {
-            flags |= HAS_DESCENDANT_WITH_OR_EVAL;
-            markParentForWithOrEval(ancestors);
-        }
+        return getFlag(IS_LAZY);
     }
 
     /**
@@ -568,30 +409,7 @@
      * @return true if {@code eval} is used
      */
     public boolean hasEval() {
-        return (flags & HAS_EVAL) != 0;
-    }
-
-    /**
-     * Flag this function as calling the {@code eval} function
-     * @param ancestors the iterator over functions in this functions's containing lexical context
-     */
-    public void setHasEval(final Iterator<FunctionNode> ancestors) {
-        if(!hasEval()) {
-            this.flags |= HAS_EVAL;
-            markParentForWithOrEval(ancestors);
-        }
-    }
-
-    /**
-     * Test whether this function or any of its nested functions contains a <tt>with</tt> statement
-     * or an <tt>eval</tt> call.
-     *
-     * @see #hasWith()
-     * @see #hasEval()
-     * @return true if this or a nested function contains with or eval
-     */
-    public boolean hasDeepWithOrEval() {
-        return (flags & HAS_DEEP_WITH_OR_EVAL) != 0;
+        return getFlag(HAS_EVAL);
     }
 
     /**
@@ -603,90 +421,11 @@
     }
 
     /**
-     * Set the first token for this function
-     * @param firstToken the first token
-     */
-    public void setFirstToken(final long firstToken) {
-        this.firstToken = firstToken;
-    }
-
-    /**
-     * Returns a list of functions declared by this function. Only includes declared functions, and does not include any
-     * function expressions that might occur in its body.
-     * @return a list of functions declared by this function.
+     * Check whether this function has nested function declarations
+     * @return true if nested function declarations exist
      */
-    public List<FunctionNode> getDeclaredFunctions() {
-        // Note that the function does not have a dedicated list of declared functions, but rather relies on the
-        // invariant that all function declarations are at the beginning of the statement list as VarNode with a
-        // FunctionNode marked as statement with its variable initializer. Every VarNode is also preceded by a
-        // LineNumberNode. This invariant is established by the parser and has to be preserved in visitors.
-        final List<FunctionNode> fns = new ArrayList<>();
-        for (final Node stmt : statements) {
-            if(stmt instanceof LineNumberNode) {
-                continue;
-            } else if(stmt instanceof VarNode) {
-                final Node init = ((VarNode)stmt).getInit();
-                if(init instanceof FunctionNode) {
-                    final FunctionNode fn = (FunctionNode)init;
-                    if(fn.isDeclared()) {
-                        fns.add(fn);
-                        continue;
-                    }
-                }
-            }
-            // Node is neither a LineNumberNode, nor a function declaration VarNode. Since all function declarations are
-            // at the start of the function, we've reached the end of function declarations.
-            break;
-        }
-        return fns;
-    }
-
-    /**
-     * Get the label stack. This is used by the parser to establish
-     * label nesting depth
-     *
-     * @return the label stack
-     */
-    public Stack<LabelNode> getLabelStack() {
-        return labelStack;
-    }
-
-    /**
-     * If this function needs to use var args, return the identifier to the node used
-     * for the var args structure
-     *
-     * @return IdentNode representing the var args structure
-     */
-    public IdentNode getVarArgsNode() {
-        return varArgsNode;
-    }
-
-    /**
-     * Set the identifier to the node used for the var args structure
-     *
-     * @param varArgsNode IdentNode representing the var args
-     */
-    public void setVarArgsNode(final IdentNode varArgsNode) {
-        this.varArgsNode = varArgsNode;
-    }
-
-    /**
-     * If this function uses the {@code callee} variable, return the node used
-     * as this variable
-     *
-     * @return an IdentNode representing the {@code callee} variable
-     */
-    public IdentNode getCalleeNode() {
-        return calleeNode;
-    }
-
-    /**
-     * If this function uses the {@code callee} variable, set the node representing the
-     * callee
-     * @param calleeNode an IdentNode representing the callee
-     */
-    public void setCalleeNode(final IdentNode calleeNode) {
-        this.calleeNode = calleeNode;
+    public boolean hasDeclaredFunctions() {
+        return getFlag(HAS_FUNCTION_DECLARATIONS);
     }
 
     /**
@@ -697,26 +436,7 @@
      * @return true if the function's generated Java method needs a {@code callee} parameter.
      */
     public boolean needsCallee() {
-        return needsParentScope() || needsSelfSymbol() || (needsArguments() && !isStrictMode());
-    }
-
-    /**
-     * If this is a function where {@code arguments} is used, return the node used as the {@code arguments}
-     * variable
-     * @return an IdentNode representing {@code arguments}
-     */
-    public IdentNode getArgumentsNode() {
-        return argumentsNode;
-    }
-
-    /**
-     * If this is a Function where {@code arguments} is used, an identifier to the node representing
-     * the {@code arguments} value has to be supplied by the compiler
-     *
-     * @param argumentsNode IdentNode that represents {@code arguments}
-     */
-    public void setArgumentsNode(final IdentNode argumentsNode) {
-        this.argumentsNode = argumentsNode;
+        return needsParentScope() || needsSelfSymbol() || (needsArguments() && !isStrict());
     }
 
     /**
@@ -728,11 +448,42 @@
     }
 
     /**
-     * Reset the identifier for this function
-     * @param ident IdentNode for new identifier
+     * Return a set of symbols declared in this function node. This
+     * is only relevant after Attr, otherwise it will be an empty
+     * set as no symbols have been introduced
+     * @return set of declared symbols in function
+     */
+    public Set<Symbol> getDeclaredSymbols() {
+        return Collections.unmodifiableSet(declaredSymbols);
+    }
+
+    /**
+     * Add a declared symbol to this function node
+     * @param symbol symbol that is declared
      */
-    public void setIdent(final IdentNode ident) {
-        this.ident = ident;
+    public void addDeclaredSymbol(final Symbol symbol) {
+        declaredSymbols.add(symbol);
+    }
+
+    /**
+     * Get the function body
+     * @return the function body
+     */
+    public Block getBody() {
+        return body;
+    }
+
+    /**
+     * Reset the function body
+     * @param lc lexical context
+     * @param body new body
+     * @return new function node if body changed, same if not
+     */
+    public FunctionNode setBody(final LexicalContext lc, final Block body) {
+        if(this.body == body) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body));
     }
 
     /**
@@ -748,17 +499,6 @@
     }
 
     /**
-     * Flag this function as one that defines the identifier "arguments" as a function parameter or nested function
-     * name. This precludes it from needing to have an Arguments object defined as "arguments" local variable. Note that
-     * defining a local variable named "arguments" still requires construction of the Arguments object (see
-     * ECMAScript 5.1 Chapter 10.5).
-     * @see #needsArguments()
-     */
-    public void setDefinesArguments() {
-        this.flags |= DEFINES_ARGUMENTS;
-    }
-
-    /**
      * Returns true if this function needs to have an Arguments object defined as a local variable named "arguments".
      * Functions that use "arguments" as identifier and don't define it as a name of a parameter or a nested function
      * (see ECMAScript 5.1 Chapter 10.5), as well as any function that uses eval or with, or has a nested function that
@@ -770,15 +510,7 @@
     public boolean needsArguments() {
         // uses "arguments" or calls eval, but it does not redefine "arguments", and finally, it's not a script, since
         // for top-level script, "arguments" is picked up from Context by Global.init() instead.
-        return (flags & MAYBE_NEEDS_ARGUMENTS) != 0 && (flags & DEFINES_ARGUMENTS) == 0 && !isProgram();
-    }
-
-    /**
-     * Flags this function as one that uses the "arguments" identifier.
-     * @see #needsArguments()
-     */
-    public void setUsesArguments() {
-        flags |= USES_ARGUMENTS;
+        return getFlag(MAYBE_NEEDS_ARGUMENTS) && !getFlag(DEFINES_ARGUMENTS) && !isProgram();
     }
 
     /**
@@ -789,7 +521,7 @@
      * @return true if the function needs parent scope.
      */
     public boolean needsParentScope() {
-        return (flags & NEEDS_PARENT_SCOPE) != 0 || isProgram();
+        return getFlag(NEEDS_PARENT_SCOPE) || isProgram();
     }
 
     /**
@@ -802,15 +534,6 @@
     }
 
     /**
-     * Set the kind of this function
-     * @see FunctionNode.Kind
-     * @param kind the kind
-     */
-    public void setKind(final Kind kind) {
-        this.kind = kind;
-    }
-
-    /**
      * Return the last token for this function's code
      * @return last token
      */
@@ -820,10 +543,15 @@
 
     /**
      * Set the last token for this function's code
+     * @param lc lexical context
      * @param lastToken the last token
+     * @return function node or a new one if state was changed
      */
-    public void setLastToken(final long lastToken) {
-        this.lastToken = lastToken;
+    public FunctionNode setLastToken(final LexicalContext lc, final long lastToken) {
+        if (this.lastToken == lastToken) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body));
     }
 
     /**
@@ -835,21 +563,13 @@
     }
 
     /**
-     * Set the name of this function
-     * @param name the name
-     */
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    /**
      * Check if this function should have all its variables in its own scope. Scripts, split sub-functions, and
      * functions having with and/or eval blocks are such.
      *
      * @return true if all variables should be in scope
      */
     public boolean allVarsInScope() {
-        return isProgram() || (flags & HAS_ALL_VARS_IN_SCOPE) != 0;
+        return isProgram() || getFlag(HAS_ALL_VARS_IN_SCOPE);
     }
 
     /**
@@ -858,15 +578,7 @@
      * @return true if this function is split from a larger one
      */
     public boolean isSplit() {
-        return (flags & IS_SPLIT) != 0;
-    }
-
-    /**
-     * Flag this function node as being a sub-function generated by the splitter
-     */
-    public void setIsSplit() {
-        this.flags |= IS_SPLIT;
-        setNeedsScope();
+        return getFlag(IS_SPLIT);
     }
 
     /**
@@ -875,15 +587,7 @@
      * @return true if there are lazy child functions
      */
     public boolean hasLazyChildren() {
-        return (flags & HAS_LAZY_CHILDREN) != 0;
-    }
-
-    /**
-     * Flag this function node as having yet-to-be-generated child functions
-     */
-    public void setHasLazyChildren() {
-        this.flags |= HAS_LAZY_CHILDREN;
-        setNeedsScope();
+        return getFlag(HAS_LAZY_CHILDREN);
     }
 
     /**
@@ -895,66 +599,13 @@
     }
 
     /**
-     * Set the paremeters to this function
-     * @param parameters a list of IdentNodes representing parameters in left to right order
-     */
-    public void setParameters(final List<IdentNode> parameters) {
-        this.parameters = parameters;
-    }
-
-    /**
      * Get a specialized type for an identity, if one exists
      * @param node node to check specialized type for
      * @return null if no specialization exists, otherwise type
      */
+    @SuppressWarnings("static-method")
     public Type getSpecializedType(final IdentNode node) {
-        return specializedTypes.get(node);
-    }
-
-    /**
-     * Set parameter type hints for specialization.
-     * @param types types array of length equal to parameter list size
-     */
-    public void setParameterTypes(final Class<?>[] types) {
-        assert types.length == parameters.size() : "Type vector length doesn't correspond to parameter types";
-        //diff - skip the callee and this etc, they are not explicit params in the parse tree
-        for (int i = 0; i < types.length ; i++) {
-            specializedTypes.put(parameters.get(i), Type.typeFor(types[i]));
-        }
-    }
-
-    /**
-     * Get the identifier for the variable in which the function return value
-     * should be stored
-     * @return an IdentNode representing the return value
-     */
-    public IdentNode getResultNode() {
-        return resultNode;
-    }
-
-    /**
-     * Set the identifier representing the variable in which the function return
-     * value should be stored
-     * @param resultNode an IdentNode representing the return value
-     */
-    public void setResultNode(final IdentNode resultNode) {
-        this.resultNode = resultNode;
-    }
-
-    /**
-     * Get the identifier representing this function's scope
-     * @return an IdentNode representing this function's scope
-     */
-    public IdentNode getScopeNode() {
-        return scopeNode;
-    }
-
-    /**
-     * Set the identifier representing this function's scope
-     * @param scopeNode an IdentNode representing this function's scope
-     */
-    public void setScopeNode(final IdentNode scopeNode) {
-        this.scopeNode = scopeNode;
+        return null; //TODO implement specialized types later
     }
 
     /**
@@ -962,15 +613,7 @@
      * @return true if function is declared.
      */
     public boolean isDeclared() {
-        return (flags & IS_DECLARED) != 0;
-    }
-
-    /**
-     * Flag this function as being created as a function declaration (as opposed to a function expression).
-     * @see Parser
-     */
-    public void setIsDeclared() {
-        this.flags |= IS_DECLARED;
+        return getFlag(IS_DECLARED);
     }
 
     /**
@@ -978,15 +621,7 @@
      * @return true if function is anonymous
      */
     public boolean isAnonymous() {
-        return (flags & IS_ANONYMOUS) != 0;
-    }
-
-    /**
-     * Flag this function as an anonymous function.
-     * @see Parser
-     */
-    public void setIsAnonymous() {
-        this.flags |= IS_ANONYMOUS;
+        return getFlag(IS_ANONYMOUS);
     }
 
     /**
@@ -995,109 +630,7 @@
      * @return true if function needs a symbol for self
      */
     public boolean needsSelfSymbol() {
-        return (flags & NEEDS_SELF_SYMBOL) != 0;
-    }
-
-    /**
-     * Get the initializer statement for the __callee__ variable, where applicable
-     * for self references
-     * @return initialization
-     */
-    public Node getSelfSymbolInit() {
-        return this.selfSymbolInit;
-    }
-
-    /**
-     * Flag the function as needing a self symbol. This is needed only for
-     * self referring functions
-     * @param selfSymbolInit initialization expression for self symbol
-     */
-    public void setNeedsSelfSymbol(final Node selfSymbolInit) {
-        this.flags |= NEEDS_SELF_SYMBOL;
-        this.selfSymbolInit = selfSymbolInit;
-    }
-
-    /**
-     * Marks this function as using any of its ancestors' scopes.
-     */
-    public void setUsesAncestorScope() {
-        this.flags |= USES_ANCESTOR_SCOPE;
-    }
-
-    @Override
-    void setUsesParentScopeSymbol(Symbol symbol, Iterator<Block> ancestors) {
-        setUsesAncestorScope();
-        super.setUsesParentScopeSymbol(symbol, ancestors);
-    }
-
-    /**
-     * Return the node representing {@code this} in this function
-     * @return IdentNode representing {@code this}
-     */
-    public IdentNode getThisNode() {
-        return thisNode;
-    }
-
-    /**
-     * Set the node representing {@code this} in this function
-     * @param thisNode identifier representing {@code this}
-     */
-    public void setThisNode(final IdentNode thisNode) {
-        this.thisNode = thisNode;
-    }
-
-    /**
-     * Every function declared as {@code function x()} is internally hoisted
-     * and represented as {@code var x = function()  ... }. This getter returns
-     * the VarNode representing this virtual assignment
-     *
-     * @return the var node emitted for setting this function symbol
-     */
-    public VarNode getFunctionVarNode() {
-        return funcVarNode;
-    }
-
-    /**
-     * Set the virtual VarNode assignment for this function.
-     * @see FunctionNode#getFunctionVarNode()
-     *
-     * @param varNode the virtual var node assignment
-     */
-    public void setFunctionVarNode(final VarNode varNode) {
-        funcVarNode = varNode;
-    }
-
-    /**
-     * The line number information where the function was declared must be propagated
-     * to the virtual {@code var x = function() ... } assignment described in
-     * {@link FunctionNode#getFunctionVarNode()}
-     * This maintains the line number of the declaration
-     *
-     * @return a line number node representing the line this function was declared
-     */
-    public LineNumberNode getFunctionVarLineNumberNode() {
-        return funcVarLineNumberNode;
-    }
-
-    /**
-     * Set the virtual VarNode assignment for this function, along with
-     * a line number node for tracking the original start line of the function
-     * declaration
-     *
-     * @param varNode    the virtual var node assignment
-     * @param lineNumber the line number node for the function declaration
-     */
-    public void setFunctionVarNode(final VarNode varNode, final LineNumberNode lineNumber) {
-        funcVarNode           = varNode;
-        funcVarLineNumberNode = lineNumber;
-    }
-
-    /**
-     * Get the namespace this function uses for its symbols
-     * @return the namespace
-     */
-    public Namespace getNamespace() {
-        return namespace;
+        return body.getFlag(Block.NEEDS_SELF_SYMBOL);
     }
 
     @Override
@@ -1118,47 +651,38 @@
 
     /**
      * Set the function return type
-     *
+     * @param lc lexical context
      * @param returnType new return type
+     * @return function node or a new one if state was changed
      */
-    public void setReturnType(final Type returnType) {
+    public FunctionNode setReturnType(final LexicalContext lc, final Type returnType) {
         //we never bother with object types narrower than objects, that will lead to byte code verification errors
         //as for instance even if we know we are returning a string from a method, the code generator will always
         //treat it as an object, at least for now
-        this.returnType = Type.widest(this.returnType,  returnType.isObject() ? Type.OBJECT : returnType);
-    }
-
-    /**
-     * Set strict mode on or off for this function
-     *
-     * @param isStrictMode true if strict mode should be enabled
-     */
-    public void setStrictMode(final boolean isStrictMode) {
-        flags = isStrictMode ? flags | IS_STRICT_MODE : flags & ~IS_STRICT_MODE;
+        if (this.returnType == returnType) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(
+            lc,
+            this,
+            new FunctionNode(
+                this,
+                lastToken,
+                flags,
+                Type.widest(this.returnType, returnType.isObject() ?
+                    Type.OBJECT :
+                    returnType),
+                compileUnit,
+                compilationState,
+                body));
     }
 
     /**
      * Check if the function is generated in strict mode
      * @return true if strict mode enabled for function
      */
-    public boolean isStrictMode() {
-        return (flags & IS_STRICT_MODE) != 0;
-    }
-
-    /**
-     * Set the lowered state
-     */
-    public void setIsLowered() {
-        flags |= IS_LOWERED;
-    }
-
-    /**
-     * Get the lowered state
-     *
-     * @return true if function is lowered
-     */
-    public boolean isLowered() {
-        return (flags & IS_LOWERED) != 0;
+    public boolean isStrict() {
+        return getFlag(IS_STRICT);
     }
 
     /**
@@ -1173,25 +697,47 @@
     /**
      * Reset the compile unit used to compile this function
      * @see Compiler
+     * @param lc lexical context
      * @param compileUnit the compile unit
+     * @return function node or a new one if state was changed
      */
-    public void setCompileUnit(final CompileUnit compileUnit) {
-        this.compileUnit = compileUnit;
+    public FunctionNode setCompileUnit(final LexicalContext lc, final CompileUnit compileUnit) {
+        if (this.compileUnit == compileUnit) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body));
     }
 
     /**
-     * Return the method emitter used to write bytecode for this function
-     * @return the method emitter
+     * Create a temporary variable to the current frame.
+     *
+     * @param block that needs the temporary
+     * @param type  Strong type of symbol.
+     * @param node  Primary node to use symbol.
+     *
+     * @return Symbol used.
      */
-    public MethodEmitter getMethodEmitter() {
-        return method;
+    public Symbol ensureSymbol(final Block block, final Type type, final Node node) {
+        Symbol symbol = node.getSymbol();
+
+        // If no symbol already present.
+        if (symbol == null) {
+            final String uname = uniqueName(TEMP_PREFIX.symbolName());
+            symbol = new Symbol(uname, IS_TEMP, type);
+            block.putSymbol(uname, symbol);
+            node.setSymbol(symbol);
+        }
+
+        return symbol;
     }
 
     /**
-     * Set the method emitter that is to be used to write bytecode for this function
-     * @param method a method emitter
+     * Get the symbol for a compiler constant, or null if not available (yet)
+     * @param cc compiler constant
+     * @return symbol for compiler constant, or null if not defined yet (for example in Lower)
      */
-    public void setMethodEmitter(final MethodEmitter method) {
-        this.method = method;
+    public Symbol compilerConstant(final CompilerConstants cc) {
+        return body.getExistingSymbol(cc.symbolName());
     }
+
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java	Wed May 08 10:10:05 2013 +0100
@@ -32,13 +32,15 @@
 
 import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for an identifier.
  */
-public class IdentNode extends Node implements PropertyKey, TypeOverride<IdentNode>, FunctionCall {
+@Immutable
+public final class IdentNode extends Node implements PropertyKey, TypeOverride<IdentNode>, FunctionCall {
     private static final int PROPERTY_NAME    = 1 << 0;
     private static final int INITIALIZED_HERE = 1 << 1;
     private static final int FUNCTION         = 1 << 2;
@@ -47,9 +49,9 @@
     private final String name;
 
     /** Type for a callsite, e.g. X in a get()X or a set(X)V */
-    private Type callSiteType;
+    private final Type callSiteType;
 
-    private byte flags;
+    private final int flags;
 
     /**
      * Constructor
@@ -62,6 +64,15 @@
     public IdentNode(final Source source, final long token, final int finish, final String name) {
         super(source, token, finish);
         this.name = name;
+        this.callSiteType = null;
+        this.flags = 0;
+    }
+
+    private IdentNode(final IdentNode identNode, final String name, final Type callSiteType, final int flags) {
+        super(identNode);
+        this.name = name;
+        this.callSiteType = callSiteType;
+        this.flags = flags;
     }
 
     /**
@@ -71,8 +82,9 @@
      */
     public IdentNode(final IdentNode identNode) {
         super(identNode);
-        this.name  = identNode.getName();
-        this.flags = identNode.flags;
+        this.name         = identNode.getName();
+        this.callSiteType = null;
+        this.flags        = identNode.flags;
     }
 
     @Override
@@ -92,40 +104,15 @@
 
     @Override
     public IdentNode setType(final Type type) {
-        if (DEBUG_FIELDS && getSymbol() != null && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
-            ObjectClassGenerator.LOG.info(getClass().getName() + " " + this + " => " + type + " instead of " + getType());
-        }
         // do NOT, repeat NOT touch the symbol here. it might be a local variable or whatever. This is the override if it isn't
-        if(this.callSiteType == type) {
+        if (this.callSiteType == type) {
             return this;
         }
-        final IdentNode n = (IdentNode)clone();
-        n.callSiteType = type;
-        return n;
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new IdentNode(this);
-    }
+        if (DEBUG_FIELDS && getSymbol() != null && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
+            ObjectClassGenerator.LOG.info(getClass().getName(), " ", this, " => ", type, " instead of ", getType());
+        }
 
-    /**
-     * Test to see if two IdentNode are the same.
-     *
-     * @param other Other ident.
-     * @return true if the idents are the same.
-     */
-    @Override
-    public boolean equals(final Object other) {
-        if (other instanceof IdentNode) {
-            return name.equals(((IdentNode)other).name);
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return name.hashCode();
+        return new IdentNode(this, name, type, flags);
     }
 
     /**
@@ -135,7 +122,7 @@
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterIdentNode(this) != null) {
+        if (visitor.enterIdentNode(this)) {
             return visitor.leaveIdentNode(this);
         }
 
@@ -147,7 +134,7 @@
         if (hasCallSiteType()) {
             sb.append('{');
             final String desc = getType().getDescriptor();
-            sb.append(desc.charAt(desc.length() - 1) == ';' ? "O" : getType().getDescriptor());
+            sb.append(desc.charAt(desc.length() - 1) == ';' ? 'O' : getType().getDescriptor());
             sb.append('}');
         }
 
@@ -191,10 +178,10 @@
      * @return a node equivalent to this one except for the requested change.
      */
     public IdentNode setIsPropertyName() {
-        if(isPropertyName()) return this;
-        final IdentNode n = (IdentNode)clone();
-        n.flags |= PROPERTY_NAME;
-        return n;
+        if (isPropertyName()) {
+            return this;
+        }
+        return new IdentNode(this, name, callSiteType, flags | PROPERTY_NAME);
     }
 
     /**
@@ -210,10 +197,10 @@
      * @return a node equivalent to this one except for the requested change.
      */
     public IdentNode setIsInitializedHere() {
-        if(isInitializedHere()) return this;
-        final IdentNode n = (IdentNode)clone();
-        n.flags |= INITIALIZED_HERE;
-        return n;
+        if (isInitializedHere()) {
+            return this;
+        }
+        return new IdentNode(this, name, callSiteType, flags | INITIALIZED_HERE);
     }
 
     /**
@@ -223,7 +210,7 @@
      * @return true if this IdentNode is special
      */
     public boolean isSpecialIdentity() {
-        return name.equals(__DIR__.tag()) || name.equals(__FILE__.tag()) || name.equals(__LINE__.tag());
+        return name.equals(__DIR__.symbolName()) || name.equals(__FILE__.symbolName()) || name.equals(__LINE__.symbolName());
     }
 
     @Override
@@ -236,9 +223,9 @@
      * @return an ident node identical to this one in all aspects except with its function flag set.
      */
     public IdentNode setIsFunction() {
-        if(isFunction()) return this;
-        final IdentNode n = (IdentNode)clone();
-        n.flags |= FUNCTION;
-        return n;
+        if (isFunction()) {
+            return this;
+        }
+        return new IdentNode(this, name, callSiteType, flags | FUNCTION);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/IfNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/IfNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,22 +25,23 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for an IF statement.
- *
  */
-public class IfNode extends Node {
+@Immutable
+public final class IfNode extends Node {
     /** Test expression. */
-    private Node test;
+    private final Node test;
 
     /** Pass statements. */
-    private Block pass;
+    private final Block pass;
 
     /** Fail statements. */
-    private Block fail;
+    private final Block fail;
 
     /**
      * Constructor
@@ -54,37 +55,30 @@
      */
     public IfNode(final Source source, final long token, final int finish, final Node test, final Block pass, final Block fail) {
         super(source, token, finish);
+        this.test = test;
+        this.pass = pass;
+        this.fail = fail;
+    }
 
+    private IfNode(final IfNode ifNode, final Node test, final Block pass, final Block fail) {
+        super(ifNode);
         this.test = test;
         this.pass = pass;
         this.fail = fail;
     }
 
-    private IfNode(final IfNode ifNode, final CopyState cs) {
-        super(ifNode);
-
-        this.test = cs.existingOrCopy(ifNode.test);
-        this.pass = (Block)cs.existingOrCopy(ifNode.pass);
-        this.fail = (Block)cs.existingOrCopy(ifNode.fail);
-    }
-
     @Override
-    protected Node copy(final CopyState cs) {
-        return new IfNode(this, cs);
+    public boolean isTerminal() {
+        return pass.isTerminal() && fail != null && fail.isTerminal();
     }
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterIfNode(this) != null) {
-            test = test.accept(visitor);
-
-            pass = (Block)pass.accept(visitor);
-
-            if (fail != null) {
-                fail = (Block)fail.accept(visitor);
-            }
-
-            return visitor.leaveIfNode(this);
+        if (visitor.enterIfNode(this)) {
+            return visitor.leaveIfNode(
+                setTest(test.accept(visitor)).
+                setPass((Block)pass.accept(visitor)).
+                setFail(fail == null ? null : (Block)fail.accept(visitor)));
         }
 
         return this;
@@ -105,6 +99,13 @@
         return fail;
     }
 
+    private IfNode setFail(final Block fail) {
+        if (this.fail == fail) {
+            return this;
+        }
+        return new IfNode(this, test, pass, fail);
+    }
+
     /**
      * Get the then block for this IfNode
      * @return the then block
@@ -113,6 +114,13 @@
         return pass;
     }
 
+    private IfNode setPass(final Block pass) {
+        if (this.pass == pass) {
+            return this;
+        }
+        return new IfNode(this, test, pass, fail);
+    }
+
     /**
      * Get the test expression for this IfNode
      * @return the test expression
@@ -124,8 +132,12 @@
     /**
      * Reset the test expression for this IfNode
      * @param test a new test expression
+     * @return new or same IfNode
      */
-    public void setTest(final Node test) {
-        this.test = test;
+    public IfNode setTest(final Node test) {
+        if (this.test == test) {
+            return this;
+        }
+        return new IfNode(this, test, pass, fail);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/IndexNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/IndexNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,22 +25,18 @@
 
 package jdk.nashorn.internal.ir;
 
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.DEBUG_FIELDS;
-
-import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation of an indexed access (brackets operator.)
- *
  */
-public class IndexNode extends BaseNode implements TypeOverride<IndexNode> {
-    /** Property ident. */
-    private Node index;
-
-    private boolean hasCallSiteType;
+@Immutable
+public final class IndexNode extends BaseNode {
+    /** Property index. */
+    private final Node index;
 
     /**
      * Constructors
@@ -52,50 +48,27 @@
      * @param index   index for access
      */
     public IndexNode(final Source source, final long token, final int finish, final Node base, final Node index) {
-        super(source, token, finish, base);
-
+        super(source, token, finish, base, false, false);
         this.index = index;
     }
 
-    /**
-     * Copy constructor
-     *
-     * @param indexNode source node
-     */
-    public IndexNode(final IndexNode indexNode) {
-        this(indexNode, new CopyState());
-    }
-
-    private IndexNode(final IndexNode indexNode, final CopyState cs) {
-        super(indexNode, cs);
-
-        index = cs.existingOrCopy(indexNode.index);
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new IndexNode(this, cs);
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-        if (!super.equals(other)) {
-            return false;
-        }
-        return index.equals(((IndexNode)other).getIndex());
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode() ^ getIndex().hashCode();
+    private IndexNode(final IndexNode indexNode, final Node base, final Node index, final boolean isFunction, final boolean hasCallSiteType) {
+        super(indexNode, base, isFunction, hasCallSiteType);
+        this.index = index;
     }
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterIndexNode(this) != null) {
-            base = base.accept(visitor);
-            index = index.accept(visitor);
-            return visitor.leaveIndexNode(this);
+        if (visitor.enterIndexNode(this)) {
+            final Node      newBase  = base.accept(visitor);
+            final Node      newIndex = index.accept(visitor);
+            final IndexNode newNode;
+            if (newBase != base || newIndex != index) {
+                newNode = new IndexNode(this, newBase, newIndex, isFunction(), hasCallSiteType());
+            } else {
+                newNode = this;
+            }
+            return visitor.leaveIndexNode(newNode);
         }
 
         return this;
@@ -105,7 +78,7 @@
     public void toString(final StringBuilder sb) {
         final boolean needsParen = tokenType().needsParens(base.tokenType(), true);
 
-        if (hasCallSiteType) {
+        if (hasCallSiteType()) {
             sb.append('{');
             final String desc = getType().getDescriptor();
             sb.append(desc.charAt(desc.length() - 1) == ';' ? "O" : getType().getDescriptor());
@@ -135,27 +108,19 @@
         return index;
     }
 
-    /**
-     * Reset the index expression for this IndexNode
-     * @param index a new index expression
-     */
-    public void setIndex(final Node index) {
-        this.index = index;
+    @Override
+    public BaseNode setIsFunction() {
+        if (isFunction()) {
+            return this;
+        }
+        return new IndexNode(this, base, index, true, hasCallSiteType());
     }
 
     @Override
     public IndexNode setType(final Type type) {
-        if (DEBUG_FIELDS && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
-            ObjectClassGenerator.LOG.info(getClass().getName() + " " + this + " => " + type + " instead of " + getType());
-        }
-        hasCallSiteType = true;
-        getSymbol().setTypeOverride(type);
-        return this;
-    }
-
-    @Override
-    public boolean canHaveCallSiteType() {
-        return true; //carried by the symbol and always the same nodetype==symboltype
+        logTypeChange(type);
+        getSymbol().setTypeOverride(type); //always a temp so this is fine.
+        return new IndexNode(this, base, index, isFunction(), true);
     }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/LabelNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/LabelNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,29 +25,20 @@
 
 package jdk.nashorn.internal.ir;
 
-import jdk.nashorn.internal.ir.annotations.Ignore;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for a labeled statement.
- *
  */
-
-public class LabelNode extends Node {
+@Immutable
+public final class LabelNode extends LexicalContextNode {
     /** Label ident. */
-    private IdentNode label;
+    private final IdentNode label;
 
     /** Statements. */
-    private Block body;
-
-    /** Node to break from. */
-    @Ignore
-    private Node breakNode;
-
-    /** Node to continue. */
-    @Ignore
-    private Node continueNode;
+    private final Block body;
 
     /**
      * Constructor
@@ -65,26 +56,23 @@
         this.body  = body;
     }
 
-    private LabelNode(final LabelNode labelNode, final CopyState cs) {
+    private LabelNode(final LabelNode labelNode, final IdentNode label, final Block body) {
         super(labelNode);
-
-        this.label        = (IdentNode)cs.existingOrCopy(labelNode.label);
-        this.body         = (Block)cs.existingOrCopy(labelNode.body);
-        this.breakNode    = cs.existingOrSame(labelNode.breakNode);
-        this.continueNode = cs.existingOrSame(labelNode.continueNode);
+        this.label = label;
+        this.body  = body;
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new LabelNode(this, cs);
+    public boolean isTerminal() {
+        return body.isTerminal();
     }
 
     @Override
-    public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterLabelNode(this) != null) {
-            label = (IdentNode)label.accept(visitor);
-            body  = (Block)body.accept(visitor);
-            return visitor.leaveLabelNode(this);
+    public Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterLabelNode(this)) {
+            return visitor.leaveLabelNode(
+                setLabel(visitor.getLexicalContext(), (IdentNode)label.accept(visitor)).
+                setBody(visitor.getLexicalContext(), (Block)body.accept(visitor)));
         }
 
         return this;
@@ -106,44 +94,15 @@
 
     /**
      * Reset the body of the node
+     * @param lc lexical context
      * @param body new body
-     */
-    public void setBody(final Block body) {
-        this.body = body;
-    }
-
-    /**
-     * Get the break node for this node
-     * @return the break node
-     */
-    public Node getBreakNode() {
-        return breakNode;
-    }
-
-    /**
-     * Reset the break node for this node
-     * @param breakNode the break node
+     * @return new for node if changed or existing if not
      */
-    public void setBreakNode(final Node breakNode) {
-        assert breakNode instanceof BreakableNode || breakNode instanceof Block : "Invalid break node: " + breakNode;
-        this.breakNode = breakNode;
-    }
-
-    /**
-     * Get the continue node for this node
-     * @return the continue node
-     */
-    public Node getContinueNode() {
-        return continueNode;
-    }
-
-    /**
-     * Reset the continue node for this node
-     * @param continueNode the continue node
-     */
-    public void setContinueNode(final Node continueNode) {
-        assert continueNode instanceof WhileNode : "invalid continue node: " + continueNode;
-        this.continueNode = continueNode;
+    public LabelNode setBody(final LexicalContext lc, final Block body) {
+        if (this.body == body) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new LabelNode(this, label, body));
     }
 
     /**
@@ -154,4 +113,11 @@
         return label;
     }
 
+    private LabelNode setLabel(final LexicalContext lc, final IdentNode label) {
+        if (this.label == label) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new LabelNode(this, label, body));
+    }
+
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/LabeledNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.ir;
-
-import jdk.nashorn.internal.ir.annotations.Ignore;
-import jdk.nashorn.internal.runtime.Source;
-
-/**
- * IR base class for break and continue.
- *
- */
-public abstract class LabeledNode extends Node {
-    /** Optional label. */
-    @Ignore
-    protected final LabelNode labelNode;
-
-    /** Target control node. */
-    @Ignore
-    protected final Node targetNode;
-
-    /** Try chain. */
-    @Ignore
-    protected final TryNode tryChain;
-
-    /** scope nesting level */
-    protected int scopeNestingLevel;
-
-    /**
-     * Constructor
-     *
-     * @param source     the source
-     * @param token      token
-     * @param finish     finish
-     * @param labelNode  the label node
-     * @param targetNode the place to break to
-     * @param tryChain   the try chain
-     */
-    public LabeledNode(final Source source, final long token, final int finish, final LabelNode labelNode, final Node targetNode, final TryNode tryChain) {
-        super(source, token, finish);
-
-        this.labelNode  = labelNode;
-        this.targetNode = targetNode;
-        this.tryChain   = tryChain;
-    }
-
-    /**
-     * Copy constructor
-     *
-     * @param labeledNode source node
-     * @param cs          copy state
-     */
-    protected LabeledNode(final LabeledNode labeledNode, final CopyState cs) {
-        super(labeledNode);
-
-        this.labelNode         = (LabelNode)cs.existingOrCopy(labeledNode.labelNode);
-        this.targetNode        = cs.existingOrSame(labeledNode.targetNode);
-        this.tryChain          = (TryNode)cs.existingOrSame(labeledNode.tryChain);
-        this.scopeNestingLevel = labeledNode.scopeNestingLevel;
-    }
-
-    /**
-     * Get the label
-     * @return the label
-     */
-    public LabelNode getLabel() {
-        return labelNode;
-    }
-
-    /**
-     * Get the target node
-     * @return the target node
-     */
-    public Node getTargetNode() {
-        return targetNode;
-    }
-
-    /**
-     * Get the surrounding try chain
-     * @return the try chain
-     */
-    public TryNode getTryChain() {
-        return tryChain;
-    }
-
-    /**
-     * Get the scope nesting level
-     * @return nesting level
-     */
-    public int getScopeNestingLevel() {
-        return scopeNestingLevel;
-    }
-
-    /**
-     * Set scope nesting level
-     * @param level the new level
-     */
-    public void setScopeNestingLevel(final int level) {
-        scopeNestingLevel = level;
-    }
-}
--- a/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java	Wed May 08 10:10:05 2013 +0100
@@ -1,40 +1,224 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
 package jdk.nashorn.internal.ir;
 
-import java.util.ArrayDeque;
-import java.util.Deque;
+import java.io.File;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
+import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.runtime.Debug;
+import jdk.nashorn.internal.runtime.Source;
 
 /**
  * A class that tracks the current lexical context of node visitation as a stack of {@link Block} nodes. Has special
  * methods to retrieve useful subsets of the context.
+ *
+ * This is implemented with a primitive array and a stack pointer, because it really makes a difference
+ * performance wise. None of the collection classes were optimal
  */
-public class LexicalContext implements Cloneable {
-    private final Deque<Block> lexicalContext;
+public class LexicalContext {
+    private LexicalContextNode[] stack;
+
+    private int[] flags;
+    private int sp;
 
     /**
      * Creates a new empty lexical context.
      */
     public LexicalContext() {
-        lexicalContext = new ArrayDeque<>();
+        stack = new LexicalContextNode[16];
+        flags = new int[16];
+    }
+
+    /**
+     * Set the flags for a lexical context node on the stack. Does not
+     * replace the flags, but rather adds to them
+     *
+     * @param node  node
+     * @param flag  new flag to set
+     */
+    public void setFlag(final LexicalContextNode node, final int flag) {
+        if (flag != 0) {
+            for (int i = sp - 1; i >= 0; i--) {
+                if (stack[i] == node) {
+                    flags[i] |= flag;
+                    //System.err.println("Setting flag " + node + " " + flag);
+                    return;
+                }
+            }
+        }
+        assert false;
     }
 
     /**
+     * Get the flags for a lexical context node on the stack
+     * @param node node
+     * @return the flags for the node
+     */
+    public int getFlags(final LexicalContextNode node) {
+        for (int i = sp - 1; i >= 0; i--) {
+            if (stack[i] == node) {
+                return flags[i];
+            }
+        }
+        throw new AssertionError("flag node not on context stack");
+    }
+
+    /**
+     * Get the function body of a function node on the lexical context
+     * stack. This will trigger an assertion if node isn't present
+     * @param functionNode function node
+     * @return body of function node
+     */
+    public Block getFunctionBody(final FunctionNode functionNode) {
+        for (int i = sp - 1; i >= 0 ; i--) {
+            if (stack[i] == functionNode) {
+                return (Block)stack[i + 1];
+            }
+        }
+        throw new AssertionError(functionNode.getName() + " not on context stack");
+    }
+
+    /**
+     * Return all nodes in the LexicalContext
+     * @return all nodes
+     */
+    public Iterator<LexicalContextNode> getAllNodes() {
+        return new NodeIterator<>(LexicalContextNode.class);
+    }
+
+    /**
+     * Returns the outermost function in this context. It is either the program, or a lazily compiled function.
+     * @return the outermost function in this context.
+     */
+    public FunctionNode getOutermostFunction() {
+        return (FunctionNode)stack[0];
+    }
+
+
+
+    /**
      * Pushes a new block on top of the context, making it the innermost open block.
-     * @param block the new block
+     * @param node the new node
+     * @return the node that was pushed
      */
-    public void push(Block block) {
-        //new Exception(block.toString()).printStackTrace();
-        lexicalContext.push(block);
+    public <T extends LexicalContextNode> T push(final T node) {
+        if (sp == stack.length) {
+            final LexicalContextNode[] newStack = new LexicalContextNode[sp * 2];
+            System.arraycopy(stack, 0, newStack, 0, sp);
+            stack = newStack;
+
+            final int[] newFlags = new int[sp * 2];
+            System.arraycopy(flags, 0, newFlags, 0, sp);
+            flags = newFlags;
+
+        }
+        stack[sp] = node;
+        flags[sp] = 0;
+
+        sp++;
+
+        return node;
+    }
+
+    /**
+     * Is the context empty?
+     * @return true if empty
+     */
+    public boolean isEmpty() {
+        return sp == 0;
+    }
+
+    /**
+     * The depth of the lexical context
+     * @return depth
+     */
+    public int size() {
+        return sp;
     }
 
     /**
-     * Pops the innermost block off the context.
-     * @param the block expected to be popped, used to detect unbalanced pushes/pops
+     * Pops the innermost block off the context and all nodes that has been contributed
+     * since it was put there
+     *
+     * @param node the node expected to be popped, used to detect unbalanced pushes/pops
+     * @return the node that was popped
+     */
+    @SuppressWarnings("unchecked")
+    public <T extends LexicalContextNode> T pop(final T node) {
+        --sp;
+        final LexicalContextNode popped = stack[sp];
+        stack[sp] = null;
+        if (popped instanceof Flags) {
+            return (T)((Flags<?>)popped).setFlag(this, flags[sp]);
+        }
+
+        return (T)popped;
+    }
+
+
+    /**
+     * Return the top element in the context
+     * @return the node that was pushed last
      */
-    public void pop(Block block) {
-        final Block popped = lexicalContext.pop();
-        assert popped == block;
+    public LexicalContextNode peek() {
+        return stack[sp - 1];
+    }
+
+    /**
+     * Check if a node is in the lexical context
+     * @param node node to check for
+     * @return true if in the context
+     */
+    public boolean contains(final LexicalContextNode node) {
+        for (int i = 0; i < sp; i++) {
+            if (stack[i] == node) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Replace a node on the lexical context with a new one. Normally
+     * you should try to engineer IR traversals so this isn't needed
+     *
+     * @param oldNode old node
+     * @param newNode new node
+     * @return the new node
+     */
+    public LexicalContextNode replace(final LexicalContextNode oldNode, final LexicalContextNode newNode) {
+       //System.err.println("REPLACE old=" + Debug.id(oldNode) + " new=" + Debug.id(newNode));
+        for (int i = sp - 1; i >= 0; i--) {
+            if (stack[i] == oldNode) {
+                assert i == (sp - 1) : "violation of contract - we always expect to find the replacement node on top of the lexical context stack: " + newNode + " has " + stack[i + 1].getClass() + " above it";
+                stack[i] = newNode;
+                break;
+            }
+         }
+        return newNode;
     }
 
     /**
@@ -42,7 +226,7 @@
      * @return an iterator over all blocks in the context.
      */
     public Iterator<Block> getBlocks() {
-        return lexicalContext.iterator();
+        return new NodeIterator<>(Block.class);
     }
 
     /**
@@ -50,47 +234,17 @@
      * @return an iterator over all functions in the context.
      */
     public Iterator<FunctionNode> getFunctions() {
-        return new FunctionIterator(getBlocks());
+        return new NodeIterator<>(FunctionNode.class);
     }
 
-    private static final class FunctionIterator implements Iterator<FunctionNode> {
-        private final Iterator<Block> it;
-        private FunctionNode next;
-
-        FunctionIterator(Iterator<Block> it) {
-            this.it = it;
-            next = findNext();
-        }
-
-        @Override
-        public boolean hasNext() {
-            return next != null;
-        }
-
-        @Override
-        public FunctionNode next() {
-            if(next == null) {
-                throw new NoSuchElementException();
-            }
-            FunctionNode lnext = next;
-            next = findNext();
-            return lnext;
-        }
-
-        private FunctionNode findNext() {
-            while(it.hasNext()) {
-                final Block block = it.next();
-                if(block instanceof FunctionNode) {
-                    return ((FunctionNode)block);
-                }
-            }
-            return null;
-        }
-
-        @Override
-        public void remove() {
-            throw new UnsupportedOperationException();
-        }
+    /**
+     * Get the parent block for the current lexical context block
+     * @return parent block
+     */
+    public Block getParentBlock() {
+        final Iterator<Block> iter = new NodeIterator<>(Block.class, getCurrentFunction());
+        iter.next();
+        return iter.hasNext() ? iter.next() : null;
     }
 
     /**
@@ -98,12 +252,12 @@
      * @param block the block whose ancestors are returned
      * @return an iterator over all ancestors block of the given block.
      */
-    public Iterator<Block> getAncestorBlocks(Block block) {
-        final Iterator<Block> it = getBlocks();
-        while(it.hasNext()) {
-            final Block b = it.next();
-            if(block == b) {
-                return it;
+    public Iterator<Block> getAncestorBlocks(final Block block) {
+        final Iterator<Block> iter = getBlocks();
+        while (iter.hasNext()) {
+            final Block b = iter.next();
+            if (block == b) {
+                return iter;
             }
         }
         throw new AssertionError("Block is not on the current lexical context stack");
@@ -115,17 +269,17 @@
      * @return an iterator over a block and all its ancestors.
      */
     public Iterator<Block> getBlocks(final Block block) {
-        final Iterator<Block> it = getAncestorBlocks(block);
+        final Iterator<Block> iter = getAncestorBlocks(block);
         return new Iterator<Block>() {
             boolean blockReturned = false;
             @Override
             public boolean hasNext() {
-                return it.hasNext() || !blockReturned;
+                return iter.hasNext() || !blockReturned;
             }
             @Override
             public Block next() {
-                if(blockReturned) {
-                    return it.next();
+                if (blockReturned) {
+                    return iter.next();
                 }
                 blockReturned = true;
                 return block;
@@ -138,45 +292,25 @@
     }
 
     /**
-     * Returns the closest function node to the block. If the block is itself a function, it is returned.
-     * @param block the block
-     * @return the function closest to the block.
-     * @see #getParentFunction(Block)
-     */
-    public FunctionNode getFunction(Block block) {
-        if(block instanceof FunctionNode) {
-            return (FunctionNode)block;
-        }
-        return getParentFunction(block);
-    }
-
-    /**
-     * Returns the closest function node to the block and all its ancestor functions. If the block is itself a function,
-     * it is returned too.
-     * @param block the block
-     * @return the closest function node to the block and all its ancestor functions.
+     * Get the function for this block. If the block is itself a function
+     * this returns identity
+     * @param block block for which to get function
+     * @return function for block
      */
-    public Iterator<FunctionNode> getFunctions(final Block block) {
-        return new FunctionIterator(getBlocks(block));
-    }
-
-    /**
-     * Returns the containing function of the block. If the block is itself a function, its parent function is returned.
-     * @param block the block
-     * @return the containing function of the block.
-     * @see #getFunction(Block)
-     */
-    public FunctionNode getParentFunction(Block block) {
-        return getFirstFunction(getAncestorBlocks(block));
-    }
-
-    private static FunctionNode getFirstFunction(Iterator<Block> it) {
-        while(it.hasNext()) {
-            final Block ancestor = it.next();
-            if(ancestor instanceof FunctionNode) {
-                return (FunctionNode)ancestor;
+    public FunctionNode getFunction(final Block block) {
+        final Iterator<LexicalContextNode> iter = new NodeIterator<>(LexicalContextNode.class);
+        while (iter.hasNext()) {
+            final LexicalContextNode next = iter.next();
+            if (next == block) {
+                while (iter.hasNext()) {
+                    final LexicalContextNode next2 = iter.next();
+                    if (next2 instanceof FunctionNode) {
+                        return (FunctionNode)next2;
+                    }
+                }
             }
         }
+        assert false;
         return null;
     }
 
@@ -185,7 +319,7 @@
      * @return the innermost block in the context.
      */
     public Block getCurrentBlock() {
-        return lexicalContext.element();
+        return getBlocks().next();
     }
 
     /**
@@ -193,6 +327,284 @@
      * @return the innermost function in the context.
      */
     public FunctionNode getCurrentFunction() {
-        return getFirstFunction(getBlocks());
+        if (isEmpty()) {
+            return null;
+        }
+        return new NodeIterator<>(FunctionNode.class).next();
+    }
+
+    /**
+     * Get the block in which a symbol is defined
+     * @param symbol symbol
+     * @return block in which the symbol is defined, assert if no such block in context
+     */
+    public Block getDefiningBlock(final Symbol symbol) {
+        if (symbol.isTemp()) {
+            return null;
+        }
+        final String name = symbol.getName();
+        for (final Iterator<Block> it = getBlocks(); it.hasNext();) {
+            final Block next = it.next();
+            if (next.getExistingSymbol(name) == symbol) {
+                return next;
+            }
+        }
+        throw new AssertionError("Couldn't find symbol " + name + " in the context");
+    }
+
+    /**
+     * Get the function in which a symbol is defined
+     * @param symbol symbol
+     * @return function node in which this symbol is defined, assert if no such symbol exists in context
+     */
+    public FunctionNode getDefiningFunction(Symbol symbol) {
+        if (symbol.isTemp()) {
+            return null;
+        }
+        final String name = symbol.getName();
+        for (final Iterator<LexicalContextNode> iter = new NodeIterator<>(LexicalContextNode.class); iter.hasNext();) {
+            final LexicalContextNode next = iter.next();
+            if (next instanceof Block && ((Block)next).getExistingSymbol(name) == symbol) {
+                while (iter.hasNext()) {
+                    final LexicalContextNode next2 = iter.next();
+                    if (next2 instanceof FunctionNode) {
+                        return ((FunctionNode)next2);
+                    }
+                }
+                throw new AssertionError("Defining block for symbol " + name + " has no function in the context");
+            }
+        }
+        throw new AssertionError("Couldn't find symbol " + name + " in the context");
+    }
+
+    /**
+     * Is the topmost lexical context element a function body?
+     * @return true if function body
+     */
+    public boolean isFunctionBody() {
+        return getParentBlock() == null;
+    }
+
+    /**
+     * Returns true if the expression defining the function is a callee of a CallNode that should be the second
+     * element on the stack, e.g. <code>(function(){})()</code>. That is, if the stack ends with
+     * {@code [..., CallNode, FunctionNode]} then {@code callNode.getFunction()} should be equal to
+     * {@code functionNode}, and the top of the stack should itself be a variant of {@code functionNode}.
+     * @param functionNode the function node being tested
+     * @return true if the expression defining the current function is a callee of a call expression.
+     */
+    public boolean isFunctionDefinedInCurrentCall(FunctionNode functionNode) {
+        final LexicalContextNode parent = stack[sp - 2];
+        if(parent instanceof CallNode && ((CallNode)parent).getFunction() == functionNode) {
+            assert functionNode.getSource() == peek().getSource();
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Get the parent function for a function in the lexical context
+     * @param functionNode function for which to get parent
+     * @return parent function of functionNode or null if none (e.g. if functionNode is the program)
+     */
+    public FunctionNode getParentFunction(final FunctionNode functionNode) {
+        final Iterator<FunctionNode> iter = new NodeIterator<>(FunctionNode.class);
+        while (iter.hasNext()) {
+            final FunctionNode next = iter.next();
+            if (next == functionNode) {
+                return iter.hasNext() ? iter.next() : null;
+            }
+        }
+        assert false;
+        return null;
+    }
+
+    /**
+     * Count the number of with scopes until a given node
+     * @param until node to stop counting at, or null if all nodes should be counted
+     * @return number of with scopes encountered in the context
+     */
+    public int getScopeNestingLevelTo(final LexicalContextNode until) {
+        //count the number of with nodes until "until" is hit
+        int n = 0;
+        for (final Iterator<WithNode> iter = new NodeIterator<>(WithNode.class, until); iter.hasNext(); iter.next()) {
+            n++;
+        }
+        return n;
+    }
+
+    private BreakableNode getBreakable() {
+        for (final NodeIterator<BreakableNode> iter = new NodeIterator<>(BreakableNode.class, getCurrentFunction()); iter.hasNext(); ) {
+            final BreakableNode next = iter.next();
+            if (next.isBreakableWithoutLabel()) {
+                return next;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Find the breakable node corresponding to this label.
+     * @param label label to search for, if null the closest breakable node will be returned unconditionally, e.g. a while loop with no label
+     * @return closest breakable node
+     */
+    public BreakableNode getBreakable(final IdentNode label) {
+        if (label != null) {
+            final LabelNode foundLabel = findLabel(label.getName());
+            if (foundLabel != null) {
+                // iterate to the nearest breakable to the foundLabel
+                BreakableNode breakable = null;
+                for (final NodeIterator<BreakableNode> iter = new NodeIterator<>(BreakableNode.class, foundLabel); iter.hasNext(); ) {
+                    breakable = iter.next();
+                }
+                return breakable;
+            }
+            return null;
+        }
+        return getBreakable();
+    }
+
+    private LoopNode getContinueTo() {
+        final Iterator<LoopNode> iter = new NodeIterator<>(LoopNode.class, getCurrentFunction());
+        return iter.hasNext() ? iter.next() : null;
+    }
+
+    /**
+     * Find the continue target node corresponding to this label.
+     * @param label label to search for, if null the closest loop node will be returned unconditionally, e.g. a while loop with no label
+     * @return closest continue target node
+     */
+    public LoopNode getContinueTo(final IdentNode label) {
+        if (label != null) {
+            final LabelNode foundLabel = findLabel(label.getName());
+            if (foundLabel != null) {
+                // iterate to the nearest loop to the foundLabel
+                LoopNode loop = null;
+                for (final NodeIterator<LoopNode> iter = new NodeIterator<>(LoopNode.class, foundLabel); iter.hasNext(); ) {
+                    loop = iter.next();
+                }
+                return loop;
+            }
+            return null;
+        }
+        return getContinueTo();
+    }
+
+    /**
+     * Check the lexical context for a given label node by name
+     * @param name name of the label
+     * @return LabelNode if found, null otherwise
+     */
+    public LabelNode findLabel(final String name) {
+        for (final Iterator<LabelNode> iter = new NodeIterator<>(LabelNode.class, getCurrentFunction()); iter.hasNext(); ) {
+            final LabelNode next = iter.next();
+            if (next.getLabel().getName().equals(name)) {
+                return next;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Checks whether a given label is a jump destination that lies outside a given
+     * split node
+     * @param splitNode the split node
+     * @param label     the label
+     * @return true if label resides outside the split node
+     */
+    public boolean isExternalTarget(final SplitNode splitNode, final Label label) {
+        boolean targetFound = false;
+        for (int i = sp - 1; i >= 0; i--) {
+            final LexicalContextNode next = stack[i];
+            if (next == splitNode) {
+                return !targetFound;
+            }
+
+            if (next instanceof BreakableNode) {
+                for (final Label l : ((BreakableNode)next).getLabels()) {
+                    if (l == label) {
+                        targetFound = true;
+                        break;
+                    }
+                }
+            }
+        }
+        assert false : label + " was expected in lexical context " + LexicalContext.this + " but wasn't";
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append("[ ");
+        for (int i = 0; i < sp; i++) {
+            final Node node = stack[i];
+            sb.append(node.getClass().getSimpleName());
+            sb.append('@');
+            sb.append(Debug.id(node));
+            sb.append(':');
+            final Source source = node.getSource();
+            String src = source.toString();
+            if (src.indexOf(File.pathSeparator) != -1) {
+                src = src.substring(src.lastIndexOf(File.pathSeparator));
+            }
+            src += ' ';
+            src += source.getLine(node.getStart());
+            sb.append(' ');
+        }
+        sb.append(" ==> ]");
+        return sb.toString();
+    }
+
+    private class NodeIterator <T extends LexicalContextNode> implements Iterator<T> {
+        private int index;
+        private T next;
+        private final Class<T> clazz;
+        private LexicalContextNode until;
+
+        NodeIterator(final Class<T> clazz) {
+            this(clazz, null);
+        }
+
+        NodeIterator(final Class<T> clazz, final LexicalContextNode until) {
+            this.index = sp - 1;
+            this.clazz = clazz;
+            this.until = until;
+            this.next  = findNext();
+        }
+
+        @Override
+        public boolean hasNext() {
+            return next != null;
+        }
+
+        @Override
+        public T next() {
+            if (next == null) {
+                throw new NoSuchElementException();
+            }
+            T lnext = next;
+            next = findNext();
+            return lnext;
+        }
+
+        private T findNext() {
+            for (int i = index; i >= 0; i--) {
+                final Node node = stack[i];
+                if (node == until) {
+                    return null;
+                }
+                if (clazz.isAssignableFrom(node.getClass())) {
+                    index = i - 1;
+                    return clazz.cast(node);
+                }
+            }
+            return null;
+        }
+
+        @Override
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/ir/LexicalContextNode.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.internal.ir;
+
+import jdk.nashorn.internal.ir.visitor.NodeVisitor;
+import jdk.nashorn.internal.runtime.Source;
+
+/**
+ * Superclass for nodes that can be part of the lexical context
+ * @see LexicalContext
+ */
+public abstract class LexicalContextNode extends Node {
+    /**
+     * Constructor
+     *
+     * @param source source
+     * @param token  token
+     * @param finish finish
+     */
+    protected LexicalContextNode(final Source source, final long token, final int finish) {
+        super(source, token, finish);
+    }
+
+    /**
+     * Copy constructor
+     *
+     * @param node source node
+     */
+    protected LexicalContextNode(final LexicalContextNode node) {
+        super(node);
+    }
+
+    /**
+     * Accept function for the node given a lexical context. It must be prepared
+     * to replace itself if present in the lexical context
+     *
+     * @param lc      lexical context
+     * @param visitor node visitor
+     *
+     * @return new node or same node depending on state change
+     */
+    protected abstract Node accept(final LexicalContext lc, final NodeVisitor visitor);
+
+    @Override
+    public Node accept(final NodeVisitor visitor) {
+        final LexicalContext lc = visitor.getLexicalContext();
+        lc.push(this);
+        final LexicalContextNode newNode = (LexicalContextNode)accept(lc, visitor);
+        return lc.pop(newNode);
+    }
+}
--- a/nashorn/src/jdk/nashorn/internal/ir/LineNumberNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/LineNumberNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.Token;
 import jdk.nashorn.internal.runtime.Source;
@@ -32,8 +33,8 @@
 /**
  * IR Node representing a line number
  */
-
-public class LineNumberNode extends Node {
+@Immutable
+public final class LineNumberNode extends Node {
     /** Line number */
     private final int lineNumber;
 
@@ -46,24 +47,17 @@
      */
     public LineNumberNode(final Source source, final long token, final int lineNumber) {
         super(source, token, Token.descPosition(token));
-
         this.lineNumber = lineNumber;
     }
 
-   private LineNumberNode(final LineNumberNode lineNumberNode) {
+    private LineNumberNode(final LineNumberNode lineNumberNode) {
         super(lineNumberNode);
-
         this.lineNumber = lineNumberNode.getLineNumber();
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new LineNumberNode(this);
-    }
-
-    @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterLineNumberNode(this) != null) {
+        if (visitor.enterLineNumberNode(this)) {
             return visitor.leaveLineNumberNode(this);
         }
 
--- a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java	Wed May 08 10:10:05 2013 +0100
@@ -30,6 +30,7 @@
 import java.util.List;
 import jdk.nashorn.internal.codegen.CompileUnit;
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.Lexer.LexerToken;
 import jdk.nashorn.internal.parser.Token;
@@ -44,6 +45,7 @@
  *
  * @param <T> the literal type
  */
+@Immutable
 public abstract class LiteralNode<T> extends Node implements PropertyKey {
     /** Literal value */
     protected final T value;
@@ -93,23 +95,6 @@
         return value == null;
     }
 
-    @Override
-    public int hashCode() {
-        return value == null ? 0 : value.hashCode();
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-        if (!(other instanceof LiteralNode<?>)) {
-            return false;
-        }
-        final LiteralNode<?> otherNode = (LiteralNode<?>)other;
-        if (otherNode.isNull()) {
-            return isNull();
-        }
-        return ((LiteralNode<?>)other).getValue().equals(value);
-    }
-
     /**
      * Check if the literal value is boolean true
      * @return true if literal value is boolean true
@@ -226,7 +211,7 @@
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterLiteralNode(this) != null) {
+        if (visitor.enterLiteralNode(this)) {
             return visitor.leaveLiteralNode(this);
         }
 
@@ -274,7 +259,8 @@
         return new NodeLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish());
     }
 
-    private static class BooleanLiteralNode extends LiteralNode<Boolean> {
+    @Immutable
+    private static final class BooleanLiteralNode extends LiteralNode<Boolean> {
 
         private BooleanLiteralNode(final Source source, final long token, final int finish, final boolean value) {
             super(source, Token.recast(token, value ? TokenType.TRUE : TokenType.FALSE), finish, value);
@@ -285,11 +271,6 @@
         }
 
         @Override
-        protected Node copy(final CopyState cs) {
-            return new BooleanLiteralNode(this);
-        }
-
-        @Override
         public boolean isTrue() {
             return value;
         }
@@ -331,7 +312,8 @@
         return new BooleanLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value);
     }
 
-    private static class NumberLiteralNode extends LiteralNode<Number> {
+    @Immutable
+    private static final class NumberLiteralNode extends LiteralNode<Number> {
 
         private final Type type = numberGetType(value);
 
@@ -358,11 +340,6 @@
         }
 
         @Override
-        protected Node copy(final CopyState cs) {
-            return new NumberLiteralNode(this);
-        }
-
-        @Override
         public Type getType() {
             return type;
         }
@@ -407,11 +384,6 @@
         private UndefinedLiteralNode(final UndefinedLiteralNode literalNode) {
             super(literalNode);
         }
-
-        @Override
-        protected Node copy(final CopyState cs) {
-            return new UndefinedLiteralNode(this);
-        }
     }
 
     /**
@@ -440,6 +412,7 @@
         return new UndefinedLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish());
     }
 
+    @Immutable
     private static class StringLiteralNode extends LiteralNode<String> {
         private StringLiteralNode(final Source source, final long token, final int finish, final String value) {
             super(source, Token.recast(token, TokenType.STRING), finish, value);
@@ -450,11 +423,6 @@
         }
 
         @Override
-        protected Node copy(final CopyState cs) {
-            return new StringLiteralNode(this);
-        }
-
-        @Override
         public void toString(final StringBuilder sb) {
             sb.append('\"');
             sb.append(value);
@@ -488,6 +456,7 @@
         return new StringLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value);
     }
 
+    @Immutable
     private static class LexerTokenLiteralNode extends LiteralNode<LexerToken> {
         private LexerTokenLiteralNode(final Source source, final long token, final int finish, final LexerToken value) {
             super(source, Token.recast(token, TokenType.STRING), finish, value); //TODO is string the correct token type here?
@@ -498,11 +467,6 @@
         }
 
         @Override
-        protected Node copy(final CopyState cs) {
-            return new LexerTokenLiteralNode(this);
-        }
-
-        @Override
         public Type getType() {
             return Type.OBJECT;
         }
@@ -539,7 +503,7 @@
         return new LexerTokenLiteralNode(parent.getSource(), parent.getToken(), parent.getFinish(), value);
     }
 
-    private static class NodeLiteralNode extends LiteralNode<Node> {
+    private static final class NodeLiteralNode extends LiteralNode<Node> {
 
         private NodeLiteralNode(final Source source, final long token, final int finish) {
             this(source, token, finish, null);
@@ -558,13 +522,8 @@
         }
 
         @Override
-        protected Node copy(final CopyState cs) {
-            return new NodeLiteralNode(this);
-        }
-
-        @Override
         public Node accept(final NodeVisitor visitor) {
-            if (visitor.enterLiteralNode(this) != null) {
+            if (visitor.enterLiteralNode(this)) {
                 if (value != null) {
                     final Node newValue = value.accept(visitor);
                     if(value != newValue) {
@@ -617,7 +576,7 @@
     /**
      * Array literal node class.
      */
-    public static class ArrayLiteralNode extends LiteralNode<Node[]> {
+    public static final class ArrayLiteralNode extends LiteralNode<Node[]> {
         private static class PostsetMarker {
             //empty
         }
@@ -705,11 +664,6 @@
             this.elementType = node.elementType;
         }
 
-        @Override
-        protected Node copy(final CopyState cs) {
-            return new ArrayLiteralNode(this);
-        }
-
         /**
          * Compute things like widest element type needed. Internal use from compiler only
          */
@@ -894,7 +848,7 @@
 
         @Override
         public Node accept(final NodeVisitor visitor) {
-            if (visitor.enterLiteralNode(this) != null) {
+            if (visitor.enterLiteralNode(this)) {
                 for (int i = 0; i < value.length; i++) {
                     final Node element = value[i];
                     if (element != null) {
--- a/nashorn/src/jdk/nashorn/internal/ir/Location.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/Location.java	Wed May 08 10:10:05 2013 +0100
@@ -25,16 +25,13 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.Objects;
 import jdk.nashorn.internal.parser.Token;
 import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * Used to locate an entity back to it's source file.
- *
  */
-
 public class Location implements Cloneable {
     /** Source of entity. */
     private final Source source;
@@ -73,22 +70,13 @@
     }
 
     @Override
-    public boolean equals(final Object other) {
-        if (other == null) {
-            return false;
-        }
-
-        if (other.getClass() != this.getClass()) {
-            return false;
-        }
-
-        final Location loc = (Location)other;
-        return token == loc.token && Objects.equals(source, loc.source);
+    public final boolean equals(final Object other) {
+        return super.equals(other);
     }
 
     @Override
-    public int hashCode() {
-        return Token.hashCode(token) ^ Objects.hashCode(source);
+    public final int hashCode() {
+        return super.hashCode();
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/ir/LoopNode.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.ir;
+
+import java.util.Arrays;
+import java.util.List;
+
+import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.runtime.Source;
+
+/**
+ * A loop node, for example a while node, do while node or for node
+ */
+public abstract class LoopNode extends BreakableNode {
+    /** loop continue label. */
+    protected final Label continueLabel;
+
+    /** Loop test node, null if infinite */
+    protected final Node test;
+
+    /** Loop body */
+    protected final Block body;
+
+    /** Can control flow escape from loop, e.g. through breaks or continues to outer loops? */
+    protected final boolean controlFlowEscapes;
+
+    /**
+     * Constructor
+     *
+     * @param source  source
+     * @param token   token
+     * @param finish  finish
+     * @param test    test, or null if infinite loop
+     * @param body    loop body
+     * @param controlFlowEscapes controlFlowEscapes
+     */
+    protected LoopNode(final Source source, final long token, final int finish, final Node test, final Block body, final boolean controlFlowEscapes) {
+        super(source, token, finish, new Label("while_break"));
+        this.continueLabel = new Label("while_continue");
+        this.test = test;
+        this.body = body;
+        this.controlFlowEscapes = controlFlowEscapes;
+    }
+
+    /**
+     * Constructor
+     *
+     * @param loopNode loop node
+     * @param test     new test
+     * @param body     new body
+     * @param controlFlowEscapes controlFlowEscapes
+     */
+    protected LoopNode(final LoopNode loopNode, final Node test, final Block body, final boolean controlFlowEscapes) {
+        super(loopNode);
+        this.continueLabel = new Label(loopNode.continueLabel);
+        this.test = test;
+        this.body = body;
+        this.controlFlowEscapes = controlFlowEscapes;
+    }
+
+    @Override
+    public abstract Node ensureUniqueLabels(final LexicalContext lc);
+
+    /**
+     * Does the control flow escape from this loop, i.e. through breaks or
+     * continues to outer loops?
+     * @return true if control flow escapes
+     */
+    public boolean controlFlowEscapes() {
+        return controlFlowEscapes;
+    }
+
+
+    @Override
+    public boolean isTerminal() {
+        if (!mustEnter()) {
+            return false;
+        }
+        //must enter but control flow may escape - then not terminal
+        if (controlFlowEscapes) {
+            return false;
+        }
+        //must enter, but body ends with return - then terminal
+        if (body.isTerminal()) {
+            return true;
+        }
+        //no breaks or returns, it is still terminal if we can never exit
+        return test == null;
+    }
+
+    /**
+     * Conservative check: does this loop have to be entered?
+     * @return true if body will execute at least once
+     */
+    public abstract boolean mustEnter();
+
+    /**
+     * Get the continue label for this while node, i.e. location to go to on continue
+     * @return continue label
+     */
+    public Label getContinueLabel() {
+        return continueLabel;
+    }
+
+    @Override
+    public List<Label> getLabels() {
+        return Arrays.asList(breakLabel, continueLabel);
+    }
+
+    @Override
+    public boolean isLoop() {
+        return true;
+    }
+
+    /**
+     * Get the body for this for node
+     * @return the body
+     */
+    public abstract Block getBody();
+
+    /**
+     * @param lc   lexical context
+     * @param body new body
+     * @return new for node if changed or existing if not
+     */
+    public abstract LoopNode setBody(final LexicalContext lc, final Block body);
+
+    /**
+     * Get the test for this for node
+     * @return the test
+     */
+    public abstract Node getTest();
+
+    /**
+     * Set the test for this for node
+     *
+     * @param lc lexical context
+     * @param test new test
+     * @return same or new node depending on if test was changed
+     */
+    public abstract LoopNode setTest(final LexicalContext lc, final Node test);
+
+    /**
+     * Set the control flow escapes flag for this node.
+     * TODO  - integrate this with Lowering in a better way
+     *
+     * @param lc lexical context
+     * @param controlFlowEscapes control flow escapes value
+     * @return new loop node if changed otherwise the same
+     */
+    public abstract LoopNode setControlFlowEscapes(final LexicalContext lc, final boolean controlFlowEscapes);
+
+}
--- a/nashorn/src/jdk/nashorn/internal/ir/Node.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/Node.java	Wed May 08 10:10:05 2013 +0100
@@ -25,7 +25,9 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.IdentityHashMap;
+import java.util.ArrayList;
+import java.util.List;
+
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.Token;
@@ -33,30 +35,17 @@
 
 /**
  * Nodes are used to compose Abstract Syntax Trees.
- *
  */
 public abstract class Node extends Location {
     /** Node symbol. */
     private Symbol symbol;
 
     /** Start of source range. */
-    protected int start;
+    protected final int start;
 
     /** End of source range. */
     protected int finish;
 
-    /** Has this node been resolved - i.e. emitted code already */
-    private boolean isResolved;
-
-    /** Is this node terminal */
-    private boolean isTerminal;
-
-    /** Is this a goto node */
-    private boolean hasGoto;
-
-    /** Is this a discard */
-    private boolean shouldDiscard;
-
     /**
      * Constructor
      *
@@ -72,6 +61,21 @@
     }
 
     /**
+     * Constructor
+     *
+     * @param source  source
+     * @param token   token
+     * @param start   start
+     * @param finish  finish
+     */
+    protected Node(final Source source, final long token, final int start, final int finish) {
+        super(source, token);
+
+        this.start = start;
+        this.finish = finish;
+    }
+
+    /**
      * Copy constructor
      *
      * @param node source node
@@ -79,13 +83,9 @@
     protected Node(final Node node) {
         super(node);
 
-        this.symbol        = node.symbol;
-        this.isResolved    = node.isResolved;
-        this.isTerminal    = node.isTerminal;
-        this.hasGoto       = node.hasGoto;
-        this.shouldDiscard = node.shouldDiscard;
-        this.start         = node.start;
-        this.finish        = node.finish;
+        this.symbol = node.symbol;
+        this.start  = node.start;
+        this.finish = node.finish;
     }
 
     /**
@@ -156,28 +156,6 @@
     }
 
     /**
-     * Test to see if code been generated for this node. Set isResolved if not.
-     *
-     * @return True if node has already been resolved.
-     */
-    public boolean testResolved() {
-        if (isResolved()) {
-            return true;
-        }
-
-        setIsResolved(true);
-
-        return false;
-    }
-
-    /**
-     * Reset the resolved flag.
-     */
-    public void resetResolved() {
-        setIsResolved(false);
-    }
-
-    /**
      * Is this a debug info node like LineNumberNode etc?
      *
      * @return true if this is a debug node
@@ -187,72 +165,13 @@
     }
 
     /**
-     * Helper class used for node cloning
+     * For reference copies - ensure that labels in the copy node are unique
+     * using an appropriate copy constructor
+     * @param lc lexical context
+     * @return new node or same of no labels
      */
-    public static final class CopyState {
-        private final IdentityHashMap<Node, Node> cloneMap = new IdentityHashMap<>();
-
-        /**
-         * Find existing or create new copy of the node.
-         *
-         * @param node Node to copy.
-         *
-         * @return New object.
-         */
-        public Node existingOrCopy(final Node node) {
-            if (node != null) {
-                Node copy = cloneMap.get(node);
-
-                if (copy == null) {
-                    copy = node.copy(this);
-                    cloneMap.put(node, copy);
-                }
-
-                return copy;
-            }
-
-            return node;
-        }
-
-        /**
-         * Find existing or use old copy of the node.
-         *
-         * @param node Node to copy.
-         *
-         * @return new object.
-         */
-        public Node existingOrSame(final Node node) {
-            if (node != null) {
-                Node copy = cloneMap.get(node);
-
-                if (copy == null) {
-                    copy = node;
-                }
-
-                return copy;
-            }
-
-            return node;
-        }
-    }
-
-    /**
-     * Deep copy the node.
-     *
-     * @return Deep copy of the  Node.
-     */
-    public final Node copy() {
-        return copy(new CopyState());
-    }
-
-    /**
-     * Deep copy the node.
-     *
-     * @param cs CopyState passed around to re-use certain nodes.
-     * @return Deep copy of the  Node.
-     */
-    protected Node copy(final CopyState cs) {
-        return cs.existingOrCopy(this);
+    public Node ensureUniqueLabels(final LexicalContext lc) {
+        return this;
     }
 
     /**
@@ -283,35 +202,7 @@
      * @return true if terminal
      */
     public boolean hasTerminalFlags() {
-        return isTerminal || hasGoto;
-    }
-
-    /**
-     * Copy the terminal flags state of a node to another node
-     *
-     * @param other source node
-     */
-    public void copyTerminalFlags(final Node other) {
-        isTerminal = other.isTerminal;
-        hasGoto    = other.hasGoto;
-    }
-
-    /**
-     * Check if the return value of this expression should be discarded
-     * @return true if return value is discarded
-     */
-    public boolean shouldDiscard() {
-        return shouldDiscard;
-    }
-
-    /**
-     * Setter that determines whether this node's return value should be discarded
-     * or not
-     *
-     * @param shouldDiscard true if return value is discarded, false otherwise
-     */
-    public void setDiscard(final boolean shouldDiscard) {
-        this.shouldDiscard = shouldDiscard;
+        return isTerminal() || hasGoto();
     }
 
     /**
@@ -336,29 +227,7 @@
      * @return true if node has goto semantics
      */
     public boolean hasGoto() {
-        return hasGoto;
-    }
-
-    /**
-     * Flag this node as having goto semantics as described in {@link Node#hasGoto()}
-     */
-    public void setHasGoto() {
-        this.hasGoto = true;
-    }
-
-    /**
-     * Check whether this node is resolved, i.e. code has been generated for it
-     * @return true if node is resolved
-     */
-    public boolean isResolved() {
-        return isResolved;
-    }
-
-    /**
-     * Flag this node as resolved or not, i.e. code has been generated for it
-     */
-    private void setIsResolved(boolean isResolved) {
-        this.isResolved = isResolved;
+        return false;
     }
 
     /**
@@ -370,14 +239,6 @@
     }
 
     /**
-     * Set start position for node
-     * @param start start position
-     */
-    public void setStart(final int start) {
-        this.start = start;
-    }
-
-    /**
      * Return the Symbol the compiler has assigned to this Node. The symbol
      * is the place where it's expression value is stored after evaluation
      *
@@ -404,17 +265,29 @@
      * @return true if this node is terminal
      */
     public boolean isTerminal() {
-        return isTerminal;
+        return false;
     }
 
-    /**
-     * Set this to be a terminal node, i.e. it terminates control flow as described
-     * in {@link Node#isTerminal()}
-     *
-     * @param isTerminal true if this is a terminal node, false otherwise
-     */
-    public void setIsTerminal(final boolean isTerminal) {
-        this.isTerminal = isTerminal;
+    //on change, we have to replace the entire list, that's we can't simple do ListIterator.set
+    static <T extends Node> List<T> accept(final NodeVisitor visitor, final Class<T> clazz, final List<T> list) {
+        boolean changed = false;
+        final List<T> newList = new ArrayList<>();
+
+        for (final Node node : list) {
+            final T newNode = clazz.cast(node.accept(visitor));
+            if (newNode != node) {
+                changed = true;
+            }
+            newList.add(newNode);
+        }
+
+        return changed ? newList : list;
     }
 
+    static <T extends LexicalContextNode> T replaceInLexicalContext(final LexicalContext lc, final T oldNode, final T newNode) {
+        if (lc != null) {
+            lc.replace(oldNode, newNode);
+        }
+        return newNode;
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/ObjectNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/ObjectNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,16 +25,18 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation of an object literal.
  */
-public class ObjectNode extends Node {
+@Immutable
+public final class ObjectNode extends Node {
 
     /** Literal elements. */
     private final List<Node> elements;
@@ -49,35 +51,18 @@
      */
     public ObjectNode(final Source source, final long token, final int finish, final List<Node> elements) {
         super(source, token, finish);
-
         this.elements = elements;
     }
 
-    private ObjectNode(final ObjectNode objectNode, final CopyState cs) {
+    private ObjectNode(final ObjectNode objectNode, final List<Node> elements) {
         super(objectNode);
-
-        final List<Node> newElements = new ArrayList<>();
-
-        for (final Node element : objectNode.elements) {
-            newElements.add(cs.existingOrCopy(element));
-        }
-
-        this.elements = newElements;
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new ObjectNode(this, cs);
+        this.elements = elements;
     }
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterObjectNode(this) != null) {
-            for (int i = 0, count = elements.size(); i < count; i++) {
-                elements.set(i, elements.get(i).accept(visitor));
-            }
-
-            return visitor.leaveObjectNode(this);
+        if (visitor.enterObjectNode(this)) {
+            return visitor.leaveObjectNode(setElements(Node.accept(visitor, Node.class, elements)));
         }
 
         return this;
@@ -112,4 +97,11 @@
     public List<Node> getElements() {
         return Collections.unmodifiableList(elements);
     }
+
+    private ObjectNode setElements(final List<Node> elements) {
+        if (this.elements == elements) {
+            return this;
+        }
+        return new ObjectNode(this, elements);
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/PropertyNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/PropertyNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,28 +25,27 @@
 
 package jdk.nashorn.internal.ir;
 
-import jdk.nashorn.internal.ir.annotations.Reference;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation of an object literal property.
  */
-public class PropertyNode extends Node {
+@Immutable
+public final class PropertyNode extends Node {
 
     /** Property key. */
-    private PropertyKey key;
+    private final PropertyKey key;
 
     /** Property value. */
-    private Node value;
+    private final Node value;
 
     /** Property getter. */
-    @Reference
-    private Node getter;
+    private final FunctionNode getter;
 
     /** Property getter. */
-    @Reference
-    private Node setter;
+    private final FunctionNode setter;
 
     /**
      * Constructor
@@ -56,26 +55,23 @@
      * @param finish  finish
      * @param key     the key of this property
      * @param value   the value of this property
+     * @param getter  getter function body
+     * @param setter  setter function body
      */
-    public PropertyNode(final Source source, final long token, final int finish, final PropertyKey key, final Node value) {
+    public PropertyNode(final Source source, final long token, final int finish, final PropertyKey key, final Node value, final FunctionNode getter, final FunctionNode setter) {
         super(source, token, finish);
-
         this.key    = key;
         this.value  = value;
+        this.getter = getter;
+        this.setter = setter;
     }
 
-    private PropertyNode(final PropertyNode propertyNode, final CopyState cs) {
+    private PropertyNode(final PropertyNode propertyNode, final PropertyKey key, final Node value, final FunctionNode getter, final FunctionNode setter) {
         super(propertyNode);
-
-        this.key    = (PropertyKey)cs.existingOrCopy((Node)propertyNode.key);
-        this.value  = cs.existingOrCopy(propertyNode.value);
-        this.getter = cs.existingOrSame(propertyNode.getter);
-        this.setter = cs.existingOrSame(propertyNode.setter);
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new PropertyNode(this, cs);
+        this.key    = key;
+        this.value  = value;
+        this.getter = getter;
+        this.setter = setter;
     }
 
     /**
@@ -88,22 +84,12 @@
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterPropertyNode(this) != null) {
-            key = (PropertyKey)((Node)key).accept(visitor);
-
-            if (value != null) {
-                value = value.accept(visitor);
-            }
-
-            if (getter != null) {
-                getter = getter.accept(visitor);
-            }
-
-            if (setter != null) {
-                setter = setter.accept(visitor);
-            }
-
-            return visitor.leavePropertyNode(this);
+        if (visitor.enterPropertyNode(this)) {
+            return visitor.leavePropertyNode(
+                setKey((PropertyKey)((Node)key).accept(visitor)).
+                setValue(value == null ? null : value.accept(visitor)).
+                setGetter(getter == null ? null : (FunctionNode)getter.accept(visitor)).
+                setSetter(setter == null ? null : (FunctionNode)setter.accept(visitor)));
         }
 
         return this;
@@ -136,16 +122,20 @@
      * Get the getter for this property
      * @return getter or null if none exists
      */
-    public Node getGetter() {
+    public FunctionNode getGetter() {
         return getter;
     }
 
     /**
      * Set the getter of this property, null if none
      * @param getter getter
+     * @return same node or new node if state changed
      */
-    public void setGetter(final Node getter) {
-        this.getter = getter;
+    public PropertyNode setGetter(final FunctionNode getter) {
+        if (this.getter == getter) {
+            return this;
+        }
+        return new PropertyNode(this, key, value, getter, setter);
     }
 
     /**
@@ -156,20 +146,31 @@
         return (Node)key;
     }
 
+    private PropertyNode setKey(final PropertyKey key) {
+        if (this.key == key) {
+            return this;
+        }
+        return new PropertyNode(this, key, value, getter, setter);
+    }
+
     /**
      * Get the setter for this property
      * @return setter or null if none exists
      */
-    public Node getSetter() {
+    public FunctionNode getSetter() {
         return setter;
     }
 
     /**
      * Set the setter for this property, null if none
      * @param setter setter
+     * @return same node or new node if state changed
      */
-    public void setSetter(final Node setter) {
-        this.setter = setter;
+    public PropertyNode setSetter(final FunctionNode setter) {
+        if (this.setter == setter) {
+            return this;
+        }
+        return new PropertyNode(this, key, value, getter, setter);
     }
 
     /**
@@ -183,8 +184,12 @@
     /**
      * Set the value of this property
      * @param value new value
+     * @return same node or new node if state changed
      */
-    public void setValue(final Node value) {
-        this.value = value;
-    }
+    public PropertyNode setValue(final Node value) {
+        if (this.value == value) {
+            return this;
+        }
+        return new PropertyNode(this, key, value, getter, setter);
+   }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/ReturnNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/ReturnNode.java	Wed May 08 10:10:05 2013 +0100
@@ -27,22 +27,17 @@
 
 import static jdk.nashorn.internal.parser.TokenType.RETURN;
 import static jdk.nashorn.internal.parser.TokenType.YIELD;
-
-import jdk.nashorn.internal.ir.annotations.Ignore;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for RETURN or YIELD statements.
- *
  */
+@Immutable
 public class ReturnNode extends Node {
     /** Optional expression. */
-    private Node expression;
-
-    /** Try chain. */
-    @Ignore
-    private final TryNode tryChain;
+    private final Node expression;
 
     /**
      * Constructor
@@ -51,27 +46,20 @@
      * @param token      token
      * @param finish     finish
      * @param expression expression to return
-     * @param tryChain   surrounding try chain.
      */
-    public ReturnNode(final Source source, final long token, final int finish, final Node expression, final TryNode tryChain) {
+    public ReturnNode(final Source source, final long token, final int finish, final Node expression) {
         super(source, token, finish);
-
         this.expression = expression;
-        this.tryChain   = tryChain;
-
-        setIsTerminal(true);
     }
 
-    private ReturnNode(final ReturnNode returnNode, final CopyState cs) {
+    private ReturnNode(final ReturnNode returnNode, final Node expression) {
         super(returnNode);
-
-        this.expression = cs.existingOrCopy(returnNode.expression);
-        this.tryChain   = (TryNode)cs.existingOrSame(returnNode.tryChain);
+        this.expression = expression;
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new ReturnNode(this, cs);
+    public boolean isTerminal() {
+        return true;
     }
 
     /**
@@ -100,11 +88,10 @@
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterReturnNode(this) != null) {
+        if (visitor.enterReturnNode(this)) {
             if (expression != null) {
-                expression = expression.accept(visitor);
+                return visitor.leaveReturnNode(setExpression(expression.accept(visitor)));
             }
-
             return visitor.leaveReturnNode(this);
         }
 
@@ -121,25 +108,6 @@
         }
     }
 
-    @Override
-    public boolean equals(final Object other) {
-        if (other instanceof ReturnNode) {
-            final ReturnNode otherReturn = (ReturnNode)other;
-            if (hasExpression() != otherReturn.hasExpression()) {
-                return false;
-            } else if (hasExpression()) {
-                return otherReturn.getExpression().equals(getExpression());
-            }
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return 0x4711_17 ^ (expression == null ? 0 : expression.hashCode());
-    }
-
     /**
      * Get the expression this node returns
      * @return return expression, or null if void return
@@ -151,16 +119,13 @@
     /**
      * Reset the expression this node returns
      * @param expression new expression, or null if void return
+     * @return new or same return node
      */
-    public void setExpression(final Node expression) {
-        this.expression = expression;
+    public ReturnNode setExpression(final Node expression) {
+        if (this.expression == expression) {
+            return this;
+        }
+        return new ReturnNode(this, expression);
     }
 
-    /**
-     * Get the surrounding try chain for this return node
-     * @return try chain
-     */
-    public TryNode getTryChain() {
-        return tryChain;
-    }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/RuntimeNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/RuntimeNode.java	Wed May 08 10:10:05 2013 +0100
@@ -30,14 +30,15 @@
 import java.util.Collections;
 import java.util.List;
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.TokenType;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for a runtime call.
- *
  */
+@Immutable
 public class RuntimeNode extends Node implements TypeOverride<RuntimeNode> {
 
     /**
@@ -271,10 +272,10 @@
     private final List<Node> args;
 
     /** Call site override - e.g. we know that a ScriptRuntime.ADD will return an int */
-    private Type callSiteType;
+    private final Type callSiteType;
 
     /** is final - i.e. may not be removed again, lower in the code pipeline */
-    private boolean isFinal;
+    private final boolean isFinal;
 
     /**
      * Constructor
@@ -290,6 +291,17 @@
 
         this.request      = request;
         this.args         = args;
+        this.callSiteType = null;
+        this.isFinal      = false;
+    }
+
+    private RuntimeNode(final RuntimeNode runtimeNode, final Request request, final Type callSiteType, final boolean isFinal, final List<Node> args) {
+        super(runtimeNode);
+
+        this.request      = request;
+        this.args         = args;
+        this.callSiteType = callSiteType;
+        this.isFinal      = isFinal;
     }
 
     /**
@@ -326,8 +338,10 @@
     public RuntimeNode(final Node parent, final Request request, final List<Node> args) {
         super(parent);
 
-        this.request = request;
-        this.args    = args;
+        this.request      = request;
+        this.args         = args;
+        this.callSiteType = null;
+        this.isFinal      = false;
     }
 
     /**
@@ -350,20 +364,6 @@
         this(parent, request, parent.lhs(), parent.rhs());
     }
 
-    private RuntimeNode(final RuntimeNode runtimeNode, final CopyState cs) {
-        super(runtimeNode);
-
-        final List<Node> newArgs = new ArrayList<>();
-
-        for (final Node arg : runtimeNode.args) {
-            newArgs.add(cs.existingOrCopy(arg));
-        }
-
-        this.request      = runtimeNode.request;
-        this.args         = newArgs;
-        this.callSiteType = runtimeNode.callSiteType;
-    }
-
     /**
      * Is this node final - i.e. it can never be replaced with other nodes again
      * @return true if final
@@ -374,14 +374,14 @@
 
     /**
      * Flag this node as final - i.e it may never be replaced with other nodes again
+     * @param isFinal is the node final, i.e. can not be removed and replaced by a less generic one later in codegen
+     * @return same runtime node if already final, otherwise a new one
      */
-    public void setIsFinal() {
-        this.isFinal = true;
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new RuntimeNode(this, cs);
+    public RuntimeNode setIsFinal(final boolean isFinal) {
+        if (this.isFinal == isFinal) {
+            return this;
+        }
+        return new RuntimeNode(this, request, callSiteType, isFinal, args);
     }
 
     /**
@@ -394,8 +394,10 @@
 
     @Override
     public RuntimeNode setType(final Type type) {
-        this.callSiteType = type;
-        return this;
+        if (this.callSiteType == type) {
+            return this;
+        }
+        return new RuntimeNode(this, request, type, isFinal, args);
     }
 
     @Override
@@ -409,12 +411,12 @@
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterRuntimeNode(this) != null) {
-            for (int i = 0, count = args.size(); i < count; i++) {
-                args.set(i, args.get(i).accept(visitor));
+        if (visitor.enterRuntimeNode(this)) {
+            final List<Node> newArgs = new ArrayList<>();
+            for (final Node arg : args) {
+                newArgs.add(arg.accept(visitor));
             }
-
-            return visitor.leaveRuntimeNode(this);
+            return visitor.leaveRuntimeNode(setArgs(newArgs));
         }
 
         return this;
@@ -449,6 +451,13 @@
         return Collections.unmodifiableList(args);
     }
 
+    private RuntimeNode setArgs(final List<Node> args) {
+        if (this.args == args) {
+            return this;
+        }
+        return new RuntimeNode(this, request, callSiteType, isFinal, args);
+    }
+
     /**
      * Get the request that this runtime node implements
      * @return the request
--- a/nashorn/src/jdk/nashorn/internal/ir/SplitNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/SplitNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,99 +25,65 @@
 
 package jdk.nashorn.internal.ir;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
 import jdk.nashorn.internal.codegen.CompileUnit;
-import jdk.nashorn.internal.codegen.Label;
-import jdk.nashorn.internal.codegen.MethodEmitter;
-import jdk.nashorn.internal.ir.annotations.Ignore;
-import jdk.nashorn.internal.ir.annotations.Reference;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 
-
 /**
  * Node indicating code is split across classes.
  */
-public class SplitNode extends Node {
+@Immutable
+public class SplitNode extends LexicalContextNode {
     /** Split node method name. */
     private final String name;
 
     /** Compilation unit. */
-    private CompileUnit compileUnit;
-
-    /** Method emitter for current method. */
-    private MethodEmitter method;
-
-    /** Method emitter for caller method. */
-    private MethodEmitter caller;
-
-    /** Containing function. */
-    @Reference
-    private final FunctionNode functionNode;
-
-    /** A list of target labels in parent methods this split node may encounter. */
-    @Ignore
-    private final List<Label> externalTargets;
-
-    /** True if this split node or any of its children contain a return statement. */
-    private boolean hasReturn;
+    private final CompileUnit compileUnit;
 
     /** Body of split code. */
-    @Ignore
-    private Node body;
+    private final Node body;
 
     /**
      * Constructor
      *
-     * @param name          name of split node
-     * @param functionNode  function node to split in
-     * @param body          body of split code
+     * @param name        name of split node
+     * @param body        body of split code
+     * @param compileUnit compile unit to use for the body
      */
-    public SplitNode(final String name, final FunctionNode functionNode, final Node body) {
+    public SplitNode(final String name, final Node body, final CompileUnit compileUnit) {
         super(body.getSource(), body.getToken(), body.getFinish());
-
-        this.name         = name;
-        this.functionNode = functionNode;
-        this.body         = body;
-        this.externalTargets = new ArrayList<>();
+        this.name        = name;
+        this.body        = body;
+        this.compileUnit = compileUnit;
     }
 
-    private SplitNode(final SplitNode splitNode, final CopyState cs) {
+    private SplitNode(final SplitNode splitNode, final Node body) {
         super(splitNode);
+        this.name        = splitNode.name;
+        this.body        = body;
+        this.compileUnit = splitNode.compileUnit;
+    }
 
-        this.name         = splitNode.name;
-        this.functionNode = (FunctionNode)cs.existingOrSame(splitNode.functionNode);
-        this.body         = cs.existingOrCopy(splitNode.body);
-        this.externalTargets = new ArrayList<>();
+    /**
+     * Get the body for this split node - i.e. the actual code it encloses
+     * @return body for split node
+     */
+    public Node getBody() {
+        return body;
+    }
+
+    private SplitNode setBody(final LexicalContext lc, final Node body) {
+        if (this.body == body) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new SplitNode(this, body));
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new SplitNode(this, cs);
-    }
-
-    @Override
-    public Node accept(final NodeVisitor visitor) {
-        final CompileUnit   saveCompileUnit = visitor.getCurrentCompileUnit();
-        final MethodEmitter saveMethod      = visitor.getCurrentMethodEmitter();
-
-        setCaller(saveMethod);
-
-        visitor.setCurrentCompileUnit(getCompileUnit());
-        visitor.setCurrentMethodEmitter(getMethodEmitter());
-
-        try {
-            if (visitor.enterSplitNode(this) != null) {
-                body = body.accept(visitor);
-
-                return visitor.leaveSplitNode(this);
-            }
-        } finally {
-            visitor.setCurrentCompileUnit(saveCompileUnit);
-            visitor.setCurrentMethodEmitter(saveMethod);
+    public Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterSplitNode(this)) {
+            return visitor.leaveSplitNode(setBody(lc, body.accept(visitor)));
         }
-
         return this;
     }
 
@@ -130,22 +96,6 @@
     }
 
     /**
-     * Get the method emitter of the caller for this split node
-     * @return caller method emitter
-     */
-    public MethodEmitter getCaller() {
-        return caller;
-    }
-
-    /**
-     * Set the caller method emitter for this split node
-     * @param caller method emitter
-     */
-    public void setCaller(final MethodEmitter caller) {
-        this.caller = caller;
-    }
-
-    /**
      * Get the name for this split node
      * @return name
      */
@@ -161,67 +111,4 @@
         return compileUnit;
     }
 
-    /**
-     * Set the compile unit for this split node
-     * @param compileUnit compile unit
-     */
-    public void setCompileUnit(final CompileUnit compileUnit) {
-        this.compileUnit = compileUnit;
-    }
-
-    /**
-     * Get the method emitter for this split node
-     * @return method emitter
-     */
-    public MethodEmitter getMethodEmitter() {
-        return method;
-    }
-
-    /**
-     * Set the method emitter for this split node
-     * @param method method emitter
-     */
-    public void setMethodEmitter(final MethodEmitter method) {
-        this.method = method;
-    }
-
-    /**
-     * Get the function node this SplitNode splits
-     * @return function node reference
-     */
-    public FunctionNode getFunctionNode() {
-        return functionNode;
-    }
-
-    /**
-     * Get the external targets for this SplitNode
-     * @return list of external targets
-     */
-    public List<Label> getExternalTargets() {
-        return Collections.unmodifiableList(externalTargets);
-    }
-
-    /**
-     * Add an external target for this SplitNode
-     * @param targetLabel target label
-     */
-    public void addExternalTarget(final Label targetLabel) {
-        externalTargets.add(targetLabel);
-    }
-
-    /**
-     * Check whether this SplitNode returns a value
-     * @return true if return
-     */
-    public boolean hasReturn() {
-        return hasReturn;
-    }
-
-    /**
-     * Set whether this SplitNode returns a value or not
-     * @param hasReturn true if return exists, false otherwise
-     */
-    public void setHasReturn(final boolean hasReturn) {
-        this.hasReturn = hasReturn;
-    }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/SwitchNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/SwitchNode.java	Wed May 08 10:10:05 2013 +0100
@@ -28,73 +28,84 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+
 import jdk.nashorn.internal.codegen.Label;
-import jdk.nashorn.internal.ir.annotations.Ignore;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation of a SWITCH statement.
  */
-public class SwitchNode extends BreakableNode {
+@Immutable
+public final class SwitchNode extends BreakableNode {
     /** Switch expression. */
-    private Node expression;
+    private final Node expression;
+
+    /** Switch cases. */
+    private final List<CaseNode> cases;
+
+    /** Switch default index. */
+    private final int defaultCaseIndex;
 
     /** Tag symbol. */
     private Symbol tag;
 
-    /** Switch cases. */
-    private List<CaseNode> cases;
-
-    /** Switch default. */
-    @Ignore //points to one of the members in the list above, don't traverse twice
-    private CaseNode defaultCase;
-
     /**
      * Constructor
      *
-     * @param source  the source
-     * @param token   token
-     * @param finish  finish
+     * @param source      the source
+     * @param token       token
+     * @param finish      finish
+     * @param expression  switch expression
+     * @param cases       cases
+     * @param defaultCase the default case node - null if none, otherwise has to be present in cases list
      */
-    public SwitchNode(final Source source, final long token, final int finish) {
-        super(source, token, finish);
-        this.breakLabel  = new Label("switch_break");
+    public SwitchNode(final Source source, final long token, final int finish, final Node expression, final List<CaseNode> cases, final CaseNode defaultCase) {
+        super(source, token, finish, new Label("switch_break"));
+        this.expression       = expression;
+        this.cases            = cases;
+        this.defaultCaseIndex = defaultCase == null ? -1 : cases.indexOf(defaultCase);
     }
 
-    private SwitchNode(final SwitchNode switchNode, final CopyState cs) {
+    private SwitchNode(final SwitchNode switchNode, final Node expression, final List<CaseNode> cases, final int defaultCase) {
         super(switchNode);
-
-        final List<CaseNode> newCases = new ArrayList<>();
-
-        for (final CaseNode caseNode : switchNode.getCases()) {
-           newCases.add((CaseNode)cs.existingOrCopy(caseNode));
-        }
-
-        this.expression  = cs.existingOrCopy(switchNode.getExpression());
-        this.tag         = switchNode.getTag();
-        this.cases       = newCases;
-        this.defaultCase = (CaseNode)cs.existingOrCopy(switchNode.getDefaultCase());
-        this.breakLabel  = new Label(switchNode.getBreakLabel());
+        this.expression       = expression;
+        this.cases            = cases;
+        this.defaultCaseIndex = defaultCase;
+        this.tag              = switchNode.getTag(); //TODO are symbols inhereted as references?
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new SwitchNode(this, cs);
+    public Node ensureUniqueLabels(final LexicalContext lc) {
+        final List<CaseNode> newCases = new ArrayList<>();
+        for (final CaseNode caseNode : cases) {
+            newCases.add(new CaseNode(caseNode, caseNode.getTest(), caseNode.getBody()));
+        }
+        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, newCases, defaultCaseIndex));
     }
 
     @Override
-    public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterSwitchNode(this) != null) {
-            expression = expression.accept(visitor);
+    public boolean isTerminal() {
+        //there must be a default case, and that including all other cases must terminate
+        if (!cases.isEmpty() && defaultCaseIndex != -1) {
+            for (final CaseNode caseNode : cases) {
+                if (!caseNode.isTerminal()) {
+                    return false;
+                }
+            }
+            return true;
+        }
+        return false;
 
-            for (int i = 0, count = cases.size(); i < count; i++) {
-                cases.set(i, (CaseNode)cases.get(i).accept(visitor));
-            }
+    }
 
-            //the default case is in the cases list and should not be explicitly traversed!
-
-            return visitor.leaveSwitchNode(this);
+    @Override
+    public Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterSwitchNode(this)) {
+            return visitor.leaveSwitchNode(
+                setExpression(visitor.getLexicalContext(), expression.accept(visitor)).
+                setCases(visitor.getLexicalContext(), Node.accept(visitor, CaseNode.class, cases), defaultCaseIndex));
         }
 
         return this;
@@ -108,6 +119,14 @@
     }
 
     /**
+     * Return the case node that is default case
+     * @return default case or null if none
+     */
+    public CaseNode getDefaultCase() {
+        return defaultCaseIndex == -1 ? null : cases.get(defaultCaseIndex);
+    }
+
+    /**
      * Get the cases in this switch
      * @return a list of case nodes
      */
@@ -116,27 +135,33 @@
     }
 
     /**
-     * Set or reset the list of cases in this switch
-     * @param cases a list of cases, case nodes
+     * Replace case nodes with new list. the cases have to be the same
+     * and the default case index the same. This is typically used
+     * by NodeVisitors who perform operations on every case node
+     * @param lc    lexical context
+     * @param cases list of cases
+     * @return new switcy node or same if no state was changed
      */
-    public void setCases(final List<CaseNode> cases) {
-        this.cases = cases;
+    public SwitchNode setCases(final LexicalContext lc, final List<CaseNode> cases) {
+        return setCases(lc, cases, defaultCaseIndex);
+    }
+
+    private SwitchNode setCases(final LexicalContext lc, final List<CaseNode> cases, final int defaultCaseIndex) {
+        if (this.cases == cases) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex));
     }
 
     /**
-     * Get the default case for this switch
-     * @return default case node
+     * Set or reset the list of cases in this switch
+     * @param lc lexical context
+     * @param cases a list of cases, case nodes
+     * @param defaultCase a case in the list that is the default - must be in the list or class will assert
+     * @return new switch node or same if no state was changed
      */
-    public CaseNode getDefaultCase() {
-        return defaultCase;
-    }
-
-    /**
-     * Set the default case for this switch
-     * @param defaultCase default case node
-     */
-    public void setDefaultCase(final CaseNode defaultCase) {
-        this.defaultCase = defaultCase;
+    public SwitchNode setCases(final LexicalContext lc, final List<CaseNode> cases, final CaseNode defaultCase) {
+        return setCases(lc, cases, defaultCase == null ? -1 : cases.indexOf(defaultCase));
     }
 
     /**
@@ -149,10 +174,15 @@
 
     /**
      * Set or reset the expression to switch on
+     * @param lc lexical context
      * @param expression switch expression
+     * @return new switch node or same if no state was changed
      */
-    public void setExpression(final Node expression) {
-        this.expression = expression;
+    public SwitchNode setExpression(final LexicalContext lc, final Node expression) {
+        if (this.expression == expression) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex));
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/ir/Symbol.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/Symbol.java	Wed May 08 10:10:05 2013 +0100
@@ -29,8 +29,10 @@
 import java.util.HashSet;
 import java.util.Set;
 import java.util.StringTokenizer;
+
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.Debug;
 import jdk.nashorn.internal.runtime.options.Options;
 
 /**
@@ -63,6 +65,8 @@
     public static final int IS_LET           = 1 << 8;
     /** Is this an internal symbol, never represented explicitly in source code */
     public static final int IS_INTERNAL      = 1 << 9;
+    /** Is this a function self-reference symbol */
+    public static final int IS_FUNCTION_SELF = 1 << 10;
 
     /** Null or name identifying symbol. */
     private final String name;
@@ -70,12 +74,6 @@
     /** Symbol flags. */
     private int flags;
 
-    /** Defining node. */
-    private Node node;
-
-    /** Definition block. */
-    private final Block block;
-
     /** Type of symbol. */
     private Type type;
 
@@ -121,16 +119,12 @@
      *
      * @param name  name of symbol
      * @param flags symbol flags
-     * @param node  node this symbol is in
-     * @param block block this symbol is in
      * @param type  type of this symbol
      * @param slot  bytecode slot for this symbol
      */
-    protected Symbol(final String name, final int flags, final Node node, final Block block, final Type type, final int slot) {
+    protected Symbol(final String name, final int flags, final Type type, final int slot) {
         this.name       = name;
         this.flags      = flags;
-        this.node       = node;
-        this.block      = block;
         this.type       = type;
         this.slot       = slot;
         this.fieldIndex = -1;
@@ -142,11 +136,9 @@
      *
      * @param name  name of symbol
      * @param flags symbol flags
-     * @param node  node this symbol is in
-     * @param block block this symbol is in
      */
-    public Symbol(final String name, final int flags, final Node node, final Block block) {
-        this(name, flags, node, block, Type.UNKNOWN, -1);
+    public Symbol(final String name, final int flags) {
+        this(name, flags, Type.UNKNOWN, -1);
     }
 
     /**
@@ -157,7 +149,7 @@
      * @param type  type of this symbol
      */
     public Symbol(final String name, final int flags, final Type type) {
-        this(name, flags, null, null, type, -1);
+        this(name, flags, type, -1);
     }
 
     private static String align(final String string, final int max) {
@@ -269,20 +261,6 @@
         return type.isCategory2() ? 2 : 1;
     }
 
-    @Override
-    public boolean equals(final Object other) {
-        if (!(other instanceof Symbol)) {
-            return false;
-        }
-        final Symbol symbol = (Symbol) other;
-        return name.equals(symbol.name) && block.equals(symbol.block);
-    }
-
-    @Override
-    public int hashCode() {
-        return name.hashCode() ^ block.hashCode();
-    }
-
     private static String type(final String desc) {
         switch (desc.charAt(desc.length() - 1)) {
         case ';':
@@ -371,14 +349,14 @@
     /**
      * Flag this symbol as scope as described in {@link Symbol#isScope()}
      */
-    public void setIsScope() {
+    /**
+     * Flag this symbol as scope as described in {@link Symbol#isScope()}
+     */
+     public void setIsScope() {
         if (!isScope()) {
             trace("SET IS SCOPE");
         }
         flags |= IS_SCOPE;
-        if(!isGlobal()) {
-            getBlock().setNeedsScope();
-        }
     }
 
     /**
@@ -478,11 +456,11 @@
     }
 
     /**
-     * Get the block in which the symbol is defined
-     * @return a block
+     * Flag this symbol as a function's self-referencing symbol.
+     * @return true if this symbol as a function's self-referencing symbol.
      */
-    public Block getBlock() {
-        return block;
+    public boolean isFunctionSelf() {
+        return (flags & IS_FUNCTION_SELF) == IS_FUNCTION_SELF;
     }
 
     /**
@@ -492,7 +470,7 @@
      * @return field index
      */
     public int getFieldIndex() {
-        assert fieldIndex != -1 : "fieldIndex must be initialized";
+        assert fieldIndex != -1 : "fieldIndex must be initialized " + fieldIndex;
         return fieldIndex;
     }
 
@@ -503,7 +481,6 @@
      * @param fieldIndex field index - a positive integer
      */
     public void setFieldIndex(final int fieldIndex) {
-        assert this.fieldIndex == -1 : "fieldIndex must be initialized only once";
         this.fieldIndex = fieldIndex;
     }
 
@@ -524,22 +501,6 @@
     }
 
     /**
-     * Get the node this symbol stores the result for
-     * @return node
-     */
-    public Node getNode() {
-        return node;
-    }
-
-    /**
-     * Set the node this symbol stores the result for
-     * @param node node
-     */
-    public void setNode(final Node node) {
-        this.node = node;
-    }
-
-    /**
      * Get the name of this symbol
      * @return symbol name
      */
@@ -616,18 +577,25 @@
     }
 
     /**
-     * Check if this symbol is in the global scope, i.e. it is on the outermost level
-     * in the script
-     * @return true if this this is a global scope symbol
+     * From a lexical context, set this symbol as needing scope, which
+     * will set flags for the defining block that will be written when
+     * block is popped from the lexical context stack, used by codegen
+     * when flags need to be tagged, but block is in the
+     * middle of evaluation and cannot be modified.
+     *
+     * @param lc     lexical context
+     * @param symbol symbol
      */
-    public boolean isTopLevel() {
-        return block instanceof FunctionNode && ((FunctionNode) block).isProgram();
+    public static void setSymbolIsScope(final LexicalContext lc, final Symbol symbol) {
+        symbol.setIsScope();
+        if (!symbol.isGlobal()) {
+            lc.setFlag(lc.getDefiningBlock(symbol), Block.NEEDS_SCOPE);
+        }
     }
 
-
     private void trace(final String desc) {
         if (TRACE_SYMBOLS != null && (TRACE_SYMBOLS.isEmpty() || TRACE_SYMBOLS.contains(name))) {
-            Context.err("SYMBOL: '" + name + "' " + desc);
+            Context.err(Debug.id(this) + " SYMBOL: '" + name + "' " + desc);
             if (TRACE_SYMBOLS_STACKTRACE != null && (TRACE_SYMBOLS_STACKTRACE.isEmpty() || TRACE_SYMBOLS_STACKTRACE.contains(name))) {
                 new Throwable().printStackTrace(Context.getCurrentErr());
             }
--- a/nashorn/src/jdk/nashorn/internal/ir/TernaryNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/TernaryNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,15 +25,21 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * TernaryNode nodes represent three operand operations (?:).
  */
-public class TernaryNode extends BinaryNode {
+@Immutable
+public final class TernaryNode extends Node {
+    private final Node lhs;
+
+    private final Node rhs;
+
     /** Third argument. */
-    private Node third;
+    private final Node third;
 
     /**
      * Constructor
@@ -45,43 +51,26 @@
      * @param third  third node
      */
     public TernaryNode(final Source source, final long token, final Node lhs, final Node rhs, final Node third) {
-        super(source, token, lhs, rhs);
-
-        this.finish = third.getFinish();
+        super(source, token, third.getFinish());
+        this.lhs = lhs;
+        this.rhs = rhs;
         this.third = third;
     }
 
-    private TernaryNode(final TernaryNode ternaryNode, final CopyState cs) {
-        super(ternaryNode, cs);
-
-        this.third = cs.existingOrCopy(ternaryNode.third);
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new TernaryNode(this, cs);
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-        if (!super.equals(other)) {
-            return false;
-        }
-        return third.equals(((TernaryNode)other).third());
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode() ^ third().hashCode();
+    private TernaryNode(final TernaryNode ternaryNode, final Node lhs, final Node rhs, final Node third) {
+        super(ternaryNode);
+        this.lhs = lhs;
+        this.rhs = rhs;
+        this.third = third;
     }
 
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterTernaryNode(this) != null) {
+        if (visitor.enterTernaryNode(this)) {
             final Node newLhs = lhs().accept(visitor);
             final Node newRhs = rhs().accept(visitor);
             final Node newThird = third.accept(visitor);
-            return visitor.leaveTernaryNode((TernaryNode)setThird(newThird).setLHS(newLhs).setRHS(newRhs));
+            return visitor.leaveTernaryNode(setThird(newThird).setLHS(newLhs).setRHS(newRhs));
         }
 
         return this;
@@ -123,6 +112,22 @@
     }
 
     /**
+     * Get the lhs node for this ternary expression, i.e. "x" in x ? y : z
+     * @return a node
+     */
+    public Node lhs() {
+        return lhs;
+    }
+
+    /**
+     * Get the rhs node for this ternary expression, i.e. "y" in x ? y : z
+     * @return a node
+     */
+    public Node rhs() {
+        return rhs;
+    }
+
+    /**
      * Get the "third" node for this ternary expression, i.e. "z" in x ? y : z
      * @return a node
      */
@@ -131,14 +136,38 @@
     }
 
     /**
+     * Set the left hand side expression for this node
+     * @param lhs new left hand side expression
+     * @return a node equivalent to this one except for the requested change.
+     */
+    public TernaryNode setLHS(final Node lhs) {
+        if (this.lhs == lhs) {
+            return this;
+        }
+        return new TernaryNode(this, lhs, rhs, third);
+    }
+
+    /**
+     * Set the right hand side expression for this node
+     * @param rhs new left hand side expression
+     * @return a node equivalent to this one except for the requested change.
+     */
+    public TernaryNode setRHS(final Node rhs) {
+        if (this.rhs == rhs) {
+            return this;
+        }
+        return new TernaryNode(this, lhs, rhs, third);
+    }
+
+    /**
      * Reset the "third" node for this ternary expression, i.e. "z" in x ? y : z
      * @param third a node
      * @return a node equivalent to this one except for the requested change.
      */
     public TernaryNode setThird(final Node third) {
-        if(this.third == third) return this;
-        final TernaryNode n = (TernaryNode)clone();
-        n.third = third;
-        return n;
+        if (this.third == third) {
+            return this;
+        }
+        return new TernaryNode(this, lhs, rhs, third);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/ThrowNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/ThrowNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,20 +25,17 @@
 
 package jdk.nashorn.internal.ir;
 
-import jdk.nashorn.internal.ir.annotations.Ignore;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for THROW statements.
  */
-public class ThrowNode extends Node {
+@Immutable
+public final class ThrowNode extends Node {
     /** Exception expression. */
-    private Node expression;
-
-    /** Try chain. */
-    @Ignore
-    private final TryNode tryChain;
+    private final Node expression;
 
     /**
      * Constructor
@@ -47,26 +44,21 @@
      * @param token      token
      * @param finish     finish
      * @param expression expression to throw
-     * @param tryChain   surrounding try chain
      */
-    public ThrowNode(final Source source, final long token, final int finish, final Node expression, final TryNode tryChain) {
+    public ThrowNode(final Source source, final long token, final int finish, final Node expression) {
         super(source, token, finish);
 
         this.expression = expression;
-        this.tryChain = tryChain;
-        setIsTerminal(true);
     }
 
-    private ThrowNode(final ThrowNode throwNode, final CopyState cs) {
-        super(throwNode);
-
-        this.expression = cs.existingOrCopy(throwNode.expression);
-        this.tryChain = (TryNode)cs.existingOrSame(throwNode.tryChain);
+    private ThrowNode(final Node node, final Node expression) {
+        super(node);
+        this.expression = expression;
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new ThrowNode(this, cs);
+    public boolean isTerminal() {
+        return true;
     }
 
     /**
@@ -75,9 +67,8 @@
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterThrowNode(this) != null) {
-            setExpression(expression.accept(visitor));
-            return visitor.leaveThrowNode(this);
+        if (visitor.enterThrowNode(this)) {
+            return visitor.leaveThrowNode(setExpression(expression.accept(visitor)));
         }
 
         return this;
@@ -103,16 +94,13 @@
     /**
      * Reset the expression being thrown by this node
      * @param expression new expression
+     * @return new or same thrownode
      */
-    public void setExpression(final Node expression) {
-        this.expression = expression;
+    public ThrowNode setExpression(final Node expression) {
+        if (this.expression == expression) {
+            return this;
+        }
+        return new ThrowNode(this, expression);
     }
 
-    /**
-     * Get surrounding tryChain for this node
-     * @return try chain
-     */
-    public TryNode getTryChain() {
-        return tryChain;
-    }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/TryNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/TryNode.java	Wed May 08 10:10:05 2013 +0100
@@ -28,30 +28,28 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+
 import jdk.nashorn.internal.codegen.Label;
-import jdk.nashorn.internal.ir.annotations.Ignore;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation of a TRY statement.
  */
-public class TryNode extends Node {
-    /** Try chain. */
-    @Ignore //don't print, will be apparent from the AST
-    private TryNode next;
-
+@Immutable
+public final class TryNode extends Node {
     /** Try statements. */
-    private Block body;
+    private final Block body;
 
     /** List of catch clauses. */
-    private List<Block> catchBlocks;
+    private final List<Block> catchBlocks;
 
     /** Finally clause. */
-    private Block finallyBody;
+    private final Block finallyBody;
 
     /** Exit label. */
-    private Label exit;
+    private final Label exit;
 
     /** Exception symbol. */
     private Symbol exception;
@@ -62,37 +60,46 @@
     /**
      * Constructor
      *
-     * @param source  the source
-     * @param token   token
-     * @param finish  finish
-     * @param next    next try node in chain
+     * @param source      the source
+     * @param token       token
+     * @param finish      finish
+     * @param body        try node body
+     * @param catchBlocks list of catch blocks in order
+     * @param finallyBody body of finally block or null if none
      */
-    public TryNode(final Source source, final long token, final int finish, final TryNode next) {
+    public TryNode(final Source source, final long token, final int finish, final Block body, final List<Block> catchBlocks, final Block finallyBody) {
         super(source, token, finish);
-
-        this.next = next;
+        this.body = body;
+        this.catchBlocks = catchBlocks;
+        this.finallyBody = finallyBody;
         this.exit = new Label("exit");
     }
 
-    private TryNode(final TryNode tryNode, final CopyState cs) {
+    private TryNode(final TryNode tryNode, final Block body, final List<Block> catchBlocks, final Block finallyBody) {
         super(tryNode);
-
-        final List<Block> newCatchBlocks = new ArrayList<>();
-
-        for (final Block block : tryNode.catchBlocks) {
-            newCatchBlocks.add((Block)cs.existingOrCopy(block));
-        }
-
-        this.next        = (TryNode)cs.existingOrSame(tryNode.getNext());
-        this.body        = (Block)cs.existingOrCopy(tryNode.getBody());
-        this.catchBlocks = newCatchBlocks;
-        this.finallyBody = (Block)cs.existingOrCopy(tryNode.getFinallyBody());
-        this.exit        = new Label(tryNode.getExit());
+        this.body = body;
+        this.catchBlocks = catchBlocks;
+        this.finallyBody = finallyBody;
+        this.exit = new Label(tryNode.exit);
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new TryNode(this, cs);
+    public Node ensureUniqueLabels(final LexicalContext lc) {
+        //try nodes are never in lex context
+        return new TryNode(this, body, catchBlocks, finallyBody);
+    }
+
+    @Override
+    public boolean isTerminal() {
+        if (body.isTerminal()) {
+            for (final Block catchBlock : getCatchBlocks()) {
+                if (!catchBlock.isTerminal()) {
+                    return false;
+                }
+            }
+            return true;
+        }
+        return false;
     }
 
     /**
@@ -101,21 +108,16 @@
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterTryNode(this) != null) {
-            // Need to do first for termination analysis.
-            if (finallyBody != null) {
-                finallyBody = (Block)finallyBody.accept(visitor);
-            }
-
-            body = (Block)body.accept(visitor);
-
-            final List<Block> newCatchBlocks = new ArrayList<>(catchBlocks.size());
-            for (final Block catchBlock : catchBlocks) {
-                newCatchBlocks.add((Block)catchBlock.accept(visitor));
-            }
-            this.catchBlocks = newCatchBlocks;
-
-            return visitor.leaveTryNode(this);
+        if (visitor.enterTryNode(this)) {
+            // Need to do finallybody first for termination analysis. TODO still necessary?
+            final Block newFinallyBody = finallyBody == null ? null : (Block)finallyBody.accept(visitor);
+            final Block newBody        = (Block)body.accept(visitor);
+            return visitor.leaveTryNode(
+                setBody(newBody).
+                setFinallyBody(newFinallyBody).
+                setCatchBlocks(Node.accept(visitor, Block.class, catchBlocks)).
+                setException(exception).
+                setFinallyCatchAll(finallyCatchAll));
         }
 
         return this;
@@ -123,7 +125,7 @@
 
     @Override
     public void toString(final StringBuilder sb) {
-        sb.append("try");
+        sb.append("try ");
     }
 
     /**
@@ -137,9 +139,13 @@
     /**
      * Reset the body of this try block
      * @param body new body
+     * @return new TryNode or same if unchanged
      */
-    public void setBody(final Block body) {
-        this.body = body;
+    public TryNode setBody(final Block body) {
+        if (this.body == body) {
+            return this;
+        }
+        return new TryNode(this,  body, catchBlocks, finallyBody);
     }
 
     /**
@@ -151,16 +157,7 @@
         for (final Block catchBlock : catchBlocks) {
             catches.add((CatchNode)catchBlock.getStatements().get(0));
         }
-        return catches;
-    }
-
-    /**
-     * Returns true if the specified block is the body of this try block, or any of its catch blocks.
-     * @param block the block
-     * @return true if the specified block is the body of this try block, or any of its catch blocks.
-     */
-    public boolean isChildBlock(Block block) {
-        return body == block || catchBlocks.contains(block);
+        return Collections.unmodifiableList(catches);
     }
 
     /**
@@ -174,9 +171,13 @@
     /**
      * Set the catch blocks of this try
      * @param catchBlocks list of catch blocks
+     * @return new TryNode or same if unchanged
      */
-    public void setCatchBlocks(final List<Block> catchBlocks) {
-        this.catchBlocks = catchBlocks;
+    public TryNode setCatchBlocks(final List<Block> catchBlocks) {
+        if (this.catchBlocks == catchBlocks) {
+            return this;
+        }
+        return new TryNode(this, body, catchBlocks, finallyBody);
     }
 
     /**
@@ -190,9 +191,11 @@
     /**
      * Set the exception symbol for this try block
      * @param exception a symbol for the compiler to store the exception in
+     * @return new TryNode or same if unchanged
      */
-    public void setException(final Symbol exception) {
+    public TryNode setException(final Symbol exception) {
         this.exception = exception;
+        return this;
     }
 
     /**
@@ -207,9 +210,13 @@
      * If a finally block exists, the synthetic catchall needs another symbol to
      * store its throwable
      * @param finallyCatchAll a symbol for the finally catch all exception
+     * @return new TryNode or same if unchanged
+     *
+     * TODO can this still be stateful?
      */
-    public void setFinallyCatchAll(final Symbol finallyCatchAll) {
+    public TryNode setFinallyCatchAll(final Symbol finallyCatchAll) {
         this.finallyCatchAll = finallyCatchAll;
+        return this;
     }
 
     /**
@@ -221,14 +228,6 @@
     }
 
     /**
-     * Set the exit label for this try block
-     * @param exit label
-     */
-    public void setExit(final Label exit) {
-        this.exit = exit;
-    }
-
-    /**
      * Get the body of the finally clause for this try
      * @return finally body, or null if no finally
      */
@@ -239,24 +238,12 @@
     /**
      * Set the finally body of this try
      * @param finallyBody new finally body
-     */
-    public void setFinallyBody(final Block finallyBody) {
-        this.finallyBody = finallyBody;
-    }
-
-    /**
-     * Get next try node in try chain
-     * @return next try node
+     * @return new TryNode or same if unchanged
      */
-    public TryNode getNext() {
-        return next;
-    }
-
-    /**
-     * Set next try node in try chain
-     * @param next next try node
-     */
-    public void setNext(final TryNode next) {
-        this.next = next;
+    public TryNode setFinallyBody(final Block finallyBody) {
+        if (this.finallyBody == finallyBody) {
+            return this;
+        }
+        return new TryNode(this, body, catchBlocks, finallyBody);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/UnaryNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/UnaryNode.java	Wed May 08 10:10:05 2013 +0100
@@ -31,6 +31,7 @@
 import static jdk.nashorn.internal.parser.TokenType.INCPOSTFIX;
 
 import jdk.nashorn.internal.codegen.types.Type;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.Token;
 import jdk.nashorn.internal.parser.TokenType;
@@ -39,9 +40,10 @@
 /**
  * UnaryNode nodes represent single operand operations.
  */
-public class UnaryNode extends Node implements Assignment<Node> {
+@Immutable
+public final class UnaryNode extends Node implements Assignment<Node> {
     /** Right hand side argument. */
-    private Node rhs;
+    private final Node rhs;
 
     /**
      * Constructor
@@ -51,23 +53,26 @@
      * @param rhs    expression
      */
     public UnaryNode(final Source source, final long token, final Node rhs) {
-        super(source, token, Token.descPosition(token));
-
-        this.start  = Math.min(rhs.getStart(), Token.descPosition(token));
-        this.finish = Math.max(Token.descPosition(token) + Token.descLength(token), rhs.getFinish());
-        this.rhs    = rhs;
+        this(source, token, Math.min(rhs.getStart(), Token.descPosition(token)), Math.max(Token.descPosition(token) + Token.descLength(token), rhs.getFinish()), rhs);
     }
 
     /**
-     * Copy constructor
-     *
-     * @param unaryNode source node
-     * @param cs        copy state
+     * Constructor
+     * @param source the source
+     * @param token  token
+     * @param start  start
+     * @param finish finish
+     * @param rhs    expression
      */
-    protected UnaryNode(final UnaryNode unaryNode, final CopyState cs) {
+    public UnaryNode(final Source source, final long token, final int start, final int finish, final Node rhs) {
+        super(source, token, start, finish);
+        this.rhs = rhs;
+    }
+
+
+    private UnaryNode(final UnaryNode unaryNode, final Node rhs) {
         super(unaryNode);
-
-        this.rhs = cs.existingOrCopy(unaryNode.rhs);
+        this.rhs = rhs;
     }
 
     /**
@@ -113,31 +118,13 @@
         return getAssignmentDest();
     }
 
-    @Override
-    public boolean equals(final Object other) {
-        if (!super.equals(other)) {
-            return false;
-        }
-        return rhs.equals(((UnaryNode)other).rhs());
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode() ^ rhs().hashCode();
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new UnaryNode(this, cs);
-    }
-
     /**
      * Assist in IR navigation.
      * @param visitor IR navigating visitor.
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterUnaryNode(this) != null) {
+        if (visitor.enterUnaryNode(this)) {
             return visitor.leaveUnaryNode(setRHS(rhs.accept(visitor)));
         }
 
@@ -219,9 +206,9 @@
      * @return a node equivalent to this one except for the requested change.
      */
     public UnaryNode setRHS(final Node rhs) {
-        if(this.rhs == rhs) return this;
-        final UnaryNode n = (UnaryNode)clone();
-        n.rhs = rhs;
-        return n;
+        if (this.rhs == rhs) {
+            return this;
+        }
+        return new UnaryNode(this, rhs);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/VarNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/VarNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,21 +25,31 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * Node represents a var/let declaration.
  */
-public class VarNode extends Node implements Assignment<IdentNode> {
+@Immutable
+public final class VarNode extends Node implements Assignment<IdentNode> {
     /** Var name. */
-    private IdentNode name;
+    private final IdentNode name;
 
     /** Initialization expression. */
-    private Node init;
+    private final Node init;
 
     /** Is this a var statement (as opposed to a "var" in a for loop statement) */
-    private final boolean isStatement;
+    private final int flags;
+
+    /** Flag that determines if this function node is a statement */
+    public static final int IS_STATEMENT = 1 << 0;
+
+    /** Flag that determines if this is the last function declaration in a function
+     *  This is used to micro optimize the placement of return value assignments for
+     *  a program node */
+    public static final int IS_LAST_FUNCTION_DECLARATION = 1 << 1;
 
     /**
      * Constructor
@@ -51,7 +61,14 @@
      * @param init   init node or null if just a declaration
      */
     public VarNode(final Source source, final long token, final int finish, final IdentNode name, final Node init) {
-        this(source, token, finish, name, init, true);
+        this(source, token, finish, name, init, IS_STATEMENT);
+    }
+
+    private VarNode(final VarNode varNode, final IdentNode name, final Node init, final int flags) {
+        super(varNode);
+        this.name = init == null ? name : name.setIsInitializedHere();
+        this.init = init;
+        this.flags = flags;
     }
 
     /**
@@ -62,28 +79,14 @@
      * @param finish finish
      * @param name   name of variable
      * @param init   init node or null if just a declaration
-     * @param isStatement if this is a var statement (true), or a for-loop initializer (false)
+     * @param flags  flags
      */
-    public VarNode(final Source source, final long token, final int finish, final IdentNode name, final Node init, boolean isStatement) {
+    public VarNode(final Source source, final long token, final int finish, final IdentNode name, final Node init, final int flags) {
         super(source, token, finish);
 
         this.name  = init == null ? name : name.setIsInitializedHere();
         this.init  = init;
-        this.isStatement = isStatement;
-    }
-
-
-    private VarNode(final VarNode varNode, final CopyState cs) {
-        super(varNode);
-
-        this.name = (IdentNode)cs.existingOrCopy(varNode.name);
-        this.init = cs.existingOrCopy(varNode.init);
-        this.isStatement = varNode.isStatement;
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new VarNode(this, cs);
+        this.flags = flags;
     }
 
     @Override
@@ -115,45 +118,17 @@
     }
 
     /**
-     * Test to see if two VarNodes are the same.
-     * @param other Other VarNode.
-     * @return True if the VarNodes are the same.
-     */
-    @Override
-    public boolean equals(final Object other) {
-        if (other instanceof VarNode) {
-            final VarNode otherNode    = (VarNode)other;
-            final boolean nameMatches  = name.equals(otherNode.name);
-            if (hasInit() != otherNode.hasInit()) {
-                return false;
-            } else if (init == null) {
-                return nameMatches;
-            } else {
-                return nameMatches && init.equals(otherNode.init);
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return name.hashCode() ^ (init == null ? 0 : init.hashCode());
-    }
-
-    /**
      * Assist in IR navigation.
      * @param visitor IR navigating visitor.
      */
     @Override
     public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterVarNode(this) != null) {
+        if (visitor.enterVarNode(this)) {
             final IdentNode newName = (IdentNode)name.accept(visitor);
-            final Node newInit = init == null ? null : init.accept(visitor);
-            final VarNode newThis;
-            if(name != newName || init != newInit) {
-                newThis = (VarNode)clone();
-                newThis.init = newInit;
-                newThis.name = newInit == null ? newName : newName.setIsInitializedHere();
+            final Node      newInit = init == null ? null : init.accept(visitor);
+            final VarNode   newThis;
+            if (name != newName || init != newInit) {
+                newThis = new VarNode(this, newName, newInit, flags);
             } else {
                 newThis = this;
             }
@@ -187,10 +162,10 @@
      * @return a node equivalent to this one except for the requested change.
      */
     public VarNode setInit(final Node init) {
-        if(this.init == init) return this;
-        final VarNode n = (VarNode)clone();
-        n.init = init;
-        return n;
+        if (this.init == init) {
+            return this;
+        }
+        return new VarNode(this, name, init, flags);
     }
 
     /**
@@ -204,12 +179,38 @@
     /**
      * Reset the identifier for this VarNode
      * @param name new IdentNode representing the variable being set or declared
+     * @return a node equivalent to this one except for the requested change.
      */
-    private VarNode setName(final IdentNode name) {
-        if(this.name == name) return this;
-        final VarNode n = (VarNode)clone();
-        n.name = name;
-        return n;
+    public VarNode setName(final IdentNode name) {
+        if (this.name == name) {
+            return this;
+        }
+        return new VarNode(this, name, init, flags);
+    }
+
+    private VarNode setFlags(final int flags) {
+        if (this.flags == flags) {
+            return this;
+        }
+        return new VarNode(this, name, init, flags);
+    }
+
+    /**
+     * Check if a flag is set for this var node
+     * @param flag flag
+     * @return true if flag is set
+     */
+    public boolean getFlag(final int flag) {
+        return (flags & flag) == flag;
+    }
+
+    /**
+     * Set a flag for this var node
+     * @param flag flag
+     * @return new node if flags changed, same otherwise
+     */
+    public VarNode setFlag(final int flag) {
+        return setFlags(flags | flag);
     }
 
     /**
@@ -217,7 +218,7 @@
      * @return true if this is a var statement (as opposed to a var initializer in a for loop).
      */
     public boolean isStatement() {
-        return isStatement;
+        return (flags & IS_STATEMENT) != 0;
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/ir/WhileNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/WhileNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,7 +25,7 @@
 
 package jdk.nashorn.internal.ir;
 
-import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
@@ -33,130 +33,126 @@
  * IR representation for a WHILE statement. This is the superclass of all
  * loop nodes
  */
-public class WhileNode extends BreakableNode {
-    /** Test expression. */
-    protected Node test;
+@Immutable
+public final class WhileNode extends LoopNode {
 
-    /** For body. */
-    protected Block body;
-
-    /** loop continue label. */
-    protected Label continueLabel;
+    /** is this a do while node ? */
+    private final boolean isDoWhile;
 
     /**
      * Constructor
      *
-     * @param source  the source
-     * @param token   token
-     * @param finish  finish
+     * @param source    the source
+     * @param token     token
+     * @param finish    finish
+     * @param isDoWhile is this a do while loop?
      */
-    public WhileNode(final Source source, final long token, final int finish) {
-        super(source, token, finish);
-
-        this.breakLabel    = new Label("while_break");
-        this.continueLabel = new Label("while_continue");
+    public WhileNode(final Source source, final long token, final int finish, final boolean isDoWhile) {
+        super(source, token, finish, null, null, false);
+        this.isDoWhile = isDoWhile;
     }
 
     /**
-     * Copy constructor
+     * Internal copy constructor
      *
-     * @param whileNode source node
-     * @param cs        copy state
+     * @param whileNode while node
+     * @param test      test
+     * @param body      body
+     * @param controlFlowEscapes control flow escapes?
      */
-    protected WhileNode(final WhileNode whileNode, final CopyState cs) {
-        super(whileNode);
-
-        this.test          = cs.existingOrCopy(whileNode.test);
-        this.body          = (Block)cs.existingOrCopy(whileNode.body);
-        this.breakLabel    = new Label(whileNode.breakLabel);
-        this.continueLabel = new Label(whileNode.continueLabel);
+    protected WhileNode(final WhileNode whileNode, final Node test, final Block body, final boolean controlFlowEscapes) {
+        super(whileNode, test, body, controlFlowEscapes);
+        this.isDoWhile = whileNode.isDoWhile;
     }
 
     @Override
-    protected Node copy(final CopyState cs) {
-        return new WhileNode(this, cs);
+    public Node ensureUniqueLabels(final LexicalContext lc) {
+        return Node.replaceInLexicalContext(lc, this, new WhileNode(this, test, body, controlFlowEscapes));
+    }
+
+    @Override
+    public boolean hasGoto() {
+        return test == null;
     }
 
     @Override
-    public boolean isLoop() {
-        return true;
-    }
+    protected Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterWhileNode(this)) {
+            if (isDoWhile()) {
+                return visitor.leaveWhileNode(
+                        setTest(lc, test.accept(visitor)).
+                        setBody(lc, (Block)body.accept(visitor)));
+            }
+            return visitor.leaveWhileNode(
+                    setBody(lc, (Block)body.accept(visitor)).
+                    setTest(lc, test.accept(visitor)));
 
-    /**
-     * Assist in IR navigation.
-     * @param visitor IR navigating visitor.
-     */
-    @Override
-    public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterWhileNode(this) != null) {
-            test = test.accept(visitor);
-            body = (Block)body.accept(visitor);
-
-            return visitor.leaveWhileNode(this);
         }
         return this;
     }
 
     @Override
-    public void toString(final StringBuilder sb) {
-        sb.append("while (");
-        test.toString(sb);
-        sb.append(')');
+    public Node getTest() {
+        return test;
     }
 
-    /**
-     * Get the loop body
-     * @return body
-     */
+    @Override
+    public WhileNode setTest(final LexicalContext lc, final Node test) {
+        if (this.test == test) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new WhileNode(this, test, body, controlFlowEscapes));
+    }
+
+    @Override
     public Block getBody() {
         return body;
     }
 
-    /**
-     * Reset the loop body
-     * @param body new body
-     */
-    public void setBody(final Block body) {
-        this.body = body;
+    @Override
+    public WhileNode setBody(final LexicalContext lc, final Block body) {
+        if (this.body == body) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new WhileNode(this, test, body, controlFlowEscapes));
     }
 
-    /**
-     * Set the break label (described in {@link WhileNode#getBreakLabel()} for this while node
-     * @param breakLabel break label
-     */
-    public void setBreakLabel(final Label breakLabel) {
-        this.breakLabel = breakLabel;
+    @Override
+    public WhileNode setControlFlowEscapes(final LexicalContext lc, final boolean controlFlowEscapes) {
+        if (this.controlFlowEscapes == controlFlowEscapes) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new WhileNode(this, test, body, controlFlowEscapes));
     }
 
     /**
-     * Get the continue label for this while node, i.e. location to go to on continue
-     * @return continue label
+     * Check if this is a do while loop or a normal while loop
+     * @return true if do while
      */
-    public Label getContinueLabel() {
-        return continueLabel;
-    }
-
-    /**
-     * Set the continue label (described in {@link WhileNode#getContinueLabel()} for this while node
-     * @param continueLabel continue label
-     */
-    public void setContinueLabel(final Label continueLabel) {
-        this.continueLabel = continueLabel;
+    public boolean isDoWhile() {
+        return isDoWhile;
     }
 
-    /**
-     * Get the test expression for this loop, that upon evaluation to true does another iteration
-     * @return test expression
-     */
-    public Node getTest() {
-        return test;
+    @Override
+    public void toString(final StringBuilder sb) {
+        if (isDoWhile()) {
+            sb.append("do {");
+            body.toString(sb);
+            sb.append("} while (");
+            test.toString(sb);
+            sb.append(')');
+        } else {
+            sb.append("while (");
+            test.toString(sb);
+            sb.append(')');
+        }
     }
 
-    /**
-     * Set the test expression for this loop
-     * @param test test expression, null if infinite loop
-     */
-    public void setTest(final Node test) {
-        this.test = test;
+    @Override
+    public boolean mustEnter() {
+        if (isDoWhile()) {
+            return true;
+        }
+        return test == null;
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/WithNode.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/WithNode.java	Wed May 08 10:10:05 2013 +0100
@@ -25,18 +25,20 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.runtime.Source;
 
 /**
  * IR representation for {@code with} statements.
  */
-public class WithNode extends Node {
+@Immutable
+public final class WithNode extends LexicalContextNode {
    /** This expression. */
-    private Node expression;
+    private final Node expression;
 
     /** Statements. */
-    private Block body;
+    private final Block body;
 
     /**
      * Constructor
@@ -44,42 +46,39 @@
      * @param source     the source
      * @param token      token
      * @param finish     finish
-     * @param expression expression in parenthesis
-     * @param body       with node body
      */
-    public WithNode(final Source source, final long token, final int finish, final Node expression, final Block body) {
+    public WithNode(final Source source, final long token, final int finish) {
         super(source, token, finish);
 
+        this.expression = null;
+        this.body       = null;
+    }
+
+    private WithNode(final WithNode node, final Node expression, final Block body) {
+        super(node);
+
         this.expression = expression;
         this.body       = body;
     }
 
-    private WithNode(final WithNode withNode, final CopyState cs) {
-        super(withNode);
-
-        this.expression = cs.existingOrCopy(withNode.expression);
-        this.body       = (Block)cs.existingOrCopy(withNode.body);
-    }
-
-    @Override
-    protected Node copy(final CopyState cs) {
-        return new WithNode(this, cs);
-    }
-
     /**
      * Assist in IR navigation.
      *
      * @param visitor IR navigating visitor.
      */
     @Override
-    public Node accept(final NodeVisitor visitor) {
-        if (visitor.enterWithNode(this) != null) {
-            expression = expression.accept(visitor);
-            body = (Block)body.accept(visitor);
-            return visitor.leaveWithNode(this);
+    public Node accept(final LexicalContext lc, final NodeVisitor visitor) {
+        if (visitor.enterWithNode(this)) {
+             return visitor.leaveWithNode(
+                setExpression(lc, expression.accept(visitor)).
+                setBody(lc, (Block)body.accept(visitor)));
         }
+        return this;
+    }
 
-        return this;
+    @Override
+    public boolean isTerminal() {
+        return body.isTerminal();
     }
 
     @Override
@@ -99,10 +98,15 @@
 
     /**
      * Reset the body of this with node
+     * @param lc lexical context
      * @param body new body
+     * @return new or same withnode
      */
-    public void setBody(final Block body) {
-        this.body = body;
+    public WithNode setBody(final LexicalContext lc, final Block body) {
+        if (this.body == body) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new WithNode(this, expression, body));
     }
 
     /**
@@ -115,10 +119,15 @@
 
     /**
      * Reset the expression of this with node
+     * @param lc lexical context
      * @param expression new expression
+     * @return new or same withnode
      */
-    public void setExpression(final Node expression) {
-        this.expression = expression;
+    public WithNode setExpression(final LexicalContext lc, final Node expression) {
+        if (this.expression == expression) {
+            return this;
+        }
+        return Node.replaceInLexicalContext(lc, this, new WithNode(this, expression, body));
     }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/ir/annotations/Immutable.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.ir.annotations;
+
+/**
+ * Tag for nodes that are immutable. To be immutable all fields must be
+ * final and copy on write semantics must be in place
+ */
+public @interface Immutable {
+    //empty
+}
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java	Wed May 08 10:10:05 2013 +0100
@@ -33,7 +33,9 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+
 import jdk.nashorn.internal.ir.BinaryNode;
+import jdk.nashorn.internal.ir.Block;
 import jdk.nashorn.internal.ir.Node;
 import jdk.nashorn.internal.ir.TernaryNode;
 import jdk.nashorn.internal.ir.annotations.Ignore;
@@ -113,6 +115,10 @@
             type += "#" + node.getSymbol();
         }
 
+        if (node instanceof Block && ((Block)node).needsScope()) {
+            type += " <scope>";
+        }
+
         final List<Field> children = new LinkedList<>();
 
         if (!isReference) {
@@ -121,10 +127,6 @@
 
         String status = "";
 
-        if (node.shouldDiscard()) {
-            status += " Discard";
-        }
-
         if (node.isTerminal()) {
             status += " Terminal";
         }
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Wed May 08 10:10:05 2013 +0100
@@ -36,7 +36,6 @@
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
 import jdk.nashorn.internal.ir.ContinueNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
 import jdk.nashorn.internal.ir.EmptyNode;
 import jdk.nashorn.internal.ir.ExecuteNode;
 import jdk.nashorn.internal.ir.ForNode;
@@ -88,7 +87,7 @@
         final Parser       parser     = new Parser(env, new Source(name, code), new Context.ThrowErrorManager(), env._strict);
         final JSONWriter   jsonWriter = new JSONWriter(includeLoc);
         try {
-            final FunctionNode functionNode = parser.parse(CompilerConstants.RUN_SCRIPT.tag());
+            final FunctionNode functionNode = parser.parse(CompilerConstants.RUN_SCRIPT.symbolName());
             functionNode.accept(jsonWriter);
             return jsonWriter.getString();
         } catch (final ParserException e) {
@@ -98,11 +97,16 @@
     }
 
     @Override
-    protected Node enterDefault(final Node node) {
+    protected boolean enterDefault(final Node node) {
         objectStart();
         location(node);
 
-        return node;
+        return true;
+    }
+
+    private boolean leave() {
+        objectEnd();
+        return false;
     }
 
     @Override
@@ -112,7 +116,7 @@
     }
 
     @Override
-    public Node enterAccessNode(final AccessNode accessNode) {
+    public boolean enterAccessNode(final AccessNode accessNode) {
         enterDefault(accessNode);
 
         type("MemberExpression");
@@ -128,11 +132,11 @@
 
         property("computed", false);
 
-        return leaveDefault(accessNode);
+        return leave();
     }
 
     @Override
-    public Node enterBlock(final Block block) {
+    public boolean enterBlock(final Block block) {
         enterDefault(block);
 
         type("BlockStatement");
@@ -140,21 +144,21 @@
 
         array("body", block.getStatements());
 
-        return leaveDefault(block);
+        return leave();
     }
 
     private static boolean isLogical(final TokenType tt) {
         switch (tt) {
-            case AND:
-            case OR:
-                return true;
-            default:
-                return false;
+        case AND:
+        case OR:
+            return true;
+        default:
+            return false;
         }
     }
 
     @Override
-    public Node enterBinaryNode(final BinaryNode binaryNode) {
+    public boolean enterBinaryNode(final BinaryNode binaryNode) {
         enterDefault(binaryNode);
 
         final String name;
@@ -179,29 +183,29 @@
         property("right");
         binaryNode.rhs().accept(this);
 
-        return leaveDefault(binaryNode);
+        return leave();
     }
 
     @Override
-    public Node enterBreakNode(final BreakNode breakNode) {
+    public boolean enterBreakNode(final BreakNode breakNode) {
         enterDefault(breakNode);
 
         type("BreakStatement");
         comma();
 
-        final LabelNode label = breakNode.getLabel();
+        final IdentNode label = breakNode.getLabel();
         if (label != null) {
-            property("label", label.getLabel().getName());
+            property("label", label.getName());
         } else {
             property("label");
             nullValue();
         }
 
-        return leaveDefault(breakNode);
+        return leave();
     }
 
     @Override
-    public Node enterCallNode(final CallNode callNode) {
+    public boolean enterCallNode(final CallNode callNode) {
         enterDefault(callNode);
 
         type("CallExpression");
@@ -213,11 +217,11 @@
 
         array("arguments", callNode.getArgs());
 
-        return leaveDefault(callNode);
+        return leave();
     }
 
     @Override
-    public Node enterCaseNode(final CaseNode caseNode) {
+    public boolean enterCaseNode(final CaseNode caseNode) {
         enterDefault(caseNode);
 
         type("SwitchCase");
@@ -234,11 +238,11 @@
 
         array("consequent", caseNode.getBody().getStatements());
 
-        return leaveDefault(caseNode);
+        return leave();
     }
 
     @Override
-    public Node enterCatchNode(final CatchNode catchNode) {
+    public boolean enterCatchNode(final CatchNode catchNode) {
         enterDefault(catchNode);
 
         type("CatchClause");
@@ -260,55 +264,38 @@
         property("body");
         catchNode.getBody().accept(this);
 
-        return leaveDefault(catchNode);
+        return leave();
     }
 
     @Override
-    public Node enterContinueNode(final ContinueNode continueNode) {
+    public boolean enterContinueNode(final ContinueNode continueNode) {
         enterDefault(continueNode);
 
         type("ContinueStatement");
         comma();
 
-        final LabelNode label = continueNode.getLabel();
+        final IdentNode label = continueNode.getLabel();
         if (label != null) {
-            property("label", label.getLabel().getName());
+            property("label", label.getName());
         } else {
             property("label");
             nullValue();
         }
 
-        return leaveDefault(continueNode);
+        return leave();
     }
 
     @Override
-    public Node enterDoWhileNode(final DoWhileNode doWhileNode) {
-        enterDefault(doWhileNode);
-
-        type("DoWhileStatement");
-        comma();
-
-        property("body");
-        doWhileNode.getBody().accept(this);
-        comma();
-
-        property("test");
-        doWhileNode.getTest().accept(this);
-
-        return leaveDefault(doWhileNode);
-    }
-
-    @Override
-    public Node enterEmptyNode(final EmptyNode emptyNode) {
+    public boolean enterEmptyNode(final EmptyNode emptyNode) {
         enterDefault(emptyNode);
 
         type("EmptyStatement");
 
-        return leaveDefault(emptyNode);
+        return leave();
     }
 
     @Override
-    public Node enterExecuteNode(final ExecuteNode executeNode) {
+    public boolean enterExecuteNode(final ExecuteNode executeNode) {
         enterDefault(executeNode);
 
         type("ExpressionStatement");
@@ -317,11 +304,11 @@
         property("expression");
         executeNode.getExpression().accept(this);
 
-        return leaveDefault(executeNode);
+        return leave();
     }
 
     @Override
-    public Node enterForNode(final ForNode forNode) {
+    public boolean enterForNode(final ForNode forNode) {
         enterDefault(forNode);
 
         if (forNode.isForIn() || (forNode.isForEach() && forNode.getInit() != null)) {
@@ -380,11 +367,11 @@
             forNode.getBody().accept(this);
         }
 
-        return leaveDefault(forNode);
+        return leave();
     }
 
     @Override
-    public Node enterFunctionNode(final FunctionNode functionNode) {
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
         enterDefault(functionNode);
 
         final boolean program = functionNode.isProgram();
@@ -419,7 +406,7 @@
         }
 
         // body consists of nested functions and statements
-        final List<Node> stats = functionNode.getStatements();
+        final List<Node> stats = functionNode.getBody().getStatements();
         final int size = stats.size();
         int idx = 0;
         arrayStart("body");
@@ -435,11 +422,11 @@
         }
         arrayEnd();
 
-        return leaveDefault(functionNode);
+        return leave();
     }
 
     @Override
-    public Node enterIdentNode(final IdentNode identNode) {
+    public boolean enterIdentNode(final IdentNode identNode) {
         enterDefault(identNode);
 
         final String name = identNode.getName();
@@ -451,11 +438,11 @@
             property("name", identNode.getName());
         }
 
-        return leaveDefault(identNode);
+        return leave();
     }
 
     @Override
-    public Node enterIfNode(final IfNode ifNode) {
+    public boolean enterIfNode(final IfNode ifNode) {
         enterDefault(ifNode);
 
         type("IfStatement");
@@ -477,11 +464,11 @@
             nullValue();
         }
 
-        return leaveDefault(ifNode);
+        return leave();
     }
 
     @Override
-    public Node enterIndexNode(final IndexNode indexNode) {
+    public boolean enterIndexNode(final IndexNode indexNode) {
         enterDefault(indexNode);
 
         type("MemberExpression");
@@ -497,11 +484,11 @@
 
         property("computed", true);
 
-        return leaveDefault(indexNode);
+        return leave();
     }
 
     @Override
-    public Node enterLabelNode(final LabelNode labelNode) {
+    public boolean enterLabelNode(final LabelNode labelNode) {
         enterDefault(labelNode);
 
         type("LabeledStatement");
@@ -514,17 +501,17 @@
         property("body");
         labelNode.getBody().accept(this);
 
-        return leaveDefault(labelNode);
+        return leave();
     }
 
     @Override
-    public Node enterLineNumberNode(final LineNumberNode lineNumberNode) {
-        return null;
+    public boolean enterLineNumberNode(final LineNumberNode lineNumberNode) {
+        return false;
     }
 
     @SuppressWarnings("rawtypes")
     @Override
-    public Node enterLiteralNode(final LiteralNode literalNode) {
+    public boolean enterLiteralNode(final LiteralNode literalNode) {
         enterDefault(literalNode);
 
         if (literalNode instanceof LiteralNode.ArrayLiteralNode) {
@@ -556,11 +543,11 @@
             }
         }
 
-        return leaveDefault(literalNode);
+        return leave();
     }
 
     @Override
-    public Node enterObjectNode(final ObjectNode objectNode) {
+    public boolean enterObjectNode(final ObjectNode objectNode) {
         enterDefault(objectNode);
 
         type("ObjectExpression");
@@ -568,11 +555,11 @@
 
         array("properties", objectNode.getElements());
 
-        return leaveDefault(objectNode);
+        return leave();
     }
 
     @Override
-    public Node enterPropertyNode(final PropertyNode propertyNode) {
+    public boolean enterPropertyNode(final PropertyNode propertyNode) {
         final Node key = propertyNode.getKey();
 
         final Node value = propertyNode.getValue();
@@ -634,11 +621,11 @@
             }
         }
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterReturnNode(final ReturnNode returnNode) {
+    public boolean enterReturnNode(final ReturnNode returnNode) {
         enterDefault(returnNode);
 
         type("ReturnStatement");
@@ -652,31 +639,29 @@
             nullValue();
         }
 
-        return leaveDefault(returnNode);
+        return leave();
     }
 
     @Override
-    public Node enterRuntimeNode(final RuntimeNode runtimeNode) {
+    public boolean enterRuntimeNode(final RuntimeNode runtimeNode) {
         final RuntimeNode.Request req = runtimeNode.getRequest();
 
         if (req == RuntimeNode.Request.DEBUGGER) {
             enterDefault(runtimeNode);
-
             type("DebuggerStatement");
-
-            return leaveDefault(runtimeNode);
+            return leave();
         }
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterSplitNode(final SplitNode splitNode) {
-        return null;
+    public boolean enterSplitNode(final SplitNode splitNode) {
+        return false;
     }
 
     @Override
-    public Node enterSwitchNode(final SwitchNode switchNode) {
+    public boolean enterSwitchNode(final SwitchNode switchNode) {
         enterDefault(switchNode);
 
         type("SwitchStatement");
@@ -688,11 +673,11 @@
 
         array("cases", switchNode.getCases());
 
-        return leaveDefault(switchNode);
+        return leave();
     }
 
     @Override
-    public Node enterTernaryNode(final TernaryNode ternaryNode) {
+    public boolean enterTernaryNode(final TernaryNode ternaryNode) {
         enterDefault(ternaryNode);
 
         type("ConditionalExpression");
@@ -709,11 +694,11 @@
         property("alternate");
         ternaryNode.third().accept(this);
 
-        return leaveDefault(ternaryNode);
+        return leave();
     }
 
     @Override
-    public Node enterThrowNode(final ThrowNode throwNode) {
+    public boolean enterThrowNode(final ThrowNode throwNode) {
         enterDefault(throwNode);
 
         type("ThrowStatement");
@@ -722,11 +707,11 @@
         property("argument");
         throwNode.getExpression().accept(this);
 
-        return leaveDefault(throwNode);
+        return leave();
     }
 
     @Override
-    public Node enterTryNode(final TryNode tryNode) {
+    public boolean enterTryNode(final TryNode tryNode) {
         enterDefault(tryNode);
 
         type("TryStatement");
@@ -747,11 +732,11 @@
             nullValue();
         }
 
-        return leaveDefault(tryNode);
+        return leave();
     }
 
     @Override
-    public Node enterUnaryNode(final UnaryNode unaryNode) {
+    public boolean enterUnaryNode(final UnaryNode unaryNode) {
         enterDefault(unaryNode);
 
         final TokenType tokenType = unaryNode.tokenType();
@@ -769,25 +754,25 @@
             final boolean prefix;
             final String operator;
             switch (tokenType) {
-                case INCPOSTFIX:
-                    prefix = false;
-                    operator = "++";
-                    break;
-                case DECPOSTFIX:
-                    prefix = false;
-                    operator = "--";
-                    break;
-                case INCPREFIX:
-                    operator = "++";
-                    prefix = true;
-                    break;
-                case DECPREFIX:
-                    operator = "--";
-                    prefix = true;
-                    break;
-                default:
-                    prefix = false;
-                    operator = tokenType.getName();
+            case INCPOSTFIX:
+                prefix = false;
+                operator = "++";
+                break;
+            case DECPOSTFIX:
+                prefix = false;
+                operator = "--";
+                break;
+            case INCPREFIX:
+                operator = "++";
+                prefix = true;
+                break;
+            case DECPREFIX:
+                operator = "--";
+                prefix = true;
+                break;
+            default:
+                prefix = false;
+                operator = tokenType.getName();
             }
 
             type(unaryNode.isAssignment()? "UpdateExpression" : "UnaryExpression");
@@ -803,11 +788,11 @@
             unaryNode.rhs().accept(this);
         }
 
-        return leaveDefault(unaryNode);
+        return leave();
     }
 
     @Override
-    public Node enterVarNode(final VarNode varNode) {
+    public boolean enterVarNode(final VarNode varNode) {
         enterDefault(varNode);
 
         type("VariableDeclaration");
@@ -839,28 +824,37 @@
         // declarations
         arrayEnd();
 
-        return leaveDefault(varNode);
+        return leave();
     }
 
     @Override
-    public Node enterWhileNode(final WhileNode whileNode) {
+    public boolean enterWhileNode(final WhileNode whileNode) {
         enterDefault(whileNode);
 
-        type("WhileStatement");
+        type(whileNode.isDoWhile() ? "DoWhileStatement" : "WhileStatement");
         comma();
 
-        property("test");
-        whileNode.getTest().accept(this);
-        comma();
+        if (whileNode.isDoWhile()) {
+            property("body");
+            whileNode.getBody().accept(this);
+            comma();
 
-        property("block");
-        whileNode.getBody().accept(this);
+            property("test");
+            whileNode.getTest().accept(this);
+        } else {
+            property("test");
+            whileNode.getTest().accept(this);
+            comma();
 
-        return leaveDefault(whileNode);
+            property("block");
+            whileNode.getBody().accept(this);
+        }
+
+        return leave();
     }
 
     @Override
-    public Node enterWithNode(final WithNode withNode) {
+    public boolean enterWithNode(final WithNode withNode) {
         enterDefault(withNode);
 
         type("WithStatement");
@@ -873,8 +867,8 @@
         property("body");
         withNode.getBody().accept(this);
 
-        return leaveDefault(withNode);
-    }
+        return leave();
+   }
 
     // Internals below
 
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/PrintVisitor.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/PrintVisitor.java	Wed May 08 10:10:05 2013 +0100
@@ -26,30 +26,22 @@
 package jdk.nashorn.internal.ir.debug;
 
 import java.util.List;
-import jdk.nashorn.internal.ir.AccessNode;
+
+import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
-import jdk.nashorn.internal.ir.BreakNode;
-import jdk.nashorn.internal.ir.CallNode;
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
-import jdk.nashorn.internal.ir.ContinueNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
 import jdk.nashorn.internal.ir.ExecuteNode;
 import jdk.nashorn.internal.ir.ForNode;
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.IfNode;
-import jdk.nashorn.internal.ir.IndexNode;
 import jdk.nashorn.internal.ir.LabelNode;
 import jdk.nashorn.internal.ir.LineNumberNode;
 import jdk.nashorn.internal.ir.Node;
-import jdk.nashorn.internal.ir.ReturnNode;
-import jdk.nashorn.internal.ir.RuntimeNode;
 import jdk.nashorn.internal.ir.SplitNode;
 import jdk.nashorn.internal.ir.SwitchNode;
 import jdk.nashorn.internal.ir.Symbol;
-import jdk.nashorn.internal.ir.ThrowNode;
 import jdk.nashorn.internal.ir.TryNode;
-import jdk.nashorn.internal.ir.UnaryNode;
 import jdk.nashorn.internal.ir.VarNode;
 import jdk.nashorn.internal.ir.WhileNode;
 import jdk.nashorn.internal.ir.WithNode;
@@ -136,21 +128,20 @@
     /*
      * Visits.
      */
+
     @Override
-    public Node enterAccessNode(final AccessNode accessNode) {
-        accessNode.toString(sb);
-        return null;
+    public boolean enterDefault(final Node node) {
+        node.toString(sb);
+        return false;
     }
 
     @Override
-    public Node enterBlock(final Block block) {
+    public boolean enterBlock(final Block block) {
         sb.append(' ');
         sb.append('{');
 
         indent += TABWIDTH;
 
-        final boolean isFunction = block instanceof FunctionNode;
-
         final List<Node> statements = block.getStatements();
 
         boolean lastLineNumber = false;
@@ -161,14 +152,14 @@
                 indent();
             }
 
-            if (statement instanceof UnaryNode) {
-                statement.toString(sb);
-            } else {
-                statement.accept(this);
-            }
+            statement.accept(this);
 
             lastLineNumber = statement instanceof LineNumberNode;
 
+            if (statement instanceof FunctionNode) {
+                continue;
+            }
+
             final Symbol symbol = statement.getSymbol();
 
             if (symbol != null) {
@@ -200,72 +191,42 @@
         indent();
         sb.append("}");
 
-        if (isFunction) {
-            sb.append(EOLN);
-        }
-
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterBreakNode(final BreakNode breakNode) {
-        breakNode.toString(sb);
-        return null;
-    }
-
-    @Override
-    public Node enterCallNode(final CallNode callNode) {
-        callNode.toString(sb);
-        return null;
-    }
-
-    @Override
-    public Node enterContinueNode(final ContinueNode continueNode) {
-        continueNode.toString(sb);
-        return null;
+    public boolean enterBinaryNode(final BinaryNode binaryNode) {
+        binaryNode.lhs().accept(this);
+        sb.append(' ');
+        sb.append(binaryNode.tokenType());
+        sb.append(' ');
+        binaryNode.rhs().accept(this);
+        return false;
     }
 
     @Override
-    public Node enterDoWhileNode(final DoWhileNode doWhileNode) {
-        sb.append("do");
-        doWhileNode.getBody().accept(this);
-        sb.append(' ');
-        doWhileNode.toString(sb);
-
-        return null;
+    public boolean enterExecuteNode(final ExecuteNode executeNode) {
+        executeNode.getExpression().accept(this);
+        return false;
     }
 
     @Override
-    public Node enterExecuteNode(final ExecuteNode executeNode) {
-        final Node expression = executeNode.getExpression();
-
-        if (expression instanceof UnaryNode) {
-            expression.toString(sb);
-        } else {
-            expression.accept(this);
-        }
-
-        return null;
+    public boolean enterForNode(final ForNode forNode) {
+        forNode.toString(sb);
+        forNode.getBody().accept(this);
+        return false;
     }
 
     @Override
-    public Node enterForNode(final ForNode forNode) {
-        forNode.toString(sb);
-        forNode.getBody().accept(this);
-
-        return null;
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
+        functionNode.toString(sb);
+        enterBlock(functionNode.getBody());
+        sb.append(EOLN);
+        return false;
     }
 
     @Override
-    public Node enterFunctionNode(final FunctionNode functionNode) {
-        functionNode.toString(sb);
-        enterBlock(functionNode);
-
-        return null;
-    }
-
-    @Override
-    public Node enterIfNode(final IfNode ifNode) {
+    public boolean enterIfNode(final IfNode ifNode) {
         ifNode.toString(sb);
         ifNode.getPass().accept(this);
 
@@ -276,55 +237,36 @@
             fail.accept(this);
         }
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterIndexNode(final IndexNode indexNode) {
-        indexNode.toString(sb);
-        return null;
-    }
-
-    @Override
-    public Node enterLabelNode(final LabelNode labeledNode) {
+    public boolean enterLabelNode(final LabelNode labeledNode) {
         indent -= TABWIDTH;
         indent();
         indent += TABWIDTH;
         labeledNode.toString(sb);
         labeledNode.getBody().accept(this);
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterLineNumberNode(final LineNumberNode lineNumberNode) {
+    public boolean enterLineNumberNode(final LineNumberNode lineNumberNode) {
         if (printLineNumbers) {
             lineNumberNode.toString(sb);
         }
 
-        return null;
-    }
-
-
-    @Override
-    public Node enterReturnNode(final ReturnNode returnNode) {
-        returnNode.toString(sb);
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterRuntimeNode(final RuntimeNode runtimeNode) {
-        runtimeNode.toString(sb);
-        return null;
-    }
-
-    @Override
-    public Node enterSplitNode(final SplitNode splitNode) {
+    public boolean enterSplitNode(final SplitNode splitNode) {
         splitNode.toString(sb);
         sb.append(EOLN);
         indent += TABWIDTH;
         indent();
-        return splitNode;
+        return true;
     }
 
     @Override
@@ -337,7 +279,7 @@
     }
 
     @Override
-    public Node enterSwitchNode(final SwitchNode switchNode) {
+    public boolean enterSwitchNode(final SwitchNode switchNode) {
         switchNode.toString(sb);
         sb.append(" {");
 
@@ -357,24 +299,18 @@
         indent();
         sb.append("}");
 
-        return null;
-   }
-
-    @Override
-    public Node enterThrowNode(final ThrowNode throwNode) {
-        throwNode.toString(sb);
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterTryNode(final TryNode tryNode) {
+    public boolean enterTryNode(final TryNode tryNode) {
         tryNode.toString(sb);
         tryNode.getBody().accept(this);
 
         final List<Block> catchBlocks = tryNode.getCatchBlocks();
 
         for (final Block catchBlock : catchBlocks) {
-            final CatchNode catchNode = (CatchNode) catchBlock.getStatements().get(0);
+            final CatchNode catchNode = (CatchNode)catchBlock.getStatements().get(0);
             catchNode.toString(sb);
             catchNode.getBody().accept(this);
         }
@@ -386,35 +322,42 @@
             finallyBody.accept(this);
         }
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterVarNode(final VarNode varNode) {
+    public boolean enterVarNode(final VarNode varNode) {
         sb.append("var ");
         varNode.getName().toString(sb);
         final Node init = varNode.getInit();
-        if(init != null) {
+        if (init != null) {
             sb.append(" = ");
             init.accept(this);
         }
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterWhileNode(final WhileNode whileNode) {
-        whileNode.toString(sb);
-        whileNode.getBody().accept(this);
+    public boolean enterWhileNode(final WhileNode whileNode) {
+        if (whileNode.isDoWhile()) {
+            sb.append("do");
+            whileNode.getBody().accept(this);
+            sb.append(' ');
+            whileNode.toString(sb);
+        } else {
+            whileNode.toString(sb);
+            whileNode.getBody().accept(this);
+        }
 
-        return null;
+        return false;
     }
 
     @Override
-    public Node enterWithNode(final WithNode withNode) {
+    public boolean enterWithNode(final WithNode withNode) {
         withNode.toString(sb);
         withNode.getBody().accept(this);
 
-        return null;
+        return false;
     }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/visitor/NodeOperatorVisitor.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/visitor/NodeOperatorVisitor.java	Wed May 08 10:10:05 2013 +0100
@@ -25,9 +25,8 @@
 
 package jdk.nashorn.internal.ir.visitor;
 
-import jdk.nashorn.internal.codegen.CompileUnit;
-import jdk.nashorn.internal.codegen.MethodEmitter;
 import jdk.nashorn.internal.ir.BinaryNode;
+import jdk.nashorn.internal.ir.LexicalContext;
 import jdk.nashorn.internal.ir.Node;
 import jdk.nashorn.internal.ir.UnaryNode;
 
@@ -45,15 +44,14 @@
     /**
      * Constructor
      *
-     * @param compileUnit compile unit
-     * @param method      method emitter
+     * @param lc a custom lexical context
      */
-    public NodeOperatorVisitor(final CompileUnit compileUnit, final MethodEmitter method) {
-        super(compileUnit, method);
+    public NodeOperatorVisitor(final LexicalContext lc) {
+        super(lc);
     }
 
     @Override
-    public final Node enterUnaryNode(final UnaryNode unaryNode) {
+    public final boolean enterUnaryNode(final UnaryNode unaryNode) {
         switch (unaryNode.tokenType()) {
         case ADD:
             return enterADD(unaryNode);
@@ -119,7 +117,7 @@
     }
 
     @Override
-    public final Node enterBinaryNode(final BinaryNode binaryNode) {
+    public final boolean enterBinaryNode(final BinaryNode binaryNode) {
         switch (binaryNode.tokenType()) {
         case ADD:
             return enterADD(binaryNode);
@@ -287,17 +285,6 @@
     }
 
     /*
-    @Override
-    public Node enter(final TernaryNode ternaryNode) {
-        return enterDefault(ternaryNode);
-    }
-
-    @Override
-    public Node leave(final TernaryNode ternaryNode) {
-        return leaveDefault(ternaryNode);
-    }*/
-
-    /*
      * Unary entries and exists.
      */
 
@@ -305,9 +292,9 @@
      * Unary enter - callback for entering a unary +
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterADD(final UnaryNode unaryNode) {
+    public boolean enterADD(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -325,9 +312,9 @@
      * Unary enter - callback for entering a ~ operator
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterBIT_NOT(final UnaryNode unaryNode) {
+    public boolean enterBIT_NOT(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -345,9 +332,9 @@
      * Unary enter - callback for entering a conversion
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterCONVERT(final UnaryNode unaryNode) {
+    public boolean enterCONVERT(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -365,9 +352,9 @@
      * Unary enter - callback for entering a ++ or -- operator
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterDECINC(final UnaryNode unaryNode) {
+    public boolean enterDECINC(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -387,7 +374,7 @@
      * @param  unaryNode the node
      * @return processed node
      */
-    public Node enterDELETE(final UnaryNode unaryNode) {
+    public boolean enterDELETE(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -405,9 +392,9 @@
      * Unary enter - callback for entering a discard operator
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterDISCARD(final UnaryNode unaryNode) {
+    public boolean enterDISCARD(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -425,9 +412,9 @@
      * Unary enter - callback for entering a new operator
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterNEW(final UnaryNode unaryNode) {
+    public boolean enterNEW(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -445,9 +432,9 @@
      * Unary enter - callback for entering a ! operator
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterNOT(final UnaryNode unaryNode) {
+    public boolean enterNOT(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -465,9 +452,9 @@
      * Unary enter - callback for entering a unary -
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterSUB(final UnaryNode unaryNode) {
+    public boolean enterSUB(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -485,9 +472,9 @@
      * Unary enter - callback for entering a typeof
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterTYPEOF(final UnaryNode unaryNode) {
+    public boolean enterTYPEOF(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -505,9 +492,9 @@
      * Unary enter - callback for entering a void
      *
      * @param  unaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterVOID(final UnaryNode unaryNode) {
+    public boolean enterVOID(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -525,9 +512,9 @@
      * Binary enter - callback for entering + operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterADD(final BinaryNode binaryNode) {
+    public boolean enterADD(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -545,9 +532,9 @@
      * Binary enter - callback for entering {@literal &&} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterAND(final BinaryNode binaryNode) {
+    public boolean enterAND(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -565,9 +552,9 @@
      * Binary enter - callback for entering an assignment
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN(final BinaryNode binaryNode) {
+    public boolean enterASSIGN(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -585,9 +572,9 @@
      * Binary enter - callback for entering += operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_ADD(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_ADD(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -605,9 +592,9 @@
      * Binary enter - callback for entering {@literal &=} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_BIT_AND(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_AND(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -625,9 +612,9 @@
      * Binary enter - callback for entering |= operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_BIT_OR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_OR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -645,9 +632,9 @@
      * Binary enter - callback for entering ^= operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_BIT_XOR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_BIT_XOR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -665,9 +652,9 @@
      * Binary enter - callback for entering /= operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_DIV(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_DIV(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -685,9 +672,9 @@
      * Binary enter - callback for entering %= operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_MOD(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_MOD(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -705,9 +692,9 @@
      * Binary enter - callback for entering *= operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_MUL(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_MUL(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -725,9 +712,9 @@
      * Binary enter - callback for entering {@literal >>=} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_SAR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SAR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -745,9 +732,9 @@
      * Binary enter - callback for entering a {@literal <<=} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_SHL(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SHL(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -765,9 +752,9 @@
      * Binary enter - callback for entering {@literal >>>=} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_SHR(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SHR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -785,9 +772,9 @@
      * Binary enter - callback for entering -= operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterASSIGN_SUB(final BinaryNode binaryNode) {
+    public boolean enterASSIGN_SUB(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -805,9 +792,9 @@
      * Binary enter - callback for entering a bind operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterBIND(final BinaryNode binaryNode) {
+    public boolean enterBIND(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -825,9 +812,9 @@
      * Binary enter - callback for entering {@literal &} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterBIT_AND(final BinaryNode binaryNode) {
+    public boolean enterBIT_AND(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -845,9 +832,9 @@
      * Binary enter - callback for entering | operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterBIT_OR(final BinaryNode binaryNode) {
+    public boolean enterBIT_OR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -865,9 +852,9 @@
      * Binary enter - callback for entering ^ operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterBIT_XOR(final BinaryNode binaryNode) {
+    public boolean enterBIT_XOR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -886,9 +873,9 @@
      * (a, b) where the result is a
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterCOMMALEFT(final BinaryNode binaryNode) {
+    public boolean enterCOMMALEFT(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -908,9 +895,9 @@
      * (a, b) where the result is b
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterCOMMARIGHT(final BinaryNode binaryNode) {
+    public boolean enterCOMMARIGHT(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -929,9 +916,9 @@
      * Binary enter - callback for entering a division
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterDIV(final BinaryNode binaryNode) {
+    public boolean enterDIV(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -949,9 +936,9 @@
      * Binary enter - callback for entering == operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterEQ(final BinaryNode binaryNode) {
+    public boolean enterEQ(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -969,9 +956,9 @@
      * Binary enter - callback for entering === operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterEQ_STRICT(final BinaryNode binaryNode) {
+    public boolean enterEQ_STRICT(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -989,9 +976,9 @@
      * Binary enter - callback for entering {@literal >=} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterGE(final BinaryNode binaryNode) {
+    public boolean enterGE(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1009,9 +996,9 @@
      * Binary enter - callback for entering {@literal >} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterGT(final BinaryNode binaryNode) {
+    public boolean enterGT(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1029,9 +1016,9 @@
      * Binary enter - callback for entering in operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterIN(final BinaryNode binaryNode) {
+    public boolean enterIN(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1049,9 +1036,9 @@
      * Binary enter - callback for entering instanceof operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterINSTANCEOF(final BinaryNode binaryNode) {
+    public boolean enterINSTANCEOF(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1069,9 +1056,9 @@
      * Binary enter - callback for entering {@literal <=} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterLE(final BinaryNode binaryNode) {
+    public boolean enterLE(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1089,9 +1076,9 @@
      * Binary enter - callback for entering {@literal <} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterLT(final BinaryNode binaryNode) {
+    public boolean enterLT(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1108,9 +1095,9 @@
      * Binary enter - callback for entering % operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterMOD(final BinaryNode binaryNode) {
+    public boolean enterMOD(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1128,9 +1115,9 @@
      * Binary enter - callback for entering * operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterMUL(final BinaryNode binaryNode) {
+    public boolean enterMUL(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1148,9 +1135,9 @@
      * Binary enter - callback for entering != operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterNE(final BinaryNode binaryNode) {
+    public boolean enterNE(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1168,9 +1155,9 @@
      * Binary enter - callback for entering a !== operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterNE_STRICT(final BinaryNode binaryNode) {
+    public boolean enterNE_STRICT(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1188,9 +1175,9 @@
      * Binary enter - callback for entering || operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterOR(final BinaryNode binaryNode) {
+    public boolean enterOR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1208,9 +1195,9 @@
      * Binary enter - callback for entering {@literal >>} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterSAR(final BinaryNode binaryNode) {
+    public boolean enterSAR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1228,9 +1215,9 @@
      * Binary enter - callback for entering {@literal <<} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterSHL(final BinaryNode binaryNode) {
+    public boolean enterSHL(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1247,9 +1234,9 @@
      * Binary enter - callback for entering {@literal >>>} operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterSHR(final BinaryNode binaryNode) {
+    public boolean enterSHR(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -1267,9 +1254,9 @@
      * Binary enter - callback for entering - operator
      *
      * @param  binaryNode the node
-     * @return processed node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterSUB(final BinaryNode binaryNode) {
+    public boolean enterSUB(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
--- a/nashorn/src/jdk/nashorn/internal/ir/visitor/NodeVisitor.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/visitor/NodeVisitor.java	Wed May 08 10:10:05 2013 +0100
@@ -25,8 +25,6 @@
 
 package jdk.nashorn.internal.ir.visitor;
 
-import jdk.nashorn.internal.codegen.CompileUnit;
-import jdk.nashorn.internal.codegen.MethodEmitter;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
@@ -35,7 +33,6 @@
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
 import jdk.nashorn.internal.ir.ContinueNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
 import jdk.nashorn.internal.ir.EmptyNode;
 import jdk.nashorn.internal.ir.ExecuteNode;
 import jdk.nashorn.internal.ir.ForNode;
@@ -44,6 +41,7 @@
 import jdk.nashorn.internal.ir.IfNode;
 import jdk.nashorn.internal.ir.IndexNode;
 import jdk.nashorn.internal.ir.LabelNode;
+import jdk.nashorn.internal.ir.LexicalContext;
 import jdk.nashorn.internal.ir.LineNumberNode;
 import jdk.nashorn.internal.ir.LiteralNode;
 import jdk.nashorn.internal.ir.Node;
@@ -65,41 +63,30 @@
  * Visitor used to navigate the IR.
  */
 public abstract class NodeVisitor {
-    /** Current functionNode. */
-    private FunctionNode currentFunctionNode;
-
-    /** Current compile unit used for class generation. */
-    private CompileUnit compileUnit;
+    private final LexicalContext lc;
 
     /**
-     * Current method visitor used for method generation.
-     * <p>
-     * TODO: protected is just for convenience and readability, so that
-     * subclasses can directly use 'method' - might want to change that
-     */
-    protected MethodEmitter method;
-
-    /** Current block. */
-    private Block currentBlock;
-
-    /**
-     * Constructor.
+     * Constructor
      */
     public NodeVisitor() {
-        this(null, null);
+        this(new LexicalContext());
     }
 
     /**
      * Constructor
      *
-     * @param compileUnit compile unit for this node visitor
-     * @param method method emitter for this node visitor
+     * @param lc a custom lexical context
      */
-    public NodeVisitor(final CompileUnit compileUnit, final MethodEmitter method) {
-        super();
+    public NodeVisitor(final LexicalContext lc) {
+        this.lc = lc;
+    }
 
-        this.compileUnit = compileUnit;
-        this.method      = method;
+    /**
+     * Get the lexical context of this node visitor
+     * @return lexical context
+     */
+    public LexicalContext getLexicalContext() {
+        return lc;
     }
 
     /**
@@ -118,10 +105,10 @@
      *
      * @see NodeVisitor#leaveDefault(Node)
      * @param node the node to visit
-     * @return the node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    protected Node enterDefault(final Node node) {
-        return node;
+    protected boolean enterDefault(final Node node) {
+        return true;
     }
 
     /**
@@ -150,9 +137,9 @@
      * Callback for entering an AccessNode
      *
      * @param  accessNode the node
-     * @return processed node, null if traversal should end, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterAccessNode(final AccessNode accessNode) {
+    public boolean enterAccessNode(final AccessNode accessNode) {
         return enterDefault(accessNode);
     }
 
@@ -170,9 +157,9 @@
      * Callback for entering a Block
      *
      * @param  block     the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterBlock(final Block block) {
+    public boolean enterBlock(final Block block) {
         return enterDefault(block);
     }
 
@@ -192,7 +179,7 @@
      * @param  binaryNode  the node
      * @return processed   node
      */
-    public Node enterBinaryNode(final BinaryNode binaryNode) {
+    public boolean enterBinaryNode(final BinaryNode binaryNode) {
         return enterDefault(binaryNode);
     }
 
@@ -210,9 +197,9 @@
      * Callback for entering a BreakNode
      *
      * @param  breakNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterBreakNode(final BreakNode breakNode) {
+    public boolean enterBreakNode(final BreakNode breakNode) {
         return enterDefault(breakNode);
     }
 
@@ -230,9 +217,9 @@
      * Callback for entering a CallNode
      *
      * @param  callNode  the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterCallNode(final CallNode callNode) {
+    public boolean enterCallNode(final CallNode callNode) {
         return enterDefault(callNode);
     }
 
@@ -250,9 +237,9 @@
      * Callback for entering a CaseNode
      *
      * @param  caseNode  the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterCaseNode(final CaseNode caseNode) {
+    public boolean enterCaseNode(final CaseNode caseNode) {
         return enterDefault(caseNode);
     }
 
@@ -270,9 +257,9 @@
      * Callback for entering a CatchNode
      *
      * @param  catchNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterCatchNode(final CatchNode catchNode) {
+    public boolean enterCatchNode(final CatchNode catchNode) {
         return enterDefault(catchNode);
     }
 
@@ -290,9 +277,9 @@
      * Callback for entering a ContinueNode
      *
      * @param  continueNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterContinueNode(final ContinueNode continueNode) {
+    public boolean enterContinueNode(final ContinueNode continueNode) {
         return enterDefault(continueNode);
     }
 
@@ -307,32 +294,12 @@
     }
 
     /**
-     * Callback for entering a DoWhileNode
-     *
-     * @param  doWhileNode the node
-     * @return processed   node
-     */
-    public Node enterDoWhileNode(final DoWhileNode doWhileNode) {
-        return enterDefault(doWhileNode);
-    }
-
-    /**
-     * Callback for leaving a DoWhileNode
-     *
-     * @param  doWhileNode the node
-     * @return processed node, which will replace the original one, or the original node
-     */
-    public Node leaveDoWhileNode(final DoWhileNode doWhileNode) {
-        return leaveDefault(doWhileNode);
-    }
-
-    /**
      * Callback for entering an EmptyNode
      *
      * @param  emptyNode   the node
-     * @return processed   node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterEmptyNode(final EmptyNode emptyNode) {
+    public boolean enterEmptyNode(final EmptyNode emptyNode) {
         return enterDefault(emptyNode);
     }
 
@@ -350,9 +317,9 @@
      * Callback for entering an ExecuteNode
      *
      * @param  executeNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterExecuteNode(final ExecuteNode executeNode) {
+    public boolean enterExecuteNode(final ExecuteNode executeNode) {
         return enterDefault(executeNode);
     }
 
@@ -370,9 +337,9 @@
      * Callback for entering a ForNode
      *
      * @param  forNode   the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterForNode(final ForNode forNode) {
+    public boolean enterForNode(final ForNode forNode) {
         return enterDefault(forNode);
     }
 
@@ -390,9 +357,9 @@
      * Callback for entering a FunctionNode
      *
      * @param  functionNode the node
-     * @return processed    node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterFunctionNode(final FunctionNode functionNode) {
+    public boolean enterFunctionNode(final FunctionNode functionNode) {
         return enterDefault(functionNode);
     }
 
@@ -410,9 +377,9 @@
      * Callback for entering an IdentNode
      *
      * @param  identNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterIdentNode(final IdentNode identNode) {
+    public boolean enterIdentNode(final IdentNode identNode) {
         return enterDefault(identNode);
     }
 
@@ -429,10 +396,10 @@
     /**
      * Callback for entering an IfNode
      *
-     * @param  ifNode    the node
-     * @return processed node, null if traversal should end
+     * @param  ifNode the node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterIfNode(final IfNode ifNode) {
+    public boolean enterIfNode(final IfNode ifNode) {
         return enterDefault(ifNode);
     }
 
@@ -450,9 +417,9 @@
      * Callback for entering an IndexNode
      *
      * @param  indexNode  the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterIndexNode(final IndexNode indexNode) {
+    public boolean enterIndexNode(final IndexNode indexNode) {
         return enterDefault(indexNode);
     }
 
@@ -470,9 +437,9 @@
      * Callback for entering a LabelNode
      *
      * @param  labelNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterLabelNode(final LabelNode labelNode) {
+    public boolean enterLabelNode(final LabelNode labelNode) {
         return enterDefault(labelNode);
     }
 
@@ -490,9 +457,9 @@
      * Callback for entering a LineNumberNode
      *
      * @param  lineNumberNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterLineNumberNode(final LineNumberNode lineNumberNode) {
+    public boolean enterLineNumberNode(final LineNumberNode lineNumberNode) {
         return enterDefault(lineNumberNode);
     }
 
@@ -510,9 +477,9 @@
      * Callback for entering a LiteralNode
      *
      * @param  literalNode the node
-     * @return processed   node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterLiteralNode(final LiteralNode<?> literalNode) {
+    public boolean enterLiteralNode(final LiteralNode<?> literalNode) {
         return enterDefault(literalNode);
     }
 
@@ -530,9 +497,9 @@
      * Callback for entering an ObjectNode
      *
      * @param  objectNode the node
-     * @return processed  node
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterObjectNode(final ObjectNode objectNode) {
+    public boolean enterObjectNode(final ObjectNode objectNode) {
         return enterDefault(objectNode);
     }
 
@@ -550,9 +517,9 @@
      * Callback for entering a PropertyNode
      *
      * @param  propertyNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterPropertyNode(final PropertyNode propertyNode) {
+    public boolean enterPropertyNode(final PropertyNode propertyNode) {
         return enterDefault(propertyNode);
     }
 
@@ -570,9 +537,9 @@
      * Callback for entering a ReturnNode
      *
      * @param  returnNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterReturnNode(final ReturnNode returnNode) {
+    public boolean enterReturnNode(final ReturnNode returnNode) {
         return enterDefault(returnNode);
     }
 
@@ -590,9 +557,9 @@
      * Callback for entering a RuntimeNode
      *
      * @param  runtimeNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterRuntimeNode(final RuntimeNode runtimeNode) {
+    public boolean enterRuntimeNode(final RuntimeNode runtimeNode) {
         return enterDefault(runtimeNode);
     }
 
@@ -610,9 +577,9 @@
      * Callback for entering a SplitNode
      *
      * @param  splitNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterSplitNode(final SplitNode splitNode) {
+    public boolean enterSplitNode(final SplitNode splitNode) {
         return enterDefault(splitNode);
     }
 
@@ -630,9 +597,9 @@
      * Callback for entering a SwitchNode
      *
      * @param  switchNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterSwitchNode(final SwitchNode switchNode) {
+    public boolean enterSwitchNode(final SwitchNode switchNode) {
         return enterDefault(switchNode);
     }
 
@@ -650,9 +617,9 @@
      * Callback for entering a TernaryNode
      *
      * @param  ternaryNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterTernaryNode(final TernaryNode ternaryNode) {
+    public boolean enterTernaryNode(final TernaryNode ternaryNode) {
         return enterDefault(ternaryNode);
     }
 
@@ -670,9 +637,9 @@
      * Callback for entering a ThrowNode
      *
      * @param  throwNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterThrowNode(final ThrowNode throwNode) {
+    public boolean enterThrowNode(final ThrowNode throwNode) {
         return enterDefault(throwNode);
     }
 
@@ -690,9 +657,9 @@
      * Callback for entering a TryNode
      *
      * @param  tryNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterTryNode(final TryNode tryNode) {
+    public boolean enterTryNode(final TryNode tryNode) {
         return enterDefault(tryNode);
     }
 
@@ -710,9 +677,9 @@
      * Callback for entering a UnaryNode
      *
      * @param  unaryNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterUnaryNode(final UnaryNode unaryNode) {
+    public boolean enterUnaryNode(final UnaryNode unaryNode) {
         return enterDefault(unaryNode);
     }
 
@@ -730,9 +697,9 @@
      * Callback for entering a VarNode
      *
      * @param  varNode   the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterVarNode(final VarNode varNode) {
+    public boolean enterVarNode(final VarNode varNode) {
         return enterDefault(varNode);
     }
 
@@ -750,9 +717,9 @@
      * Callback for entering a WhileNode
      *
      * @param  whileNode the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterWhileNode(final WhileNode whileNode) {
+    public boolean enterWhileNode(final WhileNode whileNode) {
         return enterDefault(whileNode);
     }
 
@@ -770,9 +737,9 @@
      * Callback for entering a WithNode
      *
      * @param  withNode  the node
-     * @return processed node, null if traversal should end
+     * @return true if traversal should continue and node children be traversed, false otherwise
      */
-    public Node enterWithNode(final WithNode withNode) {
+    public boolean enterWithNode(final WithNode withNode) {
         return enterDefault(withNode);
     }
 
@@ -786,74 +753,5 @@
         return leaveDefault(withNode);
     }
 
-    /**
-     * Get the current function node for this NodeVisitor
-     * @see FunctionNode
-     * @return the function node being visited
-     */
-    public FunctionNode getCurrentFunctionNode() {
-        return currentFunctionNode;
-    }
-
-    /**
-     * Reset the current function node being visited for this NodeVisitor
-     * @see FunctionNode
-     * @param currentFunctionNode a new function node to traverse
-     */
-    public void setCurrentFunctionNode(final FunctionNode currentFunctionNode) {
-        this.currentFunctionNode = currentFunctionNode;
-    }
-
-    /**
-     * Get the current compile unit for this NodeVisitor
-     * @see CompileUnit
-     * @return a compile unit, or null if not a compiling NodeVisitor
-     */
-    public CompileUnit getCurrentCompileUnit() {
-        return compileUnit;
-    }
-
-    /**
-     * Set the current compile unit for this NodeVisitor
-     * @see CompileUnit
-     * @param compileUnit a new compile unit
-     */
-    public void setCurrentCompileUnit(final CompileUnit compileUnit) {
-        this.compileUnit = compileUnit;
-    }
-
-    /**
-     * Get the current method emitter for this NodeVisitor
-     * @see MethodEmitter
-     * @return the method emitter
-     */
-    public MethodEmitter getCurrentMethodEmitter() {
-        return method;
-    }
-
-    /**
-     * Reset the current method emitter for this NodeVisitor
-     * @see MethodEmitter
-     * @param method a new method emitter
-     */
-    public void setCurrentMethodEmitter(final MethodEmitter method) {
-        this.method = method;
-    }
-
-    /**
-     * Get the current Block being traversed for this NodeVisitor
-     * @return the current block
-     */
-    public Block getCurrentBlock() {
-        return currentBlock;
-    }
-
-    /**
-     * Reset the Block to be traversed for this NodeVisitor
-     * @param currentBlock the new current block
-     */
-    public void setCurrentBlock(final Block currentBlock) {
-        this.currentBlock = currentBlock;
-    }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/lookup/MethodHandleFactory.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/lookup/MethodHandleFactory.java	Wed May 08 10:10:05 2013 +0100
@@ -137,7 +137,7 @@
      */
     static Object traceReturn(final DebugLogger logger, final Object value) {
         final String str = "\treturn: " + stripName(value) + " [type=" + (value == null ? "null" : stripName(value.getClass()) + ']');
-        logger.log(str, TRACE_LEVEL);
+        logger.log(TRACE_LEVEL, str);
         return value;
     }
 
@@ -173,7 +173,7 @@
         }
 
         assert logger != null;
-        logger.log(sb.toString(), TRACE_LEVEL);
+        logger.log(TRACE_LEVEL, sb);
         stacktrace(logger);
     }
 
@@ -184,7 +184,7 @@
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         final PrintStream ps = new PrintStream(baos);
         new Throwable().printStackTrace(ps);
-        logger.log(baos.toString(), TRACE_LEVEL);
+        logger.log(TRACE_LEVEL, baos.toString());
     }
 
     private static String argString(final Object arg) {
@@ -614,7 +614,7 @@
         @Override
         public SwitchPoint createSwitchPoint() {
             final SwitchPoint sp = super.createSwitchPoint();
-            LOG.log("createSwitchPoint " + sp, TRACE_LEVEL);
+            LOG.log(TRACE_LEVEL, "createSwitchPoint ", sp);
             return sp;
         }
 
@@ -627,7 +627,7 @@
         @Override
         public MethodType type(final Class<?> returnType, final Class<?>... paramTypes) {
             final MethodType mt = super.type(returnType, paramTypes);
-            LOG.log("methodType " + returnType + ' ' + Arrays.toString(paramTypes) + ' ' + mt, TRACE_LEVEL);
+            LOG.log(TRACE_LEVEL, "methodType ", returnType, " ", Arrays.toString(paramTypes), " ", mt);
             return mt;
         }
     }
@@ -638,7 +638,7 @@
     private static class TraceCreateMethodHandleFunctionality extends TraceMethodHandleFunctionality {
         @Override
         public MethodHandle debug(final MethodHandle master, final String str, final Object... args) {
-            LOG.log(str + ' ' + describe(args), TRACE_LEVEL);
+            LOG.log(TRACE_LEVEL, str, " ", describe(args));
             stacktrace(LOG);
             return master;
         }
--- a/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -40,7 +40,7 @@
 
     BoundScriptFunctionImpl(ScriptFunctionData data, ScriptFunction targetFunction) {
         super(data);
-        this.prototype = ScriptRuntime.UNDEFINED;
+        setPrototype(ScriptRuntime.UNDEFINED);
         this.targetFunction = targetFunction;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Wed May 08 10:10:05 2013 +0100
@@ -418,7 +418,7 @@
                 long length;
                 if (len instanceof Integer || len instanceof Long) {
                     length = ((Number) len).longValue();
-                    if (length >= 0 && length < 0xffff_ffffL) {
+                    if (length >= 0 && length < JSType.MAX_UINT) {
                         return new NativeArray(length);
                     }
                 }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Wed May 08 10:10:05 2013 +0100
@@ -182,7 +182,8 @@
 
     @Override
     public String safeToString() {
-        return "[Date " + toISOStringImpl(this) + "]";
+        final String str = isValidDate() ? toISOStringImpl(this) : INVALID_DATE;
+        return "[Date " + str + "]";
     }
 
     @Override
@@ -518,7 +519,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object getTimezoneOffset(final Object self) {
         final NativeDate nd = getNativeDate(self);
-        if (nd != null) {
+        if (nd != null && nd.isValidDate()) {
             final long msec = (long) nd.getTime();
             return - nd.getTimeZone().getOffset(msec) / msPerMinute;
         }
@@ -534,8 +535,8 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object setTime(final Object self, final Object time) {
+        final NativeDate nd  = getNativeDate(self);
         final double     num = timeClip(JSType.toNumber(time));
-        final NativeDate nd  = getNativeDate(self);
         nd.setTime(num);
         return num;
     }
@@ -550,9 +551,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object setMilliseconds(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MILLISECOND, args, true);
-        }
+        setFields(nd, MILLISECOND, args, true);
         return nd.getTime();
     }
 
@@ -566,9 +565,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object setUTCMilliseconds(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MILLISECOND, args, false);
-        }
+        setFields(nd, MILLISECOND, args, false);
         return nd.getTime();
     }
 
@@ -582,9 +579,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
     public static Object setSeconds(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, SECOND, args, true);
-        }
+        setFields(nd, SECOND, args, true);
         return nd.getTime();
     }
 
@@ -598,9 +593,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
     public static Object setUTCSeconds(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, SECOND, args, false);
-        }
+        setFields(nd, SECOND, args, false);
         return nd.getTime();
     }
 
@@ -614,9 +607,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 3)
     public static Object setMinutes(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MINUTE, args, true);
-        }
+        setFields(nd, MINUTE, args, true);
         return nd.getTime();
     }
 
@@ -630,9 +621,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 3)
     public static Object setUTCMinutes(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MINUTE, args, false);
-        }
+        setFields(nd, MINUTE, args, false);
         return nd.getTime();
     }
 
@@ -646,9 +635,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 4)
     public static Object setHours(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, HOUR, args, true);
-        }
+        setFields(nd, HOUR, args, true);
         return nd.getTime();
     }
 
@@ -662,9 +649,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 4)
     public static Object setUTCHours(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, HOUR, args, false);
-        }
+        setFields(nd, HOUR, args, false);
         return nd.getTime();
     }
 
@@ -678,9 +663,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object setDate(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, DAY, args, true);
-        }
+        setFields(nd, DAY, args, true);
         return nd.getTime();
     }
 
@@ -694,9 +677,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
     public static Object setUTCDate(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, DAY, args, false);
-        }
+        setFields(nd, DAY, args, false);
         return nd.getTime();
     }
 
@@ -710,9 +691,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
     public static Object setMonth(final Object self, final Object... args) {
         final NativeDate nd = getNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MONTH, args, true);
-        }
+        setFields(nd, MONTH, args, true);
         return nd.getTime();
     }
 
@@ -726,9 +705,7 @@
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 2)
     public static Object setUTCMonth(final Object self, final Object... args) {
         final NativeDate nd = ensureNativeDate(self);
-        if (nd.isValidDate()) {
-            setFields(nd, MONTH, args, false);
-        }
+        setFields(nd, MONTH, args, false);
         return nd.getTime();
     }
 
@@ -746,7 +723,11 @@
             setFields(nd, YEAR, args, true);
         } else {
             final double[] d = convertArgs(args, 0, YEAR, YEAR, 3);
-            nd.setTime(timeClip(utc(makeDate(makeDay(d[0], d[1], d[2]), 0), nd.getTimeZone())));
+            if (d != null) {
+                nd.setTime(timeClip(utc(makeDate(makeDay(d[0], d[1], d[2]), 0), nd.getTimeZone())));
+            } else {
+                nd.setTime(NaN);
+            }
         }
         return nd.getTime();
     }
@@ -781,13 +762,13 @@
     public static Object setYear(final Object self, final Object year) {
         final NativeDate nd = getNativeDate(self);
         if (isNaN(nd.getTime())) {
-            return null;
+            nd.setTime(utc(0, nd.getTimeZone()));
         }
 
         final double yearNum = JSType.toNumber(year);
         if (isNaN(yearNum)) {
             nd.setTime(NaN);
-            return nd;
+            return nd.getTime();
         }
         int yearInt = JSType.toInteger(yearNum);
         if (0 <= yearInt && yearInt <= 99) {
@@ -795,7 +776,7 @@
         }
         setFields(nd, YEAR, new Object[] {yearInt}, true);
 
-        return nd;
+        return nd.getTime();
     }
 
     /**
@@ -851,11 +832,11 @@
         }
         final ScriptObject sobj  = (ScriptObject)selfObj;
         final Object       value = sobj.getDefaultValue(Number.class);
-
-        final double num = (value instanceof Number) ? ((Number)value).doubleValue() : NaN;
-
-        if (isInfinite(num) || isNaN(num)) {
-            return null;
+        if (value instanceof Number) {
+            final double num = ((Number)value).doubleValue();
+            if (isInfinite(num) || isNaN(num)) {
+                return null;
+            }
         }
 
         try {
@@ -1297,6 +1278,10 @@
         final double time = local ? nd.getLocalTime() : nd.getTime();
         final double d[] = convertArgs(args, time, fieldId, start, length);
 
+        if (! nd.isValidDate()) {
+            return;
+        }
+
         double newTime;
         if (d == null) {
             newTime = NaN;
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Wed May 08 10:10:05 2013 +0100
@@ -247,7 +247,6 @@
         out.println("Scope count " + ScriptObject.getScopeCount());
         out.println("ScriptObject listeners added " + PropertyListenerManager.getListenersAdded());
         out.println("ScriptObject listeners removed " + PropertyListenerManager.getListenersRemoved());
-        out.println("ScriptObject listeners dead " + PropertyListenerManager.getListenersDead());
         out.println("ScriptFunction count " + ScriptObject.getCount());
         out.println("ScriptFunction invokes " + ScriptFunction.getInvokes());
         out.println("ScriptFunction allocations " + ScriptFunction.getAllocations());
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Wed May 08 10:10:05 2013 +0100
@@ -81,23 +81,13 @@
 
         Object[] args = null;
 
-        if (ScriptObject.isArray(array)) {
-            args = ((NativeArray)array).asObjectArray();
-        } else if (array instanceof ScriptObject) {
+        if (array instanceof ScriptObject) {
             // look for array-like object
             final ScriptObject sobj = (ScriptObject)array;
             final Object       len  = sobj.getLength();
-
-            if (len == UNDEFINED || len == null) {
-                throw typeError("function.apply.expects.array");
-            }
+            final int n = (int)JSType.toUint32(len);
 
-            final int n = (int)JSType.toUint32(len);
-            if (n != JSType.toNumber(len)) {
-                throw typeError("function.apply.expects.array");
-            }
-
-            args = new Object[(int)JSType.toUint32(len)];
+            args = new Object[n];
             for (int i = 0; i < args.length; i++) {
                 args[i] = sobj.get(i);
             }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Wed May 08 10:10:05 2013 +0100
@@ -148,11 +148,7 @@
         if (overrides instanceof ScriptObject) {
             this.overrides = true;
             final ScriptObject sobj = (ScriptObject)overrides;
-            final Iterator<String> iter = sobj.propertyIterator();
-            while (iter.hasNext()) {
-                final String prop = iter.next();
-                super.set(prop, sobj.get(prop), false);
-            }
+            this.addBoundProperties(sobj);
         } else {
             this.overrides = false;
         }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Wed May 08 10:10:05 2013 +0100
@@ -229,7 +229,7 @@
         final JSType type = JSType.of(value);
         if (type == JSType.OBJECT) {
             if (isArray(value)) {
-                return JA((NativeArray)value, state);
+                return JA((ScriptObject)value, state);
             } else if (value instanceof ScriptObject) {
                 return JO((ScriptObject)value, state);
             }
@@ -315,7 +315,7 @@
     }
 
     // Spec: The abstract operation JA(value) serializes an array.
-    private static Object JA(final NativeArray value, final StringifyState state) {
+    private static Object JA(final ScriptObject value, final StringifyState state) {
         if (state.stack.containsKey(value)) {
             throw typeError("JSON.stringify.cyclic");
         }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Wed May 08 10:10:05 2013 +0100
@@ -523,23 +523,28 @@
     }
 
     private RegExpResult execInner(final String string) {
+        final boolean isGlobal = regexp.isGlobal();
         int start = getLastIndex();
-        if (! regexp.isGlobal()) {
+        if (!isGlobal) {
             start = 0;
         }
 
         if (start < 0 || start > string.length()) {
-            setLastIndex(0);
+            if (isGlobal) {
+                setLastIndex(0);
+            }
             return null;
         }
 
         final RegExpMatcher matcher = regexp.match(string);
         if (matcher == null || !matcher.search(start)) {
-            setLastIndex(0);
+            if (isGlobal) {
+                setLastIndex(0);
+            }
             return null;
         }
 
-        if (regexp.isGlobal()) {
+        if (isGlobal) {
             setLastIndex(matcher.end());
         }
 
@@ -548,6 +553,22 @@
         return match;
     }
 
+    // String.prototype.split method ignores the global flag and should not update lastIndex property.
+    private RegExpResult execSplit(final String string, int start) {
+        if (start < 0 || start > string.length()) {
+            return null;
+        }
+
+        final RegExpMatcher matcher = regexp.match(string);
+        if (matcher == null || !matcher.search(start)) {
+            return null;
+        }
+
+        final RegExpResult match = new RegExpResult(string, matcher.start(), groups(matcher));
+        globalObject.setLastRegExpResult(match);
+        return match;
+    }
+
     /**
      * Convert java.util.regex.Matcher groups to JavaScript groups.
      * That is, replace null and groups that didn't match with undefined.
@@ -600,7 +621,7 @@
      * @return True if a match is found.
      */
     public Object test(final String string) {
-        return exec(string) != null;
+        return execInner(string) != null;
     }
 
     /**
@@ -765,35 +786,31 @@
      * @return Array of substrings.
      */
     Object split(final String string, final long limit) {
-        return split(this, string, limit);
-    }
-
-    private static Object split(final NativeRegExp regexp0, final String input, final long limit) {
-        final List<Object> matches = new ArrayList<>();
-
-        final NativeRegExp regexp = new NativeRegExp(regexp0);
-        regexp.setGlobal(true);
-
         if (limit == 0L) {
             return new NativeArray();
         }
 
+        final List<Object> matches = new ArrayList<>();
+
         RegExpResult match;
-        final int inputLength = input.length();
+        final int inputLength = string.length();
         int lastLength = -1;
+        int lastIndex = 0;
         int lastLastIndex = 0;
 
-        while ((match = regexp.execInner(input)) != null) {
-            final int lastIndex = match.getIndex() + match.length();
+        while ((match = execSplit(string, lastIndex)) != null) {
+            lastIndex = match.getIndex() + match.length();
 
             if (lastIndex > lastLastIndex) {
-                matches.add(input.substring(lastLastIndex, match.getIndex()));
-                if (match.getGroups().length > 1 && match.getIndex() < inputLength) {
-                    matches.addAll(Arrays.asList(match.getGroups()).subList(1, match.getGroups().length));
+                matches.add(string.substring(lastLastIndex, match.getIndex()));
+                final Object[] groups = match.getGroups();
+                if (groups.length > 1 && match.getIndex() < inputLength) {
+                    for (int index = 1; index < groups.length && matches.size() < limit; index++) {
+                        matches.add(groups[index]);
+                    }
                 }
 
                 lastLength = match.length();
-                lastLastIndex = lastIndex;
 
                 if (matches.size() >= limit) {
                     break;
@@ -801,8 +818,10 @@
             }
 
             // bump the index to avoid infinite loop
-            if (regexp.getLastIndex() == match.getIndex()) {
-                regexp.setLastIndex(match.getIndex() + 1);
+            if (lastIndex == lastLastIndex) {
+                lastIndex++;
+            } else {
+                lastLastIndex = lastIndex;
             }
         }
 
@@ -810,12 +829,12 @@
             // check special case if we need to append an empty string at the
             // end of the match
             // if the lastIndex was the entire string
-            if (lastLastIndex == input.length()) {
-                if (lastLength > 0 || regexp.test("") == Boolean.FALSE) {
+            if (lastLastIndex == string.length()) {
+                if (lastLength > 0 || execSplit("", 0) == null) {
                     matches.add("");
                 }
             } else {
-                matches.add(input.substring(lastLastIndex, inputLength));
+                matches.add(string.substring(lastLastIndex, inputLength));
             }
         }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Wed May 08 10:10:05 2013 +0100
@@ -51,6 +51,7 @@
 
     NativeRegExpExecResult(final RegExpResult result) {
         setProto(Global.instance().getArrayPrototype());
+        setIsArray();
         this.setArray(ArrayData.allocate(result.getGroups().clone()));
         this.index = result.getIndex();
         this.input = result.getInput();
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Wed May 08 10:10:05 2013 +0100
@@ -25,11 +25,11 @@
 
 package jdk.nashorn.internal.objects;
 
+import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.JSType.isRepresentableAsInt;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -41,6 +41,7 @@
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
@@ -55,7 +56,6 @@
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
-import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.runtime.linker.NashornGuards;
 import jdk.nashorn.internal.runtime.linker.PrimitiveLookup;
 
@@ -179,7 +179,6 @@
         return ((ScriptObject) Global.toObject(self)).get(key);
     }
 
-    @SuppressWarnings("unused")
     private static Object get(final Object self, final int key) {
         final CharSequence cs = JSType.toCharSequence(self);
         if (key >= 0 && key < cs.length()) {
@@ -842,7 +841,7 @@
         final long lim = (limit == UNDEFINED) ? JSType.MAX_UINT : JSType.toUint32(limit);
 
         if (separator == UNDEFINED) {
-            return new NativeArray(new Object[]{str});
+            return lim == 0 ? new NativeArray() : new NativeArray(new Object[]{str});
         }
 
         if (separator instanceof NativeRegExp) {
@@ -855,8 +854,9 @@
 
     private static Object splitString(String str, String separator, long limit) {
         if (separator.isEmpty()) {
-            final Object[] array = new Object[str.length()];
-            for (int i = 0; i < array.length; i++) {
+            final int length = (int) Math.min(str.length(), limit);
+            final Object[] array = new Object[length];
+            for (int i = 0; i < length; i++) {
                 array[i] = String.valueOf(str.charAt(i));
             }
             return new NativeArray(array);
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Wed May 08 10:10:05 2013 +0100
@@ -29,6 +29,7 @@
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
+import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 
@@ -71,17 +72,17 @@
 
         @Override
         protected long getLongImpl(final int key) {
-            return getIntImpl(key) & 0xffff_ffffL;
+            return getIntImpl(key) & JSType.MAX_UINT;
         }
 
         @Override
         protected double getDoubleImpl(final int key) {
-            return getIntImpl(key) & 0xffff_ffffL;
+            return getIntImpl(key) & JSType.MAX_UINT;
         }
 
         @Override
         protected Object getObjectImpl(final int key) {
-            return getIntImpl(key) & 0xffff_ffffL;
+            return getIntImpl(key) & JSType.MAX_UINT;
         }
 
         @Override
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Wed May 08 10:10:05 2013 +0100
@@ -42,6 +42,10 @@
  * function objects -- to expose properties like "prototype", "length" etc.
  */
 public class ScriptFunctionImpl extends ScriptFunction {
+
+    /** Reference to constructor prototype. */
+    private Object prototype;
+
     // property map for strict mode functions
     private static final PropertyMap strictmodemap$;
     // property map for bound functions
@@ -49,6 +53,9 @@
     // property map for non-strict, non-bound functions.
     private static final PropertyMap nasgenmap$;
 
+    // Marker object for lazily initialized prototype object
+    private static final Object LAZY_PROTOTYPE = new Object();
+
     /**
      * Constructor called by Nasgen generated code, no membercount, use the default map.
      * Creates builtin functions only.
@@ -83,8 +90,8 @@
      * @param methodHandle handle for invocation
      * @param scope scope object
      * @param specs specialized versions of this method, if available, null otherwise
-     * @param strict are we in strict mode
-     * @param builtin is this a built-in function
+     * @param isStrict are we in strict mode
+     * @param isBuiltin is this a built-in function
      * @param isConstructor can the function be used as a constructor (most can; some built-ins are restricted).
      */
     ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final MethodHandle[] specs, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
@@ -235,10 +242,23 @@
         return Global.objectPrototype();
     }
 
+    @Override
+    public final Object getPrototype() {
+        if (prototype == LAZY_PROTOTYPE) {
+            prototype = new PrototypeObject(this);
+        }
+        return prototype;
+    }
+
+    @Override
+    public final void setPrototype(final Object prototype) {
+        this.prototype = prototype;
+    }
+
     // Internals below..
     private void init() {
         this.setProto(Global.instance().getFunctionPrototype());
-        this.setPrototype(new PrototypeObject(this));
+        this.prototype = LAZY_PROTOTYPE;
 
         if (isStrict()) {
             final ScriptFunction func = getTypeErrorThrower();
--- a/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java	Wed May 08 10:10:05 2013 +0100
@@ -37,8 +37,8 @@
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.JSErrorType;
 import jdk.nashorn.internal.runtime.ParserException;
+import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.regexp.RegExpFactory;
-import jdk.nashorn.internal.runtime.Source;
 
 /**
  * Base class for parsers.
@@ -197,9 +197,10 @@
      *
      * @param message    Error message.
      * @param errorToken Offending token.
+     * @return ParserException upon failure. Caller should throw and not ignore
      */
-    protected final void error(final String message, final long errorToken) {
-        error(JSErrorType.SYNTAX_ERROR, message, errorToken);
+    protected final ParserException error(final String message, final long errorToken) {
+        return error(JSErrorType.SYNTAX_ERROR, message, errorToken);
     }
 
     /**
@@ -208,22 +209,24 @@
      * @param errorType  The error type
      * @param message    Error message.
      * @param errorToken Offending token.
+     * @return ParserException upon failure. Caller should throw and not ignore
      */
-    protected final void error(final JSErrorType errorType, final String message, final long errorToken) {
+    protected final ParserException error(final JSErrorType errorType, final String message, final long errorToken) {
         final int position  = Token.descPosition(errorToken);
         final int lineNum   = source.getLine(position);
         final int columnNum = source.getColumn(position);
         final String formatted = ErrorManager.format(message, source, lineNum, columnNum, errorToken);
-        throw new ParserException(errorType, formatted, source, lineNum, columnNum, errorToken);
+        return new ParserException(errorType, formatted, source, lineNum, columnNum, errorToken);
     }
 
     /**
      * Report an error.
      *
      * @param message Error message.
+     * @return ParserException upon failure. Caller should throw and not ignore
      */
-    protected final void error(final String message) {
-        error(JSErrorType.SYNTAX_ERROR, message);
+    protected final ParserException error(final String message) {
+        return error(JSErrorType.SYNTAX_ERROR, message);
     }
 
     /**
@@ -231,13 +234,24 @@
      *
      * @param errorType  The error type
      * @param message    Error message.
+     * @return ParserException upon failure. Caller should throw and not ignore
      */
-    protected final void error(final JSErrorType errorType, final String message) {
+    protected final ParserException error(final JSErrorType errorType, final String message) {
         // TODO - column needs to account for tabs.
         final int position = Token.descPosition(token);
         final int column = position - linePosition;
         final String formatted = ErrorManager.format(message, source, line, column, token);
-        throw new ParserException(errorType, formatted, source, line, column, token);
+        return new ParserException(errorType, formatted, source, line, column, token);
+    }
+
+    /**
+     * Report a warning to the error manager.
+     *
+     * @param errorType  The error type of the warning
+     * @param message    Warning message.
+     */
+    protected final void warning(final JSErrorType errorType, final String message, final long errorToken) {
+        errors.warning(error(errorType, message, errorToken));
     }
 
     /**
@@ -270,7 +284,7 @@
      */
     protected final void expect(final TokenType expected) throws ParserException {
         if (type != expected) {
-            error(expectMessage(expected));
+            throw error(expectMessage(expected));
         }
 
         next();
@@ -285,7 +299,7 @@
      */
     protected final Object expectValue(final TokenType expected) throws ParserException {
         if (type != expected) {
-            error(expectMessage(expected));
+            throw error(expectMessage(expected));
         }
 
         final Object value = getValue();
@@ -429,7 +443,7 @@
                 try {
                     RegExpFactory.validate(regex.getExpression(), regex.getOptions());
                 } catch (final ParserException e) {
-                    error(e.getMessage());
+                    throw error(e.getMessage());
                 }
             }
             node = LiteralNode.newInstance(source, literalToken, finish, (LexerToken)value);
--- a/nashorn/src/jdk/nashorn/internal/parser/JSONParser.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/JSONParser.java	Wed May 08 10:10:05 2013 +0100
@@ -170,8 +170,7 @@
                 }
             case '"':
             case '\\':
-                error(AbstractParser.message("unexpected.token", str));
-                break;
+                throw error(AbstractParser.message("unexpected.token", str));
             }
         }
 
@@ -222,14 +221,12 @@
                 return new UnaryNode(source, literalToken, LiteralNode.newInstance(source, realToken, finish, (Number)value));
             }
 
-            error(AbstractParser.message("expected", "number", type.getNameOrType()));
-            break;
+            throw error(AbstractParser.message("expected", "number", type.getNameOrType()));
         default:
             break;
         }
 
-        error(AbstractParser.message("expected", "json literal", type.getNameOrType()));
-        return null;
+        throw error(AbstractParser.message("expected", "json literal", type.getNameOrType()));
     }
 
     /**
@@ -265,7 +262,7 @@
                 elements.add(jsonLiteral());
                 // Comma between array elements is mandatory in JSON.
                 if (type != COMMARIGHT && type != RBRACKET) {
-                    error(AbstractParser.message("expected", ", or ]", type.getNameOrType()));
+                   throw error(AbstractParser.message("expected", ", or ]", type.getNameOrType()));
                 }
                 break;
             }
@@ -306,7 +303,7 @@
 
                 // Comma between property assigments is mandatory in JSON.
                 if (type != RBRACE && type != COMMARIGHT) {
-                    error(AbstractParser.message("expected", ", or }", type.getNameOrType()));
+                    throw error(AbstractParser.message("expected", ", or }", type.getNameOrType()));
                 }
                 break;
             }
@@ -334,13 +331,11 @@
         if (name != null) {
             expect(COLON);
             final Node value = jsonLiteral();
-            return new PropertyNode(source, propertyToken, value.getFinish(), name, value);
+            return new PropertyNode(source, propertyToken, value.getFinish(), name, value, null, null);
         }
 
         // Raise an error.
-        error(AbstractParser.message("expected", "string", type.getNameOrType()));
-
-        return null;
+        throw error(AbstractParser.message("expected", "string", type.getNameOrType()));
     }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Wed May 08 10:10:05 2013 +0100
@@ -57,6 +57,9 @@
  */
 @SuppressWarnings("fallthrough")
 public class Lexer extends Scanner {
+    private static final long MIN_INT_L = Integer.MIN_VALUE;
+    private static final long MAX_INT_L = Integer.MAX_VALUE;
+
     private static final boolean XML_LITERALS = Options.getBooleanProperty("nashorn.lexer.xmlliterals");
 
     /** Content source. */
@@ -984,27 +987,27 @@
      */
     private static Number valueOf(final String valueString, final int radix) throws NumberFormatException {
         try {
-            return Integer.valueOf(valueString, radix);
+            final long value = Long.parseLong(valueString, radix);
+            if(value >= MIN_INT_L && value <= MAX_INT_L) {
+                return Integer.valueOf((int)value);
+            }
+            return Long.valueOf(value);
         } catch (final NumberFormatException e) {
-            try {
-                return Long.valueOf(valueString, radix);
-            } catch (final NumberFormatException e2) {
-                if (radix == 10) {
-                    return Double.valueOf(valueString);
-                }
-
-                double value = 0.0;
+            if (radix == 10) {
+                return Double.valueOf(valueString);
+            }
 
-                for (int i = 0; i < valueString.length(); i++) {
-                    final char ch = valueString.charAt(i);
-                    // Preverified, should always be a valid digit.
-                    final int digit = convertDigit(ch, radix);
-                    value *= radix;
-                    value += digit;
-                }
+            double value = 0.0;
 
-                return value;
+            for (int i = 0; i < valueString.length(); i++) {
+                final char ch = valueString.charAt(i);
+                // Preverified, should always be a valid digit.
+                final int digit = convertDigit(ch, radix);
+                value *= radix;
+                value += digit;
             }
+
+            return value;
         }
     }
 
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Wed May 08 10:10:05 2013 +0100
@@ -54,24 +54,23 @@
 import static jdk.nashorn.internal.parser.TokenType.WHILE;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Stack;
 import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.codegen.Namespace;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
+import jdk.nashorn.internal.ir.BlockLexicalContext;
 import jdk.nashorn.internal.ir.BreakNode;
 import jdk.nashorn.internal.ir.BreakableNode;
 import jdk.nashorn.internal.ir.CallNode;
 import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.CatchNode;
 import jdk.nashorn.internal.ir.ContinueNode;
-import jdk.nashorn.internal.ir.DoWhileNode;
 import jdk.nashorn.internal.ir.EmptyNode;
 import jdk.nashorn.internal.ir.ExecuteNode;
 import jdk.nashorn.internal.ir.ForNode;
@@ -84,6 +83,7 @@
 import jdk.nashorn.internal.ir.LexicalContext;
 import jdk.nashorn.internal.ir.LineNumberNode;
 import jdk.nashorn.internal.ir.LiteralNode;
+import jdk.nashorn.internal.ir.LoopNode;
 import jdk.nashorn.internal.ir.Node;
 import jdk.nashorn.internal.ir.ObjectNode;
 import jdk.nashorn.internal.ir.PropertyKey;
@@ -117,9 +117,10 @@
     /** Is scripting mode. */
     private final boolean scripting;
 
-    private final LexicalContext lexicalContext = new LexicalContext();
     private List<Node> functionDeclarations;
 
+    private final BlockLexicalContext lc = new BlockLexicalContext();
+
     /** Namespace for function names where not explicitly given */
     private final Namespace namespace;
 
@@ -146,7 +147,7 @@
      */
     public Parser(final ScriptEnvironment env, final Source source, final ErrorManager errors, final boolean strict) {
         super(source, errors, strict);
-        this.env   = env;
+        this.env       = env;
         this.namespace = new Namespace(env.getNamespace());
         this.scripting = env._scripting;
     }
@@ -162,7 +163,7 @@
      * @return function node resulting from successful parse
      */
     public FunctionNode parse() {
-        return parse(RUN_SCRIPT.tag());
+        return parse(RUN_SCRIPT.symbolName());
     }
 
     /**
@@ -176,7 +177,7 @@
      */
     public FunctionNode parse(final String scriptName) {
         final long t0 = Timing.isEnabled() ? System.currentTimeMillis() : 0L;
-        LOG.info(this + " begin for '" + scriptName + "'");
+        LOG.info(this, " begin for '", scriptName, "'");
 
         try {
             stream = new TokenStream();
@@ -214,7 +215,7 @@
              final String end = this + " end '" + scriptName + "'";
              if (Timing.isEnabled()) {
                  Timing.accumulateTime(toString(), System.currentTimeMillis() - t0);
-                 LOG.info(end + "' in " + (System.currentTimeMillis() - t0) + " ms");
+                 LOG.info(end, "' in ", (System.currentTimeMillis() - t0), " ms");
              } else {
                  LOG.info(end);
              }
@@ -275,8 +276,7 @@
      */
     private Block newBlock() {
         final Block block = new Block(source, token, Token.descPosition(token));
-        lexicalContext.push(block);
-        return block;
+        return lc.push(block);
     }
 
     /**
@@ -285,36 +285,60 @@
      * @param ident Name of function.
      * @return New block.
      */
-    private FunctionNode newFunctionBlock(final IdentNode ident) {
+    private FunctionNode newFunctionNode(final long startToken, final IdentNode ident, final List<IdentNode> parameters, final FunctionNode.Kind kind) {
         // Build function name.
         final StringBuilder sb = new StringBuilder();
 
-        final FunctionNode parentFunction = getFunction();
-        if(parentFunction != null && !parentFunction.isProgram()) {
+        final FunctionNode parentFunction = lc.getCurrentFunction();
+        if (parentFunction != null && !parentFunction.isProgram()) {
             sb.append(parentFunction.getName()).append('$');
         }
 
-        sb.append(ident != null ? ident.getName() : FUNCTION_PREFIX.tag());
+        sb.append(ident != null ? ident.getName() : FUNCTION_PREFIX.symbolName());
         final String name = namespace.uniqueName(sb.toString());
-        assert parentFunction != null || name.equals(RUN_SCRIPT.tag())  : "name = " + name;// must not rename runScript().
+        assert parentFunction != null || name.equals(RUN_SCRIPT.symbolName())  : "name = " + name;// must not rename runScript().
+
+        int flags = 0;
+        if (parentFunction == null) {
+            flags |= FunctionNode.IS_PROGRAM;
+        }
+        if (isStrictMode) {
+            flags |= FunctionNode.IS_STRICT;
+        }
 
         // Start new block.
-        final FunctionNode functionBlock = new FunctionNode(source, token, Token.descPosition(token), namespace, ident, name);
-        if(parentFunction == null) {
-            functionBlock.setProgram();
-        }
-        functionBlock.setStrictMode(isStrictMode);
-        functionBlock.setState(errors.hasErrors() ? CompilationState.PARSE_ERROR : CompilationState.PARSED);
-        lexicalContext.push(functionBlock);
-
-        return functionBlock;
+        FunctionNode functionNode =
+            new FunctionNode(
+                source,
+                token,
+                Token.descPosition(token),
+                startToken,
+                namespace,
+                ident,
+                name,
+                parameters,
+                kind,
+                flags);
+
+        functionNode = functionNode.setState(lc, errors.hasErrors() ? CompilationState.PARSE_ERROR : CompilationState.PARSED);
+        lc.push(functionNode);
+        // Create new block, and just put it on the context stack, restoreFunctionNode() will associate it with the
+        // FunctionNode.
+        newBlock();
+        return functionNode;
     }
 
     /**
      * Restore the current block.
      */
-    private void restoreBlock(Block block) {
-        lexicalContext.pop(block);
+    private Block restoreBlock(final Block block) {
+        return lc.pop(block);//.setFlag(lc, flags);
+    }
+
+    private FunctionNode restoreFunctionNode(final FunctionNode functionNode, final long lastToken) {
+        final Block newBody = restoreBlock(lc.getFunctionBody(functionNode));
+
+        return lc.pop(functionNode).setBody(lc, newBody).setLastToken(lc, lastToken);
     }
 
     /**
@@ -323,23 +347,17 @@
      */
     private Block getBlock(final boolean needsBraces) {
         // Set up new block. Captures LBRACE.
-        final Block newBlock = newBlock();
+        Block newBlock = newBlock();
         try {
-            pushControlNode(newBlock);
-
             // Block opening brace.
             if (needsBraces) {
                 expect(LBRACE);
             }
-
-            try {
-                // Accumulate block statements.
-                statementList();
-            } finally {
-                popControlNode();
-            }
+            // Accumulate block statements.
+            statementList();
+
         } finally {
-            restoreBlock(newBlock);
+            newBlock = restoreBlock(newBlock);
         }
 
         final int possibleEnd = Token.descPosition(token) + Token.descLength(token);
@@ -363,15 +381,12 @@
             return getBlock(true);
         }
         // Set up new block. Captures first token.
-        final Block newBlock = newBlock();
-
+        Block newBlock = newBlock();
         try {
-            // Accumulate statements.
             statement();
         } finally {
-            restoreBlock(newBlock);
+            newBlock = restoreBlock(newBlock);
         }
-
         return newBlock;
     }
 
@@ -382,11 +397,8 @@
     private void detectSpecialFunction(final IdentNode ident) {
         final String name = ident.getName();
 
-        if (EVAL.tag().equals(name)) {
-            final Iterator<FunctionNode> it = lexicalContext.getFunctions();
-            if(it.hasNext()) {
-                it.next().setHasEval(it);
-            }
+        if (EVAL.symbolName().equals(name)) {
+            markEval(lc);
         }
     }
 
@@ -397,8 +409,8 @@
     private void detectSpecialProperty(final IdentNode ident) {
         final String name = ident.getName();
 
-        if (ARGUMENTS.tag().equals(name)) {
-            getFunction().setUsesArguments();
+        if (ARGUMENTS.symbolName().equals(name)) {
+            lc.setFlag(lc.getCurrentFunction(), FunctionNode.USES_ARGUMENTS);
         }
     }
 
@@ -439,7 +451,7 @@
                   lhs instanceof IndexNode ||
                   lhs instanceof IdentNode)) {
                 if (env._early_lvalue_error) {
-                    error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
+                    throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
                 }
                 return referenceError(lhs, rhs);
             }
@@ -469,144 +481,14 @@
      * @return           Reduced expression.
      */
     private Node incDecExpression(final long firstToken, final TokenType tokenType, final Node expression, final boolean isPostfix) {
-        long incDecToken = firstToken;
         if (isPostfix) {
-            incDecToken = Token.recast(incDecToken, tokenType == DECPREFIX ? DECPOSTFIX : INCPOSTFIX);
-        }
-
-        final UnaryNode node = new UnaryNode(source, incDecToken, expression);
-        if (isPostfix) {
-            node.setStart(expression.getStart());
-            node.setFinish(Token.descPosition(incDecToken) + Token.descLength(incDecToken));
-        }
-
-        return node;
-    }
-
-    /**
-     * Find a label node in the label stack.
-     * @param ident Ident to find.
-     * @return null or the found label node.
-     */
-    private LabelNode findLabel(final IdentNode ident) {
-        for (final LabelNode labelNode : getFunction().getLabelStack()) {
-            if (labelNode.getLabel().equals(ident)) {
-                return labelNode;
-            }
+            return new UnaryNode(source, Token.recast(firstToken, tokenType == DECPREFIX ? DECPOSTFIX : INCPOSTFIX), expression.getStart(), Token.descPosition(firstToken) + Token.descLength(firstToken), expression);
         }
 
-        return null;
-    }
-
-    /**
-     * Add a label to the label stack.
-     * @param labelNode Label to add.
-     */
-    private void pushLabel(final LabelNode labelNode) {
-        getFunction().getLabelStack().push(labelNode);
-    }
-
-    /**
-      * Remove a label from the label stack.
-      */
-    private void popLabel() {
-        getFunction().getLabelStack().pop();
-    }
-
-    /**
-     * Track the current nesting of controls for break and continue.
-     * @param node For, while, do or switch node.
-     */
-    private void pushControlNode(final Node node) {
-        final boolean isLoop = node instanceof WhileNode;
-        final boolean isBreakable = node instanceof BreakableNode || node instanceof Block;
-        final FunctionNode function = getFunction();
-        function.getControlStack().push(node);
-
-        for (final LabelNode labelNode : function.getLabelStack()) {
-            if (isBreakable && labelNode.getBreakNode() == null) {
-                labelNode.setBreakNode(node);
-            }
-
-            if (isLoop && labelNode.getContinueNode() == null) {
-                labelNode.setContinueNode(node);
-            }
-        }
+        return new UnaryNode(source, firstToken, expression);
     }
 
     /**
-     * Finish with control.
-     */
-    private void popControlNode() {
-        // Get control stack.
-        final Stack<Node> controlStack = getFunction().getControlStack();
-
-        // Can be empty if missing brace.
-        if (!controlStack.isEmpty()) {
-            controlStack.pop();
-        }
-    }
-
-    private void popControlNode(final Node node) {
-        // Get control stack.
-        final Stack<Node> controlStack = getFunction().getControlStack();
-
-        // Can be empty if missing brace.
-        if (!controlStack.isEmpty() && controlStack.peek() == node) {
-            controlStack.pop();
-        }
-    }
-
-    private boolean isInWithBlock() {
-        final Stack<Node> controlStack = getFunction().getControlStack();
-        for (int i = controlStack.size() - 1; i >= 0; i--) {
-            final Node node = controlStack.get(i);
-
-            if (node instanceof WithNode) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    private <T extends Node> T findControl(final Class<T> ctype) {
-        final Stack<Node> controlStack = getFunction().getControlStack();
-        for (int i = controlStack.size() - 1; i >= 0; i--) {
-            final Node node = controlStack.get(i);
-
-            if (ctype.isAssignableFrom(node.getClass())) {
-                return ctype.cast(node);
-            }
-        }
-
-        return null;
-    }
-
-    private <T extends Node> List<T> findControls(final Class<T> ctype, final Node to) {
-        final List<T> nodes = new ArrayList<>();
-        final Stack<Node> controlStack = getFunction().getControlStack();
-        for (int i = controlStack.size() - 1; i >= 0; i--) {
-            final Node node = controlStack.get(i);
-
-            if (to == node) {
-                break; //stop looking
-            }
-
-            if (ctype.isAssignableFrom(node.getClass())) {
-                nodes.add(ctype.cast(node));
-            }
-        }
-
-        return nodes;
-    }
-
-    private <T extends Node> int countControls(final Class<T> ctype, final Node to) {
-        return findControls(ctype, to).size();
-    }
-
-
-    /**
      * -----------------------------------------------------------------------
      *
      * Grammar based on
@@ -630,18 +512,23 @@
         final long functionToken = Token.toDesc(FUNCTION, 0, source.getLength());
         // Set up the script to append elements.
 
-        final FunctionNode script = newFunctionBlock(new IdentNode(source, functionToken, Token.descPosition(functionToken), scriptName));
-
-        script.setKind(FunctionNode.Kind.SCRIPT);
-        script.setFirstToken(functionToken);
+        FunctionNode script = newFunctionNode(
+            functionToken,
+            new IdentNode(source, functionToken, Token.descPosition(functionToken), scriptName),
+            new ArrayList<IdentNode>(),
+            FunctionNode.Kind.SCRIPT);
+
         functionDeclarations = new ArrayList<>();
         sourceElements();
-        script.prependStatements(functionDeclarations);
+        addFunctionDeclarations(script);
         functionDeclarations = null;
+
         expect(EOF);
-        script.setLastToken(token);
+
         script.setFinish(source.getLength() - 1);
 
+        script = restoreFunctionNode(script, token); //commit code
+        script = script.setBody(lc, script.getBody().setNeedsScope(lc));
         return script;
     }
 
@@ -670,24 +557,6 @@
     }
 
     /**
-     * Return last node in a statement list.
-     *
-     * @param statements Statement list.
-     *
-     * @return Last (non-debug) statement or null if empty block.
-     */
-    private static Node lastStatement(final List<Node> statements) {
-        for (int lastIndex = statements.size() - 1; lastIndex >= 0; lastIndex--) {
-            final Node node = statements.get(lastIndex);
-            if (!node.isDebug()) {
-                return node;
-            }
-        }
-
-        return null;
-    }
-
-    /**
      * SourceElements :
      *      SourceElement
      *      SourceElements SourceElement
@@ -716,7 +585,7 @@
                     // check for directive prologues
                     if (checkDirective) {
                         // skip any debug statement like line number to get actual first line
-                        final Node lastStatement = lastStatement(getBlock().getStatements());
+                        final Node lastStatement = lc.getLastStatement();
 
                         // get directive prologue, if any
                         final String directive = getDirective(lastStatement);
@@ -736,8 +605,8 @@
                             // handle use strict directive
                             if ("use strict".equals(directive)) {
                                 isStrictMode = true;
-                                final FunctionNode function = getFunction();
-                                function.setStrictMode(true);
+                                final FunctionNode function = lc.getCurrentFunction();
+                                lc.setFlag(lc.getCurrentFunction(), FunctionNode.IS_STRICT);
 
                                 // We don't need to check these, if lexical environment is already strict
                                 if (!oldStrictMode && directiveStmts != null) {
@@ -759,7 +628,7 @@
                         }
                     }
                 } catch (final Exception e) {
-                    // Recover parsing.
+                    //recover parsing
                     recover(e);
                 }
 
@@ -806,14 +675,13 @@
         if (type == FUNCTION) {
             // As per spec (ECMA section 12), function declarations as arbitrary statement
             // is not "portable". Implementation can issue a warning or disallow the same.
-            if (isStrictMode && !topLevel) {
-                error(AbstractParser.message("strict.no.func.here"), token);
-            }
             functionExpression(true, topLevel);
             return;
         }
 
-        getBlock().addStatement(lineNumberNode);
+        if (lineNumberNode != null) {
+            appendStatement(lineNumberNode);
+        }
 
         switch (type) {
         case LBRACE:
@@ -893,13 +761,9 @@
      * Parse a statement block.
      */
     private void block() {
-        // Get statements in block.
         final Block newBlock = getBlock(true);
-
         // Force block execution.
-        final ExecuteNode executeNode = new ExecuteNode(source, newBlock.getToken(), finish, newBlock);
-
-        getBlock().addStatement(executeNode);
+        appendStatement(new ExecuteNode(source, newBlock.getToken(), finish, newBlock));
     }
 
     /**
@@ -942,7 +806,7 @@
             switch (ident.getName()) {
             case "eval":
             case "arguments":
-                error(AbstractParser.message("strict.name", ident.getName(), contextString), ident.getToken());
+                throw error(AbstractParser.message("strict.name", ident.getName(), contextString), ident.getToken());
             default:
                 break;
             }
@@ -995,8 +859,7 @@
             // Allocate var node.
             final VarNode var = new VarNode(source, varToken, finish, name, init);
             vars.add(var);
-            // Add to current block.
-            getBlock().addStatement(var);
+            appendStatement(var);
 
             if (type != COMMARIGHT) {
                 break;
@@ -1009,7 +872,7 @@
             boolean semicolon = type == SEMICOLON;
             endOfLine();
             if (semicolon) {
-                getBlock().setFinish(finish);
+                lc.getCurrentBlock().setFinish(finish);
             }
         }
 
@@ -1026,8 +889,7 @@
      */
     private void emptyStatement() {
         if (env._empty_statements) {
-            getBlock().addStatement(new EmptyNode(source, token,
-                    Token.descPosition(token) + Token.descLength(token)));
+            appendStatement(new EmptyNode(source, token, Token.descPosition(token) + Token.descLength(token)));
         }
 
         // SEMICOLON checked in caller.
@@ -1052,7 +914,7 @@
         ExecuteNode executeNode = null;
         if (expression != null) {
             executeNode = new ExecuteNode(source, expressionToken, finish, expression);
-            getBlock().addStatement(executeNode);
+            appendStatement(executeNode);
         } else {
             expect(null);
         }
@@ -1061,7 +923,7 @@
 
         if (executeNode != null) {
             executeNode.setFinish(finish);
-            getBlock().setFinish(finish);
+            lc.getCurrentBlock().setFinish(finish);
         }
     }
 
@@ -1081,29 +943,17 @@
         next();
 
         expect(LPAREN);
-
-        // Get the test expression.
         final Node test = expression();
-
         expect(RPAREN);
-
-        // Get the pass statement.
         final Block pass = getStatement();
 
-        // Assume no else.
         Block fail = null;
-
         if (type == ELSE) {
             next();
-
-            // Get the else block.
             fail = getStatement();
         }
 
-        // Construct and add new if node.
-        final IfNode ifNode = new IfNode(source, ifToken, fail != null ? fail.getFinish() : pass.getFinish(), test, pass, fail);
-
-        getBlock().addStatement(ifNode);
+        appendStatement(new IfNode(source, ifToken, fail != null ? fail.getFinish() : pass.getFinish(), test, pass, fail));
     }
 
     /**
@@ -1120,12 +970,12 @@
      */
     private void forStatement() {
         // Create FOR node, capturing FOR token.
-        final ForNode forNode = new ForNode(source, token, Token.descPosition(token));
-
-        pushControlNode(forNode);
+        ForNode forNode = new ForNode(source, token, Token.descPosition(token), null, null, null, null, ForNode.IS_FOR);
+
 
         // Set up new block for scope of vars. Captures first token.
-        final Block outer = newBlock();
+        Block outer = newBlock();
+        lc.push(forNode);
 
         try {
             // FOR tested in caller.
@@ -1134,31 +984,97 @@
             // Nashorn extension: for each expression.
             // iterate property values rather than property names.
             if (!env._no_syntax_extensions && type == IDENT && "each".equals(getValue())) {
-                forNode.setIsForEach();
+                forNode = forNode.setIsForEach(lc);
                 next();
             }
 
             expect(LPAREN);
 
-            /// Capture control information.
-            forControl(forNode);
+            List<VarNode> vars = null;
+
+            switch (type) {
+            case VAR:
+                // Var statements captured in for outer block.
+                vars = variableStatement(false);
+                break;
+            case SEMICOLON:
+                break;
+            default:
+                final Node expression = expression(unaryExpression(), COMMARIGHT.getPrecedence(), true);
+                forNode = forNode.setInit(lc, expression);
+                break;
+            }
+
+            switch (type) {
+            case SEMICOLON:
+                // for (init; test; modify)
+                expect(SEMICOLON);
+                if (type != SEMICOLON) {
+                    forNode = forNode.setTest(lc, expression());
+                }
+                expect(SEMICOLON);
+                if (type != RPAREN) {
+                    forNode = forNode.setModify(lc, expression());
+                }
+                break;
+
+            case IN:
+                forNode = forNode.setIsForIn(lc);
+                if (vars != null) {
+                    // for (var i in obj)
+                    if (vars.size() == 1) {
+                        forNode = forNode.setInit(lc, new IdentNode(vars.get(0).getName()));
+                    } else {
+                        // for (var i, j in obj) is invalid
+                        throw error(AbstractParser.message("many.vars.in.for.in.loop"), vars.get(1).getToken());
+                    }
+
+                } else {
+                    // for (expr in obj)
+                    final Node init = forNode.getInit();
+                    assert init != null : "for..in init expression can not be null here";
+
+                    // check if initial expression is a valid L-value
+                    if (!(init instanceof AccessNode ||
+                          init instanceof IndexNode ||
+                          init instanceof IdentNode)) {
+                        throw error(AbstractParser.message("not.lvalue.for.in.loop"), init.getToken());
+                    }
+
+                    if (init instanceof IdentNode) {
+                        if (!checkIdentLValue((IdentNode)init)) {
+                            throw error(AbstractParser.message("not.lvalue.for.in.loop"), init.getToken());
+                        }
+                        verifyStrictIdent((IdentNode)init, "for-in iterator");
+                    }
+                }
+
+                next();
+
+                // Get the collection expression.
+                forNode = forNode.setModify(lc, expression());
+                break;
+
+            default:
+                expect(SEMICOLON);
+                break;
+            }
 
             expect(RPAREN);
 
             // Set the for body.
             final Block body = getStatement();
-            forNode.setBody(body);
+            forNode = forNode.setBody(lc, body);
             forNode.setFinish(body.getFinish());
             outer.setFinish(body.getFinish());
 
-            // Add for to current block.
-            getBlock().addStatement(forNode);
+            appendStatement(forNode);
         } finally {
-            restoreBlock(outer);
-            popControlNode();
+            lc.pop(forNode);
+            outer = restoreBlock(outer);
         }
 
-        getBlock().addStatement(new ExecuteNode(source, outer.getToken(), outer.getFinish(), outer));
+        appendStatement(new ExecuteNode(source, outer.getToken(), outer.getFinish(), outer));
      }
 
     /**
@@ -1175,87 +1091,7 @@
      * comprehensions.
      * @param forNode Owning FOR.
      */
-    private void forControl(final ForNode forNode) {
-        List<VarNode> vars = null;
-
-        switch (type) {
-        case VAR:
-            // Var statements captured in for outer block.
-            vars = variableStatement(false);
-            break;
-
-        case SEMICOLON:
-            break;
-
-        default:
-            final Node expression = expression(unaryExpression(), COMMARIGHT.getPrecedence(), true);
-            forNode.setInit(expression);
-        }
-
-        switch (type) {
-        case SEMICOLON:
-            // for (init; test; modify)
-            expect(SEMICOLON);
-
-            // Get the test expression.
-            if (type != SEMICOLON) {
-                forNode.setTest(expression());
-            }
-
-            expect(SEMICOLON);
-
-            // Get the modify expression.
-            if (type != RPAREN) {
-                final Node expression = expression();
-                forNode.setModify(expression);
-            }
-
-            break;
-
-        case IN:
-            forNode.setIsForIn();
-
-            if (vars != null) {
-                // for (var i in obj)
-                if (vars.size() == 1) {
-                    forNode.setInit(new IdentNode(vars.get(0).getName()));
-                } else {
-                    // for (var i, j in obj) is invalid
-                    error(AbstractParser.message("many.vars.in.for.in.loop"), vars.get(1).getToken());
-                }
-
-            } else {
-                // for (expr in obj)
-                final Node init = forNode.getInit();
-                assert init != null : "for..in init expression can not be null here";
-
-                // check if initial expression is a valid L-value
-                if (!(init instanceof AccessNode ||
-                      init instanceof IndexNode ||
-                      init instanceof IdentNode)) {
-                    error(AbstractParser.message("not.lvalue.for.in.loop"), init.getToken());
-                }
-
-                if (init instanceof IdentNode) {
-                    if (!checkIdentLValue((IdentNode)init)) {
-                        error(AbstractParser.message("not.lvalue.for.in.loop"), init.getToken());
-                    }
-                    verifyStrictIdent((IdentNode)init, "for-in iterator");
-                }
-            }
-
-            next();
-
-            // Get the collection expression.
-            forNode.setModify(expression());
-            break;
-
-        default:
-            expect(SEMICOLON);
-            break;
-        }
-
-    }
+
 
     /**
      * ...IterationStatement :
@@ -1274,27 +1110,17 @@
         next();
 
         // Construct WHILE node.
-        final WhileNode whileNode = new WhileNode(source, whileToken, Token.descPosition(whileToken));
-        pushControlNode(whileNode);
+        WhileNode whileNode = new WhileNode(source, whileToken, Token.descPosition(whileToken), false);
+        lc.push(whileNode);
 
         try {
             expect(LPAREN);
-
-            // Get the test expression.
-            final Node test = expression();
-            whileNode.setTest(test);
-
+            whileNode = whileNode.setTest(lc, expression());
             expect(RPAREN);
-
-            // Get WHILE body.
-            final Block statements = getStatement();
-            whileNode.setBody(statements);
-            whileNode.setFinish(statements.getFinish());
-
-            // Add WHILE node.
-            getBlock().addStatement(whileNode);
+            whileNode = whileNode.setBody(lc, getStatement());
+            appendStatement(whileNode);
         } finally {
-            popControlNode();
+            lc.pop(whileNode);
         }
     }
 
@@ -1314,34 +1140,25 @@
         // DO tested in the caller.
         next();
 
-        final WhileNode doWhileNode = new DoWhileNode(source, doToken, Token.descPosition(doToken));
-        pushControlNode(doWhileNode);
+        WhileNode doWhileNode = new WhileNode(source, doToken, Token.descPosition(doToken), true);
+        lc.push(doWhileNode);
 
         try {
            // Get DO body.
-            final Block statements = getStatement();
-            doWhileNode.setBody(statements);
+            doWhileNode = doWhileNode.setBody(lc, getStatement());
 
             expect(WHILE);
-
             expect(LPAREN);
-
-            // Get the test expression.
-            final Node test = expression();
-            doWhileNode.setTest(test);
-
+            doWhileNode = doWhileNode.setTest(lc, expression());
             expect(RPAREN);
 
             if (type == SEMICOLON) {
                 endOfLine();
             }
-
             doWhileNode.setFinish(finish);
-
-            // Add DO node.
-            getBlock().addStatement(doWhileNode);
+            appendStatement(doWhileNode);
         } finally {
-            popControlNode();
+            lc.pop(doWhileNode);
         }
     }
 
@@ -1370,28 +1187,26 @@
 
         default:
             final IdentNode ident = getIdent();
-            labelNode = findLabel(ident);
+            labelNode = lc.findLabel(ident.getName());
 
             if (labelNode == null) {
-                error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
+                throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
             }
 
             break;
         }
 
-        final Node targetNode = labelNode != null ? labelNode.getContinueNode() : findControl(WhileNode.class);
+        final IdentNode label = labelNode == null ? null : labelNode.getLabel();
+        final LoopNode targetNode = lc.getContinueTo(label);
 
         if (targetNode == null) {
-            error(AbstractParser.message("illegal.continue.stmt"), continueToken);
+            throw error(AbstractParser.message("illegal.continue.stmt"), continueToken);
         }
 
         endOfLine();
 
         // Construct and add CONTINUE node.
-        final ContinueNode continueNode = new ContinueNode(source, continueToken, finish, labelNode, targetNode, findControl(TryNode.class));
-        continueNode.setScopeNestingLevel(countControls(WithNode.class, targetNode));
-
-        getBlock().addStatement(continueNode);
+        appendStatement(new ContinueNode(source, continueToken, finish, label == null ? null : new IdentNode(label)));
     }
 
     /**
@@ -1418,28 +1233,27 @@
 
         default:
             final IdentNode ident = getIdent();
-            labelNode = findLabel(ident);
+            labelNode = lc.findLabel(ident.getName());
 
             if (labelNode == null) {
-                error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
+                throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken());
             }
 
             break;
         }
 
-        final Node targetNode = labelNode != null ? labelNode.getBreakNode() : findControl(BreakableNode.class);
-
+        //either an explicit label - then get its node or just a "break" - get first breakable
+        //targetNode is what we are breaking out from.
+        final IdentNode label = labelNode == null ? null : labelNode.getLabel();
+        final BreakableNode targetNode = lc.getBreakable(label);
         if (targetNode == null) {
-            error(AbstractParser.message("illegal.break.stmt"), breakToken);
+            throw error(AbstractParser.message("illegal.break.stmt"), breakToken);
         }
 
         endOfLine();
 
         // Construct and add BREAK node.
-        final BreakNode breakNode = new BreakNode(source, breakToken, finish, labelNode, targetNode, findControl(TryNode.class));
-        breakNode.setScopeNestingLevel(countControls(WithNode.class, targetNode));
-
-        getBlock().addStatement(breakNode);
+        appendStatement(new BreakNode(source, breakToken, finish, label == null ? null : new IdentNode(label)));
     }
 
     /**
@@ -1452,8 +1266,8 @@
      */
     private void returnStatement() {
         // check for return outside function
-        if (getFunction().getKind() == FunctionNode.Kind.SCRIPT) {
-            error(AbstractParser.message("invalid.return"));
+        if (lc.getCurrentFunction().getKind() == FunctionNode.Kind.SCRIPT) {
+            throw error(AbstractParser.message("invalid.return"));
         }
 
         // Capture RETURN token.
@@ -1478,8 +1292,7 @@
         endOfLine();
 
         // Construct and add RETURN node.
-        final ReturnNode returnNode = new ReturnNode(source, returnToken, finish, expression, findControl(TryNode.class));
-        getBlock().addStatement(returnNode);
+        appendStatement(new ReturnNode(source, returnToken, finish, expression));
     }
 
     /**
@@ -1513,8 +1326,7 @@
         endOfLine();
 
         // Construct and add YIELD node.
-        final ReturnNode yieldNode = new ReturnNode(source, yieldToken, finish, expression, findControl(TryNode.class));
-        getBlock().addStatement(yieldNode);
+        appendStatement(new ReturnNode(source, yieldToken, finish, expression));
     }
 
     /**
@@ -1533,35 +1345,23 @@
 
         // ECMA 12.10.1 strict mode restrictions
         if (isStrictMode) {
-            error(AbstractParser.message("strict.no.with"), withToken);
+            throw error(AbstractParser.message("strict.no.with"), withToken);
         }
 
         // Get WITH expression.
-        final WithNode withNode = new WithNode(source, withToken, finish, null, null);
-        final Iterator<FunctionNode> it = lexicalContext.getFunctions();
-        if(it.hasNext()) {
-            it.next().setHasWith(it);
-        }
+        WithNode withNode = new WithNode(source, withToken, finish);
 
         try {
-            pushControlNode(withNode);
-
+            lc.push(withNode);
             expect(LPAREN);
-
-            final Node expression = expression();
-            withNode.setExpression(expression);
-
+            withNode = withNode.setExpression(lc, expression());
             expect(RPAREN);
-
-            // Get WITH body.
-            final Block statements = getStatement();
-            withNode.setBody(statements);
-            withNode.setFinish(finish);
+            withNode = withNode.setBody(lc, getStatement());
         } finally {
-            popControlNode(withNode);
+            lc.pop(withNode);
         }
 
-        getBlock().addStatement(withNode);
+        appendStatement(withNode);
     }
 
     /**
@@ -1587,22 +1387,17 @@
      * Parse SWITCH statement.
      */
     private void switchStatement() {
-        // Capture SWITCH token.
         final long switchToken = token;
         // SWITCH tested in caller.
         next();
 
         // Create and add switch statement.
-        final SwitchNode switchNode = new SwitchNode(source, switchToken, Token.descPosition(switchToken));
-        pushControlNode(switchNode);
+        SwitchNode switchNode = new SwitchNode(source, switchToken, Token.descPosition(switchToken), null, new ArrayList<CaseNode>(), null);
+        lc.push(switchNode);
 
         try {
             expect(LPAREN);
-
-            // Get switch expression.
-            final Node switchExpression = expression();
-            switchNode.setExpression(switchExpression);
-
+            switchNode = switchNode.setExpression(lc, expression());
             expect(RPAREN);
 
             expect(LBRACE);
@@ -1619,19 +1414,14 @@
                 switch (type) {
                 case CASE:
                     next();
-
-                    // Get case expression.
                     caseExpression = expression();
-
                     break;
 
                 case DEFAULT:
                     if (defaultCase != null) {
-                        error(AbstractParser.message("duplicate.default.in.switch"));
+                        throw error(AbstractParser.message("duplicate.default.in.switch"));
                     }
-
                     next();
-
                     break;
 
                 default:
@@ -1654,16 +1444,13 @@
                 cases.add(caseNode);
             }
 
-            switchNode.setCases(cases);
-            switchNode.setDefaultCase(defaultCase);
-
+            switchNode = switchNode.setCases(lc, cases, defaultCase);
             next();
-
             switchNode.setFinish(finish);
 
-            getBlock().addStatement(switchNode);
+            appendStatement(switchNode);
         } finally {
-            popControlNode();
+            lc.pop(switchNode);
         }
     }
 
@@ -1683,23 +1470,19 @@
 
         expect(COLON);
 
-        if (findLabel(ident) != null) {
-            error(AbstractParser.message("duplicate.label", ident.getName()), labelToken);
+        if (lc.findLabel(ident.getName()) != null) {
+            throw error(AbstractParser.message("duplicate.label", ident.getName()), labelToken);
         }
 
+        LabelNode labelNode = new LabelNode(source, labelToken, finish, ident, null);
         try {
-            // Create and add label.
-            final LabelNode labelNode = new LabelNode(source, labelToken, finish, ident, null);
-            pushLabel(labelNode);
-            // Get and save body.
-            final Block statements = getStatement();
-            labelNode.setBody(statements);
+            lc.push(labelNode);
+            labelNode = labelNode.setBody(lc, getStatement());
             labelNode.setFinish(finish);
-
-            getBlock().addStatement(labelNode);
+            appendStatement(labelNode);
         } finally {
-            // Remove label.
-            popLabel();
+            assert lc.peek() instanceof LabelNode;
+            lc.pop(labelNode);
         }
     }
 
@@ -1732,14 +1515,12 @@
         }
 
         if (expression == null) {
-            error(AbstractParser.message("expected.operand", type.getNameOrType()));
+            throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
         }
 
         endOfLine();
 
-        // Construct and add THROW node.
-        final ThrowNode throwNode = new ThrowNode(source, throwToken, finish, expression, findControl(TryNode.class));
-        getBlock().addStatement(throwNode);
+        appendStatement(new ThrowNode(source, throwToken, finish, expression));
     }
 
     /**
@@ -1766,28 +1547,18 @@
         next();
 
         // Container block needed to act as target for labeled break statements
-        final Block outer = newBlock();
-        pushControlNode(outer);
+        Block outer = newBlock();
 
         // Create try.
-        final TryNode tryNode = new TryNode(source, tryToken, Token.descPosition(tryToken), findControl(TryNode.class));
-        pushControlNode(tryNode);
 
         try {
-            // Get TRY body.
-            final Block tryBody = getBlock(true);
-
-            // Prepare to accumulate catches.
+            final Block       tryBody     = getBlock(true);
             final List<Block> catchBlocks = new ArrayList<>();
 
             while (type == CATCH) {
-                // Capture CATCH token.
                 final long catchToken = token;
                 next();
-
                 expect(LPAREN);
-
-                // Get exception ident.
                 final IdentNode exception = getIdent();
 
                 // ECMA 12.4.1 strict mode restrictions
@@ -1795,28 +1566,23 @@
 
                 // Check for conditional catch.
                 Node ifExpression = null;
-
                 if (type == IF) {
                     next();
-
                     // Get the exception condition.
                     ifExpression = expression();
                 }
 
                 expect(RPAREN);
 
-                final Block catchBlock = newBlock();
+                Block catchBlock = newBlock();
                 try {
-
                     // Get CATCH body.
                     final Block catchBody = getBlock(true);
-
-                    // Create and add catch.
                     final CatchNode catchNode = new CatchNode(source, catchToken, finish, exception, ifExpression, catchBody);
-                    getBlock().addStatement(catchNode);
+                    appendStatement(catchNode);
+                } finally {
+                    catchBlock = restoreBlock(catchBlock);
                     catchBlocks.add(catchBlock);
-                } finally {
-                    restoreBlock(catchBlock);
                 }
 
                 // If unconditional catch then should to be the end.
@@ -1825,38 +1591,32 @@
                 }
             }
 
-            popControlNode();
-
             // Prepare to capture finally statement.
             Block finallyStatements = null;
 
             if (type == FINALLY) {
                 next();
-
-                // Get FINALLY body.
                 finallyStatements = getBlock(true);
             }
 
             // Need at least one catch or a finally.
             if (catchBlocks.isEmpty() && finallyStatements == null) {
-                error(AbstractParser.message("missing.catch.or.finally"), tryToken);
+                throw error(AbstractParser.message("missing.catch.or.finally"), tryToken);
             }
 
-            tryNode.setBody(tryBody);
-            tryNode.setCatchBlocks(catchBlocks);
-            tryNode.setFinallyBody(finallyStatements);
+            final TryNode tryNode = new TryNode(source, tryToken, Token.descPosition(tryToken), tryBody, catchBlocks, finallyStatements);
+            // Add try.
+            assert lc.peek() == outer;
+            appendStatement(tryNode);
+
             tryNode.setFinish(finish);
             outer.setFinish(finish);
 
-            // Add try.
-            outer.addStatement(tryNode);
         } finally {
-            popControlNode(tryNode);
-            restoreBlock(outer);
-            popControlNode(outer);
+            outer = restoreBlock(outer);
         }
 
-        getBlock().addStatement(new ExecuteNode(source, outer.getToken(), outer.getFinish(), outer));
+        appendStatement(new ExecuteNode(source, outer.getToken(), outer.getFinish(), outer));
     }
 
     /**
@@ -1872,11 +1632,8 @@
         final long debuggerToken = token;
         // DEBUGGER tested in caller.
         next();
-
         endOfLine();
-
-        final RuntimeNode runtimeNode = new RuntimeNode(source, debuggerToken, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Node>());
-        getBlock().addStatement(runtimeNode);
+        appendStatement(new RuntimeNode(source, debuggerToken, finish, RuntimeNode.Request.DEBUGGER, new ArrayList<Node>()));
     }
 
     /**
@@ -1912,7 +1669,7 @@
             return ident;
         case OCTAL:
             if (isStrictMode) {
-               error(AbstractParser.message("strict.no.octal"), token);
+               throw error(AbstractParser.message("strict.no.octal"), token);
             }
         case STRING:
         case ESCSTRING:
@@ -2036,7 +1793,7 @@
 
             default:
                 if (!elision) {
-                    error(AbstractParser.message("expected.comma", type.getNameOrType()));
+                    throw error(AbstractParser.message("expected.comma", type.getNameOrType()));
                 }
                 // Add expression element.
                 final Node expression = assignmentExpression(false);
@@ -2077,8 +1834,8 @@
 
         // Object context.
         // Prepare to accumulate elements.
-        final List<Node> elements = new ArrayList<>();
-        final Map<Object, PropertyNode> map = new HashMap<>();
+       // final List<Node> elements = new ArrayList<>();
+        final Map<String, PropertyNode> map = new LinkedHashMap<>();
 
         // Create a block for the object literal.
             boolean commaSeen = true;
@@ -2096,25 +1853,30 @@
 
                 default:
                     if (!commaSeen) {
-                        error(AbstractParser.message("expected.comma", type.getNameOrType()));
-                }
-
-                commaSeen = false;
-                // Get and add the next property.
-                final PropertyNode property = propertyAssignment();
-                final Object key = property.getKeyName();
-                final PropertyNode existingProperty = map.get(key);
-
-                if (existingProperty != null) {
+                        throw error(AbstractParser.message("expected.comma", type.getNameOrType()));
+                    }
+
+                    commaSeen = false;
+                    // Get and add the next property.
+                    final PropertyNode property = propertyAssignment();
+                    final String key = property.getKeyName();
+                    final PropertyNode existingProperty = map.get(key);
+
+                    if (existingProperty == null) {
+                        map.put(key, property);
+                       // elements.add(property);
+                        break;
+                    }
+
                     // ECMA section 11.1.5 Object Initialiser
                     // point # 4 on property assignment production
-                    final Node value  = property.getValue();
-                    final Node getter = property.getGetter();
-                    final Node setter = property.getSetter();
-
-                    final Node prevValue  = existingProperty.getValue();
-                    final Node prevGetter = existingProperty.getGetter();
-                    final Node prevSetter = existingProperty.getSetter();
+                    final Node         value  = property.getValue();
+                    final FunctionNode getter = property.getGetter();
+                    final FunctionNode setter = property.getSetter();
+
+                    final Node         prevValue  = existingProperty.getValue();
+                    final FunctionNode prevGetter = existingProperty.getGetter();
+                    final FunctionNode prevSetter = existingProperty.getSetter();
 
                     boolean redefinitionOk = true;
                     // ECMA 11.1.5 strict mode restrictions
@@ -2125,7 +1887,7 @@
                     }
 
                     final boolean isPrevAccessor = prevGetter != null || prevSetter != null;
-                    final boolean isAccessor = getter != null || setter != null;
+                    final boolean isAccessor     = getter != null     || setter != null;
 
                     // data property redefined as accessor property
                     if (prevValue != null && isAccessor) {
@@ -2145,40 +1907,33 @@
                     }
 
                     if (!redefinitionOk) {
-                        error(AbstractParser.message("property.redefinition", key.toString()), property.getToken());
+                        throw error(AbstractParser.message("property.redefinition", key.toString()), property.getToken());
                     }
 
+                    PropertyNode newProperty = existingProperty;
                     if (value != null) {
-                        final Node existingValue = existingProperty.getValue();
-
-                        if (existingValue == null) {
-                            existingProperty.setValue(value);
+                        if (prevValue == null) {
+                            map.put(key, newProperty = newProperty.setValue(value));
                         } else {
-                            final long propertyToken = Token.recast(existingProperty.getToken(), COMMARIGHT);
-                            existingProperty.setValue(new BinaryNode(source, propertyToken, existingValue, value));
+                            final long propertyToken = Token.recast(newProperty.getToken(), COMMARIGHT);
+                            map.put(key, newProperty = newProperty.setValue(new BinaryNode(source, propertyToken, prevValue, value)));
                         }
 
-                        existingProperty.setGetter(null);
-                        existingProperty.setSetter(null);
+                        map.put(key, newProperty = newProperty.setGetter(null).setSetter(null));
                     }
 
                     if (getter != null) {
-                        existingProperty.setGetter(getter);
+                        map.put(key, newProperty = newProperty.setGetter(getter));
                     }
 
                     if (setter != null) {
-                        existingProperty.setSetter(setter);
+                        map.put(key, newProperty = newProperty.setSetter(setter));
                     }
-                } else {
-                    map.put(key, property);
-                    elements.add(property);
-                }
-
-                break;
+                    break;
             }
         }
 
-        return new ObjectNode(source, objectToken, finish, elements);
+        return new ObjectNode(source, objectToken, finish, new ArrayList<Node>(map.values()));
     }
 
     /**
@@ -2198,7 +1953,7 @@
             return getIdent();
         case OCTAL:
             if (isStrictMode) {
-                error(AbstractParser.message("strict.no.octal"), token);
+                throw error(AbstractParser.message("strict.no.octal"), token);
             }
         case STRING:
         case ESCSTRING:
@@ -2235,8 +1990,6 @@
         final long propertyToken = token;
 
         FunctionNode functionNode;
-        List<IdentNode> parameters;
-        PropertyNode propertyNode;
         PropertyKey propertyName;
 
         if (type == IDENT) {
@@ -2253,11 +2006,8 @@
                     final IdentNode getNameNode = new IdentNode(source, ((Node)getIdent).getToken(), finish, "get " + getterName);
                     expect(LPAREN);
                     expect(RPAREN);
-                    parameters = new ArrayList<>();
-                    functionNode = functionBody(getSetToken, getNameNode, parameters, FunctionNode.Kind.GETTER);
-                    propertyNode = new PropertyNode(source, propertyToken, finish, getIdent, null);
-                    propertyNode.setGetter(functionNode);
-                    return propertyNode;
+                    functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER);
+                    return new PropertyNode(source, propertyToken, finish, getIdent, null, functionNode, null);
 
                 case "set":
                     final PropertyKey setIdent = propertyName();
@@ -2267,12 +2017,10 @@
                     final IdentNode argIdent = getIdent();
                     verifyStrictIdent(argIdent, "setter argument");
                     expect(RPAREN);
-                    parameters = new ArrayList<>();
+                    List<IdentNode> parameters = new ArrayList<>();
                     parameters.add(argIdent);
                     functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER);
-                    propertyNode = new PropertyNode(source, propertyToken, finish, setIdent, null);
-                    propertyNode.setSetter(functionNode);
-                    return propertyNode;
+                    return new PropertyNode(source, propertyToken, finish, setIdent, null, null, functionNode);
 
                 default:
                     break;
@@ -2286,9 +2034,7 @@
 
         expect(COLON);
 
-        final Node value = assignmentExpression(false);
-        propertyNode =  new PropertyNode(source, propertyToken, finish, propertyName, value);
-        return propertyNode;
+        return new PropertyNode(source, propertyToken, finish, propertyName, assignmentExpression(false), null, null);
     }
 
     /**
@@ -2321,9 +2067,6 @@
             }
 
             lhs = new CallNode(source, callToken, finish, lhs, arguments);
-            if (isInWithBlock()) {
-                ((CallNode)lhs).setInWithBlock();
-            }
         }
 
 loop:
@@ -2338,9 +2081,6 @@
 
                 // Create call node.
                 lhs = new CallNode(source, callToken, finish, lhs, arguments);
-                if (isInWithBlock()) {
-                    ((CallNode)lhs).setInWithBlock();
-                }
 
                 break;
 
@@ -2420,9 +2160,6 @@
         }
 
         final CallNode callNode = new CallNode(source, constructor.getToken(), finish, constructor, arguments);
-        if (isInWithBlock()) {
-            callNode.setInWithBlock();
-        }
 
         return new UnaryNode(source, newToken, callNode);
     }
@@ -2482,8 +2219,7 @@
 
             case PERIOD:
                 if (lhs == null) {
-                    error(AbstractParser.message("expected.operand", type.getNameOrType()));
-                    return null;
+                    throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
                 }
 
                 next();
@@ -2585,29 +2321,33 @@
         }
 
         expect(LPAREN);
-
         final List<IdentNode> parameters = formalParameterList();
-
         expect(RPAREN);
 
-        final FunctionNode functionNode = functionBody(functionToken, name, parameters, FunctionNode.Kind.NORMAL);
+        FunctionNode functionNode = functionBody(functionToken, name, parameters, FunctionNode.Kind.NORMAL);
 
         if (isStatement) {
-            if(topLevel) {
-                functionNode.setIsDeclared();
+            if (topLevel) {
+                functionNode = functionNode.setFlag(lc, FunctionNode.IS_DECLARED);
+            } else if (isStrictMode) {
+                throw error(JSErrorType.SYNTAX_ERROR, AbstractParser.message("strict.no.func.decl.here"), functionToken);
+            } else if (env._function_statement == ScriptEnvironment.FunctionStatementBehavior.ERROR) {
+                throw error(JSErrorType.SYNTAX_ERROR, AbstractParser.message("no.func.decl.here"), functionToken);
+            } else if (env._function_statement == ScriptEnvironment.FunctionStatementBehavior.WARNING) {
+                warning(JSErrorType.SYNTAX_ERROR, AbstractParser.message("no.func.decl.here.warn"), functionToken);
             }
-            if(ARGUMENTS.tag().equals(name.getName())) {
-                getFunction().setDefinesArguments();
+            if (ARGUMENTS.symbolName().equals(name.getName())) {
+                lc.setFlag(lc.getCurrentFunction(), FunctionNode.DEFINES_ARGUMENTS);
             }
         }
 
         if (isAnonymous) {
-            functionNode.setIsAnonymous();
+            functionNode = functionNode.setFlag(lc, FunctionNode.IS_ANONYMOUS);
         }
 
         final int arity = parameters.size();
 
-        final boolean strict = functionNode.isStrictMode();
+        final boolean strict = functionNode.isStrict();
         if (arity > 1) {
             final HashSet<String> parametersSet = new HashSet<>(arity);
 
@@ -2615,39 +2355,37 @@
                 final IdentNode parameter = parameters.get(i);
                 String parameterName = parameter.getName();
 
-                if (ARGUMENTS.tag().equals(parameterName)) {
-                    functionNode.setDefinesArguments();
+                if (ARGUMENTS.symbolName().equals(parameterName)) {
+                    functionNode = functionNode.setFlag(lc, FunctionNode.DEFINES_ARGUMENTS);
                 }
 
                 if (parametersSet.contains(parameterName)) {
                     // redefinition of parameter name
                     if (strict) {
-                        error(AbstractParser.message("strict.param.redefinition", parameterName), parameter.getToken());
-                    } else {
-                        // rename in non-strict mode
-                        parameterName = functionNode.uniqueName(parameterName);
-                        final long parameterToken = parameter.getToken();
-                        parameters.set(i, new IdentNode(source, parameterToken, Token.descPosition(parameterToken), functionNode.uniqueName(parameterName)));
+                        throw error(AbstractParser.message("strict.param.redefinition", parameterName), parameter.getToken());
                     }
+                    // rename in non-strict mode
+                    parameterName = functionNode.uniqueName(parameterName);
+                    final long parameterToken = parameter.getToken();
+                    parameters.set(i, new IdentNode(source, parameterToken, Token.descPosition(parameterToken), functionNode.uniqueName(parameterName)));
                 }
 
                 parametersSet.add(parameterName);
             }
         } else if (arity == 1) {
-            if (ARGUMENTS.tag().equals(parameters.get(0).getName())) {
-                functionNode.setDefinesArguments();
+            if (ARGUMENTS.symbolName().equals(parameters.get(0).getName())) {
+                functionNode = functionNode.setFlag(lc, FunctionNode.DEFINES_ARGUMENTS);
             }
         }
 
         if (isStatement) {
-            final VarNode varNode = new VarNode(source, functionToken, finish, name, functionNode, true);
-            if(topLevel) {
+            final VarNode varNode = new VarNode(source, functionToken, finish, name, functionNode, VarNode.IS_STATEMENT);
+            if (topLevel) {
                 functionDeclarations.add(lineNumber);
                 functionDeclarations.add(varNode);
             } else {
-                final Block block = getBlock();
-                block.addStatement(lineNumber);
-                block.addStatement(varNode);
+                appendStatement(lineNumber);
+                appendStatement(varNode);
             }
         }
 
@@ -2701,13 +2439,11 @@
      */
     private FunctionNode functionBody(final long firstToken, final IdentNode ident, final List<IdentNode> parameters, final FunctionNode.Kind kind) {
         FunctionNode functionNode = null;
+        long lastToken = 0L;
 
         try {
             // Create a new function block.
-            functionNode = newFunctionBlock(ident);
-            functionNode.setParameters(parameters);
-            functionNode.setKind(kind);
-            functionNode.setFirstToken(firstToken);
+            functionNode = newFunctionNode(firstToken, ident, parameters, kind);
 
             // Nashorn extension: expression closures
             if (!env._no_syntax_extensions && type != LBRACE) {
@@ -2720,14 +2456,12 @@
 
                 // just expression as function body
                 final Node expr = expression();
-
+                assert lc.getCurrentBlock() == lc.getFunctionBody(functionNode);
                 // create a return statement - this creates code in itself and does not need to be
                 // wrapped into an ExecuteNode
-                final ReturnNode  returnNode = new ReturnNode(source, expr.getToken(), finish, expr, null);
-
-                // add the return statement
-                functionNode.addStatement(returnNode);
-                functionNode.setLastToken(token);
+                final ReturnNode returnNode = new ReturnNode(source, expr.getToken(), finish, expr);
+                appendStatement(returnNode);
+                lastToken = token;
                 functionNode.setFinish(Token.descPosition(token) + Token.descLength(token));
 
             } else {
@@ -2738,23 +2472,35 @@
                 functionDeclarations = new ArrayList<>();
                 try {
                     sourceElements();
-                    functionNode.prependStatements(functionDeclarations);
+                    addFunctionDeclarations(functionNode);
                 } finally {
                     functionDeclarations = prevFunctionDecls;
                 }
 
-                functionNode.setLastToken(token);
+                lastToken = token;
                 expect(RBRACE);
                 functionNode.setFinish(finish);
 
             }
         } finally {
-            restoreBlock(functionNode);
+            functionNode = restoreFunctionNode(functionNode, lastToken);
         }
-
         return functionNode;
     }
 
+    private void addFunctionDeclarations(final FunctionNode functionNode) {
+        assert lc.peek() == lc.getFunctionBody(functionNode);
+        VarNode lastDecl = null;
+        for (int i = functionDeclarations.size() - 1; i >= 0; i--) {
+            Node decl = functionDeclarations.get(i);
+            if (lastDecl == null && decl instanceof VarNode) {
+                decl = lastDecl = ((VarNode)decl).setFlag(VarNode.IS_LAST_FUNCTION_DECLARATION);
+                lc.setFlag(functionNode, FunctionNode.HAS_FUNCTION_DECLARATIONS);
+            }
+            prependStatement(decl);
+        }
+    }
+
     private RuntimeNode referenceError(final Node lhs, final Node rhs) {
         final ArrayList<Node> args = new ArrayList<>();
         args.add(lhs);
@@ -2764,9 +2510,7 @@
             args.add(rhs);
         }
         args.add(LiteralNode.newInstance(source, lhs.getToken(), lhs.getFinish(), lhs.toString()));
-        final RuntimeNode runtimeNode = new RuntimeNode(source, lhs.getToken(),
-                      lhs.getFinish(), RuntimeNode.Request.REFERENCE_ERROR, args);
-        return runtimeNode;
+        return new RuntimeNode(source, lhs.getToken(), lhs.getFinish(), RuntimeNode.Request.REFERENCE_ERROR, args);
     }
 
     /*
@@ -2815,19 +2559,7 @@
         case BIT_NOT:
         case NOT:
             next();
-
             final Node expr = unaryExpression();
-
-            /*
-             // Not sure if "delete <ident>" is a compile-time error or a
-             // runtime error in strict mode.
-
-             if (isStrictMode) {
-                 if (unaryTokenType == DELETE && expr instanceof IdentNode) {
-                     error(message("strict.cant.delete.ident", ((IdentNode)expr).getName()), expr.getToken());
-                 }
-             }
-             */
             return new UnaryNode(source, unaryToken, expr);
 
         case INCPREFIX:
@@ -2890,7 +2622,7 @@
         }
 
         if (expression == null) {
-            error(AbstractParser.message("expected.operand", type.getNameOrType()));
+            throw error(AbstractParser.message("expected.operand", type.getNameOrType()));
         }
 
         return expression;
@@ -2992,6 +2724,7 @@
         // Include commas in expression parsing.
         return expression(unaryExpression(), COMMARIGHT.getPrecedence(), false);
     }
+
     private Node expression(final Node exprLhs, final int minPrecedence, final boolean noIn) {
         // Get the precedence of the next operator.
         int precedence = type.getPrecedence();
@@ -3087,11 +2820,26 @@
         return "[JavaScript Parsing]";
     }
 
-    private Block getBlock() {
-        return lexicalContext.getCurrentBlock();
+    private static void markEval(final LexicalContext lc) {
+        final Iterator<FunctionNode> iter = lc.getFunctions();
+        boolean flaggedCurrentFn = false;
+        while (iter.hasNext()) {
+            final FunctionNode fn = iter.next();
+            if (!flaggedCurrentFn) {
+                lc.setFlag(fn, FunctionNode.HAS_EVAL);
+                flaggedCurrentFn = true;
+            } else {
+                lc.setFlag(fn, FunctionNode.HAS_NESTED_EVAL);
+            }
+            lc.setFlag(lc.getFunctionBody(fn), Block.NEEDS_SCOPE);
+        }
     }
 
-    private FunctionNode getFunction() {
-        return lexicalContext.getCurrentFunction();
+    private void prependStatement(final Node statement) {
+        lc.prependStatement(statement);
+    }
+
+    private void appendStatement(final Node statement) {
+        lc.appendStatement(statement);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java	Wed May 08 10:10:05 2013 +0100
@@ -280,6 +280,11 @@
        return values;
     }
 
+    @Override
+    public String toString() {
+        return name;
+    }
+
     static {
         // Avoid cloning of enumeration.
         values = TokenType.values();
--- a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Wed May 08 10:10:05 2013 +0100
@@ -54,10 +54,24 @@
  * @see SpillProperty
  */
 public class AccessorProperty extends Property {
+    private static final MethodHandles.Lookup lookup = MethodHandles.lookup();
     private static final MethodHandle REPLACE_MAP = findOwnMH("replaceMap", Object.class, Object.class, PropertyMap.class, String.class, Class.class, Class.class);
 
     private static final int NOOF_TYPES = getNumberOfAccessorTypes();
 
+    /**
+     * Properties in different maps for the same structure class will share their field getters and setters. This could
+     * be further extended to other method handles that are looked up in the AccessorProperty constructor, but right now
+     * these are the most frequently retrieved ones, and lookup of method handle natives only registers in the profiler
+     * for them.
+     */
+    private static ClassValue<GettersSetters> GETTERS_SETTERS = new ClassValue<GettersSetters>() {
+        @Override
+        protected GettersSetters computeValue(Class<?> structure) {
+            return new GettersSetters(structure);
+        }
+    };
+
     /** Property getter cache */
     private MethodHandle[] getters = new MethodHandle[NOOF_TYPES];
 
@@ -152,6 +166,22 @@
         setCurrentType(getterType);
     }
 
+    private static class GettersSetters {
+        final MethodHandle[] getters;
+        final MethodHandle[] setters;
+
+        public GettersSetters(Class<?> structure) {
+            final int fieldCount = ObjectClassGenerator.getFieldCount(structure);
+            getters = new MethodHandle[fieldCount];
+            setters = new MethodHandle[fieldCount];
+            for(int i = 0; i < fieldCount; ++i) {
+                final String fieldName = ObjectClassGenerator.getFieldName(i, Type.OBJECT);
+                getters[i] = MH.getter(lookup, structure, fieldName, Type.OBJECT.getTypeClass());
+                setters[i] = MH.setter(lookup, structure, fieldName, Type.OBJECT.getTypeClass());
+            }
+        }
+    }
+
     /**
      * Constructor for dual field AccessorPropertys.
      *
@@ -171,22 +201,19 @@
         primitiveGetter = null;
         primitiveSetter = null;
 
-        final MethodHandles.Lookup lookup = MethodHandles.lookup();
-
         if (isParameter() && hasArguments()) {
-            final MethodHandle arguments   = MH.getter(MethodHandles.lookup(), structure, "arguments", Object.class);
+            final MethodHandle arguments   = MH.getter(lookup, structure, "arguments", Object.class);
             final MethodHandle argumentsSO = MH.asType(arguments, arguments.type().changeReturnType(ScriptObject.class));
 
             objectGetter = MH.insertArguments(MH.filterArguments(ScriptObject.GET_ARGUMENT.methodHandle(), 0, argumentsSO), 1, slot);
             objectSetter = MH.insertArguments(MH.filterArguments(ScriptObject.SET_ARGUMENT.methodHandle(), 0, argumentsSO), 1, slot);
         } else {
-            final String fieldNameObject    = ObjectClassGenerator.getFieldName(slot, Type.OBJECT);
-            final String fieldNamePrimitive = ObjectClassGenerator.getFieldName(slot, ObjectClassGenerator.PRIMITIVE_TYPE);
-
-            objectGetter = MH.getter(lookup, structure, fieldNameObject, Type.OBJECT.getTypeClass());
-            objectSetter = MH.setter(lookup, structure, fieldNameObject, Type.OBJECT.getTypeClass());
+            final GettersSetters gs = GETTERS_SETTERS.get(structure);
+            objectGetter = gs.getters[slot];
+            objectSetter = gs.setters[slot];
 
             if (!OBJECT_FIELDS_ONLY) {
+                final String fieldNamePrimitive = ObjectClassGenerator.getFieldName(slot, ObjectClassGenerator.PRIMITIVE_TYPE);
                 primitiveGetter = MH.getter(lookup, structure, fieldNamePrimitive, PRIMITIVE_TYPE.getTypeClass());
                 primitiveSetter = MH.setter(lookup, structure, fieldNamePrimitive, PRIMITIVE_TYPE.getTypeClass());
             }
@@ -365,7 +392,7 @@
     }
 
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        return MH.findStatic(MethodHandles.lookup(), AccessorProperty.class, name, MH.type(rtype, types));
+        return MH.findStatic(lookup, AccessorProperty.class, name, MH.type(rtype, types));
     }
 
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Wed May 08 10:10:05 2013 +0100
@@ -54,10 +54,7 @@
 import jdk.nashorn.internal.ir.debug.ASTWriter;
 import jdk.nashorn.internal.ir.debug.PrintVisitor;
 import jdk.nashorn.internal.parser.Parser;
-import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory;
 import jdk.nashorn.internal.runtime.options.Options;
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
 
 /**
  * This class manages the global state of execution. Context is immutable.
@@ -114,24 +111,9 @@
      * Get the current global scope
      * @return the current global scope
      */
-    @CallerSensitive
     public static ScriptObject getGlobal() {
-        final SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            // skip getCallerClass and getGlobal and get to the real caller
-            Class<?> caller = Reflection.getCallerClass();
-            ClassLoader callerLoader = caller.getClassLoader();
-
-            // Allow this method only for nashorn's own classes, objects
-            // package classes and Java adapter classes. Rest should
-            // have the necessary security permission.
-            if (callerLoader != myLoader &&
-                !(callerLoader instanceof StructureLoader) &&
-                !(JavaAdapterFactory.isAdapterClass(caller))) {
-                sm.checkPermission(new RuntimePermission("nashorn.getGlobal"));
-            }
-        }
-
+        // This class in a package.access protected package.
+        // Trusted code only can call this method.
         return getGlobalTrusted();
     }
 
@@ -399,7 +381,7 @@
             // We need to get strict mode flag from compiled class. This is
             // because eval code may start with "use strict" directive.
             try {
-                strictFlag = clazz.getField(STRICT_MODE.tag()).getBoolean(null);
+                strictFlag = clazz.getField(STRICT_MODE.symbolName()).getBoolean(null);
             } catch (final NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
                 //ignored
                 strictFlag = false;
@@ -432,6 +414,28 @@
         return ScriptRuntime.apply(func, evalThis);
     }
 
+    private Source loadInternal(final String srcStr, final String prefix, final String resourcePath) {
+        if (srcStr.startsWith(prefix)) {
+            final String resource = resourcePath + srcStr.substring(prefix.length());
+            // NOTE: even sandbox scripts should be able to load scripts in nashorn: scheme
+            // These scripts are always available and are loaded from nashorn.jar's resources.
+            return AccessController.doPrivileged(
+                    new PrivilegedAction<Source>() {
+                        @Override
+                        public Source run() {
+                            try {
+                                final URL resURL = Context.class.getResource(resource);
+                                return (resURL != null)? new Source(srcStr, resURL) : null;
+                            } catch (final IOException exp) {
+                                return null;
+                            }
+                        }
+                    });
+        }
+
+        return null;
+    }
+
     /**
      * Implementation of {@code load} Nashorn extension. Load a script file from a source
      * expression
@@ -444,33 +448,18 @@
      * @throws IOException if source cannot be found or loaded
      */
     public Object load(final ScriptObject scope, final Object from) throws IOException {
-        Object src = (from instanceof ConsString)?  from.toString() : from;
+        final Object src = (from instanceof ConsString)?  from.toString() : from;
         Source source = null;
 
         // load accepts a String (which could be a URL or a file name), a File, a URL
         // or a ScriptObject that has "name" and "source" (string valued) properties.
         if (src instanceof String) {
             final String srcStr = (String)src;
-            final File   file   = new File(srcStr);
+            final File file = new File(srcStr);
             if (srcStr.indexOf(':') != -1) {
-                if (srcStr.startsWith("nashorn:")) {
-                    final String resource = "resources/" + srcStr.substring("nashorn:".length());
-                    // NOTE: even sandbox scripts should be able to load scripts in nashorn: scheme
-                    // These scripts are always available and are loaded from nashorn.jar's resources.
-                    source = AccessController.doPrivileged(
-                            new PrivilegedAction<Source>() {
-                                @Override
-                                public Source run() {
-                                    try {
-                                        final URL resURL = Context.class.getResource(resource);
-                                        return (resURL != null)? new Source(srcStr, resURL) : null;
-                                    } catch (final IOException exp) {
-                                        return null;
-                                    }
-                                }
-                            });
-                } else {
-                    URL url = null;
+                if ((source = loadInternal(srcStr, "nashorn:", "resources/")) == null &&
+                    (source = loadInternal(srcStr, "fx:", "resources/fx/")) == null) {
+                    URL url;
                     try {
                         //check for malformed url. if malformed, it may still be a valid file
                         url = new URL(srcStr);
@@ -713,7 +702,7 @@
                 MH.findStatic(
                     MethodHandles.lookup(),
                     script,
-                    RUN_SCRIPT.tag(),
+                    RUN_SCRIPT.symbolName(),
                     MH.type(
                         Object.class,
                         ScriptFunction.class,
@@ -722,13 +711,13 @@
         boolean strict;
 
         try {
-            strict = script.getField(STRICT_MODE.tag()).getBoolean(null);
+            strict = script.getField(STRICT_MODE.symbolName()).getBoolean(null);
         } catch (final NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
             strict = false;
         }
 
         // Package as a JavaScript function and pass function back to shell.
-        return ((GlobalObject)Context.getGlobalTrusted()).newScriptFunction(RUN_SCRIPT.tag(), runMethodHandle, scope, strict);
+        return ((GlobalObject)Context.getGlobalTrusted()).newScriptFunction(RUN_SCRIPT.symbolName(), runMethodHandle, scope, strict);
     }
 
     private ScriptFunction compileScript(final Source source, final ScriptObject scope, final ErrorManager errMan) {
@@ -746,13 +735,13 @@
             global = (GlobalObject)Context.getGlobalTrusted();
             script = global.findCachedClass(source);
             if (script != null) {
-                Compiler.LOG.fine("Code cache hit for " + source + " avoiding recompile.");
+                Compiler.LOG.fine("Code cache hit for ", source, " avoiding recompile.");
                 return script;
             }
         }
 
         final FunctionNode functionNode = new Parser(env, source, errMan, strict).parse();
-        if (errors.hasErrors() || env._parse_only) {
+        if (errors.hasErrors()) {
             return null;
         }
 
@@ -764,6 +753,10 @@
             getErr().println(new PrintVisitor(functionNode));
         }
 
+        if (env._parse_only) {
+            return null;
+        }
+
         final URL          url    = source.getURL();
         final ScriptLoader loader = env._loader_per_compile ? createNewLoader() : scriptLoader;
         final CodeSource   cs     = url == null ? null : new CodeSource(url, (CodeSigner[])null);
--- a/nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java	Wed May 08 10:10:05 2013 +0100
@@ -135,7 +135,16 @@
      * @param str the string to log
      */
     public void finest(final String str) {
-        log(str, Level.FINEST);
+        log(Level.FINEST, str);
+    }
+
+    /**
+     * Shorthand for outputting a log string as log level
+     * {@link java.util.logging.Level#FINEST} on this logger
+     * @param objs object array to log - use this to perform lazy concatenation to avoid unconditional toString overhead
+     */
+    public void finest(final Object... objs) {
+        log(Level.FINEST, objs);
     }
 
     /**
@@ -144,7 +153,16 @@
      * @param str the string to log
      */
     public void finer(final String str) {
-        log(str, Level.FINER);
+        log(Level.FINER, str);
+    }
+
+    /**
+     * Shorthand for outputting a log string as log level
+     * {@link java.util.logging.Level#FINER} on this logger
+     * @param objs object array to log - use this to perform lazy concatenation to avoid unconditional toString overhead
+     */
+    public void finer(final Object... objs) {
+        log(Level.FINER, objs);
     }
 
     /**
@@ -153,7 +171,16 @@
      * @param str the string to log
      */
     public void fine(final String str) {
-        log(str, Level.FINE);
+        log(Level.FINE, str);
+    }
+
+    /**
+     * Shorthand for outputting a log string as log level
+     * {@link java.util.logging.Level#FINE} on this logger
+     * @param objs object array to log - use this to perform lazy concatenation to avoid unconditional toString overhead
+     */
+    public void fine(final Object... objs) {
+        log(Level.FINE, objs);
     }
 
     /**
@@ -162,7 +189,16 @@
      * @param str the string to log
      */
     public void config(final String str) {
-        log(str, Level.CONFIG);
+        log(Level.CONFIG, str);
+    }
+
+    /**
+     * Shorthand for outputting a log string as log level
+     * {@link java.util.logging.Level#CONFIG} on this logger
+     * @param objs object array to log - use this to perform lazy concatenation to avoid unconditional toString overhead
+     */
+    public void config(final Object... objs) {
+        log(Level.CONFIG, objs);
     }
 
     /**
@@ -171,7 +207,16 @@
      * @param str the string to log
      */
     public void info(final String str) {
-        log(str, Level.INFO);
+        log(Level.INFO, str);
+    }
+
+    /**
+     * Shorthand for outputting a log string as log level
+     * {@link java.util.logging.Level#FINE} on this logger
+     * @param objs object array to log - use this to perform lazy concatenation to avoid unconditional toString overhead
+     */
+    public void info(final Object... objs) {
+        log(Level.INFO, objs);
     }
 
     /**
@@ -180,7 +225,16 @@
      * @param str the string to log
      */
     public void warning(final String str) {
-        log(str, Level.WARNING);
+        log(Level.WARNING, str);
+    }
+
+    /**
+     * Shorthand for outputting a log string as log level
+     * {@link java.util.logging.Level#FINE} on this logger
+     * @param objs object array to log - use this to perform lazy concatenation to avoid unconditional toString overhead
+     */
+    public void warning(final Object... objs) {
+        log(Level.WARNING, objs);
     }
 
     /**
@@ -189,20 +243,28 @@
      * @param str the string to log
      */
     public void severe(final String str) {
-        log(str, Level.SEVERE);
+        log(Level.SEVERE, str);
+    }
+
+    /**
+     * Shorthand for outputting a log string as log level
+     * {@link java.util.logging.Level#FINE} on this logger
+     * @param objs object array to log - use this to perform lazy concatenation to avoid unconditional toString overhead
+     */
+    public void severe(final Object... objs) {
+        log(Level.SEVERE, objs);
     }
 
     /**
      * Output log line on this logger at a given level of verbosity
      * @see java.util.logging.Level
      *
+     * @param level minimum log level required for logging to take place
      * @param str   string to log
-     * @param level minimum log level required for logging to take place
      */
-    public void log(final String str, final Level level) {
+    public void log(final Level level, final String str) {
         if (isEnabled) {
             final StringBuilder sb = new StringBuilder();
-
             for (int i = 0 ; i < indent ; i++) {
                 sb.append(' ');
             }
@@ -210,4 +272,24 @@
             logger.log(level, sb.toString());
         }
     }
+
+    /**
+     * Output log line on this logger at a given level of verbosity
+     * @see java.util.logging.Level
+     *
+     * @param level minimum log level required for logging to take place
+     * @param objs  objects for which to invoke toString and concatenate to log
+     */
+    public void log(final Level level, final Object... objs) {
+        if (isEnabled) {
+            final StringBuilder sb = new StringBuilder();
+            for (int i = 0 ; i < indent ; i++) {
+                sb.append(' ');
+            }
+            for (final Object obj : objs) {
+                sb.append(obj);
+            }
+            logger.log(level, sb.toString());
+        }
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java	Wed May 08 10:10:05 2013 +0100
@@ -105,6 +105,22 @@
     }
 
     /**
+     * Return the appropriate receiver for a getter.
+     * @return appropriate receiver
+     */
+    public ScriptObject getGetterReceiver() {
+        return property != null && property.hasGetterFunction() ? self : prototype;
+    }
+
+   /**
+     * Return the appropriate receiver for a setter.
+     * @return appropriate receiver
+     */
+    public ScriptObject getSetterReceiver() {
+        return property != null && property.hasSetterFunction() ? self : prototype;
+    }
+
+    /**
      * Return the property that was found
      * @return property
      */
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Wed May 08 10:10:05 2013 +0100
@@ -105,9 +105,7 @@
     // This is the abstract "Walk" operation from the spec.
     private static Object walk(final ScriptObject holder, final Object name, final ScriptFunction reviver) {
         final Object val = holder.get(name);
-        if (val == ScriptRuntime.UNDEFINED) {
-            return val;
-        } else if (val instanceof ScriptObject) {
+        if (val instanceof ScriptObject) {
             final ScriptObject     valueObj = (ScriptObject)val;
             final boolean          strict   = valueObj.isStrictContext();
             final Iterator<String> iter     = valueObj.propertyIterator();
@@ -122,33 +120,15 @@
                     valueObj.set(key, newElement, strict);
                 }
             }
-
-            return valueObj;
-        } else if (isArray(val)) {
-            final ScriptObject      valueArray = (ScriptObject)val;
-            final boolean          strict     = valueArray.isStrictContext();
-            final Iterator<String> iter       = valueArray.propertyIterator();
-
-            while (iter.hasNext()) {
-                final String key        = iter.next();
-                final Object newElement = walk(valueArray, valueArray.get(key), reviver);
+        }
 
-                if (newElement == ScriptRuntime.UNDEFINED) {
-                    valueArray.delete(key, strict);
-                } else {
-                    valueArray.set(key, newElement, strict);
-                }
-            }
-            return valueArray;
-        } else {
-            try {
-                // Object.class, ScriptFunction.class, ScriptObject.class, String.class, Object.class);
-                return REVIVER_INVOKER.invokeExact(reviver, holder, JSType.toString(name), val);
-            } catch(Error|RuntimeException t) {
-                throw t;
-            } catch(final Throwable t) {
-                throw new RuntimeException(t);
-            }
+        try {
+             // Object.class, ScriptFunction.class, ScriptObject.class, String.class, Object.class);
+             return REVIVER_INVOKER.invokeExact(reviver, holder, JSType.toString(name), val);
+        } catch(Error|RuntimeException t) {
+            throw t;
+        } catch(final Throwable t) {
+            throw new RuntimeException(t);
         }
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Wed May 08 10:10:05 2013 +0100
@@ -102,6 +102,8 @@
     /** JavaScript compliant conversion function from Object to primitive */
     public static final Call TO_PRIMITIVE = staticCall(JSType.class, "toPrimitive", Object.class,  Object.class);
 
+    private static final double INT32_LIMIT = 4294967296.0;
+
     /**
      * The external type name as returned by ECMAScript "typeof" operator
      *
@@ -612,10 +614,7 @@
      * @return an int32
      */
     public static int toInt32(final double num) {
-        if (Double.isInfinite(num)) {
-            return 0;
-        }
-        return (int)(long)num;
+        return (int)doubleToInt32(num);
     }
 
     /**
@@ -658,10 +657,7 @@
      * @return a uint32
      */
     public static long toUint32(final double num) {
-        if (Double.isInfinite(num)) {
-            return 0L;
-        }
-        return ((long)num) & 0xffff_ffffL;
+        return doubleToInt32(num) & MAX_UINT;
     }
 
     /**
@@ -702,10 +698,22 @@
      * @return a uint16
      */
     public static int toUint16(final double num) {
-        if (Double.isInfinite(num)) {
+        return ((int)doubleToInt32(num)) & 0xffff;
+    }
+
+    private static long doubleToInt32(final double num) {
+        final int exponent = Math.getExponent(num);
+        if (exponent < 31) {
+            return (long) num;  // Fits into 32 bits
+        }
+        if (exponent >= 84) {
+            // Either infinite or NaN or so large that shift / modulo will produce 0
+            // (52 bit mantissa + 32 bit target width).
             return 0;
         }
-        return ((int)(long)num) & 0xffff;
+        // This is rather slow and could probably be sped up using bit-fiddling.
+        final double d = (num >= 0) ? Math.floor(num) : Math.ceil(num);
+        return (long)(d % INT32_LIMIT);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Wed May 08 10:10:05 2013 +0100
@@ -170,7 +170,7 @@
         Class<?> javaClass = null;
         try {
             javaClass = context.findClass(fullName);
-        } catch (final ClassNotFoundException e) {
+        } catch (final NoClassDefFoundError | ClassNotFoundException e) {
             //ignored
         }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java	Wed May 08 10:10:05 2013 +0100
@@ -25,20 +25,20 @@
 
 package jdk.nashorn.internal.runtime;
 
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
 
 /**
  * Helper class to manage property listeners and notification.
  */
 public class PropertyListenerManager implements PropertyListener {
 
+    /** property listeners for this object. */
+    private Map<PropertyListener,Boolean> listeners;
+
     // These counters are updated in debug mode
     private static int listenersAdded;
     private static int listenersRemoved;
-    private static int listenersDead;
 
     /**
      * @return the listenersAdded
@@ -54,16 +54,6 @@
         return listenersRemoved;
     }
 
-    /**
-     * @return the listenersDead
-     */
-    public static int getListenersDead() {
-        return listenersDead;
-    }
-
-    /** property listeners for this object. */
-    private List<WeakReference<PropertyListener>> listeners;
-
     // Property listener management methods
 
     /**
@@ -73,12 +63,13 @@
      */
     public final void addPropertyListener(final PropertyListener listener) {
         if (listeners == null) {
-            listeners = new ArrayList<>();
+            listeners = new WeakHashMap<>();
         }
+
         if (Context.DEBUG) {
             listenersAdded++;
         }
-        listeners.add(new WeakReference<>(listener));
+        listeners.put(listener, Boolean.TRUE);
     }
 
     /**
@@ -88,15 +79,10 @@
      */
     public final void removePropertyListener(final PropertyListener listener) {
         if (listeners != null) {
-            final Iterator<WeakReference<PropertyListener>> iter = listeners.iterator();
-            while (iter.hasNext()) {
-                if (iter.next().get() == listener) {
-                    if (Context.DEBUG) {
-                        listenersRemoved++;
-                    }
-                    iter.remove();
-                }
+            if (Context.DEBUG) {
+                listenersRemoved++;
             }
+            listeners.remove(listener);
         }
     }
 
@@ -108,18 +94,8 @@
      */
     protected final void notifyPropertyAdded(final ScriptObject object, final Property prop) {
         if (listeners != null) {
-            final Iterator<WeakReference<PropertyListener>> iter = listeners.iterator();
-            while (iter.hasNext()) {
-                final WeakReference<PropertyListener> weakRef = iter.next();
-                final PropertyListener listener = weakRef.get();
-                if (listener == null) {
-                    if (Context.DEBUG) {
-                        listenersDead++;
-                    }
-                    iter.remove();
-                } else {
-                    listener.propertyAdded(object, prop);
-                }
+            for (PropertyListener listener : listeners.keySet()) {
+                listener.propertyAdded(object, prop);
             }
         }
     }
@@ -132,18 +108,8 @@
      */
     protected final void notifyPropertyDeleted(final ScriptObject object, final Property prop) {
         if (listeners != null) {
-            final Iterator<WeakReference<PropertyListener>> iter = listeners.iterator();
-            while (iter.hasNext()) {
-                final WeakReference<PropertyListener> weakRef = iter.next();
-                final PropertyListener listener = weakRef.get();
-                if (listener == null) {
-                    if (Context.DEBUG) {
-                        listenersDead++;
-                    }
-                    iter.remove();
-                } else {
-                    listener.propertyDeleted(object, prop);
-                }
+            for (PropertyListener listener : listeners.keySet()) {
+                listener.propertyDeleted(object, prop);
             }
         }
     }
@@ -157,18 +123,8 @@
      */
     protected final void notifyPropertyModified(final ScriptObject object, final Property oldProp, final Property newProp) {
         if (listeners != null) {
-            final Iterator<WeakReference<PropertyListener>> iter = listeners.iterator();
-            while (iter.hasNext()) {
-                final WeakReference<PropertyListener> weakRef = iter.next();
-                final PropertyListener listener = weakRef.get();
-                if (listener == null) {
-                    if (Context.DEBUG) {
-                        listenersDead++;
-                    }
-                    iter.remove();
-                } else {
-                    listener.propertyModified(object, oldProp, newProp);
-                }
+            for (PropertyListener listener : listeners.keySet()) {
+                listener.propertyModified(object, oldProp, newProp);
             }
         }
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java	Wed May 08 10:10:05 2013 +0100
@@ -25,10 +25,11 @@
 
 package jdk.nashorn.internal.runtime;
 
+import static jdk.nashorn.internal.lookup.Lookup.MH;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
-
 import jdk.nashorn.internal.codegen.Compiler;
 import jdk.nashorn.internal.codegen.CompilerConstants;
 import jdk.nashorn.internal.codegen.FunctionSignature;
@@ -37,8 +38,6 @@
 import jdk.nashorn.internal.parser.Token;
 import jdk.nashorn.internal.parser.TokenType;
 
-import static jdk.nashorn.internal.lookup.Lookup.MH;
-
 /**
  * This is a subclass that represents a script function that may be regenerated,
  * for example with specialization based on call site types, or lazily generated.
@@ -47,7 +46,7 @@
  */
 public final class RecompilableScriptFunctionData extends ScriptFunctionData {
 
-    private final FunctionNode functionNode;
+    private FunctionNode functionNode;
     private final PropertyMap  allocatorMap;
     private final CodeInstaller<ScriptEnvironment> installer;
     private final String allocatorClassName;
@@ -70,7 +69,7 @@
                 "" :
                 functionNode.getIdent().getName(),
               functionNode.getParameters().size(),
-              functionNode.isStrictMode(),
+              functionNode.isStrict(),
               false,
               true);
 
@@ -129,7 +128,7 @@
 
     private void ensureHasAllocator() throws ClassNotFoundException {
         if (allocator == null && allocatorClassName != null) {
-            this.allocator = MH.findStatic(LOOKUP, Context.forStructureClass(allocatorClassName), CompilerConstants.ALLOCATE.tag(), MH.type(ScriptObject.class, PropertyMap.class));
+            this.allocator = MH.findStatic(LOOKUP, Context.forStructureClass(allocatorClassName), CompilerConstants.ALLOCATE.symbolName(), MH.type(ScriptObject.class, PropertyMap.class));
         }
     }
 
@@ -148,8 +147,11 @@
          // therefore, currently method specialization is disabled. TODO
 
          if (functionNode.isLazy()) {
-             Compiler.LOG.info("Trampoline hit: need to do lazy compilation of '" + functionNode.getName() + "'");
-             new Compiler(installer, functionNode).compile().install();
+             Compiler.LOG.info("Trampoline hit: need to do lazy compilation of '", functionNode.getName(), "'");
+             final Compiler compiler = new Compiler(installer, functionNode);
+             functionNode = compiler.compile();
+             assert !functionNode.isLazy();
+             compiler.install();
 
              // we don't need to update any flags - varArgs and needsCallee are instrincic
              // in the function world we need to get a destination node from the compile instead
@@ -159,7 +161,7 @@
          // we can't get here unless we have bytecode, either from eager compilation or from
          // running a lazy compile on the lines above
 
-         assert functionNode.hasState(CompilationState.INSTALLED);
+         assert functionNode.hasState(CompilationState.EMITTED) : functionNode.getName() + " " + functionNode.getState() + " " + Debug.id(functionNode);
 
          // code exists - look it up and add it into the automatically sorted invoker list
          code.add(
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Wed May 08 10:10:05 2013 +0100
@@ -82,6 +82,36 @@
     /** Show full Nashorn version */
     public final boolean _fullversion;
 
+    /** Launch using as fx application */
+    public final boolean _fx;
+
+    /**
+     * Behavior when encountering a function declaration in a lexical context where only statements are acceptable
+     * (function declarations are source elements, but not statements).
+     */
+    public enum FunctionStatementBehavior {
+        /**
+         * Accept the function declaration silently and treat it as if it were a function expression assigned to a local
+         * variable.
+         */
+        ACCEPT,
+        /**
+         * Log a parser warning, but accept the function declaration and treat it as if it were a function expression
+         * assigned to a local variable.
+         */
+        WARNING,
+        /**
+         * Raise a {@code SyntaxError}.
+         */
+        ERROR
+    }
+
+    /**
+     * Behavior when encountering a function declaration in a lexical context where only statements are acceptable
+     * (function declarations are source elements, but not statements).
+     */
+    public final FunctionStatementBehavior _function_statement;
+
     /** Should lazy compilation take place */
     public final boolean _lazy_compilation;
 
@@ -158,6 +188,14 @@
         _early_lvalue_error   = options.getBoolean("early.lvalue.error");
         _empty_statements     = options.getBoolean("empty.statements");
         _fullversion          = options.getBoolean("fullversion");
+        if(options.getBoolean("function.statement.error")) {
+            _function_statement = FunctionStatementBehavior.ERROR;
+        } else if(options.getBoolean("function.statement.warning")) {
+            _function_statement = FunctionStatementBehavior.WARNING;
+        } else {
+            _function_statement = FunctionStatementBehavior.ACCEPT;
+        }
+        _fx                   = options.getBoolean("fx");
         _lazy_compilation     = options.getBoolean("lazy.compilation");
         _loader_per_compile   = options.getBoolean("loader.per.compile");
         _no_syntax_extensions = options.getBoolean("no.syntax.extensions");
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Wed May 08 10:10:05 2013 +0100
@@ -71,9 +71,6 @@
 
     private static final MethodHandle IS_NONSTRICT_FUNCTION = findOwnMH("isNonStrictFunction", boolean.class, Object.class, Object.class, ScriptFunctionData.class);
 
-    /** Reference to constructor prototype. */
-    protected Object prototype;
-
     /** The parent scope. */
     private final ScriptObject scope;
 
@@ -221,6 +218,7 @@
         final ScriptObject object = data.allocate();
 
         if (object != null) {
+            Object prototype = getPrototype();
             if (prototype instanceof ScriptObject) {
                 object.setProto((ScriptObject)prototype);
             }
@@ -282,24 +280,18 @@
      * Get the prototype object for this function
      * @return prototype
      */
-    public final Object getPrototype() {
-        return prototype;
-    }
+    public abstract Object getPrototype();
 
     /**
      * Set the prototype object for this function
      * @param prototype new prototype object
-     * @return the prototype parameter
      */
-    public final Object setPrototype(final Object prototype) {
-        this.prototype = prototype;
-        return prototype;
-    }
+    public abstract void setPrototype(Object prototype);
 
     /**
      * Return the most appropriate invoke handle if there are specializations
      * @param type most specific method type to look for invocation with
-     * @param callsite args for trampoline invocation
+     * @param args args for trampoline invocation
      * @return invoke method handle
      */
     private MethodHandle getBestInvoker(final MethodType type, final Object[] args) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Wed May 08 10:10:05 2013 +0100
@@ -28,6 +28,7 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCall;
 import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
+import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.PropertyDescriptor.CONFIGURABLE;
@@ -39,7 +40,6 @@
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndexNoThrow;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -61,12 +61,13 @@
 import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.codegen.ObjectClassGenerator;
+import jdk.nashorn.internal.lookup.Lookup;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.objects.AccessorPropertyDescriptor;
 import jdk.nashorn.internal.objects.DataPropertyDescriptor;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
-import jdk.nashorn.internal.lookup.Lookup;
-import jdk.nashorn.internal.lookup.MethodHandleFactory;
+import jdk.nashorn.internal.runtime.linker.LinkerCallSite;
 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.linker.NashornGuards;
 
@@ -901,7 +902,7 @@
         final MethodHandle getter = find.getGetter(int.class);
         if (getter != null) {
             try {
-                return (int)getter.invokeExact((Object)find.getOwner());
+                return (int)getter.invokeExact((Object)find.getGetterReceiver());
             } catch (final Error|RuntimeException e) {
                 throw e;
             } catch (final Throwable e) {
@@ -916,7 +917,7 @@
         final MethodHandle getter = find.getGetter(long.class);
         if (getter != null) {
             try {
-                return (long)getter.invokeExact((Object)find.getOwner());
+                return (long)getter.invokeExact((Object)find.getGetterReceiver());
             } catch (final Error|RuntimeException e) {
                 throw e;
             } catch (final Throwable e) {
@@ -931,7 +932,7 @@
         final MethodHandle getter = find.getGetter(double.class);
         if (getter != null) {
             try {
-                return (double)getter.invokeExact((Object)find.getOwner());
+                return (double)getter.invokeExact((Object)find.getGetterReceiver());
             } catch (final Error|RuntimeException e) {
                 throw e;
             } catch (final Throwable e) {
@@ -953,7 +954,7 @@
         final MethodHandle getter = find.getGetter(Object.class);
         if (getter != null) {
             try {
-                return getter.invokeExact((Object)find.getOwner());
+                return getter.invokeExact((Object)find.getGetterReceiver());
             } catch (final Error|RuntimeException e) {
                 throw e;
             } catch (final Throwable e) {
@@ -1679,12 +1680,7 @@
      * @return GuardedInvocation to be invoked at call site.
      */
     protected GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final LinkRequest request, final String operator) {
-        final String name = desc.getNameToken(2);
-
-        if (request.isCallSiteUnstable()) {
-            return findMegaMorphicGetMethod(desc, name);
-        }
-
+        final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
         final FindProperty find = findProperty(name, true);
 
         MethodHandle methodHandle;
@@ -1700,6 +1696,10 @@
             throw new AssertionError(); // never invoked with any other operation
         }
 
+        if (request.isCallSiteUnstable()) {
+            return findMegaMorphicGetMethod(desc, name);
+        }
+
         final Class<?> returnType = desc.getMethodType().returnType();
         final Property property = find.getProperty();
         methodHandle = find.getGetter(returnType);
@@ -1727,7 +1727,9 @@
     }
 
     private static GuardedInvocation findMegaMorphicGetMethod(final CallSiteDescriptor desc, final String name) {
-        final GuardedInvocation inv = findGetIndexMethod(desc.getMethodType().insertParameterTypes(1, Object.class));
+        final MethodType mhType = desc.getMethodType().insertParameterTypes(1, Object.class);
+        final GuardedInvocation inv = findGetIndexMethod(mhType);
+
         return inv.replaceMethods(MH.insertArguments(inv.getInvocation(), 1, name), inv.getGuard());
     }
 
@@ -1890,8 +1892,8 @@
     }
 
     private static GuardedInvocation findMegaMorphicSetMethod(final CallSiteDescriptor desc, final String name) {
-        final GuardedInvocation inv = findSetIndexMethod(desc.getMethodType().insertParameterTypes(1, Object.class),
-                NashornCallSiteDescriptor.isStrict(desc));
+        final MethodType type = desc.getMethodType().insertParameterTypes(1, Object.class);
+        final GuardedInvocation inv = findSetIndexMethod(type, NashornCallSiteDescriptor.isStrict(desc));
         return inv.replaceMethods(MH.insertArguments(inv.getInvocation(), 1, name), inv.getGuard());
     }
 
@@ -1949,7 +1951,7 @@
      * @return GuardedInvocation to be invoked at call site.
      */
     public GuardedInvocation noSuchProperty(final CallSiteDescriptor desc, final LinkRequest request) {
-        final String name = desc.getNameToken(2);
+        final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
         final FindProperty find = findProperty(NO_SUCH_PROPERTY_NAME, true);
         final boolean scopeAccess = isScope() && NashornCallSiteDescriptor.isScope(desc);
 
@@ -1973,6 +1975,24 @@
 
         return createEmptyGetter(desc, name);
     }
+    /**
+     * Invoke fall back if a property is not found.
+     * @param name Name of property.
+     * @return Result from call.
+     */
+    private Object invokeNoSuchProperty(final String name) {
+        final FindProperty find = findProperty(NO_SUCH_PROPERTY_NAME, true);
+
+        if (find != null) {
+            final Object func = getObjectValue(find);
+
+            if (func instanceof ScriptFunction) {
+                return ScriptRuntime.apply((ScriptFunction)func, this, name);
+            }
+        }
+
+        return UNDEFINED;
+    }
 
     private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc, final String name) {
         return new GuardedInvocation(Lookup.emptyGetter(desc.getMethodType().returnType()), getMap().getProtoGetSwitchPoint(name), NashornGuards.getMapGuard(getMap()));
@@ -2120,8 +2140,11 @@
      *
      * Make sure arguments are paired correctly.
      * @param methodHandle MethodHandle to adjust.
-     * @param callType     MethodType of caller.
-     * @param callerVarArg true if the caller is vararg, false otherwise, null if it should be inferred.
+     * @param callType     MethodType of the call site.
+     * @param callerVarArg true if the caller is vararg, false otherwise, null if it should be inferred from the
+     * {@code callType}; basically, if the last parameter type of the call site is an array, it'll be considered a
+     * variable arity call site. These are ordinarily rare; Nashorn code generator creates variable arity call sites
+     * when the call has more than {@link LinkerCallSite#ARGLIMIT} parameters.
      *
      * @return method handle with adjusted arguments
      */
@@ -2136,7 +2159,7 @@
         final int callCount      = callType.parameterCount();
 
         final boolean isCalleeVarArg = parameterCount > 0 && methodType.parameterType(parameterCount - 1).isArray();
-        final boolean isCallerVarArg = callerVarArg != null ? callerVarArg.booleanValue() : (callCount > 1 &&
+        final boolean isCallerVarArg = callerVarArg != null ? callerVarArg.booleanValue() : (callCount > 0 &&
                 callType.parameterType(callCount - 1).isArray());
 
         if (callCount < parameterCount) {
@@ -2239,310 +2262,314 @@
            setArray(getArray().shrink(newLength));
            getArray().setLength(newLength);
        }
-   }
+    }
+
+    private int getInt(final int index, final String key) {
+        if (isValidArrayIndex(index)) {
+             for (ScriptObject object = this; ; ) {
+                final FindProperty find = object.findProperty(key, false, false, this);
+
+                if (find != null) {
+                    return getIntValue(find);
+                }
+
+                if ((object = object.getProto()) == null) {
+                    break;
+                }
+
+                final ArrayData array = object.getArray();
+
+                if (array.has(index)) {
+                    return array.getInt(index);
+                }
+           }
+        } else {
+            final FindProperty find = findProperty(key, true);
+
+            if (find != null) {
+                return getIntValue(find);
+            }
+        }
+
+        return JSType.toInt32(invokeNoSuchProperty(key));
+    }
 
     @Override
     public int getInt(final Object key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getInt(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getInt(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getIntValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getInt(key) : 0;
+        return getInt(index, convertKey(key));
     }
 
     @Override
     public int getInt(final double key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getInt(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getInt(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getIntValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getInt(key) : 0;
+        return getInt(index, convertKey(key));
     }
 
     @Override
     public int getInt(final long key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getInt(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getInt(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getIntValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getInt(key) : 0;
+        return getInt(index, convertKey(key));
     }
 
     @Override
     public int getInt(final int key) {
-        final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getInt(index);
+        final ArrayData array = getArray();
+
+        if (array.has(key)) {
+            return array.getInt(key);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getIntValue(find);
+        return getInt(key, convertKey(key));
+    }
+
+    private long getLong(final int index, final String key) {
+        if (isValidArrayIndex(index)) {
+            for (ScriptObject object = this; ; ) {
+                final FindProperty find = object.findProperty(key, false, false, this);
+
+                if (find != null) {
+                    return getLongValue(find);
+                }
+
+                if ((object = object.getProto()) == null) {
+                    break;
+                }
+
+                final ArrayData array = object.getArray();
+
+                if (array.has(index)) {
+                    return array.getLong(index);
+                }
+           }
+        } else {
+            final FindProperty find = findProperty(key, true);
+
+            if (find != null) {
+                return getLongValue(find);
+            }
         }
 
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getInt(key) : 0;
+        return JSType.toLong(invokeNoSuchProperty(key));
     }
 
     @Override
     public long getLong(final Object key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getLong(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getLong(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getLongValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getLong(key) : 0L;
+        return getLong(index, convertKey(key));
     }
 
     @Override
     public long getLong(final double key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getLong(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getLong(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getLongValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getLong(key) : 0L;
+        return getLong(index, convertKey(key));
     }
 
     @Override
     public long getLong(final long key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getLong(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getLong(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getLongValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getLong(key) : 0L;
+        return getLong(index, convertKey(key));
     }
 
     @Override
     public long getLong(final int key) {
-        final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getLong(index);
+        final ArrayData array = getArray();
+
+        if (array.has(key)) {
+            return array.getLong(key);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getLongValue(find);
+        return getLong(key, convertKey(key));
+    }
+
+    private double getDouble(final int index, final String key) {
+        if (isValidArrayIndex(index)) {
+            for (ScriptObject object = this; ; ) {
+                final FindProperty find = object.findProperty(key, false, false, this);
+
+                if (find != null) {
+                    return getDoubleValue(find);
+                }
+
+                if ((object = object.getProto()) == null) {
+                    break;
+                }
+
+                final ArrayData array = object.getArray();
+
+                if (array.has(index)) {
+                    return array.getDouble(index);
+                }
+           }
+        } else {
+            final FindProperty find = findProperty(key, true);
+
+            if (find != null) {
+                return getDoubleValue(find);
+            }
         }
 
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getLong(key) : 0L;
+        return JSType.toNumber(invokeNoSuchProperty(key));
     }
 
     @Override
     public double getDouble(final Object key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getDouble(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getDouble(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getDoubleValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getDouble(key) : Double.NaN;
+        return getDouble(index, convertKey(key));
     }
 
     @Override
     public double getDouble(final double key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getDouble(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getDouble(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getDoubleValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getDouble(key) : Double.NaN;
+        return getDouble(index, convertKey(key));
     }
 
     @Override
     public double getDouble(final long key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getDouble(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getDouble(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getDoubleValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getDouble(key) : Double.NaN;
+        return getDouble(index, convertKey(key));
     }
 
     @Override
     public double getDouble(final int key) {
-        final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getDouble(index);
+        final ArrayData array = getArray();
+
+        if (array.has(key)) {
+            return array.getDouble(key);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getDoubleValue(find);
+        return getDouble(key, convertKey(key));
+    }
+
+    private Object get(final int index, final String key) {
+        if (isValidArrayIndex(index)) {
+            for (ScriptObject object = this; ; ) {
+                final FindProperty find = object.findProperty(key, false, false, this);
+
+                if (find != null) {
+                    return getObjectValue(find);
+                }
+
+                if ((object = object.getProto()) == null) {
+                    break;
+                }
+
+                final ArrayData array = object.getArray();
+
+                if (array.has(index)) {
+                    return array.getObject(index);
+                }
+            }
+        } else {
+            final FindProperty find = findProperty(key, true);
+
+            if (find != null) {
+                return getObjectValue(find);
+            }
         }
 
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.getDouble(key) : Double.NaN;
+        return invokeNoSuchProperty(key);
     }
 
     @Override
     public Object get(final Object key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getObject(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getObject(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getObjectValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.get(key) : UNDEFINED;
+        return get(index, convertKey(key));
     }
 
     @Override
     public Object get(final double key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getObject(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getObject(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getObjectValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.get(key) : UNDEFINED;
+        return get(index, convertKey(key));
     }
 
     @Override
     public Object get(final long key) {
         final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getObject(index);
+        final ArrayData array = getArray();
+
+        if (array.has(index)) {
+            return array.getObject(index);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getObjectValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.get(key) : UNDEFINED;
+        return get(index, convertKey(key));
     }
 
     @Override
     public Object get(final int key) {
-        final int index = getArrayIndexNoThrow(key);
-
-        if (getArray().has(index)) {
-            return getArray().getObject(index);
+        final ArrayData array = getArray();
+
+        if (array.has(key)) {
+            return array.getObject(key);
         }
 
-        final FindProperty find = findProperty(convertKey(key), false);
-
-        if (find != null) {
-            return getObjectValue(find);
-        }
-
-        final ScriptObject proto = this.getProto();
-
-        return proto != null ? proto.get(key) : UNDEFINED;
+        return get(key, convertKey(key));
     }
 
     /**
@@ -2554,7 +2581,7 @@
      */
     private void doesNotHave(final int index, final Object value, final boolean strict) {
         final long oldLength = getArray().length();
-        final long longIndex = index & 0xffff_ffffL;
+        final long longIndex = index & JSType.MAX_UINT;
 
         if (!getArray().has(index)) {
             final String key = convertKey(longIndex);
@@ -2613,8 +2640,6 @@
             f = null;
         }
 
-        MethodHandle setter;
-
         if (f != null) {
             if (!f.getProperty().isWritable()) {
                 if (strict) {
@@ -2624,9 +2649,9 @@
                 return;
             }
 
-            setter = f.getSetter(Object.class, strict); //TODO specfields
             try {
-                setter.invokeExact((Object)f.getOwner(), value);
+                final MethodHandle setter = f.getSetter(Object.class, strict); //TODO specfields
+                setter.invokeExact((Object)f.getSetterReceiver(), value);
             } catch (final Error|RuntimeException e) {
                 throw e;
             } catch (final Throwable e) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/StructureLoader.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/StructureLoader.java	Wed May 08 10:10:05 2013 +0100
@@ -47,7 +47,7 @@
  *
  */
 final class StructureLoader extends NashornLoader {
-    private static final String JS_OBJECT_PREFIX_EXTERNAL = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_PREFIX.tag();
+    private static final String JS_OBJECT_PREFIX_EXTERNAL = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_PREFIX.symbolName();
     private static final String OBJECTS_PACKAGE_EXTERNAL  = binaryName(OBJECTS_PACKAGE);
 
     /**
@@ -110,7 +110,7 @@
     @Override
     protected Class<?> findClass(final String name) throws ClassNotFoundException {
         if (name.startsWith(JS_OBJECT_PREFIX_EXTERNAL)) {
-            final int start = name.indexOf(JS_OBJECT_PREFIX.tag()) + JS_OBJECT_PREFIX.tag().length();
+            final int start = name.indexOf(JS_OBJECT_PREFIX.symbolName()) + JS_OBJECT_PREFIX.symbolName().length();
             return generateClass(name, name.substring(start, name.length()));
         }
         return super.findClass(name);
--- a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Wed May 08 10:10:05 2013 +0100
@@ -232,11 +232,18 @@
         return (Scope) proto;
     }
 
+    private static GuardedInvocation fixReceiverType(final GuardedInvocation link, final MethodHandle filter) {
+        // The receiver may be an Object or a ScriptObject.
+        final MethodType invType = link.getInvocation().type();
+        final MethodType newInvType = invType.changeParameterType(0, filter.type().returnType());
+        return link.asType(newInvType);
+    }
+
     private static GuardedInvocation fixExpressionCallSite(final NashornCallSiteDescriptor desc, final GuardedInvocation link) {
         // If it's not a getMethod, just add an expression filter that converts WithObject in "this" position to its
         // expression.
         if(!"getMethod".equals(desc.getFirstOperator())) {
-            return link.filterArguments(0, WITHEXPRESSIONFILTER);
+            return fixReceiverType(link, WITHEXPRESSIONFILTER).filterArguments(0, WITHEXPRESSIONFILTER);
         }
 
         final MethodHandle linkInvocation = link.getInvocation();
@@ -252,7 +259,8 @@
     }
 
     private static GuardedInvocation fixScopeCallSite(final GuardedInvocation link) {
-        return link.replaceMethods(filter(link.getInvocation(), WITHSCOPEFILTER), filterGuard(link, WITHSCOPEFILTER));
+        final GuardedInvocation newLink = fixReceiverType(link, WITHSCOPEFILTER);
+        return link.replaceMethods(filter(newLink.getInvocation(), WITHSCOPEFILTER), filterGuard(newLink, WITHSCOPEFILTER));
     }
 
     private static MethodHandle filterGuard(final GuardedInvocation link, final MethodHandle filter) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java	Wed May 08 10:10:05 2013 +0100
@@ -84,7 +84,9 @@
      * @return valid array index, or negative value if not valid
      */
     public static int getArrayIndexNoThrow(final Object key) {
-        if (key instanceof Number) {
+        if (key instanceof Integer) {
+            return getArrayIndexNoThrow(((Integer)key).intValue());
+        } else if (key instanceof Number) {
             return getArrayIndexNoThrow(((Number)key).doubleValue());
         } else if (key instanceof String) {
             return (int)fromString((String)key);
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/MapIterator.java	Wed May 08 10:10:05 2013 +0100
@@ -66,8 +66,7 @@
             bumpIndex();
         }
 
-        // special case - balk at iterating to infinity or MAX_UINT
-        return (length != JSType.MAX_UINT) && indexInArray();
+        return indexInArray();
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Wed May 08 10:10:05 2013 +0100
@@ -273,7 +273,7 @@
     }
 
     private static Long indexToKey(final int index) {
-        return Long.valueOf(index & 0xffff_ffffL);
+        return Long.valueOf(index & JSType.MAX_UINT);
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/ClassAndLoader.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/ClassAndLoader.java	Wed May 08 10:10:05 2013 +0100
@@ -185,4 +185,4 @@
         }
         return classesAndLoaders.keySet();
     }
-}
\ No newline at end of file
+}
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Wed May 08 10:10:05 2013 +0100
@@ -127,9 +127,9 @@
     private static final Type METHOD_TYPE_TYPE = Type.getType(MethodType.class);
     private static final Type METHOD_HANDLE_TYPE = Type.getType(MethodHandle.class);
     private static final String GET_HANDLE_OBJECT_DESCRIPTOR = Type.getMethodDescriptor(METHOD_HANDLE_TYPE,
-            OBJECT_TYPE, STRING_TYPE, METHOD_TYPE_TYPE, Type.BOOLEAN_TYPE);
+            OBJECT_TYPE, STRING_TYPE, METHOD_TYPE_TYPE);
     private static final String GET_HANDLE_FUNCTION_DESCRIPTOR = Type.getMethodDescriptor(METHOD_HANDLE_TYPE,
-            SCRIPT_FUNCTION_TYPE, METHOD_TYPE_TYPE, Type.BOOLEAN_TYPE);
+            SCRIPT_FUNCTION_TYPE, METHOD_TYPE_TYPE);
     private static final String GET_CLASS_INITIALIZER_DESCRIPTOR = Type.getMethodDescriptor(SCRIPT_OBJECT_TYPE);
     private static final Type RUNTIME_EXCEPTION_TYPE = Type.getType(RuntimeException.class);
     private static final Type THROWABLE_TYPE = Type.getType(Throwable.class);
@@ -315,7 +315,6 @@
             mv.dup();
             mv.aconst(mi.getName());
             mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
-            mv.iconst(mi.method.isVarArgs() ? 1 : 0);
             mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR);
             mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
         }
@@ -459,7 +458,6 @@
                     mv.aconst(mi.getName());
                 }
                 mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
-                mv.iconst(mi.method.isVarArgs() ? 1 : 0);
                 mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor);
             }
             mv.putfield(generatedClassName, mi.methodHandleInstanceFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Wed May 08 10:10:05 2013 +0100
@@ -50,12 +50,11 @@
      * handles for their abstract method implementations.
      * @param fn the script function
      * @param type the method type it has to conform to
-     * @param varArg if the Java method for which the function is being adapted is a variable arity method
      * @return the appropriately adapted method handle for invoking the script function.
      */
-    public static MethodHandle getHandle(final ScriptFunction fn, final MethodType type, final boolean varArg) {
+    public static MethodHandle getHandle(final ScriptFunction fn, final MethodType type) {
         // JS "this" will be null for SAMs
-        return adaptHandle(fn.getBoundInvokeHandle(null), type, varArg);
+        return adaptHandle(fn.getBoundInvokeHandle(null), type);
     }
 
     /**
@@ -66,12 +65,11 @@
      * @param obj the script obj
      * @param name the name of the property that contains the function
      * @param type the method type it has to conform to
-     * @param varArg if the Java method for which the function is being adapted is a variable arity method
      * @return the appropriately adapted method handle for invoking the script function, or null if the value of the
      * property is either null or undefined, or "toString" was requested as the name, but the object doesn't directly
      * define it but just inherits it through prototype.
      */
-    public static MethodHandle getHandle(final Object obj, final String name, final MethodType type, final boolean varArg) {
+    public static MethodHandle getHandle(final Object obj, final String name, final MethodType type) {
         if (! (obj instanceof ScriptObject)) {
             throw typeError("not.an.object", ScriptRuntime.safeToString(obj));
         }
@@ -84,7 +82,7 @@
 
         final Object fnObj = sobj.get(name);
         if (fnObj instanceof ScriptFunction) {
-            return adaptHandle(((ScriptFunction)fnObj).getBoundInvokeHandle(sobj), type, varArg);
+            return adaptHandle(((ScriptFunction)fnObj).getBoundInvokeHandle(sobj), type);
         } else if(fnObj == null || fnObj instanceof Undefined) {
             return null;
         } else {
@@ -108,7 +106,7 @@
         classOverrides.set(overrides);
     }
 
-    private static MethodHandle adaptHandle(final MethodHandle handle, final MethodType type, final boolean varArg) {
-        return Bootstrap.getLinkerServices().asType(ScriptObject.pairArguments(handle, type, varArg), type);
+    private static MethodHandle adaptHandle(final MethodHandle handle, final MethodType type) {
+        return Bootstrap.getLinkerServices().asType(ScriptObject.pairArguments(handle, type, false), type);
     }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java	Wed May 08 10:10:05 2013 +0100
@@ -43,9 +43,8 @@
     public static final int CALLSITE_SCOPE                = 0x01;
     /** Flags that the call site is in code that uses ECMAScript strict mode. */
     public static final int CALLSITE_STRICT               = 0x02;
-    /** Flags that a property getter or setter call site references a scope variable that is not in the global scope
-     * (it is in a function lexical scope), and the function's scope object class is fixed and known in advance. Such
-     * getters and setters can often be linked more optimally using these assumptions. */
+    /** Flags that a property getter or setter call site references a scope variable that is located at a known distance
+     * in the scope chain. Such getters and setters can often be linked more optimally using these assumptions. */
     public static final int CALLSITE_FAST_SCOPE    = 0x400;
 
     /** Flags that the call site is profiled; Contexts that have {@code "profile.callsites"} boolean property set emit
--- a/nashorn/src/jdk/nashorn/internal/runtime/options/Options.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/options/Options.java	Wed May 08 10:10:05 2013 +0100
@@ -243,7 +243,13 @@
      */
     public String getString(final String key) {
         final Option<?> option = get(key);
-        return option != null ? (String)option.getValue() : null;
+        if(option != null) {
+            final String value = (String)option.getValue();
+            if(value != null) {
+                return value.intern();
+            }
+        }
+        return null;
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Wed May 08 10:10:05 2013 +0100
@@ -287,7 +287,10 @@
 
                     if (syntax.allowDoubleRangeOpInCC()) {
                         env.ccEscWarn("-");
-                        parseCharClassSbChar(cc, arg); // goto sb_char /* [0-9-a] is allowed as [0-9\-a] */
+                        arg.inType = CCVALTYPE.SB;
+                        arg.v = '-';
+                        arg.vIsRaw = false;
+                        parseCharClassValEntry2(cc, arg); // goto val_entry2 /* [0-9-a] is allowed as [0-9\-a] */
                         break;
                     }
                     newSyntaxException(ERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS);
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties	Wed May 08 10:10:05 2013 +0100
@@ -144,6 +144,26 @@
     desc="Print full version info of Nashorn." \
 }
 
+nashorn.option.function.statement.error= {                                    \
+    name="--function-statement-error",                                        \
+    desc="Report an error when function declaration is used as a statement.", \
+    is_undocumented=true,                                                     \
+    default=false                                                             \
+}
+
+nashorn.option.function.statement.warning = {                      \
+    name="--function-statement-warning",                           \
+    desc="Warn when function declaration is used as a statement.", \
+    is_undocumented=true,                                          \
+    default=false                                                  \
+}
+
+nashorn.option.fx = {                           \
+    name="-fx",                                 \
+    desc="Launch script as an fx application.", \
+    default=false                               \
+}
+
 nashorn.option.log = {                                                       \
     name="--log",                                                            \
     is_undocumented=true,                                                    \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/base.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+Scene                                  = Java.type("javafx.scene.Scene");
+Group                                  = Java.type("javafx.scene.Group");
+Stage                                  = Java.type("javafx.stage.Stage");
+
+Binding                                = Java.type("javafx.beans.binding.Binding");
+Bindings                               = Java.type("javafx.beans.binding.Bindings");
+BooleanBinding                         = Java.type("javafx.beans.binding.BooleanBinding");
+BooleanExpression                      = Java.type("javafx.beans.binding.BooleanExpression");
+DoubleBinding                          = Java.type("javafx.beans.binding.DoubleBinding");
+DoubleExpression                       = Java.type("javafx.beans.binding.DoubleExpression");
+FloatBinding                           = Java.type("javafx.beans.binding.FloatBinding");
+FloatExpression                        = Java.type("javafx.beans.binding.FloatExpression");
+IntegerBinding                         = Java.type("javafx.beans.binding.IntegerBinding");
+IntegerExpression                      = Java.type("javafx.beans.binding.IntegerExpression");
+ListBinding                            = Java.type("javafx.beans.binding.ListBinding");
+ListExpression                         = Java.type("javafx.beans.binding.ListExpression");
+LongBinding                            = Java.type("javafx.beans.binding.LongBinding");
+LongExpression                         = Java.type("javafx.beans.binding.LongExpression");
+MapBinding                             = Java.type("javafx.beans.binding.MapBinding");
+MapExpression                          = Java.type("javafx.beans.binding.MapExpression");
+NumberBinding                          = Java.type("javafx.beans.binding.NumberBinding");
+NumberExpression                       = Java.type("javafx.beans.binding.NumberExpression");
+NumberExpressionBase                   = Java.type("javafx.beans.binding.NumberExpressionBase");
+ObjectBinding                          = Java.type("javafx.beans.binding.ObjectBinding");
+ObjectExpression                       = Java.type("javafx.beans.binding.ObjectExpression");
+SetBinding                             = Java.type("javafx.beans.binding.SetBinding");
+SetExpression                          = Java.type("javafx.beans.binding.SetExpression");
+StringBinding                          = Java.type("javafx.beans.binding.StringBinding");
+StringExpression                       = Java.type("javafx.beans.binding.StringExpression");
+When                                   = Java.type("javafx.beans.binding.When");
+DefaultProperty                        = Java.type("javafx.beans.DefaultProperty");
+InvalidationListener                   = Java.type("javafx.beans.InvalidationListener");
+Observable                             = Java.type("javafx.beans.Observable");
+JavaBeanBooleanProperty                = Java.type("javafx.beans.property.adapter.JavaBeanBooleanProperty");
+JavaBeanBooleanPropertyBuilder         = Java.type("javafx.beans.property.adapter.JavaBeanBooleanPropertyBuilder");
+JavaBeanDoubleProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanDoubleProperty");
+JavaBeanDoublePropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanDoublePropertyBuilder");
+JavaBeanFloatProperty                  = Java.type("javafx.beans.property.adapter.JavaBeanFloatProperty");
+JavaBeanFloatPropertyBuilder           = Java.type("javafx.beans.property.adapter.JavaBeanFloatPropertyBuilder");
+JavaBeanIntegerProperty                = Java.type("javafx.beans.property.adapter.JavaBeanIntegerProperty");
+JavaBeanIntegerPropertyBuilder         = Java.type("javafx.beans.property.adapter.JavaBeanIntegerPropertyBuilder");
+JavaBeanLongProperty                   = Java.type("javafx.beans.property.adapter.JavaBeanLongProperty");
+JavaBeanLongPropertyBuilder            = Java.type("javafx.beans.property.adapter.JavaBeanLongPropertyBuilder");
+JavaBeanObjectProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanObjectProperty");
+JavaBeanObjectPropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanObjectPropertyBuilder");
+JavaBeanProperty                       = Java.type("javafx.beans.property.adapter.JavaBeanProperty");
+JavaBeanStringProperty                 = Java.type("javafx.beans.property.adapter.JavaBeanStringProperty");
+JavaBeanStringPropertyBuilder          = Java.type("javafx.beans.property.adapter.JavaBeanStringPropertyBuilder");
+ReadOnlyJavaBeanBooleanProperty        = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanBooleanProperty");
+ReadOnlyJavaBeanBooleanPropertyBuilder = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanBooleanPropertyBuilder");
+ReadOnlyJavaBeanDoubleProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanDoubleProperty");
+ReadOnlyJavaBeanDoublePropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanDoublePropertyBuilder");
+ReadOnlyJavaBeanFloatProperty          = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanFloatProperty");
+ReadOnlyJavaBeanFloatPropertyBuilder   = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanFloatPropertyBuilder");
+ReadOnlyJavaBeanIntegerProperty        = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanIntegerProperty");
+ReadOnlyJavaBeanIntegerPropertyBuilder = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanIntegerPropertyBuilder");
+ReadOnlyJavaBeanLongProperty           = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanLongProperty");
+ReadOnlyJavaBeanLongPropertyBuilder    = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanLongPropertyBuilder");
+ReadOnlyJavaBeanObjectProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanObjectProperty");
+ReadOnlyJavaBeanObjectPropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanObjectPropertyBuilder");
+ReadOnlyJavaBeanProperty               = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanProperty");
+ReadOnlyJavaBeanStringProperty         = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanStringProperty");
+ReadOnlyJavaBeanStringPropertyBuilder  = Java.type("javafx.beans.property.adapter.ReadOnlyJavaBeanStringPropertyBuilder");
+BooleanProperty                        = Java.type("javafx.beans.property.BooleanProperty");
+BooleanPropertyBase                    = Java.type("javafx.beans.property.BooleanPropertyBase");
+DoubleProperty                         = Java.type("javafx.beans.property.DoubleProperty");
+DoublePropertyBase                     = Java.type("javafx.beans.property.DoublePropertyBase");
+FloatProperty                          = Java.type("javafx.beans.property.FloatProperty");
+FloatPropertyBase                      = Java.type("javafx.beans.property.FloatPropertyBase");
+IntegerProperty                        = Java.type("javafx.beans.property.IntegerProperty");
+IntegerPropertyBase                    = Java.type("javafx.beans.property.IntegerPropertyBase");
+ListProperty                           = Java.type("javafx.beans.property.ListProperty");
+ListPropertyBase                       = Java.type("javafx.beans.property.ListPropertyBase");
+LongProperty                           = Java.type("javafx.beans.property.LongProperty");
+LongPropertyBase                       = Java.type("javafx.beans.property.LongPropertyBase");
+MapProperty                            = Java.type("javafx.beans.property.MapProperty");
+MapPropertyBase                        = Java.type("javafx.beans.property.MapPropertyBase");
+ObjectProperty                         = Java.type("javafx.beans.property.ObjectProperty");
+ObjectPropertyBase                     = Java.type("javafx.beans.property.ObjectPropertyBase");
+Property                               = Java.type("javafx.beans.property.Property");
+ReadOnlyBooleanProperty                = Java.type("javafx.beans.property.ReadOnlyBooleanProperty");
+ReadOnlyBooleanPropertyBase            = Java.type("javafx.beans.property.ReadOnlyBooleanPropertyBase");
+ReadOnlyBooleanWrapper                 = Java.type("javafx.beans.property.ReadOnlyBooleanWrapper");
+ReadOnlyDoubleProperty                 = Java.type("javafx.beans.property.ReadOnlyDoubleProperty");
+ReadOnlyDoublePropertyBase             = Java.type("javafx.beans.property.ReadOnlyDoublePropertyBase");
+ReadOnlyDoubleWrapper                  = Java.type("javafx.beans.property.ReadOnlyDoubleWrapper");
+ReadOnlyFloatProperty                  = Java.type("javafx.beans.property.ReadOnlyFloatProperty");
+ReadOnlyFloatPropertyBase              = Java.type("javafx.beans.property.ReadOnlyFloatPropertyBase");
+ReadOnlyFloatWrapper                   = Java.type("javafx.beans.property.ReadOnlyFloatWrapper");
+ReadOnlyIntegerProperty                = Java.type("javafx.beans.property.ReadOnlyIntegerProperty");
+ReadOnlyIntegerPropertyBase            = Java.type("javafx.beans.property.ReadOnlyIntegerPropertyBase");
+ReadOnlyIntegerWrapper                 = Java.type("javafx.beans.property.ReadOnlyIntegerWrapper");
+ReadOnlyListProperty                   = Java.type("javafx.beans.property.ReadOnlyListProperty");
+ReadOnlyListPropertyBase               = Java.type("javafx.beans.property.ReadOnlyListPropertyBase");
+ReadOnlyListWrapper                    = Java.type("javafx.beans.property.ReadOnlyListWrapper");
+ReadOnlyLongProperty                   = Java.type("javafx.beans.property.ReadOnlyLongProperty");
+ReadOnlyLongPropertyBase               = Java.type("javafx.beans.property.ReadOnlyLongPropertyBase");
+ReadOnlyLongWrapper                    = Java.type("javafx.beans.property.ReadOnlyLongWrapper");
+ReadOnlyMapProperty                    = Java.type("javafx.beans.property.ReadOnlyMapProperty");
+ReadOnlyMapPropertyBase                = Java.type("javafx.beans.property.ReadOnlyMapPropertyBase");
+ReadOnlyMapWrapper                     = Java.type("javafx.beans.property.ReadOnlyMapWrapper");
+ReadOnlyObjectProperty                 = Java.type("javafx.beans.property.ReadOnlyObjectProperty");
+ReadOnlyObjectPropertyBase             = Java.type("javafx.beans.property.ReadOnlyObjectPropertyBase");
+ReadOnlyObjectWrapper                  = Java.type("javafx.beans.property.ReadOnlyObjectWrapper");
+ReadOnlyProperty                       = Java.type("javafx.beans.property.ReadOnlyProperty");
+ReadOnlySetProperty                    = Java.type("javafx.beans.property.ReadOnlySetProperty");
+ReadOnlySetPropertyBase                = Java.type("javafx.beans.property.ReadOnlySetPropertyBase");
+ReadOnlySetWrapper                     = Java.type("javafx.beans.property.ReadOnlySetWrapper");
+ReadOnlyStringProperty                 = Java.type("javafx.beans.property.ReadOnlyStringProperty");
+ReadOnlyStringPropertyBase             = Java.type("javafx.beans.property.ReadOnlyStringPropertyBase");
+ReadOnlyStringWrapper                  = Java.type("javafx.beans.property.ReadOnlyStringWrapper");
+SetProperty                            = Java.type("javafx.beans.property.SetProperty");
+SetPropertyBase                        = Java.type("javafx.beans.property.SetPropertyBase");
+SimpleBooleanProperty                  = Java.type("javafx.beans.property.SimpleBooleanProperty");
+SimpleDoubleProperty                   = Java.type("javafx.beans.property.SimpleDoubleProperty");
+SimpleFloatProperty                    = Java.type("javafx.beans.property.SimpleFloatProperty");
+SimpleIntegerProperty                  = Java.type("javafx.beans.property.SimpleIntegerProperty");
+SimpleListProperty                     = Java.type("javafx.beans.property.SimpleListProperty");
+SimpleLongProperty                     = Java.type("javafx.beans.property.SimpleLongProperty");
+SimpleMapProperty                      = Java.type("javafx.beans.property.SimpleMapProperty");
+SimpleObjectProperty                   = Java.type("javafx.beans.property.SimpleObjectProperty");
+SimpleSetProperty                      = Java.type("javafx.beans.property.SimpleSetProperty");
+SimpleStringProperty                   = Java.type("javafx.beans.property.SimpleStringProperty");
+StringProperty                         = Java.type("javafx.beans.property.StringProperty");
+StringPropertyBase                     = Java.type("javafx.beans.property.StringPropertyBase");
+ChangeListener                         = Java.type("javafx.beans.value.ChangeListener");
+ObservableBooleanValue                 = Java.type("javafx.beans.value.ObservableBooleanValue");
+ObservableDoubleValue                  = Java.type("javafx.beans.value.ObservableDoubleValue");
+ObservableFloatValue                   = Java.type("javafx.beans.value.ObservableFloatValue");
+ObservableIntegerValue                 = Java.type("javafx.beans.value.ObservableIntegerValue");
+ObservableListValue                    = Java.type("javafx.beans.value.ObservableListValue");
+ObservableLongValue                    = Java.type("javafx.beans.value.ObservableLongValue");
+ObservableMapValue                     = Java.type("javafx.beans.value.ObservableMapValue");
+ObservableNumberValue                  = Java.type("javafx.beans.value.ObservableNumberValue");
+ObservableObjectValue                  = Java.type("javafx.beans.value.ObservableObjectValue");
+ObservableSetValue                     = Java.type("javafx.beans.value.ObservableSetValue");
+ObservableStringValue                  = Java.type("javafx.beans.value.ObservableStringValue");
+ObservableValue                        = Java.type("javafx.beans.value.ObservableValue");
+ObservableValueBase                    = Java.type("javafx.beans.value.ObservableValueBase");
+WeakChangeListener                     = Java.type("javafx.beans.value.WeakChangeListener");
+WritableBooleanValue                   = Java.type("javafx.beans.value.WritableBooleanValue");
+WritableDoubleValue                    = Java.type("javafx.beans.value.WritableDoubleValue");
+WritableFloatValue                     = Java.type("javafx.beans.value.WritableFloatValue");
+WritableIntegerValue                   = Java.type("javafx.beans.value.WritableIntegerValue");
+WritableListValue                      = Java.type("javafx.beans.value.WritableListValue");
+WritableLongValue                      = Java.type("javafx.beans.value.WritableLongValue");
+WritableMapValue                       = Java.type("javafx.beans.value.WritableMapValue");
+WritableNumberValue                    = Java.type("javafx.beans.value.WritableNumberValue");
+WritableObjectValue                    = Java.type("javafx.beans.value.WritableObjectValue");
+WritableSetValue                       = Java.type("javafx.beans.value.WritableSetValue");
+WritableStringValue                    = Java.type("javafx.beans.value.WritableStringValue");
+WritableValue                          = Java.type("javafx.beans.value.WritableValue");
+WeakInvalidationListener               = Java.type("javafx.beans.WeakInvalidationListener");
+WeakListener                           = Java.type("javafx.beans.WeakListener");
+FXCollections                          = Java.type("javafx.collections.FXCollections");
+ListChangeListener                     = Java.type("javafx.collections.ListChangeListener");
+ListChangeListener$Change              = Java.type("javafx.collections.ListChangeListener$Change");
+MapChangeListener                      = Java.type("javafx.collections.MapChangeListener");
+MapChangeListener$Change               = Java.type("javafx.collections.MapChangeListener$Change");
+ModifiableObservableListBase           = Java.type("javafx.collections.ModifiableObservableListBase");
+ObservableList                         = Java.type("javafx.collections.ObservableList");
+ObservableListBase                     = Java.type("javafx.collections.ObservableListBase");
+ObservableMap                          = Java.type("javafx.collections.ObservableMap");
+ObservableSet                          = Java.type("javafx.collections.ObservableSet");
+SetChangeListener                      = Java.type("javafx.collections.SetChangeListener");
+SetChangeListener$Change               = Java.type("javafx.collections.SetChangeListener$Change");
+WeakListChangeListener                 = Java.type("javafx.collections.WeakListChangeListener");
+WeakMapChangeListener                  = Java.type("javafx.collections.WeakMapChangeListener");
+WeakSetChangeListener                  = Java.type("javafx.collections.WeakSetChangeListener");
+ActionEvent                            = Java.type("javafx.event.ActionEvent");
+Event                                  = Java.type("javafx.event.Event");
+EventDispatchChain                     = Java.type("javafx.event.EventDispatchChain");
+EventDispatcher                        = Java.type("javafx.event.EventDispatcher");
+EventHandler                           = Java.type("javafx.event.EventHandler");
+EventTarget                            = Java.type("javafx.event.EventTarget");
+EventType                              = Java.type("javafx.event.EventType");
+WeakEventHandler                       = Java.type("javafx.event.WeakEventHandler");
+Builder                                = Java.type("javafx.util.Builder");
+BuilderFactory                         = Java.type("javafx.util.BuilderFactory");
+Callback                               = Java.type("javafx.util.Callback");
+BigDecimalStringConverter              = Java.type("javafx.util.converter.BigDecimalStringConverter");
+BigIntegerStringConverter              = Java.type("javafx.util.converter.BigIntegerStringConverter");
+BooleanStringConverter                 = Java.type("javafx.util.converter.BooleanStringConverter");
+ByteStringConverter                    = Java.type("javafx.util.converter.ByteStringConverter");
+CharacterStringConverter               = Java.type("javafx.util.converter.CharacterStringConverter");
+CurrencyStringConverter                = Java.type("javafx.util.converter.CurrencyStringConverter");
+DateStringConverter                    = Java.type("javafx.util.converter.DateStringConverter");
+DateTimeStringConverter                = Java.type("javafx.util.converter.DateTimeStringConverter");
+DefaultStringConverter                 = Java.type("javafx.util.converter.DefaultStringConverter");
+DoubleStringConverter                  = Java.type("javafx.util.converter.DoubleStringConverter");
+FloatStringConverter                   = Java.type("javafx.util.converter.FloatStringConverter");
+FormatStringConverter                  = Java.type("javafx.util.converter.FormatStringConverter");
+IntegerStringConverter                 = Java.type("javafx.util.converter.IntegerStringConverter");
+LongStringConverter                    = Java.type("javafx.util.converter.LongStringConverter");
+NumberStringConverter                  = Java.type("javafx.util.converter.NumberStringConverter");
+PercentageStringConverter              = Java.type("javafx.util.converter.PercentageStringConverter");
+ShortStringConverter                   = Java.type("javafx.util.converter.ShortStringConverter");
+TimeStringConverter                    = Java.type("javafx.util.converter.TimeStringConverter");
+Duration                               = Java.type("javafx.util.Duration");
+Pair                                   = Java.type("javafx.util.Pair");
+StringConverter                        = Java.type("javafx.util.StringConverter");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/bootstrap.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+// Check for fx presence.
+if (typeof javafx.application.Application != "function") {
+    print("JavaFX is not available.");
+    exit(1);
+}
+
+// Extend the javafx.application.Application class overriding init, start and stop.
+com.sun.javafx.application.LauncherImpl.launchApplication((Java.extend(javafx.application.Application, {
+    // Overridden javafx.application.Application.init();
+    init: function() {
+        // Java FX packages and classes must be defined here because
+        // they may not be viable until launch time due to clinit ordering.
+
+        load("fx:base.js");
+    },
+
+    // Overridden javafx.application.Application.start(Stage stage);
+    start: function(stage) {
+        // Set up stage global.
+        $STAGE = stage;
+
+        // Load user FX scripts.
+        for each (var script in $SCRIPTS) {
+            load(script);
+        }
+
+        // Call the global init function if present.
+        if ($GLOBAL.init) {
+            init();
+        }
+
+        // Call the global start function if present.  Otherwise show the stage.
+        if ($GLOBAL.start) {
+            start(stage);
+        } else {
+            stage.show();
+        }
+    },
+
+    // Overridden javafx.application.Application.stop();
+    stop: function() {
+        // Call the global stop function if present.
+        if ($GLOBAL.stop) {
+            stop();
+        }
+    }
+
+    // No arguments passed to application (handled thru $ARG.)
+})).class, new (Java.type("java.lang.String[]"))(0));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/controls.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+AreaChart                                  = Java.type("javafx.scene.chart.AreaChart");
+AreaChartBuilder                           = Java.type("javafx.scene.chart.AreaChartBuilder");
+Axis                                       = Java.type("javafx.scene.chart.Axis");
+Axis$TickMark                              = Java.type("javafx.scene.chart.Axis$TickMark");
+AxisBuilder                                = Java.type("javafx.scene.chart.AxisBuilder");
+BarChart                                   = Java.type("javafx.scene.chart.BarChart");
+BarChartBuilder                            = Java.type("javafx.scene.chart.BarChartBuilder");
+BubbleChart                                = Java.type("javafx.scene.chart.BubbleChart");
+BubbleChartBuilder                         = Java.type("javafx.scene.chart.BubbleChartBuilder");
+CategoryAxis                               = Java.type("javafx.scene.chart.CategoryAxis");
+CategoryAxisBuilder                        = Java.type("javafx.scene.chart.CategoryAxisBuilder");
+Chart                                      = Java.type("javafx.scene.chart.Chart");
+ChartBuilder                               = Java.type("javafx.scene.chart.ChartBuilder");
+LineChart                                  = Java.type("javafx.scene.chart.LineChart");
+LineChartBuilder                           = Java.type("javafx.scene.chart.LineChartBuilder");
+NumberAxis                                 = Java.type("javafx.scene.chart.NumberAxis");
+NumberAxis$DefaultFormatter                = Java.type("javafx.scene.chart.NumberAxis$DefaultFormatter");
+NumberAxisBuilder                          = Java.type("javafx.scene.chart.NumberAxisBuilder");
+PieChart                                   = Java.type("javafx.scene.chart.PieChart");
+PieChart$Data                              = Java.type("javafx.scene.chart.PieChart$Data");
+PieChartBuilder                            = Java.type("javafx.scene.chart.PieChartBuilder");
+ScatterChart                               = Java.type("javafx.scene.chart.ScatterChart");
+ScatterChartBuilder                        = Java.type("javafx.scene.chart.ScatterChartBuilder");
+StackedAreaChart                           = Java.type("javafx.scene.chart.StackedAreaChart");
+StackedAreaChartBuilder                    = Java.type("javafx.scene.chart.StackedAreaChartBuilder");
+StackedBarChart                            = Java.type("javafx.scene.chart.StackedBarChart");
+StackedBarChartBuilder                     = Java.type("javafx.scene.chart.StackedBarChartBuilder");
+ValueAxis                                  = Java.type("javafx.scene.chart.ValueAxis");
+ValueAxisBuilder                           = Java.type("javafx.scene.chart.ValueAxisBuilder");
+XYChart                                    = Java.type("javafx.scene.chart.XYChart");
+XYChart$Data                               = Java.type("javafx.scene.chart.XYChart$Data");
+XYChart$Series                             = Java.type("javafx.scene.chart.XYChart$Series");
+XYChartBuilder                             = Java.type("javafx.scene.chart.XYChartBuilder");
+Accordion                                  = Java.type("javafx.scene.control.Accordion");
+AccordionBuilder                           = Java.type("javafx.scene.control.AccordionBuilder");
+Button                                     = Java.type("javafx.scene.control.Button");
+ButtonBase                                 = Java.type("javafx.scene.control.ButtonBase");
+ButtonBaseBuilder                          = Java.type("javafx.scene.control.ButtonBaseBuilder");
+ButtonBuilder                              = Java.type("javafx.scene.control.ButtonBuilder");
+Cell                                       = Java.type("javafx.scene.control.Cell");
+CheckBoxListCell                           = Java.type("javafx.scene.control.cell.CheckBoxListCell");
+CheckBoxListCellBuilder                    = Java.type("javafx.scene.control.cell.CheckBoxListCellBuilder");
+CheckBoxTableCell                          = Java.type("javafx.scene.control.cell.CheckBoxTableCell");
+CheckBoxTableCellBuilder                   = Java.type("javafx.scene.control.cell.CheckBoxTableCellBuilder");
+CheckBoxTreeCell                           = Java.type("javafx.scene.control.cell.CheckBoxTreeCell");
+CheckBoxTreeCellBuilder                    = Java.type("javafx.scene.control.cell.CheckBoxTreeCellBuilder");
+CheckBoxTreeTableCell                      = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCell");
+CheckBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.CheckBoxTreeTableCellBuilder");
+ChoiceBoxListCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxListCell");
+ChoiceBoxListCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxListCellBuilder");
+ChoiceBoxTableCell                         = Java.type("javafx.scene.control.cell.ChoiceBoxTableCell");
+ChoiceBoxTableCellBuilder                  = Java.type("javafx.scene.control.cell.ChoiceBoxTableCellBuilder");
+ChoiceBoxTreeCell                          = Java.type("javafx.scene.control.cell.ChoiceBoxTreeCell");
+ChoiceBoxTreeCellBuilder                   = Java.type("javafx.scene.control.cell.ChoiceBoxTreeCellBuilder");
+ChoiceBoxTreeTableCell                     = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCell");
+ChoiceBoxTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.ChoiceBoxTreeTableCellBuilder");
+ComboBoxListCell                           = Java.type("javafx.scene.control.cell.ComboBoxListCell");
+ComboBoxListCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxListCellBuilder");
+ComboBoxTableCell                          = Java.type("javafx.scene.control.cell.ComboBoxTableCell");
+ComboBoxTableCellBuilder                   = Java.type("javafx.scene.control.cell.ComboBoxTableCellBuilder");
+ComboBoxTreeCell                           = Java.type("javafx.scene.control.cell.ComboBoxTreeCell");
+ComboBoxTreeCellBuilder                    = Java.type("javafx.scene.control.cell.ComboBoxTreeCellBuilder");
+ComboBoxTreeTableCell                      = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCell");
+ComboBoxTreeTableCellBuilder               = Java.type("javafx.scene.control.cell.ComboBoxTreeTableCellBuilder");
+MapValueFactory                            = Java.type("javafx.scene.control.cell.MapValueFactory");
+ProgressBarTableCell                       = Java.type("javafx.scene.control.cell.ProgressBarTableCell");
+ProgressBarTreeTableCell                   = Java.type("javafx.scene.control.cell.ProgressBarTreeTableCell");
+PropertyValueFactory                       = Java.type("javafx.scene.control.cell.PropertyValueFactory");
+PropertyValueFactoryBuilder                = Java.type("javafx.scene.control.cell.PropertyValueFactoryBuilder");
+TextFieldListCell                          = Java.type("javafx.scene.control.cell.TextFieldListCell");
+TextFieldListCellBuilder                   = Java.type("javafx.scene.control.cell.TextFieldListCellBuilder");
+TextFieldTableCell                         = Java.type("javafx.scene.control.cell.TextFieldTableCell");
+TextFieldTableCellBuilder                  = Java.type("javafx.scene.control.cell.TextFieldTableCellBuilder");
+TextFieldTreeCell                          = Java.type("javafx.scene.control.cell.TextFieldTreeCell");
+TextFieldTreeCellBuilder                   = Java.type("javafx.scene.control.cell.TextFieldTreeCellBuilder");
+TextFieldTreeTableCell                     = Java.type("javafx.scene.control.cell.TextFieldTreeTableCell");
+TextFieldTreeTableCellBuilder              = Java.type("javafx.scene.control.cell.TextFieldTreeTableCellBuilder");
+TreeItemPropertyValueFactory               = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactory");
+TreeItemPropertyValueFactoryBuilder        = Java.type("javafx.scene.control.cell.TreeItemPropertyValueFactoryBuilder");
+CellBuilder                                = Java.type("javafx.scene.control.CellBuilder");
+CheckBox                                   = Java.type("javafx.scene.control.CheckBox");
+CheckBoxBuilder                            = Java.type("javafx.scene.control.CheckBoxBuilder");
+CheckBoxTreeItem                           = Java.type("javafx.scene.control.CheckBoxTreeItem");
+CheckBoxTreeItem$TreeModificationEvent     = Java.type("javafx.scene.control.CheckBoxTreeItem$TreeModificationEvent");
+CheckBoxTreeItemBuilder                    = Java.type("javafx.scene.control.CheckBoxTreeItemBuilder");
+CheckMenuItem                              = Java.type("javafx.scene.control.CheckMenuItem");
+CheckMenuItemBuilder                       = Java.type("javafx.scene.control.CheckMenuItemBuilder");
+ChoiceBox                                  = Java.type("javafx.scene.control.ChoiceBox");
+ChoiceBoxBuilder                           = Java.type("javafx.scene.control.ChoiceBoxBuilder");
+ColorPicker                                = Java.type("javafx.scene.control.ColorPicker");
+ColorPickerBuilder                         = Java.type("javafx.scene.control.ColorPickerBuilder");
+ComboBox                                   = Java.type("javafx.scene.control.ComboBox");
+ComboBoxBase                               = Java.type("javafx.scene.control.ComboBoxBase");
+ComboBoxBaseBuilder                        = Java.type("javafx.scene.control.ComboBoxBaseBuilder");
+ComboBoxBuilder                            = Java.type("javafx.scene.control.ComboBoxBuilder");
+ContentDisplay                             = Java.type("javafx.scene.control.ContentDisplay");
+ContextMenu                                = Java.type("javafx.scene.control.ContextMenu");
+ContextMenuBuilder                         = Java.type("javafx.scene.control.ContextMenuBuilder");
+Control                                    = Java.type("javafx.scene.control.Control");
+ControlBuilder                             = Java.type("javafx.scene.control.ControlBuilder");
+CustomMenuItem                             = Java.type("javafx.scene.control.CustomMenuItem");
+CustomMenuItemBuilder                      = Java.type("javafx.scene.control.CustomMenuItemBuilder");
+FocusModel                                 = Java.type("javafx.scene.control.FocusModel");
+Hyperlink                                  = Java.type("javafx.scene.control.Hyperlink");
+HyperlinkBuilder                           = Java.type("javafx.scene.control.HyperlinkBuilder");
+IndexedCell                                = Java.type("javafx.scene.control.IndexedCell");
+IndexedCellBuilder                         = Java.type("javafx.scene.control.IndexedCellBuilder");
+IndexRange                                 = Java.type("javafx.scene.control.IndexRange");
+IndexRangeBuilder                          = Java.type("javafx.scene.control.IndexRangeBuilder");
+Label                                      = Java.type("javafx.scene.control.Label");
+LabelBuilder                               = Java.type("javafx.scene.control.LabelBuilder");
+Labeled                                    = Java.type("javafx.scene.control.Labeled");
+LabeledBuilder                             = Java.type("javafx.scene.control.LabeledBuilder");
+ListCell                                   = Java.type("javafx.scene.control.ListCell");
+ListCellBuilder                            = Java.type("javafx.scene.control.ListCellBuilder");
+ListView                                   = Java.type("javafx.scene.control.ListView");
+ListView$EditEvent                         = Java.type("javafx.scene.control.ListView$EditEvent");
+ListViewBuilder                            = Java.type("javafx.scene.control.ListViewBuilder");
+Menu                                       = Java.type("javafx.scene.control.Menu");
+MenuBar                                    = Java.type("javafx.scene.control.MenuBar");
+MenuBarBuilder                             = Java.type("javafx.scene.control.MenuBarBuilder");
+MenuBuilder                                = Java.type("javafx.scene.control.MenuBuilder");
+MenuButton                                 = Java.type("javafx.scene.control.MenuButton");
+MenuButtonBuilder                          = Java.type("javafx.scene.control.MenuButtonBuilder");
+MenuItem                                   = Java.type("javafx.scene.control.MenuItem");
+MenuItemBuilder                            = Java.type("javafx.scene.control.MenuItemBuilder");
+MultipleSelectionModel                     = Java.type("javafx.scene.control.MultipleSelectionModel");
+MultipleSelectionModelBuilder              = Java.type("javafx.scene.control.MultipleSelectionModelBuilder");
+OverrunStyle                               = Java.type("javafx.scene.control.OverrunStyle");
+Pagination                                 = Java.type("javafx.scene.control.Pagination");
+PaginationBuilder                          = Java.type("javafx.scene.control.PaginationBuilder");
+PasswordField                              = Java.type("javafx.scene.control.PasswordField");
+PasswordFieldBuilder                       = Java.type("javafx.scene.control.PasswordFieldBuilder");
+PopupControl                               = Java.type("javafx.scene.control.PopupControl");
+PopupControlBuilder                        = Java.type("javafx.scene.control.PopupControlBuilder");
+ProgressBar                                = Java.type("javafx.scene.control.ProgressBar");
+ProgressBarBuilder                         = Java.type("javafx.scene.control.ProgressBarBuilder");
+ProgressIndicator                          = Java.type("javafx.scene.control.ProgressIndicator");
+ProgressIndicatorBuilder                   = Java.type("javafx.scene.control.ProgressIndicatorBuilder");
+RadioButton                                = Java.type("javafx.scene.control.RadioButton");
+RadioButtonBuilder                         = Java.type("javafx.scene.control.RadioButtonBuilder");
+RadioMenuItem                              = Java.type("javafx.scene.control.RadioMenuItem");
+RadioMenuItemBuilder                       = Java.type("javafx.scene.control.RadioMenuItemBuilder");
+ResizeFeaturesBase                         = Java.type("javafx.scene.control.ResizeFeaturesBase");
+ResizeFeaturesBaseBuilder                  = Java.type("javafx.scene.control.ResizeFeaturesBaseBuilder");
+ScrollBar                                  = Java.type("javafx.scene.control.ScrollBar");
+ScrollBarBuilder                           = Java.type("javafx.scene.control.ScrollBarBuilder");
+ScrollPane                                 = Java.type("javafx.scene.control.ScrollPane");
+ScrollPane$ScrollBarPolicy                 = Java.type("javafx.scene.control.ScrollPane$ScrollBarPolicy");
+ScrollPaneBuilder                          = Java.type("javafx.scene.control.ScrollPaneBuilder");
+ScrollToEvent                              = Java.type("javafx.scene.control.ScrollToEvent");
+SelectionMode                              = Java.type("javafx.scene.control.SelectionMode");
+SelectionModel                             = Java.type("javafx.scene.control.SelectionModel");
+Separator                                  = Java.type("javafx.scene.control.Separator");
+SeparatorBuilder                           = Java.type("javafx.scene.control.SeparatorBuilder");
+SeparatorMenuItem                          = Java.type("javafx.scene.control.SeparatorMenuItem");
+SeparatorMenuItemBuilder                   = Java.type("javafx.scene.control.SeparatorMenuItemBuilder");
+SingleSelectionModel                       = Java.type("javafx.scene.control.SingleSelectionModel");
+Skin                                       = Java.type("javafx.scene.control.Skin");
+SkinBase                                   = Java.type("javafx.scene.control.SkinBase");
+SkinBaseBuilder                            = Java.type("javafx.scene.control.SkinBaseBuilder");
+Skinnable                                  = Java.type("javafx.scene.control.Skinnable");
+Slider                                     = Java.type("javafx.scene.control.Slider");
+SliderBuilder                              = Java.type("javafx.scene.control.SliderBuilder");
+SortEvent                                  = Java.type("javafx.scene.control.SortEvent");
+SplitMenuButton                            = Java.type("javafx.scene.control.SplitMenuButton");
+SplitMenuButtonBuilder                     = Java.type("javafx.scene.control.SplitMenuButtonBuilder");
+SplitPane                                  = Java.type("javafx.scene.control.SplitPane");
+SplitPane$Divider                          = Java.type("javafx.scene.control.SplitPane$Divider");
+SplitPaneBuilder                           = Java.type("javafx.scene.control.SplitPaneBuilder");
+Tab                                        = Java.type("javafx.scene.control.Tab");
+TabBuilder                                 = Java.type("javafx.scene.control.TabBuilder");
+TableCell                                  = Java.type("javafx.scene.control.TableCell");
+TableCellBuilder                           = Java.type("javafx.scene.control.TableCellBuilder");
+TableColumn                                = Java.type("javafx.scene.control.TableColumn");
+TableColumn$CellDataFeatures               = Java.type("javafx.scene.control.TableColumn$CellDataFeatures");
+TableColumn$CellEditEvent                  = Java.type("javafx.scene.control.TableColumn$CellEditEvent");
+TableColumn$SortType                       = Java.type("javafx.scene.control.TableColumn$SortType");
+TableColumnBase                            = Java.type("javafx.scene.control.TableColumnBase");
+TableColumnBaseBuilder                     = Java.type("javafx.scene.control.TableColumnBaseBuilder");
+TableColumnBuilder                         = Java.type("javafx.scene.control.TableColumnBuilder");
+TableFocusModel                            = Java.type("javafx.scene.control.TableFocusModel");
+TablePosition                              = Java.type("javafx.scene.control.TablePosition");
+TablePositionBase                          = Java.type("javafx.scene.control.TablePositionBase");
+TableRow                                   = Java.type("javafx.scene.control.TableRow");
+TableRowBuilder                            = Java.type("javafx.scene.control.TableRowBuilder");
+TableSelectionModel                        = Java.type("javafx.scene.control.TableSelectionModel");
+TableSelectionModelBuilder                 = Java.type("javafx.scene.control.TableSelectionModelBuilder");
+TableView                                  = Java.type("javafx.scene.control.TableView");
+TableView$ResizeFeatures                   = Java.type("javafx.scene.control.TableView$ResizeFeatures");
+TableView$TableViewFocusModel              = Java.type("javafx.scene.control.TableView$TableViewFocusModel");
+TableView$TableViewSelectionModel          = Java.type("javafx.scene.control.TableView$TableViewSelectionModel");
+TableViewBuilder                           = Java.type("javafx.scene.control.TableViewBuilder");
+TabPane                                    = Java.type("javafx.scene.control.TabPane");
+TabPane$TabClosingPolicy                   = Java.type("javafx.scene.control.TabPane$TabClosingPolicy");
+TabPaneBuilder                             = Java.type("javafx.scene.control.TabPaneBuilder");
+TextArea                                   = Java.type("javafx.scene.control.TextArea");
+TextAreaBuilder                            = Java.type("javafx.scene.control.TextAreaBuilder");
+TextField                                  = Java.type("javafx.scene.control.TextField");
+TextFieldBuilder                           = Java.type("javafx.scene.control.TextFieldBuilder");
+TextInputControl                           = Java.type("javafx.scene.control.TextInputControl");
+TextInputControl$Content                   = Java.type("javafx.scene.control.TextInputControl$Content");
+TextInputControlBuilder                    = Java.type("javafx.scene.control.TextInputControlBuilder");
+TitledPane                                 = Java.type("javafx.scene.control.TitledPane");
+TitledPaneBuilder                          = Java.type("javafx.scene.control.TitledPaneBuilder");
+Toggle                                     = Java.type("javafx.scene.control.Toggle");
+ToggleButton                               = Java.type("javafx.scene.control.ToggleButton");
+ToggleButtonBuilder                        = Java.type("javafx.scene.control.ToggleButtonBuilder");
+ToggleGroup                                = Java.type("javafx.scene.control.ToggleGroup");
+ToggleGroupBuilder                         = Java.type("javafx.scene.control.ToggleGroupBuilder");
+ToolBar                                    = Java.type("javafx.scene.control.ToolBar");
+ToolBarBuilder                             = Java.type("javafx.scene.control.ToolBarBuilder");
+Tooltip                                    = Java.type("javafx.scene.control.Tooltip");
+TooltipBuilder                             = Java.type("javafx.scene.control.TooltipBuilder");
+TreeCell                                   = Java.type("javafx.scene.control.TreeCell");
+TreeCellBuilder                            = Java.type("javafx.scene.control.TreeCellBuilder");
+TreeItem                                   = Java.type("javafx.scene.control.TreeItem");
+TreeItem$TreeModificationEvent             = Java.type("javafx.scene.control.TreeItem$TreeModificationEvent");
+TreeItemBuilder                            = Java.type("javafx.scene.control.TreeItemBuilder");
+TreeSortMode                               = Java.type("javafx.scene.control.TreeSortMode");
+TreeTableCell                              = Java.type("javafx.scene.control.TreeTableCell");
+TreeTableCellBuilder                       = Java.type("javafx.scene.control.TreeTableCellBuilder");
+TreeTableColumn                            = Java.type("javafx.scene.control.TreeTableColumn");
+TreeTableColumn$CellDataFeatures           = Java.type("javafx.scene.control.TreeTableColumn$CellDataFeatures");
+TreeTableColumn$CellEditEvent              = Java.type("javafx.scene.control.TreeTableColumn$CellEditEvent");
+TreeTableColumn$SortType                   = Java.type("javafx.scene.control.TreeTableColumn$SortType");
+TreeTableColumnBuilder                     = Java.type("javafx.scene.control.TreeTableColumnBuilder");
+TreeTablePosition                          = Java.type("javafx.scene.control.TreeTablePosition");
+TreeTableRow                               = Java.type("javafx.scene.control.TreeTableRow");
+TreeTableRowBuilder                        = Java.type("javafx.scene.control.TreeTableRowBuilder");
+TreeTableView                              = Java.type("javafx.scene.control.TreeTableView");
+TreeTableView$EditEvent                    = Java.type("javafx.scene.control.TreeTableView$EditEvent");
+TreeTableView$ResizeFeatures               = Java.type("javafx.scene.control.TreeTableView$ResizeFeatures");
+TreeTableView$TreeTableViewFocusModel      = Java.type("javafx.scene.control.TreeTableView$TreeTableViewFocusModel");
+TreeTableView$TreeTableViewSelectionModel  = Java.type("javafx.scene.control.TreeTableView$TreeTableViewSelectionModel");
+TreeTableViewBuilder                       = Java.type("javafx.scene.control.TreeTableViewBuilder");
+TreeView                                   = Java.type("javafx.scene.control.TreeView");
+TreeView$EditEvent                         = Java.type("javafx.scene.control.TreeView$EditEvent");
+TreeViewBuilder                            = Java.type("javafx.scene.control.TreeViewBuilder");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/fxml.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+FXML                 = Java.type("javafx.fxml.FXML");
+FXMLLoader           = Java.type("javafx.fxml.FXMLLoader");
+Initializable        = Java.type("javafx.fxml.Initializable");
+JavaFXBuilderFactory = Java.type("javafx.fxml.JavaFXBuilderFactory");
+LoadException        = Java.type("javafx.fxml.LoadException");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/graphics.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,431 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+Animation                              = Java.type("javafx.animation.Animation");
+Animation$Status                       = Java.type("javafx.animation.Animation$Status");
+AnimationBuilder                       = Java.type("javafx.animation.AnimationBuilder");
+AnimationTimer                         = Java.type("javafx.animation.AnimationTimer");
+FadeTransition                         = Java.type("javafx.animation.FadeTransition");
+FadeTransitionBuilder                  = Java.type("javafx.animation.FadeTransitionBuilder");
+FillTransition                         = Java.type("javafx.animation.FillTransition");
+FillTransitionBuilder                  = Java.type("javafx.animation.FillTransitionBuilder");
+Interpolatable                         = Java.type("javafx.animation.Interpolatable");
+Interpolator                           = Java.type("javafx.animation.Interpolator");
+KeyFrame                               = Java.type("javafx.animation.KeyFrame");
+KeyValue                               = Java.type("javafx.animation.KeyValue");
+ParallelTransition                     = Java.type("javafx.animation.ParallelTransition");
+ParallelTransitionBuilder              = Java.type("javafx.animation.ParallelTransitionBuilder");
+PathTransition                         = Java.type("javafx.animation.PathTransition");
+PathTransition$OrientationType         = Java.type("javafx.animation.PathTransition$OrientationType");
+PathTransitionBuilder                  = Java.type("javafx.animation.PathTransitionBuilder");
+PauseTransition                        = Java.type("javafx.animation.PauseTransition");
+PauseTransitionBuilder                 = Java.type("javafx.animation.PauseTransitionBuilder");
+RotateTransition                       = Java.type("javafx.animation.RotateTransition");
+RotateTransitionBuilder                = Java.type("javafx.animation.RotateTransitionBuilder");
+ScaleTransition                        = Java.type("javafx.animation.ScaleTransition");
+ScaleTransitionBuilder                 = Java.type("javafx.animation.ScaleTransitionBuilder");
+SequentialTransition                   = Java.type("javafx.animation.SequentialTransition");
+SequentialTransitionBuilder            = Java.type("javafx.animation.SequentialTransitionBuilder");
+StrokeTransition                       = Java.type("javafx.animation.StrokeTransition");
+StrokeTransitionBuilder                = Java.type("javafx.animation.StrokeTransitionBuilder");
+Timeline                               = Java.type("javafx.animation.Timeline");
+TimelineBuilder                        = Java.type("javafx.animation.TimelineBuilder");
+Transition                             = Java.type("javafx.animation.Transition");
+TransitionBuilder                      = Java.type("javafx.animation.TransitionBuilder");
+TranslateTransition                    = Java.type("javafx.animation.TranslateTransition");
+TranslateTransitionBuilder             = Java.type("javafx.animation.TranslateTransitionBuilder");
+Application                            = Java.type("javafx.application.Application");
+Application$Parameters                 = Java.type("javafx.application.Application$Parameters");
+ConditionalFeature                     = Java.type("javafx.application.ConditionalFeature");
+HostServices                           = Java.type("javafx.application.HostServices");
+Platform                               = Java.type("javafx.application.Platform");
+Preloader                              = Java.type("javafx.application.Preloader");
+Preloader$ErrorNotification            = Java.type("javafx.application.Preloader$ErrorNotification");
+Preloader$PreloaderNotification        = Java.type("javafx.application.Preloader$PreloaderNotification");
+Preloader$ProgressNotification         = Java.type("javafx.application.Preloader$ProgressNotification");
+Preloader$StateChangeNotification      = Java.type("javafx.application.Preloader$StateChangeNotification");
+Preloader$StateChangeNotification$Type = Java.type("javafx.application.Preloader$StateChangeNotification$Type");
+ScheduledService                       = Java.type("javafx.concurrent.ScheduledService");
+Service                                = Java.type("javafx.concurrent.Service");
+Task                                   = Java.type("javafx.concurrent.Task");
+Worker                                 = Java.type("javafx.concurrent.Worker");
+Worker$State                           = Java.type("javafx.concurrent.Worker$State");
+WorkerStateEvent                       = Java.type("javafx.concurrent.WorkerStateEvent");
+CssMetaData                            = Java.type("javafx.css.CssMetaData");
+FontCssMetaData                        = Java.type("javafx.css.FontCssMetaData");
+ParsedValue                            = Java.type("javafx.css.ParsedValue");
+PseudoClass                            = Java.type("javafx.css.PseudoClass");
+SimpleStyleableBooleanProperty         = Java.type("javafx.css.SimpleStyleableBooleanProperty");
+SimpleStyleableDoubleProperty          = Java.type("javafx.css.SimpleStyleableDoubleProperty");
+SimpleStyleableFloatProperty           = Java.type("javafx.css.SimpleStyleableFloatProperty");
+SimpleStyleableIntegerProperty         = Java.type("javafx.css.SimpleStyleableIntegerProperty");
+SimpleStyleableLongProperty            = Java.type("javafx.css.SimpleStyleableLongProperty");
+SimpleStyleableObjectProperty          = Java.type("javafx.css.SimpleStyleableObjectProperty");
+SimpleStyleableStringProperty          = Java.type("javafx.css.SimpleStyleableStringProperty");
+Styleable                              = Java.type("javafx.css.Styleable");
+StyleableBooleanProperty               = Java.type("javafx.css.StyleableBooleanProperty");
+StyleableDoubleProperty                = Java.type("javafx.css.StyleableDoubleProperty");
+StyleableFloatProperty                 = Java.type("javafx.css.StyleableFloatProperty");
+StyleableIntegerProperty               = Java.type("javafx.css.StyleableIntegerProperty");
+StyleableLongProperty                  = Java.type("javafx.css.StyleableLongProperty");
+StyleableObjectProperty                = Java.type("javafx.css.StyleableObjectProperty");
+StyleableProperty                      = Java.type("javafx.css.StyleableProperty");
+StyleableStringProperty                = Java.type("javafx.css.StyleableStringProperty");
+StyleConverter                         = Java.type("javafx.css.StyleConverter");
+StyleOrigin                            = Java.type("javafx.css.StyleOrigin");
+BoundingBox                            = Java.type("javafx.geometry.BoundingBox");
+BoundingBoxBuilder                     = Java.type("javafx.geometry.BoundingBoxBuilder");
+Bounds                                 = Java.type("javafx.geometry.Bounds");
+Dimension2D                            = Java.type("javafx.geometry.Dimension2D");
+Dimension2DBuilder                     = Java.type("javafx.geometry.Dimension2DBuilder");
+HorizontalDirection                    = Java.type("javafx.geometry.HorizontalDirection");
+HPos                                   = Java.type("javafx.geometry.HPos");
+Insets                                 = Java.type("javafx.geometry.Insets");
+InsetsBuilder                          = Java.type("javafx.geometry.InsetsBuilder");
+NodeOrientation                        = Java.type("javafx.geometry.NodeOrientation");
+Orientation                            = Java.type("javafx.geometry.Orientation");
+Point2D                                = Java.type("javafx.geometry.Point2D");
+Point2DBuilder                         = Java.type("javafx.geometry.Point2DBuilder");
+Point3D                                = Java.type("javafx.geometry.Point3D");
+Point3DBuilder                         = Java.type("javafx.geometry.Point3DBuilder");
+Pos                                    = Java.type("javafx.geometry.Pos");
+Rectangle2D                            = Java.type("javafx.geometry.Rectangle2D");
+Rectangle2DBuilder                     = Java.type("javafx.geometry.Rectangle2DBuilder");
+Side                                   = Java.type("javafx.geometry.Side");
+VerticalDirection                      = Java.type("javafx.geometry.VerticalDirection");
+VPos                                   = Java.type("javafx.geometry.VPos");
+Collation                              = Java.type("javafx.print.Collation");
+JobSettings                            = Java.type("javafx.print.JobSettings");
+PageLayout                             = Java.type("javafx.print.PageLayout");
+PageOrientation                        = Java.type("javafx.print.PageOrientation");
+PageRange                              = Java.type("javafx.print.PageRange");
+Paper                                  = Java.type("javafx.print.Paper");
+Paper$Units                            = Java.type("javafx.print.Paper$Units");
+PaperSource                            = Java.type("javafx.print.PaperSource");
+PrintColor                             = Java.type("javafx.print.PrintColor");
+Printer                                = Java.type("javafx.print.Printer");
+Printer$MarginType                     = Java.type("javafx.print.Printer$MarginType");
+PrinterAttributes                      = Java.type("javafx.print.PrinterAttributes");
+PrinterJob                             = Java.type("javafx.print.PrinterJob");
+PrinterJob$JobStatus                   = Java.type("javafx.print.PrinterJob$JobStatus");
+PrintQuality                           = Java.type("javafx.print.PrintQuality");
+PrintResolution                        = Java.type("javafx.print.PrintResolution");
+PrintSides                             = Java.type("javafx.print.PrintSides");
+AmbientLight                           = Java.type("javafx.scene.AmbientLight");
+AmbientLightBuilder                    = Java.type("javafx.scene.AmbientLightBuilder");
+CacheHint                              = Java.type("javafx.scene.CacheHint");
+Camera                                 = Java.type("javafx.scene.Camera");
+CameraBuilder                          = Java.type("javafx.scene.CameraBuilder");
+Canvas                                 = Java.type("javafx.scene.canvas.Canvas");
+CanvasBuilder                          = Java.type("javafx.scene.canvas.CanvasBuilder");
+GraphicsContext                        = Java.type("javafx.scene.canvas.GraphicsContext");
+Cursor                                 = Java.type("javafx.scene.Cursor");
+DepthTest                              = Java.type("javafx.scene.DepthTest");
+Blend                                  = Java.type("javafx.scene.effect.Blend");
+BlendBuilder                           = Java.type("javafx.scene.effect.BlendBuilder");
+BlendMode                              = Java.type("javafx.scene.effect.BlendMode");
+Bloom                                  = Java.type("javafx.scene.effect.Bloom");
+BloomBuilder                           = Java.type("javafx.scene.effect.BloomBuilder");
+BlurType                               = Java.type("javafx.scene.effect.BlurType");
+BoxBlur                                = Java.type("javafx.scene.effect.BoxBlur");
+BoxBlurBuilder                         = Java.type("javafx.scene.effect.BoxBlurBuilder");
+ColorAdjust                            = Java.type("javafx.scene.effect.ColorAdjust");
+ColorAdjustBuilder                     = Java.type("javafx.scene.effect.ColorAdjustBuilder");
+ColorInput                             = Java.type("javafx.scene.effect.ColorInput");
+ColorInputBuilder                      = Java.type("javafx.scene.effect.ColorInputBuilder");
+DisplacementMap                        = Java.type("javafx.scene.effect.DisplacementMap");
+DisplacementMapBuilder                 = Java.type("javafx.scene.effect.DisplacementMapBuilder");
+DropShadow                             = Java.type("javafx.scene.effect.DropShadow");
+DropShadowBuilder                      = Java.type("javafx.scene.effect.DropShadowBuilder");
+Effect                                 = Java.type("javafx.scene.effect.Effect");
+FloatMap                               = Java.type("javafx.scene.effect.FloatMap");
+FloatMapBuilder                        = Java.type("javafx.scene.effect.FloatMapBuilder");
+GaussianBlur                           = Java.type("javafx.scene.effect.GaussianBlur");
+GaussianBlurBuilder                    = Java.type("javafx.scene.effect.GaussianBlurBuilder");
+Glow                                   = Java.type("javafx.scene.effect.Glow");
+GlowBuilder                            = Java.type("javafx.scene.effect.GlowBuilder");
+ImageInput                             = Java.type("javafx.scene.effect.ImageInput");
+ImageInputBuilder                      = Java.type("javafx.scene.effect.ImageInputBuilder");
+InnerShadow                            = Java.type("javafx.scene.effect.InnerShadow");
+InnerShadowBuilder                     = Java.type("javafx.scene.effect.InnerShadowBuilder");
+Light                                  = Java.type("javafx.scene.effect.Light");
+Light$Distant                          = Java.type("javafx.scene.effect.Light$Distant");
+Light$Point                            = Java.type("javafx.scene.effect.Light$Point");
+Light$Spot                             = Java.type("javafx.scene.effect.Light$Spot");
+LightBuilder                           = Java.type("javafx.scene.effect.LightBuilder");
+Lighting                               = Java.type("javafx.scene.effect.Lighting");
+LightingBuilder                        = Java.type("javafx.scene.effect.LightingBuilder");
+MotionBlur                             = Java.type("javafx.scene.effect.MotionBlur");
+MotionBlurBuilder                      = Java.type("javafx.scene.effect.MotionBlurBuilder");
+PerspectiveTransform                   = Java.type("javafx.scene.effect.PerspectiveTransform");
+PerspectiveTransformBuilder            = Java.type("javafx.scene.effect.PerspectiveTransformBuilder");
+Reflection                             = Java.type("javafx.scene.effect.Reflection");
+ReflectionBuilder                      = Java.type("javafx.scene.effect.ReflectionBuilder");
+SepiaTone                              = Java.type("javafx.scene.effect.SepiaTone");
+SepiaToneBuilder                       = Java.type("javafx.scene.effect.SepiaToneBuilder");
+Shadow                                 = Java.type("javafx.scene.effect.Shadow");
+ShadowBuilder                          = Java.type("javafx.scene.effect.ShadowBuilder");
+//Group                                  = Java.type("javafx.scene.Group");
+GroupBuilder                           = Java.type("javafx.scene.GroupBuilder");
+Image                                  = Java.type("javafx.scene.image.Image");
+ImageView                              = Java.type("javafx.scene.image.ImageView");
+ImageViewBuilder                       = Java.type("javafx.scene.image.ImageViewBuilder");
+PixelFormat                            = Java.type("javafx.scene.image.PixelFormat");
+PixelFormat$Type                       = Java.type("javafx.scene.image.PixelFormat$Type");
+PixelReader                            = Java.type("javafx.scene.image.PixelReader");
+PixelWriter                            = Java.type("javafx.scene.image.PixelWriter");
+WritableImage                          = Java.type("javafx.scene.image.WritableImage");
+WritablePixelFormat                    = Java.type("javafx.scene.image.WritablePixelFormat");
+ImageCursor                            = Java.type("javafx.scene.ImageCursor");
+ImageCursorBuilder                     = Java.type("javafx.scene.ImageCursorBuilder");
+Clipboard                              = Java.type("javafx.scene.input.Clipboard");
+ClipboardContent                       = Java.type("javafx.scene.input.ClipboardContent");
+ClipboardContentBuilder                = Java.type("javafx.scene.input.ClipboardContentBuilder");
+ContextMenuEvent                       = Java.type("javafx.scene.input.ContextMenuEvent");
+DataFormat                             = Java.type("javafx.scene.input.DataFormat");
+Dragboard                              = Java.type("javafx.scene.input.Dragboard");
+DragEvent                              = Java.type("javafx.scene.input.DragEvent");
+GestureEvent                           = Java.type("javafx.scene.input.GestureEvent");
+InputEvent                             = Java.type("javafx.scene.input.InputEvent");
+InputEventBuilder                      = Java.type("javafx.scene.input.InputEventBuilder");
+InputMethodEvent                       = Java.type("javafx.scene.input.InputMethodEvent");
+InputMethodHighlight                   = Java.type("javafx.scene.input.InputMethodHighlight");
+InputMethodRequests                    = Java.type("javafx.scene.input.InputMethodRequests");
+InputMethodTextRun                     = Java.type("javafx.scene.input.InputMethodTextRun");
+InputMethodTextRunBuilder              = Java.type("javafx.scene.input.InputMethodTextRunBuilder");
+KeyCharacterCombination                = Java.type("javafx.scene.input.KeyCharacterCombination");
+KeyCharacterCombinationBuilder         = Java.type("javafx.scene.input.KeyCharacterCombinationBuilder");
+KeyCode                                = Java.type("javafx.scene.input.KeyCode");
+KeyCodeCombination                     = Java.type("javafx.scene.input.KeyCodeCombination");
+KeyCodeCombinationBuilder              = Java.type("javafx.scene.input.KeyCodeCombinationBuilder");
+KeyCombination                         = Java.type("javafx.scene.input.KeyCombination");
+KeyCombination$Modifier                = Java.type("javafx.scene.input.KeyCombination$Modifier");
+KeyCombination$ModifierValue           = Java.type("javafx.scene.input.KeyCombination$ModifierValue");
+KeyEvent                               = Java.type("javafx.scene.input.KeyEvent");
+Mnemonic                               = Java.type("javafx.scene.input.Mnemonic");
+MnemonicBuilder                        = Java.type("javafx.scene.input.MnemonicBuilder");
+MouseButton                            = Java.type("javafx.scene.input.MouseButton");
+MouseDragEvent                         = Java.type("javafx.scene.input.MouseDragEvent");
+MouseEvent                             = Java.type("javafx.scene.input.MouseEvent");
+PickResult                             = Java.type("javafx.scene.input.PickResult");
+RotateEvent                            = Java.type("javafx.scene.input.RotateEvent");
+ScrollEvent                            = Java.type("javafx.scene.input.ScrollEvent");
+ScrollEvent$HorizontalTextScrollUnits  = Java.type("javafx.scene.input.ScrollEvent$HorizontalTextScrollUnits");
+ScrollEvent$VerticalTextScrollUnits    = Java.type("javafx.scene.input.ScrollEvent$VerticalTextScrollUnits");
+SwipeEvent                             = Java.type("javafx.scene.input.SwipeEvent");
+TouchEvent                             = Java.type("javafx.scene.input.TouchEvent");
+TouchPoint                             = Java.type("javafx.scene.input.TouchPoint");
+TouchPoint$State                       = Java.type("javafx.scene.input.TouchPoint$State");
+TouchPointBuilder                      = Java.type("javafx.scene.input.TouchPointBuilder");
+TransferMode                           = Java.type("javafx.scene.input.TransferMode");
+ZoomEvent                              = Java.type("javafx.scene.input.ZoomEvent");
+AnchorPane                             = Java.type("javafx.scene.layout.AnchorPane");
+AnchorPaneBuilder                      = Java.type("javafx.scene.layout.AnchorPaneBuilder");
+Background                             = Java.type("javafx.scene.layout.Background");
+BackgroundBuilder                      = Java.type("javafx.scene.layout.BackgroundBuilder");
+BackgroundFill                         = Java.type("javafx.scene.layout.BackgroundFill");
+BackgroundFillBuilder                  = Java.type("javafx.scene.layout.BackgroundFillBuilder");
+BackgroundImage                        = Java.type("javafx.scene.layout.BackgroundImage");
+BackgroundImageBuilder                 = Java.type("javafx.scene.layout.BackgroundImageBuilder");
+BackgroundPosition                     = Java.type("javafx.scene.layout.BackgroundPosition");
+BackgroundPositionBuilder              = Java.type("javafx.scene.layout.BackgroundPositionBuilder");
+BackgroundRepeat                       = Java.type("javafx.scene.layout.BackgroundRepeat");
+BackgroundSize                         = Java.type("javafx.scene.layout.BackgroundSize");
+BackgroundSizeBuilder                  = Java.type("javafx.scene.layout.BackgroundSizeBuilder");
+Border                                 = Java.type("javafx.scene.layout.Border");
+BorderBuilder                          = Java.type("javafx.scene.layout.BorderBuilder");
+BorderImage                            = Java.type("javafx.scene.layout.BorderImage");
+BorderImageBuilder                     = Java.type("javafx.scene.layout.BorderImageBuilder");
+BorderPane                             = Java.type("javafx.scene.layout.BorderPane");
+BorderPaneBuilder                      = Java.type("javafx.scene.layout.BorderPaneBuilder");
+BorderRepeat                           = Java.type("javafx.scene.layout.BorderRepeat");
+BorderStroke                           = Java.type("javafx.scene.layout.BorderStroke");
+BorderStrokeBuilder                    = Java.type("javafx.scene.layout.BorderStrokeBuilder");
+BorderStrokeStyle                      = Java.type("javafx.scene.layout.BorderStrokeStyle");
+BorderStrokeStyleBuilder               = Java.type("javafx.scene.layout.BorderStrokeStyleBuilder");
+BorderWidths                           = Java.type("javafx.scene.layout.BorderWidths");
+BorderWidthsBuilder                    = Java.type("javafx.scene.layout.BorderWidthsBuilder");
+ColumnConstraints                      = Java.type("javafx.scene.layout.ColumnConstraints");
+ColumnConstraintsBuilder               = Java.type("javafx.scene.layout.ColumnConstraintsBuilder");
+ConstraintsBase                        = Java.type("javafx.scene.layout.ConstraintsBase");
+CornerRadii                            = Java.type("javafx.scene.layout.CornerRadii");
+FlowPane                               = Java.type("javafx.scene.layout.FlowPane");
+FlowPaneBuilder                        = Java.type("javafx.scene.layout.FlowPaneBuilder");
+GridPane                               = Java.type("javafx.scene.layout.GridPane");
+GridPaneBuilder                        = Java.type("javafx.scene.layout.GridPaneBuilder");
+HBox                                   = Java.type("javafx.scene.layout.HBox");
+HBoxBuilder                            = Java.type("javafx.scene.layout.HBoxBuilder");
+Pane                                   = Java.type("javafx.scene.layout.Pane");
+PaneBuilder                            = Java.type("javafx.scene.layout.PaneBuilder");
+Priority                               = Java.type("javafx.scene.layout.Priority");
+Region                                 = Java.type("javafx.scene.layout.Region");
+RegionBuilder                          = Java.type("javafx.scene.layout.RegionBuilder");
+RowConstraints                         = Java.type("javafx.scene.layout.RowConstraints");
+RowConstraintsBuilder                  = Java.type("javafx.scene.layout.RowConstraintsBuilder");
+StackPane                              = Java.type("javafx.scene.layout.StackPane");
+StackPaneBuilder                       = Java.type("javafx.scene.layout.StackPaneBuilder");
+TilePane                               = Java.type("javafx.scene.layout.TilePane");
+TilePaneBuilder                        = Java.type("javafx.scene.layout.TilePaneBuilder");
+VBox                                   = Java.type("javafx.scene.layout.VBox");
+VBoxBuilder                            = Java.type("javafx.scene.layout.VBoxBuilder");
+LightBase                              = Java.type("javafx.scene.LightBase");
+LightBaseBuilder                       = Java.type("javafx.scene.LightBaseBuilder");
+Node                                   = Java.type("javafx.scene.Node");
+NodeBuilder                            = Java.type("javafx.scene.NodeBuilder");
+Color                                  = Java.type("javafx.scene.paint.Color");
+ColorBuilder                           = Java.type("javafx.scene.paint.ColorBuilder");
+CycleMethod                            = Java.type("javafx.scene.paint.CycleMethod");
+ImagePattern                           = Java.type("javafx.scene.paint.ImagePattern");
+ImagePatternBuilder                    = Java.type("javafx.scene.paint.ImagePatternBuilder");
+LinearGradient                         = Java.type("javafx.scene.paint.LinearGradient");
+LinearGradientBuilder                  = Java.type("javafx.scene.paint.LinearGradientBuilder");
+Material                               = Java.type("javafx.scene.paint.Material");
+Paint                                  = Java.type("javafx.scene.paint.Paint");
+PhongMaterial                          = Java.type("javafx.scene.paint.PhongMaterial");
+PhongMaterialBuilder                   = Java.type("javafx.scene.paint.PhongMaterialBuilder");
+RadialGradient                         = Java.type("javafx.scene.paint.RadialGradient");
+RadialGradientBuilder                  = Java.type("javafx.scene.paint.RadialGradientBuilder");
+Stop                                   = Java.type("javafx.scene.paint.Stop");
+StopBuilder                            = Java.type("javafx.scene.paint.StopBuilder");
+ParallelCamera                         = Java.type("javafx.scene.ParallelCamera");
+ParallelCameraBuilder                  = Java.type("javafx.scene.ParallelCameraBuilder");
+Parent                                 = Java.type("javafx.scene.Parent");
+ParentBuilder                          = Java.type("javafx.scene.ParentBuilder");
+PerspectiveCamera                      = Java.type("javafx.scene.PerspectiveCamera");
+PerspectiveCameraBuilder               = Java.type("javafx.scene.PerspectiveCameraBuilder");
+PointLight                             = Java.type("javafx.scene.PointLight");
+PointLightBuilder                      = Java.type("javafx.scene.PointLightBuilder");
+//Scene                                  = Java.type("javafx.scene.Scene");
+SceneBuilder                           = Java.type("javafx.scene.SceneBuilder");
+Arc                                    = Java.type("javafx.scene.shape.Arc");
+ArcBuilder                             = Java.type("javafx.scene.shape.ArcBuilder");
+ArcTo                                  = Java.type("javafx.scene.shape.ArcTo");
+ArcToBuilder                           = Java.type("javafx.scene.shape.ArcToBuilder");
+ArcType                                = Java.type("javafx.scene.shape.ArcType");
+Box                                    = Java.type("javafx.scene.shape.Box");
+BoxBuilder                             = Java.type("javafx.scene.shape.BoxBuilder");
+Circle                                 = Java.type("javafx.scene.shape.Circle");
+CircleBuilder                          = Java.type("javafx.scene.shape.CircleBuilder");
+ClosePath                              = Java.type("javafx.scene.shape.ClosePath");
+ClosePathBuilder                       = Java.type("javafx.scene.shape.ClosePathBuilder");
+CubicCurve                             = Java.type("javafx.scene.shape.CubicCurve");
+CubicCurveBuilder                      = Java.type("javafx.scene.shape.CubicCurveBuilder");
+CubicCurveTo                           = Java.type("javafx.scene.shape.CubicCurveTo");
+CubicCurveToBuilder                    = Java.type("javafx.scene.shape.CubicCurveToBuilder");
+CullFace                               = Java.type("javafx.scene.shape.CullFace");
+Cylinder                               = Java.type("javafx.scene.shape.Cylinder");
+CylinderBuilder                        = Java.type("javafx.scene.shape.CylinderBuilder");
+DrawMode                               = Java.type("javafx.scene.shape.DrawMode");
+Ellipse                                = Java.type("javafx.scene.shape.Ellipse");
+EllipseBuilder                         = Java.type("javafx.scene.shape.EllipseBuilder");
+FillRule                               = Java.type("javafx.scene.shape.FillRule");
+HLineTo                                = Java.type("javafx.scene.shape.HLineTo");
+HLineToBuilder                         = Java.type("javafx.scene.shape.HLineToBuilder");
+Line                                   = Java.type("javafx.scene.shape.Line");
+LineBuilder                            = Java.type("javafx.scene.shape.LineBuilder");
+LineTo                                 = Java.type("javafx.scene.shape.LineTo");
+LineToBuilder                          = Java.type("javafx.scene.shape.LineToBuilder");
+Mesh                                   = Java.type("javafx.scene.shape.Mesh");
+MeshView                               = Java.type("javafx.scene.shape.MeshView");
+MeshViewBuilder                        = Java.type("javafx.scene.shape.MeshViewBuilder");
+MoveTo                                 = Java.type("javafx.scene.shape.MoveTo");
+MoveToBuilder                          = Java.type("javafx.scene.shape.MoveToBuilder");
+Path                                   = Java.type("javafx.scene.shape.Path");
+PathBuilder                            = Java.type("javafx.scene.shape.PathBuilder");
+PathElement                            = Java.type("javafx.scene.shape.PathElement");
+PathElementBuilder                     = Java.type("javafx.scene.shape.PathElementBuilder");
+Polygon                                = Java.type("javafx.scene.shape.Polygon");
+PolygonBuilder                         = Java.type("javafx.scene.shape.PolygonBuilder");
+Polyline                               = Java.type("javafx.scene.shape.Polyline");
+PolylineBuilder                        = Java.type("javafx.scene.shape.PolylineBuilder");
+QuadCurve                              = Java.type("javafx.scene.shape.QuadCurve");
+QuadCurveBuilder                       = Java.type("javafx.scene.shape.QuadCurveBuilder");
+QuadCurveTo                            = Java.type("javafx.scene.shape.QuadCurveTo");
+QuadCurveToBuilder                     = Java.type("javafx.scene.shape.QuadCurveToBuilder");
+Rectangle                              = Java.type("javafx.scene.shape.Rectangle");
+RectangleBuilder                       = Java.type("javafx.scene.shape.RectangleBuilder");
+Shape                                  = Java.type("javafx.scene.shape.Shape");
+Shape3D                                = Java.type("javafx.scene.shape.Shape3D");
+Shape3DBuilder                         = Java.type("javafx.scene.shape.Shape3DBuilder");
+ShapeBuilder                           = Java.type("javafx.scene.shape.ShapeBuilder");
+Sphere                                 = Java.type("javafx.scene.shape.Sphere");
+SphereBuilder                          = Java.type("javafx.scene.shape.SphereBuilder");
+StrokeLineCap                          = Java.type("javafx.scene.shape.StrokeLineCap");
+StrokeLineJoin                         = Java.type("javafx.scene.shape.StrokeLineJoin");
+StrokeType                             = Java.type("javafx.scene.shape.StrokeType");
+SVGPath                                = Java.type("javafx.scene.shape.SVGPath");
+SVGPathBuilder                         = Java.type("javafx.scene.shape.SVGPathBuilder");
+TriangleMesh                           = Java.type("javafx.scene.shape.TriangleMesh");
+VLineTo                                = Java.type("javafx.scene.shape.VLineTo");
+VLineToBuilder                         = Java.type("javafx.scene.shape.VLineToBuilder");
+SnapshotParameters                     = Java.type("javafx.scene.SnapshotParameters");
+SnapshotParametersBuilder              = Java.type("javafx.scene.SnapshotParametersBuilder");
+SnapshotResult                         = Java.type("javafx.scene.SnapshotResult");
+SubScene                               = Java.type("javafx.scene.SubScene");
+SubSceneBuilder                        = Java.type("javafx.scene.SubSceneBuilder");
+Font                                   = Java.type("javafx.scene.text.Font");
+FontBuilder                            = Java.type("javafx.scene.text.FontBuilder");
+FontPosture                            = Java.type("javafx.scene.text.FontPosture");
+FontSmoothingType                      = Java.type("javafx.scene.text.FontSmoothingType");
+FontWeight                             = Java.type("javafx.scene.text.FontWeight");
+Text                                   = Java.type("javafx.scene.text.Text");
+TextAlignment                          = Java.type("javafx.scene.text.TextAlignment");
+TextBoundsType                         = Java.type("javafx.scene.text.TextBoundsType");
+TextBuilder                            = Java.type("javafx.scene.text.TextBuilder");
+TextFlow                               = Java.type("javafx.scene.text.TextFlow");
+TextFlowBuilder                        = Java.type("javafx.scene.text.TextFlowBuilder");
+Affine                                 = Java.type("javafx.scene.transform.Affine");
+AffineBuilder                          = Java.type("javafx.scene.transform.AffineBuilder");
+MatrixType                             = Java.type("javafx.scene.transform.MatrixType");
+NonInvertibleTransformException        = Java.type("javafx.scene.transform.NonInvertibleTransformException");
+Rotate                                 = Java.type("javafx.scene.transform.Rotate");
+RotateBuilder                          = Java.type("javafx.scene.transform.RotateBuilder");
+Scale                                  = Java.type("javafx.scene.transform.Scale");
+ScaleBuilder                           = Java.type("javafx.scene.transform.ScaleBuilder");
+Shear                                  = Java.type("javafx.scene.transform.Shear");
+ShearBuilder                           = Java.type("javafx.scene.transform.ShearBuilder");
+Transform                              = Java.type("javafx.scene.transform.Transform");
+TransformBuilder                       = Java.type("javafx.scene.transform.TransformBuilder");
+TransformChangedEvent                  = Java.type("javafx.scene.transform.TransformChangedEvent");
+Translate                              = Java.type("javafx.scene.transform.Translate");
+TranslateBuilder                       = Java.type("javafx.scene.transform.TranslateBuilder");
+DirectoryChooser                       = Java.type("javafx.stage.DirectoryChooser");
+DirectoryChooserBuilder                = Java.type("javafx.stage.DirectoryChooserBuilder");
+FileChooser                            = Java.type("javafx.stage.FileChooser");
+FileChooser$ExtensionFilter            = Java.type("javafx.stage.FileChooser$ExtensionFilter");
+FileChooserBuilder                     = Java.type("javafx.stage.FileChooserBuilder");
+Modality                               = Java.type("javafx.stage.Modality");
+Popup                                  = Java.type("javafx.stage.Popup");
+PopupBuilder                           = Java.type("javafx.stage.PopupBuilder");
+PopupWindow                            = Java.type("javafx.stage.PopupWindow");
+PopupWindowBuilder                     = Java.type("javafx.stage.PopupWindowBuilder");
+Screen                                 = Java.type("javafx.stage.Screen");
+//Stage                                  = Java.type("javafx.stage.Stage");
+StageBuilder                           = Java.type("javafx.stage.StageBuilder");
+StageStyle                             = Java.type("javafx.stage.StageStyle");
+Window                                 = Java.type("javafx.stage.Window");
+WindowBuilder                          = Java.type("javafx.stage.WindowBuilder");
+WindowEvent                            = Java.type("javafx.stage.WindowEvent");
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/media.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+AudioClip             = Java.type("javafx.scene.media.AudioClip");
+AudioClipBuilder      = Java.type("javafx.scene.media.AudioClipBuilder");
+AudioEqualizer        = Java.type("javafx.scene.media.AudioEqualizer");
+AudioSpectrumListener = Java.type("javafx.scene.media.AudioSpectrumListener");
+AudioTrack            = Java.type("javafx.scene.media.AudioTrack");
+EqualizerBand         = Java.type("javafx.scene.media.EqualizerBand");
+Media                 = Java.type("javafx.scene.media.Media");
+MediaBuilder          = Java.type("javafx.scene.media.MediaBuilder");
+MediaErrorEvent       = Java.type("javafx.scene.media.MediaErrorEvent");
+MediaException        = Java.type("javafx.scene.media.MediaException");
+MediaException$Type   = Java.type("javafx.scene.media.MediaException$Type");
+MediaMarkerEvent      = Java.type("javafx.scene.media.MediaMarkerEvent");
+MediaPlayer           = Java.type("javafx.scene.media.MediaPlayer");
+MediaPlayer$Status    = Java.type("javafx.scene.media.MediaPlayer$Status");
+MediaPlayerBuilder    = Java.type("javafx.scene.media.MediaPlayerBuilder");
+MediaView             = Java.type("javafx.scene.media.MediaView");
+MediaViewBuilder      = Java.type("javafx.scene.media.MediaViewBuilder");
+SubtitleTrack         = Java.type("javafx.scene.media.SubtitleTrack");
+Track                 = Java.type("javafx.scene.media.Track");
+VideoTrack            = Java.type("javafx.scene.media.VideoTrack");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swing.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+JFXPanel        = Java.type("javafx.embed.swing.JFXPanel");
+JFXPanelBuilder = Java.type("javafx.embed.swing.JFXPanelBuilder");
+SwingFXUtils    = Java.type("javafx.embed.swing.SwingFXUtils");
+SwingNode       = Java.type("javafx.embed.swing.SwingNode");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/swt.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+CustomTransfer        = Java.type("javafx.embed.swt.CustomTransfer");
+CustomTransferBuilder = Java.type("javafx.embed.swt.CustomTransferBuilder");
+FXCanvas              = Java.type("javafx.embed.swt.FXCanvas");
+SWTFXUtils            = Java.type("javafx.embed.swt.SWTFXUtils");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/fx/web.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+HTMLEditor        = Java.type("javafx.scene.web.HTMLEditor");
+HTMLEditorBuilder = Java.type("javafx.scene.web.HTMLEditorBuilder");
+PopupFeatures     = Java.type("javafx.scene.web.PopupFeatures");
+PromptData        = Java.type("javafx.scene.web.PromptData");
+PromptDataBuilder = Java.type("javafx.scene.web.PromptDataBuilder");
+WebEngine         = Java.type("javafx.scene.web.WebEngine");
+WebEngineBuilder  = Java.type("javafx.scene.web.WebEngineBuilder");
+WebEvent          = Java.type("javafx.scene.web.WebEvent");
+WebHistory        = Java.type("javafx.scene.web.WebHistory");
+WebView           = Java.type("javafx.scene.web.WebView");
+WebViewBuilder    = Java.type("javafx.scene.web.WebViewBuilder");
--- a/nashorn/src/jdk/nashorn/tools/Shell.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/src/jdk/nashorn/tools/Shell.java	Wed May 08 10:10:05 2013 +0100
@@ -42,9 +42,12 @@
 import jdk.nashorn.api.scripting.NashornException;
 import jdk.nashorn.internal.codegen.Compiler;
 import jdk.nashorn.internal.ir.FunctionNode;
+import jdk.nashorn.internal.ir.debug.ASTWriter;
+import jdk.nashorn.internal.ir.debug.PrintVisitor;
 import jdk.nashorn.internal.parser.Parser;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
+import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -168,7 +171,11 @@
             return compileScripts(context, global, files);
         }
 
-        return runScripts(context, global, files);
+        if (env._fx) {
+            return runFXScripts(context, global, files);
+        } else {
+            return runScripts(context, global, files);
+        }
     }
 
     /**
@@ -254,6 +261,14 @@
                     return COMPILATION_ERROR;
                 }
 
+                if (env._print_ast) {
+                    context.getErr().println(new ASTWriter(functionNode));
+                }
+
+                if (env._print_parse) {
+                    context.getErr().println(new PrintVisitor(functionNode));
+                }
+
                 //null - pass no code installer - this is compile only
                 new Compiler(env, functionNode).compile();
             }
@@ -318,6 +333,46 @@
     }
 
     /**
+     * Runs launches "fx:bootstrap.js" with the given JavaScript files provided
+     * as arguments.
+     *
+     * @param context the nashorn context
+     * @param global the global scope
+     * @param files the list of script files to provide
+     *
+     * @return error code
+     * @throws IOException when any script file read results in I/O error
+     */
+    private int runFXScripts(final Context context, final ScriptObject global, final List<String> files) throws IOException {
+        final ScriptObject oldGlobal = Context.getGlobal();
+        final boolean globalChanged = (oldGlobal != global);
+        try {
+            if (globalChanged) {
+                Context.setGlobal(global);
+            }
+
+            global.addOwnProperty("$GLOBAL", Property.NOT_ENUMERABLE, global);
+            global.addOwnProperty("$SCRIPTS", Property.NOT_ENUMERABLE, files);
+            context.load(global, "fx:bootstrap.js");
+        } catch (final NashornException e) {
+            context.getErrorManager().error(e.toString());
+            if (context.getEnv()._dump_on_error) {
+                e.printStackTrace(context.getErr());
+            }
+
+            return RUNTIME_ERROR;
+        } finally {
+            context.getOut().flush();
+            context.getErr().flush();
+            if (globalChanged) {
+                Context.setGlobal(oldGlobal);
+            }
+        }
+
+        return SUCCESS;
+    }
+
+    /**
      * Hook to ScriptFunction "apply". A performance metering shell may
      * introduce enter/exit timing here.
      *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/examples/int-micro.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+
+function bench(name, func) {
+    var start = Date.now();
+    for (var iter = 0; iter < 5000000; iter++) {
+        func();
+    }
+    print(name + "\t" + (Date.now() - start));
+}
+
+function uint32(value) {
+    return function() {
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+        value >>> 0;
+    };
+}
+
+function int32(value) {
+    return function() {
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+        value >> 0;
+    };
+}
+
+print("\nToUint32");
+for (var i = 1; i < 3; i++) {
+    bench("infinity      ", uint32(Infinity));
+    bench("infinity neg  ", uint32(-Infinity));
+    bench("nan           ", uint32(NaN));
+    bench("small         ", uint32(1));
+    bench("small neg     ", uint32(-1));
+    bench("small frac    ", uint32(1.5));
+    bench("small neg frac", uint32(-1.5));
+    bench("large         ", uint32(9223372036854775807));
+    bench("large neg     ", uint32(-9223372036854775808));
+}
+
+print("\nToInt32");
+for (var i = 1; i < 3; i++) {
+    bench("infinity      ", int32(Infinity));
+    bench("infinity neg  ", int32(-Infinity));
+    bench("nan           ", int32(NaN));
+    bench("small         ", int32(1));
+    bench("small neg     ", int32(-1));
+    bench("small frac    ", int32(1.5));
+    bench("small neg frac", int32(-1.5));
+    bench("large         ", int32(9223372036854775807));
+    bench("large neg     ", int32(-9223372036854775808));
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008238.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8008238: Labeled break in finally causes stack overflow in Node copy
+ *
+ * @test
+ * @run
+ */
+
+a: try {
+} finally {
+    break a;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008814-3.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's not a compile time error to have a nested strict function declaration when the outer one is not strict
+ *
+ * @test
+ * @run
+ */
+
+function f() {
+  if(true) {
+    function g() {
+      "use strict";
+      print("g invoked!")
+    }
+  }
+  g()
+}
+f()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008814-3.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,1 @@
+g invoked!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008814-4.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's not a compile time error to have a nested function declaration when warnings are reported
+ *
+ * @option --function-statement-warning
+ * @test
+ * @run/ignore-std-error
+ */
+
+function f() {
+  if(true) {
+    function g() {
+      print("g invoked!")
+    }
+  }
+  g()
+}
+f()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8008814-4.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,1 @@
+g invoked!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8011578.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8011578 : -Dnashorn.unstable.relink.threshold=1 causes tests to fail.
+ *
+ * @test
+ * @option -Dnashorn.unstable.relink.threshold=1
+ * @run
+ */
+
+load(__DIR__ + "NASHORN-296.js");
+load(__DIR__ + "NASHORN-691.js");
+load(__DIR__ + "calllink.js");
+load(__DIR__ + "nosuchproperty.js");
+
+__noSuchProperty__ = function(x) {
+    print(x);
+    return x;
+}
+
+print(this["find"]);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8011578.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,22 @@
+o.foo = 33
+o.foo = 44
+o.foo = 3
+o.foo = hello
+obj1.func called
+obj2.func called
+no such method: func
+obj4's prototype func called
+MyConstructor.prototype.func
+MyConstructor.prototype.func
+obj1.func called
+obj2.func called
+new obj3.func called
+new obj4.func called
+all new MyConstructor.prototype.func
+all new MyConstructor.prototype.func
+obj.__noSuchProperty__ for foo
+new obj.__noSuchProperty__ for foo
+proto.__noSuchProperty__ for foo
+new proto.__noSuchProperty__ for foo
+find
+find
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012240.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012240: Array.prototype.map.call({length: -1, get 0(){throw 0}}, function(){}).length does not throw error
+ *
+ * @test
+ * @run
+ */
+
+var in_getter_for_0 = false;
+
+try {
+    Array.prototype.map.call(
+        {
+            length: -1, 
+            get 0() {
+                in_getter_for_0 = true;
+                throw 0;
+            }
+        }, 
+    function(){}).length;
+} catch (e) {
+    if (e !== 0 || !in_getter_for_0) {
+       fail("should have thrown error from getter for '0'th element");
+    }
+} 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012334.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012334: ToUint32, ToInt32, and ToUint16 don't conform to spec
+ *
+ * @test
+ * @run
+ */
+
+
+function test(val) {
+    print(val | 0);
+    print(val >> 0);
+    print(val >>> 0);
+    print(1 >>> val);
+    print(parseInt("10", val));
+}
+
+test(0);
+test(-0);
+test('Infinity');
+test('+Infinity');
+test('-Infinity');
+test(Number.POSITIVE_INFINITY);
+test(Number.NEGATIVE_INFINITY);
+test(Number.NaN);
+test(Number.MIN_VALUE);
+test(-Number.MIN_VALUE);
+test(1);
+test(-1);
+test(0.1);
+test(-0.1);
+test(1.1);
+test(-1.1);
+test(9223372036854775807);
+test(-9223372036854775808);
+test('9223372036854775807');
+test('-9223372036854775808');
+test(2147483647);
+test(2147483648);
+test(2147483649);
+test(-2147483647);
+test(-2147483648);
+test(-2147483649);
+test(4294967295);
+test(4294967296);
+test(4294967297);
+test(-4294967295);
+test(-4294967296);
+test(-4294967297);
+test(1e23);
+test(-1e23);
+test(1e24);
+test(-1e24);
+test(1e25);
+test(-1e25);
+test(1e26);
+test(-1e26);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012334.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,200 @@
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
+2147483647
+2147483647
+2147483647
+0
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+-2147483647
+-2147483647
+2147483649
+0
+NaN
+-2147483647
+-2147483647
+2147483649
+0
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+2147483647
+2147483647
+2147483647
+0
+NaN
+-1
+-1
+4294967295
+0
+NaN
+0
+0
+0
+1
+10
+1
+1
+1
+0
+NaN
+1
+1
+1
+0
+NaN
+0
+0
+0
+1
+10
+-1
+-1
+4294967295
+0
+NaN
+-167772160
+-167772160
+4127195136
+1
+NaN
+167772160
+167772160
+167772160
+1
+NaN
+-1610612736
+-1610612736
+2684354560
+1
+NaN
+1610612736
+1610612736
+1610612736
+1
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+-2147483648
+-2147483648
+2147483648
+1
+NaN
+0
+0
+0
+1
+10
+0
+0
+0
+1
+10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012457.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012457: Function.prototype.apply should accept any array-like argument for function arguments
+ *
+ * @test
+ * @run
+ */
+
+// no exception for these
+Function().apply(null, {length: null})
+Function().apply(null, {length: 0.1})
+
+// getter should be called
+var getter_0_called = false;
+
+Function().apply(null, 
+    Object.defineProperty([],"0",
+        {  get: function(){ getter_0_called = true; return 0 }
+    })
+);
+
+if (! getter_0_called) {
+    fail("getter for '0' of arguments array not called");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012460.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012460: RegExp regression
+ *
+ * @test
+ * @run
+ */
+
+
+var semver = "\\s*[v=]*\\s*([0-9]+)" // major
+        + "\\.([0-9]+)" // minor
+        + "\\.([0-9]+)" // patch
+        + "(-[0-9]+-?)?" // build
+        + "([a-zA-Z-+][a-zA-Z0-9-\.:]*)?" // tag
+    , exprComparator = "^((<|>)?=?)\s*("+semver+")$|^$";
+var validComparator = new RegExp("^"+exprComparator+"$");
+
+
+print(exprComparator);
+print(">=0.6.0-".match(validComparator));
+print("=0.6.0-".match(validComparator));
+print("0.6.0-".match(validComparator));
+print("<=0.6.0-".match(validComparator));
+print(">=0.6.0-a:b-c.d".match(validComparator));
+print("=0.6.0-a:b-c.d".match(validComparator));
+print("0.6.0+a:b-c.d".match(validComparator));
+print("<=0.6.0+a:b-c.d".match(validComparator));
+
+print(/[a-zA-Z-+]/.exec("a"));
+print(/[a-zA-Z-+]/.exec("b"));
+print(/[a-zA-Z-+]/.exec("y"));
+print(/[a-zA-Z-+]/.exec("z"));
+print(/[a-zA-Z-+]/.exec("B"));
+print(/[a-zA-Z-+]/.exec("Y"));
+print(/[a-zA-Z-+]/.exec("Z"));
+print(/[a-zA-Z-+]/.exec("-"));
+print(/[a-zA-Z-+]/.exec("+"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012460.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,18 @@
+^((<|>)?=?)s*(\s*[v=]*\s*([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9]+-?)?([a-zA-Z-+][a-zA-Z0-9-.:]*)?)$|^$
+>=0.6.0-,>=,>,0.6.0-,0,6,0,,-
+=0.6.0-,=,,0.6.0-,0,6,0,,-
+0.6.0-,,,0.6.0-,0,6,0,,-
+<=0.6.0-,<=,<,0.6.0-,0,6,0,,-
+>=0.6.0-a:b-c.d,>=,>,0.6.0-a:b-c.d,0,6,0,,-a:b-c.d
+=0.6.0-a:b-c.d,=,,0.6.0-a:b-c.d,0,6,0,,-a:b-c.d
+0.6.0+a:b-c.d,,,0.6.0+a:b-c.d,0,6,0,,+a:b-c.d
+<=0.6.0+a:b-c.d,<=,<,0.6.0+a:b-c.d,0,6,0,,+a:b-c.d
+a
+b
+y
+z
+B
+Y
+Z
+-
++
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012462.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012462: Date.prototype.toJSON does not handle non-Date 'this' as per the spec.
+ *
+ * @test
+ * @run
+ */
+
+var toJSON = Date.prototype.toJSON;
+
+function checkJSON(value, expected) {
+    var res = toJSON.call({
+        valueOf: function() { return value; },
+        toISOString: function() { return value; }
+    });
+
+    if (res !== expected) {
+        fail("Date.prototype.toJSON does not work for non-Date 'this'");
+    }
+}
+
+checkJSON(NaN, null);
+checkJSON(-Infinity, null);
+checkJSON(Infinity, null);
+checkJSON("foo", "foo");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012931.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8012931: NativeDate.safeToString() throws RangeError for invalid date
+ *
+ * @test
+ * @run
+ */
+
+var d = new Date(NaN);
+d.toString = Number.prototype.toString;
+
+try {
+    d.toString();
+} catch(e) {
+    print(e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8012931.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,1 @@
+TypeError: [Date Invalid Date] is not a Number
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013131.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013131: Various compatibility issues in String.prototype.split()
+ *
+ * @test
+ * @run
+ */
+
+
+// Make sure limit is honored with undefined/empty separator
+print(JSON.stringify("aa".split(undefined, 0)));
+print(JSON.stringify("abc".split("", 1)));
+
+// Make sure limit is honored with capture groups
+print(JSON.stringify("aa".split(/(a)/, 1)));
+print(JSON.stringify("aa".split(/(a)/, 2)));
+print(JSON.stringify("aa".split(/((a))/, 1)));
+print(JSON.stringify("aa".split(/((a))/, 2)));
+
+// Empty capture group at end of string should be ignored
+print(JSON.stringify("aaa".split(/((?:))/)));
+
+// Tests below are to make sure that split does not read or write lastIndex property
+var r = /a/;
+r.lastIndex = {
+    valueOf: function(){throw 2}
+};
+print(JSON.stringify("aa".split(r)));
+
+r = /a/g;
+r.lastIndex = 100;
+print(JSON.stringify("aa".split(r)));
+print(r.lastIndex);
+
+r = /((?:))/g;
+r.lastIndex = 100;
+print(JSON.stringify("aaa".split(r)));
+print(r.lastIndex);
+
+// Make sure lastIndex is not updated on non-global regexp
+r = /a/;
+r.lastIndex = 100;
+print(JSON.stringify(r.exec("aaa")));
+print(r.lastIndex);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013131.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,14 @@
+[]
+["a"]
+[""]
+["","a"]
+[""]
+["","a"]
+["a","","a","","a"]
+["","",""]
+["","",""]
+100
+["a","","a","","a"]
+100
+["a"]
+100
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013167.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013167: Vararg constructor was not found
+ *
+ * @test
+ * @run
+ */
+
+var x = new Packages.jdk.nashorn.test.models.VarArgConstructor(1, false, "a", "b", "c")
+print(x.indicator)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013167.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,1 @@
+vararg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013325.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013325: function named 'arguments' should still access arguments object within itself.
+ * Its parent should however see the function and not an arguments object.
+ *
+ * @test
+ * @run
+ */
+
+function x() {
+  // x doesn't see an arguments object as it has a nested function with that name
+  // so it'll invoke the function.
+  arguments("a", "b", "c");
+  
+  function arguments(x, y, z) {
+      // The function 'arguments' OTOH can't see itself; if it uses the 
+      // identifier 'arguments', it'll see its own arguments object.
+      print(arguments)
+      print(x + " " + y + " " + z)
+  }
+}
+x()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013325.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,2 @@
+[object Arguments]
+a b c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013337.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013337: Issues with Date.prototype's get, set functions 
+ *
+ * @test
+ * @option -timezone=Asia/Calcutta
+ * @run
+ */
+
+function check(str) {
+    print(str + " = " + eval(str));
+}
+
+check('new Date(NaN).setFullYear(NaN)');
+check('new Date(0).setYear(70)');
+check('new Date(0).setYear(NaN)');
+check('new Date(NaN).setYear(70)');
+check('new Date(NaN).getTimezoneOffset()');
+
+function checkGetterCalled(func) {
+    var getterCalled = false;
+
+    new Date(NaN)[func]( { valueOf: function() { getterCalled = true } } );
+
+    if (getterCalled) {
+       print("Date.prototype." + func + " calls valueOf on arg");
+    }
+}
+
+checkGetterCalled("setMilliseconds");
+checkGetterCalled("setUTCMilliseconds");
+checkGetterCalled("setSeconds");
+checkGetterCalled("setUTCSeconds");
+checkGetterCalled("setMinutes");
+checkGetterCalled("setUTCMinutes");
+checkGetterCalled("setHours");
+checkGetterCalled("setUTCHours");
+checkGetterCalled("setDate");
+checkGetterCalled("setUTCDate");
+checkGetterCalled("setMonth");
+checkGetterCalled("setUTCMonth");
+
+try {
+    Date.prototype.setTime.call({}, { valueOf: function() { throw "err" } }) 
+} catch (e) {
+    if (! (e instanceof TypeError)) {
+        fail("TypeError expected, got " + e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013337.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,17 @@
+new Date(NaN).setFullYear(NaN) = NaN
+new Date(0).setYear(70) = 0
+new Date(0).setYear(NaN) = NaN
+new Date(NaN).setYear(70) = -19800000
+new Date(NaN).getTimezoneOffset() = NaN
+Date.prototype.setMilliseconds calls valueOf on arg
+Date.prototype.setUTCMilliseconds calls valueOf on arg
+Date.prototype.setSeconds calls valueOf on arg
+Date.prototype.setUTCSeconds calls valueOf on arg
+Date.prototype.setMinutes calls valueOf on arg
+Date.prototype.setUTCMinutes calls valueOf on arg
+Date.prototype.setHours calls valueOf on arg
+Date.prototype.setUTCHours calls valueOf on arg
+Date.prototype.setDate calls valueOf on arg
+Date.prototype.setUTCDate calls valueOf on arg
+Date.prototype.setMonth calls valueOf on arg
+Date.prototype.setUTCMonth calls valueOf on arg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013444.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8013444: JSON.parse does not invoke "reviver" callback as per spec.
+ *
+ * @test
+ * @run
+ */
+
+
+var type = typeof JSON.parse('{}',function(){})
+print("type is " + type);
+
+var obj = JSON.parse('{"name": "nashorn"}', 
+    function(k, v) {
+        if (k === "") return v;
+        return v.toUpperCase();
+    });
+print(JSON.stringify(obj))
+
+var array = 
+  JSON.parse("[1, 3, 5, 7, 9, 11]",
+   function(k, v) {
+      if (k === "") return v;
+      return v*2;
+   }
+ );
+print(array)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8013444.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,3 @@
+type is undefined
+{"name":"NASHORN"}
+2,6,10,14,18,22
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/try2.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Try throw test - nest finally
+ *
+ * @test
+ * @run 
+ */
+
+function f() {
+    print("a");
+    try {
+	print("b");
+    } finally {
+	print("c");
+	try {
+	    print("d");
+	} finally {
+	    print("e");
+	}
+	print("f");
+    }
+    print("g");
+}
+
+f();
+
+print("done");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/try2.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,8 @@
+a
+b
+c
+d
+e
+f
+g
+done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8008814-1.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's a compile time error to have a nested function declaration when there's an option to treat it as an error
+ *
+ * @option --function-statement-error
+ * @test/compile-error
+ */
+
+if(true) {
+  function g() {
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8008814-1.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,3 @@
+test/script/error/JDK-8008814-1.js:32:2 Function declarations can only occur at program or function body level. You should use a function expression here instead.
+  function g() {
+  ^
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8008814-2.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-8008814: it's a compile time error to have a nested function declaration in strict mode
+ *
+ * @test/compile-error
+ */
+
+"use strict";
+if(true) {
+  function g() {
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8008814-2.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,3 @@
+test/script/error/JDK-8008814-2.js:32:2 In strict mode, function declarations can only occur at program or function body level. You should use a function expression here instead.
+  function g() {
+  ^
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/logcoverage.js	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * mh_coverage.js
+ * Screen scrape various logs to ensure that we cover enough functionality, 
+ * e.g. method handle instrumentation
+ *
+ * @test
+ * @run
+ */
+
+/*
+ * creates new script engine initialized with given options and
+ * runs given code on it. Returns standard output captured.
+ */
+
+function runScriptEngine(opts, name) {
+    var imports = new JavaImporter(
+        Packages.jdk.nashorn.api.scripting,
+        java.io, java.lang, java.util);
+
+    with(imports) {
+        var fac = new NashornScriptEngineFactory();
+        // get current System.err
+        var oldErr = System.err;
+	var oldOut = System.out;
+        var baosErr = new ByteArrayOutputStream();
+        var newErr = new PrintStream(baosErr);
+        var baosOut = new ByteArrayOutputStream();
+	var newOut = new PrintStream(baosOut);
+        try {
+            // set new standard err
+            System.setErr(newErr);
+            System.setOut(newOut);
+            var strType = Java.type("java.lang.String");
+            var engine = fac.getScriptEngine(Java.toJavaArray(opts, strType));
+	    var reader = new java.io.FileReader(name);
+            engine.eval(reader);
+            newErr.flush();
+	    newOut.flush();
+            return new java.lang.String(baosErr.toByteArray());
+        } finally {
+            // restore System.err to old value
+            System.setErr(oldErr);
+	    System.setOut(oldOut);
+        }
+    }
+}
+
+var str;
+
+var methodsCalled = [
+   'asCollector', 
+   'asType', 
+   'bindTo', 
+   'dropArguments', 
+   'explicitCastArguments', 
+   'filterArguments', 
+   'filterReturnValue', 
+   'findStatic', 
+   'findVirtual',  
+   'foldArguments', 
+   'getter', 
+   'guardWithTest', 
+   'insertArguments', 
+   'methodType', 
+   'setter'
+];
+
+function check(str, strs) {
+    for each (s in strs) {
+       if (s.indexOf(str) !== -1) {
+	   continue;
+       }
+       print(method + "not found");
+       return;
+    }
+    print("check ok!");
+}
+
+str = runScriptEngine([ "--log=codegen,compiler=finest,methodhandles=finest,fields=finest" ], __DIR__ + "../basic/NASHORN-19.js");
+
+check(str, methodsCalled);
+check(str, ['return', 'get', 'set', '[fields]']);
+check(str, ['codegen']);
+
+print("hello, world!");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/logcoverage.js.EXPECTED	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,4 @@
+check ok!
+check ok!
+check ok!
+hello, world!
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Wed May 08 10:10:05 2013 +0100
@@ -55,7 +55,7 @@
  * Tests for JSR-223 script engine for Nashorn.
  *
  * @test
- * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.ScriptEngineTest
+ * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest
  * @run testng jdk.nashorn.api.scripting.ScriptEngineTest
  */
 public class ScriptEngineTest {
@@ -906,4 +906,26 @@
             fail(se.getMessage());
         }
     }
+
+    @Test
+    /**
+     * Tests whether invocation of a JavaScript method through a variable arity Java method will pass the vararg array.
+     * Both non-vararg and vararg JavaScript methods are tested.
+     * @throws ScriptException
+     */
+    public void variableArityInterfaceTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.eval(
+            "function test1(i, strings) {" +
+            "    return 'i == ' + i + ', strings instanceof java.lang.String[] == ' + (strings instanceof Java.type('java.lang.String[]')) + ', strings == ' + java.util.Arrays.toString(strings)" +
+            "}" +
+            "function test2() {" +
+            "    return 'arguments[0] == ' + arguments[0] + ', arguments[1] instanceof java.lang.String[] == ' + (arguments[1] instanceof Java.type('java.lang.String[]')) + ', arguments[1] == ' + java.util.Arrays.toString(arguments[1])" +
+            "}"
+        );
+        final VariableArityTestInterface itf = ((Invocable)e).getInterface(VariableArityTestInterface.class);
+        Assert.assertEquals(itf.test1(42, "a", "b"), "i == 42, strings instanceof java.lang.String[] == true, strings == [a, b]");
+        Assert.assertEquals(itf.test2(44, "c", "d", "e"), "arguments[0] == 44, arguments[1] instanceof java.lang.String[] == true, arguments[1] == [c, d, e]");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting;
+
+public interface VariableArityTestInterface {
+    public String test1(int i, String... strings);
+    public String test2(int i, String... strings);
+}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java	Wed May 08 10:10:05 2013 +0100
@@ -105,4 +105,89 @@
         // FIXME: add more number-to-string test cases
         // FIXME: add case for Object type (JSObject with getDefaultValue)
     }
+
+    /**
+     * Test of JSType.toUint32(double)
+     */
+    @Test
+    public void testToUint32() {
+        assertEquals(JSType.toUint32(+0.0), 0);
+        assertEquals(JSType.toUint32(-0.0), 0);
+        assertEquals(JSType.toUint32(Double.NaN), 0);
+        assertEquals(JSType.toUint32(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toUint32(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toUint32(9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint32(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint32(1099511627776.0d), 0);
+        assertEquals(JSType.toUint32(-1099511627776.0d), 0);
+        assertEquals(JSType.toUint32(4294967295.0d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967296.0d), 0);
+        assertEquals(JSType.toUint32(4294967297.0d), 1);
+        assertEquals(JSType.toUint32(-4294967295.0d), 1);
+        assertEquals(JSType.toUint32(-4294967296.0d), 0);
+        assertEquals(JSType.toUint32(-4294967297.0d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967295.6d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967296.6d), 0);
+        assertEquals(JSType.toUint32(4294967297.6d), 1);
+        assertEquals(JSType.toUint32(-4294967295.6d), 1);
+        assertEquals(JSType.toUint32(-4294967296.6d), 0);
+        assertEquals(JSType.toUint32(-4294967297.6d), 4294967295l);
+    }
+
+    /**
+     * Test of JSType.toInt32(double)
+     */
+    @Test
+    public void testToInt32() {
+        assertEquals(JSType.toInt32(+0.0), 0);
+        assertEquals(JSType.toInt32(-0.0), 0);
+        assertEquals(JSType.toInt32(Double.NaN), 0);
+        assertEquals(JSType.toInt32(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toInt32(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toInt32(9223372036854775807.0d), 0);
+        assertEquals(JSType.toInt32(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toInt32(1099511627776.0d), 0);
+        assertEquals(JSType.toInt32(-1099511627776.0d), 0);
+        assertEquals(JSType.toInt32(4294967295.0d), -1);
+        assertEquals(JSType.toInt32(4294967296.0d), 0);
+        assertEquals(JSType.toInt32(4294967297.0d), 1);
+        assertEquals(JSType.toInt32(-4294967295.0d), 1);
+        assertEquals(JSType.toInt32(-4294967296.0d), 0);
+        assertEquals(JSType.toInt32(-4294967297.d), -1);
+        assertEquals(JSType.toInt32(4294967295.6d), -1);
+        assertEquals(JSType.toInt32(4294967296.6d), 0);
+        assertEquals(JSType.toInt32(4294967297.6d), 1);
+        assertEquals(JSType.toInt32(-4294967295.6d), 1);
+        assertEquals(JSType.toInt32(-4294967296.6d), 0);
+        assertEquals(JSType.toInt32(-4294967297.6d), -1);
+    }
+
+    /**
+     * Test of JSType.toUint16(double)
+     */
+    @Test
+    public void testToUint16() {
+        assertEquals(JSType.toUint16(+0.0), 0);
+        assertEquals(JSType.toUint16(-0.0), 0);
+        assertEquals(JSType.toUint16(Double.NaN), 0);
+        assertEquals(JSType.toUint16(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toUint16(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toUint16(9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint16(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint16(1099511627776.0d), 0);
+        assertEquals(JSType.toUint16(-1099511627776.0d), 0);
+        assertEquals(JSType.toUint16(4294967295.0d), 65535);
+        assertEquals(JSType.toUint16(4294967296.0d), 0);
+        assertEquals(JSType.toUint16(4294967297.0d), 1);
+        assertEquals(JSType.toUint16(-4294967295.0d), 1);
+        assertEquals(JSType.toUint16(-4294967296.0d), 0);
+        assertEquals(JSType.toUint16(-4294967297.0d), 65535);
+        assertEquals(JSType.toUint16(4294967295.6d), 65535);
+        assertEquals(JSType.toUint16(4294967296.6d), 0);
+        assertEquals(JSType.toUint16(4294967297.6d), 1);
+        assertEquals(JSType.toUint16(-4294967295.6d), 1);
+        assertEquals(JSType.toUint16(-4294967296.6d), 0);
+        assertEquals(JSType.toUint16(-4294967297.6d), 65535);
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/VarArgConstructor.java	Wed May 08 10:10:05 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.test.models;
+
+import java.util.List;
+
+public class VarArgConstructor {
+    private final String indicator;
+
+    public VarArgConstructor(int x, boolean y, List<String> z) {
+        indicator = "non-vararg";
+    }
+
+    public VarArgConstructor(int x, boolean y, String... z) {
+        indicator = "vararg";
+    }
+
+    public String getIndicator() {
+        return indicator;
+    }
+}
--- a/nashorn/tools/fxshell/jdk/nashorn/tools/FXShell.java	Sun Apr 28 08:15:54 2013 +0100
+++ b/nashorn/tools/fxshell/jdk/nashorn/tools/FXShell.java	Wed May 08 10:10:05 2013 +0100
@@ -178,7 +178,7 @@
      *
      * @param path Path to UTF-8 encoded JavaScript file.
      *
-     * @return Last evalulation result (discarded.)
+     * @return Last evaluation result (discarded.)
      */
     private Object load(String path) {
         try {