< prev index next >
src/share/vm/gc/g1/heapRegionRemSet.cpp
Print this page
rev 9830 : [mq]: rev.01
rev 9831 : [mq]: rev.02
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* 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.
@@ -783,19 +783,28 @@
// When concurrent readers access the contains() function
// (during the evacuation phase) no removals are allowed.
void HeapRegionRemSet::add_strong_code_root(nmethod* nm) {
assert(nm != NULL, "sanity");
+ assert((!CodeCache_lock->owned_by_self() || SafepointSynchronize::is_at_safepoint()),
+ "should call add_strong_code_root_locked instead.\n CodeCache_lock->owned_by_self(): %s\n is_at_safepoint(): %s",
+ BOOL_TO_STR(CodeCache_lock->owned_by_self()), BOOL_TO_STR(SafepointSynchronize::is_at_safepoint()));
// Optimistic unlocked contains-check
if (!_code_roots.contains(nm)) {
MutexLockerEx ml(&_m, Mutex::_no_safepoint_check_flag);
add_strong_code_root_locked(nm);
}
}
void HeapRegionRemSet::add_strong_code_root_locked(nmethod* nm) {
assert(nm != NULL, "sanity");
+ assert((CodeCache_lock->owned_by_self() ||
+ (SafepointSynchronize::is_at_safepoint() &&
+ (_m.owned_by_self() || Thread::current()->is_VM_thread()))),
+ "not safely locked.\n CodeCache_lock->owned_by_self(): %s\n is_at_safepoint(): %s\n _m.owned_by_self(): %s\n Thread::current()->is_VM_thread(): %s",
+ BOOL_TO_STR(CodeCache_lock->owned_by_self()), BOOL_TO_STR(SafepointSynchronize::is_at_safepoint()),
+ BOOL_TO_STR(_m.owned_by_self()), BOOL_TO_STR(Thread::current()->is_VM_thread()));
_code_roots.add(nm);
}
void HeapRegionRemSet::remove_strong_code_root(nmethod* nm) {
assert(nm != NULL, "sanity");
< prev index next >