Fix RhGetCodeTarget for Unix x64 (#5168)
This commit is contained in:
Родитель
ab4222fba0
Коммит
39a8b6ac90
|
@ -448,8 +448,15 @@ COOP_PINVOKE_HELPER(UInt8 *, RhGetCodeTarget, (UInt8 * pCodeOrg))
|
||||||
#ifdef _TARGET_AMD64_
|
#ifdef _TARGET_AMD64_
|
||||||
UInt8 * pCode = pCodeOrg;
|
UInt8 * pCode = pCodeOrg;
|
||||||
|
|
||||||
// is this "add rcx,8"?
|
// is this "add rcx/rdi,8"?
|
||||||
if (pCode[0] == 0x48 && pCode[1] == 0x83 && pCode[2] == 0xc1 && pCode[3] == 0x08)
|
if (pCode[0] == 0x48 &&
|
||||||
|
pCode[1] == 0x83 &&
|
||||||
|
#ifdef UNIX_AMD64_ABI
|
||||||
|
pCode[2] == 0xc7 &&
|
||||||
|
#else
|
||||||
|
pCode[2] == 0xc1 &&
|
||||||
|
#endif
|
||||||
|
pCode[3] == 0x08)
|
||||||
{
|
{
|
||||||
// unboxing sequence
|
// unboxing sequence
|
||||||
unboxingStub = true;
|
unboxingStub = true;
|
||||||
|
|
|
@ -358,14 +358,11 @@ internal class ReflectionTest
|
||||||
|
|
||||||
Type byRefLikeType = GetTestType(nameof(TestByRefLikeTypeMethod), nameof(ByRefLike));
|
Type byRefLikeType = GetTestType(nameof(TestByRefLikeTypeMethod), nameof(ByRefLike));
|
||||||
MethodInfo toStringMethod = byRefLikeType.GetMethod("ToString");
|
MethodInfo toStringMethod = byRefLikeType.GetMethod("ToString");
|
||||||
/*var toString = (ToStringDelegate)*/toStringMethod.CreateDelegate(typeof(ToStringDelegate));
|
var toString = (ToStringDelegate)toStringMethod.CreateDelegate(typeof(ToStringDelegate));
|
||||||
|
|
||||||
// Doesn't work on Unix: https://github.com/dotnet/corert/issues/4379
|
|
||||||
#if false
|
|
||||||
ByRefLike foo = new ByRefLike(123);
|
ByRefLike foo = new ByRefLike(123);
|
||||||
if (toString(ref foo) != "123")
|
if (toString(ref foo) != "123")
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче