Age | Commit message (Collapse) | Author |
|
Fix incremental GC thread stack/register pushing on windows (case 1411601)
|
|
* Dynamically lookup IsWow64Process2 and fallback to IsWow64Process if
needed.
* Store TIB on each thread and lookup via call to NtCurrentTeb on thread
registration rather than calling GetThreadSelectorEntry which is not
available on UWP.
|
|
We are missing commit 5668de71107022a316ee967162bc16c10754b9ce in our
branch, and previous commit references variables added in this commit.
|
|
(fix of commits 449eda034, 190e18c75)
During incremental collection GC_push_all_stacks() may be called when
the world is not stopped. If the context registers and sp value are
saved during thread suspension then GC_push_all_stacks() gets these
values of the previous GC cycle or, even, gets all zeros instead the
context registers and sp on the first GC after the thread creation.
This commit fixes this by calling GetThreadContext in GC_push_stack_for
if thread is not suspended.
* win32_threads.c (first_thread): Refine the comment.
* win32_threads.c [!GC_NO_THREADS_DISCOVERY && RETRY_GET_THREAD_CONTEXT]
(GC_delete_gc_thread_no_free): Reset context_sp if GC_win32_dll_threads.
* win32_threads.c (GC_push_stack_for): Change the assertion expression
from thread->suspended to thread->suspended||!GC_world_stopped (the
assertion is off unless THREAD_LOCAL_ALLOC).
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_push_stack_for): If
thread is not suspended then call GetThreadContext(), if it fails then
use sp value and the context registers saved during the latest
stop-the-world; add comments.
* win32_threads.c (GC_push_all_stacks): Add the title comment (copied
from pthread_stop_world.c).
|
|
* win32_threads.c (GC_push_stack_for): Add assertion that thread is
suspended (before using context registers) if thread is not self and
not blocked.
|
|
(fix of commit 449eda034)
The gctest crashes were observed in debug builds produced by MS VC.
In addition, this change greatly reduces memory usage by GC_threads[]
and dll_thread_table[] (compared to the solution that stores the full
CONTEXT in GC_Thread_Rep).
* win32_threads.c (copy_ptr_regs): Declare static function.
* win32_threads.c (PUSHED_REGS_COUNT): Define macro.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT]
(GC_Thread_Rep.saved_context): Move down to be the last field; change
type from CONTEXT to word[PUSHED_REGS_COUNT]; rename to context_regs.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT]
(GC_Thread_Rep.context_sp): New field.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_suspend): Declare
context local variable and use it for GetThreadContext() call; if the
latter succeeds then call copy_ptr_regs(); update comment.
* win32_threads.c (copy_ptr_regs): Define static function (move
PUSH-related part of GC_push_stack_for code here); change PUSH1(reg) to
store reg to regs[]; define context as *pcontext; add assertion that
number of stored registers is equal to PUSHED_REGS_COUNT.
* win32_threads.c [WOW64_THREAD_CONTEXT_WORKAROUND] (copy_ptr_regs):
Store ContextFlags and SegFs as the first elements of regs[].
* win32_threads.c (GC_push_stack_for): Declare i local variable (set
to 0).
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_push_stack_for):
Replace pcontext and context with word *regs; set sp from
thread->context_sp; remove undef context.
* win32_threads.c [!RETRY_GET_THREAD_CONTEXT] (GC_push_stack_for):
Declare regs[PUSHED_REGS_COUNT]; call copy_ptr_regs() to initialize
regs[] and sp; limit context scope to GetThreadContext() and
copy_ptr_regs() calls only.
* win32_threads.c (GC_push_stack_for): Call GC_push_one() for each
regs[] element (except for the first 2 ones if
WOW64_THREAD_CONTEXT_WORKAROUND).
* win32_threads.c [WOW64_THREAD_CONTEXT_WORKAROUND]
(GC_push_stack_for): Define ContextFlags, SegFs local variables
(the values are obtained from regs[]); use these variables instead of
context one; do not overwrite sp local variable value so that not to
use context.Esp directly (i.e. not to use context out of its scope).
|
|
(a cherry-pick of commits 3f39ea8, ab3699da from 'unity-master')
Calls to GetThreadContext may fail. Work around this by putting
access in suspend/resume loop to advance thread past problematic areas
where suspend fails. Capture context in per thread structure at
suspend time rather than retreiving it during the push logic.
* include/private/gcconfig.h [(I386 || X86_64) && (CYGWIN32 || MSWIN32)]
(RETRY_GET_THREAD_CONTEXT): Define macro.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT]
(MAX_SUSPEND_THREAD_RETRIES): Likewise.
* include/private/gcconfig.h [NO_RETRY_GET_THREAD_CONTEXT]
(RETRY_GET_THREAD_CONTEXT): Undefine macro (for test purposes).
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_Thread_Rep): Add
saved_context field; add comment.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_suspend): Define
retry_cnt local variable; set ContextFlags and call GetThreadContext()
after invocation of SuspendThread(); call ResumeThread() and proceed to
SuspendThread() if GetThreadContext() failed (the limit of iterations
is MAX_SUSPEND_THREAD_RETRIES); call Sleep(0) after ResumeThread() or
failed SuspendThread() except for the first 2 iterations.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_push_stack_for):
Declare pcontext local variable (which refers to thread->saved_context);
define context as a macro (to *pcontext) instead of a local variable;
add comment; do not set ContextFlags and do not call GetThreadContext();
undefine context after last use of PUSHn().
|
|
(code refactoring of commit 9483d5bba)
Issue #262 (bdwgc).
* include/private/gcconfig.h [I386 && (CYGWIN32 || MSWIN32)]
(WOW64_THREAD_CONTEXT_WORKAROUND): Define macro.
* win32_threads.c [!CONTEXT_EXCEPTION_ACTIVE] (CONTEXT_EXCEPTION_ACTIVE,
CONTEXT_EXCEPTION_REQUEST, CONTEXT_EXCEPTION_REPORTING): Move macro
definition upper to be before GC_suspend(); define only if
WOW64_THREAD_CONTEXT_WORKAROUND is defined (instead of I386).
* win32_threads.c (isWow64): Move static variable upper to be before
GC_suspend(); define only if WOW64_THREAD_CONTEXT_WORKAROUND.
* win32_threads.c (GET_THREAD_CONTEXT_FLAGS): New macro.
* win32_threads.c (GC_push_stack_for): Always set context.ContextFlags
to GET_THREAD_CONTEXT_FLAGS.
* win32_threads.c [I386] (GC_push_stack_for): Always store context.Esp
to sp (as the initial value).
* win32_threads.c (GC_push_stack_for): Use WoW64 workaround only
if WOW64_THREAD_CONTEXT_WORKAROUND (instead of I386).
* win32_threads.c (GC_thr_init): Set isWow64 only if
WOW64_THREAD_CONTEXT_WORKAROUND (instead of I386).
|
|
Issue #262 (bdwgc).
* misc.c [MSWIN32 && !MSWINRT_FLAVOR && !MSWIN_XBOX1]
(GC_win32_MessageBoxA): Do not define unless SMALL_CONFIG.
* misc.c [MSWIN32 && !_WIN64 && GC_WIN32_THREADS && CHECK_NOT_WOW64]
(GC_init): Do not call IsWow64Process() and GC_win32_MessageBoxA().
* win32_threads.c [I386] (isWow64): New static variable.
* win32_threads.c [I386] (GC_push_stack_for): If isWow64 then set also
CONTEXT_EXCEPTION_REQUEST and CONTEXT_SEGMENTS bits in ContextFlags;
if isWow64, and CONTEXT_EXCEPTION_REPORTING and
CONTEXT_EXCEPTION_ACTIVE are set on return from GetThreadContext then
call GetThreadSelectorEntry and use StackLimit of FS selector to set
sp local variable (instead of context.Esp); add comment.
* win32_threads.c [I386 && DEBUG_THREADS] (GC_push_stack_for): Call
GC_log_printf() to report TIB stack limit/base and the case when
CONTEXT_EXCEPTION_REQUEST is not supported.
* win32_threads.c [I386] (GC_thr_init): Set isWow64 by IsWow64Process()
if the later is available.
|
|
QNX Platform
|
|
|
|
|
|
GC_invoke_finalizers can take a long period of time to complete. During
Mono shutdown we need a way to safely stop the finalization of objects.
|
|
Add callback to support ephemeron marking in Mono.
|
|
|
|
Stop using git protocol for libatomic_ops submodule
|
|
GitHub is removing support for unauthenticated git soon: https://github.blog/2021-09-01-improving-git-protocol-security-github/
|
|
|
|
|
|
The other available heuristics did't work out here so I added a new custom approach using GCC's __builtin_frame_address() (https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html).
While this approach is not very exact it still works for my test projects I've tried.
Another approach would be to get a hold of the stack inside the main function and directly handing that data over to the GC. Since this design would be more involved I'd only tackle it if necessary.
|
|
|
|
These adaptions are needed to make the il2cpp branch platform/hmi/qnx-evaluation produce output for all 4 target architectures: Intel x86+x86_64,arm32 and arm64.
|
|
Unity-Technologies/unity-master-darwin-stop-world-fix
Add loop to handle abort error like in suspend logic.
|
|
|
|
Fix Performance Regression with GC_retry_signals enabled (Case 1255866)
|
|
The original GC_retry_signals case would almost always introduce a 3ms
pause when stopping and starting the world. Instead only fallback to
that retry case if the threads haven't responded after a timeout.
|
|
Use a specific Emscripten allocator for Tiny
|
|
This allocator allows the GC to use the same allocator as the rest of
Emscripten, to avoid unnecessary heap fragmentation. The Emscripten used
in full Unity doesn't have this feature yet, so we'll put this behind
a define that is only enabled for Tiny.
|
|
Add GC_set_disable_automatic_collection API to disable automatic peri…
|
|
collections
|
|
Fix nda platforms
|
|
Unity-Technologies/unity-master-precise-array-marking-stack-limit
Avoid exceeding the mark stack limit (case 1235202)
|
|
|
|
|
|
Add GC_trigger_collection API
|
|
|
|
|
|
|
|
|
|
Fix GET_TIME, MS_TIME_DIFF & NS_TIME_DIFF macros for Switch.
|
|
|
|
|
|
|
|
Default GC_retry_signals=TRUE always
|
|
We saw GC lockups because of lost signals on Android. Any platform
could lose signals, so we'll be conserative and always retry.
|
|
Really fix 'potential unsafe sign check of a bitwise operation' code …
|
|
(fix of commit af00c4d)
* mark.c [!OS2] (GC_mark_from): Replace (signed_word)v>=0 to (v&SIGNB)==0
(anyway, the compiler generates the same code).
|
|
* Ensure *.sh files use LF line endings
* Bump libatomic_ops with fix for cygwin
* Use noinst_LTLIBRARIES to avoid libtool wrapper scripts in mono source tree.
|
|
Remove code that attempt to free the heap on Windows
|
|
This causes problems in Unity for the UWP player when it unloads IL2CPP.
It looks like it was never actually necessary on Windows desktop either,
so let's remove it.
|