Skip to content

Commit

Permalink
8328329: [lworld] Optimize field type checking sequence for x86 target.
Browse files Browse the repository at this point in the history
  • Loading branch information
jatin-bhateja committed Mar 18, 2024
1 parent 9b79f47 commit dcb3adf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
7 changes: 7 additions & 0 deletions src/hotspot/cpu/x86/assembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6249,6 +6249,13 @@ void Assembler::subss(XMMRegister dst, Address src) {
emit_operand(dst, src, 0);
}

void Assembler::btl(Register dst, int imm8) {
int encode = prefix_and_encode(dst->encoding());
emit_int16(0x0F, (unsigned char)0xBA);
emit_int8(modrm_encoding(0x3, rsp->encoding() /* /4 */ , encode));
emit_int8(imm8);
}

void Assembler::testb(Register dst, int imm8, bool use_ral) {
NOT_LP64(assert(dst->has_byte_register(), "must have byte register"));
if (dst == rax) {
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/cpu/x86/assembler_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,7 @@ class Assembler : public AbstractAssembler {
void btsq(Address dst, int imm8);
void btrq(Address dst, int imm8);
#endif
void btl(Register dst, int imm8);

void orw(Register dst, Register src);

Expand Down
18 changes: 6 additions & 12 deletions src/hotspot/cpu/x86/macroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3002,26 +3002,20 @@ void MacroAssembler::test_klass_is_empty_inline_type(Register klass, Register te

void MacroAssembler::test_field_is_null_free_inline_type(Register flags, Register temp_reg, Label& is_null_free_inline_type) {
movl(temp_reg, flags);
shrl(temp_reg, ResolvedFieldEntry::is_null_free_inline_type_shift);
andl(temp_reg, 0x1);
testl(temp_reg, temp_reg);
jcc(Assembler::notZero, is_null_free_inline_type);
btl(temp_reg, ResolvedFieldEntry::is_null_free_inline_type_shift);
jcc(Assembler::carrySet, is_null_free_inline_type);
}

void MacroAssembler::test_field_is_not_null_free_inline_type(Register flags, Register temp_reg, Label& not_null_free_inline_type) {
movl(temp_reg, flags);
shrl(temp_reg, ResolvedFieldEntry::is_null_free_inline_type_shift);
andl(temp_reg, 0x1);
testl(temp_reg, temp_reg);
jcc(Assembler::zero, not_null_free_inline_type);
btl(temp_reg, ResolvedFieldEntry::is_null_free_inline_type_shift);
jcc(Assembler::carryClear, not_null_free_inline_type);
}

void MacroAssembler::test_field_is_flat(Register flags, Register temp_reg, Label& is_flat) {
movl(temp_reg, flags);
shrl(temp_reg, ResolvedFieldEntry::is_flat_shift);
andl(temp_reg, 0x1);
testl(temp_reg, temp_reg);
jcc(Assembler::notZero, is_flat);
btl(temp_reg, ResolvedFieldEntry::is_flat_shift);
jcc(Assembler::carrySet, is_flat);
}

void MacroAssembler::test_oop_prototype_bit(Register oop, Register temp_reg, int32_t test_bit, bool jmp_set, Label& jmp_label) {
Expand Down

0 comments on commit dcb3adf

Please sign in to comment.