提交 d7ff80f0 编写于 作者: J Jan Vorlicek

Fix missing unbox flag on method handle for struct methods

Fixes Loader\classloader\generics\regressions\dev10_393447 test runtime
failure when compiled with crossgen2.

This mimicks what old crossgen does.
上级 5e5a0d4e
......@@ -348,6 +348,12 @@ private ISymbolNode CreateTypeHandleHelper(TypeDesc type, SignatureContext signa
private ISymbolNode CreateMethodHandleHelper(MethodWithToken method, SignatureContext signatureContext)
{
bool useUnboxingStub = method.Method.IsUnboxingThunk();
if (useUnboxingStub)
{
method = new MethodWithToken(method.Method.GetUnboxedMethod(), method.Token, method.ConstrainedType);
}
bool useInstantiatingStub = method.Method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method.Method;
return new PrecodeHelperImport(
......@@ -355,7 +361,7 @@ private ISymbolNode CreateMethodHandleHelper(MethodWithToken method, SignatureCo
_codegenNodeFactory.MethodSignature(
ReadyToRunFixupKind.READYTORUN_FIXUP_MethodHandle,
method,
isUnboxingStub: false,
isUnboxingStub: useUnboxingStub,
isInstantiatingStub: useInstantiatingStub,
signatureContext));
}
......
......@@ -1698,10 +1698,20 @@ private void embedGenericHandle(ref CORINFO_RESOLVED_TOKEN pResolvedToken, bool
break;
case CorInfoGenericHandleType.CORINFO_HANDLETYPE_METHOD:
symbolNode = _compilation.SymbolNodeFactory.ReadyToRunHelper(
ReadyToRunHelperId.MethodHandle,
new MethodWithToken(HandleToObject(pResolvedToken.hMethod), HandleToModuleToken(ref pResolvedToken), constrainedType: null),
GetSignatureContext());
{
MethodDesc md = HandleToObject(pResolvedToken.hMethod);
TypeDesc td = HandleToObject(pResolvedToken.hClass);
if (td.IsValueType)
{
md = _unboxingThunkFactory.GetUnboxingMethod(md);
}
symbolNode = _compilation.SymbolNodeFactory.ReadyToRunHelper(
ReadyToRunHelperId.MethodHandle,
new MethodWithToken(md, HandleToModuleToken(ref pResolvedToken), constrainedType: null),
GetSignatureContext());
}
break;
case CorInfoGenericHandleType.CORINFO_HANDLETYPE_FIELD:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册