Skip to content

Commit

Permalink
Revert to overhead returns default instead of Unsafe.SkinInit.
Browse files Browse the repository at this point in the history
  • Loading branch information
timcassell committed Jun 9, 2023
1 parent 3c3798f commit 3780045
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private static void PrepareInstanceAndResultType(
if (isUsingAsyncKeyword)
throw new NotSupportedException("Async void is not supported by design.");
}
else if (resultType.IsByRefLike() || resultType?.GetElementType()?.IsByRefLike() == true)
else if (resultType.IsByRefLike() || resultType.GetElementType()?.IsByRefLike() == true)
{
throw new NotSupportedException("InProcessNoEmitToolchain does not support consuming ByRefLike return types.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,9 @@ public BenchmarkAction(object instance, MethodInfo method, int unrollFactor)
InvokeMultiple = InvokeMultipleHardcoded;
}

private static T OverheadStatic()
{
Unsafe.SkipInit(out T value);
return value;
}
private static T OverheadStatic() => default;

private T OverheadInstance()
{
Unsafe.SkipInit(out T value);
return value;
}
private T OverheadInstance() => default;

private void InvokeSingleHardcoded() => consumer.Consume(callback());

Expand Down Expand Up @@ -274,11 +266,7 @@ public BenchmarkActionTask(object instance, MethodInfo method, int unrollFactor)
InvokeMultiple = InvokeMultipleHardcoded;
}

private T Overhead()
{
Unsafe.SkipInit(out T value);
return value;
}
private T Overhead() => default;

// must be kept in sync with GenericTaskDeclarationsProvider.TargetMethodDelegate
private T ExecuteBlocking() => startTaskCallback().GetAwaiter().GetResult();
Expand Down Expand Up @@ -362,11 +350,7 @@ public BenchmarkActionValueTask(object instance, MethodInfo method, int unrollFa
InvokeMultiple = InvokeMultipleHardcoded;
}

private T Overhead()
{
Unsafe.SkipInit(out T value);
return value;
}
private T Overhead() => default;

// must be kept in sync with GenericTaskDeclarationsProvider.TargetMethodDelegate
private T ExecuteBlocking() => startTaskCallback().GetAwaiter().GetResult();
Expand Down

0 comments on commit 3780045

Please sign in to comment.