#ifdef PRINTNOISE
printf("Scavenging interrupt contexts ...\n");
#endif
- scavenge_interrupt_contexts();
+ scavenge_interrupt_contexts(th);
#ifdef PRINTNOISE
printf("Scavenging interrupt handlers (%d bytes) ...\n",
#endif
}
-void scavenge_interrupt_contexts(void)
+void scavenge_interrupt_contexts(struct thread *th)
{
int i, index;
os_context_t *context;
- struct thread *th=arch_os_get_current_thread();
-
index = fixnum_value(SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,0));
#define _GC_INTERNAL_H_
#include <genesis/simple-fun.h>
+#include "thread.h"
/* disabling gc assertions made no discernable difference to GC speed,
* last I tried it - dan 2003.12.21
extern struct hash_table *weak_hash_tables; /* in gc-common.c */
extern void scavenge(lispobj *start, long n_words);
-extern void scavenge_interrupt_contexts(void);
+extern void scavenge_interrupt_contexts(struct thread *thread);
extern void scav_weak_hash_tables(void);
extern void scan_weak_hash_tables(void);
extern void scan_weak_pointers(void);
#if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)
static void
-scavenge_control_stack()
+scavenge_control_stack(struct thread *th)
{
unsigned long control_stack_size;
/* This is going to be a big problem when we try to port threads
* to PPC... CLH */
- struct thread *th = arch_os_get_current_thread();
lispobj *control_stack =
(lispobj *)(th->control_stack_start);
control_stack_size = current_control_stack_pointer - control_stack;
scavenge(control_stack, control_stack_size);
-
- /* Scrub the unscavenged control stack space, so that we can't run
- * into any stale pointers in a later GC. */
- scrub_control_stack();
}
/* Scavenging Interrupt Contexts */
}
void
-scavenge_interrupt_contexts(void)
+scavenge_interrupt_contexts(struct thread *th)
{
int i, index;
os_context_t *context;
- struct thread *th=arch_os_get_current_thread();
-
- index = fixnum_value(SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,0));
+ index = fixnum_value(SymbolValue(FREE_INTERRUPT_CONTEXT_INDEX,th));
#if defined(DEBUG_PRINT_CONTEXT_INDEX)
printf("Number of active contexts: %d\n", index);
* If not x86, we need to scavenge the interrupt context(s) and the
* control stack.
*/
- scavenge_interrupt_contexts();
- scavenge_control_stack();
+ {
+ struct thread *th;
+ for_each_thread(th) {
+ scavenge_interrupt_contexts(th);
+ scavenge_control_stack(th);
+ }
+
+ /* Scrub the unscavenged control stack space, so that we can't run
+ * into any stale pointers in a later GC (this is done by the
+ * stop-for-gc handler in the other threads). */
+ scrub_control_stack();
+ }
#endif
/* Scavenge the Lisp functions of the interrupt handlers, taking