diff options
author | Morgan Brown <morganbr@users.noreply.github.com> | 2018-08-06 03:39:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-06 03:39:48 +0300 |
commit | 84abd2b56c32550cc7a2bbbb66968752a62b4992 (patch) | |
tree | f15d3d1b31cae845e2dd1adb987443997dc38e00 /src/ILCompiler.WebAssembly | |
parent | a01ce99723b73ff88c869a898b9de92aff196136 (diff) |
Fix calling sealed virtual methods now that sealed vtables are always enabled. (#6180)
Diffstat (limited to 'src/ILCompiler.WebAssembly')
-rw-r--r-- | src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs index 677b18eeb..eab414bce 100644 --- a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs +++ b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs @@ -1105,6 +1105,14 @@ namespace Internal.IL private LLVMValueRef LLVMFunctionForMethod(MethodDesc callee, StackEntry thisPointer, bool isCallVirt) { string calleeName = _compilation.NameMangler.GetMangledMethodName(callee).ToString(); + + // Sealed methods must not be called virtually due to sealed vTables, so call them directly + if(callee.IsFinal || callee.OwningType.IsSealed()) + { + AddMethodReference(callee); + return GetOrCreateLLVMFunction(calleeName); + } + if (thisPointer != null && callee.IsVirtual && isCallVirt) { // TODO: Full resolution of virtual methods |