dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.38k stars 192 forks source link

[NativeAOT-LLVM] Implement WasmImportlinkage #2444

Closed yowl closed 8 months ago

yowl commented 8 months ago

This PR implements the new WasmImportlinkageAttribute and remove the old policy based mechanism. Added a test for the browser target as it is easier to fulfill the import in Javascript.

Added a key ExternSymbolKey to _externSymbolsWithAccessors to distinguish between Wasm imports and normal DllImports, Wasm imports of the same function from different modules, and imports of the same name but with different signatures.

When writing the object files, added a new dictionary _wasmImportLinkages to track emitted functions with the wasm import attributes. This allows us to remove duplicate imports as they behaviour for that is not defined.

yowl commented 8 months ago

cc @dotnet/nativeaot-llvm

yowl commented 8 months ago

Think the last commit addresses the remaining review comments, thanks.

yowl commented 8 months ago

Thanks for the extended review!