Skip to content

Commit a4ea872

Browse files
committed
perf(mobile): stop iOS syntax highlighting from looking up a thread-local on every lexer call
Compiled as C11, the wasm2c runtime makes its stack depth counter thread-local, and on Apple platforms every lexer function entry then calls _tlv_get_addr. The pod's C files now compile as gnu99, where wasm2c falls back to a plain global on Apple. Callers already serialize the lexer, so the counter never needs per-thread state.
1 parent a21d788 commit a4ea872

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎apps/mobile/modules/t3-highlights/T3HighlightsNative.podspec‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Pod::Spec.new do |s|
2020
s.compiler_flags = '-O2'
2121
s.pod_target_xcconfig = {
2222
'DEFINES_MODULE' => 'YES',
23+
# Under C11, wasm2c makes its stack depth counter thread-local, so every lexer
24+
# function entry calls _tlv_get_addr (2–9% of lexing time on an iPhone 12).
25+
# Callers already serialize the lexer (t3_highlights.h), so a plain global is safe.
26+
'GCC_C_LANGUAGE_STANDARD' => 'gnu99',
2327
# Plain malloc memory with explicit bounds checks: no guard-page signal
2428
# handlers competing with the app's crash reporting.
2529
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) WASM_RT_USE_MMAP=0 WASM_RT_MEMCHECK_BOUNDS_CHECK=1 WASM_RT_SKIP_SIGNAL_RECOVERY=1',

0 commit comments

Comments
 (0)