Index: runtime/vm/isolate_reload.cc |
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc |
index 9a67be9f5369bfc3a842bc4857c033dc03e9fc69..3d49d460a1d31dfa14a7306d1fc4d038f9dc3c41 100644 |
--- a/runtime/vm/isolate_reload.cc |
+++ b/runtime/vm/isolate_reload.cc |
@@ -47,11 +47,11 @@ DEFINE_FLAG(bool, check_reloaded, false, |
#name) |
-InstanceMorpher::InstanceMorpher(const Class& from, const Class& to) |
+InstanceMorpher::InstanceMorpher(Zone* zone, const Class& from, const Class& to) |
: from_(from), to_(to), mapping_() { |
ComputeMapping(); |
- before_ = new ZoneGrowableArray<const Instance*>(); |
- after_ = new ZoneGrowableArray<const Instance*>(); |
+ before_ = new ZoneGrowableArray<const Instance*>(zone, 0); |
+ after_ = new ZoneGrowableArray<const Instance*>(zone, 0); |
ASSERT(from_.id() == to_.id()); |
cid_ = from_.id(); |
} |
@@ -216,7 +216,7 @@ void ClassReasonForCancelling::AppendTo(JSONArray* array) { |
RawError* IsolateReloadContext::error() const { |
- ASSERT(has_error()); |
+ ASSERT(reload_aborted()); |
// Report the first error to the surroundings. |
const Error& error = |
Error::Handle(reasons_to_cancel_reload_.At(0)->ToError()); |
@@ -359,10 +359,12 @@ bool IsolateReloadContext::IsSameLibrary( |
IsolateReloadContext::IsolateReloadContext(Isolate* isolate, |
JSONStream* js) |
- : start_time_micros_(OS::GetCurrentMonotonicMicros()), |
+ : zone_(Thread::Current()->zone()), |
+ start_time_micros_(OS::GetCurrentMonotonicMicros()), |
reload_timestamp_(OS::GetCurrentTimeMillis()), |
isolate_(isolate), |
reload_skipped_(false), |
+ reload_aborted_(false), |
js_(js), |
saved_num_cids_(-1), |
saved_class_table_(NULL), |
@@ -384,6 +386,7 @@ IsolateReloadContext::IsolateReloadContext(Isolate* isolate, |
// NOTE: DO NOT ALLOCATE ANY RAW OBJECTS HERE. The IsolateReloadContext is not |
// associated with the isolate yet and if a GC is triggered here the raw |
// objects will not be properly accounted for. |
+ ASSERT(zone_ != NULL); |
} |
@@ -409,8 +412,8 @@ void IsolateReloadContext::ReportSuccess() { |
class Aborted : public ReasonForCancelling { |
public: |
- explicit Aborted(const Error& error) |
- : ReasonForCancelling(), error_(error) { } |
+ explicit Aborted(Zone* zone, const Error& error) |
+ : ReasonForCancelling(zone), error_(error) { } |
private: |
const Error& error_; |
@@ -422,10 +425,12 @@ class Aborted : public ReasonForCancelling { |
}; |
-void IsolateReloadContext::StartReload(bool force_reload) { |
+// NOTE: This function returns *after* FinalizeLoading is called. |
+void IsolateReloadContext::Reload(bool force_reload) { |
TIMELINE_SCOPE(Reload); |
Thread* thread = Thread::Current(); |
ASSERT(isolate() == thread->isolate()); |
+ fprintf(stderr, "Reload\n"); |
rmacnak
2016/08/02 16:30:22
Remove
Cutch
2016/08/02 16:32:33
Done.
|
// Grab root library before calling CheckpointBeforeReload. |
const Library& root_lib = Library::Handle(object_store()->root_library()); |
@@ -486,7 +491,7 @@ void IsolateReloadContext::StartReload(bool force_reload) { |
} |
if (result.IsError()) { |
const Error& error = Error::Cast(result); |
- AddReasonForCancelling(new Aborted(error)); |
+ AddReasonForCancelling(new Aborted(zone_, error)); |
} |
} |
@@ -517,10 +522,12 @@ void IsolateReloadContext::RegisterClass(const Class& new_cls) { |
} |
-void IsolateReloadContext::FinishReload() { |
+// FinalizeLoading will be called *before* Reload() returns. |
+void IsolateReloadContext::FinalizeLoading() { |
if (reload_skipped_) { |
return; |
} |
+ fprintf(stderr, "FinalizeLoading\n"); |
rmacnak
2016/08/02 16:30:22
"
Cutch
2016/08/02 16:32:33
Done.
|
BuildLibraryMapping(); |
TIR_Print("---- DONE FINALIZING\n"); |
if (ValidateReload()) { |
@@ -543,6 +550,7 @@ void IsolateReloadContext::FinishReload() { |
BackgroundCompiler::Enable(); |
+ reload_aborted_ = HasReasonsForCancelling(); |
ReportOnJSON(js_); |
} |
@@ -580,7 +588,7 @@ void IsolateReloadContext::ReportOnJSON(JSONStream* stream) { |
void IsolateReloadContext::AbortReload(const Error& error) { |
- AddReasonForCancelling(new Aborted(error)); |
+ AddReasonForCancelling(new Aborted(zone_, error)); |
ReportReasonsForCancelling(); |
Rollback(); |
} |
@@ -722,10 +730,10 @@ BitVector* IsolateReloadContext::FindModifiedLibraries(bool force_reload) { |
// Construct the imported-by graph. |
ZoneGrowableArray<ZoneGrowableArray<intptr_t>* >* imported_by = |
- new ZoneGrowableArray<ZoneGrowableArray<intptr_t>* >(num_libs); |
+ new ZoneGrowableArray<ZoneGrowableArray<intptr_t>* >(zone_, num_libs); |
imported_by->SetLength(num_libs); |
for (intptr_t i = 0; i < num_libs; i++) { |
- (*imported_by)[i] = new ZoneGrowableArray<intptr_t>(); |
+ (*imported_by)[i] = new ZoneGrowableArray<intptr_t>(zone_, 0); |
} |
Array& imports = Array::Handle(); |
Namespace& ns = Namespace::Handle(); |
@@ -1207,7 +1215,7 @@ void IsolateReloadContext::MorphInstances() { |
bool IsolateReloadContext::ValidateReload() { |
TIMELINE_SCOPE(ValidateReload); |
- if (has_error()) return false; |
+ if (reload_aborted()) return false; |
// Validate libraries. |
{ |