Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Code ref serialization (non-closure case).
  • Loading branch information
jnthn committed Mar 9, 2013
1 parent bb1ccc4 commit e972b32
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/org/perl6/nqp/sixmodel/SerializationWriter.java
Expand Up @@ -228,6 +228,15 @@ public void writeIntHash(HashMap<String, Integer> hash) {
outputs[currentBuffer].putLong((int)hash.get(key));
}
}

private void writeCodeRef(SixModelObject ref) {
SerializationContext codeSC = ref.sc;
int scId = getSCId(codeSC);
int idx = codeSC.root_codes.indexOf(ref);
growToHold(currentBuffer, 8);
outputs[currentBuffer].putInt(scId);
outputs[currentBuffer].putInt(idx);
}

/* Writing function for references to things. */
public void writeRef(SixModelObject ref) {
Expand Down Expand Up @@ -318,12 +327,10 @@ else if (ref.sc != null) {
/* These all delegate to the REPR. */
ref.st.REPR.serialize(tc, this, ref);
break;
// XXX Implement these cases.
/*
case REFVAR_STATIC_CODEREF:
case REFVAR_CLONED_CODEREF:
/*case REFVAR_CLONED_CODEREF:*/
writeCodeRef(ref);
break;*/
break;
default:
throw new RuntimeException("Serialization Error: Unimplemented object type writeRef");
}
Expand Down

0 comments on commit e972b32

Please sign in to comment.