Skip to content

[browser] fix 4GB JS interop - #109079

Merged
ilonatommy merged 10 commits into
dotnet:mainfrom
pavelsavara:browser_fix_4gb
Oct 31, 2024
Merged

ilonatommy merged 10 commits into
dotnet:mainfrom
pavelsavara:browser_fix_4gb

Conversation

@pavelsavara

@pavelsavara pavelsavara commented Oct 21, 2024

Copy link
Copy Markdown
Member

This is use on your own risk

Even when we try to make this work, we do not think it's good idea to allocate more than 256MB in a web page.

  • add new malloc which is wrapper over Module._malloc that returns uint32 rather than negative number above 2GB
  • fix receiving pointers when calling to JS on via ICALL
  • fix marshaling IntPtr as uint32 to JS, because typically it's used as offset to array
  • add Module parameter to preRun and other emscripten events. So that it could be used to test memory.
  • improved MemoryTest WBT to waste 2GB before starting the mono runtime.

@pavelsavara
pavelsavara marked this pull request as ready for review October 24, 2024 17:17
@pavelsavara
pavelsavara requested review from ilonatommy, kg and maraf and removed request for ilonatommy, lewing and maraf October 24, 2024 17:17
Comment thread src/mono/browser/runtime/debug.ts Outdated
Comment thread src/mono/browser/runtime/invoke-js.ts Outdated

@kg kg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the incremental improvements you're making while doing this

Comment thread src/mono/wasm/testassets/WasmBasicTestApp/App/MemoryTest.cs Outdated
Comment thread src/mono/wasm/testassets/WasmBasicTestApp/App/MemoryTest.cs Outdated
Comment thread src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js
pavelsavara and others added 2 commits October 25, 2024 11:17
Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>
Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>
Comment thread src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js Outdated
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants