RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5]
Chen Liang
liach at openjdk.org
Thu Jun 8 01:32:20 UTC 2023
On Thu, 8 Jun 2023 00:12:39 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> Ok, yes, it's less likely now but possible a MH has been explicitly obtained before the defining class has been intialized. In this case I still think we can clear the table out after processing any existing entries, since subsequent requests for MHs after initialization will defer to the target's method handle table.
I think I can just replace the lazy VH's MH table with that of the target, as whatever this table's cache has the target table does as well (due to our getMethodHandleUncached delegation). This is effectively GCing the old table as well.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1581752314
More information about the core-libs-dev
mailing list