comparison src/share/vm/asm/codeBuffer.cpp @ 4040:754110e02bd5

7103380: assertion failure with -XX:+PrintNativeNMethods Reviewed-by: kvn, iveresov
author never
date Sun, 23 Oct 2011 12:31:20 -0700
parents 79d8657be916
children 44ce519bc3d1
comparison
equal deleted inserted replaced
4009:e5928e7dab26 4040:754110e02bd5
630 // relocs to repair embedded addresses. The layout in the destination 630 // relocs to repair embedded addresses. The layout in the destination
631 // CodeBuffer is different to the source CodeBuffer: the destination 631 // CodeBuffer is different to the source CodeBuffer: the destination
632 // CodeBuffer gets the final layout (consts, insts, stubs in order of 632 // CodeBuffer gets the final layout (consts, insts, stubs in order of
633 // ascending address). 633 // ascending address).
634 void CodeBuffer::relocate_code_to(CodeBuffer* dest) const { 634 void CodeBuffer::relocate_code_to(CodeBuffer* dest) const {
635 DEBUG_ONLY(address dest_end = dest->_total_start + dest->_total_size); 635 address dest_end = dest->_total_start + dest->_total_size;
636 address dest_filled = NULL;
636 for (int n = (int) SECT_FIRST; n < (int) SECT_LIMIT; n++) { 637 for (int n = (int) SECT_FIRST; n < (int) SECT_LIMIT; n++) {
637 // pull code out of each section 638 // pull code out of each section
638 const CodeSection* cs = code_section(n); 639 const CodeSection* cs = code_section(n);
639 if (cs->is_empty()) continue; // skip trivial section 640 if (cs->is_empty()) continue; // skip trivial section
640 CodeSection* dest_cs = dest->code_section(n); 641 CodeSection* dest_cs = dest->code_section(n);
652 // Destination is a final resting place, not just another buffer. 653 // Destination is a final resting place, not just another buffer.
653 // Normalize uninitialized bytes in the final padding. 654 // Normalize uninitialized bytes in the final padding.
654 Copy::fill_to_bytes(dest_cs->end(), dest_cs->remaining(), 655 Copy::fill_to_bytes(dest_cs->end(), dest_cs->remaining(),
655 Assembler::code_fill_byte()); 656 Assembler::code_fill_byte());
656 } 657 }
658 // Keep track of the highest filled address
659 dest_filled = MAX2(dest_filled, dest_cs->end() + dest_cs->remaining());
657 660
658 assert(cs->locs_start() != (relocInfo*)badAddress, 661 assert(cs->locs_start() != (relocInfo*)badAddress,
659 "this section carries no reloc storage, but reloc was attempted"); 662 "this section carries no reloc storage, but reloc was attempted");
660 663
661 // Make the new code copy use the old copy's relocations: 664 // Make the new code copy use the old copy's relocations:
665 RelocIterator iter(dest_cs); 668 RelocIterator iter(dest_cs);
666 while (iter.next()) { 669 while (iter.next()) {
667 iter.reloc()->fix_relocation_after_move(this, dest); 670 iter.reloc()->fix_relocation_after_move(this, dest);
668 } 671 }
669 } 672 }
673 }
674
675 if (dest->blob() == NULL) {
676 // Destination is a final resting place, not just another buffer.
677 // Normalize uninitialized bytes in the final padding.
678 Copy::fill_to_bytes(dest_filled, dest_end - dest_filled,
679 Assembler::code_fill_byte());
680
670 } 681 }
671 } 682 }
672 683
673 csize_t CodeBuffer::figure_expanded_capacities(CodeSection* which_cs, 684 csize_t CodeBuffer::figure_expanded_capacities(CodeSection* which_cs,
674 csize_t amount, 685 csize_t amount,