Merge
authortwisti
Mon, 12 May 2014 17:01:57 -0700
changeset 24440 7c472e3e3c57
parent 24439 252c634b2e1c (current diff)
parent 24424 2658d7834c6e (diff)
child 24441 50946251753f
Merge
hotspot/src/share/vm/code/codeCache.cpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/arguments.hpp
--- a/.hgtags	Fri May 09 09:12:39 2014 +0200
+++ b/.hgtags	Mon May 12 17:01:57 2014 -0700
@@ -254,3 +254,4 @@
 efe7dbc6088691757404e0c8745f894e3ca9c022 jdk9-b09
 8c0bdeecd7c0f9ce3f3762a51991f755cb3a972c jdk9-b10
 0809c9a4d36e6291f1c4384604c4bbf29e975722 jdk9-b11
+0d1f816217dce5e72187f167cc1816080cbeb453 jdk9-b12
--- a/.hgtags-top-repo	Fri May 09 09:12:39 2014 +0200
+++ b/.hgtags-top-repo	Mon May 12 17:01:57 2014 -0700
@@ -254,3 +254,4 @@
 4a21dc7d57d1069a01f68e7182c074cb37349dfb jdk9-b09
 fa13f2b926f8426876ec03e7903f3ee0ee150f2e jdk9-b10
 ab55a18a95e1990a588929d5d29db3eb9985fea0 jdk9-b11
+59f6350295f9681fe5956d8bc889bf341914c6cb jdk9-b12
--- a/common/bin/hgforest.sh	Fri May 09 09:12:39 2014 +0200
+++ b/common/bin/hgforest.sh	Mon May 12 17:01:57 2014 -0700
@@ -144,8 +144,10 @@
       repos="${repos} ${i}"
     fi
   done
+
+  pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
+
   if [ "${command_args}" != "" ] ; then
-    pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
     if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
       echo "ERROR: Need initial clone from non-local source" > ${status_output}
       exit 1
@@ -156,6 +158,16 @@
         repos_extra="${repos_extra} ${i}"
       fi
     done
+  else
+    if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
+      # local source repo. Copy the extras ones that exist there.
+      for i in ${subrepos_extra} ; do
+        if [ -f ${pull_default}/${i}/.hg/hgrc -a ! -f ${i}/.hg/hgrc ] ; then
+          # sub-repo there in source but not here
+          repos_extra="${repos_extra} ${i}"
+        fi
+      done
+    fi
   fi
   at_a_time=2
   # Any repos to deal with?
--- a/corba/.hgtags	Fri May 09 09:12:39 2014 +0200
+++ b/corba/.hgtags	Mon May 12 17:01:57 2014 -0700
@@ -254,3 +254,4 @@
 1a3a4f48515dbf1cff37279691b2fb74f228298d jdk9-b09
 3bd4039dfc632fd7fc8418a25a3dcc34d1cd4019 jdk9-b10
 77ea0a2503582a28e4e66be7239a49a0d1dd313f jdk9-b11
+e212cdcc8c11f0ba5acf6f5ddb596c4c545a93f9 jdk9-b12
--- a/hotspot/.hgtags	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/.hgtags	Mon May 12 17:01:57 2014 -0700
@@ -414,3 +414,4 @@
 05e8f5242c26ba45d4fa947e4f4f54c058c9b522 jdk9-b09
 ebc44d040cd149d2120d69fe183a3dae7840f4b4 jdk9-b10
 783309c3a1a629a452673399dcfa83ef7eca94d8 jdk9-b11
+1c383bb39e2849ca62cb763f4e182a29b421d60a jdk9-b12
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -149,7 +149,7 @@
 }
 
 void VM_Version::print_features() {
-  tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), get_cache_line_size());
+  tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), (int) get_cache_line_size());
 }
 
 #ifdef COMPILER2
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Mon May 12 17:01:57 2014 -0700
@@ -318,22 +318,22 @@
           tty->print("BIS");
       }
       if (AllocatePrefetchLines > 1) {
-        tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
       } else {
-        tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
       }
     }
     if (PrefetchCopyIntervalInBytes > 0) {
-      tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes);
+      tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
     }
     if (PrefetchScanIntervalInBytes > 0) {
-      tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes);
+      tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
     }
     if (PrefetchFieldsAhead > 0) {
-      tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
+      tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
     }
     if (ContendedPaddingWidth > 0) {
-      tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth);
+      tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
     }
   }
 #endif // PRODUCT
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -522,11 +522,11 @@
     // these asserts are somewhat nonsensical
 #ifndef _LP64
     assert(which == imm_operand || which == disp32_operand,
-           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip));
+           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)));
 #else
     assert((which == call32_operand || which == imm_operand) && is_64bit ||
            which == narrow_oop_operand && !is_64bit,
-           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip));
+           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)));
 #endif // _LP64
     return ip;
 
--- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@
 
 #ifndef PRODUCT
         if (TraceFPURegisterUsage) {
-          tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->print_cr("");
+          tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->cr();
         }
 #endif
       }
--- a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,7 @@
   if (TraceICs) {
     ResourceMark rm;
     tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
-                  instruction_address(),
+                  p2i(instruction_address()),
                   callee->name_and_sig_as_C_string());
   }
 
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,7 @@
 }
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Profiling/safepoint support
 
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@
 
 #define __ _masm->
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 #ifdef _WIN64
 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
--- a/hotspot/src/cpu/x86/vm/jni_x86.h	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/jni_x86.h	Mon May 12 17:01:57 2014 -0700
@@ -26,8 +26,14 @@
 #ifndef _JAVASOFT_JNI_MD_H_
 #define _JAVASOFT_JNI_MD_H_
 
-#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)
+#if defined(_WIN32)
+  #define JNIEXPORT __declspec(dllexport)
+  #define JNIIMPORT __declspec(dllimport)
+  #define JNICALL __stdcall
 
+  typedef int jint;
+  typedef __int64 jlong;
+#else
 
 // Note: please do not change these without also changing jni_md.h in the JDK
 // repository
@@ -50,13 +56,6 @@
   typedef long long jlong;
 #endif
 
-#else
-  #define JNIEXPORT __declspec(dllexport)
-  #define JNIIMPORT __declspec(dllimport)
-  #define JNICALL __stdcall
-
-  typedef int jint;
-  typedef __int64 jlong;
 #endif
 
 typedef signed char jbyte;
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,7 @@
 
 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 #ifdef ASSERT
 bool AbstractAssembler::pd_check_instruction_mark() { return true; }
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "memory/allocation.inline.hpp"
 #include "prims/methodHandles.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define __ _masm->
 
 #ifdef PRODUCT
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,8 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void NativeInstruction::wrote(int offset) {
   ICache::invalidate_word(addr_at(offset));
 }
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -925,16 +925,16 @@
   if (PrintMiscellaneous && Verbose) {
     tty->print_cr("Logical CPUs per core: %u",
                   logical_processors_per_package());
-    tty->print("UseSSE=%d",UseSSE);
+    tty->print("UseSSE=%d", (int) UseSSE);
     if (UseAVX > 0) {
-      tty->print("  UseAVX=%d",UseAVX);
+      tty->print("  UseAVX=%d", (int) UseAVX);
     }
     if (UseAES) {
       tty->print("  UseAES=1");
     }
 #ifdef COMPILER2
     if (MaxVectorSize > 0) {
-      tty->print("  MaxVectorSize=%d", MaxVectorSize);
+      tty->print("  MaxVectorSize=%d", (int) MaxVectorSize);
     }
 #endif
     tty->cr();
@@ -957,23 +957,23 @@
         }
       }
       if (AllocatePrefetchLines > 1) {
-        tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
       } else {
-        tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
       }
     }
 
     if (PrefetchCopyIntervalInBytes > 0) {
-      tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes);
+      tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
     }
     if (PrefetchScanIntervalInBytes > 0) {
-      tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes);
+      tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
     }
     if (PrefetchFieldsAhead > 0) {
-      tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
+      tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
     }
     if (ContendedPaddingWidth > 0) {
-      tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth);
+      tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
     }
   }
 #endif // !PRODUCT
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
 
   if (PrintMiscellaneous && (WizardMode || Verbose)) {
     tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
-                  vtable_index, s->entry_point(),
+                  vtable_index, p2i(s->entry_point()),
                   (int)(s->code_end() - s->entry_point()),
                   (int)(s->code_end() - __ pc()));
   }
@@ -199,7 +199,7 @@
 
   if (PrintMiscellaneous && (WizardMode || Verbose)) {
     tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
-                  itable_index, s->entry_point(),
+                  itable_index, p2i(s->entry_point()),
                   (int)(s->code_end() - s->entry_point()),
                   (int)(s->code_end() - __ pc()));
   }
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,8 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // machine-dependent part of VtableStubs: create VtableStub of correct size and
 // initialize its code
 
--- a/hotspot/src/os/bsd/vm/decoder_machO.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/os/bsd/vm/decoder_machO.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
   struct symtab_command * symt = (struct symtab_command *)
     mach_find_command((struct mach_header_64 *)mach_base, LC_SYMTAB);
   if (symt == NULL) {
-    DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", mach_base));
+    DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", p2i(mach_base)));
     return false;
   }
   uint32_t off = symt->symoff;          /* symbol table offset (within this mach file) */
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Mon May 12 17:01:57 2014 -0700
@@ -124,6 +124,9 @@
 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
 
 #define LARGEPAGES_BIT (1 << 6)
+
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ////////////////////////////////////////////////////////////////////////////////
 // global variables
 julong os::Bsd::_physical_memory = 0;
@@ -2394,7 +2397,6 @@
                         (!FLAG_IS_DEFAULT(UseLargePages) ||
                          !FLAG_IS_DEFAULT(LargePageSizeInBytes)
                         );
-  char msg[128];
 
   // Create a large shared memory region to attach to based on size.
   // Currently, size is the total size of the heap
@@ -2415,8 +2417,7 @@
      //            coalesce into large pages. Try to reserve large pages when
      //            the system is still "fresh".
      if (warn_on_failure) {
-       jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
-       warning(msg);
+       warning("Failed to reserve shared memory (errno = %d).", errno);
      }
      return NULL;
   }
@@ -2433,8 +2434,7 @@
 
   if ((intptr_t)addr == -1) {
      if (warn_on_failure) {
-       jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
-       warning(msg);
+       warning("Failed to attach shared memory (errno = %d).", err);
      }
      return NULL;
   }
@@ -3810,6 +3810,7 @@
   return true;
 }
 
+ATTRIBUTE_PRINTF(3, 0)
 int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
   return ::vsnprintf(buf, count, format, args);
 }
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -925,7 +925,7 @@
 
   if (PerfTraceMemOps) {
     tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
+               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
   }
 }
 
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Mon May 12 17:01:57 2014 -0700
@@ -102,6 +102,8 @@
 # include <inttypes.h>
 # include <sys/ioctl.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling
 // getrusage() is prepared to handle the associated failure.
 #ifndef RUSAGE_THREAD
@@ -2138,7 +2140,7 @@
   // Print warning if unsafe chroot environment detected
   if (unsafe_chroot_detected) {
     st->print("WARNING!! ");
-    st->print_cr(unstable_chroot_error);
+    st->print_cr("%s", unstable_chroot_error);
   }
 
   os::Linux::print_libversion_info(st);
@@ -2199,8 +2201,8 @@
 void os::Linux::print_libversion_info(outputStream* st) {
   // libc, pthread
   st->print("libc:");
-  st->print(os::Linux::glibc_version()); st->print(" ");
-  st->print(os::Linux::libpthread_version()); st->print(" ");
+  st->print("%s ", os::Linux::glibc_version());
+  st->print("%s ", os::Linux::libpthread_version());
   if (os::Linux::is_LinuxThreads()) {
      st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed");
   }
@@ -3417,7 +3419,7 @@
      //            the system is still "fresh".
      if (warn_on_failure) {
        jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
-       warning(msg);
+       warning("%s", msg);
      }
      return NULL;
   }
@@ -3435,7 +3437,7 @@
   if ((intptr_t)addr == -1) {
      if (warn_on_failure) {
        jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
-       warning(msg);
+       warning("%s", msg);
      }
      return NULL;
   }
@@ -3455,7 +3457,7 @@
     char msg[128];
     jio_snprintf(msg, sizeof(msg), "Failed to reserve large pages memory req_addr: "
         PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error);
-    warning(msg);
+    warning("%s", msg);
   }
 }
 
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Mon May 12 17:01:57 2014 -0700
@@ -931,7 +931,7 @@
 
   if (PerfTraceMemOps) {
     tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
+               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
   }
 }
 
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Mon May 12 17:01:57 2014 -0700
@@ -36,6 +36,8 @@
 #include <pthread.h>
 #include <signal.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Todo: provide a os::get_max_process_id() or similar. Number of processes
 // may have been configured, can be read more accurately from proc fs etc.
 #ifndef MAX_PID
@@ -192,10 +194,10 @@
   st->print("uname:");
   struct utsname name;
   uname(&name);
-  st->print(name.sysname); st->print(" ");
-  st->print(name.release); st->print(" ");
-  st->print(name.version); st->print(" ");
-  st->print(name.machine);
+  st->print("%s ", name.sysname);
+  st->print("%s ", name.release);
+  st->print("%s ", name.version);
+  st->print("%s", name.machine);
   st->cr();
 }
 
@@ -682,7 +684,7 @@
 void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set) {
   char buf[NUM_IMPORTANT_SIGS + 1];
   os::Posix::describe_signal_set_short(set, buf, sizeof(buf));
-  st->print(buf);
+  st->print("%s", buf);
 }
 
 // Writes one-line description of a combination of sigaction.sa_flags into a user
@@ -742,7 +744,7 @@
 void os::Posix::print_sa_flags(outputStream* st, int flags) {
   char buffer[0x100];
   os::Posix::describe_sa_flags(flags, buffer, sizeof(buffer));
-  st->print(buffer);
+  st->print("%s", buffer);
 }
 
 // Helper function for os::Posix::print_siginfo_...():
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -276,6 +276,8 @@
 # endif
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 address os::current_stack_pointer() {
 #if defined(__clang__) || defined(__llvm__)
   register void *esp;
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,6 +89,8 @@
 #define SPELL_REG_FP "ebp"
 #endif // AMD64
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 address os::current_stack_pointer() {
 #ifdef SPARC_WORKS
   register void *esp;
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1322,7 +1322,7 @@
     OperandForm* oper = form->is_operand();
     if (oper != NULL && oper->is_bound_register()) {
       const RegDef* first = oper->get_RegClass()->find_first_elem();
-      fprintf(fp, "    st->print(\"%s\");\n", first->_regname);
+      fprintf(fp, "    st->print_raw(\"%s\");\n", first->_regname);
     } else {
       globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var);
     }
@@ -2530,7 +2530,7 @@
   case Form::idealP: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
   case Form::idealNKlass:
   case Form::idealN: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
-  case Form::idealL: fprintf(fp,"  st->print(\"#%%lld\", _c%d);\n", const_index); break;
+  case Form::idealL: fprintf(fp,"  st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", const_index); break;
   case Form::idealF: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   case Form::idealD: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   default:
--- a/hotspot/src/share/vm/adlc/output_h.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/adlc/output_h.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -386,14 +386,14 @@
 static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) {
   assert(oper != NULL, "what");
   CondInterface* cond = oper->_interface->is_CondInterface();
-  fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print(\"%s\");\n",i,cond->_overflow_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print(\"%s\");\n",i,cond->_no_overflow_format);
+  fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print_raw(\"%s\");\n",i,cond->_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print_raw(\"%s\");\n",i,cond->_not_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print_raw(\"%s\");\n",i,cond->_less_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print_raw(\"%s\");\n",i,cond->_greater_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print_raw(\"%s\");\n",i,cond->_less_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print_raw(\"%s\");\n",i,cond->_greater_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print_raw(\"%s\");\n",i,cond->_overflow_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print_raw(\"%s\");\n",i,cond->_no_overflow_format);
 }
 
 // Output code that dumps constant values, increment "i" if type is constant
@@ -416,8 +416,8 @@
     ++i;
   }
   else if (!strcmp(ideal_type, "ConL")) {
-    fprintf(fp,"    st->print(\"#\" INT64_FORMAT, _c%d);\n", i);
-    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%d);\n", i);
+    fprintf(fp,"    st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", i);
+    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%d);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "ConF")) {
@@ -429,7 +429,7 @@
   else if (!strcmp(ideal_type, "ConD")) {
     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
     fprintf(fp,"    jlong _c%dl = JavaValue(_c%d).get_jlong();\n", i, i);
-    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%dl);\n", i);
+    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%dl);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "Bool")) {
@@ -471,7 +471,7 @@
         if ( string != NameList::_signal ) {
           // Normal string
           // Pass through to st->print
-          fprintf(fp,"  st->print(\"%s\");\n", string);
+          fprintf(fp,"  st->print_raw(\"%s\");\n", string);
         } else {
           // Replacement variable
           const char *rep_var = oper._format->_rep_vars.iter();
@@ -542,7 +542,7 @@
         if ( string != NameList::_signal ) {
           // Normal string
           // Pass through to st->print
-          fprintf(fp,"  st->print(\"%s\");\n", string);
+          fprintf(fp,"  st->print_raw(\"%s\");\n", string);
         } else {
           // Replacement variable
           const char *rep_var = oper._format->_rep_vars.iter();
@@ -669,7 +669,7 @@
       } else if( string == NameList::_signal2 ) // Raw program text
         fputs(inst._format->_strings.iter(), fp);
       else
-        fprintf(fp,"st->print(\"%s\");\n", string);
+        fprintf(fp,"st->print_raw(\"%s\");\n", string);
     } // Done with all format strings
   } // Done generating the user-defined portion of the format
 
@@ -696,13 +696,13 @@
     default:
       assert(0,"ShouldNotReachHere");
     }
-    fprintf(fp,  "  st->print_cr(\"\");\n" );
+    fprintf(fp,  "  st->cr();\n" );
     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
     fprintf(fp,  "  st->print(\"        # \");\n" );
     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   }
   else if(inst.is_ideal_safepoint()) {
-    fprintf(fp,  "  st->print(\"\");\n" );
+    fprintf(fp,  "  st->print_raw(\"\");\n" );
     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
     fprintf(fp,  "  st->print(\"        # \");\n" );
     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -988,7 +988,7 @@
   for (csize_t step; ptr < end(); ptr += step) {
     step = end() - ptr;
     if (step > jintSize * 4)  step = jintSize * 4;
-    tty->print(PTR_FORMAT ": ", ptr);
+    tty->print(INTPTR_FORMAT ": ", p2i(ptr));
     while (step > 0) {
       tty->print(" " PTR32_FORMAT, *(jint*)ptr);
       ptr += jintSize;
@@ -1098,7 +1098,7 @@
     while (c && c->offset() == offset) {
       stream->bol();
       stream->print("  ;; ");
-      stream->print_cr(c->string());
+      stream->print_cr("%s", c->string());
       c = c->next_comment();
     }
   }
@@ -1154,10 +1154,10 @@
 void CodeSection::print(const char* name) {
   csize_t locs_size = locs_end() - locs_start();
   tty->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)%s",
-                name, start(), end(), limit(), size(), capacity(),
+                name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity(),
                 is_frozen()? " [frozen]": "");
   tty->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d",
-                name, locs_start(), locs_end(), locs_limit(), locs_size, locs_capacity(), locs_point_off());
+                name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off());
   if (PrintRelocations) {
     RelocIterator iter(this);
     iter.print();
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -173,7 +173,7 @@
   bool allocates(address pc) const  { return pc >= _start && pc <  _limit; }
   bool allocates2(address pc) const { return pc >= _start && pc <= _limit; }
 
-  void    set_end(address pc)       { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " PTR_FORMAT " <= " PTR_FORMAT " <= " PTR_FORMAT, _start, pc, _limit)); _end = pc; }
+  void    set_end(address pc)       { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit))); _end = pc; }
   void    set_mark(address pc)      { assert(contains2(pc), "not in codeBuffer");
                                       _mark = pc; }
   void    set_mark_off(int offset)  { assert(contains2(offset+_start),"not in codeBuffer");
--- a/hotspot/src/share/vm/asm/register.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/asm/register.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,8 +118,8 @@
 ) {
   assert(
     a != b,
-    err_msg_res("registers must be different: a=%d, b=%d",
-                a, b)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "",
+                p2i(a), p2i(b))
   );
 }
 
@@ -132,8 +132,9 @@
   assert(
     a != b && a != c
            && b != c,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d",
-                a, b, c)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c))
   );
 }
 
@@ -148,8 +149,9 @@
     a != b && a != c && a != d
            && b != c && b != d
                      && c != d,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d",
-                a, b, c, d)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d))
   );
 }
 
@@ -166,8 +168,9 @@
            && b != c && b != d && b != e
                      && c != d && c != e
                                && d != e,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d",
-                a, b, c, d, e)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e))
   );
 }
 
@@ -186,8 +189,10 @@
                      && c != d && c != e && c != f
                                && d != e && d != f
                                          && e != f,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d",
-                a, b, c, d, e, f)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f))
   );
 }
 
@@ -208,8 +213,10 @@
                                && d != e && d != f && d != g
                                          && e != f && e != g
                                                    && f != g,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d",
-                a, b, c, d, e, f, g)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g))
   );
 }
 
@@ -232,8 +239,10 @@
                                          && e != f && e != g && e != h
                                                    && f != g && f != h
                                                              && g != h,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d",
-                a, b, c, d, e, f, g, h)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h))
   );
 }
 
@@ -258,8 +267,11 @@
                                                    && f != g && f != h && f != i
                                                              && g != h && g != i
                                                                        && h != i,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d",
-                a, b, c, d, e, f, g, h, i)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT
+                ", i=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i))
   );
 }
 
--- a/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 
   void inc_indent();
   void dec_indent();
-  void print(const char* format, ...);
+  void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   void print_begin(const char* tag);
   void print_end(const char* tag);
 
@@ -161,7 +161,7 @@
 
   print("name \"%s\"", method_name(_compilation->method(), true));
   print("method \"%s\"", method_name(_compilation->method()));
-  print("date "INT64_FORMAT, os::javaTimeMillis());
+  print("date "INT64_FORMAT, (int64_t) os::javaTimeMillis());
 
   print_end("compilation");
 }
--- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -134,23 +134,23 @@
     if (value->is_null_object()) {
       output()->print("null");
     } else if (!value->is_loaded()) {
-      output()->print("<unloaded object " PTR_FORMAT ">", value);
+      output()->print("<unloaded object " INTPTR_FORMAT ">", p2i(value));
     } else {
-      output()->print("<object " PTR_FORMAT " klass=", value->constant_encoding());
+      output()->print("<object " INTPTR_FORMAT " klass=", p2i(value->constant_encoding()));
       print_klass(value->klass());
       output()->print(">");
     }
   } else if (type->as_InstanceConstant() != NULL) {
     ciInstance* value = type->as_InstanceConstant()->value();
     if (value->is_loaded()) {
-      output()->print("<instance " PTR_FORMAT " klass=", value->constant_encoding());
+      output()->print("<instance " INTPTR_FORMAT " klass=", p2i(value->constant_encoding()));
       print_klass(value->klass());
       output()->print(">");
     } else {
-      output()->print("<unloaded instance " PTR_FORMAT ">", value);
+      output()->print("<unloaded instance " INTPTR_FORMAT ">", p2i(value));
     }
   } else if (type->as_ArrayConstant() != NULL) {
-    output()->print("<array " PTR_FORMAT ">", type->as_ArrayConstant()->value()->constant_encoding());
+    output()->print("<array " INTPTR_FORMAT ">", p2i(type->as_ArrayConstant()->value()->constant_encoding()));
   } else if (type->as_ClassConstant() != NULL) {
     ciInstanceKlass* klass = type->as_ClassConstant()->value();
     if (!klass->is_loaded()) {
@@ -268,7 +268,7 @@
 
 
 void InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) {
-  output()->print(name);
+  output()->print("%s", name);
   output()->print(".(");
 }
 
@@ -479,7 +479,7 @@
   if (x->declared_type()->is_klass())
     print_klass(x->declared_type()->as_klass());
   else
-    output()->print(type2name(x->declared_type()->basic_type()));
+    output()->print("%s", type2name(x->declared_type()->basic_type()));
 }
 
 
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1563,15 +1563,15 @@
   } else if (is_virtual()) {
     out->print("R%d", vreg_number());
   } else if (is_single_cpu()) {
-    out->print(as_register()->name());
+    out->print("%s", as_register()->name());
   } else if (is_double_cpu()) {
-    out->print(as_register_hi()->name());
-    out->print(as_register_lo()->name());
+    out->print("%s", as_register_hi()->name());
+    out->print("%s", as_register_lo()->name());
 #if defined(X86)
   } else if (is_single_xmm()) {
-    out->print(as_xmm_float_reg()->name());
+    out->print("%s", as_xmm_float_reg()->name());
   } else if (is_double_xmm()) {
-    out->print(as_xmm_double_reg()->name());
+    out->print("%s", as_xmm_double_reg()->name());
   } else if (is_single_fpu()) {
     out->print("fpu%d", fpu_regnr());
   } else if (is_double_fpu()) {
@@ -1583,9 +1583,9 @@
     out->print("d%d", fpu_regnrLo() >> 1);
 #else
   } else if (is_single_fpu()) {
-    out->print(as_float_reg()->name());
+    out->print("%s", as_float_reg()->name());
   } else if (is_double_fpu()) {
-    out->print(as_double_reg()->name());
+    out->print("%s", as_double_reg()->name());
 #endif
 
   } else if (is_illegal()) {
@@ -1611,9 +1611,9 @@
     case T_LONG:   out->print("lng:" JLONG_FORMAT, as_jlong()); break;
     case T_FLOAT:  out->print("flt:%f",   as_jfloat());         break;
     case T_DOUBLE: out->print("dbl:%f",   as_jdouble());        break;
-    case T_OBJECT: out->print("obj:0x%x", as_jobject());        break;
-    case T_METADATA: out->print("metadata:0x%x", as_metadata());break;
-    default:       out->print("%3d:0x%x",type(), as_jdouble()); break;
+    case T_OBJECT: out->print("obj:" INTPTR_FORMAT, p2i(as_jobject()));        break;
+    case T_METADATA: out->print("metadata:" INTPTR_FORMAT, p2i(as_metadata()));break;
+    default:       out->print("%3d:0x" UINT64_FORMAT_X, type(), (uint64_t)as_jlong()); break;
   }
 }
 
@@ -1629,7 +1629,7 @@
     case times_8: out->print(" * 8"); break;
     }
   }
-  out->print(" Disp: %d", _disp);
+  out->print(" Disp: " INTX_FORMAT, _disp);
 }
 
 // debug output of block header without InstructionPrinter
@@ -1703,7 +1703,7 @@
   } else {
     out->print("     ");
   }
-  out->print(name()); out->print(" ");
+  out->print("%s ", name());
   print_instr(out);
   if (info() != NULL) out->print(" [bci:%d]", info()->stack()->bci());
 #ifdef ASSERT
@@ -1833,7 +1833,7 @@
 // LIR_OpJavaCall
 void LIR_OpJavaCall::print_instr(outputStream* out) const {
   out->print("call: ");
-  out->print("[addr: 0x%x]", address());
+  out->print("[addr: " INTPTR_FORMAT "]", p2i(address()));
   if (receiver()->is_valid()) {
     out->print(" [recv: ");   receiver()->print(out);   out->print("]");
   }
@@ -1844,7 +1844,7 @@
 
 // LIR_OpLabel
 void LIR_OpLabel::print_instr(outputStream* out) const {
-  out->print("[label:0x%x]", _label);
+  out->print("[label:" INTPTR_FORMAT "]", p2i(_label));
 }
 
 // LIR_OpArrayCopy
@@ -1911,7 +1911,7 @@
 // LIR_Op1
 void LIR_OpRTCall::print_instr(outputStream* out) const {
   intx a = (intx)addr();
-  out->print(Runtime1::name_for_address(addr()));
+  out->print("%s", Runtime1::name_for_address(addr()));
   out->print(" ");
   tmp()->print(out);
 }
@@ -1934,10 +1934,10 @@
   } else if (stub() != NULL) {
     out->print("[");
     stub()->print_name(out);
-    out->print(": 0x%x]", stub());
+    out->print(": " INTPTR_FORMAT "]", p2i(stub()));
     if (stub()->info() != NULL) out->print(" [bci:%d]", stub()->info()->stack()->bci());
   } else {
-    out->print("[label:0x%x] ", label());
+    out->print("[label:" INTPTR_FORMAT "] ", p2i(label()));
   }
   if (ublock() != NULL) {
     out->print("unordered: [B%d] ", ublock()->block_id());
@@ -2004,7 +2004,7 @@
   tmp4()->print(out);                       out->print(" ");
   out->print("[hdr:%d]", header_size()); out->print(" ");
   out->print("[obj:%d]", object_size()); out->print(" ");
-  out->print("[lbl:0x%x]", stub()->entry());
+  out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 void LIR_OpRoundFP::print_instr(outputStream* out) const {
@@ -2037,7 +2037,7 @@
   tmp3()->print(out);                    out->print(" ");
   tmp4()->print(out);                    out->print(" ");
   out->print("[type:0x%x]", type());     out->print(" ");
-  out->print("[label:0x%x]", stub()->entry());
+  out->print("[label:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 
@@ -2074,7 +2074,7 @@
   if (_scratch->is_valid()) {
     _scratch->print(out);  out->print(" ");
   }
-  out->print("[lbl:0x%x]", stub()->entry());
+  out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 #ifdef ASSERT
@@ -2082,7 +2082,7 @@
   print_condition(out, condition()); out->print(" ");
   in_opr1()->print(out);             out->print(" ");
   in_opr2()->print(out);             out->print(", \"");
-  out->print(msg());                 out->print("\"");
+  out->print("%s", msg());          out->print("\"");
 }
 #endif
 
--- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,10 +62,10 @@
   _optimistic = ir->compilation()->is_optimistic();
 
   TRACE_RANGE_CHECK_ELIMINATION(
-    tty->print_cr("");
+    tty->cr();
     tty->print_cr("Range check elimination");
     ir->method()->print_name(tty);
-    tty->print_cr("");
+    tty->cr();
   );
 
   TRACE_RANGE_CHECK_ELIMINATION(
@@ -1024,7 +1024,7 @@
                                                          tty->print("i%d", phi->id());
                                                          tty->print(": ");
                                                          bound->print();
-                                                         tty->print_cr("");
+                                                         tty->cr();
                            );
                          }
                      });
@@ -1039,7 +1039,7 @@
                                             tty->print("i%d", instr->id());
                                             tty->print(": ");
                                             bound->print();
-                                            tty->print_cr("");
+                                            tty->cr();
               );
           }
         }
@@ -1400,7 +1400,7 @@
 
 // print
 void RangeCheckEliminator::Bound::print() {
-  tty->print("");
+  tty->print("%s", "");
   if (this->_lower_instr || this->_lower != min_jint) {
     if (this->_lower_instr) {
       tty->print("i%d", this->_lower_instr->id());
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -532,8 +532,8 @@
     if (TraceExceptions) {
       ttyLocker ttyl;
       ResourceMark rm;
-      tty->print_cr("Exception <%s> (0x%x) thrown in compiled method <%s> at PC " PTR_FORMAT " for thread 0x%x",
-                    exception->print_value_string(), (address)exception(), nm->method()->print_value_string(), pc, thread);
+      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "",
+                    exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
     }
     // for AbortVMOnException flag
     NOT_PRODUCT(Exceptions::debug_check_abort(exception));
@@ -563,7 +563,7 @@
     ttyLocker ttyl;
     ResourceMark rm;
     tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT,
-                  thread, continuation, pc);
+                  p2i(thread), p2i(continuation), p2i(pc));
   }
 
   return continuation;
@@ -988,8 +988,8 @@
         address copy_buff = stub_location - *byte_skip - *byte_count;
         address being_initialized_entry = stub_location - *being_initialized_entry_offset;
         if (TracePatching) {
-          tty->print_cr(" Patching %s at bci %d at address 0x%x  (%s)", Bytecodes::name(code), bci,
-                        instr_pc, (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
+          tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT "  (%s)", Bytecodes::name(code), bci,
+                        p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
           nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc());
           assert(caller_code != NULL, "nmethod not found");
 
@@ -1448,7 +1448,7 @@
     methodHandle inlinee = methodHandle(vfst.method());
     inlinee->print_short_name(&ss1);
     m->print_short_name(&ss2);
-    tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc %x", ss1.as_string(), vfst.bci(), ss2.as_string(), caller_frame.pc());
+    tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc()));
   }
 
 
--- a/hotspot/src/share/vm/c1/c1_ValueType.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/c1/c1_ValueType.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,7 @@
   ValueType* join(ValueType* y) const;
 
   // debugging
-  void print(outputStream* s = tty)              { s->print(name()); }
+  void print(outputStream* s = tty)              { s->print("%s", name()); }
 };
 
 
--- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1287,10 +1287,10 @@
         tty->print_cr("class of method is not initialized.");
       else if (_level > MaxBCEAEstimateLevel)
         tty->print_cr("level (%d) exceeds MaxBCEAEstimateLevel (%d).",
-                      _level, MaxBCEAEstimateLevel);
+                      _level, (int) MaxBCEAEstimateLevel);
       else if (method()->code_size() > MaxBCEAEstimateSize)
-        tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize.",
-                      method()->code_size(), MaxBCEAEstimateSize);
+        tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize (%d).",
+                      method()->code_size(), (int) MaxBCEAEstimateSize);
       else
         ShouldNotReachHere();
     }
--- a/hotspot/src/share/vm/ci/ciConstant.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciConstant.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
     tty->print("%d", _value._int);
     break;
   case T_LONG:
-    tty->print(INT64_FORMAT, _value._long);
+    tty->print(INT64_FORMAT, (int64_t)(_value._long));
     break;
   case T_FLOAT:
     tty->print("%f", _value._float);
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1250,8 +1250,7 @@
       if (replay_data_file != NULL) {
         fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
         dump_replay_data(&replay_data_stream);
-        tty->print("# Compiler replay data is saved as: ");
-        tty->print_cr(buffer);
+        tty->print_cr("# Compiler replay data is saved as: %s", buffer);
       } else {
         tty->print_cr("# Can't open file to dump replay data.");
       }
@@ -1274,7 +1273,7 @@
         )
         replay_data_stream.flush();
         tty->print("# Compiler inline data is saved as: ");
-        tty->print_cr(buffer);
+        tty->print_cr("%s", buffer);
       } else {
         tty->print_cr("# Can't open file to dump inline data.");
       }
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -292,7 +292,7 @@
 // Implementation of the print method.
 void ciInstanceKlass::print_impl(outputStream* st) {
   ciKlass::print_impl(st);
-  GUARDED_VM_ENTRY(st->print(" loader=0x%x", (address)loader());)
+  GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i((address)loader()));)
   if (is_loaded()) {
     st->print(" loaded=true initialized=%s finalized=%s subklass=%s size=%d flags=",
               bool_to_str(is_initialized()),
@@ -618,7 +618,7 @@
         case T_SHORT:   _out->print_cr("%d", mirror->short_field(fd->offset()));  break;
         case T_CHAR:    _out->print_cr("%d", mirror->char_field(fd->offset()));   break;
         case T_INT:     _out->print_cr("%d", mirror->int_field(fd->offset()));    break;
-        case T_LONG:    _out->print_cr(INT64_FORMAT, mirror->long_field(fd->offset()));   break;
+        case T_LONG:    _out->print_cr(INT64_FORMAT, (int64_t)(mirror->long_field(fd->offset())));   break;
         case T_FLOAT: {
           float f = mirror->float_field(fd->offset());
           _out->print_cr("%d", *(int*)&f);
@@ -626,7 +626,7 @@
         }
         case T_DOUBLE: {
           double d = mirror->double_field(fd->offset());
-          _out->print_cr(INT64_FORMAT, *(jlong*)&d);
+          _out->print_cr(INT64_FORMAT, *(int64_t*)&d);
           break;
         }
         case T_ARRAY: {
@@ -656,7 +656,7 @@
               _out->print_cr("\"");
             } else {
               const char* klass_name  = value->klass()->name()->as_quoted_ascii();
-              _out->print_cr(klass_name);
+              _out->print_cr("%s", klass_name);
             }
           } else {
             ShouldNotReachHere();
--- a/hotspot/src/share/vm/ci/ciMetadata.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciMetadata.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 void ciMetadata::print(outputStream* st) {
   st->print("<%s", type_string());
   GUARDED_VM_ENTRY(print_impl(st);)
-  st->print(" ident=%d address=0x%x>", ident(), (address)this);
+  st->print(" ident=%d address=" INTPTR_FORMAT ">", ident(), p2i((address)this));
 }
 
 
--- a/hotspot/src/share/vm/ci/ciMethodData.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciMethodData.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -557,7 +557,7 @@
             if (round == 0) {
               count++;
             } else {
-              out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
+              out->print(" %d %s", (int)(dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t)), k->name()->as_quoted_ascii());
             }
           }
         }
@@ -569,7 +569,7 @@
             if (round == 0) {
               count++;
             } else {
-              out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
+              out->print(" %d %s", (int)(dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t)), k->name()->as_quoted_ascii());
             }
           }
         }
--- a/hotspot/src/share/vm/ci/ciObject.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciObject.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,9 +213,9 @@
 void ciObject::print(outputStream* st) {
   st->print("<%s", type_string());
   GUARDED_VM_ENTRY(print_impl(st);)
-  st->print(" ident=%d %s address=0x%x>", ident(),
+  st->print(" ident=%d %s address=" INTPTR_FORMAT ">", ident(),
         is_scavengable() ? "SCAVENGABLE" : "",
-        (address)this);
+        p2i((address)this));
 }
 
 // ------------------------------------------------------------------
--- a/hotspot/src/share/vm/ci/ciSignature.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciSignature.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,5 +148,5 @@
   print_signature();
  tty->print(" accessing_klass=");
   _accessing_klass->print();
-  tty->print(" address=0x%x>", (address)this);
+  tty->print(" address=" INTPTR_FORMAT ">", p2i((address)this));
 }
--- a/hotspot/src/share/vm/ci/ciType.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/ci/ciType.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
 // Print the name of this type
 void ciType::print_name_on(outputStream* st) {
   ResourceMark rm;
-  st->print(name());
+  st->print("%s", name());
 }
 
 
--- a/hotspot/src/share/vm/classfile/classFileError.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/classFileError.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,9 @@
 
 // Keep these in a separate file to prevent inlining
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
+
 void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) {
     ResourceMark rm(THREAD);
     Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),
@@ -53,6 +56,8 @@
                        msg, index, name, _class_name->as_C_string());
 }
 
+PRAGMA_DIAG_POP
+
 void StackMapStream::stackmap_format_error(const char* msg, TRAPS) {
   ResourceMark rm(THREAD);
   Exceptions::fthrow(
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -312,7 +312,9 @@
     if (!b) { classfile_parse_error(msg, CHECK); }
   }
 
-  inline void assert_property(bool b, const char* msg, TRAPS) {
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
+inline void assert_property(bool b, const char* msg, TRAPS) {
 #ifdef ASSERT
     if (!b) {
       ResourceMark rm(THREAD);
@@ -329,6 +331,7 @@
     }
 #endif
   }
+PRAGMA_DIAG_POP
 
   inline void check_property(bool property, const char* msg, int index, TRAPS) {
     if (_need_verify) {
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -343,7 +343,7 @@
   tty->print("[Meta index for %s=", entry->name());
   for (int i = 0; i < meta_packages.length(); i++) {
     if (i > 0) tty->print(" ");
-    tty->print(meta_packages.at(i));
+    tty->print("%s", meta_packages.at(i));
   }
   tty->print_cr("]");
 }
@@ -1299,7 +1299,7 @@
     e = e->next();
   }
   jlong end = os::javaTimeMillis();
-  tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, %d ms)",
+  tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, " JLONG_FORMAT " ms)",
                 _compile_the_world_class_counter, _compile_the_world_method_counter, (end - start));
   {
     // Print statistics as if before normal exit:
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Mon May 12 17:01:57 2014 -0700
@@ -281,10 +281,10 @@
     ResourceMark rm;
     tty->print_cr("[TraceClassLoaderData] Adding k: " PTR_FORMAT " %s to CLD: "
                   PTR_FORMAT " loader: " PTR_FORMAT " %s",
-                  k,
+                  p2i(k),
                   k->external_name(),
-                  k->class_loader_data(),
-                  (void *)k->class_loader(),
+                  p2i(k->class_loader_data()),
+                  p2i((void *)k->class_loader()),
                   loader_name());
   }
 }
@@ -319,11 +319,11 @@
 
   if (TraceClassLoaderData) {
     ResourceMark rm;
-    tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this);
-    tty->print(" for instance "PTR_FORMAT" of %s", (void *)class_loader(),
+    tty->print("[ClassLoaderData: unload loader data " INTPTR_FORMAT, p2i(this));
+    tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()),
                loader_name());
     if (is_anonymous()) {
-      tty->print(" for anonymous class  "PTR_FORMAT " ", _klasses);
+      tty->print(" for anonymous class  " INTPTR_FORMAT " ", p2i(_klasses));
     }
     tty->print_cr("]");
   }
@@ -485,14 +485,14 @@
 void ClassLoaderData::dump(outputStream * const out) {
   ResourceMark rm;
   out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {",
-      this, (void *)class_loader(),
-      class_loader() != NULL ? class_loader()->klass() : NULL, loader_name());
+      p2i(this), p2i((void *)class_loader()),
+      p2i(class_loader() != NULL ? class_loader()->klass() : NULL), loader_name());
   if (claimed()) out->print(" claimed ");
   if (is_unloading()) out->print(" unloading ");
-  out->print(" handles " INTPTR_FORMAT, handles());
+  out->print(" handles " INTPTR_FORMAT, p2i(handles()));
   out->cr();
   if (metaspace_or_null() != NULL) {
-    out->print_cr("metaspace: " PTR_FORMAT, metaspace_or_null());
+    out->print_cr("metaspace: " INTPTR_FORMAT, p2i(metaspace_or_null()));
     metaspace_or_null()->dump(out);
   } else {
     out->print_cr("metaspace: NULL");
@@ -586,8 +586,8 @@
       if (TraceClassLoaderData) {
         ResourceMark rm;
         tty->print("[ClassLoaderData: ");
-        tty->print("create class loader data "PTR_FORMAT, cld);
-        tty->print(" for instance "PTR_FORMAT" of %s", (void *)cld->class_loader(),
+        tty->print("create class loader data " INTPTR_FORMAT, p2i(cld));
+        tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
                    cld->loader_name());
         tty->print_cr("]");
       }
@@ -847,7 +847,7 @@
   if (class_loader() == NULL) {
     out->print("NULL class_loader");
   } else {
-    out->print("class loader "PTR_FORMAT, this);
+    out->print("class loader " INTPTR_FORMAT, p2i(this));
     class_loader()->print_value_on(out);
   }
 }
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp	Mon May 12 17:01:57 2014 -0700
@@ -436,7 +436,7 @@
       _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError();
       if (TraceDefaultMethods) {
         _exception_message->print_value_on(tty);
-        tty->print_cr("");
+        tty->cr();
       }
     }
   }
@@ -463,7 +463,7 @@
       if (_members.at(i).second == DISQUALIFIED) {
         str->print(" (disqualified)");
       }
-      str->print_cr("");
+      str->cr();
     }
 
     if (_selected_target != NULL) {
@@ -480,7 +480,7 @@
     if (!method_holder->is_interface()) {
       tty->print(" : in superclass");
     }
-    str->print_cr("");
+    str->cr();
   }
 
   void print_exception(outputStream* str, int indent) {
@@ -688,7 +688,7 @@
     for (int i = 0; i < slots->length(); ++i) {
       tty->indent();
       slots->at(i)->print_on(tty);
-      tty->print_cr("");
+      tty->cr();
     }
   }
 #endif // ndef PRODUCT
@@ -828,7 +828,7 @@
       streamIndentor si(tty, 2);
       tty->indent().print("Looking for default methods for slot ");
       slot->print_on(tty);
-      tty->print_cr("");
+      tty->cr();
     }
 #endif // ndef PRODUCT
 
@@ -946,7 +946,7 @@
       if (TraceDefaultMethods) {
         tty->print("for slot: ");
         slot->print_on(tty);
-        tty->print_cr("");
+        tty->cr();
         if (method->has_target()) {
           method->print_selected(tty, 1);
         } else if (method->throws_exception()) {
--- a/hotspot/src/share/vm/classfile/dictionary.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp	Mon May 12 17:01:57 2014 -0700
@@ -31,6 +31,7 @@
 #include "runtime/orderAccess.inline.hpp"
 #include "utilities/hashtable.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 DictionaryEntry*  Dictionary::_current_class_entry = NULL;
 int               Dictionary::_current_class_index =    0;
--- a/hotspot/src/share/vm/classfile/dictionary.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -379,7 +379,7 @@
     }
     if (method_type() != NULL) {
       if (printed)  st->print(" and ");
-      st->print(INTPTR_FORMAT, (void *)method_type());
+      st->print(INTPTR_FORMAT, p2i((void *)method_type()));
       printed = true;
     }
     st->print_cr(printed ? "" : "(empty)");
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Mon May 12 17:01:57 2014 -0700
@@ -51,6 +51,8 @@
 #include "runtime/vframe.hpp"
 #include "utilities/preserveException.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define INJECTED_FIELD_COMPUTE_OFFSET(klass, name, signature, may_be_java)    \
   klass::_##name##_offset = JavaClasses::compute_injected_offset(JavaClasses::klass##_##name##_enum);
 
@@ -1490,7 +1492,7 @@
   while (h_throwable.not_null()) {
     objArrayHandle result (THREAD, objArrayOop(backtrace(h_throwable())));
     if (result.is_null()) {
-      st->print_cr(no_stack_trace_message());
+      st->print_cr("%s", no_stack_trace_message());
       return;
     }
 
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Mon May 12 17:01:57 2014 -0700
@@ -39,6 +39,8 @@
 #include "gc_implementation/g1/g1StringDedup.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // --------------------------------------------------------------------------
 
 // the number of buckets a thread claims
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Mon May 12 17:01:57 2014 -0700
@@ -2269,7 +2269,7 @@
       oop appendix = appendix_box->obj_at(0);
       if (TraceMethodHandles) {
     #ifndef PRODUCT
-        tty->print("Linked method="INTPTR_FORMAT": ", m);
+        tty->print("Linked method=" INTPTR_FORMAT ": ", p2i(m));
         m->print();
         if (appendix != NULL) { tty->print("appendix = "); appendix->print(); }
         tty->cr();
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Mon May 12 17:01:57 2014 -0700
@@ -364,7 +364,7 @@
 
 void ErrorContext::details(outputStream* ss, const Method* method) const {
   if (is_valid()) {
-    ss->print_cr("");
+    ss->cr();
     ss->print_cr("Exception Details:");
     location_details(ss, method);
     reason_details(ss);
@@ -379,7 +379,7 @@
   streamIndentor si(ss);
   ss->indent().print_cr("Reason:");
   streamIndentor si2(ss);
-  ss->indent().print("");
+  ss->indent().print("%s", "");
   switch (_fault) {
     case INVALID_BYTECODE:
       ss->print("Error exists in the bytecode");
@@ -432,7 +432,7 @@
       ShouldNotReachHere();
       ss->print_cr("Unknown");
   }
-  ss->print_cr("");
+  ss->cr();
 }
 
 void ErrorContext::location_details(outputStream* ss, const Method* method) const {
@@ -507,7 +507,7 @@
     for (u2 i = 0; i < sm_table->number_of_entries(); ++i) {
       ss->indent();
       sm_frame->print_on(ss, current_offset);
-      ss->print_cr("");
+      ss->cr();
       current_offset += sm_frame->offset_delta();
       sm_frame = sm_frame->next();
     }
@@ -579,7 +579,8 @@
     tty->print_cr("Verifying method %s", m->name_and_sig_as_C_string());
   }
 
-  const char* bad_type_msg = "Bad type on operand stack in %s";
+// For clang, the only good constant format string is a literal constant format string.
+#define bad_type_msg "Bad type on operand stack in %s"
 
   int32_t max_stack = m->verifier_max_stack();
   int32_t max_locals = m->max_locals();
@@ -1676,6 +1677,8 @@
   }
 }
 
+#undef bad_type_message
+
 char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) {
   char* code_data = NEW_RESOURCE_ARRAY(char, code_length);
   memset(code_data, 0, sizeof(char) * code_length);
@@ -2363,8 +2366,8 @@
   if (opcode == Bytecodes::_invokedynamic) {
     if (_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
       class_format_error(
-        "invokedynamic instructions not supported by this class file version",
-        _klass->external_name());
+        "invokedynamic instructions not supported by this class file version (%d), class %s",
+        _klass->major_version(), _klass->external_name());
       return;
     }
   } else {
--- a/hotspot/src/share/vm/classfile/verifier.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/verifier.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -375,15 +375,15 @@
   bool has_error() const { return result() != NULL; }
   char* exception_message() {
     stringStream ss;
-    ss.print(_message);
+    ss.print("%s", _message);
     _error_context.details(&ss, _method());
     return ss.as_string();
   }
 
   // Called when verify or class format errors are encountered.
   // May throw an exception based upon the mode.
-  void verify_error(ErrorContext ctx, const char* fmt, ...);
-  void class_format_error(const char* fmt, ...);
+  void verify_error(ErrorContext ctx, const char* fmt, ...) ATTRIBUTE_PRINTF(3, 4);
+  void class_format_error(const char* fmt, ...) ATTRIBUTE_PRINTF(2, 3);
 
   Klass* load_class(Symbol* name, TRAPS);
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -533,7 +533,7 @@
     xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'",
                      actual_name, declared_name);
     xtty->method(mh);
-    xtty->end_elem("");
+    xtty->end_elem("%s", "");
   }
   if (PrintMiscellaneous && (WizardMode || Verbose)) {
     tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):",
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -530,7 +530,7 @@
 }
 
 void CodeBlob::print_on(outputStream* st) const {
-  st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this);
+  st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", p2i(this));
   st->print_cr("Framesize: %d", _frame_size);
 }
 
@@ -548,7 +548,7 @@
 }
 
 void BufferBlob::print_value_on(outputStream* st) const {
-  st->print_cr("BufferBlob (" INTPTR_FORMAT  ") used for %s", this, name());
+  st->print_cr("BufferBlob (" INTPTR_FORMAT  ") used for %s", p2i(this), name());
 }
 
 void RuntimeStub::verify() {
@@ -558,13 +558,13 @@
 void RuntimeStub::print_on(outputStream* st) const {
   ttyLocker ttyl;
   CodeBlob::print_on(st);
-  st->print("Runtime Stub (" INTPTR_FORMAT "): ", this);
-  st->print_cr(name());
+  st->print("Runtime Stub (" INTPTR_FORMAT "): ", p2i(this));
+  st->print_cr("%s", name());
   Disassembler::decode((CodeBlob*)this, st);
 }
 
 void RuntimeStub::print_value_on(outputStream* st) const {
-  st->print("RuntimeStub (" INTPTR_FORMAT "): ", this); st->print(name());
+  st->print("RuntimeStub (" INTPTR_FORMAT "): ", p2i(this)); st->print("%s", name());
 }
 
 void SingletonBlob::verify() {
@@ -574,12 +574,12 @@
 void SingletonBlob::print_on(outputStream* st) const {
   ttyLocker ttyl;
   CodeBlob::print_on(st);
-  st->print_cr(name());
+  st->print_cr("%s", name());
   Disassembler::decode((CodeBlob*)this, st);
 }
 
 void SingletonBlob::print_value_on(outputStream* st) const {
-  st->print_cr(name());
+  st->print_cr("%s", name());
 }
 
 void DeoptimizationBlob::print_value_on(outputStream* st) const {
--- a/hotspot/src/share/vm/code/codeCache.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,10 +81,10 @@
   bool is_empty()                                { return count == 0; }
 
   void print(const char* title) {
-    tty->print_cr(" #%d %s = %dK (hdr %d%%,  loc %d%%, code %d%%, stub %d%%, [oops %d%%, data %d%%, pcs %d%%])",
+    tty->print_cr(" #%d %s = %dK (hdr %d%%,  loc %d%%, code %d%%, stub %d%%, [oops %d%%, metadata %d%%, data %d%%, pcs %d%%])",
                   count,
                   title,
-                  total() / K,
+                  (int)(total() / K),
                   header_size             * 100 / total_size,
                   relocation_size         * 100 / total_size,
                   code_size               * 100 / total_size,
@@ -193,7 +193,7 @@
     }
     if (PrintCodeCacheExtension) {
       ResourceMark rm;
-      tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (%d bytes)",
+      tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)",
                     (intptr_t)_heap->low_boundary(), (intptr_t)_heap->high(),
                     (address)_heap->high() - (address)_heap->low_boundary());
     }
@@ -490,7 +490,7 @@
           if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) {
             CompiledIC *ic = CompiledIC_at(iter.reloc());
             if (TraceCompiledIC) {
-              tty->print("noticed icholder " INTPTR_FORMAT " ", ic->cached_icholder());
+              tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder()));
               ic->print();
             }
             assert(ic->cached_icholder() != NULL, "must be non-NULL");
@@ -744,10 +744,10 @@
   }
   // Print bytes that are allocated in the freelist
   ttyLocker ttl;
-  tty->print_cr("Number of elements in freelist: %d",    freelist_length());
-  tty->print_cr("Allocated in freelist:          %dkB",  bytes_allocated_in_freelist()/K);
-  tty->print_cr("Unused bytes in CodeBlobs:      %dkB",  (int)(wasted_bytes/K));
-  tty->print_cr("Segment map size:               %dkB",  allocated_segments()/K); // 1 byte per segment
+  tty->print_cr("Number of elements in freelist: " SSIZE_FORMAT,    freelist_length());
+  tty->print_cr("Allocated in freelist:          " SSIZE_FORMAT "kB",  bytes_allocated_in_freelist()/K);
+  tty->print_cr("Unused bytes in CodeBlobs:      " SSIZE_FORMAT "kB",  (wasted_bytes/K));
+  tty->print_cr("Segment map size:               " SSIZE_FORMAT "kB",  allocated_segments()/K); // 1 byte per segment
 }
 
 //------------------------------------------------------------------------------------------------
@@ -759,7 +759,7 @@
   if (PrintCodeCache2) {  // Need to add a new flag
     ResourceMark rm;
     if (size == 0)  size = cb->size();
-    tty->print_cr("CodeCache %s:  addr: " INTPTR_FORMAT ", size: 0x%x", event, cb, size);
+    tty->print_cr("CodeCache %s:  addr: " INTPTR_FORMAT ", size: 0x%x", event, p2i(cb), size);
   }
 }
 
@@ -929,9 +929,9 @@
 
   if (detailed) {
     st->print_cr(" bounds [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT "]",
-                 _heap->low_boundary(),
-                 _heap->high(),
-                 _heap->high_boundary());
+                 p2i(_heap->low_boundary()),
+                 p2i(_heap->high()),
+                 p2i(_heap->high_boundary()));
     st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT
                  " adapters=" UINT32_FORMAT,
                  nof_blobs(), nof_nmethods(), nof_adapters());
--- a/hotspot/src/share/vm/code/compiledIC.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/compiledIC.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,9 +88,9 @@
   if (TraceCompiledIC) {
     tty->print("  ");
     print_compiled_ic();
-    tty->print(" changing destination to " INTPTR_FORMAT, entry_point);
+    tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point));
     if (!is_optimized()) {
-      tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", (address)cache);
+      tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache));
     }
     if (is_icstub) {
       tty->print(" (icstub)");
@@ -195,7 +195,7 @@
   if (TraceICs) {
     ResourceMark rm;
     tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT,
-                   instruction_address(), call_info->selected_method()->print_value_string(), entry);
+                   p2i(instruction_address()), call_info->selected_method()->print_value_string(), p2i(entry));
   }
 
   // We can't check this anymore. With lazy deopt we could have already
@@ -272,7 +272,7 @@
 void CompiledIC::set_to_clean() {
   assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call");
   if (TraceInlineCacheClearing || TraceICs) {
-    tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", instruction_address());
+    tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address()));
     print();
   }
 
@@ -354,7 +354,7 @@
       if (TraceICs) {
          ResourceMark rm(thread);
          tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter: %s",
-           instruction_address(),
+           p2i(instruction_address()),
            method->print_value_string());
       }
     } else {
@@ -362,7 +362,7 @@
       InlineCacheBuffer::create_transition_stub(this, info.claim_cached_icholder(), info.entry());
       if (TraceICs) {
          ResourceMark rm(thread);
-         tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", instruction_address());
+         tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", p2i(instruction_address()));
       }
     }
   } else {
@@ -392,7 +392,7 @@
       ResourceMark rm(thread);
       assert(info.cached_metadata() == NULL || info.cached_metadata()->is_klass(), "must be");
       tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to compiled (rcvr klass) %s: %s",
-        instruction_address(),
+        p2i(instruction_address()),
         ((Klass*)info.cached_metadata())->print_value_string(),
         (safe) ? "" : "via stub");
     }
@@ -530,8 +530,8 @@
     if (TraceICs) {
       ResourceMark rm;
       tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_compiled " INTPTR_FORMAT,
-                    instruction_address(),
-                    info.entry());
+                    p2i(instruction_address()),
+                    p2i(info.entry()));
     }
     // Call to compiled code
     assert (CodeCache::contains(info.entry()), "wrong entry point");
@@ -600,11 +600,11 @@
 
 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());
+             p2i(instruction_address()), is_call_to_interpreted() ? "interpreted " : "", p2i(ic_destination()), p2i(is_optimized() ? NULL : cached_value()));
 }
 
 void CompiledStaticCall::print() {
-  tty->print("static call at " INTPTR_FORMAT " -> ", instruction_address());
+  tty->print("static call at " INTPTR_FORMAT " -> ", p2i(instruction_address()));
   if (is_clean()) {
     tty->print("clean");
   } else if (is_call_to_compiled()) {
--- a/hotspot/src/share/vm/code/compressedStream.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/compressedStream.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -212,6 +212,8 @@
   return h ^ l;
 }
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_IGNORED // Someone needs to deal with this.
 void test_compressed_stream(int trace) {
   CompressedWriteStream bytes(stretch_limit * 100);
   jint n;
@@ -275,6 +277,7 @@
   guarantee(length == length2, "bad length");
   guarantee(fails == 0, "test failures");
 }
+PRAGMA_DIAG_POP
 
 #if defined(_MSC_VER) &&_MSC_VER >=1400 && !defined(_WIN64)
 #pragma warning(default: 4748)
--- a/hotspot/src/share/vm/code/debugInfo.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/debugInfo.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,9 @@
 #include "code/nmethod.hpp"
 #include "runtime/handles.inline.hpp"
 
-// Comstructors
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
+// Constructors
 
 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
 : CompressedWriteStream(initial_size) {
--- a/hotspot/src/share/vm/code/exceptionHandlerTable.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 #include "code/nmethod.hpp"
 #include "memory/allocation.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void ExceptionHandlerTable::add_entry(HandlerTableEntry entry) {
   _nesting.check();
   if (_length >= _size) {
--- a/hotspot/src/share/vm/code/icBuffer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/icBuffer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +39,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/stubRoutines.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 DEF_STUB_INTERFACE(ICStub);
 
--- a/hotspot/src/share/vm/code/nmethod.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,8 @@
 #include "shark/sharkCompiler.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef DTRACE_ENABLED
 
 // Only bother with this argument setup if dtrace is available
--- a/hotspot/src/share/vm/code/pcDesc.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/pcDesc.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "code/scopeDesc.hpp"
 #include "memory/resourceArea.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PcDesc::PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset) {
   _pc_offset           = pc_offset;
   _scope_decode_offset = scope_decode_offset;
--- a/hotspot/src/share/vm/code/relocInfo.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/relocInfo.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +31,7 @@
 #include "runtime/stubCodeGenerator.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 const RelocationHolder RelocationHolder::none; // its type is relocInfo::none
 
--- a/hotspot/src/share/vm/code/scopeDesc.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/scopeDesc.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +30,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop) {
   _code          = code;
--- a/hotspot/src/share/vm/code/vtableStubs.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/code/vtableStubs.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +39,8 @@
 #include "opto/matcher.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // -----------------------------------------------------------------------------------------
 // Implementation of VtableStub
 
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -172,7 +172,7 @@
   void log_nmethod(JavaThread* thread, nmethod* nm) {
     log(thread, "nmethod %d%s " INTPTR_FORMAT " code ["INTPTR_FORMAT ", " INTPTR_FORMAT "]",
         nm->compile_id(), nm->is_osr_method() ? "%" : "",
-        nm, nm->code_begin(), nm->code_end());
+        p2i(nm), p2i(nm->code_begin()), p2i(nm->code_end()));
   }
 
   void log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) {
@@ -1786,7 +1786,7 @@
         if (xtty != NULL) {
           ttyLocker ttyl;
           // Record any per thread log files
-          xtty->elem("thread_logfile thread='%d' filename='%s'", thread_id, file_name);
+          xtty->elem("thread_logfile thread='" INTX_FORMAT "' filename='%s'", thread_id, file_name);
         }
         return;
       }
@@ -1817,7 +1817,7 @@
   if (_should_block) {
 #ifndef PRODUCT
     if (PrintCompilation && (Verbose || WizardMode))
-      tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", Thread::current());
+      tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", p2i(Thread::current()));
 #endif
     ThreadInVMfromNative tivfn(JavaThread::current());
   }
@@ -1834,7 +1834,7 @@
     CodeCache::print_summary(&s, detailed);
   }
   ttyLocker ttyl;
-  tty->print(s.as_string());
+  tty->print("%s", s.as_string());
 }
 
 // ------------------------------------------------------------------
@@ -2039,7 +2039,7 @@
       // Lock to prevent tearing
       ttyLocker ttyl;
       xtty->begin_elem("code_cache_full");
-      xtty->print(s.as_string());
+      xtty->print("%s", s.as_string());
       xtty->stamp();
       xtty->end_elem();
     }
--- a/hotspot/src/share/vm/compiler/compileLog.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -174,9 +174,9 @@
 void CompileLog::name(ciKlass* k) {
   print(" name='");
   if (!k->is_loaded()) {
-    text()->print(k->name()->as_klass_external_name());
+    text()->print("%s", k->name()->as_klass_external_name());
   } else {
-    text()->print(k->external_name());
+    text()->print("%s", k->external_name());
   }
   print("'");
 }
@@ -303,7 +303,7 @@
 // Print about successful method inlining.
 void CompileLog::inline_success(const char* reason) {
   begin_elem("inline_success reason='");
-  text(reason);
+  text("%s", reason);
   end_elem("'");
 }
 
@@ -313,7 +313,7 @@
 // Print about failed method inlining.
 void CompileLog::inline_fail(const char* reason) {
   begin_elem("inline_fail reason='");
-  text(reason);
+  text("%s", reason);
   end_elem("'");
 }
 
@@ -339,5 +339,5 @@
 void CompileLog::code_cache_state() {
   begin_elem("code_cache");
   CodeCache::log_state(this);
-  end_elem("");
+  end_elem("%s", "");
 }
--- a/hotspot/src/share/vm/compiler/compileLog.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/compiler/compileLog.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
 
   static CompileLog* _first;     // head of static chain
 
-  void va_tag(bool push, const char* format, va_list ap);
+  void va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);
 
  public:
   CompileLog(const char* file_name, FILE* fp, intx thread_id);
@@ -69,7 +69,7 @@
   // or reset, context string will be silently ignored
   stringStream* context()                        { return &_context; }
   void    clear_context()                        { context()->reset(); }
-  void      set_context(const char* format, ...);
+  void      set_context(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
   void          name(ciSymbol* s);               // name='s'
   void          name(Symbol* s)                  { xmlStream::name(s); }
--- a/hotspot/src/share/vm/compiler/compilerOracle.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +520,7 @@
     tty->print_cr("CompilerOracle: unrecognized line");
     tty->print_cr("  \"%s\"", original_line);
     if (error_msg != NULL) {
-      tty->print_cr(error_msg);
+      tty->print_cr("%s", error_msg);
     }
   }
 }
@@ -642,7 +642,7 @@
   char method_sep = have_colon ? ':' : '.';
 
   if (Verbose) {
-    tty->print_cr(line);
+    tty->print_cr("%s", line);
   }
 
   ResourceMark rm;
--- a/hotspot/src/share/vm/compiler/disassembler.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,8 @@
 #include "shark/sharkEntry.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void*       Disassembler::_library               = NULL;
 bool        Disassembler::_tried_to_load_library = false;
 
@@ -411,6 +413,7 @@
   return env->handle_event(event, (address) arg);
 }
 
+ATTRIBUTE_PRINTF(2, 3)
 static int printf_to_env(void* env_pv, const char* format, ...) {
   decode_env* env = (decode_env*) env_pv;
   outputStream* st = env->output();
--- a/hotspot/src/share/vm/compiler/methodLiveness.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +32,8 @@
 #include "memory/allocation.inline.hpp"
 #include "utilities/bitMap.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // The MethodLiveness class performs a simple liveness analysis on a method
 // in order to decide which locals are live (that is, will be used again) at
 // a particular bytecode index (bci).
--- a/hotspot/src/share/vm/compiler/oopMap.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/compiler/oopMap.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -633,8 +633,8 @@
       tty->print_cr(
         "Add derived pointer@" INTPTR_FORMAT
         " - Derived: " INTPTR_FORMAT
-        " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %d)",
-        derived_loc, (address)*derived_loc, (address)*base_loc, base_loc, offset
+        " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")",
+        p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset
       );
     }
     // Set derived oop location to point to base.
@@ -661,8 +661,8 @@
 
     if (TraceDerivedPointers) {
       tty->print_cr("Updating derived pointer@" INTPTR_FORMAT
-                    " - Derived: " INTPTR_FORMAT "  Base: " INTPTR_FORMAT " (Offset: %d)",
-          derived_loc, (address)*derived_loc, (address)base, offset);
+                    " - Derived: " INTPTR_FORMAT "  Base: " INTPTR_FORMAT " (Offset: " INTX_FORMAT ")",
+          p2i(derived_loc), p2i((address)*derived_loc), p2i((address)base), offset);
     }
 
     // Delete entry
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -157,8 +157,8 @@
                  " split_deaths(" SIZE_FORMAT ")"
                  " coal_deaths(" SIZE_FORMAT ")"
                  " + count(" SSIZE_FORMAT ")",
-                 this, size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
-                 _allocation_stats.split_births(), _allocation_stats.split_deaths(),
+                 p2i(this), size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
+                 _allocation_stats.coal_births(), _allocation_stats.split_deaths(),
                  _allocation_stats.coal_deaths(), count()));
 }
 #endif
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp	Mon May 12 17:01:57 2014 -0700
@@ -27,7 +27,7 @@
 
 #include "memory/collectorPolicy.hpp"
 
-class ConcurrentMarkSweepPolicy : public TwoGenerationCollectorPolicy {
+class ConcurrentMarkSweepPolicy : public GenCollectorPolicy {
  protected:
   void initialize_alignments();
   void initialize_generations();
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -428,7 +428,7 @@
 void LinearAllocBlock::print_on(outputStream* st) const {
   st->print_cr(" LinearAllocBlock: ptr = " PTR_FORMAT ", word_size = " SIZE_FORMAT
             ", refillsize = " SIZE_FORMAT ", allocation_size_limit = " SIZE_FORMAT,
-            _ptr, _word_size, _refillSize, _allocation_size_limit);
+            p2i(_ptr), _word_size, _refillSize, _allocation_size_limit);
 }
 
 void CompactibleFreeListSpace::print_on(outputStream* st) const {
@@ -459,7 +459,7 @@
     for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL;
          fc = fc->next()) {
       gclog_or_tty->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ")  %s",
-                          fc, (HeapWord*)fc + i,
+                          p2i(fc), p2i((HeapWord*)fc + i),
                           fc->cantCoalesce() ? "\t CC" : "");
     }
   }
@@ -503,7 +503,7 @@
   if (_sp->block_is_obj(addr)) {
     const bool dead = _post_remark && !_live_bit_map->isMarked(addr);
     _st->print_cr(PTR_FORMAT ": %s object of size " SIZE_FORMAT "%s",
-      addr,
+      p2i(addr),
       dead ? "dead" : "live",
       sz,
       (!dead && CMSPrintObjectsInDump) ? ":" : ".");
@@ -513,7 +513,7 @@
     }
   } else { // free block
     _st->print_cr(PTR_FORMAT ": free block of size " SIZE_FORMAT "%s",
-      addr, sz, CMSPrintChunksInDump ? ":" : ".");
+      p2i(addr), sz, CMSPrintChunksInDump ? ":" : ".");
     if (CMSPrintChunksInDump) {
       ((FreeChunk*)addr)->print_on(_st);
       _st->print_cr("--------------------------------------");
@@ -1983,7 +1983,7 @@
   assert(ur.contains(urasm),
          err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")"
                  " should contain [" PTR_FORMAT "," PTR_FORMAT ")",
-                 ur.start(), ur.end(), urasm.start(), urasm.end()));
+                 p2i(ur.start()), p2i(ur.end()), p2i(urasm.start()), p2i(urasm.end())));
 #endif
   // inform allocator that promotions should be tracked.
   assert(_promoInfo.noPromotions(), "_promoInfo inconsistency");
@@ -2206,7 +2206,7 @@
   if (PrintFLSStatistics > 0) {
     HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict();
     gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT,
-                           largestAddr);
+                           p2i(largestAddr));
   }
   setFLSurplus();
   setFLHints();
@@ -2355,8 +2355,8 @@
       gclog_or_tty->print_cr(
         " Current:  addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n"
         " Previous: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n",
-        addr,       res,        was_obj      ?"true":"false", was_live      ?"true":"false",
-        _last_addr, _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false");
+        p2i(addr),       res,        was_obj      ?"true":"false", was_live      ?"true":"false",
+        p2i(_last_addr), _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false");
       _sp->print_on(gclog_or_tty);
       guarantee(false, "Seppuku!");
     }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -403,7 +403,7 @@
     if (CMSTraceSweeper) {
       gclog_or_tty->print_cr(">>>>> Saving sweep limit " PTR_FORMAT
                              "  for space [" PTR_FORMAT "," PTR_FORMAT ") <<<<<<",
-                             _sweep_limit, bottom(), end());
+                             p2i(_sweep_limit), p2i(bottom()), p2i(end()));
     }
   }
   NOT_PRODUCT(
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,6 +64,8 @@
 #include "services/memoryService.hpp"
 #include "services/runtimeService.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // statics
 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL;
 bool CMSCollector::_full_gc_requested = false;
@@ -1182,7 +1184,7 @@
     gclog_or_tty->print(" icms alloc limits:  "
                            PTR_FORMAT "," PTR_FORMAT
                            " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ",
-                           _icms_start_limit, _icms_stop_limit,
+                           p2i(_icms_start_limit), p2i(_icms_stop_limit),
                            percent_of_space(eden, _icms_start_limit),
                            percent_of_space(eden, _icms_stop_limit));
     if (Verbose) {
@@ -1210,7 +1212,7 @@
         gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT
                                ", new limit=" PTR_FORMAT
                                " (" SIZE_FORMAT "%%)",
-                               top, _icms_stop_limit,
+                               p2i(top), p2i(_icms_stop_limit),
                                percent_of_space(space, _icms_stop_limit));
       }
       ConcurrentMarkSweepThread::start_icms();
@@ -1227,7 +1229,7 @@
         gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT
                                ", new limit=" PTR_FORMAT
                                " (" SIZE_FORMAT "%%)",
-                               top, space->end(),
+                               p2i(top), p2i(space->end()),
                                percent_of_space(space, space->end()));
       }
       ConcurrentMarkSweepThread::stop_icms();
@@ -1502,7 +1504,7 @@
   if (PrintCMSInitiationStatistics && stats().valid()) {
     gclog_or_tty->print("CMSCollector shouldConcurrentCollect: ");
     gclog_or_tty->stamp();
-    gclog_or_tty->print_cr("");
+    gclog_or_tty->cr();
     stats().print_on(gclog_or_tty);
     gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f",
       stats().time_until_cms_gen_full());
@@ -1561,7 +1563,7 @@
   // this is not likely to be productive in practice because it's probably too
   // late anyway.
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  assert(gch->collector_policy()->is_two_generation_policy(),
+  assert(gch->collector_policy()->is_generation_policy(),
          "You may want to check the correctness of the following");
   if (gch->incremental_collection_will_fail(true /* consult_young */)) {
     if (Verbose && PrintGCDetails) {
@@ -1965,7 +1967,7 @@
   // has exceeded the threshold set by CMSFullGCsBeforeCompaction,
   // or if an incremental collection has failed
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  assert(gch->collector_policy()->is_two_generation_policy(),
+  assert(gch->collector_policy()->is_generation_policy(),
          "You may want to check the correctness of the following");
   // Inform cms gen if this was due to partial collection failing.
   // The CMS gen may use this fact to determine its expansion policy.
@@ -3588,7 +3590,7 @@
                  _collector->cmsGen()->short_name(),
                  _phase, _collector->timerValue(), _wallclock.seconds());
     if (_print_cr) {
-      gclog_or_tty->print_cr("");
+      gclog_or_tty->cr();
     }
     if (PrintCMSStatistics != 0) {
       gclog_or_tty->print_cr(" (CMS-concurrent-%s yielded %d times)", _phase,
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,7 +111,7 @@
   // From this time Thread::current() should be working.
   assert(this == Thread::current(), "just checking");
   if (BindCMSThreadToCPU && !os::bind_to_processor(CPUForCMSThread)) {
-    warning("Couldn't bind CMS thread to processor %u", CPUForCMSThread);
+    warning("Couldn't bind CMS thread to processor " UINTX_FORMAT, CPUForCMSThread);
   }
   // Wait until Universe::is_fully_initialized()
   {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -239,7 +239,7 @@
     jio_snprintf(buf, sizeof(buf), " [%.3f:  CMSThread %s] ",
                  ts.seconds(), desc);
     buf[sizeof(buf) - 1] = '\0';
-    gclog_or_tty->print(buf);
+    gclog_or_tty->print("%s", buf);
   }
 }
 
@@ -271,7 +271,7 @@
   inline void tick() {
     _ticks++;
     if (CMSLoopWarn && _ticks % _threshold == 0) {
-      warning("%s has looped %d times %s", _src, _ticks, _msg);
+      warning("%s has looped " INTX_FORMAT " times %s", _src, _ticks, _msg);
     }
   }
 };
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 #include "memory/freeBlockDictionary.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifndef PRODUCT
 
 #define baadbabeHeapWord badHeapWordVal
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #include "oops/markOop.inline.hpp"
 #include "oops/oop.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 /////////////////////////////////////////////////////////////////////////
 //// PromotionInfo
 /////////////////////////////////////////////////////////////////////////
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 #include "runtime/os.hpp"
 #include "utilities/dtrace.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 //////////////////////////////////////////////////////////
 // Methods in abstract class VM_CMS_Operation
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -537,7 +537,7 @@
 
   if (verbose_low()) {
     gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", "
-                           "heap end = "PTR_FORMAT, _heap_start, _heap_end);
+                           "heap end = " PTR_FORMAT, p2i(_heap_start), p2i(_heap_end));
   }
 
   if (!_markBitMap1.allocate(heap_rs)) {
@@ -651,7 +651,7 @@
     if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) {
       warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): "
               "must be between " UINTX_FORMAT " and " UINTX_FORMAT,
-              mark_stack_size, 1, MarkStackSizeMax);
+              mark_stack_size, (uintx) 1, MarkStackSizeMax);
       return;
     }
     FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size);
@@ -662,7 +662,7 @@
         if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) {
           warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): "
                   "must be between " UINTX_FORMAT " and " UINTX_FORMAT,
-                  MarkStackSize, 1, MarkStackSizeMax);
+                  MarkStackSize, (uintx) 1, MarkStackSizeMax);
           return;
         }
       } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) {
@@ -821,7 +821,7 @@
     assert(!concurrent_marking_in_progress(), "invariant");
     assert(_finger == _heap_end,
            err_msg("only way to get here: _finger: "PTR_FORMAT", _heap_end: "PTR_FORMAT,
-                   _finger, _heap_end));
+                   p2i(_finger), p2i(_heap_end)));
     update_g1_committed(true);
   }
 }
@@ -1424,7 +1424,7 @@
     assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
            err_msg("Preconditions not met - "
                    "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT,
-                   start, ntams, hr->end()));
+                   p2i(start), p2i(ntams), p2i(hr->end())));
 
     // Find the first marked object at or after "start".
     start = _bm->getNextMarkedWordAddress(start, ntams);
@@ -1609,7 +1609,7 @@
     if (failures > 0 && _verbose)  {
       gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", "
                              "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT,
-                             HR_FORMAT_PARAMS(hr), hr->next_top_at_mark_start(),
+                             HR_FORMAT_PARAMS(hr), p2i(hr->next_top_at_mark_start()),
                              _calc_cl.region_marked_bytes(), hr->next_marked_bytes());
     }
 
@@ -2241,7 +2241,7 @@
       if (_cm->verbose_high()) {
         gclog_or_tty->print_cr("\t[%u] we're looking at location "
                                "*"PTR_FORMAT" = "PTR_FORMAT,
-                               _task->worker_id(), p, (void*) obj);
+                               _task->worker_id(), p2i(p), p2i((void*) obj));
       }
 
       _task->deal_with_reference(obj);
@@ -2675,7 +2675,7 @@
     }
 
     _out->print_cr("  "PTR_FORMAT": "PTR_FORMAT"%s%s",
-                   p, (void*) obj, str, str2);
+                   p2i(p), p2i((void*) obj), str, str2);
   }
 };
 
@@ -2702,7 +2702,7 @@
 
     if (print_it) {
       _out->print_cr(" "PTR_FORMAT"%s",
-                     (void *)o, (over_tams) ? " >" : (marked) ? " M" : "");
+                     p2i((void *)o), (over_tams) ? " >" : (marked) ? " M" : "");
       PrintReachableOopClosure oopCl(_out, _vo, _all);
       o->oop_iterate_no_header(&oopCl);
     }
@@ -2723,14 +2723,14 @@
     HeapWord* t = hr->top();
     HeapWord* p = _g1h->top_at_mark_start(hr, _vo);
     _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" "
-                   "TAMS: "PTR_FORMAT, b, e, t, p);
+                   "TAMS: " PTR_FORMAT, p2i(b), p2i(e), p2i(t), p2i(p));
     _out->cr();
 
     HeapWord* from = b;
     HeapWord* to   = t;
 
     if (to > from) {
-      _out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to);
+      _out->print_cr("Objects in [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(from), p2i(to));
       _out->cr();
       PrintReachableObjectClosure ocl(_out, _vo, _all, hr);
       hr->object_iterate_mem_careful(MemRegion(from, to), &ocl);
@@ -2846,7 +2846,7 @@
       gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" "
                              "["PTR_FORMAT", "PTR_FORMAT"), "
                              "limit = "PTR_FORMAT,
-                             worker_id, curr_region, bottom, end, limit);
+                             worker_id, p2i(curr_region), p2i(bottom), p2i(end), p2i(limit));
     }
 
     // Is the gap between reading the finger and doing the CAS too long?
@@ -2860,13 +2860,13 @@
 
       if (verbose_low()) {
         gclog_or_tty->print_cr("[%u] we were successful with region = "
-                               PTR_FORMAT, worker_id, curr_region);
+                               PTR_FORMAT, worker_id, p2i(curr_region));
       }
 
       if (limit > bottom) {
         if (verbose_low()) {
           gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, "
-                                 "returning it ", worker_id, curr_region);
+                                 "returning it ", worker_id, p2i(curr_region));
         }
         return curr_region;
       } else {
@@ -2874,7 +2874,7 @@
                "the region limit should be at bottom");
         if (verbose_low()) {
           gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, "
-                                 "returning NULL", worker_id, curr_region);
+                                 "returning NULL", worker_id, p2i(curr_region));
         }
         // we return NULL and the caller should try calling
         // claim_region() again.
@@ -2886,7 +2886,7 @@
         gclog_or_tty->print_cr("[%u] somebody else moved the finger, "
                                "global finger = "PTR_FORMAT", "
                                "our finger = "PTR_FORMAT,
-                               worker_id, _finger, finger);
+                               worker_id, p2i(_finger), p2i(finger));
       }
 
       // read it again
@@ -2925,7 +2925,7 @@
   void do_object_work(oop obj) {
     guarantee(!_g1h->obj_in_cs(obj),
               err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d",
-                      (void*) obj, phase_str(), _info));
+                      p2i((void*) obj), phase_str(), _info));
   }
 
 public:
@@ -3004,7 +3004,7 @@
       HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger);
       guarantee(global_finger == global_hr->bottom(),
                 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT,
-                        global_finger, HR_FORMAT_PARAMS(global_hr)));
+                        p2i(global_finger), HR_FORMAT_PARAMS(global_hr)));
     }
 
     // Verify the task fingers
@@ -3018,7 +3018,7 @@
         guarantee(task_finger == task_hr->bottom() ||
                   !task_hr->in_collection_set(),
                   err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT,
-                          task_finger, HR_FORMAT_PARAMS(task_hr)));
+                          p2i(task_finger), HR_FORMAT_PARAMS(task_hr)));
       }
     }
   }
@@ -3062,7 +3062,7 @@
            err_msg("Preconditions not met - "
                    "start: "PTR_FORMAT", limit: "PTR_FORMAT", "
                    "top: "PTR_FORMAT", end: "PTR_FORMAT,
-                   start, limit, hr->top(), hr->end()));
+                   p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end())));
 
     assert(hr->next_marked_bytes() == 0, "Precondition");
 
@@ -3303,7 +3303,7 @@
 
 void ConcurrentMark::print_on_error(outputStream* st) const {
   st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT,
-      _prevMarkBitMap, _nextMarkBitMap);
+      p2i(_prevMarkBitMap), p2i(_nextMarkBitMap));
   _prevMarkBitMap->print_on_error(st, " Prev Bits: ");
   _nextMarkBitMap->print_on_error(st, " Next Bits: ");
 }
@@ -3336,11 +3336,11 @@
 // for debugging purposes
 void ConcurrentMark::print_finger() {
   gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
-                         _heap_start, _heap_end, _finger);
+                         p2i(_heap_start), p2i(_heap_end), p2i(_finger));
   for (uint i = 0; i < _max_worker_id; ++i) {
-    gclog_or_tty->print("   %u: "PTR_FORMAT, i, _tasks[i]->finger());
+    gclog_or_tty->print("   %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger()));
   }
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 }
 #endif
 
@@ -3349,7 +3349,7 @@
 
   if (_cm->verbose_high()) {
     gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT,
-                           _worker_id, (void*) obj);
+                           _worker_id, p2i((void*) obj));
   }
 
   size_t obj_size = obj->size();
@@ -3428,7 +3428,7 @@
 
   if (_cm->verbose_low()) {
     gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT,
-                           _worker_id, hr);
+                           _worker_id, p2i(hr));
   }
 
   _curr_region  = hr;
@@ -3445,7 +3445,7 @@
     if (_cm->verbose_low()) {
       gclog_or_tty->print_cr("[%u] found an empty region "
                              "["PTR_FORMAT", "PTR_FORMAT")",
-                             _worker_id, bottom, limit);
+                             _worker_id, p2i(bottom), p2i(limit));
     }
     // The region was collected underneath our feet.
     // We set the finger to bottom to ensure that the bitmap
@@ -3477,7 +3477,7 @@
   assert(_curr_region != NULL, "invariant");
   if (_cm->verbose_low()) {
     gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT,
-                           _worker_id, _curr_region);
+                           _worker_id, p2i(_curr_region));
   }
   clear_region_fields();
 }
@@ -3768,7 +3768,7 @@
 
       if (_cm->verbose_high()) {
         gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
-                               (void*) obj);
+                               p2i((void*) obj));
       }
 
       assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" );
@@ -4153,7 +4153,7 @@
         gclog_or_tty->print_cr("[%u] we're scanning part "
                                "["PTR_FORMAT", "PTR_FORMAT") "
                                "of region "HR_FORMAT,
-                               _worker_id, _finger, _region_limit,
+                               _worker_id, p2i(_finger), p2i(_region_limit),
                                HR_FORMAT_PARAMS(_curr_region));
       }
 
@@ -4240,7 +4240,7 @@
         if (_cm->verbose_low()) {
           gclog_or_tty->print_cr("[%u] we successfully claimed "
                                  "region "PTR_FORMAT,
-                                 _worker_id, claimed_region);
+                                 _worker_id, p2i(claimed_region));
         }
 
         setup_for_region(claimed_region);
@@ -4301,7 +4301,7 @@
       if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) {
         if (_cm->verbose_medium()) {
           gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully",
-                                 _worker_id, (void*) obj);
+                                 _worker_id, p2i((void*) obj));
         }
 
         statsOnly( ++_steals );
@@ -4549,8 +4549,8 @@
                  G1PPRL_SUM_ADDR_FORMAT("committed")
                  G1PPRL_SUM_ADDR_FORMAT("reserved")
                  G1PPRL_SUM_BYTE_FORMAT("region-size"),
-                 g1_committed.start(), g1_committed.end(),
-                 g1_reserved.start(), g1_reserved.end(),
+                 p2i(g1_committed.start()), p2i(g1_committed.end()),
+                 p2i(g1_reserved.start()), p2i(g1_reserved.end()),
                  HeapRegion::GrainBytes);
   _out->print_cr(G1PPRL_LINE_PREFIX);
   _out->print_cr(G1PPRL_LINE_PREFIX
@@ -4667,7 +4667,7 @@
                  G1PPRL_DOUBLE_FORMAT
                  G1PPRL_BYTE_FORMAT
                  G1PPRL_BYTE_FORMAT,
-                 type, bottom, end,
+                 type, p2i(bottom), p2i(end),
                  used_bytes, prev_live_bytes, next_live_bytes, gc_eff,
                  remset_bytes, strong_code_roots_bytes);
 
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -277,7 +277,7 @@
   assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
 
   if (_cm->verbose_high()) {
-    gclog_or_tty->print_cr("[%u] pushing "PTR_FORMAT, _worker_id, (void*) obj);
+    gclog_or_tty->print_cr("[%u] pushing " PTR_FORMAT, _worker_id, p2i((void*) obj));
   }
 
   if (!_task_queue->push(obj)) {
@@ -317,7 +317,7 @@
 inline void CMTask::deal_with_reference(oop obj) {
   if (_cm->verbose_high()) {
     gclog_or_tty->print_cr("[%u] we're dealing with reference = "PTR_FORMAT,
-                           _worker_id, (void*) obj);
+                           _worker_id, p2i((void*) obj));
   }
 
   ++_refs_reached;
@@ -334,7 +334,7 @@
       if (!hr->obj_allocated_since_next_marking(obj)) {
         if (_cm->verbose_high()) {
           gclog_or_tty->print_cr("[%u] "PTR_FORMAT" is not considered marked",
-                                 _worker_id, (void*) obj);
+                                 _worker_id, p2i((void*) obj));
         }
 
         // we need to mark it first
@@ -349,7 +349,7 @@
           if (_finger != NULL && objAddr < _finger) {
             if (_cm->verbose_high()) {
               gclog_or_tty->print_cr("[%u] below the local finger ("PTR_FORMAT"), "
-                                     "pushing it", _worker_id, _finger);
+                                     "pushing it", _worker_id, p2i(_finger));
             }
             push(obj);
           } else if (_curr_region != NULL && objAddr < _region_limit) {
@@ -367,7 +367,7 @@
             if (_cm->verbose_high()) {
               gclog_or_tty->print_cr("[%u] below the global finger "
                                      "("PTR_FORMAT"), pushing it",
-                                     _worker_id, global_finger);
+                                     _worker_id, p2i(global_finger));
             }
             push(obj);
           } else {
@@ -382,7 +382,7 @@
             if (_cm->verbose_high()) {
               gclog_or_tty->print_cr("[%u] below the global finger "
                                      "("PTR_FORMAT"), pushing it",
-                                     _worker_id, global_finger);
+                                     _worker_id, p2i(global_finger));
             }
             push(obj);
           }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,7 +143,7 @@
 void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) {
   msg->append("[%s] %s c: %u b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT,
               _name, message, _count, BOOL_TO_STR(_bot_updates),
-              _alloc_region, _used_bytes_before);
+              p2i(_alloc_region), _used_bytes_before);
 }
 
 void G1AllocRegion::init() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -184,7 +184,7 @@
 
 class ar_ext_msg : public err_msg {
 public:
-  ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("") {
+  ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("%s", "") {
     alloc_region->fill_in_ext_msg(this, message);
   }
 };
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
             REGION_SIZE_IN_WORDS * HeapWordSize);
     // Check address calculation (bounds)
     assert(array.bottom_address_mapped() == fake_heap,
-      err_msg("bottom mapped address should be "PTR_FORMAT", but is "PTR_FORMAT, fake_heap, array.bottom_address_mapped()));
+      err_msg("bottom mapped address should be " PTR_FORMAT ", but is " PTR_FORMAT, p2i(fake_heap), p2i(array.bottom_address_mapped())));
     assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be");
 
     int* bottom = array.address_mapped_to(fake_heap);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
   void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) {
     assert(base != NULL, "just checking");
     assert(length > 0, "just checking");
-    assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %zd, larger than word size?", shift_by));
+    assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %u, larger than word size?", shift_by));
     _base = base;
     _length = length;
     _biased_base = base - (bias * elem_size);
@@ -71,10 +71,10 @@
       err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes));
     assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0,
       err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT,
-        mapping_granularity_in_bytes, bottom));
+        mapping_granularity_in_bytes, p2i(bottom)));
     assert((uintptr_t)end % mapping_granularity_in_bytes == 0,
       err_msg("end mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT,
-        mapping_granularity_in_bytes, end));
+        mapping_granularity_in_bytes, p2i(end)));
     size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes);
     idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes;
     address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "runtime/java.hpp"
 #include "services/memTracker.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 //////////////////////////////////////////////////////////////////////
 // G1BlockOffsetSharedArray
 //////////////////////////////////////////////////////////////////////
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@
   virtual void set_bottom(HeapWord* new_bottom) {
     assert(new_bottom <= _end,
            err_msg("new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")",
-                   new_bottom, _end));
+                   p2i(new_bottom), p2i(_end)));
     _bottom = new_bottom;
     resize(pointer_delta(_end, _bottom));
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
   assert(pc >= (char*)_reserved.start() &&
          pc <  (char*)_reserved.end(),
          err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")",
-                 p, (char*)_reserved.start(), (char*)_reserved.end()));
+                 p2i(p), p2i(_reserved.start()), p2i(_reserved.end())));
   size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char));
   size_t result = delta >> LogN;
   check_index(result, "bad index from address");
@@ -65,7 +65,7 @@
          err_msg("bad address from index result " PTR_FORMAT
                  " _reserved.start() " PTR_FORMAT " _reserved.end() "
                  PTR_FORMAT,
-                 result, _reserved.start(), _reserved.end()));
+                 p2i(result), p2i(_reserved.start()), p2i(_reserved.end())));
   return result;
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +31,8 @@
 #include "services/memTracker.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) {
   if (has_count_table()) {
     assert(from_card_num >= 0 && from_card_num < _committed_max_card_num,
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,10 +77,10 @@
            err_msg("Invalid card pointer: "
                    "card_ptr: " PTR_FORMAT ", "
                    "_ct_bot: " PTR_FORMAT,
-                   card_ptr, _ct_bot));
+                   p2i(card_ptr), p2i(_ct_bot)));
     size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte));
     assert(card_num >= 0 && card_num < _committed_max_card_num,
-           err_msg("card pointer out of range: " PTR_FORMAT, card_ptr));
+           err_msg("card pointer out of range: " PTR_FORMAT, p2i(card_ptr)));
     return card_num;
   }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Mon May 12 17:01:57 2014 -0700
@@ -28,6 +28,8 @@
 #include "gc_implementation/g1/g1CodeCacheRemSet.hpp"
 #include "memory/iterator.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 G1CodeRootChunk::G1CodeRootChunk() : _top(NULL), _next(NULL), _prev(NULL) {
   _top = bottom();
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon May 12 17:01:57 2014 -0700
@@ -22,6 +22,11 @@
  *
  */
 
+#if !defined(__clang_major__) && defined(__GNUC__)
+// FIXME, formats have issues.  Disable this macro definition, compile, and study warnings for more information.
+#define ATTRIBUTE_PRINTF(x,y)
+#endif
+
 #include "precompiled.hpp"
 #include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
@@ -370,7 +375,7 @@
     }
   }
 
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 }
 
 void G1CollectedHeap::push_dirty_cards_region(HeapRegion* hr)
@@ -3470,7 +3475,7 @@
       // help us track down what went wrong. This is why we call
       // print_extended_on() instead of print_on().
       print_extended_on(gclog_or_tty);
-      gclog_or_tty->print_cr("");
+      gclog_or_tty->cr();
 #ifndef PRODUCT
       if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) {
         concurrent_mark()->print_reachable("at-verification-failure",
@@ -3664,7 +3669,7 @@
   PrintRSetsClosure(const char* msg) : _msg(msg), _occupied_sum(0) {
     gclog_or_tty->cr();
     gclog_or_tty->print_cr("========================================");
-    gclog_or_tty->print_cr(msg);
+    gclog_or_tty->print_cr("%s", msg);
     gclog_or_tty->cr();
   }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
   assert(addr != NULL, "invariant");
   assert(_g1_reserved.contains((const void*) addr),
       err_msg("Address "PTR_FORMAT" is outside of the heap ranging from ["PTR_FORMAT" to "PTR_FORMAT")",
-          (void*)addr, _g1_reserved.start(), _g1_reserved.end()));
+          p2i((void*)addr), p2i(_g1_reserved.start()), p2i(_g1_reserved.end())));
   return _hrs.addr_to_region((HeapWord*) addr);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +22,11 @@
  *
  */
 
+#ifndef __clang_major__
+// FIXME, formats have issues.  Disable this macro definition, compile, and study warnings for more information.
+#define ATTRIBUTE_PRINTF(x,y)
+#endif
+
 #include "precompiled.hpp"
 #include "gc_implementation/g1/concurrentG1Refine.hpp"
 #include "gc_implementation/g1/concurrentMark.hpp"
@@ -965,7 +970,7 @@
 
 #ifndef PRODUCT
   if (G1YoungSurvRateVerbose) {
-    gclog_or_tty->print_cr("");
+    gclog_or_tty->cr();
     _short_lived_surv_rate_group->print();
     // do that for any other surv rate groups too
   }
@@ -2222,11 +2227,11 @@
 
   gclog_or_tty->print_cr("ALL PAUSES");
   print_summary_sd("   Total", &_total);
-  gclog_or_tty->print_cr("");
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
+  gclog_or_tty->cr();
   gclog_or_tty->print_cr("   Young GC Pauses: %8d", _young_pause_num);
   gclog_or_tty->print_cr("   Mixed GC Pauses: %8d", _mixed_pause_num);
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 
   gclog_or_tty->print_cr("EVACUATION PAUSES");
 
@@ -2246,7 +2251,7 @@
     print_summary("      Clear CT", &_clear_ct);
     print_summary("      Other", &_other);
   }
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 
   gclog_or_tty->print_cr("MISC");
   print_summary_sd("   Stop World", &_all_stop_world_times_ms);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Mon May 12 17:01:57 2014 -0700
@@ -39,7 +39,7 @@
   int _indent_level;
   int _cur;
 
-  void vappend(const char* format, va_list ap) {
+  void vappend(const char* format, va_list ap)  ATTRIBUTE_PRINTF(2, 0) {
     int res = vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap);
     if (res != -1) {
       _cur += res;
@@ -63,14 +63,14 @@
   }
 #endif
 
-  void append(const char* format, ...) {
+  void append(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3) {
     va_list ap;
     va_start(ap, format);
     vappend(format, ap);
     va_end(ap);
   }
 
-  void append_and_print_cr(const char* format, ...) {
+  void append_and_print_cr(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3) {
     va_list ap;
     va_start(ap, format);
     vappend(format, ap);
@@ -80,6 +80,8 @@
   }
 };
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
 template <class T>
 void WorkerDataArray<T>::print(int level, const char* title) {
   if (_length == 1) {
@@ -109,7 +111,7 @@
   }
 
   if (G1Log::finest()) {
-    buf.append_and_print_cr("");
+    buf.append_and_print_cr("%s", "");
   }
 
   double avg = (double)sum / (double)_length;
@@ -129,6 +131,7 @@
   }
   buf.append_and_print_cr("]");
 }
+PRAGMA_DIAG_POP
 
 #ifndef PRODUCT
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 #include "gc_implementation/g1/heapRegion.hpp"
 #include "utilities/ostream.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 const char* G1HRPrinter::action_name(ActionType action) {
   switch(action) {
     case Alloc:          return "ALLOC";
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,7 +114,7 @@
   if (_cm->verbose_high()) {
     gclog_or_tty->print_cr("[%u] we're looking at location "
                            "*"PTR_FORMAT" = "PTR_FORMAT,
-                           _task->worker_id(), p, (void*) obj);
+                           _task->worker_id(), p2i(p), p2i((void*) obj));
   }
   _task->deal_with_reference(obj);
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +39,8 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/intHisto.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define CARD_REPEAT_HISTO 0
 
 #if CARD_REPEAT_HISTO
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Mon May 12 17:01:57 2014 -0700
@@ -35,6 +35,8 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 int    HeapRegion::LogOfHRGrainBytes = 0;
 int    HeapRegion::LogOfHRGrainWords = 0;
 size_t HeapRegion::GrainBytes        = 0;
@@ -827,7 +829,7 @@
                         Mutex::_no_safepoint_check_flag);
 
         if (!_failures) {
-          gclog_or_tty->print_cr("");
+          gclog_or_tty->cr();
           gclog_or_tty->print_cr("----------");
         }
         if (!_g1h->is_in_closed_subset(obj)) {
@@ -882,7 +884,7 @@
                             Mutex::_no_safepoint_check_flag);
 
             if (!_failures) {
-              gclog_or_tty->print_cr("");
+              gclog_or_tty->cr();
               gclog_or_tty->print_cr("----------");
             }
             gclog_or_tty->print_cr("Missing rem set entry:");
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,7 @@
                 (_hr_)->startsHumongous() ? "HS" : \
                 (_hr_)->continuesHumongous() ? "HC" : \
                 !(_hr_)->is_empty() ? "O" : "F", \
-                (_hr_)->bottom(), (_hr_)->top(), (_hr_)->end()
+                p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
 
 // sentinel value for hrs_index
 #define G1_NULL_HRS_INDEX ((uint) -1)
@@ -550,7 +550,7 @@
            (containing_set != NULL && _containing_set == NULL),
            err_msg("containing_set: "PTR_FORMAT" "
                    "_containing_set: "PTR_FORMAT,
-                   containing_set, _containing_set));
+                   p2i(containing_set), p2i(_containing_set)));
 
     _containing_set = containing_set;
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Mon May 12 17:01:57 2014 -0700
@@ -36,6 +36,8 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/growableArray.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 class PerRegionTable: public CHeapObj<mtGC> {
   friend class OtherRegionsTable;
   friend class HeapRegionRemSetIterator;
@@ -1218,7 +1220,7 @@
     while (cur_evnt < _n_recorded_events && i == cur_evnt_ind) {
       gclog_or_tty->print("Event: ");
       print_event(gclog_or_tty, cur_evnt_kind);
-      gclog_or_tty->print_cr("");
+      gclog_or_tty->cr();
       cur_evnt++;
       if (cur_evnt < MaxRecordedEvents) {
         cur_evnt_kind = _recorded_events[cur_evnt];
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -233,7 +233,7 @@
     guarantee(hr != NULL, err_msg("invariant: i: %u", i));
     guarantee(hr->bottom() == prev_end,
               err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT,
-                      i, HR_FORMAT_PARAMS(hr), prev_end));
+                      i, HR_FORMAT_PARAMS(hr), p2i(prev_end)));
     guarantee(hr->hrs_index() == i,
               err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index()));
     if (i < length()) {
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +30,9 @@
 
 inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const {
   assert(addr < heap_end(),
-        err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, addr, heap_end()));
+        err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, p2i(addr), p2i(heap_end())));
   assert(addr >= heap_bottom(),
-        err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, heap_bottom()));
+        err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, p2i(addr), p2i(heap_bottom())));
 
   HeapRegion* hr = _regions.get_by_address(addr);
   assert(hr != NULL, "invariant");
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Mon May 12 17:01:57 2014 -0700
@@ -26,6 +26,8 @@
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 uint FreeRegionList::_unrealistically_long_length = 0;
 
 void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) {
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Mon May 12 17:01:57 2014 -0700
@@ -162,7 +162,7 @@
 // diagnosing failures.
 class hrs_ext_msg : public hrs_err_msg {
 public:
-  hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("") {
+  hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("%s","") {
     set->fill_in_ext_msg(this, message);
   }
 };
--- a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +32,8 @@
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void ObjPtrQueue::flush() {
   // The buffer might contain refs into the CSet. We have to filter it
   // first before we flush it, otherwise we might end up with an
--- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "gc_implementation/g1/survRateGroup.hpp"
 #include "memory/allocation.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p,
                              const char* name,
                              size_t summary_surv_rates_len) :
@@ -202,7 +204,7 @@
   if (length == 0)
     return;
 
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
   gclog_or_tty->print_cr("%s Rate Summary (for up to age " SIZE_FORMAT ")", _name, length-1);
   gclog_or_tty->print_cr("      age range     survival rate (avg)      samples (avg)");
   gclog_or_tty->print_cr("  ---------------------------------------------------------");
--- a/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -259,22 +259,22 @@
                   requested_eden_size, requested_survivor_size);
     gclog_or_tty->print_cr("    eden: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  eden()->bottom(),
-                  eden()->end(),
+                  p2i(eden()->bottom()),
+                  p2i(eden()->end()),
                   pointer_delta(eden()->end(),
                                 eden()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("    from: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  from()->bottom(),
-                  from()->end(),
+                  p2i(from()->bottom()),
+                  p2i(from()->end()),
                   pointer_delta(from()->end(),
                                 from()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("      to: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  to()->bottom(),
-                  to()->end(),
+                  p2i(to()->bottom()),
+                  p2i(to()->end()),
                   pointer_delta(  to()->end(),
                                   to()->bottom(),
                                   sizeof(char)));
@@ -382,18 +382,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
     }
   } else {
@@ -473,18 +473,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,8 @@
 #include "runtime/virtualspace.hpp"
 #include "runtime/vmThread.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
                                                              OopsInGenClosure* cl,
                                                              CardTableRS* ct,
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,8 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/workgroup.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef _MSC_VER
 #pragma warning( push )
 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
--- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,12 +79,12 @@
     if ((HeapWord*)obj < _boundary) {
 #ifndef PRODUCT
       if (_g->to()->is_in_reserved(obj)) {
-        tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p);
+        tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p2i(p));
         GenCollectedHeap* gch =  (GenCollectedHeap*)Universe::heap();
         Space* sp = gch->space_containing(p);
         oop obj = oop(sp->block_start(p));
         assert((HeapWord*)obj < (HeapWord*)p, "Error");
-        tty->print_cr("Object: " PTR_FORMAT, (void *)obj);
+        tty->print_cr("Object: " PTR_FORMAT, p2i((void *)obj));
         tty->print_cr("-------");
         obj->print();
         tty->print_cr("-----");
@@ -110,7 +110,7 @@
         if (TraceScavenge) {
           gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
              "forwarded ",
-             new_obj->klass()->internal_name(), p, (void *)obj, (void *)new_obj, new_obj->size());
+             new_obj->klass()->internal_name(), p2i(p), p2i((void *)obj), p2i((void *)new_obj), new_obj->size());
         }
 #endif
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,22 +252,22 @@
                   requested_eden_size, requested_survivor_size);
     gclog_or_tty->print_cr("    eden: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  eden_space()->bottom(),
-                  eden_space()->end(),
+                  p2i(eden_space()->bottom()),
+                  p2i(eden_space()->end()),
                   pointer_delta(eden_space()->end(),
                                 eden_space()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("    from: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  from_space()->bottom(),
-                  from_space()->end(),
+                  p2i(from_space()->bottom()),
+                  p2i(from_space()->end()),
                   pointer_delta(from_space()->end(),
                                 from_space()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("      to: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  to_space()->bottom(),
-                  to_space()->end(),
+                  p2i(to_space()->bottom()),
+                  p2i(to_space()->end()),
                   pointer_delta(  to_space()->end(),
                                   to_space()->bottom(),
                                   sizeof(char)));
@@ -373,18 +373,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
     }
   } else {
@@ -427,18 +427,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -478,23 +478,23 @@
     gclog_or_tty->print_cr("  "
                   "  _covered[%d].start(): " INTPTR_FORMAT
                   "  _covered[%d].last(): " INTPTR_FORMAT,
-                  ind, _covered[ind].start(),
-                  ind, _covered[ind].last());
+                  ind, p2i(_covered[ind].start()),
+                  ind, p2i(_covered[ind].last()));
     gclog_or_tty->print_cr("  "
                   "  _committed[%d].start(): " INTPTR_FORMAT
                   "  _committed[%d].last(): " INTPTR_FORMAT,
-                  ind, _committed[ind].start(),
-                  ind, _committed[ind].last());
+                  ind, p2i(_committed[ind].start()),
+                  ind, p2i(_committed[ind].last()));
     gclog_or_tty->print_cr("  "
                   "  byte_for(start): " INTPTR_FORMAT
                   "  byte_for(last): " INTPTR_FORMAT,
-                  byte_for(_covered[ind].start()),
-                  byte_for(_covered[ind].last()));
+                  p2i(byte_for(_covered[ind].start())),
+                  p2i(byte_for(_covered[ind].last())));
     gclog_or_tty->print_cr("  "
                   "  addr_for(start): " INTPTR_FORMAT
                   "  addr_for(last): " INTPTR_FORMAT,
-                  addr_for((jbyte*) _committed[ind].start()),
-                  addr_for((jbyte*) _committed[ind].last()));
+                  p2i(addr_for((jbyte*) _committed[ind].start())),
+                  p2i(addr_for((jbyte*) _committed[ind].last())));
   }
   debug_only(verify_guard();)
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +32,8 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 //
 // GCTask
 //
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
 #include "runtime/os.hpp"
 #include "runtime/thread.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 GCTaskThread::GCTaskThread(GCTaskManager* manager,
                            uint           which,
                            uint           processor_id) :
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -45,7 +45,7 @@
 
 void GenerationSizer::initialize_flags() {
   // Do basic sizing work
-  TwoGenerationCollectorPolicy::initialize_flags();
+  GenCollectorPolicy::initialize_flags();
 
   assert(UseSerialGC ||
           !FLAG_IS_DEFAULT(ParallelGCThreads) ||
@@ -79,7 +79,7 @@
     // Redo everything from the start
     initialize_flags();
   }
-  TwoGenerationCollectorPolicy::initialize_size_info();
+  GenCollectorPolicy::initialize_size_info();
 
   trace_gen_sizes("ps heap rnd");
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp	Mon May 12 17:01:57 2014 -0700
@@ -28,9 +28,9 @@
 #include "memory/collectorPolicy.hpp"
 
 // There is a nice batch of tested generation sizing code in
-// TwoGenerationCollectorPolicy. Lets reuse it!
+// GenCollectorPolicy. Lets reuse it!
 
-class GenerationSizer : public TwoGenerationCollectorPolicy {
+class GenerationSizer : public GenCollectorPolicy {
  private:
 
   void trace_gen_sizes(const char* const str);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
   static inline idx_t bits_required(MemRegion covered_region);
 
   void print_on_error(outputStream* st) const {
-    st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this);
+    st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, p2i(this));
     _beg_bits.print_on_error(st, " Begin Bits: ");
     _end_bits.print_on_error(st, " End Bits:   ");
   }
@@ -390,9 +390,9 @@
 inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
   // Allow one past the last valid address; useful for loop bounds.
   assert(addr >= region_start(),
-      err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, addr, region_start()));
+      err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start())));
   assert(addr <= region_end(),
-      err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, addr, region_end()));
+      err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end())));
 }
 #endif  // #ifdef ASSERT
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -373,7 +373,7 @@
     if ((result == NULL) && (QueuedAllocationWarningCount > 0) &&
         (loop_count % QueuedAllocationWarningCount == 0)) {
       warning("ParallelScavengeHeap::mem_allocate retries %d times \n\t"
-              " size=%d", loop_count, size);
+              " size=" SIZE_FORMAT, loop_count, size);
     }
   }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
   const void* loc = (void*) p;
   bool result = ((HeapWord*)p) >= young_gen()->reserved().start();
   assert(result == young_gen()->is_in_reserved(p),
-        err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p));
+        err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p)));
   return result;
 }
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_INLINE_HPP
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,8 @@
 #include "runtime/vmThread.hpp"
 #include "services/management.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 //
 // ThreadRootsMarkingTask
 //
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,8 @@
 
 #include <math.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size,
                                            size_t init_promo_size,
                                            size_t init_survivor_size,
@@ -1033,7 +1035,7 @@
       "AdaptiveSizePolicy::adjust_promo_for_footprint "
       "adjusting tenured gen for footprint. "
       "starting promo size " SIZE_FORMAT
-      " reduced promo size " SIZE_FORMAT,
+      " reduced promo size " SIZE_FORMAT
       " promo delta " SIZE_FORMAT,
       desired_promo_size, reduced_size, change );
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,8 @@
 #include "utilities/events.hpp"
 #include "utilities/stack.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 elapsedTimer        PSMarkSweep::_accumulated_time;
 jlong               PSMarkSweep::_time_of_last_gc   = 0;
 CollectorCounters*  PSMarkSweep::_counters = NULL;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +33,8 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 inline const char* PSOldGen::select_name() {
   return UseParallelOldGC ? "ParOldGen" : "PSOldGen";
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,6 +62,8 @@
 
 #include <math.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // All sizes are in HeapWords.
 const size_t ParallelCompactData::Log2RegionSize  = 16; // 64K words
 const size_t ParallelCompactData::RegionSize      = (size_t)1 << Log2RegionSize;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,8 @@
 #include "oops/oop.inline.hpp"
 #include "oops/oop.psgc.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL;
 OopStarTaskQueueSet*           PSPromotionManager::_stack_array_depth = NULL;
 PSOldGen*                      PSPromotionManager::_old_gen = NULL;
@@ -136,7 +138,7 @@
   }
 
   const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]);
-  for (uint i = 0; i < hlines; ++i) tty->print_cr(pm_stats_hdr[i]);
+  for (uint i = 0; i < hlines; ++i) tty->print_cr("%s", pm_stats_hdr[i]);
   for (uint i = 0; i < ParallelGCThreads + 1; ++i) {
     manager_array(i)->print_local_stats(i);
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -226,7 +226,7 @@
   if (TraceScavenge) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
-       new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
   }
 #endif
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Mon May 12 17:01:57 2014 -0700
@@ -56,6 +56,7 @@
 #include "services/memoryService.hpp"
 #include "utilities/stack.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 HeapWord*                  PSScavenge::_to_space_top_before_gc = NULL;
 int                        PSScavenge::_consecutive_skipped_scavenges = 0;
@@ -833,7 +834,7 @@
 
   if (AlwaysTenure || NeverTenure) {
     assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
-        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold));
+        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold));
     _tenuring_threshold = MaxTenuringThreshold;
   } else {
     // We want to smooth out our startup times for the AdaptiveSizePolicy
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,7 @@
   if (TraceScavenge &&  o->is_forwarded()) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        "forwarding",
-       new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
   }
 #endif
 
@@ -180,7 +180,7 @@
     if (TraceScavenge) {
       ResourceMark rm;
       gclog_or_tty->print_cr("PSScavengeKlassClosure::do_klass " PTR_FORMAT ", %s, dirty: %s",
-                             klass,
+                             p2i(klass),
                              klass->external_name(),
                              klass->has_modified_oops() ? "true" : "false");
     }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 # include "os_bsd.inline.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // PSVirtualSpace
 
 PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) :
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +33,8 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PSYoungGen::PSYoungGen(size_t        initial_size,
                        size_t        min_size,
                        size_t        max_size) :
--- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Mon May 12 17:01:57 2014 -0700
@@ -84,7 +84,7 @@
 
   if (AlwaysTenure || NeverTenure) {
     assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
-        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold));
+        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is " UINTX_FORMAT, MaxTenuringThreshold));
     result = MaxTenuringThreshold;
   } else {
     size_t total = 0;
@@ -106,7 +106,7 @@
       gclog_or_tty->cr();
       gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold "
         UINTX_FORMAT " (max threshold " UINTX_FORMAT ")",
-        desired_survivor_size*oopSize, result, MaxTenuringThreshold);
+        desired_survivor_size*oopSize, (uintx) result, MaxTenuringThreshold);
     }
 
     size_t total = 0;
@@ -115,8 +115,8 @@
       total += sizes[age];
       if (sizes[age] > 0) {
         if (PrintTenuringDistribution) {
-          gclog_or_tty->print_cr("- age %3u: %10ld bytes, %10ld total",
-            age, sizes[age]*oopSize, total*oopSize);
+          gclog_or_tty->print_cr("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total",
+                                        age,    sizes[age]*oopSize,          total*oopSize);
         }
       }
       if (UsePerfData) {
--- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,7 +107,7 @@
       assert(demand >= 0,
              err_msg("Demand (" SSIZE_FORMAT ") should be non-negative for "
                      PTR_FORMAT " (size=" SIZE_FORMAT ")",
-                     demand, this, count));
+                     demand, p2i(this), count));
       // Defensive: adjust for imprecision in event counting
       if (demand < 0) {
         demand = 0;
--- a/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
 
 void ImmutableSpace::print() const {
   print_short();
-  tty->print_cr(" [%#-6lx,%#-6lx)", bottom(), end());
+  tty->print_cr(" [" INTPTR_FORMAT_W(#-6) "," INTPTR_FORMAT_W(#-6) ")", p2i(bottom()), p2i(end()));
 }
 
 #endif
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +32,8 @@
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 uint                    MarkSweep::_total_invocations = 0;
 
 Stack<oop, mtGC>              MarkSweep::_marking_stack;
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +30,8 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
   _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray<LGRPSpace*>(0, true);
   _page_size = os::vm_page_size();
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +32,8 @@
 #include "runtime/thread.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) {
   assert(MutableSpace::alignment() >= 0 &&
          MutableSpace::alignment() % os::vm_page_size() == 0,
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "oops/oop.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
   _end(NULL), _hard_end(NULL),
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 #include "memory/space.inline.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Catch-all file for utility classes
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Mon May 12 17:01:57 2014 -0700
@@ -599,12 +599,12 @@
   assert(heap_start >= ((uintptr_t)NULL + epsilon), "sanity");
   void* before_heap = (void*)(heap_start - epsilon);
   assert(!heap->is_in(before_heap),
-      err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", before_heap));
+      err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(before_heap)));
 
   // Test that a pointer to after the heap end is reported as outside the heap.
   assert(heap_end <= ((uintptr_t)-1 - epsilon), "sanity");
   void* after_heap = (void*)(heap_end + epsilon);
   assert(!heap->is_in(after_heap),
-      err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", after_heap));
+      err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap)));
 }
 #endif
--- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,7 +213,7 @@
       st->print_cr(" %s", buf);
     }
   } else {
-    st->print_cr(" " PTR_FORMAT, (void *)value);
+    st->print_cr(" " INTPTR_FORMAT, p2i((void *)value));
   }
 }
 
@@ -282,7 +282,7 @@
   if (i >= 0 && i < climit) {
     cp_index = cache->entry_at(i)->constant_pool_index();
   } else {
-    st->print_cr(" not in CP[*]?", i);
+    st->print_cr("%d not in CP[*]?", i);
       return false;
     }
   return true;
@@ -297,7 +297,7 @@
      cp_index = constants->object_to_cp_index(i);
      return true;
   } else {
-    st->print_cr(" not in OBJ[*]?", i);
+    st->print_cr("%d not in OBJ[*]?", i);
   return false;
 }
 }
@@ -321,7 +321,7 @@
   if (tag.is_int()) {
     st->print_cr(" " INT32_FORMAT, constants->int_at(i));
   } else if (tag.is_long()) {
-    st->print_cr(" " INT64_FORMAT, constants->long_at(i));
+    st->print_cr(" " INT64_FORMAT, (int64_t)(constants->long_at(i)));
   } else if (tag.is_float()) {
     st->print_cr(" %f", constants->float_at(i));
   } else if (tag.is_double()) {
@@ -340,7 +340,7 @@
   } else if (tag.is_method_handle()) {
     int kind = constants->method_handle_ref_kind_at(i);
     int i2 = constants->method_handle_index_at(i);
-    st->print(" <MethodHandle of kind %d>", kind, i2);
+    st->print(" <MethodHandle of kind %d index at %d>", kind, i2);
     print_field_or_method(-i, i2, st);
   } else {
     st->print_cr(" bad tag=%d at %d", tag.value(), i);
@@ -389,6 +389,7 @@
 }
 
 
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void BytecodePrinter::print_attributes(int bci, outputStream* st) {
   // Show attributes of pre-rewritten codes
   Bytecodes::Code code = Bytecodes::java_code(raw_code());
@@ -515,7 +516,10 @@
           int idx = ll - lo;
           const char *format = first ? " %d:" INT32_FORMAT " (delta: %d)" :
                                        ", %d:" INT32_FORMAT " (delta: %d)";
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
           st->print(format, ll, dest[idx], dest[idx]-bci);
+PRAGMA_DIAG_POP
         }
         st->cr();
       }
@@ -535,7 +539,10 @@
         for (int ll = 0; ll < len; ll++, first = false)  {
           const char *format = first ? " " INT32_FORMAT ":" INT32_FORMAT :
                                        ", " INT32_FORMAT ":" INT32_FORMAT ;
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
           st->print(format, key[ll], dest[ll]);
+PRAGMA_DIAG_POP
         }
         st->cr();
       }
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
   if (description() != NULL) st->print("%s  ", description());
   if (bytecode()    >= 0   ) st->print("%d %s  ", bytecode(), Bytecodes::name(bytecode()));
   st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
-                code_begin(), code_end(), code_size());
+                p2i(code_begin()), p2i(code_end()), code_size());
 
   if (PrintInterpreter) {
     st->cr();
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +75,8 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 class UnlockFlagSaver {
   private:
     JavaThread* _thread;
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1626,7 +1626,7 @@
                                                      THREAD);
   if (HAS_PENDING_EXCEPTION) {
     if (TraceMethodHandles) {
-      tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, (void *)PENDING_EXCEPTION);
+      tty->print_cr("invokedynamic throws BSME for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION));
       PENDING_EXCEPTION->print();
     }
     if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
--- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +31,8 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/signature.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 class OopMapCacheEntry: private InterpreterOopMap {
   friend class InterpreterOopMap;
   friend class OopMapForCacheEntry;
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,7 @@
   tty->print("[");
   for (int i = 0; i < number_of_states; i++) {
     if (i > 0) tty->print(", ");
-    tty->print(INTPTR_FORMAT, _entry[i]);
+    tty->print(INTPTR_FORMAT, p2i(_entry[i]));
   }
   tty->print("]");
 }
--- a/hotspot/src/share/vm/libadt/dict.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/libadt/dict.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,8 @@
 
 #include <assert.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // The iostream is not needed and it gets confused for gcc by the
 // define of bool.
 //
--- a/hotspot/src/share/vm/libadt/set.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/libadt/set.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -116,7 +116,7 @@
 void Set::print() const
 {
   char *printable_set = setstr();
-  tty->print_cr(printable_set);
+  tty->print_cr("%s", printable_set);
   FreeHeap(printable_set);
 }
 
--- a/hotspot/src/share/vm/memory/allocation.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,7 +79,7 @@
 }
 
 void MetaspaceObj::print_address_on(outputStream* st) const {
-  st->print(" {"INTPTR_FORMAT"}", this);
+  st->print(" {" INTPTR_FORMAT "}", p2i(this));
 }
 
 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() {
@@ -142,7 +142,7 @@
 void ResourceObj::set_allocation_type(address res, allocation_type type) {
     // Set allocation type in the resource object
     uintptr_t allocation = (uintptr_t)res;
-    assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " PTR_FORMAT, res));
+    assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " INTPTR_FORMAT, p2i(res)));
     assert(type <= allocation_mask, "incorrect allocation type");
     ResourceObj* resobj = (ResourceObj *)res;
     resobj->_allocation_t[0] = ~(allocation + type);
@@ -179,7 +179,7 @@
       // Operator new() was called and type was set.
       assert(!allocated_on_stack(),
              err_msg("not embedded or stack, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
-                     this, get_allocation_type(), _allocation_t[0], _allocation_t[1]));
+                     p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]));
     } else {
       // Operator new() was not called.
       // Assume that it is embedded or stack object.
@@ -193,7 +193,7 @@
     // Note: garbage may resembles valid value.
     assert(~(_allocation_t[0] | allocation_mask) != (uintptr_t)this || !is_type_set(),
            err_msg("embedded or stack only, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
-                   this, get_allocation_type(), _allocation_t[0], _allocation_t[1]));
+                   p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]));
     set_allocation_type((address)this, STACK_OR_EMBEDDED);
     _allocation_t[1] = 0; // Zap verification value
 }
@@ -202,7 +202,7 @@
     // Used in InlineTree::ok_to_inline() for WarmCallInfo.
     assert(allocated_on_stack(),
            err_msg("copy only into local, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
-                   this, get_allocation_type(), _allocation_t[0], _allocation_t[1]));
+                   p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]));
     // Keep current _allocation_t value;
     return *this;
 }
@@ -218,13 +218,13 @@
 
 void trace_heap_malloc(size_t size, const char* name, void* p) {
   // A lock is not needed here - tty uses a lock internally
-  tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p, size, name == NULL ? "" : name);
+  tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p2i(p), size, name == NULL ? "" : name);
 }
 
 
 void trace_heap_free(void* p) {
   // A lock is not needed here - tty uses a lock internally
-  tty->print_cr("Heap free   " INTPTR_FORMAT, p);
+  tty->print_cr("Heap free   " INTPTR_FORMAT, p2i(p));
 }
 
 //--------------------------------------------------------------------------------------
@@ -725,11 +725,11 @@
 void AllocatedObj::print_value() const { print_value_on(tty); }
 
 void AllocatedObj::print_on(outputStream* st) const {
-  st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", this);
+  st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", p2i(this));
 }
 
 void AllocatedObj::print_value_on(outputStream* st) const {
-  st->print("AllocatedObj(" INTPTR_FORMAT ")", this);
+  st->print("AllocatedObj(" INTPTR_FORMAT ")", p2i(this));
 }
 
 julong Arena::_bytes_allocated = 0;
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1318,7 +1318,7 @@
     for (Chunk_t* fc = fl->head(); fc != NULL;
          fc = fc->next()) {
       _st->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ")  %s",
-                    fc, (HeapWord*)fc + sz,
+                    p2i(fc), p2i((HeapWord*)fc + sz),
                     fc->cantCoalesce() ? "\t CC" : "");
     }
   }
--- a/hotspot/src/share/vm/memory/blockOffsetTable.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/blockOffsetTable.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,12 +59,12 @@
                   "  rs.base(): " INTPTR_FORMAT
                   "  rs.size(): " INTPTR_FORMAT
                   "  rs end(): " INTPTR_FORMAT,
-                  rs.base(), rs.size(), rs.base() + rs.size());
+                  p2i(rs.base()), rs.size(), p2i(rs.base() + rs.size()));
     gclog_or_tty->print_cr("  "
                   "  _vs.low_boundary(): " INTPTR_FORMAT
                   "  _vs.high_boundary(): " INTPTR_FORMAT,
-                  _vs.low_boundary(),
-                  _vs.high_boundary());
+                  p2i(_vs.low_boundary()),
+                  p2i(_vs.high_boundary()));
   }
 }
 
@@ -537,10 +537,10 @@
     q -= (N_words * n_cards_back);
     assert(q >= _sp->bottom(),
            err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
-                   q, _sp->bottom()));
+                   p2i(q), p2i(_sp->bottom())));
     assert(q < _sp->end(),
            err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
-                   q, _sp->end()));
+                   p2i(q), p2i(_sp->end())));
     index -= n_cards_back;
     offset = _array->offset_array(index);
   }
@@ -549,10 +549,10 @@
   q -= offset;
   assert(q >= _sp->bottom(),
          err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
-                 q, _sp->bottom()));
+                 p2i(q), p2i(_sp->bottom())));
   assert(q < _sp->end(),
          err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
-                 q, _sp->end()));
+                 p2i(q), p2i(_sp->end())));
   HeapWord* n = q;
 
   while (n <= addr) {
@@ -563,14 +563,14 @@
            err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT","
                    " while querying blk_start(" PTR_FORMAT ")"
                    " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
-                   n, last, addr, _sp->bottom(), _sp->end()));
+                   p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end())));
   }
   assert(q <= addr,
          err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")",
-                 q, addr));
+                 p2i(q), p2i(addr)));
   assert(addr <= n,
          err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")",
-                 addr, n));
+                 p2i(addr), p2i(n)));
   return q;
 }
 
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -138,11 +138,11 @@
     gclog_or_tty->print_cr("  "
                   "  &_byte_map[0]: " INTPTR_FORMAT
                   "  &_byte_map[_last_valid_index]: " INTPTR_FORMAT,
-                  &_byte_map[0],
-                  &_byte_map[_last_valid_index]);
+                  p2i(&_byte_map[0]),
+                  p2i(&_byte_map[_last_valid_index]));
     gclog_or_tty->print_cr("  "
                   "  byte_map_base: " INTPTR_FORMAT,
-                  byte_map_base);
+                  p2i(byte_map_base));
   }
 }
 
@@ -392,23 +392,23 @@
     gclog_or_tty->print_cr("  "
                   "  _covered[%d].start(): " INTPTR_FORMAT
                   "  _covered[%d].last(): " INTPTR_FORMAT,
-                  ind, _covered[ind].start(),
-                  ind, _covered[ind].last());
+                  ind, p2i(_covered[ind].start()),
+                  ind, p2i(_covered[ind].last()));
     gclog_or_tty->print_cr("  "
                   "  _committed[%d].start(): " INTPTR_FORMAT
                   "  _committed[%d].last(): " INTPTR_FORMAT,
-                  ind, _committed[ind].start(),
-                  ind, _committed[ind].last());
+                  ind, p2i(_committed[ind].start()),
+                  ind, p2i(_committed[ind].last()));
     gclog_or_tty->print_cr("  "
                   "  byte_for(start): " INTPTR_FORMAT
                   "  byte_for(last): " INTPTR_FORMAT,
-                  byte_for(_covered[ind].start()),
-                  byte_for(_covered[ind].last()));
+                  p2i(byte_for(_covered[ind].start())),
+                  p2i(byte_for(_covered[ind].last())));
     gclog_or_tty->print_cr("  "
                   "  addr_for(start): " INTPTR_FORMAT
                   "  addr_for(last): " INTPTR_FORMAT,
-                  addr_for((jbyte*) _committed[ind].start()),
-                  addr_for((jbyte*) _committed[ind].last()));
+                  p2i(addr_for((jbyte*) _committed[ind].start())),
+                  p2i(addr_for((jbyte*) _committed[ind].last())));
   }
   // Touch the last card of the covered region to show that it
   // is committed (or SEGV).
@@ -657,14 +657,14 @@
     if (failed) {
       if (!failures) {
         tty->cr();
-        tty->print_cr("== CT verification failed: ["PTR_FORMAT","PTR_FORMAT"]", start, end);
+        tty->print_cr("== CT verification failed: [" INTPTR_FORMAT "," INTPTR_FORMAT "]", p2i(start), p2i(end));
         tty->print_cr("==   %sexpecting value: %d",
                       (val_equals) ? "" : "not ", val);
         failures = true;
       }
       tty->print_cr("==   card "PTR_FORMAT" ["PTR_FORMAT","PTR_FORMAT"], "
-                    "val: %d", curr, addr_for(curr),
-                    (HeapWord*) (((size_t) addr_for(curr)) + card_size),
+                    "val: %d", p2i(curr), p2i(addr_for(curr)),
+                    p2i((HeapWord*) (((size_t) addr_for(curr)) + card_size)),
                     (int) curr_val);
     }
   }
@@ -682,7 +682,7 @@
 
 void CardTableModRefBS::print_on(outputStream* st) const {
   st->print_cr("Card table byte_map: [" INTPTR_FORMAT "," INTPTR_FORMAT "] byte_map_base: " INTPTR_FORMAT,
-               _byte_map, _byte_map + _byte_map_size, byte_map_base);
+               p2i(_byte_map), p2i(_byte_map + _byte_map_size), p2i(byte_map_base));
 }
 
 bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) {
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
     assert(_whole_heap.contains(p),
            err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
-                   p, _whole_heap.start(), _whole_heap.end()));
+                   p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
     jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
     assert(result >= _byte_map && result < _byte_map + _byte_map_size,
            "out of bounds accessor for card marking array");
@@ -431,7 +431,7 @@
     assert(_whole_heap.contains(result),
            err_msg("Returning result = "PTR_FORMAT" out of bounds of "
                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
-                   result, _whole_heap.start(), _whole_heap.end()));
+                   p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
     return result;
   }
 
@@ -440,7 +440,7 @@
     assert(_whole_heap.contains(p),
            err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
-                   p, _whole_heap.start(), _whole_heap.end()));
+                   p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
     return byte_for(p) - _byte_map;
   }
 
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -288,14 +288,14 @@
          err_msg("Did you forget to call save_marks()? "
                  "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
                  "[" PTR_FORMAT ", " PTR_FORMAT ")",
-                 urasm.start(), urasm.end(), ur.start(), ur.end()));
+                 p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())));
   // In the case of CMS+ParNew, issue a warning
   if (!ur.contains(urasm)) {
     assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above");
     warning("CMS+ParNew: Did you forget to call save_marks()? "
             "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
             "[" PTR_FORMAT ", " PTR_FORMAT ")",
-             urasm.start(), urasm.end(), ur.start(), ur.end());
+             p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end()));
     MemRegion ur2 = sp->used_region();
     MemRegion urasm2 = sp->used_region_at_save_marks();
     if (!ur.equals(ur2)) {
@@ -349,12 +349,12 @@
     assert(jp >= _begin && jp < _end,
            err_msg("Error: jp " PTR_FORMAT " should be within "
                    "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
-                   jp, _begin, _end));
+                   p2i(jp), p2i(_begin), p2i(_end)));
     oop obj = oopDesc::load_decode_heap_oop(p);
     guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
               err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
                       "clean card crosses boundary" PTR_FORMAT,
-                      (HeapWord*)obj, jp, _boundary));
+                      p2i((HeapWord*)obj), p2i(jp), p2i(_boundary)));
   }
 
 public:
@@ -362,10 +362,10 @@
     _boundary(b), _begin(begin), _end(end) {
     assert(b <= begin,
            err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT,
-                   b, begin));
+                   p2i(b), p2i(begin)));
     assert(begin <= end,
            err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT,
-                   begin, end));
+                   p2i(begin), p2i(end)));
   }
 
   virtual void do_oop(oop* p)       { VerifyCleanCardClosure::do_oop_work(p); }
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -200,6 +200,9 @@
     _initial_gen0_size(0),
     _max_gen0_size(0),
     _gen_alignment(0),
+    _min_gen1_size(0),
+    _initial_gen1_size(0),
+    _max_gen1_size(0),
     _generations(NULL)
 {}
 
@@ -238,10 +241,6 @@
   assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young gen and heap sizes");
   assert(NewSize % _gen_alignment == 0, "NewSize alignment");
   assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % _gen_alignment == 0, "MaxNewSize alignment");
-}
-
-void TwoGenerationCollectorPolicy::assert_flags() {
-  GenCollectorPolicy::assert_flags();
   assert(OldSize + NewSize <= MaxHeapSize, "Ergonomics decided on incompatible generation and heap sizes");
   assert(OldSize % _gen_alignment == 0, "OldSize alignment");
 }
@@ -252,6 +251,7 @@
   assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes");
   assert(NewSize == _initial_gen0_size, "Discrepancy between NewSize flag and local storage");
   assert(MaxNewSize == _max_gen0_size, "Discrepancy between MaxNewSize flag and local storage");
+  assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage");
   assert(_min_gen0_size <= _initial_gen0_size, "Ergonomics decided on incompatible minimum and initial young gen sizes");
   assert(_initial_gen0_size <= _max_gen0_size, "Ergonomics decided on incompatible initial and maximum young gen sizes");
   assert(_min_gen0_size % _gen_alignment == 0, "_min_gen0_size alignment");
@@ -263,11 +263,6 @@
       "Ergonomics made initial young generation larger than initial heap");
   assert(_max_gen0_size <= bound_minus_alignment(_max_gen0_size, _max_heap_byte_size),
       "Ergonomics made maximum young generation lager than maximum heap");
-}
-
-void TwoGenerationCollectorPolicy::assert_size_info() {
-  GenCollectorPolicy::assert_size_info();
-  assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage");
   assert(_min_gen1_size <= _initial_gen1_size, "Ergonomics decided on incompatible minimum and initial old gen sizes");
   assert(_initial_gen1_size <= _max_gen1_size, "Ergonomics decided on incompatible initial and maximum old gen sizes");
   assert(_max_gen1_size % _gen_alignment == 0, "_max_gen1_size alignment");
@@ -369,12 +364,6 @@
     vm_exit_during_initialization("Invalid young gen ratio specified");
   }
 
-  DEBUG_ONLY(GenCollectorPolicy::assert_flags();)
-}
-
-void TwoGenerationCollectorPolicy::initialize_flags() {
-  GenCollectorPolicy::initialize_flags();
-
   if (!is_size_aligned(OldSize, _gen_alignment)) {
     // Setting OldSize directly to preserve information about the possible
     // setting of OldSize on the command line.
@@ -433,7 +422,7 @@
 
   always_do_update_barrier = UseConcMarkSweepGC;
 
-  DEBUG_ONLY(TwoGenerationCollectorPolicy::assert_flags();)
+  DEBUG_ONLY(GenCollectorPolicy::assert_flags();)
 }
 
 // Values set on the command line win over any ergonomically
@@ -445,6 +434,13 @@
 // themselves and with overall heap sizings.
 // In the absence of explicitly set command line flags, policies
 // such as the use of NewRatio are used to size the generation.
+
+// Minimum sizes of the generations may be different than
+// the initial sizes.  An inconsistency is permitted here
+// in the total size that can be specified explicitly by
+// command line specification of OldSize and NewSize and
+// also a command line specification of -Xms.  Issue a warning
+// but allow the values to pass.
 void GenCollectorPolicy::initialize_size_info() {
   CollectorPolicy::initialize_size_info();
 
@@ -520,19 +516,6 @@
       _min_gen0_size, _initial_gen0_size, _max_gen0_size);
   }
 
-  DEBUG_ONLY(GenCollectorPolicy::assert_size_info();)
-}
-
-// Minimum sizes of the generations may be different than
-// the initial sizes.  An inconsistency is permitted here
-// in the total size that can be specified explicitly by
-// command line specification of OldSize and NewSize and
-// also a command line specification of -Xms.  Issue a warning
-// but allow the values to pass.
-
-void TwoGenerationCollectorPolicy::initialize_size_info() {
-  GenCollectorPolicy::initialize_size_info();
-
   // At this point the minimum, initial and maximum sizes
   // of the overall heap and of gen0 have been determined.
   // The maximum gen1 size can be determined from the maximum gen0
@@ -625,7 +608,7 @@
       _min_gen1_size, _initial_gen1_size, _max_gen1_size);
   }
 
-  DEBUG_ONLY(TwoGenerationCollectorPolicy::assert_size_info();)
+  DEBUG_ONLY(GenCollectorPolicy::assert_size_info();)
 }
 
 HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
@@ -753,7 +736,7 @@
     if ((QueuedAllocationWarningCount > 0) &&
         (try_count % QueuedAllocationWarningCount == 0)) {
           warning("TwoGenerationCollectorPolicy::mem_allocate_work retries %d times \n\t"
-                  " size=%d %s", try_count, size, is_tlab ? "(TLAB)" : "");
+                  " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : "");
     }
   }
 }
@@ -920,7 +903,7 @@
     if ((QueuedAllocationWarningCount > 0) &&
         (loop_count % QueuedAllocationWarningCount == 0)) {
       warning("satisfy_failed_metadata_allocation() retries %d times \n\t"
-              " size=%d", loop_count, word_size);
+              " size=" SIZE_FORMAT, loop_count, word_size);
     }
   } while (true);  // Until a GC is done
 }
--- a/hotspot/src/share/vm/memory/collectorPolicy.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp	Mon May 12 17:01:57 2014 -0700
@@ -47,7 +47,6 @@
 
 // Forward declarations.
 class GenCollectorPolicy;
-class TwoGenerationCollectorPolicy;
 class AdaptiveSizePolicy;
 #if INCLUDE_ALL_GCS
 class ConcurrentMarkSweepPolicy;
@@ -114,7 +113,7 @@
 
   enum Name {
     CollectorPolicyKind,
-    TwoGenerationCollectorPolicyKind,
+    GenCollectorPolicyKind,
     ConcurrentMarkSweepPolicyKind,
     ASConcurrentMarkSweepPolicyKind,
     G1CollectorPolicyKind
@@ -135,7 +134,6 @@
 
   // Identification methods.
   virtual GenCollectorPolicy*           as_generation_policy()            { return NULL; }
-  virtual TwoGenerationCollectorPolicy* as_two_generation_policy()        { return NULL; }
   virtual MarkSweepPolicy*              as_mark_sweep_policy()            { return NULL; }
 #if INCLUDE_ALL_GCS
   virtual ConcurrentMarkSweepPolicy*    as_concurrent_mark_sweep_policy() { return NULL; }
@@ -143,7 +141,6 @@
 #endif // INCLUDE_ALL_GCS
   // Note that these are not virtual.
   bool is_generation_policy()            { return as_generation_policy() != NULL; }
-  bool is_two_generation_policy()        { return as_two_generation_policy() != NULL; }
   bool is_mark_sweep_policy()            { return as_mark_sweep_policy() != NULL; }
 #if INCLUDE_ALL_GCS
   bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
@@ -225,6 +222,9 @@
   size_t _min_gen0_size;
   size_t _initial_gen0_size;
   size_t _max_gen0_size;
+  size_t _min_gen1_size;
+  size_t _initial_gen1_size;
+  size_t _max_gen1_size;
 
   // _gen_alignment and _space_alignment will have the same value most of the
   // time. When using large pages they can differ.
@@ -264,8 +264,11 @@
   size_t initial_gen0_size() { return _initial_gen0_size; }
   size_t max_gen0_size()     { return _max_gen0_size; }
   size_t gen_alignment()     { return _gen_alignment; }
+  size_t min_gen1_size()     { return _min_gen1_size; }
+  size_t initial_gen1_size() { return _initial_gen1_size; }
+  size_t max_gen1_size()     { return _max_gen1_size; }
 
-  virtual int number_of_generations() = 0;
+  int number_of_generations() { return 2; }
 
   virtual GenerationSpec **generations() {
     assert(_generations != NULL, "Sanity check");
@@ -297,47 +300,15 @@
   virtual void post_heap_initialize() {
     assert(_max_gen0_size == MaxNewSize, "Should be taken care of by initialize_size_info");
   }
-};
 
-// All of hotspot's current collectors are subtypes of this
-// class. Currently, these collectors all use the same gen[0],
-// but have different gen[1] types. If we add another subtype
-// of CollectorPolicy, this class should be broken out into
-// its own file.
-
-class TwoGenerationCollectorPolicy : public GenCollectorPolicy {
- protected:
-  size_t _min_gen1_size;
-  size_t _initial_gen1_size;
-  size_t _max_gen1_size;
-
-  void initialize_flags();
-  void initialize_size_info();
-
-  DEBUG_ONLY(void assert_flags();)
-  DEBUG_ONLY(void assert_size_info();)
-
- public:
-  TwoGenerationCollectorPolicy() : GenCollectorPolicy(), _min_gen1_size(0),
-    _initial_gen1_size(0), _max_gen1_size(0) {}
-
-  // Accessors
-  size_t min_gen1_size()     { return _min_gen1_size; }
-  size_t initial_gen1_size() { return _initial_gen1_size; }
-  size_t max_gen1_size()     { return _max_gen1_size; }
-
-  // Inherited methods
-  TwoGenerationCollectorPolicy* as_two_generation_policy() { return this; }
-
-  int number_of_generations()          { return 2; }
   BarrierSet::Name barrier_set_name()  { return BarrierSet::CardTableModRef; }
 
   virtual CollectorPolicy::Name kind() {
-    return CollectorPolicy::TwoGenerationCollectorPolicyKind;
+    return CollectorPolicy::GenCollectorPolicyKind;
   }
 };
 
-class MarkSweepPolicy : public TwoGenerationCollectorPolicy {
+class MarkSweepPolicy : public GenCollectorPolicy {
  protected:
   void initialize_alignments();
   void initialize_generations();
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,8 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/stack.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 //
 // DefNewGeneration functions.
 
--- a/hotspot/src/share/vm/memory/filemap.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +40,7 @@
 #define O_BINARY 0     // otherwise do nothing.
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 extern address JVM_FunctionAtStart();
 extern address JVM_FunctionAtEnd();
--- a/hotspot/src/share/vm/memory/gcLocker.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/gcLocker.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
       tty->print_cr("critical counts don't match: %d != %d", _jni_lock_count, count);
       for (JavaThread* thr = Threads::first(); thr; thr = thr->next()) {
         if (thr->in_critical()) {
-          tty->print_cr(INTPTR_FORMAT " in_critical %d", thr, thr->in_critical());
+          tty->print_cr(INTPTR_FORMAT " in_critical %d", p2i(thr), thr->in_critical());
         }
       }
     }
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -197,9 +197,8 @@
 
 void GenCollectedHeap::post_initialize() {
   SharedHeap::post_initialize();
-  TwoGenerationCollectorPolicy *policy =
-    (TwoGenerationCollectorPolicy *)collector_policy();
-  guarantee(policy->is_two_generation_policy(), "Illegal policy type");
+  GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
+  guarantee(policy->is_generation_policy(), "Illegal policy type");
   DefNewGeneration* def_new_gen = (DefNewGeneration*) get_gen(0);
   assert(def_new_gen->kind() == Generation::DefNew ||
          def_new_gen->kind() == Generation::ParNew ||
@@ -795,7 +794,7 @@
 bool GenCollectedHeap::is_in_young(oop p) {
   bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start();
   assert(result == _gens[0]->is_in_reserved(p),
-         err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p));
+         err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p)));
   return result;
 }
 
@@ -1068,7 +1067,7 @@
   for (int i = _n_gens-1; i >= 0; i--) {
     Generation* g = _gens[i];
     if (!silent) {
-      gclog_or_tty->print(g->name());
+      gclog_or_tty->print("%s", g->name());
       gclog_or_tty->print(" ");
     }
     g->verify();
@@ -1271,7 +1270,7 @@
   // back a time later than 'now'.
   jlong retVal = now - tolgc_cl.time();
   if (retVal < 0) {
-    NOT_PRODUCT(warning("time warp: "INT64_FORMAT, retVal);)
+    NOT_PRODUCT(warning("time warp: "INT64_FORMAT, (int64_t) retVal);)
     return 0;
   }
   return retVal;
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Mon May 12 17:01:57 2014 -0700
@@ -453,7 +453,7 @@
     // Assumes a 2-generation system; the first disjunct remembers if an
     // incremental collection failed, even when we thought (second disjunct)
     // that it would not.
-    assert(heap()->collector_policy()->is_two_generation_policy(),
+    assert(heap()->collector_policy()->is_generation_policy(),
            "the following definition may not be suitable for an n(>2)-generation system");
     return incremental_collection_failed() ||
            (consult_young && !get_gen(0)->collection_attempt_is_safe());
--- a/hotspot/src/share/vm/memory/genOopClosures.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/genOopClosures.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -193,7 +193,7 @@
  protected:
   template <class T> inline void do_oop_work(T* p) {
     oop obj = oopDesc::load_decode_heap_oop(p);
-    guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, (oopDesc*) obj));
+    guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj)));
   }
  public:
   virtual void do_oop(oop* p);
--- a/hotspot/src/share/vm/memory/generation.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/generation.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +43,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/events.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 Generation::Generation(ReservedSpace rs, size_t initial_size, int level) :
   _level(level),
   _ref_processor(NULL) {
--- a/hotspot/src/share/vm/memory/generation.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/generation.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -422,7 +422,7 @@
     // have to guard against non-monotonicity.
     NOT_PRODUCT(
       if (now < _time_of_last_gc) {
-        warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now);
+        warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, (int64_t)_time_of_last_gc, (int64_t)now);
       }
     )
     return _time_of_last_gc;
--- a/hotspot/src/share/vm/memory/heapInspection.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,8 @@
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // HeapInspection
 
 int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) {
@@ -270,6 +272,7 @@
   return true;
 }
 
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void KlassInfoHisto::print_title(outputStream* st, bool csv_format,
                                  bool selected[], int width_table[],
                                  const char *name_table[]) {
@@ -282,7 +285,10 @@
   } else {
     st->print("Index Super");
     for (int c=0; c<KlassSizeStats::_num_columns; c++) {
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
       if (selected[c]) {st->print(str_fmt(width_table[c]), name_table[c]);}
+PRAGMA_DIAG_POP
     }
     st->print(" ClassName");
   }
@@ -395,12 +401,18 @@
           case KlassSizeStats::_index_inst_size:
           case KlassSizeStats::_index_inst_count:
           case KlassSizeStats::_index_method_count:
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
             st->print(str_fmt(width_table[c]), "-");
+PRAGMA_DIAG_POP
             break;
           default:
             {
               double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes;
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
               st->print(perc_fmt(width_table[c]), perc);
+PRAGMA_DIAG_POP
             }
           }
         }
--- a/hotspot/src/share/vm/memory/heapInspection.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/heapInspection.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -295,6 +295,9 @@
   // returns a format string to print a julong with the given width. E.g,
   // printf(num_fmt(6), julong(10)) would print out the number 10 with 4
   // leading spaces.
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
+
   static void print_julong(outputStream* st, int width, julong n) {
     int num_spaces = width - julong_width(n);
     if (num_spaces > 0) {
@@ -302,6 +305,7 @@
     }
     st->print(JULONG_FORMAT, n);
   }
+PRAGMA_DIAG_POP
 
   static char* perc_fmt(int width) {
     static char buf[32];
--- a/hotspot/src/share/vm/memory/metachunk.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/metachunk.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 class VirtualSpaceNode;
 
 const size_t metadata_chunk_initialize = 0xf7f7f7f7;
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > BlockTreeDictionary;
 typedef BinaryTreeDictionary<Metachunk, FreeList<Metachunk> > ChunkTreeDictionary;
 
@@ -1961,7 +1963,7 @@
       st->print_cr(" free " SIZE_FORMAT,
                    chunk->free_word_size());
     } else {
-      st->print_cr("");
+      st->cr();
     }
   }
 
@@ -2245,7 +2247,7 @@
     humongous_chunks = next_humongous_chunks;
   }
   if (TraceMetadataChunkAllocation && Verbose) {
-    gclog_or_tty->print_cr("");
+    gclog_or_tty->cr();
     gclog_or_tty->print_cr("updated dictionary count %d %s",
                      chunk_manager()->humongous_dictionary()->total_count(),
                      chunk_size_name(HumongousIndex));
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +40,7 @@
 #include "runtime/vmThread.hpp"
 #include "utilities/hashtable.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 int MetaspaceShared::_max_alignment = 0;
 
@@ -337,13 +338,14 @@
   int all_rw_count = 0;
   int all_rw_bytes = 0;
 
-  const char *fmt = "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f";
+// To make fmt_stats be a syntactic constant (for format warnings), use #define.
+#define fmt_stats "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f"
   const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
   const char *hdr = "                        ro_cnt   ro_bytes     % |   rw_cnt   rw_bytes     % |  all_cnt  all_bytes     %";
 
   tty->print_cr("Detailed metadata info (rw includes md and mc):");
-  tty->print_cr(hdr);
-  tty->print_cr(sep);
+  tty->print_cr("%s", hdr);
+  tty->print_cr("%s", sep);
   for (int type = 0; type < int(_number_of_types); type ++) {
     const char *name = type_name((Type)type);
     int ro_count = _counts[RO][type];
@@ -357,7 +359,7 @@
     double rw_perc = 100.0 * double(rw_bytes) / double(rw_all);
     double perc    = 100.0 * double(bytes)    / double(ro_all + rw_all);
 
-    tty->print_cr(fmt, name,
+    tty->print_cr(fmt_stats, name,
                   ro_count, ro_bytes, ro_perc,
                   rw_count, rw_bytes, rw_perc,
                   count, bytes, perc);
@@ -375,14 +377,15 @@
   double all_rw_perc = 100.0 * double(all_rw_bytes) / double(rw_all);
   double all_perc    = 100.0 * double(all_bytes)    / double(ro_all + rw_all);
 
-  tty->print_cr(sep);
-  tty->print_cr(fmt, "Total",
+  tty->print_cr("%s", sep);
+  tty->print_cr(fmt_stats, "Total",
                 all_ro_count, all_ro_bytes, all_ro_perc,
                 all_rw_count, all_rw_bytes, all_rw_perc,
                 all_count, all_bytes, all_perc);
 
   assert(all_ro_bytes == ro_all, "everything should have been counted");
   assert(all_rw_bytes == rw_all, "everything should have been counted");
+#undef fmt_stats
 }
 
 // Populate the shared space.
@@ -514,7 +517,8 @@
   md_top = wc.get_top();
 
   // Print shared spaces all the time
-  const char* fmt = "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT;
+// To make fmt_space be a syntactic constant (for format warnings), use #define.
+#define fmt_space "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " INTPTR_FORMAT
   Metaspace* ro_space = _loader_data->ro_metaspace();
   Metaspace* rw_space = _loader_data->rw_metaspace();
 
@@ -545,10 +549,10 @@
   const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0;
   const double total_u_perc = total_bytes / double(total_alloced) * 100.0;
 
-  tty->print_cr(fmt, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom());
-  tty->print_cr(fmt, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom());
-  tty->print_cr(fmt, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low);
-  tty->print_cr(fmt, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low);
+  tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom());
+  tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom());
+  tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low);
+  tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low);
   tty->print_cr("total   : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]",
                  total_bytes, total_alloced, total_u_perc);
 
@@ -603,6 +607,7 @@
 
     dac.dump_stats(int(ro_bytes), int(rw_bytes), int(md_bytes), int(mc_bytes));
   }
+#undef fmt_space
 }
 
 static void link_shared_classes(Klass* obj, TRAPS) {
--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,8 @@
 #include "runtime/java.hpp"
 #include "runtime/jniHandles.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
 ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy      = NULL;
 bool             ReferenceProcessor::_pending_list_uses_discovered_field = false;
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/workgroup.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 SharedHeap* SharedHeap::_sh;
 
 // The set of potentially parallel tasks in strong root scanning.
--- a/hotspot/src/share/vm/memory/space.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/space.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +43,8 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top,
                                                 HeapWord* top_obj) {
   if (top_obj != NULL) {
--- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +31,8 @@
 #include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Thread-Local Edens support
 
 // static member initialization
--- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,7 @@
                         " obj: "SIZE_FORMAT
                         " free: "SIZE_FORMAT
                         " waste: "SIZE_FORMAT"\n",
-                        "slow", thrd, thrd->osthread()->thread_id(),
+                        "slow", p2i(thrd), thrd->osthread()->thread_id(),
                         obj_size, free(), refill_waste_limit());
   }
 }
--- a/hotspot/src/share/vm/memory/universe.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/memory/universe.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,6 +78,8 @@
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Known objects
 Klass* Universe::_boolArrayKlassObj                 = NULL;
 Klass* Universe::_byteArrayKlassObj                 = NULL;
@@ -1348,7 +1350,7 @@
   HandleMark hm;  // Handles created during verification can be zapped
   _verify_count++;
 
-  if (!silent) gclog_or_tty->print(prefix);
+  if (!silent) gclog_or_tty->print("%s", prefix);
   if (!silent) gclog_or_tty->print("[Verifying ");
   if (!silent) gclog_or_tty->print("threads ");
   Threads::verify();
--- a/hotspot/src/share/vm/oops/annotations.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/annotations.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
 
 
 void Annotations::print_value_on(outputStream* st) const {
-  st->print("Anotations(" INTPTR_FORMAT ")", this);
+  st->print("Anotations(" INTPTR_FORMAT ")", p2i(this));
 }
 
 #if INCLUDE_SERVICES
--- a/hotspot/src/share/vm/oops/constMethod.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/constMethod.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -388,8 +388,8 @@
 void ConstMethod::print_on(outputStream* st) const {
   ResourceMark rm;
   assert(is_constMethod(), "must be constMethod");
-  st->print_cr(internal_name());
-  st->print(" - method:       " INTPTR_FORMAT " ", (address)method());
+  st->print_cr("%s", internal_name());
+  st->print(" - method:       " INTPTR_FORMAT " ", p2i((address)method()));
   method()->print_value_on(st); st->cr();
   if (has_stackmap_table()) {
     st->print(" - stackmap data:       ");
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Mon May 12 17:01:57 2014 -0700
@@ -42,6 +42,8 @@
 #include "runtime/signature.hpp"
 #include "runtime/vframe.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {
   // Tags are RW but comment below applies to tags also.
   Array<u1>* tags = MetadataFactory::new_writeable_array<u1>(loader_data, length, 0, CHECK_NULL);
@@ -1892,7 +1894,7 @@
 
 void ConstantPool::print_on(outputStream* st) const {
   assert(is_constantPool(), "must be constantPool");
-  st->print_cr(internal_name());
+  st->print_cr("%s", internal_name());
   if (flags() != 0) {
     st->print(" - flags: 0x%x", flags());
     if (has_preresolution()) st->print(" has_preresolution");
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Mon May 12 17:01:57 2014 -0700
@@ -39,8 +39,9 @@
 # include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
-// Implememtation of ConstantPoolCacheEntry
+// Implementation of ConstantPoolCacheEntry
 
 void ConstantPoolCacheEntry::initialize_entry(int index) {
   assert(0 < index && index < 0x10000, "sanity check");
@@ -668,7 +669,7 @@
 
 void ConstantPoolCache::print_on(outputStream* st) const {
   assert(is_constantPoolCache(), "obj must be constant pool cache");
-  st->print_cr(internal_name());
+  st->print_cr("%s", internal_name());
   // print constant pool cache entries
   for (int i = 0; i < length(); i++) entry_at(i)->print(st, i);
 }
--- a/hotspot/src/share/vm/oops/generateOopMap.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/generateOopMap.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -412,9 +412,9 @@
   int copy_cts                              (CellTypeState *dst, CellTypeState *src);
 
   // Error handling
-  void  error_work                          (const char *format, va_list ap);
-  void  report_error                        (const char *format, ...);
-  void  verify_error                        (const char *format, ...);
+  void  error_work                          (const char *format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void  report_error                        (const char *format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void  verify_error                        (const char *format, ...) ATTRIBUTE_PRINTF(2, 3);
   bool  got_error()                         { return _got_error; }
 
   // Create result set
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Mon May 12 17:01:57 2014 -0700
@@ -77,6 +77,8 @@
 #include "c1/c1_Compiler.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef DTRACE_ENABLED
 
 
@@ -2857,7 +2859,7 @@
   st->print(BULLET"instance size:     %d", size_helper());                        st->cr();
   st->print(BULLET"klass size:        %d", size());                               st->cr();
   st->print(BULLET"access:            "); access_flags().print_on(st);            st->cr();
-  st->print(BULLET"state:             "); st->print_cr(state_names[_init_state]);
+  st->print(BULLET"state:             "); st->print_cr("%s", state_names[_init_state]);
   st->print(BULLET"name:              "); name()->print_value_on(st);             st->cr();
   st->print(BULLET"super:             "); super()->print_value_on_maybe_null(st); st->cr();
   st->print(BULLET"sub:               ");
--- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,8 @@
 #include "oops/oop.pcgc.inline.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 template <class T>
 void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) {
   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
--- a/hotspot/src/share/vm/oops/klass.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/klass.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,7 @@
   assert(!is_null(v), "narrow klass value can never be zero");
   int    shift = Universe::narrow_klass_shift();
   Klass* result = (Klass*)(void*)((uintptr_t)Universe::narrow_klass_base() + ((uintptr_t)v << shift));
-  assert(check_klass_alignment(result), err_msg("address not aligned: " PTR_FORMAT, (void*) result));
+  assert(check_klass_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result)));
   return result;
 }
 
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Mon May 12 17:01:57 2014 -0700
@@ -39,6 +39,8 @@
 #include "runtime/handles.inline.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 inline InstanceKlass* klassVtable::ik() const {
   Klass* k = _klass();
   assert(k->oop_is_instance(), "not an InstanceKlass");
--- a/hotspot/src/share/vm/oops/markOop.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/markOop.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +26,11 @@
 #include "oops/markOop.hpp"
 #include "runtime/thread.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void markOopDesc::print_on(outputStream* st) const {
   if (is_locked()) {
-    st->print("locked(0x%lx)->", value());
+    st->print("locked(" INTPTR_FORMAT ")->", value());
     markOop(*(markOop*)value())->print_on(st);
   } else {
     assert(is_unlocked() || has_bias_pattern(), "just checking");
--- a/hotspot/src/share/vm/oops/method.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/method.cpp	Mon May 12 17:01:57 2014 -0700
@@ -56,6 +56,7 @@
 #include "utilities/quickSort.hpp"
 #include "utilities/xmlstream.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Implementation of Method
 
@@ -1425,7 +1426,7 @@
 
   void type_name(const char* name) {
     if (_use_separator) _st->print(", ");
-    _st->print(name);
+    _st->print("%s", name);
     _use_separator = true;
   }
 
@@ -1898,7 +1899,7 @@
 void Method::print_on(outputStream* st) const {
   ResourceMark rm;
   assert(is_method(), "must be method");
-  st->print_cr(internal_name());
+  st->print_cr("%s", internal_name());
   // get the effect of PrintOopAddress, always, for methods:
   st->print_cr(" - this oop:          "INTPTR_FORMAT, (intptr_t)this);
   st->print   (" - method holder:     "); method_holder()->print_value_on(st); st->cr();
@@ -1981,7 +1982,7 @@
 
 void Method::print_value_on(outputStream* st) const {
   assert(is_method(), "must be method");
-  st->print(internal_name());
+  st->print("%s", internal_name());
   print_address_on(st);
   st->print(" ");
   name()->print_value_on(st);
--- a/hotspot/src/share/vm/oops/methodData.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,8 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // ==================================================================
 // DataLayout
 //
@@ -127,7 +129,7 @@
     st->print("trap(%s) ", Deoptimization::format_trap_state(buf, sizeof(buf), trap));
   }
   if (extra != NULL) {
-    st->print(extra);
+    st->print("%s", extra);
   }
   int flags = data()->flags();
   if (flags != 0) {
@@ -635,7 +637,7 @@
 }
 
 void ParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
-  st->print("parameter types", extra);
+  st->print("parameter types"); // FIXME extra ignored?
   _parameters.print_data_on(st);
 }
 
--- a/hotspot/src/share/vm/oops/oop.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/oop.cpp	Mon May 12 17:01:57 2014 -0700
@@ -30,6 +30,8 @@
 #include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 bool always_do_update_barrier = false;
 
 BarrierSet* oopDesc::_bs = NULL;
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -211,7 +211,7 @@
   address base = Universe::narrow_oop_base();
   int    shift = Universe::narrow_oop_shift();
   oop result = (oop)(void*)((uintptr_t)base + ((uintptr_t)v << shift));
-  assert(check_obj_alignment(result), err_msg("address not aligned: " PTR_FORMAT, (void*) result));
+  assert(check_obj_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result)));
   return result;
 }
 
--- a/hotspot/src/share/vm/opto/block.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/block.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -339,7 +339,7 @@
     st->print(" FRegPressure: %d",_freg_pressure);
     st->print(" FHRP Index: %d",_fhrp_index);
   }
-  st->print_cr("");
+  st->cr();
 }
 
 void Block::dump() const {
--- a/hotspot/src/share/vm/opto/callnode.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/callnode.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
 #ifndef PRODUCT
 void ParmNode::dump_spec(outputStream *st) const {
   if( _con < TypeFunc::Parms ) {
-    st->print(names[_con]);
+    st->print("%s", names[_con]);
   } else {
     st->print("Parm%d: ",_con-TypeFunc::Parms);
     // Verbose and WizardMode dump bottom_type for all nodes
@@ -348,19 +348,19 @@
       break;
     case Type::AryPtr:
     case Type::InstPtr:
-      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->isa_oopptr()->const_oop());
+      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->isa_oopptr()->const_oop()));
       break;
     case Type::KlassPtr:
-      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_klassptr()->klass());
+      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_klassptr()->klass()));
       break;
     case Type::MetadataPtr:
-      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_metadataptr()->metadata());
+      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_metadataptr()->metadata()));
       break;
     case Type::NarrowOop:
-      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_oopptr()->const_oop());
+      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_oopptr()->const_oop()));
       break;
     case Type::RawPtr:
-      st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,t->is_rawptr());
+      st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,p2i(t->is_rawptr()));
       break;
     case Type::DoubleCon:
       st->print(" %s%d]=#%fD",msg,i,t->is_double_constant()->_d);
@@ -369,7 +369,7 @@
       st->print(" %s%d]=#%fF",msg,i,t->is_float_constant()->_f);
       break;
     case Type::Long:
-      st->print(" %s%d]=#"INT64_FORMAT,msg,i,t->is_long()->get_con());
+      st->print(" %s%d]=#"INT64_FORMAT,msg,i,(int64_t)(t->is_long()->get_con()));
       break;
     case Type::Half:
     case Type::Top:
@@ -428,7 +428,7 @@
 
     for (i = 0; i < (uint)scobjs.length(); i++) {
       // Scalar replaced objects.
-      st->print_cr("");
+      st->cr();
       st->print("        # ScObj" INT32_FORMAT " ", i);
       SafePointScalarObjectNode* spobj = scobjs.at(i);
       ciKlass* cik = spobj->bottom_type()->is_oopptr()->klass();
@@ -485,7 +485,7 @@
       st->print(" }");
     }
   }
-  st->print_cr("");
+  st->cr();
   if (caller() != NULL) caller()->format(regalloc, n, st);
 }
 
@@ -981,7 +981,7 @@
 #ifndef PRODUCT
 void CallRuntimeNode::dump_spec(outputStream *st) const {
   st->print("# ");
-  st->print(_name);
+  st->print("%s", _name);
   CallNode::dump_spec(st);
 }
 #endif
@@ -999,7 +999,7 @@
 #ifndef PRODUCT
 void CallLeafNode::dump_spec(outputStream *st) const {
   st->print("# ");
-  st->print(_name);
+  st->print("%s", _name);
   CallNode::dump_spec(st);
 }
 #endif
--- a/hotspot/src/share/vm/opto/chaitin.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/chaitin.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2020,25 +2020,25 @@
       tty->print_cr("new LRG");
     }
   }
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-degree list
   tty->print("Lo degree: ");
   for(uint i3 = _lo_degree; i3; i3 = lrgs(i3)._next )
     tty->print("L%d ",i3);
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-stk-degree list
   tty->print("Lo stk degree: ");
   for(uint i4 = _lo_stk_degree; i4; i4 = lrgs(i4)._next )
     tty->print("L%d ",i4);
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-degree list
   tty->print("Hi degree: ");
   for(uint i5 = _hi_degree; i5; i5 = lrgs(i5)._next )
     tty->print("L%d ",i5);
-  tty->print_cr("");
+  tty->cr();
 }
 
 void PhaseChaitin::dump_degree_lists() const {
@@ -2046,26 +2046,26 @@
   tty->print("Lo degree: ");
   for( uint i = _lo_degree; i; i = lrgs(i)._next )
     tty->print("L%d ",i);
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-stk-degree list
   tty->print("Lo stk degree: ");
   for(uint i2 = _lo_stk_degree; i2; i2 = lrgs(i2)._next )
     tty->print("L%d ",i2);
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-degree list
   tty->print("Hi degree: ");
   for(uint i3 = _hi_degree; i3; i3 = lrgs(i3)._next )
     tty->print("L%d ",i3);
-  tty->print_cr("");
+  tty->cr();
 }
 
 void PhaseChaitin::dump_simplified() const {
   tty->print("Simplified: ");
   for( uint i = _simplified; i; i = lrgs(i)._next )
     tty->print("L%d ",i);
-  tty->print_cr("");
+  tty->cr();
 }
 
 static char *print_reg( OptoReg::Name reg, const PhaseChaitin *pc, char *buf ) {
@@ -2144,7 +2144,7 @@
       }
       tty->print("   : parm %d: ", k);
       domain->field_at(k + TypeFunc::Parms)->dump();
-      tty->print_cr("");
+      tty->cr();
     }
   }
 
@@ -2166,7 +2166,7 @@
           _matcher._parm_regs[j].second() == reg ) {
         tty->print("parm %d: ",j);
         domain->field_at(j + TypeFunc::Parms)->dump();
-        tty->print_cr("");
+        tty->cr();
         break;
       }
     }
--- a/hotspot/src/share/vm/opto/compile.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/compile.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2424,7 +2424,7 @@
         starts_bundle = ' ';
         tty->print("\t");
         delay->format(_regalloc, tty);
-        tty->print_cr("");
+        tty->cr();
         delay = NULL;
       }
 
@@ -2438,12 +2438,12 @@
     if (pcs && n->_idx < pc_limit)
       tty->print_cr("%3.3x", pcs[n->_idx]);
     else
-      tty->print_cr("");
+      tty->cr();
 
     assert(cut_short || delay == NULL, "no unconditional delay branch");
 
   } // End of per-block dump
-  tty->print_cr("");
+  tty->cr();
 
   if (cut_short)  tty->print_cr("*** disassembly is cut short ***");
 }
@@ -3688,7 +3688,8 @@
     default: ShouldNotReachHere();
     }
     assert(constant_addr, "consts section too small");
-    assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), err_msg_res("must be: %d == %d", constant_addr - _masm.code()->consts()->start(), con.offset()));
+    assert((constant_addr - _masm.code()->consts()->start()) == con.offset(),
+            err_msg_res("must be: %d == %d", (int) (constant_addr - _masm.code()->consts()->start()), (int)(con.offset())));
   }
 }
 
@@ -3768,7 +3769,7 @@
 
   for (uint i = 0; i < n->outcnt(); i++) {
     address* constant_addr = &jump_table_base[i];
-    assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, *constant_addr, (((address) n) + i)));
+    assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, p2i(*constant_addr), p2i(((address) n) + i)));
     *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr);
     cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type);
   }
@@ -3884,7 +3885,7 @@
   }
   if (do_print_inlining) {
     for (int i = 0; i < _print_inlining_list->length(); i++) {
-      tty->print(_print_inlining_list->adr_at(i)->ss()->as_string());
+      tty->print("%s", _print_inlining_list->adr_at(i)->ss()->as_string());
     }
   }
 }
--- a/hotspot/src/share/vm/opto/compile.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/compile.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -459,7 +459,7 @@
   void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
     stringStream ss;
     CompileTask::print_inlining(&ss, method, inline_level, bci, msg);
-    print_inlining_stream()->print(ss.as_string());
+    print_inlining_stream()->print("%s", ss.as_string());
   }
 
   void log_late_inline(CallGenerator* cg);
--- a/hotspot/src/share/vm/opto/doCall.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/doCall.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
     out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
     stringStream ss;
     prof_klass->name()->print_symbol_on(&ss);
-    out->print(ss.as_string());
+    out->print("%s", ss.as_string());
     out->cr();
   }
 }
--- a/hotspot/src/share/vm/opto/gcm.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/gcm.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2014,7 +2014,7 @@
   tty->print("%s: %d  trip_count: %6.0f freq: %6.0f\n",
              _depth == 0 ? "Method" : "Loop", _id, trip_count(), _freq);
   for (int i = 0; i < _depth; i++) tty->print("   ");
-  tty->print("         members:", _id);
+  tty->print("         members:");
   int k = 0;
   for (int i = 0; i < _members.length(); i++) {
     if (k++ >= 6) {
--- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
     } else {
       // It would be nice if we could shut down cleanly but it should
       // be an error if we can't connect to the visualizer.
-      fatal(err_msg_res("Couldn't connect to visualizer at %s:%d",
+      fatal(err_msg_res("Couldn't connect to visualizer at %s:" INTX_FORMAT,
                         PrintIdealGraphAddress, PrintIdealGraphPort));
     }
   }
@@ -195,7 +195,7 @@
 
 
 void IdealGraphPrinter::begin_elem(const char *s) {
-  _xml->begin_elem(s);
+  _xml->begin_elem("%s", s);
 }
 
 void IdealGraphPrinter::end_elem() {
@@ -203,7 +203,7 @@
 }
 
 void IdealGraphPrinter::begin_head(const char *s) {
-  _xml->begin_head(s);
+  _xml->begin_head("%s", s);
 }
 
 void IdealGraphPrinter::end_head() {
@@ -223,7 +223,7 @@
 }
 
 void IdealGraphPrinter::head(const char *name) {
-  _xml->head(name);
+  _xml->head("%s", name);
 }
 
 void IdealGraphPrinter::tail(const char *name) {
@@ -231,7 +231,7 @@
 }
 
 void IdealGraphPrinter::text(const char *s) {
-  _xml->text(s);
+  _xml->text("%s", s);
 }
 
 void IdealGraphPrinter::print_prop(const char *name, int val) {
@@ -359,7 +359,7 @@
 void IdealGraphPrinter::print_indent() {
   tty->print_cr("printing ident %d", _depth);
   for (int i = 0; i < _depth; i++) {
-    _xml->print(INDENT);
+    _xml->print("%s", INDENT);
   }
 }
 
--- a/hotspot/src/share/vm/opto/ifg.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/ifg.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -256,7 +256,7 @@
   for( i = 0; i < _maxlrg*2; i++ )
     if( h_cnt[i] )
       tty->print("%d/%d ",i,h_cnt[i]);
-  tty->print_cr("");
+  tty->cr();
 }
 
 void PhaseIFG::verify( const PhaseChaitin *pc ) const {
--- a/hotspot/src/share/vm/opto/loopPredicate.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -639,7 +639,7 @@
 
   if (TraceLoopPredicate) {
     predString->print_cr("<u range");
-    tty->print(predString->as_string());
+    tty->print("%s", predString->as_string());
   }
   return bol;
 }
--- a/hotspot/src/share/vm/opto/loopnode.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3569,7 +3569,7 @@
 
 #ifdef ASSERT
 void PhaseIdealLoop::dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA) {
-  tty->print_cr(msg);
+  tty->print_cr("%s", msg);
   tty->print("n: "); n->dump();
   tty->print("early(n): "); early->dump();
   if (n->in(0) != NULL  && !n->in(0)->is_top() &&
--- a/hotspot/src/share/vm/opto/matcher.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/matcher.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2622,7 +2622,7 @@
         tty->print_cr("%s  %d  %s",
                       ruleName[i], _cost[i], ruleName[_rule[i]] );
       }
-  tty->print_cr("");
+  tty->cr();
 
   for( i=0; i<2; i++ )
     if( _kids[i] )
--- a/hotspot/src/share/vm/opto/memnode.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3981,7 +3981,7 @@
     intptr_t st_off = get_store_offset(st, phase);
     if (st_off < 0)  continue;  // ignore dead garbage
     if (last_off > st_off) {
-      tty->print_cr("*** bad store offset at %d: %d > %d", i, last_off, st_off);
+      tty->print_cr("*** bad store offset at %d: " INTX_FORMAT " > " INTX_FORMAT, i, last_off, st_off);
       this->dump(2);
       assert(false, "ascending store offsets");
       return false;
--- a/hotspot/src/share/vm/opto/node.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/node.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1688,7 +1688,7 @@
       }
     }
   }
-  if (suffix) st->print(suffix);
+  if (suffix) st->print("%s", suffix);
   C->_in_dump_cnt--;
 }
 
--- a/hotspot/src/share/vm/opto/parse1.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -611,7 +611,7 @@
   set_map(entry_map);
   do_exits();
 
-  if (log)  log->done("parse nodes='%d' live='%d' memory='%d'",
+  if (log)  log->done("parse nodes='%d' live='%d' memory='" SIZE_FORMAT "'",
                       C->unique(), C->live_nodes(), C->node_arena()->used());
 }
 
@@ -1395,7 +1395,7 @@
       tty->print((( i < ns) ? " %d" : " %d(e)"), b->successor_at(i)->rpo());
     }
     if (b->is_loop_head()) tty->print("  lphd");
-    tty->print_cr("");
+    tty->cr();
   }
 
   assert(block()->is_merged(), "must be merged before being parsed");
--- a/hotspot/src/share/vm/opto/parse2.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/parse2.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -628,7 +628,7 @@
     _method->print_short_name();
     tty->print_cr(" switch decision tree");
     tty->print_cr("    %d ranges (%d singletons), max_depth=%d, est_depth=%d",
-                  hi-lo+1, nsing, _max_switch_depth, _est_switch_depth);
+                  (int) (hi-lo+1), nsing, _max_switch_depth, _est_switch_depth);
     if (_max_switch_depth > _est_switch_depth) {
       tty->print_cr("******** BAD SWITCH DEPTH ********");
     }
@@ -636,7 +636,7 @@
     for( r = lo; r <= hi; r++ ) {
       r->print();
     }
-    tty->print_cr("");
+    tty->cr();
   }
 #endif
 }
--- a/hotspot/src/share/vm/opto/phaseX.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/phaseX.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -958,10 +958,10 @@
   if (VerifyIterativeGVN && PrintOpto) {
     if (_verify_counter == _verify_full_passes) {
       tty->print_cr("VerifyIterativeGVN: %d transforms and verify passes",
-                    _verify_full_passes);
+                    (int) _verify_full_passes);
     } else {
       tty->print_cr("VerifyIterativeGVN: %d transforms, %d full verify passes",
-                  _verify_counter, _verify_full_passes);
+                  (int) _verify_counter, (int) _verify_full_passes);
     }
   }
 }
--- a/hotspot/src/share/vm/opto/regmask.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/regmask.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -116,7 +116,7 @@
   case Special: st->print("r---"); break;
   case Bad:     st->print("rBAD"); break;
   default:
-    if (r < _last_Mach_Reg) st->print(Matcher::regName[r]);
+    if (r < _last_Mach_Reg) st->print("%s", Matcher::regName[r]);
     else st->print("rS%d",r);
     break;
   }
--- a/hotspot/src/share/vm/opto/runtime.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1393,7 +1393,7 @@
   } else {
     tty->print("<unknown>");
   }
-  tty->print(" at " INTPTR_FORMAT,  exception_pc);
+  tty->print(" at " INTPTR_FORMAT,  p2i(exception_pc));
   tty->print_cr("]");
 }
 
--- a/hotspot/src/share/vm/opto/subnode.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/subnode.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1065,7 +1065,7 @@
 #ifndef PRODUCT
 void BoolTest::dump_on(outputStream *st) const {
   const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"};
-  st->print(msg[_test]);
+  st->print("%s", msg[_test]);
 }
 #endif
 
--- a/hotspot/src/share/vm/opto/type.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/opto/type.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,8 @@
 #include "opto/opcodes.hpp"
 #include "opto/type.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Portions of code courtesy of Clifford Click
 
 // Optimization - Graph Style
@@ -842,7 +844,7 @@
 #ifndef PRODUCT
 //------------------------------dump2------------------------------------------
 void Type::dump2( Dict &d, uint depth, outputStream *st ) const {
-  st->print(_type_info[_base].msg);
+  st->print("%s", _type_info[_base].msg);
 }
 
 //------------------------------dump-------------------------------------------
--- a/hotspot/src/share/vm/prims/jni.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jni.cpp	Mon May 12 17:01:57 2014 -0700
@@ -275,7 +275,7 @@
 
   class JNITraceWrapper : public StackObj {
    public:
-    JNITraceWrapper(const char* format, ...) {
+    JNITraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
       if (TraceJNICalls) {
         va_list ap;
         va_start(ap, format);
--- a/hotspot/src/share/vm/prims/jniCheck.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,7 +100,7 @@
   result_type JNICALL header {                                           \
     JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\
     if (thr == NULL || !thr->is_Java_thread()) {                         \
-      tty->print_cr(fatal_using_jnienv_in_nonjava);                      \
+      tty->print_cr("%s", fatal_using_jnienv_in_nonjava);                      \
       os::abort(true);                                                   \
     }                                                                    \
     JNIEnv* xenv = thr->jni_environment();                               \
@@ -184,7 +184,7 @@
 functionEnter(JavaThread* thr)
 {
   if (thr->in_critical()) {
-    tty->print_cr(warn_other_function_in_critical);
+    tty->print_cr("%s", warn_other_function_in_critical);
   }
   if (thr->has_pending_exception()) {
     NativeReportJNIWarning(thr, "JNI call made with exception pending");
@@ -195,7 +195,7 @@
 functionEnterExceptionAllowed(JavaThread* thr)
 {
   if (thr->in_critical()) {
-    tty->print_cr(warn_other_function_in_critical);
+    tty->print_cr("%s", warn_other_function_in_critical);
   }
 }
 
--- a/hotspot/src/share/vm/prims/jvm.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Mon May 12 17:01:57 2014 -0700
@@ -215,7 +215,7 @@
 #ifdef ASSERT
   class JVMTraceWrapper : public StackObj {
    public:
-    JVMTraceWrapper(const char* format, ...) {
+    JVMTraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
       if (TraceJVMCalls) {
         va_list ap;
         va_start(ap, format);
@@ -2736,14 +2736,14 @@
 
 
 JVM_LEAF(jlong, JVM_Lseek(jint fd, jlong offset, jint whence))
-  JVMWrapper4("JVM_Lseek (0x%x, %Ld, %d)", fd, offset, whence);
+  JVMWrapper4("JVM_Lseek (0x%x, " INT64_FORMAT ", %d)", fd, (int64_t) offset, whence);
   //%note jvm_r6
   return os::lseek(fd, offset, whence);
 JVM_END
 
 
 JVM_LEAF(jint, JVM_SetLength(jint fd, jlong length))
-  JVMWrapper3("JVM_SetLength (0x%x, %Ld)", fd, length);
+  JVMWrapper3("JVM_SetLength (0x%x, " INT64_FORMAT ")", fd, (int64_t) length);
   return os::ftruncate(fd, length);
 JVM_END
 
@@ -2758,13 +2758,14 @@
 // Printing support //////////////////////////////////////////////////
 extern "C" {
 
+ATTRIBUTE_PRINTF(3, 0)
 int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
   // see bug 4399518, 4417214
   if ((intptr_t)count <= 0) return -1;
   return vsnprintf(str, count, fmt, args);
 }
 
-
+ATTRIBUTE_PRINTF(3, 0)
 int jio_snprintf(char *str, size_t count, const char *fmt, ...) {
   va_list args;
   int len;
@@ -2774,7 +2775,7 @@
   return len;
 }
 
-
+ATTRIBUTE_PRINTF(2,3)
 int jio_fprintf(FILE* f, const char *fmt, ...) {
   int len;
   va_list args;
@@ -2784,7 +2785,7 @@
   return len;
 }
 
-
+ATTRIBUTE_PRINTF(2, 0)
 int jio_vfprintf(FILE* f, const char *fmt, va_list args) {
   if (Arguments::vfprintf_hook() != NULL) {
      return Arguments::vfprintf_hook()(f, fmt, args);
@@ -2793,7 +2794,7 @@
   }
 }
 
-
+ATTRIBUTE_PRINTF(1, 2)
 JNIEXPORT int jio_printf(const char *fmt, ...) {
   int len;
   va_list args;
@@ -2930,7 +2931,7 @@
   JavaThread* receiver = java_lang_Thread::thread(java_thread);
   Events::log_exception(JavaThread::current(),
                         "JVM_StopThread thread JavaThread " INTPTR_FORMAT " as oop " INTPTR_FORMAT " [exception " INTPTR_FORMAT "]",
-                        receiver, (address)java_thread, throwable);
+                        p2i(receiver), p2i((address)java_thread), p2i(throwable));
   // First check if thread is alive
   if (receiver != NULL) {
     // Check if exception is getting thrown at self (use oop equality, since the
--- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Mon May 12 17:01:57 2014 -0700
@@ -1,6 +1,6 @@
 <?xml version="1.0"?> 
 <!--
- Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  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,6 +43,9 @@
 # include "prims/jvmtiRawMonitor.hpp"
 # include "prims/jvmtiUtil.hpp"
 
+// There are known-bad format/arg pairings in the code generated by this file.
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 </xsl:text>
 
   <xsl:if test="$trace = 'Trace'">
--- a/hotspot/src/share/vm/prims/jvmtiEnvThreadState.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiEnvThreadState.cpp	Mon May 12 17:01:57 2014 -0700
@@ -113,7 +113,7 @@
     JvmtiFramePop fp = JvmtiFramePop(_pops->at(i));
     tty->print("%d: ", i);
     fp.print();
-    tty->print_cr("");
+    tty->cr();
   }
 }
 #endif
--- a/hotspot/src/share/vm/prims/jvmtiEventController.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiEventController.cpp	Mon May 12 17:01:57 2014 -0700
@@ -38,6 +38,8 @@
 #include "runtime/vmThread.hpp"
 #include "runtime/vm_operations.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef JVMTI_TRACE
 #define EC_TRACE(out) do { \
   if (JvmtiTrace::trace_event_controller()) { \
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Mon May 12 17:01:57 2014 -0700
@@ -56,6 +56,8 @@
 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef JVMTI_TRACE
 #define EVT_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_SENT) != 0) { SafeResourceMark rm; tty->print_cr out; }
 #define EVT_TRIG_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_TRIGGER) != 0) { SafeResourceMark rm; tty->print_cr out; }
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -413,7 +413,7 @@
     JvmtiBreakpoint& bp = _bps.at(i);
     tty->print("%d: ", i);
     bp.print();
-    tty->print_cr("");
+    tty->cr();
   }
 #endif
 }
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +43,7 @@
 #include "runtime/relocator.hpp"
 #include "utilities/bitMap.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 Array<Method*>* VM_RedefineClasses::_old_methods = NULL;
 Array<Method*>* VM_RedefineClasses::_new_methods = NULL;
@@ -1904,6 +1905,8 @@
 // annotations_typeArray if needed. Returns the original constant
 // pool reference if a rewrite was not needed or the new constant
 // pool reference if a rewrite was needed.
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
 u2 VM_RedefineClasses::rewrite_cp_ref_in_annotation_data(
      AnnotationArray* annotations_typeArray, int &byte_i_ref,
      const char * trace_mesg, TRAPS) {
@@ -1920,6 +1923,7 @@
   byte_i_ref += 2;
   return old_cp_index;
 }
+PRAGMA_DIAG_POP
 
 
 // Rewrite constant pool references in the element_value portion of an
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -536,7 +536,7 @@
           // unknown letter, or we don't want to know its name
           st->put(ch);
         } else {
-          st->print(n);
+          st->print("%s", n);
           prev_type = true;
         }
         break;
--- a/hotspot/src/share/vm/prims/privilegedStack.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/privilegedStack.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +30,7 @@
 #include "prims/privilegedStack.hpp"
 #include "runtime/vframe.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 void PrivilegedElement::initialize(vframeStream* vfst, oop context, PrivilegedElement* next, TRAPS) {
   Method* method        = vfst->method();
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/dtrace.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 /*
  *      Implementation of class sun.misc.Unsafe
  */
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Mon May 12 17:01:57 2014 -0700
@@ -53,6 +53,8 @@
 #include "compiler/compileBroker.hpp"
 #include "runtime/compilationPolicy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define SIZE_T_MAX_VALUE ((size_t) -1)
 
 bool WhiteBox::_used = false;
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon May 12 17:01:57 2014 -0700
@@ -852,7 +852,7 @@
     for (int i=0; i < _num_jvm_flags; i++) {
       st->print("%s ", _jvm_flags_array[i]);
     }
-    st->print_cr("");
+    st->cr();
   }
 }
 
@@ -861,7 +861,7 @@
     for (int i=0; i < _num_jvm_args; i++) {
       st->print("%s ", _jvm_args_array[i]);
     }
-    st->print_cr("");
+    st->cr();
   }
 }
 
@@ -1375,8 +1375,8 @@
   }
   if (PrintGCDetails && Verbose) {
     tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
-      MarkStackSize / K, MarkStackSizeMax / K);
-    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
+      (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
+    tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads);
   }
 }
 #endif // INCLUDE_ALL_GCS
@@ -1456,7 +1456,7 @@
     if (PrintGCDetails) {
       // Cannot use gclog_or_tty yet.
       tty->print_cr("Automatic selection of the low pause collector"
-       " based on pause goal of %d (ms)", MaxGCPauseMillis);
+       " based on pause goal of %d (ms)", (int) MaxGCPauseMillis);
     }
     return true;
   }
@@ -1673,8 +1673,8 @@
 
   if (PrintGCDetails && Verbose) {
     tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
-      MarkStackSize / K, MarkStackSizeMax / K);
-    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
+      (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
+    tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads);
   }
 }
 
@@ -1758,7 +1758,7 @@
 
     if (PrintGCDetails && Verbose) {
       // Cannot use gclog_or_tty yet.
-      tty->print_cr("  Maximum heap size " SIZE_FORMAT, reasonable_max);
+      tty->print_cr("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
     }
     FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx)reasonable_max);
   }
@@ -2131,7 +2131,7 @@
     // Using "else if" below to avoid printing two error messages if min > max.
     // This will also prevent us from reporting both min>100 and max>100 at the
     // same time, but that is less annoying than printing two identical errors IMHO.
-    FormatBuffer<80> err_msg("");
+    FormatBuffer<80> err_msg("%s","");
     if (!verify_MinHeapFreeRatio(err_msg, MinHeapFreeRatio)) {
       jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
       status = false;
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
 extern "C" {
   typedef void (JNICALL *abort_hook_t)(void);
   typedef void (JNICALL *exit_hook_t)(jint code);
-  typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args);
+  typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args)  ATTRIBUTE_PRINTF(2, 0);
 }
 
 // Forward declarations
--- a/hotspot/src/share/vm/runtime/biasedLocking.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/biasedLocking.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -161,7 +161,7 @@
   if (TraceBiasedLocking && (Verbose || !is_bulk)) {
     ResourceMark rm;
     tty->print_cr("Revoking bias of object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT " , allow rebias %d , requesting thread " INTPTR_FORMAT,
-                  (void *)obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
+                  p2i((void *)obj), (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
   }
 
   JavaThread* biased_thread = mark->biased_locker();
@@ -214,8 +214,8 @@
     if (mon_info->owner() == obj) {
       if (TraceBiasedLocking && Verbose) {
         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
-                      (void *) mon_info->owner(),
-                      (void *) obj);
+                      p2i((void *) mon_info->owner()),
+                      p2i((void *) obj));
       }
       // Assume recursive case and fix up highest lock later
       markOop mark = markOopDesc::encode((BasicLock*) NULL);
@@ -224,8 +224,8 @@
     } else {
       if (TraceBiasedLocking && Verbose) {
         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
-                      (void *) mon_info->owner(),
-                      (void *) obj);
+                      p2i((void *) mon_info->owner()),
+                      p2i((void *) obj));
       }
     }
   }
@@ -328,7 +328,7 @@
     tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
                   INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
                   (bulk_rebias ? "rebias" : "revoke"),
-                  (void *) o, (intptr_t) o->mark(), o->klass()->external_name());
+                  p2i((void *) o), (intptr_t) o->mark(), o->klass()->external_name());
   }
 
   jlong cur_time = os::javaTimeMillis();
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -170,7 +170,7 @@
 void NonTieredCompPolicy::trace_osr_completion(nmethod* osr_nm) {
   if (TraceOnStackReplacement) {
     if (osr_nm == NULL) tty->print_cr("compilation failed");
-    else tty->print_cr("nmethod " INTPTR_FORMAT, osr_nm);
+    else tty->print_cr("nmethod " INTPTR_FORMAT, p2i(osr_nm));
   }
 }
 #endif // !PRODUCT
@@ -417,6 +417,7 @@
 }
 
 #ifndef PRODUCT
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void NonTieredCompPolicy::trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci) {
   if (TraceInvocationCounterOverflow) {
     MethodCounters* mcs = m->method_counters();
@@ -428,7 +429,10 @@
       bci == InvocationEntryBci
       ? "comp-policy cntr ovfl @ %d in entry of "
       : "comp-policy cntr ovfl @ %d in loop of ";
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
     tty->print(msg, bci);
+PRAGMA_DIAG_POP
     m->print_value();
     tty->cr();
     ic->print();
@@ -503,7 +507,7 @@
     if (TraceCompilationPolicy) {
       tty->print("method invocation trigger: ");
       m->print_short_name(tty);
-      tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)m(), m->code_size());
+      tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)m()), m->code_size());
     }
     RegisterMap reg_map(thread, false);
     javaVFrame* triggerVF = thread->last_java_vframe(&reg_map);
@@ -512,7 +516,7 @@
 
     if (first->top_method()->code() != NULL) {
       // called obsolete method/nmethod -- no need to recompile
-      if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, first->top_method()->code());
+      if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, p2i(first->top_method()->code()));
     } else {
       if (TimeCompilationPolicy) accumulated_time()->start();
       GrowableArray<RFrame*>* stack = new GrowableArray<RFrame*>(50);
@@ -640,7 +644,7 @@
     if (TraceCompilationPolicy && Verbose) {
       tty->print("\n\t     check caller: ");
       next_m->print_short_name(tty);
-      tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)next_m(), next_m->code_size());
+      tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)next_m()), next_m->code_size());
     }
 
     current = next;
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,6 +89,8 @@
 #endif
 #endif // COMPILER2
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 bool DeoptimizationMarker::_is_active = false;
 
 Deoptimization::UnrollBlock::UnrollBlock(int  size_of_deoptimized_frame,
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 #include "runtime/vframe.hpp"
 #include "utilities/macros.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Static fields of FlatProfiler
 int               FlatProfiler::received_gc_ticks   = 0;
 int               FlatProfiler::vm_operation_ticks  = 0;
@@ -309,7 +311,7 @@
     st->fill_to(col2);
     t->print_native(st);
     st->fill_to(col3);
-    st->print(msg);
+    st->print("%s", msg);
     st->cr();
   }
 
--- a/hotspot/src/share/vm/runtime/frame.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,6 +62,8 @@
 # include "nativeInst_ppc.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 RegisterMap::RegisterMap(JavaThread *thread, bool update_map) {
   _thread         = thread;
   _update_map     = update_map;
--- a/hotspot/src/share/vm/runtime/globals.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,8 @@
 #include "shark/shark_globals.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \
               MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \
               MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \
@@ -283,6 +285,7 @@
 // Length of format string (e.g. "%.1234s") for printing ccstr below
 #define FORMAT_BUFFER_LEN 16
 
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void Flag::print_on(outputStream* st, bool withComments) {
   // Don't print notproduct and develop flags in a product build.
   if (is_constant_in_binary()) {
@@ -315,7 +318,10 @@
         size_t llen = pointer_delta(eol, cp, sizeof(char));
         jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
             "%%." SIZE_FORMAT "s", llen);
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
         st->print(format_buffer, cp);
+PRAGMA_DIAG_POP
         st->cr();
         cp = eol+1;
         st->print("%5s %-35s += ", "", _name);
@@ -372,7 +378,7 @@
         } else {
           st->print(" ");
         }
-        st->print(d.name);
+        st->print("%s", d.name);
       }
     }
 
--- a/hotspot/src/share/vm/runtime/handles.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,8 @@
 # include "os_bsd.inline.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef ASSERT
 oop* HandleArea::allocate_handle(oop obj) {
   assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,7 @@
 #include "runtime/vframe.hpp"
 #include "utilities/preserveException.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Implementation of InterfaceSupport
 
--- a/hotspot/src/share/vm/runtime/java.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/java.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -97,6 +97,7 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 GrowableArray<Method*>* collected_profiled_methods;
 
@@ -366,7 +367,7 @@
       BaselineTTYOutputer outputer(tty);
       MemTracker::print_memory_usage(outputer, K, false);
     } else {
-      tty->print_cr(MemTracker::reason());
+      tty->print_cr("%s", MemTracker::reason());
     }
   }
 }
@@ -407,7 +408,7 @@
       BaselineTTYOutputer outputer(tty);
       MemTracker::print_memory_usage(outputer, K, false);
     } else {
-      tty->print_cr(MemTracker::reason());
+      tty->print_cr("%s", MemTracker::reason());
     }
   }
 }
--- a/hotspot/src/share/vm/runtime/jniHandles.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp	Mon May 12 17:01:57 2014 -0700
@@ -30,6 +30,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/thread.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 JNIHandleBlock* JNIHandles::_global_handles       = NULL;
 JNIHandleBlock* JNIHandles::_weak_global_handles  = NULL;
--- a/hotspot/src/share/vm/runtime/mutex.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/mutex.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 # include "mutex_bsd.inline.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
 //
 // Native Monitor-Mutex locking - theory of operations
--- a/hotspot/src/share/vm/runtime/os.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/os.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,8 @@
 
 # include <signal.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 OSThread*         os::_starting_thread    = NULL;
 address           os::_polling_page       = NULL;
 volatile int32_t* os::_mem_serialize_page = NULL;
@@ -909,9 +911,9 @@
 
     for (int i = 0; env_list[i] != NULL; i++) {
       if (getenv(env_list[i], buffer, len)) {
-        st->print(env_list[i]);
+        st->print("%s", env_list[i]);
         st->print("=");
-        st->print_cr(buffer);
+        st->print_cr("%s", buffer);
       }
     }
   }
--- a/hotspot/src/share/vm/runtime/osThread.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/osThread.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +26,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/osThread.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 OSThread::OSThread(OSThreadStartFunc start_proc, void* start_parm) {
   pd_initialize();
--- a/hotspot/src/share/vm/runtime/perfData.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/perfData.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
 #include "utilities/exceptions.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PerfDataList*   PerfDataManager::_all = NULL;
 PerfDataList*   PerfDataManager::_sampled = NULL;
 PerfDataList*   PerfDataManager::_constants = NULL;
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp	Mon May 12 17:01:57 2014 -0700
@@ -35,6 +35,8 @@
 #include "runtime/statSampler.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Prefix of performance data file.
 const char               PERFDATA_NAME[] = "hsperfdata";
 
--- a/hotspot/src/share/vm/runtime/safepoint.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp	Mon May 12 17:01:57 2014 -0700
@@ -82,6 +82,8 @@
 #include "c1/c1_globals.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // --------------------------------------------------------------------------------------------------
 // Implementation of Safepoint begin/end
 
@@ -787,7 +789,7 @@
   old_sp += incr*32;  new_sp += incr*32;  was_oops += incr*32;
   for( int i2=0; i2<16; i2++ ) {
     tty->print("call %c%d |"PTR_FORMAT" ","LI"[i2>>3],i2&7,new_sp); print_ptrs(*old_sp++,*new_sp++,*was_oops++); }
-  tty->print_cr("");
+  tty->cr();
 }
 #endif  // SPARC
 #endif  // PRODUCT
@@ -829,7 +831,7 @@
     timeout_error_printed = true;
     // Print out the thread info which didn't reach the safepoint for debugging
     // purposes (useful when there are lots of threads in the debugger).
-    tty->print_cr("");
+    tty->cr();
     tty->print_cr("# SafepointSynchronize::begin: Timeout detected:");
     if (reason ==  _spinning_timeout) {
       tty->print_cr("# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint.");
@@ -849,7 +851,7 @@
            (reason == _blocking_timeout && !cur_state->has_called_back()))) {
         tty->print("# ");
         cur_thread->print();
-        tty->print_cr("");
+        tty->cr();
       }
     }
     tty->print_cr("# SafepointSynchronize::begin: (End of list)");
@@ -1322,7 +1324,7 @@
        spstat->_time_to_sync > PrintSafepointStatisticsTimeout * MICROUNITS) {
     print_statistics();
   }
-  tty->print_cr("");
+  tty->cr();
 
   // Print out polling page sampling status.
   if (!need_to_track_page_armed_status) {
--- a/hotspot/src/share/vm/runtime/safepoint.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/safepoint.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -174,7 +174,7 @@
 
   // Debugging
   static void print_state()                                PRODUCT_RETURN;
-  static void safepoint_msg(const char* format, ...)       PRODUCT_RETURN;
+  static void safepoint_msg(const char* format, ...) ATTRIBUTE_PRINTF(1, 2) PRODUCT_RETURN;
 
   static void deferred_initialize_stat();
   static void print_stat_on_exit();
@@ -240,7 +240,7 @@
   static void create(JavaThread *thread);
   static void destroy(JavaThread *thread);
 
-  void safepoint_msg(const char* format, ...) {
+  void safepoint_msg(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
     if (ShowSafepointMsgs) {
       va_list ap;
       va_start(ap, format);
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Mon May 12 17:01:57 2014 -0700
@@ -82,6 +82,8 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Shared stub locations
 RuntimeStub*        SharedRuntime::_wrong_method_blob;
 RuntimeStub*        SharedRuntime::_wrong_method_abstract_blob;
--- a/hotspot/src/share/vm/runtime/signature.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/signature.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +32,7 @@
 #include "oops/typeArrayKlass.hpp"
 #include "runtime/signature.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Implementation of SignatureIterator
 
--- a/hotspot/src/share/vm/runtime/stackValue.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/stackValue.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
     case T_OBJECT:
      _o()->print_value_on(st);
-      st->print(" <" INTPTR_FORMAT ">", (address)_o());
+      st->print(" <" INTPTR_FORMAT ">", p2i((address)_o()));
      break;
 
     case T_CONFLICT:
--- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +40,8 @@
 # include "jniTypes_ppc.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 jint StackValueCollection::int_at(int slot) const {
   intptr_t val =  at(slot)->get_int();
   jint ival = *((jint*) (&val));
--- a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,10 +60,10 @@
 
 
 void StubCodeDesc::print_on(outputStream* st) const {
-  st->print(group());
+  st->print("%s", group());
   st->print("::");
-  st->print(name());
-  st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", begin(), end(), size_in_bytes());
+  st->print("%s", name());
+  st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", p2i(begin()), p2i(end()), size_in_bytes());
 }
 
 // Implementation of StubCodeGenerator
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +43,8 @@
 #include "utilities/ticks.inline.hpp"
 #include "utilities/xmlstream.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef ASSERT
 
 #define SWEEP(nm) record_sweep(nm, __LINE__)
@@ -627,7 +629,7 @@
       tty->vprint(format, ap);
       va_end(ap);
     }
-    tty->print_cr(s.as_string());
+    tty->print_cr("%s", s.as_string());
   }
 
   if (LogCompilation && (xtty != NULL)) {
@@ -644,7 +646,7 @@
       xtty->vprint(format, ap);
       va_end(ap);
     }
-    xtty->print(s.as_string());
+    xtty->print("%s", s.as_string());
     xtty->stamp();
     xtty->end_elem();
   }
--- a/hotspot/src/share/vm/runtime/sweeper.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@
   static const Tickspan total_time_sweeping()      { return _total_time_sweeping; }
   static const Tickspan peak_sweep_time()          { return _peak_sweep_time; }
   static const Tickspan peak_sweep_fraction_time() { return _peak_sweep_fraction_time; }
-  static void log_sweep(const char* msg, const char* format = NULL, ...);
+  static void log_sweep(const char* msg, const char* format = NULL, ...) ATTRIBUTE_PRINTF(2, 3);
 
 
 #ifdef ASSERT
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -60,6 +60,8 @@
   #define ATTR
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // The "core" versions of monitor enter and exit reside in this file.
 // The interpreter and compilers contain specialized transliterated
 // variants of the enter-exit fast-path operations.  See i486.ad fast_lock(),
--- a/hotspot/src/share/vm/runtime/thread.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Mon May 12 17:01:57 2014 -0700
@@ -112,6 +112,8 @@
 #include "runtime/rtmLocking.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef DTRACE_ENABLED
 
 // Only bother with this argument setup if dtrace is available
@@ -4273,7 +4275,7 @@
 // Threads::print_on() is called at safepoint by VM_PrintThreads operation.
 void Threads::print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks) {
   char buf[32];
-  st->print_cr(os::local_time_string(buf, sizeof(buf)));
+  st->print_cr("%s", os::local_time_string(buf, sizeof(buf)));
 
   st->print_cr("Full thread dump %s (%s %s):",
                 Abstract_VM_Version::vm_name(),
--- a/hotspot/src/share/vm/runtime/thread.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Mon May 12 17:01:57 2014 -0700
@@ -684,7 +684,7 @@
   NamedThread();
   ~NamedThread();
   // May only be called once per thread.
-  void set_name(const char* format, ...);
+  void set_name(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3);
   virtual bool is_Named_thread() const { return true; }
   virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; }
   JavaThread *processed_thread() { return _processed_thread; }
--- a/hotspot/src/share/vm/runtime/timer.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/timer.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -204,7 +204,7 @@
       _logfile->print("[Error in TraceCPUTime]");
     }
     if (_print_cr) {
-      _logfile->print_cr("");
+      _logfile->cr();
     }
     _logfile->flush();
   }
--- a/hotspot/src/share/vm/runtime/unhandledOops.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/unhandledOops.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +31,8 @@
 #include "runtime/unhandledOops.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef CHECK_UNHANDLED_OOPS
 const int free_list_size = 256;
 
--- a/hotspot/src/share/vm/runtime/vframe.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vframe.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,8 @@
 #include "runtime/vframeArray.hpp"
 #include "runtime/vframe_hp.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 vframe::vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread)
 : _reg_map(reg_map), _thread(thread) {
   assert(fr != NULL, "must have frame");
--- a/hotspot/src/share/vm/runtime/vframe.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vframe.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -399,7 +399,7 @@
     if (WizardMode) {
       tty->print_cr("Error in fill_from_frame: pc_desc for "
                     INTPTR_FORMAT " not found or invalid at %d",
-                    _frame.pc(), decode_offset);
+                    p2i(_frame.pc()), decode_offset);
       nm()->print();
       nm()->method()->print_codes();
       nm()->print_code();
--- a/hotspot/src/share/vm/runtime/vframeArray.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vframeArray.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +43,7 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 int vframeArrayElement:: bci(void) const { return (_bci == SynchronizationEntryBCI ? 0 : _bci); }
 
--- a/hotspot/src/share/vm/runtime/virtualspace.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +43,7 @@
 # include "os_bsd.inline.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // ReservedSpace
 
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +40,8 @@
 #include "utilities/events.hpp"
 #include "utilities/xmlstream.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Dummy VM operation to act as first element in our circular double-linked list
 class VM_Dummy: public VM_Operation {
   VMOp_Type type() const { return VMOp_Dummy; }
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +39,8 @@
 #include "services/threadService.hpp"
 #include "trace/tracing.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define VM_OP_NAME_INITIALIZE(name) #name,
 
 const char* VM_Operation::_names[VM_Operation::VMOp_Terminating] = \
--- a/hotspot/src/share/vm/runtime/vm_version.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@
   set_version_field(&_vm_minor_version, JDK_MINOR_VERSION, "bad minor version");
   set_version_field(&_vm_micro_version, JDK_MICRO_VERSION, "bad micro version");
   int offset = (JDK_BUILD_NUMBER != NULL && JDK_BUILD_NUMBER[0] == 'b') ? 1 : 0;
-  set_version_field(&_vm_build_number, JDK_BUILD_NUMBER + offset,
+  set_version_field(&_vm_build_number, &JDK_BUILD_NUMBER[offset],
                     "bad build number");
 
   _initialized = true;
--- a/hotspot/src/share/vm/services/attachListener.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/attachListener.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -284,15 +284,15 @@
   }
 
   if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
-    FormatBuffer<80> err_msg("");
+    FormatBuffer<80> err_msg("%s", "");
     if (!Arguments::verify_MaxHeapFreeRatio(err_msg, value)) {
-      out->print_cr(err_msg.buffer());
+      out->print_cr("%s", err_msg.buffer());
       return JNI_ERR;
     }
   } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) {
-    FormatBuffer<80> err_msg("");
+    FormatBuffer<80> err_msg("%s", "");
     if (!Arguments::verify_MinHeapFreeRatio(err_msg, value)) {
-      out->print_cr(err_msg.buffer());
+      out->print_cr("%s", err_msg.buffer());
       return JNI_ERR;
     }
   }
@@ -381,7 +381,7 @@
   Flag* f = Flag::find_flag((char*)name, strlen(name));
   if (f) {
     f->print_as_flag(out);
-    out->print_cr("");
+    out->cr();
   } else {
     out->print_cr("no such flag '%s'", name);
   }
--- a/hotspot/src/share/vm/services/classLoadingService.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/classLoadingService.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,7 +136,7 @@
 
   if (TraceClassUnloading) {
     ResourceMark rm;
-    tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), k);
+    tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), p2i(k));
   }
 }
 
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +33,8 @@
 #include "services/management.hpp"
 #include "utilities/macros.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void DCmdRegistrant::register_dcmds(){
   // Registration of the diagnostic commands
   // First argument specifies which interfaces will export the command
@@ -101,7 +103,7 @@
     if (factory != NULL) {
       output()->print_cr("%s%s", factory->name(),
                          factory->is_enabled() ? "" : " [disabled]");
-      output()->print_cr(factory->description());
+      output()->print_cr("%s", factory->description());
       output()->print_cr("\nImpact: %s", factory->impact());
       JavaPermission p = factory->permission();
       if(p._class != NULL) {
--- a/hotspot/src/share/vm/services/diagnosticFramework.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -259,7 +259,7 @@
     }
     arg = arg->next();
   }
-  out->print_cr("");
+  out->cr();
   if (_arguments_list != NULL) {
     out->print_cr("\nArguments:");
     arg = _arguments_list;
@@ -268,7 +268,7 @@
                  arg->is_mandatory() ? "" : "[optional]",
                  arg->description(), arg->type());
       if (arg->has_default()) {
-        out->print(arg->default_string());
+        out->print("%s", arg->default_string());
       } else {
         out->print("no default value");
       }
@@ -284,7 +284,7 @@
                  arg->is_mandatory() ? "" : "[optional]",
                  arg->description(), arg->type());
       if (arg->has_default()) {
-        out->print(arg->default_string());
+        out->print("%s", arg->default_string());
       } else {
         out->print("no default value");
       }
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1842,6 +1842,7 @@
 }
 
 // dump the heap to given path.
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 int HeapDumper::dump(const char* path) {
   assert(path != NULL && strlen(path) > 0, "path missing");
 
@@ -1882,7 +1883,10 @@
       char msg[256];
       sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]",
         JLONG_FORMAT, timer()->seconds());
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
       tty->print_cr(msg, writer.bytes_written());
+PRAGMA_DIAG_POP
     } else {
       tty->print_cr("Dump file is incomplete: %s", writer.error());
     }
--- a/hotspot/src/share/vm/services/lowMemoryDetector.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -353,7 +353,7 @@
 
 #ifndef PRODUCT
 void SensorInfo::print() {
-  tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %ld pending_clears = %ld",
+  tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %d pending_clears = %d",
                 (_sensor_on ? "on" : "off"),
                 _sensor_count, _pending_trigger_count, _pending_clear_count);
 }
--- a/hotspot/src/share/vm/services/management.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/management.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,8 @@
 #include "services/threadService.hpp"
 #include "utilities/macros.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PerfVariable* Management::_begin_vm_creation_time = NULL;
 PerfVariable* Management::_end_vm_creation_time = NULL;
 PerfVariable* Management::_vm_init_done_time = NULL;
@@ -1839,12 +1841,12 @@
     uintx uvalue = (uintx)new_value.j;
 
     if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
-      FormatBuffer<80> err_msg("");
+      FormatBuffer<80> err_msg("%s", "");
       if (!Arguments::verify_MaxHeapFreeRatio(err_msg, uvalue)) {
         THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer());
       }
     } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) {
-      FormatBuffer<80> err_msg("");
+      FormatBuffer<80> err_msg("%s", "");
       if (!Arguments::verify_MinHeapFreeRatio(err_msg, uvalue)) {
         THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer());
       }
--- a/hotspot/src/share/vm/services/memReporter.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/memReporter.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #include "services/memPtrArray.hpp"
 #include "services/memTracker.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 const char* BaselineOutputer::memory_unit(size_t scale) {
   switch(scale) {
     case K: return "KB";
--- a/hotspot/src/share/vm/services/memSnapshot.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/memSnapshot.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +31,8 @@
 #include "services/memSnapshot.hpp"
 #include "services/memTracker.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef ASSERT
 
 void decode_pointer_record(MemPointerRecord* rec) {
@@ -733,7 +735,7 @@
         if (os::dll_address_to_function_name(ex->pc(), buf, sizeof(buf), NULL)) {
           tty->print_cr("\t%s", buf);
         } else {
-          tty->print_cr("");
+          tty->cr();
         }
       }
     }
--- a/hotspot/src/share/vm/services/memTrackWorker.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/memTrackWorker.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +43,7 @@
   // create thread uses cgc thread type for now. We should revisit
   // the option, or create new thread type.
   _has_error = !os::create_thread(this, os::cgc_thread);
-  set_name("MemTrackWorker", 0);
+  set_name("MemTrackWorker");
 
   // initial generation circuit buffer
   if (!has_error()) {
--- a/hotspot/src/share/vm/services/memoryService.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/memoryService.cpp	Mon May 12 17:01:57 2014 -0700
@@ -123,12 +123,12 @@
 void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) {
   CollectorPolicy* policy = heap->collector_policy();
 
-  assert(policy->is_two_generation_policy(), "Only support two generations");
+  assert(policy->is_generation_policy(), "Only support two generations");
   guarantee(heap->n_gens() == 2, "Only support two-generation heap");
 
-  TwoGenerationCollectorPolicy* two_gen_policy = policy->as_two_generation_policy();
-  if (two_gen_policy != NULL) {
-    GenerationSpec** specs = two_gen_policy->generations();
+  GenCollectorPolicy* gen_policy = policy->as_generation_policy();
+  if (gen_policy != NULL) {
+    GenerationSpec** specs = gen_policy->generations();
     Generation::Name kind = specs[0]->name();
     switch (kind) {
       case Generation::DefNew:
--- a/hotspot/src/share/vm/services/nmtDCmd.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/nmtDCmd.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,7 @@
   // native memory tracking has to be on
   if (!MemTracker::is_on() || MemTracker::shutdown_in_progress()) {
     // if it is not on, what's the reason?
-    output()->print_cr(MemTracker::reason());
+    output()->print_cr("%s", MemTracker::reason());
     return;
   }
 
--- a/hotspot/src/share/vm/services/threadService.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/services/threadService.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,8 @@
 #include "runtime/vm_operations.hpp"
 #include "services/threadService.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // TODO: we need to define a naming convention for perf counters
 // to distinguish counters for:
 //   - standard JSR174 use
--- a/hotspot/src/share/vm/trace/traceStream.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/trace/traceStream.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,7 +113,7 @@
   }
 
   void print(const char* val) {
-    _st.print(val);
+    _st.print("%s", val);
   }
 };
 
--- a/hotspot/src/share/vm/utilities/array.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/array.hpp	Mon May 12 17:01:57 2014 -0700
@@ -376,7 +376,7 @@
 
   // FIXME: How to handle this?
   void print_value_on(outputStream* st) const {
-    st->print("Array<T>(" INTPTR_FORMAT ")", this);
+    st->print("Array<T>(" INTPTR_FORMAT ")", p2i(this));
   }
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/utilities/bitMap.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/bitMap.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -522,13 +522,13 @@
 
 void BitMap::print_on_error(outputStream* st, const char* prefix) const {
   st->print_cr("%s[" PTR_FORMAT ", " PTR_FORMAT ")",
-      prefix, map(), (char*)map() + (size() >> LogBitsPerByte));
+      prefix, p2i(map()), p2i((char*)map() + (size() >> LogBitsPerByte)));
 }
 
 #ifndef PRODUCT
 
 void BitMap::print_on(outputStream* st) const {
-  tty->print("Bitmap(%d):", size());
+  tty->print("Bitmap(" SIZE_FORMAT "):", size());
   for (idx_t index = 0; index < size(); index++) {
     tty->print("%c", at(index) ? '1' : '0');
   }
--- a/hotspot/src/share/vm/utilities/constantTag.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/constantTag.cpp	Mon May 12 17:01:57 2014 -0700
@@ -28,7 +28,7 @@
 #ifndef PRODUCT
 
 void constantTag::print_on(outputStream* st) const {
-  st->print(internal_name());
+  st->print("%s", internal_name());
 }
 
 #endif // PRODUCT
--- a/hotspot/src/share/vm/utilities/debug.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,8 @@
 #  endif
 #endif // PRODUCT
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 FormatBufferResource::FormatBufferResource(const char * format, ...)
   : FormatBufferBase((char*)resource_allocate_bytes(RES_BUFSZ)) {
   va_list argp;
@@ -96,6 +98,7 @@
   va_end(argp);
 }
 
+ATTRIBUTE_PRINTF(1, 2)
 void warning(const char* format, ...) {
   if (PrintWarnings) {
     FILE* const err = defaultStream::error_stream();
--- a/hotspot/src/share/vm/utilities/debug.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/debug.hpp	Mon May 12 17:01:57 2014 -0700
@@ -43,17 +43,17 @@
 #define RES_BUFSZ 256
 class FormatBufferResource : public FormatBufferBase {
  public:
-  FormatBufferResource(const char * format, ...);
+  FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
 };
 
 // Use stack for buffer
 template <size_t bufsz = 256>
 class FormatBuffer : public FormatBufferBase {
  public:
-  inline FormatBuffer(const char * format, ...);
-  inline void append(const char* format, ...);
-  inline void print(const char* format, ...);
-  inline void printv(const char* format, va_list ap);
+  inline FormatBuffer(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
+  inline void append(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3);
+  inline void print(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3);
+  inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
 
   char* buffer() { return _buf; }
   int size() { return bufsz; }
@@ -223,7 +223,7 @@
 void report_unimplemented(const char* file, int line);
 void report_untested(const char* file, int line, const char* message);
 
-void warning(const char* format, ...);
+void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
 
 #ifdef ASSERT
 // Compile-time asserts.
--- a/hotspot/src/share/vm/utilities/events.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/events.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,7 @@
     va_start(ap, format);
     // Save a copy of begin message and log it.
     _buffer.printv(format, ap);
-    Events::log(NULL, _buffer);
+    Events::log(NULL, "%s", _buffer.buffer());
     va_end(ap);
   }
 }
@@ -91,6 +91,6 @@
   if (LogEvents) {
     // Append " done" to the begin message and log it
     _buffer.append(" done");
-    Events::log(NULL, _buffer);
+    Events::log(NULL, "%s", _buffer.buffer());
   }
 }
--- a/hotspot/src/share/vm/utilities/events.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/events.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,7 @@
   void print(outputStream* out, EventRecord<T>& e) {
     out->print("Event: %.3f ", e.timestamp);
     if (e.thread != NULL) {
-      out->print("Thread " INTPTR_FORMAT " ", e.thread);
+      out->print("Thread " INTPTR_FORMAT " ", p2i(e.thread));
     }
     print(out, e.data);
   }
@@ -148,7 +148,7 @@
  public:
   StringEventLog(const char* name, int count = LogEventsBufferEntries) : EventLogBase<StringLogMessage>(name, count) {}
 
-  void logv(Thread* thread, const char* format, va_list ap) {
+  void logv(Thread* thread, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0) {
     if (!should_log()) return;
 
     double timestamp = fetch_timestamp();
@@ -159,7 +159,7 @@
     _records[index].data.printv(format, ap);
   }
 
-  void log(Thread* thread, const char* format, ...) {
+  void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(3, 4) {
     va_list ap;
     va_start(ap, format);
     logv(thread, format, ap);
@@ -193,18 +193,17 @@
   static void print();
 
   // Logs a generic message with timestamp and format as printf.
-  static void log(Thread* thread, const char* format, ...);
+  static void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
   // Log exception related message
-  static void log_exception(Thread* thread, const char* format, ...);
+  static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
-  static void log_deopt_message(Thread* thread, const char* format, ...);
+  static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
   // Register default loggers
   static void init();
 };
 
-
 inline void Events::log(Thread* thread, const char* format, ...) {
   if (LogEvents) {
     va_list ap;
@@ -283,7 +282,7 @@
 
  public:
   // log a begin event, format as printf
-  EventMark(const char* format, ...);
+  EventMark(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   // log an end event
   ~EventMark();
 };
--- a/hotspot/src/share/vm/utilities/exceptions.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +35,7 @@
 #include "utilities/events.hpp"
 #include "utilities/exceptions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Implementation of ThreadShadow
 void check_ThreadShadow() {
@@ -237,6 +238,7 @@
   _throw_msg(thread, file, line, h_name, msg);
 }
 
+
 // Creates an exception oop, calls the <init> method with the given signature.
 // and returns a Handle
 Handle Exceptions::new_exception(Thread *thread, Symbol* name,
--- a/hotspot/src/share/vm/utilities/exceptions.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp	Mon May 12 17:01:57 2014 -0700
@@ -132,7 +132,7 @@
   // There is no THROW... macro for this method. Caller should remember
   // to do a return after calling it.
   static void fthrow(Thread* thread, const char* file, int line, Symbol* name,
-                     const char* format, ...);
+                     const char* format, ...) ATTRIBUTE_PRINTF(5, 6);
 
   // Create and initialize a new exception
   static Handle new_exception(Thread* thread, Symbol* name,
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,32 @@
 # include "utilities/globalDefinitions_xlc.hpp"
 #endif
 
+#ifndef PRAGMA_DIAG_PUSH
+#define PRAGMA_DIAG_PUSH
+#endif
+#ifndef PRAGMA_DIAG_POP
+#define PRAGMA_DIAG_POP
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED
+#endif
+#ifndef PRAGMA_FORMAT_IGNORED
+#define PRAGMA_FORMAT_IGNORED
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
+#endif
+#ifndef PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+#endif
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(fmt, vargs)
+#endif
+
+
 #include "utilities/macros.hpp"
 
 // This file holds all globally used constants & types, class (forward)
@@ -1284,6 +1310,11 @@
   return ((int)((unsigned int)high << 16) | (unsigned int)low);
 }
 
+// Convert pointer to intptr_t, for use in printing pointers.
+inline intptr_t p2i(const void * p) {
+  return (intptr_t) p;
+}
+
 // Printf-style formatters for fixed- and variable-width types as pointers and
 // integers.  These are derived from the definitions in inttypes.h.  If the platform
 // doesn't provide appropriate definitions, they should be provided in
@@ -1302,6 +1333,7 @@
 // Format 64-bit quantities.
 #define INT64_FORMAT           "%" PRId64
 #define UINT64_FORMAT          "%" PRIu64
+#define UINT64_FORMAT_X        "%" PRIx64
 #define INT64_FORMAT_W(width)  "%" #width PRId64
 #define UINT64_FORMAT_W(width) "%" #width PRIu64
 
@@ -1324,6 +1356,8 @@
 #define PTR_FORMAT    "0x%08"  PRIxPTR
 #endif  // _LP64
 
+#define INTPTR_FORMAT_W(width)   "%" #width PRIxPTR
+
 #define SSIZE_FORMAT             "%"   PRIdPTR
 #define SIZE_FORMAT              "%"   PRIuPTR
 #define SIZE_FORMAT_HEX          "0x%" PRIxPTR
@@ -1355,7 +1389,6 @@
   return *(void**)addr;
 }
 
-
 #ifndef PRODUCT
 
 // For unit testing only
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -282,6 +282,35 @@
 #define PRAGMA_IMPLEMENTATION        #pragma implementation
 #define VALUE_OBJ_CLASS_SPEC
 
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(fmt,vargs)  __attribute__((format(printf, fmt, vargs)))
+#endif
+
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic ignored \"-Wformat-security\"")
+#define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"")
+
+#if defined(__clang_major__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 1)) || (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6)
+// Tested to work with clang version 3.1 and better.
+#define PRAGMA_DIAG_PUSH             _Pragma("GCC diagnostic push")
+#define PRAGMA_DIAG_POP              _Pragma("GCC diagnostic pop")
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED
+
+// Hack to deal with gcc yammering about non-security format stuff
+#else
+// Old versions of gcc don't do push/pop, also do not cope with this pragma within a function
+// One method does so much varied printing that it is decorated with both internal and external
+// versions of the macro-pragma to obtain better checking with newer compilers.
+#define PRAGMA_DIAG_PUSH
+#define PRAGMA_DIAG_POP
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
+#endif
+
+#ifndef __clang_major__
+#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC _Pragma("GCC diagnostic ignored \"-Wformat\"") _Pragma("GCC diagnostic error \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic error \"-Wformat-security\"")
+#endif
+
 #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
 #define TEMPLATE_TABLE_BUG
 #endif
--- a/hotspot/src/share/vm/utilities/numberSeq.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/numberSeq.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,5 +258,5 @@
     }
     s->print("\t[%d]=%7.3f", i, _sequence[i]);
   }
-  s->print_cr("");
+  s->cr();
 }
--- a/hotspot/src/share/vm/utilities/ostream.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/ostream.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -268,7 +268,7 @@
   size_t limit = (len + 16) / 16 * 16;
   for (size_t i = 0; i < limit; ++i) {
     if (i % 16 == 0) {
-      indent().print("%07x:", i);
+      indent().print(INTPTR_FORMAT_W(07)":", i);
     }
     if (i % 2 == 0) {
       print(" ");
@@ -289,7 +289,7 @@
           }
         }
       }
-      print_cr("");
+      cr();
     }
   }
 }
@@ -606,7 +606,7 @@
 // memory usage and command line flags into header
 void gcLogFileStream::dump_loggc_header() {
   if (is_open()) {
-    print_cr(Abstract_VM_Version::internal_vm_info_string());
+    print_cr("%s", Abstract_VM_Version::internal_vm_info_string());
     os::print_memory_info(this);
     print("CommandLine flags: ");
     CommandLineFlags::printSetFlags(this);
@@ -687,7 +687,7 @@
     write(time_msg, strlen(time_msg));
 
     if (out != NULL) {
-      out->print(time_msg);
+      out->print("%s", time_msg);
     }
 
     dump_loggc_header();
@@ -720,7 +720,7 @@
     write(time_msg, strlen(time_msg));
 
     if (out != NULL) {
-      out->print(time_msg);
+      out->print("%s", time_msg);
     }
 
     fclose(_file);
@@ -765,7 +765,7 @@
     write(time_msg, strlen(time_msg));
 
     if (out != NULL) {
-      out->print(time_msg);
+      out->print("%s", time_msg);
     }
 
     dump_loggc_header();
@@ -845,7 +845,7 @@
     xs->head("hotspot_log version='%d %d'"
              " process='%d' time_ms='"INT64_FORMAT"'",
              LOG_MAJOR_VERSION, LOG_MINOR_VERSION,
-             os::current_process_id(), time_ms);
+             os::current_process_id(), (int64_t)time_ms);
     // Write VM version header immediately.
     xs->head("vm_version");
     xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr();
--- a/hotspot/src/share/vm/utilities/ostream.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/ostream.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
    static const char* do_vsnprintf(char* buffer, size_t buflen,
                                    const char* format, va_list ap,
                                    bool add_cr,
-                                   size_t& result_len);
+                                   size_t& result_len)  ATTRIBUTE_PRINTF(3, 0);
 
  public:
    // creation
@@ -80,10 +80,10 @@
    void set_position(int pos)   { _position = pos; }
 
    // printing
-   void print(const char* format, ...);
-   void print_cr(const char* format, ...);
-   void vprint(const char *format, va_list argptr);
-   void vprint_cr(const char* format, va_list argptr);
+   void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+   void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+   void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
+   void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
    void print_raw(const char* str)            { write(str, strlen(str)); }
    void print_raw(const char* str, int len)   { write(str,         len); }
    void print_raw_cr(const char* str)         { write(str, strlen(str)); cr(); }
@@ -274,10 +274,10 @@
   ~staticBufferStream() {};
   virtual void write(const char* c, size_t len);
   void flush();
-  void print(const char* format, ...);
-  void print_cr(const char* format, ...);
-  void vprint(const char *format, va_list argptr);
-  void vprint_cr(const char* format, va_list argptr);
+  void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
+  void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
 };
 
 // In the non-fixed buffer case an underlying buffer will be created and
--- a/hotspot/src/share/vm/utilities/quickSort.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/quickSort.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
   for (int i = 0; i < length; i++) {
     tty->print(" %d", array[i]);
   }
-  tty->print_cr("");
+  tty->cr();
 }
 
 bool QuickSort::compare_arrays(int* actual, int* expected, int length) {
--- a/hotspot/src/share/vm/utilities/taskqueue.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/taskqueue.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +30,8 @@
 #include "utilities/stack.inline.hpp"
 #include "utilities/taskqueue.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef TRACESPINNING
 uint ParallelTaskTerminator::_total_yields = 0;
 uint ParallelTaskTerminator::_total_spins = 0;
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 #include "utilities/top.hpp"
 #include "utilities/vmError.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // List of environment variables that should be reported in error log file.
 const char *env_list[] = {
   // All platforms
@@ -358,17 +360,17 @@
            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("%s", buf);
            st->print(" bytes");
            if (_message != NULL) {
              st->print(" for ");
-             st->print(_message);
+             st->print("%s", _message);
            }
            st->cr();
          } else {
            if (_message != NULL)
              st->print("# ");
-             st->print_cr(_message);
+             st->print_cr("%s", _message);
          }
          // In error file give some solutions
          if (_verbose) {
@@ -485,7 +487,7 @@
     } else {
       st->print("Failed to write core dump. %s", coredump_message);
     }
-    st->print_cr("");
+    st->cr();
     st->print_cr("#");
 
   STEP(65, "(printing bug submit message)")
--- a/hotspot/src/share/vm/utilities/workgroup.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #include "runtime/os.hpp"
 #include "utilities/workgroup.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Definitions of WorkGang methods.
 
 AbstractWorkGang::AbstractWorkGang(const char* name,
--- a/hotspot/src/share/vm/utilities/xmlstream.cpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/xmlstream.cpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,6 +336,8 @@
   print_raw_cr(">");
 }
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
 // ------------------------------------------------------------------
 void xmlStream::va_done(const char* format, va_list ap) {
   char buffer[200];
@@ -354,6 +356,7 @@
   buffer[kind_len] = 0;
   tail(buffer);
 }
+PRAGMA_DIAG_POP
 
 // Output a timestamp attribute.
 void xmlStream::stamp() {
@@ -399,7 +402,7 @@
   ResourceMark rm;
   assert_if_no_error(inside_attrs(), "printing attributes");
   if (method.is_null())  return;
-  text()->print(method->method_holder()->external_name());
+  text()->print("%s", method->method_holder()->external_name());
   print_raw(" ");  // " " is easier for tools to parse than "::"
   method->name()->print_symbol_on(text());
   print_raw(" ");  // separator
--- a/hotspot/src/share/vm/utilities/xmlstream.hpp	Fri May 09 09:12:39 2014 +0200
+++ b/hotspot/src/share/vm/utilities/xmlstream.hpp	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@
   outputStream* out()                            { return _out; }
 
   // helpers for writing XML elements
-  void          va_tag(bool push, const char* format, va_list ap);
+  void          va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);
   virtual void see_tag(const char* tag, bool push) NOT_DEBUG({});
   virtual void pop_tag(const char* tag) NOT_DEBUG({});
 
@@ -109,29 +109,29 @@
   int unflushed_count() { return (int)(out()->count() - _last_flush); }
 
   // writing complete XML elements
-  void          elem(const char* format, ...);
-  void    begin_elem(const char* format, ...);
-  void      end_elem(const char* format, ...);
+  void          elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void    begin_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void      end_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   void      end_elem();
-  void          head(const char* format, ...);
-  void    begin_head(const char* format, ...);
-  void      end_head(const char* format, ...);
+  void          head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void    begin_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void      end_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   void      end_head();
-  void          done(const char* format, ...);  // xxx_done event, plus tail
+  void          done(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);  // xxx_done event, plus tail
   void          done_raw(const char * kind);
   void          tail(const char* kind);
 
   // va_list versions
-  void       va_elem(const char* format, va_list ap);
-  void va_begin_elem(const char* format, va_list ap);
-  void       va_head(const char* format, va_list ap);
-  void va_begin_head(const char* format, va_list ap);
-  void       va_done(const char* format, va_list ap);
+  void       va_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void va_begin_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void       va_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void va_begin_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void       va_done(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
 
   // write text (with quoting of special XML characters <>&'" etc.)
   outputStream* text() { return _text; }
-  void          text(const char* format, ...);
-  void       va_text(const char* format, va_list ap) {
+  void          text(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void       va_text(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) {
     text()->vprint(format, ap);
   }
 
--- a/jaxp/.hgtags	Fri May 09 09:12:39 2014 +0200
+++ b/jaxp/.hgtags	Mon May 12 17:01:57 2014 -0700
@@ -254,3 +254,4 @@
 f93a792fe37279d4d37aea86a99f3abbdc6fe79b jdk9-b09
 4ce98701efe3b28f6ce3ab23385445731e968af7 jdk9-b10
 6b4280dceb00642f54d5bc1c2cb7d34c99a04992 jdk9-b11
+e88cecf5a21b760ff7d7761c2db6bb8c82bc9f0c jdk9-b12
--- a/jaxws/.hgtags	Fri May 09 09:12:39 2014 +0200
+++ b/jaxws/.hgtags	Mon May 12 17:01:57 2014 -0700
@@ -257,3 +257,4 @@
 c9e8bb8c1144a966ca7b481142c6b5e55d14a29c jdk9-b09
 9af43f4d215f6f19b1767f6ac66da931b8ee9535 jdk9-b10
 1f953ba7db2b535e19f0354abfee6d67605e0684 jdk9-b11
+779f8b21c75f83e3918dac8499e4d0ecb3a54ed7 jdk9-b12
--- a/jdk/.hgtags	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/.hgtags	Mon May 12 17:01:57 2014 -0700
@@ -254,3 +254,4 @@
 2cef452ba711b17950da275fd15931925799f07c jdk9-b09
 ab06ba2894313a47e4969ca37792ff119c49e711 jdk9-b10
 47feccd164b7187a0147693a922ee47c6629643c jdk9-b11
+83d9bc20973de232cae45b139fdff8a4549c130f jdk9-b12
--- a/jdk/make/CompileJavaClasses.gmk	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/make/CompileJavaClasses.gmk	Mon May 12 17:01:57 2014 -0700
@@ -84,8 +84,6 @@
       SolarisUserDefinedFileAttributeView.java \
       SolarisWatchService.java \
       SolarisAclFileAttributeView.java \
-      SolarisLoginModule.java \
-      SolarisSystem.java \
       sun/nio/ch/DevPollArrayWrapper.java \
       sun/nio/ch/DevPollSelectorImpl.java \
       sun/nio/ch/DevPollSelectorProvider.java \
@@ -100,15 +98,6 @@
   EXCLUDES += com/oracle/security
 endif
 
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  # Exclude Window security related files in src/share/classes
-  EXFILES += NTLoginModule.java \
-      NTSystem.java
-else
-  EXFILES += UnixLoginModule.java \
-      UnixSystem.java
-endif
-
 ifeq ($(OPENJDK_TARGET_OS), windows)
   # Don't build GTK L&F on Windows
   EXCLUDES += com/sun/java/swing/plaf/gtk
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Mon May 12 17:01:57 2014 -0700
@@ -273,7 +273,8 @@
                 Java_sun_misc_VM_isSetUID;
                 Java_sun_misc_VM_initialize;
 		Java_sun_misc_VMSupport_initAgentProperties;
-
+		Java_sun_misc_VMSupport_getVMTemporaryDirectory;
+		
                 # ZipFile.c needs this one
 		throwFileNotFoundException;
 
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java	Mon May 12 17:01:57 2014 -0700
@@ -87,6 +87,10 @@
             new Algorithm("", "SHA1withDSA", "Signature")
         );
         algorithmsMap.put(
+            XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256,
+            new Algorithm("", "SHA256withDSA", "Signature")
+        );
+        algorithmsMap.put(
             XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
             new Algorithm("", "MD5withRSA", "Signature")
         );
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java	Mon May 12 17:01:57 2014 -0700
@@ -380,7 +380,12 @@
      * This method registers the default algorithms.
      */
     public static void registerDefaultAlgorithms() {
-        algorithmHash.put(SignatureDSA.URI, SignatureDSA.class);
+        algorithmHash.put(
+            XMLSignature.ALGO_ID_SIGNATURE_DSA, SignatureDSA.class
+        );
+        algorithmHash.put(
+            XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256, SignatureDSA.SHA256.class
+        );
         algorithmHash.put(
             XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1, SignatureBaseRSA.SignatureRSASHA1.class
         );
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java	Mon May 12 17:01:57 2014 -0700
@@ -31,13 +31,15 @@
 import java.security.SecureRandom;
 import java.security.Signature;
 import java.security.SignatureException;
+import java.security.interfaces.DSAKey;
 import java.security.spec.AlgorithmParameterSpec;
 
 import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
 import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithmSpi;
+import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
 import com.sun.org.apache.xml.internal.security.utils.Base64;
-import com.sun.org.apache.xml.internal.security.utils.Constants;
+import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
 
 public class SignatureDSA extends SignatureAlgorithmSpi {
 
@@ -45,19 +47,19 @@
     private static java.util.logging.Logger log =
         java.util.logging.Logger.getLogger(SignatureDSA.class.getName());
 
-    /** Field URI */
-    public static final String URI = Constants.SignatureSpecNS + "dsa-sha1";
-
     /** Field algorithm */
     private java.security.Signature signatureAlgorithm = null;
 
+    /** size of Q */
+    private int size;
+
     /**
      * Method engineGetURI
      *
      * @inheritDoc
      */
     protected String engineGetURI() {
-        return SignatureDSA.URI;
+        return XMLSignature.ALGO_ID_SIGNATURE_DSA;
     }
 
     /**
@@ -66,7 +68,7 @@
      * @throws XMLSignatureException
      */
     public SignatureDSA() throws XMLSignatureException {
-        String algorithmID = JCEMapper.translateURItoJCEID(SignatureDSA.URI);
+        String algorithmID = JCEMapper.translateURItoJCEID(engineGetURI());
         if (log.isLoggable(java.util.logging.Level.FINE)) {
             log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
         }
@@ -110,7 +112,8 @@
                 log.log(java.util.logging.Level.FINE, "Called DSA.verify() on " + Base64.encode(signature));
             }
 
-            byte[] jcebytes = SignatureDSA.convertXMLDSIGtoASN1(signature);
+            byte[] jcebytes = JavaUtils.convertDsaXMLDSIGtoASN1(signature,
+                                                                size/8);
 
             return this.signatureAlgorithm.verify(jcebytes);
         } catch (SignatureException ex) {
@@ -150,6 +153,7 @@
             }
             throw new XMLSignatureException("empty", ex);
         }
+        size = ((DSAKey)publicKey).getParams().getQ().bitLength();
     }
 
     /**
@@ -159,7 +163,7 @@
         try {
             byte jcebytes[] = this.signatureAlgorithm.sign();
 
-            return SignatureDSA.convertASN1toXMLDSIG(jcebytes);
+            return JavaUtils.convertDsaASN1toXMLDSIG(jcebytes, size/8);
         } catch (IOException ex) {
             throw new XMLSignatureException("empty", ex);
         } catch (SignatureException ex) {
@@ -185,6 +189,7 @@
         } catch (InvalidKeyException ex) {
             throw new XMLSignatureException("empty", ex);
         }
+        size = ((DSAKey)privateKey).getParams().getQ().bitLength();
     }
 
     /**
@@ -204,6 +209,7 @@
         } catch (InvalidKeyException ex) {
             throw new XMLSignatureException("empty", ex);
         }
+        size = ((DSAKey)privateKey).getParams().getQ().bitLength();
     }
 
     /**
@@ -258,100 +264,6 @@
     }
 
     /**
-     * Converts an ASN.1 DSA value to a XML Signature DSA Value.
-     *
-     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
-     * pairs; the XML Signature requires the core BigInteger values.
-     *
-     * @param asn1Bytes
-     * @return the decode bytes
-     *
-     * @throws IOException
-     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
-     */
-    private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[]) throws IOException {
-
-        byte rLength = asn1Bytes[3];
-        int i;
-
-        for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
-
-        byte sLength = asn1Bytes[5 + rLength];
-        int j;
-
-        for (j = sLength;
-            (j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
-
-        if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
-            || (asn1Bytes[2] != 2) || (i > 20)
-            || (asn1Bytes[4 + rLength] != 2) || (j > 20)) {
-            throw new IOException("Invalid ASN.1 format of DSA signature");
-        }
-        byte xmldsigBytes[] = new byte[40];
-
-        System.arraycopy(asn1Bytes, (4 + rLength) - i, xmldsigBytes, 20 - i, i);
-        System.arraycopy(asn1Bytes, (6 + rLength + sLength) - j, xmldsigBytes,
-                         40 - j, j);
-
-        return xmldsigBytes;
-    }
-
-    /**
-     * Converts a XML Signature DSA Value to an ASN.1 DSA value.
-     *
-     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
-     * pairs; the XML Signature requires the core BigInteger values.
-     *
-     * @param xmldsigBytes
-     * @return the encoded ASN.1 bytes
-     *
-     * @throws IOException
-     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
-     */
-    private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[]) throws IOException {
-
-        if (xmldsigBytes.length != 40) {
-            throw new IOException("Invalid XMLDSIG format of DSA signature");
-        }
-
-        int i;
-
-        for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
-
-        int j = i;
-
-        if (xmldsigBytes[20 - i] < 0) {
-            j += 1;
-        }
-
-        int k;
-
-        for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
-
-        int l = k;
-
-        if (xmldsigBytes[40 - k] < 0) {
-            l += 1;
-        }
-
-        byte asn1Bytes[] = new byte[6 + j + l];
-
-        asn1Bytes[0] = 48;
-        asn1Bytes[1] = (byte) (4 + j + l);
-        asn1Bytes[2] = 2;
-        asn1Bytes[3] = (byte) j;
-
-        System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
-
-        asn1Bytes[4 + j] = 2;
-        asn1Bytes[5 + j] = (byte) l;
-
-        System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
-
-        return asn1Bytes;
-    }
-
-    /**
      * Method engineSetHMACOutputLength
      *
      * @param HMACOutputLength
@@ -373,4 +285,15 @@
     ) throws XMLSignatureException {
         throw new XMLSignatureException("algorithms.CannotUseAlgorithmParameterSpecOnDSA");
     }
+
+    public static class SHA256 extends SignatureDSA {
+
+        public SHA256() throws XMLSignatureException {
+            super();
+        }
+
+        public String engineGetURI() {
+            return XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256;
+        }
+    }
 }
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Mon May 12 17:01:57 2014 -0700
@@ -85,6 +85,10 @@
     public static final String ALGO_ID_SIGNATURE_DSA =
         Constants.SignatureSpecNS + "dsa-sha1";
 
+    /** Signature - Optional DSAwithSHA256 */
+    public static final String ALGO_ID_SIGNATURE_DSA_SHA256 =
+        Constants.SignatureSpec11NS + "dsa-sha256";
+
     /** Signature - Recommended RSAwithSHA1 */
     public static final String ALGO_ID_SIGNATURE_RSA =
         Constants.SignatureSpecNS + "rsa-sha1";
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java	Mon May 12 17:01:57 2014 -0700
@@ -145,4 +145,98 @@
 
         return retBytes;
     }
+
+    /**
+     * Converts an ASN.1 DSA value to a XML Signature DSA Value.
+     *
+     * The JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
+     * pairs (see section 2.2.2 of RFC 3279); the XML Signature requires the
+     * core BigInteger values.
+     *
+     * @param asn1Bytes the ASN.1 encoded bytes
+     * @param size size of r and s in bytes
+     * @return the XML Signature encoded bytes
+     * @throws IOException if the bytes are not encoded correctly
+     * @see <A HREF="http://www.w3.org/TR/xmldsig-core1/#sec-DSA">6.4.1 DSA</A>
+     */
+    public static byte[] convertDsaASN1toXMLDSIG(byte[] asn1Bytes, int size)
+        throws IOException
+    {
+        if (asn1Bytes[0] != 48 || asn1Bytes[1] != asn1Bytes.length - 2
+            || asn1Bytes[2] != 2) {
+            throw new IOException("Invalid ASN.1 format of DSA signature");
+        }
+
+        byte rLength = asn1Bytes[3];
+        int i;
+        for (i = rLength; i > 0 && asn1Bytes[4 + rLength - i] == 0; i--);
+
+        byte sLength = asn1Bytes[5 + rLength];
+        int j;
+        for (j = sLength;
+             j > 0 && asn1Bytes[6 + rLength + sLength - j] == 0; j--);
+
+        if (i > size || asn1Bytes[4 + rLength] != 2 || j > size) {
+            throw new IOException("Invalid ASN.1 format of DSA signature");
+        } else {
+            byte[] xmldsigBytes = new byte[size * 2];
+            System.arraycopy(asn1Bytes, 4 + rLength - i, xmldsigBytes,
+                             size - i, i);
+            System.arraycopy(asn1Bytes, 6 + rLength + sLength - j,
+                             xmldsigBytes, size * 2 - j, j);
+            return xmldsigBytes;
+        }
+    }
+
+    /**
+     * Converts an XML Signature DSA Value to a ASN.1 DSA value.
+     *
+     * The JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
+     * pairs (see section 2.2.2 of RFC 3279); the XML Signature requires the
+     * core BigInteger values.
+     *
+     * @param xmldsigBytes the XML Signature encoded bytes
+     * @param size size of r and s in bytes
+     * @return the ASN.1 encoded bytes
+     * @throws IOException if the bytes are not encoded correctly
+     * @see <A HREF="http://www.w3.org/TR/xmldsig-core1/#sec-DSA">6.4.1 DSA</A>
+     */
+    public static byte[] convertDsaXMLDSIGtoASN1(byte[] xmldsigBytes, int size)
+        throws IOException
+    {
+        int totalSize = size * 2;
+        if (xmldsigBytes.length != totalSize) {
+            throw new IOException("Invalid XMLDSIG format of DSA signature");
+        }
+
+        int i;
+        for (i = size; i > 0 && xmldsigBytes[size - i] == 0; i--);
+
+        int j = i;
+        if (xmldsigBytes[size - i] < 0) {
+            j++;
+        }
+
+        int k;
+        for (k = size; k > 0 && xmldsigBytes[totalSize - k] == 0; k--);
+
+        int l = k;
+        if (xmldsigBytes[totalSize - k] < 0) {
+            l++;
+        }
+
+        byte[] asn1Bytes = new byte[6 + j + l];
+        asn1Bytes[0] = 48;
+        asn1Bytes[1] = (byte)(4 + j + l);
+        asn1Bytes[2] = 2;
+        asn1Bytes[3] = (byte)j;
+        System.arraycopy(xmldsigBytes, size - i, asn1Bytes, 4 + j - i, i);
+
+        asn1Bytes[4 + j] = 2;
+        asn1Bytes[5 + j] = (byte) l;
+        System.arraycopy(xmldsigBytes, totalSize - k, asn1Bytes,
+                         6 + j + l - k, k);
+
+        return asn1Bytes;
+    }
 }
--- a/jdk/src/share/classes/com/sun/security/auth/module/NTLoginModule.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/auth/module/NTLoginModule.java	Mon May 12 17:01:57 2014 -0700
@@ -139,15 +139,17 @@
 
         succeeded = false; // Indicate not yet successful
 
-        ntSystem = new NTSystem(debugNative);
-        if (ntSystem == null) {
+        try {
+            ntSystem = new NTSystem(debugNative);
+        } catch (UnsatisfiedLinkError ule) {
             if (debug) {
                 System.out.println("\t\t[NTLoginModule] " +
                                    "Failed in NT login");
             }
             throw new FailedLoginException
                 ("Failed in attempt to import the " +
-                 "underlying NT system identity information");
+                 "underlying NT system identity information" +
+                 " on " + System.getProperty("os.name"));
         }
 
         if (ntSystem.getName() == null) {
--- a/jdk/src/share/classes/com/sun/security/auth/module/SolarisLoginModule.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/auth/module/SolarisLoginModule.java	Mon May 12 17:01:57 2014 -0700
@@ -129,39 +129,39 @@
 
         long[] solarisGroups = null;
 
-        ss = new SolarisSystem();
-
-        if (ss == null) {
+        try {
+            ss = new SolarisSystem();
+        } catch (UnsatisfiedLinkError ule) {
             succeeded = false;
             throw new FailedLoginException
                                 ("Failed in attempt to import " +
-                                "the underlying system identity information");
-        } else {
-            userPrincipal = new SolarisPrincipal(ss.getUsername());
-            UIDPrincipal = new SolarisNumericUserPrincipal(ss.getUid());
-            GIDPrincipal = new SolarisNumericGroupPrincipal(ss.getGid(), true);
-            if (ss.getGroups() != null && ss.getGroups().length > 0)
-                solarisGroups = ss.getGroups();
-                for (int i = 0; i < solarisGroups.length; i++) {
-                    SolarisNumericGroupPrincipal ngp =
-                        new SolarisNumericGroupPrincipal
-                        (solarisGroups[i], false);
-                    if (!ngp.getName().equals(GIDPrincipal.getName()))
-                        supplementaryGroups.add(ngp);
-                }
-            if (debug) {
-                System.out.println("\t\t[SolarisLoginModule]: " +
-                        "succeeded importing info: ");
-                System.out.println("\t\t\tuid = " + ss.getUid());
-                System.out.println("\t\t\tgid = " + ss.getGid());
-                solarisGroups = ss.getGroups();
-                for (int i = 0; i < solarisGroups.length; i++) {
-                    System.out.println("\t\t\tsupp gid = " + solarisGroups[i]);
-                }
+                                "the underlying system identity information" +
+                                " on " + System.getProperty("os.name"));
+        }
+        userPrincipal = new SolarisPrincipal(ss.getUsername());
+        UIDPrincipal = new SolarisNumericUserPrincipal(ss.getUid());
+        GIDPrincipal = new SolarisNumericGroupPrincipal(ss.getGid(), true);
+        if (ss.getGroups() != null && ss.getGroups().length > 0)
+            solarisGroups = ss.getGroups();
+            for (int i = 0; i < solarisGroups.length; i++) {
+                SolarisNumericGroupPrincipal ngp =
+                    new SolarisNumericGroupPrincipal
+                    (solarisGroups[i], false);
+                if (!ngp.getName().equals(GIDPrincipal.getName()))
+                    supplementaryGroups.add(ngp);
             }
-            succeeded = true;
-            return true;
+        if (debug) {
+            System.out.println("\t\t[SolarisLoginModule]: " +
+                    "succeeded importing info: ");
+            System.out.println("\t\t\tuid = " + ss.getUid());
+            System.out.println("\t\t\tgid = " + ss.getGid());
+            solarisGroups = ss.getGroups();
+            for (int i = 0; i < solarisGroups.length; i++) {
+                System.out.println("\t\t\tsupp gid = " + solarisGroups[i]);
+            }
         }
+        succeeded = true;
+        return true;
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/security/auth/module/SolarisSystem.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/auth/module/SolarisSystem.java	Mon May 12 17:01:57 2014 -0700
@@ -29,8 +29,10 @@
  * <p> This class implementation retrieves and makes available Solaris
  * UID/GID/groups information for the current user.
  *
+ * @deprecated replaced by {@link UnixSystem}.
  */
-@jdk.Exported
+@jdk.Exported(false)
+@Deprecated
 public class SolarisSystem {
 
     private native void getSolarisInfo();
--- a/jdk/src/share/classes/com/sun/security/auth/module/UnixLoginModule.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/com/sun/security/auth/module/UnixLoginModule.java	Mon May 12 17:01:57 2014 -0700
@@ -122,40 +122,40 @@
 
         long[] unixGroups = null;
 
-        ss = new UnixSystem();
-
-        if (ss == null) {
+        try {
+            ss = new UnixSystem();
+        } catch (UnsatisfiedLinkError ule) {
             succeeded = false;
             throw new FailedLoginException
                                 ("Failed in attempt to import " +
-                                "the underlying system identity information");
-        } else {
-            userPrincipal = new UnixPrincipal(ss.getUsername());
-            UIDPrincipal = new UnixNumericUserPrincipal(ss.getUid());
-            GIDPrincipal = new UnixNumericGroupPrincipal(ss.getGid(), true);
-            if (ss.getGroups() != null && ss.getGroups().length > 0) {
-                unixGroups = ss.getGroups();
-                for (int i = 0; i < unixGroups.length; i++) {
-                    UnixNumericGroupPrincipal ngp =
-                        new UnixNumericGroupPrincipal
-                        (unixGroups[i], false);
-                    if (!ngp.getName().equals(GIDPrincipal.getName()))
-                        supplementaryGroups.add(ngp);
-                }
+                                "the underlying system identity information" +
+                                " on " + System.getProperty("os.name"));
+        }
+        userPrincipal = new UnixPrincipal(ss.getUsername());
+        UIDPrincipal = new UnixNumericUserPrincipal(ss.getUid());
+        GIDPrincipal = new UnixNumericGroupPrincipal(ss.getGid(), true);
+        if (ss.getGroups() != null && ss.getGroups().length > 0) {
+            unixGroups = ss.getGroups();
+            for (int i = 0; i < unixGroups.length; i++) {
+                UnixNumericGroupPrincipal ngp =
+                    new UnixNumericGroupPrincipal
+                    (unixGroups[i], false);
+                if (!ngp.getName().equals(GIDPrincipal.getName()))
+                    supplementaryGroups.add(ngp);
             }
-            if (debug) {
-                System.out.println("\t\t[UnixLoginModule]: " +
-                        "succeeded importing info: ");
-                System.out.println("\t\t\tuid = " + ss.getUid());
-                System.out.println("\t\t\tgid = " + ss.getGid());
-                unixGroups = ss.getGroups();
-                for (int i = 0; i < unixGroups.length; i++) {
-                    System.out.println("\t\t\tsupp gid = " + unixGroups[i]);
-                }
+        }
+        if (debug) {
+            System.out.println("\t\t[UnixLoginModule]: " +
+                    "succeeded importing info: ");
+            System.out.println("\t\t\tuid = " + ss.getUid());
+            System.out.println("\t\t\tgid = " + ss.getGid());
+            unixGroups = ss.getGroups();
+            for (int i = 0; i < unixGroups.length; i++) {
+                System.out.println("\t\t\tsupp gid = " + unixGroups[i]);
             }
-            succeeded = true;
-            return true;
         }
+        succeeded = true;
+        return true;
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/Math.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/lang/Math.java	Mon May 12 17:01:57 2014 -0700
@@ -1904,51 +1904,36 @@
          * are naturally handled without any additional testing
          */
 
-        // First check for NaN values
-        if (Double.isNaN(start) || Double.isNaN(direction)) {
-            // return a NaN derived from the input NaN(s)
-            return start + direction;
-        } else if (start == direction) {
-            return direction;
-        } else {        // start > direction or start < direction
+        /*
+         * IEEE 754 floating-point numbers are lexicographically
+         * ordered if treated as signed-magnitude integers.
+         * Since Java's integers are two's complement,
+         * incrementing the two's complement representation of a
+         * logically negative floating-point value *decrements*
+         * the signed-magnitude representation. Therefore, when
+         * the integer representation of a floating-point value
+         * is negative, the adjustment to the representation is in
+         * the opposite direction from what would initially be expected.
+         */
+
+        // Branch to descending case first as it is more costly than ascending
+        // case due to start != 0.0d conditional.
+        if (start > direction) { // descending
+            if (start != 0.0d) {
+                final long transducer = Double.doubleToRawLongBits(start);
+                return Double.longBitsToDouble(transducer + ((transducer > 0L) ? -1L : 1L));
+            } else { // start == 0.0d && direction < 0.0d
+                return -Double.MIN_VALUE;
+            }
+        } else if (start < direction) { // ascending
             // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
             // then bitwise convert start to integer.
-            long transducer = Double.doubleToRawLongBits(start + 0.0d);
-
-            /*
-             * IEEE 754 floating-point numbers are lexicographically
-             * ordered if treated as signed- magnitude integers .
-             * Since Java's integers are two's complement,
-             * incrementing" the two's complement representation of a
-             * logically negative floating-point value *decrements*
-             * the signed-magnitude representation. Therefore, when
-             * the integer representation of a floating-point values
-             * is less than zero, the adjustment to the representation
-             * is in the opposite direction than would be expected at
-             * first .
-             */
-            if (direction > start) { // Calculate next greater value
-                transducer = transducer + (transducer >= 0L ? 1L:-1L);
-            } else  { // Calculate next lesser value
-                assert direction < start;
-                if (transducer > 0L)
-                    --transducer;
-                else
-                    if (transducer < 0L )
-                        ++transducer;
-                    /*
-                     * transducer==0, the result is -MIN_VALUE
-                     *
-                     * The transition from zero (implicitly
-                     * positive) to the smallest negative
-                     * signed magnitude value must be done
-                     * explicitly.
-                     */
-                    else
-                        transducer = DoubleConsts.SIGN_BIT_MASK | 1L;
-            }
-
-            return Double.longBitsToDouble(transducer);
+            final long transducer = Double.doubleToRawLongBits(start + 0.0d);
+            return Double.longBitsToDouble(transducer + ((transducer >= 0L) ? 1L : -1L));
+        } else if (start == direction) {
+            return direction;
+        } else { // isNaN(start) || isNaN(direction)
+            return start + direction;
         }
     }
 
@@ -2003,51 +1988,36 @@
          * are naturally handled without any additional testing
          */
 
-        // First check for NaN values
-        if (Float.isNaN(start) || Double.isNaN(direction)) {
-            // return a NaN derived from the input NaN(s)
-            return start + (float)direction;
-        } else if (start == direction) {
-            return (float)direction;
-        } else {        // start > direction or start < direction
+        /*
+         * IEEE 754 floating-point numbers are lexicographically
+         * ordered if treated as signed-magnitude integers.
+         * Since Java's integers are two's complement,
+         * incrementing the two's complement representation of a
+         * logically negative floating-point value *decrements*
+         * the signed-magnitude representation. Therefore, when
+         * the integer representation of a floating-point value
+         * is negative, the adjustment to the representation is in
+         * the opposite direction from what would initially be expected.
+         */
+
+        // Branch to descending case first as it is more costly than ascending
+        // case due to start != 0.0f conditional.
+        if (start > direction) { // descending
+            if (start != 0.0f) {
+                final int transducer = Float.floatToRawIntBits(start);
+                return Float.intBitsToFloat(transducer + ((transducer > 0) ? -1 : 1));
+            } else { // start == 0.0f && direction < 0.0f
+                return -Float.MIN_VALUE;
+            }
+        } else if (start < direction) { // ascending
             // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
             // then bitwise convert start to integer.
-            int transducer = Float.floatToRawIntBits(start + 0.0f);
-
-            /*
-             * IEEE 754 floating-point numbers are lexicographically
-             * ordered if treated as signed- magnitude integers .
-             * Since Java's integers are two's complement,
-             * incrementing" the two's complement representation of a
-             * logically negative floating-point value *decrements*
-             * the signed-magnitude representation. Therefore, when
-             * the integer representation of a floating-point values
-             * is less than zero, the adjustment to the representation
-             * is in the opposite direction than would be expected at
-             * first.
-             */
-            if (direction > start) {// Calculate next greater value
-                transducer = transducer + (transducer >= 0 ? 1:-1);
-            } else  { // Calculate next lesser value
-                assert direction < start;
-                if (transducer > 0)
-                    --transducer;
-                else
-                    if (transducer < 0 )
-                        ++transducer;
-                    /*
-                     * transducer==0, the result is -MIN_VALUE
-                     *
-                     * The transition from zero (implicitly
-                     * positive) to the smallest negative
-                     * signed magnitude value must be done
-                     * explicitly.
-                     */
-                    else
-                        transducer = FloatConsts.SIGN_BIT_MASK | 1;
-            }
-
-            return Float.intBitsToFloat(transducer);
+            final int transducer = Float.floatToRawIntBits(start + 0.0f);
+            return Float.intBitsToFloat(transducer + ((transducer >= 0) ? 1 : -1));
+        } else if (start == direction) {
+            return (float)direction;
+        } else { // isNaN(start) || isNaN(direction)
+            return start + (float)direction;
         }
     }
 
@@ -2077,12 +2047,13 @@
      * @since 1.6
      */
     public static double nextUp(double d) {
-        if( Double.isNaN(d) || d == Double.POSITIVE_INFINITY)
+        // Use a single conditional and handle the likely cases first.
+        if (d < Double.POSITIVE_INFINITY) {
+            // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0).
+            final long transducer = Double.doubleToRawLongBits(d + 0.0D);
+            return Double.longBitsToDouble(transducer + ((transducer >= 0L) ? 1L : -1L));
+        } else { // d is NaN or +Infinity
             return d;
-        else {
-            d += 0.0d;
-            return Double.longBitsToDouble(Double.doubleToRawLongBits(d) +
-                                           ((d >= 0.0d)?+1L:-1L));
         }
     }
 
@@ -2112,12 +2083,13 @@
      * @since 1.6
      */
     public static float nextUp(float f) {
-        if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
+        // Use a single conditional and handle the likely cases first.
+        if (f < Float.POSITIVE_INFINITY) {
+            // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0).
+            final int transducer = Float.floatToRawIntBits(f + 0.0F);
+            return Float.intBitsToFloat(transducer + ((transducer >= 0) ? 1 : -1));
+        } else { // f is NaN or +Infinity
             return f;
-        else {
-            f += 0.0f;
-            return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
-                                        ((f >= 0.0f)?+1:-1));
         }
     }
 
--- a/jdk/src/share/classes/java/net/ContentHandler.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/net/ContentHandler.java	Mon May 12 17:01:57 2014 -0700
@@ -46,15 +46,28 @@
  * <p>
  * If no content handler could be found, URLConnection will
  * look for a content handler in a user-defineable set of places.
- * By default it looks in sun.net.www.content, but users can define a
- * vertical-bar delimited set of class prefixes to search through in
- * addition by defining the java.content.handler.pkgs property.
- * The class name must be of the form:
- * <pre>
- *     {package-prefix}.{major}.{minor}
- * e.g.
+ * Users can define a vertical-bar delimited set of class prefixes
+ * to search through by defining the <i>java.content.handler.pkgs</i>
+ * property. The class name must be of the form:
+ * <blockquote>
+ *     <i>{package-prefix}.{major}.{minor}</i>
+ *     <P>
+ *     where <i>{major}.{minor}</i> is formed by taking the
+ *     content-type string, replacing all slash characters with a
+ *     {@code period} ('.'), and all other non-alphanumeric characters
+ *     with the underscore character '{@code _}'. The alphanumeric
+ *     characters are specifically the 26 uppercase ASCII letters
+ *     '{@code A}' through '{@code Z}', the 26 lowercase ASCII
+ *     letters '{@code a}' through '{@code z}', and the 10 ASCII
+ *     digits '{@code 0}' through '{@code 9}'.
+ *     <p>
+ *     e.g.
  *     YoyoDyne.experimental.text.plain
- * </pre>
+ * </blockquote>
+ * If no user-defined content handler is found, then the system
+ * tries to load a specific <i>content-type</i> handler from one
+ * of the built-in handlers, if one exists.
+ * <p>
  * If the loading of the content handler class would be performed by
  * a classloader that is outside of the delegation chain of the caller,
  * the JVM will need the RuntimePermission "getClassLoader".
--- a/jdk/src/share/classes/java/net/URL.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/net/URL.java	Mon May 12 17:01:57 2014 -0700
@@ -266,10 +266,7 @@
      *     a subclass of {@code URLStreamHandler}, then the next package
      *     in the list is tried.
      * <li>If the previous step fails to find a protocol handler, then the
-     *     constructor tries to load from a system default package.
-     *     <blockquote><pre>
-     *         &lt;<i>system default package</i>&gt;.&lt;<i>protocol</i>&gt;.Handler
-     *     </pre></blockquote>
+     *     constructor tries to load a built-in protocol handler.
      *     If this class does not exist, or if the class exists but it is not a
      *     subclass of {@code URLStreamHandler}, then a
      *     {@code MalformedURLException} is thrown.
--- a/jdk/src/share/classes/java/net/URLConnection.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/net/URLConnection.java	Mon May 12 17:01:57 2014 -0700
@@ -704,21 +704,10 @@
      *     handler for that content type.
      * <li>If no content handler factory has yet been set up, or if the
      *     factory's {@code createContentHandler} method returns
-     *     {@code null}, then the application loads the class named:
-     *     <blockquote><pre>
-     *         sun.net.www.content.&lt;<i>contentType</i>&gt;
-     *     </pre></blockquote>
-     *     where &lt;<i>contentType</i>&gt; is formed by taking the
-     *     content-type string, replacing all slash characters with a
-     *     {@code period} ('.'), and all other non-alphanumeric characters
-     *     with the underscore character '{@code _}'. The alphanumeric
-     *     characters are specifically the 26 uppercase ASCII letters
-     *     '{@code A}' through '{@code Z}', the 26 lowercase ASCII
-     *     letters '{@code a}' through '{@code z}', and the 10 ASCII
-     *     digits '{@code 0}' through '{@code 9}'. If the specified
-     *     class does not exist, or is not a subclass of
-     *     {@code ContentHandler}, then an
-     *     {@code UnknownServiceException} is thrown.
+     *     {@code null}, then this method tries to load a content handler
+     *     class as defined by {@link java.net.ContentHandler ContentHandler}.
+     *     If the class does not exist, or is not a subclass of {@code
+     *     ContentHandler}, then an {@code UnknownServiceException} is thrown.
      * </ol>
      *
      * @return     the object fetched. The {@code instanceof} operator
--- a/jdk/src/share/classes/java/time/DayOfWeek.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/DayOfWeek.java	Mon May 12 17:01:57 2014 -0700
@@ -201,7 +201,7 @@
      * Gets the day-of-week {@code int} value.
      * <p>
      * The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday).
-     * See {@link WeekFields#dayOfWeek} for localized week-numbering.
+     * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week-numbering.
      *
      * @return the day-of-week, from 1 (Monday) to 7 (Sunday)
      */
@@ -288,7 +288,7 @@
     /**
      * Gets the value of the specified field from this day-of-week as an {@code int}.
      * <p>
-     * This queries this day-of-week for the value for the specified field.
+     * This queries this day-of-week for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -321,7 +321,7 @@
     /**
      * Gets the value of the specified field from this day-of-week as a {@code long}.
      * <p>
-     * This queries this day-of-week for the value for the specified field.
+     * This queries this day-of-week for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -419,7 +419,7 @@
      * The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)}
      * passing {@link ChronoField#DAY_OF_WEEK} as the field.
      * Note that this adjusts forwards or backwards within a Monday to Sunday week.
-     * See {@link WeekFields#dayOfWeek} for localized week start days.
+     * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week start days.
      * See {@code TemporalAdjuster} for other adjusters with more control,
      * such as {@code next(MONDAY)}.
      * <p>
--- a/jdk/src/share/classes/java/time/Duration.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/Duration.java	Mon May 12 17:01:57 2014 -0700
@@ -546,7 +546,7 @@
      * They are returned in the order seconds, nanos.
      * <p>
      * This set can be used in conjunction with {@link #get(TemporalUnit)}
-     * to access the entire state of the period.
+     * to access the entire state of the duration.
      *
      * @return a list containing the seconds and nanos units, not null
      */
@@ -686,8 +686,8 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param amountToAdd  the amount of the period, measured in terms of the unit, positive or negative
-     * @param unit  the unit that the period is measured in, must have an exact duration, not null
+     * @param amountToAdd  the amount to add, measured in terms of the unit, positive or negative
+     * @param unit  the unit that the amount is measured in, must have an exact duration, not null
      * @return a {@code Duration} based on this duration with the specified duration added, not null
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
@@ -848,8 +848,8 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param amountToSubtract  the amount of the period, measured in terms of the unit, positive or negative
-     * @param unit  the unit that the period is measured in, must have an exact duration, not null
+     * @param amountToSubtract  the amount to subtract, measured in terms of the unit, positive or negative
+     * @param unit  the unit that the amount is measured in, must have an exact duration, not null
      * @return a {@code Duration} based on this duration with the specified duration subtracted, not null
      * @throws ArithmeticException if numeric overflow occurs
      */
--- a/jdk/src/share/classes/java/time/Instant.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/Instant.java	Mon May 12 17:01:57 2014 -0700
@@ -530,7 +530,7 @@
     /**
      * Gets the value of the specified field from this instant as an {@code int}.
      * <p>
-     * This queries this instant for the value for the specified field.
+     * This queries this instant for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -571,7 +571,7 @@
     /**
      * Gets the value of the specified field from this instant as a {@code long}.
      * <p>
-     * This queries this instant for the value for the specified field.
+     * This queries this instant for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
--- a/jdk/src/share/classes/java/time/LocalDate.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/LocalDate.java	Mon May 12 17:01:57 2014 -0700
@@ -280,7 +280,7 @@
      * @param dayOfYear  the day-of-year to represent, from 1 to 366
      * @return the local date, not null
      * @throws DateTimeException if the value of any field is out of range,
-     *  or if the day-of-year is invalid for the month-year
+     *  or if the day-of-year is invalid for the year
      */
     public static LocalDate ofYearDay(int year, int dayOfYear) {
         YEAR.checkValidValue(year);
@@ -308,7 +308,7 @@
      *
      * @param epochDay  the Epoch Day to convert, based on the epoch 1970-01-01
      * @return the local date, not null
-     * @throws DateTimeException if the epoch days exceeds the supported date range
+     * @throws DateTimeException if the epoch day exceeds the supported date range
      */
     public static LocalDate ofEpochDay(long epochDay) {
         long zeroDay = epochDay + DAYS_0000_TO_1970;
@@ -515,7 +515,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this date.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -592,7 +592,7 @@
     /**
      * Gets the value of the specified field from this date as an {@code int}.
      * <p>
-     * This queries this date for the value for the specified field.
+     * This queries this date for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -600,7 +600,7 @@
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this date, except {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH}
-     * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * which are too large to fit in an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -627,7 +627,7 @@
     /**
      * Gets the value of the specified field from this date as a {@code long}.
      * <p>
-     * This queries this date for the value for the specified field.
+     * This queries this date for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -875,7 +875,9 @@
      * <p>
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * <p>
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * Key date-time classes also implement the {@code TemporalAdjuster} interface,
      * such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -885,7 +887,7 @@
      * For example this code returns a date on the last day of July:
      * <pre>
      *  import static java.time.Month.*;
-     *  import static java.time.temporal.Adjusters.*;
+     *  import static java.time.temporal.TemporalAdjusters.*;
      *
      *  result = localDate.with(JULY).with(lastDayOfMonth());
      * </pre>
@@ -1041,7 +1043,8 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this date with the year altered.
+     * Returns a copy of this {@code LocalDate} with the year altered.
+     * <p>
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1059,7 +1062,8 @@
     }
 
     /**
-     * Returns a copy of this date with the month-of-year altered.
+     * Returns a copy of this {@code LocalDate} with the month-of-year altered.
+     * <p>
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1077,7 +1081,8 @@
     }
 
     /**
-     * Returns a copy of this date with the day-of-month altered.
+     * Returns a copy of this {@code LocalDate} with the day-of-month altered.
+     * <p>
      * If the resulting date is invalid, an exception is thrown.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1095,7 +1100,8 @@
     }
 
     /**
-     * Returns a copy of this date with the day-of-year altered.
+     * Returns a copy of this {@code LocalDate} with the day-of-year altered.
+     * <p>
      * If the resulting date is invalid, an exception is thrown.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1245,7 +1251,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in years added.
+     * Returns a copy of this {@code LocalDate} with the specified number of years added.
      * <p>
      * This method adds the specified amount to the years field in three steps:
      * <ol>
@@ -1273,7 +1279,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in months added.
+     * Returns a copy of this {@code LocalDate} with the specified number of months added.
      * <p>
      * This method adds the specified amount to the months field in three steps:
      * <ol>
@@ -1304,7 +1310,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in weeks added.
+     * Returns a copy of this {@code LocalDate} with the specified number of weeks added.
      * <p>
      * This method adds the specified amount in weeks to the days field incrementing
      * the month and year fields as necessary to ensure the result remains valid.
@@ -1402,11 +1408,11 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in years subtracted.
+     * Returns a copy of this {@code LocalDate} with the specified number of years subtracted.
      * <p>
      * This method subtracts the specified amount from the years field in three steps:
      * <ol>
-     * <li>Subtract the input years to the year field</li>
+     * <li>Subtract the input years from the year field</li>
      * <li>Check if the resulting date would be invalid</li>
      * <li>Adjust the day-of-month to the last valid day if necessary</li>
      * </ol>
@@ -1426,11 +1432,11 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in months subtracted.
+     * Returns a copy of this {@code LocalDate} with the specified number of months subtracted.
      * <p>
      * This method subtracts the specified amount from the months field in three steps:
      * <ol>
-     * <li>Subtract the input months to the month-of-year field</li>
+     * <li>Subtract the input months from the month-of-year field</li>
      * <li>Check if the resulting date would be invalid</li>
      * <li>Adjust the day-of-month to the last valid day if necessary</li>
      * </ol>
@@ -1450,7 +1456,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in weeks subtracted.
+     * Returns a copy of this {@code LocalDate} with the specified number of weeks subtracted.
      * <p>
      * This method subtracts the specified amount in weeks from the days field decrementing
      * the month and year fields as necessary to ensure the result remains valid.
--- a/jdk/src/share/classes/java/time/LocalDateTime.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java	Mon May 12 17:01:57 2014 -0700
@@ -428,7 +428,7 @@
     /**
      * Obtains an instance of {@code LocalDateTime} from a temporal object.
      * <p>
-     * This obtains an offset time based on the specified temporal.
+     * This obtains a local date-time based on the specified temporal.
      * A {@code TemporalAccessor} represents an arbitrary set of date and time information,
      * which this factory converts to an instance of {@code LocalDateTime}.
      * <p>
@@ -656,7 +656,7 @@
     /**
      * Gets the value of the specified field from this date-time as an {@code int}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -665,7 +665,7 @@
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
      * {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} which are too large to fit in
-     * an {@code int} and throw a {@code DateTimeException}.
+     * an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -693,7 +693,7 @@
     /**
      * Gets the value of the specified field from this date-time as a {@code long}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -878,7 +878,9 @@
      * <p>
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * <p>
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * Key date-time classes also implement the {@code TemporalAdjuster} interface,
      * such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -888,7 +890,7 @@
      * For example this code returns a date on the last day of July:
      * <pre>
      *  import static java.time.Month.*;
-     *  import static java.time.temporal.Adjusters.*;
+     *  import static java.time.temporal.TemporalAdjusters.*;
      *
      *  result = localDateTime.with(JULY).with(lastDayOfMonth());
      * </pre>
@@ -974,6 +976,7 @@
     //-----------------------------------------------------------------------
     /**
      * Returns a copy of this {@code LocalDateTime} with the year altered.
+     * <p>
      * The time does not affect the calculation and will be the same in the result.
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
@@ -989,6 +992,7 @@
 
     /**
      * Returns a copy of this {@code LocalDateTime} with the month-of-year altered.
+     * <p>
      * The time does not affect the calculation and will be the same in the result.
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
@@ -1004,7 +1008,8 @@
 
     /**
      * Returns a copy of this {@code LocalDateTime} with the day-of-month altered.
-     * If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
+     * <p>
+     * If the resulting date-time is invalid, an exception is thrown.
      * The time does not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1020,7 +1025,8 @@
 
     /**
      * Returns a copy of this {@code LocalDateTime} with the day-of-year altered.
-     * If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
+     * <p>
+     * If the resulting date-time is invalid, an exception is thrown.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1035,7 +1041,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code LocalDateTime} with the hour-of-day altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1049,7 +1055,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code LocalDateTime} with the minute-of-hour altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1063,7 +1069,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code LocalDateTime} with the second-of-minute altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1077,7 +1083,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code LocalDateTime} with the nano-of-second altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1109,7 +1115,7 @@
      * @param unit  the unit to truncate to, not null
      * @return a {@code LocalDateTime} based on this date-time with the time truncated, not null
      * @throws DateTimeException if unable to truncate
-     * @throws UnsupportedTemporalTypeException if the field is not supported
+     * @throws UnsupportedTemporalTypeException if the unit is not supported
      */
     public LocalDateTime truncatedTo(TemporalUnit unit) {
         return with(date, time.truncatedTo(unit));
@@ -1192,7 +1198,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in years added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of years added.
      * <p>
      * This method adds the specified amount to the years field in three steps:
      * <ol>
@@ -1217,7 +1223,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in months added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of months added.
      * <p>
      * This method adds the specified amount to the months field in three steps:
      * <ol>
@@ -1242,7 +1248,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in weeks added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of weeks added.
      * <p>
      * This method adds the specified amount in weeks to the days field incrementing
      * the month and year fields as necessary to ensure the result remains valid.
@@ -1262,7 +1268,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in days added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of days added.
      * <p>
      * This method adds the specified amount to the days field incrementing the
      * month and year fields as necessary to ensure the result remains valid.
@@ -1283,7 +1289,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in hours added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of hours added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1296,7 +1302,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in minutes added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of minutes added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1309,7 +1315,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in seconds added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of seconds added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1322,7 +1328,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1391,7 +1397,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in years subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of years subtracted.
      * <p>
      * This method subtracts the specified amount from the years field in three steps:
      * <ol>
@@ -1415,7 +1421,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in months subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of months subtracted.
      * <p>
      * This method subtracts the specified amount from the months field in three steps:
      * <ol>
@@ -1439,7 +1445,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in weeks subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of weeks subtracted.
      * <p>
      * This method subtracts the specified amount in weeks from the days field decrementing
      * the month and year fields as necessary to ensure the result remains valid.
@@ -1458,9 +1464,9 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in days subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of days subtracted.
      * <p>
-     * This method subtracts the specified amount from the days field incrementing the
+     * This method subtracts the specified amount from the days field decrementing the
      * month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
@@ -1478,7 +1484,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of hours subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1491,7 +1497,7 @@
    }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of minutes subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1504,7 +1510,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of seconds subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1517,7 +1523,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1575,7 +1581,7 @@
      * what the result of this method will be.
      * <p>
      * The result of this method is obtained by invoking the
-     * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+     * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
      * specified query passing {@code this} as the argument.
      *
      * @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/LocalTime.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/LocalTime.java	Mon May 12 17:01:57 2014 -0700
@@ -93,7 +93,7 @@
 import java.util.Objects;
 
 /**
- * A time without time-zone in the ISO-8601 calendar system,
+ * A time without a time-zone in the ISO-8601 calendar system,
  * such as {@code 10:15:30}.
  * <p>
  * {@code LocalTime} is an immutable date-time object that represents a time,
@@ -101,7 +101,7 @@
  * Time is represented to nanosecond precision.
  * For example, the value "13:45.30.123456789" can be stored in a {@code LocalTime}.
  * <p>
- * It does not store or represent a date or time-zone.
+ * This class does not store or represent a date or time-zone.
  * Instead, it is a description of the local time as seen on a wall clock.
  * It cannot represent an instant on the time-line without additional information
  * such as an offset or time-zone.
@@ -280,7 +280,7 @@
         return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + now.getNano());
     }
 
-    //------------------------get-----------------------------------------------
+    //-----------------------------------------------------------------------
     /**
      * Obtains an instance of {@code LocalTime} from an hour and minute.
      * <p>
@@ -395,7 +395,7 @@
      * on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code LocalTime::from}.
+     * allowing it to be used as a query via method reference, {@code LocalTime::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the local time, not null
@@ -418,7 +418,7 @@
      * The string must represent a valid time and is parsed using
      * {@link java.time.format.DateTimeFormatter#ISO_LOCAL_TIME}.
      *
-     * @param text the text to parse such as "10:15:30", not null
+     * @param text  the text to parse such as "10:15:30", not null
      * @return the parsed local time, not null
      * @throws DateTimeParseException if the text cannot be parsed
      */
@@ -524,7 +524,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this time.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -589,7 +589,7 @@
     /**
      * Gets the value of the specified field from this time as an {@code int}.
      * <p>
-     * This queries this time for the value for the specified field.
+     * This queries this time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -597,7 +597,7 @@
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
-     * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * which are too large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -624,7 +624,7 @@
     /**
      * Gets the value of the specified field from this time as a {@code long}.
      * <p>
-     * This queries this time for the value for the specified field.
+     * This queries this time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -858,7 +858,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code LocalTime} with the hour-of-day altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -875,7 +875,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code LocalTime} with the minute-of-hour altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -892,7 +892,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code LocalTime} with the second-of-minute altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -909,7 +909,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code LocalTime} with the nano-of-second altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -929,7 +929,7 @@
     /**
      * Returns a copy of this {@code LocalTime} with the time truncated.
      * <p>
-     * Truncating the time returns a copy of the original time with fields
+     * Truncation returns a copy of the original time with fields
      * smaller than the specified unit set to zero.
      * For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit
      * will set the second-of-minute and nano-of-second field to zero.
@@ -1059,7 +1059,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in hours added.
+     * Returns a copy of this {@code LocalTime} with the specified number of hours added.
      * <p>
      * This adds the specified number of hours to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1078,7 +1078,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in minutes added.
+     * Returns a copy of this {@code LocalTime} with the specified number of minutes added.
      * <p>
      * This adds the specified number of minutes to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1103,7 +1103,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in seconds added.
+     * Returns a copy of this {@code LocalTime} with the specified number of seconds added.
      * <p>
      * This adds the specified number of seconds to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1130,7 +1130,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code LocalTime} with the specified number of nanoseconds added.
      * <p>
      * This adds the specified number of nanoseconds to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1208,7 +1208,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code LocalTime} with the specified number of hours subtracted.
      * <p>
      * This subtracts the specified number of hours from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1223,7 +1223,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code LocalTime} with the specified number of minutes subtracted.
      * <p>
      * This subtracts the specified number of minutes from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1238,7 +1238,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code LocalTime} with the specified number of seconds subtracted.
      * <p>
      * This subtracts the specified number of seconds from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1253,7 +1253,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code LocalTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This subtracts the specified number of nanoseconds from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1470,14 +1470,13 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Compares this {@code LocalTime} to another time.
+     * Compares this time to another time.
      * <p>
      * The comparison is based on the time-line position of the local times within a day.
      * It is "consistent with equals", as defined by {@link Comparable}.
      *
      * @param other  the other time to compare to, not null
      * @return the comparator value, negative if less, positive if greater
-     * @throws NullPointerException if {@code other} is null
      */
     @Override
     public int compareTo(LocalTime other) {
@@ -1495,26 +1494,24 @@
     }
 
     /**
-     * Checks if this {@code LocalTime} is after the specified time.
+     * Checks if this time is after the specified time.
      * <p>
      * The comparison is based on the time-line position of the time within a day.
      *
      * @param other  the other time to compare to, not null
      * @return true if this is after the specified time
-     * @throws NullPointerException if {@code other} is null
      */
     public boolean isAfter(LocalTime other) {
         return compareTo(other) > 0;
     }
 
     /**
-     * Checks if this {@code LocalTime} is before the specified time.
+     * Checks if this time is before the specified time.
      * <p>
      * The comparison is based on the time-line position of the time within a day.
      *
      * @param other  the other time to compare to, not null
      * @return true if this point is before the specified time
-     * @throws NullPointerException if {@code other} is null
      */
     public boolean isBefore(LocalTime other) {
         return compareTo(other) < 0;
--- a/jdk/src/share/classes/java/time/Month.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/Month.java	Mon May 12 17:01:57 2014 -0700
@@ -202,7 +202,7 @@
      * chronology, or can be converted to a {@code LocalDate}.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code Month::from}.
+     * allowing it to be used as a query via method reference, {@code Month::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the month-of-year, not null
@@ -315,7 +315,7 @@
     /**
      * Gets the value of the specified field from this month-of-year as an {@code int}.
      * <p>
-     * This queries this month for the value for the specified field.
+     * This queries this month for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -348,7 +348,7 @@
     /**
      * Gets the value of the specified field from this month-of-year as a {@code long}.
      * <p>
-     * This queries this month for the value for the specified field.
+     * This queries this month for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
--- a/jdk/src/share/classes/java/time/MonthDay.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/MonthDay.java	Mon May 12 17:01:57 2014 -0700
@@ -90,8 +90,8 @@
  * A month-day in the ISO-8601 calendar system, such as {@code --12-03}.
  * <p>
  * {@code MonthDay} is an immutable date-time object that represents the combination
- * of a year and month. Any field that can be derived from a month and day, such as
- * quarter-of-year, can be obtained.
+ * of a month and day-of-month. Any field that can be derived from a month and day,
+ * such as quarter-of-year, can be obtained.
  * <p>
  * This class does not store or represent a year, time or time-zone.
  * For example, the value "December 3rd" can be stored in a {@code MonthDay}.
@@ -154,7 +154,7 @@
     /**
      * Obtains the current month-day from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current month-day.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -169,7 +169,7 @@
     /**
      * Obtains the current month-day from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current month-day.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current month-day.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -258,7 +258,7 @@
      * chronology, or can be converted to a {@code LocalDate}.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code MonthDay::from}.
+     * allowing it to be used as a query via method reference, {@code MonthDay::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the month-day, not null
@@ -389,7 +389,7 @@
     /**
      * Gets the value of the specified field from this month-day as an {@code int}.
      * <p>
-     * This queries this month-day for the value for the specified field.
+     * This queries this month-day for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -420,7 +420,7 @@
     /**
      * Gets the value of the specified field from this month-day as a {@code long}.
      * <p>
-     * This queries this month-day for the value for the specified field.
+     * This queries this month-day for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -501,7 +501,7 @@
      * This method checks whether this month and day and the input year form
      * a valid date. This can only return false for February 29th.
      *
-     * @param year  the year to validate, an out of range value returns false
+     * @param year  the year to validate
      * @return true if the year is valid for this month-day
      * @see Year#isValidMonthDay(MonthDay)
      */
@@ -685,7 +685,7 @@
     }
 
     /**
-     * Is this month-day after the specified month-day.
+     * Checks if this month-day is after the specified month-day.
      *
      * @param other  the other month-day to compare to, not null
      * @return true if this is after the specified month-day
@@ -695,7 +695,7 @@
     }
 
     /**
-     * Is this month-day before the specified month-day.
+     * Checks if this month-day is before the specified month-day.
      *
      * @param other  the other month-day to compare to, not null
      * @return true if this point is before the specified month-day
--- a/jdk/src/share/classes/java/time/OffsetDateTime.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java	Mon May 12 17:01:57 2014 -0700
@@ -199,7 +199,7 @@
     /**
      * Obtains the current date-time from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current date-time.
      * The offset will be calculated from the time-zone in the clock.
      * <p>
@@ -215,7 +215,7 @@
     /**
      * Obtains the current date-time from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current date-time.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date-time.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * The offset will be calculated from the specified time-zone.
      * <p>
@@ -345,7 +345,7 @@
      * those fields that are equivalent to the relevant objects.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code OffsetDateTime::from}.
+     * allowing it to be used as a query via method reference, {@code OffsetDateTime::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the offset date-time, not null
@@ -566,7 +566,7 @@
     /**
      * Gets the value of the specified field from this date-time as an {@code int}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -575,7 +575,7 @@
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
      * {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
-     * large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -608,7 +608,7 @@
     /**
      * Gets the value of the specified field from this date-time as a {@code long}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -703,7 +703,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Gets the {@code LocalDateTime} part of this offset date-time.
+     * Gets the {@code LocalDateTime} part of this date-time.
      * <p>
      * This returns a {@code LocalDateTime} with the same year, month, day and time
      * as this date-time.
@@ -795,10 +795,10 @@
     /**
      * Gets the day-of-week field, which is an enum {@code DayOfWeek}.
      * <p>
-     * This method returns the enum {@link java.time.DayOfWeek} for the day-of-week.
+     * This method returns the enum {@link DayOfWeek} for the day-of-week.
      * This avoids confusion as to what {@code int} values mean.
      * If you need access to the primitive {@code int} value then the enum
-     * provides the {@link java.time.DayOfWeek#getValue() int value}.
+     * provides the {@link DayOfWeek#getValue() int value}.
      * <p>
      * Additional information can be obtained from the {@code DayOfWeek}.
      * This includes textual names of the values.
@@ -868,7 +868,8 @@
      * <p>
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * Key date-time classes also implement the {@code TemporalAdjuster} interface,
      * such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -878,7 +879,7 @@
      * For example this code returns a date on the last day of July:
      * <pre>
      *  import static java.time.Month.*;
-     *  import static java.time.temporal.Adjusters.*;
+     *  import static java.time.temporal.TemporalAdjusters.*;
      *
      *  result = offsetDateTime.with(JULY).with(lastDayOfMonth());
      * </pre>
@@ -920,7 +921,7 @@
     /**
      * Returns a copy of this date-time with the specified field set to a new value.
      * <p>
-     * TThis returns an {@code OffsetDateTime}, based on this one, with the value
+     * This returns an {@code OffsetDateTime}, based on this one, with the value
      * for the specified field changed.
      * This can be used to change any supported field, such as the year, month or day-of-month.
      * If it is not possible to set the value, because the field is not supported or for
@@ -979,7 +980,8 @@
     //-----------------------------------------------------------------------
     /**
      * Returns a copy of this {@code OffsetDateTime} with the year altered.
-     * The offset does not affect the calculation and will be the same in the result.
+     * <p>
+     * The time and offset do not affect the calculation and will be the same in the result.
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -994,7 +996,8 @@
 
     /**
      * Returns a copy of this {@code OffsetDateTime} with the month-of-year altered.
-     * The offset does not affect the calculation and will be the same in the result.
+     * <p>
+     * The time and offset do not affect the calculation and will be the same in the result.
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1009,8 +1012,9 @@
 
     /**
      * Returns a copy of this {@code OffsetDateTime} with the day-of-month altered.
+     * <p>
      * If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
-     * The offset does not affect the calculation and will be the same in the result.
+     * The time and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1025,6 +1029,8 @@
 
     /**
      * Returns a copy of this {@code OffsetDateTime} with the day-of-year altered.
+     * <p>
+     * The time and offset do not affect the calculation and will be the same in the result.
      * If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1040,9 +1046,9 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code OffsetDateTime} with the hour-of-day altered.
      * <p>
-     * The offset does not affect the calculation and will be the same in the result.
+     * The date and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1055,9 +1061,9 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour altered.
      * <p>
-     * The offset does not affect the calculation and will be the same in the result.
+     * The date and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1070,9 +1076,9 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code OffsetDateTime} with the second-of-minute altered.
      * <p>
-     * The offset does not affect the calculation and will be the same in the result.
+     * The date and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1085,15 +1091,15 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code OffsetDateTime} with the nano-of-second altered.
      * <p>
-     * The offset does not affect the calculation and will be the same in the result.
+     * The date and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @param nanoOfSecond  the nano-of-second to set in the result, from 0 to 999,999,999
      * @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null
-     * @throws DateTimeException if the nanos value is invalid
+     * @throws DateTimeException if the nano value is invalid
      */
     public OffsetDateTime withNano(int nanoOfSecond) {
         return with(dateTime.withNano(nanoOfSecond), offset);
@@ -1187,7 +1193,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in years added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of years added.
      * <p>
      * This method adds the specified amount to the years field in three steps:
      * <ol>
@@ -1211,7 +1217,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in months added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of months added.
      * <p>
      * This method adds the specified amount to the months field in three steps:
      * <ol>
@@ -1235,13 +1241,13 @@
     }
 
     /**
-     * Returns a copy of this OffsetDateTime with the specified period in weeks added.
+     * Returns a copy of this OffsetDateTime with the specified number of weeks added.
      * <p>
      * This method adds the specified amount in weeks to the days field incrementing
      * the month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
-     * For example, 2008-12-31 plus one week would result in the 2009-01-07.
+     * For example, 2008-12-31 plus one week would result in 2009-01-07.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1254,13 +1260,13 @@
     }
 
     /**
-     * Returns a copy of this OffsetDateTime with the specified period in days added.
+     * Returns a copy of this OffsetDateTime with the specified number of days added.
      * <p>
      * This method adds the specified amount to the days field incrementing the
      * month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
-     * For example, 2008-12-31 plus one day would result in the 2009-01-01.
+     * For example, 2008-12-31 plus one day would result in 2009-01-01.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1273,7 +1279,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in hours added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of hours added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1286,7 +1292,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of minutes added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1299,7 +1305,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of seconds added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1312,7 +1318,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1376,11 +1382,11 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in years subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of years subtracted.
      * <p>
      * This method subtracts the specified amount from the years field in three steps:
      * <ol>
-     * <li>Subtract the input years to the year field</li>
+     * <li>Subtract the input years from the year field</li>
      * <li>Check if the resulting date would be invalid</li>
      * <li>Adjust the day-of-month to the last valid day if necessary</li>
      * </ol>
@@ -1400,11 +1406,11 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in months subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of months subtracted.
      * <p>
      * This method subtracts the specified amount from the months field in three steps:
      * <ol>
-     * <li>Subtract the input months to the month-of-year field</li>
+     * <li>Subtract the input months from the month-of-year field</li>
      * <li>Check if the resulting date would be invalid</li>
      * <li>Adjust the day-of-month to the last valid day if necessary</li>
      * </ol>
@@ -1424,13 +1430,13 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in weeks subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of weeks subtracted.
      * <p>
      * This method subtracts the specified amount in weeks from the days field decrementing
      * the month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
-     * For example, 2008-12-31 minus one week would result in the 2009-01-07.
+     * For example, 2008-12-31 minus one week would result in 2009-01-07.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1443,13 +1449,13 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in days subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of days subtracted.
      * <p>
-     * This method subtracts the specified amount from the days field incrementing the
+     * This method subtracts the specified amount from the days field decrementing the
      * month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
-     * For example, 2008-12-31 minus one day would result in the 2009-01-01.
+     * For example, 2008-12-31 minus one day would result in 2009-01-01.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1462,7 +1468,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of hours subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1475,7 +1481,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of minutes subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1488,7 +1494,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of seconds subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1501,7 +1507,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1598,7 +1604,7 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified date-time.
      * The result will be negative if the end is before the start.
-     * For example, the period in days between two date-times can be calculated
+     * For example, the amount in days between two date-times can be calculated
      * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
      * The {@code Temporal} passed to this method is converted to a
@@ -1608,7 +1614,7 @@
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two date-times.
-     * For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
+     * For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
      * will only be one month as it is one minute short of two months.
      * <p>
      * There are two equivalent ways of using this method.
@@ -1769,7 +1775,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Compares this {@code OffsetDateTime} to another date-time.
+     * Compares this date-time to another date-time.
      * <p>
      * The comparison is based on the instant then on the local date-time.
      * It is "consistent with equals", as defined by {@link Comparable}.
--- a/jdk/src/share/classes/java/time/OffsetTime.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/OffsetTime.java	Mon May 12 17:01:57 2014 -0700
@@ -153,14 +153,14 @@
     /**
      * Obtains the current time from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current time.
      * The offset will be calculated from the time-zone in the clock.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
      * because the clock is hard-coded.
      *
-     * @return the current time using the system clock, not null
+     * @return the current time using the system clock and default time-zone, not null
      */
     public static OffsetTime now() {
         return now(Clock.systemDefaultZone());
@@ -169,7 +169,7 @@
     /**
      * Obtains the current time from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current time.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current time.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * The offset will be calculated from the specified time-zone.
      * <p>
@@ -277,7 +277,7 @@
      * those fields that are equivalent to the relevant objects.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code OffsetTime::from}.
+     * allowing it to be used as a query via method reference, {@code OffsetTime::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the offset time, not null
@@ -402,7 +402,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this offset-time.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -473,7 +473,7 @@
     /**
      * Gets the value of the specified field from this time as an {@code int}.
      * <p>
-     * This queries this time for the value for the specified field.
+     * This queries this time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -481,7 +481,7 @@
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
-     * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * which are too large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -505,7 +505,7 @@
     /**
      * Gets the value of the specified field from this time as a {@code long}.
      * <p>
-     * This queries this time for the value for the specified field.
+     * This queries this time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -575,7 +575,7 @@
      * <p>
      * This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime}
      * adjusted by the difference between the two offsets.
-     * This will result in the old and new objects representing the same instant an an implied day.
+     * This will result in the old and new objects representing the same instant on an implied day.
      * This is useful for finding the local time in a different offset.
      * For example, if this time represents {@code 10:30+02:00} and the offset specified is
      * {@code +03:00}, then this method will return {@code 11:30+03:00}.
@@ -737,7 +737,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code OffsetTime} with the hour-of-day altered.
      * <p>
      * The offset does not affect the calculation and will be the same in the result.
      * <p>
@@ -752,7 +752,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code OffsetTime} with the minute-of-hour altered.
      * <p>
      * The offset does not affect the calculation and will be the same in the result.
      * <p>
@@ -767,7 +767,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code OffsetTime} with the second-of-minute altered.
      * <p>
      * The offset does not affect the calculation and will be the same in the result.
      * <p>
@@ -782,7 +782,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code OffsetTime} with the nano-of-second altered.
      * <p>
      * The offset does not affect the calculation and will be the same in the result.
      * <p>
@@ -884,7 +884,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in hours added.
+     * Returns a copy of this {@code OffsetTime} with the specified number of hours added.
      * <p>
      * This adds the specified number of hours to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -899,7 +899,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in minutes added.
+     * Returns a copy of this {@code OffsetTime} with the specified number of minutes added.
      * <p>
      * This adds the specified number of minutes to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -914,7 +914,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in seconds added.
+     * Returns a copy of this {@code OffsetTime} with the specified number of seconds added.
      * <p>
      * This adds the specified number of seconds to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -929,7 +929,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds added.
      * <p>
      * This adds the specified number of nanoseconds to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -995,7 +995,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code OffsetTime} with the specified number of hours subtracted.
      * <p>
      * This subtracts the specified number of hours from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1010,7 +1010,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code OffsetTime} with the specified number of minutes subtracted.
      * <p>
      * This subtracts the specified number of minutes from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1025,7 +1025,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code OffsetTime} with the specified number of seconds subtracted.
      * <p>
      * This subtracts the specified number of seconds from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1040,7 +1040,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This subtracts the specified number of nanoseconds from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1130,7 +1130,7 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified time.
      * The result will be negative if the end is before the start.
-     * For example, the period in hours between two times can be calculated
+     * For example, the amount in hours between two times can be calculated
      * using {@code startTime.until(endTime, HOURS)}.
      * <p>
      * The {@code Temporal} passed to this method is converted to a
@@ -1140,7 +1140,7 @@
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two times.
-     * For example, the period in hours between 11:30Z and 13:29Z will only
+     * For example, the amount in hours between 11:30Z and 13:29Z will only
      * be one hour as it is one minute short of two hours.
      * <p>
      * There are two equivalent ways of using this method.
@@ -1165,7 +1165,7 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endExclusive  the end date, exclusive, which is converted to an {@code OffsetTime}, not null
+     * @param endExclusive  the end time, exclusive, which is converted to an {@code OffsetTime}, not null
      * @param unit  the unit to measure the amount in, not null
      * @return the amount of time between this time and the end time
      * @throws DateTimeException if the amount cannot be calculated, or the end
@@ -1258,7 +1258,6 @@
      *
      * @param other  the other time to compare to, not null
      * @return the comparator value, negative if less, positive if greater
-     * @throws NullPointerException if {@code other} is null
      */
     @Override
     public int compareTo(OffsetTime other) {
--- a/jdk/src/share/classes/java/time/Period.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/Period.java	Mon May 12 17:01:57 2014 -0700
@@ -616,7 +616,7 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param amountToAdd  the period to add, not null
+     * @param amountToAdd  the amount to add, not null
      * @return a {@code Period} based on this period with the requested period added, not null
      * @throws DateTimeException if the specified amount has a non-ISO chronology or
      *  contains an invalid unit
@@ -705,7 +705,7 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param amountToSubtract  the period to subtract, not null
+     * @param amountToSubtract  the amount to subtract, not null
      * @return a {@code Period} based on this period with the requested period subtracted, not null
      * @throws DateTimeException if the specified amount has a non-ISO chronology or
      *  contains an invalid unit
--- a/jdk/src/share/classes/java/time/Year.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/Year.java	Mon May 12 17:01:57 2014 -0700
@@ -164,7 +164,7 @@
     /**
      * Obtains the current year from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current year.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -179,7 +179,7 @@
     /**
      * Obtains the current year from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -240,7 +240,7 @@
      * chronology, or can be converted to a {@code LocalDate}.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code Year::from}.
+     * allowing it to be used as a query via method reference, {@code Year::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the year, not null
@@ -375,7 +375,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this year.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -441,7 +441,7 @@
     /**
      * Gets the value of the specified field from this year as an {@code int}.
      * <p>
-     * This queries this year for the value for the specified field.
+     * This queries this year for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -472,7 +472,7 @@
     /**
      * Gets the value of the specified field from this year as a {@code long}.
      * <p>
-     * This queries this year for the value for the specified field.
+     * This queries this year for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -720,13 +720,13 @@
     }
 
     /**
-     * Returns a copy of this year with the specified number of years added.
+     * Returns a copy of this {@code Year} with the specified number of years added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @param yearsToAdd  the years to add, may be negative
-     * @return a {@code Year} based on this year with the period added, not null
-     * @throws DateTimeException if the result exceeds the supported year range
+     * @return a {@code Year} based on this year with the years added, not null
+     * @throws DateTimeException if the result exceeds the supported range
      */
     public Year plusYears(long yearsToAdd) {
         if (yearsToAdd == 0) {
@@ -786,13 +786,13 @@
     }
 
     /**
-     * Returns a copy of this year with the specified number of years subtracted.
+     * Returns a copy of this {@code Year} with the specified number of years subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @param yearsToSubtract  the years to subtract, may be negative
-     * @return a {@code Year} based on this year with the period subtracted, not null
-     * @throws DateTimeException if the result exceeds the supported year range
+     * @return a {@code Year} based on this year with the year subtracted, not null
+     * @throws DateTimeException if the result exceeds the supported range
      */
     public Year minusYears(long yearsToSubtract) {
         return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
@@ -871,12 +871,12 @@
      * The result will be negative if the end is before the start.
      * The {@code Temporal} passed to this method is converted to a
      * {@code Year} using {@link #from(TemporalAccessor)}.
-     * For example, the period in decades between two year can be calculated
+     * For example, the amount in decades between two year can be calculated
      * using {@code startYear.until(endYear, DECADES)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two years.
-     * For example, the period in decades between 2012 and 2031
+     * For example, the amount in decades between 2012 and 2031
      * will only be one decade as it is one year short of two decades.
      * <p>
      * There are two equivalent ways of using this method.
@@ -948,7 +948,7 @@
      * <p>
      * The day-of-year value 366 is only valid in a leap year.
      *
-     * @param dayOfYear  the day-of-year to use, not null
+     * @param dayOfYear  the day-of-year to use, from 1 to 365-366
      * @return the local date formed from this year and the specified date of year, not null
      * @throws DateTimeException if the day of year is zero or less, 366 or greater or equal
      *  to 366 and this is not a leap year
@@ -1025,7 +1025,7 @@
     }
 
     /**
-     * Is this year after the specified year.
+     * Checks if this year is after the specified year.
      *
      * @param other  the other year to compare to, not null
      * @return true if this is after the specified year
@@ -1035,7 +1035,7 @@
     }
 
     /**
-     * Is this year before the specified year.
+     * Checks if this year is before the specified year.
      *
      * @param other  the other year to compare to, not null
      * @return true if this point is before the specified year
--- a/jdk/src/share/classes/java/time/YearMonth.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/YearMonth.java	Mon May 12 17:01:57 2014 -0700
@@ -157,9 +157,8 @@
     /**
      * Obtains the current year-month from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current year-month.
-     * The zone and offset will be set based on the time-zone in the clock.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
      * because the clock is hard-coded.
@@ -173,7 +172,7 @@
     /**
      * Obtains the current year-month from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year-month.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year-month.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -243,7 +242,7 @@
      * chronology, or can be converted to a {@code LocalDate}.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code YearMonth::from}.
+     * allowing it to be used as a query via method reference, {@code YearMonth::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the year-month, not null
@@ -363,7 +362,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this year-month.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -430,7 +429,7 @@
     /**
      * Gets the value of the specified field from this year-month as an {@code int}.
      * <p>
-     * This queries this year-month for the value for the specified field.
+     * This queries this year-month for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -462,7 +461,7 @@
     /**
      * Gets the value of the specified field from this year-month as a {@code long}.
      * <p>
-     * This queries this year-month for the value for the specified field.
+     * This queries this year-month for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -819,7 +818,7 @@
     }
 
     /**
-     * Returns a copy of this year-month with the specified period in years added.
+     * Returns a copy of this {@code YearMonth} with the specified number of years added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -836,7 +835,7 @@
     }
 
     /**
-     * Returns a copy of this year-month with the specified period in months added.
+     * Returns a copy of this {@code YearMonth} with the specified number of months added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -906,7 +905,7 @@
     }
 
     /**
-     * Returns a copy of this year-month with the specified period in years subtracted.
+     * Returns a copy of this {@code YearMonth} with the specified number of years subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -919,7 +918,7 @@
     }
 
     /**
-     * Returns a copy of this year-month with the specified period in months subtracted.
+     * Returns a copy of this {@code YearMonth} with the specified number of months subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1004,12 +1003,12 @@
      * The result will be negative if the end is before the start.
      * The {@code Temporal} passed to this method is converted to a
      * {@code YearMonth} using {@link #from(TemporalAccessor)}.
-     * For example, the period in years between two year-months can be calculated
+     * For example, the amount in years between two year-months can be calculated
      * using {@code startYearMonth.until(endYearMonth, YEARS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two year-months.
-     * For example, the period in decades between 2012-06 and 2032-05
+     * For example, the amount in decades between 2012-06 and 2032-05
      * will only be one decade as it is one month short of two decades.
      * <p>
      * There are two equivalent ways of using this method.
@@ -1134,7 +1133,7 @@
     }
 
     /**
-     * Is this year-month after the specified year-month.
+     * Checks if this year-month is after the specified year-month.
      *
      * @param other  the other year-month to compare to, not null
      * @return true if this is after the specified year-month
@@ -1144,7 +1143,7 @@
     }
 
     /**
-     * Is this year-month before the specified year-month.
+     * Checks if this year-month is before the specified year-month.
      *
      * @param other  the other year-month to compare to, not null
      * @return true if this point is before the specified year-month
--- a/jdk/src/share/classes/java/time/ZoneId.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/ZoneId.java	Mon May 12 17:01:57 2014 -0700
@@ -453,7 +453,7 @@
      * zones over offset-based zones using {@link TemporalQueries#zone()}.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code ZoneId::from}.
+     * allowing it to be used as a query via method reference, {@code ZoneId::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the zone ID, not null
--- a/jdk/src/share/classes/java/time/ZoneOffset.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/ZoneOffset.java	Mon May 12 17:01:57 2014 -0700
@@ -89,7 +89,7 @@
 /**
  * A time-zone offset from Greenwich/UTC, such as {@code +02:00}.
  * <p>
- * A time-zone offset is the period of time that a time-zone differs from Greenwich/UTC.
+ * A time-zone offset is the amount of time that a time-zone differs from Greenwich/UTC.
  * This is usually a fixed number of hours and minutes.
  * <p>
  * Different parts of the world have different time-zone offsets.
@@ -334,7 +334,7 @@
      * on extracting the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} field.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code ZoneOffset::from}.
+     * allowing it to be used as a query via method reference, {@code ZoneOffset::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the zone-offset, not null
@@ -564,7 +564,7 @@
     /**
      * Gets the value of the specified field from this offset as an {@code int}.
      * <p>
-     * This queries this offset for the value for the specified field.
+     * This queries this offset for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -599,7 +599,7 @@
     /**
      * Gets the value of the specified field from this offset as a {@code long}.
      * <p>
-     * This queries this offset for the value for the specified field.
+     * This queries this offset for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
--- a/jdk/src/share/classes/java/time/ZonedDateTime.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/ZonedDateTime.java	Mon May 12 17:01:57 2014 -0700
@@ -418,7 +418,7 @@
      * <p>
      * Converting an instant to a zoned date-time is simple as there is only one valid
      * offset for each instant. If the valid offset is different to the offset specified,
-     * the the date-time and offset of the zoned date-time will differ from those specified.
+     * then the date-time and offset of the zoned date-time will differ from those specified.
      * <p>
      * If the {@code ZoneId} to be used is a {@code ZoneOffset}, this method is equivalent
      * to {@link #of(LocalDateTime, ZoneId)}.
@@ -469,6 +469,7 @@
      * @param offset  the zone offset, not null
      * @param zone  the time-zone, not null
      * @return the zoned date-time, not null
+     * @throws DateTimeException if the combination of arguments is invalid
      */
     public static ZonedDateTime ofStrict(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) {
         Objects.requireNonNull(localDateTime, "localDateTime");
@@ -538,7 +539,7 @@
      * those fields that are equivalent to the relevant objects.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code ZonedDateTime::from}.
+     * allowing it to be used as a query via method reference, {@code ZonedDateTime::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the zoned date-time, not null
@@ -782,7 +783,7 @@
     /**
      * Gets the value of the specified field from this date-time as an {@code int}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -791,7 +792,7 @@
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
      * {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
-     * large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -824,7 +825,7 @@
     /**
      * Gets the value of the specified field from this date-time as a {@code long}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -1182,7 +1183,8 @@
      * <p>
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * Key date-time classes also implement the {@code TemporalAdjuster} interface,
      * such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -1192,7 +1194,7 @@
      * For example this code returns a date on the last day of July:
      * <pre>
      *  import static java.time.Month.*;
-     *  import static java.time.temporal.Adjusters.*;
+     *  import static java.time.temporal.TemporalAdjusters.*;
      *
      *  result = zonedDateTime.with(JULY).with(lastDayOfMonth());
      * </pre>
@@ -1313,7 +1315,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the year value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the year altered.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#withYear(int) changing the year} of the local date-time.
@@ -1335,7 +1337,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the month-of-year value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the month-of-year altered.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#withMonth(int) changing the month} of the local date-time.
@@ -1357,7 +1359,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the day-of-month value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the day-of-month altered.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#withDayOfMonth(int) changing the day-of-month} of the local date-time.
@@ -1404,7 +1406,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the hour-of-day altered.
      * <p>
      * This operates on the local time-line,
      * {@linkplain LocalDateTime#withHour(int) changing the time} of the local date-time.
@@ -1426,7 +1428,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the minute-of-hour altered.
      * <p>
      * This operates on the local time-line,
      * {@linkplain LocalDateTime#withMinute(int) changing the time} of the local date-time.
@@ -1448,7 +1450,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the second-of-minute altered.
      * <p>
      * This operates on the local time-line,
      * {@linkplain LocalDateTime#withSecond(int) changing the time} of the local date-time.
@@ -1470,7 +1472,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the nano-of-second altered.
      * <p>
      * This operates on the local time-line,
      * {@linkplain LocalDateTime#withNano(int) changing the time} of the local date-time.
@@ -1506,7 +1508,7 @@
      * {@link ChronoUnit#DAYS DAYS}. Other units throw an exception.
      * <p>
      * This operates on the local time-line,
-     * {@link LocalDateTime#truncatedTo(java.time.temporal.TemporalUnit) truncating}
+     * {@link LocalDateTime#truncatedTo(TemporalUnit) truncating}
      * the underlying local date-time. This is then converted back to a
      * {@code ZonedDateTime}, using the zone ID to obtain the offset.
      * <p>
@@ -1607,7 +1609,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in years added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of years added.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#plusYears(long) adding years} to the local date-time.
@@ -1629,7 +1631,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in months added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of months added.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#plusMonths(long) adding months} to the local date-time.
@@ -1651,7 +1653,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in weeks added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of weeks added.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#plusWeeks(long) adding weeks} to the local date-time.
@@ -1673,7 +1675,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in days added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of days added.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#plusDays(long) adding days} to the local date-time.
@@ -1696,7 +1698,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in hours added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of hours added.
      * <p>
      * This operates on the instant time-line, such that adding one hour will
      * always be a duration of one hour later.
@@ -1724,7 +1726,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in minutes added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of minutes added.
      * <p>
      * This operates on the instant time-line, such that adding one minute will
      * always be a duration of one minute later.
@@ -1742,7 +1744,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in seconds added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of seconds added.
      * <p>
      * This operates on the instant time-line, such that adding one second will
      * always be a duration of one second later.
@@ -1760,7 +1762,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds added.
      * <p>
      * This operates on the instant time-line, such that adding one nano will
      * always be a duration of one nano later.
@@ -1848,7 +1850,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in years subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of years subtracted.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#minusYears(long) subtracting years} to the local date-time.
@@ -1870,7 +1872,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in months subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of months subtracted.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#minusMonths(long) subtracting months} to the local date-time.
@@ -1892,7 +1894,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in weeks subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of weeks subtracted.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#minusWeeks(long) subtracting weeks} to the local date-time.
@@ -1914,7 +1916,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in days subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of days subtracted.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time.
@@ -1937,7 +1939,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of hours subtracted.
      * <p>
      * This operates on the instant time-line, such that subtracting one hour will
      * always be a duration of one hour earlier.
@@ -1965,7 +1967,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of minutes subtracted.
      * <p>
      * This operates on the instant time-line, such that subtracting one minute will
      * always be a duration of one minute earlier.
@@ -1983,7 +1985,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of seconds subtracted.
      * <p>
      * This operates on the instant time-line, such that subtracting one second will
      * always be a duration of one second earlier.
@@ -2001,7 +2003,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This operates on the instant time-line, such that subtracting one nano will
      * always be a duration of one nano earlier.
@@ -2028,7 +2030,7 @@
      * what the result of this method will be.
      * <p>
      * The result of this method is obtained by invoking the
-     * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+     * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
      * specified query passing {@code this} as the argument.
      *
      * @param <R> the type of the result
@@ -2049,7 +2051,7 @@
      * objects in terms of a single {@code TemporalUnit}.
      * The start and end points are {@code this} and the specified date-time.
      * The result will be negative if the end is before the start.
-     * For example, the period in days between two date-times can be calculated
+     * For example, the amount in days between two date-times can be calculated
      * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
      * The {@code Temporal} passed to this method is converted to a
@@ -2059,7 +2061,7 @@
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two date-times.
-     * For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
+     * For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
      * will only be one month as it is one minute short of two months.
      * <p>
      * There are two equivalent ways of using this method.
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java	Mon May 12 17:01:57 2014 -0700
@@ -249,8 +249,8 @@
      * This allows dates in different calendar systems to be compared based
      * on the position of the date on the local time-line.
      * The underlying comparison is equivalent to comparing the epoch-day.
+     *
      * @return a comparator that compares in time-line order ignoring the chronology
-     *
      * @see #isAfter
      * @see #isBefore
      * @see #isEqual
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java	Mon May 12 17:01:57 2014 -0700
@@ -227,7 +227,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this date with the specified period in years added.
+     * Returns a copy of this date with the specified number of years added.
      * <p>
      * This adds the specified period in years to the date.
      * In some cases, adding years can cause the resulting date to become invalid.
@@ -243,7 +243,7 @@
     abstract D plusYears(long yearsToAdd);
 
     /**
-     * Returns a copy of this date with the specified period in months added.
+     * Returns a copy of this date with the specified number of months added.
      * <p>
      * This adds the specified period in months to the date.
      * In some cases, adding months can cause the resulting date to become invalid.
@@ -259,7 +259,7 @@
     abstract D plusMonths(long monthsToAdd);
 
     /**
-     * Returns a copy of this date with the specified period in weeks added.
+     * Returns a copy of this date with the specified number of weeks added.
      * <p>
      * This adds the specified period in weeks to the date.
      * In some cases, adding weeks can cause the resulting date to become invalid.
@@ -292,7 +292,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this date with the specified period in years subtracted.
+     * Returns a copy of this date with the specified number of years subtracted.
      * <p>
      * This subtracts the specified period in years to the date.
      * In some cases, subtracting years can cause the resulting date to become invalid.
@@ -313,7 +313,7 @@
     }
 
     /**
-     * Returns a copy of this date with the specified period in months subtracted.
+     * Returns a copy of this date with the specified number of months subtracted.
      * <p>
      * This subtracts the specified period in months to the date.
      * In some cases, subtracting months can cause the resulting date to become invalid.
@@ -334,7 +334,7 @@
     }
 
     /**
-     * Returns a copy of this date with the specified period in weeks subtracted.
+     * Returns a copy of this date with the specified number of weeks subtracted.
      * <p>
      * This subtracts the specified period in weeks to the date.
      * In some cases, subtracting weeks can cause the resulting date to become invalid.
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java	Mon May 12 17:01:57 2014 -0700
@@ -131,7 +131,6 @@
      * The underlying comparison is equivalent to comparing the epoch-day and nano-of-day.
      *
      * @return a comparator that compares in time-line order ignoring the chronology
-     *
      * @see #isAfter
      * @see #isBefore
      * @see #isEqual
@@ -323,7 +322,7 @@
      * what the result of this method will be.
      * <p>
      * The result of this method is obtained by invoking the
-     * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+     * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
      * specified query passing {@code this} as the argument.
      *
      * @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Mon May 12 17:01:57 2014 -0700
@@ -132,7 +132,6 @@
      * The underlying comparison is equivalent to comparing the epoch-second and nano-of-second.
      *
      * @return a comparator that compares in time-line order ignoring the chronology
-     *
      * @see #isAfter
      * @see #isBefore
      * @see #isEqual
@@ -292,7 +291,7 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @return a {@code ZoneChronoDateTime} based on this date-time with the earlier offset, not null
+     * @return a {@code ChronoZonedDateTime} based on this date-time with the earlier offset, not null
      * @throws DateTimeException if no rules can be found for the zone
      * @throws DateTimeException if no rules are valid for this date-time
      */
@@ -319,7 +318,7 @@
     ChronoZonedDateTime<D> withLaterOffsetAtOverlap();
 
     /**
-     * Returns a copy of this ZonedDateTime with a different time-zone,
+     * Returns a copy of this date-time with a different time-zone,
      * retaining the local date-time if possible.
      * <p>
      * This method changes the time-zone and retains the local date-time.
@@ -470,7 +469,7 @@
      * what the result of this method will be.
      * <p>
      * The result of this method is obtained by invoking the
-     * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+     * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
      * specified query passing {@code this} as the argument.
      *
      * @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/chrono/Chronology.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/Chronology.java	Mon May 12 17:01:57 2014 -0700
@@ -132,8 +132,9 @@
  * The set of available chronologies can be extended by applications.
  * Adding a new calendar system requires the writing of an implementation of
  * {@code Chronology}, {@code ChronoLocalDate} and {@code Era}.
- * The majority of the logic specific to the calendar system will be in
- * {@code ChronoLocalDate}. The {@code Chronology} subclass acts as a factory.
+ * The majority of the logic specific to the calendar system will be in the
+ * {@code ChronoLocalDate} implementation.
+ * The {@code Chronology} implementation acts as a factory.
  * <p>
  * To permit the discovery of additional chronologies, the {@link java.util.ServiceLoader ServiceLoader}
  * is used. A file must be added to the {@code META-INF/services} directory with the
@@ -167,7 +168,7 @@
      * If the specified temporal object does not have a chronology, {@link IsoChronology} is returned.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code Chronology::from}.
+     * allowing it to be used as a query via method reference, {@code Chronology::from}.
      *
      * @param temporal  the temporal to convert, not null
      * @return the chronology, not null
@@ -413,7 +414,7 @@
      * The alternate clock may be introduced using {@link Clock dependency injection}.
      *
      * @implSpec
-     * The default implementation invokes {@link #date(TemporalAccessor)} )}.
+     * The default implementation invokes {@link #date(TemporalAccessor)}.
      *
      * @param clock  the clock to use, not null
      * @return the current local date, not null
@@ -622,7 +623,7 @@
      * The parameters control the style of the returned text and the locale.
      *
      * @implSpec
-     * The default implementation behaves as the the formatter was used to
+     * The default implementation behaves as though the formatter was used to
      * format the chronology textual name.
      *
      * @param style  the style of the text required, not null
--- a/jdk/src/share/classes/java/time/chrono/Era.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/Era.java	Mon May 12 17:01:57 2014 -0700
@@ -182,7 +182,7 @@
     /**
      * Gets the value of the specified field from this era as an {@code int}.
      * <p>
-     * This queries this era for the value for the specified field.
+     * This queries this era for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -215,7 +215,7 @@
     /**
      * Gets the value of the specified field from this era as a {@code long}.
      * <p>
-     * This queries this era for the value for the specified field.
+     * This queries this era for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
--- a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Mon May 12 17:01:57 2014 -0700
@@ -394,7 +394,7 @@
      * Gets the ID of the chronology.
      * <p>
      * The ID uniquely identifies the {@code Chronology}. It can be used to
-     * lookup the {@code Chronology} using {@link #of(String)}.
+     * lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID, non-null
      * @see #getCalendarType()
@@ -409,7 +409,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the calendar system type; non-null if the calendar has
      *    a standard type, otherwise null
--- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Mon May 12 17:01:57 2014 -0700
@@ -143,7 +143,7 @@
      * Gets the ID of the chronology - 'ISO'.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID - 'ISO'
      * @see #getCalendarType()
@@ -158,7 +158,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      * It can also be used as part of a locale, accessible via
      * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
      *
--- a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Mon May 12 17:01:57 2014 -0700
@@ -150,7 +150,7 @@
      * Gets the ID of the chronology - 'Japanese'.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID - 'Japanese'
      * @see #getCalendarType()
@@ -165,7 +165,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      * It can also be used as part of a locale, accessible via
      * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
      *
--- a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Mon May 12 17:01:57 2014 -0700
@@ -132,7 +132,7 @@
      * Gets the ID of the chronology - 'Minguo'.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID - 'Minguo'
      * @see #getCalendarType()
@@ -147,7 +147,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      * It can also be used as part of a locale, accessible via
      * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
      *
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Mon May 12 17:01:57 2014 -0700
@@ -168,7 +168,7 @@
      * Gets the ID of the chronology - 'ThaiBuddhist'.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID - 'ThaiBuddhist'
      * @see #getCalendarType()
@@ -183,7 +183,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      * It can also be used as part of a locale, accessible via
      * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
      *
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java	Mon May 12 17:01:57 2014 -0700
@@ -117,7 +117,7 @@
  * {@code parse(CharSequence text, DateTimeFormatter formatter)}.
  * <p>For example:
  * <blockquote><pre>
- *  String text = date.toString(formatter);
+ *  String text = date.format(formatter);
  *  LocalDate date = LocalDate.parse(text, formatter);
  * </pre></blockquote>
  * <p>
@@ -266,7 +266,7 @@
  * For example:
  * <blockquote><pre>
  *  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd");
- *  String text = date.toString(formatter);
+ *  String text = date.format(formatter);
  *  LocalDate date = LocalDate.parse(text, formatter);
  * </pre></blockquote>
  * <p>
@@ -1976,7 +1976,7 @@
      * Errors are returned using the error index field of the {@code ParsePosition}
      * instead of {@code DateTimeParseException}.
      * The returned error index will be set to an index indicative of the error.
-     * Callers must check for errors before using the context.
+     * Callers must check for errors before using the result.
      * <p>
      * If the formatter parses the same field more than once with different values,
      * the result will be an error.
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Mon May 12 17:01:57 2014 -0700
@@ -137,7 +137,6 @@
  * <li>ChronologyText - the name of the chronology</li>
  * <li>Literal - a text literal</li>
  * <li>Nested and Optional - formats can be nested or made optional</li>
- * <li>Other - the printer and parser interfaces can be used to add user supplied formatting</li>
  * </ul>
  * In addition, any of the elements may be decorated by padding, either with spaces or any other character.
  * <p>
@@ -194,8 +193,8 @@
      * The locale and chronology are used to lookup the locale specific format
      * for the requested dateStyle and/or timeStyle.
      *
-     * @param dateStyle  the FormatStyle for the date
-     * @param timeStyle  the FormatStyle for the time
+     * @param dateStyle  the FormatStyle for the date, null for time-only pattern
+     * @param timeStyle  the FormatStyle for the time, null for date-only pattern
      * @param chrono  the Chronology, non-null
      * @param locale  the locale, non-null
      * @return the locale and Chronology specific formatting pattern
@@ -747,9 +746,9 @@
      * defines the connection between each value and the text:
      * <pre>
      * Map&lt;Long, String&gt; map = new HashMap&lt;&gt;();
-     * map.put(1, "JNY");
-     * map.put(2, "FBY");
-     * map.put(3, "MCH");
+     * map.put(1L, "JNY");
+     * map.put(2L, "FBY");
+     * map.put(3L, "MCH");
      * ...
      * builder.appendText(MONTH_OF_YEAR, map);
      * </pre>
@@ -841,7 +840,7 @@
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
      * The end-of-day time of '24:00' is handled as midnight at the start of the following day.
-     * The leap-second time of '23:59:59' is handled to some degree, see
+     * The leap-second time of '23:59:60' is handled to some degree, see
      * {@link DateTimeFormatter#parsedLeapSecond()} for full details.
      * <p>
      * An alternative to this method is to format/parse the instant as a single
@@ -864,7 +863,7 @@
      * Appends the zone offset, such as '+01:00', to the formatter.
      * <p>
      * This appends an instruction to format/parse the offset ID to the builder.
-     * This is equivalent to calling {@code appendOffset("HH:MM:ss", "Z")}.
+     * This is equivalent to calling {@code appendOffset("+HH:MM:ss", "Z")}.
      *
      * @return this, for chaining, not null
      */
@@ -1049,7 +1048,7 @@
      *   "GMT+01:30"               -- ZoneOffset.of("+01:30")
      * </pre>
      * <p>
-     * Note that this method is is identical to {@code appendZoneId()} except
+     * Note that this method is identical to {@code appendZoneId()} except
      * in the mechanism used to obtain the zone.
      * Note also that parsing accepts offsets, whereas formatting will never
      * produce one.
@@ -1107,7 +1106,7 @@
      *   "GMT+01:30"               -- ZoneOffset.of("GMT+01:30")
      * </pre>
      * <p>
-     * Note that this method is is identical to {@code appendZoneId()} except
+     * Note that this method is identical to {@code appendZoneId()} except
      * in the mechanism used to obtain the zone.
      *
      * @return this, for chaining, not null
@@ -1132,7 +1131,7 @@
      * for the locale set in the {@link DateTimeFormatter}.
      * If the temporal object being printed represents an instant, then the text
      * will be the summer or winter time text as appropriate.
-     * If the lookup for text does not find any suitable reuslt, then the
+     * If the lookup for text does not find any suitable result, then the
      * {@link ZoneId#getId() ID} will be printed instead.
      * If the zone cannot be obtained then an exception is thrown unless the
      * section of the formatter is optional.
@@ -1168,7 +1167,7 @@
      * for the locale set in the {@link DateTimeFormatter}.
      * If the temporal object being printed represents an instant, then the text
      * will be the summer or winter time text as appropriate.
-     * If the lookup for text does not find any suitable reuslt, then the
+     * If the lookup for text does not find any suitable result, then the
      * {@link ZoneId#getId() ID} will be printed instead.
      * If the zone cannot be obtained then an exception is thrown unless the
      * section of the formatter is optional.
@@ -1182,7 +1181,7 @@
      * zone. This method also allows a set of preferred {@link ZoneId} to be
      * specified for parsing. The matched preferred zone id will be used if the
      * textural zone name being parsed is not unique.
-     *
+     * <p>
      * If the zone cannot be parsed then an exception is thrown unless the
      * section of the formatter is optional.
      *
@@ -1227,7 +1226,6 @@
      * <p>
      * The calendar system name will be output during a format.
      * If the chronology cannot be obtained then an exception will be thrown.
-     * The calendar system name is obtained from the Chronology.
      *
      * @param textStyle  the text style to use, not null
      * @return this, for chaining, not null
@@ -1453,7 +1451,7 @@
      *    LLLLL   5      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE)
      *
      *    w       1      append special localized WeekFields element for numeric week-of-year
-     *    ww      1      append special localized WeekFields element for numeric week-of-year, zero-padded
+     *    ww      2      append special localized WeekFields element for numeric week-of-year, zero-padded
      *    W       1      append special localized WeekFields element for numeric week-of-month
      *    d       1      appendValue(ChronoField.DAY_OF_MONTH)
      *    dd      2      appendValue(ChronoField.DAY_OF_MONTH, 2)
@@ -1880,7 +1878,6 @@
      * <p>
      * During parsing, the padding and decorated element are parsed.
      * If parsing is lenient, then the pad width is treated as a maximum.
-     * If parsing is case insensitive, then the pad character is matched ignoring case.
      * The padding is parsed greedily. Thus, if the decorated element starts with
      * the pad character, it will not be parsed.
      *
--- a/jdk/src/share/classes/java/time/format/DecimalStyle.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/format/DecimalStyle.java	Mon May 12 17:01:57 2014 -0700
@@ -62,7 +62,6 @@
 package java.time.format;
 
 import java.text.DecimalFormatSymbols;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Locale;
@@ -138,7 +137,7 @@
      *     of(Locale.getDefault(Locale.Category.FORMAT))}.
      *
      * @see java.util.Locale.Category#FORMAT
-     * @return the info, not null
+     * @return the decimal style, not null
      */
     public static DecimalStyle ofDefaultLocale() {
         return of(Locale.getDefault(Locale.Category.FORMAT));
@@ -150,7 +149,7 @@
      * This method provides access to locale sensitive decimal style symbols.
      *
      * @param locale  the locale, not null
-     * @return the info, not null
+     * @return the decimal style, not null
      */
     public static DecimalStyle of(Locale locale) {
         Objects.requireNonNull(locale, "locale");
@@ -340,7 +339,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Checks if this DecimalStyle is equal another DecimalStyle.
+     * Checks if this DecimalStyle is equal to another DecimalStyle.
      *
      * @param obj  the object to check, null returns false
      * @return true if this is equal to the other date
--- a/jdk/src/share/classes/java/time/temporal/IsoFields.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/temporal/IsoFields.java	Mon May 12 17:01:57 2014 -0700
@@ -638,7 +638,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Implementation of the period unit.
+     * Implementation of the unit.
      */
     private static enum Unit implements TemporalUnit {
 
--- a/jdk/src/share/classes/java/time/temporal/Temporal.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/temporal/Temporal.java	Mon May 12 17:01:57 2014 -0700
@@ -157,7 +157,8 @@
      * This adjusts this date-time according to the rules of the specified adjuster.
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * The adjuster is responsible for handling special cases, such as the varying
      * lengths of month and leap years.
@@ -287,7 +288,7 @@
      * This provides equivalent, safe behavior for immutable and mutable implementations.
      *
      * @param amountToAdd  the amount of the specified unit to add, may be negative
-     * @param unit  the unit of the period to add, not null
+     * @param unit  the unit of the amount to add, not null
      * @return an object of the same type with the specified period added, not null
      * @throws DateTimeException if the unit cannot be added
      * @throws UnsupportedTemporalTypeException if the unit is not supported
@@ -359,7 +360,7 @@
      * </pre>
      *
      * @param amountToSubtract  the amount of the specified unit to subtract, may be negative
-     * @param unit  the unit of the period to subtract, not null
+     * @param unit  the unit of the amount to subtract, not null
      * @return an object of the same type with the specified period subtracted, not null
      * @throws DateTimeException if the unit cannot be subtracted
      * @throws UnsupportedTemporalTypeException if the unit is not supported
@@ -378,12 +379,12 @@
      * The start and end points are {@code this} and the specified temporal.
      * The end point is converted to be of the same type as the start point if different.
      * The result will be negative if the end is before the start.
-     * For example, the period in hours between two temporal objects can be
+     * For example, the amount in hours between two temporal objects can be
      * calculated using {@code startTime.until(endTime, HOURS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two temporals.
-     * For example, the period in hours between the times 11:30 and 13:29
+     * For example, the amount in hours between the times 11:30 and 13:29
      * will only be one hour as it is one minute short of two hours.
      * <p>
      * There are two equivalent ways of using this method.
--- a/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java	Mon May 12 17:01:57 2014 -0700
@@ -180,7 +180,7 @@
     /**
      * Gets the value of the specified field as an {@code int}.
      * <p>
-     * This queries the date-time for the value for the specified field.
+     * This queries the date-time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If the date-time cannot return the value, because the field is unsupported or for
      * some other reason, an exception will be thrown.
@@ -229,7 +229,7 @@
     /**
      * Gets the value of the specified field as a {@code long}.
      * <p>
-     * This queries the date-time for the value for the specified field.
+     * This queries the date-time for the value of the specified field.
      * The returned value may be outside the valid range of values for the field.
      * If the date-time cannot return the value, because the field is unsupported or for
      * some other reason, an exception will be thrown.
--- a/jdk/src/share/classes/java/time/temporal/TemporalField.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/temporal/TemporalField.java	Mon May 12 17:01:57 2014 -0700
@@ -116,7 +116,7 @@
      * For example, in the field 'MonthOfYear', the unit is 'Months'.
      * See also {@link #getRangeUnit()}.
      *
-     * @return the period unit defining the base unit of the field, not null
+     * @return the unit defining the base unit of the field, not null
      */
     TemporalUnit getBaseUnit();
 
@@ -130,7 +130,7 @@
      * The range is never null. For example, the 'Year' field is shorthand for
      * 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'.
      *
-     * @return the period unit defining the range of the field, not null
+     * @return the unit defining the range of the field, not null
      */
     TemporalUnit getRangeUnit();
 
@@ -179,7 +179,7 @@
      * Checks if this field is supported by the temporal object.
      * <p>
      * This determines whether the temporal accessor supports this field.
-     * If this returns false, the the temporal cannot be queried for this field.
+     * If this returns false, then the temporal cannot be queried for this field.
      * <p>
      * There are two equivalent ways of using this method.
      * The first is to invoke this method directly.
--- a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java	Mon May 12 17:01:57 2014 -0700
@@ -221,7 +221,7 @@
      * @param temporal  the temporal object to adjust, not null
      * @param amount  the amount of this unit to add, positive or negative
      * @return the adjusted temporal object, not null
-     * @throws DateTimeException if the period cannot be added
+     * @throws DateTimeException if the amount cannot be added
      * @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
      */
     <R extends Temporal> R addTo(R temporal, long amount);
--- a/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Mon May 12 17:01:57 2014 -0700
@@ -83,7 +83,7 @@
  * The discontinuity is normally a gap in spring and an overlap in autumn.
  * {@code ZoneOffsetTransition} models the transition between the two offsets.
  * <p>
- * Gaps occur where there are local date-times that simply do not not exist.
+ * Gaps occur where there are local date-times that simply do not exist.
  * An example would be when the offset changes from {@code +03:00} to {@code +04:00}.
  * This might be described as 'the clocks will move forward one hour tonight at 1am'.
  * <p>
@@ -334,7 +334,7 @@
     /**
      * Does this transition represent a gap in the local time-line.
      * <p>
-     * Gaps occur where there are local date-times that simply do not not exist.
+     * Gaps occur where there are local date-times that simply do not exist.
      * An example would be when the offset changes from {@code +01:00} to {@code +02:00}.
      * This might be described as 'the clocks will move forward one hour tonight at 1am'.
      *
--- a/jdk/src/share/classes/java/util/BitSet.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/util/BitSet.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -696,6 +696,9 @@
      *  <pre> {@code
      * for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
      *     // operate on index i here
+     *     if (i == Integer.MAX_VALUE) {
+     *         break; // or (i+1) would overflow
+     *     }
      * }}</pre>
      *
      * @param  fromIndex the index to start checking from (inclusive)
@@ -1186,10 +1189,12 @@
         int i = nextSetBit(0);
         if (i != -1) {
             b.append(i);
-            for (i = nextSetBit(i+1); i >= 0; i = nextSetBit(i+1)) {
+            while (true) {
+                if (++i < 0) break;
+                if ((i = nextSetBit(i)) < 0) break;
                 int endOfRun = nextClearBit(i);
                 do { b.append(", ").append(i); }
-                while (++i < endOfRun);
+                while (++i != endOfRun);
             }
         }
 
--- a/jdk/src/share/classes/java/util/Hashtable.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/util/Hashtable.java	Mon May 12 17:01:57 2014 -0700
@@ -26,7 +26,6 @@
 package java.util;
 
 import java.io.*;
-import java.util.concurrent.ThreadLocalRandom;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
 import java.util.function.BiFunction;
@@ -92,8 +91,10 @@
  * ConcurrentModificationException}.  Thus, in the face of concurrent
  * modification, the iterator fails quickly and cleanly, rather than risking
  * arbitrary, non-deterministic behavior at an undetermined time in the future.
- * The Enumerations returned by Hashtable's keys and elements methods are
- * <em>not</em> fail-fast.
+ * The Enumerations returned by Hashtable's {@link #keys keys} and
+ * {@link #elements elements} methods are <em>not</em> fail-fast; if the
+ * Hashtable is structurally modified at any time after the enumeration is
+ * created then the results of enumerating are undefined.
  *
  * <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
@@ -115,6 +116,9 @@
  * to use {@link java.util.concurrent.ConcurrentHashMap} in place of
  * {@code Hashtable}.
  *
+ * @param <K> the type of keys maintained by this map
+ * @param <V> the type of mapped values
+ *
  * @author  Arthur van Hoff
  * @author  Josh Bloch
  * @author  Neal Gafter
@@ -246,6 +250,9 @@
 
     /**
      * Returns an enumeration of the keys in this hashtable.
+     * Use the Enumeration methods on the returned object to fetch the keys
+     * sequentially. If the hashtable is structurally modified while enumerating
+     * over the keys then the results of enumerating are undefined.
      *
      * @return  an enumeration of the keys in this hashtable.
      * @see     Enumeration
@@ -260,7 +267,8 @@
     /**
      * Returns an enumeration of the values in this hashtable.
      * Use the Enumeration methods on the returned object to fetch the elements
-     * sequentially.
+     * sequentially. If the hashtable is structurally modified while enumerating
+     * over the values then the results of enumerating are undefined.
      *
      * @return  an enumeration of the values in this hashtable.
      * @see     java.util.Enumeration
@@ -417,8 +425,6 @@
     }
 
     private void addEntry(int hash, K key, V value, int index) {
-        modCount++;
-
         Entry<?,?> tab[] = table;
         if (count >= threshold) {
             // Rehash the table if the threshold is exceeded
@@ -434,6 +440,7 @@
         Entry<K,V> e = (Entry<K,V>) tab[index];
         tab[index] = new Entry<>(hash, key, value, e);
         count++;
+        modCount++;
     }
 
     /**
@@ -494,12 +501,12 @@
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for(Entry<K,V> prev = null ; e != null ; prev = e, e = e.next) {
             if ((e.hash == hash) && e.key.equals(key)) {
-                modCount++;
                 if (prev != null) {
                     prev.next = e.next;
                 } else {
                     tab[index] = e.next;
                 }
+                modCount++;
                 count--;
                 V oldValue = e.value;
                 e.value = null;
@@ -528,9 +535,9 @@
      */
     public synchronized void clear() {
         Entry<?,?> tab[] = table;
-        modCount++;
         for (int index = tab.length; --index >= 0; )
             tab[index] = null;
+        modCount++;
         count = 0;
     }
 
@@ -719,14 +726,14 @@
             Entry<K,V> e = (Entry<K,V>)tab[index];
             for(Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
                 if (e.hash==hash && e.equals(entry)) {
-                    modCount++;
                     if (prev != null)
                         prev.next = e.next;
                     else
                         tab[index] = e.next;
 
+                    e.value = null; // clear for gc.
+                    modCount++;
                     count--;
-                    e.value = null;
                     return true;
                 }
             }
@@ -939,14 +946,14 @@
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
             if ((e.hash == hash) && e.key.equals(key) && e.value.equals(value)) {
-                modCount++;
                 if (prev != null) {
                     prev.next = e.next;
                 } else {
                     tab[index] = e.next;
                 }
+                e.value = null; // clear for gc
+                modCount++;
                 count--;
-                e.value = null;
                 return true;
             }
         }
@@ -1030,12 +1037,12 @@
             if (e.hash == hash && e.key.equals(key)) {
                 V newValue = remappingFunction.apply(key, e.value);
                 if (newValue == null) {
-                    modCount++;
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
+                    modCount++;
                     count--;
                 } else {
                     e.value = newValue;
@@ -1059,12 +1066,12 @@
             if (e.hash == hash && Objects.equals(e.key, key)) {
                 V newValue = remappingFunction.apply(key, e.value);
                 if (newValue == null) {
-                    modCount++;
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
+                    modCount++;
                     count--;
                 } else {
                     e.value = newValue;
@@ -1094,12 +1101,12 @@
             if (e.hash == hash && e.key.equals(key)) {
                 V newValue = remappingFunction.apply(e.value, value);
                 if (newValue == null) {
-                    modCount++;
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
+                    modCount++;
                     count--;
                 } else {
                     e.value = newValue;
@@ -1298,24 +1305,24 @@
      * by passing an Enumeration.
      */
     private class Enumerator<T> implements Enumeration<T>, Iterator<T> {
-        Entry<?,?>[] table = Hashtable.this.table;
+        final Entry<?,?>[] table = Hashtable.this.table;
         int index = table.length;
         Entry<?,?> entry;
         Entry<?,?> lastReturned;
-        int type;
+        final int type;
 
         /**
          * Indicates whether this Enumerator is serving as an Iterator
          * or an Enumeration.  (true -> Iterator).
          */
-        boolean iterator;
+        final boolean iterator;
 
         /**
          * The modCount value that the iterator believes that the backing
          * Hashtable should have.  If this expectation is violated, the iterator
          * has detected concurrent modification.
          */
-        protected int expectedModCount = modCount;
+        protected int expectedModCount = Hashtable.this.modCount;
 
         Enumerator(int type, boolean iterator) {
             this.type = type;
@@ -1360,7 +1367,7 @@
         }
 
         public T next() {
-            if (modCount != expectedModCount)
+            if (Hashtable.this.modCount != expectedModCount)
                 throw new ConcurrentModificationException();
             return nextElement();
         }
@@ -1381,14 +1388,14 @@
                 Entry<K,V> e = (Entry<K,V>)tab[index];
                 for(Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
                     if (e == lastReturned) {
-                        modCount++;
-                        expectedModCount++;
                         if (prev == null)
                             tab[index] = e.next;
                         else
                             prev.next = e.next;
-                        count--;
+                        expectedModCount++;
                         lastReturned = null;
+                        Hashtable.this.modCount++;
+                        Hashtable.this.count--;
                         return;
                     }
                 }
--- a/jdk/src/share/classes/java/util/Locale.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/util/Locale.java	Mon May 12 17:01:57 2014 -0700
@@ -2904,8 +2904,8 @@
                 for (int i = 1; i < subtags.length; i++) {
                     if (isSubtagIllFormed(subtags[i], false)) {
                         isIllFormed = true;
+                        break;
                     }
-                    break;
                 }
             }
             if (isIllFormed) {
--- a/jdk/src/share/classes/java/util/Vector.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/util/Vector.java	Mon May 12 17:01:57 2014 -0700
@@ -56,7 +56,9 @@
  * concurrent modification, the iterator fails quickly and cleanly, rather
  * than risking arbitrary, non-deterministic behavior at an undetermined
  * time in the future.  The {@link Enumeration Enumerations} returned by
- * the {@link #elements() elements} method are <em>not</em> fail-fast.
+ * the {@link #elements() elements} method are <em>not</em> fail-fast; if the
+ * Vector is structurally modified at any time after the enumeration is
+ * created then the results of enumerating are undefined.
  *
  * <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
@@ -74,6 +76,8 @@
  * implementation is not needed, it is recommended to use {@link
  * ArrayList} in place of {@code Vector}.
  *
+ * @param <E> Type of component elements
+ *
  * @author  Lee Boynton
  * @author  Jonathan Payne
  * @see Collection
@@ -330,7 +334,9 @@
      * Returns an enumeration of the components of this vector. The
      * returned {@code Enumeration} object will generate all items in
      * this vector. The first item generated is the item at index {@code 0},
-     * then the item at index {@code 1}, and so on.
+     * then the item at index {@code 1}, and so on. If the vector is
+     * structurally modified while enumerating over the elements then the
+     * results of enumerating are undefined.
      *
      * @return  an enumeration of the components of this vector
      * @see     Iterator
@@ -553,7 +559,6 @@
      *         ({@code index < 0 || index >= size()})
      */
     public synchronized void removeElementAt(int index) {
-        modCount++;
         if (index >= elementCount) {
             throw new ArrayIndexOutOfBoundsException(index + " >= " +
                                                      elementCount);
@@ -565,6 +570,7 @@
         if (j > 0) {
             System.arraycopy(elementData, index + 1, elementData, index, j);
         }
+        modCount++;
         elementCount--;
         elementData[elementCount] = null; /* to let gc do its work */
     }
@@ -593,7 +599,6 @@
      *         ({@code index < 0 || index > size()})
      */
     public synchronized void insertElementAt(E obj, int index) {
-        modCount++;
         if (index > elementCount) {
             throw new ArrayIndexOutOfBoundsException(index
                                                      + " > " + elementCount);
@@ -601,6 +606,7 @@
         ensureCapacityHelper(elementCount + 1);
         System.arraycopy(elementData, index, elementData, index + 1, elementCount - index);
         elementData[index] = obj;
+        modCount++;
         elementCount++;
     }
 
@@ -616,8 +622,8 @@
      * @param   obj   the component to be added
      */
     public synchronized void addElement(E obj) {
+        ensureCapacityHelper(elementCount + 1);
         modCount++;
-        ensureCapacityHelper(elementCount + 1);
         elementData[elementCount++] = obj;
     }
 
@@ -653,11 +659,11 @@
      * method (which is part of the {@link List} interface).
      */
     public synchronized void removeAllElements() {
-        modCount++;
         // Let gc do its work
         for (int i = 0; i < elementCount; i++)
             elementData[i] = null;
 
+        modCount++;
         elementCount = 0;
     }
 
@@ -705,12 +711,15 @@
      * of the Vector <em>only</em> if the caller knows that the Vector
      * does not contain any null elements.)
      *
+     * @param <T> type of array elements. The same type as {@code <E>} or a
+     * supertype of {@code <E>}.
      * @param a the array into which the elements of the Vector are to
      *          be stored, if it is big enough; otherwise, a new array of the
      *          same runtime type is allocated for this purpose.
      * @return an array containing the elements of the Vector
-     * @throws ArrayStoreException if the runtime type of a is not a supertype
-     * of the runtime type of every element in this Vector
+     * @throws ArrayStoreException if the runtime type of a, {@code <T>}, is not
+     * a supertype of the runtime type, {@code <E>}, of every element in this
+     * Vector
      * @throws NullPointerException if the given array is null
      * @since 1.2
      */
@@ -778,8 +787,8 @@
      * @since 1.2
      */
     public synchronized boolean add(E e) {
+        ensureCapacityHelper(elementCount + 1);
         modCount++;
-        ensureCapacityHelper(elementCount + 1);
         elementData[elementCount++] = e;
         return true;
     }
@@ -879,14 +888,18 @@
      * @throws NullPointerException if the specified collection is null
      * @since 1.2
      */
-    public synchronized boolean addAll(Collection<? extends E> c) {
-        modCount++;
+    public boolean addAll(Collection<? extends E> c) {
         Object[] a = c.toArray();
         int numNew = a.length;
-        ensureCapacityHelper(elementCount + numNew);
-        System.arraycopy(a, 0, elementData, elementCount, numNew);
-        elementCount += numNew;
-        return numNew != 0;
+        if (numNew > 0) {
+            synchronized (this) {
+                ensureCapacityHelper(elementCount + numNew);
+                System.arraycopy(a, 0, elementData, elementCount, numNew);
+                modCount++;
+                elementCount += numNew;
+            }
+        }
+        return numNew > 0;
     }
 
     /**
@@ -951,22 +964,25 @@
      * @since 1.2
      */
     public synchronized boolean addAll(int index, Collection<? extends E> c) {
-        modCount++;
         if (index < 0 || index > elementCount)
             throw new ArrayIndexOutOfBoundsException(index);
 
         Object[] a = c.toArray();
         int numNew = a.length;
-        ensureCapacityHelper(elementCount + numNew);
+
+        if (numNew > 0) {
+            ensureCapacityHelper(elementCount + numNew);
 
-        int numMoved = elementCount - index;
-        if (numMoved > 0)
-            System.arraycopy(elementData, index, elementData, index + numNew,
-                             numMoved);
+            int numMoved = elementCount - index;
+            if (numMoved > 0)
+                System.arraycopy(elementData, index, elementData,
+                        index + numNew, numMoved);
 
-        System.arraycopy(a, 0, elementData, index, numNew);
-        elementCount += numNew;
-        return numNew != 0;
+             System.arraycopy(a, 0, elementData, index, numNew);
+             elementCount += numNew;
+             modCount++;
+        }
+        return numNew > 0;
     }
 
     /**
@@ -1047,12 +1063,12 @@
      * (If {@code toIndex==fromIndex}, this operation has no effect.)
      */
     protected synchronized void removeRange(int fromIndex, int toIndex) {
-        modCount++;
         int numMoved = elementCount - toIndex;
         System.arraycopy(elementData, toIndex, elementData, fromIndex,
                          numMoved);
 
         // Let gc do its work
+        modCount++;
         int newElementCount = elementCount - (toIndex-fromIndex);
         while (elementCount != newElementCount)
             elementData[--elementCount] = null;
@@ -1420,7 +1436,7 @@
         }
 
         public long estimateSize() {
-            return (long) (getFence() - index);
+            return getFence() - index;
         }
 
         public int characteristics() {
--- a/jdk/src/share/classes/java/util/stream/SortedOps.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/SortedOps.java	Mon May 12 17:01:57 2014 -0700
@@ -279,16 +279,60 @@
     }
 
     /**
+     * Abstract {@link Sink} for implementing sort on reference streams.
+     *
+     * <p>
+     * Note: documentation below applies to reference and all primitive sinks.
+     * <p>
+     * Sorting sinks first accept all elements, buffering then into an array
+     * or a re-sizable data structure, if the size of the pipeline is known or
+     * unknown respectively.  At the end of the sink protocol those elements are
+     * sorted and then pushed downstream.
+     * This class records if {@link #cancellationRequested} is called.  If so it
+     * can be inferred that the source pushing source elements into the pipeline
+     * knows that the pipeline is short-circuiting.  In such cases sub-classes
+     * pushing elements downstream will preserve the short-circuiting protocol
+     * by calling {@code downstream.cancellationRequested()} and checking the
+     * result is {@code false} before an element is pushed.
+     * <p>
+     * Note that the above behaviour is an optimization for sorting with
+     * sequential streams.  It is not an error that more elements, than strictly
+     * required to produce a result, may flow through the pipeline.  This can
+     * occur, in general (not restricted to just sorting), for short-circuiting
+     * parallel pipelines.
+     */
+    private static abstract class AbstractRefSortingSink<T> extends Sink.ChainedReference<T, T> {
+        protected final Comparator<? super T> comparator;
+        // @@@ could be a lazy final value, if/when support is added
+        protected boolean cancellationWasRequested;
+
+        AbstractRefSortingSink(Sink<? super T> downstream, Comparator<? super T> comparator) {
+            super(downstream);
+            this.comparator = comparator;
+        }
+
+        /**
+         * Records is cancellation is requested so short-circuiting behaviour
+         * can be preserved when the sorted elements are pushed downstream.
+         *
+         * @return false, as this sink never short-circuits.
+         */
+        @Override
+        public final boolean cancellationRequested() {
+            cancellationWasRequested = true;
+            return false;
+        }
+    }
+
+    /**
      * {@link Sink} for implementing sort on SIZED reference streams.
      */
-    private static final class SizedRefSortingSink<T> extends Sink.ChainedReference<T, T> {
-        private final Comparator<? super T> comparator;
+    private static final class SizedRefSortingSink<T> extends AbstractRefSortingSink<T> {
         private T[] array;
         private int offset;
 
         SizedRefSortingSink(Sink<? super T> sink, Comparator<? super T> comparator) {
-            super(sink);
-            this.comparator = comparator;
+            super(sink, comparator);
         }
 
         @Override
@@ -303,8 +347,14 @@
         public void end() {
             Arrays.sort(array, 0, offset, comparator);
             downstream.begin(offset);
-            for (int i = 0; i < offset; i++)
-                downstream.accept(array[i]);
+            if (!cancellationWasRequested) {
+                for (int i = 0; i < offset; i++)
+                    downstream.accept(array[i]);
+            }
+            else {
+                for (int i = 0; i < offset && !downstream.cancellationRequested(); i++)
+                    downstream.accept(array[i]);
+            }
             downstream.end();
             array = null;
         }
@@ -318,13 +368,11 @@
     /**
      * {@link Sink} for implementing sort on reference streams.
      */
-    private static final class RefSortingSink<T> extends Sink.ChainedReference<T, T> {
-        private final Comparator<? super T> comparator;
+    private static final class RefSortingSink<T> extends AbstractRefSortingSink<T> {
         private ArrayList<T> list;
 
         RefSortingSink(Sink<? super T> sink, Comparator<? super T> comparator) {
-            super(sink);
-            this.comparator = comparator;
+            super(sink, comparator);
         }
 
         @Override
@@ -338,7 +386,15 @@
         public void end() {
             list.sort(comparator);
             downstream.begin(list.size());
-            list.forEach(downstream::accept);
+            if (!cancellationWasRequested) {
+                list.forEach(downstream::accept);
+            }
+            else {
+                for (T t : list) {
+                    if (downstream.cancellationRequested()) break;
+                    downstream.accept(t);
+                }
+            }
             downstream.end();
             list = null;
         }
@@ -350,9 +406,26 @@
     }
 
     /**
+     * Abstract {@link Sink} for implementing sort on int streams.
+     */
+    private static abstract class AbstractIntSortingSink extends Sink.ChainedInt<Integer> {
+        protected boolean cancellationWasRequested;
+
+        AbstractIntSortingSink(Sink<? super Integer> downstream) {
+            super(downstream);
+        }
+
+        @Override
+        public final boolean cancellationRequested() {
+            cancellationWasRequested = true;
+            return false;
+        }
+    }
+
+    /**
      * {@link Sink} for implementing sort on SIZED int streams.
      */
-    private static final class SizedIntSortingSink extends Sink.ChainedInt<Integer> {
+    private static final class SizedIntSortingSink extends AbstractIntSortingSink {
         private int[] array;
         private int offset;
 
@@ -371,8 +444,14 @@
         public void end() {
             Arrays.sort(array, 0, offset);
             downstream.begin(offset);
-            for (int i = 0; i < offset; i++)
-                downstream.accept(array[i]);
+            if (!cancellationWasRequested) {
+                for (int i = 0; i < offset; i++)
+                    downstream.accept(array[i]);
+            }
+            else {
+                for (int i = 0; i < offset && !downstream.cancellationRequested(); i++)
+                    downstream.accept(array[i]);
+            }
             downstream.end();
             array = null;
         }
@@ -386,7 +465,7 @@
     /**
      * {@link Sink} for implementing sort on int streams.
      */
-    private static final class IntSortingSink extends Sink.ChainedInt<Integer> {
+    private static final class IntSortingSink extends AbstractIntSortingSink {
         private SpinedBuffer.OfInt b;
 
         IntSortingSink(Sink<? super Integer> sink) {
@@ -405,8 +484,16 @@
             int[] ints = b.asPrimitiveArray();
             Arrays.sort(ints);
             downstream.begin(ints.length);
-            for (int anInt : ints)
-                downstream.accept(anInt);
+            if (!cancellationWasRequested) {
+                for (int anInt : ints)
+                    downstream.accept(anInt);
+            }
+            else {
+                for (int anInt : ints) {
+                    if (downstream.cancellationRequested()) break;
+                    downstream.accept(anInt);
+                }
+            }
             downstream.end();
         }
 
@@ -417,9 +504,26 @@
     }
 
     /**
+     * Abstract {@link Sink} for implementing sort on long streams.
+     */
+    private static abstract class AbstractLongSortingSink extends Sink.ChainedLong<Long> {
+        protected boolean cancellationWasRequested;
+
+        AbstractLongSortingSink(Sink<? super Long> downstream) {
+            super(downstream);
+        }
+
+        @Override
+        public final boolean cancellationRequested() {
+            cancellationWasRequested = true;
+            return false;
+        }
+    }
+
+    /**
      * {@link Sink} for implementing sort on SIZED long streams.
      */
-    private static final class SizedLongSortingSink extends Sink.ChainedLong<Long> {
+    private static final class SizedLongSortingSink extends AbstractLongSortingSink {
         private long[] array;
         private int offset;
 
@@ -438,8 +542,14 @@
         public void end() {
             Arrays.sort(array, 0, offset);
             downstream.begin(offset);
-            for (int i = 0; i < offset; i++)
-                downstream.accept(array[i]);
+            if (!cancellationWasRequested) {
+                for (int i = 0; i < offset; i++)
+                    downstream.accept(array[i]);
+            }
+            else {
+                for (int i = 0; i < offset && !downstream.cancellationRequested(); i++)
+                    downstream.accept(array[i]);
+            }
             downstream.end();
             array = null;
         }
@@ -453,7 +563,7 @@
     /**
      * {@link Sink} for implementing sort on long streams.
      */
-    private static final class LongSortingSink extends Sink.ChainedLong<Long> {
+    private static final class LongSortingSink extends AbstractLongSortingSink {
         private SpinedBuffer.OfLong b;
 
         LongSortingSink(Sink<? super Long> sink) {
@@ -472,8 +582,16 @@
             long[] longs = b.asPrimitiveArray();
             Arrays.sort(longs);
             downstream.begin(longs.length);
-            for (long aLong : longs)
-                downstream.accept(aLong);
+            if (!cancellationWasRequested) {
+                for (long aLong : longs)
+                    downstream.accept(aLong);
+            }
+            else {
+                for (long aLong : longs) {
+                    if (downstream.cancellationRequested()) break;
+                    downstream.accept(aLong);
+                }
+            }
             downstream.end();
         }
 
@@ -484,9 +602,26 @@
     }
 
     /**
+     * Abstract {@link Sink} for implementing sort on long streams.
+     */
+    private static abstract class AbstractDoubleSortingSink extends Sink.ChainedDouble<Double> {
+        protected boolean cancellationWasRequested;
+
+        AbstractDoubleSortingSink(Sink<? super Double> downstream) {
+            super(downstream);
+        }
+
+        @Override
+        public final boolean cancellationRequested() {
+            cancellationWasRequested = true;
+            return false;
+        }
+    }
+
+    /**
      * {@link Sink} for implementing sort on SIZED double streams.
      */
-    private static final class SizedDoubleSortingSink extends Sink.ChainedDouble<Double> {
+    private static final class SizedDoubleSortingSink extends AbstractDoubleSortingSink {
         private double[] array;
         private int offset;
 
@@ -505,8 +640,14 @@
         public void end() {
             Arrays.sort(array, 0, offset);
             downstream.begin(offset);
-            for (int i = 0; i < offset; i++)
-                downstream.accept(array[i]);
+            if (!cancellationWasRequested) {
+                for (int i = 0; i < offset; i++)
+                    downstream.accept(array[i]);
+            }
+            else {
+                for (int i = 0; i < offset && !downstream.cancellationRequested(); i++)
+                    downstream.accept(array[i]);
+            }
             downstream.end();
             array = null;
         }
@@ -520,7 +661,7 @@
     /**
      * {@link Sink} for implementing sort on double streams.
      */
-    private static final class DoubleSortingSink extends Sink.ChainedDouble<Double> {
+    private static final class DoubleSortingSink extends AbstractDoubleSortingSink {
         private SpinedBuffer.OfDouble b;
 
         DoubleSortingSink(Sink<? super Double> sink) {
@@ -539,8 +680,16 @@
             double[] doubles = b.asPrimitiveArray();
             Arrays.sort(doubles);
             downstream.begin(doubles.length);
-            for (double aDouble : doubles)
-                downstream.accept(aDouble);
+            if (!cancellationWasRequested) {
+                for (double aDouble : doubles)
+                    downstream.accept(aDouble);
+            }
+            else {
+                for (double aDouble : doubles) {
+                    if (downstream.cancellationRequested()) break;
+                    downstream.accept(aDouble);
+                }
+            }
             downstream.end();
         }
 
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java	Mon May 12 17:01:57 2014 -0700
@@ -153,6 +153,8 @@
          * Fetch the default value for the attribute.
          * If there is no default value (such as for
          * composite attributes), null will be returned.
+         *
+         * @return default value for the attribute
          */
         public String getDefaultValue() {
             return defaultValue;
@@ -161,6 +163,8 @@
         /**
          * Indicates if the attribute should be inherited
          * from the parent or not.
+         *
+         * @return true if the attribute should be inherited from the parent
          */
         public boolean isInherited() {
             return inherited;
@@ -1036,6 +1040,8 @@
 
     /**
      * Return the set of all possible CSS attribute keys.
+     *
+     * @return the set of all possible CSS attribute keys
      */
     public static Attribute[] getAllAttributeKeys() {
         Attribute[] keys = new Attribute[Attribute.allAttributes.length];
--- a/jdk/src/share/classes/javax/swing/text/html/FormView.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java	Mon May 12 17:01:57 2014 -0700
@@ -448,6 +448,8 @@
     /**
      * This method is responsible for submitting the form data.
      * A thread is forked to undertake the submission.
+     *
+     * @param data data to submit
      */
     protected void submitData(String data) {
         Element form = getFormElement();
--- a/jdk/src/share/classes/javax/swing/text/html/HTML.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/html/HTML.java	Mon May 12 17:01:57 2014 -0700
@@ -571,6 +571,9 @@
      * are recognized by the default HTML reader.
      * This set does not include tags that are
      * manufactured by the reader.
+     *
+     * @return the set of actual HTML tags that
+     * are recognized by the default HTML reader
      */
     public static Tag[] getAllTags() {
         Tag[] tags = new Tag[Tag.allTags.length];
@@ -626,6 +629,7 @@
      * @param key the key to use to fetch the value
      * @param def the default value to use if the attribute isn't
      *  defined or there is an error converting to an integer
+     * @return an attribute value
      */
     public static int getIntegerAttributeValue(AttributeSet attr,
                                                Attribute key, int def) {
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java	Mon May 12 17:01:57 2014 -0700
@@ -339,6 +339,7 @@
      * <p>This is a convenience method for
      * <code>getReader(int, int, int, HTML.Tag, TRUE)</code>.
      *
+     * @param pos the starting position
      * @param popDepth   the number of <code>ElementSpec.EndTagTypes</code>
      *          to generate before inserting
      * @param pushDepth  the number of <code>ElementSpec.StartTagTypes</code>
@@ -1022,6 +1023,9 @@
      * @throws IllegalArgumentException if <code>elem</code> is a leaf
      * @throws IllegalStateException if an <code>HTMLEditorKit.Parser</code>
      *         has not been defined
+     * @throws BadLocationException if replacement is impossible because of
+     *         a structural issue
+     * @throws IOException if an I/O exception occurs
      * @since 1.3
      */
     public void setInnerHTML(Element elem, String htmlText) throws
@@ -1099,6 +1103,9 @@
      * @param htmlText the string to be parsed and inserted in place of <code>elem</code>
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set
+     * @throws BadLocationException if replacement is impossible because of
+     *         a structural issue
+     * @throws IOException if an I/O exception occurs
      * @since 1.3
      */
     public void setOuterHTML(Element elem, String htmlText) throws
@@ -1177,6 +1184,9 @@
      * @throws IllegalArgumentException if <code>elem</code> is a leaf
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set on the document
+     * @throws BadLocationException if insertion is impossible because of
+     *         a structural issue
+     * @throws IOException if an I/O exception occurs
      * @since 1.3
      */
     public void insertAfterStart(Element elem, String htmlText) throws
@@ -1247,6 +1257,9 @@
      * @throws IllegalArgumentException if <code>elem</code> is a leaf
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set on the document
+     * @throws BadLocationException if insertion is impossible because of
+     *         a structural issue
+     * @throws IOException if an I/O exception occurs
      * @since 1.3
      */
     public void insertBeforeEnd(Element elem, String htmlText) throws
@@ -1310,6 +1323,9 @@
      * @param htmlText the string to be parsed and inserted before <code>elem</code>
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set on the document
+     * @throws BadLocationException if insertion is impossible because of
+     *         a structural issue
+     * @throws IOException if an I/O exception occurs
      * @since 1.3
      */
     public void insertBeforeStart(Element elem, String htmlText) throws
@@ -1368,6 +1384,9 @@
      * @param htmlText the string to be parsed and inserted after <code>elem</code>
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set on the document
+     * @throws BadLocationException if insertion is impossible because of
+     *         a structural issue
+     * @throws IOException if an I/O exception occurs
      * @since 1.3
      */
     public void insertAfterEnd(Element elem, String htmlText) throws
@@ -1890,6 +1909,7 @@
 
         /**
          * Type of tag this iterator represents.
+         * @return the tag
          */
         public abstract HTML.Tag getTag();
     }
@@ -2171,10 +2191,24 @@
      */
     public class HTMLReader extends HTMLEditorKit.ParserCallback {
 
+        /**
+         * Constructs an HTMLReader using default pop and push depth and no tag to insert.
+         *
+         * @param offset the starting offset
+         */
         public HTMLReader(int offset) {
             this(offset, 0, 0, null);
         }
 
+        /**
+         * Constructs an HTMLReader.
+         *
+         * @param offset the starting offset
+         * @param popDepth how many parents to ascend before insert new element
+         * @param pushDepth how many parents to descend (relative to popDepth) before
+         *                  inserting
+         * @param insertTag a tag to insert (may be null)
+         */
         public HTMLReader(int offset, int popDepth, int pushDepth,
                           HTML.Tag insertTag) {
             this(offset, popDepth, pushDepth, insertTag, true, false, true);
@@ -2742,6 +2776,9 @@
          * all of the well-known tags will have been registered.
          * This can be used to change the handling of a particular
          * tag or to add support for custom tags.
+         *
+         * @param t an HTML tag
+         * @param a tag action handler
          */
         protected void registerTag(HTML.Tag t, TagAction a) {
             tagMap.put(t, a);
@@ -2762,6 +2799,9 @@
              * tag for those actions that are shared across
              * many tags.  By default this does nothing and
              * completely ignores the tag.
+             *
+             * @param t the HTML tag
+             * @param a the attributes
              */
             public void start(HTML.Tag t, MutableAttributeSet a) {
             }
@@ -2773,12 +2813,17 @@
              * tag for those actions that are shared across
              * many tags.  By default this does nothing and
              * completely ignores the tag.
+             *
+             * @param t the HTML tag
              */
             public void end(HTML.Tag t) {
             }
 
         }
 
+        /**
+         * Action assigned by default to handle the Block task of the reader.
+         */
         public class BlockAction extends TagAction {
 
             public void start(HTML.Tag t, MutableAttributeSet attr) {
@@ -2816,6 +2861,9 @@
         }
 
 
+        /**
+         * Action assigned by default to handle the Paragraph task of the reader.
+         */
         public class ParagraphAction extends BlockAction {
 
             public void start(HTML.Tag t, MutableAttributeSet a) {
@@ -2829,6 +2877,9 @@
             }
         }
 
+        /**
+         * Action assigned by default to handle the Special task of the reader.
+         */
         public class SpecialAction extends TagAction {
 
             public void start(HTML.Tag t, MutableAttributeSet a) {
@@ -2848,6 +2899,9 @@
         }
 
 
+        /**
+         * Action assigned by default to handle the Hidden task of the reader.
+         */
         public class HiddenAction extends TagAction {
 
             public void start(HTML.Tag t, MutableAttributeSet a) {
@@ -3093,6 +3147,9 @@
             }
         }
 
+        /**
+         * Action assigned by default to handle the Character task of the reader.
+         */
         public class CharacterAction extends TagAction {
 
             public void start(HTML.Tag t, MutableAttributeSet attr) {
@@ -3515,6 +3572,8 @@
          * context.  Therefore all text that is seen belongs
          * to the text area and is hence added to the
          * TextAreaDocument associated with the text area.
+         *
+         * @param data the given content
          */
         protected void textAreaContent(char[] data) {
             try {
@@ -3529,6 +3588,8 @@
          * PRE element.  This synthesizes lines to hold the
          * runs of text, and makes calls to addContent to
          * actually add the text.
+         *
+         * @param data the given content
          */
         protected void preContent(char[] data) {
             int last = 0;
@@ -3550,6 +3611,9 @@
         /**
          * Adds an instruction to the parse buffer to create a
          * block element with the given attributes.
+         *
+         * @param t an HTML tag
+         * @param attr the attribute set
          */
         protected void blockOpen(HTML.Tag t, MutableAttributeSet attr) {
             if (impliedP) {
@@ -3574,6 +3638,8 @@
         /**
          * Adds an instruction to the parse buffer to close out
          * a block element of the given type.
+         *
+         * @param t the HTML tag
          */
         protected void blockClose(HTML.Tag t) {
             inBlock--;
@@ -3672,6 +3738,9 @@
         /**
          * Adds content that is basically specified entirely
          * in the attribute set.
+         *
+         * @param t an HTML tag
+         * @param a the attribute set
          */
         protected void addSpecialElement(HTML.Tag t, MutableAttributeSet a) {
             if ((t != HTML.Tag.FRAME) && (! inParagraph) && (! inPre)) {
@@ -4049,7 +4118,13 @@
          */
         Option option;
 
+        /**
+         * Buffer to keep building elements.
+         */
         protected Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>();
+        /**
+         * Current character attribute set.
+         */
         protected MutableAttributeSet charAttr = new TaggedAttributeSet();
         Stack<AttributeSet> charAttrStack = new Stack<AttributeSet>();
         Hashtable<HTML.Tag, TagAction> tagMap;
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Mon May 12 17:01:57 2014 -0700
@@ -971,6 +971,8 @@
          * Parse the given stream and drive the given callback
          * with the results of the parse.  This method should
          * be implemented to be thread-safe.
+         *
+         * @throws IOException if an I/O exception occurs
          */
         public abstract void parse(Reader r, ParserCallback cb, boolean ignoreCharSet) throws IOException;
 
@@ -1026,6 +1028,8 @@
          * or \r\n, which ever is encountered the most in parsing the
          * stream.
          *
+         * @param eol value of eol
+         *
          * @since 1.3
          */
         public void handleEndOfLineString(String eol) {
@@ -1490,6 +1494,7 @@
         }
 
         /**
+         * @param e the JEditorPane
          * @return HTMLDocument of <code>e</code>.
          */
         protected HTMLDocument getHTMLDocument(JEditorPane e) {
@@ -1501,6 +1506,7 @@
         }
 
         /**
+         * @param e the JEditorPane
          * @return HTMLEditorKit for <code>e</code>.
          */
         protected HTMLEditorKit getHTMLEditorKit(JEditorPane e) {
@@ -1514,6 +1520,10 @@
         /**
          * Returns an array of the Elements that contain <code>offset</code>.
          * The first elements corresponds to the root.
+         *
+         * @param doc an instance of HTMLDocument
+         * @param offset value of offset
+         * @return an array of the Elements that contain <code>offset</code>
          */
         protected Element[] getElementsAt(HTMLDocument doc, int offset) {
             return getElementsAt(doc.getDefaultRootElement(), offset, 0);
@@ -1541,6 +1551,11 @@
          * return -1 if no elements is found representing <code>tag</code>,
          * or 0 if the parent of the leaf at <code>offset</code> represents
          * <code>tag</code>.
+         *
+         * @param doc an instance of HTMLDocument
+         * @param offset an offset to start from
+         * @param tag tag to represent
+         * @return number of elements
          */
         protected int elementCountToTag(HTMLDocument doc, int offset,
                                         HTML.Tag tag) {
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLFrameHyperlinkEvent.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLFrameHyperlinkEvent.java	Mon May 12 17:01:57 2014 -0700
@@ -125,6 +125,8 @@
 
     /**
      * returns the target for the link.
+     *
+     * @return the target for the link
      */
     public String getTarget() {
         return targetFrame;
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java	Mon May 12 17:01:57 2014 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMSignatureMethod.java 1333415 2012-05-03 12:03:51Z coheigea $
@@ -34,10 +34,12 @@
 
 import java.io.IOException;
 import java.security.*;
+import java.security.interfaces.DSAKey;
 import java.security.spec.AlgorithmParameterSpec;
 import org.w3c.dom.Element;
 
 import com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureECDSA;
+import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
 import org.jcp.xml.dsig.internal.SignerOutputStream;
 
 /**
@@ -68,6 +70,8 @@
         "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384";
     static final String ECDSA_SHA512 =
         "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512";
+    static final String DSA_SHA256 =
+        "http://www.w3.org/2009/xmldsig11#dsa-sha256";
 
     /**
      * Creates a <code>DOMSignatureMethod</code>.
@@ -119,6 +123,8 @@
             return new SHA512withRSA(smElem);
         } else if (alg.equals(SignatureMethod.DSA_SHA1)) {
             return new SHA1withDSA(smElem);
+        } else if (alg.equals(DSA_SHA256)) {
+            return new SHA256withDSA(smElem);
         } else if (alg.equals(ECDSA_SHA1)) {
             return new SHA1withECDSA(smElem);
         } else if (alg.equals(ECDSA_SHA256)) {
@@ -178,7 +184,9 @@
         try {
             Type type = getAlgorithmType();
             if (type == Type.DSA) {
-                return signature.verify(convertXMLDSIGtoASN1(sig));
+                int size = ((DSAKey)key).getParams().getQ().bitLength();
+                return signature.verify(JavaUtils.convertDsaXMLDSIGtoASN1(sig,
+                                                                       size/8));
             } else if (type == Type.ECDSA) {
                 return signature.verify(SignatureECDSA.convertXMLDSIGtoASN1(sig));
             } else {
@@ -222,7 +230,9 @@
         try {
             Type type = getAlgorithmType();
             if (type == Type.DSA) {
-                return convertASN1toXMLDSIG(signature.sign());
+                int size = ((DSAKey)key).getParams().getQ().bitLength();
+                return JavaUtils.convertDsaASN1toXMLDSIG(signature.sign(),
+                                                         size/8);
             } else if (type == Type.ECDSA) {
                 return SignatureECDSA.convertASN1toXMLDSIG(signature.sign());
             } else {
@@ -235,101 +245,6 @@
         }
     }
 
-    /**
-     * Converts an ASN.1 DSA value to a XML Signature DSA Value.
-     *
-     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
-     * pairs; the XML Signature requires the core BigInteger values.
-     *
-     * @param asn1Bytes
-     *
-     * @throws IOException
-     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
-     */
-    private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[])
-        throws IOException
-    {
-        byte rLength = asn1Bytes[3];
-        int i;
-
-        for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
-
-        byte sLength = asn1Bytes[5 + rLength];
-        int j;
-
-        for (j = sLength;
-            (j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
-
-        if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
-            || (asn1Bytes[2] != 2) || (i > 20)
-            || (asn1Bytes[4 + rLength] != 2) || (j > 20)) {
-            throw new IOException("Invalid ASN.1 format of DSA signature");
-        } else {
-            byte xmldsigBytes[] = new byte[40];
-
-            System.arraycopy(asn1Bytes, (4+rLength)-i, xmldsigBytes, 20-i, i);
-            System.arraycopy(asn1Bytes, (6+rLength+sLength)-j, xmldsigBytes,
-                             40 - j, j);
-
-            return xmldsigBytes;
-        }
-    }
-
-    /**
-     * Converts a XML Signature DSA Value to an ASN.1 DSA value.
-     *
-     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
-     * pairs; the XML Signature requires the core BigInteger values.
-     *
-     * @param xmldsigBytes
-     *
-     * @throws IOException
-     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
-     */
-    private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[])
-        throws IOException
-    {
-        if (xmldsigBytes.length != 40) {
-            throw new IOException("Invalid XMLDSIG format of DSA signature");
-        }
-
-        int i;
-
-        for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
-
-        int j = i;
-
-        if (xmldsigBytes[20 - i] < 0) {
-            j += 1;
-        }
-
-        int k;
-
-        for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
-
-        int l = k;
-
-        if (xmldsigBytes[40 - k] < 0) {
-            l += 1;
-        }
-
-        byte asn1Bytes[] = new byte[6 + j + l];
-
-        asn1Bytes[0] = 48;
-        asn1Bytes[1] = (byte)(4 + j + l);
-        asn1Bytes[2] = 2;
-        asn1Bytes[3] = (byte)j;
-
-        System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
-
-        asn1Bytes[4 + j] = 2;
-        asn1Bytes[5 + j] = (byte) l;
-
-        System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
-
-        return asn1Bytes;
-    }
-
     static final class SHA1withRSA extends DOMSignatureMethod {
         SHA1withRSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
@@ -425,6 +340,25 @@
         }
     }
 
+    static final class SHA256withDSA extends DOMSignatureMethod {
+        SHA256withDSA(AlgorithmParameterSpec params)
+            throws InvalidAlgorithmParameterException {
+            super(params);
+        }
+        SHA256withDSA(Element dmElem) throws MarshalException {
+            super(dmElem);
+        }
+        public String getAlgorithm() {
+            return DSA_SHA256;
+        }
+        String getJCAAlgorithm() {
+            return "SHA256withDSA";
+        }
+        Type getAlgorithmType() {
+            return Type.DSA;
+        }
+    }
+
     static final class SHA1withECDSA extends DOMSignatureMethod {
         SHA1withECDSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Mon May 12 17:01:57 2014 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMXMLSignatureFactory.java 1333869 2012-05-04 10:42:44Z coheigea $
@@ -239,6 +239,8 @@
             return new DOMSignatureMethod.SHA512withRSA(params);
         } else if (algorithm.equals(SignatureMethod.DSA_SHA1)) {
             return new DOMSignatureMethod.SHA1withDSA(params);
+        } else if (algorithm.equals(DOMSignatureMethod.DSA_SHA256)) {
+            return new DOMSignatureMethod.SHA256withDSA(params);
         } else if (algorithm.equals(SignatureMethod.HMAC_SHA1)) {
             return new DOMHMACSignatureMethod.SHA1(params);
         } else if (algorithm.equals(DOMHMACSignatureMethod.HMAC_SHA256)) {
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java	Mon May 12 17:01:57 2014 -0700
@@ -233,8 +233,6 @@
      *               does not conform to the expected pattern
      */
     public static int getLocalVmId(File file) {
-        int lvmid = 0;
-
         try {
             // try 1.4.2 and later format first
             return Integer.parseInt(file.getName());
@@ -287,31 +285,13 @@
         return tmpDirName + dirNamePrefix + user + File.separator;
     }
 
-    /*
-     * this static initializer would not be necessary if the
-     * Solaris java.io.tmpdir property were set to /tmp by default
-     */
     static {
         /*
-         * Why is java.io.tmpdir on Solaris set to "/var/tmp/" when the
-         * HotSpot JVM os:get_temp_path() method returns "/tmp/"
-         *
-         * Why do Solaris and Windows return a string with a trailing
-         * file separator character where as Linix does not? (this change
-         * seems to have occurred sometime during hopper beta)
+         * For this to work, the target VM and this code need to use
+         * the same directory. Instead of guessing which directory the
+         * VM is using, we will ask.
          */
-        String tmpdir = System.getProperty("java.io.tmpdir");
-
-        if (tmpdir.compareTo("/var/tmp/") == 0) {
-             /*
-              * shared memory files are created in /tmp. Interestingly,
-              * java.io.tmpdir is set to "/var/tmp/" on Solaris and Linux,
-              * but os::get_temp_directory() is set to "/tmp/" on these
-              * platforms. the java.io.logging packages also makes reference
-              * to java.io.tmpdir.
-              */
-             tmpdir = "/tmp/";
-        }
+        String tmpdir = sun.misc.VMSupport.getVMTemporaryDirectory();
 
         /*
          * Assure that the string returned has a trailing File.separator
--- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Mon May 12 17:01:57 2014 -0700
@@ -69,6 +69,14 @@
 
 public enum LauncherHelper {
     INSTANCE;
+
+    // used to identify JavaFX applications
+    private static final String JAVAFX_APPLICATION_MARKER =
+            "JavaFX-Application-Class";
+    private static final String JAVAFX_APPLICATION_CLASS_NAME =
+            "javafx.application.Application";
+    private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX =
+            "sun.launcher.LauncherHelper$FXHelper";
     private static final String MAIN_CLASS = "Main-Class";
 
     private static StringBuilder outBuf = new StringBuilder();
@@ -418,7 +426,8 @@
              * exists to enforce compliance with the jar specification
              */
             if (mainAttrs.containsKey(
-                    new Attributes.Name(FXHelper.JAVAFX_APPLICATION_MARKER))) {
+                    new Attributes.Name(JAVAFX_APPLICATION_MARKER))) {
+                FXHelper.setFXLaunchParameters(jarname, LM_JAR);
                 return FXHelper.class.getName();
             }
 
@@ -516,9 +525,9 @@
          * the main class may or may not have a main method, so do this before
          * validating the main class.
          */
-        if (mainClass.equals(FXHelper.class) ||
-                FXHelper.doesExtendFXApplication(mainClass)) {
-            // Will abort() if there are problems with the FX runtime
+        if (JAVAFX_FXHELPER_CLASS_NAME_SUFFIX.equals(mainClass.getName()) ||
+            doesExtendFXApplication(mainClass)) {
+            // Will abort() if there are problems with FX runtime
             FXHelper.setFXLaunchParameters(what, mode);
             return FXHelper.class;
         }
@@ -537,6 +546,21 @@
         return appClass;
     }
 
+    /*
+     * Check if the given class is a JavaFX Application class. This is done
+     * in a way that does not cause the Application class to load or throw
+     * ClassNotFoundException if the JavaFX runtime is not available.
+     */
+    private static boolean doesExtendFXApplication(Class<?> mainClass) {
+        for (Class<?> sc = mainClass.getSuperclass(); sc != null;
+                sc = sc.getSuperclass()) {
+            if (sc.getName().equals(JAVAFX_APPLICATION_CLASS_NAME)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     // Check the existence and signature of main and abort if incorrect
     static void validateMainClass(Class<?> mainClass) {
         Method mainMethod;
@@ -545,7 +569,7 @@
         } catch (NoSuchMethodException nsme) {
             // invalid main or not FX application, abort with an error
             abort(null, "java.launcher.cls.error4", mainClass.getName(),
-                  FXHelper.JAVAFX_APPLICATION_CLASS_NAME);
+                  JAVAFX_APPLICATION_CLASS_NAME);
             return; // Avoid compiler issues
         }
 
@@ -668,11 +692,7 @@
     }
 
     static final class FXHelper {
-        // Marker entry in jar manifest that designates a JavaFX application jar
-        private static final String JAVAFX_APPLICATION_MARKER =
-                "JavaFX-Application-Class";
-        private static final String JAVAFX_APPLICATION_CLASS_NAME =
-                "javafx.application.Application";
+
         private static final String JAVAFX_LAUNCHER_CLASS_NAME =
                 "com.sun.javafx.application.LauncherImpl";
 
@@ -742,21 +762,6 @@
             }
         }
 
-        /*
-         * Check if the given class is a JavaFX Application class. This is done
-         * in a way that does not cause the Application class to load or throw
-         * ClassNotFoundException if the JavaFX runtime is not available.
-         */
-        private static boolean doesExtendFXApplication(Class<?> mainClass) {
-            for (Class<?> sc = mainClass.getSuperclass(); sc != null;
-                    sc = sc.getSuperclass()) {
-                if (sc.getName().equals(JAVAFX_APPLICATION_CLASS_NAME)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
         public static void main(String... args) throws Exception {
             if (fxLauncherMethod == null
                     || fxLaunchMode == null
--- a/jdk/src/share/classes/sun/misc/VMSupport.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/misc/VMSupport.java	Mon May 12 17:01:57 2014 -0700
@@ -97,4 +97,14 @@
             throw new RuntimeException(ioe.getMessage());
         }
     }
+
+    /*
+     * Return the temporary directory that the VM uses for the attach
+     * and perf data files.
+     *
+     * It is important that this directory is well-known and the
+     * same for all VM instances. It cannot be affected by configuration
+     * variables such as java.io.tmpdir.
+     */
+    public static native String getVMTemporaryDirectory();
 }
--- a/jdk/src/share/classes/sun/nio/fs/AbstractPoller.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/nio/fs/AbstractPoller.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,8 +100,6 @@
         // validate arguments before request to poller
         if (dir == null)
             throw new NullPointerException();
-        if (events.length == 0)
-            throw new IllegalArgumentException("No events to register");
         Set<WatchEvent.Kind<?>> eventSet = new HashSet<>(events.length);
         for (WatchEvent.Kind<?> event: events) {
             // standard events
@@ -114,17 +112,16 @@
             }
 
             // OVERFLOW is ignored
-            if (event == StandardWatchEventKinds.OVERFLOW) {
-                if (events.length == 1)
-                    throw new IllegalArgumentException("No events to register");
+            if (event == StandardWatchEventKinds.OVERFLOW)
                 continue;
-            }
 
             // null/unsupported
             if (event == null)
                 throw new NullPointerException("An element in event set is 'null'");
             throw new UnsupportedOperationException(event.name());
         }
+        if (eventSet.isEmpty())
+            throw new IllegalArgumentException("No events to register");
         return (WatchKey)invoke(RequestType.REGISTER, dir, eventSet, modifiers);
     }
 
@@ -192,14 +189,17 @@
          * the request.
          */
         Object awaitResult() {
+            boolean interrupted = false;
             synchronized (this) {
                 while (!completed) {
                     try {
                         wait();
                     } catch (InterruptedException x) {
-                        // ignore
+                        interrupted = true;
                     }
                 }
+                if (interrupted)
+                    Thread.currentThread().interrupt();
                 return result;
             }
         }
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Mon May 12 17:01:57 2014 -0700
@@ -39,6 +39,7 @@
 import java.security.AccessController;
 import java.util.*;
 
+import com.sun.security.auth.module.UnixSystem;
 import sun.security.action.GetPropertyAction;
 import sun.security.krb5.internal.KerberosTime;
 import sun.security.krb5.internal.Krb5;
@@ -105,14 +106,14 @@
 
     private final String source;
 
-    private static int uid;
+    private static long uid;
     static {
         try {
             // Available on Solaris, Linux and Mac. Otherwise, no _euid suffix
-            Class<?> clazz = Class.forName("com.sun.security.auth.module.UnixSystem");
-            uid = (int)(long)(Long)
-                    clazz.getMethod("getUid").invoke(clazz.newInstance());
-        } catch (Exception e) {
+            UnixSystem us = new com.sun.security.auth.module.UnixSystem();
+            uid = us.getUid();
+        } catch (Throwable e) {
+            // Cannot be only Exception, might be UnsatisfiedLinkError
             uid = -1;
         }
     }
--- a/jdk/src/share/classes/sun/security/ssl/ByteBufferInputStream.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/ByteBufferInputStream.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,8 @@
         if (bb.remaining() == 0) {
             return -1;
         }
-        return bb.get();
+
+        return (bb.get() & 0xFF);   // need to be in the range 0 to 255
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/ssl/EngineInputRecord.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/EngineInputRecord.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -109,14 +109,8 @@
             ProtocolVersion recordVersion =
                 ProtocolVersion.valueOf(buf.get(pos + 1), buf.get(pos + 2));
 
-            // Check if too old (currently not possible)
-            // or if the major version does not match.
-            // The actual version negotiation is in the handshaker classes
-            if ((recordVersion.v < ProtocolVersion.MIN.v)
-                    || (recordVersion.major > ProtocolVersion.MAX.major)) {
-                throw new SSLException(
-                    "Unsupported record version " + recordVersion);
-            }
+            // check the record version
+            checkRecordVersion(recordVersion, false);
 
             /*
              * Reasonably sure this is a V3, disable further checks.
@@ -147,18 +141,8 @@
                 ProtocolVersion recordVersion =
                     ProtocolVersion.valueOf(buf.get(pos + 3), buf.get(pos + 4));
 
-                // Check if too old (currently not possible)
-                // or if the major version does not match.
-                // The actual version negotiation is in the handshaker classes
-                if ((recordVersion.v < ProtocolVersion.MIN.v)
-                        || (recordVersion.major > ProtocolVersion.MAX.major)) {
-
-                    // if it's not SSLv2, we're out of here.
-                    if (recordVersion.v != ProtocolVersion.SSL20Hello.v) {
-                        throw new SSLException(
-                            "Unsupported record version " + recordVersion);
-                    }
-                }
+                // check the record version
+                checkRecordVersion(recordVersion, true);
 
                 /*
                  * Client or Server Hello
@@ -406,14 +390,9 @@
 
         ProtocolVersion recordVersion = ProtocolVersion.valueOf(
                 srcBB.get(srcPos + 1), srcBB.get(srcPos + 2));
-        // Check if too old (currently not possible)
-        // or if the major version does not match.
-        // The actual version negotiation is in the handshaker classes
-        if ((recordVersion.v < ProtocolVersion.MIN.v)
-                || (recordVersion.major > ProtocolVersion.MAX.major)) {
-            throw new SSLException(
-                "Unsupported record version " + recordVersion);
-        }
+
+        // check the record version
+        checkRecordVersion(recordVersion, false);
 
         /*
          * It's really application data.  How much to consume?
--- a/jdk/src/share/classes/sun/security/ssl/InputRecord.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/InputRecord.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -534,19 +534,35 @@
     }
 
     /**
+     * Return true if the specified record protocol version is out of the
+     * range of the possible supported versions.
+     */
+    static void checkRecordVersion(ProtocolVersion version,
+            boolean allowSSL20Hello) throws SSLException {
+        // Check if the record version is too old (currently not possible)
+        // or if the major version does not match.
+        //
+        // The actual version negotiation is in the handshaker classes
+        if ((version.v < ProtocolVersion.MIN.v) ||
+            ((version.major & 0xFF) > (ProtocolVersion.MAX.major & 0xFF))) {
+
+            // if it's not SSLv2, we're out of here.
+            if (!allowSSL20Hello ||
+                    (version.v != ProtocolVersion.SSL20Hello.v)) {
+                throw new SSLException("Unsupported record version " + version);
+            }
+        }
+    }
+
+    /**
      * Read a SSL/TLS record. Throw an IOException if the format is invalid.
      */
     private void readV3Record(InputStream s, OutputStream o)
             throws IOException {
         ProtocolVersion recordVersion = ProtocolVersion.valueOf(buf[1], buf[2]);
-        // Check if too old (currently not possible)
-        // or if the major version does not match.
-        // The actual version negotiation is in the handshaker classes
-        if ((recordVersion.v < ProtocolVersion.MIN.v)
-                || (recordVersion.major > ProtocolVersion.MAX.major)) {
-            throw new SSLException(
-                "Unsupported record version " + recordVersion);
-        }
+
+        // check the record version
+        checkRecordVersion(recordVersion, false);
 
         /*
          * Get and check length, then the data.
--- a/jdk/src/share/classes/sun/security/ssl/ProtocolVersion.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/classes/sun/security/ssl/ProtocolVersion.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
         this.v = v;
         this.name = name;
         major = (byte)(v >>> 8);
-        minor = (byte)(v & 0xff);
+        minor = (byte)(v & 0xFF);
     }
 
     // private
@@ -117,8 +117,8 @@
         } else if (v == SSL20Hello.v) {
             return SSL20Hello;
         } else {
-            int major = (v >>> 8) & 0xff;
-            int minor = v & 0xff;
+            int major = (v >>> 8) & 0xFF;
+            int minor = v & 0xFF;
             return new ProtocolVersion(v, "Unknown-" + major + "." + minor);
         }
     }
@@ -128,10 +128,7 @@
      * numbers. Never throws exceptions.
      */
     public static ProtocolVersion valueOf(int major, int minor) {
-        major &= 0xff;
-        minor &= 0xff;
-        int v = (major << 8) | minor;
-        return valueOf(v);
+        return valueOf(((major & 0xFF) << 8) | (minor & 0xFF));
     }
 
     /**
--- a/jdk/src/share/javavm/export/jvm.h	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/javavm/export/jvm.h	Mon May 12 17:01:57 2014 -0700
@@ -1331,6 +1331,9 @@
 JNIEXPORT jobject JNICALL
 JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
 
+JNIEXPORT jstring JNICALL
+JVM_GetTemporaryDirectory(JNIEnv *env);
+
 /* Generics reflection support.
  *
  * Returns information about the given class's EnclosingMethod
--- a/jdk/src/share/native/sun/misc/VMSupport.c	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/src/share/native/sun/misc/VMSupport.c	Mon May 12 17:01:57 2014 -0700
@@ -53,3 +53,9 @@
     }
     return (*InitAgentProperties_fp)(env, props);
 }
+
+JNIEXPORT jstring JNICALL
+Java_sun_misc_VMSupport_getVMTemporaryDirectory(JNIEnv *env, jclass cls)
+{
+    return JVM_GetTemporaryDirectory(env);
+}
--- a/jdk/test/ProblemList.txt	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/ProblemList.txt	Mon May 12 17:01:57 2014 -0700
@@ -249,6 +249,18 @@
 
 # jdk_jdi
 
+# 6983531
+com/sun/jdi/BadHandshakeTest.java                               linux-all, windows-all
+
+# 8004127
+com/sun/jdi/RedefineImplementor.sh                              generic-all
+
+# 8031555
+com/sun/jdi/JdbMethodExitTest.sh                                generic-all
+
+# 8041934
+com/sun/jdi/RepStep.java                                        generic-all
+
 ############################################################################
 
 # jdk_util
@@ -270,4 +282,10 @@
 # 8033104
 sun/jvmstat/monitor/MonitoredVm/CR6672135.java			generic-all
 
+# 8041989
+sun/tools/jstatd/TestJstatdDefaults.java                        generic-all
+
+# 8037285
+sun/tools/jstatd/TestJstatdServer.java                          generic-all
+
 ############################################################################
--- a/jdk/test/TEST.groups	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/TEST.groups	Mon May 12 17:01:57 2014 -0700
@@ -1,4 +1,4 @@
-#  Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+#  Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 #  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 #  This code is free software; you can redistribute it and/or modify it
@@ -155,6 +155,15 @@
 jdk_jdi = \
     com/sun/jdi
 
+# java launcher specific tests, Note: do not include this group into any groups
+# that potentially could be included into a jprt test rule, as the complementary
+# closed  group includes awt SplashScreen and these tests may not run 
+# satisfacotorily on all platforms and  profiles thus this group must always 
+# be a stand-alone group
+jdk_launcher = \
+    tools/launcher \
+    sun/tools
+    
 #
 # Tool (and tool API) tests are split into core and svc groups
 #
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/security/auth/module/AllPlatforms.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 8039951
+ * @summary com.sun.security.auth.module missing classes on some platforms
+ * @run main/othervm AllPlatforms
+ */
+
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.LoginContext;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class AllPlatforms {
+    public static void main(String[] args) throws Exception {
+        login("cross-platform",
+                "UnixLoginModule", "optional",
+                "NTLoginModule", "optional",
+                "SolarisLoginModule", "optional");
+        try {
+            login("windows", "NTLoginModule", "required");
+            login("unix", "UnixLoginModule", "required");
+            login("solaris", "SolarisLoginModule", "required");
+        } catch (Exception e) {
+            e.printStackTrace(System.out);
+            if (e.toString().contains("UnsatisfiedLinkError")) {
+                throw new Exception("This is ugly");
+            }
+        }
+    }
+
+    static void login(String test, String... conf) throws Exception {
+        System.out.println("Testing " + test + "...");
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("hello {\n");
+        for (int i=0; i<conf.length; i+=2) {
+            sb.append("    com.sun.security.auth.module." + conf[i]
+                    + " " + conf[i+1] + ";\n");
+        }
+        sb.append("};\n");
+        Files.write(Paths.get(test), sb.toString().getBytes());
+
+        // Must be called. Configuration has an internal static field.
+        Configuration.setConfiguration(null);
+        System.setProperty("java.security.auth.login.config", test);
+
+        LoginContext lc = new LoginContext("hello");
+        lc.login();
+        System.out.println(lc.getSubject());
+    }
+}
--- a/jdk/test/com/sun/tools/attach/BasicTests.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java	Mon May 12 17:01:57 2014 -0700
@@ -38,7 +38,7 @@
  * @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
  * @summary Basic unit tests for the VM attach mechanism.
  * @library /lib/testlibrary
- * @run build Agent BadAgent RedefineAgent Application Shutdown RedefineDummy
+ * @run build Agent BadAgent RedefineAgent Application Shutdown RedefineDummy RunnerUtil
  * @run main BasicTests
  *
  * This test will perform a number of basic attach tests.
@@ -238,19 +238,17 @@
             // Test 6 - list method should list the target VM
             System.out.println(" - Test: VirtualMachine.list");
             List<VirtualMachineDescriptor> l = VirtualMachine.list();
-            if (!l.isEmpty()) {
-                boolean found = false;
-                for (VirtualMachineDescriptor vmd: l) {
-                    if (vmd.id().equals(pid)) {
-                        found = true;
-                        break;
-                    }
+            boolean found = false;
+            for (VirtualMachineDescriptor vmd: l) {
+                if (vmd.id().equals(pid)) {
+                    found = true;
+                    break;
                 }
-                if (found) {
-                    System.out.println(" - " + pid + " found.");
-                } else {
-                    throw new RuntimeException(pid + " not found in VM list");
-                }
+            }
+            if (found) {
+                System.out.println(" - " + pid + " found.");
+            } else {
+                throw new RuntimeException(pid + " not found in VM list");
             }
 
             // test 7 - basic hashCode/equals tests
--- a/jdk/test/com/sun/tools/attach/RunnerUtil.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java	Mon May 12 17:01:57 2014 -0700
@@ -24,12 +24,11 @@
 import java.io.IOException;
 import java.io.File;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
+
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JDKToolLauncher;
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.Utils;
 import jdk.testlibrary.ProcessThread;
@@ -39,6 +38,7 @@
  * (Test runner = class that launch a test)
  */
 public class RunnerUtil {
+
     /**
      * The Application process must be run concurrently with our tests since
      * the tests will attach to the Application.
@@ -49,16 +49,31 @@
      *
      * The Application will write its pid and shutdownPort in the given outFile.
      */
-    public static ProcessThread startApplication(String outFile) throws Throwable {
+    public static ProcessThread startApplication(String outFile, String... additionalOpts) throws Throwable {
         String classpath = System.getProperty("test.class.path", ".");
-        String[] args = Utils.addTestJavaOpts(
-            "-Dattach.test=true", "-classpath", classpath, "Application", outFile);
+        String[] myArgs = concat(additionalOpts, new String [] { "-Dattach.test=true", "-classpath", classpath, "Application", outFile });
+        String[] args = Utils.addTestJavaOpts(myArgs);
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
         ProcessThread pt = new ProcessThread("runApplication", pb);
         pt.start();
         return pt;
     }
 
+    public static String[] concat(String[] a, String[] b) {
+        if (a == null) {
+            return b;
+        }
+        if (b == null) {
+            return a;
+        }
+        int aLen = a.length;
+        int bLen = b.length;
+        String[] c = new String[aLen + bLen];
+        System.arraycopy(a, 0, c, 0, aLen);
+        System.arraycopy(b, 0, c, aLen, bLen);
+        return c;
+     }
+
     /**
      * Will stop the running Application.
      * First tries to shutdown nicely by connecting to the shut down port.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * 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 com.sun.tools.attach.*;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Properties;
+import java.util.List;
+import java.io.File;
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.ProcessThread;
+
+/*
+ * @test
+ * @bug 8033104
+ * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
+ * @library /lib/testlibrary
+ * @run build Application Shutdown RunnerUtil
+ * @run main/timeout=10 TempDirTest
+ */
+
+public class TempDirTest {
+
+    public static void main(String args[]) throws Throwable {
+
+        Path clientTmpDir = Files.createTempDirectory("TempDirTest-client");
+        clientTmpDir.toFile().deleteOnExit();
+        Path targetTmpDir = Files.createTempDirectory("TempDirTest-target");
+        targetTmpDir.toFile().deleteOnExit();
+
+        // run the test with all possible combinations of setting java.io.tmpdir
+        runExperiment(null, null);
+        runExperiment(clientTmpDir, null);
+        runExperiment(clientTmpDir, targetTmpDir);
+        runExperiment(null, targetTmpDir);
+
+    }
+
+    private static int counter = 0;
+
+    /*
+     * The actual test is in the nested class TestMain.
+     * The responsibility of this class is to:
+     * 1. Start the Application class in a separate process.
+     * 2. Find the pid and shutdown port of the running Application.
+     * 3. Launches the tests in nested class TestMain that will attach to the Application.
+     * 4. Shut down the Application.
+     */
+    public static void runExperiment(Path clientTmpDir, Path targetTmpDir) throws Throwable {
+
+        System.out.print("### Running tests with overridden tmpdir for");
+        System.out.print(" client: " + (clientTmpDir == null ? "no" : "yes"));
+        System.out.print(" target: " + (targetTmpDir == null ? "no" : "yes"));
+        System.out.println(" ###");
+
+        final String pidFile = "TempDirTest.Application.pid-" + counter++;
+        ProcessThread processThread = null;
+        RunnerUtil.ProcessInfo info = null;
+        try {
+            String[] tmpDirArg = null;
+            if (targetTmpDir != null) {
+                tmpDirArg = new String[] {"-Djava.io.tmpdir=" + targetTmpDir};
+            }
+            processThread = RunnerUtil.startApplication(pidFile, tmpDirArg);
+            info = RunnerUtil.readProcessInfo(pidFile);
+            launchTests(info.pid, clientTmpDir);
+        } catch (Throwable t) {
+            System.out.println("TempDirTest got unexpected exception: " + t);
+            t.printStackTrace();
+            throw t;
+        } finally {
+            // Make sure the Application process is stopped.
+            RunnerUtil.stopApplication(info.shutdownPort, processThread);
+        }
+    }
+
+    /**
+     * Runs the actual tests in nested class TestMain.
+     * The reason for running the tests in a separate process
+     * is that we need to modify the class path and
+     * the -Djava.io.tmpdir property.
+     */
+    private static void launchTests(int pid, Path clientTmpDir) throws Throwable {
+        final String sep = File.separator;
+
+        // Need to add jdk/lib/tools.jar to classpath.
+        String classpath =
+            System.getProperty("test.class.path", "") + File.pathSeparator +
+            System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+
+        String[] tmpDirArg = null;
+        if (clientTmpDir != null) {
+            tmpDirArg = new String [] {"-Djava.io.tmpdir=" + clientTmpDir};
+        }
+
+        // Arguments : [-Djava.io.tmpdir=] -classpath cp TempDirTest$TestMain pid
+        String[] args = RunnerUtil.concat(
+                tmpDirArg,
+                new String[] {
+                    "-classpath",
+                    classpath,
+                    "TempDirTest$TestMain",
+                    Integer.toString(pid) });
+        OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+        output.shouldHaveExitValue(0);
+    }
+
+    /**
+     * This is the actual test. It will attach to the running Application
+     * and perform a number of basic attach tests.
+     */
+    public static class TestMain {
+        public static void main(String args[]) throws Exception {
+            String pid = args[0];
+
+            // Test 1 - list method should list the target VM
+            System.out.println(" - Test: VirtualMachine.list");
+            List<VirtualMachineDescriptor> l = VirtualMachine.list();
+            boolean found = false;
+            for (VirtualMachineDescriptor vmd: l) {
+                if (vmd.id().equals(pid)) {
+                    found = true;
+                    break;
+                }
+            }
+            if (found) {
+                System.out.println(" - " + pid + " found.");
+            } else {
+                throw new RuntimeException(pid + " not found in VM list");
+            }
+
+            // Test 2 - try to attach and verify connection
+
+            System.out.println(" - Attaching to application ...");
+            VirtualMachine vm = VirtualMachine.attach(pid);
+
+            System.out.println(" - Test: system properties in target VM");
+            Properties props = vm.getSystemProperties();
+            String value = props.getProperty("attach.test");
+            if (value == null || !value.equals("true")) {
+                throw new RuntimeException("attach.test property not set");
+            }
+            System.out.println(" - attach.test property set as expected");
+        }
+    }
+}
--- a/jdk/test/com/sun/tools/attach/java.policy.allow	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/com/sun/tools/attach/java.policy.allow	Mon May 12 17:01:57 2014 -0700
@@ -13,7 +13,6 @@
     permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmstat.monitor";
     permission java.lang.RuntimePermission "loadLibrary.attach";
     permission java.util.PropertyPermission "sun.jvmstat.*", "read";
-    permission java.util.PropertyPermission "java.io.tmpdir", "read";
 
     /* to read configuration file in META-INF/services, and write/delete .attach_pid<pid> */
     permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
--- a/jdk/test/com/sun/tools/attach/java.policy.deny	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/com/sun/tools/attach/java.policy.deny	Mon May 12 17:01:57 2014 -0700
@@ -11,7 +11,6 @@
     permission java.lang.RuntimePermission "accessClassInPackage.sun.tools.attach";
     permission java.lang.RuntimePermission "loadLibrary.attach";
     permission java.util.PropertyPermission "sun.jvmstat.*", "read";
-    permission java.util.PropertyPermission "java.io.tmpdir", "read";
 
     /* to read configuration file in META-INF/services, and write/delete .attach_pid<pid> */
     permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigInteger/PrimeTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 8026236
+ * @summary test primality verification methods in BigInteger
+ * @author bpb
+ */
+import java.math.BigInteger;
+import java.util.BitSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.NavigableSet;
+import java.util.Set;
+import java.util.SplittableRandom;
+import java.util.TreeSet;
+import static java.util.stream.Collectors.toCollection;
+import static java.util.stream.Collectors.toList;
+
+public class PrimeTest {
+
+    private static final int DEFAULT_UPPER_BOUND = 1299709; // 100000th prime
+    private static final int DEFAULT_CERTAINTY = 100;
+    private static final int NUM_NON_PRIMES = 10000;
+
+    /**
+     * Run the test.
+     *
+     * @param args The parameters.
+     * @throws Exception on failure
+     */
+    public static void main(String[] args) throws Exception {
+        // Prepare arguments
+        int upperBound = args.length > 0 ? Integer.valueOf(args[0]) : DEFAULT_UPPER_BOUND;
+        int certainty = args.length > 1 ? Integer.valueOf(args[1]) : DEFAULT_CERTAINTY;
+        boolean parallel = args.length > 2 ? Boolean.valueOf(args[2]) : true;
+
+        // Echo parameter settings
+        System.out.println("Upper bound = " + upperBound
+                + "\nCertainty = " + certainty
+                + "\nParallel = " + parallel);
+
+        // Get primes through specified bound (inclusive) and Integer.MAX_VALUE
+        NavigableSet<BigInteger> primes = getPrimes(upperBound);
+
+        // Check whether known primes are identified as such
+        boolean primeTest = checkPrime(primes, certainty, parallel);
+        System.out.println("Prime test result: " + (primeTest ? "SUCCESS" : "FAILURE"));
+        if (!primeTest) {
+            System.err.println("Prime test failed");
+        }
+
+        // Check whether known non-primes are not identified as primes
+        boolean nonPrimeTest = checkNonPrime(primes, certainty);
+        System.out.println("Non-prime test result: " + (nonPrimeTest ? "SUCCESS" : "FAILURE"));
+
+        boolean mersennePrimeTest = checkMersennePrimes(certainty);
+        System.out.println("Mersenne test result: " + (mersennePrimeTest ? "SUCCESS" : "FAILURE"));
+
+        if (!primeTest || !nonPrimeTest || !mersennePrimeTest) {
+            throw new Exception("PrimeTest FAILED!");
+        }
+
+        System.out.println("PrimeTest succeeded!");
+    }
+
+    /**
+     * Create a {@code BitSet} wherein a set bit indicates the corresponding
+     * index plus 2 is prime. That is, if bit N is set, then the integer N + 2
+     * is prime. The values 0 and 1 are intentionally excluded. See the
+     * <a
+     * href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Algorithm_description">
+     * Sieve of Eratosthenes</a> algorithm description for more information.
+     *
+     * @param upperBound The maximum prime to allow
+     * @return bits indicating which indexes represent primes
+     */
+    private static BitSet createPrimes(int upperBound) {
+        int nbits = upperBound - 1;
+        BitSet bs = new BitSet(nbits);
+        for (int p = 2; p * p < upperBound;) {
+            for (int i = p * p; i < nbits + 2; i += p) {
+                bs.set(i - 2, true);
+            }
+            do {
+                ++p;
+            } while (p > 1 && bs.get(p - 2));
+        }
+        bs.flip(0, nbits);
+        return bs;
+    }
+
+    /**
+     * Load the primes up to the specified bound (inclusive) into a
+     * {@code NavigableSet}, appending the prime {@code Integer.MAX_VALUE}.
+     *
+     * @param upperBound The maximum prime to allow
+     * @return a set of primes
+     */
+    private static NavigableSet<BigInteger> getPrimes(int upperBound) {
+        BitSet bs = createPrimes(upperBound);
+        NavigableSet<BigInteger> primes = bs.stream()
+                .mapToObj(p -> BigInteger.valueOf(p + 2))
+                .collect(toCollection(TreeSet::new));
+        primes.add(BigInteger.valueOf(Integer.MAX_VALUE));
+        System.out.println(String.format("Created %d primes", primes.size()));
+        return primes;
+    }
+
+    /**
+     * Verifies whether the fraction of probable primes detected is at least 1 -
+     * 1/2^certainty.
+     *
+     * @return true if and only if the test succeeds
+     */
+    private static boolean checkPrime(Set<BigInteger> primes,
+            int certainty,
+            boolean parallel) {
+        long probablePrimes = (parallel ? primes.parallelStream() : primes.stream())
+                .filter(bi -> bi.isProbablePrime(certainty))
+                .count();
+
+        // N = certainty / 2
+        // Success if p/t >= 1 - 1/4^N
+        // or (p/t)*4^N >= 4^N - 1
+        // or p*4^N >= t*(4^N - 1)
+        BigInteger p = BigInteger.valueOf(probablePrimes);
+        BigInteger t = BigInteger.valueOf(primes.size());
+        BigInteger fourToTheC = BigInteger.valueOf(4).pow(certainty / 2);
+        BigInteger fourToTheCMinusOne = fourToTheC.subtract(BigInteger.ONE);
+        BigInteger left = p.multiply(fourToTheC);
+        BigInteger right = t.multiply(fourToTheCMinusOne);
+
+        if (left.compareTo(right) < 0) {
+            System.err.println("Probable prime certainty test failed");
+        }
+
+        return left.compareTo(right) >= 0;
+    }
+
+    /**
+     * Verifies whether all {@code BigInteger}s in the tested range for which
+     * {@code isProbablePrime()} returns {@code false} are <i>not</i>
+     * prime numbers.
+     *
+     * @return true if and only if the test succeeds
+     */
+    private static boolean checkNonPrime(NavigableSet<BigInteger> primes,
+            int certainty) {
+        int maxPrime = DEFAULT_UPPER_BOUND;
+        try {
+            maxPrime = primes.last().intValueExact();
+        } catch (ArithmeticException e) {
+            // ignore it
+        }
+
+        // Create a list of non-prime BigIntegers.
+        List<BigInteger> nonPrimeBigInts = (new SplittableRandom())
+                .ints(NUM_NON_PRIMES, 2, maxPrime).mapToObj(BigInteger::valueOf)
+                .filter(b -> !b.isProbablePrime(certainty)).collect(toList());
+
+        // If there are any non-probable primes also in the primes list then fail.
+        boolean failed = nonPrimeBigInts.stream().anyMatch(primes::contains);
+
+        // In the event, print which purported non-primes were actually prime.
+        if (failed) {
+            for (BigInteger bigInt : nonPrimeBigInts) {
+                if (primes.contains(bigInt)) {
+                    System.err.println("Prime value thought to be non-prime: " + bigInt);
+                }
+            }
+        }
+
+        return !failed;
+    }
+
+    /**
+     * Verifies whether a specified subset of Mersenne primes are correctly
+     * identified as being prime. See
+     * <a href="https://en.wikipedia.org/wiki/Mersenne_prime">Mersenne prime</a>
+     * for more information.
+     *
+     * @return true if and only if the test succeeds
+     */
+    private static boolean checkMersennePrimes(int certainty) {
+        int[] MERSENNE_EXPONENTS = {
+            2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203,
+            2281, 3217, 4253, // uncomment remaining array elements to make this test run a long time
+            /* 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497,
+            86243, 110503, 132049, 216091, 756839, 859433, 1257787, 1398269,
+            2976221, 3021377, 6972593, 13466917, 20996011, 24036583, 25964951,
+            30402457, 32582657, 37156667, 42643801, 43112609, 57885161 */
+        };
+        System.out.println("Checking first "+MERSENNE_EXPONENTS.length+" Mersenne primes");
+
+        boolean result = true;
+        for (int n : MERSENNE_EXPONENTS) {
+            BigInteger mp = BigInteger.ONE.shiftLeft(n).subtract(BigInteger.ONE);
+            if (!mp.isProbablePrime(certainty)) {
+                System.err.println("Mp with p = "+n+" not classified as prime");
+                result = false;
+            }
+        }
+
+        return result;
+    }
+}
--- a/jdk/test/java/nio/file/WatchService/Basic.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/java/nio/file/WatchService/Basic.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
  */
 
 /* @test
- * @bug 4313887 6838333 7017446
+ * @bug 4313887 6838333 7017446 8011537 8042470
  * @summary Unit test for java.nio.file.WatchService
  * @library ..
  * @run main Basic
@@ -295,24 +295,31 @@
             // IllegalArgumentException
             System.out.println("IllegalArgumentException tests...");
             try {
-                dir.register(watcher, new WatchEvent.Kind<?>[]{ } );
+                dir.register(watcher /*empty event list*/);
                 throw new RuntimeException("IllegalArgumentException not thrown");
             } catch (IllegalArgumentException x) {
             }
             try {
                 // OVERFLOW is ignored so this is equivalent to the empty set
-                dir.register(watcher, new WatchEvent.Kind<?>[]{ OVERFLOW });
+                dir.register(watcher, OVERFLOW);
+                throw new RuntimeException("IllegalArgumentException not thrown");
+            } catch (IllegalArgumentException x) {
+            }
+            try {
+                // OVERFLOW is ignored even if specified multiple times
+                dir.register(watcher, OVERFLOW, OVERFLOW);
                 throw new RuntimeException("IllegalArgumentException not thrown");
             } catch (IllegalArgumentException x) {
             }
 
             // UnsupportedOperationException
             try {
-                dir.register(watcher, new WatchEvent.Kind<?>[]{
+                dir.register(watcher,
                              new WatchEvent.Kind<Object>() {
                                 @Override public String name() { return "custom"; }
                                 @Override public Class<Object> type() { return Object.class; }
-                             }});
+                             });
+                throw new RuntimeException("UnsupportedOperationException not thrown");
             } catch (UnsupportedOperationException x) {
             }
             try {
@@ -328,7 +335,7 @@
             // NullPointerException
             System.out.println("NullPointerException tests...");
             try {
-                dir.register(null, new WatchEvent.Kind<?>[]{ ENTRY_CREATE });
+                dir.register(null, ENTRY_CREATE);
                 throw new RuntimeException("NullPointerException not thrown");
             } catch (NullPointerException x) {
             }
@@ -380,7 +387,7 @@
 
         try {
             dir.register(watcher, new WatchEvent.Kind<?>[]{ ENTRY_CREATE });
-             throw new RuntimeException("ClosedWatchServiceException not thrown");
+            throw new RuntimeException("ClosedWatchServiceException not thrown");
         } catch (ClosedWatchServiceException  x) {
         }
 
@@ -468,6 +475,28 @@
         }
     }
 
+    /**
+     * Test that thread interruped status is preserved upon a call
+     * to register()
+     */
+    static void testThreadInterrupt(Path dir) throws IOException {
+        System.out.println("-- Thread interrupted status test --");
+
+        FileSystem fs = FileSystems.getDefault();
+        Thread curr = Thread.currentThread();
+        try (WatchService watcher = fs.newWatchService()) {
+            System.out.println("interrupting current thread");
+            curr.interrupt();
+            dir.register(watcher, ENTRY_CREATE);
+            if (!curr.isInterrupted())
+                throw new RuntimeException("thread should remain interrupted");
+            System.out.println("current thread is still interrupted");
+            System.out.println("OKAY");
+        } finally {
+            curr.interrupted();
+        }
+    }
+
     public static void main(String[] args) throws IOException {
         Path dir = TestUtil.createTemporaryDirectory();
         try {
@@ -478,6 +507,7 @@
             testWakeup(dir);
             testExceptions(dir);
             testTwoWatchers(dir);
+            testThreadInterrupt(dir);
 
         } finally {
             TestUtil.removeAll(dir);
--- a/jdk/test/java/util/BitSet/BSMethods.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/java/util/BitSet/BSMethods.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 /* @test
  * @bug 4098239 4107540 4080736 4261102 4274710 4305272
- *      4979017 4979028 4979031 5030267 6222207
+ *      4979017 4979028 4979031 5030267 6222207 8040806
  * @summary Test the operation of the methods of BitSet class
  * @author Mike McCloskey, Martin Buchholz
  */
@@ -897,6 +897,16 @@
     private static void testToString() {
         check(new BitSet().toString().equals("{}"));
         check(makeSet(2,3,42,43,234).toString().equals("{2, 3, 42, 43, 234}"));
+        try {
+            check(makeSet(Integer.MAX_VALUE-1).toString().equals(
+                    "{" + (Integer.MAX_VALUE-1) + "}"));
+            check(makeSet(Integer.MAX_VALUE).toString().equals(
+                    "{" + Integer.MAX_VALUE + "}"));
+            check(makeSet(0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE).toString().equals(
+                    "{0, 1, " + (Integer.MAX_VALUE-1) + ", " + Integer.MAX_VALUE + "}"));
+        } catch (IndexOutOfBoundsException exc) {
+            fail("toString() with indices near MAX_VALUE");
+        }
     }
 
     private static void testLogicalIdentities() {
--- a/jdk/test/java/util/Locale/Bug7069824.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/java/util/Locale/Bug7069824.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 
 /*
  * @test
- * @bug 7069824
+ * @bug 7069824 8042360
  * @summary Verify implementation for Locale matching.
  * @run main Bug7069824
  */
@@ -91,6 +91,17 @@
         String range;
         double weight;
 
+        // Testcase for 8042360
+        range = "en-Latn-1234567890";
+        try {
+            lr = new LanguageRange(range);
+            error = true;
+            System.err.println("    IAE should be thrown for LanguageRange("
+                + range + ").");
+        }
+        catch (IllegalArgumentException ex) {
+        }
+
         range = null;
         try {
             lr = new LanguageRange(range);
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java	Mon May 12 17:01:57 2014 -0700
@@ -26,6 +26,9 @@
 
 import java.util.*;
 import java.util.Spliterators;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.BiFunction;
+import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Supplier;
 import java.util.stream.*;
@@ -122,24 +125,33 @@
 
     @Test(groups = { "serialization-hostile" })
     public void testSequentialShortCircuitTerminal() {
-        // The sorted op for sequential evaluation will buffer all elements when accepting
-        // then at the end sort those elements and push those elements downstream
+        // The sorted op for sequential evaluation will buffer all elements when
+        // accepting then at the end sort those elements and push those elements
+        // downstream
+        // A peek operation is added in-between the sorted() and terminal
+        // operation that counts the number of calls to its consumer and
+        // asserts that the number of calls is at most the required quantity
 
         List<Integer> l = Arrays.asList(5, 4, 3, 2, 1);
 
+        Function<Integer, Stream<Integer>> knownSize = i -> assertNCallsOnly(
+                l.stream().sorted(), Stream::peek, i);
+        Function<Integer, Stream<Integer>> unknownSize = i -> assertNCallsOnly
+                (unknownSizeStream(l).sorted(), Stream::peek, i);
+
         // Find
-        assertEquals(l.stream().sorted().findFirst(), Optional.of(1));
-        assertEquals(l.stream().sorted().findAny(), Optional.of(1));
-        assertEquals(unknownSizeStream(l).sorted().findFirst(), Optional.of(1));
-        assertEquals(unknownSizeStream(l).sorted().findAny(), Optional.of(1));
+        assertEquals(knownSize.apply(1).findFirst(), Optional.of(1));
+        assertEquals(knownSize.apply(1).findAny(), Optional.of(1));
+        assertEquals(unknownSize.apply(1).findFirst(), Optional.of(1));
+        assertEquals(unknownSize.apply(1).findAny(), Optional.of(1));
 
         // Match
-        assertEquals(l.stream().sorted().anyMatch(i -> i == 2), true);
-        assertEquals(l.stream().sorted().noneMatch(i -> i == 2), false);
-        assertEquals(l.stream().sorted().allMatch(i -> i == 2), false);
-        assertEquals(unknownSizeStream(l).sorted().anyMatch(i -> i == 2), true);
-        assertEquals(unknownSizeStream(l).sorted().noneMatch(i -> i == 2), false);
-        assertEquals(unknownSizeStream(l).sorted().allMatch(i -> i == 2), false);
+        assertEquals(knownSize.apply(2).anyMatch(i -> i == 2), true);
+        assertEquals(knownSize.apply(2).noneMatch(i -> i == 2), false);
+        assertEquals(knownSize.apply(2).allMatch(i -> i == 2), false);
+        assertEquals(unknownSize.apply(2).anyMatch(i -> i == 2), true);
+        assertEquals(unknownSize.apply(2).noneMatch(i -> i == 2), false);
+        assertEquals(unknownSize.apply(2).allMatch(i -> i == 2), false);
     }
 
     private <T> Stream<T> unknownSizeStream(List<T> l) {
@@ -199,19 +211,24 @@
     public void testIntSequentialShortCircuitTerminal() {
         int[] a = new int[]{5, 4, 3, 2, 1};
 
+        Function<Integer, IntStream> knownSize = i -> assertNCallsOnly(
+                Arrays.stream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+        Function<Integer, IntStream> unknownSize = i -> assertNCallsOnly
+                (unknownSizeIntStream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+
         // Find
-        assertEquals(Arrays.stream(a).sorted().findFirst(), OptionalInt.of(1));
-        assertEquals(Arrays.stream(a).sorted().findAny(), OptionalInt.of(1));
-        assertEquals(unknownSizeIntStream(a).sorted().findFirst(), OptionalInt.of(1));
-        assertEquals(unknownSizeIntStream(a).sorted().findAny(), OptionalInt.of(1));
+        assertEquals(knownSize.apply(1).findFirst(), OptionalInt.of(1));
+        assertEquals(knownSize.apply(1).findAny(), OptionalInt.of(1));
+        assertEquals(unknownSize.apply(1).findFirst(), OptionalInt.of(1));
+        assertEquals(unknownSize.apply(1).findAny(), OptionalInt.of(1));
 
         // Match
-        assertEquals(Arrays.stream(a).sorted().anyMatch(i -> i == 2), true);
-        assertEquals(Arrays.stream(a).sorted().noneMatch(i -> i == 2), false);
-        assertEquals(Arrays.stream(a).sorted().allMatch(i -> i == 2), false);
-        assertEquals(unknownSizeIntStream(a).sorted().anyMatch(i -> i == 2), true);
-        assertEquals(unknownSizeIntStream(a).sorted().noneMatch(i -> i == 2), false);
-        assertEquals(unknownSizeIntStream(a).sorted().allMatch(i -> i == 2), false);
+        assertEquals(knownSize.apply(2).anyMatch(i -> i == 2), true);
+        assertEquals(knownSize.apply(2).noneMatch(i -> i == 2), false);
+        assertEquals(knownSize.apply(2).allMatch(i -> i == 2), false);
+        assertEquals(unknownSize.apply(2).anyMatch(i -> i == 2), true);
+        assertEquals(unknownSize.apply(2).noneMatch(i -> i == 2), false);
+        assertEquals(unknownSize.apply(2).allMatch(i -> i == 2), false);
     }
 
     private IntStream unknownSizeIntStream(int[] a) {
@@ -242,19 +259,24 @@
     public void testLongSequentialShortCircuitTerminal() {
         long[] a = new long[]{5, 4, 3, 2, 1};
 
+        Function<Integer, LongStream> knownSize = i -> assertNCallsOnly(
+                Arrays.stream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+        Function<Integer, LongStream> unknownSize = i -> assertNCallsOnly
+                (unknownSizeLongStream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+
         // Find
-        assertEquals(Arrays.stream(a).sorted().findFirst(), OptionalLong.of(1));
-        assertEquals(Arrays.stream(a).sorted().findAny(), OptionalLong.of(1));
-        assertEquals(unknownSizeLongStream(a).sorted().findFirst(), OptionalLong.of(1));
-        assertEquals(unknownSizeLongStream(a).sorted().findAny(), OptionalLong.of(1));
+        assertEquals(knownSize.apply(1).findFirst(), OptionalLong.of(1));
+        assertEquals(knownSize.apply(1).findAny(), OptionalLong.of(1));
+        assertEquals(unknownSize.apply(1).findFirst(), OptionalLong.of(1));
+        assertEquals(unknownSize.apply(1).findAny(), OptionalLong.of(1));
 
         // Match
-        assertEquals(Arrays.stream(a).sorted().anyMatch(i -> i == 2), true);
-        assertEquals(Arrays.stream(a).sorted().noneMatch(i -> i == 2), false);
-        assertEquals(Arrays.stream(a).sorted().allMatch(i -> i == 2), false);
-        assertEquals(unknownSizeLongStream(a).sorted().anyMatch(i -> i == 2), true);
-        assertEquals(unknownSizeLongStream(a).sorted().noneMatch(i -> i == 2), false);
-        assertEquals(unknownSizeLongStream(a).sorted().allMatch(i -> i == 2), false);
+        assertEquals(knownSize.apply(2).anyMatch(i -> i == 2), true);
+        assertEquals(knownSize.apply(2).noneMatch(i -> i == 2), false);
+        assertEquals(knownSize.apply(2).allMatch(i -> i == 2), false);
+        assertEquals(unknownSize.apply(2).anyMatch(i -> i == 2), true);
+        assertEquals(unknownSize.apply(2).noneMatch(i -> i == 2), false);
+        assertEquals(unknownSize.apply(2).allMatch(i -> i == 2), false);
     }
 
     private LongStream unknownSizeLongStream(long[] a) {
@@ -285,19 +307,24 @@
     public void testDoubleSequentialShortCircuitTerminal() {
         double[] a = new double[]{5.0, 4.0, 3.0, 2.0, 1.0};
 
+        Function<Integer, DoubleStream> knownSize = i -> assertNCallsOnly(
+                Arrays.stream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+        Function<Integer, DoubleStream> unknownSize = i -> assertNCallsOnly
+                (unknownSizeDoubleStream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+
         // Find
-        assertEquals(Arrays.stream(a).sorted().findFirst(), OptionalDouble.of(1));
-        assertEquals(Arrays.stream(a).sorted().findAny(), OptionalDouble.of(1));
-        assertEquals(unknownSizeDoubleStream(a).sorted().findFirst(), OptionalDouble.of(1));
-        assertEquals(unknownSizeDoubleStream(a).sorted().findAny(), OptionalDouble.of(1));
+        assertEquals(knownSize.apply(1).findFirst(), OptionalDouble.of(1));
+        assertEquals(knownSize.apply(1).findAny(), OptionalDouble.of(1));
+        assertEquals(unknownSize.apply(1).findFirst(), OptionalDouble.of(1));
+        assertEquals(unknownSize.apply(1).findAny(), OptionalDouble.of(1));
 
         // Match
-        assertEquals(Arrays.stream(a).sorted().anyMatch(i -> i == 2.0), true);
-        assertEquals(Arrays.stream(a).sorted().noneMatch(i -> i == 2.0), false);
-        assertEquals(Arrays.stream(a).sorted().allMatch(i -> i == 2.0), false);
-        assertEquals(unknownSizeDoubleStream(a).sorted().anyMatch(i -> i == 2.0), true);
-        assertEquals(unknownSizeDoubleStream(a).sorted().noneMatch(i -> i == 2.0), false);
-        assertEquals(unknownSizeDoubleStream(a).sorted().allMatch(i -> i == 2.0), false);
+        assertEquals(knownSize.apply(2).anyMatch(i -> i == 2.0), true);
+        assertEquals(knownSize.apply(2).noneMatch(i -> i == 2.0), false);
+        assertEquals(knownSize.apply(2).allMatch(i -> i == 2.0), false);
+        assertEquals(unknownSize.apply(2).anyMatch(i -> i == 2.0), true);
+        assertEquals(unknownSize.apply(2).noneMatch(i -> i == 2.0), false);
+        assertEquals(unknownSize.apply(2).allMatch(i -> i == 2.0), false);
     }
 
     private DoubleStream unknownSizeDoubleStream(double[] a) {
@@ -321,4 +348,14 @@
         assertSorted(result);
         assertContentsUnordered(data, result);
     }
+
+    /**
+     * Interpose a consumer that asserts it is called at most N times.
+     */
+    <T, S extends BaseStream<T, S>, R> S assertNCallsOnly(S s, BiFunction<S, Consumer<T>, S> pf, int n) {
+        AtomicInteger boxedInt = new AtomicInteger();
+        return pf.apply(s, i -> {
+            assertFalse(boxedInt.incrementAndGet() > n, "Intermediate op called more than " + n + " time(s)");
+        });
+    }
 }
--- a/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java	Mon May 12 17:01:57 2014 -0700
@@ -98,13 +98,13 @@
             monitorProxy.start();
 
             final int initGetCount = observedProxy.getGetCount();
-            int getCount = initGetCount;
-            for (int i = 0; i < 500; i++) { // 500 * 10 = 5 seconds
-                getCount = observedProxy.getGetCount();
-                if (getCount != initGetCount)
-                    break;
-                Thread.sleep(10);
-            }
+            int getCount;
+            System.out.println("Checking GetCount, possible deadlock if timeout.");
+            do { // 8038322. Until timeout of testing harness
+                Thread.sleep(200);
+            } while ((getCount=observedProxy.getGetCount()) == initGetCount);
+            System.out.println("Done!");
+
             if (getCount <= initGetCount)
                 throw new Exception("Test failed: presumable deadlock");
             // This won't show up as a deadlock in CTRL-\ or in
@@ -131,10 +131,11 @@
                 };
                 mbs.addNotificationListener(monitorName, listener, null, null);
                 observedProxy.setThing(1000);
-                for (int i = 0; i < 500 && notifCount.get() == 0; i++)
-                    Thread.sleep(10);
-                if (notifCount.get() == 0)
-                    throw new Exception("Test failed: presumable deadlock");
+                System.out.println("Waiting notifCount.get() != 0, possible deadlock if timeout.");
+                do {
+                    Thread.sleep(200);
+                } while(notifCount.get() == 0); // 8038322. Until timeout of testing harness
+                System.out.println("Done");
             }
 
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/SSLEngine/IllegalRecordVersion.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+// This test case relies on updated static security property, no way to re-use
+// security property in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8042449
+ * @summary Issue for negative byte major record version
+ *
+ * @run main/othervm IllegalRecordVersion
+ */
+
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import java.io.*;
+import java.security.*;
+import java.nio.*;
+
+public class IllegalRecordVersion {
+
+    public static void main(String args[]) throws Exception {
+        SSLContext context = SSLContext.getDefault();
+
+        SSLEngine cliEngine = context.createSSLEngine();
+        cliEngine.setUseClientMode(true);
+        SSLEngine srvEngine = context.createSSLEngine();
+        srvEngine.setUseClientMode(false);
+
+        SSLSession session = cliEngine.getSession();
+        int netBufferMax = session.getPacketBufferSize();
+        int appBufferMax = session.getApplicationBufferSize();
+
+        ByteBuffer cliToSrv = ByteBuffer.allocateDirect(netBufferMax);
+        ByteBuffer srvIBuff = ByteBuffer.allocateDirect(appBufferMax + 50);
+        ByteBuffer cliOBuff = ByteBuffer.wrap("I'm client".getBytes());
+
+
+        System.out.println("client hello (record version(0xa9, 0xa2))");
+        SSLEngineResult cliRes = cliEngine.wrap(cliOBuff, cliToSrv);
+        System.out.println("Client wrap result: " + cliRes);
+        cliToSrv.flip();
+        if (cliToSrv.limit() > 5) {
+            cliToSrv.put(1, (byte)0xa9);
+            cliToSrv.put(2, (byte)0xa2);
+        }
+
+        try {
+            srvEngine.unwrap(cliToSrv, srvIBuff);
+            throw new Exception(
+                "Cannot catch the unsupported record version issue");
+        } catch (SSLException e) {
+            // get the expected exception
+        }
+    }
+}
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java	Mon May 12 17:01:57 2014 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184
+ * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349
  * @summary Basic unit tests for generating XML Signatures with JSR 105
  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
  *     X509KeySelector.java GenerationTests.java
@@ -80,9 +80,10 @@
     private static KeyInfoFactory kifac;
     private static DocumentBuilder db;
     private static CanonicalizationMethod withoutComments;
-    private static SignatureMethod dsaSha1, rsaSha1, rsaSha256, rsaSha384, rsaSha512;
+    private static SignatureMethod dsaSha1, dsaSha256, rsaSha1,
+                                   rsaSha256, rsaSha384, rsaSha512;
     private static DigestMethod sha1, sha256, sha384, sha512;
-    private static KeyInfo dsa, rsa, rsa1024;
+    private static KeyInfo dsa1024, dsa2048, rsa, rsa1024;
     private static KeySelector kvks = new KeySelectors.KeyValueKeySelector();
     private static KeySelector sks;
     private static Key signingKey;
@@ -106,10 +107,13 @@
         "http://www.w3.org/TR/xml-stylesheet";
     private final static String STYLESHEET_B64 =
         "http://www.w3.org/Signature/2002/04/xml-stylesheet.b64";
+    private final static String DSA_SHA256 =
+        "http://www.w3.org/2009/xmldsig11#dsa-sha256";
 
     public static void main(String args[]) throws Exception {
         setup();
-        test_create_signature_enveloped_dsa();
+        test_create_signature_enveloped_dsa(1024);
+        test_create_signature_enveloped_dsa(2048);
         test_create_signature_enveloping_b64_dsa();
         test_create_signature_enveloping_dsa();
         test_create_signature_enveloping_hmac_sha1_40();
@@ -157,15 +161,18 @@
         withoutComments = fac.newCanonicalizationMethod
             (CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec)null);
         dsaSha1 = fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null);
+        dsaSha256 = fac.newSignatureMethod(DSA_SHA256, null);
         sha1 = fac.newDigestMethod(DigestMethod.SHA1, null);
         sha256 = fac.newDigestMethod(DigestMethod.SHA256, null);
         sha384 = fac.newDigestMethod
             ("http://www.w3.org/2001/04/xmldsig-more#sha384", null);
         sha512 = fac.newDigestMethod(DigestMethod.SHA512, null);
-        dsa = kifac.newKeyInfo(Collections.singletonList
+        dsa1024 = kifac.newKeyInfo(Collections.singletonList
             (kifac.newKeyValue(validatingKey)));
+        dsa2048 = kifac.newKeyInfo(Collections.singletonList
+            (kifac.newKeyValue(getPublicKey("DSA", 2048))));
         rsa = kifac.newKeyInfo(Collections.singletonList
-            (kifac.newKeyValue(getPublicKey("RSA"))));
+            (kifac.newKeyValue(getPublicKey("RSA", 512))));
         rsa1024 = kifac.newKeyInfo(Collections.singletonList
             (kifac.newKeyValue(getPublicKey("RSA", 1024))));
         rsaSha1 = fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null);
@@ -180,11 +187,25 @@
         httpUd = new HttpURIDereferencer();
     }
 
-    static void test_create_signature_enveloped_dsa() throws Exception {
-        System.out.println("* Generating signature-enveloped-dsa.xml");
+    static void test_create_signature_enveloped_dsa(int size) throws Exception {
+        System.out.println("* Generating signature-enveloped-dsa-"
+                           + size + ".xml");
+        SignatureMethod sm = null;
+        KeyInfo ki = null;
+        Key privKey;
+        if (size == 1024) {
+            sm = dsaSha1;
+            ki = dsa1024;
+            privKey = signingKey;
+        } else if (size == 2048) {
+            sm = dsaSha256;
+            ki = dsa2048;
+            privKey = getPrivateKey("DSA", 2048);
+        } else throw new RuntimeException("unsupported keysize:" + size);
+
         // create SignedInfo
         SignedInfo si = fac.newSignedInfo
-            (withoutComments, dsaSha1, Collections.singletonList
+            (withoutComments, sm, Collections.singletonList
                 (fac.newReference
                     ("", sha1, Collections.singletonList
                         (fac.newTransform(Transform.ENVELOPED,
@@ -192,7 +213,7 @@
                  null, null)));
 
         // create XMLSignature
-        XMLSignature sig = fac.newXMLSignature(si, dsa);
+        XMLSignature sig = fac.newXMLSignature(si, ki);
 
         Document doc = db.newDocument();
         Element envelope = doc.createElementNS
@@ -201,12 +222,12 @@
             "xmlns", "http://example.org/envelope");
         doc.appendChild(envelope);
 
-        DOMSignContext dsc = new DOMSignContext(signingKey, envelope);
+        DOMSignContext dsc = new DOMSignContext(privKey, envelope);
 
         sig.sign(dsc);
-//      StringWriter sw = new StringWriter();
-//      dumpDocument(doc, sw);
-//      System.out.println(sw.toString());
+//        StringWriter sw = new StringWriter();
+//        dumpDocument(doc, sw);
+//        System.out.println(sw.toString());
 
         DOMValidateContext dvc = new DOMValidateContext
             (kvks, envelope.getFirstChild());
@@ -226,21 +247,21 @@
     static void test_create_signature_enveloping_b64_dsa() throws Exception {
         System.out.println("* Generating signature-enveloping-b64-dsa.xml");
         test_create_signature_enveloping
-            (sha1, dsaSha1, dsa, signingKey, kvks, true);
+            (sha1, dsaSha1, dsa1024, signingKey, kvks, true);
         System.out.println();
     }
 
     static void test_create_signature_enveloping_dsa() throws Exception {
         System.out.println("* Generating signature-enveloping-dsa.xml");
         test_create_signature_enveloping
-            (sha1, dsaSha1, dsa, signingKey, kvks, false);
+            (sha1, dsaSha1, dsa1024, signingKey, kvks, false);
         System.out.println();
     }
 
     static void test_create_signature_enveloping_sha256_dsa() throws Exception {
         System.out.println("* Generating signature-enveloping-sha256-dsa.xml");
         test_create_signature_enveloping
-            (sha256, dsaSha1, dsa, signingKey, kvks, false);
+            (sha256, dsaSha1, dsa1024, signingKey, kvks, false);
         System.out.println();
     }
 
@@ -293,7 +314,7 @@
     static void test_create_signature_enveloping_rsa() throws Exception {
         System.out.println("* Generating signature-enveloping-rsa.xml");
         test_create_signature_enveloping(sha1, rsaSha1, rsa,
-            getPrivateKey("RSA"), kvks, false);
+            getPrivateKey("RSA", 512), kvks, false);
         System.out.println();
     }
 
@@ -301,7 +322,7 @@
         throws Exception {
         System.out.println("* Generating signature-enveloping-sha384-rsa_sha256.xml");
         test_create_signature_enveloping(sha384, rsaSha256, rsa,
-            getPrivateKey("RSA"), kvks, false);
+            getPrivateKey("RSA", 512), kvks, false);
         System.out.println();
     }
 
@@ -323,13 +344,13 @@
 
     static void test_create_signature_external_b64_dsa() throws Exception {
         System.out.println("* Generating signature-external-b64-dsa.xml");
-        test_create_signature_external(dsaSha1, dsa, signingKey, kvks, true);
+        test_create_signature_external(dsaSha1, dsa1024, signingKey, kvks, true);
         System.out.println();
     }
 
     static void test_create_signature_external_dsa() throws Exception {
         System.out.println("* Generating signature-external-dsa.xml");
-        test_create_signature_external(dsaSha1, dsa, signingKey, kvks, false);
+        test_create_signature_external(dsaSha1, dsa1024, signingKey, kvks, false);
         System.out.println();
     }
 
@@ -441,7 +462,7 @@
 
         // create XMLSignature
         XMLSignature sig = fac.newXMLSignature(si, rsa, objs, "signature", null);
-        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
 
         sig.sign(dsc);
 
@@ -487,7 +508,7 @@
         XMLSignature sig = fac.newXMLSignature(si, rsa,
                                                Collections.singletonList(obj),
                                                "signature", null);
-        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
         dsc.setIdAttributeNS(nc, null, "Id");
 
         sig.sign(dsc);
@@ -530,7 +551,7 @@
         XMLSignature sig = fac.newXMLSignature(si, rsa,
                                                Collections.singletonList(obj),
                                                "signature", null);
-        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
         sig.sign(dsc);
     }
 
@@ -1116,6 +1137,16 @@
         "90670890367185141189796";
     private static final String DSA_X =
         "0527140396812450214498055937934275626078768840117";
+    private static final String DSA_2048_Y =
+        "15119007057343785981993995134621348945077524760182795513668325877793414638620983617627033248732235626178802906346261435991040697338468329634416089753032362617771631199351767336660070462291411472735835843440140283101463231807789628656218830720378705090795271104661936237385140354825159080766174663596286149653433914842868551355716015585570827642835307073681358328172009941968323702291677280809277843998510864653406122348712345584706761165794179850728091522094227603562280855104749858249588234915206290448353957550635709520273178475097150818955098638774564910092913714625772708285992586894795017709678223469405896699928";
+    private static final String DSA_2048_P =
+        "18111848663142005571178770624881214696591339256823507023544605891411707081617152319519180201250440615163700426054396403795303435564101919053459832890139496933938670005799610981765220283775567361483662648340339405220348871308593627647076689407931875483406244310337925809427432681864623551598136302441690546585427193224254314088256212718983105131138772434658820375111735710449331518776858786793875865418124429269409118756812841019074631004956409706877081612616347900606555802111224022921017725537417047242635829949739109274666495826205002104010355456981211025738812433088757102520562459649777989718122219159982614304359";
+    private static final String DSA_2048_Q =
+        "19689526866605154788513693571065914024068069442724893395618704484701";
+    private static final String DSA_2048_G =
+        "2859278237642201956931085611015389087970918161297522023542900348087718063098423976428252369340967506010054236052095950169272612831491902295835660747775572934757474194739347115870723217560530672532404847508798651915566434553729839971841903983916294692452760249019857108409189016993380919900231322610083060784269299257074905043636029708121288037909739559605347853174853410208334242027740275688698461842637641566056165699733710043802697192696426360843173620679214131951400148855611740858610821913573088059404459364892373027492936037789337011875710759208498486908611261954026964574111219599568903257472567764789616958430";
+    private static final String DSA_2048_X =
+        "14562787764977288900757387442281559936279834964901963465277698843172";
     private static final String RSA_MOD =
         "010800185049102889923150759252557522305032794699952150943573164381" +
         "936603255999071981574575044810461362008102247767482738822150129277" +
@@ -1138,43 +1169,48 @@
         "204903524890556839550490384015324575598723478554854070823335021842" +
         "210112348400928769";
 
-    private static PublicKey getPublicKey(String algo) throws Exception {
-        return getPublicKey(algo, 512);
-    }
-
     private static PublicKey getPublicKey(String algo, int keysize)
         throws Exception {
         KeyFactory kf = KeyFactory.getInstance(algo);
         KeySpec kspec;
         if (algo.equalsIgnoreCase("DSA")) {
-            kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y),
-                                         new BigInteger(DSA_P),
-                                         new BigInteger(DSA_Q),
-                                         new BigInteger(DSA_G));
+            if (keysize == 1024) {
+                kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y),
+                                             new BigInteger(DSA_P),
+                                             new BigInteger(DSA_Q),
+                                             new BigInteger(DSA_G));
+            } else if (keysize == 2048) {
+                kspec = new DSAPublicKeySpec(new BigInteger(DSA_2048_Y),
+                                             new BigInteger(DSA_2048_P),
+                                             new BigInteger(DSA_2048_Q),
+                                             new BigInteger(DSA_2048_G));
+            } else throw new RuntimeException("Unsupported keysize:" + keysize);
         } else if (algo.equalsIgnoreCase("RSA")) {
             if (keysize == 512) {
                 kspec = new RSAPublicKeySpec(new BigInteger(RSA_MOD),
                                              new BigInteger(RSA_PUB));
-            } else {
+            } else if (keysize == 1024) {
                 kspec = new RSAPublicKeySpec(new BigInteger(RSA_1024_MOD),
                                              new BigInteger(RSA_PUB));
-            }
+            } else throw new RuntimeException("Unsupported keysize:" + keysize);
         } else throw new RuntimeException("Unsupported key algorithm " + algo);
         return kf.generatePublic(kspec);
     }
 
-    private static PrivateKey getPrivateKey(String algo) throws Exception {
-        return getPrivateKey(algo, 512);
-    }
-
     private static PrivateKey getPrivateKey(String algo, int keysize)
         throws Exception {
         KeyFactory kf = KeyFactory.getInstance(algo);
         KeySpec kspec;
         if (algo.equalsIgnoreCase("DSA")) {
-            kspec = new DSAPrivateKeySpec
-                (new BigInteger(DSA_X), new BigInteger(DSA_P),
-                 new BigInteger(DSA_Q), new BigInteger(DSA_G));
+            if (keysize == 1024) {
+                kspec = new DSAPrivateKeySpec
+                    (new BigInteger(DSA_X), new BigInteger(DSA_P),
+                     new BigInteger(DSA_Q), new BigInteger(DSA_G));
+            } else if (keysize == 2048) {
+                kspec = new DSAPrivateKeySpec
+                    (new BigInteger(DSA_2048_X), new BigInteger(DSA_2048_P),
+                     new BigInteger(DSA_2048_Q), new BigInteger(DSA_2048_G));
+            } else throw new RuntimeException("Unsupported keysize:" + keysize);
         } else if (algo.equalsIgnoreCase("RSA")) {
             if (keysize == 512) {
                 kspec = new RSAPrivateKeySpec
--- a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,8 @@
         //@@@FIXME: this should also work for key types other than DSA/RSA
         static boolean algEquals(String algURI, String algName) {
             if (algName.equalsIgnoreCase("DSA") &&
-                algURI.equals(SignatureMethod.DSA_SHA1)) {
+                algURI.equals(SignatureMethod.DSA_SHA1) ||
+                algURI.equals("http://www.w3.org/2009/xmldsig11#dsa-sha256")) {
                 return true;
             } else if (algName.equalsIgnoreCase("RSA") &&
                 (algURI.equals(SignatureMethod.RSA_SHA1) ||
--- a/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java	Mon May 12 17:01:57 2014 -0700
@@ -39,6 +39,8 @@
 import java.nio.file.StandardOpenOption;
 import java.security.MessageDigest;
 import java.util.*;
+
+import com.sun.security.auth.module.UnixSystem;
 import sun.security.jgss.GSSUtil;
 import sun.security.krb5.internal.APReq;
 import sun.security.krb5.internal.rcache.AuthTime;
@@ -59,7 +61,7 @@
                 System.getProperty("user.dir");
 
 
-    private static int uid;
+    private static long uid;
 
     public static void main0(String[] args) throws Exception {
         System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF);
@@ -78,11 +80,10 @@
             }
 
             try {
-                Class<?> clazz = Class.forName(
-                        "com.sun.security.auth.module.UnixSystem");
-                uid = (int)(long)(Long)
-                        clazz.getMethod("getUid").invoke(clazz.newInstance());
-            } catch (Exception e) {
+                UnixSystem us = new com.sun.security.auth.module.UnixSystem();
+                uid = us.getUid();
+            } catch (Throwable e) {
+                // Cannot be only Exception, might be UnsatisfiedLinkError
                 uid = -1;
             }
 
--- a/jdk/test/tools/launcher/FXLauncherTest.java	Fri May 09 09:12:39 2014 +0200
+++ b/jdk/test/tools/launcher/FXLauncherTest.java	Mon May 12 17:01:57 2014 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8001533 8004547
+ * @bug 8001533 8004547 8035782
  * @summary Test launching FX application with java -jar
  * Test uses main method and blank main method, a jfx app class and an incorrest
  * jfx app class, a main-class for the manifest, a bogus one and none.
@@ -373,6 +373,11 @@
                 System.out.println(tr);
                 throw new Exception("jfxrt.jar is being loaded, it should not be!");
             }
+            if (!tr.notContains("sun.launcher.LauncherHelper$FXHelper")) {
+                System.out.println("testing for extraneous 'sun.launcher.LauncherHelper$FXHelper'");
+                System.out.println(tr);
+                throw new Exception("FXHelper is being loaded, it should not be!");
+            }
             for (String p : APP_PARMS) {
                 if (!tr.contains(p)) {
                     System.err.println("ERROR: Did not find "
--- a/langtools/.hgtags	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/.hgtags	Mon May 12 17:01:57 2014 -0700
@@ -254,3 +254,4 @@
 2d13524486b46a0f879361fbadf68fe42d02d221 jdk9-b09
 7736a820af6f15cef9a1499f122e40abc83b2fbd jdk9-b10
 f04fccfbd880c819affc3ef33e0083aab9556409 jdk9-b11
+72efbe612e494f98b9c3ede1b4a3d02304e1e9cc jdk9-b12
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Mon May 12 17:01:57 2014 -0700
@@ -180,7 +180,7 @@
         Map<String,List<ProgramElementDoc>> map = new HashMap<>();
         List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
         if (list != null) {
-            list.sort(Util.makeComparatorForClassUse());
+            Collections.sort(list, Util.makeComparatorForClassUse());
             for (ProgramElementDoc doc : list) {
                 PackageDoc pkg = doc.containingPackage();
                 pkgSet.add(pkg);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Mon May 12 17:01:57 2014 -0700
@@ -112,7 +112,7 @@
      */
     protected void sortIndexMap() {
         for (List<Doc> docs : indexmap.values()) {
-            docs.sort(Util.makeComparatorForIndexUse());
+            Collections.sort(docs, Util.makeComparatorForIndexUse());
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon May 12 17:01:57 2014 -0700
@@ -694,10 +694,10 @@
         }
 
         /**
-         * A total ordering between type symbols that refines the
+         * A partial ordering between type symbols that refines the
          * class inheritance graph.
          *
-         * Typevariables always precede other kinds of symbols.
+         * Type variables always precede other kinds of symbols.
          */
         public final boolean precedes(TypeSymbol that, Types types) {
             if (this == that)
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Mon May 12 17:01:57 2014 -0700
@@ -1446,11 +1446,19 @@
          */
         public enum InferenceBound {
             /** upper bounds */
-            UPPER,
+            UPPER {
+                public InferenceBound complement() { return LOWER; }
+            },
             /** lower bounds */
-            LOWER,
+            LOWER {
+                public InferenceBound complement() { return UPPER; }
+            },
             /** equality constraints */
-            EQ
+            EQ {
+                public InferenceBound complement() { return EQ; }
+            };
+
+            public abstract InferenceBound complement();
         }
 
         /** inference variable bounds */
@@ -1636,6 +1644,9 @@
                 //only change bounds if request comes from substBounds
                 super.addBound(ib, bound, types, update);
             }
+            else if (bound.hasTag(UNDETVAR) && !((UndetVar) bound).isCaptured()) {
+                ((UndetVar) bound).addBound(ib.complement(), this, types, false);
+            }
         }
 
         @Override
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Mon May 12 17:01:57 2014 -0700
@@ -151,31 +151,31 @@
         };
     // </editor-fold>
 
-    // <editor-fold defaultstate="collapsed" desc="lowerBound">
+    // <editor-fold defaultstate="collapsed" desc="wildLowerBound">
     /**
-     * The "lvalue conversion".<br>
-     * The lower bound of most types is the type
-     * itself.  Wildcards, on the other hand have upper
-     * and lower bounds.
-     * @param t a type
-     * @return the lower bound of the given type
+     * Get a wildcard's lower bound, returning non-wildcards unchanged.
+     * @param t a type argument, either a wildcard or a type
      */
-    public Type lowerBound(Type t) {
-        return lowerBound.visit(t);
+    public Type wildLowerBound(Type t) {
+        if (t.hasTag(WILDCARD)) {
+            WildcardType w = (WildcardType) t;
+            return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type);
+        }
+        else return t;
     }
-    // where
-        private final MapVisitor<Void> lowerBound = new MapVisitor<Void>() {
-
-            @Override
-            public Type visitWildcardType(WildcardType t, Void ignored) {
-                return t.isExtendsBound() ? syms.botType : visit(t.type);
-            }
-
-            @Override
-            public Type visitCapturedType(CapturedType t, Void ignored) {
-                return visit(t.getLowerBound());
-            }
-        };
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="cvarLowerBound">
+    /**
+     * Get a capture variable's lower bound, returning other types unchanged.
+     * @param t a type
+     */
+    public Type cvarLowerBound(Type t) {
+        if (t.hasTag(TYPEVAR) && ((TypeVar) t).isCaptured()) {
+            return cvarLowerBound(t.getLowerBound());
+        }
+        else return t;
+    }
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="isUnbounded">
@@ -827,9 +827,14 @@
             return true;
         }
 
-        Type lower = lowerBound(s);
-        if (s != lower)
-            return isSubtype(capture ? capture(t) : t, lower, false);
+        // Generally, if 's' is a type variable, recur on lower bound; but
+        // for alpha <: CAP, alpha should get upper bound CAP
+        if (!t.hasTag(UNDETVAR)) {
+            // TODO: JDK-8039198, bounds checking sometimes passes in a wildcard as s
+            Type lower = cvarLowerBound(wildLowerBound(s));
+            if (s != lower)
+                return isSubtype(capture ? capture(t) : t, lower, false);
+        }
 
         return isSubtype.visit(capture ? capture(t) : t, s);
     }
@@ -1136,7 +1141,7 @@
                     return visit(s, t);
 
                 if (s.isSuperBound() && !s.isExtendsBound())
-                    return visit(t, upperBound(s)) && visit(t, lowerBound(s));
+                    return visit(t, upperBound(s)) && visit(t, wildLowerBound(s));
 
                 if (t.isCompound() && s.isCompound()) {
                     if (!visit(supertype(t), supertype(s)))
@@ -1291,7 +1296,7 @@
                         break;
                     }
                     case SUPER: {
-                        Type bound = lowerBound(s);
+                        Type bound = wildLowerBound(s);
                         undetvar.addBound(InferenceBound.LOWER, bound, this);
                         break;
                     }
@@ -1384,9 +1389,9 @@
 //                                  t.isSuperBound()
 //                                  || isSubtypeNoCapture(upperBound(s), U(t)));
 //                System.err.format(" %s L(%s) <: L(%s) %s = %s%n",
-//                                  L(t), t, s, lowerBound(s),
+//                                  L(t), t, s, wildLowerBound(s),
 //                                  t.isExtendsBound()
-//                                  || isSubtypeNoCapture(L(t), lowerBound(s)));
+//                                  || isSubtypeNoCapture(L(t), wildLowerBound(s)));
 //                System.err.println();
 //            }
 
@@ -1398,7 +1403,7 @@
 //                    debugContainsType(t, s);
                     return isSameWildcard(t, s)
                         || isCaptureOf(s, t)
-                        || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(s))) &&
+                        || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), wildLowerBound(s))) &&
                             (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t))));
                 }
             }
@@ -1760,7 +1765,7 @@
                     if (s.isExtendsBound())
                         return !isCastableRecursive(t.type, upperBound(s));
                     else if (s.isSuperBound())
-                        return notSoftSubtypeRecursive(lowerBound(s), t.type);
+                        return notSoftSubtypeRecursive(wildLowerBound(s), t.type);
                 } else if (t.isSuperBound()) {
                     if (s.isExtendsBound())
                         return notSoftSubtypeRecursive(t.type, upperBound(s));
@@ -1770,19 +1775,13 @@
         };
     // </editor-fold>
 
-    // <editor-fold defaultstate="collapsed" desc="lowerBoundArgtypes">
-    /**
-     * Returns the lower bounds of the formals of a method.
-     */
-    public List<Type> lowerBoundArgtypes(Type t) {
-        return lowerBounds(t.getParameterTypes());
+    // <editor-fold defaultstate="collapsed" desc="cvarLowerBounds">
+    public List<Type> cvarLowerBounds(List<Type> ts) {
+        return map(ts, cvarLowerBoundMapping);
     }
-    public List<Type> lowerBounds(List<Type> ts) {
-        return map(ts, lowerBoundMapping);
-    }
-    private final Mapping lowerBoundMapping = new Mapping("lowerBound") {
+    private final Mapping cvarLowerBoundMapping = new Mapping("cvarLowerBound") {
             public Type apply(Type t) {
-                return lowerBound(t);
+                return cvarLowerBound(t);
             }
         };
     // </editor-fold>
@@ -2251,7 +2250,8 @@
 
     // <editor-fold defaultstate="collapsed" desc="makeCompoundType">
     /**
-     * Make a compound type from non-empty list of types
+     * Make a compound type from non-empty list of types.  The list should be
+     * ordered according to {@link Symbol#precedes(TypeSymbol,Types)}.
      *
      * @param bounds            the types from which the compound type is formed
      * @param supertype         is objectType if all bounds are interfaces,
@@ -3340,12 +3340,15 @@
      * Insert a type in a closure
      */
     public List<Type> insert(List<Type> cl, Type t) {
-        if (cl.isEmpty() || t.tsym.precedes(cl.head.tsym, this)) {
+        if (cl.isEmpty()) {
             return cl.prepend(t);
-        } else if (cl.head.tsym.precedes(t.tsym, this)) {
+        } else if (t.tsym == cl.head.tsym) {
+            return cl;
+        } else if (t.tsym.precedes(cl.head.tsym, this)) {
+            return cl.prepend(t);
+        } else {
+            // t comes after head, or the two are unrelated
             return insert(cl.tail, t).prepend(cl.head);
-        } else {
-            return cl;
         }
     }
 
@@ -3357,12 +3360,15 @@
             return cl2;
         } else if (cl2.isEmpty()) {
             return cl1;
+        } else if (cl1.head.tsym == cl2.head.tsym) {
+            return union(cl1.tail, cl2.tail).prepend(cl1.head);
         } else if (cl1.head.tsym.precedes(cl2.head.tsym, this)) {
             return union(cl1.tail, cl2).prepend(cl1.head);
         } else if (cl2.head.tsym.precedes(cl1.head.tsym, this)) {
             return union(cl1, cl2.tail).prepend(cl2.head);
         } else {
-            return union(cl1.tail, cl2.tail).prepend(cl1.head);
+            // unrelated types
+            return union(cl1.tail, cl2).prepend(cl1.head);
         }
     }
 
@@ -3472,18 +3478,31 @@
     private List<Type> closureMin(List<Type> cl) {
         ListBuffer<Type> classes = new ListBuffer<>();
         ListBuffer<Type> interfaces = new ListBuffer<>();
+        Set<Type> toSkip = new HashSet<>();
         while (!cl.isEmpty()) {
             Type current = cl.head;
-            if (current.isInterface())
-                interfaces.append(current);
-            else
-                classes.append(current);
-            ListBuffer<Type> candidates = new ListBuffer<>();
-            for (Type t : cl.tail) {
-                if (!isSubtypeNoCapture(current, t))
-                    candidates.append(t);
+            boolean keep = !toSkip.contains(current);
+            if (keep && current.hasTag(TYPEVAR)) {
+                // skip lower-bounded variables with a subtype in cl.tail
+                for (Type t : cl.tail) {
+                    if (isSubtypeNoCapture(t, current)) {
+                        keep = false;
+                        break;
+                    }
+                }
             }
-            cl = candidates.toList();
+            if (keep) {
+                if (current.isInterface())
+                    interfaces.append(current);
+                else
+                    classes.append(current);
+                for (Type t : cl.tail) {
+                    // skip supertypes of 'current' in cl.tail
+                    if (isSubtypeNoCapture(current, t))
+                        toSkip.add(t);
+                }
+            }
+            cl = cl.tail;
         }
         return classes.appendList(interfaces).toList();
     }
@@ -3643,7 +3662,19 @@
             return s;
 
         List<Type> closure = union(closure(t), closure(s));
-        List<Type> bounds = closureMin(closure);
+        return glbFlattened(closure, t);
+    }
+    //where
+    /**
+     * Perform glb for a list of non-primitive, non-error, non-compound types;
+     * redundant elements are removed.  Bounds should be ordered according to
+     * {@link Symbol#precedes(TypeSymbol,Types)}.
+     *
+     * @param flatBounds List of type to glb
+     * @param errT Original type to use if the result is an error type
+     */
+    private Type glbFlattened(List<Type> flatBounds, Type errT) {
+        List<Type> bounds = closureMin(flatBounds);
 
         if (bounds.isEmpty()) {             // length == 0
             return syms.objectType;
@@ -3651,11 +3682,21 @@
             return bounds.head;
         } else {                            // length > 1
             int classCount = 0;
-            for (Type bound : bounds)
-                if (!bound.isInterface())
+            List<Type> lowers = List.nil();
+            for (Type bound : bounds) {
+                if (!bound.isInterface()) {
                     classCount++;
-            if (classCount > 1)
-                return createErrorType(t);
+                    Type lower = cvarLowerBound(bound);
+                    if (bound != lower && !lower.hasTag(BOT))
+                        lowers = insert(lowers, lower);
+                }
+            }
+            if (classCount > 1) {
+                if (lowers.isEmpty())
+                    return createErrorType(errT);
+                else
+                    return glbFlattened(union(bounds, lowers), errT);
+            }
         }
         return makeCompoundType(bounds);
     }
@@ -3929,8 +3970,13 @@
                     Si.lower = Ti.getSuperBound();
                     break;
                 }
-                if (Si.bound == Si.lower)
+                Type tmpBound = Si.bound.hasTag(UNDETVAR) ? ((UndetVar)Si.bound).qtype : Si.bound;
+                Type tmpLower = Si.lower.hasTag(UNDETVAR) ? ((UndetVar)Si.lower).qtype : Si.lower;
+                if (!Si.bound.hasTag(ERROR) &&
+                    !Si.lower.hasTag(ERROR) &&
+                    isSameType(tmpBound, tmpLower, false)) {
                     currentS.head = Si.bound;
+                }
             }
             currentA = currentA.tail;
             currentT = currentT.tail;
@@ -4135,7 +4181,7 @@
             if (source.isExtendsBound())
                 adaptRecursive(upperBound(source), upperBound(target));
             else if (source.isSuperBound())
-                adaptRecursive(lowerBound(source), lowerBound(target));
+                adaptRecursive(wildLowerBound(source), wildLowerBound(target));
             return null;
         }
 
@@ -4147,7 +4193,7 @@
             Type val = mapping.get(source.tsym);
             if (val != null) {
                 if (val.isSuperBound() && target.isSuperBound()) {
-                    val = isSubtype(lowerBound(val), lowerBound(target))
+                    val = isSubtype(wildLowerBound(val), wildLowerBound(target))
                         ? target : val;
                 } else if (val.isExtendsBound() && target.isExtendsBound()) {
                     val = isSubtype(upperBound(val), upperBound(target))
@@ -4261,7 +4307,7 @@
         }
 
         public Type visitType(Type t, Void s) {
-            return high ? upperBound(t) : lowerBound(t);
+            return high ? upperBound(t) : t;
         }
 
         @Override
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon May 12 17:01:57 2014 -0700
@@ -3214,6 +3214,14 @@
         result = checkId(tree, env1.enclClass.sym.type, sym, env, resultInfo);
     }
 
+    /** Report dependencies.
+     * @param from The enclosing class sym
+     * @param to   The found identifier that the class depends on.
+     */
+    public void reportDependence(Symbol from, Symbol to) {
+        // Override if you want to collect the reported dependencies.
+    }
+
     public void visitSelect(JCFieldAccess tree) {
         // Determine the expected kind of the qualifier expression.
         int skind = 0;
@@ -3341,6 +3349,10 @@
 
         env.info.selectSuper = selectSuperPrev;
         result = checkId(tree, site, sym, env, resultInfo);
+
+        if ((tree.sym.kind & TYP) != 0) {
+            reportDependence(env.enclClass.sym, tree.sym);
+        }
     }
     //where
         /** Determine symbol referenced by a Select expression,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon May 12 17:01:57 2014 -0700
@@ -626,7 +626,7 @@
          } else if (a.isExtendsBound()) {
              return types.isCastable(bound, types.upperBound(a), types.noWarnings);
          } else if (a.isSuperBound()) {
-             return !types.notSoftSubtype(types.lowerBound(a), bound);
+             return !types.notSoftSubtype(types.wildLowerBound(a), bound);
          }
          return true;
      }
@@ -2730,7 +2730,7 @@
         if (types.isSameType(type, syms.stringType)) return;
         if ((type.tsym.flags() & Flags.ENUM) != 0) return;
         if ((type.tsym.flags() & Flags.ANNOTATION) != 0) return;
-        if (types.lowerBound(type).tsym == syms.classType.tsym) return;
+        if (types.cvarLowerBound(type).tsym == syms.classType.tsym) return;
         if (types.isArray(type) && !types.isArray(types.elemtype(type))) {
             validateAnnotationType(pos, types.elemtype(type));
             return;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon May 12 17:01:57 2014 -0700
@@ -1458,7 +1458,7 @@
             Type solve(UndetVar uv, InferenceContext inferenceContext) {
                 Infer infer = inferenceContext.infer();
                 List<Type> hibounds = filterBounds(uv, inferenceContext);
-                //note: lobounds should have at least one element
+                //note: hibounds should have at least one element
                 Type owntype = hibounds.tail.tail == null  ? hibounds.head : infer.types.glb(hibounds);
                 if (owntype.isPrimitive() || owntype.hasTag(ERROR)) {
                     throw infer.inferenceException
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon May 12 17:01:57 2014 -0700
@@ -1552,7 +1552,7 @@
             currentResolutionContext.methodCheck =
                     prevResolutionContext.methodCheck.mostSpecificCheck(actuals, !allowBoxing);
             Type mst = instantiate(env, site, m2, null,
-                    adjustArgs(types.lowerBounds(types.memberType(site, m1).getParameterTypes()), m1, maxLength, useVarargs), null,
+                    adjustArgs(types.cvarLowerBounds(types.memberType(site, m1).getParameterTypes()), m1, maxLength, useVarargs), null,
                     allowBoxing, useVarargs, noteWarner);
             return mst != null &&
                     !noteWarner.hasLint(Lint.LintCategory.UNCHECKED);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon May 12 17:01:57 2014 -0700
@@ -131,6 +131,12 @@
     public boolean preferSource;
 
     /**
+     * Switch: Search classpath and sourcepath for classes before the
+     * bootclasspath
+     */
+    public boolean userPathsFirst;
+
+    /**
      * The currently selected profile.
      */
     public final Profile profile;
@@ -270,6 +276,7 @@
         saveParameterNames = options.isSet("save-parameter-names");
         cacheCompletionFailure = options.isUnset("dev");
         preferSource = "source".equals(options.get("-Xprefer"));
+        userPathsFirst = options.isSet(XXUSERPATHSFIRST);
 
         profile = Profile.instance(context);
 
@@ -2649,7 +2656,7 @@
                 if (c.owner == p)  // it might be an inner class
                     p.members_field.enter(c);
             }
-        } else if (c.classfile != null && (c.flags_field & seen) == 0) {
+        } else if (!preferCurrent && c.classfile != null && (c.flags_field & seen) == 0) {
             // if c.classfile == null, we are currently compiling this class
             // and no further action is necessary.
             // if (c.flags_field & seen) != 0, we have already encountered
@@ -2695,19 +2702,32 @@
 
     private boolean verbosePath = true;
 
+    // Set to true when the currently selected file should be kept
+    private boolean preferCurrent;
+
     /** Load directory of package into members scope.
      */
     private void fillIn(PackageSymbol p) throws IOException {
-        if (p.members_field == null) p.members_field = new Scope(p);
-        String packageName = p.fullname.toString();
-
-        Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
+        if (p.members_field == null)
+            p.members_field = new Scope(p);
 
-        fillIn(p, PLATFORM_CLASS_PATH,
-               fileManager.list(PLATFORM_CLASS_PATH,
-                                packageName,
-                                EnumSet.of(JavaFileObject.Kind.CLASS),
-                                false));
+        preferCurrent = false;
+        if (userPathsFirst) {
+            scanUserPaths(p);
+            preferCurrent = true;
+            scanPlatformPath(p);
+        } else {
+            scanPlatformPath(p);
+            scanUserPaths(p);
+        }
+        verbosePath = false;
+    }
+
+    /**
+     * Scans class path and source path for files in given package.
+     */
+    private void scanUserPaths(PackageSymbol p) throws IOException {
+        Set<JavaFileObject.Kind> kinds = getPackageFileKinds();
 
         Set<JavaFileObject.Kind> classKinds = EnumSet.copyOf(kinds);
         classKinds.remove(JavaFileObject.Kind.SOURCE);
@@ -2748,6 +2768,7 @@
             }
         }
 
+        String packageName = p.fullname.toString();
         if (wantSourceFiles && !haveSourcePath) {
             fillIn(p, CLASS_PATH,
                    fileManager.list(CLASS_PATH,
@@ -2768,7 +2789,17 @@
                                         sourceKinds,
                                         false));
         }
-        verbosePath = false;
+    }
+
+    /**
+     * Scans platform class path for files in given package.
+     */
+    private void scanPlatformPath(PackageSymbol p) throws IOException {
+        fillIn(p, PLATFORM_CLASS_PATH,
+               fileManager.list(PLATFORM_CLASS_PATH,
+                                p.fullname.toString(),
+                                EnumSet.of(JavaFileObject.Kind.CLASS),
+                                false));
     }
     // where
         private void fillIn(PackageSymbol p,
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Option.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Option.java	Mon May 12 17:01:57 2014 -0700
@@ -416,6 +416,8 @@
 
     XPREFER("-Xprefer:", "opt.prefer", EXTENDED, BASIC, ONEOF, "source", "newer"),
 
+    XXUSERPATHSFIRST("-XXuserPathsFirst", "opt.userpathsfirst", HIDDEN, BASIC),
+
     // see enum PkgInfo
     XPKGINFO("-Xpkginfo:", "opt.pkginfo", EXTENDED, BASIC, ONEOF, "always", "legacy", "nonempty"),
 
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/javac.properties	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/javac.properties	Mon May 12 17:01:57 2014 -0700
@@ -240,6 +240,8 @@
     Print information about rounds of annotation processing
 javac.opt.printProcessorInfo=\
     Print information about which annotations a processor is asked to process
+javac.opt.userpathsfirst=\
+    Search classpath and sourcepath for classes before the bootclasspath instead of after
 javac.opt.prefer=\
     Specify which file to read when both a source file and class file are found for an implicitly compiled class
 javac.opt.AT=\
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Source.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Source.java	Mon May 12 17:01:57 2014 -0700
@@ -313,7 +313,7 @@
             int sp = fn.lastIndexOf(File.separatorChar);
             String pkg = "";
             if (sp != -1) {
-                pkg = fn.substring(0,sp);
+                pkg = fn.substring(0,sp).replace('/','.');
             }
             // Is this a module-info.java file?
             if (fn.endsWith("module-info.java")) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/AttrWithDeps.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * 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.sjavac.comp;
+
+import com.sun.tools.javac.comp.Attr;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.code.Symbol;
+
+/** Subclass to Attr that overrides reportDepedence.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public class AttrWithDeps extends Attr {
+
+    /** The dependency database
+     */
+    protected Dependencies deps;
+
+    protected AttrWithDeps(Context context) {
+        super(context);
+        deps = Dependencies.instance(context);
+    }
+
+    public static void preRegister(Context context) {
+        context.put(attrKey, new Context.Factory<Attr>() {
+            public Attr make(Context c) {
+                Attr instance = new AttrWithDeps(c);
+                c.put(Attr.class, instance);
+                return instance;
+            }
+        });
+    }
+
+    /** Collect dependencies in the enclosing class
+     * @param from The enclosing class sym
+     * @param to   The enclosing classes references this sym.
+     * */
+    @Override
+    public void reportDependence(Symbol from, Symbol to) {
+        // Capture dependencies between the packages.
+        deps.collect(from.packge().fullname, to.packge().fullname);
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java	Mon May 12 17:01:57 2014 -0700
@@ -51,6 +51,7 @@
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.StringUtils;
+import com.sun.tools.sjavac.comp.AttrWithDeps;
 import com.sun.tools.sjavac.comp.Dependencies;
 import com.sun.tools.sjavac.comp.JavaCompilerWithDeps;
 import com.sun.tools.sjavac.comp.SmartFileManager;
@@ -131,6 +132,7 @@
         context = new Context();
         context.put(JavaFileManager.class, smartFileManager);
         ResolveWithDeps.preRegister(context);
+        AttrWithDeps.preRegister(context);
         JavaCompilerWithDeps.preRegister(context, this);
         subTasks = new ArrayList<>();
     }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java	Mon May 12 17:01:57 2014 -0700
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 1234567
+ * @bug 8026564
  * @summary The parts of a fully-qualified type can't be annotated.
  * @author Werner Dietl
  * @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.java	Mon May 12 17:01:57 2014 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 1234567
+ * @bug 8026564
  * @summary A missing annotation type in a type variable bound
  *     should result in the same errors with and without an
  *     annotation processor.
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.java	Mon May 12 17:01:57 2014 -0700
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 1234567
+ * @bug 8013852
  * @summary ensure that declaration annotations are not allowed on
  *   new array expressions
  * @author Werner Dietl
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DeclarationAnnotation.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DeclarationAnnotation.java	Mon May 12 17:01:57 2014 -0700
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 1234567
+ * @bug 8013852
  * @summary ensure that declaration annotations are not allowed on
  *   method receiver types
  * @author Werner Dietl
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DeclarationAnnotation.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DeclarationAnnotation.java	Mon May 12 17:01:57 2014 -0700
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 1234567
+ * @bug 8013852
  * @summary ensure that declaration annotations are not allowed on
  *   wildcards
  * @author Werner Dietl
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/AnonymousClass.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/AnonymousClass.java	Mon May 12 17:01:57 2014 -0700
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 1234567
+ * @bug 8013852
  * @summary new type annotation location: anonymous class creation
  * @author Werner Dietl
  * @compile AnonymousClass.java
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java	Mon May 12 17:01:57 2014 -0700
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 1234567
+ * @bug 8013852
  * @summary Test population of reference info for instance and class initializers
  * @author Werner Dietl
  * @compile -g Driver.java ReferenceInfoUtil.java Initializers.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 sourcefile attribute test for anonymous class.
+ * @bug 8040129
+ * @library /tools/javac/lib ../lib
+ * @build SourceFileTestBase TestBase InMemoryFileManager ToolBox
+ * @run main AnonymousClassTest
+ */
+
+public class AnonymousClassTest extends SourceFileTestBase {
+    public static void main(String[] args) throws Exception {
+        new AnonymousClassTest().test(new Object(){}.getClass(), "AnonymousClassTest.java");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 sourcefile attribute test for inner class.
+ * @bug 8040129
+ * @library /tools/javac/lib ../lib
+ * @build SourceFileTestBase TestBase InMemoryFileManager ToolBox
+ * @run main InnerClassTest
+ */
+
+public class InnerClassTest extends SourceFileTestBase {
+    public static void main(String[] args) throws Exception {
+        new InnerClassTest().test(Inner.class, "InnerClassTest.java");
+    }
+
+    class Inner {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 sourcefile attribute test for local class.
+ * @bug 8040129
+ * @library /tools/javac/lib ../lib
+ * @build SourceFileTestBase TestBase InMemoryFileManager ToolBox
+ * @run main LocalClassTest
+ */
+
+public class LocalClassTest extends SourceFileTestBase {
+    public static void main(String[] args) throws Exception {
+        class Local {
+        }
+        new LocalClassTest().test(Local.class, "LocalClassTest.java");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/MixTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 sourcefile attribute test for complex structure of nested classes and other types.
+ * @bug 8040129
+ * @library /tools/javac/lib ../lib
+ * @build SourceFileTestBase TestBase InMemoryFileManager ToolBox
+ * @run main MixTest
+ */
+
+public class MixTest extends SourceFileTestBase {
+    public static void main(String[] args) throws Exception {
+        new InnerClass();
+        Runnable r = new Runnable() {
+            @Override
+            public void run() {
+                Runnable run = () -> {
+                    class Local {
+                    }
+                };
+            }
+
+            class innerInAnonymous {
+            }
+        };
+
+        new MixTest().run();
+    }
+
+    public void run() throws Exception {
+        String fileName = getClass().getName() + ".java";
+        test("MixTest", fileName);
+        test("MixTest$1", fileName);
+        test("MixTest$InnerClass", fileName);
+        test("MixTest$1$innerInAnonymous", fileName);
+        test("MixTest$1$1Local", fileName);
+        test("MixTest$InnerClass$innerEnum", fileName);
+        test("MixTest$InnerClass$innerInterface", fileName);
+        test("MixTest$InnerClass$innerEnum$innerClassInnerEnum", fileName);
+        test("MixTest$InnerClass$innerEnum$innerClassInnerEnum$1InnerLocal", fileName);
+    }
+
+    static class InnerClass {
+        private InnerClass() {
+        }
+
+        enum innerEnum {
+            E;
+
+            class innerClassInnerEnum {
+                void method() {
+                    class InnerLocal {
+                    }
+                }
+            }
+        }
+
+        @interface innerInterface {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 sourcefile attribute test for file compiled without debug information.
+ * @library /tools/javac/lib ../lib
+ * @build SourceFileTestBase TestBase InMemoryFileManager ToolBox
+ * @compile -g:none NoSourceFileAttribute.java
+ * @run main  NoSourceFileAttribute
+ */
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+
+import java.io.IOException;
+
+
+public class NoSourceFileAttribute extends TestBase {
+    public static void main(String[] args) throws Exception {
+        new NoSourceFileAttribute().test();
+    }
+
+    public void test() throws IOException, ConstantPoolException {
+        assertNull(
+                ClassFile.read(getClassFile(NoSourceFileAttribute.class)).getAttribute(Attribute.SourceFile),
+                "Classfile should have no SourceFile attribute when compiled without debug information.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.SourceFile_attribute;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import javax.tools.JavaFileObject;
+
+public class SourceFileTestBase extends TestBase {
+
+    protected void test(Class<?> classToTest, String fileName) throws Exception {
+        assertAttributePresent(ClassFile.read(getClassFile(classToTest)), fileName);
+    }
+
+    protected void test(String classToTest, String fileName) throws Exception {
+        assertAttributePresent(ClassFile.read(getClassFile(classToTest + ".class")), fileName);
+    }
+
+    /**
+     * Compile sourceCode and for all "classesToTest" checks SourceFile attribute.
+     */
+    protected void compileAndTest(String sourceCode, String... classesToTest) throws Exception {
+
+        Map<String, ? extends JavaFileObject> classes = compile(sourceCode);
+        String fileName = ToolBox.getJavaFileNameFromSource(sourceCode);
+        for (String className : classesToTest) {
+            assertAttributePresent(ClassFile.read(classes.get(className).openInputStream()), fileName);
+        }
+    }
+
+    private void assertAttributePresent(ClassFile classFile, String fileName) throws Exception {
+
+        //We need to count attributes with the same names because there is no appropriate API in the ClassFile.
+
+        List<SourceFile_attribute> sourceFileAttributes = new ArrayList<>();
+        for (Attribute a : classFile.attributes.attrs) {
+            if (Attribute.SourceFile.equals(a.getName(classFile.constant_pool))) {
+                sourceFileAttributes.add((SourceFile_attribute) a);
+            }
+        }
+
+        assertEquals(sourceFileAttributes.size(), 1, "Should be the only SourceFile attribute");
+
+        SourceFile_attribute attribute = sourceFileAttributes.get(0);
+
+        assertEquals(classFile.constant_pool.getUTF8Info(attribute.attribute_name_index).value,
+                Attribute.SourceFile, "Incorrect attribute name");
+        assertEquals(classFile.constant_pool.getUTF8Info(attribute.sourcefile_index).value, fileName,
+                "Incorrect source file name");
+        assertEquals(attribute.attribute_length, 2, "Incorrect attribute length");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 sourcefile attribute test for synthetic class.
+ * @bug 8040129
+ * @library /tools/javac/lib ../lib
+ * @build SourceFileTestBase TestBase InMemoryFileManager ToolBox
+ * @run main SyntheticClassTest
+ */
+
+public class SyntheticClassTest extends SourceFileTestBase {
+    public static void main(String[] args) throws Exception {
+        new Inner();
+
+        new SyntheticClassTest().test("SyntheticClassTest$1", "SyntheticClassTest.java");
+    }
+
+    static class Inner {
+        private Inner() {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 sourcefile attribute test for two type in one file.
+ * @bug 8040129
+ * @library /tools/javac/lib ../lib
+ * @build SourceFileTestBase TestBase InMemoryFileManager ToolBox
+ * @run main TopLevelClassesOneFileTest
+ */
+
+public class TopLevelClassesOneFileTest extends SourceFileTestBase {
+    public static void main(String[] args) throws Exception {
+        new TopLevelClassesOneFileTest().run();
+    }
+
+    public void run() throws Exception {
+        int failed = 0;
+        for (Type firstType : Type.values()) {
+            for (Type secondType : Type.values()) {
+                if (firstType != secondType) {
+                    try {
+                        compileAndTest("public " + firstType.source + secondType.source,
+                                firstType.name(), secondType.name());
+                    } catch (AssertionFailedException | CompilationException ex) {
+                        System.err.println("Failed with public type " + firstType.name()
+                                + " and type " + secondType.name());
+                        ex.printStackTrace();
+                        failed++;
+                    }
+                }
+            }
+        }
+        if (failed > 0)
+            throw new AssertionFailedException("Test failed. Failed cases count = " + failed + " .See log.");
+    }
+
+    enum Type {
+        CLASS("class CLASS{}"),
+        INTERFACE("interface INTERFACE{}"),
+        ENUM("enum ENUM{;}"),
+        ANNOTATION("@interface ANNOTATION{}");
+
+        String source;
+
+        Type(String source) {
+            this.source = source;
+        }
+    }
+}
--- a/langtools/test/tools/javac/generics/inference/7086586/T7086586.out	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/generics/inference/7086586/T7086586.out	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
-T7086586.java:14:20: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>))
-T7086586.java:15:20: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>))
-T7086586.java:16:23: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>))
-T7086586.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>))
+T7086586.java:14:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.type.captureof: 1, ?, java.lang.String)
+T7086586.java:15:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.type.captureof: 1, ?, java.lang.Number)
+T7086586.java:16:31: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.type.captureof: 1, ?, java.lang.Exception)
+T7086586.java:17:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistentMethod, , , (compiler.misc.location: kindname.interface, java.util.List<compiler.misc.type.captureof: 1, ?>, null)
 4 errors
--- a/langtools/test/tools/javac/generics/inference/7086586/T7086586b.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/generics/inference/7086586/T7086586b.java	Mon May 12 17:01:57 2014 -0700
@@ -23,9 +23,10 @@
 
 /*
  * @test
- * @bug 7086586
+ * @bug 7086586 8033718
  *
- * @summary Inference producing null type argument
+ * @summary Inference producing null type argument; inference ignores capture
+ *          variable as upper bound
  */
 import java.util.List;
 
@@ -40,8 +41,8 @@
         assertionCount++;
     }
 
-    <T> void m(List<? super T> dummy) { assertTrue(false); }
-    <T> void m(Object dummy) { assertTrue(true); }
+    <T> void m(List<? super T> dummy) { assertTrue(true); }
+    <T> void m(Object dummy) { assertTrue(false); }
 
     void test(List<?> l) {
         m(l);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/LowerBoundGLB.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 8033718
+ * @author dlsmith
+ * @summary GLB for two capture variables with lower bounds
+ * @compile LowerBoundGLB.java
+ */
+
+public class LowerBoundGLB {
+
+    interface Box<T> {
+        T get();
+        void set(T arg);
+    }
+
+    <T> T doGLB(Box<? super T> b1, Box<? super T> b2) {
+        return null;
+    }
+
+    void test(Box<? super String> l1, Box<? super CharSequence> l2) {
+        doGLB(l1, l2).substring(3);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/wildcards/RefQueue.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 RefQueue<S> { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/wildcards/RefQueueBug.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 8033437
+ * @summary inconsistent generic types behaviour when compiling together vs. separate
+ * @compile RefQueue.java
+ * @compile RefQueueBug.java
+ */
+
+public class RefQueueBug<T> {
+    final RefQueue<? super T> queue = new RefQueue<>();
+    public static void main(String[] args) {
+        RefQueueBug<Object> r = new RefQueueBug<>();
+        RefQueue<Object> q = r.queue;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/options/xprefer/XPreferTest.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,385 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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 Tests which path is used to represent an implicit type given
+ * various xprefer arguments and multiple .class / .java files involved.
+ * @bug 8028196
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+import java.util.Scanner;
+
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.ToolProvider;
+
+
+public class XPreferTest {
+
+    enum Dir {
+        SOURCE_PATH("src"),
+        CLASS_PATH("cp"),
+        BOOT_PATH("boot");
+
+        File file;
+        Dir(String dir) {
+            this.file = new File(dir);
+        }
+    }
+
+    enum ImplicitOption {
+        XPREFER_SOURCE("-Xprefer:source"),
+        XPREFER_NEWER("-Xprefer:newer"),
+        XXUSERPATHSFIRST("-XXuserPathsFirst");
+
+        final String optionString;
+        private ImplicitOption(String optionString) {
+            this.optionString = optionString;
+        }
+    }
+
+    final static JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+    final static File OUTPUT_DIR = new File("out");
+
+    public static void main(String... args) throws Exception {
+
+        // Initialize test-directories
+        OUTPUT_DIR.mkdir();
+        for (Dir dir : Dir.values())
+            dir.file.mkdir();
+
+        int testCaseCounter = 0;
+
+        for (List<Dir> dirSubset : SubseqIter.subseqsOf(Dir.values())) {
+
+            if (dirSubset.isEmpty())
+                continue;
+
+            for (ImplicitOption policy : ImplicitOption.values()) {
+                for (List<Dir> dirOrder : PermutationIterator.permutationsOf(dirSubset)) {
+                    new TestCase(dirOrder, policy, testCaseCounter++).run();
+                }
+            }
+        }
+    }
+
+    static class TestCase {
+
+        String classId;
+        List<Dir> dirs;
+        ImplicitOption option;
+
+        public TestCase(List<Dir> dirs, ImplicitOption option, int testCaseNum) {
+            this.dirs = dirs;
+            this.option = option;
+            this.classId = "XPreferTestImplicit" + testCaseNum;
+        }
+
+        void run() throws Exception {
+
+            System.out.println("Test:");
+            System.out.println("    Class id: " + classId);
+            System.out.println("    Dirs:     " + dirs);
+            System.out.println("    Option:   " + option);
+
+            createTestFiles();
+            String compileOutput = compile();
+            Dir actual = getChosenOrigin(compileOutput);
+            Dir expected = getExpectedOrigin();
+
+            System.out.println("    Expected: " + expected);
+            System.out.println("    Actual:   " + actual);
+
+            if (actual != expected) {
+                throw new RuntimeException(String.format(
+                        "Expected javac to choose %s but %s was chosen",
+                        expected == null ? "<none>" : expected.name(),
+                        actual   == null ? "<none>" : actual.name()));
+            }
+        }
+
+        Dir getExpectedOrigin() {
+
+            Dir newest = dirs.get(0);
+
+            switch (option) {
+
+            case XPREFER_NEWER:
+
+                Dir cls = dirs.contains(Dir.BOOT_PATH) ? Dir.BOOT_PATH
+                        : dirs.contains(Dir.CLASS_PATH) ? Dir.CLASS_PATH
+                        : null;
+
+                Dir src = dirs.contains(Dir.SOURCE_PATH) ? Dir.SOURCE_PATH
+                        : null;
+
+                for (Dir dir : dirs)
+                    if (dir == cls || dir == src)
+                        return dir;
+
+                return null;
+
+            case XPREFER_SOURCE:
+                return dirs.contains(Dir.SOURCE_PATH) ? Dir.SOURCE_PATH
+                     : dirs.contains(Dir.BOOT_PATH) ? Dir.BOOT_PATH
+                     : dirs.contains(Dir.CLASS_PATH) ? Dir.CLASS_PATH
+                     : null;
+
+            case XXUSERPATHSFIRST:
+
+                for (Dir dir : dirs)
+                    if (dir == Dir.SOURCE_PATH || dir == Dir.CLASS_PATH)
+                        return dir;
+
+                // Neither SOURCE_PATH nor CLASS_PATH among dirs. Safty check:
+                if (newest != Dir.BOOT_PATH)
+                    throw new AssertionError("Expected to find BOOT_PATH");
+
+                return Dir.BOOT_PATH;
+
+            default:
+                throw new RuntimeException("Unhandled policy case.");
+            }
+        }
+
+        Dir getChosenOrigin(String compilerOutput) {
+            Scanner s = new Scanner(compilerOutput);
+            while (s.hasNextLine()) {
+                String line = s.nextLine();
+                if (line.matches("\\[loading .*\\]"))
+                    for (Dir dir : Dir.values())
+                        if (line.contains(dir.file.getName() + "/" + classId))
+                            return dir;
+            }
+            return null;
+        }
+
+        String compile() throws IOException {
+
+            // Create a class that references classId
+            File explicit = new File("ExplicitClass.java");
+            FileWriter filewriter = new FileWriter(explicit);
+            filewriter.append("class ExplicitClass { " + classId + " implicit; }");
+            filewriter.close();
+
+            StringWriter sw = new StringWriter();
+
+            com.sun.tools.javac.Main.compile(new String[] {
+                    "-verbose",
+                    option.optionString,
+                    "-sourcepath", Dir.SOURCE_PATH.file.getPath(),
+                    "-classpath", Dir.CLASS_PATH.file.getPath(),
+                    "-Xbootclasspath/p:" + Dir.BOOT_PATH.file.getPath(),
+                    "-d", XPreferTest.OUTPUT_DIR.getPath(),
+                    explicit.getPath()
+            }, new PrintWriter(sw));
+
+            return sw.toString();
+        }
+
+        void createTestFiles() throws IOException {
+            long t = 1390927988755L;  // Tue Jan 28 17:53:08 CET 2014
+            for (Dir dir : dirs) {
+                createFile(dir).setLastModified(t);
+                t -= 10000;
+            }
+        }
+
+        File createFile(Dir dir) throws IOException {
+            File src = new File(dir.file, classId + ".java");
+            try (FileWriter w = new FileWriter(src)) {
+                w.append("public class " + classId + " {}");
+            }
+            // If we're after the ".java" representation, we're done...
+            if(dir == Dir.SOURCE_PATH)
+                return src;
+            // ...otherwise compile into a ".class".
+            CompilationTask task = comp.getTask(null, null, null, null, null,
+                    comp.getStandardFileManager(null, null, null).getJavaFileObjects(src));
+            File dest = new File(dir.file, classId + ".class");
+            if(!task.call() || !dest.exists())
+                throw new RuntimeException("Compilation failure.");
+            src.delete();
+            return dest;
+        }
+    }
+}
+
+// Iterator for iteration over all subsequences of a given list.
+class SubseqIter<T> implements Iterator<List<T>> {
+
+    List<T> elements;
+    boolean[] states;
+
+    public SubseqIter(Collection<T> c) {
+        states = new boolean[c.size()];
+        elements = new ArrayList<T>(c);
+    }
+
+    public static <T> Iterable<List<T>> subseqsOf(final T[] t) {
+        return new Iterable<List<T>>() {
+            @Override
+            public Iterator<List<T>> iterator() {
+                return new SubseqIter<T>(Arrays.asList(t));
+            }
+        };
+    }
+
+    // Roll values in 'states' from index i and forward.
+    // Return true if we wrapped back to zero.
+    private boolean roll(int i) {
+        if (i == states.length)
+            return true;
+        if (!roll(i + 1))
+            return false;
+        states[i] = !states[i];
+        return !states[i];
+    }
+
+    @Override
+    public List<T> next() {
+        if (!hasNext())
+            throw new NoSuchElementException();
+        // Include element i if states[i] is true
+        List<T> next = new ArrayList<T>();
+        for (int i = 0; i < states.length; i++)
+            if (states[i])
+                next.add(elements.get(i));
+        if (roll(0))
+            states = null; // hasNext() == false from now on.
+        return next;
+    }
+
+    @Override
+    public boolean hasNext() {
+        return states != null;
+    }
+
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException();
+    }
+}
+
+class PermutationIterator<T> implements Iterator<List<T>> {
+
+    DirInt head;
+    boolean hasNext = true;
+
+    public PermutationIterator(List<T> toPermute) {
+        ListIterator<T> iter = toPermute.listIterator();
+        if (iter.hasNext())
+            head = new DirInt(iter.nextIndex(), iter.next());
+        DirInt prev = head;
+        while (iter.hasNext()) {
+            DirInt di = new DirInt(iter.nextIndex(), iter.next());
+            di.left = prev;
+            prev.right = di;
+            prev = di;
+        }
+    }
+
+    public static <T> Iterable<List<T>> permutationsOf(final List<T> list) {
+        return new Iterable<List<T>>() {
+            public Iterator<List<T>> iterator() {
+                return new PermutationIterator<>(list);
+            }
+        };
+    }
+
+    @Override
+    public boolean hasNext() {
+        return hasNext;
+    }
+
+    @Override
+    public List<T> next() {
+        // Prep return value based on current state
+        List<T> result = new ArrayList<>();
+        for (DirInt di = head; di != null; di = di.right)
+            result.add(di.object);
+
+        // Step state forward
+        DirInt maxMob = null;
+        for (DirInt di = head; di != null; di = di.right)
+            if (di.isMobile() && (maxMob == null || di.val > maxMob.val))
+                maxMob = di;
+
+        if (maxMob == null) {
+            hasNext = false;
+        } else {
+            maxMob.swapWithAdjacent();
+            for (DirInt di = head; di != null; di = di.right)
+                if (di.val > maxMob.val)
+                    di.facingLeft = !di.facingLeft;
+        }
+        return result;
+    }
+
+    private final class DirInt {
+        int val;
+        T object;
+        DirInt left, right;
+        boolean facingLeft = true;
+
+        public DirInt(int val, T object) {
+            this.val = val;
+            this.object = object;
+        }
+
+        boolean isMobile() {
+            DirInt adjacent = facingLeft ? left : right;
+            return adjacent != null && val > adjacent.val;
+        }
+
+        public void swapWithAdjacent() {
+            DirInt l = facingLeft ? left : this;
+            DirInt r = facingLeft ? this : right;
+            if (head == l) head = r;
+            if (l.left  != null) l.left.right = r;
+            if (r.right != null) r.right.left = l;
+            l.right = r.right;
+            r.left = l.left;
+            r.right = l;
+            l.left = r;
+        }
+    }
+
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException();
+    }
+}
--- a/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java	Mon May 12 17:01:57 2014 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     1234567
+ * @bug     8013852
  * @summary Annotations on types
  * @library /tools/javac/lib
  * @ignore
--- a/langtools/test/tools/sjavac/SJavac.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/sjavac/SJavac.java	Mon May 12 17:01:57 2014 -0700
@@ -83,6 +83,7 @@
         compileWithInvisibleSources();
         compileCircularSources();
         compileExcludingDependency();
+        incrementalCompileTestFullyQualifiedRef();
 
         delete(gensrc);
         delete(gensrc2);
@@ -95,15 +96,15 @@
         System.out.println("\nInitial compile of gensrc.");
         System.out.println("----------------------------");
         populate(gensrc,
-            "alfa/AINT.java",
-            "package alfa; public interface AINT { void aint(); }",
+            "alfa/omega/AINT.java",
+            "package alfa.omega; public interface AINT { void aint(); }",
 
-            "alfa/A.java",
-            "package alfa; public class A implements AINT { "+
+            "alfa/omega/A.java",
+            "package alfa.omega; public class A implements AINT { "+
                  "public final static int DEFINITION = 17; public void aint() { } }",
 
-            "alfa/AA.java",
-            "package alfa;"+
+            "alfa/omega/AA.java",
+            "package alfa.omega;"+
             "// A package private class, not contributing to the public api.\n"+
             "class AA {"+
             "   // A properly nested static inner class.\n"+
@@ -127,7 +128,7 @@
             "package beta;public interface BINT { void foo(); }",
 
             "beta/B.java",
-            "package beta; import alfa.A; public class B {"+
+            "package beta; import alfa.omega.A; public class B {"+
             "private int b() { return A.DEFINITION; } native void foo(); }");
 
         compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
@@ -151,16 +152,16 @@
         System.out.println("\nTesting that deleting AA.java deletes all");
         System.out.println("generated inner class as well as AA.class");
         System.out.println("-----------------------------------------");
-        removeFrom(gensrc, "alfa/AA.java");
+        removeFrom(gensrc, "alfa/omega/AA.java");
         compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
                 "--server:portfile=testserver,background=false", "--log=debug");
         Map<String,Long> new_bin_state = collectState(bin);
         verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state,
-                                       "bin/alfa/AA$1.class",
-                                       "bin/alfa/AA$AAAA.class",
-                                       "bin/alfa/AA$AAA.class",
-                                       "bin/alfa/AAAAA.class",
-                                       "bin/alfa/AA.class");
+                                       "bin/alfa/omega/AA$1.class",
+                                       "bin/alfa/omega/AA$AAAA.class",
+                                       "bin/alfa/omega/AA$AAA.class",
+                                       "bin/alfa/omega/AAAAA.class",
+                                       "bin/alfa/omega/AA.class");
 
         previous_bin_state = new_bin_state;
         Map<String,Long> new_headers_state = collectState(headers);
@@ -175,8 +176,8 @@
         System.out.println("Since we did not modify the native api of B.");
         System.out.println("-------------------------------------------------------------");
 
-        populate(gensrc,"alfa/A.java",
-                       "package alfa; public class A implements AINT { "+
+        populate(gensrc,"alfa/omega/A.java",
+                       "package alfa.omega; public class A implements AINT { "+
                  "public final static int DEFINITION = 18; public void aint() { } private void foo() { } }");
 
         compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
@@ -184,8 +185,8 @@
         Map<String,Long> new_bin_state = collectState(bin);
 
         verifyNewerFiles(previous_bin_state, new_bin_state,
-                         "bin/alfa/A.class",
-                         "bin/alfa/AINT.class",
+                         "bin/alfa/omega/A.class",
+                         "bin/alfa/omega/AINT.class",
                          "bin/beta/B.class",
                          "bin/beta/BINT.class",
                          "bin/javac_state");
@@ -202,7 +203,7 @@
         System.out.println("---------------------------------------------------------");
 
         populate(gensrc,"beta/B.java",
-                       "package beta; import alfa.A; public class B {"+
+                       "package beta; import alfa.omega.A; public class B {"+
                        "private int b() { return A.DEFINITION; } }");
 
         compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
@@ -226,7 +227,7 @@
         System.out.println("------------------------------------------------------------------------");
 
         populate(gensrc,"beta/B.java",
-                       "package beta; import alfa.A; public class B {"+
+                       "package beta; import alfa.omega.A; public class B {"+
                        "private int b() { return A.DEFINITION; } "+
                  "@java.lang.annotation.Native final static int alfa = 42; }");
 
@@ -252,7 +253,7 @@
         System.out.println("-------------------------------------------------------------------");
 
         populate(gensrc,"beta/B.java",
-                       "package beta; import alfa.A; public class B {"+
+                       "package beta; import alfa.omega.A; public class B {"+
                        "private int b() { return A.DEFINITION; } "+
                  "@java.lang.annotation.Native final static int alfa = 43; }");
 
@@ -282,8 +283,8 @@
         delete(bin);
         previous_bin_state = collectState(bin);
 
-        populate(gensrc,"alfa/A.java",
-                 "package alfa; import beta.B; import gamma.C; public class A { B b; C c; }",
+        populate(gensrc,"alfa/omega/A.java",
+                 "package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }",
                  "beta/B.java",
                  "package beta; public class B { broken",
                  "gamma/C.java",
@@ -297,7 +298,7 @@
                 "--server:portfile=testserver,background=false");
         Map<String,Long> new_bin_state = collectState(bin);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/A.class",
+                                     "bin/alfa/omega/A.class",
                                      "bin/beta/B.class",
                                      "bin/gamma/C.class",
                                      "bin/javac_state");
@@ -325,8 +326,8 @@
         delete(bin);
         previous_bin_state = collectState(bin);
 
-        populate(gensrc,"alfa/A.java",
-                 "package alfa; import beta.B; import gamma.C; public class A { B b; C c; }");
+        populate(gensrc,"alfa/omega/A.java",
+                 "package alfa.omega; import beta.B; import gamma.C; public class A { B b; C c; }");
         populate(gensrc2,"beta/B.java",
                  "package beta; public class B { broken",
                  "gamma/C.java",
@@ -341,7 +342,7 @@
         System.out.println("The first compile went well!");
         Map<String,Long> new_bin_state = collectState(bin);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/A.class",
+                                     "bin/alfa/omega/A.class",
                                      "bin/javac_state");
 
         System.out.println("----- Compile with exluded beta went well!");
@@ -365,18 +366,18 @@
         delete(bin);
         previous_bin_state = collectState(bin);
 
-        populate(gensrc,"alfa/A.java",
-                 "package alfa; public class A { beta.B b; }",
+        populate(gensrc,"alfa/omega/A.java",
+                 "package alfa.omega; public class A { beta.B b; }",
                  "beta/B.java",
                  "package beta; public class B { gamma.C c; }",
                  "gamma/C.java",
-                 "package gamma; public class C { alfa.A a; }");
+                 "package gamma; public class C { alfa.omega.A a; }");
 
         compile("gensrc", "-d", "bin", "-h", "headers", "-j", "3",
                 "--server:portfile=testserver,background=false","--log=debug");
         Map<String,Long> new_bin_state = collectState(bin);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/A.class",
+                                     "bin/alfa/omega/A.class",
                                      "bin/beta/B.class",
                                      "bin/gamma/C.class",
                                      "bin/javac_state");
@@ -396,20 +397,57 @@
         previous_bin_state = collectState(bin);
 
         populate(gensrc,
-                 "alfa/A.java",
-                 "package alfa; public class A { beta.B b; }",
+                 "alfa/omega/A.java",
+                 "package alfa.omega; public class A { beta.B b; }",
                  "beta/B.java",
                  "package beta; public class B { }");
 
-        compile("-x", "beta", "-src", "gensrc", "-x", "alfa", "-sourcepath", "gensrc",
+        compile("-x", "beta", "-src", "gensrc", "-x", "alfa/omega", "-sourcepath", "gensrc",
                 "-d", "bin", "--server:portfile=testserver,background=false");
 
         Map<String,Long> new_bin_state = collectState(bin);
         verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
-                                     "bin/alfa/A.class",
+                                     "bin/alfa/omega/A.class",
                                      "bin/javac_state");
     }
 
+    void incrementalCompileTestFullyQualifiedRef() throws Exception {
+        System.out.println("Verify that \"alfa.omega.A a;\" does create a proper dependency.");
+        System.out.println("----------------------------------------------------------------");
+
+        populate(gensrc,
+                 "alfa/omega/A.java",
+                 "package alfa.omega; public class A { "+
+                 "  public final static int DEFINITION = 18; "+
+                 "  public void hello() { }"+
+                 "}",
+                 "beta/B.java",
+                 "package beta; public class B { "+
+                 "  public void world() { alfa.omega.A a; }"+
+                 "}");
+
+        compile("gensrc", "-d", "bin", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        Map<String,Long> previous_bin_state = collectState(bin);
+
+        // Change pubapi of A, this should trigger a recompile of B.
+        populate(gensrc,
+                 "alfa/omega/A.java",
+                 "package alfa.omega; public class A { "+
+                 "  public final static int DEFINITION = 19; "+
+                 "  public void hello() { }"+
+                 "}");
+
+        compile("gensrc", "-d", "bin", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        Map<String,Long> new_bin_state = collectState(bin);
+
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/alfa/omega/A.class",
+                         "bin/beta/B.class",
+                         "bin/javac_state");
+    }
+
     void removeFrom(Path dir, String... args) throws IOException {
         for (String filename : args) {
             Path p = dir.resolve(filename);
--- a/langtools/test/tools/sjavac/SJavacWrapper.java	Fri May 09 09:12:39 2014 +0200
+++ b/langtools/test/tools/sjavac/SJavacWrapper.java	Mon May 12 17:01:57 2014 -0700
@@ -26,6 +26,8 @@
  * @summary Test all aspects of sjavac.
  *
  * @bug 8004658
+ * @bug 8042441
+ * @bug 8042699
  * @summary Add internal smart javac wrapper to solve JEP 139
  *
  * @run main SJavacWrapper
--- a/make/Javadoc.gmk	Fri May 09 09:12:39 2014 +0200
+++ b/make/Javadoc.gmk	Mon May 12 17:01:57 2014 -0700
@@ -115,10 +115,7 @@
 DOCSDIR_URL = {@docroot}/$(GET2DOCSDIR)
 
 # Url to copyright html file
-COPYRIGHT_URL-7 = $(DOCSDIR_URL)/legal/cpyr.html
-# This isn't added in old build yet.
-#COPYRIGHT_URL-8 = $(DOCSDIR_URL)/legal/cpyr.html
-COPYRIGHT_URL = $(COPYRIGHT_URL-$(JDK_MINOR_VERSION))
+COPYRIGHT_URL = $(DOCSDIR_URL)/legal/cpyr.html
 
 # Url to bug filing site
 BUG_SUBMIT_URL = http://bugreport.sun.com/bugreport/
--- a/nashorn/.hgtags	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/.hgtags	Mon May 12 17:01:57 2014 -0700
@@ -245,3 +245,4 @@
 27f6ea87dcbd52c4b59e34a9f18d5b3321d53fa7 jdk9-b09
 0eaa55c7abe5d96023a4b38a326f411209c43f49 jdk9-b10
 4d60c3292e14aac90dc3b8232496ba4af4254cc3 jdk9-b11
+282e9a675e079cc84dbfaa4c10050f08397faab0 jdk9-b12
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/BufferArray.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import jdk.nashorn.api.scripting.AbstractJSObject;
+import java.nio.DoubleBuffer;
+
+/**
+ * Simple class demonstrating pluggable script object
+ * implementation. By implementing jdk.nashorn.api.scripting.JSObject
+ * (or extending AbstractJSObject which implements it), you
+ * can supply a friendly script object. Nashorn will call
+ * 'magic' methods on such a class on 'obj.foo, obj.foo = 33,
+ * obj.bar()' etc. from script.
+ *
+ * In this example, Java nio DoubleBuffer object is wrapped
+ * as a friendly script object that provides indexed acces
+ * to buffer content and also support array-like "length"
+ * readonly property to retrieve buffer's capacity. This class
+ * also demonstrates a function valued property called "buf".
+ * On 'buf' method, we return the underlying nio buffer object
+ * that is being wrapped.
+ */
+public class BufferArray extends AbstractJSObject {
+    // underlying nio buffer
+    private final DoubleBuffer buf;
+
+    public BufferArray(int size) {
+        buf = DoubleBuffer.allocate(size);
+    }
+
+    public BufferArray(DoubleBuffer buf) {
+        this.buf = buf;
+    }
+
+    // called to check if indexed property exists
+    @Override
+    public boolean hasSlot(int index) {
+        return index > 0 && index < buf.capacity();
+    }
+
+    // get the value from that index
+    @Override
+    public Object getSlot(int index) {
+       return buf.get(index);
+    }
+
+    // set the value at that index
+    @Override
+    public void setSlot(int index, Object value) {
+       buf.put(index, ((Number)value).doubleValue());
+    }
+
+    // do you have a property of that given name?
+    @Override
+    public boolean hasMember(String name) {
+       return "length".equals(name) || "buf".equals(name);
+    }
+
+    // get the value of that named property
+    @Override
+    public Object getMember(String name) {
+       switch (name) {
+          case "length":
+              return buf.capacity();
+          case "buf":
+              // return a 'function' value for this property
+              return new AbstractJSObject() {
+                  @Override
+                  public Object call(Object thiz, Object... args) {
+                      return BufferArray.this.buf;
+                  }
+
+                  // yes, I'm a function !
+                  @Override
+                  public boolean isFunction() {
+                      return true;
+                  }
+              };
+       }
+       return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/CastExample.java	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple java example with type casts.
+// see javacastcounter.js.
+
+class CastExample {
+   public final static int I = (int)23.33;
+   public final String str = (String)"hello";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/README	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,1 @@
+Simple Nashorn examples that can be run with "jjs" tool.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/array_mapreduce.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Usage: jjs array_mapreduce.js
+
+// Many Array.prototype functions such as map, 
+// filter, reduce, reduceRight, every, some are generic.
+// These functions accept ECMAScript array as well as 
+// many array-like objects including java arrays.
+// So, you can do map/filter/reduce with Java streams or
+// you can also use Array.prototype functions as below.
+// See also http://en.wikipedia.org/wiki/MapReduce
+
+var DoubleArray = Java.type("double[]");
+var StringArray = Java.type("java.lang.String[]");
+
+var map = Array.prototype.map;
+var filter = Array.prototype.filter;
+var reduce = Array.prototype.reduce;
+
+var jarr = new StringArray(5);
+jarr[0] = "nashorn";
+jarr[1] = "ecmascript";
+jarr[2] = "javascript";
+jarr[3] = "js";
+jarr[4] = "scheme";
+
+// sum of word lengths
+print("Sum word length:",
+    reduce.call(
+        map.call(jarr, function(x) x.length),
+        function(x, y) x + y)
+);
+
+// another array example involving numbers
+jarr = new DoubleArray(10);
+// make random array of numbers
+for (var i = 0; i < jarr.length; i++)
+    jarr[i] = Math.random();
+
+var forEach = Array.prototype.forEach;
+// print numbers in the array
+forEach.call(jarr, function(x) print(x));
+
+// print sum of squares of the random numbers
+print("Square sum:",
+    reduce.call(
+        map.call(jarr, function(x) x*x), 
+        function(x, y) x + y)
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/astviewer.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,98 @@
+#// Usage: jjs -scripting -fx astviewer.js -- <scriptfile>
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+if (!$OPTIONS._fx) {
+    print("Usage: jjs -scripting -fx astviewer.js -- <.js file>");
+    exit(1);
+}
+
+// Using JavaFX from Nashorn. See also:
+// http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/javafx.html
+
+// This example shows AST of a script file as a JavaFX
+// tree view in a window. If no file is specified, AST of
+// this script file is shown. This script demonstrates
+// 'load' function, JavaFX support by -fx, readFully function
+// in scripting mode.
+
+// JavaFX classes used
+var StackPane = Java.type("javafx.scene.layout.StackPane");
+var Scene     = Java.type("javafx.scene.Scene");
+var TreeItem  = Java.type("javafx.scene.control.TreeItem");
+var TreeView  = Java.type("javafx.scene.control.TreeView");
+
+// Create a javafx TreeItem to view a AST node
+function treeItemForASTNode(ast, name) {
+    var item = new TreeItem(name);
+    for (var prop in ast) {
+       var node = ast[prop];
+       if (typeof node == 'object') {
+           if (node == null) {
+               // skip nulls
+               continue;
+           }
+
+           if (Array.isArray(node) && node.length == 0) {
+               // skip empty arrays
+               continue;
+           }
+
+           var subitem = treeItemForASTNode(node, prop);
+       } else {
+           var subitem = new TreeItem(prop + ": " + node);
+       }
+       item.children.add(subitem);
+    }
+    return item;
+}
+
+// do we have a script file passed? if not, use current script
+var sourceName = arguments.length == 0? __FILE__ : arguments[0];
+
+// load parser.js from nashorn resources
+load("nashorn:parser.js");
+
+// read the full content of the file and parse it 
+// to get AST of the script specified
+var ast = parse(readFully(sourceName));
+
+// JavaFX start method
+function start(stage) {
+    stage.title = "AST Viewer";
+    var rootItem = treeItemForASTNode(ast, sourceName);
+    var tree = new TreeView(rootItem);
+    var root = new StackPane();
+    root.children.add(tree);
+    stage.scene = new Scene(root, 300, 450);
+    stage.show();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/barchart_weather.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,116 @@
+#// Usage: jjs -fx barchart_weather.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Example that retrieves weather data from a URL in JSON
+// format and draws bar chart using JavaFX
+
+// -fx check
+if (! $OPTIONS._fx) {
+    print("Usage: jjs -fx barchart_weather.js");
+    exit(1);
+}
+
+// Java classes used
+var URL = Java.type("java.net.URL");
+var BufferedReader = Java.type("java.io.BufferedReader");
+var InputStreamReader = Java.type("java.io.InputStreamReader");
+
+// function to retrieve text content of the given URL
+function readTextFromURL(url) {
+    var str = '';
+    var u = new URL(url);
+    var reader = new BufferedReader(
+        new InputStreamReader(u.openStream()));
+    try {
+        reader.lines().forEach(function(x) str += x);
+        return str;
+    } finally {
+        reader.close();
+    }
+}
+
+// change URL for your city here!
+var url = "http://api.openweathermap.org/data/2.5/forecast?q=chennai,india&units=metric&mode=json";
+
+// download JSON document and parse
+var json = readTextFromURL(url);
+var weather = JSON.parse(json);
+
+// View JSON of this using site such as http://www.jsoneditoronline.org/ to know
+// about the JSON data format used by this site
+
+// Extracted data from the json object
+var temp = weather.list.map(function(x) x.main.temp);
+var temp_min = weather.list.map(function(x) x.main.temp_min);
+var temp_max = weather.list.map(function(x) x.main.temp_max);
+var date = weather.list.map(function(x) x.dt_txt);
+
+// JavaFX classes used
+var Scene = Java.type("javafx.scene.Scene");
+var BarChart = Java.type("javafx.scene.chart.BarChart");
+var CategoryAxis = Java.type("javafx.scene.chart.CategoryAxis");
+var NumberAxis = Java.type("javafx.scene.chart.NumberAxis");
+var XYChart = Java.type("javafx.scene.chart.XYChart");
+
+function start(stage) {
+    stage.title="Chennai Weather Bar Chart";
+    var xAxis = new CategoryAxis();
+    xAxis.label = "date/time";
+    var yAxis = new NumberAxis();
+    yAxis.label = "temp in C";
+    var bc = new BarChart(xAxis, yAxis);
+
+    // 3 bars per datetime item - temp, min temp and max temp
+    var s1 = new XYChart.Series();
+    s1.name = "temp";
+    for (d in date) {
+        s1.data.add(new XYChart.Data(date[d], temp[d]));
+    }
+
+    var s2 = new XYChart.Series();
+    s2.name = "min temp";
+    for (d in date) {
+        s2.data.add(new XYChart.Data(date[d], temp_min[d]));
+    }
+
+    var s3 = new XYChart.Series();
+    s3.name = "max temp";
+    for (d in date) {
+        s3.data.add(new XYChart.Data(date[d], temp_max[d]));
+    }
+
+    bc.data.addAll(s1, s2, s3);
+
+    stage.scene = new Scene(bc, 800, 600);
+    stage.show();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/call_lambda.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// nashorn allows you treat every Java8 lambda as a function
+
+var JFunction = Java.type("java.util.function.Function");
+var obj = new JFunction() {
+    apply: function(x) {
+        print(x + ", lambda");
+    }
+};
+
+// prints 'function'
+print(typeof obj);
+
+// call it!
+obj("hello");
--- a/nashorn/samples/counters.js	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/samples/counters.js	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,7 +33,11 @@
  * This file can be run along with any script you want to run
  * to print aggregate stat counters from nashorn.
  *
- * Usage:  jjs <your-file.js> counters.js
+ * Usage:  jjs -J-Dnashorn.debug <your-file.js> counters.js
  */
 
-Debug.dumpCounters();
+if (java.lang.System.getProperty("nashorn.debug") == null) {
+    print("Usage: jjs -J-Dnashorn.debug <your-file.js> counters.js");
+} else {
+    Debug.dumpCounters();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/dirname.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// __DIR__ variable is equivalent of `dirname $0` in
+// shell scripts - expands to the directory where
+// the current script is located.
+
+print("This script is in the directory: " + __DIR__);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/disassemble.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Usage: jjs disassemble.js -- <.class-file-path>
+
+// Simple .class disassembler that uses bundled ObjectWeb ASM
+// classes in jdk8. WARNING: Bundled ObjectWeb ASM classes are
+// not part of official jdk8 API. It can be changed/removed 
+// without notice. So, this script is brittle by design!
+
+// This example demonstrates passing arguments to script
+// from jjs command line, nio and ASM usage.
+
+// classes used
+var FileSystems = Java.type("java.nio.file.FileSystems");
+var Files = Java.type("java.nio.file.Files");
+var System = Java.type("java.lang.System");
+var PrintWriter = Java.type("java.io.PrintWriter");
+
+// WARNING: uses non-API classes of jdk8!
+var ClassReader = Java.type("jdk.internal.org.objectweb.asm.ClassReader");
+var TraceClassVisitor = Java.type("jdk.internal.org.objectweb.asm.util.TraceClassVisitor");
+
+// convert file name to Path instance
+function path(file) {
+    return FileSystems.default.getPath(file);
+}
+
+// read all file content as a byte[]
+function readAllBytes(file) {
+    return Files.readAllBytes(path(file));
+}
+
+// disassemble .class byte[] and prints output to stdout
+function disassemble(bytecode) {
+    var pw = new PrintWriter(System.out);
+    new ClassReader(bytecode).accept(new TraceClassVisitor(pw), 0);
+}
+
+// check for command line arg (for .class file name)
+if (arguments.length == 0 || !arguments[0].endsWith('.class')) {
+    print("Usage: jjs disassemble -- <.class file>");
+    exit(1);
+}
+
+// disassemble the given .class file
+disassemble(readAllBytes(arguments[0]));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/README	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,1 @@
+Using javax.script engine API of nashorn from script!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/accessvar.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple example showing global variable access from caller
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+
+// eval code!
+engine.eval("x = 'hello'");
+
+// access global var from engine
+print(engine.get('x'));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/callfunc.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// simple example showing how to call a global script 
+// function from caller
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+
+// eval code!
+engine.eval("function func(name) { print('I am func, hello ' + name) }");
+
+// invoke functions, methods of code evaluated by engine
+// from javax.script.Invocable interface. But, hey, 
+// calling code is JavaScript and don't worry about types :)
+
+engine.invokeFunction("func", "Nashorn");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/callmethod.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,64 @@
+#// Usage: jjs -scripting callmethod.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// simple example demonstrating calling a script object
+// method from script engine user code
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+
+// eval code - too many script escapes?
+// use heredoc !
+engine.eval(<<CODE
+    var obj = {
+        func: function() {
+            print("I am func of " + this);
+        },
+
+        toString: function() {
+            return "Object 'obj'";
+        }
+   };
+CODE);
+
+// invoke methods of an object in script world
+// from javax.script.Invocable interface. But, hey, 
+// calling code is JavaScript and don't worry about types :)
+
+// get that script object on which to call a method
+var scriptObj = engine.get("obj");
+// call 'func' method on object 'obj'
+engine.invokeMethod(scriptObj, "func");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/exposevar.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Example showing how to expose a script global var from caller
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+
+// expose variable to engine
+engine.put("name", "Nashorn");
+
+// access it from script
+engine.eval("print('Hello, ' + name)");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/foreignobject.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,71 @@
+#// Usage: jjs -scripting foreignobject.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// cross nashorn engine scripting
+// access script objects from other engines in natural syntax
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+
+// eval code!
+engine.eval(<<CODE
+    var obj = {
+        foo: 42,
+        func: function() {
+            print("func: " + this.foo);
+        }
+    };
+CODE);
+
+// Nashorn engine returns script objects as instance of
+// the class jdk.nashorn.api.scripting.ScriptObjectMirror
+// But nashorn's dynalink linker can treat these objects
+// specially to support natural script syntax to access..
+// In Java code, you need to use ScriptObjectMirror's 
+// methods though. Once again, script world is simpler :-)
+
+var foreignObj = engine.get("obj");
+// access properties, functions of it
+// with natural syntax
+print(foreignObj.foo);
+foreignObj.func();
+print(typeof foreignObj.func);
+
+// access engine's global
+var foreignGlobal = engine.eval("this");
+// create objects in engine's world from here!
+print(new foreignGlobal.Object());
+print(new foreignGlobal.Date());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/hello.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple hello world example showing create engine
+// and eval simple script
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+// eval code!
+engine.eval("print('hello world')");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/interface.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,60 @@
+#// Usage: jjs -scripting interface.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Example demonstrating how to implement a Java interface
+// whose methods are backed by global script functions
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+
+// eval code - too many script escapes?
+// use heredoc !
+engine.eval(<<CODE
+function run() {
+    print("run global function called");
+}
+CODE);
+
+// create Java interface object whose methods are
+// implemented by script functions. This is from
+// javax.script.Invocable. But we are in JS world, 
+// don't worry about types :)
+
+var Runnable = Java.type("java.lang.Runnable");
+var r = engine.getInterface(Runnable.class);
+print(r.class);
+
+r.run();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/interface2.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,63 @@
+#// Usage: jjs -scripting interface2.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple example demonstrating how to implement java interface
+// whose methods are backed by script methods of a script object
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+
+// eval code - too many script escapes?
+// use heredoc !
+engine.eval(<<CODE
+  var obj = {
+    run: function() {
+        print("I am run method of 'obj'");
+    }
+  };
+CODE);
+
+// create Java interface object whose methods are
+// implemented by script methods of a script object
+// This is from javax.script.Invocable. But we are
+// in JS world, don't worry about types :)
+
+var Runnable = Java.type("java.lang.Runnable");
+
+var scriptObj = engine.get("obj");
+var r = engine.getInterface(scriptObj, Runnable.class);
+print(r.class);
+r.run();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/engine/lambda_as_func.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple example demonstrating how to expose 'function's
+// from embedding code. Any lambda object exposed to engine
+// can be called as 'function' in script.
+
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+// create manager
+var manager = new ScriptEngineManager();
+// create engine
+var engine = manager.getEngineByName("js");
+
+// Any lambda (@FunctionalInterface annotated type) object can be
+// be exposed from script embedding code. Script can call
+// it as a function
+engine.put("upper", new java.util.function.Function() {
+     apply: function(x) x.toUpperCase()
+});
+
+print(engine.eval("upper('hello')"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/env.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,43 @@
+#// Usage: jjs -scripting env.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// In nashorn -scripting mode, 
+// "$ENV" object exposes process 
+// environment variables
+
+print($ENV.PATH);
+print($ENV.JAVA_HOME);
+
+for (i in $ENV) {
+   print(i, "->", $ENV[i]);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/expression_closure.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// nashorn supports expression closures extension of
+// Mozilla JavaScript 1.8. See also
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.8
+
+// leave {, } and 'return' keyword
+
+function sqr(x) x*x;
+
+// prints 289 (= 17*17)
+print(sqr(17));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/fileline.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// nashorn supports pseudo global variables __FILE__
+// and __LINE__ that expands to currently executed
+// script file name and current script line number
+
+// prints current file and line number
+print("executing " + __FILE__ + " @ " + __LINE__);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/fizzbuzz.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// What is FizzBuzz? http://c2.com/cgi/wiki?FizzBuzzTest
+
+// Yet another FizzBuzz impl. using Java 8 lambda and stream
+// but using Nashorn. This is ECMAScript port of @stuartmarks'
+// Java implementation
+
+var IntStream = Java.type("java.util.stream.IntStream");
+
+function ifmod(m, r, f) {
+    return function(i) { return i % m == 0? r : f(i); }
+}
+
+// pass script function for lambda
+IntStream.rangeClosed(1, 100).
+   mapToObj(
+      ifmod(15, "FizzBuzz", ifmod(5, "Buzz", ifmod(3, "Fizz", String))))
+      .forEach(print);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/for_each.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// nashorn supports for..each extension supported
+// by Mozilla. See also
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for_each...in
+
+var strs = [ "hello", "world" ];
+for each (str in strs)
+    print(str);
+
+// create a java int[] object
+var JArray = Java.type("int[]");
+var arr = new JArray(10);
+
+// store squares as values
+for (i in arr) 
+    arr[i] = i*i;
+
+// for .. each on java arrays
+print("squares");
+for each (i in arr)
+    print(i);
+
+var System = Java.type("java.lang.System");
+
+// for..each on java Iterables
+// print System properties as name = value pairs
+print("System properties");
+for each (p in System.properties.entrySet()) {
+    print(p.key, "=", p.value);
+} 
+
+// print process environment vars as name = value pairs
+print("Process environment");
+for each (e in System.env.entrySet()) {
+    print(e.key, "=", e.value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/gaussian_random.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// print 100 Guassian distributed numbers
+
+var Random = Java.type("java.util.Random");
+var DoubleStream = Java.type("java.util.stream.DoubleStream");
+
+var r = new Random();
+
+// expression closure (see expression_closure.js as well)
+// passed as lambda double generator. "print" passed as 
+// double consumer lambda to 'forEach' method.
+
+DoubleStream
+    .generate(function() r.nextGaussian())
+    .limit(100)
+    .forEach(print);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/gaussian_random_bind.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// print 100 Guassian distributed numbers
+
+var Random = Java.type("java.util.Random");
+var DoubleStream = Java.type("java.util.stream.DoubleStream");
+
+// function as lambda double generator. "print" passed as 
+// double consumer lambda to 'forEach' method.
+// Function.prototype.bind used to attach 'state' for the
+// generator function.
+
+DoubleStream
+    .generate(
+         function(r) {
+             return r.nextGaussian()
+         }.bind(this, new Random()))
+    .limit(100)
+    .forEach(print);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/gutenberg.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,142 @@
+#// Usage: jjs -scripting gutenberg.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple example that demonstrates reading XML Rss feed
+// to generate a HTML file from script and show it by browser
+
+// Java classes used
+var Characters = Java.type("javax.xml.stream.events.Characters");
+var Factory = Java.type("javax.xml.stream.XMLInputFactory");
+var File = Java.type("java.io.File");
+var FileWriter = Java.type("java.io.FileWriter");
+var PrintWriter = Java.type("java.io.PrintWriter");
+var URL = Java.type("java.net.URL");
+
+// read Rss feed from a URL. Returns an array
+// of objects having only title and link properties
+function readRssFeed(url) {
+    var fac = Factory.newInstance();
+    var reader = fac.createXMLEventReader(url.openStream());
+
+    // get text content from next event
+    function getChars() {
+        var result = "";
+        var e = reader.nextEvent();
+        if (e instanceof Characters) {
+            result = e.getData();
+        }
+        return result;
+    }
+
+    var items = [];
+    var title, link;
+    var inItem = false;
+    while (reader.hasNext()) {
+        var evt = reader.nextEvent();
+        if (evt.isStartElement()) {
+            var local = evt.name.localPart;
+            if (local == "item") {
+               // capture title, description now
+               inItem = true;
+            }
+        
+            if (inItem) {
+                switch (local) {
+                    case 'title':
+                        title = getChars();
+                        break;
+                    case 'link':
+                        link = getChars();
+                        break;
+                }
+            }
+        } else if (evt.isEndElement()) {
+            var local = evt.name.localPart;
+            if (local == "item") {
+                // one item done, save it in result array
+                items.push({ title: title, link: link });
+                inItem = false;
+            }
+        }
+    }
+
+    return items;
+}
+
+// generate simple HTML for an RSS feed
+function getBooksHtml() {
+    var url = new URL("http://www.gutenberg.org/cache/epub/feeds/today.rss");
+    var items = readRssFeed(url);
+
+    var str = "<ul>";
+
+    // Nashorn's string interpolation and heredoc
+    // support is very handy in generating text content
+    // that is filled with elements from runtime objects.
+    // We insert title and link in <li> elements here.
+    for each (i in items) {
+        str += <<EOF
+<li>
+    <a href="${i.link}">${i.title}</a>
+</li>
+EOF
+    }
+    str += "</ul>";
+    return str;
+}
+
+// write the string to the given file
+function writeTo(file, str) {
+    var w = new PrintWriter(new FileWriter(file));
+    try {
+        w.print(str);
+    } finally {
+        w.close();
+    }
+}
+
+// generate books HTML
+var str = getBooksHtml();
+
+// write to file. __DIR__ is directory where
+// this script is stored.
+var file = new File(__DIR__ + "books.html");
+writeTo(file, str);
+
+// show it by desktop browser
+try {
+    var Desktop = Java.type("java.awt.Desktop");
+    Desktop.desktop.browse(file.toURI());
+} catch (e) {
+    print(e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/heredoc.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,51 @@
+#// Usage: jjs -scripting heredoc.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Nashorn supports Shell script like here-documents
+// in -scripting mode. Here-docs are multi-line strings
+// that are possibly interpolated with ${} expressions
+// See also http://en.wikipedia.org/wiki/Here_document
+
+var sender = "Buffy the Vampire Slayer";
+var recipient = "Spike";
+ 
+print(<<END
+ 
+Dear ${recipient},
+ 
+I wish you to leave Sunnydale and never return.
+ 
+Not Quite Love,
+${sender}
+ 
+END);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/interface_impl.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// nashorn supports Java interface implementation
+// by script using anonymous class-like syntax
+
+var Runnable = Java.type("java.lang.Runnable");
+var Thread = Java.type("java.lang.Thread");
+// use anonymous class-like new syntax
+var r = new Runnable() {
+    run: function() {
+        print("I am a runnable " + Thread.currentThread());
+    }
+}
+
+r.run();
+
+var t = new Thread(r);
+t.start();
+t.join();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/javaastviewer.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,202 @@
+#// Usage: jjs -fx javaastviewer.js -- <.java files>
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// This example demonstrates Java subclassing by Java.extend
+// and javac Compiler and Tree API. This example also uses
+// -fx and javafx TreeView to visualize Java AST as TreeView
+
+if (!$OPTIONS._fx || arguments.length == 0) {
+    print("Usage: jjs -fx javaastviewer.js -- <.java files>");
+    exit(1);
+}
+
+// Java types used
+var Enum = Java.type("java.lang.Enum");
+var HashSet  = Java.type("java.util.HashSet");
+var Name = Java.type("javax.lang.model.element.Name");
+var List = Java.type("java.util.List");
+var Set  = Java.type("java.util.Set");
+var SimpleTreeVisitor = Java.type("com.sun.source.util.SimpleTreeVisitor");
+var StringArray = Java.type("java.lang.String[]");
+var ToolProvider = Java.type("javax.tools.ToolProvider");
+var Tree = Java.type("com.sun.source.tree.Tree");
+
+function javaASTToScriptObject(args) {
+    // properties ignored (javac implementation class properties) in AST view.
+    // may not be exhaustive - any getAbc would become "abc" property or
+    // public field becomes a property of same name.
+    var ignoredProps = new HashSet();
+    for each (var word in 
+        ['extending', 'implementing', 'init', 'mods', 'clazz', 'defs', 
+         'expr', 'tag', 'preferredPosition', 'qualid', 'recvparam',
+         'restype', 'params', 'startPosition', 'thrown',
+         'tree', 'typarams', 'typetag', 'vartype']) {
+        ignoredProps.add(word);
+    }
+
+    // get the system compiler tool
+    var compiler = ToolProvider.systemJavaCompiler;
+
+    // get standard file manager
+    var fileMgr = compiler.getStandardFileManager(null, null, null);
+
+    // make a list of compilation unit from command line argument file names
+    // Using Java.to convert script array (arguments) to a Java String[]
+    var compUnits = fileMgr.getJavaFileObjects(Java.to(args, StringArray));
+
+    // create a new compilation task
+    var task = compiler.getTask(null, fileMgr, null, null, null, compUnits);
+
+    // subclass SimpleTreeVisitor - converts Java AST node to
+    // a simple script object by walking through it
+    var ConverterVisitor = Java.extend(SimpleTreeVisitor);
+
+    var visitor = new ConverterVisitor() {
+        // convert java AST node to a friendly script object
+        // which can be viewed. Every node ends up in defaultAction 
+        // method of SimpleTreeVisitor method.
+
+        defaultAction: function (node, p) {
+            var resultObj = {};
+            // Nashorn does not iterate properties and methods of Java objects
+            // But, we can bind properties of any object (including java objects)
+            // to a script object and iterate it!
+            var obj = {};
+            Object.bindProperties(obj, node);
+
+            // we don't want every property, method of java object
+            for (var prop in obj) {
+                var val = obj[prop];
+                var type = typeof val;
+                // ignore 'method' members
+                if (type == 'function' || type == 'undefined') {
+                    continue;
+                }
+
+                // ignore properties from Javac implementation
+                // classes - hack by name!!
+                if (ignoredProps.contains(prop)) {
+                    continue;
+                }
+
+                // subtree - recurse it
+                if (val instanceof Tree) {
+                    resultObj[prop] = visitor.visit(val, p);
+                } else if (val instanceof List) {
+                    // List of trees - recurse each and make an array
+                    var len = val.size();
+                    if (len != 0) {
+                        var arr = [];
+                        for (var j = 0; j < len; j++) {
+                            var e = val[j];
+                            if (e instanceof Tree) {
+                                arr.push(visitor.visit(e, p));
+                            }
+                        }
+                        resultObj[prop] = arr;
+                    }
+                } else if (val instanceof Set) {
+                    // Set - used for modifier flags
+                    // make array
+                    var len = val.size();
+                    if (len != 0) {
+                        var arr = [];
+                        for each (var e in val) {
+                            if (e instanceof Enum || typeof e == 'string') {
+                                arr.push(e.toString());
+                            }
+                        }
+                        resultObj[prop] = arr;
+                    }
+                } else if (val instanceof Enum || val instanceof Name) {
+                    // make string for any Enum or Name
+                    resultObj[prop] = val.toString();
+                } else if (type != 'object') {
+                    // primitives 'as is'
+                    resultObj[prop] = val;
+                }
+            }
+            return resultObj;
+        }
+    }
+
+    // top level object with one property for each compilation unit
+    var scriptObj = {};
+    for each (var cu in task.parse()) {
+        scriptObj[cu.sourceFile.name] = cu.accept(visitor, null);
+    }
+
+    return scriptObj;
+}
+
+// JavaFX classes used
+var StackPane = Java.type("javafx.scene.layout.StackPane");
+var Scene     = Java.type("javafx.scene.Scene");
+var TreeItem  = Java.type("javafx.scene.control.TreeItem");
+var TreeView  = Java.type("javafx.scene.control.TreeView");
+
+// Create a javafx TreeItem to view a script object
+function treeItemForObject(obj, name) {
+    var item = new TreeItem(name);
+    for (var prop in obj) {
+       var node = obj[prop];
+       if (typeof node == 'object') {
+           if (node == null) {
+               // skip nulls
+               continue;
+           }
+           var subitem = treeItemForObject(node, prop);
+       } else {
+           var subitem = new TreeItem(prop + ": " + node);
+       }
+       item.children.add(subitem);
+    }
+
+    item.expanded = true;
+    return item;
+}
+
+var commandArgs = arguments;
+
+// JavaFX start method
+function start(stage) {
+    var obj = javaASTToScriptObject(commandArgs);
+    stage.title = "Java AST Viewer"
+    var rootItem = treeItemForObject(obj, "AST");
+    rootItem.expanded = true;
+    var tree = new TreeView(rootItem);
+    var root = new StackPane();
+    root.children.add(tree);
+    stage.scene = new Scene(root, 300, 450);
+    stage.show();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/javacastcounter.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Usage: jjs javacastcounter.js -- <.java files>
+
+// This example demonstrates Nashorn Java.extend API
+// to subclass a Java class from script.
+
+// This example uses Javac Compiler and Tree API
+// to list type casts used in java source files.
+
+if (arguments.length == 0) {
+    print("Usage: jjs javacastcounter.js -- <.java files>");
+    exit(1);
+}
+
+// Java types used
+var ToolProvider = Java.type("javax.tools.ToolProvider");
+var TreeScanner = Java.type("com.sun.source.util.TreeScanner");
+var Trees = Java.type("com.sun.source.util.Trees");
+var StringArray = Java.type("java.lang.String[]");
+
+// get the system compiler tool
+var compiler = ToolProvider.systemJavaCompiler;
+
+// get standard file manager
+var fileMgr = compiler.getStandardFileManager(null, null, null);
+
+// make a list of compilation unit from command line argument file names
+// Using Java.to convert script array (arguments) to a Java String[]
+var compUnits = fileMgr.getJavaFileObjects(Java.to(arguments, StringArray));
+
+// create a new compilation task
+var task = compiler.getTask(null, fileMgr, null, null, null, compUnits);
+
+// SourcePositions object to get positions of AST nodes
+var sourcePositions = Trees.instance(task).sourcePositions;
+
+// Subclass TreeScanner class
+var CastCounter = Java.extend(TreeScanner);
+
+var counter = new CastCounter() {
+    // current CompilationUnitTree
+    compUnit: null,
+    // current LineMap (pos -> line, column)
+    lineMap: null,
+    // current compilation unit's file name
+    fileName: null,
+
+    // overrides of TreeScanner methods
+
+    visitCompilationUnit: function(node, p) {
+        // capture info about current Compilation unit
+        this.compUnit = node;
+        this.lineMap = node.lineMap;
+        this.fileName = node.sourceFile.name;
+
+        // Using Java.super API to call super class method here        
+        return Java.super(counter).visitCompilationUnit(node, p);
+    },
+
+    visitTypeCast: function(node, p) {
+        // print information on this type cast node
+        var pos = sourcePositions.getStartPosition(this.compUnit, node);
+        var line = this.lineMap.getLineNumber(pos);
+        var col = this.lineMap.getColumnNumber(pos);
+        print(node + " @ " + this.fileName + ":" + line + ":" + col);
+
+        // count one more type cast
+        return 1;
+    },
+
+    reduce: function(r1, r2) {
+        return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
+    }
+};
+
+// print total number of type cast nodes seen
+print("Total casts:", counter.scan(task.parse(), null));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/javaimporter.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// JavaImporter along with 'with' statement helps in
+// localized Java class references
+
+function readTextFromURL(url) {
+
+    // equivalent to 
+    // 
+    //    import java.io.*;
+    //    import java.net.*;
+    //    import java.lang.StringBuffer;
+    //
+    // only inside the 'with' statement
+    with (new JavaImporter(java.io, 
+        java.net,
+        java.lang.StringBuilder)) {
+        var buf = new StringBuilder();
+        var u = new URL(url);
+        var reader = new BufferedReader(
+            new InputStreamReader(u.openStream()));
+        var line = null;
+        try {
+            while ((line = reader.readLine()) != null)
+                buf.append(line).append('\n');
+        } finally {
+            reader.close();
+        }
+
+        return buf.toString();
+    }
+}
+
+print(readTextFromURL("https://twitter.com/"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/javalist.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Java List elements accessed/modified via
+// array element access/update syntax
+
+var ArrayList = Java.type("java.util.ArrayList");
+var list = new ArrayList();
+
+// add elements to list by List's add method calls
+list.add("js");
+list.add("ecmascript");
+list.add("nashorn");
+
+// get by List's get(int) method
+print(list[0]);
+print(list[1]);
+print(list[2]);
+
+// access list elements by indexed access as well
+print(list[0]);
+print(list[1]);
+print(list[2]);
+
+// assign to list elements by index as well
+list[0] = list[0].toUpperCase();
+list[1] = list[1].toUpperCase();
+list[2] = list[2].toUpperCase();
+
+print(list.get(0));
+print(list.get(1));
+print(list.get(2));
+print(list[0]);
+print(list[1]);
+print(list[2]);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/javamap.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Java Map keys as properties
+
+// Demonstrating Java Map key/value can be accessed
+// as property/value from script.
+
+var HashMap = Java.type("java.util.HashMap");
+var map = new HashMap();
+
+// map key-value access by java get/put method calls
+map.put('js', 'nashorn');
+print(map.get('js'));
+
+// access keys of map as properties
+print(map['js']);
+print(map.js);
+
+// also assign new key-value pair 
+// as 'property-value'
+map['language'] = 'java';
+print(map.get("language"));
+print(map.language);
+print(map['language']);
+
+map.answer = 42;
+print(map.get("answer"));
+print(map.answer);
+print(map['answer']);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/javashell.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,146 @@
+#// Usage: jjs -scripting javashell.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple Java "shell" with which you can try out
+// your few liner Java code leaving imports, main etc.
+// And you can leave even compilation as this script
+// takes care boilerplate+compile step for you.
+
+// Java types used
+var Arrays = Java.type("java.util.Arrays");
+var BufferedReader = Java.type("java.io.BufferedReader");
+var FileWriter = Java.type("java.io.FileWriter");
+var LocalDateTime = Java.type("java.time.LocalDateTime");
+var InputStreamReader = Java.type("java.io.InputStreamReader");
+var PrintWriter = Java.type("java.io.PrintWriter");
+var ProcessBuilder = Java.type("java.lang.ProcessBuilder");
+var System = Java.type("java.lang.System");
+
+// read multiple lines of input from stdin till user
+// enters an empty line
+function input(endMarker, prompt) {
+    if (!endMarker) {
+        endMarker = "";
+    }
+
+    if (!prompt) {
+        prompt = " >> ";
+    }
+
+    var str = "";
+    var reader = new BufferedReader(new InputStreamReader(System.in));
+    var line;
+    while (true) {
+        System.out.print(prompt);
+        line = reader.readLine();
+        if (line == null || line == endMarker) {
+            break;
+        }
+        str += line + "\n";
+    }
+    return str;
+}
+
+// write the string to the given file
+function writeTo(file, str) {
+    var w = new PrintWriter(new FileWriter(file));
+    try {
+        w.print(str);
+    } finally {
+        w.close();
+    }
+}
+
+// generate Java code with user's input
+// put inside generated main method
+function generate(className) {
+    var usercode = input();
+    if (usercode == "") {
+        return false;
+    }
+
+    var fullcode = <<EOF
+// userful imports, add more here if you want
+// more imports.
+import static java.lang.System.*;
+import java.io.*;
+import java.net.*;
+import java.math.*;
+import java.nio.file.*;
+import java.time.*;
+import java.time.chrono.*;
+import java.time.format.*;
+import java.time.temporal.*;
+import java.time.zone.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+public class ${className} {
+   public static void main(String[] args) throws Exception {
+       ${usercode}
+   }
+}
+EOF
+
+    writeTo("${className}.java", fullcode);
+    return true;
+}
+
+// execute code command
+function exec(args) {
+    // build child process and start it!
+    new ProcessBuilder(Arrays.asList(args.split(' ')))
+         .inheritIO()
+         .start()
+         .waitFor();
+}
+
+// generate unique name
+function uniqueName() {
+    var now = LocalDateTime.now().toString();
+    // replace unsafe chars with '_' 
+    return "JavaShell" + now.replace(/-|:|\./g, '_');
+}
+
+// read-compile-run loop
+while(true) {
+    var className = uniqueName();
+    if (generate(className)) {
+        exec("javac ${className}.java");
+        exec("java ${className}");
+    } else {
+        break;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/jsadapter_dom.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,189 @@
+#// Usage: jjs -scripting jsadapter_dom.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple example that demonstrates reading XML Rss feed
+// to generate a HTML file from script and show it by browser
+// Uses XML DOM parser and DOM element wrapped by script 
+// "proxy" (JSAdapter constructor)
+
+// Java classes used
+var DocBuilderFac = Java.type("javax.xml.parsers.DocumentBuilderFactory");
+var Node = Java.type("org.w3c.dom.Node");
+var File = Java.type("java.io.File");
+var FileWriter = Java.type("java.io.FileWriter");
+var PrintWriter = Java.type("java.io.PrintWriter");
+
+// constants from Node class
+var ELEMENT_NODE = Node.ELEMENT_NODE;
+var TEXT_NODE = Node.TEXT_NODE;
+
+// parse XML from uri and return Document
+function parseXML(uri) {
+    var docBuilder = DocBuilderFac.newInstance().newDocumentBuilder();
+    return docBuilder["parse(java.lang.String)"](uri);
+}
+
+// get child Elements of given name of the parent element given
+function getChildElements(elem, name) {
+    var nodeList = elem.childNodes;
+    var childElems = [];
+    var len = nodeList.length;
+    for (var i = 0; i < len; i++) {
+        var node = nodeList.item(i);
+        if (node.nodeType == ELEMENT_NODE &&
+            node.tagName == name) {
+            childElems.push(wrapElement(node));
+        }
+    }
+
+    return childElems;
+}
+
+// get concatenated child text content of an Element
+function getElemText(elem) {
+    var nodeList = elem.childNodes;
+    var len = nodeList.length;
+    var text = '';
+    for (var i = 0; i < len; i++) {
+        var node = nodeList.item(i);
+        if (node.nodeType == TEXT_NODE) {
+            text += node.nodeValue;
+        } 
+    }
+
+    return text;
+}
+
+// Wrap DOM Element object as a convenient script object
+// using JSAdapter. JSAdapter is like java.lang.reflect.Proxy
+// in that it allows property access, method calls be trapped
+// by 'magic' methods like __get__, __call__.
+function wrapElement(elem) {
+    if (! elem) {
+        return elem;
+    }
+    return new JSAdapter() {
+        // getter to expose child elements and attributes by name
+        __get__: function(name) {
+            if (typeof name == 'string') {
+                if (name.startsWith('@')) {
+                    var attr = elem.getAttributeNode(name.substring(1));
+                    return !attr? undefined : attr.value;
+                }
+
+                var arr = getChildElements(elem, name);
+                if (arr.length == 1) {
+                    // single child element, expose as single element
+                    return arr[0];
+                } else {
+                    // multiple children of given name, expose as array
+                    return arr;
+                }
+            }
+            return undefined;
+        },
+
+        __call__: function(name) {
+            // toString override to get text content of this Element
+            if (name == 'toString' || name == 'valueOf') {
+                return getElemText(elem);
+            }
+            return undefined;
+        }
+    }
+}
+
+// generate HTML using here-doc and string interpolation
+function getBooksHtml() {
+    var doc = parseXML("http://www.gutenberg.org/cache/epub/feeds/today.rss");
+    // wrap document root Element as script convenient object
+    var rss = wrapElement(doc.documentElement);
+    print("rss file version " + rss['@version']);
+
+    var str = <<HEAD
+
+<html>
+<title>${rss.channel.title}</title>
+<body>
+<h1>${rss.channel.description}</h1>
+<p>
+Published on ${rss.channel.pubDate}
+</p>
+
+HEAD
+
+    var items = rss.channel.item;
+    for each (var i in items) {
+        str += <<LIST
+
+<dl>
+<dt><a href="${i.link}">${i.title}</a></dt>
+<dd>${i.description}</dd>
+</dl>
+
+LIST
+    }
+    str += <<END
+
+</body>
+</html>
+
+END
+    return str;
+}
+
+// write the string to the given file
+function writeTo(file, str) {
+    var w = new PrintWriter(new FileWriter(file));
+    try {
+        w.print(str);
+    } finally {
+        w.close();
+    }
+}
+
+// generate books HTML
+var str = getBooksHtml();
+
+// write to file. __DIR__ is directory where
+// this script is stored.
+var file = new File(__DIR__ + "books.html");
+writeTo(file, str);
+
+// show it by desktop browser
+try {
+    var Desktop = Java.type("java.awt.Desktop");
+    Desktop.desktop.browse(file.toURI());
+} catch (e) {
+    print(e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/jsobject.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,75 @@
+#// Usage: jjs -scripting -cp . jsobject.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// This sample demonstrats how to expose a
+// script friendly object from your java code
+// by implementing jdk.nashorn.api.scripting.JSObject
+
+// compile the java program
+`javac BufferArray.java`;
+
+// print error, if any and exit
+if ($ERR != '') {
+    print($ERR);
+    exit($EXIT);
+}
+
+// create BufferArray
+var BufferArray = Java.type("BufferArray");
+var bb = new BufferArray(10);
+
+// 'magic' methods called to retrieve set/get
+// properties on BufferArray instance
+var len = bb.length;
+print("bb.length = " + len)
+for (var i = 0; i < len; i++) {
+    bb[i] = i*i;
+}
+
+for (var i = 0; i < len; i++) {
+    print(bb[i]);
+}
+
+// get underlying buffer by calling a method
+// on BufferArray magic object
+
+// 'buf' is a function member
+print(typeof bb.buf);
+var buf = bb.buf();
+
+// use retrieved underlying nio buffer
+var cap = buf.capacity();
+print("buf.capacity() = " + cap);
+for (var i = 0; i < cap; i++) {
+   print(buf.get(i));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/jsobject_mapreduce.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,62 @@
+#// Usage: jjs -scripting -cp . jsobject_mapreduce.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Many Array.prototype functions such as map, 
+// filter, reduce, reduceRight, every, some are generic.
+// These functions accept ECMAScript array as well as 
+// many array-like objects including JSObjects.
+// See also http://en.wikipedia.org/wiki/MapReduce
+
+`javac BufferArray.java`;
+
+var BufferArray = Java.type("BufferArray");
+var buf = new BufferArray(10);
+
+var map = Array.prototype.map;
+var filter = Array.prototype.filter;
+var reduce = Array.prototype.reduce;
+
+// make random list of numbers
+for (var i = 0; i < 10; i++)
+    buf[i] = Math.random();
+
+var forEach = Array.prototype.forEach;
+// print numbers in the list
+forEach.call(buf, function(x) print(x));
+
+// print sum of squares of the random numbers
+print("Square sum:",
+    reduce.call(
+        map.call(buf, function(x) x*x), 
+        function(x, y) x + y)
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/jsonviewer.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,120 @@
+#// Usage: jjs -fx jsonviewer.js
+// or
+//        jjs -fx jsonviewer.js -- <url-of-json-doc>
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+if (! $OPTIONS._fx) {
+    print("Usage: jjs -fx jsonviewer.js -- <url-of-json-doc>");
+    exit(1);
+}
+
+// This example downloads a JSON file from a URL and
+// shows the same as a JavaFX tree view.
+
+// Using JavaFX from Nashorn. See also:
+// http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/javafx.html
+
+// JavaFX classes used
+var StackPane = Java.type("javafx.scene.layout.StackPane");
+var Scene     = Java.type("javafx.scene.Scene");
+var TreeItem  = Java.type("javafx.scene.control.TreeItem");
+var TreeView  = Java.type("javafx.scene.control.TreeView");
+
+// read text content of a URL
+function readTextFromURL(url) {
+    // equivalent to 
+    // 
+    //    import java.io.*;
+    //    import java.net.*;
+    //    import java.lang.StringBuffer;
+    //
+    // only inside the 'with' statement
+    with (new JavaImporter(java.io,
+        java.net,
+        java.lang.StringBuilder)) {
+        var buf = new StringBuilder();
+        var u = new URL(url);
+        var reader = new BufferedReader(
+            new InputStreamReader(u.openStream()));
+        var line = null;
+        try {
+            while ((line = reader.readLine()) != null)
+                buf.append(line).append('\n');
+        } finally {
+            reader.close();
+        }
+
+        return buf.toString();
+    }
+}
+
+// Create a javafx TreeItem to view a script object
+function treeItemForObject(obj, name) {
+    var item = new TreeItem(name);
+    for (var prop in obj) {
+       var node = obj[prop];
+       if (typeof node == 'object') {
+           if (node == null) {
+               // skip nulls
+               continue;
+           }
+
+           if (Array.isArray(node) && node.length == 0) {
+               // skip empty arrays
+               continue;
+           }
+
+           var subitem = treeItemForObject(node, prop);
+       } else {
+           var subitem = new TreeItem(prop + ": " + node);
+       }
+       item.children.add(subitem);
+    }
+    return item;
+}
+
+var DEFAULT_URL = "http://api.openweathermap.org/data/2.5/forecast/daily?q=Chennai&amp;mode=json&amp;units=metric&amp;cnt=7`";
+
+var url = arguments.length == 0? DEFAULT_URL : arguments[0];
+var obj = JSON.parse(readTextFromURL(url));
+
+// JavaFX start method
+function start(stage) {
+    stage.title = "JSON Viewer";
+    var rootItem = treeItemForObject(obj, url);
+    var tree = new TreeView(rootItem);
+    var root = new StackPane();
+    root.children.add(tree);
+    stage.scene = new Scene(root, 300, 450);
+    stage.show();
+}
--- a/nashorn/samples/letter.js	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/samples/letter.js	Mon May 12 17:01:57 2014 -0700
@@ -1,3 +1,5 @@
+#// Usage: jjs -scripting letter.js -- <sender> <recipient>
+
 /*
  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/list_mapreduce.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Usage: jjs list_mapreduce.js
+
+// Many Array.prototype functions such as map, 
+// filter, reduce, reduceRight, every, some are generic.
+// These functions accept ECMAScript array as well as 
+// many array-like objects including java.util.ArrayLists.
+// So, you can do map/filter/reduce with Java streams or
+// you can also use Array.prototype functions as below.
+// See also http://en.wikipedia.org/wiki/MapReduce
+
+var ArrayList = Java.type("java.util.ArrayList");
+var list = new ArrayList();
+list.add("nashorn");
+list.add("ecmascript");
+list.add("javascript");
+list.add("js");
+list.add("scheme");
+
+var map = Array.prototype.map;
+var filter = Array.prototype.filter;
+var reduce = Array.prototype.reduce;
+
+// sum of word lengths
+print("Sum word length:",
+    reduce.call(
+        map.call(list, function(x) x.length),
+        function(x, y) x + y)
+);
+
+// filter use to filter out "j*" and concatenate rest with ":"
+// after uppercasing all strings
+print(
+    reduce.call(
+        map.call(
+            filter.call(list, function(x) !x.startsWith("j")),
+            function(x) x.toUpperCase()),
+        function(x, y) x + ":" + y)
+);
+
+// another list example involving numbers
+list.clear();
+// make random list of numbers
+for (var i = 0; i < 10; i++)
+    list.add(Math.random());
+
+var forEach = Array.prototype.forEach;
+// print numbers in the list
+forEach.call(list, function(x) print(x));
+
+// print sum of squares of the random numbers
+print("Square sum:",
+    reduce.call(
+        map.call(list, function(x) x*x), 
+        function(x, y) x + y)
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/locales.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple program that lists available locals. This is ECMAScript
+// port of Java example by @brunoborges
+
+// Java classes used
+var Arrays = Java.type("java.util.Arrays");
+var Collectors = Java.type("java.util.stream.Collectors");
+var JString = Java.type("java.lang.String");
+var Locale = Java.type("java.util.Locale");
+
+var formatStr = "Country : %s \t\t\t\t:\t Country Code : %s";
+
+// Nashorn allows script functions to be passed
+// whereever Java8 lambdas are expected.
+
+// Nashorn also supports "expression closures" supported by
+// Mozilla JavaScript 1.8 version. See also
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.8
+
+// The following prints locales in (country) display name order
+var list = Arrays.asList(Locale.getISOCountries())
+    .stream()
+    .map(function(x) new Locale("", x))
+    .sorted(function(c0, c1) c0.displayCountry.compareTo(c1.displayCountry))
+    .map(function(l) JString.format(formatStr, l.displayCountry, l.country))
+    .collect(Collectors.toList());
+
+list.forEach(print);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/logisticmap.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,82 @@
+#// Usage: jjs -fx -scripting logisticmap.js -- <initial_x> <R>
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Logistic map viewer using Java8 Streams and JavaFX
+// See also http://en.wikipedia.org/wiki/Logistic_map
+
+if (!$OPTIONS._fx || arguments.length < 2) {
+    print("Usage: jjs -fx -scripting logisticmap.js -- <initial_x> <R>");
+    exit(1);
+}
+
+// parameters for the logistic map
+var x = parseFloat(arguments[0]);
+var R = parseFloat(arguments[1]);
+var NUM_POINTS = arguments.length > 2? parseFloat(arguments[2]) : 20;
+
+// Java classes used
+var DoubleStream = Java.type('java.util.stream.DoubleStream');
+var LineChart = Java.type("javafx.scene.chart.LineChart");
+var NumberAxis = Java.type("javafx.scene.chart.NumberAxis");
+var Scene = Java.type("javafx.scene.Scene");
+var Stage = Java.type("javafx.stage.Stage");
+var XYChart = Java.type("javafx.scene.chart.XYChart");
+
+function start(stage) {
+    stage.title = "Logistic Map: initial x = ${x}, R = ${R}";
+    // make chart
+    var xAxis = new NumberAxis();
+    var yAxis = new NumberAxis();
+    var lineChart = new LineChart(xAxis, yAxis);
+    xAxis.setLabel("iteration");
+    yAxis.setLabel("x");
+    // make chart data series
+    var series = new XYChart.Series();
+    var data = series.data;
+    // populate data using logistic iteration
+    var i = 0;
+    DoubleStream
+        .generate(function() x = R*x*(1-x))
+        .limit(NUM_POINTS)
+        .forEach(
+            function(value) {
+                data.add(new XYChart.Data(i, value));
+                i++;
+            }
+         );
+    // add to stage
+    var scene = new Scene(lineChart, 800, 600);
+    lineChart.data.add(series);
+    stage.scene = scene;
+    stage.show();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/options.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,37 @@
+#// Usage: jjs -scripting options.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// print all option names and values
+for (i in $OPTIONS) {
+    print(i, '=', $OPTIONS[i]);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/readLine.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,38 @@
+#// Usage: jjs -scripting greeting.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// readLine prints prompt and reads user response
+var name = readLine("Your name please: ");
+
+// user name is interpolated within string
+print("Hello ${name}");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/sam_function.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// nashorn supports passing script functions whenever
+// a SAM (single abstract method) type object is expected
+
+var System = Java.type("java.lang.System");
+var Timer = Java.type("java.util.Timer");
+var timer = new Timer();
+
+// schedule method accepts java.util.TimerTask
+// which is a single-abstract-method type. you
+// can pass a script function and nashorn will
+// wrap it as SAM implementor.
+
+timer.schedule(function() {
+    print("Hello World!");
+}, 1000);
+
+// wait for timer thread to print by
+// reading from stdin. 
+print("press any key to exit after message from timer...");
+System.in.read();
--- a/nashorn/samples/shell.js	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/samples/shell.js	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,50 +29,53 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/**
- * This is a simple shell tool in JavaScript.
+// Usage: jjs shell.js
+
+/* This is a simple shell tool in JavaScript.
  *
  * Runs any operating system command using Java "exec". When "eval" command is
  * used, evaluates argument(s) as JavaScript code.
  */
 
-var imports = new JavaImporter(java.io, java.lang, java.util);
-
-function prompt() {
-    java.lang.System.out.print(">");
-}
+(function() {
+    // Java classes used
+    var Arrays = Java.type("java.util.Arrays");
+    var BufferedReader = Java.type("java.io.BufferedReader");
+    var InputStreamReader = Java.type("java.io.InputStreamReader");
+    var ProcessBuilder = Java.type("java.lang.ProcessBuilder");
+    var System = Java.type("java.lang.System");
 
-with (imports) {
-    var reader = new BufferedReader(new InputStreamReader(System["in"]));
-    var line = null;
+    // print prompt
+    function prompt() {
+        System.out.print("> ");
+    }
+
+    var reader = new BufferedReader(new InputStreamReader(System.in));
     prompt();
-    while ((line = reader.readLine()) != null) {
-        if (line != "") {
-            var args = line.split(" ");
+    // read and evaluate each line from stdin
+    reader.lines().forEach(function(line) {
+        if (! line.isEmpty()) {
+            var args = line.split(' ');
             try {
-                if (args[0] == "eval") {
-                    var code = line.substring("eval".length);
+                // special 'eval' command to evaluate JS code
+                if (args[0] == 'eval') {
+                    var code = line.substring('eval'.length);
                     var res = eval(code);
                     if (res != undefined) {
                         print(res);
                     }
                 } else {
-                    var argList = new ArrayList();
-                    for (i in args) { argList.add(args[i]); }                
-                    var procBuilder = new ProcessBuilder(argList);
-                    procBuilder.redirectErrorStream();
-                    var proc = procBuilder.start();
-                    var out = new BufferedReader(new InputStreamReader(proc.getInputStream()));
-                    var line = null;
-                    while ((line = out.readLine()) != null) {
-                        System.out.println(line);
-                    }
-                    proc.waitFor();
+                    // build child process and start it!
+                    new ProcessBuilder(Arrays.asList(args))
+                        .inheritIO()
+                        .start()
+                        .waitFor();
                 }
             } catch (e) {
+                // print exception, if any
                 print(e);
             }
         }
         prompt();
-    }
-}
+    })
+})()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/stack.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// nashorn supports 'stack' property on ECMAScript
+// error objects. This property's value is a string
+// that shows script stack trace.
+
+function g() { 
+    throw new Error("wrong");
+}
+
+function f() {
+    g();
+}
+
+// Output looks something like:
+//
+//  Error: wrong
+//	at g (stack.js:37)
+//	at f (stack.js:41)
+//	at <program> (stack.js:52)
+
+try {
+   f();
+} catch (e) {
+   print(e.stack);
+}
--- a/nashorn/samples/test.js	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/samples/test.js	Mon May 12 17:01:57 2014 -0700
@@ -30,4 +30,3 @@
  */
 
 print("Hello World");
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/uniform_random.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// generate/print 100 uniformly distributed random values
+// and print summary statistics on it
+
+var DoubleStream = Java.type("java.util.stream.DoubleStream");
+
+// pass script function when a lambda is required
+// Math.random passed here for double generator lambda
+// print passed to forEach method
+
+DoubleStream
+    .generate(Math.random)
+    .limit(100)
+    .forEach(print);
+
+print(DoubleStream
+    .generate(Math.random)
+    .limit(100)
+    .summaryStatistics());
--- a/nashorn/samples/uniq.js	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/samples/uniq.js	Mon May 12 17:01:57 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,27 +29,28 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/**
- * Prints unique lines from a given file.
- */
+// Usage: jjs uniq.js
+// or: jjs uniq.js -- <file>
+
+// omit repeated lines and print unique lines
 
-if (arguments.length != 1) {
-    print("Usage: jjs uniq.js -- <file>");
-    java.lang.System.exit(1);
-}
+var BufferedReader = Java.type("java.io.BufferedReader");
+var FileReader = Java.type("java.io.FileReader");
+var InputStreamReader = Java.type("java.io.InputStreamReader");
+var System = Java.type("java.lang.System");
 
-var imports = new JavaImporter(java.io);
-
+// use object as set - but insertion order preserved
 var uniqueLines = {};
-with (imports) {
-    var reader = new BufferedReader(new FileReader(arguments[0]));
-    while ((line = reader.readLine()) != null) {
-        // using a JS object as a map...
-        uniqueLines[line] = true;
-    }
+var reader = arguments.length > 0 ?
+    new FileReader(arguments[0])  :
+    new InputStreamReader(System.in);
+reader = new BufferedReader(reader);
+
+// add unique lines
+reader.lines().forEach(function(line) {
+    uniqueLines[line] = true;
+})
+
+for (line in uniqueLines) {
+    print(line);
 }
-
-// now print the collected lines
-for (i in uniqueLines) {
-    print(i);
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/uniqs.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Usage: jjs uniqs.js -- <file>
+// omit repeated lines and print unique lines
+// But this version uses Stream API 
+
+if (arguments.length < 1) {
+    print("Usage: jjs uniqs.js -- <file>");
+    exit(1);
+}
+
+var Files = Java.type("java.nio.file.Files");
+var FileSystems = Java.type("java.nio.file.FileSystems");
+print('Unique lines:',
+   Files
+    .lines(FileSystems.default.getPath(arguments[0]))
+    .distinct()
+    .peek(print)
+    .count());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/weather.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,63 @@
+#// usage: jjs -scripting weather.js
+
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// Simple nashorn example showing back-quote exec process,
+// JSON and Java8 streams
+
+var Arrays = Java.type("java.util.Arrays");
+
+// use curl to download JSON weather data from the net
+// use backquote -scripting mode syntax to exec a process
+
+`curl http://api.openweathermap.org/data/2.5/forecast/daily?q=Chennai&amp;mode=json&amp;units=metric&amp;cnt=7`;
+
+// parse JSON
+var weather = JSON.parse($OUT);
+
+// pull out humidity as array
+var humidity = weather.list.map(function(curVal) {
+    return curVal.humidity;
+})
+
+// Stream API to print stat
+print("Humidity");
+print(Arrays["stream(int[])"](humidity).summaryStatistics());
+
+// pull maximum day time temperature
+var temp = weather.list.map(function(curVal) {
+    return curVal.temp.max;
+});
+
+// Stream API to print stat
+print("Max Temperature");
+print(Arrays["stream(double[])"](temp).summaryStatistics());
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Mon May 12 17:01:57 2014 -0700
@@ -525,6 +525,31 @@
         return evalImpl(script, ctxt, getNashornGlobalFrom(ctxt));
     }
 
+    private Object evalImpl(final Context.MultiGlobalCompiledScript mgcs, final ScriptContext ctxt, final Global ctxtGlobal) throws ScriptException {
+        final Global oldGlobal = Context.getGlobal();
+        final boolean globalChanged = (oldGlobal != ctxtGlobal);
+        try {
+            if (globalChanged) {
+                Context.setGlobal(ctxtGlobal);
+            }
+
+            final ScriptFunction script = mgcs.getFunction(ctxtGlobal);
+
+            // set ScriptContext variables if ctxt is non-null
+            if (ctxt != null) {
+                setContextVariables(ctxtGlobal, ctxt);
+            }
+            return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(ScriptRuntime.apply(script, ctxtGlobal), ctxtGlobal));
+        } catch (final Exception e) {
+            throwAsScriptException(e, ctxtGlobal);
+            throw new AssertionError("should not reach here");
+        } finally {
+            if (globalChanged) {
+                Context.setGlobal(oldGlobal);
+            }
+        }
+    }
+
     private Object evalImpl(final ScriptFunction script, final ScriptContext ctxt, final Global ctxtGlobal) throws ScriptException {
         if (script == null) {
             return null;
@@ -571,18 +596,38 @@
     }
 
     private CompiledScript asCompiledScript(final Source source) throws ScriptException {
-        final ScriptFunction func = compileImpl(source, context);
+        final Context.MultiGlobalCompiledScript mgcs;
+        final ScriptFunction func;
+        final Global oldGlobal = Context.getGlobal();
+        final Global newGlobal = getNashornGlobalFrom(context);
+        final boolean globalChanged = (oldGlobal != newGlobal);
+        try {
+            if (globalChanged) {
+                Context.setGlobal(newGlobal);
+            }
+
+            mgcs = nashornContext.compileScript(source);
+            func = mgcs.getFunction(newGlobal);
+        } catch (final Exception e) {
+            throwAsScriptException(e, newGlobal);
+            throw new AssertionError("should not reach here");
+        } finally {
+            if (globalChanged) {
+                Context.setGlobal(oldGlobal);
+            }
+        }
+
         return new CompiledScript() {
             @Override
             public Object eval(final ScriptContext ctxt) throws ScriptException {
                 final Global globalObject = getNashornGlobalFrom(ctxt);
-                // Are we running the script in the correct global?
+                // Are we running the script in the same global in which it was compiled?
                 if (func.getScope() == globalObject) {
                     return evalImpl(func, ctxt, globalObject);
                 }
-                // ScriptContext with a different global. Compile again!
-                // Note that we may still hit per-global compilation cache.
-                return evalImpl(compileImpl(source, ctxt), ctxt, globalObject);
+
+                // different global
+                return evalImpl(mgcs, ctxt, globalObject);
             }
             @Override
             public ScriptEngine getEngine() {
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Mon May 12 17:01:57 2014 -0700
@@ -1451,7 +1451,10 @@
 
             if (value == null) {
                 hasGettersSetters = true;
-            } else if (key.equals(ScriptObject.PROTO_PROPERTY_NAME)) {
+            } else if (propertyNode.getKey() instanceof IdentNode &&
+                       key.equals(ScriptObject.PROTO_PROPERTY_NAME)) {
+                // ES6 draft compliant __proto__ inside object literal
+                // Identifier key and name is __proto__
                 protoNode = value;
                 continue;
             }
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Mon May 12 17:01:57 2014 -0700
@@ -1906,6 +1906,13 @@
         // Object.getPrototypeOf(Function.prototype) === Object.prototype
         anon.setInitialProto(ObjectPrototype);
 
+        // ES6 draft compliant __proto__ property of Object.prototype
+        // accessors on Object.prototype for "__proto__"
+        final ScriptFunction getProto = ScriptFunctionImpl.makeFunction("getProto", ScriptObject.GETPROTO);
+        final ScriptFunction setProto = ScriptFunctionImpl.makeFunction("setProto", ScriptObject.SETPROTOCHECK);
+        ObjectPrototype.addOwnProperty("__proto__", Attribute.NOT_ENUMERABLE, getProto, setProto);
+
+
         // Function valued properties of Function.prototype were not properly
         // initialized. Because, these were created before global.function and
         // global.object were not initialized.
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Mon May 12 17:01:57 2014 -0700
@@ -33,6 +33,7 @@
 import static jdk.nashorn.internal.parser.TokenType.CATCH;
 import static jdk.nashorn.internal.parser.TokenType.COLON;
 import static jdk.nashorn.internal.parser.TokenType.COMMARIGHT;
+import static jdk.nashorn.internal.parser.TokenType.CONST;
 import static jdk.nashorn.internal.parser.TokenType.DECPOSTFIX;
 import static jdk.nashorn.internal.parser.TokenType.DECPREFIX;
 import static jdk.nashorn.internal.parser.TokenType.ELSE;
@@ -849,6 +850,11 @@
             expect(SEMICOLON);
             break;
         default:
+            if (env._const_as_var && type == CONST) {
+                variableStatement(true);
+                break;
+            }
+
             if (type == IDENT || isNonStrictModeIdent()) {
                 if (T(k + 1) == COLON) {
                     labelStatement();
@@ -1110,6 +1116,12 @@
             case SEMICOLON:
                 break;
             default:
+                if (env._const_as_var && type == CONST) {
+                    // Var statements captured in for outer block.
+                    vars = variableStatement(false);
+                    break;
+                }
+
                 final Expression expression = expression(unaryExpression(), COMMARIGHT.getPrecedence(), true);
                 forNode = forNode.setInit(lc, expression);
                 break;
--- a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java	Mon May 12 17:01:57 2014 -0700
@@ -111,7 +111,7 @@
     CATCH          (KEYWORD,  "catch"),
 //  CHAR           (FUTURE,   "char"),
     CLASS          (FUTURE,   "class"),
-    CONST          (FUTURE,  "const"),
+    CONST          (KEYWORD,  "const"),
     CONTINUE       (KEYWORD,  "continue"),
     DEBUGGER       (KEYWORD,  "debugger"),
     DEFAULT        (KEYWORD,  "default"),
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Mon May 12 17:01:57 2014 -0700
@@ -490,6 +490,39 @@
     }
 
     /**
+     * Interface to represent compiled code that can be re-used across many
+     * global scope instances
+     */
+    public static interface MultiGlobalCompiledScript {
+        /**
+         * Obtain script function object for a specific global scope object.
+         *
+         * @param newGlobal global scope for which function object is obtained
+         * @return script function for script level expressions
+         */
+        public ScriptFunction getFunction(final Global newGlobal);
+    }
+
+    /**
+     * Compile a top level script.
+     *
+     * @param source the script source
+     * @return reusable compiled script across many global scopes.
+     */
+    public MultiGlobalCompiledScript compileScript(final Source source) {
+        final Class<?> clazz = compile(source, this.errors, this._strict);
+        final MethodHandle runMethodHandle = getRunScriptHandle(clazz);
+        final boolean strict = isStrict(clazz);
+
+        return new MultiGlobalCompiledScript() {
+            @Override
+            public ScriptFunction getFunction(final Global newGlobal) {
+                return Context.getGlobal().newScriptFunction(RUN_SCRIPT.symbolName(), runMethodHandle, newGlobal, strict);
+            }
+        };
+    }
+
+    /**
      * Entry point for {@code eval}
      *
      * @param initialScope The scope of this eval call
@@ -949,14 +982,8 @@
         return ScriptRuntime.apply(script, thiz);
     }
 
-    private static ScriptFunction getRunScriptFunction(final Class<?> script, final ScriptObject scope) {
-        if (script == null) {
-            return null;
-        }
-
-        // Get run method - the entry point to the script
-        final MethodHandle runMethodHandle =
-                MH.findStatic(
+    private static MethodHandle getRunScriptHandle(final Class<?> script) {
+        return MH.findStatic(
                     MethodHandles.lookup(),
                     script,
                     RUN_SCRIPT.symbolName(),
@@ -964,14 +991,24 @@
                         Object.class,
                         ScriptFunction.class,
                         Object.class));
+    }
 
-        boolean strict;
-
+    private static boolean isStrict(final Class<?> script) {
         try {
-            strict = script.getField(STRICT_MODE.symbolName()).getBoolean(null);
+            return script.getField(STRICT_MODE.symbolName()).getBoolean(null);
         } catch (final NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
-            strict = false;
+            return false;
         }
+    }
+
+    private static ScriptFunction getRunScriptFunction(final Class<?> script, final ScriptObject scope) {
+        if (script == null) {
+            return null;
+        }
+
+        // Get run method - the entry point to the script
+        final MethodHandle runMethodHandle = getRunScriptHandle(script);
+        boolean strict = isStrict(script);
 
         // Package as a JavaScript function and pass function back to shell.
         return Context.getGlobal().newScriptFunction(RUN_SCRIPT.symbolName(), runMethodHandle, scope, strict);
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptEnvironment.java	Mon May 12 17:01:57 2014 -0700
@@ -62,6 +62,9 @@
     /** Only compile script, do not run it or generate other ScriptObjects */
     public final boolean _compile_only;
 
+    /** Accept "const" keyword and treat it as variable. Interim feature */
+    public final boolean _const_as_var;
+
     /** Accumulated callsite flags that will be used when bootstrapping script callsites */
     public final int     _callsite_flags;
 
@@ -200,6 +203,7 @@
 
         _class_cache_size     = options.getInteger("class.cache.size");
         _compile_only         = options.getBoolean("compile.only");
+        _const_as_var         = options.getBoolean("const.as.var");
         _debug_lines          = options.getBoolean("debug.lines");
         _dest_dir             = options.getString("d");
         _dump_on_error        = options.getBoolean("doe");
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Mon May 12 17:01:57 2014 -0700
@@ -91,7 +91,7 @@
  */
 
 public abstract class ScriptObject implements PropertyAccess {
-    /** __proto__ special property name */
+    /** __proto__ special property name inside object literals. ES6 draft. */
     public static final String PROTO_PROPERTY_NAME   = "__proto__";
 
     /** Search fall back routine name for "no such method" */
@@ -130,8 +130,10 @@
     /** Indexed array data. */
     private ArrayData arrayData;
 
-    static final MethodHandle GETPROTO           = findOwnMH("getProto", ScriptObject.class);
-    static final MethodHandle SETPROTOCHECK      = findOwnMH("setProtoCheck", void.class, Object.class);
+    /** Method handle to retrive prototype of this object */
+    public static final MethodHandle GETPROTO           = findOwnMH("getProto", ScriptObject.class);
+    /** Method handle to set prototype of this object */
+    public static final MethodHandle SETPROTOCHECK      = findOwnMH("setProtoCheck", void.class, Object.class);
     static final MethodHandle MEGAMORPHIC_GET    = findOwnMH("megamorphicGet", Object.class, String.class, boolean.class, boolean.class);
     static final MethodHandle GLOBALFILTER       = findOwnMH("globalFilter", Object.class, Object.class);
 
@@ -1732,10 +1734,6 @@
         MethodHandle methodHandle;
 
         if (find == null) {
-            if (PROTO_PROPERTY_NAME.equals(name)) {
-                return new GuardedInvocation(GETPROTO, NashornGuards.getScriptObjectGuard());
-            }
-
             if ("getProp".equals(operator)) {
                 return noSuchProperty(desc, request);
             } else if ("getMethod".equals(operator)) {
@@ -1890,9 +1888,7 @@
                 return createEmptySetMethod(desc, "property.not.writable", true);
             }
         } else {
-            if (PROTO_PROPERTY_NAME.equals(name)) {
-                return new GuardedInvocation(SETPROTOCHECK, NashornGuards.getScriptObjectGuard());
-            } else if (! isExtensible()) {
+            if (! isExtensible()) {
                 return createEmptySetMethod(desc, "object.non.extensible", false);
             }
         }
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/JdkRegExp.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/JdkRegExp.java	Mon May 12 17:01:57 2014 -0700
@@ -46,9 +46,6 @@
     /** Java regexp pattern to use for match. We compile to one of these */
     private Pattern pattern;
 
-    /** The matcher */
-    private RegExpMatcher matcher;
-
     /**
      * Construct a Regular expression from the given {@code source} and {@code flags} strings.
      *
@@ -95,14 +92,7 @@
             return null; // never matches or similar, e.g. a[]
         }
 
-        RegExpMatcher currentMatcher = this.matcher;
-
-        if (currentMatcher == null || matcher.getInput() != str) {
-            currentMatcher = new DefaultMatcher(str);
-            this.matcher  = currentMatcher;
-        }
-
-        return currentMatcher;
+        return new DefaultMatcher(str);
     }
 
     class DefaultMatcher implements RegExpMatcher {
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/JoniRegExp.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/JoniRegExp.java	Mon May 12 17:01:57 2014 -0700
@@ -44,9 +44,6 @@
     /** Compiled Joni Regex */
     private Regex regex;
 
-    /** Matcher */
-    private RegExpMatcher matcher;
-
     /**
      * Construct a Regular expression from the given {@code pattern} and {@code flags} strings.
      *
@@ -95,14 +92,7 @@
             return null;
         }
 
-        RegExpMatcher currentMatcher = this.matcher;
-
-        if (currentMatcher == null || input != currentMatcher.getInput()) {
-            currentMatcher = new JoniMatcher(input);
-            this.matcher   = currentMatcher;
-        }
-
-        return currentMatcher;
+        return new JoniMatcher(input);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/Regex.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/Regex.java	Mon May 12 17:01:57 2014 -0700
@@ -131,12 +131,13 @@
         this.warnings = null;
     }
 
-    public void compile() {
+    public synchronized MatcherFactory compile() {
         if (factory == null && analyser != null) {
-            Compiler compiler = new ArrayCompiler(analyser);
+            new ArrayCompiler(analyser).compile();
             analyser = null; // only do this once
-            compiler.compile();
         }
+        assert factory != null;
+        return factory;
     }
 
     public Matcher matcher(char[] chars) {
@@ -144,8 +145,11 @@
     }
 
     public Matcher matcher(char[] chars, int p, int end) {
-        compile();
-        return factory.create(this, chars, p, end);
+        MatcherFactory matcherFactory = factory;
+        if (matcherFactory == null) {
+            matcherFactory = compile();
+        }
+        return matcherFactory.create(this, chars, p, end);
     }
 
     public WarnCallback getWarnings() {
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Options.properties	Mon May 12 17:01:57 2014 -0700
@@ -102,6 +102,13 @@
     type=Boolean                      \
 }
 
+nashorn.option.const.as.var = {          \
+    name="--const-as-var",               \
+    is_undocumented=true,                \
+    desc="Replace 'const' with 'var'.",  \
+    type=Boolean                         \
+}
+
 nashorn.option.d = {                                             \
     name="--dump-debug-dir",                                     \
     short_name="-d",                                             \
--- a/nashorn/src/jdk/nashorn/tools/Shell.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/src/jdk/nashorn/tools/Shell.java	Mon May 12 17:01:57 2014 -0700
@@ -453,7 +453,7 @@
             }
         } finally {
             if (globalChanged) {
-                Context.setGlobal(global);
+                Context.setGlobal(oldGlobal);
             }
         }
 
--- a/nashorn/test/script/basic/JDK-8008448.js	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/test/script/basic/JDK-8008448.js	Mon May 12 17:01:57 2014 -0700
@@ -26,6 +26,7 @@
  * Ensure that all parseable files can be parsed using parser API.
  *
  * @test
+ * @option --const-as-var
  * @option -scripting
  * @run
  */
--- a/nashorn/test/script/basic/JDK-8024120.js	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/test/script/basic/JDK-8024120.js	Mon May 12 17:01:57 2014 -0700
@@ -32,10 +32,6 @@
 
 obj.__proto__ = null;
 
-if (obj.__proto__ !== null || typeof(obj.__proto__) != 'object') {
-    fail("obj.__proto__ is expected to be null");
-}
-
 var p = Object.getPrototypeOf(obj);
 if (p !== null || typeof(p) != 'object') {
     fail("Object.getPrototypeOf(obj) is expected to be null");
--- a/nashorn/test/script/basic/JDK-8024174.js	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/test/script/basic/JDK-8024174.js	Mon May 12 17:01:57 2014 -0700
@@ -46,6 +46,6 @@
     __proto__: null
 };
 
-if (obj2.__proto__ !== null || Object.getPrototypeOf(obj2) !== null) {
+if (Object.getPrototypeOf(obj2) !== null) {
     fail("obj2.__proto__ was not set to null inside literal");
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027933.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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-8027933: Add const.as.var option
+ *
+ * @test
+ * @option --const-as-var
+ * @run
+ */
+
+const THE_ANSWER = 42;
+print("Answer to all questions: " + THE_ANSWER);
+
+print((function () {
+    const FORTY_TWO = 42;
+    return FORTY_TWO
+})())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027933.js.EXPECTED	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,2 @@
+Answer to all questions: 42
+42
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8041998.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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-8041998: RegExp implementation is not thread-safe
+ *
+ * @test
+ * @run
+ */
+
+var Thread = java.lang.Thread;
+
+function run() {
+    var line = 'content-type: text/html';
+    for (var i = 0; i < 300; i++) {
+        Thread.sleep(1);
+        line.split(/: /);
+    }
+    print("done");
+}
+
+var threads = [];
+
+for (var i = 0; i < 4; i++) {
+    var thread = new Thread(run);
+    thread.start();
+    threads.push(thread);
+}
+
+for (var i = 0; i < 4; i++) {
+    threads[i].join();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8041998.js.EXPECTED	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,4 @@
+done
+done
+done
+done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8042364.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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-8042364: Make __proto__ ES6 draft compliant
+ * 
+ * @test
+ * @run
+ */
+
+// check for Object.prototype.__proto__ accessor property
+print("Object.prototype has __proto__?",
+    Object.prototype.hasOwnProperty("__proto__"))
+
+var desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__")
+print("descriptor");
+print(JSON.stringify(desc))
+print("getter", desc.get)
+print("setter", desc.set)
+
+// no computed "__proto__" name, only identifier!
+var p = {}
+var obj = {
+    "__proto__" : p
+}
+
+if (Object.getPrototypeOf(obj) === p) {
+    fail("obj has wrong __proto__, allows computed __proto__!")
+}
+
+if (obj.__proto__ !== p) {
+    fail("__proto__ not created as normal property!")
+}
+
+if (Object.getPrototypeOf(obj) !== Object.prototype) {
+    fail("obj has wrong __proto__")
+}
+
+var obj2 = {
+    __proto__: p
+}
+
+if (Object.getPrototypeOf(obj2) !== p) {
+    fail("can't set __proto__ in object literal")
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8042364.js.EXPECTED	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,5 @@
+Object.prototype has __proto__? true
+descriptor
+{"configurable":true,"enumerable":false}
+getter function getProto() { [native code] }
+setter function setProto() { [native code] }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8027933.js	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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-8027933: Add const.as.var option
+ *
+ * @test/compile-error
+ */
+
+// without --const-as-var the following should fail to compile
+const THE_ANSWER = 42;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/error/JDK-8027933.js.EXPECTED	Mon May 12 17:01:57 2014 -0700
@@ -0,0 +1,3 @@
+test/script/error/JDK-8027933.js:31:0 Expected an operand but found const
+const THE_ANSWER = 42;
+^
--- a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Mon May 12 17:01:57 2014 -0700
@@ -71,6 +71,7 @@
         options.set("print.ast", true);
         options.set("print.parse", true);
         options.set("scripting", true);
+        options.set("const.as.var", true);
 
         final ErrorManager errors = new ErrorManager() {
             @Override
--- a/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java	Mon May 12 17:01:57 2014 -0700
@@ -65,6 +65,7 @@
         options.set("anon.functions", true);
         options.set("parse.only", true);
         options.set("scripting", true);
+        options.set("const.as.var", true);
 
         ErrorManager errors = new ErrorManager();
         this.context = new Context(options, errors, Thread.currentThread().getContextClassLoader());
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java	Fri May 09 09:12:39 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java	Mon May 12 17:01:57 2014 -0700
@@ -220,4 +220,19 @@
         // bar should be visible in default context
         assertTrue(e.eval("typeof bar").equals("function"));
     }
+
+
+    @Test public void nashornSwallowsConstKeyword() throws Exception {
+        final NashornScriptEngineFactory f = new NashornScriptEngineFactory();
+        final String[] args = new String[] { "--const-as-var" };
+        final ScriptEngine engine = f.getScriptEngine(args);
+
+        final Object ret = engine.eval(""
+            + "(function() {\n"
+            + "  const x = 10;\n"
+            + "  return x;\n"
+            + "})();"
+        );
+        assertEquals(ret, 10, "Parsed and executed OK");
+    }
 }