mirror of
https://github.com/janet-lang/janet
synced 2024-11-29 03:19:54 +00:00
Marshal alive fibers in func envs as detached.
This will help with marshaling fibers.
This commit is contained in:
parent
6554cc4a8d
commit
de4f8f9aaf
@ -184,6 +184,13 @@ static void marshal_one_env(MarshalState *st, JanetFuncEnv *env, int flags) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
janet_v_push(st->seen_envs, env);
|
janet_v_push(st->seen_envs, env);
|
||||||
|
if (env->offset && (JANET_STATUS_ALIVE == janet_fiber_status(env->as.fiber))) {
|
||||||
|
pushint(st, 0);
|
||||||
|
pushint(st, env->length);
|
||||||
|
Janet *values = env->as.fiber->data + env->offset;
|
||||||
|
for (int32_t i = 0; i < env->length; i++)
|
||||||
|
marshal_one(st, values[i], flags + 1);
|
||||||
|
} else {
|
||||||
janet_env_maybe_detach(env);
|
janet_env_maybe_detach(env);
|
||||||
pushint(st, env->offset);
|
pushint(st, env->offset);
|
||||||
pushint(st, env->length);
|
pushint(st, env->length);
|
||||||
@ -196,6 +203,7 @@ static void marshal_one_env(MarshalState *st, JanetFuncEnv *env, int flags) {
|
|||||||
marshal_one(st, env->as.values[i], flags + 1);
|
marshal_one(st, env->as.values[i], flags + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Add function flags to janet functions */
|
/* Add function flags to janet functions */
|
||||||
static void janet_func_addflags(JanetFuncDef *def) {
|
static void janet_func_addflags(JanetFuncDef *def) {
|
||||||
|
Loading…
Reference in New Issue
Block a user