RFR: 8297757: VarHandles.getStaticFieldFromBaseAndOffset should get the receiver type from VarHandle
Mandy Chung
mchung at openjdk.org
Thu Jan 19 19:23:24 UTC 2023
`VarHandles.getStaticFieldFromBaseAndOffset` maps a base/offset/fieldType to a static `Field`. It's fragile to assume that the location of a static field returned by `Unsafe.staticFieldBase` is a Class object. This changes the VarHandle implementation for static fields (i.e. `FieldStaticReadOnly` and `FieldStaticReadWrite` classes) to include the receiver type in addition to the base and offset.
-------------
Commit messages:
- 8297757: Re-examine assumption in VarHandles.getStaticFieldFromBaseAndOffset that base is a Class object
Changes: https://git.openjdk.org/jdk/pull/12100/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12100&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8297757
Stats: 36 lines in 2 files changed: 3 ins; 2 del; 31 mod
Patch: https://git.openjdk.org/jdk/pull/12100.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12100/head:pull/12100
PR: https://git.openjdk.org/jdk/pull/12100
More information about the core-libs-dev
mailing list