Navigation Menu

Skip to content

Commit

Permalink
Make sure scalar containers are fresh per frame.
Browse files Browse the repository at this point in the history
Also stub the place we'll later need to provide some support for state
variables.
  • Loading branch information
jnthn committed Dec 5, 2013
1 parent bd782aa commit 6f955c8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/core/frame.c
Expand Up @@ -158,6 +158,31 @@ void MVM_frame_invoke(MVMThreadContext *tc, MVMStaticFrame *static_frame,
if (fresh)
frame->env = malloc(static_frame_body->env_size);
memcpy(frame->env, static_frame_body->static_env, static_frame_body->env_size);
if (static_frame_body->static_env_flags) {
MVMROOT(tc, static_frame, {
/* Drag everything out of static_frame_body before we start,
* as GC action may invalidate it. */
MVMuint8 *flags = static_frame_body->static_env_flags;
MVMint64 numlex = static_frame_body->num_lexicals;
MVMint64 i;
for (i = 0; i < numlex; i++) {
switch (flags[i]) {
case 0: break;
case 1:
frame->env[i].o = MVM_repr_clone(tc, frame->env[i].o);
break;
case 2:
printf("WARNING: State vars NYI\n");
frame->env[i].o = MVM_repr_clone(tc, frame->env[i].o);
break;
default:
MVM_exception_throw_adhoc(tc,
"Unknown lexical environment setup flag");
}
}
});
static_frame_body = &static_frame->body; /* In case it moved. */
}
}
else {
frame->env = NULL;
Expand Down

0 comments on commit 6f955c8

Please sign in to comment.