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

[mono] Use InlineArrayAttribute for ArgumentData and StackAllocatedByRefs #88149

Merged
merged 3 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
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
31 changes: 0 additions & 31 deletions src/libraries/System.Private.CoreLib/src/System/ParamsArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace System
{
#if CORECLR || NATIVEAOT

[InlineArray(Length)]
internal struct TwoObjects
{
Expand Down Expand Up @@ -46,33 +44,4 @@ public ThreeObjects(object? arg0, object? arg1, object? arg2)
this[2] = arg2;
}
}

#else

internal struct TwoObjects
{
internal object? Arg0;
private object? _arg1;

public TwoObjects(object? arg0, object? arg1)
{
Arg0 = arg0;
_arg1 = arg1;
}
}

internal struct ThreeObjects
{
internal object? Arg0;
private object? _arg1;
private object? _arg2;

public ThreeObjects(object? arg0, object? arg1, object? arg2)
{
Arg0 = arg0;
_arg1 = arg1;
_arg2 = arg2;
}
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,11 @@ BindingFlags invokeAttr

internal const int MaxStackAllocArgCount = 4;

#if CORECLR
[InlineArray(MaxStackAllocArgCount)]
#endif
private protected struct ArgumentData<T>
{
private T _arg0;
lambdageek marked this conversation as resolved.
Show resolved Hide resolved
#if !CORECLR
#pragma warning disable CA1823, CS0169, IDE0051, IDE0044 // accessed via 'CheckArguments' ref arithmetic
private T _arg1;
private T _arg2;
private T _arg3;
#pragma warning restore CA1823, CS0169, IDE0051, IDE0044
#endif

[UnscopedRef]
public Span<T> AsSpan(int length)
{
Expand All @@ -308,19 +300,10 @@ private protected ref struct StackAllocedArguments
}

// Helper struct to avoid intermediate IntPtr[] allocation and RegisterForGCReporting in calls to the native reflection stack.
#if CORECLR
[InlineArray(MaxStackAllocArgCount)]
#endif
private protected ref struct StackAllocatedByRefs
{
internal ref byte _arg0;
#if !CORECLR
#pragma warning disable CA1823, CS0169, IDE0051 // accessed via 'CheckArguments' ref arithmetic
private ref byte _arg1;
private ref byte _arg2;
private ref byte _arg3;
#pragma warning restore CA1823, CS0169, IDE0051
#endif
}
#endif
}
Expand Down
Loading