Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
695f29e
Convert funceval to UCO pattern
am11 Apr 12, 2026
688ca70
Rename FuncEvalInvokeContract to FuncEvalInvokeArgs
am11 Apr 14, 2026
5d89dfb
Remove UnpackFuncEvalResult function
am11 Apr 14, 2026
4d3f798
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 14, 2026
cd5d779
Simplification and mopping
am11 Apr 14, 2026
3711c83
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 14, 2026
a5ed117
Address CR feedback
am11 Apr 14, 2026
5306777
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 14, 2026
e2d4338
Make UCO MethodDesc globals DAC-accessible
am11 Apr 14, 2026
ab3068a
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 14, 2026
89fe5b5
Relax boxed value handling
am11 Apr 14, 2026
309e6de
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 14, 2026
43c19bf
Remove main entrypoints checks
am11 Apr 14, 2026
83b9e1f
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 14, 2026
ee224c6
Improve func-eval return handling and boxing logic
am11 Apr 15, 2026
2bc283c
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 15, 2026
d80c094
Revert "Remove main entrypoints checks"
am11 Apr 15, 2026
a889daa
Revert "Make UCO MethodDesc globals DAC-accessible"
am11 Apr 15, 2026
8f751e3
Move GC protection further up
am11 Apr 15, 2026
409cfb2
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 15, 2026
f11c087
Refactor MethodTable assignment logic in funceval.cpp
am11 Apr 15, 2026
e23a645
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 15, 2026
2f3be5a
Merge branch 'main' into feature/MDCS-to-UCOA-pattern2
am11 Apr 15, 2026
d92f2ee
Fix regression
am11 Apr 15, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,51 @@ internal static unsafe void CallDefaultConstructor(object* pObj, delegate*<objec
*pException = ex;
}
}

[StructLayout(LayoutKind.Sequential)]
private unsafe struct FuncEvalInvokeArgs
{
public nint MethodHandle;
public nint OwnerType;
public object* ThisObj;
public object?[]* Args;
public int IsNewObj;
}

[UnmanagedCallersOnly]
[RequiresUnsafe]
private static unsafe void InvokeFuncEval(FuncEvalInvokeArgs* pInvokeArgs, object* pResult, Exception* pException)
{
try
{
RuntimeMethodHandleInternal handle = new RuntimeMethodHandleInternal(pInvokeArgs->MethodHandle);
RuntimeType? ownerType = pInvokeArgs->OwnerType != 0
? RuntimeTypeHandle.GetRuntimeTypeFromHandle(pInvokeArgs->OwnerType)
: null;
MethodBase method = RuntimeType.GetMethodBase(ownerType, handle)!;

object? thisObj = *pInvokeArgs->ThisObj;
object?[]? args = *pInvokeArgs->Args;

if (pInvokeArgs->IsNewObj != 0)
{
// Call constructor on the pre-allocated instance.
// ConstructorInfo.Invoke(object, ...) invokes on an existing instance and returns null.
method.Invoke(thisObj, BindingFlags.DoNotWrapExceptions, binder: null, args, culture: null);
*pResult = thisObj!;
}
else
{
object? result = method.Invoke(thisObj, BindingFlags.DoNotWrapExceptions, binder: null, args, culture: null);
if (result is not null)
*pResult = result;
}
}
catch (Exception ex)
{
*pException = ex;
}
}
}
// Helper class to assist with unsafe pinning of arbitrary objects.
// It's used by VM code.
Expand Down Expand Up @@ -736,7 +781,7 @@ internal unsafe struct MethodDesc
internal unsafe struct MethodDescChunk
{
public MethodTable* MethodTable;
public MethodDescChunk* Next;
public MethodDescChunk* Next;
public byte Size; // The size of this chunk minus 1 (in multiples of MethodDesc::ALIGNMENT)
public byte Count; // The number of MethodDescs in this chunk minus 1
public ushort FlagsAndTokenRange;
Expand Down Expand Up @@ -1132,11 +1177,11 @@ internal unsafe struct MethodTableAuxiliaryData
private const uint enum_flag_HasCheckedCanCompareBitsOrUseFastGetHashCode = 0x0002; // Whether we have checked the overridden Equals or GetHashCode
private const uint enum_flag_CanCompareBitsOrUseFastGetHashCode = 0x0004; // Is any field type or sub field type overridden Equals or GetHashCode

private const uint enum_flag_Initialized = 0x0001;
private const uint enum_flag_HasCheckedStreamOverride = 0x0400;
private const uint enum_flag_StreamOverriddenRead = 0x0800;
private const uint enum_flag_StreamOverriddenWrite = 0x1000;
private const uint enum_flag_EnsuredInstanceActive = 0x2000;
private const uint enum_flag_Initialized = 0x0001;
private const uint enum_flag_HasCheckedStreamOverride = 0x0400;
private const uint enum_flag_StreamOverriddenRead = 0x0800;
private const uint enum_flag_StreamOverriddenWrite = 0x1000;
private const uint enum_flag_EnsuredInstanceActive = 0x2000;


public bool HasCheckedCanCompareBitsOrUseFastGetHashCode => (Flags & enum_flag_HasCheckedCanCompareBitsOrUseFastGetHashCode) != 0;
Expand Down
Loading
Loading