Jay's patch to speed up thread creation in 3m
svn: r2920
This commit is contained in:
parent
5160a8a3a5
commit
29209ad625
|
@ -495,6 +495,9 @@ void GC_register_traversers(Type_Tag tag, Size_Proc size, Mark_Proc mark, Fixup_
|
|||
void GC_register_thread(void *p, void *c)
|
||||
{
|
||||
}
|
||||
void GC_register_new_thread(void *p, void *c)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* immobile box */
|
||||
|
|
|
@ -73,10 +73,13 @@ GC2_EXTERN void GC_init_type_tags(int count, int weakbox, int ephemeron);
|
|||
freedom in the layout of a weak box or ephemeron, so it performs weak
|
||||
box traversals itself, but MzScheme gets to choose the tag.) */
|
||||
|
||||
GC2_EXTERN void GC_register_thread(void *, void *);
|
||||
GC2_EXTERN void GC_register_new_thread(void *, void *);
|
||||
/*
|
||||
Indicates that a just-allocated point is for a thread record
|
||||
owned by a particular custodian. */
|
||||
GC2_EXTERN void GC_register_thread(void *, void *);
|
||||
/*
|
||||
Indicates that a a thread record is owned by a particular custodian. */
|
||||
|
||||
GC2_EXTERN void (*GC_collect_start_callback)(void);
|
||||
GC2_EXTERN void (*GC_collect_end_callback)(void);
|
||||
|
|
|
@ -1052,6 +1052,16 @@ struct thread {
|
|||
static Mark_Proc normal_thread_mark = NULL, normal_custodian_mark = NULL;
|
||||
static struct thread *threads = NULL;
|
||||
|
||||
inline static void register_new_thread(void *t, void *c)
|
||||
{
|
||||
struct thread *work;
|
||||
|
||||
work = (struct thread *)malloc(sizeof(struct thread));
|
||||
work->owner = current_owner((Scheme_Custodian *)c);
|
||||
work->thread = t;
|
||||
work->next = threads;
|
||||
threads = work;
|
||||
}
|
||||
inline static void register_thread(void *t, void *c)
|
||||
{
|
||||
struct thread *work;
|
||||
|
@ -1061,11 +1071,7 @@ inline static void register_thread(void *t, void *c)
|
|||
work->owner = current_owner((Scheme_Custodian *)c);
|
||||
return;
|
||||
}
|
||||
work = (struct thread *)malloc(sizeof(struct thread));
|
||||
work->owner = current_owner((Scheme_Custodian *)c);
|
||||
work->thread = t;
|
||||
work->next = threads;
|
||||
threads = work;
|
||||
register_new_thread(t, c);
|
||||
}
|
||||
|
||||
inline static void mark_threads(int owner)
|
||||
|
@ -1110,6 +1116,7 @@ inline static int thread_get_owner(void *p)
|
|||
|
||||
#ifndef NEWGC_BTC_ACCOUNT
|
||||
# define register_thread(t,c) /* */
|
||||
# define register_new_thread(t,c) /* */
|
||||
# define clean_up_thread_list() /* */
|
||||
#endif
|
||||
|
||||
|
@ -1117,6 +1124,10 @@ void GC_register_thread(void *t, void *c)
|
|||
{
|
||||
register_thread(t, c);
|
||||
}
|
||||
void GC_register_new_thread(void *t, void *c)
|
||||
{
|
||||
register_new_thread(t, c);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Internal Stack Routines */
|
||||
|
|
|
@ -1943,7 +1943,7 @@ static Scheme_Thread *make_thread(Scheme_Config *config,
|
|||
mgr = (Scheme_Custodian *)scheme_get_param(config, MZCONFIG_CUSTODIAN);
|
||||
|
||||
#ifdef MZ_PRECISE_GC
|
||||
GC_register_thread(process, mgr);
|
||||
GC_register_new_thread(process, mgr);
|
||||
#endif
|
||||
|
||||
{
|
||||
|
@ -2820,7 +2820,7 @@ static Scheme_Object *call_as_nested_thread(int argc, Scheme_Object *argv[])
|
|||
np = MALLOC_ONE_TAGGED(Scheme_Thread);
|
||||
np->so.type = scheme_thread_type;
|
||||
#ifdef MZ_PRECISE_GC
|
||||
GC_register_thread(np, mgr);
|
||||
GC_register_new_thread(np, mgr);
|
||||
#endif
|
||||
np->running = MZTHREAD_RUNNING;
|
||||
np->ran_some = 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user