Repository navigation
runtime/shims: remove thread_local and function-local static guards in d3d12_xs, file_system and xgameruntime - #7957
Conversation
…n d3d12_xs, file_system and xgameruntime
|
Tested
|
|
Tested
This is the first check on the head ( AI-assisted: written with DeepSeek V4.1 Flash in an OpenCode session. Every number and log line above comes from a real run on the machine named in it. |
|
AI-assisted review and test. Pass, no regressions. Tested
In Code read: I agree with it. Saving and restoring the last error around One non-blocking note: the two |
|
Tested
The last row is the one the description already explains (the inline
One nit: AI-assisted (Claude Code); no game files. |
|
Tested
Code read, no problems found:
Notes, none blocking:
No game files. AI-assisted (Claude Code). |
|
Tested Full AI-assisted (Claude Code); I read the full diff before building. |
|
Tested
AI-assisted (Claude Code). |
…function-local static guards in d3d12_xs, file_system and xgameruntime Squashed from ItsNotRexed#7957 by DevilNine, head b8c7363 (security scan PASS). Clean merge on top of ItsNotRexed#6582's XErrorReport and the Wave 0 static-guard PRs (ItsNotRexed#7175, ItsNotRexed#7198, ItsNotRexed#7359).
…ocal static guards) The descriptor-range table and heap-allocator locks (ItsNotRexed#7021) become constant-initialized SRWLOCK wrappers with a lazily made, immortal range vector; LEONIDA_XMEM_RESOURCE_BACKING (ItsNotRexed#7411) is cached in an atomic; XboxBvhBuilder's registration (ItsNotRexed#7516) makes its table with an immortal new. A function-local static with a dynamic initializer takes the CRT's thread-safe-init guard, which must not run on the title's thread once it owns TLS index 0 (the Wave 0 crash class).
…namic statics in d3d12_xs, d3d12_xs_device and xgameruntime_offline Squashed from ItsNotRexed#8178 by piyonchu, head aefa7be (security scan PASS). Applied as the PR's own diff (gh pr diff). One pattern per file: d3d12_xs.cpp keeps ItsNotRexed#7957's global INIT_ONCE helpers (already on main), so this PR's local-static INIT_ONCE versions there are not taken; d3d12_xs_device.cpp and xgameruntime_offline.cpp take this PR's INIT_ONCE form. The device vtable's INIT_ONCE keeps ItsNotRexed#7078's slot 25/56 struct-return entries (this PR's version predates them), and ItsNotRexed#2490's list vtable gets the same INIT_ONCE form, since lists are made on title threads.
…kQueueIsEmpty are forwarded to the real task queue Squashed from ItsNotRexed#8588 by tedin7, head e09f0a9 (security scan PASS). Applied as the PR's own diff (gh pr diff); head matches the watcher's scan. xgameruntime_test keeps Wave 1's per-thread time-sensitive flag checks (ItsNotRexed#7957); the old slot-8 comment that preceded this PR's new slot-8 test is dropped.
Summary
Follow-up in the RT-488 class (companion to #7074, #7175, #7198, #7359, and #7824, with zero file overlap) removing remaining static module TLS (
thread_local->_tls_index) and MSVC thread-safe function-local static initialization guards (_Init_thread_header->_Init_thread_epochin module TLS) across four untouched shims.Claimed in #7804 (comment).
Changes
runtime/shims/d3d12_xs.cpp:d3d12.dllhandle, 1.2 serializer support probe, and 4host(...)exports) with namespace-scopeINIT_ONCE+InitOnceExecuteOnce(passing object-pointer context structs; no function-pointer-to-void*cast).runtime/shims/file_system.cpp:host_copy_file2()'s function-local static withINIT_ONCEand replace copy-up'sstd::mutexwithSRWLOCK_INIT.runtime/shims/xgameruntime.cpp&runtime/shims/xgameruntime_gamesave.cpp:thread_local bool t_time_sensitiveandthread_local uint32_t t_read_countwith Win32TlsAllocslots initialized viaINIT_ONCE, preserving Win32GetLastError()acrossTlsGetValue/TlsSetValue.runtime/test/xgameruntime_test.cpp:GetLastError()preservation regression checks forXThreadingImplslots 27 and 30 (XThreadSetTimeSensitive/XThreadIsTimeSensitive).Symbol verification (
dumpbin /SYMBOLS, MSVC19.44.35229.0RelWithDebInfo onmaindde82f2)main)d3d12_xs.cpp.obj_Init_thread_header=1,_tls_index=10,0xgameruntime.cpp.obj_Init_thread_header=0,_tls_index=10,0xgameruntime_gamesave.cpp.obj_Init_thread_header=0,_tls_index=10,0file_system.cpp.objhost_copy_file2+ `startup_trace.h`0local `` guards infile_system.cpp(only inline `startup_trace::detail::mutex()` remains until #7824 lands)Overlap check
Zero files in common with #7074 (
library_loader.cpp), #7175 (registry.cpp), #7198 (winhttp_offline.cpp), #7359 (gameinput.cpp,dxgi_com.cpp,xmem.cpp), #7824 / #7723 (startup_trace.h,xgameruntime_offline.cpp), or actived3d12_xs_device.cppPRs. No game files or game data are included.Testing
32.0.16.2124), MSVC19.44.35229.0, Windows SDK10.0.26100.0, CMake + NinjaRelWithDebInfoonmain(dde82f2).6/6 passed, 0 failed):device_proxy,device_proxy_trace,root_sig,file_system,xgameruntime,xgameruntime_gamesave.python -I scripts/check_no_game_data.pyexited0on all 5 changed files.AI-assisted (Gemini / Antigravity).