Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2017-07-27 03:57:26 +0300
committerFadi Hanna <fadim@microsoft.com>2017-07-27 03:57:26 +0300
commit47220f754b3f07e85972c64c7f6392798d9b039f (patch)
treeededfd9230e0cd3d046dbe07b69c11146da28143 /src/System.Private.Reflection.Execution
parentab0c3c080ce646d9f4d38b927ad5ad83651c4c94 (diff)
Delegate construction wasn't correctly working for all cases in USG code:
1) fixed calls to non-generic instance methods on structs to correctly use the unboxing stub 2) fixed calls to generic instance methods on structs to correctly unbox the thisPtr 3) fixed calls to non-generic instance methods on USG classes that do not require an instantiating argument (we were using a fat function pointer with a null dictionary component) [tfs-changeset: 1668066]
Diffstat (limited to 'src/System.Private.Reflection.Execution')
-rw-r--r--src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs b/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
index 74fd8a6fc..025db1e8b 100644
--- a/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
+++ b/src/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
@@ -701,10 +701,29 @@ namespace Internal.Reflection.Execution
Debug.Assert(parameterTypeHandles.Length == byRefParameters.Length && byRefParameters.Length == forcedByRefParameters.Length);
- bool isMethodOnStructure = RuntimeAugments.IsValueType(declaringType);
+ ThunkKind thunkKind;
+ if (methodBase.IsGenericMethod)
+ {
+ thunkKind = CallConverterThunk.ThunkKind.StandardToGenericInstantiating;
+ }
+ else if (RuntimeAugments.IsValueType(declaringType))
+ {
+ // Unboxing instantiating stub
+ if (dictionary == IntPtr.Zero)
+ {
+ Debug.Assert(!methodBase.IsStatic);
+ thunkKind = CallConverterThunk.ThunkKind.StandardToGeneric;
+ }
+ else
+ thunkKind = CallConverterThunk.ThunkKind.StandardToGenericInstantiating;
+ }
+ else
+ {
+ thunkKind = CallConverterThunk.ThunkKind.StandardToGenericInstantiatingIfNotHasThis;
+ }
return CallConverterThunk.MakeThunk(
- (methodBase.IsGenericMethod || isMethodOnStructure ? ThunkKind.StandardToGenericInstantiating : ThunkKind.StandardToGenericInstantiatingIfNotHasThis),
+ thunkKind,
methodEntrypoint,
dictionary,
!methodBase.IsStatic,
@@ -714,7 +733,10 @@ namespace Internal.Reflection.Execution
}
else
{
- return FunctionPointerOps.GetGenericMethodFunctionPointer(methodEntrypoint, dictionary);
+ if (dictionary == IntPtr.Zero)
+ return methodEntrypoint;
+ else
+ return FunctionPointerOps.GetGenericMethodFunctionPointer(methodEntrypoint, dictionary);
}
}