When marshalling a closure, try to detach funcenvs

If possible, this will reduce the need to marshal fibers
in many cases. Also add this logic to the GC so holding a closure
that originally came from a fiber that crashed does not cause that fiber
to hang around forever.
This commit is contained in:
Calvin Rose
2020-03-17 18:55:32 -05:00
parent 4a05b4556e
commit fac47e8ecb
4 changed files with 24 additions and 0 deletions
+1
View File
@@ -184,6 +184,7 @@ static void marshal_one_env(MarshalState *st, JanetFuncEnv *env, int flags) {
}
}
janet_v_push(st->seen_envs, env);
janet_env_maybe_detach(env);
pushint(st, env->offset);
pushint(st, env->length);
if (env->offset) {