Skip to content
Merged
Changes from all 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
17 changes: 16 additions & 1 deletion src/mono/mono/mini/mini-llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ typedef struct {
gboolean llvm_only;
gboolean has_got_access;
gboolean emit_dummy_arg;
gboolean has_safepoints;
int this_arg_pindex, rgctx_arg_pindex;
LLVMValueRef imt_rgctx_loc;
GHashTable *llvm_types;
Expand Down Expand Up @@ -3560,7 +3561,7 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder)
#ifdef TARGET_WASM
// For GC stack scanning to work, have to spill all reference variables to the stack
// Some ref variables have type intptr
if (MONO_TYPE_IS_REFERENCE (var->inst_vtype) || var->inst_vtype->type == MONO_TYPE_I)
if (ctx->has_safepoints && (MONO_TYPE_IS_REFERENCE (var->inst_vtype) || var->inst_vtype->type == MONO_TYPE_I))
var->flags |= MONO_INST_INDIRECT;
#endif

Expand Down Expand Up @@ -8625,6 +8626,20 @@ emit_method_inner (EmitContext *ctx)
}
}
}
if (cfg->method->wrapper_type) {
WrapperInfo *info = mono_marshal_get_wrapper_info (cfg->method);

switch (info->subtype) {
case WRAPPER_SUBTYPE_GSHAREDVT_IN:
case WRAPPER_SUBTYPE_GSHAREDVT_OUT:
case WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG:
case WRAPPER_SUBTYPE_GSHAREDVT_OUT_SIG:
/* Arguments are not used after the call */
requires_safepoint = FALSE;
break;
}
}
ctx->has_safepoints = requires_safepoint;

#ifndef MONO_LLVM_LOADED
if (!cfg->llvm_only && mono_threads_are_safepoints_enabled () && requires_safepoint) {
Expand Down