comparison src/share/vm/oops/cpCache.cpp @ 13102:f9f4503a4ab5

Merge
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Thu, 21 Nov 2013 15:04:54 +0100
parents 41cb10cbfb3c
children 3205e78d8193
comparison
equal deleted inserted replaced
13101:790ebab62d23 13102:f9f4503a4ab5
282 // Competing writers must acquire exclusive access via a lock. 282 // Competing writers must acquire exclusive access via a lock.
283 // A losing writer waits on the lock until the winner writes f1 and leaves 283 // A losing writer waits on the lock until the winner writes f1 and leaves
284 // the lock, so that when the losing writer returns, he can use the linked 284 // the lock, so that when the losing writer returns, he can use the linked
285 // cache entry. 285 // cache entry.
286 286
287 oop cplock = cpool->lock(); 287 MonitorLockerEx ml(cpool->lock());
288 ObjectLocker ol(cplock, Thread::current(), cplock != NULL);
289 if (!is_f1_null()) { 288 if (!is_f1_null()) {
290 return; 289 return;
291 } 290 }
292 291
293 const methodHandle adapter = call_info.resolved_method(); 292 const methodHandle adapter = call_info.resolved_method();
553 } 552 }
554 553
555 // Implementation of ConstantPoolCache 554 // Implementation of ConstantPoolCache
556 555
557 ConstantPoolCache* ConstantPoolCache::allocate(ClassLoaderData* loader_data, 556 ConstantPoolCache* ConstantPoolCache::allocate(ClassLoaderData* loader_data,
558 int length,
559 const intStack& index_map, 557 const intStack& index_map,
558 const intStack& invokedynamic_index_map,
560 const intStack& invokedynamic_map, TRAPS) { 559 const intStack& invokedynamic_map, TRAPS) {
560
561 const int length = index_map.length() + invokedynamic_index_map.length();
561 int size = ConstantPoolCache::size(length); 562 int size = ConstantPoolCache::size(length);
562 563
563 return new (loader_data, size, false, MetaspaceObj::ConstantPoolCacheType, THREAD) 564 return new (loader_data, size, false, MetaspaceObj::ConstantPoolCacheType, THREAD)
564 ConstantPoolCache(length, index_map, invokedynamic_map); 565 ConstantPoolCache(length, index_map, invokedynamic_index_map, invokedynamic_map);
565 } 566 }
566 567
567 void ConstantPoolCache::initialize(const intArray& inverse_index_map, 568 void ConstantPoolCache::initialize(const intArray& inverse_index_map,
569 const intArray& invokedynamic_inverse_index_map,
568 const intArray& invokedynamic_references_map) { 570 const intArray& invokedynamic_references_map) {
569 assert(inverse_index_map.length() == length(), "inverse index map must have same length as cache"); 571 for (int i = 0; i < inverse_index_map.length(); i++) {
570 for (int i = 0; i < length(); i++) {
571 ConstantPoolCacheEntry* e = entry_at(i); 572 ConstantPoolCacheEntry* e = entry_at(i);
572 int original_index = inverse_index_map[i]; 573 int original_index = inverse_index_map[i];
573 e->initialize_entry(original_index); 574 e->initialize_entry(original_index);
574 assert(entry_at(i) == e, "sanity"); 575 assert(entry_at(i) == e, "sanity");
575 } 576 }
577
578 // Append invokedynamic entries at the end
579 int invokedynamic_offset = inverse_index_map.length();
580 for (int i = 0; i < invokedynamic_inverse_index_map.length(); i++) {
581 int offset = i + invokedynamic_offset;
582 ConstantPoolCacheEntry* e = entry_at(offset);
583 int original_index = invokedynamic_inverse_index_map[i];
584 e->initialize_entry(original_index);
585 assert(entry_at(offset) == e, "sanity");
586 }
587
576 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) { 588 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
577 const int cpci = invokedynamic_references_map[ref]; 589 const int cpci = invokedynamic_references_map[ref];
578 if (cpci >= 0) { 590 if (cpci >= 0) {
579 #ifdef ASSERT 591 #ifdef ASSERT
580 // invokedynamic and invokehandle have more entries; check if they 592 // invokedynamic and invokehandle have more entries; check if they