Repository navigation
Commit 0a2ce0c
authored
Read the GC's thread context from a __thread pointer on Linux (#429)
On Linux the fast thread-local slot, the GC's stack context, was read
with pthread_getspecific: a call through the PLT on each allocation that
leaves the inline path, each time a String or a number is boxed, and
wherever HX_CTX_GET is used. In an OpenFL game it was 3 to 4% of the
main thread's samples. With GCC and Clang on Linux it is now a __thread
pointer, read with one load from the thread pointer. __thread rather
than thread_local: for an extern thread_local, C++ calls a wrapper in
case another unit initializes it dynamically.
Defining HXCPP_PTHREAD_FAST_TLS keeps pthread_getspecific.1 parent 810ced2 commit 0a2ce0c
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
147 | 163 | | |
148 | 164 | | |
149 | 165 | | |
| |||
0 commit comments