comparison src/share/vm/memory/universe.cpp @ 10265:92ef81e2f571

8003557: NPG: Klass* const k should be const Klass* k. Summary: With NPG, const KlassOop klass which is in fact a definition converted to Klass* const, which is not the original intention. The right usage is converting them to const Klass*. Reviewed-by: coleenp, kvn Contributed-by: yumin.qi@oracle.com
author minqi
date Fri, 10 May 2013 08:27:30 -0700
parents b06ac540229e
children 0def34ab1c98 ce9ecec70f99
comparison
equal deleted inserted replaced
10262:c272092594bd 10265:92ef81e2f571
1423 _prev_methods = NULL; 1423 _prev_methods = NULL;
1424 } 1424 }
1425 } 1425 }
1426 1426
1427 1427
1428 void ActiveMethodOopsCache::add_previous_version(Method* const method) { 1428 void ActiveMethodOopsCache::add_previous_version(Method* method) {
1429 assert(Thread::current()->is_VM_thread(), 1429 assert(Thread::current()->is_VM_thread(),
1430 "only VMThread can add previous versions"); 1430 "only VMThread can add previous versions");
1431 1431
1432 // Only append the previous method if it is executing on the stack. 1432 // Only append the previous method if it is executing on the stack.
1433 if (method->on_stack()) { 1433 if (method->on_stack()) {
1434 1434
1435 if (_prev_methods == NULL) { 1435 if (_prev_methods == NULL) {
1436 // This is the first previous version so make some space. 1436 // This is the first previous version so make some space.
1437 // Start with 2 elements under the assumption that the class 1437 // Start with 2 elements under the assumption that the class
1438 // won't be redefined much. 1438 // won't be redefined much.
1439 _prev_methods = new (ResourceObj::C_HEAP, mtClass) GrowableArray<Method*>(2, true); 1439 _prev_methods = new (ResourceObj::C_HEAP, mtClass) GrowableArray<Method*>(2, true);
1440 } 1440 }
1441 1441
1442 // RC_TRACE macro has an embedded ResourceMark 1442 // RC_TRACE macro has an embedded ResourceMark
1443 RC_TRACE(0x00000100, 1443 RC_TRACE(0x00000100,
1444 ("add: %s(%s): adding prev version ref for cached method @%d", 1444 ("add: %s(%s): adding prev version ref for cached method @%d",
1445 method->name()->as_C_string(), method->signature()->as_C_string(), 1445 method->name()->as_C_string(), method->signature()->as_C_string(),
1446 _prev_methods->length())); 1446 _prev_methods->length()));
1447 1447
1448 _prev_methods->append(method); 1448 _prev_methods->append(method);
1449 } 1449 }
1450 1450
1451 1451
1462 // This method isn't running anymore so remove it 1462 // This method isn't running anymore so remove it
1463 _prev_methods->remove_at(i); 1463 _prev_methods->remove_at(i);
1464 MetadataFactory::free_metadata(method->method_holder()->class_loader_data(), method); 1464 MetadataFactory::free_metadata(method->method_holder()->class_loader_data(), method);
1465 } else { 1465 } else {
1466 // RC_TRACE macro has an embedded ResourceMark 1466 // RC_TRACE macro has an embedded ResourceMark
1467 RC_TRACE(0x00000400, ("add: %s(%s): previous cached method @%d is alive", 1467 RC_TRACE(0x00000400,
1468 method->name()->as_C_string(), method->signature()->as_C_string(), i)); 1468 ("add: %s(%s): previous cached method @%d is alive",
1469 method->name()->as_C_string(), method->signature()->as_C_string(), i));
1469 } 1470 }
1470 } 1471 }
1471 } // end add_previous_version() 1472 } // end add_previous_version()
1472 1473
1473 1474
1474 bool ActiveMethodOopsCache::is_same_method(Method* const method) const { 1475 bool ActiveMethodOopsCache::is_same_method(const Method* method) const {
1475 InstanceKlass* ik = InstanceKlass::cast(klass()); 1476 InstanceKlass* ik = InstanceKlass::cast(klass());
1476 Method* check_method = ik->method_with_idnum(method_idnum()); 1477 const Method* check_method = ik->method_with_idnum(method_idnum());
1477 assert(check_method != NULL, "sanity check"); 1478 assert(check_method != NULL, "sanity check");
1478 if (check_method == method) { 1479 if (check_method == method) {
1479 // done with the easy case 1480 // done with the easy case
1480 return true; 1481 return true;
1481 } 1482 }