mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
Reviewed-by: jrose, kvn, twisti
This commit is contained in:
parent
fede1f0216
commit
113e9ab39d
9 changed files with 759 additions and 766 deletions
|
@ -298,7 +298,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
|
||||||
for (int i = 0; i < _bytes_to_copy; i++) {
|
for (int i = 0; i < _bytes_to_copy; i++) {
|
||||||
address ptr = (address)(_pc_start + i);
|
address ptr = (address)(_pc_start + i);
|
||||||
int a_byte = (*ptr) & 0xFF;
|
int a_byte = (*ptr) & 0xFF;
|
||||||
__ a_byte (a_byte);
|
__ emit_int8 (a_byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,10 +340,10 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
|
||||||
int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
|
int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
|
||||||
|
|
||||||
// Emit the patch record. We need to emit a full word, so emit an extra empty byte
|
// Emit the patch record. We need to emit a full word, so emit an extra empty byte
|
||||||
__ a_byte(0);
|
__ emit_int8(0);
|
||||||
__ a_byte(being_initialized_entry_offset);
|
__ emit_int8(being_initialized_entry_offset);
|
||||||
__ a_byte(bytes_to_skip);
|
__ emit_int8(bytes_to_skip);
|
||||||
__ a_byte(_bytes_to_copy);
|
__ emit_int8(_bytes_to_copy);
|
||||||
address patch_info_pc = __ pc();
|
address patch_info_pc = __ pc();
|
||||||
assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
|
assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -316,7 +316,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
|
||||||
for (int i = 0; i < _bytes_to_copy; i++) {
|
for (int i = 0; i < _bytes_to_copy; i++) {
|
||||||
address ptr = (address)(_pc_start + i);
|
address ptr = (address)(_pc_start + i);
|
||||||
int a_byte = (*ptr) & 0xFF;
|
int a_byte = (*ptr) & 0xFF;
|
||||||
__ a_byte (a_byte);
|
__ emit_int8(a_byte);
|
||||||
*ptr = 0x90; // make the site look like a nop
|
*ptr = 0x90; // make the site look like a nop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,11 +363,11 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
|
||||||
// emit the offsets needed to find the code to patch
|
// emit the offsets needed to find the code to patch
|
||||||
int being_initialized_entry_offset = __ pc() - being_initialized_entry + sizeof_patch_record;
|
int being_initialized_entry_offset = __ pc() - being_initialized_entry + sizeof_patch_record;
|
||||||
|
|
||||||
__ a_byte(0xB8);
|
__ emit_int8((unsigned char)0xB8);
|
||||||
__ a_byte(0);
|
__ emit_int8(0);
|
||||||
__ a_byte(being_initialized_entry_offset);
|
__ emit_int8(being_initialized_entry_offset);
|
||||||
__ a_byte(bytes_to_skip);
|
__ emit_int8(bytes_to_skip);
|
||||||
__ a_byte(_bytes_to_copy);
|
__ emit_int8(_bytes_to_copy);
|
||||||
address patch_info_pc = __ pc();
|
address patch_info_pc = __ pc();
|
||||||
assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
|
assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
|
||||||
|
|
||||||
|
|
|
@ -1023,7 +1023,7 @@ void MacroAssembler::lea(Address dst, AddressLiteral adr) {
|
||||||
|
|
||||||
void MacroAssembler::leave() {
|
void MacroAssembler::leave() {
|
||||||
// %%% is this really better? Why not on 32bit too?
|
// %%% is this really better? Why not on 32bit too?
|
||||||
emit_byte(0xC9); // LEAVE
|
emit_int8((unsigned char)0xC9); // LEAVE
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroAssembler::lneg(Register hi, Register lo) {
|
void MacroAssembler::lneg(Register hi, Register lo) {
|
||||||
|
@ -2112,11 +2112,11 @@ void MacroAssembler::fat_nop() {
|
||||||
if (UseAddressNop) {
|
if (UseAddressNop) {
|
||||||
addr_nop_5();
|
addr_nop_5();
|
||||||
} else {
|
} else {
|
||||||
emit_byte(0x26); // es:
|
emit_int8(0x26); // es:
|
||||||
emit_byte(0x2e); // cs:
|
emit_int8(0x2e); // cs:
|
||||||
emit_byte(0x64); // fs:
|
emit_int8(0x64); // fs:
|
||||||
emit_byte(0x65); // gs:
|
emit_int8(0x65); // gs:
|
||||||
emit_byte(0x90);
|
emit_int8((unsigned char)0x90);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2534,12 +2534,12 @@ void MacroAssembler::jump_cc(Condition cc, AddressLiteral dst) {
|
||||||
int offs = (intptr_t)dst.target() - ((intptr_t)pc());
|
int offs = (intptr_t)dst.target() - ((intptr_t)pc());
|
||||||
if (dst.reloc() == relocInfo::none && is8bit(offs - short_size)) {
|
if (dst.reloc() == relocInfo::none && is8bit(offs - short_size)) {
|
||||||
// 0111 tttn #8-bit disp
|
// 0111 tttn #8-bit disp
|
||||||
emit_byte(0x70 | cc);
|
emit_int8(0x70 | cc);
|
||||||
emit_byte((offs - short_size) & 0xFF);
|
emit_int8((offs - short_size) & 0xFF);
|
||||||
} else {
|
} else {
|
||||||
// 0000 1111 1000 tttn #32-bit disp
|
// 0000 1111 1000 tttn #32-bit disp
|
||||||
emit_byte(0x0F);
|
emit_int8(0x0F);
|
||||||
emit_byte(0x80 | cc);
|
emit_int8((unsigned char)(0x80 | cc));
|
||||||
emit_long(offs - long_size);
|
emit_long(offs - long_size);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -58,7 +58,7 @@ void Assembler::pd_patch_instruction(address branch, address target) {
|
||||||
|
|
||||||
void MacroAssembler::align(int modulus) {
|
void MacroAssembler::align(int modulus) {
|
||||||
while (offset() % modulus != 0)
|
while (offset() % modulus != 0)
|
||||||
emit_byte(AbstractAssembler::code_fill_byte());
|
emit_int8(AbstractAssembler::code_fill_byte());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroAssembler::bang_stack_with_offset(int offset) {
|
void MacroAssembler::bang_stack_with_offset(int offset) {
|
||||||
|
|
|
@ -116,7 +116,7 @@ void MacroAssembler::get_thread(Register thread) {
|
||||||
ThreadLocalStorage::pd_tlsAccessMode tlsMode = ThreadLocalStorage::pd_getTlsAccessMode ();
|
ThreadLocalStorage::pd_tlsAccessMode tlsMode = ThreadLocalStorage::pd_getTlsAccessMode ();
|
||||||
if (tlsMode == ThreadLocalStorage::pd_tlsAccessIndirect) { // T1
|
if (tlsMode == ThreadLocalStorage::pd_tlsAccessIndirect) { // T1
|
||||||
// Use thread as a temporary: mov r, gs:[0]; mov r, [r+tlsOffset]
|
// Use thread as a temporary: mov r, gs:[0]; mov r, [r+tlsOffset]
|
||||||
emit_byte (segment);
|
emit_int8 (segment);
|
||||||
// ExternalAddress doesn't work because it can't take NULL
|
// ExternalAddress doesn't work because it can't take NULL
|
||||||
AddressLiteral null(0, relocInfo::none);
|
AddressLiteral null(0, relocInfo::none);
|
||||||
movptr (thread, null);
|
movptr (thread, null);
|
||||||
|
@ -125,7 +125,7 @@ void MacroAssembler::get_thread(Register thread) {
|
||||||
} else
|
} else
|
||||||
if (tlsMode == ThreadLocalStorage::pd_tlsAccessDirect) { // T2
|
if (tlsMode == ThreadLocalStorage::pd_tlsAccessDirect) { // T2
|
||||||
// mov r, gs:[tlsOffset]
|
// mov r, gs:[tlsOffset]
|
||||||
emit_byte (segment);
|
emit_int8 (segment);
|
||||||
AddressLiteral tls_off((address)ThreadLocalStorage::pd_getTlsOffset(), relocInfo::none);
|
AddressLiteral tls_off((address)ThreadLocalStorage::pd_getTlsOffset(), relocInfo::none);
|
||||||
movptr (thread, tls_off);
|
movptr (thread, tls_off);
|
||||||
return ;
|
return ;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::int3() {
|
void MacroAssembler::int3() {
|
||||||
emit_byte(0xCC);
|
emit_int8((unsigned char)0xCC);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LP64
|
#ifndef _LP64
|
||||||
|
|
|
@ -109,17 +109,6 @@ void AbstractAssembler::flush() {
|
||||||
ICache::invalidate_range(addr_at(0), offset());
|
ICache::invalidate_range(addr_at(0), offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AbstractAssembler::a_byte(int x) {
|
|
||||||
emit_byte(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AbstractAssembler::a_long(jint x) {
|
|
||||||
emit_long(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AbstractAssembler::bind(Label& L) {
|
void AbstractAssembler::bind(Label& L) {
|
||||||
if (L.is_bound()) {
|
if (L.is_bound()) {
|
||||||
// Assembler can bind a label more than once to the same place.
|
// Assembler can bind a label more than once to the same place.
|
||||||
|
|
|
@ -216,16 +216,6 @@ class AbstractAssembler : public ResourceObj {
|
||||||
bool isByte(int x) const { return 0 <= x && x < 0x100; }
|
bool isByte(int x) const { return 0 <= x && x < 0x100; }
|
||||||
bool isShiftCount(int x) const { return 0 <= x && x < 32; }
|
bool isShiftCount(int x) const { return 0 <= x && x < 32; }
|
||||||
|
|
||||||
void emit_int8( int8_t x) { code_section()->emit_int8( x); }
|
|
||||||
void emit_int16( int16_t x) { code_section()->emit_int16( x); }
|
|
||||||
void emit_int32( int32_t x) { code_section()->emit_int32( x); }
|
|
||||||
void emit_int64( int64_t x) { code_section()->emit_int64( x); }
|
|
||||||
|
|
||||||
void emit_float( jfloat x) { code_section()->emit_float( x); }
|
|
||||||
void emit_double( jdouble x) { code_section()->emit_double( x); }
|
|
||||||
void emit_address(address x) { code_section()->emit_address(x); }
|
|
||||||
|
|
||||||
void emit_byte(int x) { emit_int8 (x); } // deprecated
|
|
||||||
void emit_long(jint x) { emit_int32(x); } // deprecated
|
void emit_long(jint x) { emit_int32(x); } // deprecated
|
||||||
|
|
||||||
// Instruction boundaries (required when emitting relocatable values).
|
// Instruction boundaries (required when emitting relocatable values).
|
||||||
|
@ -284,6 +274,15 @@ class AbstractAssembler : public ResourceObj {
|
||||||
// ensure buf contains all code (call this before using/copying the code)
|
// ensure buf contains all code (call this before using/copying the code)
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
|
void emit_int8( int8_t x) { code_section()->emit_int8( x); }
|
||||||
|
void emit_int16( int16_t x) { code_section()->emit_int16( x); }
|
||||||
|
void emit_int32( int32_t x) { code_section()->emit_int32( x); }
|
||||||
|
void emit_int64( int64_t x) { code_section()->emit_int64( x); }
|
||||||
|
|
||||||
|
void emit_float( jfloat x) { code_section()->emit_float( x); }
|
||||||
|
void emit_double( jdouble x) { code_section()->emit_double( x); }
|
||||||
|
void emit_address(address x) { code_section()->emit_address(x); }
|
||||||
|
|
||||||
// min and max values for signed immediate ranges
|
// min and max values for signed immediate ranges
|
||||||
static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; }
|
static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; }
|
||||||
static int max_simm(int nbits) { return (intptr_t(1) << (nbits - 1)) - 1; }
|
static int max_simm(int nbits) { return (intptr_t(1) << (nbits - 1)) - 1; }
|
||||||
|
@ -323,8 +322,6 @@ class AbstractAssembler : public ResourceObj {
|
||||||
void clear_inst_mark() { code_section()->clear_mark(); }
|
void clear_inst_mark() { code_section()->clear_mark(); }
|
||||||
|
|
||||||
// Constants in code
|
// Constants in code
|
||||||
void a_byte(int x);
|
|
||||||
void a_long(jint x);
|
|
||||||
void relocate(RelocationHolder const& rspec, int format = 0) {
|
void relocate(RelocationHolder const& rspec, int format = 0) {
|
||||||
assert(!pd_check_instruction_mark()
|
assert(!pd_check_instruction_mark()
|
||||||
|| inst_mark() == NULL || inst_mark() == code_section()->end(),
|
|| inst_mark() == NULL || inst_mark() == code_section()->end(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue