comparison src/share/vm/oops/cpCache.cpp @ 13056:41cb10cbfb3c

8025937: assert(existing_f1 == NULL || existing_f1 == f1) failed: illegal field change Summary: Create extra constant pool cache entries for invokespecial/InterfaceMethodref to hold the alternate resolution. Reviewed-by: jrose, lfoltan, hseigel
author coleenp
date Wed, 13 Nov 2013 16:42:24 -0500
parents b8860472c377
children 3205e78d8193
comparison
equal deleted inserted replaced
13055:fce21ac5968d 13056:41cb10cbfb3c
552 } 552 }
553 553
554 // Implementation of ConstantPoolCache 554 // Implementation of ConstantPoolCache
555 555
556 ConstantPoolCache* ConstantPoolCache::allocate(ClassLoaderData* loader_data, 556 ConstantPoolCache* ConstantPoolCache::allocate(ClassLoaderData* loader_data,
557 int length,
558 const intStack& index_map, 557 const intStack& index_map,
558 const intStack& invokedynamic_index_map,
559 const intStack& invokedynamic_map, TRAPS) { 559 const intStack& invokedynamic_map, TRAPS) {
560
561 const int length = index_map.length() + invokedynamic_index_map.length();
560 int size = ConstantPoolCache::size(length); 562 int size = ConstantPoolCache::size(length);
561 563
562 return new (loader_data, size, false, MetaspaceObj::ConstantPoolCacheType, THREAD) 564 return new (loader_data, size, false, MetaspaceObj::ConstantPoolCacheType, THREAD)
563 ConstantPoolCache(length, index_map, invokedynamic_map); 565 ConstantPoolCache(length, index_map, invokedynamic_index_map, invokedynamic_map);
564 } 566 }
565 567
566 void ConstantPoolCache::initialize(const intArray& inverse_index_map, 568 void ConstantPoolCache::initialize(const intArray& inverse_index_map,
569 const intArray& invokedynamic_inverse_index_map,
567 const intArray& invokedynamic_references_map) { 570 const intArray& invokedynamic_references_map) {
568 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++) {
569 for (int i = 0; i < length(); i++) {
570 ConstantPoolCacheEntry* e = entry_at(i); 572 ConstantPoolCacheEntry* e = entry_at(i);
571 int original_index = inverse_index_map[i]; 573 int original_index = inverse_index_map[i];
572 e->initialize_entry(original_index); 574 e->initialize_entry(original_index);
573 assert(entry_at(i) == e, "sanity"); 575 assert(entry_at(i) == e, "sanity");
574 } 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
575 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) { 588 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
576 const int cpci = invokedynamic_references_map[ref]; 589 const int cpci = invokedynamic_references_map[ref];
577 if (cpci >= 0) { 590 if (cpci >= 0) {
578 #ifdef ASSERT 591 #ifdef ASSERT
579 // invokedynamic and invokehandle have more entries; check if they 592 // invokedynamic and invokehandle have more entries; check if they