Automatically convert i32 pointer args to unsigned when CAN_ADDRESS_2GB is set#19740
Automatically convert i32 pointer args to unsigned when CAN_ADDRESS_2GB is set#19740
Conversation
6ca2414 to
a84657f
Compare
|
I think this change might also allows us to completely remove the unsignPointers pass.. but I'm not sure. |
864860e to
b09ddf0
Compare
8eb5546 to
1206ca2
Compare
34d58ac to
bb88913
Compare
| requestedSize = requestedSize >>> 0; | ||
| #if !MEMORY64 && !CAN_ADDRESS_2GB | ||
| // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned. | ||
| requestedSize >>>= 0; |
There was a problem hiding this comment.
Why do this? The code is only run if requestedSize === (requestedSize >>> 0).
There was a problem hiding this comment.
The reason for this special case is that we still want emscripten_resize_heap(MAX_INT32) to fail here even if CAN_ADDRESS_2GB is not set.. at least the tests expect that. So this function in particular has to force its parameter to unsigned even when CAN_ADDRESS_2GB is not set.
There was a problem hiding this comment.
In fact we want to fail especially if CAN_ADDRESS_2GB is not set.
Without this line the below assert(requestedSize > oldSize); will fail because requestedSize would come through as -1.
There was a problem hiding this comment.
Oh, right... this is for proper error handling. Higher values are not valid and we error on them.
| requestedSize = requestedSize >>> 0; | ||
| #if !MEMORY64 && !CAN_ADDRESS_2GB | ||
| // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned. | ||
| requestedSize >>>= 0; |
There was a problem hiding this comment.
Oh, right... this is for proper error handling. Higher values are not valid and we error on them.
|
I split out #19752 |
bb88913 to
e221930
Compare
sbc100
left a comment
There was a problem hiding this comment.
I reverted the potentially problematic parts of this change in src/library_strings.js.. so hopefully what remains is more conservative.
e221930 to
3e11c0c
Compare
…GB is set This extends the use automatically-generated JS wrappers to handle conversion of incoming i32 pointer to u32 JS numbers. This is only needed when CAN_ADDRESS_2GB is set. See #19737
3e11c0c to
96e9b41
Compare
kripken
left a comment
There was a problem hiding this comment.
Thanks, and sorry for insisting on those assertions, maybe I'm overly cautious but I think they might help someone.
This extends the use automatically-generated JS wrappers to handle conversion of incoming i32 pointer to u32 JS numbers. This is only needed when CAN_ADDRESS_2GB is set.
See #19737