-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[interp] handle box + brtrue/brfalse and box+isinst+unbox.any patterns up front #103052
Conversation
In cases where we don't do cprop and deadce (for example if ~mono_interp_opt~ is 0 because we're debugging) don't emit a box_vt opcode before a branch. Instead just emit a constant true Fixes dotnet#102988
…net#102998)" This reverts commit c286a8e.
Tagging subscribers to this area: @BrzVlad, @kotlarmilos |
This means that the previous approach of retrying with optimization enabled is useless and should be removed. We should handle all IL patterns like this. Interp changes LGTM. |
we handle box byreflike code patterns directly now
@BrzVlad PTAL. I updated the interpreter to handle the other patterns in the unoptimized pass. @AaronRobinsonMSFT I added a new test locking down the behavior for @stephentoub this PR also reverts your previous revert |
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
interp_add_ins (td, MINT_LDC_I4_S); | ||
td->last_ins->data[0] = (guint16) 1; | ||
push_simple_type (td, STACK_TYPE_I4); | ||
interp_ins_set_dreg (td->last_ins, td->sp [-1].var); |
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.
Is the [-1]
a comment mechanic in the intepreter? is there a macro or some other abstraction over that? I'm assuming the sp
is "stack pointer", so perhaps that is the previous slot?
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.
Yea, I'm not sure why we do it this way. But the general pattern is to decrement SP by the number of operands that an opcode expects (so now they're at sp[0]
... sp[k-1]
) and use those var
s, then do a push for the result(s) (which creates new vars) and then use sp[-1]
to refer to the result.
In cases where we don't do cprop and deadce (for example if
mono_interp_opt
is 0 because we're debugging) don't emit a box_vt opcode before a branch. Instead just emit a constant trueFixes #102988
Also reverts the changes from #102998