RFR: 8272723: Don't use Access API to access primitive fields [v2]

Stefan Karlsson stefank at openjdk.java.net
Fri Aug 20 06:36:23 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 220:

> 218: 
> 219: template <class T>
> 220: T*       oopDesc::obj_field_addr(int offset) const { return (T*) field_addr(offset); }

The `template<typename T>` doesn't match the style used for obj_field_addr.

Could/should we consolidate the three functions?:

void*    oopDesc::field_addr(int offset)     const { return reinterpret_cast<void*>(cast_from_oop<intptr_t>(as_oop()) + offset); }

template <typename T>
T*       oopDesc::field_addr(int offset)     const { return reinterpret_cast<T*>(field_addr(offset)); }

template <typename T>
T*       oopDesc::obj_field_addr(int offset) const { return field_addr<T>(offset); }

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

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


More information about the hotspot-dev mailing list