Ensure deoptimizing frames have a valid pc marker before deferred materialization.

BUG=http://dartbug.com/26131
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1847623002 .
This commit is contained in:
Ryan Macnak 2016-03-30 13:11:14 -07:00
parent 868a5c582c
commit ba608694b7
8 changed files with 46 additions and 3 deletions

View file

@ -1793,6 +1793,17 @@ END_LEAF_RUNTIME_ENTRY
// materialization phase.
DEFINE_RUNTIME_ENTRY(DeoptimizeMaterialize, 0) {
#if !defined(DART_PRECOMPILED_RUNTIME)
#if defined(DEBUG)
{
// We may rendezvous for a safepoint at entry or GC from the allocations
// below. Check the stack is walkable.
StackFrameIterator frames_iterator(StackFrameIterator::kValidateFrames);
StackFrame* frame = frames_iterator.NextFrame();
while (frame != NULL) {
frame = frames_iterator.NextFrame();
}
}
#endif
DeoptContext* deopt_context = isolate->deopt_context();
intptr_t deopt_arg_count = deopt_context->MaterializeDeferredObjects();
isolate->set_deopt_context(NULL);

View file

@ -666,9 +666,14 @@ class DeoptPcMarkerInstr : public DeoptInstr {
return;
}
*dest_addr = reinterpret_cast<intptr_t>(Object::null());
deopt_context->DeferPcMarkerMaterialization(
object_table_index_, dest_addr);
// We don't always have the Code object for the frame's corresponding
// unoptimized code as it may have been collected. Use a stub as the pc
// marker until we can recreate that Code object during deferred
// materialization to maintain the invariant that Dart frames always have
// a pc marker.
*reinterpret_cast<RawObject**>(dest_addr) =
StubCode::FrameAwaitingMaterialization_entry()->code();
deopt_context->DeferPcMarkerMaterialization(object_table_index_, dest_addr);
}
private:

View file

@ -63,6 +63,7 @@ class SnapshotWriter;
V(Subtype2TestCache) \
V(Subtype3TestCache) \
V(CallClosureNoSuchMethod) \
V(FrameAwaitingMaterialization) \
// Is it permitted for the stubs above to refer to Object::null(), which is
// allocated in the VM isolate and shared across all isolates.

View file

@ -2179,6 +2179,11 @@ void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) {
__ Ret();
}
void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
__ bkpt(0);
}
} // namespace dart
#endif // defined TARGET_ARCH_ARM

View file

@ -2232,6 +2232,11 @@ void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) {
__ ret();
}
void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
__ brk(0);
}
} // namespace dart
#endif // defined TARGET_ARCH_ARM64

View file

@ -2093,6 +2093,12 @@ void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) {
__ int3();
}
void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
__ int3();
}
} // namespace dart
#endif // defined TARGET_ARCH_IA32

View file

@ -2345,6 +2345,11 @@ void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) {
__ Ret();
}
void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
__ break_(0);
}
} // namespace dart
#endif // defined TARGET_ARCH_MIPS

View file

@ -2220,6 +2220,11 @@ void StubCode::GenerateICLookupThroughCodeStub(Assembler* assembler) {
__ ret();
}
void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
__ int3();
}
} // namespace dart
#endif // defined TARGET_ARCH_X64