future: fix problem related to continuation marks
Capturing, restoring, then capturing again a future's continuation marks did not work right.
This commit is contained in:
parent
f6e863a4dd
commit
d062212ebc
|
@ -9025,7 +9025,7 @@ Scheme_Lightweight_Continuation *scheme_capture_lightweight_continuation(Scheme_
|
||||||
seg = p->cont_mark_stack_segments[i >> SCHEME_LOG_MARK_SEGMENT_SIZE];
|
seg = p->cont_mark_stack_segments[i >> SCHEME_LOG_MARK_SEGMENT_SIZE];
|
||||||
pos = i & SCHEME_MARK_SEGMENT_MASK;
|
pos = i & SCHEME_MARK_SEGMENT_MASK;
|
||||||
|
|
||||||
memcpy(cont_mark_stack_slice + i, seg + pos, sizeof(Scheme_Cont_Mark));
|
memcpy(cont_mark_stack_slice + j, seg + pos, sizeof(Scheme_Cont_Mark));
|
||||||
}
|
}
|
||||||
|
|
||||||
return lw;
|
return lw;
|
||||||
|
|
|
@ -2369,6 +2369,8 @@ void *worker_thread_future_loop(void *arg)
|
||||||
Scheme_Object *rator, **argv;
|
Scheme_Object *rator, **argv;
|
||||||
int argc;
|
int argc;
|
||||||
|
|
||||||
|
scheme_fill_lwc_start();
|
||||||
|
|
||||||
if (ft->suspended_lw_stack) {
|
if (ft->suspended_lw_stack) {
|
||||||
Scheme_Lightweight_Continuation *lc;
|
Scheme_Lightweight_Continuation *lc;
|
||||||
|
|
||||||
|
@ -2387,7 +2389,6 @@ void *worker_thread_future_loop(void *arg)
|
||||||
argv = NULL;
|
argv = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheme_fill_lwc_start();
|
|
||||||
jitcode = ((Scheme_Native_Closure *)rator)->code->start_code;
|
jitcode = ((Scheme_Native_Closure *)rator)->code->start_code;
|
||||||
v = scheme_call_as_lightweight_continuation(jitcode, rator, argc, argv);
|
v = scheme_call_as_lightweight_continuation(jitcode, rator, argc, argv);
|
||||||
if (SAME_OBJ(v, SCHEME_TAIL_CALL_WAITING))
|
if (SAME_OBJ(v, SCHEME_TAIL_CALL_WAITING))
|
||||||
|
|
|
@ -132,16 +132,13 @@ THREAD_LOCAL_DECL(Scheme_Current_LWC *scheme_current_lwc);
|
||||||
static Scheme_Object *do_call_as_lwc(Scheme_Native_Proc *code,
|
static Scheme_Object *do_call_as_lwc(Scheme_Native_Proc *code,
|
||||||
void *data,
|
void *data,
|
||||||
int argc,
|
int argc,
|
||||||
Scheme_Object **argv,
|
Scheme_Object **argv)
|
||||||
MZ_MARK_STACK_TYPE cont_mark_stack_start)
|
|
||||||
{
|
{
|
||||||
#ifdef JIT_THREAD_LOCAL
|
#ifdef JIT_THREAD_LOCAL
|
||||||
# define THDLOC &BOTTOM_VARIABLE
|
# define THDLOC &BOTTOM_VARIABLE
|
||||||
#else
|
#else
|
||||||
# define THDLOC NULL
|
# define THDLOC NULL
|
||||||
#endif
|
#endif
|
||||||
scheme_current_lwc->runstack_start = MZ_RUNSTACK;
|
|
||||||
scheme_current_lwc->cont_mark_stack_start = cont_mark_stack_start;
|
|
||||||
return sjc.native_starter_code(data, argc, argv, THDLOC, code, (void **)&scheme_current_lwc->stack_start);
|
return sjc.native_starter_code(data, argc, argv, THDLOC, code, (void **)&scheme_current_lwc->stack_start);
|
||||||
#undef THDLOC
|
#undef THDLOC
|
||||||
}
|
}
|
||||||
|
@ -151,16 +148,13 @@ Scheme_Object *scheme_call_as_lightweight_continuation(Scheme_Native_Proc *code,
|
||||||
int argc,
|
int argc,
|
||||||
Scheme_Object **argv)
|
Scheme_Object **argv)
|
||||||
{
|
{
|
||||||
return do_call_as_lwc(code, data, argc, argv, MZ_CONT_MARK_STACK);
|
return do_call_as_lwc(code, data, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MZ_USE_FUTURES
|
#ifdef MZ_USE_FUTURES
|
||||||
Scheme_Object *scheme_force_value_same_mark_as_lightweight_continuation(Scheme_Object *v)
|
Scheme_Object *scheme_force_value_same_mark_as_lightweight_continuation(Scheme_Object *v)
|
||||||
{
|
{
|
||||||
/* Providing 0 as cont_mark_stack_start is the "same_mark" part:
|
return do_call_as_lwc(sjc.force_value_same_mark_code, NULL, 0, NULL);
|
||||||
it preserves any continuation marks that are in place as part
|
|
||||||
of the continuation. */
|
|
||||||
return do_call_as_lwc(sjc.force_value_same_mark_code, NULL, 0, NULL, 0);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user