mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
AK: Use __builtin_frame_address to find current stack depth remaining
Instead of checking the address of a temporary, grab the address of the current frame pointer to determine how much memory is left on the stack. This better communicates to the compiler what we're trying to do, and resolves some crashes with ASAN in test-js while the option detect_stack_use_after_return is turned on.
This commit is contained in:
parent
96b197ef46
commit
7d71acf1bb
Notes:
sideshowbarker
2024-07-16 23:08:48 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/7d71acf1bb Pull-request: https://github.com/SerenityOS/serenity/pull/19723 Issue: https://github.com/SerenityOS/serenity/issues/17163
1 changed files with 2 additions and 2 deletions
|
@ -19,8 +19,8 @@ public:
|
|||
size_t size() const { return m_size; }
|
||||
size_t size_free() const
|
||||
{
|
||||
FlatPtr dummy;
|
||||
return reinterpret_cast<FlatPtr>(&dummy) - m_base;
|
||||
auto p = reinterpret_cast<FlatPtr>(__builtin_frame_address(0));
|
||||
return p - m_base;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue