Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
dart::FastObjectCopy Class Reference
Inheritance diagram for dart::FastObjectCopy:
dart::ObjectCopy< FastObjectCopyBase > dart::FastObjectCopyBase dart::ObjectCopyBase

Public Member Functions

 FastObjectCopy (Thread *thread, IdentityMap *map)
 
 ~FastObjectCopy ()
 
ObjectPtr TryCopyGraphFast (ObjectPtr root)
 
ObjectPtr TryBuildArrayOfObjectsToRehash (const GrowableArray< ObjectPtr > &objects_to_rehash)
 
- Public Member Functions inherited from dart::ObjectCopy< FastObjectCopyBase >
 ObjectCopy (Thread *thread, IdentityMap *map)
 
void CopyPredefinedInstance (typename Types::Object from, typename Types::Object to, intptr_t cid)
 
void CopyUserdefinedInstance (typename Types::Object from, typename Types::Object to, UnboxedFieldBitmap bitmap)
 
void CopyUserdefinedInstanceWithoutUnboxedFields (typename Types::Object from, typename Types::Object to)
 
void CopyClosure (typename Types::Closure from, typename Types::Closure to)
 
void CopyContext (typename Types::Context from, typename Types::Context to)
 
void CopyArray (typename Types::Array from, typename Types::Array to)
 
void CopyGrowableObjectArray (typename Types::GrowableObjectArray from, typename Types::GrowableObjectArray to)
 
void CopyRecord (typename Types::Record from, typename Types::Record to)
 
void CopyLinkedHashBase (T from, T to, UntaggedLinkedHashBase *from_untagged, UntaggedLinkedHashBase *to_untagged)
 
void CopyMap (typename Types::Map from, typename Types::Map to)
 
void CopySet (typename Types::Set from, typename Types::Set to)
 
void CopyDouble (typename Types::Double from, typename Types::Double to)
 
void CopyFloat32x4 (typename Types::Float32x4 from, typename Types::Float32x4 to)
 
void CopyFloat64x2 (typename Types::Float64x2 from, typename Types::Float64x2 to)
 
void CopyTypedData (TypedDataPtr from, TypedDataPtr to)
 
void CopyTypedData (const TypedData &from, const TypedData &to)
 
void CopyTypedDataView (typename Types::TypedDataView from, typename Types::TypedDataView to)
 
void CopyExternalTypedData (typename Types::ExternalTypedData from, typename Types::ExternalTypedData to)
 
void CopyTransferableTypedData (typename Types::TransferableTypedData from, typename Types::TransferableTypedData to)
 
void CopyWeakProperty (typename Types::WeakProperty from, typename Types::WeakProperty to)
 
void CopyWeakReference (typename Types::WeakReference from, typename Types::WeakReference to)
 
UntaggedObjectUntagObject (typename Types::Object obj)
 
- Public Member Functions inherited from dart::FastObjectCopyBase
 FastObjectCopyBase (Thread *thread, IdentityMap *map)
 
- Public Member Functions inherited from dart::ObjectCopyBase
 ObjectCopyBase (Thread *thread)
 
 ~ObjectCopyBase ()
 

Friends

class ObjectGraphCopier
 

Additional Inherited Members

- Public Types inherited from dart::ObjectCopy< FastObjectCopyBase >
using Types = typename Base::Types
 
- Public Types inherited from dart::FastObjectCopyBase
using Types = PtrTypes
 
- Protected Member Functions inherited from dart::FastObjectCopyBase
DART_FORCE_INLINE void ForwardCompressedPointers (ObjectPtr src, ObjectPtr dst, intptr_t offset, intptr_t end_offset)
 
DART_FORCE_INLINE void ForwardCompressedPointers (ObjectPtr src, ObjectPtr dst, intptr_t offset, intptr_t end_offset, UnboxedFieldBitmap bitmap)
 
void ForwardCompressedArrayPointers (intptr_t array_length, ObjectPtr src, ObjectPtr dst, intptr_t offset, intptr_t end_offset)
 
void ForwardCompressedContextPointers (intptr_t context_length, ObjectPtr src, ObjectPtr dst, intptr_t offset, intptr_t end_offset)
 
DART_FORCE_INLINE void ForwardCompressedPointer (ObjectPtr src, ObjectPtr dst, intptr_t offset)
 
ObjectPtr Forward (uword tags, ObjectPtr from)
 
void EnqueueTransferable (TransferableTypedDataPtr from, TransferableTypedDataPtr to)
 
void EnqueueWeakProperty (WeakPropertyPtr from)
 
void EnqueueWeakReference (WeakReferencePtr from)
 
void EnqueueObjectToRehash (ObjectPtr to)
 
void EnqueueExpandoToRehash (ObjectPtr to)
 
- Protected Member Functions inherited from dart::ObjectCopyBase
void StoreCompressedLargeArrayPointerBarrier (ObjectPtr obj, intptr_t offset, ObjectPtr value)
 
DART_FORCE_INLINE bool CanCopyObject (uword tags, ObjectPtr object)
 
- Static Protected Member Functions inherited from dart::FastObjectCopyBase
static void StoreCompressedArrayPointers (intptr_t array_length, ObjectPtr src, ObjectPtr dst, intptr_t offset, intptr_t end_offset)
 
static void StoreCompressedPointers (ObjectPtr src, ObjectPtr dst, intptr_t offset, intptr_t end_offset)
 
static void StoreCompressedPointersNoBarrier (ObjectPtr src, ObjectPtr dst, intptr_t offset, intptr_t end_offset)
 
- Static Protected Member Functions inherited from dart::ObjectCopyBase
static ObjectPtr LoadPointer (ObjectPtr src, intptr_t offset)
 
static CompressedObjectPtr LoadCompressedPointer (ObjectPtr src, intptr_t offset)
 
static compressed_uword LoadCompressedNonPointerWord (ObjectPtr src, intptr_t offset)
 
static void StorePointerBarrier (ObjectPtr obj, intptr_t offset, ObjectPtr value)
 
static void StoreCompressedPointerBarrier (ObjectPtr obj, intptr_t offset, ObjectPtr value)
 
static void StorePointerNoBarrier (ObjectPtr obj, intptr_t offset, ObjectPtr value)
 
template<typename T = ObjectPtr>
static void StoreCompressedPointerNoBarrier (ObjectPtr obj, intptr_t offset, T value)
 
static void StoreCompressedNonPointerWord (ObjectPtr obj, intptr_t offset, compressed_uword value)
 
- Protected Attributes inherited from dart::FastObjectCopyBase
FastForwardMap fast_forward_map_
 
- Protected Attributes inherited from dart::ObjectCopyBase
Threadthread_
 
uword heap_base_
 
Zonezone_
 
Heapheap_
 
ClassTableclass_table_
 
Scavengernew_space_
 
Objecttmp_
 
Objectto_
 
intptr_t expando_cid_
 
const char * exception_msg_ = nullptr
 
Objectexception_unexpected_object_
 

Detailed Description

Definition at line 2122 of file object_graph_copy.cc.

Constructor & Destructor Documentation

◆ FastObjectCopy()

dart::FastObjectCopy::FastObjectCopy ( Thread thread,
IdentityMap map 
)
inline

Definition at line 2124 of file object_graph_copy.cc.

2124: ObjectCopy(thread, map) {}
ObjectCopy(Thread *thread, IdentityMap *map)
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Definition: SkVx.h:680

◆ ~FastObjectCopy()

dart::FastObjectCopy::~FastObjectCopy ( )
inline

Definition at line 2125 of file object_graph_copy.cc.

2125{}

Member Function Documentation

◆ TryBuildArrayOfObjectsToRehash()

ObjectPtr dart::FastObjectCopy::TryBuildArrayOfObjectsToRehash ( const GrowableArray< ObjectPtr > &  objects_to_rehash)
inline

Definition at line 2229 of file object_graph_copy.cc.

2230 {
2231 const intptr_t length = objects_to_rehash.length();
2232 if (length == 0) return Object::null();
2233
2234 const intptr_t size = Array::InstanceSize(length);
2235 const uword array_addr = new_space_->TryAllocateNoSafepoint(thread_, size);
2236 if (array_addr == 0) {
2238 return Marker();
2239 }
2240
2241 const uword header_size =
2243 ArrayPtr array(reinterpret_cast<UntaggedArray*>(array_addr));
2244 SetNewSpaceTaggingWord(array, kArrayCid, header_size);
2245 StoreCompressedPointerNoBarrier(array, OFFSET_OF(UntaggedArray, length_),
2246 Smi::New(length));
2248 OFFSET_OF(UntaggedArray, type_arguments_),
2250 auto array_data = array.untag()->data();
2251 for (intptr_t i = 0; i < length; ++i) {
2252 array_data[i] = objects_to_rehash[i];
2253 }
2254 return array;
2255 }
static intptr_t InstanceSize()
Definition: object.h:10936
intptr_t length() const
static void StoreCompressedPointerNoBarrier(ObjectPtr obj, intptr_t offset, T value)
static ObjectPtr null()
Definition: object.h:433
uword TryAllocateNoSafepoint(Thread *thread, intptr_t size)
Definition: scavenger.h:146
static SmiPtr New(intptr_t value)
Definition: object.h:10006
static constexpr bool SizeFits(intptr_t size)
Definition: raw_object.h:216
size_t length
const char * kFastAllocationFailed
uintptr_t uword
Definition: globals.h:501
static DART_FORCE_INLINE ObjectPtr Marker()
DART_FORCE_INLINE void SetNewSpaceTaggingWord(ObjectPtr to, classid_t cid, uint32_t size)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
#define OFFSET_OF(type, field)
Definition: globals.h:138

◆ TryCopyGraphFast()

ObjectPtr dart::FastObjectCopy::TryCopyGraphFast ( ObjectPtr  root)
inline

Definition at line 2127 of file object_graph_copy.cc.

2127 {
2128 NoSafepointScope no_safepoint_scope;
2129
2130 ObjectPtr root_copy = Forward(TagsFromUntaggedObject(root.untag()), root);
2131 if (root_copy == Marker()) {
2132 return root_copy;
2133 }
2134 auto& from_weak_property = WeakProperty::Handle(zone_);
2135 auto& to_weak_property = WeakProperty::Handle(zone_);
2136 auto& weak_property_key = Object::Handle(zone_);
2137 while (true) {
2138 if (fast_forward_map_.fill_cursor_ ==
2139 fast_forward_map_.raw_from_to_.length()) {
2140 break;
2141 }
2142
2143 // Run fixpoint to copy all objects.
2144 while (fast_forward_map_.fill_cursor_ <
2145 fast_forward_map_.raw_from_to_.length()) {
2146 const intptr_t index = fast_forward_map_.fill_cursor_;
2147 ObjectPtr from = fast_forward_map_.raw_from_to_[index];
2148 ObjectPtr to = fast_forward_map_.raw_from_to_[index + 1];
2149 FastCopyObject(from, to);
2150 if (exception_msg_ != nullptr) {
2151 return root_copy;
2152 }
2153 fast_forward_map_.fill_cursor_ += 2;
2154
2155 // To maintain responsiveness we regularly check whether safepoints are
2156 // requested - if so, we bail to slow path which will then checkin.
2159 return root_copy;
2160 }
2161 }
2162
2163 // Possibly forward values of [WeakProperty]s if keys became reachable.
2164 intptr_t i = 0;
2165 auto& weak_properties = fast_forward_map_.raw_weak_properties_;
2166 while (i < weak_properties.length()) {
2167 from_weak_property = weak_properties[i];
2168 weak_property_key =
2169 fast_forward_map_.ForwardedObject(from_weak_property.key());
2170 if (weak_property_key.ptr() != Marker()) {
2171 to_weak_property ^=
2172 fast_forward_map_.ForwardedObject(from_weak_property.ptr());
2173
2174 // The key became reachable so we'll change the forwarded
2175 // [WeakProperty]'s key to the new key (it is `null` at this point).
2176 to_weak_property.set_key(weak_property_key);
2177
2178 // Since the key has become strongly reachable in the copied graph,
2179 // we'll also need to forward the value.
2180 ForwardCompressedPointer(from_weak_property.ptr(),
2181 to_weak_property.ptr(),
2182 OFFSET_OF(UntaggedWeakProperty, value_));
2183
2184 // We don't need to process this [WeakProperty] again.
2185 const intptr_t last = weak_properties.length() - 1;
2186 if (i < last) {
2187 weak_properties[i] = weak_properties[last];
2188 weak_properties.SetLength(last);
2189 continue;
2190 }
2191 }
2192 i++;
2193 }
2194 }
2195 // After the fix point with [WeakProperty]s do [WeakReference]s.
2196 auto& from_weak_reference = WeakReference::Handle(zone_);
2197 auto& to_weak_reference = WeakReference::Handle(zone_);
2198 auto& weak_reference_target = Object::Handle(zone_);
2199 auto& weak_references = fast_forward_map_.raw_weak_references_;
2200 for (intptr_t i = 0; i < weak_references.length(); i++) {
2201 from_weak_reference = weak_references[i];
2202 weak_reference_target =
2203 fast_forward_map_.ForwardedObject(from_weak_reference.target());
2204 if (weak_reference_target.ptr() != Marker()) {
2205 to_weak_reference ^=
2206 fast_forward_map_.ForwardedObject(from_weak_reference.ptr());
2207
2208 // The target became reachable so we'll change the forwarded
2209 // [WeakReference]'s target to the new target (it is `null` at this
2210 // point).
2211 to_weak_reference.set_target(weak_reference_target);
2212 }
2213 }
2214 if (root_copy != Marker()) {
2215 ObjectPtr array;
2217 fast_forward_map_.raw_objects_to_rehash_);
2218 if (array == Marker()) return root_copy;
2219 raw_objects_to_rehash_ = Array::RawCast(array);
2220
2222 fast_forward_map_.raw_expandos_to_rehash_);
2223 if (array == Marker()) return root_copy;
2224 raw_expandos_to_rehash_ = Array::RawCast(array);
2225 }
2226 return root_copy;
2227 }
ObjectPtr ForwardedObject(ObjectPtr object)
DART_FORCE_INLINE void ForwardCompressedPointer(ObjectPtr src, ObjectPtr dst, intptr_t offset)
ObjectPtr Forward(uword tags, ObjectPtr from)
ObjectPtr TryBuildArrayOfObjectsToRehash(const GrowableArray< ObjectPtr > &objects_to_rehash)
static Object & Handle()
Definition: object.h:407
static ObjectPtr RawCast(ObjectPtr obj)
Definition: object.h:325
bool IsSafepointRequested() const
Definition: thread.h:937
DART_FORCE_INLINE uword TagsFromUntaggedObject(UntaggedObject *obj)
string root
Definition: scale_cpu.py:20

Friends And Related Function Documentation

◆ ObjectGraphCopier

friend class ObjectGraphCopier
friend

Definition at line 2258 of file object_graph_copy.cc.


The documentation for this class was generated from the following file: