-
Notifications
You must be signed in to change notification settings - Fork 5k
[mono][interp] implement interp bitcast intrinsics #115443
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
base: main
Are you sure you want to change the base?
Conversation
Tagging subscribers to this area: @BrzVlad, @kotlarmilos |
OPDEF(MINT_BITCAST_I4_R4, "bitcast.i4.r4", 3, 1, 1, MintOpNoArgs) | ||
OPDEF(MINT_BITCAST_I8_R8, "bitcast.i8.r8", 3, 1, 1, MintOpNoArgs) | ||
OPDEF(MINT_BITCAST_R4_I4, "bitcast.r4.i4", 3, 1, 1, MintOpNoArgs) | ||
OPDEF(MINT_BITCAST_R8_I8, "bitcast.r8.i8", 3, 1, 1, MintOpNoArgs) |
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.
Don't understand why the type matters. Sounds like we should just emit MINT_MOV_4
or MINT_MOV_8
.
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.
I really did just extract the changes from the linked pr and try to get them working as a first step. I think the intent was to make sure the jiterp sees the reinterpret but I'm not sure it matters in a practical sense?
cc @kg
|
this will also help reduce the impact of #116221 |
return FALSE; | ||
} | ||
g_assert (size < G_MAXUINT16); | ||
|
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.
At this point we have the size. I imagine we should just do the following:
if (size <= 4)
add_ins (MINT_MOV_4);
else if (size <= 8)
add_ins (MINT_MOV_8);
else
add_ins (MINT_MOV_VT);
td->sp--; | ||
interp_add_ins (td, MINT_MOV_VT); | ||
interp_ins_set_sreg (td->last_ins, td->sp [0].var); | ||
push_type_vt (td, tto_klass, size); |
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.
The bug in your code is that here you are always pushing a VT type on the stack, where you could actually have a primitive type since you could cast a valuetype (of size 8) to an int64 for example. If you use the suggestion from above this should no longer be a problem.
based on #103915