Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue where togglerefs might be incorrectly pinned. (#12933)
Due to current order, process togglerefs and then take current threads stack could cause a problem where toogleref references might be left in registers after native code process the list and those reference would then be put into current thread context, incorrectly pinning the toggleref, preventing it from being GC:ed. The problem was observed on Windows (in debug build) running sgen-toggleref.exe runtime test since the native compile of sgen_process_togglerefs used a register when walking the list of togglerefs that was then not re-used until the current threads stack was taken, causing incorrect pinning. This problem could in theory happen on any platform depending on how sgen_process_togglerefs would been compiled and what register will be used. Fix is to take current threads context before walking the togglerefs to make sure we are not getting managed references into registers as part of managing the toggleref list in native code.
- Loading branch information