RFR: 8203339: Add oopDesc::field_offset()
Stefan Karlsson
stefan.karlsson at oracle.com
Thu May 17 07:23:03 UTC 2018
Hi all,
Please review this patch to add a oopDesc::field_offset() convenience
function.
http://cr.openjdk.java.net/~stefank/8203339/webrev.01/
https://bugs.openjdk.java.net/browse/JDK-8203339
We use it in ZGC to extract the offset to oop fields in some of our
OopClosures. The OopClosures provide the interior pointers to oop
fields, and together with the object pointer the offset can be calculated.
See the following ZGC use-case:
http://hg.openjdk.java.net/zgc/zgc/file/3a52c8361e20/src/hotspot/share/gc/z/zHeapIterator.cpp#l87
class ZHeapIteratorPushOopClosure : public ExtendedOopClosure {
private:
ZHeapIterator* const _iter;
const oop _base;
public:
ZHeapIteratorPushOopClosure(ZHeapIterator* iter, oop base) :
_iter(iter),
_base(base) {}
void do_oop_nv(oop* p) {
const oop obj = HeapAccess<ON_UNKNOWN_OOP_REF>::oop_load_at(_base,
_base->field_offset(p));
_iter->push(obj);
}
Thanks,
StefanK
More information about the hotspot-dev
mailing list