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

[wasm] Intrinsics for blazor #102670

Merged
merged 6 commits into from
Jun 19, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,56 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas
#endif
} else if (!strcmp (tm, "InitBlockUnaligned") || !strcmp (tm, "InitBlock")) {
*op = MINT_INITBLK;
} else if (!strcmp (tm, "IsNullRef")) {
#if SIZEOF_VOID_P == 4
*op = MINT_CEQ0_I4;
#else
// FIXME: No CEQ0_I8
#endif
} else if (!strcmp (tm, "NullRef")) {
#if SIZEOF_VOID_P == 4
*op = MINT_LDC_I4_0;
#else
*op = MINT_LDC_I8_0;
#endif
} else if (!strcmp (tm, "Add")) {
MonoGenericContext *ctx = mono_method_get_context (target_method);
g_assert (ctx);
g_assert (ctx->method_inst);
g_assert (ctx->method_inst->type_argc == 1);
MonoType *t = ctx->method_inst->type_argv [0];

int base_var = td->sp [-2].var,
offset_var = td->sp [-1].var,
align, esize;

#if SIZEOF_VOID_P == 8
if (td->sp [-1].type == STACK_TYPE_I4) {
interp_add_ins (td, MINT_CONV_I8_I4);
interp_ins_set_sreg (td->last_ins, offset_var);
interp_ins_set_dreg (td->last_ins, offset_var);
kg marked this conversation as resolved.
Show resolved Hide resolved
}
#endif

td->sp -= 2;

esize = mono_type_size (t, &align);
if (esize != 1) {
g_assert (esize <= 32767);
interp_add_ins (td, MINT_MUL_P_IMM);
td->last_ins->data [0] = (gint16)esize;
interp_ins_set_sreg (td->last_ins, offset_var);
interp_ins_set_dreg (td->last_ins, offset_var);
}

interp_add_ins (td, MINT_ADD_P);
interp_ins_set_sregs2 (td->last_ins, base_var, offset_var);
push_simple_type (td, STACK_TYPE_MP);
interp_ins_set_dreg (td->last_ins, td->sp [-1].var);

td->ip += 5;

return TRUE;
}
} else if (in_corlib && !strcmp (klass_name_space, "System.Runtime.CompilerServices") && !strcmp (klass_name, "RuntimeHelpers")) {
if (!strcmp (tm, "get_OffsetToStringData")) {
Expand Down
Loading