8241042: x86_64: Improve Assembler generation

Reviewed-by: vlivanov, kvn
This commit is contained in:
Claes Redestad 2020-03-05 16:07:17 +01:00
parent ec5bd02186
commit 176192499f
3 changed files with 682 additions and 1260 deletions

File diff suppressed because it is too large Load Diff

View File

@ -283,14 +283,21 @@ class AbstractAssembler : public ResourceObj {
// ensure buf contains all code (call this before using/copying the code)
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_int8( int8_t x1) { code_section()->emit_int8(x1); }
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_int16( int16_t x) { code_section()->emit_int16(x); }
void emit_int16( int8_t x1, int8_t x2) { code_section()->emit_int16(x1, x2); }
void emit_int24( int8_t x1, int8_t x2, int8_t x3) { code_section()->emit_int24(x1, x2, x3); }
void emit_int32( int32_t x) { code_section()->emit_int32(x); }
void emit_int32( int8_t x1, int8_t x2, int8_t x3, int8_t x4) { code_section()->emit_int32(x1, x2, x3, x4); }
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
static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; }

View File

@ -200,9 +200,38 @@ class CodeSection {
}
// Code emission
void emit_int8 ( int8_t x) { *((int8_t*) end()) = x; set_end(end() + sizeof(int8_t)); }
void emit_int16( int16_t x) { *((int16_t*) end()) = x; set_end(end() + sizeof(int16_t)); }
void emit_int32( int32_t x) { *((int32_t*) end()) = x; set_end(end() + sizeof(int32_t)); }
void emit_int8(int8_t x1) {
address curr = end();
*((int8_t*) curr++) = x1;
set_end(curr);
}
void emit_int16(int16_t x) { *((int16_t*) end()) = x; set_end(end() + sizeof(int16_t)); }
void emit_int16(int8_t x1, int8_t x2) {
address curr = end();
*((int8_t*) curr++) = x1;
*((int8_t*) curr++) = x2;
set_end(curr);
}
void emit_int24(int8_t x1, int8_t x2, int8_t x3) {
address curr = end();
*((int8_t*) curr++) = x1;
*((int8_t*) curr++) = x2;
*((int8_t*) curr++) = x3;
set_end(curr);
}
void emit_int32(int32_t x) { *((int32_t*) end()) = x; set_end(end() + sizeof(int32_t)); }
void emit_int32(int8_t x1, int8_t x2, int8_t x3, int8_t x4) {
address curr = end();
*((int8_t*) curr++) = x1;
*((int8_t*) curr++) = x2;
*((int8_t*) curr++) = x3;
*((int8_t*) curr++) = x4;
set_end(curr);
}
void emit_int64( int64_t x) { *((int64_t*) end()) = x; set_end(end() + sizeof(int64_t)); }
void emit_float( jfloat x) { *((jfloat*) end()) = x; set_end(end() + sizeof(jfloat)); }