Repository navigation
Commit d521995
committed
perf: resolve the calling thread's own runtime without the global lock
Every Java -> JS call (and lock/unlock) resolved its runtime id through
GetRuntime(int), which takes the process-wide s_runtimeCacheMutex, so workers
and multithreaded JS serialized on one lock. A thread's own runtime is now
matched against a thread_local id first; other threads keep the locked map.
That relies on two invariants that are now checked: a thread hosts at most
one runtime (as com.tns.Runtime's constructor already enforces in Java), and
a runtime is only destroyed on the thread that created it.1 parent af0d2cc commit d521995
2 files changed
Lines changed: 27 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
| |||
144 | 149 | | |
145 | 150 | | |
146 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
302 | 313 | | |
303 | 314 | | |
304 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
305 | 322 | | |
306 | 323 | | |
307 | 324 | | |
| |||
1099 | 1116 | | |
1100 | 1117 | | |
1101 | 1118 | | |
| 1119 | + | |
1102 | 1120 | | |
1103 | 1121 | | |
1104 | 1122 | | |
| |||
1140 | 1158 | | |
1141 | 1159 | | |
1142 | 1160 | | |
| 1161 | + | |
1143 | 1162 | | |
1144 | 1163 | | |
1145 | 1164 | | |
| |||
1178 | 1197 | | |
1179 | 1198 | | |
1180 | 1199 | | |
| 1200 | + | |
1181 | 1201 | | |
1182 | 1202 | | |
1183 | 1203 | | |
| |||
1275 | 1295 | | |
1276 | 1296 | | |
1277 | 1297 | | |
| 1298 | + | |
1278 | 1299 | | |
1279 | 1300 | | |
1280 | 1301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 107 | + | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| 320 | + | |
| 321 | + | |
320 | 322 | | |
321 | 323 | | |
322 | 324 | | |
| |||
425 | 427 | | |
426 | 428 | | |
427 | 429 | | |
| 430 | + | |
428 | 431 | | |
429 | 432 | | |
430 | 433 | | |
| |||
0 commit comments