RFR: 8325949: Create an internal utility method for creating VarHandle instances
Per Minborg
pminborg at openjdk.org
Thu Sep 12 18:22:42 UTC 2024
This PR suggests introducing an internal class in `java.base` to simplify the use of some `MethodHandles.Lookup` operations.
While the utility of the methods might appear to be limited in classes with many static `VarHandle`/`MethodHandle` variables, it should be noted that the class files become smaller and simpler. Here are some examples:
| Class File | Base [Bytes] | Patch [Byte] |
| --------------------------------| ------------- | ------------ |
| FutureTask.class | 10255 | 10154 |
| AtomicBoolean.class | 5364 | 5161 |
|AtomicMarkableReference.class | 3890 | 3687 |

The new `MethodHandlesInternal.class` file is of size 2012 bytes.
In total for `java.base` we have:
| Build map "jdk" | Size [Bytes] |
| ---------------| ------------- |
| Base | 5963657 |
| Patch | 5962751 |
| Delta | 906|
For 60 billion instances, this represents 54 TB.
-------------
Commit messages:
- Fix copyright headers
- Introduce MethodHandlesInternal
Changes: https://git.openjdk.org/jdk/pull/20972/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20972&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8325949
Stats: 423 lines in 31 files changed: 109 ins; 202 del; 112 mod
Patch: https://git.openjdk.org/jdk/pull/20972.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20972/head:pull/20972
PR: https://git.openjdk.org/jdk/pull/20972
More information about the core-libs-dev
mailing list