Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Wasm enable shared generics and generic virtual methods #7897

Open
wants to merge 91 commits into
base: master
from

Conversation

@yowl
Copy link
Contributor

yowl commented Dec 1, 2019

Mostly taken from the cpp backend, this enables shared generics and generic virtual methods for the Wasm backend. Have tried to keep the logic as clean as I could, but maybe there's some obvious enhancements/reductions in code that I missed.

Size of HelloWasm LLVM bc before, and after, . <- To be completed. HelloWasm before this change didn't have much in the way of generics so this mostly reflects the framework and runtime generics.

Enables the Simple/Generics tests for wasm which have the almost same coverage as cpp (Wasm includes an additional test) in terms of what is #if'ed out.

WIP as depends on #7893 and #7891

Fixes #7248

yowl added 30 commits Apr 20, 2019
…r at least might as well do that now rather than work around the lack of it.
# Conflicts:
#	tests/src/Simple/HelloWasm/Program.cs
add call for generic context
need to add the hidden param where necessary.
Still have to  do generic lookup functions and delegate thunks are undefined
Correct call for checking cctor to match cpp.  Return the value - but its not used yet
passes compilation.
Calling stub instead of signal()
exception thrown: RuntimeError: index out of bounds,__ZN6EEType18get_OptionalFieldsEv@http://localhost:6931/HelloWasm.wasm:wasm-function[19519]:0xc24eb3
__ZN6EEType13get_RareFlagsEv@http://localhost:6931/HelloWasm.wasm:wasm-function[19529]:0xc257d1
__ZN6EEType14RequiresAlign8Ev@http://localhost:6931/HelloWasm.wasm:wasm-function[19615]:0xc2a3d7
_RhpNewArray@http://localhost:6931/HelloWasm.wasm:wasm-function[19617]:0xc2a523
_S_P_TypeLoader_System_Collections_Generic_LowLevelDictionary_2_System___Canon__IntPtr___Clear@http://localhost:6931/HelloWasm.wasm:wasm-function[2237]:0x2f3c6f
_S_P_TypeLoader_System_Collections_Generic_LowLevelDictionary_2_System___Canon__IntPtr____ctor_0@http://localhost:6931/HelloWasm.wasm:wasm-function[1733]:0x29d8b4
_S_P_TypeLoader_System_Collections_Generic_LowLevelDictionary_2_System___Canon__IntPtr____ctor@http://localhost:6931/HelloWasm.wasm:wasm-function[1164]:0x256ca5
_S_P_TypeLoader_Internal_Runtime_TypeLoader_TypeLoaderEnvironment___ctor@http://localhost:6931/HelloWasm.wasm:wasm-function[861]:0x22fcff
_S_P_TypeLoader_Internal_Runtime_TypeLoader_TypeLoaderEnvironment__Initialize@http://localhost:6931/HelloWasm.wasm:wasm-function[470]:0x202c0b
_S_P_TypeLoader_Internal_Runtime_CompilerHelpers_LibraryInitializer__InitializeLibrary@http://localhost:6931/HelloWasm.wasm:wasm-function[400]:0x1fc3c6
_StartupCodeMain@http://localhost:6931/HelloWasm.wasm:wasm-function[396]:0x1fc2fe
___managed__Main@http://localhost:6931/HelloWasm.wasm:wasm-function[17784]:0xb875ad
_main@http://localhost:6931/HelloWasm.wasm:wasm-function[19766]:0xc31ced
Module._main@http://localhost:6931/HelloWasm.js:6592:33
callMain@http://localhost:6931/HelloWasm.js:7044:22
doRun@http://localhost:6931/HelloWasm.js:7102:49
Problem now seems to be that class statics are not initialised
now fails with

_S_P_CoreLib_System_Diagnostics_Debug__Fail_0@http://localhost:6931/HelloWasm.wasm:wasm-function[702]:0x21d82e
_S_P_CoreLib_System_Diagnostics_Debug__Assert_1@http://localhost:6931/HelloWasm.wasm:wasm-function[597]:0x20ff8a
_S_P_CoreLib_System_Diagnostics_Debug__Assert@http://localhost:6931/HelloWasm.wasm:wasm-function[337]:0x1f7a56
_S_P_CoreLib_System_Threading_ManagedThreadId__AllocateId@http://localhost:6931/HelloWasm.wasm:wasm-function[2330]:0x2fb83b
_S_P_CoreLib_System_Threading_ManagedThreadId___ctor@http://localhost:6931/HelloWasm.wasm:wasm-function[1682]:0x298e63
_S_P_CoreLib_System_Threading_ManagedThreadId__MakeForCurrentThread@http://localhost:6931/HelloWasm.wasm:wasm-function[1217]:0x25ae5b
_S_P_CoreLib_System_Threading_ManagedThreadId__get_Current@http://localhost:6931/HelloWasm.wasm:wasm-function[810]:0x22b6ce
_S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner__get_CurrentManagedThreadId@http://localhost:6931/HelloWasm.wasm:wasm-function[484]:0x2050c7
_S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner__EnsureClassConstructorRun@http://localhost:6931/HelloWasm.wasm:wasm-function[391]:0x1fbf2d
for the generic dict, try to remove the +1 pointer as otherwise the index lookup is one off - this maybe the wrong way to fix this.
Fails as InternalGetResourceString throws.
yowl added 30 commits Nov 22, 2019
…ed-fails

# Conflicts:
#	src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
Fails at TestConstrainedMethodCalls
Fails TestInstantiatingUnboxingStubs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.