-
Notifications
You must be signed in to change notification settings - Fork 44
fix the ArrayStore item #271
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
Conversation
The `ArrayStore` item used to emit an array store instruction based on the type kind of the array, which is always reference. It needs to do that based on the type kind of the _component type_ of the array. Further, this commit replaces all occurences of "element type" with "component type", because that's what they really are. This doesn't make a difference with single-dimensional arrays, which is the vast majority of arrays, but it does make a difference with multi-dimensional arrays, where component type is the type of the inner array, while the element type is never an array type. Finally, some tests for arrays are added.
@@ -32,6 +36,6 @@ protected Node forEachDependency(final Node node, final BiFunction<Item, Node, N | |||
} | |||
|
|||
public void writeCode(final CodeBuilder cb, final BlockCreatorImpl block) { | |||
cb.arrayStore(arrayExpr.typeKind()); | |||
cb.arrayStore(TypeKind.from(componentType)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual bugfix. The rest of this commit is cleanup :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks.
Agree that 2 variants accepting |
I would add an explicit |
Ok, so |
The
ArrayStore
item used to emit an array store instruction based on the type kind of the array, which is always reference. It needs to do that based on the type kind of the component type of the array.Further, this commit replaces all occurences of "element type" with "component type", because that's what they really are. This doesn't make a difference with single-dimensional arrays, which is the vast majority of arrays, but it does make a difference with multi-dimensional arrays, where component type is the type of the inner array, while the element type is never an array type.
Finally, some tests for arrays are added.