are CodeElements unique?
Chen Liang
chen.l.liang at oracle.com
Wed May 7 19:00:36 UTC 2025
No worries - this actually reminds me of Adam's complaints about ClassFile API's parsed instructions having no identity and thus complicated to handle for the low code model in Babylon.
Identity is important for control flow and transforms like SSA transform. Unfortunately, since transforms are free to pass in any element or duplicate them, we probably can't do that for ClassFile API, and have to resort to such an external mechanism at the terminals.
Regards,
Chen
________________________________
From: Paul Sandoz <paul.sandoz at oracle.com>
Sent: Wednesday, May 7, 2025 1:00 PM
Cc: Mark Roberts <markro at cs.washington.edu>; classfile-api-dev at openjdk.org <classfile-api-dev at openjdk.org>; Chen Liang <chen.l.liang at oracle.com>
Subject: Re: are CodeElements unique?
Oops apologies, I thought this was a Babylon code model question, please ignore!
Paul.
On May 7, 2025, at 10:59 AM, paul.sandoz at oracle.com wrote:
Yes. All code items have identity, and their equals/hashCode is defined in terms of that identity i.e., same implementation as for Object.
A reflected method body or lambda body must have only one code model instance associated with it. (We have been fixing some a bugs to ensure this is guaranteed.)
Paul.
On May 7, 2025, at 10:43 AM, Mark Roberts <markro at cs.washington.edu> wrote:
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/8a70b93b/attachment-0001.htm>
More information about the classfile-api-dev
mailing list