8008962: NPG: Memory regression: One extra Monitor per ConstantPool

Re-use InstanceKlass::_init_lock locking ConstantPool as well.

Reviewed-by: dholmes, coleenp, acorn
This commit is contained in:
Ioi Lam 2013-04-25 12:55:49 -07:00
parent 333cf9a756
commit 4e19360f89
7 changed files with 61 additions and 51 deletions

View file

@ -259,7 +259,8 @@ JvmtiEnv::RetransformClasses(jint class_count, const jclass* classes) {
// bytes to the InstanceKlass here because they have not been
// validated and we're not at a safepoint.
constantPoolHandle constants(current_thread, ikh->constants());
MonitorLockerEx ml(constants->lock()); // lock constant pool while we query it
oop cplock = constants->lock();
ObjectLocker ol(cplock, current_thread, cplock != NULL); // lock constant pool while we query it
JvmtiClassFileReconstituter reconstituter(ikh);
if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
@ -2417,7 +2418,8 @@ JvmtiEnv::GetConstantPool(oop k_mirror, jint* constant_pool_count_ptr, jint* con
instanceKlassHandle ikh(thread, k_oop);
constantPoolHandle constants(thread, ikh->constants());
MonitorLockerEx ml(constants->lock()); // lock constant pool while we query it
oop cplock = constants->lock();
ObjectLocker ol(cplock, thread, cplock != NULL); // lock constant pool while we query it
JvmtiConstantPoolReconstituter reconstituter(ikh);
if (reconstituter.get_error() != JVMTI_ERROR_NONE) {