Mercurial > hg > graal-jvmci-8
comparison src/share/vm/code/relocInfo.hpp @ 14456:abec000618bf
Merge
author | kvn |
---|---|
date | Tue, 28 Jan 2014 12:25:34 -0800 |
parents | 2b8e28fdf503 |
children | d8041d695d19 |
comparison
equal
deleted
inserted
replaced
14269:2a8891e0a082 | 14456:abec000618bf |
---|---|
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, |
362 // many bits are required to represent the value. (In addition, | 363 // many bits are required to represent the value. (In addition, |
363 // if the sole halfword is a 10-bit unsigned number, it is made | 364 // if the sole halfword is a 10-bit unsigned number, it is made |
364 // "immediate" in the prefix header word itself. This optimization | 365 // "immediate" in the prefix header word itself. This optimization |
365 // is invisible outside this module.) | 366 // is invisible outside this module.) |
366 | 367 |
367 inline friend relocInfo prefix_relocInfo(int datalen = 0); | 368 inline friend relocInfo prefix_relocInfo(int datalen); |
368 | 369 |
369 protected: | 370 protected: |
370 // an immediate relocInfo optimizes a prefix with one 10-bit unsigned value | 371 // an immediate relocInfo optimizes a prefix with one 10-bit unsigned value |
371 static relocInfo immediate_relocInfo(int data0) { | 372 static relocInfo immediate_relocInfo(int data0) { |
372 assert(fits_into_immediate(data0), "data0 in limits"); | 373 assert(fits_into_immediate(data0), "data0 in limits"); |
457 | 458 |
458 inline relocInfo filler_relocInfo() { | 459 inline relocInfo filler_relocInfo() { |
459 return relocInfo(relocInfo::none, relocInfo::offset_limit() - relocInfo::offset_unit); | 460 return relocInfo(relocInfo::none, relocInfo::offset_limit() - relocInfo::offset_unit); |
460 } | 461 } |
461 | 462 |
462 inline relocInfo prefix_relocInfo(int datalen) { | 463 inline relocInfo prefix_relocInfo(int datalen = 0) { |
463 assert(relocInfo::fits_into_immediate(datalen), "datalen in limits"); | 464 assert(relocInfo::fits_into_immediate(datalen), "datalen in limits"); |
464 return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen); | 465 return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen); |
465 } | 466 } |
466 | 467 |
467 | 468 |
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) { |