RFR: 8266746: C1: Replace UnsafeGetRaw with UnsafeGetObject when setting up OSR entry block [v3]

Martin Doerr mdoerr at openjdk.java.net
Mon Jun 28 16:18:13 UTC 2021


On Thu, 20 May 2021 02:44:10 GMT, Yi Yang <yyang at openjdk.org> wrote:

>> After JDK-8150921, most Unsafe{Get,Put}Raw intrinsic methods can be replaced by Unsafe{Get,Put}Object.
>> 
>> There is the only one occurrence where c1 refers UnsafeGetRaw among GraphBuilder::setup_osr_entry_block()
>> 
>> https://github.com/openjdk/jdk/blob/74fecc070a6462e6a2d061525b53a63de15339f9/src/hotspot/share/c1/c1_GraphBuilder.cpp#L3143-L3157
>> 
>> We can replace UnsafeGetRaw with UnsafeGetObject when setting up OSR entry block. After that, Unsafe{Get,Put}Raw can be completely removed  because no one refers to them.
>> 
>> (This patch actually does two things:
>> 1. `Replace UnsafeGetRaw with UnsafeGetObject when setting up OSR entry block` This is the only occurrence where c1 refers UnsafeGetRaw
>> 2. `Cleanup unused Unsafe{Get,Put}Raw code`
>> They are related so I put it together, but I still want to hear your suggestions, I will separate them into two patches if you think it is more reasonable)
>> 
>> Thanks!
>> Yang
>
> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   many nit

If you want to use unaligned_move, please remove the assertions (the derived PPC64 instructions do support unaligned access):

--- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
@@ -1172,7 +1172,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src_opr, LIR_Opr dest, BasicType type,
     assert(Assembler::is_simm16(disp_value), "should have set this up");
     offset = load(src, disp_value, to_reg, type, wide, unaligned);
   } else {
-    assert(!unaligned, "unexpected");
     offset = load(src, disp_reg, to_reg, type, wide);
   }
 
@@ -1301,7 +1300,6 @@ void LIR_Assembler::reg2mem(LIR_Opr from_reg, LIR_Opr dest, BasicType type,
     assert(Assembler::is_simm16(disp_value), "should have set this up");
     offset = store(from_reg, src, disp_value, type, wide, unaligned);
   } else {
-    assert(!unaligned, "unexpected");
     offset = store(from_reg, src, disp_reg, type, wide);
   }

src/hotspot/share/c1/c1_LIRGenerator.cpp line 2114:

> 2112:     LIR_Address* addr = new LIR_Address(src.result(), offset, type);
> 2113:     if (type == T_LONG || type == T_DOUBLE) {
> 2114:       __ unaligned_move(addr, result);

You're always using unaligned_move. Old code checks x->may_be_unaligned(). May be ok, though.

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

Changes requested by mdoerr (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3917


More information about the hotspot-gc-dev mailing list