mirror of
https://github.com/janet-lang/janet
synced 2024-11-25 17:57:17 +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);
|
||||||
@ -195,6 +202,7 @@ static void marshal_one_env(MarshalState *st, JanetFuncEnv *env, int flags) {
|
|||||||
for (int32_t i = 0; i < env->length; i++)
|
for (int32_t i = 0; i < env->length; i++)
|
||||||
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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user