Skip to content

Commit

Permalink
Bump minimum serialization format version.
Browse files Browse the repository at this point in the history
This in turn enables us to assume we have varints in the thing we
are reading, which we have for quite a while now.
  • Loading branch information
jnthn committed Aug 1, 2014
1 parent e92aa36 commit 9a3a96d
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/6model/serialization.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
/* Version of the serialization format that we are currently at and lowest
* version we support. */
#define CURRENT_VERSION 11
#define VARINT_MIN_VERSION 9
#define MIN_VERSION 5
#define MIN_VERSION 9

/* Various sizes (in bytes). */
#define HEADER_SIZE (4 * 16)
Expand Down Expand Up @@ -1468,11 +1467,7 @@ MVMObject * MVM_serialization_read_ref(MVMThreadContext *tc, MVMSerializationRea
return tc->instance->VMNull;
case REFVAR_VM_INT: {
MVMint64 value;
if (reader->root.version < VARINT_MIN_VERSION) {
value = MVM_serialization_read_int(tc, reader);
} else {
value = read_varint_func(tc, reader);
}
value = read_varint_func(tc, reader);
result = MVM_repr_box_int(tc, tc->instance->boot_types.BOOTInt, value);
return result;
}
Expand All @@ -1495,11 +1490,7 @@ MVMObject * MVM_serialization_read_ref(MVMThreadContext *tc, MVMSerializationRea
case REFVAR_VM_ARR_STR:
return read_array_str(tc, reader);
case REFVAR_VM_ARR_INT:
if (reader->root.version < VARINT_MIN_VERSION) {
return read_array_int(tc, reader);
} else {
return read_array_varint(tc, reader);
}
return read_array_varint(tc, reader);
case REFVAR_VM_HASH_STR_VAR:
result = read_hash_str_var(tc, reader);
if (reader->current_object) {
Expand Down Expand Up @@ -1572,10 +1563,6 @@ static void check_and_dissect_input(MVMThreadContext *tc,
"Unsupported serialization format version %d (current version is %d)",
reader->root.version, CURRENT_VERSION);

if (reader->root.version < VARINT_MIN_VERSION) {
reader->read_varint = MVM_serialization_read_int;
}

/* Ensure that the data is at least as long as the header is expected to be. */
if (data_len < HEADER_SIZE)
fail_deserialize(tc, reader,
Expand Down Expand Up @@ -2067,8 +2054,6 @@ void MVM_serialization_deserialize(MVMThreadContext *tc, MVMSerializationContext
reader->root.string_heap = string_heap;

/* Put reader functions in place. */
/* if we are before VARINT_MIN_VERSION, this will be changed to point
* to read_int instead */
reader->read_varint = read_varint_func;

/* Put code root list into SC. We'll end up mutating it, but that's
Expand Down

0 comments on commit 9a3a96d

Please sign in to comment.