From 61ba258618e61e9b1afa5c60a0f84e7feea9c245 Mon Sep 17 00:00:00 2001 From: "regis@google.com" Date: Fri, 7 Feb 2014 23:02:54 +0000 Subject: [PATCH] Fix snapshotting of TypeArguments. R=asiva@google.com Review URL: https://codereview.chromium.org//132623007 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32457 260f80e4-7a28-3924-810f-c04153c831b5 --- runtime/vm/dart_api_message.cc | 1 + runtime/vm/raw_object_snapshot.cc | 5 +++++ runtime/vm/snapshot.h | 1 + 3 files changed, 7 insertions(+) diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc index 70d57206c77..5bbc9235767 100644 --- a/runtime/vm/dart_api_message.cc +++ b/runtime/vm/dart_api_message.cc @@ -487,6 +487,7 @@ Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id, AddBackRef(object_id, value, kIsDeserialized); Dart_CObject* length = ReadObjectImpl(); ASSERT(length->type == Dart_CObject_kInt32); + ReadObjectImpl(); // Read and skip instantiations_ field. for (int i = 0; i < length->value.as_int32; i++) { Dart_CObject* type = ReadObjectImpl(); if (type != &dynamic_type_marker) { diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc index 3429dd94b91..ee7d6a8889b 100644 --- a/runtime/vm/raw_object_snapshot.cc +++ b/runtime/vm/raw_object_snapshot.cc @@ -449,6 +449,8 @@ RawTypeArguments* TypeArguments::ReadFrom(SnapshotReader* reader, reader->AddBackRef(object_id, &type_arguments, kIsDeserialized); // Now set all the object fields. + *reader->ArrayHandle() ^= reader->ReadObjectImpl(); + type_arguments.set_instantiations(*reader->ArrayHandle()); for (intptr_t i = 0; i < len; i++) { *reader->TypeHandle() ^= reader->ReadObjectImpl(); type_arguments.SetTypeAt(i, *reader->TypeHandle()); @@ -493,6 +495,9 @@ void RawTypeArguments::WriteTo(SnapshotWriter* writer, // Write out the length field. writer->Write(ptr()->length_); + // Write out the instantiations field. + writer->WriteObjectImpl(ptr()->instantiations_); + // Write out the individual types. intptr_t len = Smi::Value(ptr()->length_); for (intptr_t i = 0; i < len; i++) { diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h index 80e5cd3db27..3f88f746010 100644 --- a/runtime/vm/snapshot.h +++ b/runtime/vm/snapshot.h @@ -221,6 +221,7 @@ class SnapshotReader : public BaseReader { ObjectStore* object_store() const { return isolate_->object_store(); } ClassTable* class_table() const { return isolate_->class_table(); } Object* ObjectHandle() { return &obj_; } + Array* ArrayHandle() { return &array_; } String* StringHandle() { return &str_; } AbstractType* TypeHandle() { return &type_; } TypeArguments* TypeArgumentsHandle() { return &type_arguments_; }