RFR: 8289046: Undefined Behaviour in x86 class Assembler [v5]

Andrew Haley aph at openjdk.org
Tue Jul 19 10:10:12 UTC 2022


On Tue, 12 Jul 2022 16:24:28 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Delete changes to hotspot/shared.
>
> src/hotspot/cpu/x86/assembler_x86.cpp line 2592:
> 
>> 2590:   vex_prefix(src, 0, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes);
>> 2591:   emit_int8((unsigned char)0x90);
>> 2592:   emit_operand(as_Register(dst->encoding()), src);
> 
> I'm in favor of KRegister-specific `emit_operand` overload here.
> 
> 
> static int raw_encode(KRegister kreg) {
>   assert(kreg == knoreg || kreg->is_valid(), "sanity");
>   int kreg_enc = kreg->raw_encoding();
>   assert(kreg_enc == -1 || is_valid_encoding(kreg_enc), "sanity");
>   return kreg_enc;
> }
> 
> void Assembler::emit_operand(KRegister kreg, Address adr,
>                              int rip_relative_correction) {
>   emit_operand(kreg, adr._base, adr._index, adr._scale, adr._disp,
>                adr._rspec,
>                rip_relative_correction);
> }
> 
> void Assembler::emit_operand(KRegister kreg, Register base, Register index,
>                              Address::ScaleFactor scale, int disp,
>                              RelocationHolder const& rspec,
>                              int rip_relative_correction) {
>   assert(!index->is_valid() || index != rsp, "illegal addressing mode");
>   emit_operand_helper(raw_encode(kreg), raw_encode(base), raw_encode(index),
>                       scale, disp, rspec, rip_relative_correction);
> }

OK now?

-------------

PR: https://git.openjdk.org/jdk/pull/9261


More information about the hotspot-compiler-dev mailing list