RFR: 8272723: Don't use Access API to access primitive fields [v2]
Stefan Karlsson
stefank at openjdk.java.net
Fri Aug 20 06:41:22 UTC 2021
On Thu, 19 Aug 2021 16:05:54 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
>> For earlier incarnations of Shenandoah, we needed to put barriers before accessing primitive fields. This is no longer necessary nor implemented/used by any GC, and we should simplify the code to do plain access instead.
>>
>> (We may want to remove remaining primitive access machinery in the Access API soon)
>>
>> Testing:
>> - [x] tier1
>> - [ ] tier2
>> - [ ] hotspot_gc
>
> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove remaining primitive Access API uses
src/hotspot/share/oops/oop.inline.hpp line 240:
> 238: inline void oopDesc::bool_field_put(int offset, jboolean value) { *field_addr<jboolean>(offset) = jboolean(value & 1); }
> 239: inline jboolean oopDesc::bool_field_volatile(int offset) const { return Atomic::load_acquire(field_addr<jboolean>(offset)); }
> 240: inline void oopDesc::bool_field_put_volatile(int offset, jboolean value) { Atomic::release_store_fence(field_addr<jboolean>(offset), jboolean(value & 1)); }
bool_field_volatile doesn't match the old HeapAccess<MO_SEQ_CST::load_at:
RawAccessBarrier<decorators>::load_internal(void* addr) {
if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
OrderAccess::fence();
}
return Atomic::load_acquire(reinterpret_cast<const volatile T*>(addr));
}
src/hotspot/share/oops/typeArrayOop.inline.hpp line 93:
> 91:
> 92: inline jbyte typeArrayOopDesc::byte_at(int which) const {
> 93: assert(is_within_bounds(which), "index %d out of bounds %d", which, length());
byte_at_addr already asserts this.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5187
More information about the hotspot-dev
mailing list