Merge
authorlana
Thu, 22 May 2014 14:38:34 -0700
changeset 24448 6a343232ff19
parent 24423 436c66332af2 (current diff)
parent 24447 97e9abb0864b (diff)
child 24490 8e732d204328
Merge
hotspot/src/share/vm/libadt/port.cpp
hotspot/src/share/vm/libadt/port.hpp
--- a/hotspot/make/aix/makefiles/vm.make	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/make/aix/makefiles/vm.make	Thu May 22 14:38:34 2014 -0700
@@ -136,8 +136,6 @@
 JVM      = jvm
 LIBJVM   = lib$(JVM).so
 
-CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
-
 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 LIBJVM_DIZ         = lib$(JVM).diz
 
--- a/hotspot/make/bsd/makefiles/vm.make	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/make/bsd/makefiles/vm.make	Thu May 22 14:38:34 2014 -0700
@@ -146,9 +146,6 @@
 ifeq ($(OS_VENDOR), Darwin)
   LIBJVM   = lib$(JVM).dylib
   CFLAGS  += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-  ifeq (${VERSION}, $(filter ${VERSION}, debug fastdebug))
-    CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
-  endif
 
   LIBJVM_DEBUGINFO   = lib$(JVM).dylib.dSYM
   LIBJVM_DIZ         = lib$(JVM).diz
--- a/hotspot/make/windows/projectfiles/common/Makefile	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/make/windows/projectfiles/common/Makefile	Thu May 22 14:38:34 2014 -0700
@@ -93,7 +93,7 @@
 !if "$(HOTSPOT_RELEASE_VERSION)" != ""
 HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
 !else
-HOTSPOT_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
+HOTSPOT_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
 !endif
 # Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set,
 # and if it is not see if we have the src/closed directory
@@ -105,9 +105,18 @@
 !else
 HOTSPOT_VM_DISTRO="\\\"OpenJDK\\\""
 !endif
+!if "$(JDK_BUILD_NUMBER)" != ""
+JDK_BUILD_NUMBER="\\\"$(JDK_BUILD_NUMBER)\\\""
+!else
+JDK_BUILD_NUMBER="\\\"00\\\""
+!endif
 !endif
 
-ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO)
+JDK_MAJOR_VERSION="\\\"$(JDK_MAJOR_VER)\\\""
+JDK_MINOR_VERSION="\\\"$(JDK_MINOR_VER)\\\""
+JDK_MICRO_VERSION="\\\"$(JDK_MICRO_VER)\\\""
+
+ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) -define JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) -define JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) -define JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER)
 ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions)
 
 $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
--- a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp	Thu May 22 14:38:34 2014 -0700
@@ -41,7 +41,6 @@
 define_pd_global(bool, ProfileInterpreter,           true);
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            140000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         3);
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Thu May 22 14:38:34 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/c1_CodeStubs_sparc.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Thu May 22 14:38:34 2014 -0700
@@ -414,6 +414,7 @@
 
 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
   __ bind(_entry);
+  __ set(_trap_request, G4);
   __ call(Runtime1::entry_for(Runtime1::deoptimize_id), relocInfo::runtime_call_type);
   __ delayed()->nop();
   ce->add_call_info_here(_info);
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Thu May 22 14:38:34 2014 -0700
@@ -781,7 +781,7 @@
       {
         __ set_info("deoptimize", dont_gc_arguments);
         OopMap* oop_map = save_live_registers(sasm);
-        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize));
+        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), G4);
         oop_maps = new OopMapSet();
         oop_maps->add_gc_map(call_offset, oop_map);
         restore_live_registers(sasm);
--- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp	Thu May 22 14:38:34 2014 -0700
@@ -40,7 +40,6 @@
 define_pd_global(bool, UseOnStackReplacement,        true );
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             1000 ); // Design center runs on 1.3.1
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     1400 );
 define_pd_global(bool, UseTLAB,                      true );
--- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp	Thu May 22 14:38:34 2014 -0700
@@ -44,7 +44,6 @@
 #endif // CC_INTERP
 define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            140000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         4);
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu May 22 14:38:34 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_CodeStubs_x86.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Thu May 22 14:38:34 2014 -0700
@@ -430,6 +430,7 @@
 
 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
   __ bind(_entry);
+  ce->store_parameter(_trap_request, 0);
   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::deoptimize_id)));
   ce->add_call_info_here(_info);
   DEBUG_ONLY(__ should_not_reach_here());
--- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Thu May 22 14:38:34 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/c1_Runtime1_x86.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Thu May 22 14:38:34 2014 -0700
@@ -1468,9 +1468,10 @@
     case deoptimize_id:
       {
         StubFrame f(sasm, "deoptimize", dont_gc_arguments);
-        const int num_rt_args = 1;  // thread
+        const int num_rt_args = 2;  // thread, trap_request
         OopMap* oop_map = save_live_registers(sasm, num_rt_args);
-        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize));
+        f.load_argument(0, rax);
+        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), rax);
         oop_maps = new OopMapSet();
         oop_maps->add_gc_map(call_offset, oop_map);
         restore_live_registers(sasm);
--- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp	Thu May 22 14:38:34 2014 -0700
@@ -41,7 +41,6 @@
 define_pd_global(bool, UseOnStackReplacement,        true );
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             1500 );
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     933  );
 define_pd_global(intx, FreqInlineSize,               325  );
--- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp	Thu May 22 14:38:34 2014 -0700
@@ -45,7 +45,6 @@
 #endif // CC_INTERP
 define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         3);
--- a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp	Thu May 22 14:38:34 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/macroAssembler_x86.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Thu May 22 14:38:34 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/cpu/zero/vm/shark_globals_zero.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Thu May 22 14:38:34 2014 -0700
@@ -43,7 +43,6 @@
 define_pd_global(intx,     Tier3CompileThreshold,        2500);
 define_pd_global(intx,     Tier4CompileThreshold,        4500);
 
-define_pd_global(intx,     BackEdgeThreshold,            100000);
 define_pd_global(intx,     Tier2BackEdgeThreshold,       100000);
 define_pd_global(intx,     Tier3BackEdgeThreshold,       100000);
 define_pd_global(intx,     Tier4BackEdgeThreshold,       100000);
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Thu May 22 14:38:34 2014 -0700
@@ -1871,7 +1871,7 @@
 // properties.
 
 // ShmBkBlock: base class for all blocks in the shared memory bookkeeping
-class ShmBkBlock {
+class ShmBkBlock : public CHeapObj<mtInternal> {
 
   ShmBkBlock* _next;
 
--- a/hotspot/src/os/aix/vm/porting_aix.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os/aix/vm/porting_aix.cpp	Thu May 22 14:38:34 2014 -0700
@@ -23,6 +23,7 @@
  */
 
 #include "asm/assembler.hpp"
+#include "memory/allocation.hpp"
 #include "loadlib_aix.hpp"
 #include "porting_aix.hpp"
 #include "utilities/debug.hpp"
@@ -67,7 +68,7 @@
 // a primitive string map. Should this turn out to be a performance
 // problem, a better hashmap has to be used.
 class fixed_strings {
-  struct node {
+  struct node : public CHeapObj<mtInternal> {
     char* v;
     node* next;
   };
--- a/hotspot/src/os/bsd/vm/decoder_machO.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os/bsd/vm/decoder_machO.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu May 22 14:38:34 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/adlc.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/adlc/adlc.hpp	Thu May 22 14:38:34 2014 -0700
@@ -30,12 +30,13 @@
 //
 
 // standard library constants
-#include "stdio.h"
-#include "stdlib.h"
 #include <iostream>
-#include "string.h"
-#include "ctype.h"
-#include "stdarg.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
 #include <sys/types.h>
 
 /* Make sure that we have the intptr_t and uintptr_t definitions */
--- a/hotspot/src/share/vm/adlc/adlparse.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/adlc/adlparse.hpp	Thu May 22 14:38:34 2014 -0700
@@ -64,8 +64,6 @@
 class PeepConstraint;
 class PeepReplace;
 
-// class ostream; // ostream is a typedef in some systems
-
 extern char *toUpper(const char *str);
 
 //---------------------------ADLParser-----------------------------------------
--- a/hotspot/src/share/vm/adlc/filebuff.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/adlc/filebuff.cpp	Thu May 22 14:38:34 2014 -0700
@@ -25,8 +25,6 @@
 // FILEBUFF.CPP - Routines for handling a parser file buffer
 #include "adlc.hpp"
 
-using namespace std;
-
 //------------------------------FileBuff---------------------------------------
 // Create a new parsing buffer
 FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(archDesc) {
--- a/hotspot/src/share/vm/adlc/filebuff.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/adlc/filebuff.hpp	Thu May 22 14:38:34 2014 -0700
@@ -26,9 +26,6 @@
 #define SHARE_VM_ADLC_FILEBUFF_HPP
 
 // FILEBUFF.HPP - Definitions for parser file buffering routines
-#include <iostream>
-
-using namespace std;
 
 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
 
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/adlc/output_h.cpp	Thu May 22 14:38:34 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
@@ -211,7 +211,7 @@
     const char *type = oper->ideal_type(globals);
     if (!strcmp(type, "ConI")) {
       if (i > 0) fprintf(fp,", ");
-      fprintf(fp,"  int32          _c%d;\n", i);
+      fprintf(fp,"  int32_t        _c%d;\n", i);
     }
     else if (!strcmp(type, "ConP")) {
       if (i > 0) fprintf(fp,", ");
@@ -307,7 +307,7 @@
     assert(num_consts == 1, "Bad component list detected.\n");
     switch( constant_type ) {
     case Form::idealI : {
-      fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32 c%d", i);
+      fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32_t c%d", i);
       break;
     }
     case Form::idealN :      { fprintf(fp,"const TypeNarrowOop *c%d", i); break; }
@@ -326,7 +326,7 @@
     while((comp = lst.iter()) != NULL) {
       if (!strcmp(comp->base_type(globals), "ConI")) {
         if (i > 0) fprintf(fp,", ");
-        fprintf(fp,"int32 c%d", i);
+        fprintf(fp,"int32_t c%d", i);
         i++;
       }
       else if (!strcmp(comp->base_type(globals), "ConP")) {
@@ -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/assembler.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/asm/assembler.cpp	Thu May 22 14:38:34 2014 -0700
@@ -119,7 +119,7 @@
   L.patch_instructions((MacroAssembler*)this);
 }
 
-void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) {
+void AbstractAssembler::generate_stack_overflow_check(int frame_size_in_bytes) {
   if (UseStackBanging) {
     // Each code entry causes one stack bang n pages down the stack where n
     // is configurable by StackShadowPages.  The setting depends on the maximum
@@ -134,7 +134,7 @@
     // is greater than a page.
 
     const int page_size = os::vm_page_size();
-    int bang_end = StackShadowPages*page_size;
+    int bang_end = StackShadowPages * page_size;
 
     // This is how far the previous frame's stack banging extended.
     const int bang_end_safe = bang_end;
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/asm/register.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp	Thu May 22 14:38:34 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_CodeStubs.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Thu May 22 14:38:34 2014 -0700
@@ -450,9 +450,11 @@
 class DeoptimizeStub : public CodeStub {
 private:
   CodeEmitInfo* _info;
+  jint _trap_request;
 
 public:
-  DeoptimizeStub(CodeEmitInfo* info) : _info(new CodeEmitInfo(info)) {}
+  DeoptimizeStub(CodeEmitInfo* info, Deoptimization::DeoptReason reason, Deoptimization::DeoptAction action) :
+    _info(new CodeEmitInfo(info)), _trap_request(Deoptimization::make_trap_request(reason, action)) {}
 
   virtual void emit_code(LIR_Assembler* e);
   virtual CodeEmitInfo* info() const           { return _info; }
--- a/hotspot/src/share/vm/c1/c1_Compilation.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp	Thu May 22 14:38:34 2014 -0700
@@ -251,6 +251,10 @@
     return env()->comp_level() == CompLevel_full_profile &&
       C1UpdateMethodData && MethodData::profile_return();
   }
+  bool age_code() const {
+    return _method->profile_aging();
+  }
+
   // will compilation make optimistic assumptions that might lead to
   // deoptimization and that the runtime will account for?
   bool is_optimistic() const                             {
--- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Thu May 22 14:38:34 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_LIRGenerator.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu May 22 14:38:34 2014 -0700
@@ -2782,7 +2782,10 @@
       __ lock_object(syncTempOpr(), obj, lock, new_register(T_OBJECT), slow_path, NULL);
     }
   }
-
+  if (compilation()->age_code()) {
+    CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, 0), NULL, false);
+    decrement_age(info);
+  }
   // increment invocation counters if needed
   if (!method()->is_accessor()) { // Accessors do not have MDOs, so no counting.
     profile_parameters(x);
@@ -3328,6 +3331,27 @@
   increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true);
 }
 
+void LIRGenerator::decrement_age(CodeEmitInfo* info) {
+  ciMethod* method = info->scope()->method();
+  MethodCounters* mc_adr = method->ensure_method_counters();
+  if (mc_adr != NULL) {
+    LIR_Opr mc = new_pointer_register();
+    __ move(LIR_OprFact::intptrConst(mc_adr), mc);
+    int offset = in_bytes(MethodCounters::nmethod_age_offset());
+    LIR_Address* counter = new LIR_Address(mc, offset, T_INT);
+    LIR_Opr result = new_register(T_INT);
+    __ load(counter, result);
+    __ sub(result, LIR_OprFact::intConst(1), result);
+    __ store(result, counter);
+    // DeoptimizeStub will reexecute from the current state in code info.
+    CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_tenured,
+                                         Deoptimization::Action_make_not_entrant);
+    __ cmp(lir_cond_lessEqual, result, LIR_OprFact::intConst(0));
+    __ branch(lir_cond_lessEqual, T_INT, deopt);
+  }
+}
+
+
 void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info,
                                                 ciMethod *method, int frequency,
                                                 int bci, bool backedge, bool notify) {
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Thu May 22 14:38:34 2014 -0700
@@ -372,7 +372,7 @@
       increment_event_counter(info, bci, true);
     }
   }
-
+  void decrement_age(CodeEmitInfo* info);
   CodeEmitInfo* state_for(Instruction* x, ValueStack* state, bool ignore_xhandler = false);
   CodeEmitInfo* state_for(Instruction* x);
 
--- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu May 22 14:38:34 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;
@@ -685,19 +685,32 @@
 JRT_END
 
 // Cf. OptoRuntime::deoptimize_caller_frame
-JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread))
+JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread, jint trap_request))
   // Called from within the owner thread, so no need for safepoint
   RegisterMap reg_map(thread, false);
   frame stub_frame = thread->last_frame();
-  assert(stub_frame.is_runtime_frame(), "sanity check");
+  assert(stub_frame.is_runtime_frame(), "Sanity check");
   frame caller_frame = stub_frame.sender(&reg_map);
+  nmethod* nm = caller_frame.cb()->as_nmethod_or_null();
+  assert(nm != NULL, "Sanity check");
+  methodHandle method(thread, nm->method());
+  assert(nm == CodeCache::find_nmethod(caller_frame.pc()), "Should be the same");
+  Deoptimization::DeoptAction action = Deoptimization::trap_request_action(trap_request);
+  Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(trap_request);
 
-  // We are coming from a compiled method; check this is true.
-  assert(CodeCache::find_nmethod(caller_frame.pc()) != NULL, "sanity");
+  if (action == Deoptimization::Action_make_not_entrant) {
+    if (nm->make_not_entrant()) {
+      if (reason == Deoptimization::Reason_tenured) {
+        MethodData* trap_mdo = Deoptimization::get_method_data(thread, method, true /*create_if_missing*/);
+        if (trap_mdo != NULL) {
+          trap_mdo->inc_tenure_traps();
+        }
+      }
+    }
+  }
 
   // Deoptimize the caller frame.
   Deoptimization::deoptimize_frame(thread, caller_frame.id());
-
   // Return to the now deoptimized frame.
 JRT_END
 
@@ -988,8 +1001,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 +1461,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_Runtime1.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Thu May 22 14:38:34 2014 -0700
@@ -156,7 +156,7 @@
   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock);
   static void monitorexit (JavaThread* thread, BasicObjectLock* lock);
 
-  static void deoptimize(JavaThread* thread);
+  static void deoptimize(JavaThread* thread, jint trap_request);
 
   static int access_field_patching(JavaThread* thread);
   static int move_klass_patching(JavaThread* thread);
--- a/hotspot/src/share/vm/c1/c1_ValueType.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_ValueType.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciConstant.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciMetadata.cpp	Thu May 22 14:38:34 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/ciMethod.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Thu May 22 14:38:34 2014 -0700
@@ -129,6 +129,7 @@
   constantPoolHandle cpool = h_m()->constants();
   _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
   _method_data = NULL;
+  _nmethod_age = h_m()->nmethod_age();
   // Take a snapshot of these values, so they will be commensurate with the MDO.
   if (ProfileInterpreter || TieredCompilation) {
     int invcnt = h_m()->interpreter_invocation_count();
@@ -1276,6 +1277,14 @@
 }
 
 // ------------------------------------------------------------------
+// ciMethod::profile_aging
+//
+// Should the method be compiled with an age counter?
+bool ciMethod::profile_aging() const {
+  return UseCodeAging && (!MethodCounters::is_nmethod_hot(nmethod_age()) &&
+                          !MethodCounters::is_nmethod_age_unset(nmethod_age()));
+}
+// ------------------------------------------------------------------
 // ciMethod::print_codes
 //
 // Print the bytecodes for this method.
--- a/hotspot/src/share/vm/ci/ciMethod.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp	Thu May 22 14:38:34 2014 -0700
@@ -68,6 +68,7 @@
   int _max_locals;
   vmIntrinsics::ID _intrinsic_id;
   int _handler_count;
+  int _nmethod_age;
   int _interpreter_invocation_count;
   int _interpreter_throwout_count;
   int _instructions_size;
@@ -168,6 +169,10 @@
   int interpreter_invocation_count() const       { check_is_loaded(); return _interpreter_invocation_count; }
   int interpreter_throwout_count() const         { check_is_loaded(); return _interpreter_throwout_count; }
   int size_of_parameters() const                 { check_is_loaded(); return _size_of_parameters; }
+  int nmethod_age() const                        { check_is_loaded(); return _nmethod_age; }
+
+  // Should the method be compiled with an age counter?
+  bool profile_aging() const;
 
   // Code size for inlining decisions.
   int code_size_for_inlining();
--- a/hotspot/src/share/vm/ci/ciMethodData.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciMethodData.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciObject.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciSignature.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciType.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileError.cpp	Thu May 22 14:38:34 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.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu May 22 14:38:34 2014 -0700
@@ -875,6 +875,7 @@
   int runtime_visible_type_annotations_length = 0;
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
+  bool runtime_invisible_annotations_exists = false;
   bool runtime_invisible_type_annotations_exists = false;
   while (attributes_count--) {
     cfs->guarantee_more(6, CHECK);  // attribute_name_index, attribute_length
@@ -920,6 +921,10 @@
         }
         generic_signature_index = cfs->get_u2(CHECK);
       } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes for field in class file %s", CHECK);
+        }
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -928,11 +933,18 @@
                           parsed_annotations,
                           CHECK);
         cfs->skip_u1(runtime_visible_annotations_length, CHECK);
-      } else if (PreserveAllAnnotations && attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK);
+      } else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes for field in class file %s", CHECK);
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(attribute_length, CHECK);
       } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) {
         if (runtime_visible_type_annotations != NULL) {
           classfile_parse_error(
@@ -2066,7 +2078,9 @@
   int runtime_visible_type_annotations_length = 0;
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
+  bool runtime_invisible_annotations_exists = false;
   bool runtime_invisible_type_annotations_exists = false;
+  bool runtime_invisible_parameter_annotations_exists = false;
   u1* annotation_default = NULL;
   int annotation_default_length = 0;
 
@@ -2295,6 +2309,10 @@
         cfs->guarantee_more(2, CHECK_(nullHandle));  // generic_signature_index
         generic_signature_index = cfs->get_u2_fast();
       } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
         runtime_visible_annotations_length = method_attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -2302,22 +2320,45 @@
             runtime_visible_annotations_length, &parsed_annotations,
             CHECK_(nullHandle));
         cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle));
-      } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = method_attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK_(nullHandle));
+      } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = method_attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
       } else if (method_attribute_name == vmSymbols::tag_runtime_visible_parameter_annotations()) {
+        if (runtime_visible_parameter_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
         runtime_visible_parameter_annotations_length = method_attribute_length;
         runtime_visible_parameter_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_parameter_annotations != NULL, "null visible parameter annotations");
         cfs->skip_u1(runtime_visible_parameter_annotations_length, CHECK_(nullHandle));
-      } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) {
-        runtime_invisible_parameter_annotations_length = method_attribute_length;
-        runtime_invisible_parameter_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations");
-        cfs->skip_u1(runtime_invisible_parameter_annotations_length, CHECK_(nullHandle));
+      } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) {
+        if (runtime_invisible_parameter_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
+        runtime_invisible_parameter_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_parameter_annotations_length = method_attribute_length;
+          runtime_invisible_parameter_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations");
+        }
+        cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
       } else if (method_attribute_name == vmSymbols::tag_annotation_default()) {
+        if (annotation_default != NULL) {
+          classfile_parse_error(
+            "Multiple AnnotationDefault attributes for method in class file %s",
+            CHECK_(nullHandle));
+        }
         annotation_default_length = method_attribute_length;
         annotation_default = cfs->get_u1_buffer();
         assert(annotation_default != NULL, "null annotation default");
@@ -2846,6 +2887,8 @@
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
   bool runtime_invisible_type_annotations_exists = false;
+  bool runtime_invisible_annotations_exists = false;
+  bool parsed_source_debug_ext_annotations_exist = false;
   u1* inner_classes_attribute_start = NULL;
   u4  inner_classes_attribute_length = 0;
   u2  enclosing_method_class_index = 0;
@@ -2873,6 +2916,11 @@
       parse_classfile_sourcefile_attribute(CHECK);
     } else if (tag == vmSymbols::tag_source_debug_extension()) {
       // Check for SourceDebugExtension tag
+      if (parsed_source_debug_ext_annotations_exist) {
+          classfile_parse_error(
+            "Multiple SourceDebugExtension attributes in class file %s", CHECK);
+      }
+      parsed_source_debug_ext_annotations_exist = true;
       parse_classfile_source_debug_extension_attribute((int)attribute_length, CHECK);
     } else if (tag == vmSymbols::tag_inner_classes()) {
       // Check for InnerClasses tag
@@ -2909,6 +2957,10 @@
         }
         parse_classfile_signature_attribute(CHECK);
       } else if (tag == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes in class file %s", CHECK);
+        }
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -2917,11 +2969,18 @@
                           parsed_annotations,
                           CHECK);
         cfs->skip_u1(runtime_visible_annotations_length, CHECK);
-      } else if (PreserveAllAnnotations && tag == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK);
+      } else if (tag == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes in class file %s", CHECK);
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(attribute_length, CHECK);
       } else if (tag == vmSymbols::tag_enclosing_method()) {
         if (parsed_enclosingmethod_attribute) {
           classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK);
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu May 22 14:38:34 2014 -0700
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/debugInfo.hpp"
 #include "code/pcDesc.hpp"
@@ -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;
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp	Thu May 22 14:38:34 2014 -0700
@@ -0,0 +1,533 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/altHashing.hpp"
+#include "classfile/javaClasses.hpp"
+#include "classfile/stringTable.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "gc_interface/collectedHeap.inline.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/filemap.hpp"
+#include "memory/gcLocker.inline.hpp"
+#include "oops/oop.inline.hpp"
+#include "oops/oop.inline2.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "utilities/hashtable.inline.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/g1StringDedup.hpp"
+#endif
+
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
+// the number of buckets a thread claims
+const int ClaimChunkSize = 32;
+
+#ifdef ASSERT
+class StableMemoryChecker : public StackObj {
+  enum { _bufsize = wordSize*4 };
+
+  address _region;
+  jint    _size;
+  u1      _save_buf[_bufsize];
+
+  int sample(u1* save_buf) {
+    if (_size <= _bufsize) {
+      memcpy(save_buf, _region, _size);
+      return _size;
+    } else {
+      // copy head and tail
+      memcpy(&save_buf[0],          _region,                      _bufsize/2);
+      memcpy(&save_buf[_bufsize/2], _region + _size - _bufsize/2, _bufsize/2);
+      return (_bufsize/2)*2;
+    }
+  }
+
+ public:
+  StableMemoryChecker(const void* region, jint size) {
+    _region = (address) region;
+    _size   = size;
+    sample(_save_buf);
+  }
+
+  bool verify() {
+    u1 check_buf[sizeof(_save_buf)];
+    int check_size = sample(check_buf);
+    return (0 == memcmp(_save_buf, check_buf, check_size));
+  }
+
+  void set_region(const void* region) { _region = (address) region; }
+};
+#endif
+
+
+// --------------------------------------------------------------------------
+StringTable* StringTable::_the_table = NULL;
+
+bool StringTable::_needs_rehashing = false;
+
+volatile int StringTable::_parallel_claimed_idx = 0;
+
+// Pick hashing algorithm
+unsigned int StringTable::hash_string(const jchar* s, int len) {
+  return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) :
+                                    java_lang_String::hash_code(s, len);
+}
+
+oop StringTable::lookup(int index, jchar* name,
+                        int len, unsigned int hash) {
+  int count = 0;
+  for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
+    count++;
+    if (l->hash() == hash) {
+      if (java_lang_String::equals(l->literal(), name, len)) {
+        return l->literal();
+      }
+    }
+  }
+  // If the bucket size is too deep check if this hash code is insufficient.
+  if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
+    _needs_rehashing = check_rehash_table(count);
+  }
+  return NULL;
+}
+
+
+oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
+                           int len, unsigned int hashValue_arg, TRAPS) {
+
+  assert(java_lang_String::equals(string(), name, len),
+         "string must be properly initialized");
+  // Cannot hit a safepoint in this function because the "this" pointer can move.
+  No_Safepoint_Verifier nsv;
+
+  // Check if the symbol table has been rehashed, if so, need to recalculate
+  // the hash value and index before second lookup.
+  unsigned int hashValue;
+  int index;
+  if (use_alternate_hashcode()) {
+    hashValue = hash_string(name, len);
+    index = hash_to_index(hashValue);
+  } else {
+    hashValue = hashValue_arg;
+    index = index_arg;
+  }
+
+  // Since look-up was done lock-free, we need to check if another
+  // thread beat us in the race to insert the symbol.
+
+  oop test = lookup(index, name, len, hashValue); // calls lookup(u1*, int)
+  if (test != NULL) {
+    // Entry already added
+    return test;
+  }
+
+  HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
+  add_entry(index, entry);
+  return string();
+}
+
+
+oop StringTable::lookup(Symbol* symbol) {
+  ResourceMark rm;
+  int length;
+  jchar* chars = symbol->as_unicode(length);
+  return lookup(chars, length);
+}
+
+
+oop StringTable::lookup(jchar* name, int len) {
+  unsigned int hash = hash_string(name, len);
+  int index = the_table()->hash_to_index(hash);
+  return the_table()->lookup(index, name, len, hash);
+}
+
+
+oop StringTable::intern(Handle string_or_null, jchar* name,
+                        int len, TRAPS) {
+  unsigned int hashValue = hash_string(name, len);
+  int index = the_table()->hash_to_index(hashValue);
+  oop found_string = the_table()->lookup(index, name, len, hashValue);
+
+  // Found
+  if (found_string != NULL) return found_string;
+
+  debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
+  assert(!Universe::heap()->is_in_reserved(name),
+         "proposed name of symbol must be stable");
+
+  Handle string;
+  // try to reuse the string if possible
+  if (!string_or_null.is_null()) {
+    string = string_or_null;
+  } else {
+    string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
+  }
+
+#if INCLUDE_ALL_GCS
+  if (G1StringDedup::is_enabled()) {
+    // Deduplicate the string before it is interned. Note that we should never
+    // deduplicate a string after it has been interned. Doing so will counteract
+    // compiler optimizations done on e.g. interned string literals.
+    G1StringDedup::deduplicate(string());
+  }
+#endif
+
+  // Grab the StringTable_lock before getting the_table() because it could
+  // change at safepoint.
+  MutexLocker ml(StringTable_lock, THREAD);
+
+  // Otherwise, add to symbol to table
+  return the_table()->basic_add(index, string, name, len,
+                                hashValue, CHECK_NULL);
+}
+
+oop StringTable::intern(Symbol* symbol, TRAPS) {
+  if (symbol == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length;
+  jchar* chars = symbol->as_unicode(length);
+  Handle string;
+  oop result = intern(string, chars, length, CHECK_NULL);
+  return result;
+}
+
+
+oop StringTable::intern(oop string, TRAPS)
+{
+  if (string == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length;
+  Handle h_string (THREAD, string);
+  jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL);
+  oop result = intern(h_string, chars, length, CHECK_NULL);
+  return result;
+}
+
+
+oop StringTable::intern(const char* utf8_string, TRAPS) {
+  if (utf8_string == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length = UTF8::unicode_length(utf8_string);
+  jchar* chars = NEW_RESOURCE_ARRAY(jchar, length);
+  UTF8::convert_to_unicode(utf8_string, chars, length);
+  Handle string;
+  oop result = intern(string, chars, length, CHECK_NULL);
+  return result;
+}
+
+void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
+  buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), processed, removed);
+}
+
+void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
+  // Readers of the table are unlocked, so we should only be removing
+  // entries at a safepoint.
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+  const int limit = the_table()->table_size();
+
+  for (;;) {
+    // Grab next set of buckets to scan
+    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
+    if (start_idx >= limit) {
+      // End of table
+      break;
+    }
+
+    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
+    buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed);
+  }
+}
+
+void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
+  const int limit = the_table()->table_size();
+
+  assert(0 <= start_idx && start_idx <= limit,
+         err_msg("start_idx (%d) is out of bounds", start_idx));
+  assert(0 <= end_idx && end_idx <= limit,
+         err_msg("end_idx (%d) is out of bounds", end_idx));
+  assert(start_idx <= end_idx,
+         err_msg("Index ordering: start_idx=%d, end_idx=%d",
+                 start_idx, end_idx));
+
+  for (int i = start_idx; i < end_idx; i += 1) {
+    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
+    while (entry != NULL) {
+      assert(!entry->is_shared(), "CDS not used for the StringTable");
+
+      f->do_oop((oop*)entry->literal_addr());
+
+      entry = entry->next();
+    }
+  }
+}
+
+void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) {
+  const int limit = the_table()->table_size();
+
+  assert(0 <= start_idx && start_idx <= limit,
+         err_msg("start_idx (%d) is out of bounds", start_idx));
+  assert(0 <= end_idx && end_idx <= limit,
+         err_msg("end_idx (%d) is out of bounds", end_idx));
+  assert(start_idx <= end_idx,
+         err_msg("Index ordering: start_idx=%d, end_idx=%d",
+                 start_idx, end_idx));
+
+  for (int i = start_idx; i < end_idx; ++i) {
+    HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
+    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
+    while (entry != NULL) {
+      assert(!entry->is_shared(), "CDS not used for the StringTable");
+
+      if (is_alive->do_object_b(entry->literal())) {
+        if (f != NULL) {
+          f->do_oop((oop*)entry->literal_addr());
+        }
+        p = entry->next_addr();
+      } else {
+        *p = entry->next();
+        the_table()->free_entry(entry);
+        (*removed)++;
+      }
+      (*processed)++;
+      entry = *p;
+    }
+  }
+}
+
+void StringTable::oops_do(OopClosure* f) {
+  buckets_oops_do(f, 0, the_table()->table_size());
+}
+
+void StringTable::possibly_parallel_oops_do(OopClosure* f) {
+  const int limit = the_table()->table_size();
+
+  for (;;) {
+    // Grab next set of buckets to scan
+    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
+    if (start_idx >= limit) {
+      // End of table
+      break;
+    }
+
+    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
+    buckets_oops_do(f, start_idx, end_idx);
+  }
+}
+
+// This verification is part of Universe::verify() and needs to be quick.
+// See StringTable::verify_and_compare() below for exhaustive verification.
+void StringTable::verify() {
+  for (int i = 0; i < the_table()->table_size(); ++i) {
+    HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
+    for ( ; p != NULL; p = p->next()) {
+      oop s = p->literal();
+      guarantee(s != NULL, "interned string is NULL");
+      unsigned int h = java_lang_String::hash_string(s);
+      guarantee(p->hash() == h, "broken hash in string table entry");
+      guarantee(the_table()->hash_to_index(h) == i,
+                "wrong index in string table");
+    }
+  }
+}
+
+void StringTable::dump(outputStream* st) {
+  the_table()->dump_table(st, "StringTable");
+}
+
+StringTable::VerifyRetTypes StringTable::compare_entries(
+                                      int bkt1, int e_cnt1,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr1,
+                                      int bkt2, int e_cnt2,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr2) {
+  // These entries are sanity checked by verify_and_compare_entries()
+  // before this function is called.
+  oop str1 = e_ptr1->literal();
+  oop str2 = e_ptr2->literal();
+
+  if (str1 == str2) {
+    tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") "
+                  "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]",
+                  (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2);
+    return _verify_fail_continue;
+  }
+
+  if (java_lang_String::equals(str1, str2)) {
+    tty->print_cr("ERROR: identical String values in entry @ "
+                  "bucket[%d][%d] and entry @ bucket[%d][%d]",
+                  bkt1, e_cnt1, bkt2, e_cnt2);
+    return _verify_fail_continue;
+  }
+
+  return _verify_pass;
+}
+
+StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr,
+                                      StringTable::VerifyMesgModes mesg_mode) {
+
+  VerifyRetTypes ret = _verify_pass;  // be optimistic
+
+  oop str = e_ptr->literal();
+  if (str == NULL) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt,
+                    e_cnt);
+    }
+    // NULL oop means no more verifications are possible
+    return _verify_fail_done;
+  }
+
+  if (str->klass() != SystemDictionary::String_klass()) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]",
+                    bkt, e_cnt);
+    }
+    // not a String means no more verifications are possible
+    return _verify_fail_done;
+  }
+
+  unsigned int h = java_lang_String::hash_string(str);
+  if (e_ptr->hash() != h) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], "
+                    "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h);
+    }
+    ret = _verify_fail_continue;
+  }
+
+  if (the_table()->hash_to_index(h) != bkt) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], "
+                    "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h,
+                    the_table()->hash_to_index(h));
+    }
+    ret = _verify_fail_continue;
+  }
+
+  return ret;
+}
+
+// See StringTable::verify() above for the quick verification that is
+// part of Universe::verify(). This verification is exhaustive and
+// reports on every issue that is found. StringTable::verify() only
+// reports on the first issue that is found.
+//
+// StringTable::verify_entry() checks:
+// - oop value != NULL (same as verify())
+// - oop value is a String
+// - hash(String) == hash in entry (same as verify())
+// - index for hash == index of entry (same as verify())
+//
+// StringTable::compare_entries() checks:
+// - oops are unique across all entries
+// - String values are unique across all entries
+//
+int StringTable::verify_and_compare_entries() {
+  assert(StringTable_lock->is_locked(), "sanity check");
+
+  int  fail_cnt = 0;
+
+  // first, verify all the entries individually:
+  for (int bkt = 0; bkt < the_table()->table_size(); bkt++) {
+    HashtableEntry<oop, mtSymbol>* e_ptr = the_table()->bucket(bkt);
+    for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) {
+      VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs);
+      if (ret != _verify_pass) {
+        fail_cnt++;
+      }
+    }
+  }
+
+  // Optimization: if the above check did not find any failures, then
+  // the comparison loop below does not need to call verify_entry()
+  // before calling compare_entries(). If there were failures, then we
+  // have to call verify_entry() to see if the entry can be passed to
+  // compare_entries() safely. When we call verify_entry() in the loop
+  // below, we do so quietly to void duplicate messages and we don't
+  // increment fail_cnt because the failures have already been counted.
+  bool need_entry_verify = (fail_cnt != 0);
+
+  // second, verify all entries relative to each other:
+  for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) {
+    HashtableEntry<oop, mtSymbol>* e_ptr1 = the_table()->bucket(bkt1);
+    for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) {
+      if (need_entry_verify) {
+        VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1,
+                                          _verify_quietly);
+        if (ret == _verify_fail_done) {
+          // cannot use the current entry to compare against other entries
+          continue;
+        }
+      }
+
+      for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) {
+        HashtableEntry<oop, mtSymbol>* e_ptr2 = the_table()->bucket(bkt2);
+        int e_cnt2;
+        for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) {
+          if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) {
+            // skip the entries up to and including the one that
+            // we're comparing against
+            continue;
+          }
+
+          if (need_entry_verify) {
+            VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2,
+                                              _verify_quietly);
+            if (ret == _verify_fail_done) {
+              // cannot compare against this entry
+              continue;
+            }
+          }
+
+          // compare two entries, report and count any failures:
+          if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2)
+              != _verify_pass) {
+            fail_cnt++;
+          }
+        }
+      }
+    }
+  }
+  return fail_cnt;
+}
+
+// Create a new table and using alternate hash code, populate the new table
+// with the existing strings.   Set flag to use the alternate hash code afterwards.
+void StringTable::rehash_table() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+  // This should never happen with -Xshare:dump but it might in testing mode.
+  if (DumpSharedSpaces) return;
+  StringTable* new_table = new StringTable();
+
+  // Rehash the table
+  the_table()->move_to(new_table);
+
+  // Delete the table and buckets (entries are reused in new table).
+  delete _the_table;
+  // Don't check if we need rehashing until the table gets unbalanced again.
+  // Then rehash with a new global seed.
+  _needs_rehashing = false;
+  _the_table = new_table;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/stringTable.hpp	Thu May 22 14:38:34 2014 -0700
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_STRINGTABLE_HPP
+#define SHARE_VM_CLASSFILE_STRINGTABLE_HPP
+
+#include "memory/allocation.inline.hpp"
+#include "utilities/hashtable.hpp"
+
+class StringTable : public Hashtable<oop, mtSymbol> {
+  friend class VMStructs;
+  friend class Symbol;
+
+private:
+  // The string table
+  static StringTable* _the_table;
+
+  // Set if one bucket is out of balance due to hash algorithm deficiency
+  static bool _needs_rehashing;
+
+  // Claimed high water mark for parallel chunked scanning
+  static volatile int _parallel_claimed_idx;
+
+  static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
+  oop basic_add(int index, Handle string_or_null, jchar* name, int len,
+                unsigned int hashValue, TRAPS);
+
+  oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
+
+  // Apply the give oop closure to the entries to the buckets
+  // in the range [start_idx, end_idx).
+  static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
+  // Unlink or apply the give oop closure to the entries to the buckets
+  // in the range [start_idx, end_idx).
+  static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed);
+
+  StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize,
+                              sizeof (HashtableEntry<oop, mtSymbol>)) {}
+
+  StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
+    : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
+                     number_of_entries) {}
+public:
+  // The string table
+  static StringTable* the_table() { return _the_table; }
+
+  // Size of one bucket in the string table.  Used when checking for rollover.
+  static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
+
+  static void create_table() {
+    assert(_the_table == NULL, "One string table allowed.");
+    _the_table = new StringTable();
+  }
+
+  // GC support
+  //   Delete pointers to otherwise-unreachable objects.
+  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) {
+    int processed = 0;
+    int removed = 0;
+    unlink_or_oops_do(cl, f, &processed, &removed);
+  }
+  static void unlink(BoolObjectClosure* cl) {
+    int processed = 0;
+    int removed = 0;
+    unlink_or_oops_do(cl, NULL, &processed, &removed);
+  }
+  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
+  static void unlink(BoolObjectClosure* cl, int* processed, int* removed) {
+    unlink_or_oops_do(cl, NULL, processed, removed);
+  }
+  // Serially invoke "f->do_oop" on the locations of all oops in the table.
+  static void oops_do(OopClosure* f);
+
+  // Possibly parallel versions of the above
+  static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
+  static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) {
+    possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed);
+  }
+  static void possibly_parallel_oops_do(OopClosure* f);
+
+  // Hashing algorithm, used as the hash value used by the
+  //     StringTable for bucket selection and comparison (stored in the
+  //     HashtableEntry structures).  This is used in the String.intern() method.
+  static unsigned int hash_string(const jchar* s, int len);
+
+  // Internal test.
+  static void test_alt_hash() PRODUCT_RETURN;
+
+  // Probing
+  static oop lookup(Symbol* symbol);
+  static oop lookup(jchar* chars, int length);
+
+  // Interning
+  static oop intern(Symbol* symbol, TRAPS);
+  static oop intern(oop string, TRAPS);
+  static oop intern(const char *utf8_string, TRAPS);
+
+  // Debugging
+  static void verify();
+  static void dump(outputStream* st);
+
+  enum VerifyMesgModes {
+    _verify_quietly    = 0,
+    _verify_with_mesgs = 1
+  };
+
+  enum VerifyRetTypes {
+    _verify_pass          = 0,
+    _verify_fail_continue = 1,
+    _verify_fail_done     = 2
+  };
+
+  static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
+                                        HashtableEntry<oop, mtSymbol>* e_ptr1,
+                                        int bkt2, int e_cnt2,
+                                        HashtableEntry<oop, mtSymbol>* e_ptr2);
+  static VerifyRetTypes verify_entry(int bkt, int e_cnt,
+                                     HashtableEntry<oop, mtSymbol>* e_ptr,
+                                     VerifyMesgModes mesg_mode);
+  static int verify_and_compare_entries();
+
+  // Sharing
+  static void copy_buckets(char** top, char*end) {
+    the_table()->Hashtable<oop, mtSymbol>::copy_buckets(top, end);
+  }
+  static void copy_table(char** top, char*end) {
+    the_table()->Hashtable<oop, mtSymbol>::copy_table(top, end);
+  }
+  static void reverse() {
+    the_table()->Hashtable<oop, mtSymbol>::reverse();
+  }
+
+  // Rehash the symbol table if it gets out of balance
+  static void rehash_table();
+  static bool needs_rehashing() { return _needs_rehashing; }
+
+  // Parallel chunked scanning
+  static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; }
+  static int parallel_claimed_index() { return _parallel_claimed_idx; }
+};
+#endif // SHARE_VM_CLASSFILE_STRINGTABLE_HPP
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Thu May 22 14:38:34 2014 -0700
@@ -35,12 +35,10 @@
 #include "oops/oop.inline2.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/hashtable.inline.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/g1/g1StringDedup.hpp"
-#endif
+
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // --------------------------------------------------------------------------
-
 // the number of buckets a thread claims
 const int ClaimChunkSize = 32;
 
@@ -587,493 +585,3 @@
   }
 }
 #endif // PRODUCT
-
-// --------------------------------------------------------------------------
-
-#ifdef ASSERT
-class StableMemoryChecker : public StackObj {
-  enum { _bufsize = wordSize*4 };
-
-  address _region;
-  jint    _size;
-  u1      _save_buf[_bufsize];
-
-  int sample(u1* save_buf) {
-    if (_size <= _bufsize) {
-      memcpy(save_buf, _region, _size);
-      return _size;
-    } else {
-      // copy head and tail
-      memcpy(&save_buf[0],          _region,                      _bufsize/2);
-      memcpy(&save_buf[_bufsize/2], _region + _size - _bufsize/2, _bufsize/2);
-      return (_bufsize/2)*2;
-    }
-  }
-
- public:
-  StableMemoryChecker(const void* region, jint size) {
-    _region = (address) region;
-    _size   = size;
-    sample(_save_buf);
-  }
-
-  bool verify() {
-    u1 check_buf[sizeof(_save_buf)];
-    int check_size = sample(check_buf);
-    return (0 == memcmp(_save_buf, check_buf, check_size));
-  }
-
-  void set_region(const void* region) { _region = (address) region; }
-};
-#endif
-
-
-// --------------------------------------------------------------------------
-StringTable* StringTable::_the_table = NULL;
-
-bool StringTable::_needs_rehashing = false;
-
-volatile int StringTable::_parallel_claimed_idx = 0;
-
-// Pick hashing algorithm
-unsigned int StringTable::hash_string(const jchar* s, int len) {
-  return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) :
-                                    java_lang_String::hash_code(s, len);
-}
-
-oop StringTable::lookup(int index, jchar* name,
-                        int len, unsigned int hash) {
-  int count = 0;
-  for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
-    count++;
-    if (l->hash() == hash) {
-      if (java_lang_String::equals(l->literal(), name, len)) {
-        return l->literal();
-      }
-    }
-  }
-  // If the bucket size is too deep check if this hash code is insufficient.
-  if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
-    _needs_rehashing = check_rehash_table(count);
-  }
-  return NULL;
-}
-
-
-oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
-                           int len, unsigned int hashValue_arg, TRAPS) {
-
-  assert(java_lang_String::equals(string(), name, len),
-         "string must be properly initialized");
-  // Cannot hit a safepoint in this function because the "this" pointer can move.
-  No_Safepoint_Verifier nsv;
-
-  // Check if the symbol table has been rehashed, if so, need to recalculate
-  // the hash value and index before second lookup.
-  unsigned int hashValue;
-  int index;
-  if (use_alternate_hashcode()) {
-    hashValue = hash_string(name, len);
-    index = hash_to_index(hashValue);
-  } else {
-    hashValue = hashValue_arg;
-    index = index_arg;
-  }
-
-  // Since look-up was done lock-free, we need to check if another
-  // thread beat us in the race to insert the symbol.
-
-  oop test = lookup(index, name, len, hashValue); // calls lookup(u1*, int)
-  if (test != NULL) {
-    // Entry already added
-    return test;
-  }
-
-  HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
-  add_entry(index, entry);
-  return string();
-}
-
-
-oop StringTable::lookup(Symbol* symbol) {
-  ResourceMark rm;
-  int length;
-  jchar* chars = symbol->as_unicode(length);
-  return lookup(chars, length);
-}
-
-
-oop StringTable::lookup(jchar* name, int len) {
-  unsigned int hash = hash_string(name, len);
-  int index = the_table()->hash_to_index(hash);
-  return the_table()->lookup(index, name, len, hash);
-}
-
-
-oop StringTable::intern(Handle string_or_null, jchar* name,
-                        int len, TRAPS) {
-  unsigned int hashValue = hash_string(name, len);
-  int index = the_table()->hash_to_index(hashValue);
-  oop found_string = the_table()->lookup(index, name, len, hashValue);
-
-  // Found
-  if (found_string != NULL) return found_string;
-
-  debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
-  assert(!Universe::heap()->is_in_reserved(name),
-         "proposed name of symbol must be stable");
-
-  Handle string;
-  // try to reuse the string if possible
-  if (!string_or_null.is_null()) {
-    string = string_or_null;
-  } else {
-    string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
-  }
-
-#if INCLUDE_ALL_GCS
-  if (G1StringDedup::is_enabled()) {
-    // Deduplicate the string before it is interned. Note that we should never
-    // deduplicate a string after it has been interned. Doing so will counteract
-    // compiler optimizations done on e.g. interned string literals.
-    G1StringDedup::deduplicate(string());
-  }
-#endif
-
-  // Grab the StringTable_lock before getting the_table() because it could
-  // change at safepoint.
-  MutexLocker ml(StringTable_lock, THREAD);
-
-  // Otherwise, add to symbol to table
-  return the_table()->basic_add(index, string, name, len,
-                                hashValue, CHECK_NULL);
-}
-
-oop StringTable::intern(Symbol* symbol, TRAPS) {
-  if (symbol == NULL) return NULL;
-  ResourceMark rm(THREAD);
-  int length;
-  jchar* chars = symbol->as_unicode(length);
-  Handle string;
-  oop result = intern(string, chars, length, CHECK_NULL);
-  return result;
-}
-
-
-oop StringTable::intern(oop string, TRAPS)
-{
-  if (string == NULL) return NULL;
-  ResourceMark rm(THREAD);
-  int length;
-  Handle h_string (THREAD, string);
-  jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL);
-  oop result = intern(h_string, chars, length, CHECK_NULL);
-  return result;
-}
-
-
-oop StringTable::intern(const char* utf8_string, TRAPS) {
-  if (utf8_string == NULL) return NULL;
-  ResourceMark rm(THREAD);
-  int length = UTF8::unicode_length(utf8_string);
-  jchar* chars = NEW_RESOURCE_ARRAY(jchar, length);
-  UTF8::convert_to_unicode(utf8_string, chars, length);
-  Handle string;
-  oop result = intern(string, chars, length, CHECK_NULL);
-  return result;
-}
-
-void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
-  buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), processed, removed);
-}
-
-void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
-  // Readers of the table are unlocked, so we should only be removing
-  // entries at a safepoint.
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  const int limit = the_table()->table_size();
-
-  for (;;) {
-    // Grab next set of buckets to scan
-    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
-    if (start_idx >= limit) {
-      // End of table
-      break;
-    }
-
-    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
-    buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed);
-  }
-}
-
-void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
-  const int limit = the_table()->table_size();
-
-  assert(0 <= start_idx && start_idx <= limit,
-         err_msg("start_idx (%d) is out of bounds", start_idx));
-  assert(0 <= end_idx && end_idx <= limit,
-         err_msg("end_idx (%d) is out of bounds", end_idx));
-  assert(start_idx <= end_idx,
-         err_msg("Index ordering: start_idx=%d, end_idx=%d",
-                 start_idx, end_idx));
-
-  for (int i = start_idx; i < end_idx; i += 1) {
-    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
-    while (entry != NULL) {
-      assert(!entry->is_shared(), "CDS not used for the StringTable");
-
-      f->do_oop((oop*)entry->literal_addr());
-
-      entry = entry->next();
-    }
-  }
-}
-
-void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) {
-  const int limit = the_table()->table_size();
-
-  assert(0 <= start_idx && start_idx <= limit,
-         err_msg("start_idx (%d) is out of bounds", start_idx));
-  assert(0 <= end_idx && end_idx <= limit,
-         err_msg("end_idx (%d) is out of bounds", end_idx));
-  assert(start_idx <= end_idx,
-         err_msg("Index ordering: start_idx=%d, end_idx=%d",
-                 start_idx, end_idx));
-
-  for (int i = start_idx; i < end_idx; ++i) {
-    HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
-    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
-    while (entry != NULL) {
-      assert(!entry->is_shared(), "CDS not used for the StringTable");
-
-      if (is_alive->do_object_b(entry->literal())) {
-        if (f != NULL) {
-          f->do_oop((oop*)entry->literal_addr());
-        }
-        p = entry->next_addr();
-      } else {
-        *p = entry->next();
-        the_table()->free_entry(entry);
-        (*removed)++;
-      }
-      (*processed)++;
-      entry = *p;
-    }
-  }
-}
-
-void StringTable::oops_do(OopClosure* f) {
-  buckets_oops_do(f, 0, the_table()->table_size());
-}
-
-void StringTable::possibly_parallel_oops_do(OopClosure* f) {
-  const int limit = the_table()->table_size();
-
-  for (;;) {
-    // Grab next set of buckets to scan
-    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
-    if (start_idx >= limit) {
-      // End of table
-      break;
-    }
-
-    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
-    buckets_oops_do(f, start_idx, end_idx);
-  }
-}
-
-// This verification is part of Universe::verify() and needs to be quick.
-// See StringTable::verify_and_compare() below for exhaustive verification.
-void StringTable::verify() {
-  for (int i = 0; i < the_table()->table_size(); ++i) {
-    HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
-    for ( ; p != NULL; p = p->next()) {
-      oop s = p->literal();
-      guarantee(s != NULL, "interned string is NULL");
-      unsigned int h = java_lang_String::hash_string(s);
-      guarantee(p->hash() == h, "broken hash in string table entry");
-      guarantee(the_table()->hash_to_index(h) == i,
-                "wrong index in string table");
-    }
-  }
-}
-
-void StringTable::dump(outputStream* st) {
-  the_table()->dump_table(st, "StringTable");
-}
-
-StringTable::VerifyRetTypes StringTable::compare_entries(
-                                      int bkt1, int e_cnt1,
-                                      HashtableEntry<oop, mtSymbol>* e_ptr1,
-                                      int bkt2, int e_cnt2,
-                                      HashtableEntry<oop, mtSymbol>* e_ptr2) {
-  // These entries are sanity checked by verify_and_compare_entries()
-  // before this function is called.
-  oop str1 = e_ptr1->literal();
-  oop str2 = e_ptr2->literal();
-
-  if (str1 == str2) {
-    tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") "
-                  "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]",
-                  (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2);
-    return _verify_fail_continue;
-  }
-
-  if (java_lang_String::equals(str1, str2)) {
-    tty->print_cr("ERROR: identical String values in entry @ "
-                  "bucket[%d][%d] and entry @ bucket[%d][%d]",
-                  bkt1, e_cnt1, bkt2, e_cnt2);
-    return _verify_fail_continue;
-  }
-
-  return _verify_pass;
-}
-
-StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt,
-                                      HashtableEntry<oop, mtSymbol>* e_ptr,
-                                      StringTable::VerifyMesgModes mesg_mode) {
-
-  VerifyRetTypes ret = _verify_pass;  // be optimistic
-
-  oop str = e_ptr->literal();
-  if (str == NULL) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt,
-                    e_cnt);
-    }
-    // NULL oop means no more verifications are possible
-    return _verify_fail_done;
-  }
-
-  if (str->klass() != SystemDictionary::String_klass()) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]",
-                    bkt, e_cnt);
-    }
-    // not a String means no more verifications are possible
-    return _verify_fail_done;
-  }
-
-  unsigned int h = java_lang_String::hash_string(str);
-  if (e_ptr->hash() != h) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], "
-                    "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h);
-    }
-    ret = _verify_fail_continue;
-  }
-
-  if (the_table()->hash_to_index(h) != bkt) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], "
-                    "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h,
-                    the_table()->hash_to_index(h));
-    }
-    ret = _verify_fail_continue;
-  }
-
-  return ret;
-}
-
-// See StringTable::verify() above for the quick verification that is
-// part of Universe::verify(). This verification is exhaustive and
-// reports on every issue that is found. StringTable::verify() only
-// reports on the first issue that is found.
-//
-// StringTable::verify_entry() checks:
-// - oop value != NULL (same as verify())
-// - oop value is a String
-// - hash(String) == hash in entry (same as verify())
-// - index for hash == index of entry (same as verify())
-//
-// StringTable::compare_entries() checks:
-// - oops are unique across all entries
-// - String values are unique across all entries
-//
-int StringTable::verify_and_compare_entries() {
-  assert(StringTable_lock->is_locked(), "sanity check");
-
-  int  fail_cnt = 0;
-
-  // first, verify all the entries individually:
-  for (int bkt = 0; bkt < the_table()->table_size(); bkt++) {
-    HashtableEntry<oop, mtSymbol>* e_ptr = the_table()->bucket(bkt);
-    for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) {
-      VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs);
-      if (ret != _verify_pass) {
-        fail_cnt++;
-      }
-    }
-  }
-
-  // Optimization: if the above check did not find any failures, then
-  // the comparison loop below does not need to call verify_entry()
-  // before calling compare_entries(). If there were failures, then we
-  // have to call verify_entry() to see if the entry can be passed to
-  // compare_entries() safely. When we call verify_entry() in the loop
-  // below, we do so quietly to void duplicate messages and we don't
-  // increment fail_cnt because the failures have already been counted.
-  bool need_entry_verify = (fail_cnt != 0);
-
-  // second, verify all entries relative to each other:
-  for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) {
-    HashtableEntry<oop, mtSymbol>* e_ptr1 = the_table()->bucket(bkt1);
-    for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) {
-      if (need_entry_verify) {
-        VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1,
-                                          _verify_quietly);
-        if (ret == _verify_fail_done) {
-          // cannot use the current entry to compare against other entries
-          continue;
-        }
-      }
-
-      for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) {
-        HashtableEntry<oop, mtSymbol>* e_ptr2 = the_table()->bucket(bkt2);
-        int e_cnt2;
-        for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) {
-          if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) {
-            // skip the entries up to and including the one that
-            // we're comparing against
-            continue;
-          }
-
-          if (need_entry_verify) {
-            VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2,
-                                              _verify_quietly);
-            if (ret == _verify_fail_done) {
-              // cannot compare against this entry
-              continue;
-            }
-          }
-
-          // compare two entries, report and count any failures:
-          if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2)
-              != _verify_pass) {
-            fail_cnt++;
-          }
-        }
-      }
-    }
-  }
-  return fail_cnt;
-}
-
-// Create a new table and using alternate hash code, populate the new table
-// with the existing strings.   Set flag to use the alternate hash code afterwards.
-void StringTable::rehash_table() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  // This should never happen with -Xshare:dump but it might in testing mode.
-  if (DumpSharedSpaces) return;
-  StringTable* new_table = new StringTable();
-
-  // Rehash the table
-  the_table()->move_to(new_table);
-
-  // Delete the table and buckets (entries are reused in new table).
-  delete _the_table;
-  // Don't check if we need rehashing until the table gets unbalanced again.
-  // Then rehash with a new global seed.
-  _needs_rehashing = false;
-  _the_table = new_table;
-}
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp	Thu May 22 14:38:34 2014 -0700
@@ -42,7 +42,6 @@
 class BoolObjectClosure;
 class outputStream;
 
-
 // Class to hold a newly created or referenced Symbol* temporarily in scope.
 // new_symbol() and lookup() will create a Symbol* if not already in the
 // symbol table and add to the symbol's reference count.
@@ -252,134 +251,4 @@
   static int parallel_claimed_index()        { return _parallel_claimed_idx; }
 };
 
-class StringTable : public Hashtable<oop, mtSymbol> {
-  friend class VMStructs;
-
-private:
-  // The string table
-  static StringTable* _the_table;
-
-  // Set if one bucket is out of balance due to hash algorithm deficiency
-  static bool _needs_rehashing;
-
-  // Claimed high water mark for parallel chunked scanning
-  static volatile int _parallel_claimed_idx;
-
-  static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
-  oop basic_add(int index, Handle string_or_null, jchar* name, int len,
-                unsigned int hashValue, TRAPS);
-
-  oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
-
-  // Apply the give oop closure to the entries to the buckets
-  // in the range [start_idx, end_idx).
-  static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
-  // Unlink or apply the give oop closure to the entries to the buckets
-  // in the range [start_idx, end_idx).
-  static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed);
-
-  StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize,
-                              sizeof (HashtableEntry<oop, mtSymbol>)) {}
-
-  StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
-    : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
-                     number_of_entries) {}
-public:
-  // The string table
-  static StringTable* the_table() { return _the_table; }
-
-  // Size of one bucket in the string table.  Used when checking for rollover.
-  static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
-
-  static void create_table() {
-    assert(_the_table == NULL, "One string table allowed.");
-    _the_table = new StringTable();
-  }
-
-  // GC support
-  //   Delete pointers to otherwise-unreachable objects.
-  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) {
-    int processed = 0;
-    int removed = 0;
-    unlink_or_oops_do(cl, f, &processed, &removed);
-  }
-  static void unlink(BoolObjectClosure* cl) {
-    int processed = 0;
-    int removed = 0;
-    unlink_or_oops_do(cl, NULL, &processed, &removed);
-  }
-  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
-  static void unlink(BoolObjectClosure* cl, int* processed, int* removed) {
-    unlink_or_oops_do(cl, NULL, processed, removed);
-  }
-  // Serially invoke "f->do_oop" on the locations of all oops in the table.
-  static void oops_do(OopClosure* f);
-
-  // Possibly parallel versions of the above
-  static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
-  static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) {
-    possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed);
-  }
-  static void possibly_parallel_oops_do(OopClosure* f);
-
-  // Hashing algorithm, used as the hash value used by the
-  //     StringTable for bucket selection and comparison (stored in the
-  //     HashtableEntry structures).  This is used in the String.intern() method.
-  static unsigned int hash_string(const jchar* s, int len);
-
-  // Internal test.
-  static void test_alt_hash() PRODUCT_RETURN;
-
-  // Probing
-  static oop lookup(Symbol* symbol);
-  static oop lookup(jchar* chars, int length);
-
-  // Interning
-  static oop intern(Symbol* symbol, TRAPS);
-  static oop intern(oop string, TRAPS);
-  static oop intern(const char *utf8_string, TRAPS);
-
-  // Debugging
-  static void verify();
-  static void dump(outputStream* st);
-
-  enum VerifyMesgModes {
-    _verify_quietly    = 0,
-    _verify_with_mesgs = 1
-  };
-
-  enum VerifyRetTypes {
-    _verify_pass          = 0,
-    _verify_fail_continue = 1,
-    _verify_fail_done     = 2
-  };
-
-  static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
-                                        HashtableEntry<oop, mtSymbol>* e_ptr1,
-                                        int bkt2, int e_cnt2,
-                                        HashtableEntry<oop, mtSymbol>* e_ptr2);
-  static VerifyRetTypes verify_entry(int bkt, int e_cnt,
-                                     HashtableEntry<oop, mtSymbol>* e_ptr,
-                                     VerifyMesgModes mesg_mode);
-  static int verify_and_compare_entries();
-
-  // Sharing
-  static void copy_buckets(char** top, char*end) {
-    the_table()->Hashtable<oop, mtSymbol>::copy_buckets(top, end);
-  }
-  static void copy_table(char** top, char*end) {
-    the_table()->Hashtable<oop, mtSymbol>::copy_table(top, end);
-  }
-  static void reverse() {
-    the_table()->Hashtable<oop, mtSymbol>::reverse();
-  }
-
-  // Rehash the symbol table if it gets out of balance
-  static void rehash_table();
-  static bool needs_rehashing() { return _needs_rehashing; }
-
-  // Parallel chunked scanning
-  static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; }
-  static int parallel_claimed_index() { return _parallel_claimed_idx; }
-};
 #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu May 22 14:38:34 2014 -0700
@@ -29,6 +29,7 @@
 #include "classfile/loaderConstraints.hpp"
 #include "classfile/placeholders.hpp"
 #include "classfile/resolutionErrors.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "compiler/compileBroker.hpp"
@@ -2269,7 +2270,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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Thu May 22 14:38:34 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,
@@ -178,10 +178,12 @@
   // cache will contain a garbage CodeBlob until the caller can
   // run the constructor for the CodeBlob subclass he is busy
   // instantiating.
-  guarantee(size >= 0, "allocation request must be reasonable");
   assert_locked_or_safepoint(CodeCache_lock);
+  assert(size > 0, "allocation request must be reasonable");
+  if (size <= 0) {
+    return NULL;
+  }
   CodeBlob* cb = NULL;
-  _number_of_blobs++;
   while (true) {
     cb = (CodeBlob*)_heap->allocate(size, is_critical);
     if (cb != NULL) break;
@@ -191,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());
     }
@@ -199,6 +201,7 @@
   maxCodeCacheUsed = MAX2(maxCodeCacheUsed, ((address)_heap->high_boundary() -
                           (address)_heap->low_boundary()) - unallocated_capacity());
   print_trace("allocation", cb, size);
+  _number_of_blobs++;
   return cb;
 }
 
@@ -487,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");
@@ -741,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
 }
 
 //------------------------------------------------------------------------------------------------
@@ -756,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);
   }
 }
 
@@ -926,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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/compiledIC.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/compressedStream.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/debugInfo.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/icBuffer.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/pcDesc.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/relocInfo.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/scopeDesc.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/code/vtableStubs.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu May 22 14:38:34 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) {
@@ -704,13 +704,39 @@
     return NULL;
   }
 
-  CompileTask* task = CompilationPolicy::policy()->select_task(this);
+  CompileTask* task;
+  {
+    No_Safepoint_Verifier nsv;
+    task = CompilationPolicy::policy()->select_task(this);
+  }
   remove(task);
+  purge_stale_tasks(); // may temporarily release MCQ lock
   return task;
 }
 
-void CompileQueue::remove(CompileTask* task)
-{
+// Clean & deallocate stale compile tasks.
+// Temporarily releases MethodCompileQueue lock.
+void CompileQueue::purge_stale_tasks() {
+  assert(lock()->owned_by_self(), "must own lock");
+  if (_first_stale != NULL) {
+    // Stale tasks are purged when MCQ lock is released,
+    // but _first_stale updates are protected by MCQ lock.
+    // Once task processing starts and MCQ lock is released,
+    // other compiler threads can reuse _first_stale.
+    CompileTask* head = _first_stale;
+    _first_stale = NULL;
+    {
+      MutexUnlocker ul(lock());
+      for (CompileTask* task = head; task != NULL; ) {
+        CompileTask* next_task = task->next();
+        CompileTaskWrapper ctw(task); // Frees the task
+        task = next_task;
+      }
+    }
+  }
+}
+
+void CompileQueue::remove(CompileTask* task) {
    assert(lock()->owned_by_self(), "must own lock");
   if (task->prev() != NULL) {
     task->prev()->set_next(task->next());
@@ -730,6 +756,16 @@
   --_size;
 }
 
+void CompileQueue::remove_and_mark_stale(CompileTask* task) {
+  assert(lock()->owned_by_self(), "must own lock");
+  remove(task);
+
+  // Enqueue the task for reclamation (should be done outside MCQ lock)
+  task->set_next(_first_stale);
+  task->set_prev(NULL);
+  _first_stale = task;
+}
+
 // methods in the compile queue need to be marked as used on the stack
 // so that they don't get reclaimed by Redefine Classes
 void CompileQueue::mark_on_stack() {
@@ -1786,7 +1822,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 +1853,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 +1870,7 @@
     CodeCache::print_summary(&s, detailed);
   }
   ttyLocker ttyl;
-  tty->print(s.as_string());
+  tty->print("%s", s.as_string());
 }
 
 // ------------------------------------------------------------------
@@ -2006,7 +2042,7 @@
 
   // Note that the queued_for_compilation bits are cleared without
   // protection of a mutex. [They were set by the requester thread,
-  // when adding the task to the complie queue -- at which time the
+  // when adding the task to the compile queue -- at which time the
   // compile queue lock was held. Subsequently, we acquired the compile
   // queue lock to get this task off the compile queue; thus (to belabour
   // the point somewhat) our clearing of the bits must be occurring
@@ -2039,7 +2075,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/compileBroker.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp	Thu May 22 14:38:34 2014 -0700
@@ -196,7 +196,11 @@
   CompileTask* _first;
   CompileTask* _last;
 
+  CompileTask* _first_stale;
+
   int _size;
+
+  void purge_stale_tasks();
  public:
   CompileQueue(const char* name, Monitor* lock) {
     _name = name;
@@ -204,6 +208,7 @@
     _first = NULL;
     _last = NULL;
     _size = 0;
+    _first_stale = NULL;
   }
 
   const char*  name() const                      { return _name; }
@@ -211,6 +216,7 @@
 
   void         add(CompileTask* task);
   void         remove(CompileTask* task);
+  void         remove_and_mark_stale(CompileTask* task);
   CompileTask* first()                           { return _first; }
   CompileTask* last()                            { return _last;  }
 
@@ -219,6 +225,7 @@
   bool         is_empty() const                  { return _first == NULL; }
   int          size()     const                  { return _size;          }
 
+
   // Redefine Classes support
   void mark_on_stack();
   void free_all();
--- a/hotspot/src/share/vm/compiler/compileLog.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileLog.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/compiler/oopMap.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp	Thu May 22 14:38:34 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,7 +157,7 @@
                  " split_deaths(" SIZE_FORMAT ")"
                  " coal_deaths(" SIZE_FORMAT ")"
                  " + count(" SSIZE_FORMAT ")",
-                 this, size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
+                 p2i(this), size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
                  _allocation_stats.coal_births(), _allocation_stats.split_deaths(),
                  _allocation_stats.coal_deaths(), count()));
 }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu May 22 14:38:34 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
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/classLoaderData.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
@@ -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());
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu May 22 14:38:34 2014 -0700
@@ -22,7 +22,13 @@
  *
  */
 
+#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 "classfile/stringTable.hpp"
 #include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
 #include "gc_implementation/g1/bufferingOopClosure.hpp"
@@ -370,7 +376,7 @@
     }
   }
 
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 }
 
 void G1CollectedHeap::push_dirty_cards_region(HeapRegion* hr)
@@ -3470,7 +3476,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 +3670,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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Thu May 22 14:38:34 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/parMarkBitMap.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Thu May 22 14:38:34 2014 -0700
@@ -1,5 +1,6 @@
+
 /*
- * 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
@@ -23,7 +24,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
@@ -54,6 +55,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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Thu May 22 14:38:34 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
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Thu May 22 14:38:34 2014 -0700
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -23,7 +24,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
@@ -56,6 +57,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 +835,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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/libadt/dict.cpp	Thu May 22 14:38:34 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
@@ -24,29 +24,19 @@
 
 #include "precompiled.hpp"
 #include "libadt/dict.hpp"
-#include "memory/allocation.inline.hpp"
-#include "memory/resourceArea.hpp"
-#include "runtime/thread.hpp"
 
 // Dictionaries - An Abstract Data Type
 
 // %%%%% includes not needed with AVM framework - Ungar
 
-// #include "port.hpp"
-//IMPLEMENTATION
-// #include "dict.hpp"
-
 #include <assert.h>
 
-// The iostream is not needed and it gets confused for gcc by the
-// define of bool.
-//
-// #include <iostream.h>
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 //------------------------------data-----------------------------------------
 // String hash tables
 #define MAXID 20
-static byte initflag = 0;       // True after 1st initialization
+static uint8_t initflag = 0;       // True after 1st initialization
 static const char shft[MAXID] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6};
 static short xsum[MAXID];
 
@@ -281,7 +271,7 @@
 // CmpDict compares two dictionaries; they must have the same keys (their
 // keys must match using CmpKey) and they must have the same values (pointer
 // comparison).  If so 1 is returned, if not 0 is returned.
-int32 Dict::operator ==(const Dict &d2) const {
+int32_t Dict::operator ==(const Dict &d2) const {
   if( _cnt != d2._cnt ) return 0;
   if( _hash != d2._hash ) return 0;
   if( _cmp != d2._cmp ) return 0;
@@ -318,7 +308,7 @@
 // C text shows excellent spreading of values for any size hash table.
 int hashstr(const void *t) {
   register char c, k = 0;
-  register int32 sum = 0;
+  register int32_t sum = 0;
   register const char *s = (const char *)t;
 
   while( ((c = *s++) != '\0') && (k < MAXID-1) ) { // Get characters till null or MAXID-1
@@ -332,11 +322,7 @@
 // Slimey cheap hash function; no guaranteed performance.  Better than the
 // default for pointers, especially on MS-DOS machines.
 int hashptr(const void *key) {
-#ifdef __TURBOC__
-    return ((intptr_t)key >> 16);
-#else  // __TURBOC__
-    return ((intptr_t)key >> 2);
-#endif
+  return ((intptr_t)key >> 2);
 }
 
 // Slimey cheap hash function; no guaranteed performance.
@@ -345,12 +331,12 @@
 }
 
 //------------------------------Key Comparator Functions---------------------
-int32 cmpstr(const void *k1, const void *k2) {
+int32_t cmpstr(const void *k1, const void *k2) {
   return strcmp((const char *)k1,(const char *)k2);
 }
 
 // Cheap key comparator.
-int32 cmpkey(const void *key1, const void *key2) {
+int32_t cmpkey(const void *key1, const void *key2) {
   if (key1 == key2) return 0;
   intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
   if (delta > 0) return 1;
--- a/hotspot/src/share/vm/libadt/dict.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/libadt/dict.hpp	Thu May 22 14:38:34 2014 -0700
@@ -25,11 +25,12 @@
 #ifndef SHARE_VM_LIBADT_DICT_HPP
 #define SHARE_VM_LIBADT_DICT_HPP
 
-#include "libadt/port.hpp"
+// Dictionaries - An Abstract Data Type
 
-// Dictionaries - An Abstract Data Type
-//INTERFACE
-class ostream;
+#include "memory/allocation.inline.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/thread.hpp"
+
 class Dict;
 
 // These dictionaries define a key-value mapping.  They can be inserted to,
@@ -38,7 +39,7 @@
 // key comparison routine determines if two keys are equal or not.  A hash
 // function can be provided; if it's not provided the key itself is used
 // instead.  A nice string hash function is included.
-typedef int32 (*CmpKey)(const void *key1, const void *key2);
+typedef int32_t (*CmpKey)(const void *key1, const void *key2);
 typedef int  (*Hash)(const void *key);
 typedef void (*FuncDict)(const void *key, const void *val, Dict *d);
 
@@ -47,7 +48,7 @@
   class Arena *_arena;          // Where to draw storage from
   class bucket *_bin;           // Hash table is array of buckets
   uint _size;                   // Size (# of slots) in hash table
-  uint32 _cnt;                  // Number of key-value pairs in hash table
+  uint32_t _cnt;                // Number of key-value pairs in hash table
   const Hash _hash;             // Hashing function
   const CmpKey _cmp;            // Key comparison function
   void doubhash( void );        // Double hash table size
@@ -67,7 +68,7 @@
   void Clear();
 
   // Return # of key-value pairs in dict
-  uint32 Size(void) const { return _cnt; }
+  uint32_t Size(void) const { return _cnt; }
 
   // Insert inserts the given key-value pair into the dictionary.  The prior
   // value of the key is returned; NULL if the key was not previously defined.
@@ -81,7 +82,7 @@
   // == compares two dictionaries; they must have the same keys (their keys
   // must match using CmpKey) and they must have the same values (pointer
   // comparison).  If so 1 is returned, if not 0 is returned.
-  int32 operator ==(const Dict &d) const;   // Compare dictionaries for equal
+  int32_t operator ==(const Dict &d) const;   // Compare dictionaries for equal
 
   // Print out the dictionary contents as key-value pairs
   void print();
@@ -96,9 +97,9 @@
 int hashkey(const void *key);
 
 // Key comparators
-int32 cmpstr(const void *k1, const void *k2);
+int32_t cmpstr(const void *k1, const void *k2);
 // Slimey cheap key comparator.
-int32 cmpkey(const void *key1, const void *key2);
+int32_t cmpkey(const void *key1, const void *key2);
 
 //------------------------------Iteration--------------------------------------
 // The class of dictionary iterators.  Fails in the presences of modifications
--- a/hotspot/src/share/vm/libadt/port.cpp	Thu May 22 12:53:50 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "libadt/port.hpp"
-
-// Code for portable compiling
-
-#ifdef __GNUC__
-#pragma implementation
-#endif
-
-// %%%%% includes not needed with AVM framework - Ungar
-// #include "port.hpp"
-
-// This is only used if turboc is used and it causes problems with
-// gcc.
-#ifdef __TURBOC__
-#include <iostream.h>
-#endif
-
-#include <stdio.h>
-
-//------------------------------gcd--------------------------------------------
-// Greatest common divisor
-uint32 gcd( register uint32 x, register uint32 y )
-{
-  register uint32 tmp;
-  while( x ) {                  // While not zero
-    tmp = x;                    // Hold onto smaller x value
-    x = y % x;                  // Compute modulus; since y>=x, 0 <= mod < x
-    y = tmp;                    // y = old x
-  }
-  return y;
-}
-
-//-----------------------------------------------------------------------------
-// Find first 1, or return 32 if empty
-int ff1( uint32 mask )
-{
-  unsigned i, n = 0;
-
-  for( i=1, n=0; i; i<<=1, n++)
-    if( mask&i ) return n;
-  return 32;
-}
-
-//-----------------------------------------------------------------------------
-// Find highest 1, or return 32 if empty
-int fh1( uint32 mask )
-{
-  unsigned i, n = 0;
-
-  for( i=((uint32)1<<31), n=31; i; i>>=1, n--)
-    if( mask&i ) return n;
-  return 32;
-}
-
-//------------------------------rotate32---------------------------------------
-// Rotate 32bits.  Postive rotates left (bits move toward high-order bit),
-// negative rotates right.
-uint32 rotate32( register uint32 x, register int32 cnt )
-{
-  if( cnt >= 0 ) {              // Positive rotates left
-    cnt &= 31;                  // Mask off extra shift bits
-  } else {                      // Negative rotates right
-    cnt = (-cnt)&31;            // Flip sign; mask extra shift bits
-    cnt = 32-cnt;               // Rotate right by big left rotation
-  }
-  return (x << cnt) | (x >> (32-cnt));
-}
-
-/* Disabled - we have another log2 in the system.
-   This function doesn't work if used as substitute
-   for the existing log2. Keep around until we have
-   verified all uses of log2 do the correct thing!
-//------------------------------log2-------------------------------------------
-// Log base 2.  Might also be called 'count leading zeros'.  Log2(x) returns
-// an l such that (1L<<l) <= x < (2L<<l).  log2(x) returns 32.
-uint log2( uint32 x )
-{
-  register uint l = 32;         // Log bits
-  register int32 sx = x;        // Treat as signed number
-  while( sx >= 0 )              // While high bit is clear
-    sx <<= 1, l--;              // Shift bits left, count down log2
-  return l;
-}
-*/
-
-//------------------------------print------------------------------------------
-// Print a pointer without modifying the contents
-#ifdef __TURBOC__
-ostream &ostream::operator << (const void *ptr)
-{
-  return (*this) << "0x" << hex << (uint)ptr << dec;
-}
-#else
-/*ostream &operator << (ostream &os, const void *ptr)
-{
-  return os << "0x" << hex << (uint)ptr << dec;
-}*/
-#endif
--- a/hotspot/src/share/vm/libadt/port.hpp	Thu May 22 12:53:50 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_LIBADT_PORT_HPP
-#define SHARE_VM_LIBADT_PORT_HPP
-
-#include "utilities/top.hpp"
-
-// Typedefs for portable compiling
-
-#if defined(__GNUC__)
-
-#define INTERFACE       #pragma interface
-#define IMPLEMENTATION  #pragma implementation
-//INTERFACE
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-// Access to the C++ class virtual function pointer
-// Put the class in the macro
-typedef void *VPTR;
-// G++ puts it at the end of the base class
-#define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)((char*)this+sizeof(class)-sizeof(void*));}
-
-#elif defined(__TURBOC__)
-
-#include <mem.h>
-#include <string.h>
-extern "C" int stricmp(const char *, const char *);
-inline void bcopy(const void *s, void *d, int l) { memmove(d,s,l); }
-inline void bzero(void *p, int l) { memset(p,0,l); }
-inline int bcmp(const void *s, const void *d, int l) { return memcmp(s,d,l); }
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-//strcasecmp moved to globalDefinitions_visCPP.hpp
-//inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); }
-inline long abs( long x ) { return x < 0 ? -x : x; }
-// Access to the C++ class virtual function pointer
-// Put the class in the macro
-typedef void near *VPTR;
-// BorlandC puts it up front
-#define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)this;}
-
-#elif defined(__hpux)
-
-#define INTERFACE
-#define IMPLEMENTATION
-#define signed
-#include <strings.h>
-#include <stdlib.h>
-inline long min( long a, long b) { return a < b ? a : b; }
-inline long max( long a, long b) { return a > b ? a : b; }
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-inline long abs( long x ) { return x < 0 ? -x : x; }
-
-#elif defined(__MOTO__)
-// Motorola's mcc
-#define INTERFACE
-#define IMPLEMENTATION
-#include <stdlib.h>
-#include <memory.h>
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-
-#elif defined(_AIX)
-// IBM's xlC compiler
-#define INTERFACE
-#define IMPLEMENTATION
-#include <stdlib.h>
-#include <memory.h>
-
-#elif defined(_MSC_VER)
-// Microsoft Visual C++
-//#define INTERFACE
-#define IMPLEMENTATION
-#include <stdlib.h>
-#undef small
-//strcasecmp moved to globalDefinitions_visCPP.hpp
-//inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); }
-
-
-#elif defined(SPARC_WORKS)
-
-#define INTERFACE
-#define IMPLEMENTATION
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#elif defined(SOLARIS)
-
-#define INTERFACE
-#define IMPLEMENTATION
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-#elif defined(__TANDEM)
-
-// This case is for the Tandem Business Unit of Compaq Computer Corporation.
-// The Tandem case must precede the AT&T case,
-// because the Tandem c89 compiler also defines __cplusplus.
-
-#include "port_tandem.hpp"
-
-#elif defined(__cplusplus)
-// AT&Ts cfront
-#define INTERFACE
-#define IMPLEMENTATION
-#include <unistd.h>
-#define signed
-// #include <bstring.h>
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-
-#else  // All other machines
-
-#define signed
-extern "C" void bcopy(void *b1, void *b2, int len);
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-
-#endif
-
-//-----------------------------------------------------------------------------
-// Safer memory allocations
-#ifdef SAFE_MEMORY
-#define malloc(size)        safe_malloc(__FILE__,__LINE__,size)
-#define free(ptr)           safe_free(__FILE__,__LINE__,ptr)
-#define realloc(ptr,size)   safe_realloc(__FILE__,__LINE__,ptr,size)
-#define calloc(nitems,size) safe_calloc(__FILE__,__LINE__,nitems,size)
-#define strdup(ptr)         safe_strdup(__FILE__,__LINE__,ptr)
-extern void *safe_malloc (const char *file, unsigned line, unsigned size);
-extern void  safe_free   (const char *file, unsigned line, void *ptr);
-extern void *safe_calloc (const char *file, unsigned line, unsigned nitems, unsigned size);
-extern void *safe_realloc(const char *file, unsigned line, void *ptr, unsigned size);
-extern char *safe_strdup (const char *file, unsigned line, const char *src);
-inline void *operator new( size_t size ) throw() { return malloc(size); }
-inline void operator delete( void *ptr )         { free(ptr); }
-#endif
-
-//-----------------------------------------------------------------------------
-// And now, the bit-size-specified integer sizes
-typedef signed char int8;
-typedef unsigned char uint8;
-typedef unsigned char byte;
-
-// All uses of *int16 changed to 32-bit to speed up compiler on Intel
-//typedef signed short int16;   // Exactly 16bits signed
-//typedef unsigned short uint16;        // Exactly 16bits unsigned
-//const unsigned int min_uint16 = 0x0000;    // smallest uint16
-//const unsigned int max_uint16 = 0xFFFF;    // largest  uint16
-
-typedef unsigned int uint;      // When you need a fast >=16bit unsigned value
-/*typedef int int; */           // When you need a fast >=16bit value
-const unsigned int max_uint = (uint)-1;
-typedef int32_t int32;   // Exactly 32bits signed
-typedef uint32_t uint32; // Exactly 32bits unsigned
-
-// Bit-sized floating point and long thingies
-#ifndef __TANDEM
-// Do not define these for Tandem, because they conflict with typedefs in softieee.h.
-typedef float float32;          // 32-bit float
-typedef double float64;         // 64-bit float
-#endif // __TANDEM
-
-typedef jlong int64;            // Java long for my 64-bit type
-typedef julong uint64;          // Java long for my 64-bit type
-
-//-----------------------------------------------------------------------------
-// Nice constants
-uint32 gcd( uint32 x, uint32 y );
-int ff1( uint32 mask );
-int fh1( uint32 mask );
-uint32 rotate32( uint32 x, int32 cnt );
-
-
-//-----------------------------------------------------------------------------
-extern uint32 heap_totalmem;      // Current total memory allocation
-extern uint32 heap_highwater;     // Highwater mark to date for memory usage
-
-#endif // SHARE_VM_LIBADT_PORT_HPP
--- a/hotspot/src/share/vm/libadt/set.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/libadt/set.cpp	Thu May 22 14:38:34 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,20 +28,11 @@
 
 // Sets - An Abstract Data Type
 
-// %%%%% includes not needed with AVM framework - Ungar
-// #include "port.hpp"
-//IMPLEMENTATION
-// #include "set.hpp"
-
 #include <stdio.h>
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
 
-// Not needed and it causes terouble for gcc.
-//
-// #include <iostream.h>
-
 //-------------------------Virtual Functions-----------------------------------
 // These functions MUST be implemented by the inheriting class.
 class SparseSet;
@@ -116,7 +107,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/libadt/set.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/libadt/set.hpp	Thu May 22 14:38:34 2014 -0700
@@ -25,13 +25,10 @@
 #ifndef SHARE_VM_LIBADT_SET_HPP
 #define SHARE_VM_LIBADT_SET_HPP
 
-#include "libadt/port.hpp"
 #include "memory/allocation.hpp"
 
 // Sets - An Abstract Data Type
 
-//INTERFACE
-
 class SparseSet;
 class VectorSet;
 class ListSet;
--- a/hotspot/src/share/vm/libadt/vectset.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/libadt/vectset.cpp	Thu May 22 14:38:34 2014 -0700
@@ -28,15 +28,10 @@
 
 // Vector Sets - An Abstract Data Type
 
-// %%%%% includes not needed with AVM framework - Ungar
-// #include "port.hpp"
-//IMPLEMENTATION
-// #include "vectset.hpp"
-
 // BitsInByte is a lookup table which tells the number of bits that
 // are in the looked-up number.  It is very useful in VectorSet_Size.
 
-uint8 bitsInByte[256] = {
+uint8_t bitsInByte[256] = {
   0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
   1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
   1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
@@ -59,7 +54,7 @@
 // Create a new, empty Set.
 VectorSet::VectorSet(Arena *arena) : Set(arena) {
   size = 2;                     // Small initial size
-  data = (uint32 *)_set_arena->Amalloc(size*sizeof(uint32));
+  data = (uint32_t *)_set_arena->Amalloc(size*sizeof(uint32_t));
   data[0] = 0;                  // No elements
   data[1] = 0;
 }
@@ -85,8 +80,8 @@
 void VectorSet::slamin(const VectorSet& s)
 {
   size = s.size;                // Use new size
-  data = (uint32*)s._set_arena->Amalloc(size*sizeof(uint32)); // Make array of required size
-  memcpy( data, s.data, size*sizeof(uint32) ); // Fill the array
+  data = (uint32_t*)s._set_arena->Amalloc(size*sizeof(uint32_t)); // Make array of required size
+  memcpy( data, s.data, size*sizeof(uint32_t) ); // Fill the array
 }
 
 //------------------------------grow-------------------------------------------
@@ -96,8 +91,8 @@
   newsize = (newsize+31) >> 5;  // Convert to longwords
   uint x = size;
   while( x < newsize ) x <<= 1;
-  data = (uint32 *)_set_arena->Arealloc(data, size*sizeof(uint32), x*sizeof(uint32));
-  memset((char *)(data + size), 0, (x - size)*sizeof(uint32));
+  data = (uint32_t *)_set_arena->Arealloc(data, size*sizeof(uint32_t), x*sizeof(uint32_t));
+  memset((char *)(data + size), 0, (x - size)*sizeof(uint32_t));
   size = x;
 }
 
@@ -106,7 +101,7 @@
 Set &VectorSet::operator <<= (uint elem)
 {
   register uint word = elem >> 5;            // Get the longword offset
-  register uint32 mask = 1L << (elem & 31);  // Get bit mask
+  register uint32_t mask = 1L << (elem & 31);  // Get bit mask
 
   if( word >= size )            // Need to grow set?
     grow(elem+1);               // Then grow it
@@ -121,7 +116,7 @@
   register uint word = elem >> 5; // Get the longword offset
   if( word >= size )              // Beyond the last?
     return *this;                 // Then it's clear & return clear
-  register uint32 mask = 1L << (elem & 31);     // Get bit mask
+  register uint32_t mask = 1L << (elem & 31);     // Get bit mask
   data[word] &= ~mask;            // Clear bit
   return *this;
 }
@@ -132,8 +127,8 @@
 {
   // NOTE: The intersection is never any larger than the smallest set.
   if( s.size < size ) size = s.size; // Get smaller size
-  register uint32 *u1 = data;   // Pointer to the destination data
-  register uint32 *u2 = s.data; // Pointer to the source data
+  register uint32_t *u1 = data;   // Pointer to the destination data
+  register uint32_t *u2 = s.data; // Pointer to the source data
   for( uint i=0; i<size; i++)   // For data in set
     *u1++ &= *u2++;             // Copy and AND longwords
   return *this;                 // Return set
@@ -152,14 +147,14 @@
 {
   // This many words must be unioned
   register uint cnt = ((size<s.size)?size:s.size);
-  register uint32 *u1 = data;   // Pointer to the destination data
-  register uint32 *u2 = s.data; // Pointer to the source data
+  register uint32_t *u1 = data;   // Pointer to the destination data
+  register uint32_t *u2 = s.data; // Pointer to the source data
   for( uint i=0; i<cnt; i++)    // Copy and OR the two sets
     *u1++ |= *u2++;
   if( size < s.size ) {         // Is set 2 larger than set 1?
     // Extend result by larger set
-    grow(s.size*sizeof(uint32)*8);
-    memcpy(&data[cnt], u2, (s.size - cnt)*sizeof(uint32));
+    grow(s.size*sizeof(uint32_t)*8);
+    memcpy(&data[cnt], u2, (s.size - cnt)*sizeof(uint32_t));
   }
   return *this;                 // Return result set
 }
@@ -177,8 +172,8 @@
 {
   // This many words must be unioned
   register uint cnt = ((size<s.size)?size:s.size);
-  register uint32 *u1 = data;   // Pointer to the destination data
-  register uint32 *u2 = s.data; // Pointer to the source data
+  register uint32_t *u1 = data;   // Pointer to the destination data
+  register uint32_t *u2 = s.data; // Pointer to the source data
   for( uint i=0; i<cnt; i++ )   // For data in set
     *u1++ &= ~(*u2++);          // A <-- A & ~B  with longwords
   return *this;                 // Return new set
@@ -199,17 +194,17 @@
 //        1X --  B is a subset of A
 int VectorSet::compare (const VectorSet &s) const
 {
-  register uint32 *u1 = data;   // Pointer to the destination data
-  register uint32 *u2 = s.data; // Pointer to the source data
-  register uint32 AnotB = 0, BnotA = 0;
+  register uint32_t *u1 = data;   // Pointer to the destination data
+  register uint32_t *u2 = s.data; // Pointer to the source data
+  register uint32_t AnotB = 0, BnotA = 0;
   // This many words must be unioned
   register uint cnt = ((size<s.size)?size:s.size);
 
   // Get bits for both sets
   uint i;                       // Exit value of loop
   for( i=0; i<cnt; i++ ) {      // For data in BOTH sets
-    register uint32 A = *u1++;  // Data from one guy
-    register uint32 B = *u2++;  // Data from other guy
+    register uint32_t A = *u1++;  // Data from one guy
+    register uint32_t B = *u2++;  // Data from other guy
     AnotB |= (A & ~B);          // Compute bits in A not B
     BnotA |= (B & ~A);          // Compute bits in B not A
   }
@@ -250,8 +245,8 @@
 
   // NOTE: The intersection is never any larger than the smallest set.
   register uint small_size = ((size<s.size)?size:s.size);
-  register uint32 *u1 = data;        // Pointer to the destination data
-  register uint32 *u2 = s.data;      // Pointer to the source data
+  register uint32_t *u1 = data;        // Pointer to the destination data
+  register uint32_t *u2 = s.data;      // Pointer to the source data
   for( uint i=0; i<small_size; i++)  // For data in set
     if( *u1++ & *u2++ )              // If any elements in common
       return 0;                      // Then not disjoint
@@ -293,7 +288,7 @@
   register uint word = elem >> 5; // Get the longword offset
   if( word >= size )              // Beyond the last?
     return 0;                     // Then it's clear
-  register uint32 mask = 1L << (elem & 31);  // Get bit mask
+  register uint32_t mask = 1L << (elem & 31);  // Get bit mask
   return ((data[word] & mask))!=0;           // Return the sense of the bit
 }
 
@@ -305,7 +300,7 @@
   for( i=0; i<size; i++ )
     if( data[i] )
       break;
-  uint32 word = data[i];
+  uint32_t word = data[i];
   int j;                        // Exit value of loop
   for( j= -1; word; j++, word>>=1 );
   return (i<<5)+j;
@@ -316,11 +311,11 @@
 void VectorSet::Clear(void)
 {
   if( size > 100 ) {            // Reclaim storage only if huge
-    FREE_RESOURCE_ARRAY(uint32,data,size);
+    FREE_RESOURCE_ARRAY(uint32_t,data,size);
     size = 2;                   // Small initial size
-    data = NEW_RESOURCE_ARRAY(uint32,size);
+    data = NEW_RESOURCE_ARRAY(uint32_t,size);
   }
-  memset( data, 0, size*sizeof(uint32) );
+  memset( data, 0, size*sizeof(uint32_t) );
 }
 
 //------------------------------Size-------------------------------------------
@@ -328,8 +323,8 @@
 uint VectorSet::Size(void) const
 {
   uint sum = 0;                 // Cumulative size so far.
-  uint8 *currByte = (uint8*)data;
-  for( uint32 i = 0; i < (size<<2); i++) // While have bytes to process
+  uint8_t* currByte = (uint8_t*) data;
+  for( uint32_t i = 0; i < (size<<2); i++) // While have bytes to process
     sum += bitsInByte[*currByte++];      // Add bits in current byte to size.
   return sum;
 }
@@ -343,7 +338,7 @@
 //------------------------------hash-------------------------------------------
 int VectorSet::hash() const
 {
-  uint32 _xor = 0;
+  uint32_t _xor = 0;
   uint lim = ((size<4)?size:4);
   for( uint i = 0; i < lim; i++ )
     _xor ^= data[i];
--- a/hotspot/src/share/vm/libadt/vectset.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/libadt/vectset.hpp	Thu May 22 14:38:34 2014 -0700
@@ -47,7 +47,7 @@
 friend class VectorSetI;        // Friendly iterator class
 protected:
   uint size;                    // Size of data IN LONGWORDS (32bits)
-  uint32 *data;                 // The data, bit packed
+  uint32_t* data;               // The data, bit packed
 
   void slamin( const VectorSet& s );     // Initialize one set with another
   int compare(const VectorSet &s) const; // Compare set contents
@@ -99,7 +99,7 @@
   void Sort(void);                  // Sort before iterating
   int hash() const;                 // Hash function
   void Reset(void) {                // Reset a set
-    memset( data, 0, size*sizeof(uint32) );
+    memset( data, 0, size*sizeof(uint32_t) );
   }
 
   /* Removed for MCC BUG
@@ -108,7 +108,7 @@
 
   // Expose internals for speed-critical fast iterators
   uint word_size() const { return size; }
-  uint32 *EXPOSE() const { return data; }
+  uint32_t* EXPOSE() const { return data; }
 
   // Fast inlined "test and set".  Replaces the idiom:
   //     if( visited[idx] ) return;
@@ -120,8 +120,8 @@
     uint word = elem >> 5;           // Get the longword offset
     if( word >= size )               // Beyond the last?
       return test_set_grow(elem);    // Then grow; set; return 0;
-    uint32 mask = 1L << (elem & 31); // Get bit mask
-    uint32 datum = data[word] & mask;// Get bit
+    uint32_t mask = 1L << (elem & 31); // Get bit mask
+    uint32_t datum = data[word] & mask;// Get bit
     data[word] |= mask;              // Set bit
     return datum;                    // Return bit
   }
@@ -134,7 +134,7 @@
   int test( uint elem ) const {
     uint word = elem >> 5;      // Get the longword offset
     if( word >= size ) return 0; // Beyond the last?
-    uint32 mask = 1L << (elem & 31); // Get bit mask
+    uint32_t mask = 1L << (elem & 31); // Get bit mask
     return data[word] & mask;   // Get bit
   }
 
@@ -144,7 +144,7 @@
     if( word >= size ) {        // Beyond the last?
       test_set_grow(elem);      // Then grow and set
     } else {
-      uint32 mask = 1L << (elem & 31); // Get bit mask
+      uint32_t mask = 1L << (elem & 31); // Get bit mask
       data[word] |= mask;       // Set bit
     }
   }
@@ -164,7 +164,7 @@
   friend class VectorSet;
   const VectorSet *s;
   uint i, j;
-  uint32 mask;
+  uint32_t mask;
   uint next(void);
 
 public:
--- a/hotspot/src/share/vm/memory/allocation.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Thu May 22 14:38:34 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));
 }
 
 //--------------------------------------------------------------------------------------
@@ -686,50 +686,67 @@
 // a memory leak.  Use CHeapObj as the base class of such objects to make it explicit
 // that they're allocated on the C heap.
 // Commented out in product version to avoid conflicts with third-party C++ native code.
-// On certain platforms, such as Mac OS X (Darwin), in debug version, new is being called
-// from jdk source and causing data corruption. Such as
-//  Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair
-// define ALLOW_OPERATOR_NEW_USAGE for platform on which global operator new allowed.
+//
+// In C++98/03 the throwing new operators are defined with the following signature:
+//
+// void* operator new(std::size_tsize) throw(std::bad_alloc);
+// void* operator new[](std::size_tsize) throw(std::bad_alloc);
+//
+// while all the other (non-throwing) new and delete operators are defined with an empty
+// throw clause (i.e. "operator delete(void* p) throw()") which means that they do not
+// throw any exceptions (see section 18.4 of the C++ standard).
 //
-#ifndef ALLOW_OPERATOR_NEW_USAGE
-void* operator new(size_t size) throw() {
-  assert(false, "Should not call global operator new");
+// In the new C++11/14 standard, the signature of the throwing new operators was changed
+// by completely omitting the throw clause (which effectively means they could throw any
+// exception) while all the other new/delete operators where changed to have a 'nothrow'
+// clause instead of an empty throw clause.
+//
+// Unfortunately, the support for exception specifications among C++ compilers is still
+// very fragile. While some more strict compilers like AIX xlC or HP aCC reject to
+// override the default throwing new operator with a user operator with an empty throw()
+// clause, the MS Visual C++ compiler warns for every non-empty throw clause like
+// throw(std::bad_alloc) that it will ignore the exception specification. The following
+// operator definitions have been checked to correctly work with all currently supported
+// compilers and they should be upwards compatible with C++11/14. Therefore
+// PLEASE BE CAREFUL if you change the signature of the following operators!
+
+void* operator new(size_t size) /* throw(std::bad_alloc) */ {
+  fatal("Should not call global operator new");
   return 0;
 }
 
-void* operator new [](size_t size) throw() {
-  assert(false, "Should not call global operator new[]");
+void* operator new [](size_t size) /* throw(std::bad_alloc) */ {
+  fatal("Should not call global operator new[]");
   return 0;
 }
 
 void* operator new(size_t size, const std::nothrow_t&  nothrow_constant) throw() {
-  assert(false, "Should not call global operator new");
+  fatal("Should not call global operator new");
   return 0;
 }
 
 void* operator new [](size_t size, std::nothrow_t&  nothrow_constant) throw() {
-  assert(false, "Should not call global operator new[]");
+  fatal("Should not call global operator new[]");
   return 0;
 }
 
-void operator delete(void* p) {
-  assert(false, "Should not call global delete");
+void operator delete(void* p) throw() {
+  fatal("Should not call global delete");
 }
 
-void operator delete [](void* p) {
-  assert(false, "Should not call global delete []");
+void operator delete [](void* p) throw() {
+  fatal("Should not call global delete []");
 }
-#endif // ALLOW_OPERATOR_NEW_USAGE
 
 void AllocatedObj::print() const       { print_on(tty); }
 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/blockOffsetTable.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Thu May 22 14:38:34 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
@@ -736,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)" : "");
     }
   }
 }
@@ -903,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/defNewGeneration.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/gcLocker.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Thu May 22 14:38:34 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
@@ -794,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;
 }
 
@@ -1067,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();
@@ -1270,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/genMarkSweep.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp	Thu May 22 14:38:34 2014 -0700
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/codeCache.hpp"
--- a/hotspot/src/share/vm/memory/genOopClosures.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/genOopClosures.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/generation.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/generation.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/heapInspection.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/metachunk.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Thu May 22 14:38:34 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
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/space.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/memory/universe.cpp	Thu May 22 14:38:34 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
@@ -26,7 +26,7 @@
 #include "classfile/classLoader.hpp"
 #include "classfile/classLoaderData.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/codeCache.hpp"
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/annotations.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/constMethod.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Thu May 22 14:38:34 2014 -0700
@@ -26,7 +26,7 @@
 #include "classfile/classLoaderData.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/metadataOnStackMark.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "interpreter/linkResolver.hpp"
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/generateOopMap.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/klass.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/markOop.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp	Thu May 22 14:38:34 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/method.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.hpp	Thu May 22 14:38:34 2014 -0700
@@ -200,10 +200,11 @@
   // Tracking number of breakpoints, for fullspeed debugging.
   // Only mutated by VM thread.
   u2   number_of_breakpoints()             const {
-    if (method_counters() == NULL) {
+    MethodCounters* mcs = method_counters();
+    if (mcs == NULL) {
       return 0;
     } else {
-      return method_counters()->number_of_breakpoints();
+      return mcs->number_of_breakpoints();
     }
   }
   void incr_number_of_breakpoints(TRAPS)         {
@@ -220,8 +221,9 @@
   }
   // Initialization only
   void clear_number_of_breakpoints()             {
-    if (method_counters() != NULL) {
-      method_counters()->clear_number_of_breakpoints();
+    MethodCounters* mcs = method_counters();
+    if (mcs != NULL) {
+      mcs->clear_number_of_breakpoints();
     }
   }
 
@@ -268,10 +270,11 @@
   }
 
   int  interpreter_throwout_count() const        {
-    if (method_counters() == NULL) {
+    MethodCounters* mcs = method_counters();
+    if (mcs == NULL) {
       return 0;
     } else {
-      return method_counters()->interpreter_throwout_count();
+      return mcs->interpreter_throwout_count();
     }
   }
 
@@ -346,31 +349,40 @@
       return method_counters()->interpreter_invocation_count();
     }
   }
-  void set_prev_event_count(int count, TRAPS)    {
-    MethodCounters* mcs = get_method_counters(CHECK);
+  void set_prev_event_count(int count) {
+    MethodCounters* mcs = method_counters();
     if (mcs != NULL) {
       mcs->set_interpreter_invocation_count(count);
     }
   }
   jlong prev_time() const                        {
-    return method_counters() == NULL ? 0 : method_counters()->prev_time();
+    MethodCounters* mcs = method_counters();
+    return mcs == NULL ? 0 : mcs->prev_time();
   }
-  void set_prev_time(jlong time, TRAPS)          {
-    MethodCounters* mcs = get_method_counters(CHECK);
+  void set_prev_time(jlong time) {
+    MethodCounters* mcs = method_counters();
     if (mcs != NULL) {
       mcs->set_prev_time(time);
     }
   }
   float rate() const                             {
-    return method_counters() == NULL ? 0 : method_counters()->rate();
+    MethodCounters* mcs = method_counters();
+    return mcs == NULL ? 0 : mcs->rate();
   }
-  void set_rate(float rate, TRAPS) {
-    MethodCounters* mcs = get_method_counters(CHECK);
+  void set_rate(float rate) {
+    MethodCounters* mcs = method_counters();
     if (mcs != NULL) {
       mcs->set_rate(rate);
     }
   }
 #endif
+  int nmethod_age() const {
+    if (method_counters() == NULL) {
+      return INT_MAX;
+    } else {
+      return method_counters()->nmethod_age();
+    }
+  }
 
   int invocation_count();
   int backedge_count();
@@ -383,9 +395,12 @@
   static MethodCounters* build_method_counters(Method* m, TRAPS);
 
   int interpreter_invocation_count() {
-    if (TieredCompilation) return invocation_count();
-    else return (method_counters() == NULL) ? 0 :
-                 method_counters()->interpreter_invocation_count();
+    if (TieredCompilation) {
+      return invocation_count();
+    } else {
+      MethodCounters* mcs = method_counters();
+      return (mcs == NULL) ? 0 : mcs->interpreter_invocation_count();
+    }
   }
   int increment_interpreter_invocation_count(TRAPS) {
     if (TieredCompilation) ShouldNotReachHere();
--- a/hotspot/src/share/vm/oops/methodCounters.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodCounters.cpp	Thu May 22 14:38:34 2014 -0700
@@ -34,4 +34,5 @@
   backedge_counter()->reset();
   set_interpreter_throwout_count(0);
   set_interpreter_invocation_count(0);
+  set_nmethod_age(INT_MAX);
 }
--- a/hotspot/src/share/vm/oops/methodCounters.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodCounters.hpp	Thu May 22 14:38:34 2014 -0700
@@ -36,6 +36,15 @@
   u2                _number_of_breakpoints;      // fullspeed debugging support
   InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
   InvocationCounter _backedge_counter;           // Incremented before each backedge taken - used to trigger frequencey-based optimizations
+  // NMethod age is a counter for warm methods detection in the code cache sweeper.
+  // The counter is reset by the sweeper and is decremented by some of the compiled
+  // code. The counter values are interpreted as follows:
+  // 1. (HotMethodDetection..INT_MAX] - initial value, no counters inserted
+  // 2. (1..HotMethodDetectionLimit)  - the method is warm, the counter is used
+  //                                    to figure out which methods can be flushed.
+  // 3. (INT_MIN..0]                  - method is hot and will deopt and get
+  //                                    recompiled without the counters
+  int               _nmethod_age;
 
 #ifdef TIERED
   float             _rate;                        // Events (invocation and backedge counter increments) per millisecond
@@ -44,7 +53,8 @@
 
   MethodCounters() : _interpreter_invocation_count(0),
                      _interpreter_throwout_count(0),
-                     _number_of_breakpoints(0)
+                     _number_of_breakpoints(0),
+                     _nmethod_age(INT_MAX)
 #ifdef TIERED
                    , _rate(0),
                      _prev_time(0)
@@ -52,6 +62,10 @@
   {
     invocation_counter()->init();
     backedge_counter()->init();
+
+    if (StressCodeAging) {
+      set_nmethod_age(HotMethodDetectionLimit);
+    }
   }
 
  public:
@@ -104,6 +118,24 @@
   InvocationCounter* invocation_counter() { return &_invocation_counter; }
   InvocationCounter* backedge_counter()   { return &_backedge_counter; }
 
+  int nmethod_age() {
+    return _nmethod_age;
+  }
+  void set_nmethod_age(int age) {
+    _nmethod_age = age;
+  }
+  void reset_nmethod_age() {
+    set_nmethod_age(HotMethodDetectionLimit);
+  }
+
+  static bool is_nmethod_hot(int age)       { return age <= 0; }
+  static bool is_nmethod_warm(int age)      { return age < HotMethodDetectionLimit; }
+  static bool is_nmethod_age_unset(int age) { return age > HotMethodDetectionLimit; }
+
+  static ByteSize nmethod_age_offset() {
+    return byte_offset_of(MethodCounters, _nmethod_age);
+  }
+
   static ByteSize interpreter_invocation_counter_offset() {
     return byte_offset_of(MethodCounters, _interpreter_invocation_count);
   }
--- a/hotspot/src/share/vm/oops/methodData.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Thu May 22 14:38:34 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);
 }
 
@@ -1128,6 +1130,7 @@
   _backedge_counter.init();
   _invocation_counter_start = 0;
   _backedge_counter_start = 0;
+  _tenure_traps = 0;
   _num_loops = 0;
   _num_blocks = 0;
   _highest_comp_level = 0;
--- a/hotspot/src/share/vm/oops/methodData.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Thu May 22 14:38:34 2014 -0700
@@ -2059,6 +2059,7 @@
   // Counter values at the time profiling started.
   int               _invocation_counter_start;
   int               _backedge_counter_start;
+  uint              _tenure_traps;
 
 #if INCLUDE_RTM_OPT
   // State of RTM code generation during compilation of the method
@@ -2398,6 +2399,12 @@
       method()->set_not_compilable(CompLevel_full_optimization, true, "decompile_count > PerMethodRecompilationCutoff");
     }
   }
+  uint tenure_traps() const {
+    return _tenure_traps;
+  }
+  void inc_tenure_traps() {
+    _tenure_traps += 1;
+  }
 
   // Return pointer to area dedicated to parameters in MDO
   ParametersTypeData* parameters_type_data() const {
--- a/hotspot/src/share/vm/oops/oop.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/oop.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/block.cpp	Thu May 22 14:38:34 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 {
@@ -1268,7 +1268,6 @@
 }
 
 void UnionFind::reset( uint max ) {
-  assert( max <= max_uint, "Must fit within uint" );
   // Force the Union-Find mapping to be at least this large
   extend(max,0);
   // Initialize to be the ID mapping.
--- a/hotspot/src/share/vm/opto/callnode.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/callnode.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/chaitin.cpp	Thu May 22 14:38:34 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/chaitin.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/chaitin.hpp	Thu May 22 14:38:34 2014 -0700
@@ -26,7 +26,6 @@
 #define SHARE_VM_OPTO_CHAITIN_HPP
 
 #include "code/vmreg.hpp"
-#include "libadt/port.hpp"
 #include "memory/resourceArea.hpp"
 #include "opto/connode.hpp"
 #include "opto/live.hpp"
@@ -142,7 +141,7 @@
 
   // Number of registers this live range uses when it colors
 private:
-  uint8 _num_regs;              // 2 for Longs and Doubles, 1 for all else
+  uint8_t _num_regs;            // 2 for Longs and Doubles, 1 for all else
                                 // except _num_regs is kill count for fat_proj
 public:
   int num_regs() const { return _num_regs; }
@@ -151,7 +150,7 @@
 private:
   // Number of physical registers this live range uses when it colors
   // Architecture and register-set dependent
-  uint8 _reg_pressure;
+  uint8_t _reg_pressure;
 public:
   void set_reg_pressure(int i)  { _reg_pressure = i; }
   int      reg_pressure() const { return _reg_pressure; }
--- a/hotspot/src/share/vm/opto/compile.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp	Thu May 22 14:38:34 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
@@ -1089,6 +1089,7 @@
   set_do_scheduling(OptoScheduling);
   set_do_count_invocations(false);
   set_do_method_data_update(false);
+  set_age_code(has_method() && method()->profile_aging());
   set_rtm_state(NoRTM); // No RTM lock eliding by default
 #if INCLUDE_RTM_OPT
   if (UseRTMLocking && has_method() && (method()->method_data_or_null() != NULL)) {
@@ -2424,7 +2425,7 @@
         starts_bundle = ' ';
         tty->print("\t");
         delay->format(_regalloc, tty);
-        tty->print_cr("");
+        tty->cr();
         delay = NULL;
       }
 
@@ -2438,12 +2439,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 +3689,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 +3770,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 +3886,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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/compile.hpp	Thu May 22 14:38:34 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,7 +32,6 @@
 #include "compiler/compilerOracle.hpp"
 #include "compiler/compileBroker.hpp"
 #include "libadt/dict.hpp"
-#include "libadt/port.hpp"
 #include "libadt/vectset.hpp"
 #include "memory/resourceArea.hpp"
 #include "opto/idealGraphPrinter.hpp"
@@ -311,6 +310,7 @@
   bool                  _do_freq_based_layout;  // True if we intend to do frequency based block layout
   bool                  _do_count_invocations;  // True if we generate code to count invocations
   bool                  _do_method_data_update; // True if we generate code to update MethodData*s
+  bool                  _age_code;              // True if we need to profile code age (decrement the aging counter)
   int                   _AliasLevel;            // Locally-adjusted version of AliasLevel flag.
   bool                  _print_assembly;        // True if we should dump assembly code for this compilation
   bool                  _print_inlining;        // True if we should print inlining for this compilation
@@ -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);
@@ -584,7 +584,9 @@
   void          set_do_count_invocations(bool z){ _do_count_invocations = z; }
   bool              do_method_data_update() const { return _do_method_data_update; }
   void          set_do_method_data_update(bool z) { _do_method_data_update = z; }
-  int               AliasLevel() const          { return _AliasLevel; }
+  bool              age_code() const             { return _age_code; }
+  void          set_age_code(bool z)             { _age_code = z; }
+  int               AliasLevel() const           { return _AliasLevel; }
   bool              print_assembly() const       { return _print_assembly; }
   void          set_print_assembly(bool z)       { _print_assembly = z; }
   bool              print_inlining() const       { return _print_inlining; }
--- a/hotspot/src/share/vm/opto/divnode.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/divnode.cpp	Thu May 22 14:38:34 2014 -0700
@@ -514,7 +514,7 @@
   int widen = MAX2(i1->_widen, i2->_widen);
 
   if( i2->is_con() && i2->get_con() != 0 ) {
-    int32 d = i2->get_con(); // Divisor
+    int32_t d = i2->get_con(); // Divisor
     jint lo, hi;
     if( d >= 0 ) {
       lo = i1->_lo/d;
@@ -536,7 +536,7 @@
 
   // If the dividend is a constant
   if( i1->is_con() ) {
-    int32 d = i1->get_con();
+    int32_t d = i1->get_con();
     if( d < 0 ) {
       if( d == min_jint ) {
         //  (-min_jint) == min_jint == (min_jint / -1)
--- a/hotspot/src/share/vm/opto/doCall.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/doCall.cpp	Thu May 22 14:38:34 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/domgraph.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/domgraph.cpp	Thu May 22 14:38:34 2014 -0700
@@ -397,8 +397,9 @@
     ntarjan[i]._control = NULL;
 
   // Store the DFS order for the main loop
+  const uint fill_value = max_juint;
   uint *dfsorder = NEW_RESOURCE_ARRAY(uint,C->unique()+1);
-  memset(dfsorder, max_uint, (C->unique()+1) * sizeof(uint));
+  memset(dfsorder, fill_value, (C->unique()+1) * sizeof(uint));
 
   // Tarjan's algorithm, almost verbatim:
   // Step 1:
@@ -419,7 +420,7 @@
       if( whead->in(j) == NULL || !whead->in(j)->is_CFG() )
         continue;                            // Only process control nodes
       uint b = dfsorder[whead->in(j)->_idx];
-      if(b == max_uint) continue;
+      if(b == fill_value) continue;
       NTarjan *vx = &ntarjan[b];
       NTarjan *u = vx->EVAL();
       if( u->_semi < w->_semi )
--- a/hotspot/src/share/vm/opto/gcm.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/gcm.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/ifg.cpp	Thu May 22 14:38:34 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/indexSet.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/indexSet.cpp	Thu May 22 14:38:34 2014 -0700
@@ -51,7 +51,7 @@
 #endif
 
 // What is the first set bit in a 5 bit integer?
-const byte IndexSetIterator::_first_bit[32] = {
+const uint8_t IndexSetIterator::_first_bit[32] = {
   0, 0, 1, 0,
   2, 0, 1, 0,
   3, 0, 1, 0,
@@ -63,7 +63,7 @@
 };
 
 // What is the second set bit in a 5 bit integer?
-const byte IndexSetIterator::_second_bit[32] = {
+const uint8_t IndexSetIterator::_second_bit[32] = {
   5, 5, 5, 1,
   5, 2, 2, 1,
   5, 3, 3, 1,
@@ -298,7 +298,7 @@
       set_block(i, &_empty_block);
     } else {
       BitBlock *new_block = alloc_block();
-      memcpy(new_block->words(), block->words(), sizeof(uint32) * words_per_block);
+      memcpy(new_block->words(), block->words(), sizeof(uint32_t) * words_per_block);
       set_block(i, new_block);
     }
   }
--- a/hotspot/src/share/vm/opto/indexSet.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/indexSet.hpp	Thu May 22 14:38:34 2014 -0700
@@ -106,12 +106,12 @@
     // is used by IndexSet to mainting this free list.
 
     union {
-      uint32 _words[words_per_block];
+      uint32_t _words[words_per_block];
       BitBlock *_next;
     } _data;
 
     // accessors
-    uint32 *words() { return _data._words; }
+    uint32_t* words() { return _data._words; }
     void set_next(BitBlock *next) { _data._next = next; }
     BitBlock *next() { return _data._next; }
 
@@ -120,22 +120,22 @@
     // not assume that the block index has been masked out.
 
     void clear() {
-      memset(words(), 0, sizeof(uint32) * words_per_block);
+      memset(words(), 0, sizeof(uint32_t) * words_per_block);
     }
 
     bool member(uint element) {
       uint word_index = IndexSet::get_word_index(element);
       uint bit_index = IndexSet::get_bit_index(element);
 
-      return ((words()[word_index] & (uint32)(0x1 << bit_index)) != 0);
+      return ((words()[word_index] & (uint32_t)(0x1 << bit_index)) != 0);
     }
 
     bool insert(uint element) {
       uint word_index = IndexSet::get_word_index(element);
       uint bit_index = IndexSet::get_bit_index(element);
 
-      uint32 bit = (0x1 << bit_index);
-      uint32 before = words()[word_index];
+      uint32_t bit = (0x1 << bit_index);
+      uint32_t before = words()[word_index];
       words()[word_index] = before | bit;
       return ((before & bit) != 0);
     }
@@ -144,8 +144,8 @@
       uint word_index = IndexSet::get_word_index(element);
       uint bit_index = IndexSet::get_bit_index(element);
 
-      uint32 bit = (0x1 << bit_index);
-      uint32 before = words()[word_index];
+      uint32_t bit = (0x1 << bit_index);
+      uint32_t before = words()[word_index];
       words()[word_index] = before & ~bit;
       return ((before & bit) != 0);
     }
@@ -404,14 +404,14 @@
          table_size  = (1 << window_size) };
 
   // For an integer of length window_size, what is the first set bit?
-  static const byte _first_bit[table_size];
+  static const uint8_t _first_bit[table_size];
 
   // For an integer of length window_size, what is the second set bit?
-  static const byte _second_bit[table_size];
+  static const uint8_t _second_bit[table_size];
 
  private:
   // The current word we are inspecting
-  uint32                _current;
+  uint32_t              _current;
 
   // What element number are we currently on?
   uint                  _value;
@@ -420,7 +420,7 @@
   uint                  _next_word;
 
   // A pointer to the contents of the current block
-  uint32               *_words;
+  uint32_t             *_words;
 
   // The index of the next block we will inspect
   uint                  _next_block;
--- a/hotspot/src/share/vm/opto/live.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/live.hpp	Thu May 22 14:38:34 2014 -0700
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_OPTO_LIVE_HPP
 #define SHARE_VM_OPTO_LIVE_HPP
 
-#include "libadt/port.hpp"
 #include "libadt/vectset.hpp"
 #include "opto/block.hpp"
 #include "opto/indexSet.hpp"
--- a/hotspot/src/share/vm/opto/loopPredicate.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Thu May 22 14:38:34 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/loopnode.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.hpp	Thu May 22 14:38:34 2014 -0700
@@ -339,11 +339,11 @@
 
   Node_List _body;              // Loop body for inner loops
 
-  uint8 _nest;                  // Nesting depth
-  uint8 _irreducible:1,         // True if irreducible
-        _has_call:1,            // True if has call safepoint
-        _has_sfpt:1,            // True if has non-call safepoint
-        _rce_candidate:1;       // True if candidate for range check elimination
+  uint8_t _nest;                // Nesting depth
+  uint8_t _irreducible:1,       // True if irreducible
+          _has_call:1,          // True if has call safepoint
+          _has_sfpt:1,          // True if has non-call safepoint
+          _rce_candidate:1;     // True if candidate for range check elimination
 
   Node_List* _safepts;          // List of safepoints in this loop
   Node_List* _required_safept;  // A inner loop cannot delete these safepts;
--- a/hotspot/src/share/vm/opto/matcher.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/matcher.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Thu May 22 14:38:34 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/mulnode.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/mulnode.cpp	Thu May 22 14:38:34 2014 -0700
@@ -235,23 +235,23 @@
   const TypeInt *r1 = t1->is_int();
 
   // Fetch endpoints of all ranges
-  int32 lo0 = r0->_lo;
+  int32_t lo0 = r0->_lo;
   double a = (double)lo0;
-  int32 hi0 = r0->_hi;
+  int32_t hi0 = r0->_hi;
   double b = (double)hi0;
-  int32 lo1 = r1->_lo;
+  int32_t lo1 = r1->_lo;
   double c = (double)lo1;
-  int32 hi1 = r1->_hi;
+  int32_t hi1 = r1->_hi;
   double d = (double)hi1;
 
   // Compute all endpoints & check for overflow
-  int32 A = lo0*lo1;
+  int32_t A = lo0*lo1;
   if( (double)A != a*c ) return TypeInt::INT; // Overflow?
-  int32 B = lo0*hi1;
+  int32_t B = lo0*hi1;
   if( (double)B != a*d ) return TypeInt::INT; // Overflow?
-  int32 C = hi0*lo1;
+  int32_t C = hi0*lo1;
   if( (double)C != b*c ) return TypeInt::INT; // Overflow?
-  int32 D = hi0*hi1;
+  int32_t D = hi0*hi1;
   if( (double)D != b*d ) return TypeInt::INT; // Overflow?
 
   if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints
@@ -1228,12 +1228,12 @@
   //
   //   const TypeInstPtr *o = t1->is_instptr();
   //   if( t1->singleton() )
-  //     return TypeInt::make( ((uint32)o->const_oop() + o->_offset) >> shift );
+  //     return TypeInt::make( ((uint32_t)o->const_oop() + o->_offset) >> shift );
   // }
   // else if( t1->base() == Type::KlassPtr ) {
   //   const TypeKlassPtr *o = t1->is_klassptr();
   //   if( t1->singleton() )
-  //     return TypeInt::make( ((uint32)o->const_oop() + o->_offset) >> shift );
+  //     return TypeInt::make( ((uint32_t)o->const_oop() + o->_offset) >> shift );
   // }
 
   return TypeInt::INT;
--- a/hotspot/src/share/vm/opto/node.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/node.cpp	Thu May 22 14:38:34 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/node.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/node.hpp	Thu May 22 14:38:34 2014 -0700
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_OPTO_NODE_HPP
 #define SHARE_VM_OPTO_NODE_HPP
 
-#include "libadt/port.hpp"
 #include "libadt/vectset.hpp"
 #include "opto/compile.hpp"
 #include "opto/type.hpp"
--- a/hotspot/src/share/vm/opto/output.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/output.cpp	Thu May 22 14:38:34 2014 -0700
@@ -366,8 +366,8 @@
   // third inserts nops where needed.
 
   // Step one, perform a pessimistic sizing pass.
-  uint last_call_adr = max_uint;
-  uint last_avoid_back_to_back_adr = max_uint;
+  uint last_call_adr = max_juint;
+  uint last_avoid_back_to_back_adr = max_juint;
   uint nop_size = (new (this) MachNopNode())->size(_regalloc);
   for (uint i = 0; i < nblocks; i++) { // For all blocks
     Block* block = _cfg->get_block(i);
@@ -479,7 +479,7 @@
 
   // Step two, replace eligible long jumps.
   bool progress = true;
-  uint last_may_be_short_branch_adr = max_uint;
+  uint last_may_be_short_branch_adr = max_juint;
   while (has_short_branch_candidate && progress) {
     progress = false;
     has_short_branch_candidate = false;
--- a/hotspot/src/share/vm/opto/parse.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/parse.hpp	Thu May 22 14:38:34 2014 -0700
@@ -581,6 +581,7 @@
   void    jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0);
   bool    create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi);
 
+  void decrement_age();
   // helper functions for methodData style profiling
   void test_counter_against_threshold(Node* cnt, int limit);
   void increment_and_test_invocation_counter(int limit);
--- a/hotspot/src/share/vm/opto/parse1.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Thu May 22 14:38:34 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
@@ -568,6 +568,9 @@
   } else {
     set_map(entry_map);
     do_method_entry();
+    if (depth() == 1 && C->age_code()) {
+      decrement_age();
+    }
   }
   if (depth() == 1) {
     // Add check to deoptimize the nmethod if RTM state was changed
@@ -611,7 +614,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 +1398,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");
@@ -2048,6 +2051,31 @@
 #endif
 }
 
+void Parse::decrement_age() {
+  MethodCounters* mc = method()->ensure_method_counters();
+  if (mc == NULL) {
+    C->record_failure("Must have MCs");
+    return;
+  }
+  assert(!is_osr_parse(), "Not doing this for OSRs");
+
+  // Set starting bci for uncommon trap.
+  set_parse_bci(0);
+
+  const TypePtr* adr_type = TypeRawPtr::make((address)mc);
+  Node* mc_adr = makecon(adr_type);
+  Node* cnt_adr = basic_plus_adr(mc_adr, mc_adr, in_bytes(MethodCounters::nmethod_age_offset()));
+  Node* cnt = make_load(control(), cnt_adr, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
+  Node* decr = _gvn.transform(new (C) SubINode(cnt, makecon(TypeInt::ONE)));
+  store_to_memory(control(), cnt_adr, decr, T_INT, adr_type, MemNode::unordered);
+  Node *chk   = _gvn.transform(new (C) CmpINode(decr, makecon(TypeInt::ZERO)));
+  Node* tst   = _gvn.transform(new (C) BoolNode(chk, BoolTest::gt));
+  { BuildCutout unless(this, tst, PROB_ALWAYS);
+    uncommon_trap(Deoptimization::Reason_tenured,
+                  Deoptimization::Action_make_not_entrant);
+  }
+}
+
 //------------------------------return_current---------------------------------
 // Append current _map to _exit_return
 void Parse::return_current(Node* value) {
--- a/hotspot/src/share/vm/opto/parse2.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/parse2.cpp	Thu May 22 14:38:34 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
@@ -405,9 +405,9 @@
 
   bool needs_guard = false;
   int default_dest;
-  int64 total_outlier_size = 0;
-  int64 hi_size = ((int64)hi->hi()) - ((int64)hi->lo()) + 1;
-  int64 lo_size = ((int64)lo->hi()) - ((int64)lo->lo()) + 1;
+  int64_t total_outlier_size = 0;
+  int64_t hi_size = ((int64_t)hi->hi()) - ((int64_t)hi->lo()) + 1;
+  int64_t lo_size = ((int64_t)lo->hi()) - ((int64_t)lo->lo()) + 1;
 
   if (lo->dest() == hi->dest()) {
     total_outlier_size = hi_size + lo_size;
@@ -429,7 +429,7 @@
   }
 
   // Find the total number of cases and ranges
-  int64 num_cases = ((int64)hi->hi()) - ((int64)lo->lo()) + 1;
+  int64_t num_cases = ((int64_t)hi->hi()) - ((int64_t)lo->lo()) + 1;
   int num_range = hi - lo + 1;
 
   // Don't create table if: too large, too small, or too sparse.
@@ -473,7 +473,7 @@
   // These are the switch destinations hanging off the jumpnode
   int i = 0;
   for (SwitchRange* r = lo; r <= hi; r++) {
-    for (int64 j = r->lo(); j <= r->hi(); j++, i++) {
+    for (int64_t j = r->lo(); j <= r->hi(); j++, i++) {
       Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), (int)(j - lowval)));
       {
         PreserveJVMState pjvms(this);
@@ -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/phase.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/phase.hpp	Thu May 22 14:38:34 2014 -0700
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_OPTO_PHASE_HPP
 #define SHARE_VM_OPTO_PHASE_HPP
 
-#include "libadt/port.hpp"
 #include "runtime/timer.hpp"
 
 class Compile;
--- a/hotspot/src/share/vm/opto/phaseX.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/phaseX.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/regmask.cpp	Thu May 22 14:38:34 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
@@ -51,7 +51,7 @@
 
 //-------------Non-zero bit search methods used by RegMask---------------------
 // Find lowest 1, or return 32 if empty
-int find_lowest_bit( uint32 mask ) {
+int find_lowest_bit( uint32_t mask ) {
   int n = 0;
   if( (mask & 0xffff) == 0 ) {
     mask >>= 16;
@@ -80,7 +80,7 @@
 }
 
 // Find highest 1, or return 32 if empty
-int find_hihghest_bit( uint32 mask ) {
+int find_hihghest_bit( uint32_t mask ) {
   int n = 0;
   if( mask > 0xffff ) {
     mask >>= 16;
@@ -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;
   }
@@ -395,7 +395,7 @@
 //------------------------------Size-------------------------------------------
 // Compute size of register mask in bits
 uint RegMask::Size() const {
-  extern uint8 bitsInByte[256];
+  extern uint8_t bitsInByte[256];
   uint sum = 0;
   for( int i = 0; i < RM_SIZE; i++ )
     sum +=
--- a/hotspot/src/share/vm/opto/regmask.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/regmask.hpp	Thu May 22 14:38:34 2014 -0700
@@ -26,7 +26,6 @@
 #define SHARE_VM_OPTO_REGMASK_HPP
 
 #include "code/vmreg.hpp"
-#include "libadt/port.hpp"
 #include "opto/optoreg.hpp"
 #ifdef TARGET_ARCH_MODEL_x86_32
 # include "adfiles/adGlobals_x86_32.hpp"
@@ -68,9 +67,9 @@
 
 //-------------Non-zero bit search methods used by RegMask---------------------
 // Find lowest 1, or return 32 if empty
-int find_lowest_bit( uint32 mask );
+int find_lowest_bit( uint32_t mask );
 // Find highest 1, or return 32 if empty
-int find_hihghest_bit( uint32 mask );
+int find_hihghest_bit( uint32_t mask );
 
 //------------------------------RegMask----------------------------------------
 // The ADL file describes how to print the machine-specific registers, as well
--- a/hotspot/src/share/vm/opto/runtime.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Thu May 22 14:38:34 2014 -0700
@@ -960,7 +960,7 @@
   } else {
     // Receiver did not match any saved receiver and there is no empty row for it.
     // Increment total counter to indicate polymorphic case.
-    intptr_t* count_p = (intptr_t*)(((byte*)(data)) + in_bytes(CounterData::count_offset()));
+    intptr_t* count_p = (intptr_t*)(((uint8_t*)(data)) + in_bytes(CounterData::count_offset()));
     *count_p += DataLayout::counter_increment;
   }
 JRT_END
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/subnode.cpp	Thu May 22 14:38:34 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
@@ -242,8 +242,8 @@
 const Type *SubINode::sub( const Type *t1, const Type *t2 ) const {
   const TypeInt *r0 = t1->is_int(); // Handy access
   const TypeInt *r1 = t2->is_int();
-  int32 lo = r0->_lo - r1->_hi;
-  int32 hi = r0->_hi - r1->_lo;
+  int32_t lo = r0->_lo - r1->_hi;
+  int32_t hi = r0->_hi - r1->_lo;
 
   // We next check for 32-bit overflow.
   // If that happens, we just assume all integers are possible.
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/type.cpp	Thu May 22 14:38:34 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/opto/type.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/opto/type.hpp	Thu May 22 14:38:34 2014 -0700
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_OPTO_TYPE_HPP
 #define SHARE_VM_OPTO_TYPE_HPP
 
-#include "libadt/port.hpp"
 #include "opto/adlcVMDeps.hpp"
 #include "runtime/handles.hpp"
 
--- a/hotspot/src/share/vm/precompiled/precompiled.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/precompiled/precompiled.hpp	Thu May 22 14:38:34 2014 -0700
@@ -247,7 +247,6 @@
 # include "utilities/yieldingWorkgroup.hpp"
 #ifdef COMPILER2
 # include "libadt/dict.hpp"
-# include "libadt/port.hpp"
 # include "libadt/set.hpp"
 # include "libadt/vectset.hpp"
 # include "opto/addnode.hpp"
--- a/hotspot/src/share/vm/prims/jni.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Thu May 22 14:38:34 2014 -0700
@@ -26,7 +26,7 @@
 #include "classfile/classLoader.hpp"
 #include "classfile/javaAssertions.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnvThreadState.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEventController.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Thu May 22 14:38:34 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
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "compiler/compileBroker.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/oopMapCache.hpp"
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/privilegedStack.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Thu May 22 14:38:34 2014 -0700
@@ -27,7 +27,7 @@
 #include "memory/universe.hpp"
 #include "oops/oop.inline.hpp"
 
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/classLoaderData.hpp"
 
 #include "prims/whitebox.hpp"
@@ -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;
@@ -493,8 +495,8 @@
 
 #ifdef TIERED
     mcs->set_rate(0.0F);
-    mh->set_prev_event_count(0, THREAD);
-    mh->set_prev_time(0, THREAD);
+    mh->set_prev_event_count(0);
+    mh->set_prev_time(0);
 #endif
   }
 WB_END
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Thu May 22 14:38:34 2014 -0700
@@ -75,11 +75,14 @@
 
 // update_rate() is called from select_task() while holding a compile queue lock.
 void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) {
-  JavaThread* THREAD = JavaThread::current();
+  // Skip update if counters are absent.
+  // Can't allocate them since we are holding compile queue lock.
+  if (m->method_counters() == NULL)  return;
+
   if (is_old(m)) {
     // We don't remove old methods from the queue,
     // so we can just zero the rate.
-    m->set_rate(0, THREAD);
+    m->set_rate(0);
     return;
   }
 
@@ -95,14 +98,15 @@
   if (delta_s >= TieredRateUpdateMinTime) {
     // And we must've taken the previous point at least 1ms before.
     if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) {
-      m->set_prev_time(t, THREAD);
-      m->set_prev_event_count(event_count, THREAD);
-      m->set_rate((float)delta_e / (float)delta_t, THREAD); // Rate is events per millisecond
-    } else
+      m->set_prev_time(t);
+      m->set_prev_event_count(event_count);
+      m->set_rate((float)delta_e / (float)delta_t); // Rate is events per millisecond
+    } else {
       if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) {
         // If nothing happened for 25ms, zero the rate. Don't modify prev values.
-        m->set_rate(0, THREAD);
+        m->set_rate(0);
       }
+    }
   }
 }
 
@@ -164,7 +168,6 @@
   for (CompileTask* task = compile_queue->first(); task != NULL;) {
     CompileTask* next_task = task->next();
     Method* method = task->method();
-    MethodData* mdo = method->method_data();
     update_rate(t, method);
     if (max_task == NULL) {
       max_task = task;
@@ -175,8 +178,7 @@
         if (PrintTieredEvents) {
           print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level());
         }
-        CompileTaskWrapper ctw(task); // Frees the task
-        compile_queue->remove(task);
+        compile_queue->remove_and_mark_stale(task);
         method->clear_queued_for_compilation();
         task = next_task;
         continue;
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu May 22 14:38:34 2014 -0700
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/javaAssertions.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
 #include "compiler/compilerOracle.hpp"
 #include "memory/allocation.inline.hpp"
@@ -310,6 +311,7 @@
   { "UseBoundThreads",               JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { "DefaultThreadPriority",         JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { "NoYieldsInMicrolock",           JDK_Version::jdk(9), JDK_Version::jdk(10) },
+  { "BackEdgeThreshold",             JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { NULL, JDK_Version(0), JDK_Version(0) }
 };
 
@@ -852,7 +854,7 @@
     for (int i=0; i < _num_jvm_flags; i++) {
       st->print("%s ", _jvm_flags_array[i]);
     }
-    st->print_cr("");
+    st->cr();
   }
 }
 
@@ -861,7 +863,7 @@
     for (int i=0; i < _num_jvm_args; i++) {
       st->print("%s ", _jvm_args_array[i]);
     }
-    st->print_cr("");
+    st->cr();
   }
 }
 
@@ -1151,6 +1153,32 @@
   }
 }
 
+/**
+ * Returns the minimum number of compiler threads needed to run the JVM. The following
+ * configurations are possible.
+ *
+ * 1) The JVM is build using an interpreter only. As a result, the minimum number of
+ *    compiler threads is 0.
+ * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
+ *    a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
+ * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
+ *    the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
+ *    C1 can be used, so the minimum number of compiler threads is 1.
+ * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
+ *    'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,
+ *    the minimum number of compiler threads is 2.
+ */
+int Arguments::get_min_number_of_compiler_threads() {
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)
+  return 0;   // case 1
+#else
+  if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
+    return 1; // case 2 or case 3
+  }
+  return 2;   // case 4 (tiered)
+#endif
+}
+
 #if INCLUDE_ALL_GCS
 static void disable_adaptive_size_policy(const char* collector_name) {
   if (UseAdaptiveSizePolicy) {
@@ -1349,8 +1377,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
@@ -1430,7 +1458,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;
   }
@@ -1647,8 +1675,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);
   }
 }
 
@@ -1732,7 +1760,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);
   }
@@ -2105,7 +2133,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;
@@ -2398,9 +2426,11 @@
   status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
   status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
 
-  // TieredCompilation needs at least 2 compiler threads.
-  const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : CI_COMPILER_COUNT;
-  status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount");
+  int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
+  // The default CICompilerCount's value is CI_COMPILER_COUNT.
+  assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
+  // Check the minimum number of compiler threads
+  status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
 
   if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
     warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Thu May 22 14:38:34 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
@@ -323,6 +323,7 @@
 
   // Tiered
   static void set_tiered_flags();
+  static int  get_min_number_of_compiler_threads();
   // CMS/ParNew garbage collectors
   static void set_parnew_gc_flags();
   static void set_cms_and_parnew_gc_flags();
--- a/hotspot/src/share/vm/runtime/biasedLocking.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/biasedLocking.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu May 22 14:38:34 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,
@@ -742,6 +744,8 @@
   return 0;
 }
 
+Deoptimization::DeoptAction Deoptimization::_unloaded_action
+  = Deoptimization::Action_reinterpret;
 
 #ifdef COMPILER2
 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS) {
@@ -1183,6 +1187,23 @@
 }
 JRT_END
 
+MethodData*
+Deoptimization::get_method_data(JavaThread* thread, methodHandle m,
+                                bool create_if_missing) {
+  Thread* THREAD = thread;
+  MethodData* mdo = m()->method_data();
+  if (mdo == NULL && create_if_missing && !HAS_PENDING_EXCEPTION) {
+    // Build an MDO.  Ignore errors like OutOfMemory;
+    // that simply means we won't have an MDO to update.
+    Method::build_interpreter_method_data(m, THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
+      CLEAR_PENDING_EXCEPTION;
+    }
+    mdo = m()->method_data();
+  }
+  return mdo;
+}
 
 #if defined(COMPILER2) || defined(SHARK)
 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) {
@@ -1283,7 +1304,7 @@
 
     // Ensure that we can record deopt. history:
     // Need MDO to record RTM code generation state.
-    bool create_if_missing = ProfileTraps RTM_OPT_ONLY( || UseRTMLocking );
+    bool create_if_missing = ProfileTraps || UseCodeAging RTM_OPT_ONLY( || UseRTMLocking );
 
     MethodData* trap_mdo =
       get_method_data(thread, trap_method, create_if_missing);
@@ -1419,7 +1440,7 @@
     //
     // The other actions cause immediate removal of the present code.
 
-    bool update_trap_state = true;
+    bool update_trap_state = (reason != Reason_tenured);
     bool make_not_entrant = false;
     bool make_not_compilable = false;
     bool reprofile = false;
@@ -1546,7 +1567,6 @@
       if (make_not_entrant && maybe_prior_recompile && maybe_prior_trap) {
         reprofile = true;
       }
-
     }
 
     // Take requested actions on the method:
@@ -1575,6 +1595,11 @@
         trap_mdo->atomic_set_rtm_state(ProfileRTM);
       }
 #endif
+      // For code aging we count traps separately here, using make_not_entrant()
+      // as a guard against simultaneous deopts in multiple threads.
+      if (reason == Reason_tenured && trap_mdo != NULL) {
+        trap_mdo->inc_tenure_traps();
+      }
     }
 
     if (inc_recompile_count) {
@@ -1607,24 +1632,6 @@
 }
 JRT_END
 
-MethodData*
-Deoptimization::get_method_data(JavaThread* thread, methodHandle m,
-                                bool create_if_missing) {
-  Thread* THREAD = thread;
-  MethodData* mdo = m()->method_data();
-  if (mdo == NULL && create_if_missing && !HAS_PENDING_EXCEPTION) {
-    // Build an MDO.  Ignore errors like OutOfMemory;
-    // that simply means we won't have an MDO to update.
-    Method::build_interpreter_method_data(m, THREAD);
-    if (HAS_PENDING_EXCEPTION) {
-      assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
-      CLEAR_PENDING_EXCEPTION;
-    }
-    mdo = m()->method_data();
-  }
-  return mdo;
-}
-
 ProfileData*
 Deoptimization::query_update_method_data(MethodData* trap_mdo,
                                          int trap_bci,
@@ -1811,8 +1818,6 @@
 
 
 //--------------------------------statics--------------------------------------
-Deoptimization::DeoptAction Deoptimization::_unloaded_action
-  = Deoptimization::Action_reinterpret;
 const char* Deoptimization::_trap_reason_name[Reason_LIMIT] = {
   // Note:  Keep this in sync. with enum DeoptReason.
   "none",
--- a/hotspot/src/share/vm/runtime/deoptimization.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/deoptimization.hpp	Thu May 22 14:38:34 2014 -0700
@@ -62,6 +62,7 @@
     Reason_speculate_class_check, // saw unexpected object class from type speculation
     Reason_speculate_null_check,  // saw unexpected null from type speculation
     Reason_rtm_state_change,      // rtm state change detected
+    Reason_tenured,               // age of the code has reached the limit
     Reason_LIMIT,
     // Note:  Keep this enum in sync. with _trap_reason_name.
     Reason_RECORDED_LIMIT = Reason_bimorphic  // some are not recorded per bc
@@ -357,8 +358,8 @@
   // returning to a deoptimized caller
   static void popframe_preserve_args(JavaThread* thread, int bytes_to_save, void* start_address);
 
+  static MethodData* get_method_data(JavaThread* thread, methodHandle m, bool create_if_missing);
  private:
-  static MethodData* get_method_data(JavaThread* thread, methodHandle m, bool create_if_missing);
   // Update the mdo's count and per-BCI reason bits, returning previous state:
   static ProfileData* query_update_method_data(MethodData* trap_mdo,
                                                int trap_bci,
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Thu May 22 14:38:34 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/globals.hpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Thu May 22 14:38:34 2014 -0700
@@ -177,7 +177,6 @@
 define_pd_global(bool, TieredCompilation,            false);
 
 define_pd_global(intx, CompileThreshold,             0);
-define_pd_global(intx, BackEdgeThreshold,            0);
 
 define_pd_global(intx, OnStackReplacePercentage,     0);
 define_pd_global(bool, ResizeTLAB,                   false);
@@ -525,13 +524,6 @@
   product_pd(bool, UseMembar,                                               \
           "(Unstable) Issues membars on thread state transitions")          \
                                                                             \
-  /* Temp PPC Flag to allow disabling the use of lwsync on ppc platforms    \
-   * that don't support it.  This will be replaced by processor detection   \
-   * logic.                                                                 \
-   */                                                                       \
-  product(bool, UsePPCLWSYNC, true,                                         \
-          "Use lwsync instruction if true, else use slower sync")           \
-                                                                            \
   develop(bool, CleanChunkPoolAsync, falseInEmbedded,                       \
           "Clean the chunk pool asynchronously")                            \
                                                                             \
@@ -2562,6 +2554,20 @@
   diagnostic(bool, PrintMethodFlushingStatistics, false,                    \
           "print statistics about method flushing")                         \
                                                                             \
+  diagnostic(intx, HotMethodDetectionLimit, 100000,                         \
+          "Number of compiled code invocations after which "                \
+          "the method is considered as hot by the flusher")                 \
+                                                                            \
+  diagnostic(intx, MinPassesBeforeFlush, 10,                                \
+          "Minimum number of sweeper passes before an nmethod "             \
+          "can be flushed")                                                 \
+                                                                            \
+  product(bool, UseCodeAging, true,                                         \
+          "Insert counter to detect warm methods")                          \
+                                                                            \
+  diagnostic(bool, StressCodeAging, false,                                  \
+          "Start with counters compiled in")                                \
+                                                                            \
   develop(bool, UseRelocIndex, false,                                       \
           "Use an index to speed random access to relocations")             \
                                                                             \
@@ -3525,10 +3531,6 @@
   product_pd(intx, CompileThreshold,                                        \
           "number of interpreted method invocations before (re-)compiling") \
                                                                             \
-  product_pd(intx, BackEdgeThreshold,                                       \
-          "Interpreter Back edge threshold at which an OSR compilation is " \
-          "invoked")                                                        \
-                                                                            \
   product(intx, Tier0InvokeNotifyFreqLog, 7,                                \
           "Interpreter (tier 0) invocation notification frequency")         \
                                                                             \
--- a/hotspot/src/share/vm/runtime/handles.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Thu May 22 14:38:34 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/init.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/init.cpp	Thu May 22 14:38:34 2014 -0700
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "code/icBuffer.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "interpreter/bytecodes.hpp"
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/java.cpp	Thu May 22 14:38:34 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
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/classLoader.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "compiler/compileBroker.hpp"
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/mutex.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/os.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/osThread.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/perfData.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp	Thu May 22 14:38:34 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/reflection.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Thu May 22 14:38:34 2014 -0700
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/verifier.hpp"
 #include "classfile/vmSymbols.hpp"
--- a/hotspot/src/share/vm/runtime/safepoint.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp	Thu May 22 14:38:34 2014 -0700
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
@@ -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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/safepoint.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/signature.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/stackValue.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Thu May 22 14:38:34 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__)
@@ -571,37 +573,7 @@
       SWEEP(nm);
     }
   } else {
-    if (UseCodeCacheFlushing) {
-      if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) {
-        // Do not make native methods and OSR-methods not-entrant
-        nm->dec_hotness_counter();
-        // Get the initial value of the hotness counter. This value depends on the
-        // ReservedCodeCacheSize
-        int reset_val = hotness_counter_reset_val();
-        int time_since_reset = reset_val - nm->hotness_counter();
-        double threshold = -reset_val + (CodeCache::reverse_free_ratio() * NmethodSweepActivity);
-        // The less free space in the code cache we have - the bigger reverse_free_ratio() is.
-        // I.e., 'threshold' increases with lower available space in the code cache and a higher
-        // NmethodSweepActivity. If the current hotness counter - which decreases from its initial
-        // value until it is reset by stack walking - is smaller than the computed threshold, the
-        // corresponding nmethod is considered for removal.
-        if ((NmethodSweepActivity > 0) && (nm->hotness_counter() < threshold) && (time_since_reset > 10)) {
-          // A method is marked as not-entrant if the method is
-          // 1) 'old enough': nm->hotness_counter() < threshold
-          // 2) The method was in_use for a minimum amount of time: (time_since_reset > 10)
-          //    The second condition is necessary if we are dealing with very small code cache
-          //    sizes (e.g., <10m) and the code cache size is too small to hold all hot methods.
-          //    The second condition ensures that methods are not immediately made not-entrant
-          //    after compilation.
-          nm->make_not_entrant();
-          // Code cache state change is tracked in make_not_entrant()
-          if (PrintMethodFlushing && Verbose) {
-            tty->print_cr("### Nmethod %d/" PTR_FORMAT "made not-entrant: hotness counter %d/%d threshold %f",
-                          nm->compile_id(), nm, nm->hotness_counter(), reset_val, threshold);
-          }
-        }
-      }
-    }
+    possibly_flush(nm);
     // Clean-up all inline caches that point to zombie/non-reentrant methods
     MutexLocker cl(CompiledIC_lock);
     nm->cleanup_inline_caches();
@@ -610,6 +582,93 @@
   return freed_memory;
 }
 
+
+void NMethodSweeper::possibly_flush(nmethod* nm) {
+  if (UseCodeCacheFlushing) {
+    if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) {
+      bool make_not_entrant = false;
+
+      // Do not make native methods and OSR-methods not-entrant
+      nm->dec_hotness_counter();
+      // Get the initial value of the hotness counter. This value depends on the
+      // ReservedCodeCacheSize
+      int reset_val = hotness_counter_reset_val();
+      int time_since_reset = reset_val - nm->hotness_counter();
+      double threshold = -reset_val + (CodeCache::reverse_free_ratio() * NmethodSweepActivity);
+      // The less free space in the code cache we have - the bigger reverse_free_ratio() is.
+      // I.e., 'threshold' increases with lower available space in the code cache and a higher
+      // NmethodSweepActivity. If the current hotness counter - which decreases from its initial
+      // value until it is reset by stack walking - is smaller than the computed threshold, the
+      // corresponding nmethod is considered for removal.
+      if ((NmethodSweepActivity > 0) && (nm->hotness_counter() < threshold) && (time_since_reset > MinPassesBeforeFlush)) {
+        // A method is marked as not-entrant if the method is
+        // 1) 'old enough': nm->hotness_counter() < threshold
+        // 2) The method was in_use for a minimum amount of time: (time_since_reset > MinPassesBeforeFlush)
+        //    The second condition is necessary if we are dealing with very small code cache
+        //    sizes (e.g., <10m) and the code cache size is too small to hold all hot methods.
+        //    The second condition ensures that methods are not immediately made not-entrant
+        //    after compilation.
+        make_not_entrant = true;
+      }
+
+      // The stack-scanning low-cost detection may not see the method was used (which can happen for
+      // flat profiles). Check the age counter for possible data.
+      if (UseCodeAging && make_not_entrant && (nm->is_compiled_by_c2() || nm->is_compiled_by_c1())) {
+        MethodCounters* mc = nm->method()->method_counters();
+        if (mc == NULL) {
+          // Sometimes we can get here without MethodCounters. For example if we run with -Xcomp.
+          // Try to allocate them.
+          mc = Method::build_method_counters(nm->method(), Thread::current());
+        }
+        if (mc != NULL) {
+          // Snapshot the value as it's changed concurrently
+          int age = mc->nmethod_age();
+          if (MethodCounters::is_nmethod_hot(age)) {
+            // The method has gone through flushing, and it became relatively hot that it deopted
+            // before we could take a look at it. Give it more time to appear in the stack traces,
+            // proportional to the number of deopts.
+            MethodData* md = nm->method()->method_data();
+            if (md != NULL && time_since_reset > (int)(MinPassesBeforeFlush * (md->tenure_traps() + 1))) {
+              // It's been long enough, we still haven't seen it on stack.
+              // Try to flush it, but enable counters the next time.
+              mc->reset_nmethod_age();
+            } else {
+              make_not_entrant = false;
+            }
+          } else if (MethodCounters::is_nmethod_warm(age)) {
+            // Method has counters enabled, and the method was used within
+            // previous MinPassesBeforeFlush sweeps. Reset the counter. Stay in the existing
+            // compiled state.
+            mc->reset_nmethod_age();
+            // delay the next check
+            nm->set_hotness_counter(NMethodSweeper::hotness_counter_reset_val());
+            make_not_entrant = false;
+          } else if (MethodCounters::is_nmethod_age_unset(age)) {
+            // No counters were used before. Set the counters to the detection
+            // limit value. If the method is going to be used again it will be compiled
+            // with counters that we're going to use for analysis the the next time.
+            mc->reset_nmethod_age();
+          } else {
+            // Method was totally idle for 10 sweeps
+            // The counter already has the initial value, flush it and may be recompile
+            // later with counters
+          }
+        }
+      }
+
+      if (make_not_entrant) {
+        nm->make_not_entrant();
+
+        // Code cache state change is tracked in make_not_entrant()
+        if (PrintMethodFlushing && Verbose) {
+          tty->print_cr("### Nmethod %d/" PTR_FORMAT "made not-entrant: hotness counter %d/%d threshold %f",
+              nm->compile_id(), nm, nm->hotness_counter(), reset_val, threshold);
+        }
+      }
+    }
+  }
+}
+
 // Print out some state information about the current sweep and the
 // state of the code cache if it's requested.
 void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
@@ -627,7 +686,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 +703,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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp	Thu May 22 14:38:34 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
@@ -111,6 +111,7 @@
   static int hotness_counter_reset_val();
   static void report_state_change(nmethod* nm);
   static void possibly_enable_sweeper();
+  static void possibly_flush(nmethod* nm);
   static void print();   // Printing/debugging
 };
 
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/timer.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/unhandledOops.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vframe.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vframe.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vframeArray.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp	Thu May 22 14:38:34 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/vmStructs.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu May 22 14:38:34 2014 -0700
@@ -27,6 +27,7 @@
 #include "classfile/javaClasses.hpp"
 #include "classfile/loaderConstraints.hpp"
 #include "classfile/placeholders.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "ci/ciField.hpp"
 #include "ci/ciInstance.hpp"
@@ -361,10 +362,12 @@
   nonstatic_field(MethodData,           _arg_local,                                    intx)                                  \
   nonstatic_field(MethodData,           _arg_stack,                                    intx)                                  \
   nonstatic_field(MethodData,           _arg_returned,                                 intx)                                  \
+  nonstatic_field(MethodData,           _tenure_traps,                                 uint)                                  \
   nonstatic_field(DataLayout,           _header._struct._tag,                          u1)                                    \
   nonstatic_field(DataLayout,           _header._struct._flags,                        u1)                                    \
   nonstatic_field(DataLayout,           _header._struct._bci,                          u2)                                    \
   nonstatic_field(DataLayout,           _cells[0],                                     intptr_t)                              \
+  nonstatic_field(MethodCounters,       _nmethod_age,                                  int)                                   \
   nonstatic_field(MethodCounters,       _interpreter_invocation_count,                 int)                                   \
   nonstatic_field(MethodCounters,       _interpreter_throwout_count,                   u2)                                    \
   nonstatic_field(MethodCounters,       _number_of_breakpoints,                        u2)                                    \
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/attachListener.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/classLoadingService.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/management.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/memReporter.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/memSnapshot.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/memTrackWorker.cpp	Thu May 22 14:38:34 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/nmtDCmd.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/nmtDCmd.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/services/threadService.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/trace/traceStream.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/array.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/bitMap.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/constantTag.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/debug.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/events.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/events.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Thu May 22 14:38:34 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,47 @@
 #define PRAGMA_IMPLEMENTATION        #pragma implementation
 #define VALUE_OBJ_CLASS_SPEC
 
+#ifndef ATTRIBUTE_PRINTF
+// Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
+// were only introduced in GCC 4.2. Because we have no other possibility to ignore
+// these warnings for older versions of GCC, we simply don't decorate our printf-style
+// functions with __attribute__(format) in that case.
+#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)
+#define ATTRIBUTE_PRINTF(fmt,vargs)  __attribute__((format(printf, fmt, vargs)))
+#else
+#define ATTRIBUTE_PRINTF(fmt,vargs)
+#endif
+#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)) || (__GNUC__ > 4)
+// 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/hashtable.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp	Thu May 22 14:38:34 2014 -0700
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
 #include "classfile/javaClasses.hpp"
+#include "classfile/stringTable.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "memory/resourceArea.hpp"
--- a/hotspot/src/share/vm/utilities/numberSeq.cpp	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/numberSeq.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/ostream.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/ostream.hpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/quickSort.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/taskqueue.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/xmlstream.cpp	Thu May 22 14:38:34 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	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/src/share/vm/utilities/xmlstream.hpp	Thu May 22 14:38:34 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/hotspot/test/Makefile	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/test/Makefile	Thu May 22 14:38:34 2014 -0700
@@ -147,6 +147,11 @@
 all: jtreg_tests
 	@$(ECHO) "Testing completed successfully"
 
+# Support "hotspot_" prefixed test make targets too
+# The hotspot_% targets are for example invoked by the top level Makefile
+hotspot_%:
+	$(MAKE) $*
+
 # Prep for output
 prep: clean
 	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
--- a/hotspot/test/TEST.groups	Thu May 22 12:53:50 2014 -0700
+++ b/hotspot/test/TEST.groups	Thu May 22 14:38:34 2014 -0700
@@ -66,7 +66,6 @@
   gc/metaspace/TestMetaspacePerfCounters.java \
   gc/metaspace/TestPerfCountersAndMemoryPools.java \
   runtime/6819213/TestBootNativeLibraryPath.java \
-  runtime/6925573/SortMethodsTest.java \
   runtime/7158988/FieldMonitor.java \
   runtime/7194254/Test7194254.java \
   runtime/Metaspace/FragmentMetaspace.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/duplAttributes/DuplAttributes.jcod	Thu May 22 14:38:34 2014 -0700
@@ -0,0 +1,1310 @@
+/*
+ * 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 file contains ten different sub-tests.  Each sub-test consists of a
+ * class with a different case of an invalid duplicate attribute.  The main
+ * test runs each of these tests individually.  If any of them fail then the
+ * whole test fails.
+ */
+
+
+
+/*
+ * This test contains a class with invalid duplicate AnnotationDefault attributes.
+ */
+class AnnotationDefaultDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "AnnotationDefault"; // #9
+    Utf8 "LAnnotationDefaultI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "AnnotationDefaultDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "AnnotationDefaultDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+
+        Attr(#9) { // AnnotationDefault
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end AnnotationDefault
+    // wrong:
+        ;
+        Attr(#9) { // AnnotationDefault
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end AnnotationDefault
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // AnnotationDefault
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end AnnotationDefault
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a class with invalid duplicate RuntimeInvisibleAnnotations
+ * attributes.
+ */
+class ClassInvisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "RuntimeInvisibleAnnotations"; // #9
+    Utf8 "LClassInvisAnnotsI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "ClassInvisAnnotsDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "ClassInvisAnnotsDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // RuntimeInvisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeInvisibleAnnotations
+// wrong:
+    ;
+    Attr(#9) { // RuntimeInvisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeInvisibleAnnotations
+// end wrong
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a class with invalid duplicate RuntimeVisibleAnnotations
+ * attributes.
+ */
+class ClassVisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "RuntimeVisibleAnnotations"; // #9
+    Utf8 "LClassVisAnnotsI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "ClassVisAnnotsDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "ClassVisAnnotsDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // RuntimeVisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeVisibleAnnotations
+// wrong:
+    ;
+    Attr(#9) { // RuntimeVisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeVisibleAnnotations
+// end wrong
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a field with invalid duplicate RuntimeInvisibleAnnotations
+ * attributes.
+ */
+class FieldInvisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #4 #16; // #1
+    Method #17 #18; // #2
+    class #19; // #3
+    class #20; // #4
+    Utf8 "fld"; // #5
+    Utf8 "Ljava/util/ArrayList;"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "Ljava/util/ArrayList<Ljava/lang/Object;>;"; // #8
+    Utf8 "RuntimeInvisibleAnnotations"; // #9
+    Utf8 "LFieldInvisAnnotsI;"; // #10
+    Utf8 "<init>"; // #11
+    Utf8 "()V"; // #12
+    Utf8 "Code"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #11 #12; // #16
+    class #21; // #17
+    NameAndType #14 #15; // #18
+    Utf8 "FieldInvisAnnotsDup"; // #19
+    Utf8 "java/lang/Object"; // #20
+    Utf8 "FieldInvisAnnotsDupChecker"; // #21
+  } // Constant Pool
+
+  0x0021; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Signature
+          #8;
+        } // end Signature
+        ;
+        Attr(#9) { // RuntimeInvisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeInvisibleAnnotations
+    // wrong:
+        ;
+        Attr(#9) { // RuntimeInvisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeInvisibleAnnotations
+    // end wrong
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #11; // name_cpx
+      #12; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80002AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+  } // Attributes
+} // end class
+
+
+
+/*
+ * This test contains a field with invalid duplicate RuntimeVisibleAnnotations
+ * attributes.
+ */
+class FieldVisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #4 #16; // #1
+    Method #17 #18; // #2
+    class #19; // #3
+    class #20; // #4
+    Utf8 "fld"; // #5
+    Utf8 "Ljava/util/ArrayList;"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "Ljava/util/ArrayList<Ljava/lang/Object;>;"; // #8
+    Utf8 "RuntimeVisibleAnnotations"; // #9
+    Utf8 "LFieldVisAnnotsI;"; // #10
+    Utf8 "<init>"; // #11
+    Utf8 "()V"; // #12
+    Utf8 "Code"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #11 #12; // #16
+    class #21; // #17
+    NameAndType #14 #15; // #18
+    Utf8 "FieldVisAnnotsDup"; // #19
+    Utf8 "java/lang/Object"; // #20
+    Utf8 "FieldVisAnnotsDupChecker"; // #21
+  } // Constant Pool
+
+  0x0021; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Signature
+          #8;
+        } // end Signature
+        ;
+        Attr(#9) { // RuntimeVisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeVisibleAnnotations
+    // wrong:
+        ;
+        Attr(#9) { // RuntimeVisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeVisibleAnnotations
+    // end wrong
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #11; // name_cpx
+      #12; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80002AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+  } // Attributes
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate RuntimeInvisibleAnnotations
+ * attributes.
+ */
+class MethInvisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "RuntimeInvisibleAnnotations"; // #9
+    Utf8 "LMethInvisAnnotsI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "MethInvisAnnotsDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "MethInvisAnnotsDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+
+        Attr(#9) { // RuntimeInvisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeInvisibleAnnotations
+    // wrong:
+        ;
+        Attr(#9) { // RuntimeInvisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeInvisibleAnnotations
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // RuntimeInvisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeInvisibleAnnotations
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate
+ * RuntimeInvisibleParameterAnnotations attributes.
+ */
+class MethInvisParamAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #4 #16; // #1
+    Method #17 #18; // #2
+    class #19; // #3
+    class #20; // #4
+    Utf8 "<init>"; // #5
+    Utf8 "()V"; // #6
+    Utf8 "Code"; // #7
+    Utf8 "m"; // #8
+    Utf8 "()I"; // #9
+    Utf8 "Signature"; // #10
+    Utf8 "<T:Ljava/lang/Object;>()I"; // #11
+    Utf8 "RuntimeInvisibleParameterAnnotations"; // #12
+    Utf8 "LMethInvisParamAnnotsI;"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #5 #6; // #16
+    class #21; // #17
+    NameAndType #14 #15; // #18
+    Utf8 "MethInvisParamAnnotsDup"; // #19
+    Utf8 "java/lang/Object"; // #20
+    Utf8 "MethInvisParamAnnotsDupChecker"; // #21
+  } // Constant Pool
+
+  0x0021; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0001; // access
+      #8; // name_cpx
+      #9; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x03AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+        Attr(#10) { // Signature
+          #11;
+        } // end Signature
+        ;
+        Attr(#12) { // RuntimeInvisibleParameterAnnotations
+          0x0001010000000D00;
+          0x00;
+        } // end RuntimeInvisibleParameterAnnotations
+// wrong:
+        ;
+        Attr(#12) { // RuntimeInvisibleParameterAnnotations
+          0x0001010000000D00;
+          0x00;
+        } // end RuntimeInvisibleParameterAnnotations
+// end wrong
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80002AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+  } // Attributes
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate RuntimeVisibleAnnotations
+ * attributes.
+ */
+class MethVisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "RuntimeVisibleAnnotations"; // #9
+    Utf8 "LMethodVisAnnotsDupI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "MethVisAnnotsDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "MethVisAnnotsDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+
+        Attr(#9) { // RuntimeVisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeVisibleAnnotations
+    // wrong:
+        ;
+        Attr(#9) { // RuntimeVisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeVisibleAnnotations
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // RuntimeVisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeVisibleAnnotations
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate
+ * RuntimeVisibleParameterAnnotations attributes.
+ */
+class MethVisParamAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #4 #16; // #1
+    Method #17 #18; // #2
+    class #19; // #3
+    class #20; // #4
+    Utf8 "<init>"; // #5
+    Utf8 "()V"; // #6
+    Utf8 "Code"; // #7
+    Utf8 "m"; // #8
+    Utf8 "()I"; // #9
+    Utf8 "Signature"; // #10
+    Utf8 "<T:Ljava/lang/Object;>()I"; // #11
+    Utf8 "RuntimeVisibleParameterAnnotations"; // #12
+    Utf8 "LMethVisParamAnnotsI;"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #5 #6; // #16
+    class #21; // #17
+    NameAndType #14 #15; // #18
+    Utf8 "MethVisParamAnnotsDup"; // #19
+    Utf8 "java/lang/Object"; // #20
+    Utf8 "MethVisParamAnnotsDupChecker"; // #21
+  } // Constant Pool
+
+  0x0021; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0001; // access
+      #8; // name_cpx
+      #9; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x03AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+        Attr(#10) { // Signature
+          #11;
+        } // end Signature
+        ;
+        Attr(#12) { // RuntimeVisibleParameterAnnotations
+          0x0001010000000D00;
+          0x00;
+        } // end RuntimeVisibleParameterAnnotations
+// wrong:
+        ;
+        Attr(#12) { // RuntimeVisibleParameterAnnotations
+          0x0001010000000D00;
+          0x00;
+        } // end RuntimeVisibleParameterAnnotations
+// end wrong
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80002AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+  } // Attributes
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate SourceDebugExtension
+ * attributes.
+ */
+class SrcDbgExtDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "SourceDebugExtension"; // #9
+    Utf8 "LSrcDbgExtDupI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "SrcDbgExtDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "SrcDbgExt_dupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // SourceDebugExtension
+      [] { // debug_extensions
+        { // type debug_extension
+          []b { //  type_path
+          }
+        } // type debug_extension
+      } // type debug_extensions
+    } // end SourceDebugExtension
+// wrong:
+    ;
+    Attr(#9) { // SourceDebugExtension
+      [] { // debug_extensions
+        { // type debug_extension
+          []b { //  type_path
+          }
+        } // type debug_extension
+      } // type debug_extensions
+    } // end SourceDebugExtension
+// end wrong
+  } // Attributes
+
+} // end class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java	Thu May 22 14:38:34 2014 -0700
@@ -0,0 +1,63 @@
+/*
+ * 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 8040292
+ * @library /testlibrary
+ * @summary Throw exceptions when duplicate attributes are detected.
+ * @run main DuplAttributesTest
+ */
+
+import java.io.File;
+import com.oracle.java.testlibrary.*;
+
+public class DuplAttributesTest {
+
+    static final String testsrc = System.getProperty("test.src");
+
+    public static void runTest(String test, String result) throws Throwable {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-cp", testsrc + File.separator + "test.jar", test);
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("java.lang.ClassFormatError: Multiple " + result);
+    }
+
+    public static void main(String args[]) throws Throwable {
+        System.out.println("Regression test for bug 8040292");
+
+        runTest("ClassInvisAnnotsDup", "RuntimeInvisibleAnnotations");
+        runTest("ClassVisAnnotsDup", "RuntimeVisibleAnnotations");
+        runTest("SrcDbgExtDup", "SourceDebugExtension");
+
+        runTest("FieldInvisAnnotsDup", "RuntimeInvisibleAnnotations");
+        runTest("FieldVisAnnotsDup", "RuntimeVisibleAnnotations");
+
+        runTest("AnnotationDefaultDup", "AnnotationDefault");
+        runTest("MethInvisAnnotsDup", "RuntimeInvisibleAnnotations");
+        runTest("MethVisAnnotsDup", "RuntimeVisibleAnnotations");
+        runTest("MethInvisParamAnnotsDup", "RuntimeInvisibleParameterAnnotations");
+        runTest("MethVisParamAnnotsDup", "RuntimeVisibleParameterAnnotations");
+    }
+}
+
Binary file hotspot/test/runtime/duplAttributes/test.jar has changed