Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: runtime/vm/isolate.h

Issue 1965823002: Initial isolate reload support (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/isolate.h
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index c2fc95554d71e231affe824e2d343fce1bd32818..b418fd6fec65f34c19cb88c74d6a6411a11fd56c 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -35,6 +35,7 @@ class HandleVisitor;
class Heap;
class ICData;
class IsolateProfilerData;
+class IsolateReloadContext;
class IsolateSpawnState;
class Log;
class MessageHandler;
@@ -47,12 +48,12 @@ class RawInstance;
class RawArray;
class RawContext;
class RawDouble;
+class RawError;
+class RawField;
class RawGrowableObjectArray;
class RawMint;
class RawObject;
class RawInteger;
-class RawError;
-class RawField;
class RawFloat32x4;
class RawInt32x4;
class RawUserTag;
@@ -91,6 +92,18 @@ class NoOOBMessageScope : public StackResource {
};
+// Disallow isolate reload.
+class NoReloadScope : public StackResource {
+ public:
+ NoReloadScope(Isolate* isolate, Thread* thread);
+ ~NoReloadScope();
+
+ private:
+ Isolate* isolate_;
+ DISALLOW_COPY_AND_ASSIGN(NoReloadScope);
+};
+
+
class Isolate : public BaseIsolate {
public:
// Keep both these enums in sync with isolate_patch.dart.
@@ -150,6 +163,9 @@ class Isolate : public BaseIsolate {
return OFFSET_OF(Isolate, class_table_);
}
+ // Prefers old classes when we are in the middle of a reload.
+ RawClass* GetClassForHeapWalkAt(intptr_t cid);
+
static intptr_t ic_miss_code_offset() {
return OFFSET_OF(Isolate, ic_miss_code_);
}
@@ -237,6 +253,10 @@ class Isolate : public BaseIsolate {
// Marks all libraries as loaded.
void DoneLoading();
+ void DoneFinalizing();
+
+ void OnStackReload();
+ void ReloadSources(bool test_mode = false);
bool MakeRunnable();
void Run();
@@ -388,6 +408,22 @@ class Isolate : public BaseIsolate {
background_compiler_ = value;
}
+ void enable_background_compiler() {
+ background_compiler_disabled_depth_--;
+ if (background_compiler_disabled_depth_ < 0) {
+ FATAL("Mismatched number of calls to disable_background_compiler and "
+ "enable_background_compiler.");
+ }
+ }
+
+ void disable_background_compiler() {
+ background_compiler_disabled_depth_++;
+ }
+
+ bool is_background_compiler_disabled() const {
+ return background_compiler_disabled_depth_ > 0;
+ }
+
void UpdateLastAllocationProfileAccumulatorResetTimestamp() {
last_allocationprofile_accumulator_reset_timestamp_ =
OS::GetCurrentTimeMillis();
@@ -432,6 +468,22 @@ class Isolate : public BaseIsolate {
return &vm_tag_counters_;
}
+ bool IsReloading() const {
+ return reload_context_ != NULL;
+ }
+
+ IsolateReloadContext* reload_context() {
+ return reload_context_;
+ }
+
+ bool HasAttemptedReload() const {
+ return has_attempted_reload_;
+ }
+
+ bool CanReload() const;
+
+ void ReportReloadError(const Error& error);
+
uword user_tag() const {
return user_tag_;
}
@@ -717,6 +769,7 @@ class Isolate : public BaseIsolate {
// Background compilation.
BackgroundCompiler* background_compiler_;
+ intptr_t background_compiler_disabled_depth_;
// We use 6 list entries for each pending service extension calls.
enum {
@@ -769,6 +822,11 @@ class Isolate : public BaseIsolate {
Monitor* spawn_count_monitor_;
intptr_t spawn_count_;
+ // Has a reload ever been attempted?
+ bool has_attempted_reload_;
+ intptr_t no_reload_scope_depth_; // we can only reload when this is 0.
+ IsolateReloadContext* reload_context_;
+
#define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \
type metric_##variable##_;
ISOLATE_METRIC_LIST(ISOLATE_METRIC_VARIABLE);
@@ -795,12 +853,15 @@ class Isolate : public BaseIsolate {
REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION)
#undef REUSABLE_FRIEND_DECLARATION
+ friend class Become; // VisitObjectPointers
friend class GCMarker; // VisitObjectPointers
friend class SafepointHandler;
friend class Scavenger; // VisitObjectPointers
friend class ServiceIsolate;
friend class Thread;
friend class Timeline;
+ friend class NoReloadScope; // reload_block
+
DISALLOW_COPY_AND_ASSIGN(Isolate);
};

Powered by Google App Engine
This is Rietveld 408576698