Commit 7ab39d0
committed
Time::HiRes slim down Win32's _gettimeofday() _clock_gettime() polyfills
-remove align padding bytes from struct my_cxt_t{}.
unsigned long run_count; is always 4 bytes, the other 3 members are
always 8 bytes
-cleanup ABI/machine code gen of Win32-only static fn _gettimeofday()
It never leaves this TU as a fn ptr. MSVC 2022 -O1/-O2 optimizer can only
create unitialzed reg/C stk "holes" for args that are unused in
all callers and unused in callee. It can't shift left or collapse any
both sides, unused registers/C arguments, in 1 TU, even if no fn ptr
if taken in a static function. The new macro remains POSIX-like.
-In _GetSystemTimePreciseAsFileTime(), immediatly copy contents of our
" &C_auto_u64 " var, to a new C auto var, so the 64-bit value
"outputs" or psuedo-retvals of the MS Win API funcs, can be manipulated
for the rest of the function's body, completly in CPU registers, with 0%
chance of re-reading or pointlessly writing back to the C stack memory
address.
-Do the same for _gettimeofday_x() when _gettimeofday_x() calls the MS
public Win API funcs.
-Inside _GetSystemTimePreciseAsFileTime(), hoist/combine/factor out the 2
different callsites of QueryPerformanceCounter() to the root block.
All branches will execute QueryPerformanceCounter() anyways. MSVC 2022
refused to hoist the QueryPerformanceCounter() call, around the statement
if(MY_CXT.run_count++==0
||MY_CXT.base_systime_as_filetime.ft_i64>MY_CXT.reset_time){
-add PERL_STATIC_FORCE_INLINE for static funcs like _clock_gettime() that
have exactly 1 caller/callsite, usually this is XSUB function with a CV*
argument.
-add PERL_STATIC_FORCE_INLINE to _gettimeofday(), even though it has
8 different callers/callsites. The reason is because _gettimeofday() has
a huge amount of U64 math at its bottom. All the callers then do a huge
amount of mostly FP NV/double math, before saving the final NV value to a
SV* with NOK_on. To allow the CC to optimize/combine/simplify these 2
large groups of U64 math and NV math, they must be in the same function.
So add PERL_STATIC_FORCE_INLINE to _gettimeofday().
sortunsigned long run_count1 parent 56179e8 commit 7ab39d0
1 file changed
+68
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
139 | | - | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
| 146 | + | |
143 | 147 | | |
144 | 148 | | |
145 | 149 | | |
| |||
190 | 194 | | |
191 | 195 | | |
192 | 196 | | |
193 | | - | |
| 197 | + | |
194 | 198 | | |
195 | 199 | | |
196 | 200 | | |
| |||
239 | 243 | | |
240 | 244 | | |
241 | 245 | | |
| 246 | + | |
242 | 247 | | |
243 | 248 | | |
244 | 249 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
255 | 273 | | |
256 | 274 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 275 | + | |
| 276 | + | |
262 | 277 | | |
263 | 278 | | |
264 | | - | |
| 279 | + | |
265 | 280 | | |
266 | | - | |
267 | | - | |
268 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
269 | 284 | | |
270 | 285 | | |
271 | | - | |
272 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
273 | 292 | | |
274 | 293 | | |
275 | | - | |
276 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
277 | 302 | | |
278 | 303 | | |
279 | | - | |
280 | | - | |
| 304 | + | |
281 | 305 | | |
282 | 306 | | |
283 | 307 | | |
284 | 308 | | |
285 | | - | |
| 309 | + | |
286 | 310 | | |
287 | 311 | | |
288 | | - | |
| 312 | + | |
289 | 313 | | |
290 | | - | |
| 314 | + | |
291 | 315 | | |
292 | 316 | | |
293 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
294 | 320 | | |
295 | 321 | | |
296 | | - | |
297 | | - | |
298 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
299 | 325 | | |
| 326 | + | |
| 327 | + | |
300 | 328 | | |
301 | | - | |
302 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
303 | 332 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
310 | 336 | | |
311 | 337 | | |
312 | 338 | | |
313 | | - | |
314 | 339 | | |
315 | 340 | | |
316 | 341 | | |
| |||
0 commit comments