Skip to content

Commit af247c4

Browse files
camchisjuliusmarminge
authored andcommitted
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 6b53b3d commit af247c4

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
@@ -18,6 +18,10 @@ Pod::Spec.new do |s|
1818
# slower. They are generated code, so optimize them in every configuration.
1919
s.compiler_flags = '-O2'
2020
s.pod_target_xcconfig = {
21+
# Under C11, wasm2c makes its stack depth counter thread-local, so every lexer
22+
# function entry calls _tlv_get_addr (2–9% of lexing time on an iPhone 12).
23+
# Callers already serialize the lexer (t3_highlights.h), so a plain global is safe.
24+
'GCC_C_LANGUAGE_STANDARD' => 'gnu99',
2125
# Plain malloc memory with explicit bounds checks: no guard-page signal
2226
# handlers competing with the app's crash reporting.
2327
'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)