summaryrefslogtreecommitdiff
path: root/darwin_stop_world.c
diff options
context:
space:
mode:
authorJonathan Chambers <joncham@gmail.com>2018-02-02 20:29:20 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-02-02 20:29:20 +0300
commit6f12c87d903b58384ab9075020a548d7d05250fc (patch)
tree81ac769c47a58faaa168d921f3a97fc04d658fc4 /darwin_stop_world.c
parent02954567894bc270ffe7cb075448b56a706c9381 (diff)
downloadbdwgc-6f12c87d903b58384ab9075020a548d7d05250fc.tar.gz
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.
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r--darwin_stop_world.c15
1 files changed, 8 insertions, 7 deletions
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 */