return new ConstructorInvoker(runtimeConstructor);
}
- public object? Invoke()
+ public object Invoke()
{
return _methodBaseInvoker.CreateInstanceWithFewArgs(new Span<object?>());
}
- public object? Invoke(object? arg1)
+ public object Invoke(object? arg1)
{
return _methodBaseInvoker.CreateInstanceWithFewArgs(new Span<object?>(ref arg1));
}
- public object? Invoke(object? arg1, object? arg2)
+ public object Invoke(object? arg1, object? arg2)
{
StackAllocatedArguments argStorage = default;
argStorage._args.Set(0, arg1);
return _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(2));
}
- public object? Invoke(object? arg1, object? arg2, object? arg3)
+ public object Invoke(object? arg1, object? arg2, object? arg3)
{
StackAllocatedArguments argStorage = default;
argStorage._args.Set(0, arg1);
return _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(3));
}
- public object? Invoke(object? arg1, object? arg2, object? arg3, object? arg4)
+ public object Invoke(object? arg1, object? arg2, object? arg3, object? arg4)
{
StackAllocatedArguments argStorage = default;
argStorage._args.Set(0, arg1);
return _methodBaseInvoker.CreateInstanceWithFewArgs(argStorage._args.AsSpan(4));
}
- public object? Invoke(Span<object?> arguments)
+ public object Invoke(Span<object?> arguments)
{
return _methodBaseInvoker.CreateInstance(arguments);
Initialize(argumentTypes, out _strategy, out _invokerArgFlags, out _needsByRefStrategy);
}
- public object? Invoke() => Invoke(null, null, null, null);
- public object? Invoke(object? arg1) => Invoke(arg1, null, null, null);
- public object? Invoke(object? arg1, object? arg2) => Invoke(arg1, arg2, null, null);
- public object? Invoke(object? arg1, object? arg2, object? arg3) => Invoke(arg1, arg2, arg3, null);
- public object? Invoke(object? arg1, object? arg2, object? arg3, object? arg4)
+ public object Invoke() => Invoke(null, null, null, null);
+ public object Invoke(object? arg1) => Invoke(arg1, null, null, null);
+ public object Invoke(object? arg1, object? arg2) => Invoke(arg1, arg2, null, null);
+ public object Invoke(object? arg1, object? arg2, object? arg3) => Invoke(arg1, arg2, arg3, null);
+ public object Invoke(object? arg1, object? arg2, object? arg3, object? arg4)
{
if ((_invocationFlags & (InvocationFlags.NoInvoke | InvocationFlags.ContainsStackPointers)) != 0)
{
// Check fast path first.
if (_invokeFunc_Obj4Args is not null)
{
- return _invokeFunc_Obj4Args(obj: null, arg1, arg2, arg3, arg4);
+ return _invokeFunc_Obj4Args(obj: null, arg1, arg2, arg3, arg4)!;
}
if ((_strategy & InvokerStrategy.StrategyDetermined_Obj4Args) == 0)
DetermineStrategy_Obj4Args(ref _strategy, ref _invokeFunc_Obj4Args, _method, _needsByRefStrategy, backwardsCompat: false);
if (_invokeFunc_Obj4Args is not null)
{
- return _invokeFunc_Obj4Args(obj: null, arg1, arg2, arg3, arg4);
+ return _invokeFunc_Obj4Args(obj: null, arg1, arg2, arg3, arg4)!;
}
}
return InvokeDirectByRef(arg1, arg2, arg3, arg4);
}
- public object? Invoke(Span<object?> arguments)
+ public object Invoke(Span<object?> arguments)
{
if (!_needsByRefStrategy)
{
return InvokeWithFewArgs(arguments);
}
- internal object? InvokeWithFewArgs(Span<object?> arguments)
+ internal object InvokeWithFewArgs(Span<object?> arguments)
{
Debug.Assert(_argCount <= MaxStackAllocArgCount);
// Check fast path first.
if (_invokeFunc_ObjSpanArgs is not null)
{
- return _invokeFunc_ObjSpanArgs(obj : null, copyOfArgs);
+ return _invokeFunc_ObjSpanArgs(obj : null, copyOfArgs)!;
// No need to call CopyBack here since there are no ref values.
}
DetermineStrategy_ObjSpanArgs(ref _strategy, ref _invokeFunc_ObjSpanArgs, _method, _needsByRefStrategy, backwardsCompat: false);
if (_invokeFunc_ObjSpanArgs is not null)
{
- return _invokeFunc_ObjSpanArgs(obj: null, copyOfArgs);
+ return _invokeFunc_ObjSpanArgs(obj: null, copyOfArgs)!;
}
}
- object? ret = InvokeDirectByRefWithFewArgs(copyOfArgs);
+ object ret = InvokeDirectByRefWithFewArgs(copyOfArgs);
CopyBack(arguments, copyOfArgs, shouldCopyBack);
return ret;
}
- internal object? InvokeDirectByRef(object? arg1 = null, object? arg2 = null, object? arg3 = null, object? arg4 = null)
+ internal object InvokeDirectByRef(object? arg1 = null, object? arg2 = null, object? arg3 = null, object? arg4 = null)
{
StackAllocatedArguments stackStorage = new(arg1, arg2, arg3, arg4);
return InvokeDirectByRefWithFewArgs(stackStorage._args.AsSpan(_argCount));
}
- internal unsafe object? InvokeDirectByRefWithFewArgs(Span<object?> copyOfArgs)
+ internal unsafe object InvokeDirectByRefWithFewArgs(Span<object?> copyOfArgs)
{
if ((_strategy & InvokerStrategy.StrategyDetermined_RefArgs) == 0)
{
ByReference.Create(ref copyOfArgs[i]);
}
- return _invokeFunc_RefArgs!(obj: null, pByRefFixedStorage);
+ return _invokeFunc_RefArgs!(obj: null, pByRefFixedStorage)!;
}
- internal unsafe object? InvokeWithManyArgs(Span<object?> arguments)
+ internal unsafe object InvokeWithManyArgs(Span<object?> arguments)
{
Span<object?> copyOfArgs;
GCFrameRegistration regArgStorage;
- object? ret;
+ object ret;
if ((_strategy & InvokerStrategy.StrategyDetermined_ObjSpanArgs) == 0)
{
copyOfArgs[i] = arg;
}
- ret = _invokeFunc_ObjSpanArgs(obj: null, copyOfArgs);
+ ret = _invokeFunc_ObjSpanArgs(obj: null, copyOfArgs)!;
// No need to call CopyBack here since there are no ref values.
}
finally
ByReference.Create(ref Unsafe.AsRef<object>(pStorage + i));
}
- ret = _invokeFunc_RefArgs!(obj: null, pByRefStorage);
+ ret = _invokeFunc_RefArgs!(obj: null, pByRefStorage)!;
CopyBack(arguments, copyOfArgs, shouldCopyBack);
}
finally
public sealed partial class ConstructorInvoker
{
internal ConstructorInvoker() { }
- public object? Invoke(System.Span<object?> arguments) { throw null; }
- public object? Invoke() { throw null; }
- public object? Invoke(object? arg1) { throw null; }
- public object? Invoke(object? arg1, object? arg2) { throw null; }
- public object? Invoke(object? arg1, object? arg2, object? arg3) { throw null; }
- public object? Invoke(object? arg1, object? arg2, object? arg3, object? arg4) { throw null; }
+ public object Invoke(System.Span<object?> arguments) { throw null; }
+ public object Invoke() { throw null; }
+ public object Invoke(object? arg1) { throw null; }
+ public object Invoke(object? arg1, object? arg2) { throw null; }
+ public object Invoke(object? arg1, object? arg2, object? arg3) { throw null; }
+ public object Invoke(object? arg1, object? arg2, object? arg3, object? arg4) { throw null; }
public static System.Reflection.ConstructorInvoker Create(System.Reflection.ConstructorInfo constructor) { throw null; }
}
public partial class CustomAttributeData