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

Tobias Hartmann thartmann at openjdk.java.net
Wed May 19 09:00:43 UTC 2021


On Sat, 8 May 2021 09:45:19 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:
> 
>   unaliged_move for ppc/s390

Looks good to me but this should be tested on all platforms.

src/hotspot/share/c1/c1_GraphBuilder.cpp line 3153:

> 3151:       Value off_val = append(new Constant(new IntConstant(offset)));
> 3152:       get = append(new UnsafeGetObject(as_BasicType(local->type()), e,
> 3153:                                       off_val,

Indentation is wrong.

src/hotspot/share/c1/c1_Instruction.hpp line 2318:

> 2316: 
> 2317:   // accessors
> 2318:   bool is_raw_get()                             { return _is_raw_get; }

I would rename this to `_is_raw` because we already know it's a get.

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

> 2106:   __ convert(Bytecodes::_i2l, off.result(), offset);
> 2107: #else
> 2108:   LIR_Opr offset = off.result();

The indentation is wrong in the else branch.

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

Marked as reviewed by thartmann (Reviewer).

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


More information about the hotspot-compiler-dev mailing list