changeset 3335:43dfede919f5

Merge
author asaha
date Mon, 02 Apr 2012 09:29:16 -0700
parents b82c43fba5c0 1b1e6060a7fd
children 77b43af50556
files .hgtags
diffstat 22 files changed, 191 insertions(+), 122 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Mar 27 10:41:03 2012 -0700
+++ b/.hgtags	Mon Apr 02 09:29:16 2012 -0700
@@ -201,6 +201,20 @@
 513a84dd0f8b56dc0836b4e0bdd5dd0a778fc634 hs22-b05
 650d15d8f37255d3b805aa00c5bd1c30984b203d hs22-b06
 8035e71ac3f6c8a453f7e9483e7144731388b14e jdk7u2-b08
+cd3d4ec354fd040c1f47614991b3fe6d5cc5e9da hs22-b07
+b93bc193d73bd4d07150a3e8f85a8ca4bb18157c jdk7u2-b09
+623aec2a90f721fd0de9877bf7be8624874fd557 hs22-b08
+482e282037d780ca48a0eaaa4015b8ae20f0e0a9 jdk7u2-b11
+c8abdaa56b471195aefbac6ee385d7d35b8aec74 hs22-b09
+4061b13e3e6be63b6f157ef773f374f2355fdb48 jdk7u2-b12
+3ba0bb2e7c8ddac172f5b995aae57329cdd2dafa hs22-b10
+f17fe2f4b6aacc19cbb8ee39476f2f13a1c4d3cd jdk7u2-b13
+0744602f85c6fe62255326df595785eb2b32166d jdk7u2-b21
+a40d238623e5b1ab1224ea6b36dc5b23d0a53880 jdk7u3-b02
+6986bfb4c82e00b938c140f2202133350e6e73f8 jdk7u3-b03
+8e6375b46717d74d4885f839b4e72d03f357a45f jdk7u3-b04
+366e6ba09c99d8ec26c6d4b71e079189674a58fe jdk7u3-b20
+4c62237db349e5e151ca60a743b323ef63305947 jdk7u3-b05
 da883b9e6d3788057f9577e72712998ed82c9b7e hs23-b01
 49ed7eacfd16616166ff066493143889741097af jdk8-b08
 7c20d272643f47195478708eff593a9cce40fec4 jdk8-b09
@@ -255,6 +269,10 @@
 1c483d994a78e46c4656b6f3773c7014346d0f19 jdk7u4-b15
 34a4f7687460b1b2bfb1d87191919c5f101aa988 hs23-b17
 c6a96f7a781dd23d2b9fd6353fcd87493616c803 jdk7u4-b16
+418bcab91d2c07c720190d39e1b7f7e39b214994 hs23-b18
+e266ffd6a7d7ccd6e06a442155c5e2457c1884de jdk7u4-b17
+ad5eb0a72fb1d6d7aa6ec7e9cfd06045aef51728 hs23-b19
+f1b786625e0c2ce215d70dda637a127edb2688f2 jdk7u4-b18
 82e719a2e6416838b4421637646cbfd7104c7716 jdk7u6-b01
 6b71938ee832043c337aa837fc0eb3bef088fd52 jdk7u6-b02
 bca9e76ea25409d97d5b0c8f788e673e9cf49a09 jdk7u6-b03
--- a/THIRD_PARTY_README	Tue Mar 27 10:41:03 2012 -0700
+++ b/THIRD_PARTY_README	Mon Apr 02 09:29:16 2012 -0700
@@ -216,15 +216,16 @@
 is included with JRE 7, JDK 7, and OpenJDK 7.
 
 You are receiving a copy of the Elliptic Curve Cryptography library in source
-form with the JDK 7 source distribution and object code in the JRE 7 & JDK 7
-runtime.
-
-The terms of the Oracle license do NOT apply to the Elliptic Curve
-Cryptography library program; it is licensed under the following license,
-separately from the Oracle programs you receive. If you do not wish to install
-this program, you may delete the library named libsunec.so (on Solaris and
-Linux systems) or sunec.dll (on Windows systems) from the JRE bin directory
-reserved for native libraries.
+form with the JDK 7 and OpenJDK7 source distributions, and as object code in
+the JRE 7 & JDK 7 runtimes.
+
+In the case of the JRE 7 & JDK 7 runtimes, the terms of the Oracle license do
+NOT apply to the Elliptic Curve Cryptography library; it is licensed under the
+following license, separately from Oracle's JDK & JRE.  If you do not wish to
+install the Elliptic Curve Cryptography library, you may delete the library
+named libsunec.so (on Solaris and Linux systems) or sunec.dll (on Windows
+systems) from the JRE bin directory reserved for native libraries.
+
 
 --- begin of LICENSE ---
 
@@ -1000,7 +1001,7 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to libpng 1.2.18, which is 
+%% This notice is provided with respect to libpng 1.5.4, which is 
 included with JRE 7, JDK 7, and OpenJDK 7.
 
 --- begin of LICENSE ---
@@ -1014,8 +1015,10 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are
-Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
+This code is released under the libpng license.
+
+libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
+Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
 
@@ -1112,7 +1115,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-May 15, 2007
+July 7, 2011
 
 --- end of LICENSE ---
 
--- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java	Tue Mar 27 10:41:03 2012 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ConnectorImpl.java	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -217,8 +217,8 @@
     }
 
     protected void checkNativeLink(SecurityManager sm, String os) {
-        if (os.equals("SunOS") || os.equals("Linux")) {
-            // link "saproc" - SA native library on SunOS and Linux?
+        if (os.equals("SunOS") || os.equals("Linux") || os.contains("OS X")) {
+            // link "saproc" - SA native library on SunOS, Linux, and Mac OS X
             sm.checkLink("saproc");
         } else if (os.startsWith("Windows")) {
             // link "sawindbg" - SA native library on Windows.
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java	Tue Mar 27 10:41:03 2012 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
       return "bsd";
     } else if (os.equals("OpenBSD")) {
       return "bsd";
-    } else if (os.equals("Darwin") || os.startsWith("Mac OS X")) {
+    } else if (os.equals("Darwin") || os.contains("OS X")) {
       return "bsd";
     } else if (os.startsWith("Windows")) {
       return "win32";
@@ -52,17 +52,17 @@
     }
   }
 
-  /* Returns "sparc" if on SPARC, "x86" if on x86. */
+  /* Returns "sparc" for SPARC based platforms and "x86" for x86 based
+     platforms. Otherwise returns the value of os.arch.  If the value
+     is not recognized as supported, an exception is thrown instead. */
   public static String getCPU() throws UnsupportedPlatformException {
     String cpu = System.getProperty("os.arch");
-    if (cpu.equals("i386")) {
+    if (cpu.equals("i386") || cpu.equals("x86")) {
       return "x86";
-    } else if (cpu.equals("sparc") || cpu.equals("x86") || cpu.equals("ia64")) {
+    } else if (cpu.equals("sparc") || cpu.equals("sparcv9")) {
+      return "sparc";
+    } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) {
       return cpu;
-    } else if (cpu.equals("sparcv9")) {
-      return "sparc";
-    } else if (cpu.equals("x86_64") || cpu.equals("amd64")) {
-      return "amd64";
     } else {
       throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported");
     }
--- a/make/hotspot_version	Tue Mar 27 10:41:03 2012 -0700
+++ b/make/hotspot_version	Mon Apr 02 09:29:16 2012 -0700
@@ -35,11 +35,11 @@
 
 HS_MAJOR_VER=23
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=17
+HS_BUILD_NUMBER=19
 
 JDK_MAJOR_VER=1
-JDK_MINOR_VER=8
+JDK_MINOR_VER=7
 JDK_MICRO_VER=0
 
 # Previous (bootdir) JDK version
-JDK_PREVIOUS_VERSION=1.7.0
+JDK_PREVIOUS_VERSION=1.6.0
--- a/make/jprt.properties	Tue Mar 27 10:41:03 2012 -0700
+++ b/make/jprt.properties	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 
 # This tells jprt what default release we want to build
 
-jprt.hotspot.default.release=jdk7
+jprt.hotspot.default.release=jdk7u4
 
 jprt.tools.default.release=${jprt.submit.option.release?${jprt.submit.option.release}:${jprt.hotspot.default.release}}
 
@@ -54,58 +54,72 @@
 # Define the Solaris platforms we want for the various releases
 jprt.my.solaris.sparc.jdk8=solaris_sparc_5.10
 jprt.my.solaris.sparc.jdk7=solaris_sparc_5.10
+jprt.my.solaris.sparc.jdk7u4=${jprt.my.solaris.sparc.jdk7}
 jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}}
 
 jprt.my.solaris.sparcv9.jdk8=solaris_sparcv9_5.10
 jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10
+jprt.my.solaris.sparcv9.jdk7u4=${jprt.my.solaris.sparcv9.jdk7}
 jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}}
 
 jprt.my.solaris.i586.jdk8=solaris_i586_5.10
 jprt.my.solaris.i586.jdk7=solaris_i586_5.10
+jprt.my.solaris.i586.jdk7u4=${jprt.my.solaris.i586.jdk7}
 jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}}
 
 jprt.my.solaris.x64.jdk8=solaris_x64_5.10
 jprt.my.solaris.x64.jdk7=solaris_x64_5.10
+jprt.my.solaris.x64.jdk7u4=${jprt.my.solaris.x64.jdk7}
 jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}}
 
 jprt.my.linux.i586.jdk8=linux_i586_2.6
 jprt.my.linux.i586.jdk7=linux_i586_2.6
+jprt.my.linux.i586.jdk7u4=${jprt.my.linux.i586.jdk7}
 jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}}
 
 jprt.my.linux.x64.jdk8=linux_x64_2.6
 jprt.my.linux.x64.jdk7=linux_x64_2.6
+jprt.my.linux.x64.jdk7u4=${jprt.my.linux.x64.jdk7}
 jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}}
 
 jprt.my.linux.ppc.jdk8=linux_ppc_2.6
 jprt.my.linux.ppc.jdk7=linux_ppc_2.6
+jprt.my.linux.ppc.jdk7u4=${jprt.my.linux.ppc.jdk7}
 jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}}
 
 jprt.my.linux.ppcv2.jdk8=linux_ppcv2_2.6
 jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6
+jprt.my.linux.ppcv2.jdk7u4=${jprt.my.linux.ppcv2.jdk7}
 jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}}
 
 jprt.my.linux.ppcsflt.jdk8=linux_ppcsflt_2.6
 jprt.my.linux.ppcsflt.jdk7=linux_ppcsflt_2.6
+jprt.my.linux.ppcsflt.jdk7u4=${jprt.my.linux.ppcsflt.jdk7}
 jprt.my.linux.ppcsflt=${jprt.my.linux.ppcsflt.${jprt.tools.default.release}}
 
 jprt.my.linux.armvfp.jdk8=linux_armvfp_2.6
 jprt.my.linux.armvfp.jdk7=linux_armvfp_2.6
+jprt.my.linux.armvfp.jdk7u4=${jprt.my.linux.armvfp.jdk7}
 jprt.my.linux.armvfp=${jprt.my.linux.armvfp.${jprt.tools.default.release}}
 
 jprt.my.linux.armsflt.jdk8=linux_armsflt_2.6
 jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6
+jprt.my.linux.armsflt.jdk7u4=${jprt.my.linux.armsflt.jdk7}
 jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}}
 
 jprt.my.macosx.x64.jdk8=macosx_x64_10.7
 jprt.my.macosx.x64.jdk7=macosx_x64_10.7
+jprt.my.macosx.x64.jdk7u4=${jprt.my.macosx.x64.jdk7}
 jprt.my.macosx.x64=${jprt.my.macosx.x64.${jprt.tools.default.release}}
 
 jprt.my.windows.i586.jdk8=windows_i586_5.1
 jprt.my.windows.i586.jdk7=windows_i586_5.1
+jprt.my.windows.i586.jdk7u4=${jprt.my.windows.i586.jdk7}
 jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
 
 jprt.my.windows.x64.jdk8=windows_x64_5.2
 jprt.my.windows.x64.jdk7=windows_x64_5.2
+jprt.my.windows.x64.jdk7u4=${jprt.my.windows.x64.jdk7}
 jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}}
 
 # Standard list of jprt build targets for this source tree
@@ -139,6 +153,7 @@
 
 jprt.build.targets.jdk8=${jprt.build.targets.all}
 jprt.build.targets.jdk7=${jprt.build.targets.all}
+jprt.build.targets.jdk7u4=${jprt.build.targets.all}
 jprt.build.targets.jdk7temp=${jprt.build.targets.all}
 jprt.build.targets.jdk7b107=${jprt.build.targets.all}
 jprt.build.targets.jdk6=${jprt.build.targets.standard}
@@ -441,6 +456,7 @@
 
 jprt.test.targets.jdk8=${jprt.test.targets.standard}
 jprt.test.targets.jdk7=${jprt.test.targets.standard}
+jprt.test.targets.jdk7u4=${jprt.test.targets.jdk7}
 jprt.test.targets=${jprt.test.targets.${jprt.tools.default.release}}
 
 # The default test/Makefile targets that should be run
@@ -485,5 +501,6 @@
 
 jprt.make.rule.test.targets.jdk8=${jprt.make.rule.test.targets.standard}
 jprt.make.rule.test.targets.jdk7=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk7u4=${jprt.make.rule.test.targets.jdk7}
 jprt.make.rule.test.targets=${jprt.make.rule.test.targets.${jprt.tools.default.release}}
 
--- a/src/os/linux/vm/os_linux.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/os/linux/vm/os_linux.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -4690,14 +4690,12 @@
                      char *addr, size_t bytes, bool read_only,
                      bool allow_exec) {
   int prot;
-  int flags;
+  int flags = MAP_PRIVATE;
 
   if (read_only) {
     prot = PROT_READ;
-    flags = MAP_SHARED;
   } else {
     prot = PROT_READ | PROT_WRITE;
-    flags = MAP_PRIVATE;
   }
 
   if (allow_exec) {
--- a/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,33 +38,36 @@
     _summary_surv_rates(NULL),
     _surv_rate(NULL),
     _accum_surv_rate_pred(NULL),
-    _surv_rate_pred(NULL)
-{
+    _surv_rate_pred(NULL),
+    _stats_arrays_length(0) {
   reset();
   if (summary_surv_rates_len > 0) {
     size_t length = summary_surv_rates_len;
-      _summary_surv_rates = NEW_C_HEAP_ARRAY(NumberSeq*, length);
-    if (_summary_surv_rates == NULL) {
-      vm_exit_out_of_memory(sizeof(NumberSeq*) * length,
-                            "Not enough space for surv rate summary");
+    _summary_surv_rates = NEW_C_HEAP_ARRAY(NumberSeq*, length);
+    for (size_t i = 0; i < length; ++i) {
+      _summary_surv_rates[i] = new NumberSeq();
     }
-    for (size_t i = 0; i < length; ++i)
-      _summary_surv_rates[i] = new NumberSeq();
   }
 
   start_adding_regions();
 }
 
-
-void SurvRateGroup::reset()
-{
+void SurvRateGroup::reset() {
   _all_regions_allocated = 0;
   _setup_seq_num         = 0;
-  _stats_arrays_length   = 0;
   _accum_surv_rate       = 0.0;
   _last_pred             = 0.0;
   // the following will set up the arrays with length 1
   _region_num            = 1;
+
+  // The call to stop_adding_regions() will use "new" to refill
+  // the _surv_rate_pred array, so we need to make sure to call
+  // "delete".
+  for (size_t i = 0; i < _stats_arrays_length; ++i) {
+    delete _surv_rate_pred[i];
+  }
+  _stats_arrays_length = 0;
+
   stop_adding_regions();
   guarantee( _stats_arrays_length == 1, "invariant" );
   guarantee( _surv_rate_pred[0] != NULL, "invariant" );
@@ -73,72 +76,47 @@
   _region_num = 0;
 }
 
-
 void
 SurvRateGroup::start_adding_regions() {
   _setup_seq_num   = _stats_arrays_length;
   _region_num      = 0;
   _accum_surv_rate = 0.0;
-
-#if 0
-  gclog_or_tty->print_cr("[%s] start adding regions, seq num %d, length %d",
-                         _name, _setup_seq_num, _region_num);
-#endif // 0
 }
 
 void
 SurvRateGroup::stop_adding_regions() {
-
-#if 0
-  gclog_or_tty->print_cr("[%s] stop adding regions, length %d", _name, _region_num);
-#endif // 0
-
   if (_region_num > _stats_arrays_length) {
     double* old_surv_rate = _surv_rate;
     double* old_accum_surv_rate_pred = _accum_surv_rate_pred;
     TruncatedSeq** old_surv_rate_pred = _surv_rate_pred;
 
     _surv_rate = NEW_C_HEAP_ARRAY(double, _region_num);
-    if (_surv_rate == NULL) {
-      vm_exit_out_of_memory(sizeof(double) * _region_num,
-                            "Not enough space for surv rate array.");
+    _accum_surv_rate_pred = NEW_C_HEAP_ARRAY(double, _region_num);
+    _surv_rate_pred = NEW_C_HEAP_ARRAY(TruncatedSeq*, _region_num);
+
+    for (size_t i = 0; i < _stats_arrays_length; ++i) {
+      _surv_rate_pred[i] = old_surv_rate_pred[i];
     }
-    _accum_surv_rate_pred = NEW_C_HEAP_ARRAY(double, _region_num);
-    if (_accum_surv_rate_pred == NULL) {
-      vm_exit_out_of_memory(sizeof(double) * _region_num,
-                         "Not enough space for accum surv rate pred array.");
-    }
-    _surv_rate_pred = NEW_C_HEAP_ARRAY(TruncatedSeq*, _region_num);
-    if (_surv_rate == NULL) {
-      vm_exit_out_of_memory(sizeof(TruncatedSeq*) * _region_num,
-                            "Not enough space for surv rate pred array.");
-    }
-
-    for (size_t i = 0; i < _stats_arrays_length; ++i)
-      _surv_rate_pred[i] = old_surv_rate_pred[i];
-
-#if 0
-    gclog_or_tty->print_cr("[%s] stop adding regions, new seqs %d to %d",
-                  _name, _array_length, _region_num - 1);
-#endif // 0
-
     for (size_t i = _stats_arrays_length; i < _region_num; ++i) {
       _surv_rate_pred[i] = new TruncatedSeq(10);
-      // _surv_rate_pred[i]->add(last_pred);
     }
 
     _stats_arrays_length = _region_num;
 
-    if (old_surv_rate != NULL)
+    if (old_surv_rate != NULL) {
       FREE_C_HEAP_ARRAY(double, old_surv_rate);
-    if (old_accum_surv_rate_pred != NULL)
+    }
+    if (old_accum_surv_rate_pred != NULL) {
       FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred);
-    if (old_surv_rate_pred != NULL)
-      FREE_C_HEAP_ARRAY(NumberSeq*, old_surv_rate_pred);
+    }
+    if (old_surv_rate_pred != NULL) {
+      FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred);
+    }
   }
 
-  for (size_t i = 0; i < _stats_arrays_length; ++i)
+  for (size_t i = 0; i < _stats_arrays_length; ++i) {
     _surv_rate[i] = 0.0;
+  }
 }
 
 double
@@ -187,12 +165,6 @@
 SurvRateGroup::all_surviving_words_recorded(bool propagate) {
   if (propagate && _region_num > 0) { // conservative
     double surv_rate = _surv_rate_pred[_region_num-1]->last();
-
-#if 0
-    gclog_or_tty->print_cr("propagating %1.2lf from %d to %d",
-                  surv_rate, _curr_length, _array_length - 1);
-#endif // 0
-
     for (size_t i = _region_num; i < _stats_arrays_length; ++i) {
       guarantee( _surv_rate[i] <= 0.00001,
                  "the slot should not have been updated" );
--- a/src/share/vm/oops/arrayKlass.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/oops/arrayKlass.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -153,6 +153,7 @@
   }
   if (length > arrayOopDesc::max_array_length(T_ARRAY)) {
     report_java_out_of_memory("Requested array size exceeds VM limit");
+    JvmtiExport::post_array_size_exhausted();
     THROW_OOP_0(Universe::out_of_memory_error_array_size());
   }
   int size = objArrayOopDesc::object_size(length);
--- a/src/share/vm/oops/instanceKlass.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/oops/instanceKlass.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -669,6 +669,7 @@
   if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
   if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
     report_java_out_of_memory("Requested array size exceeds VM limit");
+    JvmtiExport::post_array_size_exhausted();
     THROW_OOP_0(Universe::out_of_memory_error_array_size());
   }
   int size = objArrayOopDesc::object_size(length);
--- a/src/share/vm/oops/objArrayKlass.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/oops/objArrayKlass.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,6 +68,7 @@
       return a;
     } else {
       report_java_out_of_memory("Requested array size exceeds VM limit");
+      JvmtiExport::post_array_size_exhausted();
       THROW_OOP_0(Universe::out_of_memory_error_array_size());
     }
   } else {
--- a/src/share/vm/oops/typeArrayKlass.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/oops/typeArrayKlass.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,6 +93,7 @@
       return t;
     } else {
       report_java_out_of_memory("Requested array size exceeds VM limit");
+      JvmtiExport::post_array_size_exhausted();
       THROW_OOP_0(Universe::out_of_memory_error_array_size());
     }
   } else {
--- a/src/share/vm/prims/jvmtiExport.hpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/prims/jvmtiExport.hpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -324,6 +324,12 @@
       record_vm_internal_object_allocation(object);
     }
   }
+  inline static void post_array_size_exhausted() {
+    if (should_post_resource_exhausted()) {
+      post_resource_exhausted(JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR,
+                              "Requested array size exceeds VM limit");
+    }
+  }
 
   static void cleanup_thread             (JavaThread* thread) KERNEL_RETURN;
 
--- a/src/share/vm/runtime/arguments.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -816,8 +816,21 @@
     return true;
   }
 
-  jio_fprintf(defaultStream::error_stream(),
-              "Unrecognized VM option '%s'\n", argname);
+  // For locked flags, report a custom error message if available.
+  // Otherwise, report the standard unrecognized VM option.
+
+  Flag* locked_flag = Flag::find_flag((char*)argname, strlen(argname), true);
+  if (locked_flag != NULL) {
+    char locked_message_buf[BUFLEN];
+    locked_flag->get_locked_message(locked_message_buf, BUFLEN);
+    if (strlen(locked_message_buf) == 0) {
+      jio_fprintf(defaultStream::error_stream(),
+        "Unrecognized VM option '%s'\n", argname);
+    } else {
+      jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
+    }
+  }
+
   // allow for commandline "commenting out" options like -XX:#+Verbose
   return arg[0] == '#';
 }
@@ -2510,15 +2523,6 @@
       // was arrived at by experimenting with specjbb.
       FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K);  // Note: this is in words
 
-      // CompilationPolicyChoice=0 causes the server compiler to adopt
-      // a more conservative which-method-do-I-compile policy when one
-      // of the counters maintained by the interpreter trips.  The
-      // result is reduced startup time and improved specjbb and
-      // alacrity performance.  Zero is the default, but we set it
-      // explicitly here in case the default changes.
-      // See runtime/compilationPolicy.*.
-      FLAG_SET_CMDLINE(intx, CompilationPolicyChoice, 0);
-
       // Enable parallel GC and adaptive generation sizing
       FLAG_SET_CMDLINE(bool, UseParallelGC, true);
       FLAG_SET_DEFAULT(ParallelGCThreads,
--- a/src/share/vm/runtime/globals.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/runtime/globals.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,6 +81,11 @@
   }
 }
 
+// Get custom message for this locked flag, if any.
+void Flag::get_locked_message(char* buf, int buflen) const {
+  get_locked_message_ext(buf, buflen);
+}
+
 bool Flag::is_writeable() const {
   return strcmp(kind, "{manageable}") == 0 ||
          strcmp(kind, "{product rw}") == 0 ||
@@ -260,17 +265,22 @@
   return strncmp(s, q, len) == 0;
 }
 
-Flag* Flag::find_flag(char* name, size_t length) {
-  for (Flag* current = &flagTable[0]; current->name; current++) {
+// Search the flag table for a named flag
+Flag* Flag::find_flag(char* name, size_t length, bool allow_locked) {
+  for (Flag* current = &flagTable[0]; current->name != NULL; current++) {
     if (str_equal(current->name, name, length)) {
+      // Found a matching entry.  Report locked flags only if allowed.
       if (!(current->is_unlocked() || current->is_unlocker())) {
-        // disable use of diagnostic or experimental flags until they
-        // are explicitly unlocked
-        return NULL;
+        if (!allow_locked) {
+          // disable use of locked flags, e.g. diagnostic, experimental,
+          // commercial... until they are explicitly unlocked
+          return NULL;
+        }
       }
       return current;
     }
   }
+  // Flag name is not in the flag table
   return NULL;
 }
 
--- a/src/share/vm/runtime/globals.hpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/runtime/globals.hpp	Mon Apr 02 09:29:16 2012 -0700
@@ -222,7 +222,7 @@
   // number of flags
   static size_t numFlags;
 
-  static Flag* find_flag(char* name, size_t length);
+  static Flag* find_flag(char* name, size_t length, bool allow_locked = false);
 
   bool is_bool() const        { return strcmp(type, "bool") == 0; }
   bool get_bool() const       { return *((bool*) addr); }
@@ -259,6 +259,9 @@
   bool is_writeable_ext() const;
   bool is_external_ext() const;
 
+  void get_locked_message(char*, int) const;
+  void get_locked_message_ext(char*, int) const;
+
   void print_on(outputStream* st, bool withComments = false );
   void print_as_flag(outputStream* st);
 };
--- a/src/share/vm/runtime/globals_ext.hpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/runtime/globals_ext.hpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,4 +61,9 @@
   return false;
 }
 
+inline void Flag::get_locked_message_ext(char* buf, int buflen) const {
+  assert(buf != NULL, "Buffer cannot be NULL");
+  buf[0] = '\0';
+}
+
 #endif // SHARE_VM_RUNTIME_GLOBALS_EXT_HPP
--- a/src/share/vm/runtime/safepoint.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/runtime/safepoint.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -219,6 +219,8 @@
 #ifdef ASSERT
   for (JavaThread *cur = Threads::first(); cur != NULL; cur = cur->next()) {
     assert(cur->safepoint_state()->is_running(), "Illegal initial state");
+    // Clear the visited flag to ensure that the critical counts are collected properly.
+    cur->set_visited_for_critical_count(false);
   }
 #endif // ASSERT
 
@@ -378,6 +380,13 @@
 
   OrderAccess::fence();
 
+#ifdef ASSERT
+  for (JavaThread *cur = Threads::first(); cur != NULL; cur = cur->next()) {
+    // make sure all the threads were visited
+    assert(cur->was_visited_for_critical_count(), "missed a thread");
+  }
+#endif // ASSERT
+
   // Update the count of active JNI critical regions
   GC_locker::set_jni_lock_count(_current_jni_active_count);
 
@@ -626,6 +635,7 @@
         _waiting_to_block--;
         thread->safepoint_state()->set_has_called_back(true);
 
+        DEBUG_ONLY(thread->set_visited_for_critical_count(true));
         if (thread->in_critical()) {
           // Notice that this thread is in a critical section
           increment_jni_active_count();
@@ -907,12 +917,8 @@
   // running, but are actually at a safepoint. We will happily
   // agree and update the safepoint state here.
   if (SafepointSynchronize::safepoint_safe(_thread, state)) {
+    SafepointSynchronize::check_for_lazy_critical_native(_thread, state);
     roll_forward(_at_safepoint);
-    SafepointSynchronize::check_for_lazy_critical_native(_thread, state);
-    if (_thread->in_critical()) {
-      // Notice that this thread is in a critical section
-      SafepointSynchronize::increment_jni_active_count();
-    }
     return;
   }
 
@@ -937,6 +943,11 @@
   switch(_type) {
     case _at_safepoint:
       SafepointSynchronize::signal_thread_at_safepoint();
+      DEBUG_ONLY(_thread->set_visited_for_critical_count(true));
+      if (_thread->in_critical()) {
+        // Notice that this thread is in a critical section
+        SafepointSynchronize::increment_jni_active_count();
+      }
       break;
 
     case _call_back:
--- a/src/share/vm/runtime/thread.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/runtime/thread.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -247,6 +247,10 @@
   omInUseList = NULL ;
   omInUseCount = 0 ;
 
+#ifdef ASSERT
+  _visited_for_critical_count = false;
+#endif
+
   _SR_lock = new Monitor(Mutex::suspend_resume, "SR_lock", true);
   _suspend_flags = 0;
 
--- a/src/share/vm/runtime/thread.hpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/runtime/thread.hpp	Mon Apr 02 09:29:16 2012 -0700
@@ -268,6 +268,15 @@
   ObjectMonitor* omInUseList;                   // SLL to track monitors in circulation
   int omInUseCount;                             // length of omInUseList
 
+#ifdef ASSERT
+ private:
+  bool _visited_for_critical_count;
+
+ public:
+  void set_visited_for_critical_count(bool z) { _visited_for_critical_count = z; }
+  bool was_visited_for_critical_count() const   { return _visited_for_critical_count; }
+#endif
+
  public:
   enum {
     is_definitely_current_thread = true
--- a/src/share/vm/utilities/numberSeq.cpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/utilities/numberSeq.cpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -156,6 +156,10 @@
     _sequence[i] = 0.0;
 }
 
+TruncatedSeq::~TruncatedSeq() {
+  FREE_C_HEAP_ARRAY(double, _sequence);
+}
+
 void TruncatedSeq::add(double val) {
   AbsSeq::add(val);
 
--- a/src/share/vm/utilities/numberSeq.hpp	Tue Mar 27 10:41:03 2012 -0700
+++ b/src/share/vm/utilities/numberSeq.hpp	Mon Apr 02 09:29:16 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,6 +118,7 @@
   // accepts a value for L
   TruncatedSeq(int length = DefaultSeqLength,
                double alpha = DEFAULT_ALPHA_VALUE);
+  ~TruncatedSeq();
   virtual void add(double val);
   virtual double maximum() const;
   virtual double last() const; // the last value added to the sequence