From 6f12c87d903b58384ab9075020a548d7d05250fc Mon Sep 17 00:00:00 2001 From: Jonathan Chambers Date: Fri, 2 Feb 2018 20:29:20 +0300 Subject: Do not push frame pointer on Darwin/arm and Darwin/arm64 (part of commit 9379c66 from Unity-Technologies/bdwgc) Issue #173 (bdwgc). * darwin_stop_world.c [!DARWIN_DONT_PARSE_STACK && ARM32] (GC_stack_range_for): Pass r[7] (instead of sp register) to GC_FindTopOfStack(). * darwin_stop_world.c [ARM32] (GC_stack_range_for): Do not push r[7] register (as it holds frame pointer on iOS); add comment. * darwin_stop_world.c [!DARWIN_DONT_PARSE_STACK && AARCH64] (GC_stack_range_for): Pass fp (instead of sp) register to GC_FindTopOfStack(). * darwin_stop_world.c [AARCH64] (GC_stack_range_for): Do not push fp register. --- darwin_stop_world.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'darwin_stop_world.c') diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 062eb213..1eab1f1c 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -282,13 +282,15 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p, # elif defined(ARM32) lo = (void *)state.THREAD_FLD(sp); # ifndef DARWIN_DONT_PARSE_STACK - *phi = GC_FindTopOfStack(state.THREAD_FLD(sp)); + *phi = GC_FindTopOfStack(state.THREAD_FLD(r[7])); /* fp */ # endif { int j; - for (j = 0; j <= 12; j++) { + for (j = 0; j < 7; j++) + GC_push_one(state.THREAD_FLD(r[j])); + j++; /* "r7" is skipped (iOS uses it as a frame pointer) */ + for (; j <= 12; j++) GC_push_one(state.THREAD_FLD(r[j])); - } } /* "pc" and "sp" are skipped */ GC_push_one(state.THREAD_FLD(lr)); @@ -297,7 +299,7 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p, # elif defined(AARCH64) lo = (void *)state.THREAD_FLD(sp); # ifndef DARWIN_DONT_PARSE_STACK - *phi = GC_FindTopOfStack(state.THREAD_FLD(sp)); + *phi = GC_FindTopOfStack(state.THREAD_FLD(fp)); # endif { int j; @@ -305,14 +307,13 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p, GC_push_one(state.THREAD_FLD(x[j])); } } - /* "cpsr", "pc" and "sp" are skipped */ - GC_push_one(state.THREAD_FLD(fp)); + /* "cpsr", "fp", "pc" and "sp" are skipped */ GC_push_one(state.THREAD_FLD(lr)); # elif defined(CPPCHECK) lo = NULL; # else -# error FIXME for non-x86 || ppc || arm architectures +# error FIXME for non-arm/ppc/x86 architectures # endif } /* thread != my_thread */ -- cgit v1.2.1