@@ -78,48 +78,6 @@ protected override void OnEmitCtorBodyOverride(ConstructorBuilder constructorBui
78
78
ilBuilder . Emit ( OpCodes . Stfld , consumerField ) ;
79
79
}
80
80
81
- public override void EmitOverheadImplementation ( ILGenerator ilBuilder , Type returnType )
82
- {
83
- // ByRefLike types and pointers use default, everything else uses Unsafe.SkipInit.
84
- if ( returnType . IsByRefLike ( ) || returnType . IsPointer )
85
- {
86
- /*
87
- // return default;
88
- IL_0000: ldc.i4.0
89
- IL_0001: ret
90
- */
91
- // optional local if default(T) uses .initobj
92
- var optionalLocalForInitobj = ilBuilder . DeclareOptionalLocalForReturnDefault ( returnType ) ;
93
- ilBuilder . EmitReturnDefault ( returnType , optionalLocalForInitobj ) ;
94
- return ;
95
- }
96
-
97
- /*
98
- // System.Runtime.CompilerServices.Unsafe.SkipInit(out BenchmarkDotNet.Samples.CustomWithConsumable value);
99
- // return value;
100
- .locals init (
101
- [0] valuetype BenchmarkDotNet.Samples.CustomWithConsumable
102
- )
103
-
104
- IL_0000: ldloca.s 0
105
- IL_0002: call void Unsafe::SkipInit<valuetype BenchmarkDotNet.Samples.CustomWithConsumable>(!!0&)
106
- IL_0007: ldloc.0
107
- IL_0008: ret
108
- */
109
- var local = ilBuilder . DeclareLocal ( returnType ) ;
110
- ilBuilder . EmitLdloca ( local ) ;
111
- ilBuilder . Emit ( OpCodes . Call , GetGenericSkipInitMethod ( returnType ) ) ;
112
- ilBuilder . EmitLdloc ( local ) ;
113
- ilBuilder . Emit ( OpCodes . Ret ) ;
114
- }
115
-
116
- private static MethodInfo GetGenericSkipInitMethod ( Type skipInitType )
117
- {
118
- return typeof ( Unsafe ) . GetMethods ( BindingFlags . Static | BindingFlags . Public )
119
- . Single ( m => m . Name == nameof ( Unsafe . SkipInit ) && m . IsGenericMethodDefinition && m . ReturnType == typeof ( void ) && m . GetParameters ( ) . Single ( ) . IsOut )
120
- . MakeGenericMethod ( skipInitType ) ;
121
- }
122
-
123
81
protected override void EmitActionBeforeCallOverride ( ILGenerator ilBuilder )
124
82
{
125
83
/*
0 commit comments