Move creation of resolve_module_paths to master GC

svn: r12802
This commit is contained in:
Kevin Tew 2008-12-12 19:35:07 +00:00
parent 38682c8130
commit a0be9364bc
4 changed files with 57 additions and 4 deletions

View File

@ -1547,6 +1547,11 @@ void GC_switch_out_master_gc() {
}
}
void GC_switch_in_master_gc() {
GC_set_GC(MASTERGC);
}
void GC_gcollect(void)
{
NewGC *gc = GC_get_GC();

View File

@ -2716,7 +2716,7 @@ static Scheme_Object *module_path_index_join(int argc, Scheme_Object *argv[])
return scheme_make_modidx(argv[0], argv[1], scheme_false);
}
Scheme_Object *scheme_intern_resolved_module_path(Scheme_Object *o)
Scheme_Object *scheme_intern_resolved_module_path_worker(Scheme_Object *o)
{
Scheme_Object *rmp;
Scheme_Bucket *b;
@ -2744,6 +2744,21 @@ Scheme_Object *scheme_intern_resolved_module_path(Scheme_Object *o)
return return_value;
}
Scheme_Object *scheme_intern_resolved_module_path(Scheme_Object *o)
{
#if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC)
mz_proc_thread *self;
self = proc_thread_self;
if ( scheme_master_proc_thread && scheme_master_proc_thread != proc_thread_self ) {
int return_msg_type;
void *return_payload;
pt_mbox_send_recv(scheme_master_proc_thread->mbox, 1, o, self->mbox, &return_msg_type, &return_payload);
return (Scheme_Object*) return_payload;
}
#endif
return scheme_intern_resolved_module_path_worker(o);
}
static Scheme_Object *resolved_module_path_p(int argc, Scheme_Object *argv[])
{
return (SCHEME_MODNAMEP(argv[0])

View File

@ -218,15 +218,44 @@ static void *place_start_proc(void *data_arg) {
return scheme_true;
}
static void *master_scheme_place(void *data) {
#ifdef MZ_PRECISE_GC
#endif
static void *master_scheme_place(void *data) {
GC_switch_in_master_gc();
while(1) {
int recv_type;
void *recv_payload;
pt_mbox *origin;
Scheme_Object *o;
pt_mbox_recv(scheme_master_proc_thread->mbox, &recv_type, &recv_payload, &origin);
switch(recv_type) {
case 1:
o = scheme_intern_resolved_module_path_worker((Scheme_Object *)recv_payload);
pt_mbox_send(origin, 2, (void *) o, NULL);
break;
case 3:
break;
case 5:
break;
}
}
return NULL;
}
void spawn_master_scheme_place() {
mz_proc_thread *thread;
pt_mbox *mbox;
unsigned int threadid;
thread = (mz_proc_thread*)malloc(sizeof(mz_proc_thread));
mbox = pt_mbox_create();
threadid = mz_proc_thread_self();
thread->threadid = threadid;
thread->mbox = mbox;
proc_thread_self = thread;
scheme_master_proc_thread = mz_proc_thread_create(master_scheme_place, NULL);
}
#endif
/*========================================================================*/
/* precise GC traversers */

View File

@ -356,6 +356,9 @@ extern THREAD_LOCAL Scheme_Thread *scheme_first_thread;
#define scheme_jumping_to_continuation (scheme_current_thread->cjs.jumping_to_continuation)
#define scheme_multiple_count (scheme_current_thread->ku.multiple.count)
#define scheme_multiple_array (scheme_current_thread->ku.multiple.array)
#include "mzrt.h"
extern mz_proc_thread *scheme_master_proc_thread;
extern THREAD_LOCAL mz_proc_thread *proc_thread_self;
#endif
typedef struct Scheme_Thread_Set {
@ -2687,6 +2690,7 @@ Scheme_Object *scheme_modidx_shift(Scheme_Object *modidx,
Scheme_Object *shift_to_modidx);
Scheme_Object *scheme_intern_resolved_module_path(Scheme_Object *o);
Scheme_Object *scheme_intern_resolved_module_path_worker(Scheme_Object *o);
Scheme_Object *scheme_hash_module_variable(Scheme_Env *env, Scheme_Object *modidx,
Scheme_Object *stxsym, Scheme_Object *insp,
@ -3121,7 +3125,7 @@ typedef struct Scheme_Place {
} Scheme_Place;
Scheme_Env *scheme_place_instance_init();
void spawn_master_scheme_place();
/*========================================================================*/
/* engine */