Skip to content

Commit d37a5bf

Browse files
authored
Merge pull request #873 from Unity-Technologies/unity-master-win64-struct-pinvoke
Fix issue mono#7596 on Windows x64. (mono#7625) case 1001996 - Fix p/invoke on Win32 when soft debugger is enabled
2 parents 562c6a0 + 13ef9d1 commit d37a5bf

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

mono/mini/mini-amd64.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ add_valuetype_win64 (MonoMethodSignature *signature, ArgInfo *arg_info, MonoType
606606
get_valuetype_size_win64 (klass, signature->pinvoke, arg_info, type, &arg_class, &arg_size);
607607

608608
/* Only drop value type if its not an empty struct as input that must be represented in call */
609-
if ((arg_size == 0 && !arg_info->pass_empty_struct) || (arg_size == 0 && arg_info->pass_empty_struct && is_return)) {
609+
if ((arg_size == 0 && !arg_info->pass_empty_struct) || (arg_info->pass_empty_struct && is_return)) {
610610
arg_info->storage = ArgValuetypeInReg;
611611
arg_info->pair_storage [0] = arg_info->pair_storage [1] = ArgNone;
612612
} else {
@@ -2228,7 +2228,8 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
22282228
g_assert (ainfo->storage == ArgValuetypeAddrInIReg || (ainfo->storage == ArgValuetypeAddrOnStack && ainfo->pair_storage [0] == ArgNone));
22292229

22302230
vtaddr = mono_compile_create_var (cfg, &ins->klass->byval_arg, OP_LOCAL);
2231-
2231+
vtaddr->backend.is_pinvoke = call->signature->pinvoke;
2232+
22322233
MONO_INST_NEW (cfg, load, OP_LDADDR);
22332234
cfg->has_indirection = TRUE;
22342235
load->inst_p0 = vtaddr;

msvc/libmonoruntime-common.targets.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@
112112
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\icall.c">
113113
<Filter>Source Files$(MonoRuntimeFilterSubFolder)\common</Filter>
114114
</ClCompile>
115+
<ClCompile Include="$(MonoSourceLocation)\mono\metadata\icall-table.c">
116+
<Filter>Source Files$(MonoRuntimeFilterSubFolder)\common</Filter>
117+
</ClCompile>
118+
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\icall-table.h">
119+
<Filter>Header Files$(MonoRuntimeFilterSubFolder)\common</Filter>
120+
</ClInclude>
115121
<ClInclude Include="$(MonoSourceLocation)\mono\metadata\icall-internals.h">
116122
<Filter>Header Files$(MonoRuntimeFilterSubFolder)\common</Filter>
117123
</ClInclude>

0 commit comments

Comments
 (0)