2016-05-17 19:19:06 +00:00
|
|
|
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2016-10-26 07:26:03 +00:00
|
|
|
#ifndef RUNTIME_VM_ISOLATE_RELOAD_H_
|
|
|
|
#define RUNTIME_VM_ISOLATE_RELOAD_H_
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
|
|
|
|
2016-07-29 18:23:18 +00:00
|
|
|
#include "include/dart_tools_api.h"
|
|
|
|
|
2016-05-17 19:19:06 +00:00
|
|
|
#include "vm/globals.h"
|
|
|
|
#include "vm/growable_array.h"
|
2017-04-19 17:21:53 +00:00
|
|
|
#include "vm/hash_map.h"
|
2016-05-17 19:19:06 +00:00
|
|
|
#include "vm/log.h"
|
2017-02-23 20:40:48 +00:00
|
|
|
#include "vm/object.h"
|
2016-05-17 19:19:06 +00:00
|
|
|
|
|
|
|
DECLARE_FLAG(bool, trace_reload);
|
2016-07-15 17:52:20 +00:00
|
|
|
DECLARE_FLAG(bool, trace_reload_verbose);
|
2016-05-17 19:19:06 +00:00
|
|
|
|
|
|
|
// 'Trace Isolate Reload' TIR_Print
|
|
|
|
#if defined(_MSC_VER)
|
2016-11-08 21:54:47 +00:00
|
|
|
#define TIR_Print(format, ...) \
|
|
|
|
if (FLAG_trace_reload) Log::Current()->Print(format, __VA_ARGS__)
|
2016-05-17 19:19:06 +00:00
|
|
|
#else
|
2016-11-08 21:54:47 +00:00
|
|
|
#define TIR_Print(format, ...) \
|
|
|
|
if (FLAG_trace_reload) Log::Current()->Print(format, ##__VA_ARGS__)
|
2016-05-17 19:19:06 +00:00
|
|
|
#endif
|
|
|
|
|
2016-07-15 17:52:20 +00:00
|
|
|
// 'Verbose Trace Isolate Reload' VTIR_Print
|
|
|
|
#if defined(_MSC_VER)
|
2016-11-08 21:54:47 +00:00
|
|
|
#define VTIR_Print(format, ...) \
|
|
|
|
if (FLAG_trace_reload_verbose) Log::Current()->Print(format, __VA_ARGS__)
|
2016-07-15 17:52:20 +00:00
|
|
|
#else
|
2016-11-08 21:54:47 +00:00
|
|
|
#define VTIR_Print(format, ...) \
|
|
|
|
if (FLAG_trace_reload_verbose) Log::Current()->Print(format, ##__VA_ARGS__)
|
2016-07-15 17:52:20 +00:00
|
|
|
#endif
|
|
|
|
|
2017-08-24 16:25:53 +00:00
|
|
|
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
|
|
|
|
|
2016-05-17 19:19:06 +00:00
|
|
|
namespace dart {
|
|
|
|
|
2016-07-29 18:23:18 +00:00
|
|
|
class BitVector;
|
2016-05-17 19:19:06 +00:00
|
|
|
class GrowableObjectArray;
|
|
|
|
class Isolate;
|
|
|
|
class Library;
|
2019-11-15 14:08:45 +00:00
|
|
|
class ObjectLocator;
|
2016-07-29 18:23:18 +00:00
|
|
|
class ObjectPointerVisitor;
|
|
|
|
class ObjectStore;
|
2016-05-17 19:19:06 +00:00
|
|
|
class RawError;
|
|
|
|
class RawGrowableObjectArray;
|
|
|
|
class RawLibrary;
|
|
|
|
class RawObject;
|
|
|
|
class RawString;
|
2016-07-29 18:23:18 +00:00
|
|
|
class Script;
|
2016-05-17 19:19:06 +00:00
|
|
|
class UpdateClassesVisitor;
|
|
|
|
|
2016-07-26 18:13:28 +00:00
|
|
|
class InstanceMorpher : public ZoneAllocated {
|
|
|
|
public:
|
2019-11-15 14:08:45 +00:00
|
|
|
// Creates a new [InstanceMorpher] based on the [from]/[to] class
|
|
|
|
// descriptions.
|
|
|
|
static InstanceMorpher* CreateFromClassDescriptors(
|
|
|
|
Zone* zone,
|
|
|
|
SharedClassTable* shared_class_table,
|
|
|
|
const Class& from,
|
|
|
|
const Class& to);
|
|
|
|
|
|
|
|
InstanceMorpher(Zone* zone,
|
|
|
|
classid_t cid,
|
|
|
|
SharedClassTable* shared_class_table,
|
|
|
|
ZoneGrowableArray<intptr_t>* mapping,
|
|
|
|
ZoneGrowableArray<intptr_t>* new_fields_offsets);
|
2016-07-26 18:13:28 +00:00
|
|
|
virtual ~InstanceMorpher() {}
|
|
|
|
|
|
|
|
// Called on each instance that needs to be morphed.
|
|
|
|
RawInstance* Morph(const Instance& instance) const;
|
|
|
|
|
|
|
|
// Adds an object to be morphed.
|
2019-11-15 14:08:45 +00:00
|
|
|
void AddObject(RawObject* object);
|
2016-07-26 18:13:28 +00:00
|
|
|
|
|
|
|
// Create the morphed objects based on the before() list.
|
2019-11-15 14:08:45 +00:00
|
|
|
void CreateMorphedCopies();
|
2016-07-26 18:13:28 +00:00
|
|
|
|
2016-07-28 18:07:15 +00:00
|
|
|
// Append the morper info to JSON array.
|
|
|
|
void AppendTo(JSONArray* array);
|
|
|
|
|
2016-07-26 18:13:28 +00:00
|
|
|
// Returns the list of objects that need to be morphed.
|
2019-11-15 14:08:45 +00:00
|
|
|
const GrowableArray<const Instance*>* before() const { return &before_; }
|
|
|
|
|
2016-07-26 18:13:28 +00:00
|
|
|
// Returns the list of morphed objects (matches order in before()).
|
2019-11-15 14:08:45 +00:00
|
|
|
const GrowableArray<const Instance*>* after() const { return &after_; }
|
2016-07-26 18:13:28 +00:00
|
|
|
|
|
|
|
// Returns the cid associated with the from_ and to_ class.
|
|
|
|
intptr_t cid() const { return cid_; }
|
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
// Dumps the field mappings for the [cid()] class.
|
|
|
|
void Dump() const;
|
|
|
|
|
2016-07-26 18:13:28 +00:00
|
|
|
private:
|
2019-11-15 14:08:45 +00:00
|
|
|
Zone* zone_;
|
|
|
|
classid_t cid_;
|
|
|
|
SharedClassTable* shared_class_table_;
|
|
|
|
ZoneGrowableArray<intptr_t>* mapping_;
|
|
|
|
ZoneGrowableArray<intptr_t>* new_fields_offsets_;
|
|
|
|
|
|
|
|
GrowableArray<const Instance*> before_;
|
|
|
|
GrowableArray<const Instance*> after_;
|
2016-07-26 18:13:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ReasonForCancelling : public ZoneAllocated {
|
|
|
|
public:
|
2016-08-02 16:36:46 +00:00
|
|
|
explicit ReasonForCancelling(Zone* zone) {}
|
2016-07-26 18:13:28 +00:00
|
|
|
virtual ~ReasonForCancelling() {}
|
|
|
|
|
|
|
|
// Reports a reason for cancelling reload.
|
2019-11-15 14:08:45 +00:00
|
|
|
void Report(IsolateGroupReloadContext* context);
|
2016-07-26 18:13:28 +00:00
|
|
|
|
|
|
|
// Conversion to a VM error object.
|
|
|
|
// Default implementation calls ToString.
|
|
|
|
virtual RawError* ToError();
|
|
|
|
|
|
|
|
// Conversion to a string object.
|
|
|
|
// Default implementation calls ToError.
|
|
|
|
virtual RawString* ToString();
|
|
|
|
|
2016-07-28 18:07:15 +00:00
|
|
|
// Append the reason to JSON array.
|
|
|
|
virtual void AppendTo(JSONArray* array);
|
|
|
|
|
2016-07-26 18:13:28 +00:00
|
|
|
// Concrete subclasses must override either ToError or ToString.
|
|
|
|
};
|
|
|
|
|
|
|
|
// Abstract class for also capturing the from_ and to_ class.
|
|
|
|
class ClassReasonForCancelling : public ReasonForCancelling {
|
|
|
|
public:
|
2016-08-16 20:01:10 +00:00
|
|
|
ClassReasonForCancelling(Zone* zone, const Class& from, const Class& to);
|
2016-07-28 18:07:15 +00:00
|
|
|
void AppendTo(JSONArray* array);
|
|
|
|
|
2016-07-26 18:13:28 +00:00
|
|
|
protected:
|
|
|
|
const Class& from_;
|
|
|
|
const Class& to_;
|
|
|
|
};
|
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
class IsolateGroupReloadContext {
|
2016-05-17 19:19:06 +00:00
|
|
|
public:
|
2019-11-15 14:08:45 +00:00
|
|
|
IsolateGroupReloadContext(IsolateGroup* isolate,
|
|
|
|
SharedClassTable* shared_class_table,
|
|
|
|
JSONStream* js);
|
|
|
|
~IsolateGroupReloadContext();
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2018-09-27 21:47:39 +00:00
|
|
|
// If kernel_buffer is provided, the VM takes ownership when Reload is called.
|
2019-11-15 14:08:45 +00:00
|
|
|
bool Reload(bool force_reload,
|
2016-11-17 19:29:12 +00:00
|
|
|
const char* root_script_url = NULL,
|
2018-09-26 14:10:53 +00:00
|
|
|
const char* packages_url = NULL,
|
|
|
|
const uint8_t* kernel_buffer = NULL,
|
|
|
|
intptr_t kernel_buffer_size = 0);
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2016-08-02 16:36:46 +00:00
|
|
|
// All zone allocated objects must be allocated from this zone.
|
|
|
|
Zone* zone() const { return zone_; }
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
bool UseSavedSizeTableForGC() const {
|
|
|
|
return saved_size_table_.load(std::memory_order_relaxed) != nullptr;
|
2019-10-21 16:26:39 +00:00
|
|
|
}
|
2019-09-10 12:48:16 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
IsolateGroup* isolate_group() const { return isolate_group_; }
|
|
|
|
bool reload_aborted() const { return HasReasonsForCancelling(); }
|
2016-07-29 18:23:18 +00:00
|
|
|
bool reload_skipped() const { return reload_skipped_; }
|
2016-07-26 18:13:28 +00:00
|
|
|
RawError* error() const;
|
2019-11-15 14:08:45 +00:00
|
|
|
int64_t start_time_micros() const { return start_time_micros_; }
|
2016-07-29 18:23:18 +00:00
|
|
|
int64_t reload_timestamp() const { return reload_timestamp_; }
|
|
|
|
|
2016-08-02 16:36:46 +00:00
|
|
|
static Dart_FileModifiedCallback file_modified_callback() {
|
|
|
|
return file_modified_callback_;
|
|
|
|
}
|
|
|
|
static void SetFileModifiedCallback(Dart_FileModifiedCallback callback) {
|
|
|
|
file_modified_callback_ = callback;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2019-11-15 14:08:45 +00:00
|
|
|
intptr_t GetClassSizeForHeapWalkAt(classid_t cid);
|
2019-09-06 22:06:30 +00:00
|
|
|
void DiscardSavedClassTable(bool is_rollback);
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2016-07-26 18:13:28 +00:00
|
|
|
// Tells whether there are reasons for cancelling the reload.
|
|
|
|
bool HasReasonsForCancelling() const {
|
|
|
|
return !reasons_to_cancel_reload_.is_empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Record problem for this reload.
|
|
|
|
void AddReasonForCancelling(ReasonForCancelling* reason);
|
|
|
|
|
2016-07-28 18:07:15 +00:00
|
|
|
// Reports all reasons for cancelling reload.
|
2016-07-26 18:13:28 +00:00
|
|
|
void ReportReasonsForCancelling();
|
|
|
|
|
2017-05-01 06:28:01 +00:00
|
|
|
// Reports the details of a reload operation.
|
2019-11-15 14:08:45 +00:00
|
|
|
void ReportOnJSON(JSONStream* stream, intptr_t final_library_count);
|
2016-07-28 18:07:15 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
// Ensures there is a instance morpher for [cid], if not it will use
|
|
|
|
// [instance_morpher]
|
|
|
|
void EnsureHasInstanceMorpherFor(classid_t cid,
|
|
|
|
InstanceMorpher* instance_morpher);
|
2016-07-26 18:13:28 +00:00
|
|
|
|
|
|
|
// Tells whether instance in the heap must be morphed.
|
2016-11-08 21:54:47 +00:00
|
|
|
bool HasInstanceMorphers() const { return !instance_morphers_.is_empty(); }
|
2016-07-26 18:13:28 +00:00
|
|
|
|
2016-08-02 23:11:30 +00:00
|
|
|
// Called by both FinalizeLoading and FinalizeFailedLoad.
|
2019-11-15 14:08:45 +00:00
|
|
|
void CommonFinalizeTail(intptr_t final_library_count);
|
2016-08-02 16:36:46 +00:00
|
|
|
|
|
|
|
// Report back through the observatory channels.
|
|
|
|
void ReportError(const Error& error);
|
|
|
|
void ReportSuccess();
|
2016-07-29 18:23:18 +00:00
|
|
|
|
2016-05-17 19:19:06 +00:00
|
|
|
void VisitObjectPointers(ObjectPointerVisitor* visitor);
|
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
void GetRootLibUrl(const char* root_script_url);
|
|
|
|
char* CompileToKernel(bool force_reload,
|
|
|
|
const char* packages_url,
|
|
|
|
const uint8_t** kernel_buffer,
|
|
|
|
intptr_t* kernel_buffer_size);
|
|
|
|
RawExternalTypedData* MakeRetainedTypedData(const uint8_t* kernel_buffer,
|
|
|
|
intptr_t kernel_buffer_size);
|
|
|
|
void FindModifiedSources(bool force_reload,
|
2018-02-07 19:35:39 +00:00
|
|
|
Dart_SourceFile** modified_sources,
|
2018-08-03 11:03:08 +00:00
|
|
|
intptr_t* count,
|
|
|
|
const char* packages_url);
|
2019-11-15 14:08:45 +00:00
|
|
|
bool ScriptModifiedSince(const Script& script, int64_t since);
|
2016-07-29 18:23:18 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
void CheckpointSharedClassTable();
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
void MorphInstancesPhase1Allocate(ObjectLocator* locator,
|
|
|
|
const Array& before,
|
|
|
|
const Array& after);
|
|
|
|
void MorphInstancesPhase2Become(const Array& before, const Array& after);
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
void ForEachIsolate(std::function<void(Isolate*)> callback);
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2016-08-02 16:36:46 +00:00
|
|
|
// The zone used for all reload related allocations.
|
|
|
|
Zone* zone_;
|
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
IsolateGroup* isolate_group_;
|
|
|
|
SharedClassTable* shared_class_table_;
|
2016-07-26 18:13:28 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
int64_t start_time_micros_ = -1;
|
|
|
|
int64_t reload_timestamp_ = -1;
|
|
|
|
Isolate* first_isolate_ = nullptr;
|
|
|
|
bool reload_skipped_ = false;
|
|
|
|
bool reload_finalized_ = false;
|
|
|
|
JSONStream* js_;
|
|
|
|
intptr_t num_old_libs_ = -1;
|
2016-07-26 18:13:28 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
intptr_t saved_num_cids_ = -1;
|
|
|
|
std::atomic<intptr_t*> saved_size_table_;
|
|
|
|
intptr_t num_received_libs_ = -1;
|
|
|
|
intptr_t bytes_received_libs_ = -1;
|
|
|
|
intptr_t num_received_classes_ = -1;
|
|
|
|
intptr_t num_received_procedures_ = -1;
|
|
|
|
intptr_t num_saved_libs_ = -1;
|
2016-07-26 18:13:28 +00:00
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
// Required trait for the instance_morpher_by_cid_;
|
2016-07-26 18:13:28 +00:00
|
|
|
struct MorpherTrait {
|
|
|
|
typedef InstanceMorpher* Value;
|
|
|
|
typedef intptr_t Key;
|
|
|
|
typedef InstanceMorpher* Pair;
|
|
|
|
|
|
|
|
static Key KeyOf(Pair kv) { return kv->cid(); }
|
|
|
|
static Value ValueOf(Pair kv) { return kv; }
|
|
|
|
static intptr_t Hashcode(Key key) { return key; }
|
|
|
|
static bool IsKeyEqual(Pair kv, Key key) { return kv->cid() == key; }
|
|
|
|
};
|
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
// Collect the necessary instance transformation for schema changes.
|
|
|
|
GrowableArray<InstanceMorpher*> instance_morphers_;
|
|
|
|
|
|
|
|
// Collects the reasons for cancelling the reload.
|
|
|
|
GrowableArray<ReasonForCancelling*> reasons_to_cancel_reload_;
|
|
|
|
|
2016-07-26 18:13:28 +00:00
|
|
|
// Hash map from cid to InstanceMorpher.
|
2019-11-15 14:08:45 +00:00
|
|
|
DirectChainedHashMap<MorpherTrait> instance_morpher_by_cid_;
|
|
|
|
|
|
|
|
// A bit vector indicating which of the original libraries were modified.
|
|
|
|
BitVector* modified_libs_ = nullptr;
|
|
|
|
|
|
|
|
String& root_lib_url_;
|
|
|
|
RawObject** from() {
|
|
|
|
return reinterpret_cast<RawObject**>(&root_url_prefix_);
|
|
|
|
}
|
|
|
|
RawString* root_url_prefix_;
|
|
|
|
RawString* old_root_url_prefix_;
|
|
|
|
RawObject** to() {
|
|
|
|
return reinterpret_cast<RawObject**>(&old_root_url_prefix_);
|
|
|
|
}
|
|
|
|
|
|
|
|
friend class Isolate;
|
|
|
|
friend class Class; // AddStaticFieldMapping, AddEnumBecomeMapping.
|
|
|
|
friend class Library;
|
|
|
|
friend class ObjectLocator;
|
|
|
|
friend class MarkFunctionsForRecompilation; // IsDirty.
|
|
|
|
friend class ReasonForCancelling;
|
|
|
|
friend class IsolateReloadContext;
|
|
|
|
friend class Instance; // GetClassSizeForHeapWalkAt
|
|
|
|
|
|
|
|
static Dart_FileModifiedCallback file_modified_callback_;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IsolateReloadContext {
|
|
|
|
public:
|
|
|
|
IsolateReloadContext(
|
|
|
|
std::shared_ptr<IsolateGroupReloadContext> group_reload_context,
|
|
|
|
Isolate* isolate);
|
|
|
|
~IsolateReloadContext();
|
|
|
|
|
|
|
|
// All zone allocated objects must be allocated from this zone.
|
|
|
|
Zone* zone() const { return zone_; }
|
|
|
|
|
|
|
|
IsolateGroupReloadContext* group_reload_context() {
|
|
|
|
return group_reload_context_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool IsSameLibrary(const Library& a_lib, const Library& b_lib);
|
|
|
|
static bool IsSameClass(const Class& a, const Class& b);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool IsDirty(const Library& lib);
|
|
|
|
|
|
|
|
// Prefers old classes when we are in the middle of a reload.
|
|
|
|
RawClass* GetClassForHeapWalkAt(intptr_t cid);
|
|
|
|
void DiscardSavedClassTable(bool is_rollback);
|
|
|
|
|
|
|
|
void RegisterClass(const Class& new_cls);
|
|
|
|
|
|
|
|
// Finds the library private key for |replacement_or_new| or return null
|
|
|
|
// if |replacement_or_new| is new.
|
|
|
|
RawString* FindLibraryPrivateKey(const Library& replacement_or_new);
|
|
|
|
|
|
|
|
void VisitObjectPointers(ObjectPointerVisitor* visitor);
|
|
|
|
|
|
|
|
Isolate* isolate() { return isolate_; }
|
|
|
|
ObjectStore* object_store();
|
|
|
|
|
|
|
|
void EnsuredUnoptimizedCodeForStack();
|
|
|
|
void DeoptimizeDependentCode();
|
|
|
|
|
|
|
|
void ReloadPhase1AllocateStorageMapsAndCheckpoint();
|
|
|
|
void CheckpointClasses();
|
|
|
|
RawObject* ReloadPhase2LoadKernel(kernel::Program* program,
|
|
|
|
const String& root_lib_url);
|
|
|
|
void ReloadPhase3FinalizeLoading();
|
|
|
|
void ReloadPhase4CommitPrepare();
|
|
|
|
void ReloadPhase4CommitFinish();
|
|
|
|
void ReloadPhase4Rollback();
|
|
|
|
|
|
|
|
void CheckpointLibraries();
|
|
|
|
|
|
|
|
void RollbackClasses();
|
|
|
|
void RollbackLibraries();
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void VerifyMaps();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void CommitBeforeInstanceMorphing();
|
|
|
|
void CommitAfterInstanceMorphing();
|
|
|
|
void PostCommit();
|
|
|
|
|
|
|
|
// atomic_install:
|
|
|
|
void InvalidateWorld();
|
|
|
|
void ResetMegamorphicCaches();
|
|
|
|
void ResetUnoptimizedICsOnStack();
|
|
|
|
void RunInvalidationVisitors();
|
2016-07-26 18:13:28 +00:00
|
|
|
|
2016-05-17 19:19:06 +00:00
|
|
|
struct LibraryInfo {
|
|
|
|
bool dirty;
|
|
|
|
};
|
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
// The zone used for all reload related allocations.
|
|
|
|
Zone* zone_;
|
|
|
|
std::shared_ptr<IsolateGroupReloadContext> group_reload_context_;
|
|
|
|
Isolate* isolate_;
|
|
|
|
intptr_t saved_num_cids_ = -1;
|
|
|
|
std::atomic<RawClass**> saved_class_table_;
|
|
|
|
MallocGrowableArray<LibraryInfo> library_infos_;
|
2016-07-29 18:23:18 +00:00
|
|
|
|
2016-05-17 19:19:06 +00:00
|
|
|
RawClass* OldClassOrNull(const Class& replacement_or_new);
|
|
|
|
RawLibrary* OldLibraryOrNull(const Library& replacement_or_new);
|
2016-11-17 19:29:12 +00:00
|
|
|
RawLibrary* OldLibraryOrNullBaseMoved(const Library& replacement_or_new);
|
|
|
|
|
2016-05-17 19:19:06 +00:00
|
|
|
void BuildLibraryMapping();
|
2019-05-07 23:13:27 +00:00
|
|
|
void BuildRemovedClassesSet();
|
2019-11-15 14:08:45 +00:00
|
|
|
void ValidateReload();
|
2016-05-17 19:19:06 +00:00
|
|
|
|
2016-11-08 21:54:47 +00:00
|
|
|
void AddClassMapping(const Class& replacement_or_new, const Class& original);
|
2016-05-17 19:19:06 +00:00
|
|
|
void AddLibraryMapping(const Library& replacement_or_new,
|
|
|
|
const Library& original);
|
|
|
|
void AddStaticFieldMapping(const Field& old_field, const Field& new_field);
|
2016-07-15 17:52:20 +00:00
|
|
|
void AddBecomeMapping(const Object& old, const Object& neu);
|
|
|
|
void AddEnumBecomeMapping(const Object& old, const Object& neu);
|
2016-05-17 19:19:06 +00:00
|
|
|
void RebuildDirectSubclasses();
|
|
|
|
|
2019-11-15 14:08:45 +00:00
|
|
|
RawObject** from() {
|
|
|
|
return reinterpret_cast<RawObject**>(&old_classes_set_storage_);
|
|
|
|
}
|
2016-05-17 19:19:06 +00:00
|
|
|
RawArray* old_classes_set_storage_;
|
|
|
|
RawArray* class_map_storage_;
|
2019-05-07 23:13:27 +00:00
|
|
|
RawArray* removed_class_set_storage_;
|
2016-05-17 19:19:06 +00:00
|
|
|
RawArray* old_libraries_set_storage_;
|
|
|
|
RawArray* library_map_storage_;
|
|
|
|
RawArray* become_map_storage_;
|
2016-07-15 17:52:20 +00:00
|
|
|
RawGrowableObjectArray* become_enum_mappings_;
|
2016-05-17 19:19:06 +00:00
|
|
|
RawLibrary* saved_root_library_;
|
|
|
|
RawGrowableObjectArray* saved_libraries_;
|
2019-11-15 14:08:45 +00:00
|
|
|
RawObject** to() { return reinterpret_cast<RawObject**>(&saved_libraries_); }
|
2016-05-17 19:19:06 +00:00
|
|
|
|
|
|
|
friend class Isolate;
|
2016-07-15 17:52:20 +00:00
|
|
|
friend class Class; // AddStaticFieldMapping, AddEnumBecomeMapping.
|
2016-08-02 16:36:46 +00:00
|
|
|
friend class Library;
|
2016-07-26 18:13:28 +00:00
|
|
|
friend class ObjectLocator;
|
2016-08-02 16:36:46 +00:00
|
|
|
friend class MarkFunctionsForRecompilation; // IsDirty.
|
|
|
|
friend class ReasonForCancelling;
|
2019-11-15 14:08:45 +00:00
|
|
|
friend class IsolateGroupReloadContext;
|
2016-05-17 19:19:06 +00:00
|
|
|
};
|
|
|
|
|
2019-08-20 00:49:52 +00:00
|
|
|
class CallSiteResetter : public ValueObject {
|
|
|
|
public:
|
|
|
|
explicit CallSiteResetter(Zone* zone);
|
|
|
|
|
|
|
|
void ZeroEdgeCounters(const Function& function);
|
2019-08-22 21:43:43 +00:00
|
|
|
void ResetCaches(const Code& code);
|
|
|
|
void ResetCaches(const ObjectPool& pool);
|
|
|
|
void RebindStaticTargets(const Bytecode& code);
|
2019-08-20 00:49:52 +00:00
|
|
|
void Reset(const ICData& ic);
|
|
|
|
void ResetSwitchableCalls(const Code& code);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Zone* zone_;
|
|
|
|
Instructions& instrs_;
|
|
|
|
ObjectPool& pool_;
|
|
|
|
Object& object_;
|
|
|
|
String& name_;
|
|
|
|
Class& new_cls_;
|
|
|
|
Library& new_lib_;
|
|
|
|
Function& new_function_;
|
|
|
|
Field& new_field_;
|
|
|
|
Array& entries_;
|
|
|
|
Function& old_target_;
|
|
|
|
Function& new_target_;
|
|
|
|
Function& caller_;
|
|
|
|
Array& args_desc_array_;
|
|
|
|
Array& ic_data_array_;
|
|
|
|
Array& edge_counters_;
|
|
|
|
PcDescriptors& descriptors_;
|
|
|
|
ICData& ic_data_;
|
|
|
|
};
|
|
|
|
|
2016-05-17 19:19:06 +00:00
|
|
|
} // namespace dart
|
|
|
|
|
2017-08-24 16:25:53 +00:00
|
|
|
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
|
|
|
|
|
2016-11-08 21:54:47 +00:00
|
|
|
#endif // RUNTIME_VM_ISOLATE_RELOAD_H_
|