aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm
diff options
context:
space:
mode:
authortamao <none@none>2013-07-03 14:50:10 -0700
committertamao <none@none>2013-07-03 14:50:10 -0700
commit612b92e8c4f7ce2f3e6d01d42569ef61c779fabb (patch)
tree91c41212b71b618540dbdfcc24a52310e81d1bd6 /src/share/vm
parent1a746c7cd6eecc99a8ac035a5b8b18e69333e810 (diff)
parent4fbfb231147fb27403c93d80867e457787dbc3d7 (diff)
Merge
Diffstat (limited to 'src/share/vm')
-rw-r--r--src/share/vm/gc_implementation/g1/g1CardCounts.cpp7
-rw-r--r--src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp2
-rw-r--r--src/share/vm/runtime/arguments.cpp14
-rw-r--r--src/share/vm/runtime/globals.cpp50
-rw-r--r--src/share/vm/runtime/globals.hpp3
5 files changed, 65 insertions, 11 deletions
diff --git a/src/share/vm/gc_implementation/g1/g1CardCounts.cpp b/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
index 00ea5b548..f75e518fa 100644
--- a/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
+++ b/src/share/vm/gc_implementation/g1/g1CardCounts.cpp
@@ -152,12 +152,9 @@ uint G1CardCounts::add_card_count(jbyte* card_ptr) {
if (card_num < _committed_max_card_num) {
count = (uint) _card_counts[card_num];
if (count < G1ConcRSHotCardLimit) {
- _card_counts[card_num] += 1;
+ _card_counts[card_num] =
+ (jubyte)(MIN2((uintx)(_card_counts[card_num] + 1), G1ConcRSHotCardLimit));
}
- assert(_card_counts[card_num] <= G1ConcRSHotCardLimit,
- err_msg("Refinement count overflow? "
- "new count: "UINT32_FORMAT,
- (uint) _card_counts[card_num]));
}
}
return count;
diff --git a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
index 9cee1eb1b..218be0c0e 100644
--- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
+++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
@@ -47,7 +47,7 @@ void G1SATBCardTableModRefBS::enqueue(oop pre_val) {
JavaThread* jt = (JavaThread*)thr;
jt->satb_mark_queue().enqueue(pre_val);
} else {
- MutexLocker x(Shared_SATB_Q_lock);
+ MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val);
}
}
diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp
index 625feda03..fe3ab30e0 100644
--- a/src/share/vm/runtime/arguments.cpp
+++ b/src/share/vm/runtime/arguments.cpp
@@ -849,7 +849,7 @@ bool Arguments::process_argument(const char* arg,
arg_len = equal_sign - argname;
}
- Flag* found_flag = Flag::find_flag((char*)argname, arg_len, true);
+ Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true);
if (found_flag != NULL) {
char locked_message_buf[BUFLEN];
found_flag->get_locked_message(locked_message_buf, BUFLEN);
@@ -870,6 +870,14 @@ bool Arguments::process_argument(const char* arg,
} else {
jio_fprintf(defaultStream::error_stream(),
"Unrecognized VM option '%s'\n", argname);
+ Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
+ if (fuzzy_matched != NULL) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Did you mean '%s%s%s'?\n",
+ (fuzzy_matched->is_bool()) ? "(+/-)" : "",
+ fuzzy_matched->name,
+ (fuzzy_matched->is_bool()) ? "" : "=<value>");
+ }
}
// allow for commandline "commenting out" options like -XX:#+Verbose
@@ -1571,7 +1579,9 @@ void Arguments::set_heap_base_min_address() {
// By default HeapBaseMinAddress is 2G on all platforms except Solaris x86.
// G1 currently needs a lot of C-heap, so on Solaris we have to give G1
// some extra space for the C-heap compared to other collectors.
- FLAG_SET_ERGO(uintx, HeapBaseMinAddress, 1*G);
+ // Use FLAG_SET_DEFAULT here rather than FLAG_SET_ERGO to make sure that
+ // code that checks for default values work correctly.
+ FLAG_SET_DEFAULT(HeapBaseMinAddress, 1*G);
}
}
diff --git a/src/share/vm/runtime/globals.cpp b/src/share/vm/runtime/globals.cpp
index b45e15c95..a6c47bfe1 100644
--- a/src/share/vm/runtime/globals.cpp
+++ b/src/share/vm/runtime/globals.cpp
@@ -276,14 +276,14 @@ static Flag flagTable[] = {
Flag* Flag::flags = flagTable;
size_t Flag::numFlags = (sizeof(flagTable) / sizeof(Flag));
-inline bool str_equal(const char* s, char* q, size_t len) {
+inline bool str_equal(const char* s, const char* q, size_t len) {
// s is null terminated, q is not!
if (strlen(s) != (unsigned int) len) return false;
return strncmp(s, q, len) == 0;
}
// Search the flag table for a named flag
-Flag* Flag::find_flag(char* name, size_t length, bool allow_locked) {
+Flag* Flag::find_flag(const 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.
@@ -301,6 +301,52 @@ Flag* Flag::find_flag(char* name, size_t length, bool allow_locked) {
return NULL;
}
+// Compute string similarity based on Dice's coefficient
+static float str_similar(const char* str1, const char* str2, size_t len2) {
+ int len1 = (int) strlen(str1);
+ int total = len1 + (int) len2;
+
+ int hit = 0;
+
+ for (int i = 0; i < len1 -1; ++i) {
+ for (int j = 0; j < (int) len2 -1; ++j) {
+ if ((str1[i] == str2[j]) && (str1[i+1] == str2[j+1])) {
+ ++hit;
+ break;
+ }
+ }
+ }
+
+ return 2.0f * (float) hit / (float) total;
+}
+
+Flag* Flag::fuzzy_match(const char* name, size_t length, bool allow_locked) {
+ float VMOptionsFuzzyMatchSimilarity = 0.7f;
+ Flag* match = NULL;
+ float score;
+ float max_score = -1;
+
+ for (Flag* current = &flagTable[0]; current->name != NULL; current++) {
+ score = str_similar(current->name, name, length);
+ if (score > max_score) {
+ max_score = score;
+ match = current;
+ }
+ }
+
+ if (!(match->is_unlocked() || match->is_unlocker())) {
+ if (!allow_locked) {
+ return NULL;
+ }
+ }
+
+ if (max_score < VMOptionsFuzzyMatchSimilarity) {
+ return NULL;
+ }
+
+ return match;
+}
+
// Returns the address of the index'th element
static Flag* address_of_flag(CommandLineFlagWithType flag) {
assert((size_t)flag < Flag::numFlags, "bad command line flag index");
diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
index b1adcf7fc..a8383d9a5 100644
--- a/src/share/vm/runtime/globals.hpp
+++ b/src/share/vm/runtime/globals.hpp
@@ -220,7 +220,8 @@ struct Flag {
// number of flags
static size_t numFlags;
- static Flag* find_flag(char* name, size_t length, bool allow_locked = false);
+ static Flag* find_flag(const char* name, size_t length, bool allow_locked = false);
+ static Flag* fuzzy_match(const 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); }