| Index: runtime/vm/snapshot.cc
|
| diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
|
| index 3612f1c0c4f1184b39929a069aeace1930e16940..283b0456452a31cb60b0127d3ad3f6c0bb333d76 100644
|
| --- a/runtime/vm/snapshot.cc
|
| +++ b/runtime/vm/snapshot.cc
|
| @@ -198,6 +198,8 @@ SnapshotReader::SnapshotReader(
|
| data_(ExternalTypedData::Handle(zone_)),
|
| typed_data_(TypedData::Handle(zone_)),
|
| code_(Code::Handle(zone_)),
|
| + function_(Function::Handle(zone_)),
|
| + megamorphic_cache_(MegamorphicCache::Handle(zone_)),
|
| error_(UnhandledException::Handle(zone_)),
|
| max_vm_isolate_object_id_(
|
| (kind == Snapshot::kFull) ?
|
| @@ -1173,9 +1175,18 @@ void InstructionsWriter::WriteAssembly() {
|
|
|
| stream_.Print(".text\n");
|
| stream_.Print(".globl _kInstructionsSnapshot\n");
|
| - stream_.Print(".balign %" Pd ", 0\n", OS::PreferredCodeAlignment());
|
| + stream_.Print(".balign %" Pd ", 0\n", OS::kMaxPreferredCodeAlignment);
|
| stream_.Print("_kInstructionsSnapshot:\n");
|
|
|
| + // This head also provides the gap to make the instructions snapshot
|
| + // look like a HeapPage.
|
| + intptr_t instructions_length = next_offset_;
|
| + WriteWordLiteral(instructions_length);
|
| + intptr_t header_words = HeaderSize() / sizeof(uword);
|
| + for (intptr_t i = 1; i < header_words; i++) {
|
| + WriteWordLiteral(0);
|
| + }
|
| +
|
| Object& owner = Object::Handle(Z);
|
| String& str = String::Handle(Z);
|
|
|
| @@ -1188,16 +1199,25 @@ void InstructionsWriter::WriteAssembly() {
|
| {
|
| // 1. Write from the header to the entry point.
|
| NoSafepointScope no_safepoint;
|
| - uword beginning = reinterpret_cast<uword>(insns.raw()) - kHeapObjectTag;
|
| +
|
| + uword beginning = reinterpret_cast<uword>(insns.raw_ptr());
|
| uword entry = beginning + Instructions::HeaderSize();
|
|
|
| ASSERT(Utils::IsAligned(beginning, sizeof(uint64_t)));
|
| ASSERT(Utils::IsAligned(entry, sizeof(uint64_t)));
|
|
|
| - for (uint64_t* cursor = reinterpret_cast<uint64_t*>(beginning);
|
| - cursor < reinterpret_cast<uint64_t*>(entry);
|
| + // Write Instructions with the mark and VM heap bits set.
|
| + uword marked_tags = insns.raw_ptr()->tags_;
|
| + marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags);
|
| + marked_tags = RawObject::MarkBit::update(true, marked_tags);
|
| +
|
| + WriteWordLiteral(marked_tags);
|
| + beginning += sizeof(uword);
|
| +
|
| + for (uword* cursor = reinterpret_cast<uword*>(beginning);
|
| + cursor < reinterpret_cast<uword*>(entry);
|
| cursor++) {
|
| - stream_.Print(".quad 0x%0.16" Px64 "\n", *cursor);
|
| + WriteWordLiteral(*cursor);
|
| }
|
| }
|
|
|
| @@ -1230,10 +1250,10 @@ void InstructionsWriter::WriteAssembly() {
|
| ASSERT(Utils::IsAligned(entry, sizeof(uint64_t)));
|
| ASSERT(Utils::IsAligned(end, sizeof(uint64_t)));
|
|
|
| - for (uint64_t* cursor = reinterpret_cast<uint64_t*>(entry);
|
| - cursor < reinterpret_cast<uint64_t*>(end);
|
| + for (uword* cursor = reinterpret_cast<uword*>(entry);
|
| + cursor < reinterpret_cast<uword*>(end);
|
| cursor++) {
|
| - stream_.Print(".quad 0x%0.16" Px64 "\n", *cursor);
|
| + WriteWordLiteral(*cursor);
|
| }
|
| }
|
| }
|
| @@ -1255,9 +1275,9 @@ RawInstructions* InstructionsReader::GetInstructionsAt(int32_t offset,
|
| actual_tags);
|
| }
|
|
|
| - // TODO(rmacnak): The above contains stale pointers to a Code and an
|
| - // ObjectPool. Return the actual result after calling convention change.
|
| - return Instructions::null();
|
| + ASSERT(result->IsMarked());
|
| +
|
| + return result;
|
| }
|
|
|
|
|
|
|