Fix sealed vtable calls on Wasm (#6333)
* Fix calls on sealed vtables by disabling relative pointers for WebAssembly
This commit is contained in:
Родитель
9d3c292000
Коммит
cd45c14793
|
@ -110,7 +110,7 @@ namespace Internal.TypeSystem
|
|||
{
|
||||
get
|
||||
{
|
||||
return Abi != TargetAbi.CppCodegen;
|
||||
return (Abi != TargetAbi.CppCodegen) && (Architecture != TargetArchitecture.Wasm32);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -606,6 +606,10 @@ namespace ILCompiler.DependencyAnalysis
|
|||
{
|
||||
Relocation reloc = relocs[nextRelocIndex];
|
||||
|
||||
// Make sure we've gotten the correct size for the reloc
|
||||
Debug.Assert(reloc.RelocType == RelocType.IMAGE_REL_BASED_DIR64 ||
|
||||
reloc.RelocType == RelocType.IMAGE_REL_BASED_HIGHLOW);
|
||||
|
||||
long delta;
|
||||
unsafe
|
||||
{
|
||||
|
|
|
@ -454,6 +454,17 @@ internal static class Program
|
|||
{
|
||||
PrintLine("Struct interface test: Ok.");
|
||||
}
|
||||
|
||||
ClassWithSealedVTable classWithSealedVTable = new ClassWithSealedVTable();
|
||||
PrintString("Interface dispatch with sealed vtable test: ");
|
||||
if (CallItf(classWithSealedVTable) == 37)
|
||||
{
|
||||
PrintLine("Ok.");
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintLine("Failed.");
|
||||
}
|
||||
}
|
||||
|
||||
// Calls the ITestItf interface via a generic to ensure the concrete type is known and
|
||||
|
@ -463,6 +474,11 @@ internal static class Program
|
|||
return obj.GetValue();
|
||||
}
|
||||
|
||||
private static int CallItf(ISomeItf asItf)
|
||||
{
|
||||
return asItf.GetValue();
|
||||
}
|
||||
|
||||
private static void StaticCtorTest()
|
||||
{
|
||||
BeforeFieldInitTest.Nop();
|
||||
|
@ -851,3 +867,16 @@ public sealed class SealedDerived : MyBase
|
|||
return _data * 3;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassWithSealedVTable : ISomeItf
|
||||
{
|
||||
public int GetValue()
|
||||
{
|
||||
return 37;
|
||||
}
|
||||
}
|
||||
|
||||
interface ISomeItf
|
||||
{
|
||||
int GetValue();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче