472 }
473
474 void external_word_Relocation::pack_data_to(CodeSection* dest) {
475 short* p = (short*) dest->locs_end();
476 #ifndef _LP64
477 p = pack_1_int_to(p, (int32_t) (intptr_t)_target);
478 #else
479 jlong t = (jlong) _target;
480 int32_t lo = low(t);
481 int32_t hi = high(t);
482 p = pack_2_ints_to(p, lo, hi);
483 #endif /* _LP64 */
484 dest->set_locs_end((relocInfo*) p);
485 }
486
487
488 void external_word_Relocation::unpack_data() {
489 #ifndef _LP64
490 _target = (address) (intptr_t)unpack_1_int();
491 #else
492 int32_t lo, hi;
493 unpack_2_ints(lo, hi);
494 jlong t = jlong_from(hi, lo);;
495 _target = (address) t;
496 #endif /* _LP64 */
497 }
498
499
500 void internal_word_Relocation::pack_data_to(CodeSection* dest) {
501 short* p = (short*) dest->locs_end();
502 normalize_address(_target, dest, true);
503
504 // Check whether my target address is valid within this section.
505 // If not, strengthen the relocation type to point to another section.
506 int sindex = _section;
507 if (sindex == CodeBuffer::SECT_NONE && _target != NULL
508 && (!dest->allocates(_target) || _target == dest->locs_point())) {
509 sindex = dest->outer()->section_index_of(_target);
510 guarantee(sindex != CodeBuffer::SECT_NONE, "must belong somewhere");
511 relocInfo* base = dest->locs_end() - 1;
512 assert(base->type() == this->type(), "sanity");
|
472 }
473
474 void external_word_Relocation::pack_data_to(CodeSection* dest) {
475 short* p = (short*) dest->locs_end();
476 #ifndef _LP64
477 p = pack_1_int_to(p, (int32_t) (intptr_t)_target);
478 #else
479 jlong t = (jlong) _target;
480 int32_t lo = low(t);
481 int32_t hi = high(t);
482 p = pack_2_ints_to(p, lo, hi);
483 #endif /* _LP64 */
484 dest->set_locs_end((relocInfo*) p);
485 }
486
487
488 void external_word_Relocation::unpack_data() {
489 #ifndef _LP64
490 _target = (address) (intptr_t)unpack_1_int();
491 #else
492 jint lo, hi;
493 unpack_2_ints(lo, hi);
494 jlong t = jlong_from(hi, lo);;
495 _target = (address) t;
496 #endif /* _LP64 */
497 }
498
499
500 void internal_word_Relocation::pack_data_to(CodeSection* dest) {
501 short* p = (short*) dest->locs_end();
502 normalize_address(_target, dest, true);
503
504 // Check whether my target address is valid within this section.
505 // If not, strengthen the relocation type to point to another section.
506 int sindex = _section;
507 if (sindex == CodeBuffer::SECT_NONE && _target != NULL
508 && (!dest->allocates(_target) || _target == dest->locs_point())) {
509 sindex = dest->outer()->section_index_of(_target);
510 guarantee(sindex != CodeBuffer::SECT_NONE, "must belong somewhere");
511 relocInfo* base = dest->locs_end() - 1;
512 assert(base->type() == this->type(), "sanity");
|