Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

J9 verification permits non-interfaces on operand stack of invokeinterface #19756

Closed
tajila opened this issue Jun 25, 2024 · 3 comments · Fixed by #19877
Closed

J9 verification permits non-interfaces on operand stack of invokeinterface #19756

tajila opened this issue Jun 25, 2024 · 3 comments · Fixed by #19877
Assignees
Labels

Comments

@tajila
Copy link
Contributor

tajila commented Jun 25, 2024

With the following example:

Interface val = new Concrete[elements];
val.ifaceMethod(); //throws IncompatibleClassChangeError on J9 whereas RI throws a verification failure much earlier

Test files:
TestFiles.zip

Run with:
java TestInterface

We need to align the behaviour with RI for the following reasons

  1. It forces the JIT to be conservative and treat every interface type as a potential array
  2. Better aligns J9 behaviour with the RI
@theresa-m
Copy link
Contributor

theresa-m commented Jul 18, 2024

There's not currently a way to distinguish the array of a reference/object from an object. See the 5 bits that are reserved for types https://github.com/eclipse-openj9/openj9/blob/master/runtime/oti/bytecodewalk.h#L100-L104
I think BCV_TAG_BASE_ARRAY_OR_NULL can be redefined to mean a reference or a base array so that:

  • 0x10 tag means a reference array
  • 0x11 means a base array

Does that make sense @tajila ?

@tajila
Copy link
Contributor Author

tajila commented Jul 18, 2024

There's not currently a way to distinguish the array of a reference/object from an object.

I thought it was classIndex | (arity << BCV_ARITY_SHIFT) with the BCV_JAVA_LANG_OBJECT_INDEX bit set (its not actually set but implied) ?

@theresa-m
Copy link
Contributor

Oh right that makes sense. I'll try that, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants