< prev index next >

src/share/vm/asm/codeBuffer.cpp

Print this page
rev 12121 : [mq]: all_changes.patch


 730   if (buf != NULL) {
 731     RelocIterator::create_index(dest->relocation_begin(),
 732                                 buf_offset / sizeof(relocInfo),
 733                                 dest->relocation_end());
 734   }
 735 
 736   return buf_offset;
 737 }
 738 
 739 void CodeBuffer::copy_code_to(CodeBlob* dest_blob) {
 740 #ifndef PRODUCT
 741   if (PrintNMethods && (WizardMode || Verbose)) {
 742     tty->print("done with CodeBuffer:");
 743     ((CodeBuffer*)this)->print();
 744   }
 745 #endif //PRODUCT
 746 
 747   CodeBuffer dest(dest_blob);
 748   assert(dest_blob->content_size() >= total_content_size(), "good sizing");
 749   this->compute_final_layout(&dest);




 750   relocate_code_to(&dest);
 751 
 752   // transfer strings and comments from buffer to blob
 753   dest_blob->set_strings(_code_strings);
 754 
 755   // Done moving code bytes; were they the right size?
 756   assert(round_to(dest.total_content_size(), oopSize) == dest_blob->content_size(), "sanity");
 757 
 758   // Flush generated code
 759   ICache::invalidate_range(dest_blob->code_begin(), dest_blob->code_size());
 760 }
 761 
 762 // Move all my code into another code buffer.  Consult applicable
 763 // relocs to repair embedded addresses.  The layout in the destination
 764 // CodeBuffer is different to the source CodeBuffer: the destination
 765 // CodeBuffer gets the final layout (consts, insts, stubs in order of
 766 // ascending address).
 767 void CodeBuffer::relocate_code_to(CodeBuffer* dest) const {
 768   address dest_end = dest->_total_start + dest->_total_size;
 769   address dest_filled = NULL;


 922   bxp->_before_expand = this->_before_expand;
 923   this->_before_expand = bxp;
 924 
 925   // Give each section its required (expanded) capacity.
 926   for (int n = (int)SECT_LIMIT-1; n >= SECT_FIRST; n--) {
 927     CodeSection* cb_sect   = cb.code_section(n);
 928     CodeSection* this_sect = code_section(n);
 929     if (new_capacity[n] == 0)  continue;  // already nulled out
 930     if (n != SECT_INSTS) {
 931       cb.initialize_section_size(cb_sect, new_capacity[n]);
 932     }
 933     assert(cb_sect->capacity() >= new_capacity[n], "big enough");
 934     address cb_start = cb_sect->start();
 935     cb_sect->set_end(cb_start + this_sect->size());
 936     if (this_sect->mark() == NULL) {
 937       cb_sect->clear_mark();
 938     } else {
 939       cb_sect->set_mark(cb_start + this_sect->mark_off());
 940     }
 941   }



 942 
 943   // Move all the code and relocations to the new blob:
 944   relocate_code_to(&cb);
 945 
 946   // Copy the temporary code buffer into the current code buffer.
 947   // Basically, do {*this = cb}, except for some control information.
 948   this->take_over_code_from(&cb);
 949   cb.set_blob(NULL);
 950 
 951   // Zap the old code buffer contents, to avoid mistakenly using them.
 952   debug_only(Copy::fill_to_bytes(bxp->_total_start, bxp->_total_size,
 953                                  badCodeHeapFreeVal));
 954 
 955   _decode_begin = NULL;  // sanity
 956 
 957   // Make certain that the new sections are all snugly inside the new blob.
 958   verify_section_allocation();
 959 
 960 #ifndef PRODUCT
 961   if (PrintNMethods && (WizardMode || Verbose)) {




 730   if (buf != NULL) {
 731     RelocIterator::create_index(dest->relocation_begin(),
 732                                 buf_offset / sizeof(relocInfo),
 733                                 dest->relocation_end());
 734   }
 735 
 736   return buf_offset;
 737 }
 738 
 739 void CodeBuffer::copy_code_to(CodeBlob* dest_blob) {
 740 #ifndef PRODUCT
 741   if (PrintNMethods && (WizardMode || Verbose)) {
 742     tty->print("done with CodeBuffer:");
 743     ((CodeBuffer*)this)->print();
 744   }
 745 #endif //PRODUCT
 746 
 747   CodeBuffer dest(dest_blob);
 748   assert(dest_blob->content_size() >= total_content_size(), "good sizing");
 749   this->compute_final_layout(&dest);
 750 
 751   // Set beginning of constant table before relocating.
 752   dest_blob->set_ctable_begin(dest.consts()->start());
 753 
 754   relocate_code_to(&dest);
 755 
 756   // transfer strings and comments from buffer to blob
 757   dest_blob->set_strings(_code_strings);
 758 
 759   // Done moving code bytes; were they the right size?
 760   assert(round_to(dest.total_content_size(), oopSize) == dest_blob->content_size(), "sanity");
 761 
 762   // Flush generated code
 763   ICache::invalidate_range(dest_blob->code_begin(), dest_blob->code_size());
 764 }
 765 
 766 // Move all my code into another code buffer.  Consult applicable
 767 // relocs to repair embedded addresses.  The layout in the destination
 768 // CodeBuffer is different to the source CodeBuffer: the destination
 769 // CodeBuffer gets the final layout (consts, insts, stubs in order of
 770 // ascending address).
 771 void CodeBuffer::relocate_code_to(CodeBuffer* dest) const {
 772   address dest_end = dest->_total_start + dest->_total_size;
 773   address dest_filled = NULL;


 926   bxp->_before_expand = this->_before_expand;
 927   this->_before_expand = bxp;
 928 
 929   // Give each section its required (expanded) capacity.
 930   for (int n = (int)SECT_LIMIT-1; n >= SECT_FIRST; n--) {
 931     CodeSection* cb_sect   = cb.code_section(n);
 932     CodeSection* this_sect = code_section(n);
 933     if (new_capacity[n] == 0)  continue;  // already nulled out
 934     if (n != SECT_INSTS) {
 935       cb.initialize_section_size(cb_sect, new_capacity[n]);
 936     }
 937     assert(cb_sect->capacity() >= new_capacity[n], "big enough");
 938     address cb_start = cb_sect->start();
 939     cb_sect->set_end(cb_start + this_sect->size());
 940     if (this_sect->mark() == NULL) {
 941       cb_sect->clear_mark();
 942     } else {
 943       cb_sect->set_mark(cb_start + this_sect->mark_off());
 944     }
 945   }
 946 
 947   // Needs to be initialized when calling fix_relocation_after_move.
 948   cb.blob()->set_ctable_begin(cb.consts()->start());
 949 
 950   // Move all the code and relocations to the new blob:
 951   relocate_code_to(&cb);
 952 
 953   // Copy the temporary code buffer into the current code buffer.
 954   // Basically, do {*this = cb}, except for some control information.
 955   this->take_over_code_from(&cb);
 956   cb.set_blob(NULL);
 957 
 958   // Zap the old code buffer contents, to avoid mistakenly using them.
 959   debug_only(Copy::fill_to_bytes(bxp->_total_start, bxp->_total_size,
 960                                  badCodeHeapFreeVal));
 961 
 962   _decode_begin = NULL;  // sanity
 963 
 964   // Make certain that the new sections are all snugly inside the new blob.
 965   verify_section_allocation();
 966 
 967 #ifndef PRODUCT
 968   if (PrintNMethods && (WizardMode || Verbose)) {


< prev index next >