Fix ref NonBlittableStruct IL generation

This commit is contained in:
y0soro committed 2026-05-06 07:10:03 +08:00
1 parent f03c8f4ae5
commit 49777d7a7f
2 files changed
+5 -2

No files matched your search

@@ -172,7 +172,9 @@ public static class ILGeneratorEx
body.AddLoadArgument(argumentIndex);
body.Add(OpCodes.Ldind_Ref);
body.Add(OpCodes.Call, imports.IL2CPP_Il2CppObjectBaseToPtrNotNull.Value);
body.Add(OpCodes.Call, imports.IL2CPP_il2cpp_object_unbox.Value);
if (unboxNonBlittableType)
body.Add(OpCodes.Call, imports.IL2CPP_il2cpp_object_unbox.Value);
}
else
{
@@ -120,9 +120,10 @@ public static class Pass50GenerateMethods
}
var newParam = newMethod.Parameters[i];
// TODO: create a default instance for Il2CppSystem.ValueType wrapped value type
// NOTE(Kas): out parameters of value type are passed directly as a pointer to the il2cpp method
// since we don't need to perform any additional copies
if (newParam.Definition!.IsOut && !newParam.ParameterType.GetElementType().IsValueType())
if (newParam.Definition!.IsOut && newParam.ParameterType is ByReferenceTypeSignature && !newParam.ParameterType.GetElementType().IsValueType())
{
var elementType = newParam.ParameterType.GetElementType();