Skip to content

Add multi-dim array support to the interpreter #115916

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

kg
Copy link
Member

@kg kg commented May 22, 2025

Depends on (contains) #115914

Implements ctors and method calls for multidimensional arrays. There are still scenarios around multi-dim arrays that don't work (comment regarding this is in Interpreter.cs)

To do this I had to make the newobj opcode bigger so it has room to stash a helper ftn (used to invoke the mdarray ctor).

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 22, 2025
}
else
{
AddIns(INTOP_NEWOBJ);
m_pLastNewIns->data[1] = GetDataItemIndex(ctorClass);
m_pLastNewIns->data[2] = (m_compHnd->getArrayRank(ctorClass) > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to get a rank of 0? What does it mean in that case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it, we call this even for non-arrays and that's what gets us rank of 0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this is rebased onto the updated string ctors PR, it will be using a dedicated opcode so it should be less confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants