652 cbuf.insts()->emit_int64(d64); 653 } 654 655 // emit 32 bit value and construct relocation entry from relocInfo::relocType 656 void emit_d32_reloc(CodeBuffer& cbuf, 657 int d32, 658 relocInfo::relocType reloc, 659 int format) 660 { 661 assert(reloc != relocInfo::external_word_type, "use 2-arg emit_d32_reloc"); 662 cbuf.relocate(cbuf.insts_mark(), reloc, format); 663 cbuf.insts()->emit_int32(d32); 664 } 665 666 // emit 32 bit value and construct relocation entry from RelocationHolder 667 void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, int format) { 668 #ifdef ASSERT 669 if (rspec.reloc()->type() == relocInfo::oop_type && 670 d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) { 671 assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop"); 672 assert(oopDesc::is_oop(cast_to_oop((intptr_t)d32)) && (ScavengeRootsInCode || !cast_to_oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code"); 673 } 674 #endif 675 cbuf.relocate(cbuf.insts_mark(), rspec, format); 676 cbuf.insts()->emit_int32(d32); 677 } 678 679 void emit_d32_reloc(CodeBuffer& cbuf, address addr) { 680 address next_ip = cbuf.insts_end() + 4; 681 emit_d32_reloc(cbuf, (int) (addr - next_ip), 682 external_word_Relocation::spec(addr), 683 RELOC_DISP32); 684 } 685 686 687 // emit 64 bit value and construct relocation entry from relocInfo::relocType 688 void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, relocInfo::relocType reloc, int format) { 689 cbuf.relocate(cbuf.insts_mark(), reloc, format); 690 cbuf.insts()->emit_int64(d64); 691 } 692 693 // emit 64 bit value and construct relocation entry from RelocationHolder 694 void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec, int format) { 695 #ifdef ASSERT 696 if (rspec.reloc()->type() == relocInfo::oop_type && 697 d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) { 698 assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop"); 699 assert(oopDesc::is_oop(cast_to_oop(d64)) && (ScavengeRootsInCode || !cast_to_oop(d64)->is_scavengable()), 700 "cannot embed scavengable oops in code"); 701 } 702 #endif 703 cbuf.relocate(cbuf.insts_mark(), rspec, format); 704 cbuf.insts()->emit_int64(d64); 705 } 706 707 // Access stack slot for load or store 708 void store_to_stackslot(CodeBuffer &cbuf, int opcode, int rm_field, int disp) 709 { 710 emit_opcode(cbuf, opcode); // (e.g., FILD [RSP+src]) 711 if (-0x80 <= disp && disp < 0x80) { 712 emit_rm(cbuf, 0x01, rm_field, RSP_enc); // R/M byte 713 emit_rm(cbuf, 0x00, RSP_enc, RSP_enc); // SIB byte 714 emit_d8(cbuf, disp); // Displacement // R/M byte 715 } else { 716 emit_rm(cbuf, 0x02, rm_field, RSP_enc); // R/M byte 717 emit_rm(cbuf, 0x00, RSP_enc, RSP_enc); // SIB byte 718 emit_d32(cbuf, disp); // Displacement // R/M byte 719 } | 652 cbuf.insts()->emit_int64(d64); 653 } 654 655 // emit 32 bit value and construct relocation entry from relocInfo::relocType 656 void emit_d32_reloc(CodeBuffer& cbuf, 657 int d32, 658 relocInfo::relocType reloc, 659 int format) 660 { 661 assert(reloc != relocInfo::external_word_type, "use 2-arg emit_d32_reloc"); 662 cbuf.relocate(cbuf.insts_mark(), reloc, format); 663 cbuf.insts()->emit_int32(d32); 664 } 665 666 // emit 32 bit value and construct relocation entry from RelocationHolder 667 void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, int format) { 668 #ifdef ASSERT 669 if (rspec.reloc()->type() == relocInfo::oop_type && 670 d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) { 671 assert(Universe::heap()->is_in_reserved((address)(intptr_t)d32), "should be real oop"); 672 assert(oopDesc::is_oop(cast_to_oop((intptr_t)d32)) && (ScavengeRootsInCode || !Universe::heap()->is_scavengable(cast_to_oop((intptr_t)d32))), "cannot embed scavengable oops in code"); 673 } 674 #endif 675 cbuf.relocate(cbuf.insts_mark(), rspec, format); 676 cbuf.insts()->emit_int32(d32); 677 } 678 679 void emit_d32_reloc(CodeBuffer& cbuf, address addr) { 680 address next_ip = cbuf.insts_end() + 4; 681 emit_d32_reloc(cbuf, (int) (addr - next_ip), 682 external_word_Relocation::spec(addr), 683 RELOC_DISP32); 684 } 685 686 687 // emit 64 bit value and construct relocation entry from relocInfo::relocType 688 void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, relocInfo::relocType reloc, int format) { 689 cbuf.relocate(cbuf.insts_mark(), reloc, format); 690 cbuf.insts()->emit_int64(d64); 691 } 692 693 // emit 64 bit value and construct relocation entry from RelocationHolder 694 void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec, int format) { 695 #ifdef ASSERT 696 if (rspec.reloc()->type() == relocInfo::oop_type && 697 d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) { 698 assert(Universe::heap()->is_in_reserved((address)d64), "should be real oop"); 699 assert(oopDesc::is_oop(cast_to_oop(d64)) && (ScavengeRootsInCode || !Universe::heap()->is_scavengable(cast_to_oop(d64))), 700 "cannot embed scavengable oops in code"); 701 } 702 #endif 703 cbuf.relocate(cbuf.insts_mark(), rspec, format); 704 cbuf.insts()->emit_int64(d64); 705 } 706 707 // Access stack slot for load or store 708 void store_to_stackslot(CodeBuffer &cbuf, int opcode, int rm_field, int disp) 709 { 710 emit_opcode(cbuf, opcode); // (e.g., FILD [RSP+src]) 711 if (-0x80 <= disp && disp < 0x80) { 712 emit_rm(cbuf, 0x01, rm_field, RSP_enc); // R/M byte 713 emit_rm(cbuf, 0x00, RSP_enc, RSP_enc); // SIB byte 714 emit_d8(cbuf, disp); // Displacement // R/M byte 715 } else { 716 emit_rm(cbuf, 0x02, rm_field, RSP_enc); // R/M byte 717 emit_rm(cbuf, 0x00, RSP_enc, RSP_enc); // SIB byte 718 emit_d32(cbuf, disp); // Displacement // R/M byte 719 } |