Skip to content

Commit

Permalink
Fix --dump when there are state variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Aug 10, 2014
1 parent 43991af commit ec09497
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/core/bytecode.c
Expand Up @@ -613,7 +613,8 @@ static MVMStaticFrame ** deserialize_frames(MVMThreadContext *tc, MVMCompUnit *c
}

/* Finishes up reading and exploding of a frame. */
void MVM_bytecode_finish_frame(MVMThreadContext *tc, MVMCompUnit *cu, MVMStaticFrame *sf) {
void MVM_bytecode_finish_frame(MVMThreadContext *tc, MVMCompUnit *cu,
MVMStaticFrame *sf, MVMint32 dump_only) {
MVMuint32 j;
MVMuint8 *pos;
MVMuint16 slvs;
Expand Down Expand Up @@ -707,7 +708,7 @@ void MVM_bytecode_finish_frame(MVMThreadContext *tc, MVMCompUnit *cu, MVMStaticF
MVMuint16 lex_idx = read_int16(pos, 0);
MVMuint16 flags = read_int16(pos, 2);
sf->body.static_env_flags[lex_idx] = flags;
if (flags == 2) {
if (flags == 2 && !dump_only) {
/* State variable; need to resolve wval immediately. Other kinds
* can wait. */
MVMSerializationContext *sc = MVM_sc_get_sc(tc, cu, read_int32(pos, 4));
Expand Down
2 changes: 1 addition & 1 deletion src/core/bytecode.h
Expand Up @@ -7,5 +7,5 @@ struct MVMBytecodeAnnotation {

void MVM_bytecode_unpack(MVMThreadContext *tc, MVMCompUnit *cu);
MVMBytecodeAnnotation * MVM_bytecode_resolve_annotation(MVMThreadContext *tc, MVMStaticFrameBody *sfb, MVMuint32 offset);
void MVM_bytecode_finish_frame(MVMThreadContext *tc, MVMCompUnit *cu, MVMStaticFrame *sf);
void MVM_bytecode_finish_frame(MVMThreadContext *tc, MVMCompUnit *cu, MVMStaticFrame *sf, MVMint32 dump_only);
MVMuint8 MVM_bytecode_find_static_lexical_scref(MVMThreadContext *tc, MVMCompUnit *cu, MVMStaticFrame *sf, MVMuint16 index, MVMint32 *sc, MVMint32 *id);
2 changes: 1 addition & 1 deletion src/core/bytecodedump.c
Expand Up @@ -114,7 +114,7 @@ char * MVM_bytecode_dump(MVMThreadContext *tc, MVMCompUnit *cu) {
char **lexicals;

if (!frame->body.fully_deserialized) {
MVM_bytecode_finish_frame(tc, cu, frame);
MVM_bytecode_finish_frame(tc, cu, frame, 1);
}

lexicals = (char **)malloc(sizeof(char *) * frame->body.num_lexicals);
Expand Down
2 changes: 1 addition & 1 deletion src/core/frame.c
Expand Up @@ -25,7 +25,7 @@ void prepare_and_verify_static_frame(MVMThreadContext *tc, MVMStaticFrame *stati

/* Ensure the frame is fully deserialized. */
if (!static_frame_body->fully_deserialized)
MVM_bytecode_finish_frame(tc, static_frame_body->cu, static_frame);
MVM_bytecode_finish_frame(tc, static_frame_body->cu, static_frame, 0);

/* Work size is number of locals/registers plus size of the maximum
* call site argument list. */
Expand Down
4 changes: 2 additions & 2 deletions src/core/interp.c
Expand Up @@ -905,7 +905,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
MVMStaticFrame *sf = ((MVMCode *)code)->body.sf;
MVMuint8 found = 0;
if (!sf->body.fully_deserialized)
MVM_bytecode_finish_frame(tc, sf->body.cu, sf);
MVM_bytecode_finish_frame(tc, sf->body.cu, sf, 0);
MVM_string_flatten(tc, name);
if (sf->body.lexical_names) {
MVMLexicalRegistry *entry;
Expand Down Expand Up @@ -3127,7 +3127,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
MVMROOT(tc, ncr, {
MVMStaticFrame *nsf;
if (!ncr->body.sf->body.fully_deserialized)
MVM_bytecode_finish_frame(tc, ncr->body.sf->body.cu, ncr->body.sf);
MVM_bytecode_finish_frame(tc, ncr->body.sf->body.cu, ncr->body.sf, 0);
nsf = (MVMStaticFrame *)MVM_repr_clone(tc,
(MVMObject *)ncr->body.sf);
MVM_ASSIGN_REF(tc, &(ncr->common.header), ncr->body.sf, nsf);
Expand Down

0 comments on commit ec09497

Please sign in to comment.