aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/vm/runtime')
-rw-r--r--src/share/vm/runtime/arguments.cpp7
-rw-r--r--src/share/vm/runtime/globals.cpp12
-rw-r--r--src/share/vm/runtime/globals.hpp26
-rw-r--r--src/share/vm/runtime/globals_ext.hpp56
-rw-r--r--src/share/vm/runtime/globals_extension.hpp4
-rw-r--r--src/share/vm/runtime/simpleThresholdPolicy.cpp41
-rw-r--r--src/share/vm/runtime/simpleThresholdPolicy.hpp2
-rw-r--r--src/share/vm/runtime/thread.cpp16
8 files changed, 132 insertions, 32 deletions
diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp
index b8e514d5c..89f891283 100644
--- a/src/share/vm/runtime/arguments.cpp
+++ b/src/share/vm/runtime/arguments.cpp
@@ -1359,9 +1359,12 @@ void Arguments::set_ergonomics_flags() {
// by ergonomics.
if (MaxHeapSize <= max_heap_for_compressed_oops()) {
#if !defined(COMPILER1) || defined(TIERED)
+// disable UseCompressedOops by default on MacOS X until 7118647 is fixed
+#ifndef __APPLE__
if (FLAG_IS_DEFAULT(UseCompressedOops)) {
FLAG_SET_ERGO(bool, UseCompressedOops, true);
}
+#endif // !__APPLE__
#endif
#ifdef _WIN64
if (UseLargePages && UseCompressedOops) {
@@ -1394,8 +1397,8 @@ void Arguments::set_parallel_gc_flags() {
// If no heap maximum was requested explicitly, use some reasonable fraction
// of the physical memory, up to a maximum of 1GB.
if (UseParallelGC) {
- FLAG_SET_ERGO(uintx, ParallelGCThreads,
- Abstract_VM_Version::parallel_worker_threads());
+ FLAG_SET_DEFAULT(ParallelGCThreads,
+ Abstract_VM_Version::parallel_worker_threads());
// If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
// SurvivorRatio has been set, reset their default values to SurvivorRatio +
diff --git a/src/share/vm/runtime/globals.cpp b/src/share/vm/runtime/globals.cpp
index efce31ac0..028b0958d 100644
--- a/src/share/vm/runtime/globals.cpp
+++ b/src/share/vm/runtime/globals.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,10 +55,13 @@ RUNTIME_OS_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \
MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \
MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG)
+MATERIALIZE_FLAGS_EXT
+
+
bool Flag::is_unlocker() const {
return strcmp(name, "UnlockDiagnosticVMOptions") == 0 ||
- strcmp(name, "UnlockExperimentalVMOptions") == 0;
-
+ strcmp(name, "UnlockExperimentalVMOptions") == 0 ||
+ is_unlocker_ext();
}
bool Flag::is_unlocked() const {
@@ -74,7 +77,7 @@ bool Flag::is_unlocked() const {
strcmp(kind, "{C2 experimental}") == 0) {
return UnlockExperimentalVMOptions;
} else {
- return true;
+ return is_unlocked_ext();
}
}
@@ -241,6 +244,7 @@ static Flag flagTable[] = {
#ifdef SHARK
SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, SHARK_PD_DEVELOP_FLAG_STRUCT, SHARK_PRODUCT_FLAG_STRUCT, SHARK_PD_PRODUCT_FLAG_STRUCT, SHARK_DIAGNOSTIC_FLAG_STRUCT, SHARK_NOTPRODUCT_FLAG_STRUCT)
#endif
+ FLAGTABLE_EXT
{0, NULL, NULL}
};
diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
index f330d44ea..519152558 100644
--- a/src/share/vm/runtime/globals.hpp
+++ b/src/share/vm/runtime/globals.hpp
@@ -243,6 +243,9 @@ struct Flag {
bool is_writeable() const;
bool is_external() const;
+ bool is_unlocker_ext() const;
+ bool is_unlocked_ext() const;
+
void print_on(outputStream* st, bool withComments = false );
void print_as_flag(outputStream* st);
};
@@ -887,7 +890,7 @@ class CommandLineFlags {
diagnostic(bool, TraceNMethodInstalls, false, \
"Trace nmethod intallation") \
\
- diagnostic(intx, ScavengeRootsInCode, 1, \
+ diagnostic(intx, ScavengeRootsInCode, 2, \
"0: do not allow scavengable oops in the code cache; " \
"1: allow scavenging from the code cache; " \
"2: emit as many constants as the compiler can see") \
@@ -1416,6 +1419,21 @@ class CommandLineFlags {
product(uintx, ParallelGCThreads, 0, \
"Number of parallel threads parallel gc will use") \
\
+ product(bool, UseDynamicNumberOfGCThreads, false, \
+ "Dynamically choose the number of parallel threads " \
+ "parallel gc will use") \
+ \
+ diagnostic(bool, ForceDynamicNumberOfGCThreads, false, \
+ "Force dynamic selection of the number of" \
+ "parallel threads parallel gc will use to aid debugging") \
+ \
+ product(uintx, HeapSizePerGCThread, ScaleForWordSize(64*M), \
+ "Size of heap (bytes) per GC thread used in calculating the " \
+ "number of GC threads") \
+ \
+ product(bool, TraceDynamicGCThreads, false, \
+ "Trace the dynamic GC thread usage") \
+ \
develop(bool, ParallelOldGCSplitALot, false, \
"Provoke splitting (copying data from a young gen space to" \
"multiple destination spaces)") \
@@ -2357,7 +2375,7 @@ class CommandLineFlags {
develop(bool, TraceGCTaskQueue, false, \
"Trace actions of the GC task queues") \
\
- develop(bool, TraceGCTaskThread, false, \
+ diagnostic(bool, TraceGCTaskThread, false, \
"Trace actions of the GC task threads") \
\
product(bool, PrintParallelOldGCPhaseTimes, false, \
@@ -3907,4 +3925,8 @@ RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT
RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)
+// Extensions
+
+#include "runtime/globals_ext.hpp"
+
#endif // SHARE_VM_RUNTIME_GLOBALS_HPP
diff --git a/src/share/vm/runtime/globals_ext.hpp b/src/share/vm/runtime/globals_ext.hpp
new file mode 100644
index 000000000..a0f94bc7d
--- /dev/null
+++ b/src/share/vm/runtime/globals_ext.hpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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_RUNTIME_GLOBALS_EXT_HPP
+#define SHARE_VM_RUNTIME_GLOBALS_EXT_HPP
+
+// globals_extension.hpp extension
+
+// Additional CommandLineFlags enum values
+#define COMMANDLINEFLAG_EXT
+
+// Additional CommandLineFlagsWithType enum values
+#define COMMANDLINEFLAGWITHTYPE_EXT
+
+
+// globals.cpp extension
+
+// Additional flag definitions
+#define MATERIALIZE_FLAGS_EXT
+
+// Additional flag descriptors: see flagTable definition
+#define FLAGTABLE_EXT
+
+
+// Default method implementations
+
+inline bool Flag::is_unlocker_ext() const {
+ return false;
+}
+
+inline bool Flag::is_unlocked_ext() const {
+ return true;
+}
+
+#endif // SHARE_VM_RUNTIME_GLOBALS_EXT_HPP
diff --git a/src/share/vm/runtime/globals_extension.hpp b/src/share/vm/runtime/globals_extension.hpp
index c51ede0e7..a87e78168 100644
--- a/src/share/vm/runtime/globals_extension.hpp
+++ b/src/share/vm/runtime/globals_extension.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -93,6 +93,7 @@ typedef enum {
#ifdef COMPILER2
C2_FLAGS(C2_DEVELOP_FLAG_MEMBER, C2_PD_DEVELOP_FLAG_MEMBER, C2_PRODUCT_FLAG_MEMBER, C2_PD_PRODUCT_FLAG_MEMBER, C2_DIAGNOSTIC_FLAG_MEMBER, C2_EXPERIMENTAL_FLAG_MEMBER, C2_NOTPRODUCT_FLAG_MEMBER)
#endif
+ COMMANDLINEFLAG_EXT
NUM_CommandLineFlag
} CommandLineFlag;
@@ -192,6 +193,7 @@ typedef enum {
C2_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE,
C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE)
#endif
+ COMMANDLINEFLAGWITHTYPE_EXT
NUM_CommandLineFlagWithType
} CommandLineFlagWithType;
diff --git a/src/share/vm/runtime/simpleThresholdPolicy.cpp b/src/share/vm/runtime/simpleThresholdPolicy.cpp
index d132c0e96..232da70b0 100644
--- a/src/share/vm/runtime/simpleThresholdPolicy.cpp
+++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp
@@ -30,6 +30,27 @@
#include "runtime/simpleThresholdPolicy.inline.hpp"
#include "code/scopeDesc.hpp"
+
+void SimpleThresholdPolicy::print_counters(const char* prefix, methodHandle mh) {
+ int invocation_count = mh->invocation_count();
+ int backedge_count = mh->backedge_count();
+ methodDataHandle mdh = mh->method_data();
+ int mdo_invocations = 0, mdo_backedges = 0;
+ int mdo_invocations_start = 0, mdo_backedges_start = 0;
+ if (mdh() != NULL) {
+ mdo_invocations = mdh->invocation_count();
+ mdo_backedges = mdh->backedge_count();
+ mdo_invocations_start = mdh->invocation_count_start();
+ mdo_backedges_start = mdh->backedge_count_start();
+ }
+ tty->print(" %stotal: %d,%d %smdo: %d(%d),%d(%d)", prefix,
+ invocation_count, backedge_count, prefix,
+ mdo_invocations, mdo_invocations_start,
+ mdo_backedges, mdo_backedges_start);
+ tty->print(" %smax levels: %d,%d", prefix,
+ mh->highest_comp_level(), mh->highest_osr_comp_level());
+}
+
// Print an event.
void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodHandle imh,
int bci, CompLevel level) {
@@ -38,8 +59,6 @@ void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodH
ttyLocker tty_lock;
tty->print("%lf: [", os::elapsedTime());
- int invocation_count = mh->invocation_count();
- int backedge_count = mh->backedge_count();
switch(type) {
case CALL:
tty->print("call");
@@ -82,23 +101,9 @@ void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodH
print_specific(type, mh, imh, bci, level);
if (type != COMPILE) {
- methodDataHandle mdh = mh->method_data();
- int mdo_invocations = 0, mdo_backedges = 0;
- int mdo_invocations_start = 0, mdo_backedges_start = 0;
- if (mdh() != NULL) {
- mdo_invocations = mdh->invocation_count();
- mdo_backedges = mdh->backedge_count();
- mdo_invocations_start = mdh->invocation_count_start();
- mdo_backedges_start = mdh->backedge_count_start();
- }
- tty->print(" total: %d,%d mdo: %d(%d),%d(%d)",
- invocation_count, backedge_count,
- mdo_invocations, mdo_invocations_start,
- mdo_backedges, mdo_backedges_start);
- tty->print(" max levels: %d,%d",
- mh->highest_comp_level(), mh->highest_osr_comp_level());
+ print_counters("", mh);
if (inlinee_event) {
- tty->print(" inlinee max levels: %d,%d", imh->highest_comp_level(), imh->highest_osr_comp_level());
+ print_counters("inlinee ", imh);
}
tty->print(" compilable: ");
bool need_comma = false;
diff --git a/src/share/vm/runtime/simpleThresholdPolicy.hpp b/src/share/vm/runtime/simpleThresholdPolicy.hpp
index 5aad121c3..1cff0c6cd 100644
--- a/src/share/vm/runtime/simpleThresholdPolicy.hpp
+++ b/src/share/vm/runtime/simpleThresholdPolicy.hpp
@@ -55,7 +55,7 @@ class SimpleThresholdPolicy : public CompilationPolicy {
// loop_event checks if a method should be OSR compiled at a different
// level.
CompLevel loop_event(methodOop method, CompLevel cur_level);
-
+ void print_counters(const char* prefix, methodHandle mh);
protected:
int c1_count() const { return _c1_count; }
int c2_count() const { return _c2_count; }
diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp
index a8cbf854a..da291036e 100644
--- a/src/share/vm/runtime/thread.cpp
+++ b/src/share/vm/runtime/thread.cpp
@@ -778,12 +778,12 @@ bool Thread::claim_oops_do_par_case(int strong_roots_parity) {
return true;
} else {
guarantee(res == strong_roots_parity, "Or else what?");
- assert(SharedHeap::heap()->n_par_threads() > 0,
- "Should only fail when parallel.");
+ assert(SharedHeap::heap()->workers()->active_workers() > 0,
+ "Should only fail when parallel.");
return false;
}
}
- assert(SharedHeap::heap()->n_par_threads() > 0,
+ assert(SharedHeap::heap()->workers()->active_workers() > 0,
"Should only fail when parallel.");
return false;
}
@@ -3939,7 +3939,15 @@ void Threads::possibly_parallel_oops_do(OopClosure* f, CodeBlobClosure* cf) {
// root groups. Overhead should be small enough to use all the time,
// even in sequential code.
SharedHeap* sh = SharedHeap::heap();
- bool is_par = (sh->n_par_threads() > 0);
+ // Cannot yet substitute active_workers for n_par_threads
+ // because of G1CollectedHeap::verify() use of
+ // SharedHeap::process_strong_roots(). n_par_threads == 0 will
+ // turn off parallelism in process_strong_roots while active_workers
+ // is being used for parallelism elsewhere.
+ bool is_par = sh->n_par_threads() > 0;
+ assert(!is_par ||
+ (SharedHeap::heap()->n_par_threads() ==
+ SharedHeap::heap()->workers()->active_workers()), "Mismatch");
int cp = SharedHeap::heap()->strong_roots_parity();
ALL_JAVA_THREADS(p) {
if (p->claim_oops_do(is_par, cp)) {