Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f6bc402b8344ad1774116fc13e7a07440ed91250
      
https://github.com/WebKit/WebKit/commit/f6bc402b8344ad1774116fc13e7a07440ed91250
  Author: Carlos Alberto Lopez Perez <[email protected]>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M Source/WTF/wtf/StackBounds.h

  Log Message:
  -----------
  [WTF] Make StackBounds::currentThreadStackBounds() private to Thread
https://bugs.webkit.org/show_bug.cgi?id=320926

Reviewed by Yusuke Suzuki.

On Linux, obtaining the main thread stack bounds can be expensive.
currentThreadStackBoundsInternal() calls pthread_getattr_np(), which may
parse the entire /proc/self/maps file to locate the main thread stack.
Calling it repeatedly can cause performance problems like the one fixed
in 318487@main.

currentThreadStackBounds() is intended to be called during thread
initialization, with the result cached in Thread::m_stack. Other code
should read the cached bounds using Thread::currentSingleton().stack().

Nothing enforced this restriction, which allowed the uncached function
to be used repeatedly. Move currentThreadStackBounds() to the private
section and make Thread a friend, preventing other callers from
accidentally bypassing the cached bounds.

* Source/WTF/wtf/StackBounds.h:
(WTF::StackBounds::currentThreadStackBounds):

Canonical link: https://commits.webkit.org/318534@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to