On Wed, 24 Apr 2024 21:52:11 GMT, Paul Sandoz <psan...@openjdk.org> wrote:

> Rather than duplicating some checks I wonder if it is possible to add a 
> private method `entryByIndex(int index, int expectedTag)` that the existing 
> `entryByIndex` defers to. If the `expectedTag` is non-negative then it checks 
> `tag` against `expectedTag` before proceeding to the switch expression. Then 
> the implementations of `readClassEntry` etc can be adjusted to pass along the 
> expected tag.

Unfortunately it would have to be an expected tags list or an extra constructed 
bit mask, due to the multiple tags allowed for MemberRefEntry and it would 
slightly affect the performance. Also an additional info for the exception 
message would have to be passed down (or the exception would have to be 
re-thrown), as the tag mask is not very informative.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18907#issuecomment-2076114167

Reply via email to