summaryrefslogtreecommitdiff
path: root/mark_rts.c
diff options
context:
space:
mode:
authorIlya Kurdyukov <ilyakurdyukov@altlinux.org>2021-07-02 12:00:00 +0700
committerIvan Maidanski <ivmai@mail.ru>2022-01-12 09:59:55 +0300
commit9ddbbae8e860c779d7fa548daceb1130916059ff (patch)
tree272389e85cd443134e6351672ae3a5f4474f7899 /mark_rts.c
parent7ef3eca8a709ce679664e280a44a828fb7caba5e (diff)
downloadbdwgc-9ddbbae8e860c779d7fa548daceb1130916059ff.tar.gz
Support Elbrus 2000 (Linux/e2k)
(a port of altlinux libgc-e2k.patch (8ed786c)) Issue #411 (bdwgc). * include/gc/gc.h [__GNUC__ && !__INTEL_COMPILER && __e2k__] (GC_reachable_here): Specify "r" contraint for ptr. * include/gc/gc.h [__e2k__] (GC_stack_base): Declare reg_base field. * include/private/gc_priv.h [E2K] (GC_push_all_register_sections, GC_save_regs_in_stack, GC_get_procedure_stack): Declare. * include/private/gc_priv.h [E2K && __ptr64__] (LOAD_TAGGED_VALUE): Define macro. * include/private/gc_priv.h (LOAD_WORD_OR_CONTINUE): Likewise. * include/private/gcconfig.h [LINUX && __e2k__] (E2K, mach_type_known): Likewise. * include/private/gcconfig.h [E2K] (MACH_TYPE, CPP_WORDSZ, ALIGNMENT, HBLKSIZE): Likewise. * include/private/gcconfig.h [E2K && LINUX] (DATASTART): Likewise. * mach_dep.c [E2K] (VA_SIZE, E2K_PSHTP_SIZE, get_stack_index): Likewise. * include/private/gcconfig.h [GC_GNUC_PREREQ(2,8)] (HAVE_BUILTIN_UNWIND_INIT): Do not define if E2K. * include/private/gcconfig.h [E2K && LINUX] (__dso_handle): Declare extern variable. * include/private/pthread_support.h [E2K] (GC_Thread_Rep): Declare backing_store_end and backing_store_ptr fields. * mach_dep.c [E2K]: Include errno.h, sys/syscall.h, asm/e2k_syswork.h. * mach_dep.c [E2K] (e2k_rwap_lo_fields, e2k_rwap_hi_fields): Declare struct. * mach_dep.c [E2K] (e2k_rwap_lo_u, e2k_rwap_hi_u): Declare union. * mach_dep.c [E2K] (GC_get_procedure_stack, GC_save_regs_in_stack): Implement. * mach_dep.c [E2K] (GC_with_callee_saves_pushed): Call GC_save_regs_in_stack() (not saving the result). * mark.c (GC_mark_from, GC_push_all_eager): Use LOAD_WORD_OR_CONTINUE() instead of direct dereference of current_p. * mark.c [!SMALL_CONFIG] (GC_mark_from): Do not prefetch if E2K. * mark_rts.c [E2K] (GC_push_all_register_sections): Implement but ignore traced_stack_sect (add TODO item). * mark_rts.c [!THREADS && E2K] (GC_push_current_stack): Call GC_get_procedure_stack() and GC_push_all_register_sections(). * misc.c [E2K] (GC_call_with_stack_base): Initialize reg_base to 0. * misc.c [!THREADS && E2K] (GC_do_blocking_inner, GC_get_my_stackbottom): Likewise. * os_dep.c [((HAVE_PTHREAD_ATTR_GET_NP || HAVE_PTHREAD_GETATTR_NP) && THREADS || !HAVE_GET_STACK_BASE) && E2K] (GC_get_stack_base): Likewise. * pthread_support.c [E2K] (GC_get_my_stackbottom): Likewise. * pthread_stop_world.c [E2K] (GC_suspend_handler): Call GC_with_callee_saves_pushed(). * pthread_stop_world.c [E2K] (GC_store_stack_ptr): Call GC_save_regs_in_stack() and GC_get_procedure_stack(). * pthread_stop_world.c [E2K] (GC_suspend_handler_inner): Call free(me->backing_store_end) before return. * pthread_stop_world.c [E2K] (GC_push_all_stacks): Declare bs_lo, bs_hi, stack_size local variables; call GC_save_regs_in_stack() and GC_get_procedure_stack() (and free() at the end) for self thread; call GC_push_all_register_sections(). * pthread_support.c [E2K] (GC_do_blocking_inner): Call GC_save_regs_in_stack(); add FIXME.
Diffstat (limited to 'mark_rts.c')
-rw-r--r--mark_rts.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/mark_rts.c b/mark_rts.c
index f26685ca..fc02c0c6 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -644,12 +644,15 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
}
}
-#ifdef IA64
+#if defined(E2K) || defined(IA64)
/* Similar to GC_push_all_stack_sections() but for IA-64 registers store. */
GC_INNER void GC_push_all_register_sections(ptr_t bs_lo, ptr_t bs_hi,
int eager, struct GC_traced_stack_sect_s *traced_stack_sect)
{
- while (traced_stack_sect != NULL) {
+# ifdef E2K
+ (void)traced_stack_sect; /* TODO: Not implemented yet */
+# else
+ while (traced_stack_sect != NULL) {
ptr_t frame_bs_lo = traced_stack_sect -> backing_store_end;
GC_ASSERT((word)frame_bs_lo <= (word)bs_hi);
if (eager) {
@@ -659,7 +662,8 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
}
bs_hi = traced_stack_sect -> saved_backing_store_ptr;
traced_stack_sect = traced_stack_sect -> prev;
- }
+ }
+# endif
GC_ASSERT((word)bs_lo <= (word)bs_hi);
if (eager) {
GC_push_all_eager(bs_lo, bs_hi);
@@ -667,7 +671,7 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
GC_push_all_stack(bs_lo, bs_hi);
}
}
-#endif /* IA64 */
+#endif /* E2K || IA64 */
#ifdef THREADS
@@ -826,6 +830,18 @@ STATIC void GC_push_current_stack(ptr_t cold_gc_frame,
/* All values should be sufficiently aligned that we */
/* don't have to worry about the boundary. */
}
+# elif defined(E2K)
+ /* We also need to push procedure stack store. */
+ /* Procedure stack grows up. */
+ {
+ ptr_t bs_lo;
+ size_t stack_size = GC_get_procedure_stack(&bs_lo);
+
+ GC_push_all_register_sections(bs_lo, bs_lo + stack_size,
+ TRUE /* eager */,
+ GC_traced_stack_sect);
+ free(bs_lo);
+ }
# endif
# endif /* !THREADS */
}