[browser][mono] Make sure we treat the 4GB ptrs as unsigned - #121221
Conversation
|
Please add http test to See |
|
|
|
|
This is previous attempt #109079 We introduced |
radekdoulik
left a comment
There was a problem hiding this comment.
Beside the comment it LGTM.
Looking forward to more fun with wasm64
|
I will have look at this tomorrow and probably add few more. I will also unify it with coreCLR version |
|
Looks good |
There was a problem hiding this comment.
Pull request overview
This PR addresses pointer handling issues for WebAssembly pointers exceeding 2GB by ensuring all pointer values are treated as unsigned throughout the browser/mono runtime. The changes are critical for supporting applications with memory usage above the 2GB mark.
Key changes:
- Added unsigned right shift operations (
>>> 0) to pointer accesses in memory operations, heap views, and buffer handling - Introduced
fixupPointerhelper function for consistent pointer conversion to unsigned values - Removed unused jiterpreter constant slots feature and simplified pointer constant handling
- Updated pointer parameter handling across crypto, WebSocket, debugger, event-pipe, and string marshaling modules
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/native/libs/System.Native.Browser/utils/memory.ts | Applied unsigned shift to HEAP8 array access for setHeapI8 and getHeapI8 |
| src/native/libs/System.Native.Browser/native/crypto.ts | Added unsigned conversion for crypto buffer pointer |
| src/mono/browser/runtime/web-socket.ts | Imported fixupPointer and applied to WebSocket buffer pointers and receive status pointer |
| src/mono/browser/runtime/strings.ts | Applied fixupPointer to string buffer pointers and unsigned shift to view slice/subarray operations |
| src/mono/browser/runtime/startup.ts | Applied fixupPointer to assembly and PDB data pointers for debugging |
| src/mono/browser/runtime/roots.ts | Applied unsigned conversion to root buffer offset and external root address |
| src/mono/browser/runtime/memory.ts | Applied unsigned shift to HEAP8/HEAPU8 array accesses and added pointer fixup to _zero_region |
| src/mono/browser/runtime/marshal.ts | Changed getI32 to getU32 for semaphore pointer and added fixupPointer to MemoryView constructor |
| src/mono/browser/runtime/jiterpreter.ts | Added unsigned conversion to TraceInfo ip and jiterpreter function parameters |
| src/mono/browser/runtime/jiterpreter-trace-generator.ts | Changed i32_const to ptr_const for class pointers and applied unsigned shift to offset |
| src/mono/browser/runtime/jiterpreter-support.ts | Removed constant slots feature, updated ptr_const implementation, applied unsigned shift to memarg offset |
| src/mono/browser/runtime/jiterpreter-jit-call.ts | Removed constant slot parameter from WasmBuilder and added unsigned conversion to trampoline parameters |
| src/mono/browser/runtime/jiterpreter-interp-entry.ts | Removed constant slot usage and added unsigned conversion with mask operation for imethod and entry parameters |
| src/mono/browser/runtime/diagnostics/index.ts | Applied unsigned shift to event-pipe buffer pointer |
| src/mono/browser/runtime/diagnostics/common.ts | Applied unsigned shift to diagnostics buffer pointer |
| src/mono/browser/runtime/debug.ts | Applied fixupPointer to debugger message and command buffer pointers |
| src/mono/browser/runtime/crypto.ts | Added unsigned conversion for crypto buffer pointer |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
kg
left a comment
There was a problem hiding this comment.
jiterp parts LGTM and i looked over everything else as well
Fixes problems with pointers over 2GB mark. This is still
use on your own riskconstantSlotsfeatureRelated #109079
Related #58382