-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Closes #16176 : Making writeStackCookie() to use HEAPU32 #16433
base: main
Are you sure you want to change the base?
Conversation
Made the makeSetValue() function to accept unsigned as a bool parameter, and based on this bool value decide the type of HEAP(HEAP32/HEAPU32).
* @param {bool} ignore: legacy, ignored. | ||
* @param {number} align: TODO | ||
* @param {bool} noSafe: TODO | ||
* @param {string} sep: TODO | ||
* @param {bool} forcedAlign: legacy, ignored. | ||
* @return {TODO} | ||
*/ | ||
function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, sep = ';', forcedAlign) { | ||
function makeSetValue(ptr, pos, value, type, noNeedFirst, unsigned, ignore, align, noSafe, sep = ';', forcedAlign) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new argument in this position will bread existing callers.
I'd rather not add complexity to makeSetValue by adding another argument here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(also I'm curious why this was never needed before... how is it that all of the makeSetValue
calls works just fine without ever using the unsigned heaps..).
{{{ makeSetValue('max', 0, '0x2135467', 'i32' ) }}}; | ||
{{{ makeSetValue('max', 4, '0x89BACDFE', 'i32' ) }}}; | ||
{{{ makeSetValue('max', 0, '0x2135467', 'i32', 0, true) }}}; | ||
{{{ makeSetValue('max', 4, '0x89BACDFE', 'i32', 0, true) }}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about instead we just change these lines to:
HEAPU32[(max >> 2)] = 0x2135467
HEAPU32[(max >> 2) + 1] = 0x89BACDFE
(also the line below would need updating too).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even better you can do:
var max = _emscripten_stack_get_end() >> 2;
HEAPU32[max] = 0x2135467;
HEAPU32[max + 1] = 0x89BACDFE;
Made the makeSetValue() function to accept unsigned as a bool parameter,
and based on this bool value decide the type of HEAP(HEAP32/HEAPU32).