RFR: 8304846: Provide a shared utility to dump generated classes defined via Lookup API
Mandy Chung
mchung at openjdk.org
Fri Mar 24 20:49:23 UTC 2023
This implements a shared utility to dump generated classes defined as normal/hidden classes via `Lookup` API. This replaces the implementation in `LambdaMetaFactory` and method handle implementation that dumps the hidden class bytes on disk for debugging.
For classes defined via `Lookup::defineClass`, `Lookup::defineHiddenClass` and `Lookup::defineHiddenClassWithClassData`, by default they will be dumped to the path specified in `-Djava.lang.invoke.Lookup.dumpClasses=<dumpDir>`
The hidden classes generated for lambdas, `LambdaForms` and method handle implementation use non-default dumper so that they can be controlled via a separate system property and path as in the current implementation.
To dump lambda proxy classes, set this system property:
-Djdk.internal.lambda.dumpProxyClasses=<dumpDir>
To dump LambdaForms and method handle implementation, set this system property:
-Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true
P.S. `ProxyClassesDumper` is renamed to `ClassFileDumper` but for some reason, it's not shown as rename.
-------------
Commit messages:
- rename the system property
- 8304846: Provide a shared utility to dump generated classes defined via Lookup API
Changes: https://git.openjdk.org/jdk/pull/13182/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13182&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8304846
Stats: 636 lines in 10 files changed: 317 ins; 262 del; 57 mod
Patch: https://git.openjdk.org/jdk/pull/13182.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13182/head:pull/13182
PR: https://git.openjdk.org/jdk/pull/13182
More information about the security-dev
mailing list