From f2611b7c8ea59d5682cf1064733217241508bccb Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Wed, 26 Jul 2023 21:53:49 +0000 Subject: [PATCH] [vm] Update lingering references to RawObject. TEST=ci Change-Id: If01ff0f7a9b10dc4e6f6d3139bd421df9ecc9855 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316528 Reviewed-by: Siva Annamalai Commit-Queue: Ryan Macnak --- runtime/docs/gc.md | 4 +-- runtime/lib/isolate.cc | 2 +- .../backend/redundancy_elimination.cc | 7 ++--- runtime/vm/compiler/backend/slot.h | 4 +-- runtime/vm/dart_api_message.h | 2 +- runtime/vm/deopt_instructions.cc | 7 +++-- runtime/vm/gdb_helpers.cc | 2 +- runtime/vm/heap/become.h | 2 +- runtime/vm/heap/freelist.h | 2 +- runtime/vm/heap/marker.h | 10 +++---- runtime/vm/message.h | 2 +- runtime/vm/native_arguments.h | 2 +- runtime/vm/object.cc | 2 +- runtime/vm/object.h | 2 +- runtime/vm/object_graph_copy.cc | 4 +-- runtime/vm/raw_object.h | 27 ++++++++++--------- 16 files changed, 41 insertions(+), 40 deletions(-) diff --git a/runtime/docs/gc.md b/runtime/docs/gc.md index d7397492be2..fc55bba981c 100644 --- a/runtime/docs/gc.md +++ b/runtime/docs/gc.md @@ -84,7 +84,7 @@ With the mutator and marker running concurrently, the mutator could write a poin The barrier is equivalent to ```c++ -StorePoint(RawObject* source, RawObject** slot, RawObject* target) { +StorePointer(ObjectPtr source, ObjectPtr* slot, ObjectPtr target) { *slot = target; if (target->IsSmi()) return; if (source->IsOldObject() && !source->IsRemembered() && target->IsNewObject()) { @@ -116,7 +116,7 @@ static constexpr intptr_t kBarrierOverlapShift = 2; COMPILE_ASSERT(kOldAndNotMarkedBit + kBarrierOverlapShift == kOldBit); COMPILE_ASSERT(kNewBit + kBarrierOverlapShift == kOldAndNotRememberedBit); -StorePointer(RawObject* source, RawObject** slot, RawObject* target) { +StorePointer(ObjectPtr source, ObjectPtr* slot, ObjectPtr target) { *slot = target; if (target->IsSmi()) return; if ((source->header() >> kBarrierOverlapShift) && diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc index d5a6b5706b9..800d180f8f9 100644 --- a/runtime/lib/isolate.cc +++ b/runtime/lib/isolate.cc @@ -126,7 +126,7 @@ DEFINE_NATIVE_ENTRY(SendPort_sendInternal_, 0, 2) { class UntaggedObjectPtrSetTraits { public: static bool ReportStats() { return false; } - static const char* Name() { return "RawObjectPtrSetTraits"; } + static const char* Name() { return "UntaggedObjectPtrSetTraits"; } static bool IsMatch(const ObjectPtr a, const ObjectPtr b) { return a == b; } diff --git a/runtime/vm/compiler/backend/redundancy_elimination.cc b/runtime/vm/compiler/backend/redundancy_elimination.cc index 53e14232361..d46b93673d2 100644 --- a/runtime/vm/compiler/backend/redundancy_elimination.cc +++ b/runtime/vm/compiler/backend/redundancy_elimination.cc @@ -550,10 +550,11 @@ class Place : public ValueObject { const intptr_t index_value = Smi::Cast(index_constant->value()).Value(); const ElementSize size = ElementSizeFor(class_id); const bool is_typed_access = (size != kNoSize); - // Indexing into [RawTypedDataView]/[RawExternalTypedData happens via a - // untagged load of the `_data` field (which points to C memory). + // Indexing into [UntaggedTypedDataView]/[UntaggedExternalTypedData + // happens via a untagged load of the `_data` field (which points to C + // memory). // - // Indexing into dart:ffi's [RawPointer] happens via loading of the + // Indexing into dart:ffi's [UntaggedPointer] happens via loading of the // `c_memory_address_`, converting it to an integer, doing some arithmetic // and finally using IntConverterInstr to convert to a untagged // representation. diff --git a/runtime/vm/compiler/backend/slot.h b/runtime/vm/compiler/backend/slot.h index 1fcb992d6a5..c7090831dff 100644 --- a/runtime/vm/compiler/backend/slot.h +++ b/runtime/vm/compiler/backend/slot.h @@ -230,7 +230,7 @@ class Slot : public ZoneAllocated { // A slot used to store type arguments. kTypeArguments, - // A slot at a specific [index] in a [RawTypeArgument] vector. + // A slot at a specific [index] in a [UntaggedTypeArgument] vector. kTypeArgumentsIndex, // A slot corresponding to an array element at given offset. @@ -260,7 +260,7 @@ class Slot : public ZoneAllocated { // so disambiguating type arguments fields does not improve alias analysis. static const Slot& GetTypeArgumentsSlotFor(Thread* thread, const Class& cls); - // Returns a slot at a specific [index] in a [RawTypeArgument] vector. + // Returns a slot at a specific [index] in a [UntaggedTypeArgument] vector. static const Slot& GetTypeArgumentsIndexSlot(Thread* thread, intptr_t index); // Returns a slot corresponding to an array element at [offset_in_bytes]. diff --git a/runtime/vm/dart_api_message.h b/runtime/vm/dart_api_message.h index f5994cefa95..1c593e8c710 100644 --- a/runtime/vm/dart_api_message.h +++ b/runtime/vm/dart_api_message.h @@ -15,7 +15,7 @@ namespace dart { -// This class handles translation of certain RawObjects to CObjects for +// This class handles translation of certain ObjectPtrs to CObjects for // NativeMessageHandlers. // // TODO(zra): Expand to support not only null, but also other VM heap objects diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc index 30e4be0ec17..568bf7c2e67 100644 --- a/runtime/vm/deopt_instructions.cc +++ b/runtime/vm/deopt_instructions.cc @@ -637,7 +637,7 @@ typedef DeoptIntInstr + typename PtrType> class DeoptFpuInstr : public DeoptInstr { public: explicit DeoptFpuInstr(intptr_t source_index) : source_(source_index) {} @@ -651,9 +651,8 @@ class DeoptFpuInstr : public DeoptInstr { void Execute(DeoptContext* deopt_context, intptr_t* dest_addr) { *dest_addr = Smi::RawValue(0); - deopt_context->DeferMaterialization( - source_.Value(deopt_context), - reinterpret_cast(dest_addr)); + deopt_context->DeferMaterialization(source_.Value(deopt_context), + reinterpret_cast(dest_addr)); } CatchEntryMove ToCatchEntryMove(DeoptContext* deopt_context, diff --git a/runtime/vm/gdb_helpers.cc b/runtime/vm/gdb_helpers.cc index 1cb17b5c61a..fbdea05bdba 100644 --- a/runtime/vm/gdb_helpers.cc +++ b/runtime/vm/gdb_helpers.cc @@ -12,7 +12,7 @@ namespace dart { #if !defined(PRODUCT) DART_EXPORT -void _printRawObject(ObjectPtr object) { +void _printObjectPtr(ObjectPtr object) { OS::PrintErr("%s\n", Object::Handle(object).ToCString()); } diff --git a/runtime/vm/heap/become.h b/runtime/vm/heap/become.h index b6585ff59db..1d4bb3b0b14 100644 --- a/runtime/vm/heap/become.h +++ b/runtime/vm/heap/become.h @@ -54,7 +54,7 @@ class ForwardingCorpse { }; private: - // This layout mirrors the layout of RawObject. + // This layout mirrors the layout of UntaggedObject. RelaxedAtomic tags_; RelaxedAtomic target_; diff --git a/runtime/vm/heap/freelist.h b/runtime/vm/heap/freelist.h index 9b870aa2a68..f00baca215d 100644 --- a/runtime/vm/heap/freelist.h +++ b/runtime/vm/heap/freelist.h @@ -58,7 +58,7 @@ class FreeListElement { }; private: - // This layout mirrors the layout of RawObject. + // This layout mirrors the layout of UntaggedObject. RelaxedAtomic tags_; RelaxedAtomic next_; diff --git a/runtime/vm/heap/marker.h b/runtime/vm/heap/marker.h index 19ac2ce9b3d..af323cb9e6b 100644 --- a/runtime/vm/heap/marker.h +++ b/runtime/vm/heap/marker.h @@ -24,11 +24,11 @@ class Page; class Thread; // The class GCMarker is used to mark reachable old generation objects as part -// of the mark-sweep collection. The marking bit used is defined in RawObject. -// Instances have a lifetime that spans from the beginning of concurrent -// marking (or stop-the-world marking) until marking is complete. In particular, -// an instance may be created and destroyed on different threads if the isolate -// is exited during concurrent marking. +// of the mark-sweep collection. The marking bit used is defined in +// UntaggedObject. Instances have a lifetime that spans from the beginning of +// concurrent marking (or stop-the-world marking) until marking is complete. In +// particular, an instance may be created and destroyed on different threads if +// the isolate is exited during concurrent marking. class GCMarker { public: GCMarker(IsolateGroup* isolate_group, Heap* heap); diff --git a/runtime/vm/message.h b/runtime/vm/message.h index 02bf5ec5f7c..5a7b11306fa 100644 --- a/runtime/vm/message.h +++ b/runtime/vm/message.h @@ -55,7 +55,7 @@ class Message { MessageFinalizableData* finalizable_data, Priority priority); - // Message objects can also carry RawObject pointers for Smis and objects in + // Message objects can also carry raw ObjectPtr for Smis and objects in // the VM heap. This is indicated by setting the len_ field to 0. Message(Dart_Port dest_port, ObjectPtr raw_obj, Priority priority); diff --git a/runtime/vm/native_arguments.h b/runtime/vm/native_arguments.h index e18e5fa7c43..6918ebd267b 100644 --- a/runtime/vm/native_arguments.h +++ b/runtime/vm/native_arguments.h @@ -227,7 +227,7 @@ class NativeArguments { friend class NativeEntry; friend class Simulator; - // Since this function is passed a RawObject directly, we need to be + // Since this function is passed an ObjectPtr directly, we need to be // exceedingly careful when we use it. If there are any other side // effects in the statement that may cause GC, it could lead to // bugs. diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index c3c95514cb8..12c65508cee 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -26125,7 +26125,7 @@ TypedDataViewPtr TypedDataBase::ViewFromTo(intptr_t start, } const char* TypedDataBase::ToCString() const { - // There are no instances of RawTypedDataBase. + // There are no instances of UntaggedTypedDataBase. UNREACHABLE(); return nullptr; } diff --git a/runtime/vm/object.h b/runtime/vm/object.h index 3eb505de0a3..89d18722d95 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -760,7 +760,7 @@ class Object { // Start of field mutator guards. // // All writes to heap objects should ultimately pass through one of the - // methods below or their counterparts in RawObject, to ensure that the + // methods below or their counterparts in UntaggedObject, to ensure that the // write barrier is correctly applied. template diff --git a/runtime/vm/object_graph_copy.cc b/runtime/vm/object_graph_copy.cc index f25d33b6f3d..d22c6290310 100644 --- a/runtime/vm/object_graph_copy.cc +++ b/runtime/vm/object_graph_copy.cc @@ -2664,8 +2664,8 @@ class ObjectGraphCopier : public StackResource { Handlify(&fast_object_copy_.fast_forward_map_.raw_expandos_to_rehash_, &slow_object_copy_.slow_forward_map_.expandos_to_rehash_); } - template - void Handlify(GrowableArray* from, + template + void Handlify(GrowableArray* from, GrowableArray* to) { const auto length = from->length(); if (length > 0) { diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index 16b30763de7..0f2fff8edac 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -155,9 +155,9 @@ enum TypedDataElementType { friend class ObjectCopy; \ friend class Pass2Visitor; -// RawObject is the base class of all raw objects; even though it carries the -// tags_ field not all raw objects are allocated in the heap and thus cannot -// be dereferenced (e.g. RawSmi). +// UntaggedObject is the base class of all raw objects; even though it carries +// the tags_ field not all raw objects are allocated in the heap and thus cannot +// be dereferenced (e.g. UntaggedSmi). class UntaggedObject { public: // The tags field which is a part of the object header uses the following @@ -3026,8 +3026,8 @@ class UntaggedTwoByteString : public UntaggedString { friend class StringSerializationCluster; }; -// Abstract base class for RawTypedData/RawExternalTypedData/RawTypedDataView/ -// Pointer. +// Abstract base class for UntaggedTypedData/UntaggedExternalTypedData/ +// UntaggedTypedDataView/Pointer. // // TypedData extends this with a length field, while Pointer extends this with // TypeArguments field. @@ -3038,11 +3038,11 @@ class UntaggedPointerBase : public UntaggedInstance { protected: // The contents of [data_] depends on what concrete subclass is used: // - // - RawTypedData: Start of the payload. - // - RawExternalTypedData: Start of the C-heap payload. - // - RawTypedDataView: The [data_] field of the backing store for the view - // plus the [offset_in_bytes_] the view has. - // - RawPointer: Pointer into C memory (no length specified). + // - UntaggedTypedData: Start of the payload. + // - UntaggedExternalTypedData: Start of the C-heap payload. + // - UntaggedTypedDataView: The [data_] field of the backing store for the + // view plus the [offset_in_bytes_] the view has. + // - UntaggedPointer: Pointer into C memory (no length specified). // // During allocation or snapshot reading the [data_] can be temporarily // nullptr (which is the case for views which just got created but haven't @@ -3060,7 +3060,8 @@ class UntaggedPointerBase : public UntaggedInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(PointerBase); }; -// Abstract base class for RawTypedData/RawExternalTypedData/RawTypedDataView. +// Abstract base class for UntaggedTypedData/UntaggedExternalTypedData/ +// UntaggedTypedDataView. class UntaggedTypedDataBase : public UntaggedPointerBase { protected: #if defined(DART_COMPRESSED_POINTERS) @@ -3159,13 +3160,13 @@ class UntaggedTypedDataView : public UntaggedTypedDataBase { // The view object must have gotten just initialized. if (data_ != nullptr || RawSmiValue(offset_in_bytes()) != 0 || RawSmiValue(length()) != 0) { - FATAL("RawTypedDataView has invalid inner pointer."); + FATAL("TypedDataView has invalid inner pointer."); } } else { const intptr_t offset_in_bytes = RawSmiValue(this->offset_in_bytes()); uint8_t* payload = typed_data()->untag()->data_; if ((payload + offset_in_bytes) != data_) { - FATAL("RawTypedDataView has invalid inner pointer."); + FATAL("TypedDataView has invalid inner pointer."); } } }