[External] : are CodeElements unique?

Chen Liang chen.l.liang at oracle.com
Wed May 7 18:02:45 UTC 2025


Hi Mark,
Very good question - and the answer is unfortunately, no. Transforms are allowed to reuse code models, and I think the bound Code attribute expansion also returns duplicate load or store instructions.
To ensure identity, I think tracking a pair of (index, element) is better.

Regards,
Chen Liang
________________________________
From: Mark Roberts <markro at cs.washington.edu>
Sent: Wednesday, May 7, 2025 12:43 PM
To: classfile-api-dev at openjdk.org <classfile-api-dev at openjdk.org>
Cc: Chen Liang <chen.l.liang at oracle.com>
Subject: [External] : are CodeElements unique?


Are the members of a CodeModel.elementList() unique?  Specifically, is it safe to use a CodeElement as the key value in a Map?



Thank you,

Mark


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20250507/21bb30d9/attachment.htm>


More information about the classfile-api-dev mailing list