Skip to content

Commit

Permalink
Do not flush registers before reading procedure stack on E2K
Browse files Browse the repository at this point in the history
Asm flushr instruction does not seem to be useful when followed
by syscall(__NR_access_hw_stacks).

* include/private/gc_priv.h [E2K] (GC_save_regs_in_stack): Do not
declare.
* mach_dep.c [E2K] (GC_save_regs_in_stack): Do not define.
* mach_dep.c [!HAVE_PUSH_REGS && UNIX_LIKE && !NO_GETCONTEXT && E2K]
(GC_with_callee_saves_pushed): Do not call GC_save_regs_in_stack().
* misc.c [!THREADS && !SPARC && E2K] (GC_do_blocking_inner): Likewise.
* pthread_stop_world.c [!IA64 && E2K] (GC_push_all_stacks): Likewise.
* pthread_support.c (GC_call_with_gc_active): Likewise.
  • Loading branch information
ivmai committed Nov 21, 2023
1 parent 36d6edc commit d9f2cc7
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/private/gc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ GC_EXTERN void (*GC_push_typed_structures)(void);
GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
volatile ptr_t arg);

#if defined(E2K) || defined(IA64) || defined(SPARC)
#if defined(IA64) || defined(SPARC)
/* Cause all stacked registers to be saved in memory. Return a */
/* pointer to the top of the corresponding memory stack. */
ptr_t GC_save_regs_in_stack(void);
Expand Down
7 changes: 1 addition & 6 deletions mach_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@
}
return (size_t)new_sz;
}

ptr_t GC_save_regs_in_stack(void) {
__asm__ __volatile__ ("flushr");
return NULL;
}
#endif /* E2K */

#if defined(MACOS) && defined(__MWERKS__)
Expand Down Expand Up @@ -327,7 +322,7 @@ GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
ABORT("feenableexcept failed");
# endif
# endif /* GETCONTEXT_FPU_EXCMASK_BUG */
# if defined(E2K) || defined(IA64) || defined(SPARC)
# if defined(IA64) || defined(SPARC)
/* On a register window machine, we need to save register */
/* contents on the stack for this to work. This may already be */
/* subsumed by the getcontext() call. */
Expand Down
2 changes: 0 additions & 2 deletions misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2312,8 +2312,6 @@ STATIC void GC_do_blocking_inner(ptr_t data, void *context)
GC_blocked_sp = (ptr_t) &d; /* save approx. sp */
# ifdef IA64
GC_blocked_register_sp = GC_save_regs_in_stack();
# elif defined(E2K)
(void)GC_save_regs_in_stack();
# endif
# endif

Expand Down
4 changes: 2 additions & 2 deletions pthread_stop_world.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,10 @@ GC_INNER void GC_push_all_stacks(void)
# ifdef IA64
bs_hi = GC_save_regs_in_stack();
# elif defined(E2K)
GC_ASSERT(NULL == crtn -> backing_store_end);
(void)GC_save_regs_in_stack();
{
size_t stack_size;

GC_ASSERT(NULL == crtn -> backing_store_end);
GET_PROCEDURE_STACK_LOCAL(&bs_lo, &stack_size);
bs_hi = bs_lo + stack_size;
}
Expand Down
3 changes: 0 additions & 3 deletions pthread_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -2088,9 +2088,6 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
GC_ASSERT((me -> flags & DO_BLOCKING) == 0);

/* Restore original "stack section". */
# ifdef E2K
(void)GC_save_regs_in_stack();
# endif
READER_LOCK();
GC_ASSERT(me -> crtn == crtn);
GC_ASSERT(crtn -> traced_stack_sect == &stacksect);
Expand Down

0 comments on commit d9f2cc7

Please sign in to comment.