Mercurial > hg > graal-jvmci-8
comparison src/share/vm/code/relocInfo.hpp @ 14397:53fa76359eb1
8016696: PPC64 (part 4): add relocation for trampoline stubs
Summary: A trampoline allows to encode a small branch in the code, even if there is the chance that this branch can not reach all possible code locations. If the relocation finds that a branch is too far for the instruction in the code, it can patch it to jump to the trampoline where is sufficient space for a far branch. Needed on PPC.
Reviewed-by: kvn, bdelsart, jrose
author | goetz |
---|---|
date | Thu, 04 Jul 2013 10:51:31 +0200 |
parents | 7875ea94bea5 |
children | bdd155477289 |
comparison
equal
deleted
inserted
replaced
14396:583211d4b16b | 14397:53fa76359eb1 |
---|---|
258 internal_word_type = 8, // reference within the current code blob | 258 internal_word_type = 8, // reference within the current code blob |
259 section_word_type = 9, // internal, but a cross-section reference | 259 section_word_type = 9, // internal, but a cross-section reference |
260 poll_type = 10, // polling instruction for safepoints | 260 poll_type = 10, // polling instruction for safepoints |
261 poll_return_type = 11, // polling instruction for safepoints at return | 261 poll_return_type = 11, // polling instruction for safepoints at return |
262 metadata_type = 12, // metadata that used to be oops | 262 metadata_type = 12, // metadata that used to be oops |
263 yet_unused_type_1 = 13, // Still unused | 263 trampoline_stub_type = 13, // stub-entry for trampoline |
264 yet_unused_type_2 = 14, // Still unused | 264 yet_unused_type_1 = 14, // Still unused |
265 data_prefix_tag = 15, // tag for a prefix (carries data arguments) | 265 data_prefix_tag = 15, // tag for a prefix (carries data arguments) |
266 type_mask = 15 // A mask which selects only the above values | 266 type_mask = 15 // A mask which selects only the above values |
267 }; | 267 }; |
268 | 268 |
269 protected: | 269 protected: |
299 visitor(external_word) \ | 299 visitor(external_word) \ |
300 visitor(internal_word) \ | 300 visitor(internal_word) \ |
301 visitor(poll) \ | 301 visitor(poll) \ |
302 visitor(poll_return) \ | 302 visitor(poll_return) \ |
303 visitor(section_word) \ | 303 visitor(section_word) \ |
304 visitor(trampoline_stub) \ | |
304 | 305 |
305 | 306 |
306 public: | 307 public: |
307 enum { | 308 enum { |
308 value_width = sizeof(unsigned short) * BitsPerByte, | 309 value_width = sizeof(unsigned short) * BitsPerByte, |
1148 runtime_call_Relocation() { } | 1149 runtime_call_Relocation() { } |
1149 | 1150 |
1150 public: | 1151 public: |
1151 }; | 1152 }; |
1152 | 1153 |
1154 // Trampoline Relocations. | |
1155 // A trampoline allows to encode a small branch in the code, even if there | |
1156 // is the chance that this branch can not reach all possible code locations. | |
1157 // If the relocation finds that a branch is too far for the instruction | |
1158 // in the code, it can patch it to jump to the trampoline where is | |
1159 // sufficient space for a far branch. Needed on PPC. | |
1160 class trampoline_stub_Relocation : public Relocation { | |
1161 relocInfo::relocType type() { return relocInfo::trampoline_stub_type; } | |
1162 | |
1163 public: | |
1164 static RelocationHolder spec(address static_call) { | |
1165 RelocationHolder rh = newHolder(); | |
1166 return (new (rh) trampoline_stub_Relocation(static_call)); | |
1167 } | |
1168 | |
1169 private: | |
1170 address _owner; // Address of the NativeCall that owns the trampoline. | |
1171 | |
1172 trampoline_stub_Relocation(address owner) { | |
1173 _owner = owner; | |
1174 } | |
1175 | |
1176 friend class RelocIterator; | |
1177 trampoline_stub_Relocation() { } | |
1178 | |
1179 public: | |
1180 | |
1181 // Return the address of the NativeCall that owns the trampoline. | |
1182 address owner() { return _owner; } | |
1183 | |
1184 void pack_data_to(CodeSection * dest); | |
1185 void unpack_data(); | |
1186 | |
1187 // Find the trampoline stub for a call. | |
1188 static address get_trampoline_for(address call, nmethod* code); | |
1189 }; | |
1190 | |
1153 class external_word_Relocation : public DataRelocation { | 1191 class external_word_Relocation : public DataRelocation { |
1154 relocInfo::relocType type() { return relocInfo::external_word_type; } | 1192 relocInfo::relocType type() { return relocInfo::external_word_type; } |
1155 | 1193 |
1156 public: | 1194 public: |
1157 static RelocationHolder spec(address target) { | 1195 static RelocationHolder spec(address target) { |