Mercurial > hg > graal-compiler
comparison src/share/vm/asm/codeBuffer.cpp @ 7197:1acccb7c0b01
8003850: add support for constants in stub code
Summary: remember the code section and switch back to the proper one when adding constants.
Reviewed-by: twisti, kvn
Contributed-by: goetz.lindenmaier@sap.com
author | kvn |
---|---|
date | Tue, 27 Nov 2012 17:41:38 -0800 |
parents | a3e2f723f2a5 |
children | cd3d6a6b95d9 |
comparison
equal
deleted
inserted
replaced
7196:2aff40cb4703 | 7197:1acccb7c0b01 |
---|---|
747 assert(cs->locs_start() != (relocInfo*)badAddress, | 747 assert(cs->locs_start() != (relocInfo*)badAddress, |
748 "this section carries no reloc storage, but reloc was attempted"); | 748 "this section carries no reloc storage, but reloc was attempted"); |
749 | 749 |
750 // Make the new code copy use the old copy's relocations: | 750 // Make the new code copy use the old copy's relocations: |
751 dest_cs->initialize_locs_from(cs); | 751 dest_cs->initialize_locs_from(cs); |
752 | 752 } |
753 | |
754 // Do relocation after all sections are copied. | |
755 // This is necessary if the code uses constants in stubs, which are | |
756 // relocated when the corresponding instruction in the code (e.g., a | |
757 // call) is relocated. Stubs are placed behind the main code | |
758 // section, so that section has to be copied before relocating. | |
759 for (int n = (int) SECT_FIRST; n < (int)SECT_LIMIT; n++) { | |
760 // pull code out of each section | |
761 const CodeSection* cs = code_section(n); | |
762 if (cs->is_empty()) continue; // skip trivial section | |
763 CodeSection* dest_cs = dest->code_section(n); | |
753 { // Repair the pc relative information in the code after the move | 764 { // Repair the pc relative information in the code after the move |
754 RelocIterator iter(dest_cs); | 765 RelocIterator iter(dest_cs); |
755 while (iter.next()) { | 766 while (iter.next()) { |
756 iter.reloc()->fix_relocation_after_move(this, dest); | 767 iter.reloc()->fix_relocation_after_move(this, dest); |
757 } | 768 } |