899 // This will be useful when we do final assembly into the code cache,
900 // because we will need to know how to warp any internal address that
901 // has been created at any time in this CodeBuffer's past.
902 CodeBuffer* bxp = new CodeBuffer(_total_start, _total_size);
903 bxp->take_over_code_from(this); // remember the old undersized blob
904 DEBUG_ONLY(this->_blob = nullptr); // silence a later assert
905 bxp->_before_expand = this->_before_expand;
906 this->_before_expand = bxp;
907
908 // Give each section its required (expanded) capacity.
909 for (int n = (int)SECT_LIMIT-1; n >= SECT_FIRST; n--) {
910 CodeSection* cb_sect = cb.code_section(n);
911 CodeSection* this_sect = code_section(n);
912 if (new_capacity[n] == 0) continue; // already nulled out
913 if (n != SECT_INSTS) {
914 cb.initialize_section_size(cb_sect, new_capacity[n]);
915 }
916 assert(cb_sect->capacity() >= new_capacity[n], "big enough");
917 address cb_start = cb_sect->start();
918 cb_sect->set_end(cb_start + this_sect->size());
919 if (this_sect->mark() == nullptr) {
920 cb_sect->clear_mark();
921 } else {
922 cb_sect->set_mark(cb_start + this_sect->mark_off());
923 }
924 }
925
926 // Needs to be initialized when calling fix_relocation_after_move.
927 cb.blob()->set_ctable_begin(cb.consts()->start());
928
929 // Move all the code and relocations to the new blob:
930 relocate_code_to(&cb);
931
932 // some internal addresses, _last_insn _last_label, are used during code emission,
933 // adjust them in expansion
934 adjust_internal_address(insts_begin(), cb.insts_begin());
935
936 // Copy the temporary code buffer into the current code buffer.
937 // Basically, do {*this = cb}, except for some control information.
938 this->take_over_code_from(&cb);
|
899 // This will be useful when we do final assembly into the code cache,
900 // because we will need to know how to warp any internal address that
901 // has been created at any time in this CodeBuffer's past.
902 CodeBuffer* bxp = new CodeBuffer(_total_start, _total_size);
903 bxp->take_over_code_from(this); // remember the old undersized blob
904 DEBUG_ONLY(this->_blob = nullptr); // silence a later assert
905 bxp->_before_expand = this->_before_expand;
906 this->_before_expand = bxp;
907
908 // Give each section its required (expanded) capacity.
909 for (int n = (int)SECT_LIMIT-1; n >= SECT_FIRST; n--) {
910 CodeSection* cb_sect = cb.code_section(n);
911 CodeSection* this_sect = code_section(n);
912 if (new_capacity[n] == 0) continue; // already nulled out
913 if (n != SECT_INSTS) {
914 cb.initialize_section_size(cb_sect, new_capacity[n]);
915 }
916 assert(cb_sect->capacity() >= new_capacity[n], "big enough");
917 address cb_start = cb_sect->start();
918 cb_sect->set_end(cb_start + this_sect->size());
919 cb_sect->_skipped_instructions_size = this_sect->_skipped_instructions_size; // FIXME: Upstream this.
920 if (this_sect->mark() == nullptr) {
921 cb_sect->clear_mark();
922 } else {
923 cb_sect->set_mark(cb_start + this_sect->mark_off());
924 }
925 }
926
927 // Needs to be initialized when calling fix_relocation_after_move.
928 cb.blob()->set_ctable_begin(cb.consts()->start());
929
930 // Move all the code and relocations to the new blob:
931 relocate_code_to(&cb);
932
933 // some internal addresses, _last_insn _last_label, are used during code emission,
934 // adjust them in expansion
935 adjust_internal_address(insts_begin(), cb.insts_begin());
936
937 // Copy the temporary code buffer into the current code buffer.
938 // Basically, do {*this = cb}, except for some control information.
939 this->take_over_code_from(&cb);
|