Bug 240209

Summary: Force PAS_ASSERT to generate different crash sites for each assertion.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: bmallocAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, ggaren, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[fast-cq] proposed patch. none

Description Mark Lam 2022-05-07 14:40:30 PDT
Clang currently optimizes all crash sites into one in each function.  Hence, if we get a crash address at the 1 crash site, we don't know which failed assertion got us there.  This patch uses an asm statement to force Clang to emit a different crash site for each assertion.

Benchmarks show that performance is neutral on both Jetstream2 and Speedometer2.

Size-wise, there is some increase.  The following is the "size" output on JavaScriptCore on M1:

      __TEXT.   __DATA  __OBJC  others    dec       hex
old   19628032  180224  0       18792448  38600704  24d0000
new   19644416  180224  0       19251200  39075840  2544000

diff  16384     0       0       458752    475136

The increase in the "others" categories are mostly in the String Table, Symbol Table, and Function Start Addresses.  These take up disk space but should not impact RAM usage unless they are accessed by a a debugger.
Comment 1 Mark Lam 2022-05-07 14:49:09 PDT
Created attachment 459003 [details]
[fast-cq] proposed patch.
Comment 2 Yusuke Suzuki 2022-05-07 15:14:40 PDT
Comment on attachment 459003 [details]
[fast-cq] proposed patch.

r=me
Comment 3 Mark Lam 2022-05-07 15:15:38 PDT
Comment on attachment 459003 [details]
[fast-cq] proposed patch.

Thanks for the review.
Comment 4 Radar WebKit Bug Importer 2022-05-07 15:17:15 PDT
<rdar://problem/92913312>
Comment 5 Alexey Proskuryakov 2022-05-07 18:17:45 PDT
Do we need the same in WTF?
Comment 6 Mark Lam 2022-05-07 19:38:54 PDT
(In reply to Alexey Proskuryakov from comment #5)
> Do we need the same in WTF?

No because WTF assertion crashes via WTFCrashWithInfoImpl.  This effectively puts the caller on the stack, which points to the assertion site.
Comment 7 EWS 2022-05-07 19:42:48 PDT
Committed r293952 (250398@main): <https://commits.webkit.org/250398@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 459003 [details].