Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Have P6int on JVM handle unsigned in compose.
  • Loading branch information
jnthn committed Sep 25, 2013
1 parent 37c6d7f commit 9561e47
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Expand Up @@ -11,7 +11,7 @@

public class SerializationReader {
/* The current version of the serialization format. */
private final int CURRENT_VERSION = 7;
private final int CURRENT_VERSION = 8;

/* The minimum version of the serialization format. */
private final int MIN_VERSION = 4;
Expand Down
Expand Up @@ -18,7 +18,7 @@

public class SerializationWriter {
/* The current version of the serialization format. */
private final int CURRENT_VERSION = 7;
private final int CURRENT_VERSION = 8;

/* Various sizes (in bytes). */
private final int HEADER_SIZE = 4 * 16;
Expand Down
9 changes: 9 additions & 0 deletions src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6int.java
Expand Up @@ -35,6 +35,10 @@ public void compose(ThreadContext tc, STable st, SixModelObject repr_info) {
SixModelObject bits = integerInfo.at_key_boxed(tc, "bits");
if (bits != null)
((StorageSpec)st.REPRData).bits = (short)bits.get_int(tc);

SixModelObject unsigned = integerInfo.at_key_boxed(tc, "unsigned");
if (unsigned != null)
((StorageSpec)st.REPRData).is_unsigned = (short)unsigned.get_int(tc);
}
}

Expand Down Expand Up @@ -137,6 +141,7 @@ public void serialize_inlined(ThreadContext tc, STable st, SerializationWriter w
public void serialize_repr_data(ThreadContext tc, STable st, SerializationWriter writer)
{
writer.writeInt(((StorageSpec)st.REPRData).bits);
writer.writeInt(((StorageSpec)st.REPRData).is_unsigned);
}

/**
Expand All @@ -152,6 +157,10 @@ public void deserialize_repr_data(ThreadContext tc, STable st, SerializationRead
ss.bits = (short)reader.readLong();
else
ss.bits = 64;
if (reader.version >= 8)
ss.is_unsigned = (short)reader.readLong();
else
ss.is_unsigned = 0;
ss.can_box = StorageSpec.CAN_BOX_INT;
st.REPRData = ss;
}
Expand Down

0 comments on commit 9561e47

Please sign in to comment.