[vm, gc] Route most heap reads through LoadPointer.
Provides a good point to apply a read barrier, pointer decompression, or TSAN annotations.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/44091
Change-Id: I4e6930264f8ef8399e261fd24fcab78731d6e29c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174484
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 1e46ce8..6f83c62 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -671,7 +671,7 @@
memset(field_values, 0, (num_fields * sizeof(field_values[0])));
return true;
}
- ASSERT(class_num_fields == Smi::Value(native_fields->ptr()->length_));
+ ASSERT(class_num_fields == Smi::Value(native_fields->ptr()->length()));
intptr_t* native_values =
reinterpret_cast<intptr_t*>(native_fields->ptr()->data());
memmove(field_values, native_values, (num_fields * sizeof(field_values[0])));
diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc
index 6debb13..7c3e3de 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -331,7 +331,7 @@
Dart_CObject* ApiMessageReader::CreateDartCObjectString(ObjectPtr raw) {
ASSERT(IsOneByteStringClassId(raw->GetClassId()));
OneByteStringPtr raw_str = static_cast<OneByteStringPtr>(raw);
- intptr_t len = Smi::Value(raw_str->ptr()->length_);
+ intptr_t len = Smi::Value(raw_str->ptr()->length());
Dart_CObject* object = AllocateDartCObjectString(len);
char* p = object->value.as_string;
memmove(p, raw_str->ptr()->data(), len);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 90dc677..fe94596 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -919,7 +919,7 @@
InitializeObject(address, kImmutableArrayCid, Array::InstanceSize(0));
Array::initializeHandle(empty_array_,
static_cast<ArrayPtr>(address + kHeapObjectTag));
- empty_array_->StoreSmi(&empty_array_->raw_ptr()->length_, Smi::New(0));
+ empty_array_->raw_ptr()->set_length(Smi::New(0));
empty_array_->SetCanonical();
}
@@ -930,7 +930,7 @@
InitializeObject(address, kImmutableArrayCid, Array::InstanceSize(1));
Array::initializeHandle(zero_array_,
static_cast<ArrayPtr>(address + kHeapObjectTag));
- zero_array_->StoreSmi(&zero_array_->raw_ptr()->length_, Smi::New(1));
+ zero_array_->raw_ptr()->set_length(Smi::New(1));
smi = Smi::New(0);
zero_array_->SetAt(0, smi);
zero_array_->SetCanonical();
@@ -1026,10 +1026,8 @@
TypeArguments::initializeHandle(
empty_type_arguments_,
static_cast<TypeArgumentsPtr>(address + kHeapObjectTag));
- empty_type_arguments_->StoreSmi(&empty_type_arguments_->raw_ptr()->length_,
- Smi::New(0));
- empty_type_arguments_->StoreSmi(&empty_type_arguments_->raw_ptr()->hash_,
- Smi::New(0));
+ empty_type_arguments_->raw_ptr()->set_length(Smi::New(0));
+ empty_type_arguments_->raw_ptr()->set_hash(Smi::New(0));
empty_type_arguments_->ComputeHash();
empty_type_arguments_->SetCanonical();
}
@@ -1480,7 +1478,7 @@
intptr_t leftover_len = (leftover_size - TypedData::InstanceSize(0));
ASSERT(TypedData::InstanceSize(leftover_len) == leftover_size);
- raw->ptr()->StoreSmi(&(raw->ptr()->length_), Smi::New(leftover_len));
+ raw->ptr()->set_length(Smi::New(leftover_len));
raw->ptr()->RecomputeDataField();
} else {
// Update the leftover space as a basic object.
@@ -2669,7 +2667,7 @@
}
StringPtr Class::Name() const {
- return raw_ptr()->name_;
+ return raw_ptr()->name();
}
StringPtr Class::ScrubbedName() const {
@@ -2682,8 +2680,8 @@
StringPtr Class::UserVisibleName() const {
#if !defined(PRODUCT)
- ASSERT(raw_ptr()->user_name_ != String::null());
- return raw_ptr()->user_name_;
+ ASSERT(raw_ptr()->user_name() != String::null());
+ return raw_ptr()->user_name();
#endif // !defined(PRODUCT)
// No caching in PRODUCT, regenerate.
return Symbols::New(Thread::Current(), GenerateUserVisibleName());
@@ -2691,8 +2689,8 @@
const char* Class::UserVisibleNameCString() const {
#if !defined(PRODUCT)
- ASSERT(raw_ptr()->user_name_ != String::null());
- return String::Handle(raw_ptr()->user_name_).ToCString();
+ ASSERT(raw_ptr()->user_name() != String::null());
+ return String::Handle(raw_ptr()->user_name()).ToCString();
#endif // !defined(PRODUCT)
return GenerateUserVisibleName(); // No caching in PRODUCT, regenerate.
}
@@ -2728,7 +2726,7 @@
bool Class::IsInFullSnapshot() const {
NoSafepointScope no_safepoint;
return LibraryLayout::InFullSnapshotBit::decode(
- raw_ptr()->library_->ptr()->flags_);
+ raw_ptr()->library()->ptr()->flags_);
}
AbstractTypePtr Class::RareType() const {
@@ -2815,15 +2813,15 @@
// The empty array has not been initialized yet.
return;
}
- StorePointer(&raw_ptr()->interfaces_, Object::empty_array().raw());
- StorePointer(&raw_ptr()->constants_, Object::null_array().raw());
+ raw_ptr()->set_interfaces(Object::empty_array().raw());
+ raw_ptr()->set_constants(Object::null_array().raw());
set_functions(Object::empty_array());
set_fields(Object::empty_array());
set_invocation_dispatcher_cache(Object::empty_array());
}
ArrayPtr Class::OffsetToFieldMap(bool original_classes) const {
- if (raw_ptr()->offset_in_words_to_field_ == Array::null()) {
+ if (raw_ptr()->offset_in_words_to_field() == Array::null()) {
ASSERT(is_finalized());
const intptr_t length = raw_ptr()->host_instance_size_in_words_;
const Array& array = Array::Handle(Array::New(length, Heap::kOld));
@@ -2840,9 +2838,9 @@
}
cls = cls.SuperClass(original_classes);
}
- StorePointer(&raw_ptr()->offset_in_words_to_field_, array.raw());
+ raw_ptr()->set_offset_in_words_to_field(array.raw());
}
- return raw_ptr()->offset_in_words_to_field_;
+ return raw_ptr()->offset_in_words_to_field();
}
bool Class::HasInstanceFields() const {
@@ -2916,9 +2914,9 @@
ASSERT(func.Owner() == raw());
set.Insert(func);
}
- StorePointer(&raw_ptr()->functions_hash_table_, set.Release().raw());
+ raw_ptr()->set_functions_hash_table(set.Release().raw());
} else {
- StorePointer(&raw_ptr()->functions_hash_table_, Array::null());
+ raw_ptr()->set_functions_hash_table(Array::null());
}
}
@@ -2939,9 +2937,9 @@
// Transition to using hash table.
SetFunctions(new_array);
} else if (new_len > kFunctionLookupHashTreshold) {
- ClassFunctionsSet set(raw_ptr()->functions_hash_table_);
+ ClassFunctionsSet set(raw_ptr()->functions_hash_table());
set.Insert(function);
- StorePointer(&raw_ptr()->functions_hash_table_, set.Release().raw());
+ raw_ptr()->set_functions_hash_table(set.Release().raw());
}
}
@@ -3044,7 +3042,7 @@
void Class::set_signature_function(const Function& value) const {
ASSERT(value.IsClosureFunction() || value.IsSignatureFunction());
- StorePointer(&raw_ptr()->signature_function_, value.raw());
+ raw_ptr()->set_signature_function(value.raw());
}
void Class::set_state_bits(intptr_t bits) const {
@@ -3053,34 +3051,32 @@
}
void Class::set_library(const Library& value) const {
- StorePointer(&raw_ptr()->library_, value.raw());
+ raw_ptr()->set_library(value.raw());
}
void Class::set_type_parameters(const TypeArguments& value) const {
ASSERT((num_type_arguments() == kUnknownNumTypeArguments) ||
is_prefinalized());
- StorePointer(&raw_ptr()->type_parameters_, value.raw());
+ raw_ptr()->set_type_parameters(value.raw());
}
void Class::set_functions(const Array& value) const {
// Ensure all writes to the [Function]s are visible by the time the array
// is visible.
- StorePointer<ArrayPtr, std::memory_order_release>(&raw_ptr()->functions_,
- value.raw());
+ raw_ptr()->set_functions<std::memory_order_release>(value.raw());
}
void Class::set_fields(const Array& value) const {
// Ensure all writes to the [Field]s are visible by the time the array
// is visible.
- StorePointer<ArrayPtr, std::memory_order_release>(&raw_ptr()->fields_,
- value.raw());
+ raw_ptr()->set_fields<std::memory_order_release>(value.raw());
}
void Class::set_invocation_dispatcher_cache(const Array& cache) const {
// Ensure all writes to the cache are visible by the time the array
// is visible.
- StorePointer<ArrayPtr, std::memory_order_release>(
- &raw_ptr()->invocation_dispatcher_cache_, cache.raw());
+ raw_ptr()->set_invocation_dispatcher_cache<std::memory_order_release>(
+ cache.raw());
}
intptr_t Class::NumTypeParameters(Thread* thread) const {
@@ -3234,7 +3230,7 @@
void Class::set_super_type(const AbstractType& value) const {
ASSERT(value.IsNull() || (value.IsType() && !value.IsDynamicType()));
- StorePointer(&raw_ptr()->super_type_, value.raw());
+ raw_ptr()->set_super_type(value.raw());
}
TypeParameterPtr Class::LookupTypeParameter(const String& type_name) const {
@@ -3782,7 +3778,7 @@
}
ArrayPtr Class::invocation_dispatcher_cache() const {
- return raw_ptr()->invocation_dispatcher_cache_;
+ return raw_ptr()->invocation_dispatcher_cache();
}
void Class::Finalize() const {
@@ -3929,13 +3925,13 @@
ArrayPtr Class::dependent_code() const {
DEBUG_ASSERT(
IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
- return raw_ptr()->dependent_code_;
+ return raw_ptr()->dependent_code();
}
void Class::set_dependent_code(const Array& array) const {
DEBUG_ASSERT(
IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
- StorePointer(&raw_ptr()->dependent_code_, array.raw());
+ raw_ptr()->set_dependent_code(array.raw());
}
// Conventions:
@@ -4644,11 +4640,11 @@
}
void Class::set_name(const String& value) const {
- ASSERT(raw_ptr()->name_ == String::null());
+ ASSERT(raw_ptr()->name() == String::null());
ASSERT(value.IsSymbol());
- StorePointer(&raw_ptr()->name_, value.raw());
+ raw_ptr()->set_name(value.raw());
#if !defined(PRODUCT)
- if (raw_ptr()->user_name_ == String::null()) {
+ if (raw_ptr()->user_name() == String::null()) {
// TODO(johnmccutchan): Eagerly set user name for VM isolate classes,
// lazily set user name for the other classes.
// Generate and set user_name.
@@ -4661,7 +4657,7 @@
#if !defined(PRODUCT)
void Class::set_user_name(const String& value) const {
- StorePointer(&raw_ptr()->user_name_, value.raw());
+ raw_ptr()->set_user_name(value.raw());
}
#endif // !defined(PRODUCT)
@@ -4824,7 +4820,7 @@
}
void Class::set_script(const Script& value) const {
- StorePointer(&raw_ptr()->script_, value.raw());
+ raw_ptr()->set_script(value.raw());
}
void Class::set_token_pos(TokenPosition token_pos) const {
@@ -4915,7 +4911,7 @@
void Class::set_interfaces(const Array& value) const {
ASSERT(!value.IsNull());
- StorePointer(&raw_ptr()->interfaces_, value.raw());
+ raw_ptr()->set_interfaces(value.raw());
}
void Class::AddDirectImplementor(const Class& implementor,
@@ -4924,10 +4920,10 @@
ASSERT(is_implemented());
ASSERT(!implementor.IsNull());
GrowableObjectArray& direct_implementors =
- GrowableObjectArray::Handle(raw_ptr()->direct_implementors_);
+ GrowableObjectArray::Handle(raw_ptr()->direct_implementors());
if (direct_implementors.IsNull()) {
direct_implementors = GrowableObjectArray::New(4, Heap::kOld);
- StorePointer(&raw_ptr()->direct_implementors_, direct_implementors.raw());
+ raw_ptr()->set_direct_implementors(direct_implementors.raw());
}
#if defined(DEBUG)
// Verify that the same class is not added twice.
@@ -4946,7 +4942,7 @@
void Class::ClearDirectImplementors() const {
ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
- StorePointer(&raw_ptr()->direct_implementors_, GrowableObjectArray::null());
+ raw_ptr()->set_direct_implementors(GrowableObjectArray::null());
}
void Class::AddDirectSubclass(const Class& subclass) const {
@@ -4956,10 +4952,10 @@
// Do not keep track of the direct subclasses of class Object.
ASSERT(!IsObjectClass());
GrowableObjectArray& direct_subclasses =
- GrowableObjectArray::Handle(raw_ptr()->direct_subclasses_);
+ GrowableObjectArray::Handle(raw_ptr()->direct_subclasses());
if (direct_subclasses.IsNull()) {
direct_subclasses = GrowableObjectArray::New(4, Heap::kOld);
- StorePointer(&raw_ptr()->direct_subclasses_, direct_subclasses.raw());
+ raw_ptr()->set_direct_subclasses(direct_subclasses.raw());
}
#if defined(DEBUG)
// Verify that the same class is not added twice.
@@ -4972,15 +4968,15 @@
void Class::ClearDirectSubclasses() const {
ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
- StorePointer(&raw_ptr()->direct_subclasses_, GrowableObjectArray::null());
+ raw_ptr()->set_direct_subclasses(GrowableObjectArray::null());
}
ArrayPtr Class::constants() const {
- return raw_ptr()->constants_;
+ return raw_ptr()->constants();
}
void Class::set_constants(const Array& value) const {
- StorePointer(&raw_ptr()->constants_, value.raw());
+ raw_ptr()->set_constants(value.raw());
}
void Class::set_declaration_type(const Type& value) const {
@@ -4993,7 +4989,7 @@
// The exception is DeclarationType of Null which is kNullable.
ASSERT(value.type_class_id() != kNullCid || value.IsNullable());
ASSERT(value.type_class_id() == kNullCid || value.IsNonNullable());
- StorePointer(&raw_ptr()->declaration_type_, value.raw());
+ raw_ptr()->set_declaration_type(value.raw());
}
TypePtr Class::DeclarationType() const {
@@ -5026,8 +5022,8 @@
// Never clear the stub as it may still be a target, but will be GC-d if
// not referenced.
ASSERT(!value.IsNull());
- ASSERT(raw_ptr()->allocation_stub_ == Code::null());
- StorePointer(&raw_ptr()->allocation_stub_, value.raw());
+ ASSERT(raw_ptr()->allocation_stub() == Code::null());
+ raw_ptr()->set_allocation_stub(value.raw());
}
void Class::DisableAllocationStub() const {
@@ -5039,7 +5035,7 @@
// Change the stub so that the next caller will regenerate the stub.
existing_stub.DisableStubCode();
// Disassociate the existing stub from class.
- StorePointer(&raw_ptr()->allocation_stub_, Code::null());
+ raw_ptr()->set_allocation_stub(Code::null());
}
bool Class::IsDartFunctionClass() const {
@@ -5354,7 +5350,7 @@
// If we want to increase resolver speed by avoiding the need for read lock,
// we could make change this hash table to be lock-free for the reader.
const Array& hash_table =
- Array::Handle(thread->zone(), raw_ptr()->functions_hash_table_);
+ Array::Handle(thread->zone(), raw_ptr()->functions_hash_table());
if (!hash_table.IsNull()) {
ClassFunctionsSet set(hash_table.raw());
REUSABLE_STRING_HANDLESCOPE(thread);
@@ -5863,7 +5859,7 @@
}
void TypeArguments::set_nullability(intptr_t value) const {
- StoreSmi(&raw_ptr()->nullability_, Smi::New(value));
+ raw_ptr()->set_nullability(Smi::New(value));
}
intptr_t TypeArguments::HashForRange(intptr_t from_index, intptr_t len) const {
@@ -5987,7 +5983,7 @@
if (IsNull()) {
return buffer->AddString("null");
}
- buffer->Printf("(H%" Px ")", Smi::Value(raw_ptr()->hash_));
+ buffer->Printf("(H%" Px ")", Smi::Value(raw_ptr()->hash()));
auto& type_at = AbstractType::Handle();
for (intptr_t i = 0; i < Length(); i++) {
type_at = TypeAt(i);
@@ -6088,7 +6084,7 @@
ArrayPtr TypeArguments::instantiations() const {
// We rely on the fact that any loads from the array are dependent loads and
// avoid the load-acquire barrier here.
- return raw_ptr()->instantiations_;
+ return raw_ptr()->instantiations();
}
void TypeArguments::set_instantiations(const Array& value) const {
@@ -6096,8 +6092,7 @@
// when releasing the pointer to the array pointer.
// => We have to use store-release here.
ASSERT(!value.IsNull());
- StorePointer<ArrayPtr, std::memory_order_release>(&raw_ptr()->instantiations_,
- value.raw());
+ raw_ptr()->set_instantiations<std::memory_order_release>(value.raw());
}
bool TypeArguments::HasCount(intptr_t count) const {
@@ -6111,19 +6106,20 @@
if (IsNull()) {
return 0;
}
- return Smi::Value(raw_ptr()->length_);
+ return Smi::Value(raw_ptr()->length());
}
intptr_t TypeArguments::nullability() const {
if (IsNull()) {
return 0;
}
- return Smi::Value(raw_ptr()->nullability_);
+ return Smi::Value(raw_ptr()->nullability());
}
AbstractTypePtr TypeArguments::TypeAt(intptr_t index) const {
ASSERT(!IsNull());
- return *TypeAddr(index);
+ ASSERT((index >= 0) && (index < Length()));
+ return raw_ptr()->element(index);
}
AbstractTypePtr TypeArguments::TypeAtNullSafe(intptr_t index) const {
@@ -6137,7 +6133,8 @@
void TypeArguments::SetTypeAt(intptr_t index, const AbstractType& value) const {
ASSERT(!IsCanonical());
- StorePointer(TypeAddr(index), value.raw());
+ ASSERT((index >= 0) && (index < Length()));
+ return raw_ptr()->set_element(index, value.raw());
}
bool TypeArguments::IsSubvectorInstantiated(intptr_t from_index,
@@ -6487,16 +6484,11 @@
return result.raw();
}
-AbstractTypePtr const* TypeArguments::TypeAddr(intptr_t index) const {
- ASSERT((index >= 0) && (index < Length()));
- return &raw_ptr()->types()[index];
-}
-
void TypeArguments::SetLength(intptr_t value) const {
ASSERT(!IsCanonical());
// This is only safe because we create a new Smi, which does not cause
// heap allocation.
- StoreSmi(&raw_ptr()->length_, Smi::New(value));
+ raw_ptr()->set_length(Smi::New(value));
}
TypeArgumentsPtr TypeArguments::Canonicalize(Thread* thread,
@@ -6627,19 +6619,19 @@
}
void PatchClass::set_patched_class(const Class& value) const {
- StorePointer(&raw_ptr()->patched_class_, value.raw());
+ raw_ptr()->set_patched_class(value.raw());
}
void PatchClass::set_origin_class(const Class& value) const {
- StorePointer(&raw_ptr()->origin_class_, value.raw());
+ raw_ptr()->set_origin_class(value.raw());
}
void PatchClass::set_script(const Script& value) const {
- StorePointer(&raw_ptr()->script_, value.raw());
+ raw_ptr()->set_script(value.raw());
}
void PatchClass::set_library_kernel_data(const ExternalTypedData& data) const {
- StorePointer(&raw_ptr()->library_kernel_data_, data.raw());
+ raw_ptr()->set_library_kernel_data(data.raw());
}
intptr_t Function::Hash() const {
@@ -6671,7 +6663,7 @@
}
void Function::SetInstructionsSafe(const Code& value) const {
- StorePointer(&raw_ptr()->code_, value.raw());
+ raw_ptr()->set_code(value.raw());
StoreNonPointer(&raw_ptr()->entry_point_, value.EntryPoint());
StoreNonPointer(&raw_ptr()->unchecked_entry_point_,
value.UncheckedEntryPoint());
@@ -6688,14 +6680,14 @@
bool Function::HasCode() const {
NoSafepointScope no_safepoint;
- ASSERT(raw_ptr()->code_ != Code::null());
- return raw_ptr()->code_ != StubCode::LazyCompile().raw();
+ ASSERT(raw_ptr()->code() != Code::null());
+ return raw_ptr()->code() != StubCode::LazyCompile().raw();
}
bool Function::HasCode(FunctionPtr function) {
NoSafepointScope no_safepoint;
- ASSERT(function->ptr()->code_ != Code::null());
- return function->ptr()->code_ != StubCode::LazyCompile().raw();
+ ASSERT(function->ptr()->code() != Code::null());
+ return function->ptr()->code() != StubCode::LazyCompile().raw();
}
void Function::ClearCode() const {
@@ -6704,7 +6696,7 @@
#else
ASSERT(Thread::Current()->IsMutatorThread());
- StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
+ raw_ptr()->set_unoptimized_code(Code::null());
SetInstructions(StubCode::LazyCompile());
#endif // defined(DART_PRECOMPILED_RUNTIME)
@@ -6786,13 +6778,13 @@
#else
DEBUG_ASSERT(IsMutatorOrAtSafepoint());
ASSERT(value.IsNull() || !value.is_optimized());
- StorePointer(&raw_ptr()->unoptimized_code_, value.raw());
+ raw_ptr()->set_unoptimized_code(value.raw());
#endif
}
ContextScopePtr Function::context_scope() const {
if (IsClosureFunction()) {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
return ClosureData::Cast(obj).context_scope();
}
@@ -6801,7 +6793,7 @@
void Function::set_context_scope(const ContextScope& value) const {
if (IsClosureFunction()) {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
ClosureData::Cast(obj).set_context_scope(value);
return;
@@ -6811,7 +6803,7 @@
InstancePtr Function::implicit_static_closure() const {
if (IsImplicitStaticClosureFunction()) {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
return ClosureData::Cast(obj).implicit_static_closure();
}
@@ -6820,7 +6812,7 @@
void Function::set_implicit_static_closure(const Instance& closure) const {
if (IsImplicitStaticClosureFunction()) {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
ClosureData::Cast(obj).set_implicit_static_closure(closure);
return;
@@ -6829,7 +6821,7 @@
}
ScriptPtr Function::eval_script() const {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
if (obj.IsScript()) {
return Script::Cast(obj).raw();
}
@@ -6838,27 +6830,27 @@
void Function::set_eval_script(const Script& script) const {
ASSERT(token_pos() == TokenPosition::kMinSource);
- ASSERT(raw_ptr()->data_ == Object::null());
+ ASSERT(raw_ptr()->data() == Object::null());
set_data(script);
}
FunctionPtr Function::extracted_method_closure() const {
ASSERT(kind() == FunctionLayout::kMethodExtractor);
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(obj.IsFunction());
return Function::Cast(obj).raw();
}
void Function::set_extracted_method_closure(const Function& value) const {
ASSERT(kind() == FunctionLayout::kMethodExtractor);
- ASSERT(raw_ptr()->data_ == Object::null());
+ ASSERT(raw_ptr()->data() == Object::null());
set_data(value);
}
ArrayPtr Function::saved_args_desc() const {
ASSERT(kind() == FunctionLayout::kNoSuchMethodDispatcher ||
kind() == FunctionLayout::kInvokeFieldDispatcher);
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(obj.IsArray());
return Array::Cast(obj).raw();
}
@@ -6866,7 +6858,7 @@
void Function::set_saved_args_desc(const Array& value) const {
ASSERT(kind() == FunctionLayout::kNoSuchMethodDispatcher ||
kind() == FunctionLayout::kInvokeFieldDispatcher);
- ASSERT(raw_ptr()->data_ == Object::null());
+ ASSERT(raw_ptr()->data() == Object::null());
set_data(value);
}
@@ -6875,7 +6867,7 @@
kind() == FunctionLayout::kImplicitSetter ||
kind() == FunctionLayout::kImplicitStaticGetter ||
kind() == FunctionLayout::kFieldInitializer);
- return Field::RawCast(raw_ptr()->data_);
+ return Field::RawCast(raw_ptr()->data());
}
void Function::set_accessor_field(const Field& value) const {
@@ -6884,13 +6876,14 @@
kind() == FunctionLayout::kImplicitStaticGetter ||
kind() == FunctionLayout::kFieldInitializer);
// Top level classes may be finalized multiple times.
- ASSERT(raw_ptr()->data_ == Object::null() || raw_ptr()->data_ == value.raw());
+ ASSERT(raw_ptr()->data() == Object::null() ||
+ raw_ptr()->data() == value.raw());
set_data(value);
}
FunctionPtr Function::parent_function() const {
if (IsClosureFunction() || IsSignatureFunction()) {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
if (IsClosureFunction()) {
return ClosureData::Cast(obj).parent_function();
@@ -6902,7 +6895,7 @@
}
void Function::set_parent_function(const Function& value) const {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
if (IsClosureFunction()) {
ClosureData::Cast(obj).set_parent_function(value);
@@ -6986,7 +6979,7 @@
UNREACHABLE();
}
const auto& closure_data =
- ClosureData::Handle(ClosureData::RawCast(raw_ptr()->data_));
+ ClosureData::Handle(ClosureData::RawCast(raw_ptr()->data()));
ASSERT(!closure_data.IsNull());
if (kind_out != nullptr) {
*kind_out = DefaultTypeArgumentsKindField::decode(
@@ -7000,7 +6993,7 @@
UNREACHABLE();
}
const auto& closure_data =
- ClosureData::Handle(ClosureData::RawCast(raw_ptr()->data_));
+ ClosureData::Handle(ClosureData::RawCast(raw_ptr()->data()));
ASSERT(!closure_data.IsNull());
intptr_t updated_info = closure_data.default_type_arguments_info();
auto kind = DefaultTypeArgumentsKindFor(value);
@@ -7084,7 +7077,7 @@
IsDispatcherOrImplicitAccessor() || IsFieldInitializer()) {
return Function::null();
}
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(obj.IsNull() || obj.IsScript() || obj.IsFunction() || obj.IsArray());
if (obj.IsNull() || obj.IsScript()) {
return Function::null();
@@ -7100,7 +7093,7 @@
void Function::set_implicit_closure_function(const Function& value) const {
ASSERT(!IsClosureFunction() && !IsSignatureFunction());
- const Object& old_data = Object::Handle(raw_ptr()->data_);
+ const Object& old_data = Object::Handle(raw_ptr()->data());
if (is_native()) {
ASSERT(old_data.IsArray());
ASSERT((Array::Cast(old_data).At(1) == Object::null()) || value.IsNull());
@@ -7118,7 +7111,7 @@
}
TypePtr Function::ExistingSignatureType() const {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
if (IsSignatureFunction()) {
return SignatureData::Cast(obj).signature_type();
@@ -7132,14 +7125,14 @@
void Function::SetFfiCSignature(const Function& sig) const {
ASSERT(IsFfiTrampoline());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
FfiTrampolineData::Cast(obj).set_c_signature(sig);
}
FunctionPtr Function::FfiCSignature() const {
ASSERT(IsFfiTrampoline());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
return FfiTrampolineData::Cast(obj).c_signature();
}
@@ -7162,42 +7155,42 @@
int32_t Function::FfiCallbackId() const {
ASSERT(IsFfiTrampoline());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
return FfiTrampolineData::Cast(obj).callback_id();
}
void Function::SetFfiCallbackId(int32_t value) const {
ASSERT(IsFfiTrampoline());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
FfiTrampolineData::Cast(obj).set_callback_id(value);
}
FunctionPtr Function::FfiCallbackTarget() const {
ASSERT(IsFfiTrampoline());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
return FfiTrampolineData::Cast(obj).callback_target();
}
void Function::SetFfiCallbackTarget(const Function& target) const {
ASSERT(IsFfiTrampoline());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
FfiTrampolineData::Cast(obj).set_callback_target(target);
}
InstancePtr Function::FfiCallbackExceptionalReturn() const {
ASSERT(IsFfiTrampoline());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
return FfiTrampolineData::Cast(obj).callback_exceptional_return();
}
void Function::SetFfiCallbackExceptionalReturn(const Instance& value) const {
ASSERT(IsFfiTrampoline());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
FfiTrampolineData::Cast(obj).set_callback_exceptional_return(value);
}
@@ -7245,7 +7238,7 @@
}
void Function::SetSignatureType(const Type& value) const {
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(!obj.IsNull());
if (IsSignatureFunction()) {
SignatureData::Cast(obj).set_signature_type(value);
@@ -7265,7 +7258,7 @@
FunctionPtr Function::ForwardingTarget() const {
ASSERT(kind() == FunctionLayout::kDynamicInvocationForwarder);
Array& checks = Array::Handle();
- checks ^= raw_ptr()->data_;
+ checks ^= raw_ptr()->data();
return Function::RawCast(checks.At(0));
}
@@ -7299,7 +7292,7 @@
// dyn inv forwarder: Array[0] = Function target
// Array[1] = TypeArguments default type args
void Function::set_data(const Object& value) const {
- StorePointer(&raw_ptr()->data_, value.raw());
+ raw_ptr()->set_data(value.raw());
}
bool Function::IsInFactoryScope() const {
@@ -7315,17 +7308,17 @@
void Function::set_name(const String& value) const {
ASSERT(value.IsSymbol());
- StorePointer(&raw_ptr()->name_, value.raw());
+ raw_ptr()->set_name(value.raw());
}
void Function::set_owner(const Object& value) const {
ASSERT(!value.IsNull() || IsSignatureFunction());
- StorePointer(&raw_ptr()->owner_, value.raw());
+ raw_ptr()->set_owner(value.raw());
}
RegExpPtr Function::regexp() const {
ASSERT(kind() == FunctionLayout::kIrregexpFunction);
- const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data_));
+ const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data()));
return RegExp::RawCast(pair.At(0));
}
@@ -7335,13 +7328,13 @@
intptr_t Function::string_specialization_cid() const {
ASSERT(kind() == FunctionLayout::kIrregexpFunction);
- const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data_));
+ const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data()));
return StringSpecializationCid::decode(Smi::Value(Smi::RawCast(pair.At(1))));
}
bool Function::is_sticky_specialization() const {
ASSERT(kind() == FunctionLayout::kIrregexpFunction);
- const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data_));
+ const Array& pair = Array::Cast(Object::Handle(raw_ptr()->data()));
return StickySpecialization::decode(Smi::Value(Smi::RawCast(pair.At(1))));
}
@@ -7350,7 +7343,7 @@
bool sticky) const {
ASSERT(kind() == FunctionLayout::kIrregexpFunction);
ASSERT(IsStringClassId(string_specialization_cid));
- ASSERT(raw_ptr()->data_ == Object::null());
+ ASSERT(raw_ptr()->data() == Object::null());
const Array& pair = Array::Handle(Array::New(2, Heap::kOld));
pair.SetAt(0, regexp);
pair.SetAt(1, Smi::Handle(Smi::New(StickySpecialization::encode(sticky) |
@@ -7361,7 +7354,7 @@
StringPtr Function::native_name() const {
ASSERT(is_native());
- const Object& obj = Object::Handle(raw_ptr()->data_);
+ const Object& obj = Object::Handle(raw_ptr()->data());
ASSERT(obj.IsArray());
return String::RawCast(Array::Cast(obj).At(0));
}
@@ -7378,7 +7371,7 @@
// closure function.
//
// We therefore handle both cases.
- const Object& old_data = Object::Handle(zone, raw_ptr()->data_);
+ const Object& old_data = Object::Handle(zone, raw_ptr()->data());
ASSERT(old_data.IsNull() ||
(old_data.IsFunction() &&
Function::Handle(zone, Function::RawCast(old_data.raw()))
@@ -7392,11 +7385,11 @@
void Function::set_result_type(const AbstractType& value) const {
ASSERT(!value.IsNull());
- StorePointer(&raw_ptr()->result_type_, value.raw());
+ raw_ptr()->set_result_type(value.raw());
}
AbstractTypePtr Function::ParameterTypeAt(intptr_t index) const {
- const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_);
+ const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types());
return AbstractType::RawCast(parameter_types.At(index));
}
@@ -7405,27 +7398,27 @@
ASSERT(!value.IsNull());
// Method extractor parameters are shared and are in the VM heap.
ASSERT(kind() != FunctionLayout::kMethodExtractor);
- const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_);
+ const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types());
parameter_types.SetAt(index, value);
}
void Function::set_parameter_types(const Array& value) const {
- StorePointer(&raw_ptr()->parameter_types_, value.raw());
+ raw_ptr()->set_parameter_types(value.raw());
}
StringPtr Function::ParameterNameAt(intptr_t index) const {
- const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_);
+ const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names());
return String::RawCast(parameter_names.At(index));
}
void Function::SetParameterNameAt(intptr_t index, const String& value) const {
ASSERT(!value.IsNull() && value.IsSymbol());
- const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_);
+ const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names());
parameter_names.SetAt(index, value);
}
void Function::set_parameter_names(const Array& value) const {
- StorePointer(&raw_ptr()->parameter_names_, value.raw());
+ raw_ptr()->set_parameter_names(value.raw());
}
void Function::CreateNameArrayIncludingFlags(Heap::Space space) const {
@@ -7470,7 +7463,7 @@
}
intptr_t flag_mask;
const intptr_t flag_index = GetRequiredFlagIndex(index, &flag_mask);
- const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_);
+ const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names());
if (flag_index >= parameter_names.Length()) {
return false;
}
@@ -7482,7 +7475,7 @@
void Function::SetIsRequiredAt(intptr_t index) const {
intptr_t flag_mask;
const intptr_t flag_index = GetRequiredFlagIndex(index, &flag_mask);
- const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_);
+ const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names());
ASSERT(flag_index < parameter_names.Length());
const intptr_t flags =
Smi::Value(Smi::RawCast(parameter_names.At(flag_index)));
@@ -7490,7 +7483,7 @@
}
void Function::TruncateUnusedParameterFlags() const {
- const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_);
+ const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names());
const intptr_t num_params = NumParameters();
if (parameter_names.Length() == num_params) {
// No flag slots to truncate.
@@ -7507,7 +7500,7 @@
}
void Function::set_type_parameters(const TypeArguments& value) const {
- StorePointer(&raw_ptr()->type_parameters_, value.raw());
+ raw_ptr()->set_type_parameters(value.raw());
}
intptr_t Function::NumTypeParameters(Thread* thread) const {
@@ -9058,27 +9051,27 @@
}
ClassPtr Function::Owner() const {
- if (raw_ptr()->owner_ == Object::null()) {
+ if (raw_ptr()->owner() == Object::null()) {
ASSERT(IsSignatureFunction());
return Class::null();
}
- if (raw_ptr()->owner_->IsClass()) {
- return Class::RawCast(raw_ptr()->owner_);
+ if (raw_ptr()->owner()->IsClass()) {
+ return Class::RawCast(raw_ptr()->owner());
}
- const Object& obj = Object::Handle(raw_ptr()->owner_);
+ const Object& obj = Object::Handle(raw_ptr()->owner());
ASSERT(obj.IsPatchClass());
return PatchClass::Cast(obj).patched_class();
}
ClassPtr Function::origin() const {
- if (raw_ptr()->owner_ == Object::null()) {
+ if (raw_ptr()->owner() == Object::null()) {
ASSERT(IsSignatureFunction());
return Class::null();
}
- if (raw_ptr()->owner_->IsClass()) {
- return Class::RawCast(raw_ptr()->owner_);
+ if (raw_ptr()->owner()->IsClass()) {
+ return Class::RawCast(raw_ptr()->owner());
}
- const Object& obj = Object::Handle(raw_ptr()->owner_);
+ const Object& obj = Object::Handle(raw_ptr()->owner());
ASSERT(obj.IsPatchClass());
return PatchClass::Cast(obj).origin_class();
}
@@ -9112,7 +9105,7 @@
ScriptPtr Function::script() const {
// NOTE(turnidge): If you update this function, you probably want to
// update Class::PatchFieldsAndFunctions() at the same time.
- const Object& data = Object::Handle(raw_ptr()->data_);
+ const Object& data = Object::Handle(raw_ptr()->data());
if (IsDynamicInvocationForwarder()) {
const auto& forwarding_target = Function::Handle(ForwardingTarget());
return forwarding_target.script();
@@ -9135,7 +9128,7 @@
return script.raw();
}
}
- const Object& obj = Object::Handle(raw_ptr()->owner_);
+ const Object& obj = Object::Handle(raw_ptr()->owner());
if (obj.IsPatchClass()) {
return PatchClass::Cast(obj).script();
}
@@ -9151,7 +9144,7 @@
}
ExternalTypedDataPtr Function::KernelData() const {
- Object& data = Object::Handle(raw_ptr()->data_);
+ Object& data = Object::Handle(raw_ptr()->data());
if (data.IsArray()) {
Object& script = Object::Handle(Array::Cast(data).At(0));
if (script.IsScript()) {
@@ -9164,7 +9157,7 @@
return parent.KernelData();
}
- const Object& obj = Object::Handle(raw_ptr()->owner_);
+ const Object& obj = Object::Handle(raw_ptr()->owner());
if (obj.IsClass()) {
Library& lib = Library::Handle(Class::Cast(obj).library());
return lib.kernel_data();
@@ -9178,7 +9171,7 @@
IsFfiTrampoline()) {
return 0;
}
- Object& data = Object::Handle(raw_ptr()->data_);
+ Object& data = Object::Handle(raw_ptr()->data());
if (data.IsArray()) {
Object& script = Object::Handle(Array::Cast(data).At(0));
if (script.IsScript()) {
@@ -9191,7 +9184,7 @@
return parent.KernelDataProgramOffset();
}
- const Object& obj = Object::Handle(raw_ptr()->owner_);
+ const Object& obj = Object::Handle(raw_ptr()->owner());
if (obj.IsClass()) {
Library& lib = Library::Handle(Class::Cast(obj).library());
return lib.kernel_offset();
@@ -9482,13 +9475,11 @@
}
void Function::set_ic_data_array(const Array& value) const {
- StorePointer<ArrayPtr, std::memory_order_release>(&raw_ptr()->ic_data_array_,
- value.raw());
+ raw_ptr()->set_ic_data_array<std::memory_order_release>(value.raw());
}
ArrayPtr Function::ic_data_array() const {
- return LoadPointer<ArrayPtr, std::memory_order_acquire>(
- &raw_ptr()->ic_data_array_);
+ return raw_ptr()->ic_data_array<std::memory_order_acquire>();
}
void Function::ClearICDataArray() const {
@@ -9728,41 +9719,41 @@
}
void ClosureData::set_context_scope(const ContextScope& value) const {
- StorePointer(&raw_ptr()->context_scope_, value.raw());
+ raw_ptr()->set_context_scope(value.raw());
}
void ClosureData::set_implicit_static_closure(const Instance& closure) const {
ASSERT(!closure.IsNull());
- ASSERT(raw_ptr()->closure_ == Instance::null());
- StorePointer(&raw_ptr()->closure_, closure.raw());
+ ASSERT(raw_ptr()->closure() == Instance::null());
+ raw_ptr()->set_closure(closure.raw());
}
void ClosureData::set_parent_function(const Function& value) const {
- StorePointer(&raw_ptr()->parent_function_, value.raw());
+ raw_ptr()->set_parent_function(value.raw());
}
void ClosureData::set_signature_type(const Type& value) const {
- StorePointer(&raw_ptr()->signature_type_, value.raw());
+ raw_ptr()->set_signature_type(value.raw());
}
void ClosureData::set_default_type_arguments(const TypeArguments& value) const {
- StorePointer(&raw_ptr()->default_type_arguments_, value.raw());
+ raw_ptr()->set_default_type_arguments(value.raw());
}
intptr_t ClosureData::default_type_arguments_info() const {
- const SmiPtr value = raw_ptr()->default_type_arguments_info_;
+ const SmiPtr value = raw_ptr()->default_type_arguments_info();
if (value == Smi::null()) {
static_assert(Function::DefaultTypeArgumentsKindField::decode(0) ==
Function::DefaultTypeArgumentsKind::kInvalid,
"Returning valid value for null Smi");
return 0;
}
- return Smi::Value(raw_ptr()->default_type_arguments_info_);
+ return Smi::Value(raw_ptr()->default_type_arguments_info());
}
void ClosureData::set_default_type_arguments_info(intptr_t value) const {
ASSERT(Smi::IsValid(value));
- StorePointer(&raw_ptr()->default_type_arguments_info_, Smi::New(value));
+ raw_ptr()->set_default_type_arguments_info(Smi::New(value));
}
ClosureDataPtr ClosureData::New() {
@@ -9805,11 +9796,11 @@
}
void SignatureData::set_parent_function(const Function& value) const {
- StorePointer(&raw_ptr()->parent_function_, value.raw());
+ raw_ptr()->set_parent_function(value.raw());
}
void SignatureData::set_signature_type(const Type& value) const {
- StorePointer(&raw_ptr()->signature_type_, value.raw());
+ raw_ptr()->set_signature_type(value.raw());
}
SignatureDataPtr SignatureData::New(Heap::Space space) {
@@ -9832,15 +9823,15 @@
}
void FfiTrampolineData::set_signature_type(const Type& value) const {
- StorePointer(&raw_ptr()->signature_type_, value.raw());
+ raw_ptr()->set_signature_type(value.raw());
}
void FfiTrampolineData::set_c_signature(const Function& value) const {
- StorePointer(&raw_ptr()->c_signature_, value.raw());
+ raw_ptr()->set_c_signature(value.raw());
}
void FfiTrampolineData::set_callback_target(const Function& value) const {
- StorePointer(&raw_ptr()->callback_target_, value.raw());
+ raw_ptr()->set_callback_target(value.raw());
}
void FfiTrampolineData::set_callback_id(int32_t callback_id) const {
@@ -9849,7 +9840,7 @@
void FfiTrampolineData::set_callback_exceptional_return(
const Instance& value) const {
- StorePointer(&raw_ptr()->callback_exceptional_return_, value.raw());
+ raw_ptr()->set_callback_exceptional_return(value.raw());
}
FfiTrampolineDataPtr FfiTrampolineData::New() {
@@ -9884,7 +9875,7 @@
if (IsNull()) {
return Field::null();
}
- Object& obj = Object::Handle(raw_ptr()->owner_);
+ Object& obj = Object::Handle(raw_ptr()->owner());
if (obj.IsField()) {
return Field::RawCast(obj.raw());
} else {
@@ -9910,7 +9901,7 @@
void Field::SetOriginal(const Field& value) const {
ASSERT(value.IsOriginal());
ASSERT(!value.IsNull());
- StorePointer(&raw_ptr()->owner_, static_cast<ObjectPtr>(value.raw()));
+ raw_ptr()->set_owner(static_cast<ObjectPtr>(value.raw()));
}
StringPtr Field::GetterName(const String& field_name) {
@@ -9967,24 +9958,24 @@
void Field::set_name(const String& value) const {
ASSERT(value.IsSymbol());
ASSERT(IsOriginal());
- StorePointer(&raw_ptr()->name_, value.raw());
+ raw_ptr()->set_name(value.raw());
}
ObjectPtr Field::RawOwner() const {
if (IsOriginal()) {
- return raw_ptr()->owner_;
+ return raw_ptr()->owner();
} else {
const Field& field = Field::Handle(Original());
ASSERT(field.IsOriginal());
- ASSERT(!Object::Handle(field.raw_ptr()->owner_).IsField());
- return field.raw_ptr()->owner_;
+ ASSERT(!Object::Handle(field.raw_ptr()->owner()).IsField());
+ return field.raw_ptr()->owner();
}
}
ClassPtr Field::Owner() const {
const Field& field = Field::Handle(Original());
ASSERT(field.IsOriginal());
- const Object& obj = Object::Handle(field.raw_ptr()->owner_);
+ const Object& obj = Object::Handle(field.raw_ptr()->owner());
if (obj.IsClass()) {
return Class::Cast(obj).raw();
}
@@ -9995,7 +9986,7 @@
ClassPtr Field::Origin() const {
const Field& field = Field::Handle(Original());
ASSERT(field.IsOriginal());
- const Object& obj = Object::Handle(field.raw_ptr()->owner_);
+ const Object& obj = Object::Handle(field.raw_ptr()->owner());
if (obj.IsClass()) {
return Class::Cast(obj).raw();
}
@@ -10008,7 +9999,7 @@
// update Class::PatchFieldsAndFunctions() at the same time.
const Field& field = Field::Handle(Original());
ASSERT(field.IsOriginal());
- const Object& obj = Object::Handle(field.raw_ptr()->owner_);
+ const Object& obj = Object::Handle(field.raw_ptr()->owner());
if (obj.IsClass()) {
return Class::Cast(obj).script();
}
@@ -10017,7 +10008,7 @@
}
ExternalTypedDataPtr Field::KernelData() const {
- const Object& obj = Object::Handle(this->raw_ptr()->owner_);
+ const Object& obj = Object::Handle(this->raw_ptr()->owner());
// During background JIT compilation field objects are copied
// and copy points to the original field via the owner field.
if (obj.IsField()) {
@@ -10039,7 +10030,7 @@
}
intptr_t Field::KernelDataProgramOffset() const {
- const Object& obj = Object::Handle(raw_ptr()->owner_);
+ const Object& obj = Object::Handle(raw_ptr()->owner());
// During background JIT compilation field objects are copied
// and copy points to the original field via the owner field.
if (obj.IsField()) {
@@ -10058,7 +10049,7 @@
ASSERT(IsOriginal());
ASSERT(!value.IsNull());
if (value.raw() != type()) {
- StorePointer(&raw_ptr()->type_, value.raw());
+ raw_ptr()->set_type(value.raw());
}
}
@@ -10210,13 +10201,13 @@
}
intptr_t Field::guarded_list_length() const {
- return Smi::Value(raw_ptr()->guarded_list_length_);
+ return Smi::Value(raw_ptr()->guarded_list_length());
}
void Field::set_guarded_list_length_unsafe(intptr_t list_length) const {
ASSERT(Thread::Current()->IsMutatorThread());
ASSERT(IsOriginal());
- StoreSmi(&raw_ptr()->guarded_list_length_, Smi::New(list_length));
+ raw_ptr()->set_guarded_list_length(Smi::New(list_length));
}
intptr_t Field::guarded_list_length_in_object_offset() const {
@@ -10325,14 +10316,14 @@
ArrayPtr Field::dependent_code() const {
DEBUG_ASSERT(
IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
- return raw_ptr()->dependent_code_;
+ return raw_ptr()->dependent_code();
}
void Field::set_dependent_code(const Array& array) const {
ASSERT(IsOriginal());
DEBUG_ASSERT(
IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
- StorePointer(&raw_ptr()->dependent_code_, array.raw());
+ raw_ptr()->set_dependent_code(array.raw());
}
class FieldDependentArray : public WeakCodeReferences {
@@ -10389,8 +10380,8 @@
bool Field::IsConsistentWith(const Field& other) const {
return (raw_ptr()->guarded_cid_ == other.raw_ptr()->guarded_cid_) &&
(raw_ptr()->is_nullable_ == other.raw_ptr()->is_nullable_) &&
- (raw_ptr()->guarded_list_length_ ==
- other.raw_ptr()->guarded_list_length_) &&
+ (raw_ptr()->guarded_list_length() ==
+ other.raw_ptr()->guarded_list_length()) &&
(is_unboxing_candidate() == other.is_unboxing_candidate()) &&
(static_type_exactness_state().Encode() ==
other.static_type_exactness_state().Encode());
@@ -10437,13 +10428,13 @@
// We have to ensure that all stores into the initializer function object
// happen before releasing the pointer to the initializer as it may be
// accessed without grabbing the lock.
- StorePointer<FunctionPtr, std::memory_order_release>(
- &raw_ptr()->initializer_function_, initializer.raw());
+ raw_ptr()->set_initializer_function<std::memory_order_release>(
+ initializer.raw());
#endif
}
bool Field::HasInitializerFunction() const {
- return raw_ptr()->initializer_function_ != Function::null();
+ return raw_ptr()->initializer_function() != Function::null();
}
ErrorPtr Field::InitializeInstance(const Instance& instance) const {
@@ -11010,16 +11001,16 @@
#if !defined(DART_PRECOMPILED_RUNTIME)
void Field::set_type_test_cache(const SubtypeTestCache& cache) const {
- StorePointer(&raw_ptr()->type_test_cache_, cache.raw());
+ raw_ptr()->set_type_test_cache(cache.raw());
}
#endif
bool Script::HasSource() const {
- return raw_ptr()->source_ != String::null();
+ return raw_ptr()->source() != String::null();
}
StringPtr Script::Source() const {
- return raw_ptr()->source_;
+ return raw_ptr()->source();
}
bool Script::IsPartOfDartColonLibrary() const {
@@ -11039,11 +11030,11 @@
#endif // !defined(DART_PRECOMPILED_RUNTIME)
void Script::set_compile_time_constants(const Array& value) const {
- StorePointer(&raw_ptr()->compile_time_constants_, value.raw());
+ raw_ptr()->set_compile_time_constants(value.raw());
}
void Script::set_kernel_program_info(const KernelProgramInfo& info) const {
- StorePointer(&raw_ptr()->kernel_program_info_, info.raw());
+ raw_ptr()->set_kernel_program_info(info.raw());
}
void Script::set_kernel_script_index(const intptr_t kernel_script_index) const {
@@ -11144,38 +11135,38 @@
}
void Script::set_url(const String& value) const {
- StorePointer(&raw_ptr()->url_, value.raw());
+ raw_ptr()->set_url(value.raw());
}
void Script::set_resolved_url(const String& value) const {
- StorePointer(&raw_ptr()->resolved_url_, value.raw());
+ raw_ptr()->set_resolved_url(value.raw());
}
void Script::set_source(const String& value) const {
- StorePointer(&raw_ptr()->source_, value.raw());
+ raw_ptr()->set_source(value.raw());
}
void Script::set_line_starts(const TypedData& value) const {
- StorePointer(&raw_ptr()->line_starts_, value.raw());
+ raw_ptr()->set_line_starts(value.raw());
}
void Script::set_debug_positions(const Array& value) const {
- StorePointer(&raw_ptr()->debug_positions_, value.raw());
+ raw_ptr()->set_debug_positions(value.raw());
}
TypedDataPtr Script::line_starts() const {
- return raw_ptr()->line_starts_;
+ return raw_ptr()->line_starts();
}
ArrayPtr Script::debug_positions() const {
#if !defined(DART_PRECOMPILED_RUNTIME)
- Array& debug_positions_array = Array::Handle(raw_ptr()->debug_positions_);
+ Array& debug_positions_array = Array::Handle(raw_ptr()->debug_positions());
if (debug_positions_array.IsNull()) {
// This is created lazily. Now we need it.
kernel::CollectTokenPositionsFor(*this);
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
- return raw_ptr()->debug_positions_;
+ return raw_ptr()->debug_positions();
}
void Script::set_flags(uint8_t value) const {
@@ -11554,19 +11545,19 @@
void Library::set_name(const String& name) const {
ASSERT(name.IsSymbol());
- StorePointer(&raw_ptr()->name_, name.raw());
+ raw_ptr()->set_name(name.raw());
}
void Library::set_url(const String& name) const {
- StorePointer(&raw_ptr()->url_, name.raw());
+ raw_ptr()->set_url(name.raw());
}
void Library::set_kernel_data(const ExternalTypedData& data) const {
- StorePointer(&raw_ptr()->kernel_data_, data.raw());
+ raw_ptr()->set_kernel_data(data.raw());
}
void Library::set_loading_unit(const LoadingUnit& value) const {
- StorePointer(&raw_ptr()->loading_unit_, value.raw());
+ raw_ptr()->set_loading_unit(value.raw());
}
void Library::SetName(const String& name) const {
@@ -11884,7 +11875,7 @@
}
ResolvedNamesMap cache(resolved_names());
cache.UpdateOrInsert(name, obj);
- StorePointer(&raw_ptr()->resolved_names_, cache.Release().raw());
+ raw_ptr()->set_resolved_names(cache.Release().raw());
}
bool Library::LookupExportedNamesCache(const String& name, Object* obj) const {
@@ -11919,7 +11910,7 @@
}
ResolvedNamesMap cache(exported_names());
cache.UpdateOrInsert(name, obj);
- StorePointer(&raw_ptr()->exported_names_, cache.Release().raw());
+ raw_ptr()->set_exported_names(cache.Release().raw());
}
void Library::InvalidateResolvedName(const String& name) const {
@@ -11992,7 +11983,7 @@
new_entry = Smi::New(used);
new_dict.SetAt(new_dict_size, new_entry);
// Remember the new dictionary now.
- StorePointer(&raw_ptr()->dictionary_, new_dict.raw());
+ raw_ptr()->set_dictionary(new_dict.raw());
}
void Library::AddObject(const Object& obj, const String& name) const {
@@ -12028,7 +12019,7 @@
// Invalidate the cache of loaded scripts.
if (loaded_scripts() != Array::null()) {
- StorePointer(&raw_ptr()->loaded_scripts_, Array::null());
+ raw_ptr()->set_loaded_scripts(Array::null());
}
}
@@ -12190,7 +12181,7 @@
// Create the array of scripts and cache it in loaded_scripts_.
const Array& scripts_array = Array::Handle(Array::MakeFixedLength(scripts));
- StorePointer(&raw_ptr()->loaded_scripts_, scripts_array.raw());
+ raw_ptr()->set_loaded_scripts(scripts_array.raw());
}
return loaded_scripts();
}
@@ -12456,16 +12447,16 @@
}
void Library::set_toplevel_class(const Class& value) const {
- ASSERT(raw_ptr()->toplevel_class_ == Class::null());
- StorePointer(&raw_ptr()->toplevel_class_, value.raw());
+ ASSERT(raw_ptr()->toplevel_class() == Class::null());
+ raw_ptr()->set_toplevel_class(value.raw());
}
void Library::set_dependencies(const Array& deps) const {
- StorePointer(&raw_ptr()->dependencies_, deps.raw());
+ raw_ptr()->set_dependencies(deps.raw());
}
void Library::set_metadata(const GrowableObjectArray& value) const {
- StorePointer(&raw_ptr()->metadata_, value.raw());
+ raw_ptr()->set_metadata(value.raw());
}
LibraryPtr Library::ImportLibraryAt(intptr_t index) const {
@@ -12488,7 +12479,7 @@
// We need to preserve the "dart-ext:" imports because they are used by
// Loader::ReloadNativeExtensions().
intptr_t native_import_count = 0;
- Array& imports = Array::Handle(raw_ptr()->imports_);
+ Array& imports = Array::Handle(raw_ptr()->imports());
Namespace& ns = Namespace::Handle();
Library& lib = Library::Handle();
String& url = String::Handle();
@@ -12513,13 +12504,13 @@
}
}
- StorePointer(&raw_ptr()->imports_, new_imports.raw());
- StorePointer(&raw_ptr()->exports_, Object::empty_array().raw());
+ raw_ptr()->set_imports(new_imports.raw());
+ raw_ptr()->set_exports(Object::empty_array().raw());
StoreNonPointer(&raw_ptr()->num_imports_, 0);
- StorePointer(&raw_ptr()->resolved_names_, Array::null());
- StorePointer(&raw_ptr()->exported_names_, Array::null());
- StorePointer(&raw_ptr()->loaded_scripts_, Array::null());
- StorePointer(&raw_ptr()->dependencies_, Array::null());
+ raw_ptr()->set_resolved_names(Array::null());
+ raw_ptr()->set_exported_names(Array::null());
+ raw_ptr()->set_loaded_scripts(Array::null());
+ raw_ptr()->set_dependencies(Array::null());
}
void Library::AddImport(const Namespace& ns) const {
@@ -12528,7 +12519,7 @@
if (num_imports() == capacity) {
capacity = capacity + kImportsCapacityIncrement + (capacity >> 2);
imports = Array::Grow(imports, capacity);
- StorePointer(&raw_ptr()->imports_, imports.raw());
+ raw_ptr()->set_imports(imports.raw());
}
intptr_t index = num_imports();
imports.SetAt(index, ns);
@@ -12548,7 +12539,7 @@
Array& exports = Array::Handle(this->exports());
intptr_t num_exports = exports.Length();
exports = Array::Grow(exports, num_exports + 1);
- StorePointer(&raw_ptr()->exports_, exports.raw());
+ raw_ptr()->set_exports(exports.raw());
exports.SetAt(num_exports, ns);
}
@@ -12565,12 +12556,12 @@
REUSABLE_FUNCTION_HANDLESCOPE(thread);
Array& cache = thread->ArrayHandle();
cache = HashTables::New<ResolvedNamesMap>(64);
- StorePointer(&raw_ptr()->resolved_names_, cache.raw());
+ raw_ptr()->set_resolved_names(cache.raw());
}
void Library::ClearResolvedNamesCache() const {
ASSERT(Thread::Current()->IsMutatorThread());
- StorePointer(&raw_ptr()->resolved_names_, Array::null());
+ raw_ptr()->set_resolved_names(Array::null());
}
void Library::InitExportedNamesCache() const {
@@ -12579,11 +12570,11 @@
REUSABLE_FUNCTION_HANDLESCOPE(thread);
Array& cache = thread->ArrayHandle();
cache = HashTables::New<ResolvedNamesMap>(16);
- StorePointer(&raw_ptr()->exported_names_, cache.raw());
+ raw_ptr()->set_exported_names(cache.raw());
}
void Library::ClearExportedNamesCache() const {
- StorePointer(&raw_ptr()->exported_names_, Array::null());
+ raw_ptr()->set_exported_names(Array::null());
}
void Library::InitClassDictionary() const {
@@ -12594,13 +12585,13 @@
// TODO(iposva): Find reasonable initial size.
const int kInitialElementCount = 16;
dictionary = NewDictionary(kInitialElementCount);
- StorePointer(&raw_ptr()->dictionary_, dictionary.raw());
+ raw_ptr()->set_dictionary(dictionary.raw());
}
void Library::InitImportList() const {
const Array& imports =
Array::Handle(Array::New(kInitialImportsCapacity, Heap::kOld));
- StorePointer(&raw_ptr()->imports_, imports.raw());
+ raw_ptr()->set_imports(imports.raw());
StoreNonPointer(&raw_ptr()->num_imports_, 0);
}
@@ -12619,21 +12610,20 @@
url.Hash();
const bool dart_scheme = url.StartsWith(Symbols::DartScheme());
const Library& result = Library::Handle(zone, Library::New());
- result.StorePointer(&result.raw_ptr()->name_, Symbols::Empty().raw());
- result.StorePointer(&result.raw_ptr()->url_, url.raw());
- result.StorePointer(&result.raw_ptr()->resolved_names_, Array::null());
- result.StorePointer(&result.raw_ptr()->exported_names_, Array::null());
- result.StorePointer(&result.raw_ptr()->dictionary_,
- Object::empty_array().raw());
+ result.raw_ptr()->set_name(Symbols::Empty().raw());
+ result.raw_ptr()->set_url(url.raw());
+ result.raw_ptr()->set_resolved_names(Array::null());
+ result.raw_ptr()->set_exported_names(Array::null());
+ result.raw_ptr()->set_dictionary(Object::empty_array().raw());
GrowableObjectArray& list = GrowableObjectArray::Handle(zone);
list = GrowableObjectArray::New(4, Heap::kOld);
- result.StorePointer(&result.raw_ptr()->metadata_, list.raw());
- result.StorePointer(&result.raw_ptr()->toplevel_class_, Class::null());
+ result.raw_ptr()->set_metadata(list.raw());
+ result.raw_ptr()->set_toplevel_class(Class::null());
list = GrowableObjectArray::New(Object::empty_array(), Heap::kOld);
- result.StorePointer(&result.raw_ptr()->used_scripts_, list.raw());
- result.StorePointer(&result.raw_ptr()->imports_, Object::empty_array().raw());
- result.StorePointer(&result.raw_ptr()->exports_, Object::empty_array().raw());
- result.StorePointer(&result.raw_ptr()->loaded_scripts_, Array::null());
+ result.raw_ptr()->set_used_scripts(list.raw());
+ result.raw_ptr()->set_imports(Object::empty_array().raw());
+ result.raw_ptr()->set_exports(Object::empty_array().raw());
+ result.raw_ptr()->set_loaded_scripts(Array::null());
result.set_native_entry_resolver(NULL);
result.set_native_entry_symbol_resolver(NULL);
result.set_flags(0);
@@ -13085,7 +13075,7 @@
const String& original_key =
String::Handle(reload_context->FindLibraryPrivateKey(*this));
if (!original_key.IsNull()) {
- StorePointer(&raw_ptr()->private_key_, original_key.raw());
+ raw_ptr()->set_private_key(original_key.raw());
return;
}
}
@@ -13107,7 +13097,7 @@
const String& key =
String::Handle(zone, String::New(private_key, Heap::kOld));
key.Hash(); // This string may end up in the VM isolate.
- StorePointer(&raw_ptr()->private_key_, key.raw());
+ raw_ptr()->set_private_key(key.raw());
}
const String& Library::PrivateCoreLibName(const String& member) {
@@ -13332,11 +13322,11 @@
void LibraryPrefix::set_name(const String& value) const {
ASSERT(value.IsSymbol());
- StorePointer(&raw_ptr()->name_, value.raw());
+ raw_ptr()->set_name(value.raw());
}
void LibraryPrefix::set_imports(const Array& value) const {
- StorePointer(&raw_ptr()->imports_, value.raw());
+ raw_ptr()->set_imports(value.raw());
}
void LibraryPrefix::set_num_imports(intptr_t value) const {
@@ -13347,7 +13337,7 @@
}
void LibraryPrefix::set_importer(const Library& value) const {
- StorePointer(&raw_ptr()->importer_, value.raw());
+ raw_ptr()->set_importer(value.raw());
}
const char* LibraryPrefix::ToCString() const {
@@ -13356,7 +13346,7 @@
}
void Namespace::set_metadata_field(const Field& value) const {
- StorePointer(&raw_ptr()->metadata_field_, value.raw());
+ raw_ptr()->set_metadata_field(value.raw());
}
void Namespace::AddMetadata(const Object& owner,
@@ -13528,9 +13518,9 @@
ASSERT(show_names.IsNull() || (show_names.Length() > 0));
ASSERT(hide_names.IsNull() || (hide_names.Length() > 0));
const Namespace& result = Namespace::Handle(Namespace::New());
- result.StorePointer(&result.raw_ptr()->library_, library.raw());
- result.StorePointer(&result.raw_ptr()->show_names_, show_names.raw());
- result.StorePointer(&result.raw_ptr()->hide_names_, hide_names.raw());
+ result.raw_ptr()->set_library(library.raw());
+ result.raw_ptr()->set_show_names(show_names.raw());
+ result.raw_ptr()->set_hide_names(hide_names.raw());
return result.raw();
}
@@ -13555,19 +13545,16 @@
const uint32_t binary_version) {
const KernelProgramInfo& info =
KernelProgramInfo::Handle(KernelProgramInfo::New());
- info.StorePointer(&info.raw_ptr()->string_offsets_, string_offsets.raw());
- info.StorePointer(&info.raw_ptr()->string_data_, string_data.raw());
- info.StorePointer(&info.raw_ptr()->canonical_names_, canonical_names.raw());
- info.StorePointer(&info.raw_ptr()->metadata_payloads_,
- metadata_payloads.raw());
- info.StorePointer(&info.raw_ptr()->metadata_mappings_,
- metadata_mappings.raw());
- info.StorePointer(&info.raw_ptr()->scripts_, scripts.raw());
- info.StorePointer(&info.raw_ptr()->constants_table_, constants_table.raw());
- info.StorePointer(&info.raw_ptr()->libraries_cache_, libraries_cache.raw());
- info.StorePointer(&info.raw_ptr()->classes_cache_, classes_cache.raw());
- info.StorePointer(&info.raw_ptr()->retained_kernel_blob_,
- retained_kernel_blob.raw());
+ info.raw_ptr()->set_string_offsets(string_offsets.raw());
+ info.raw_ptr()->set_string_data(string_data.raw());
+ info.raw_ptr()->set_canonical_names(canonical_names.raw());
+ info.raw_ptr()->set_metadata_payloads(metadata_payloads.raw());
+ info.raw_ptr()->set_metadata_mappings(metadata_mappings.raw());
+ info.raw_ptr()->set_scripts(scripts.raw());
+ info.raw_ptr()->set_constants_table(constants_table.raw());
+ info.raw_ptr()->set_libraries_cache(libraries_cache.raw());
+ info.raw_ptr()->set_classes_cache(classes_cache.raw());
+ info.raw_ptr()->set_retained_kernel_blob(retained_kernel_blob.raw());
info.set_kernel_binary_version(binary_version);
return info.raw();
}
@@ -13583,11 +13570,11 @@
}
void KernelProgramInfo::set_scripts(const Array& scripts) const {
- StorePointer(&raw_ptr()->scripts_, scripts.raw());
+ raw_ptr()->set_scripts(scripts.raw());
}
void KernelProgramInfo::set_constants(const Array& constants) const {
- StorePointer(&raw_ptr()->constants_, constants.raw());
+ raw_ptr()->set_constants(constants.raw());
}
void KernelProgramInfo::set_kernel_binary_version(uint32_t version) const {
@@ -13596,21 +13583,21 @@
void KernelProgramInfo::set_constants_table(
const ExternalTypedData& value) const {
- StorePointer(&raw_ptr()->constants_table_, value.raw());
+ raw_ptr()->set_constants_table(value.raw());
}
void KernelProgramInfo::set_potential_natives(
const GrowableObjectArray& candidates) const {
- StorePointer(&raw_ptr()->potential_natives_, candidates.raw());
+ raw_ptr()->set_potential_natives(candidates.raw());
}
void KernelProgramInfo::set_potential_pragma_functions(
const GrowableObjectArray& candidates) const {
- StorePointer(&raw_ptr()->potential_pragma_functions_, candidates.raw());
+ raw_ptr()->set_potential_pragma_functions(candidates.raw());
}
void KernelProgramInfo::set_libraries_cache(const Array& cache) const {
- StorePointer(&raw_ptr()->libraries_cache_, cache.raw());
+ raw_ptr()->set_libraries_cache(cache.raw());
}
typedef UnorderedHashMap<SmiTraits> IntHashMap;
@@ -13661,7 +13648,7 @@
}
void KernelProgramInfo::set_classes_cache(const Array& cache) const {
- StorePointer(&raw_ptr()->classes_cache_, cache.raw());
+ raw_ptr()->set_classes_cache(cache.raw());
}
ClassPtr KernelProgramInfo::LookupClass(Thread* thread,
@@ -14667,19 +14654,19 @@
ASSERT((try_index >= 0) && (try_index < num_entries()));
ASSERT(!handled_types.IsNull());
const Array& handled_types_data =
- Array::Handle(raw_ptr()->handled_types_data_);
+ Array::Handle(raw_ptr()->handled_types_data());
handled_types_data.SetAt(try_index, handled_types);
}
ArrayPtr ExceptionHandlers::GetHandledTypes(intptr_t try_index) const {
ASSERT((try_index >= 0) && (try_index < num_entries()));
- Array& array = Array::Handle(raw_ptr()->handled_types_data_);
+ Array& array = Array::Handle(raw_ptr()->handled_types_data());
array ^= array.At(try_index);
return array.raw();
}
void ExceptionHandlers::set_handled_types_data(const Array& value) const {
- StorePointer(&raw_ptr()->handled_types_data_, value.raw());
+ raw_ptr()->set_handled_types_data(value.raw());
}
ExceptionHandlersPtr ExceptionHandlers::New(intptr_t num_handlers) {
@@ -14781,7 +14768,7 @@
}
void SingleTargetCache::set_target(const Code& value) const {
- StorePointer(&raw_ptr()->target_, value.raw());
+ raw_ptr()->set_target(value.raw());
}
const char* SingleTargetCache::ToCString() const {
@@ -14837,7 +14824,7 @@
result ^=
Object::Allocate(MonomorphicSmiableCall::kClassId,
MonomorphicSmiableCall::InstanceSize(), Heap::kOld);
- result.StorePointer(&result.raw_ptr()->target_, target.raw());
+ result.raw_ptr()->set_target(target.raw());
result.StoreNonPointer(&result.raw_ptr()->expected_cid_, expected_cid);
result.StoreNonPointer(&result.raw_ptr()->entrypoint_, target.EntryPoint());
return result.raw();
@@ -14855,17 +14842,17 @@
void CallSiteData::set_target_name(const String& value) const {
ASSERT(!value.IsNull());
- StorePointer(&raw_ptr()->target_name_, value.raw());
+ raw_ptr()->set_target_name(value.raw());
}
void CallSiteData::set_arguments_descriptor(const Array& value) const {
ASSERT(!value.IsNull());
- StorePointer(&raw_ptr()->args_descriptor_, value.raw());
+ raw_ptr()->set_args_descriptor(value.raw());
}
#if !defined(DART_PRECOMPILED_RUNTIME)
void ICData::SetReceiversStaticType(const AbstractType& type) const {
- StorePointer(&raw_ptr()->receivers_static_type_, type.raw());
+ raw_ptr()->set_receivers_static_type(type.raw());
#if defined(TARGET_ARCH_X64)
if (!type.IsNull() && type.HasTypeClass() && (NumArgsTested() == 1) &&
@@ -14909,7 +14896,7 @@
}
FunctionPtr ICData::Owner() const {
- Object& obj = Object::Handle(raw_ptr()->owner_);
+ Object& obj = Object::Handle(raw_ptr()->owner());
if (obj.IsNull()) {
ASSERT(Dart::vm_snapshot_kind() == Snapshot::kFullAOT);
return Function::null();
@@ -14926,7 +14913,7 @@
if (IsNull()) {
return ICData::null();
}
- Object& obj = Object::Handle(raw_ptr()->owner_);
+ Object& obj = Object::Handle(raw_ptr()->owner());
if (obj.IsFunction()) {
return this->raw();
} else {
@@ -14937,11 +14924,11 @@
void ICData::SetOriginal(const ICData& value) const {
ASSERT(value.IsOriginal());
ASSERT(!value.IsNull());
- StorePointer(&raw_ptr()->owner_, static_cast<ObjectPtr>(value.raw()));
+ raw_ptr()->set_owner(static_cast<ObjectPtr>(value.raw()));
}
void ICData::set_owner(const Function& value) const {
- StorePointer(&raw_ptr()->owner_, static_cast<ObjectPtr>(value.raw()));
+ raw_ptr()->set_owner(static_cast<ObjectPtr>(value.raw()));
}
void ICData::set_deopt_id(intptr_t value) const {
@@ -14955,8 +14942,7 @@
void ICData::set_entries(const Array& value) const {
ASSERT(!value.IsNull());
- StorePointer<ArrayPtr, std::memory_order_release>(&raw_ptr()->entries_,
- value.raw());
+ raw_ptr()->set_entries<std::memory_order_release>(value.raw());
}
intptr_t ICData::NumArgsTested() const {
@@ -15065,7 +15051,7 @@
}
intptr_t ICData::Length() const {
- return (Smi::Value(entries()->ptr()->length_) / TestEntryLength());
+ return (Smi::Value(entries()->ptr()->length()) / TestEntryLength());
}
intptr_t ICData::NumberOfChecks() const {
@@ -15990,7 +15976,7 @@
NoSafepointScope no_safepoint;
result ^= raw;
- result.StorePointer(&result.raw_ptr()->target_, target.raw());
+ result.raw_ptr()->set_target(target.raw());
}
return result.raw();
}
@@ -16091,7 +16077,7 @@
ASSERT(unwrapped_owner.IsFunction() || unwrapped_owner.IsClass() ||
unwrapped_owner.IsAbstractType());
#endif
- StorePointer(&raw_ptr()->owner_, owner.raw());
+ raw_ptr()->set_owner(owner.raw());
}
void Code::set_state_bits(intptr_t bits) const {
@@ -16112,31 +16098,28 @@
void Code::set_compressed_stackmaps(const CompressedStackMaps& maps) const {
ASSERT(maps.IsOld());
- StorePointer(&raw_ptr()->compressed_stackmaps_, maps.raw());
+ raw_ptr()->set_compressed_stackmaps(maps.raw());
}
#if !defined(DART_PRECOMPILED_RUNTIME)
intptr_t Code::num_variables() const {
ASSERT(!FLAG_precompiled_mode);
- return Smi::Value(Smi::RawCast(raw_ptr()->catch_entry_));
+ return Smi::Value(Smi::RawCast(raw_ptr()->catch_entry()));
}
void Code::set_num_variables(intptr_t num_variables) const {
ASSERT(!FLAG_precompiled_mode);
- // Object::RawCast is needed for StorePointer template argument resolution.
- StorePointer(&raw_ptr()->catch_entry_,
- Object::RawCast(Smi::New(num_variables)));
+ raw_ptr()->set_catch_entry(Smi::New(num_variables));
}
#endif
#if defined(DART_PRECOMPILED_RUNTIME) || defined(DART_PRECOMPILER)
TypedDataPtr Code::catch_entry_moves_maps() const {
ASSERT(FLAG_precompiled_mode);
- return TypedData::RawCast(raw_ptr()->catch_entry_);
+ return TypedData::RawCast(raw_ptr()->catch_entry());
}
void Code::set_catch_entry_moves_maps(const TypedData& maps) const {
ASSERT(FLAG_precompiled_mode);
- // Object::RawCast is needed for StorePointer template argument resolution.
- StorePointer(&raw_ptr()->catch_entry_, Object::RawCast(maps.raw()));
+ raw_ptr()->set_catch_entry(maps.raw());
}
#endif
@@ -16145,7 +16128,7 @@
UNREACHABLE();
#else
ASSERT(array.IsOld());
- StorePointer(&raw_ptr()->deopt_info_array_, array.raw());
+ raw_ptr()->set_deopt_info_array(array.raw());
#endif
}
@@ -16153,7 +16136,7 @@
#if defined(DART_PRECOMPILED_RUNTIME)
UNREACHABLE();
#else
- StorePointer(&raw_ptr()->static_calls_target_table_, value.raw());
+ raw_ptr()->set_static_calls_target_table(value.raw());
#endif
#if defined(DEBUG)
// Check that the table is sorted by pc offsets.
@@ -16226,7 +16209,7 @@
UNREACHABLE();
#else
NoSafepointScope no_safepoint;
- const Array& table = Array::Handle(raw_ptr()->static_calls_target_table_);
+ const Array& table = Array::Handle(raw_ptr()->static_calls_target_table());
StaticCallsTable entries(table);
const intptr_t pc_offset = pc - PayloadStart();
intptr_t imin = 0;
@@ -16256,7 +16239,7 @@
if (i < 0) {
return Function::null();
}
- const Array& array = Array::Handle(raw_ptr()->static_calls_target_table_);
+ const Array& array = Array::Handle(raw_ptr()->static_calls_target_table());
StaticCallsTable entries(array);
return entries[i].Get<kSCallTableFunctionTarget>();
#endif
@@ -16268,7 +16251,7 @@
#else
const intptr_t i = BinarySearchInSCallTable(pc);
ASSERT(i >= 0);
- const Array& array = Array::Handle(raw_ptr()->static_calls_target_table_);
+ const Array& array = Array::Handle(raw_ptr()->static_calls_target_table());
StaticCallsTable entries(array);
ASSERT(code.IsNull() ||
(code.function() == entries[i].Get<kSCallTableFunctionTarget>()));
@@ -16282,7 +16265,7 @@
#else
const intptr_t i = BinarySearchInSCallTable(pc);
ASSERT(i >= 0);
- const Array& array = Array::Handle(raw_ptr()->static_calls_target_table_);
+ const Array& array = Array::Handle(raw_ptr()->static_calls_target_table());
StaticCallsTable entries(array);
#if defined(DEBUG)
if (entries[i].Get<kSCallTableFunctionTarget>() == Function::null()) {
@@ -16314,7 +16297,7 @@
#if defined(PRODUCT)
Comments* comments = new Code::Comments(Array::Handle());
#else
- Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments_));
+ Comments* comments = new Code::Comments(Array::Handle(raw_ptr()->comments()));
#endif
return *comments;
}
@@ -16324,7 +16307,7 @@
UNREACHABLE();
#else
ASSERT(comments.comments_.IsOld());
- StorePointer(&raw_ptr()->comments_, comments.comments_.raw());
+ raw_ptr()->set_comments(comments.comments_.raw());
#endif
}
@@ -16333,9 +16316,7 @@
UNREACHABLE();
#else
ASSERT(offset >= 0);
- StoreSmi(
- reinterpret_cast<SmiPtr const*>(&raw_ptr()->return_address_metadata_),
- Smi::New(offset));
+ raw_ptr()->set_return_address_metadata(Smi::New(offset));
#endif
}
@@ -16344,7 +16325,7 @@
UNREACHABLE();
return -1;
#else
- const Object& object = Object::Handle(raw_ptr()->return_address_metadata_);
+ const Object& object = Object::Handle(raw_ptr()->return_address_metadata());
// In the future we may put something other than a smi in
// |return_address_metadata_|.
if (object.IsNull() || !object.IsSmi()) {
@@ -16355,12 +16336,12 @@
}
ArrayPtr Code::inlined_id_to_function() const {
- return raw_ptr()->inlined_id_to_function_;
+ return raw_ptr()->inlined_id_to_function();
}
void Code::set_inlined_id_to_function(const Array& value) const {
ASSERT(value.IsOld());
- StorePointer(&raw_ptr()->inlined_id_to_function_, value.raw());
+ raw_ptr()->set_inlined_id_to_function(value.raw());
}
CodePtr Code::New(intptr_t pointer_offsets_length) {
@@ -16801,7 +16782,7 @@
DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive());
// RawInstructions are never allocated in New space and hence a
// store buffer update is not needed here.
- StorePointer(&raw_ptr()->active_instructions_, instructions.raw());
+ raw_ptr()->set_active_instructions(instructions.raw());
Code::InitializeCachedEntryPointsFrom(raw(), instructions.raw(),
unchecked_offset);
#endif
@@ -17109,22 +17090,22 @@
}
ArrayPtr MegamorphicCache::buckets() const {
- return raw_ptr()->buckets_;
+ return raw_ptr()->buckets();
}
void MegamorphicCache::set_buckets(const Array& buckets) const {
- StorePointer(&raw_ptr()->buckets_, buckets.raw());
+ raw_ptr()->set_buckets(buckets.raw());
}
// Class IDs in the table are smi-tagged, so we use a smi-tagged mask
// and target class ID to avoid untagging (on each iteration of the
// test loop) in generated code.
intptr_t MegamorphicCache::mask() const {
- return Smi::Value(raw_ptr()->mask_);
+ return Smi::Value(raw_ptr()->mask());
}
void MegamorphicCache::set_mask(intptr_t mask) const {
- StoreSmi(&raw_ptr()->mask_, Smi::New(mask));
+ raw_ptr()->set_mask(Smi::New(mask));
}
intptr_t MegamorphicCache::filled_entry_count() const {
@@ -17351,21 +17332,20 @@
ArrayPtr SubtypeTestCache::cache() const {
// We rely on the fact that any loads from the array are dependent loads and
// avoid the load-acquire barrier here.
- return raw_ptr()->cache_;
+ return raw_ptr()->cache<std::memory_order_relaxed>();
}
void SubtypeTestCache::set_cache(const Array& value) const {
// We have to ensure that initializing stores to the array are available
// when releasing the pointer to the array pointer.
// => We have to use store-release here.
- StorePointer<ArrayPtr, std::memory_order_release>(&raw_ptr()->cache_,
- value.raw());
+ raw_ptr()->set_cache<std::memory_order_release>(value.raw());
}
intptr_t SubtypeTestCache::NumberOfChecks() const {
NoSafepointScope no_safepoint;
// Do not count the sentinel;
- return (Smi::Value(cache()->ptr()->length_) / kTestEntryLength) - 1;
+ return (Smi::Value(cache()->ptr()->length()) / kTestEntryLength) - 1;
}
void SubtypeTestCache::AddCheck(
@@ -17632,17 +17612,17 @@
}
LoadingUnitPtr LoadingUnit::parent() const {
- return raw_ptr()->parent_;
+ return raw_ptr()->parent();
}
void LoadingUnit::set_parent(const LoadingUnit& value) const {
- StorePointer(&raw_ptr()->parent_, value.raw());
+ raw_ptr()->set_parent(value.raw());
}
ArrayPtr LoadingUnit::base_objects() const {
- return raw_ptr()->base_objects_;
+ return raw_ptr()->base_objects();
}
void LoadingUnit::set_base_objects(const Array& value) const {
- StorePointer(&raw_ptr()->base_objects_, value.raw());
+ raw_ptr()->set_base_objects(value.raw());
}
const char* LoadingUnit::ToCString() const {
@@ -17724,7 +17704,7 @@
}
void ApiError::set_message(const String& message) const {
- StorePointer(&raw_ptr()->message_, message.raw());
+ raw_ptr()->set_message(message.raw());
}
const char* ApiError::ToErrorCString() const {
@@ -17804,11 +17784,11 @@
}
void LanguageError::set_previous_error(const Error& value) const {
- StorePointer(&raw_ptr()->previous_error_, value.raw());
+ raw_ptr()->set_previous_error(value.raw());
}
void LanguageError::set_script(const Script& value) const {
- StorePointer(&raw_ptr()->script_, value.raw());
+ raw_ptr()->set_script(value.raw());
}
void LanguageError::set_token_pos(TokenPosition token_pos) const {
@@ -17825,11 +17805,11 @@
}
void LanguageError::set_message(const String& value) const {
- StorePointer(&raw_ptr()->message_, value.raw());
+ raw_ptr()->set_message(value.raw());
}
void LanguageError::set_formatted_message(const String& value) const {
- StorePointer(&raw_ptr()->formatted_message_, value.raw());
+ raw_ptr()->set_formatted_message(value.raw());
}
StringPtr LanguageError::FormatMessage() const {
@@ -17891,11 +17871,11 @@
}
void UnhandledException::set_exception(const Instance& exception) const {
- StorePointer(&raw_ptr()->exception_, exception.raw());
+ raw_ptr()->set_exception(exception.raw());
}
void UnhandledException::set_stacktrace(const Instance& stacktrace) const {
- StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw());
+ raw_ptr()->set_stacktrace(stacktrace.raw());
}
const char* UnhandledException::ToErrorCString() const {
@@ -17948,7 +17928,7 @@
}
void UnwindError::set_message(const String& message) const {
- StorePointer(&raw_ptr()->message_, message.raw());
+ raw_ptr()->set_message(message.raw());
}
void UnwindError::set_is_user_initiated(bool value) const {
@@ -19622,7 +19602,7 @@
} else {
StoreNonPointer(&raw_ptr()->type_test_stub_entry_point_, stub.EntryPoint());
}
- StorePointer(&raw_ptr()->type_test_stub_, stub.raw());
+ raw_ptr()->set_type_test_stub(stub.raw());
}
TypePtr Type::NullType() {
@@ -19784,20 +19764,20 @@
}
FunctionPtr Type::signature() const {
- intptr_t cid = raw_ptr()->signature_->GetClassId();
+ intptr_t cid = raw_ptr()->signature()->GetClassId();
if (cid == kNullCid) {
return Function::null();
}
ASSERT(cid == kFunctionCid);
- return Function::RawCast(raw_ptr()->signature_);
+ return Function::RawCast(raw_ptr()->signature());
}
void Type::set_signature(const Function& value) const {
- StorePointer(&raw_ptr()->signature_, value.raw());
+ raw_ptr()->set_signature(value.raw());
}
classid_t Type::type_class_id() const {
- return Smi::Value(raw_ptr()->type_class_id_);
+ return Smi::Value(raw_ptr()->type_class_id());
}
ClassPtr Type::type_class() const {
@@ -20375,12 +20355,12 @@
void Type::set_type_class(const Class& value) const {
ASSERT(!value.IsNull());
- StorePointer(&raw_ptr()->type_class_id_, Smi::New(value.id()));
+ raw_ptr()->set_type_class_id(Smi::New(value.id()));
}
void Type::set_arguments(const TypeArguments& value) const {
ASSERT(!IsCanonical());
- StorePointer(&raw_ptr()->arguments_, value.raw());
+ raw_ptr()->set_arguments(value.raw());
}
TypePtr Type::New(Heap::Space space) {
@@ -20527,7 +20507,7 @@
void TypeRef::set_type(const AbstractType& value) const {
ASSERT(value.IsNull() || value.IsFunctionType() || value.HasTypeClass());
ASSERT(!value.IsTypeRef());
- StorePointer(&raw_ptr()->type_, value.raw());
+ raw_ptr()->set_type(value.raw());
}
// A TypeRef cannot be canonical by definition. Only its referenced type can be.
@@ -20782,7 +20762,7 @@
}
void TypeParameter::set_parameterized_function(const Function& value) const {
- StorePointer(&raw_ptr()->parameterized_function_, value.raw());
+ raw_ptr()->set_parameterized_function(value.raw());
}
void TypeParameter::set_index(intptr_t value) const {
@@ -20793,15 +20773,15 @@
void TypeParameter::set_name(const String& value) const {
ASSERT(value.IsSymbol());
- StorePointer(&raw_ptr()->name_, value.raw());
+ raw_ptr()->set_name(value.raw());
}
void TypeParameter::set_bound(const AbstractType& value) const {
- StorePointer(&raw_ptr()->bound_, value.raw());
+ raw_ptr()->set_bound(value.raw());
}
void TypeParameter::set_default_argument(const AbstractType& value) const {
- StorePointer(&raw_ptr()->default_argument_, value.raw());
+ raw_ptr()->set_default_argument(value.raw());
}
AbstractTypePtr TypeParameter::GetFromTypeArguments(
@@ -21690,7 +21670,7 @@
intptr_t String::Hash(StringPtr raw) {
StringHasher hasher;
- uword length = Smi::Value(raw->ptr()->length_);
+ uword length = Smi::Value(raw->ptr()->length());
if (raw->IsOneByteString() || raw->IsExternalOneByteString()) {
const uint8_t* data;
if (raw->IsOneByteString()) {
@@ -22687,9 +22667,9 @@
OneByteString::InstanceSize(len), space);
NoSafepointScope no_safepoint;
OneByteStringPtr result = static_cast<OneByteStringPtr>(raw);
- result->ptr()->StoreSmi(&(result->ptr()->length_), Smi::New(len));
+ result->ptr()->set_length(Smi::New(len));
#if !defined(HASH_IN_OBJECT_HEADER)
- result->ptr()->StoreSmi(&(result->ptr()->hash_), Smi::New(0));
+ result->ptr()->set_hash(Smi::New(0));
#endif
return result;
}
@@ -23199,7 +23179,7 @@
ArrayPtr raw = static_cast<ArrayPtr>(
Object::Allocate(class_id, Array::InstanceSize(len), space));
NoSafepointScope no_safepoint;
- raw->ptr()->StoreSmi(&(raw->ptr()->length_), Smi::New(len));
+ raw->ptr()->set_length(Smi::New(len));
return raw;
}
}
@@ -23386,7 +23366,7 @@
const Array& contents = Array::Handle(data());
const Array& new_contents =
Array::Handle(Array::Grow(contents, new_capacity, space));
- StorePointer(&(raw_ptr()->data_), new_contents.raw());
+ raw_ptr()->set_data(new_contents.raw());
}
ObjectPtr GrowableObjectArray::RemoveLast() const {
@@ -24003,11 +23983,10 @@
ReceivePort::InstanceSize(), space);
NoSafepointScope no_safepoint;
result ^= raw;
- result.StorePointer(&result.raw_ptr()->send_port_, send_port.raw());
+ result.raw_ptr()->set_send_port(send_port.raw());
#if !defined(PRODUCT)
- result.StorePointer(&result.raw_ptr()->debug_name_, debug_name.raw());
- result.StorePointer(&result.raw_ptr()->allocation_location_,
- allocation_location_.raw());
+ result.raw_ptr()->set_debug_name(debug_name.raw());
+ result.raw_ptr()->set_allocation_location(allocation_location_.raw());
#endif // !defined(PRODUCT)
}
if (is_control_port) {
@@ -24195,14 +24174,13 @@
Object::Allocate(Closure::kClassId, Closure::InstanceSize(), space);
NoSafepointScope no_safepoint;
result ^= raw;
- result.StorePointer(&result.raw_ptr()->instantiator_type_arguments_,
- instantiator_type_arguments.raw());
- result.StorePointer(&result.raw_ptr()->function_type_arguments_,
- function_type_arguments.raw());
- result.StorePointer(&result.raw_ptr()->delayed_type_arguments_,
- delayed_type_arguments.raw());
- result.StorePointer(&result.raw_ptr()->function_, function.raw());
- result.StorePointer(&result.raw_ptr()->context_, context.raw());
+ result.raw_ptr()->set_instantiator_type_arguments(
+ instantiator_type_arguments.raw());
+ result.raw_ptr()->set_function_type_arguments(
+ function_type_arguments.raw());
+ result.raw_ptr()->set_delayed_type_arguments(delayed_type_arguments.raw());
+ result.raw_ptr()->set_function(function.raw());
+ result.raw_ptr()->set_context(context.raw());
}
return result.raw();
}
@@ -24250,42 +24228,42 @@
}
intptr_t StackTrace::Length() const {
- const Array& code_array = Array::Handle(raw_ptr()->code_array_);
+ const Array& code_array = Array::Handle(raw_ptr()->code_array());
return code_array.Length();
}
ObjectPtr StackTrace::CodeAtFrame(intptr_t frame_index) const {
- const Array& code_array = Array::Handle(raw_ptr()->code_array_);
+ const Array& code_array = Array::Handle(raw_ptr()->code_array());
return code_array.At(frame_index);
}
void StackTrace::SetCodeAtFrame(intptr_t frame_index,
const Object& code) const {
- const Array& code_array = Array::Handle(raw_ptr()->code_array_);
+ const Array& code_array = Array::Handle(raw_ptr()->code_array());
code_array.SetAt(frame_index, code);
}
SmiPtr StackTrace::PcOffsetAtFrame(intptr_t frame_index) const {
- const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
+ const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array());
return static_cast<SmiPtr>(pc_offset_array.At(frame_index));
}
void StackTrace::SetPcOffsetAtFrame(intptr_t frame_index,
const Smi& pc_offset) const {
- const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
+ const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array());
pc_offset_array.SetAt(frame_index, pc_offset);
}
void StackTrace::set_async_link(const StackTrace& async_link) const {
- StorePointer(&raw_ptr()->async_link_, async_link.raw());
+ raw_ptr()->set_async_link(async_link.raw());
}
void StackTrace::set_code_array(const Array& code_array) const {
- StorePointer(&raw_ptr()->code_array_, code_array.raw());
+ raw_ptr()->set_code_array(code_array.raw());
}
void StackTrace::set_pc_offset_array(const Array& pc_offset_array) const {
- StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw());
+ raw_ptr()->set_pc_offset_array(pc_offset_array.raw());
}
void StackTrace::set_expand_inlined(bool value) const {
@@ -24611,7 +24589,7 @@
"symbolize stack traces in the precompiled runtime.");
void RegExp::set_pattern(const String& pattern) const {
- StorePointer(&raw_ptr()->pattern_, pattern.raw());
+ raw_ptr()->set_pattern(pattern.raw());
}
void RegExp::set_function(intptr_t cid,
@@ -24625,25 +24603,25 @@
const TypedData& bytecode) const {
if (sticky) {
if (is_one_byte) {
- StorePointer(&raw_ptr()->one_byte_sticky_.bytecode_, bytecode.raw());
+ raw_ptr()->set_one_byte_sticky(bytecode.raw());
} else {
- StorePointer(&raw_ptr()->two_byte_sticky_.bytecode_, bytecode.raw());
+ raw_ptr()->set_two_byte_sticky(bytecode.raw());
}
} else {
if (is_one_byte) {
- StorePointer(&raw_ptr()->one_byte_.bytecode_, bytecode.raw());
+ raw_ptr()->set_one_byte(bytecode.raw());
} else {
- StorePointer(&raw_ptr()->two_byte_.bytecode_, bytecode.raw());
+ raw_ptr()->set_two_byte(bytecode.raw());
}
}
}
void RegExp::set_num_bracket_expressions(intptr_t value) const {
- StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value));
+ raw_ptr()->set_num_bracket_expressions(Smi::New(value));
}
void RegExp::set_capture_name_map(const Array& array) const {
- StorePointer(&raw_ptr()->capture_name_map_, array.raw());
+ raw_ptr()->set_capture_name_map(array.raw());
}
RegExpPtr RegExp::New(Heap::Space space) {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index ada80f9..59377eb 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -229,9 +229,9 @@
#define HEAP_OBJECT_IMPLEMENTATION(object, super) \
OBJECT_IMPLEMENTATION(object, super); \
- const object##Layout* raw_ptr() const { \
+ object##Layout* raw_ptr() const { \
ASSERT(raw() != null()); \
- return raw()->ptr(); \
+ return const_cast<object##Layout*>(raw()->ptr()); \
} \
SNAPSHOT_READER_SUPPORT(object) \
friend class StackFrame; \
@@ -253,9 +253,9 @@
object() : super() {} \
BASE_OBJECT_IMPLEMENTATION(object, super) \
OBJECT_SERVICE_SUPPORT(object) \
- const object##Layout* raw_ptr() const { \
+ object##Layout* raw_ptr() const { \
ASSERT(raw() != null()); \
- return raw()->ptr(); \
+ return const_cast<object##Layout*>(raw()->ptr()); \
} \
static intptr_t NextFieldOffset() { return -kWordSize; } \
SNAPSHOT_READER_SUPPORT(rettype) \
@@ -1041,7 +1041,7 @@
virtual StringPtr DictionaryName() const { return Name(); }
- ScriptPtr script() const { return raw_ptr()->script_; }
+ ScriptPtr script() const { return raw_ptr()->script(); }
void set_script(const Script& value) const;
TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
@@ -1053,7 +1053,7 @@
// This class represents a typedef if the signature function is not null.
FunctionPtr signature_function() const {
- return raw_ptr()->signature_function_;
+ return raw_ptr()->signature_function();
}
void set_signature_function(const Function& value) const;
@@ -1076,14 +1076,14 @@
return OFFSET_OF(ClassLayout, declaration_type_);
}
- LibraryPtr library() const { return raw_ptr()->library_; }
+ LibraryPtr library() const { return raw_ptr()->library(); }
void set_library(const Library& value) const;
// The type parameters (and their bounds) are specified as an array of
// TypeParameter.
TypeArgumentsPtr type_parameters() const {
ASSERT(is_declaration_loaded());
- return raw_ptr()->type_parameters_;
+ return raw_ptr()->type_parameters();
}
void set_type_parameters(const TypeArguments& value) const;
intptr_t NumTypeParameters(Thread* thread) const;
@@ -1171,7 +1171,7 @@
// The super type of this class, Object type if not explicitly specified.
AbstractTypePtr super_type() const {
ASSERT(is_declaration_loaded());
- return raw_ptr()->super_type_;
+ return raw_ptr()->super_type();
}
void set_super_type(const AbstractType& value) const;
static intptr_t super_type_offset() {
@@ -1187,7 +1187,7 @@
// Interfaces is an array of Types.
ArrayPtr interfaces() const {
ASSERT(is_declaration_loaded());
- return raw_ptr()->interfaces_;
+ return raw_ptr()->interfaces();
}
void set_interfaces(const Array& value) const;
@@ -1195,7 +1195,7 @@
GrowableObjectArrayPtr direct_implementors() const {
DEBUG_ASSERT(
IsolateGroup::Current()->program_lock()->IsCurrentThreadReader());
- return raw_ptr()->direct_implementors_;
+ return raw_ptr()->direct_implementors();
}
void AddDirectImplementor(const Class& subclass, bool is_mixin) const;
void ClearDirectImplementors() const;
@@ -1207,7 +1207,7 @@
return direct_subclasses_unsafe();
}
GrowableObjectArrayPtr direct_subclasses_unsafe() const {
- return raw_ptr()->direct_subclasses_;
+ return raw_ptr()->direct_subclasses();
}
void AddDirectSubclass(const Class& subclass) const;
void ClearDirectSubclasses() const;
@@ -1249,7 +1249,7 @@
static bool IsInFullSnapshot(ClassPtr cls) {
NoSafepointScope no_safepoint;
return LibraryLayout::InFullSnapshotBit::decode(
- cls->ptr()->library_->ptr()->flags_);
+ cls->ptr()->library()->ptr()->flags_);
}
// Returns true if the type specified by cls, type_arguments, and nullability
@@ -1273,7 +1273,7 @@
ArrayPtr fields() const {
// We rely on the fact that any loads from the array are dependent loads
// and avoid the load-acquire barrier here.
- return raw_ptr()->fields_;
+ return raw_ptr()->fields();
}
void SetFields(const Array& value) const;
void AddField(const Field& field) const;
@@ -1297,7 +1297,7 @@
ArrayPtr current_functions() const {
// We rely on the fact that any loads from the array are dependent loads
// and avoid the load-acquire barrier here.
- return raw_ptr()->functions_;
+ return raw_ptr()->functions();
}
ArrayPtr functions() const {
DEBUG_ASSERT(
@@ -1429,7 +1429,7 @@
StoreNonPointer(&raw_ptr()->num_native_fields_, value);
}
- CodePtr allocation_stub() const { return raw_ptr()->allocation_stub_; }
+ CodePtr allocation_stub() const { return raw_ptr()->allocation_stub(); }
void set_allocation_stub(const Code& value) const;
intptr_t kernel_offset() const {
@@ -1600,7 +1600,7 @@
}
private:
- TypePtr declaration_type() const { return raw_ptr()->declaration_type_; }
+ TypePtr declaration_type() const { return raw_ptr()->declaration_type(); }
// Caches the declaration type of this class.
void set_declaration_type(const Type& type) const;
@@ -1752,11 +1752,11 @@
class PatchClass : public Object {
public:
- ClassPtr patched_class() const { return raw_ptr()->patched_class_; }
- ClassPtr origin_class() const { return raw_ptr()->origin_class_; }
- ScriptPtr script() const { return raw_ptr()->script_; }
+ ClassPtr patched_class() const { return raw_ptr()->patched_class(); }
+ ClassPtr origin_class() const { return raw_ptr()->origin_class(); }
+ ScriptPtr script() const { return raw_ptr()->script(); }
ExternalTypedDataPtr library_kernel_data() const {
- return raw_ptr()->library_kernel_data_;
+ return raw_ptr()->library_kernel_data();
}
void set_library_kernel_data(const ExternalTypedData& data) const;
@@ -1777,7 +1777,7 @@
}
static bool IsInFullSnapshot(PatchClassPtr cls) {
NoSafepointScope no_safepoint;
- return Class::IsInFullSnapshot(cls->ptr()->patched_class_);
+ return Class::IsInFullSnapshot(cls->ptr()->patched_class());
}
static PatchClassPtr New(const Class& patched_class,
@@ -1798,7 +1798,7 @@
class SingleTargetCache : public Object {
public:
- CodePtr target() const { return raw_ptr()->target_; }
+ CodePtr target() const { return raw_ptr()->target(); }
void set_target(const Code& target) const;
static intptr_t target_offset() {
return OFFSET_OF(SingleTargetCacheLayout, target_);
@@ -1831,7 +1831,7 @@
class MonomorphicSmiableCall : public Object {
public:
- CodePtr target() const { return raw_ptr()->target_; }
+ CodePtr target() const { return raw_ptr()->target(); }
classid_t expected_cid() const { return raw_ptr()->expected_cid_; }
static intptr_t InstanceSize() {
@@ -1860,8 +1860,8 @@
class CallSiteData : public Object {
public:
- StringPtr target_name() const { return raw_ptr()->target_name_; }
- ArrayPtr arguments_descriptor() const { return raw_ptr()->args_descriptor_; }
+ StringPtr target_name() const { return raw_ptr()->target_name(); }
+ ArrayPtr arguments_descriptor() const { return raw_ptr()->args_descriptor(); }
intptr_t TypeArgsLen() const;
@@ -1945,7 +1945,7 @@
#if !defined(DART_PRECOMPILED_RUNTIME)
AbstractTypePtr receivers_static_type() const {
- return raw_ptr()->receivers_static_type_;
+ return raw_ptr()->receivers_static_type();
}
bool is_tracking_exactness() const {
return TrackingExactnessBit::decode(raw_ptr()->state_bits_);
@@ -2240,8 +2240,7 @@
intptr_t FindCheck(const GrowableArray<intptr_t>& cids) const;
ArrayPtr entries() const {
- return LoadPointer<ArrayPtr, std::memory_order_acquire>(
- &raw_ptr()->entries_);
+ return raw_ptr()->entries<std::memory_order_acquire>();
}
bool receiver_cannot_be_smi() const {
@@ -2446,7 +2445,7 @@
class Function : public Object {
public:
- StringPtr name() const { return raw_ptr()->name_; }
+ StringPtr name() const { return raw_ptr()->name(); }
StringPtr UserVisibleName() const; // Same as scrubbed name.
const char* UserVisibleNameCString() const;
@@ -2543,7 +2542,7 @@
void set_owner(const Object& value) const;
ClassPtr origin() const;
ScriptPtr script() const;
- ObjectPtr RawOwner() const { return raw_ptr()->owner_; }
+ ObjectPtr RawOwner() const { return raw_ptr()->owner(); }
// The NNBD mode of the library declaring this function.
// TODO(alexmarkov): nnbd_mode() doesn't work for mixins.
@@ -2560,7 +2559,7 @@
StringPtr native_name() const;
void set_native_name(const String& name) const;
- AbstractTypePtr result_type() const { return raw_ptr()->result_type_; }
+ AbstractTypePtr result_type() const { return raw_ptr()->result_type(); }
void set_result_type(const AbstractType& value) const;
// The parameters, starting with NumImplicitParameters() parameters which are
@@ -2568,7 +2567,7 @@
// Note that type checks exclude implicit parameters.
AbstractTypePtr ParameterTypeAt(intptr_t index) const;
void SetParameterTypeAt(intptr_t index, const AbstractType& value) const;
- ArrayPtr parameter_types() const { return raw_ptr()->parameter_types_; }
+ ArrayPtr parameter_types() const { return raw_ptr()->parameter_types(); }
void set_parameter_types(const Array& value) const;
static intptr_t parameter_types_offset() {
return OFFSET_OF(FunctionLayout, parameter_types_);
@@ -2581,7 +2580,7 @@
// elements are the names.
StringPtr ParameterNameAt(intptr_t index) const;
void SetParameterNameAt(intptr_t index, const String& value) const;
- ArrayPtr parameter_names() const { return raw_ptr()->parameter_names_; }
+ ArrayPtr parameter_names() const { return raw_ptr()->parameter_names(); }
static intptr_t parameter_names_offset() {
return OFFSET_OF(FunctionLayout, parameter_names_);
}
@@ -2607,7 +2606,7 @@
// The type parameters (and their bounds) are specified as an array of
// TypeParameter.
TypeArgumentsPtr type_parameters() const {
- return raw_ptr()->type_parameters_;
+ return raw_ptr()->type_parameters();
}
void set_type_parameters(const TypeArguments& value) const;
static intptr_t type_parameters_offset() {
@@ -2672,14 +2671,14 @@
bool SafeToClosurize() const;
static CodePtr CurrentCodeOf(const FunctionPtr function) {
- return function->ptr()->code_;
+ return function->ptr()->code();
}
CodePtr unoptimized_code() const {
#if defined(DART_PRECOMPILED_RUNTIME)
return static_cast<CodePtr>(Object::null());
#else
- return raw_ptr()->unoptimized_code_;
+ return raw_ptr()->unoptimized_code();
#endif
}
void set_unoptimized_code(const Code& value) const;
@@ -3891,11 +3890,11 @@
private:
// Enclosing function of this signature function.
- FunctionPtr parent_function() const { return raw_ptr()->parent_function_; }
+ FunctionPtr parent_function() const { return raw_ptr()->parent_function(); }
void set_parent_function(const Function& value) const;
// Signature type of this signature function.
- TypePtr signature_type() const { return raw_ptr()->signature_type_; }
+ TypePtr signature_type() const { return raw_ptr()->signature_type(); }
void set_signature_type(const Type& value) const;
static SignatureDataPtr New(Heap::Space space = Heap::kOld);
@@ -3922,17 +3921,17 @@
private:
// Signature type of this closure function.
- TypePtr signature_type() const { return raw_ptr()->signature_type_; }
+ TypePtr signature_type() const { return raw_ptr()->signature_type(); }
void set_signature_type(const Type& value) const;
- FunctionPtr c_signature() const { return raw_ptr()->c_signature_; }
+ FunctionPtr c_signature() const { return raw_ptr()->c_signature(); }
void set_c_signature(const Function& value) const;
- FunctionPtr callback_target() const { return raw_ptr()->callback_target_; }
+ FunctionPtr callback_target() const { return raw_ptr()->callback_target(); }
void set_callback_target(const Function& value) const;
InstancePtr callback_exceptional_return() const {
- return raw_ptr()->callback_exceptional_return_;
+ return raw_ptr()->callback_exceptional_return();
}
void set_callback_exceptional_return(const Instance& value) const;
@@ -3963,7 +3962,7 @@
return true;
}
NoSafepointScope no_safepoint;
- return !raw_ptr()->owner_->IsField();
+ return !raw_ptr()->owner()->IsField();
}
// Returns whether fields must be cloned via [CloneFromOriginal] for the
@@ -3974,7 +3973,7 @@
// original field of result.
FieldPtr CloneFromOriginal() const;
- StringPtr name() const { return raw_ptr()->name_; }
+ StringPtr name() const { return raw_ptr()->name(); }
StringPtr UserVisibleName() const; // Same as scrubbed name.
const char* UserVisibleNameCString() const;
virtual StringPtr DictionaryName() const { return name(); }
@@ -4086,7 +4085,7 @@
ScriptPtr Script() const;
ObjectPtr RawOwner() const;
- AbstractTypePtr type() const { return raw_ptr()->type_; }
+ AbstractTypePtr type() const { return raw_ptr()->type(); }
// Used by class finalizer, otherwise initialized in constructor.
void SetFieldType(const AbstractType& value) const;
@@ -4345,7 +4344,7 @@
FunctionPtr InitializerFunction() const {
// We rely on the fact that any loads from the initializer function
// are dependent loads and avoid the load-acquire barrier here.
- return raw_ptr()->initializer_function_;
+ return raw_ptr()->initializer_function<std::memory_order_relaxed>();
}
void SetInitializerFunction(const Function& initializer) const;
bool HasInitializerFunction() const;
@@ -4377,7 +4376,7 @@
#if !defined(DART_PRECOMPILED_RUNTIME)
SubtypeTestCachePtr type_test_cache() const {
- return raw_ptr()->type_test_cache_;
+ return raw_ptr()->type_test_cache();
}
void set_type_test_cache(const SubtypeTestCache& cache) const;
#endif
@@ -4469,7 +4468,7 @@
set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_));
}
void set_owner(const Object& value) const {
- StorePointer(&raw_ptr()->owner_, value.raw());
+ raw_ptr()->set_owner(value.raw());
}
void set_token_pos(TokenPosition token_pos) const {
StoreNonPointer(&raw_ptr()->token_pos_, token_pos);
@@ -4493,11 +4492,11 @@
class Script : public Object {
public:
- StringPtr url() const { return raw_ptr()->url_; }
+ StringPtr url() const { return raw_ptr()->url(); }
void set_url(const String& value) const;
// The actual url which was loaded from disk, if provided by the embedder.
- StringPtr resolved_url() const { return raw_ptr()->resolved_url_; }
+ StringPtr resolved_url() const { return raw_ptr()->resolved_url(); }
bool HasSource() const;
StringPtr Source() const;
bool IsPartOfDartColonLibrary() const;
@@ -4512,12 +4511,12 @@
int64_t load_timestamp() const { return raw_ptr()->load_timestamp_; }
ArrayPtr compile_time_constants() const {
- return raw_ptr()->compile_time_constants_;
+ return raw_ptr()->compile_time_constants();
}
void set_compile_time_constants(const Array& value) const;
KernelProgramInfoPtr kernel_program_info() const {
- return raw_ptr()->kernel_program_info_;
+ return raw_ptr()->kernel_program_info();
}
void set_kernel_program_info(const KernelProgramInfo& info) const;
@@ -4640,11 +4639,11 @@
class Library : public Object {
public:
- StringPtr name() const { return raw_ptr()->name_; }
+ StringPtr name() const { return raw_ptr()->name(); }
void SetName(const String& name) const;
- StringPtr url() const { return raw_ptr()->url_; }
- StringPtr private_key() const { return raw_ptr()->private_key_; }
+ StringPtr url() const { return raw_ptr()->url(); }
+ StringPtr private_key() const { return raw_ptr()->private_key(); }
bool LoadNotStarted() const {
return raw_ptr()->load_state_ == LibraryLayout::kAllocated;
}
@@ -4661,7 +4660,7 @@
}
void SetLoaded() const;
- LoadingUnitPtr loading_unit() const { return raw_ptr()->loading_unit_; }
+ LoadingUnitPtr loading_unit() const { return raw_ptr()->loading_unit(); }
void set_loading_unit(const LoadingUnit& value) const;
static intptr_t InstanceSize() {
@@ -4772,22 +4771,22 @@
const String& pragma_name,
Object* options);
- ClassPtr toplevel_class() const { return raw_ptr()->toplevel_class_; }
+ ClassPtr toplevel_class() const { return raw_ptr()->toplevel_class(); }
void set_toplevel_class(const Class& value) const;
GrowableObjectArrayPtr used_scripts() const {
- return raw_ptr()->used_scripts_;
+ return raw_ptr()->used_scripts();
}
// Library imports.
- ArrayPtr imports() const { return raw_ptr()->imports_; }
- ArrayPtr exports() const { return raw_ptr()->exports_; }
+ ArrayPtr imports() const { return raw_ptr()->imports(); }
+ ArrayPtr exports() const { return raw_ptr()->exports(); }
void AddImport(const Namespace& ns) const;
intptr_t num_imports() const { return raw_ptr()->num_imports_; }
NamespacePtr ImportAt(intptr_t index) const;
LibraryPtr ImportLibraryAt(intptr_t index) const;
- ArrayPtr dependencies() const { return raw_ptr()->dependencies_; }
+ ArrayPtr dependencies() const { return raw_ptr()->dependencies(); }
void set_dependencies(const Array& deps) const;
void DropDependenciesAndCaches() const;
@@ -4873,7 +4872,7 @@
inline intptr_t UrlHash() const;
- ExternalTypedDataPtr kernel_data() const { return raw_ptr()->kernel_data_; }
+ ExternalTypedDataPtr kernel_data() const { return raw_ptr()->kernel_data(); }
void set_kernel_data(const ExternalTypedData& data) const;
intptr_t kernel_offset() const {
@@ -4978,13 +4977,13 @@
void set_num_imports(intptr_t value) const;
void set_flags(uint8_t flags) const;
bool HasExports() const;
- ArrayPtr loaded_scripts() const { return raw_ptr()->loaded_scripts_; }
- GrowableObjectArrayPtr metadata() const { return raw_ptr()->metadata_; }
+ ArrayPtr loaded_scripts() const { return raw_ptr()->loaded_scripts(); }
+ GrowableObjectArrayPtr metadata() const { return raw_ptr()->metadata(); }
void set_metadata(const GrowableObjectArray& value) const;
- ArrayPtr dictionary() const { return raw_ptr()->dictionary_; }
+ ArrayPtr dictionary() const { return raw_ptr()->dictionary(); }
void InitClassDictionary() const;
- ArrayPtr resolved_names() const { return raw_ptr()->resolved_names_; }
+ ArrayPtr resolved_names() const { return raw_ptr()->resolved_names(); }
bool LookupResolvedNamesCache(const String& name, Object* obj) const;
void AddToResolvedNamesCache(const String& name, const Object& obj) const;
void InitResolvedNamesCache() const;
@@ -4992,7 +4991,7 @@
void InvalidateResolvedName(const String& name) const;
void InvalidateResolvedNamesCache() const;
- ArrayPtr exported_names() const { return raw_ptr()->exported_names_; }
+ ArrayPtr exported_names() const { return raw_ptr()->exported_names(); }
bool LookupExportedNamesCache(const String& name, Object* obj) const;
void AddToExportedNamesCache(const String& name, const Object& obj) const;
void InitExportedNamesCache() const;
@@ -5032,9 +5031,9 @@
// the show/hide combinators.
class Namespace : public Object {
public:
- LibraryPtr library() const { return raw_ptr()->library_; }
- ArrayPtr show_names() const { return raw_ptr()->show_names_; }
- ArrayPtr hide_names() const { return raw_ptr()->hide_names_; }
+ LibraryPtr library() const { return raw_ptr()->library(); }
+ ArrayPtr show_names() const { return raw_ptr()->show_names(); }
+ ArrayPtr hide_names() const { return raw_ptr()->hide_names(); }
void AddMetadata(const Object& owner,
TokenPosition token_pos,
@@ -5056,7 +5055,7 @@
private:
static NamespacePtr New();
- FieldPtr metadata_field() const { return raw_ptr()->metadata_field_; }
+ FieldPtr metadata_field() const { return raw_ptr()->metadata_field(); }
void set_metadata_field(const Field& value) const;
FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object);
@@ -5082,30 +5081,30 @@
return RoundedAllocationSize(sizeof(KernelProgramInfoLayout));
}
- TypedDataPtr string_offsets() const { return raw_ptr()->string_offsets_; }
+ TypedDataPtr string_offsets() const { return raw_ptr()->string_offsets(); }
- ExternalTypedDataPtr string_data() const { return raw_ptr()->string_data_; }
+ ExternalTypedDataPtr string_data() const { return raw_ptr()->string_data(); }
- TypedDataPtr canonical_names() const { return raw_ptr()->canonical_names_; }
+ TypedDataPtr canonical_names() const { return raw_ptr()->canonical_names(); }
ExternalTypedDataPtr metadata_payloads() const {
- return raw_ptr()->metadata_payloads_;
+ return raw_ptr()->metadata_payloads();
}
ExternalTypedDataPtr metadata_mappings() const {
- return raw_ptr()->metadata_mappings_;
+ return raw_ptr()->metadata_mappings();
}
ExternalTypedDataPtr constants_table() const {
- return raw_ptr()->constants_table_;
+ return raw_ptr()->constants_table();
}
void set_constants_table(const ExternalTypedData& value) const;
- ArrayPtr scripts() const { return raw_ptr()->scripts_; }
+ ArrayPtr scripts() const { return raw_ptr()->scripts(); }
void set_scripts(const Array& scripts) const;
- ArrayPtr constants() const { return raw_ptr()->constants_; }
+ ArrayPtr constants() const { return raw_ptr()->constants(); }
void set_constants(const Array& constants) const;
uint32_t kernel_binary_version() const {
@@ -5119,26 +5118,26 @@
//
// This array will hold the functions which might need their native name set.
GrowableObjectArrayPtr potential_natives() const {
- return raw_ptr()->potential_natives_;
+ return raw_ptr()->potential_natives();
}
void set_potential_natives(const GrowableObjectArray& candidates) const;
GrowableObjectArrayPtr potential_pragma_functions() const {
- return raw_ptr()->potential_pragma_functions_;
+ return raw_ptr()->potential_pragma_functions();
}
void set_potential_pragma_functions(
const GrowableObjectArray& candidates) const;
ScriptPtr ScriptAt(intptr_t index) const;
- ArrayPtr libraries_cache() const { return raw_ptr()->libraries_cache_; }
+ ArrayPtr libraries_cache() const { return raw_ptr()->libraries_cache(); }
void set_libraries_cache(const Array& cache) const;
LibraryPtr LookupLibrary(Thread* thread, const Smi& name_index) const;
LibraryPtr InsertLibrary(Thread* thread,
const Smi& name_index,
const Library& lib) const;
- ArrayPtr classes_cache() const { return raw_ptr()->classes_cache_; }
+ ArrayPtr classes_cache() const { return raw_ptr()->classes_cache(); }
void set_classes_cache(const Array& cache) const;
ClassPtr LookupClass(Thread* thread, const Smi& name_index) const;
ClassPtr InsertClass(Thread* thread,
@@ -5968,8 +5967,8 @@
return Object::null();
#else
// Outside the precompiled runtime, they should always have a target.
- ASSERT(raw->ptr()->target_ != Object::null());
- return raw->ptr()->target_;
+ ASSERT(raw->ptr()->target() != Object::null());
+ return raw->ptr()->target();
#endif
}
@@ -6053,14 +6052,14 @@
UNREACHABLE();
return NULL;
#else
- return raw_ptr()->active_instructions_;
+ return raw_ptr()->active_instructions();
#endif
}
// When dual mapping, these return the executable view.
- InstructionsPtr instructions() const { return raw_ptr()->instructions_; }
+ InstructionsPtr instructions() const { return raw_ptr()->instructions(); }
static InstructionsPtr InstructionsOf(const CodePtr code) {
- return code->ptr()->instructions_;
+ return code->ptr()->instructions();
}
static intptr_t saved_instructions_offset() {
@@ -6087,7 +6086,7 @@
}
}
- ObjectPoolPtr object_pool() const { return raw_ptr()->object_pool_; }
+ ObjectPoolPtr object_pool() const { return raw_ptr()->object_pool(); }
static intptr_t object_pool_offset() {
return OFFSET_OF(CodeLayout, object_pool_);
}
@@ -6193,19 +6192,21 @@
// Returns true if there is a debugger breakpoint set in this code object.
bool HasBreakpoint() const;
- PcDescriptorsPtr pc_descriptors() const { return raw_ptr()->pc_descriptors_; }
+ PcDescriptorsPtr pc_descriptors() const {
+ return raw_ptr()->pc_descriptors();
+ }
void set_pc_descriptors(const PcDescriptors& descriptors) const {
ASSERT(descriptors.IsOld());
- StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw());
+ raw_ptr()->set_pc_descriptors(descriptors.raw());
}
CodeSourceMapPtr code_source_map() const {
- return raw_ptr()->code_source_map_;
+ return raw_ptr()->code_source_map();
}
void set_code_source_map(const CodeSourceMap& code_source_map) const {
ASSERT(code_source_map.IsOld());
- StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw());
+ raw_ptr()->set_code_source_map(code_source_map.raw());
}
// Array of DeoptInfo objects.
@@ -6214,7 +6215,7 @@
UNREACHABLE();
return NULL;
#else
- return raw_ptr()->deopt_info_array_;
+ return raw_ptr()->deopt_info_array();
#endif
}
void set_deopt_info_array(const Array& array) const;
@@ -6230,7 +6231,7 @@
#endif
CompressedStackMapsPtr compressed_stackmaps() const {
- return raw_ptr()->compressed_stackmaps_;
+ return raw_ptr()->compressed_stackmaps();
}
void set_compressed_stackmaps(const CompressedStackMaps& maps) const;
@@ -6270,7 +6271,7 @@
UNREACHABLE();
return NULL;
#else
- return raw_ptr()->static_calls_target_table_;
+ return raw_ptr()->static_calls_target_table();
#endif
}
@@ -6323,7 +6324,7 @@
UNREACHABLE();
return NULL;
#else
- return raw_ptr()->return_address_metadata_;
+ return raw_ptr()->return_address_metadata();
#endif
}
// Sets |return_address_metadata|.
@@ -6364,7 +6365,7 @@
UNREACHABLE();
return NULL;
#else
- return raw_ptr()->var_descriptors_;
+ return raw_ptr()->var_descriptors();
#endif
}
void set_var_descriptors(const LocalVarDescriptors& value) const {
@@ -6372,7 +6373,7 @@
UNREACHABLE();
#else
ASSERT(value.IsOld());
- StorePointer(&raw_ptr()->var_descriptors_, value.raw());
+ raw_ptr()->set_var_descriptors(value.raw());
#endif
}
@@ -6380,11 +6381,11 @@
LocalVarDescriptorsPtr GetLocalVarDescriptors() const;
ExceptionHandlersPtr exception_handlers() const {
- return raw_ptr()->exception_handlers_;
+ return raw_ptr()->exception_handlers();
}
void set_exception_handlers(const ExceptionHandlers& handlers) const {
ASSERT(handlers.IsOld());
- StorePointer(&raw_ptr()->exception_handlers_, handlers.raw());
+ raw_ptr()->set_exception_handlers(handlers.raw());
}
// WARNING: function() returns the owner which is not guaranteed to be
@@ -6396,15 +6397,15 @@
FunctionPtr function() const {
ASSERT(IsFunctionCode());
return Function::RawCast(
- WeakSerializationReference::Unwrap(raw_ptr()->owner_));
+ WeakSerializationReference::Unwrap(raw_ptr()->owner()));
}
- ObjectPtr owner() const { return raw_ptr()->owner_; }
+ ObjectPtr owner() const { return raw_ptr()->owner(); }
void set_owner(const Object& owner) const;
classid_t OwnerClassId() const { return OwnerClassIdOf(raw()); }
static classid_t OwnerClassIdOf(CodePtr raw) {
- return WeakSerializationReference::UnwrappedClassIdOf(raw->ptr()->owner_);
+ return WeakSerializationReference::UnwrappedClassIdOf(raw->ptr()->owner());
}
static intptr_t owner_offset() { return OFFSET_OF(CodeLayout, owner_); }
@@ -6510,12 +6511,12 @@
UNREACHABLE();
return false;
#else
- return code->ptr()->instructions_ != code->ptr()->active_instructions_;
+ return code->ptr()->instructions() != code->ptr()->active_instructions();
#endif
}
void set_object_pool(ObjectPoolPtr object_pool) const {
- StorePointer(&raw_ptr()->object_pool_, object_pool);
+ raw_ptr()->set_object_pool(object_pool);
}
private:
@@ -6583,7 +6584,7 @@
void set_instructions(const Instructions& instructions) const {
ASSERT(Thread::Current()->IsMutatorThread() || !is_alive());
- StorePointer(&raw_ptr()->instructions_, instructions.raw());
+ raw_ptr()->set_instructions(instructions.raw());
}
#if !defined(DART_PRECOMPILED_RUNTIME)
void set_unchecked_offset(uword offset) const {
@@ -6651,9 +6652,9 @@
class Context : public Object {
public:
- ContextPtr parent() const { return raw_ptr()->parent_; }
+ ContextPtr parent() const { return raw_ptr()->parent(); }
void set_parent(const Context& parent) const {
- StorePointer(&raw_ptr()->parent_, parent.raw());
+ raw_ptr()->set_parent(parent.raw());
}
static intptr_t parent_offset() { return OFFSET_OF(ContextLayout, parent_); }
@@ -6666,7 +6667,7 @@
}
ObjectPtr At(intptr_t context_index) const {
- return *ObjectAddr(context_index);
+ return raw_ptr()->element(context_index);
}
inline void SetAt(intptr_t context_index, const Object& value) const;
@@ -6710,11 +6711,6 @@
static ContextPtr New(intptr_t num_variables, Heap::Space space = Heap::kNew);
private:
- ObjectPtr const* ObjectAddr(intptr_t context_index) const {
- ASSERT((context_index >= 0) && (context_index < num_variables()));
- return &raw_ptr()->data()[context_index];
- }
-
void set_num_variables(intptr_t num_variables) const {
StoreNonPointer(&raw_ptr()->num_variables_, num_variables);
}
@@ -7041,7 +7037,7 @@
class ApiError : public Error {
public:
- StringPtr message() const { return raw_ptr()->message_; }
+ StringPtr message() const { return raw_ptr()->message(); }
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(ApiErrorLayout));
@@ -7101,10 +7097,10 @@
TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
private:
- ErrorPtr previous_error() const { return raw_ptr()->previous_error_; }
+ ErrorPtr previous_error() const { return raw_ptr()->previous_error(); }
void set_previous_error(const Error& value) const;
- ScriptPtr script() const { return raw_ptr()->script_; }
+ ScriptPtr script() const { return raw_ptr()->script(); }
void set_script(const Script& value) const;
void set_token_pos(TokenPosition value) const;
@@ -7114,10 +7110,10 @@
void set_kind(uint8_t value) const;
- StringPtr message() const { return raw_ptr()->message_; }
+ StringPtr message() const { return raw_ptr()->message(); }
void set_message(const String& value) const;
- StringPtr formatted_message() const { return raw_ptr()->formatted_message_; }
+ StringPtr formatted_message() const { return raw_ptr()->formatted_message(); }
void set_formatted_message(const String& value) const;
static LanguageErrorPtr New();
@@ -7128,12 +7124,12 @@
class UnhandledException : public Error {
public:
- InstancePtr exception() const { return raw_ptr()->exception_; }
+ InstancePtr exception() const { return raw_ptr()->exception(); }
static intptr_t exception_offset() {
return OFFSET_OF(UnhandledExceptionLayout, exception_);
}
- InstancePtr stacktrace() const { return raw_ptr()->stacktrace_; }
+ InstancePtr stacktrace() const { return raw_ptr()->stacktrace(); }
static intptr_t stacktrace_offset() {
return OFFSET_OF(UnhandledExceptionLayout, stacktrace_);
}
@@ -7164,7 +7160,7 @@
bool is_user_initiated() const { return raw_ptr()->is_user_initiated_; }
void set_is_user_initiated(bool value) const;
- StringPtr message() const { return raw_ptr()->message_; }
+ StringPtr message() const { return raw_ptr()->message(); }
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(UnwindErrorLayout));
@@ -7392,12 +7388,12 @@
class LibraryPrefix : public Instance {
public:
- StringPtr name() const { return raw_ptr()->name_; }
+ StringPtr name() const { return raw_ptr()->name(); }
virtual StringPtr DictionaryName() const { return name(); }
- ArrayPtr imports() const { return raw_ptr()->imports_; }
+ ArrayPtr imports() const { return raw_ptr()->imports(); }
intptr_t num_imports() const { return raw_ptr()->num_imports_; }
- LibraryPtr importer() const { return raw_ptr()->importer_; }
+ LibraryPtr importer() const { return raw_ptr()->importer(); }
LibraryPtr GetLibrary(int index) const;
void AddImport(const Namespace& import) const;
@@ -7687,7 +7683,6 @@
ArrayPtr instantiations() const;
void set_instantiations(const Array& value) const;
- AbstractTypePtr const* TypeAddr(intptr_t index) const;
void SetLength(intptr_t value) const;
// Number of fields in the raw object is 4:
// instantiations_, length_, hash_ and nullability_.
@@ -7947,7 +7942,7 @@
uword type_test_stub_entry_point() const {
return raw_ptr()->type_test_stub_entry_point_;
}
- CodePtr type_test_stub() const { return raw_ptr()->type_test_stub_; }
+ CodePtr type_test_stub() const { return raw_ptr()->type_test_stub(); }
void SetTypeTestingStub(const Code& stub) const;
@@ -8008,7 +8003,7 @@
virtual classid_t type_class_id() const;
virtual ClassPtr type_class() const;
void set_type_class(const Class& value) const;
- virtual TypeArgumentsPtr arguments() const { return raw_ptr()->arguments_; }
+ virtual TypeArgumentsPtr arguments() const { return raw_ptr()->arguments(); }
virtual void set_arguments(const TypeArguments& value) const;
virtual TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
virtual bool IsInstantiated(Genericity genericity = kAny,
@@ -8168,7 +8163,7 @@
return (type() != AbstractType::null()) &&
AbstractType::Handle(type()).HasTypeClass();
}
- AbstractTypePtr type() const { return raw_ptr()->type_; }
+ AbstractTypePtr type() const { return raw_ptr()->type(); }
void set_type(const AbstractType& value) const;
virtual classid_t type_class_id() const {
return AbstractType::Handle(type()).type_class_id();
@@ -8262,7 +8257,7 @@
classid_t parameterized_class_id() const;
ClassPtr parameterized_class() const;
FunctionPtr parameterized_function() const {
- return raw_ptr()->parameterized_function_;
+ return raw_ptr()->parameterized_function();
}
bool IsClassTypeParameter() const {
return parameterized_class_id() != kFunctionCid;
@@ -8278,16 +8273,16 @@
return OFFSET_OF(TypeParameterLayout, index_);
}
- StringPtr name() const { return raw_ptr()->name_; }
+ StringPtr name() const { return raw_ptr()->name(); }
static intptr_t name_offset() {
return OFFSET_OF(TypeParameterLayout, name_);
}
intptr_t index() const { return raw_ptr()->index_; }
void set_index(intptr_t value) const;
- AbstractTypePtr bound() const { return raw_ptr()->bound_; }
+ AbstractTypePtr bound() const { return raw_ptr()->bound(); }
void set_bound(const AbstractType& value) const;
AbstractTypePtr default_argument() const {
- return raw_ptr()->default_argument_;
+ return raw_ptr()->default_argument();
}
void set_default_argument(const AbstractType& value) const;
static intptr_t bound_offset() {
@@ -8671,7 +8666,7 @@
intptr_t Length() const { return LengthOf(raw()); }
static intptr_t LengthOf(StringPtr obj) {
- return Smi::Value(obj->ptr()->length_);
+ return Smi::Value(obj->ptr()->length());
}
static intptr_t length_offset() { return OFFSET_OF(StringLayout, length_); }
@@ -8940,7 +8935,7 @@
void SetLength(intptr_t value) const {
// This is only safe because we create a new Smi, which does not cause
// heap allocation.
- StoreSmi(&raw_ptr()->length_, Smi::New(value));
+ raw_ptr()->set_length(Smi::New(value));
}
void SetHash(intptr_t value) const { SetCachedHash(raw(), value); }
@@ -9024,7 +9019,7 @@
}
static intptr_t UnroundedSize(OneByteStringPtr str) {
- return UnroundedSize(Smi::Value(str->ptr()->length_));
+ return UnroundedSize(Smi::Value(str->ptr()->length()));
}
static intptr_t UnroundedSize(intptr_t len) {
return sizeof(OneByteStringLayout) + (len * kBytesPerElement);
@@ -9163,7 +9158,7 @@
return OFFSET_OF_RETURNED_VALUE(TwoByteStringLayout, data);
}
static intptr_t UnroundedSize(TwoByteStringPtr str) {
- return UnroundedSize(Smi::Value(str->ptr()->length_));
+ return UnroundedSize(Smi::Value(str->ptr()->length()));
}
static intptr_t UnroundedSize(intptr_t len) {
return sizeof(TwoByteStringLayout) + (len * kBytesPerElement);
@@ -9493,7 +9488,7 @@
intptr_t Length() const { return LengthOf(raw()); }
static intptr_t LengthOf(const ArrayPtr array) {
- return Smi::Value(array->ptr()->length_);
+ return Smi::Value(array->ptr()->length());
}
static intptr_t length_offset() { return OFFSET_OF(ArrayLayout, length_); }
@@ -9518,8 +9513,8 @@
static bool Equals(ArrayPtr a, ArrayPtr b) {
if (a == b) return true;
if (a->IsRawNull() || b->IsRawNull()) return false;
- if (a->ptr()->length_ != b->ptr()->length_) return false;
- if (a->ptr()->type_arguments_ != b->ptr()->type_arguments_) return false;
+ if (a->ptr()->length() != b->ptr()->length()) return false;
+ if (a->ptr()->type_arguments() != b->ptr()->type_arguments()) return false;
const intptr_t length = LengthOf(a);
return memcmp(a->ptr()->data(), b->ptr()->data(), kWordSize * length) == 0;
}
@@ -9528,20 +9523,20 @@
template <std::memory_order order = std::memory_order_relaxed>
ObjectPtr At(intptr_t index) const {
- return LoadPointer<ObjectPtr, order>(ObjectAddr(index));
+ return raw_ptr()->element(index);
}
template <std::memory_order order = std::memory_order_relaxed>
void SetAt(intptr_t index, const Object& value) const {
// TODO(iposva): Add storing NoSafepointScope.
- StoreArrayPointer<ObjectPtr, order>(ObjectAddr(index), value.raw());
+ raw_ptr()->set_element(index, value.raw());
}
// Access to the array with acquire release semantics.
ObjectPtr AtAcquire(intptr_t index) const {
- return At<std::memory_order_acquire>(index);
+ return raw_ptr()->element<std::memory_order_acquire>(index);
}
void SetAtRelease(intptr_t index, const Object& value) const {
- SetAt<std::memory_order_release>(index, value);
+ raw_ptr()->set_element<std::memory_order_release>(index, value.raw());
}
bool IsImmutable() const { return raw()->GetClassId() == kImmutableArrayCid; }
@@ -9550,7 +9545,7 @@
static const intptr_t kElementTypeTypeArgPos = 0;
virtual TypeArgumentsPtr GetTypeArguments() const {
- return raw_ptr()->type_arguments_;
+ return raw_ptr()->type_arguments();
}
virtual void SetTypeArguments(const TypeArguments& value) const {
// An Array is raw or takes one type argument. However, its type argument
@@ -9643,10 +9638,10 @@
}
void SetLength(intptr_t value) const {
- StoreSmi(&raw_ptr()->length_, Smi::New(value));
+ raw_ptr()->set_length(Smi::New(value));
}
void SetLengthIgnoreRace(intptr_t value) const {
- StoreSmiIgnoreRace(&raw_ptr()->length_, Smi::New(value));
+ raw_ptr()->set_length_ignore_race(Smi::New(value));
}
template <typename type, std::memory_order order = std::memory_order_relaxed>
@@ -9712,35 +9707,33 @@
intptr_t Capacity() const {
NoSafepointScope no_safepoint;
ASSERT(!IsNull());
- return Smi::Value(DataArray()->length_);
+ return Smi::Value(DataArray()->length());
}
intptr_t Length() const {
ASSERT(!IsNull());
- return Smi::Value(raw_ptr()->length_);
+ return Smi::Value(raw_ptr()->length());
}
void SetLength(intptr_t value) const {
// This is only safe because we create a new Smi, which does not cause
// heap allocation.
- StoreSmi(&raw_ptr()->length_, Smi::New(value));
+ raw_ptr()->set_length(Smi::New(value));
}
- ArrayPtr data() const { return raw_ptr()->data_; }
- void SetData(const Array& value) const {
- StorePointer(&raw_ptr()->data_, value.raw());
- }
+ ArrayPtr data() const { return raw_ptr()->data(); }
+ void SetData(const Array& value) const { raw_ptr()->set_data(value.raw()); }
ObjectPtr At(intptr_t index) const {
NoSafepointScope no_safepoint;
ASSERT(!IsNull());
ASSERT(index < Length());
- return *ObjectAddr(index);
+ return data()->ptr()->element(index);
}
void SetAt(intptr_t index, const Object& value) const {
ASSERT(!IsNull());
ASSERT(index < Length());
// TODO(iposva): Add storing NoSafepointScope.
- data()->ptr()->StoreArrayPointer(ObjectAddr(index), value.raw());
+ data()->ptr()->set_element(index, value.raw());
}
void Add(const Object& value, Heap::Space space = Heap::kNew) const;
@@ -9749,7 +9742,7 @@
ObjectPtr RemoveLast() const;
virtual TypeArgumentsPtr GetTypeArguments() const {
- return raw_ptr()->type_arguments_;
+ return raw_ptr()->type_arguments();
}
virtual void SetTypeArguments(const TypeArguments& value) const {
// A GrowableObjectArray is raw or takes one type argument. However, its
@@ -9757,7 +9750,7 @@
// reusing the type argument vector of the instantiator.
ASSERT(value.IsNull() || ((value.Length() >= 1) && value.IsInstantiated() &&
value.IsCanonical()));
- StorePointer(&raw_ptr()->type_arguments_, value.raw());
+ raw_ptr()->set_type_arguments(value.raw());
}
// We don't expect a growable object array to be canonicalized.
@@ -9796,19 +9789,15 @@
Heap::Space space = Heap::kNew);
static SmiPtr NoSafepointLength(const GrowableObjectArrayPtr array) {
- return array->ptr()->length_;
+ return array->ptr()->length();
}
static ArrayPtr NoSafepointData(const GrowableObjectArrayPtr array) {
- return array->ptr()->data_;
+ return array->ptr()->data();
}
private:
ArrayLayout* DataArray() const { return data()->ptr(); }
- ObjectPtr* ObjectAddr(intptr_t index) const {
- ASSERT((index >= 0) && (index < Length()));
- return &(DataArray()->data()[index]);
- }
static const int kDefaultInitialCapacity = 0;
@@ -9925,11 +9914,11 @@
return OFFSET_OF(TypedDataBaseLayout, length_);
}
- SmiPtr length() const { return raw_ptr()->length_; }
+ SmiPtr length() const { return raw_ptr()->length(); }
intptr_t Length() const {
ASSERT(!IsNull());
- return Smi::Value(raw_ptr()->length_);
+ return Smi::Value(raw_ptr()->length());
}
intptr_t LengthInBytes() const {
@@ -9976,7 +9965,7 @@
protected:
void SetLength(intptr_t value) const {
ASSERT(value <= Smi::kMaxValue);
- StoreSmi(&raw_ptr()->length_, Smi::New(value));
+ raw_ptr()->set_length(Smi::New(value));
}
virtual uint8_t* Validate(uint8_t* data) const {
@@ -10206,7 +10195,7 @@
void SetLength(intptr_t value) const {
ASSERT(value <= Smi::kMaxValue);
- StoreSmi(&raw_ptr()->length_, Smi::New(value));
+ raw_ptr()->set_length(Smi::New(value));
}
void SetData(uint8_t* data) const {
@@ -10257,22 +10246,22 @@
return OFFSET_OF(TypedDataViewLayout, offset_in_bytes_);
}
- InstancePtr typed_data() const { return raw_ptr()->typed_data_; }
+ InstancePtr typed_data() const { return raw_ptr()->typed_data(); }
void InitializeWith(const TypedDataBase& typed_data,
intptr_t offset_in_bytes,
intptr_t length) {
const classid_t cid = typed_data.GetClassId();
ASSERT(IsTypedDataClassId(cid) || IsExternalTypedDataClassId(cid));
- StorePointer(&raw_ptr()->typed_data_, typed_data.raw());
- StoreSmi(&raw_ptr()->length_, Smi::New(length));
- StoreSmi(&raw_ptr()->offset_in_bytes_, Smi::New(offset_in_bytes));
+ raw_ptr()->set_typed_data(typed_data.raw());
+ raw_ptr()->set_length(Smi::New(length));
+ raw_ptr()->set_offset_in_bytes(Smi::New(offset_in_bytes));
// Update the inner pointer.
RecomputeDataField();
}
- SmiPtr offset_in_bytes() const { return raw_ptr()->offset_in_bytes_; }
+ SmiPtr offset_in_bytes() const { return raw_ptr()->offset_in_bytes(); }
protected:
virtual uint8_t* Validate(uint8_t* data) const { return data; }
@@ -10281,11 +10270,10 @@
void RecomputeDataField() { raw()->ptr()->RecomputeDataField(); }
void Clear() {
- StoreSmi(&raw_ptr()->length_, Smi::New(0));
- StoreSmi(&raw_ptr()->offset_in_bytes_, Smi::New(0));
+ raw_ptr()->set_length(Smi::New(0));
+ raw_ptr()->set_offset_in_bytes(Smi::New(0));
StoreNonPointer(&raw_ptr()->data_, nullptr);
- StorePointer(&raw_ptr()->typed_data_,
- TypedDataBase::RawCast(Object::null()));
+ raw_ptr()->set_typed_data(TypedDataBase::RawCast(Object::null()));
}
FINAL_HEAP_OBJECT_IMPLEMENTATION(TypedDataView, TypedDataBase);
@@ -10402,7 +10390,7 @@
Heap::Space space = Heap::kNew);
virtual TypeArgumentsPtr GetTypeArguments() const {
- return raw_ptr()->type_arguments_;
+ return raw_ptr()->type_arguments();
}
virtual void SetTypeArguments(const TypeArguments& value) const {
ASSERT(value.IsNull() ||
@@ -10410,48 +10398,46 @@
value.IsInstantiated() /*&& value.IsCanonical()*/));
// TODO(asiva): Values read from a message snapshot are not properly marked
// as canonical. See for example tests/isolate/message3_test.dart.
- StorePointer(&raw_ptr()->type_arguments_, value.raw());
+ raw_ptr()->set_type_arguments(value.raw());
}
static intptr_t type_arguments_offset() {
return OFFSET_OF(LinkedHashMapLayout, type_arguments_);
}
- TypedDataPtr index() const { return raw_ptr()->index_; }
+ TypedDataPtr index() const { return raw_ptr()->index(); }
void SetIndex(const TypedData& value) const {
ASSERT(!value.IsNull());
- StorePointer(&raw_ptr()->index_, value.raw());
+ raw_ptr()->set_index(value.raw());
}
static intptr_t index_offset() {
return OFFSET_OF(LinkedHashMapLayout, index_);
}
- ArrayPtr data() const { return raw_ptr()->data_; }
- void SetData(const Array& value) const {
- StorePointer(&raw_ptr()->data_, value.raw());
- }
+ ArrayPtr data() const { return raw_ptr()->data(); }
+ void SetData(const Array& value) const { raw_ptr()->set_data(value.raw()); }
static intptr_t data_offset() {
return OFFSET_OF(LinkedHashMapLayout, data_);
}
- SmiPtr hash_mask() const { return raw_ptr()->hash_mask_; }
+ SmiPtr hash_mask() const { return raw_ptr()->hash_mask(); }
void SetHashMask(intptr_t value) const {
- StoreSmi(&raw_ptr()->hash_mask_, Smi::New(value));
+ raw_ptr()->set_hash_mask(Smi::New(value));
}
static intptr_t hash_mask_offset() {
return OFFSET_OF(LinkedHashMapLayout, hash_mask_);
}
- SmiPtr used_data() const { return raw_ptr()->used_data_; }
+ SmiPtr used_data() const { return raw_ptr()->used_data(); }
void SetUsedData(intptr_t value) const {
- StoreSmi(&raw_ptr()->used_data_, Smi::New(value));
+ raw_ptr()->set_used_data(Smi::New(value));
}
static intptr_t used_data_offset() {
return OFFSET_OF(LinkedHashMapLayout, used_data_);
}
- SmiPtr deleted_keys() const { return raw_ptr()->deleted_keys_; }
+ SmiPtr deleted_keys() const { return raw_ptr()->deleted_keys(); }
void SetDeletedKeys(intptr_t value) const {
- StoreSmi(&raw_ptr()->deleted_keys_, Smi::New(value));
+ raw_ptr()->set_deleted_keys(Smi::New(value));
}
static intptr_t deleted_keys_offset() {
return OFFSET_OF(LinkedHashMapLayout, deleted_keys_);
@@ -10459,11 +10445,11 @@
intptr_t Length() const {
// The map may be uninitialized.
- if (raw_ptr()->used_data_ == Object::null()) return 0;
- if (raw_ptr()->deleted_keys_ == Object::null()) return 0;
+ if (raw_ptr()->used_data() == Object::null()) return 0;
+ if (raw_ptr()->deleted_keys() == Object::null()) return 0;
- intptr_t used = Smi::Value(raw_ptr()->used_data_);
- intptr_t deleted = Smi::Value(raw_ptr()->deleted_keys_);
+ intptr_t used = Smi::Value(raw_ptr()->used_data());
+ intptr_t deleted = Smi::Value(raw_ptr()->deleted_keys());
return (used >> 1) - deleted;
}
@@ -10523,41 +10509,41 @@
class Closure : public Instance {
public:
TypeArgumentsPtr instantiator_type_arguments() const {
- return raw_ptr()->instantiator_type_arguments_;
+ return raw_ptr()->instantiator_type_arguments();
}
void set_instantiator_type_arguments(const TypeArguments& args) const {
- StorePointer(&raw_ptr()->instantiator_type_arguments_, args.raw());
+ raw_ptr()->set_instantiator_type_arguments(args.raw());
}
static intptr_t instantiator_type_arguments_offset() {
return OFFSET_OF(ClosureLayout, instantiator_type_arguments_);
}
TypeArgumentsPtr function_type_arguments() const {
- return raw_ptr()->function_type_arguments_;
+ return raw_ptr()->function_type_arguments();
}
void set_function_type_arguments(const TypeArguments& args) const {
- StorePointer(&raw_ptr()->function_type_arguments_, args.raw());
+ raw_ptr()->set_function_type_arguments(args.raw());
}
static intptr_t function_type_arguments_offset() {
return OFFSET_OF(ClosureLayout, function_type_arguments_);
}
TypeArgumentsPtr delayed_type_arguments() const {
- return raw_ptr()->delayed_type_arguments_;
+ return raw_ptr()->delayed_type_arguments();
}
void set_delayed_type_arguments(const TypeArguments& args) const {
- StorePointer(&raw_ptr()->delayed_type_arguments_, args.raw());
+ raw_ptr()->set_delayed_type_arguments(args.raw());
}
static intptr_t delayed_type_arguments_offset() {
return OFFSET_OF(ClosureLayout, delayed_type_arguments_);
}
- FunctionPtr function() const { return raw_ptr()->function_; }
+ FunctionPtr function() const { return raw_ptr()->function(); }
static intptr_t function_offset() {
return OFFSET_OF(ClosureLayout, function_);
}
- ContextPtr context() const { return raw_ptr()->context_; }
+ ContextPtr context() const { return raw_ptr()->context(); }
static intptr_t context_offset() {
return OFFSET_OF(ClosureLayout, context_);
}
@@ -10567,7 +10553,7 @@
// No need for NumParentTypeParameters, as a closure is always closed over
// its parents type parameters (i.e., function_type_parameters() above).
- SmiPtr hash() const { return raw_ptr()->hash_; }
+ SmiPtr hash() const { return raw_ptr()->hash(); }
static intptr_t hash_offset() { return OFFSET_OF(ClosureLayout, hash_); }
static intptr_t InstanceSize() {
@@ -10619,18 +10605,18 @@
class ReceivePort : public Instance {
public:
- SendPortPtr send_port() const { return raw_ptr()->send_port_; }
+ SendPortPtr send_port() const { return raw_ptr()->send_port(); }
Dart_Port Id() const { return send_port()->ptr()->id_; }
- InstancePtr handler() const { return raw_ptr()->handler_; }
+ InstancePtr handler() const { return raw_ptr()->handler(); }
void set_handler(const Instance& value) const;
#if !defined(PRODUCT)
StackTracePtr allocation_location() const {
- return raw_ptr()->allocation_location_;
+ return raw_ptr()->allocation_location();
}
- StringPtr debug_name() const { return raw_ptr()->debug_name_; }
+ StringPtr debug_name() const { return raw_ptr()->debug_name(); }
#endif
static intptr_t InstanceSize() {
@@ -10720,15 +10706,15 @@
intptr_t Length() const;
- StackTracePtr async_link() const { return raw_ptr()->async_link_; }
+ StackTracePtr async_link() const { return raw_ptr()->async_link(); }
void set_async_link(const StackTrace& async_link) const;
void set_expand_inlined(bool value) const;
- ArrayPtr code_array() const { return raw_ptr()->code_array_; }
+ ArrayPtr code_array() const { return raw_ptr()->code_array(); }
ObjectPtr CodeAtFrame(intptr_t frame_index) const;
void SetCodeAtFrame(intptr_t frame_index, const Object& code) const;
- ArrayPtr pc_offset_array() const { return raw_ptr()->pc_offset_array_; }
+ ArrayPtr pc_offset_array() const { return raw_ptr()->pc_offset_array(); }
SmiPtr PcOffsetAtFrame(intptr_t frame_index) const;
void SetPcOffsetAtFrame(intptr_t frame_index, const Smi& pc_offset) const;
@@ -10853,19 +10839,19 @@
: raw_ptr()->num_two_byte_registers_;
}
- StringPtr pattern() const { return raw_ptr()->pattern_; }
+ StringPtr pattern() const { return raw_ptr()->pattern(); }
SmiPtr num_bracket_expressions() const {
- return raw_ptr()->num_bracket_expressions_;
+ return raw_ptr()->num_bracket_expressions();
}
- ArrayPtr capture_name_map() const { return raw_ptr()->capture_name_map_; }
+ ArrayPtr capture_name_map() const { return raw_ptr()->capture_name_map(); }
TypedDataPtr bytecode(bool is_one_byte, bool sticky) const {
if (sticky) {
- return is_one_byte ? raw_ptr()->one_byte_sticky_.bytecode_
- : raw_ptr()->two_byte_sticky_.bytecode_;
+ return TypedData::RawCast(is_one_byte ? raw_ptr()->one_byte_sticky_
+ : raw_ptr()->two_byte_sticky_);
} else {
- return is_one_byte ? raw_ptr()->one_byte_.bytecode_
- : raw_ptr()->two_byte_.bytecode_;
+ return TypedData::RawCast(is_one_byte ? raw_ptr()->one_byte_
+ : raw_ptr()->two_byte_);
}
}
@@ -10873,24 +10859,24 @@
if (sticky) {
switch (cid) {
case kOneByteStringCid:
- return OFFSET_OF(RegExpLayout, one_byte_sticky_.function_);
+ return OFFSET_OF(RegExpLayout, one_byte_sticky_);
case kTwoByteStringCid:
- return OFFSET_OF(RegExpLayout, two_byte_sticky_.function_);
+ return OFFSET_OF(RegExpLayout, two_byte_sticky_);
case kExternalOneByteStringCid:
- return OFFSET_OF(RegExpLayout, external_one_byte_sticky_function_);
+ return OFFSET_OF(RegExpLayout, external_one_byte_sticky_);
case kExternalTwoByteStringCid:
- return OFFSET_OF(RegExpLayout, external_two_byte_sticky_function_);
+ return OFFSET_OF(RegExpLayout, external_two_byte_sticky_);
}
} else {
switch (cid) {
case kOneByteStringCid:
- return OFFSET_OF(RegExpLayout, one_byte_.function_);
+ return OFFSET_OF(RegExpLayout, one_byte_);
case kTwoByteStringCid:
- return OFFSET_OF(RegExpLayout, two_byte_.function_);
+ return OFFSET_OF(RegExpLayout, two_byte_);
case kExternalOneByteStringCid:
- return OFFSET_OF(RegExpLayout, external_one_byte_function_);
+ return OFFSET_OF(RegExpLayout, external_one_byte_);
case kExternalTwoByteStringCid:
- return OFFSET_OF(RegExpLayout, external_two_byte_function_);
+ return OFFSET_OF(RegExpLayout, external_two_byte_);
}
}
@@ -10981,16 +10967,14 @@
class WeakProperty : public Instance {
public:
- ObjectPtr key() const { return raw_ptr()->key_; }
+ ObjectPtr key() const { return raw_ptr()->key(); }
- void set_key(const Object& key) const {
- StorePointer(&raw_ptr()->key_, key.raw());
- }
+ void set_key(const Object& key) const { raw_ptr()->set_key(key.raw()); }
- ObjectPtr value() const { return raw_ptr()->value_; }
+ ObjectPtr value() const { return raw_ptr()->value(); }
void set_value(const Object& value) const {
- StorePointer(&raw_ptr()->value_, value.raw());
+ raw_ptr()->set_value(value.raw());
}
static WeakPropertyPtr New(Heap::Space space = Heap::kNew);
@@ -11013,10 +10997,10 @@
class MirrorReference : public Instance {
public:
- ObjectPtr referent() const { return raw_ptr()->referent_; }
+ ObjectPtr referent() const { return raw_ptr()->referent(); }
void set_referent(const Object& referent) const {
- StorePointer(&raw_ptr()->referent_, referent.raw());
+ raw_ptr()->set_referent(referent.raw());
}
AbstractTypePtr GetAbstractTypeReferent() const;
@@ -11053,7 +11037,7 @@
}
static intptr_t tag_offset() { return OFFSET_OF(UserTagLayout, tag_); }
- StringPtr label() const { return raw_ptr()->label_; }
+ StringPtr label() const { return raw_ptr()->label(); }
void MakeActive() const;
@@ -11072,7 +11056,7 @@
static void AddTagToIsolate(Thread* thread, const UserTag& tag);
void set_label(const String& tag_label) const {
- StorePointer(&raw_ptr()->label_, tag_label.raw());
+ raw_ptr()->set_label(tag_label.raw());
}
FINAL_HEAP_OBJECT_IMPLEMENTATION(UserTag, Instance);
@@ -11087,7 +11071,7 @@
}
virtual TypeArgumentsPtr GetTypeArguments() const {
- return raw_ptr()->type_arguments_;
+ return raw_ptr()->type_arguments();
}
static intptr_t type_arguments_offset() {
return OFFSET_OF(FutureOrLayout, type_arguments_);
@@ -11142,7 +11126,7 @@
intptr_t Field::HostOffset() const {
ASSERT(is_instance()); // Valid only for dart instance fields.
- return (Smi::Value(raw_ptr()->host_offset_or_field_id_) * kWordSize);
+ return (Smi::Value(raw_ptr()->host_offset_or_field_id()) * kWordSize);
}
intptr_t Field::TargetOffset() const {
@@ -11166,8 +11150,8 @@
intptr_t target_offset_in_bytes) const {
ASSERT(is_instance()); // Valid only for dart instance fields.
ASSERT(kWordSize != 0);
- StoreSmi(&raw_ptr()->host_offset_or_field_id_,
- Smi::New(host_offset_in_bytes / kWordSize));
+ raw_ptr()->set_host_offset_or_field_id(
+ Smi::New(host_offset_in_bytes / kWordSize));
#if !defined(DART_PRECOMPILED_RUNTIME)
ASSERT(compiler::target::kWordSize != 0);
StoreNonPointer(&raw_ptr()->target_offset_,
@@ -11180,21 +11164,21 @@
InstancePtr Field::StaticValue() const {
ASSERT(is_static()); // Valid only for static dart fields.
return Isolate::Current()->field_table()->At(
- Smi::Value(raw_ptr()->host_offset_or_field_id_));
+ Smi::Value(raw_ptr()->host_offset_or_field_id()));
}
inline intptr_t Field::field_id() const {
- return Smi::Value(raw_ptr()->host_offset_or_field_id_);
+ return Smi::Value(raw_ptr()->host_offset_or_field_id());
}
void Field::set_field_id(intptr_t field_id) const {
ASSERT(is_static());
ASSERT(Thread::Current()->IsMutatorThread());
- StoreSmi(&raw_ptr()->host_offset_or_field_id_, Smi::New(field_id));
+ raw_ptr()->set_host_offset_or_field_id(Smi::New(field_id));
}
void Context::SetAt(intptr_t index, const Object& value) const {
- StorePointer(ObjectAddr(index), value.raw());
+ raw_ptr()->set_element(index, value.raw());
}
intptr_t Instance::GetNativeField(int index) const {
@@ -11276,7 +11260,7 @@
}
inline intptr_t Type::Hash() const {
- intptr_t result = Smi::Value(raw_ptr()->hash_);
+ intptr_t result = Smi::Value(raw_ptr()->hash());
if (result != 0) {
return result;
}
@@ -11286,12 +11270,12 @@
inline void Type::SetHash(intptr_t value) const {
// This is only safe because we create a new Smi, which does not cause
// heap allocation.
- StoreSmi(&raw_ptr()->hash_, Smi::New(value));
+ raw_ptr()->set_hash(Smi::New(value));
}
inline intptr_t TypeParameter::Hash() const {
ASSERT(IsFinalized());
- intptr_t result = Smi::Value(raw_ptr()->hash_);
+ intptr_t result = Smi::Value(raw_ptr()->hash());
if (result != 0) {
return result;
}
@@ -11301,12 +11285,12 @@
inline void TypeParameter::SetHash(intptr_t value) const {
// This is only safe because we create a new Smi, which does not cause
// heap allocation.
- StoreSmi(&raw_ptr()->hash_, Smi::New(value));
+ raw_ptr()->set_hash(Smi::New(value));
}
inline intptr_t TypeArguments::Hash() const {
if (IsNull()) return kAllDynamicHash;
- intptr_t result = Smi::Value(raw_ptr()->hash_);
+ intptr_t result = Smi::Value(raw_ptr()->hash());
if (result != 0) {
return result;
}
@@ -11316,7 +11300,7 @@
inline void TypeArguments::SetHash(intptr_t value) const {
// This is only safe because we create a new Smi, which does not cause
// heap allocation.
- StoreSmi(&raw_ptr()->hash_, Smi::New(value));
+ raw_ptr()->set_hash(Smi::New(value));
}
inline uint16_t String::CharAt(StringPtr str, intptr_t index) {
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 6ef0636..0f9c283 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -48,10 +48,10 @@
class CodeStatistics;
#define VISIT_FROM(type, first) \
- type* from() { return reinterpret_cast<type*>(&first); }
+ type* from() { return reinterpret_cast<type*>(&first##_); }
#define VISIT_TO(type, last) \
- type* to() { return reinterpret_cast<type*>(&last); }
+ type* to() { return reinterpret_cast<type*>(&last##_); }
#define VISIT_TO_LENGTH(type, last) \
type* to(intptr_t length) { return reinterpret_cast<type*>(last); }
@@ -536,9 +536,9 @@
// All writes to heap objects should ultimately pass through one of the
// methods below or their counterparts in Object, to ensure that the
// write barrier is correctly applied.
-
+ protected:
template <typename type, std::memory_order order = std::memory_order_relaxed>
- type LoadPointer(type const* addr) {
+ type LoadPointer(type const* addr) const {
return reinterpret_cast<std::atomic<type>*>(const_cast<type*>(addr))
->load(order);
}
@@ -568,6 +568,7 @@
}
}
+ private:
DART_FORCE_INLINE
void CheckHeapPointerStore(ObjectPtr value, Thread* thread) {
uword source_tags = this->tags_;
@@ -649,12 +650,20 @@
}
}
+ protected:
+ template <typename type, std::memory_order order = std::memory_order_relaxed>
+ type LoadSmi(type const* addr) const {
+ return reinterpret_cast<std::atomic<type>*>(const_cast<type*>(addr))
+ ->load(order);
+ }
// Use for storing into an explicitly Smi-typed field of an object
// (i.e., both the previous and new value are Smis).
+ template <std::memory_order order = std::memory_order_relaxed>
void StoreSmi(SmiPtr const* addr, SmiPtr value) {
// Can't use Contains, as array length is initialized through this method.
ASSERT(reinterpret_cast<uword>(addr) >= ObjectLayout::ToAddr(this));
- *const_cast<SmiPtr*>(addr) = value;
+ reinterpret_cast<std::atomic<SmiPtr>*>(const_cast<SmiPtr*>(addr))
+ ->store(value, order);
}
NO_SANITIZE_THREAD
void StoreSmiIgnoreRace(SmiPtr const* addr, SmiPtr value) {
@@ -663,10 +672,10 @@
*const_cast<SmiPtr*>(addr) = value;
}
- protected:
friend class StoreBufferUpdateVisitor; // RememberCard
void RememberCard(ObjectPtr const* slot);
+ private:
friend class Array;
friend class ByteBuffer;
friend class CidRewriteVisitor;
@@ -720,6 +729,70 @@
return ptr()->GetClassId();
}
+#define POINTER_FIELD(type, name) \
+ public: \
+ template <std::memory_order order = std::memory_order_relaxed> \
+ type name() const { \
+ return LoadPointer<type, order>(&name##_); \
+ } \
+ template <std::memory_order order = std::memory_order_relaxed> \
+ void set_##name(type value) { \
+ StorePointer<type, order>(&name##_, value); \
+ } \
+ \
+ protected: \
+ type name##_;
+
+#define ARRAY_POINTER_FIELD(type, name) \
+ public: \
+ template <std::memory_order order = std::memory_order_relaxed> \
+ type name() const { \
+ return LoadPointer<type, order>(&name##_); \
+ } \
+ template <std::memory_order order = std::memory_order_relaxed> \
+ void set_##name(type value) { \
+ StoreArrayPointer<type, order>(&name##_, value); \
+ } \
+ \
+ protected: \
+ type name##_;
+
+#define VARIABLE_POINTER_FIELDS(type, accessor_name, array_name) \
+ public: \
+ template <std::memory_order order = std::memory_order_relaxed> \
+ type accessor_name(intptr_t index) const { \
+ return LoadPointer<type, order>(&array_name()[index]); \
+ } \
+ template <std::memory_order order = std::memory_order_relaxed> \
+ void set_##accessor_name(intptr_t index, type value) { \
+ StoreArrayPointer<type, order>(&array_name()[index], value); \
+ } \
+ \
+ protected: \
+ type* array_name() { OPEN_ARRAY_START(type, type); } \
+ type const* array_name() const { OPEN_ARRAY_START(type, type); }
+
+#define SMI_FIELD(type, name) \
+ public: \
+ template <std::memory_order order = std::memory_order_relaxed> \
+ type name() const { \
+ type result = LoadSmi<type, order>(&name##_); \
+ ASSERT(!result.IsHeapObject()); \
+ return result; \
+ } \
+ template <std::memory_order order = std::memory_order_relaxed> \
+ void set_##name(type value) { \
+ ASSERT(!value.IsHeapObject()); \
+ StoreSmi<order>(&name##_, value); \
+ } \
+ void set_##name##_ignore_race(type value) { \
+ ASSERT(!value.IsHeapObject()); \
+ StoreSmiIgnoreRace(&name##_, value); \
+ } \
+ \
+ protected: \
+ type name##_;
+
class ClassLayout : public ObjectLayout {
public:
enum ClassFinalizedState {
@@ -745,27 +818,32 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(Class);
- VISIT_FROM(ObjectPtr, name_);
- StringPtr name_;
- StringPtr user_name_;
- ArrayPtr functions_;
- ArrayPtr functions_hash_table_;
- ArrayPtr fields_;
- ArrayPtr offset_in_words_to_field_;
- ArrayPtr interfaces_; // Array of AbstractType.
- ScriptPtr script_;
- LibraryPtr library_;
- TypeArgumentsPtr type_parameters_; // Array of TypeParameter.
- AbstractTypePtr super_type_;
- FunctionPtr signature_function_; // Associated function for typedef class.
- ArrayPtr constants_; // Canonicalized const instances of this class.
- TypePtr declaration_type_; // Declaration type for this class.
- ArrayPtr invocation_dispatcher_cache_; // Cache for dispatcher functions.
- CodePtr allocation_stub_; // Stub code for allocation of instances.
- GrowableObjectArrayPtr direct_implementors_; // Array of Class.
- GrowableObjectArrayPtr direct_subclasses_; // Array of Class.
- ArrayPtr dependent_code_; // CHA optimized codes.
- VISIT_TO(ObjectPtr, dependent_code_);
+ VISIT_FROM(ObjectPtr, name)
+ POINTER_FIELD(StringPtr, name)
+ POINTER_FIELD(StringPtr, user_name)
+ POINTER_FIELD(ArrayPtr, functions)
+ POINTER_FIELD(ArrayPtr, functions_hash_table)
+ POINTER_FIELD(ArrayPtr, fields)
+ POINTER_FIELD(ArrayPtr, offset_in_words_to_field)
+ POINTER_FIELD(ArrayPtr, interfaces) // Array of AbstractType.
+ POINTER_FIELD(ScriptPtr, script)
+ POINTER_FIELD(LibraryPtr, library)
+ POINTER_FIELD(TypeArgumentsPtr, type_parameters) // Array of TypeParameter.
+ POINTER_FIELD(AbstractTypePtr, super_type)
+ POINTER_FIELD(FunctionPtr,
+ signature_function) // Associated function for typedef class.
+ POINTER_FIELD(ArrayPtr,
+ constants) // Canonicalized const instances of this class.
+ POINTER_FIELD(TypePtr, declaration_type) // Declaration type for this class.
+ POINTER_FIELD(ArrayPtr,
+ invocation_dispatcher_cache) // Cache for dispatcher functions.
+ POINTER_FIELD(CodePtr,
+ allocation_stub) // Stub code for allocation of instances.
+ POINTER_FIELD(GrowableObjectArrayPtr,
+ direct_implementors) // Array of Class.
+ POINTER_FIELD(GrowableObjectArrayPtr, direct_subclasses) // Array of Class.
+ POINTER_FIELD(ArrayPtr, dependent_code) // CHA optimized codes.
+ VISIT_TO(ObjectPtr, dependent_code)
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
@@ -832,12 +910,12 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass);
- VISIT_FROM(ObjectPtr, patched_class_);
- ClassPtr patched_class_;
- ClassPtr origin_class_;
- ScriptPtr script_;
- ExternalTypedDataPtr library_kernel_data_;
- VISIT_TO(ObjectPtr, library_kernel_data_);
+ VISIT_FROM(ObjectPtr, patched_class)
+ POINTER_FIELD(ClassPtr, patched_class)
+ POINTER_FIELD(ClassPtr, origin_class)
+ POINTER_FIELD(ScriptPtr, script)
+ POINTER_FIELD(ExternalTypedDataPtr, library_kernel_data)
+ VISIT_TO(ObjectPtr, library_kernel_data)
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
@@ -1021,16 +1099,17 @@
uword entry_point_; // Accessed from generated code.
uword unchecked_entry_point_; // Accessed from generated code.
- VISIT_FROM(ObjectPtr, name_);
- StringPtr name_;
- ObjectPtr owner_; // Class or patch class or mixin class
- // where this function is defined.
- AbstractTypePtr result_type_;
- ArrayPtr parameter_types_;
- ArrayPtr parameter_names_;
- TypeArgumentsPtr type_parameters_; // Array of TypeParameter.
- ObjectPtr data_; // Additional data specific to the function kind. See
- // Function::set_data() for details.
+ VISIT_FROM(ObjectPtr, name)
+ POINTER_FIELD(StringPtr, name)
+ POINTER_FIELD(ObjectPtr, owner) // Class or patch class or mixin class
+ // where this function is defined.
+ POINTER_FIELD(AbstractTypePtr, result_type)
+ POINTER_FIELD(ArrayPtr, parameter_types)
+ POINTER_FIELD(ArrayPtr, parameter_names)
+ POINTER_FIELD(TypeArgumentsPtr, type_parameters) // Array of TypeParameter.
+ POINTER_FIELD(ObjectPtr,
+ data) // Additional data specific to the function kind. See
+ // Function::set_data() for details.
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
@@ -1046,17 +1125,19 @@
UNREACHABLE();
return NULL;
}
- ArrayPtr ic_data_array_; // ICData of unoptimized code.
+ POINTER_FIELD(ArrayPtr, ic_data_array); // ICData of unoptimized code.
ObjectPtr* to_no_code() {
return reinterpret_cast<ObjectPtr*>(&ic_data_array_);
}
- CodePtr code_; // Currently active code. Accessed from generated code.
- NOT_IN_PRECOMPILED(CodePtr unoptimized_code_); // Unoptimized code, keep it
+ POINTER_FIELD(CodePtr,
+ code); // Currently active code. Accessed from generated code.
+ NOT_IN_PRECOMPILED(
+ POINTER_FIELD(CodePtr, unoptimized_code)); // Unoptimized code, keep it
// after optimization.
#if defined(DART_PRECOMPILED_RUNTIME)
- VISIT_TO(ObjectPtr, code_);
+ VISIT_TO(ObjectPtr, code);
#else
- VISIT_TO(ObjectPtr, unoptimized_code_);
+ VISIT_TO(ObjectPtr, unoptimized_code);
#endif
NOT_IN_PRECOMPILED(UnboxedParameterBitmap unboxed_parameters_info_);
@@ -1113,16 +1194,18 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData);
- VISIT_FROM(ObjectPtr, context_scope_);
- ContextScopePtr context_scope_;
- FunctionPtr parent_function_; // Enclosing function of this local function.
- TypePtr signature_type_;
- InstancePtr closure_; // Closure object for static implicit closures.
+ VISIT_FROM(ObjectPtr, context_scope)
+ POINTER_FIELD(ContextScopePtr, context_scope)
+ POINTER_FIELD(FunctionPtr,
+ parent_function) // Enclosing function of this local function.
+ POINTER_FIELD(TypePtr, signature_type)
+ POINTER_FIELD(InstancePtr,
+ closure) // Closure object for static implicit closures.
// Instantiate-to-bounds TAV for use when no TAV is provided.
- TypeArgumentsPtr default_type_arguments_;
+ POINTER_FIELD(TypeArgumentsPtr, default_type_arguments)
// Additional information about the instantiate-to-bounds TAV.
- SmiPtr default_type_arguments_info_;
- VISIT_TO(ObjectPtr, default_type_arguments_info_);
+ POINTER_FIELD(SmiPtr, default_type_arguments_info)
+ VISIT_TO(ObjectPtr, default_type_arguments_info)
friend class Function;
};
@@ -1131,10 +1214,11 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(SignatureData);
- VISIT_FROM(ObjectPtr, parent_function_);
- FunctionPtr parent_function_; // Enclosing function of this sig. function.
- TypePtr signature_type_;
- VISIT_TO(ObjectPtr, signature_type_);
+ VISIT_FROM(ObjectPtr, parent_function)
+ POINTER_FIELD(FunctionPtr,
+ parent_function); // Enclosing function of this sig. function.
+ POINTER_FIELD(TypePtr, signature_type)
+ VISIT_TO(ObjectPtr, signature_type)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
friend class Function;
@@ -1144,17 +1228,17 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(FfiTrampolineData);
- VISIT_FROM(ObjectPtr, signature_type_);
- TypePtr signature_type_;
- FunctionPtr c_signature_;
+ VISIT_FROM(ObjectPtr, signature_type)
+ POINTER_FIELD(TypePtr, signature_type)
+ POINTER_FIELD(FunctionPtr, c_signature)
// Target Dart method for callbacks, otherwise null.
- FunctionPtr callback_target_;
+ POINTER_FIELD(FunctionPtr, callback_target)
// For callbacks, value to return if Dart target throws an exception.
- InstancePtr callback_exceptional_return_;
+ POINTER_FIELD(InstancePtr, callback_exceptional_return)
- VISIT_TO(ObjectPtr, callback_exceptional_return_);
+ VISIT_TO(ObjectPtr, callback_exceptional_return)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
// Callback id for callbacks.
@@ -1172,18 +1256,19 @@
class FieldLayout : public ObjectLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(Field);
- VISIT_FROM(ObjectPtr, name_);
- StringPtr name_;
- ObjectPtr owner_; // Class or patch class or mixin class
- // where this field is defined or original field.
- AbstractTypePtr type_;
- FunctionPtr initializer_function_; // Static initializer function.
+ VISIT_FROM(ObjectPtr, name)
+ POINTER_FIELD(StringPtr, name)
+ POINTER_FIELD(ObjectPtr, owner) // Class or patch class or mixin class
+ // where this field is defined or original field.
+ POINTER_FIELD(AbstractTypePtr, type)
+ POINTER_FIELD(FunctionPtr,
+ initializer_function) // Static initializer function.
// - for instance fields: offset in words to the value in the class instance.
// - for static fields: index into field_table.
- SmiPtr host_offset_or_field_id_;
- SmiPtr guarded_list_length_;
- ArrayPtr dependent_code_;
+ SMI_FIELD(SmiPtr, host_offset_or_field_id)
+ SMI_FIELD(SmiPtr, guarded_list_length)
+ POINTER_FIELD(ArrayPtr, dependent_code)
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFull:
@@ -1200,10 +1285,11 @@
return NULL;
}
#if defined(DART_PRECOMPILED_RUNTIME)
- VISIT_TO(ObjectPtr, dependent_code_);
+ VISIT_TO(ObjectPtr, dependent_code);
#else
- SubtypeTestCachePtr type_test_cache_; // For type test in implicit setter.
- VISIT_TO(ObjectPtr, type_test_cache_);
+ POINTER_FIELD(SubtypeTestCachePtr,
+ type_test_cache); // For type test in implicit setter.
+ VISIT_TO(ObjectPtr, type_test_cache);
#endif
TokenPosition token_pos_;
TokenPosition end_token_pos_;
@@ -1248,15 +1334,15 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(Script);
- VISIT_FROM(ObjectPtr, url_);
- StringPtr url_;
- StringPtr resolved_url_;
- ArrayPtr compile_time_constants_;
- TypedDataPtr line_starts_;
- ArrayPtr debug_positions_;
- KernelProgramInfoPtr kernel_program_info_;
- StringPtr source_;
- VISIT_TO(ObjectPtr, source_);
+ VISIT_FROM(ObjectPtr, url)
+ POINTER_FIELD(StringPtr, url)
+ POINTER_FIELD(StringPtr, resolved_url)
+ POINTER_FIELD(ArrayPtr, compile_time_constants)
+ POINTER_FIELD(TypedDataPtr, line_starts)
+ POINTER_FIELD(ArrayPtr, debug_positions)
+ POINTER_FIELD(KernelProgramInfoPtr, kernel_program_info)
+ POINTER_FIELD(StringPtr, source)
+ VISIT_TO(ObjectPtr, source)
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
@@ -1318,19 +1404,22 @@
RAW_HEAP_OBJECT_IMPLEMENTATION(Library);
- VISIT_FROM(ObjectPtr, name_);
- StringPtr name_;
- StringPtr url_;
- StringPtr private_key_;
- ArrayPtr dictionary_; // Top-level names in this library.
- GrowableObjectArrayPtr metadata_; // Metadata on classes, methods etc.
- ClassPtr toplevel_class_; // Class containing top-level elements.
- GrowableObjectArrayPtr used_scripts_;
- LoadingUnitPtr loading_unit_;
- ArrayPtr imports_; // List of Namespaces imported without prefix.
- ArrayPtr exports_; // List of re-exported Namespaces.
- ArrayPtr dependencies_;
- ExternalTypedDataPtr kernel_data_;
+ VISIT_FROM(ObjectPtr, name)
+ POINTER_FIELD(StringPtr, name)
+ POINTER_FIELD(StringPtr, url)
+ POINTER_FIELD(StringPtr, private_key)
+ POINTER_FIELD(ArrayPtr, dictionary) // Top-level names in this library.
+ POINTER_FIELD(GrowableObjectArrayPtr,
+ metadata) // Metadata on classes, methods etc.
+ POINTER_FIELD(ClassPtr,
+ toplevel_class) // Class containing top-level elements.
+ POINTER_FIELD(GrowableObjectArrayPtr, used_scripts)
+ POINTER_FIELD(LoadingUnitPtr, loading_unit)
+ POINTER_FIELD(ArrayPtr,
+ imports) // List of Namespaces imported without prefix.
+ POINTER_FIELD(ArrayPtr, exports) // List of re-exported Namespaces.
+ POINTER_FIELD(ArrayPtr, dependencies)
+ POINTER_FIELD(ExternalTypedDataPtr, kernel_data)
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
@@ -1347,10 +1436,13 @@
UNREACHABLE();
return NULL;
}
- ArrayPtr resolved_names_; // Cache of resolved names in library scope.
- ArrayPtr exported_names_; // Cache of exported names by library.
- ArrayPtr loaded_scripts_; // Array of scripts loaded in this library.
- VISIT_TO(ObjectPtr, loaded_scripts_);
+ POINTER_FIELD(ArrayPtr,
+ resolved_names); // Cache of resolved names in library scope.
+ POINTER_FIELD(ArrayPtr,
+ exported_names); // Cache of exported names by library.
+ POINTER_FIELD(ArrayPtr,
+ loaded_scripts); // Array of scripts loaded in this library.
+ VISIT_TO(ObjectPtr, loaded_scripts);
Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives.
Dart_NativeEntrySymbol native_entry_symbol_resolver_;
@@ -1370,34 +1462,35 @@
class NamespaceLayout : public ObjectLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace);
- VISIT_FROM(ObjectPtr, library_);
- LibraryPtr library_; // library with name dictionary.
- ArrayPtr show_names_; // list of names that are exported.
- ArrayPtr hide_names_; // list of names that are hidden.
- FieldPtr metadata_field_; // remembers the token pos of metadata if any,
- // and the metadata values if computed.
- VISIT_TO(ObjectPtr, metadata_field_);
+ VISIT_FROM(ObjectPtr, library)
+ POINTER_FIELD(LibraryPtr, library) // library with name dictionary.
+ POINTER_FIELD(ArrayPtr, show_names) // list of names that are exported.
+ POINTER_FIELD(ArrayPtr, hide_names) // list of names that are hidden.
+ POINTER_FIELD(FieldPtr,
+ metadata_field) // remembers the token pos of metadata if any,
+ // and the metadata values if computed.
+ VISIT_TO(ObjectPtr, metadata_field)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
};
class KernelProgramInfoLayout : public ObjectLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(KernelProgramInfo);
- VISIT_FROM(ObjectPtr, string_offsets_);
- TypedDataPtr string_offsets_;
- ExternalTypedDataPtr string_data_;
- TypedDataPtr canonical_names_;
- ExternalTypedDataPtr metadata_payloads_;
- ExternalTypedDataPtr metadata_mappings_;
- ArrayPtr scripts_;
- ArrayPtr constants_;
- GrowableObjectArrayPtr potential_natives_;
- GrowableObjectArrayPtr potential_pragma_functions_;
- ExternalTypedDataPtr constants_table_;
- ArrayPtr libraries_cache_;
- ArrayPtr classes_cache_;
- ObjectPtr retained_kernel_blob_;
- VISIT_TO(ObjectPtr, retained_kernel_blob_);
+ VISIT_FROM(ObjectPtr, string_offsets)
+ POINTER_FIELD(TypedDataPtr, string_offsets)
+ POINTER_FIELD(ExternalTypedDataPtr, string_data)
+ POINTER_FIELD(TypedDataPtr, canonical_names)
+ POINTER_FIELD(ExternalTypedDataPtr, metadata_payloads)
+ POINTER_FIELD(ExternalTypedDataPtr, metadata_mappings)
+ POINTER_FIELD(ArrayPtr, scripts)
+ POINTER_FIELD(ArrayPtr, constants)
+ POINTER_FIELD(GrowableObjectArrayPtr, potential_natives)
+ POINTER_FIELD(GrowableObjectArrayPtr, potential_pragma_functions)
+ POINTER_FIELD(ExternalTypedDataPtr, constants_table)
+ POINTER_FIELD(ArrayPtr, libraries_cache)
+ POINTER_FIELD(ArrayPtr, classes_cache)
+ POINTER_FIELD(ObjectPtr, retained_kernel_blob)
+ VISIT_TO(ObjectPtr, retained_kernel_blob)
uint32_t kernel_binary_version_;
@@ -1413,9 +1506,9 @@
VISIT_NOTHING();
ClassIdTagType cid_;
#else
- VISIT_FROM(ObjectPtr, target_);
- ObjectPtr target_;
- VISIT_TO(ObjectPtr, target_);
+ VISIT_FROM(ObjectPtr, target)
+ POINTER_FIELD(ObjectPtr, target)
+ VISIT_TO(ObjectPtr, target)
#endif
};
@@ -1468,39 +1561,40 @@
uword unchecked_entry_point_; // Accessed from generated code.
uword monomorphic_unchecked_entry_point_; // Accessed from generated code.
- VISIT_FROM(ObjectPtr, object_pool_);
- ObjectPoolPtr object_pool_; // Accessed from generated code.
- InstructionsPtr instructions_; // Accessed from generated code.
+ VISIT_FROM(ObjectPtr, object_pool)
+ POINTER_FIELD(ObjectPoolPtr, object_pool) // Accessed from generated code.
+ POINTER_FIELD(InstructionsPtr,
+ instructions) // Accessed from generated code.
// If owner_ is Function::null() the owner is a regular stub.
// If owner_ is a Class the owner is the allocation stub for that class.
// Else, owner_ is a regular Dart Function.
- ObjectPtr owner_; // Function, Null, or a Class.
- ExceptionHandlersPtr exception_handlers_;
- PcDescriptorsPtr pc_descriptors_;
+ POINTER_FIELD(ObjectPtr, owner) // Function, Null, or a Class.
+ POINTER_FIELD(ExceptionHandlersPtr, exception_handlers)
+ POINTER_FIELD(PcDescriptorsPtr, pc_descriptors)
// If FLAG_precompiled_mode, then this field contains
// TypedDataPtr catch_entry_moves_maps
// Otherwise, it is
// SmiPtr num_variables
- ObjectPtr catch_entry_;
- CompressedStackMapsPtr compressed_stackmaps_;
- ArrayPtr inlined_id_to_function_;
- CodeSourceMapPtr code_source_map_;
- NOT_IN_PRECOMPILED(InstructionsPtr active_instructions_);
- NOT_IN_PRECOMPILED(ArrayPtr deopt_info_array_);
+ POINTER_FIELD(ObjectPtr, catch_entry)
+ POINTER_FIELD(CompressedStackMapsPtr, compressed_stackmaps)
+ POINTER_FIELD(ArrayPtr, inlined_id_to_function)
+ POINTER_FIELD(CodeSourceMapPtr, code_source_map)
+ NOT_IN_PRECOMPILED(POINTER_FIELD(InstructionsPtr, active_instructions))
+ NOT_IN_PRECOMPILED(POINTER_FIELD(ArrayPtr, deopt_info_array))
// (code-offset, function, code) triples.
- NOT_IN_PRECOMPILED(ArrayPtr static_calls_target_table_);
+ NOT_IN_PRECOMPILED(POINTER_FIELD(ArrayPtr, static_calls_target_table))
// If return_address_metadata_ is a Smi, it is the offset to the prologue.
// Else, return_address_metadata_ is null.
- NOT_IN_PRODUCT(ObjectPtr return_address_metadata_);
- NOT_IN_PRODUCT(LocalVarDescriptorsPtr var_descriptors_);
- NOT_IN_PRODUCT(ArrayPtr comments_);
+ NOT_IN_PRODUCT(POINTER_FIELD(ObjectPtr, return_address_metadata))
+ NOT_IN_PRODUCT(POINTER_FIELD(LocalVarDescriptorsPtr, var_descriptors))
+ NOT_IN_PRODUCT(POINTER_FIELD(ArrayPtr, comments))
#if !defined(PRODUCT)
- VISIT_TO(ObjectPtr, comments_);
+ VISIT_TO(ObjectPtr, comments);
#elif defined(DART_PRECOMPILED_RUNTIME)
- VISIT_TO(ObjectPtr, code_source_map_);
+ VISIT_TO(ObjectPtr, code_source_map);
#else
- VISIT_TO(ObjectPtr, static_calls_target_table_);
+ VISIT_TO(ObjectPtr, static_calls_target_table);
#endif
// Compilation timestamp.
@@ -1855,7 +1949,7 @@
// platforms.
uword num_entries_;
- VISIT_FROM(ObjectPtr, names()[0]);
+ ObjectPtr* from() { return reinterpret_cast<ObjectPtr*>(&names()[0]); }
StringPtr* names() {
// Array of [num_entries_] variable names.
OPEN_ARRAY_START(StringPtr, StringPtr);
@@ -1880,9 +1974,9 @@
// Array with [num_entries_] entries. Each entry is an array of all handled
// exception types.
- VISIT_FROM(ObjectPtr, handled_types_data_)
- ArrayPtr handled_types_data_;
- VISIT_TO_LENGTH(ObjectPtr, &handled_types_data_);
+ VISIT_FROM(ObjectPtr, handled_types_data)
+ POINTER_FIELD(ArrayPtr, handled_types_data)
+ VISIT_TO_LENGTH(ObjectPtr, &handled_types_data_)
// Exception handler info of length [num_entries_].
const ExceptionHandlerInfo* data() const {
@@ -1900,12 +1994,10 @@
int32_t num_variables_;
- VISIT_FROM(ObjectPtr, parent_);
- ContextPtr parent_;
-
+ VISIT_FROM(ObjectPtr, parent)
+ POINTER_FIELD(ContextPtr, parent)
// Variable length data follows here.
- ObjectPtr* data() { OPEN_ARRAY_START(ObjectPtr, ObjectPtr); }
- ObjectPtr const* data() const { OPEN_ARRAY_START(ObjectPtr, ObjectPtr); }
+ VARIABLE_POINTER_FIELDS(ObjectPtr, element, data)
VISIT_TO_LENGTH(ObjectPtr, &data()[length - 1]);
friend class Object;
@@ -1964,9 +2056,9 @@
class SingleTargetCacheLayout : public ObjectLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(SingleTargetCache);
- VISIT_FROM(ObjectPtr, target_);
- CodePtr target_;
- VISIT_TO(ObjectPtr, target_);
+ VISIT_FROM(ObjectPtr, target)
+ POINTER_FIELD(CodePtr, target)
+ VISIT_TO(ObjectPtr, target)
uword entry_point_;
ClassIdTagType lower_limit_;
ClassIdTagType upper_limit_;
@@ -1974,9 +2066,10 @@
class MonomorphicSmiableCallLayout : public ObjectLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(MonomorphicSmiableCall);
- VISIT_FROM(ObjectPtr, target_);
- CodePtr target_; // Entrypoint PC in bare mode, Code in non-bare mode.
- VISIT_TO(ObjectPtr, target_);
+ VISIT_FROM(ObjectPtr, target)
+ POINTER_FIELD(CodePtr,
+ target); // Entrypoint PC in bare mode, Code in non-bare mode.
+ VISIT_TO(ObjectPtr, target)
uword expected_cid_;
uword entrypoint_;
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
@@ -1985,18 +2078,18 @@
// Abstract base class for RawICData/RawMegamorphicCache
class CallSiteDataLayout : public ObjectLayout {
protected:
- StringPtr target_name_; // Name of target function.
+ POINTER_FIELD(StringPtr, target_name); // Name of target function.
// arg_descriptor in RawICData and in RawMegamorphicCache should be
// in the same position so that NoSuchMethod can access it.
- ArrayPtr args_descriptor_; // Arguments descriptor.
+ POINTER_FIELD(ArrayPtr, args_descriptor); // Arguments descriptor.
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(CallSiteData)
};
class UnlinkedCallLayout : public CallSiteDataLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall);
- VISIT_FROM(ObjectPtr, target_name_);
- VISIT_TO(ObjectPtr, args_descriptor_);
+ VISIT_FROM(ObjectPtr, target_name)
+ VISIT_TO(ObjectPtr, args_descriptor)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
bool can_patch_to_monomorphic_;
@@ -2004,12 +2097,13 @@
class ICDataLayout : public CallSiteDataLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(ICData);
- VISIT_FROM(ObjectPtr, target_name_);
- ArrayPtr entries_; // Contains class-ids, target and count.
+ VISIT_FROM(ObjectPtr, target_name)
+ POINTER_FIELD(ArrayPtr, entries) // Contains class-ids, target and count.
// Static type of the receiver, if instance call and available.
- NOT_IN_PRECOMPILED(AbstractTypePtr receivers_static_type_);
- ObjectPtr owner_; // Parent/calling function or original IC of cloned IC.
- VISIT_TO(ObjectPtr, owner_);
+ NOT_IN_PRECOMPILED(POINTER_FIELD(AbstractTypePtr, receivers_static_type))
+ POINTER_FIELD(ObjectPtr,
+ owner) // Parent/calling function or original IC of cloned IC.
+ VISIT_TO(ObjectPtr, owner)
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
@@ -2032,10 +2126,11 @@
class MegamorphicCacheLayout : public CallSiteDataLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache);
- VISIT_FROM(ObjectPtr, target_name_)
- ArrayPtr buckets_;
- SmiPtr mask_;
- VISIT_TO(ObjectPtr, mask_)
+
+ VISIT_FROM(ObjectPtr, target_name)
+ POINTER_FIELD(ArrayPtr, buckets)
+ SMI_FIELD(SmiPtr, mask)
+ VISIT_TO(ObjectPtr, mask)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
int32_t filled_entry_count_;
@@ -2043,17 +2138,19 @@
class SubtypeTestCacheLayout : public ObjectLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache);
- VISIT_FROM(ObjectPtr, cache_);
- ArrayPtr cache_;
- VISIT_TO(ObjectPtr, cache_);
+
+ VISIT_FROM(ObjectPtr, cache)
+ POINTER_FIELD(ArrayPtr, cache)
+ VISIT_TO(ObjectPtr, cache)
};
class LoadingUnitLayout : public ObjectLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(LoadingUnit);
- VISIT_FROM(ObjectPtr, parent_);
- LoadingUnitPtr parent_;
- ArrayPtr base_objects_;
- VISIT_TO(ObjectPtr, base_objects_);
+
+ VISIT_FROM(ObjectPtr, parent)
+ POINTER_FIELD(LoadingUnitPtr, parent)
+ POINTER_FIELD(ArrayPtr, base_objects)
+ VISIT_TO(ObjectPtr, base_objects)
int32_t id_;
bool load_outstanding_;
bool loaded_;
@@ -2066,20 +2163,21 @@
class ApiErrorLayout : public ErrorLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(ApiError);
- VISIT_FROM(ObjectPtr, message_)
- StringPtr message_;
- VISIT_TO(ObjectPtr, message_)
+ VISIT_FROM(ObjectPtr, message)
+ POINTER_FIELD(StringPtr, message)
+ VISIT_TO(ObjectPtr, message)
};
class LanguageErrorLayout : public ErrorLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(LanguageError);
- VISIT_FROM(ObjectPtr, previous_error_)
- ErrorPtr previous_error_; // May be null.
- ScriptPtr script_;
- StringPtr message_;
- StringPtr formatted_message_; // Incl. previous error's formatted message.
- VISIT_TO(ObjectPtr, formatted_message_)
+ VISIT_FROM(ObjectPtr, previous_error)
+ POINTER_FIELD(ErrorPtr, previous_error) // May be null.
+ POINTER_FIELD(ScriptPtr, script)
+ POINTER_FIELD(StringPtr, message)
+ POINTER_FIELD(StringPtr,
+ formatted_message) // Incl. previous error's formatted message.
+ VISIT_TO(ObjectPtr, formatted_message)
TokenPosition token_pos_; // Source position in script_.
bool report_after_token_; // Report message at or after the token.
int8_t kind_; // Of type Report::Kind.
@@ -2090,19 +2188,19 @@
class UnhandledExceptionLayout : public ErrorLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException);
- VISIT_FROM(ObjectPtr, exception_)
- InstancePtr exception_;
- InstancePtr stacktrace_;
- VISIT_TO(ObjectPtr, stacktrace_)
+ VISIT_FROM(ObjectPtr, exception)
+ POINTER_FIELD(InstancePtr, exception)
+ POINTER_FIELD(InstancePtr, stacktrace)
+ VISIT_TO(ObjectPtr, stacktrace)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
};
class UnwindErrorLayout : public ErrorLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(UnwindError);
- VISIT_FROM(ObjectPtr, message_)
- StringPtr message_;
- VISIT_TO(ObjectPtr, message_)
+ VISIT_FROM(ObjectPtr, message)
+ POINTER_FIELD(StringPtr, message)
+ VISIT_TO(ObjectPtr, message)
bool is_user_initiated_;
};
@@ -2113,11 +2211,11 @@
class LibraryPrefixLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix);
- VISIT_FROM(ObjectPtr, name_)
- StringPtr name_; // Library prefix name.
- ArrayPtr imports_; // Libraries imported with this prefix.
- LibraryPtr importer_; // Library which declares this prefix.
- VISIT_TO(ObjectPtr, importer_)
+ VISIT_FROM(ObjectPtr, name)
+ POINTER_FIELD(StringPtr, name) // Library prefix name.
+ POINTER_FIELD(ArrayPtr, imports) // Libraries imported with this prefix.
+ POINTER_FIELD(LibraryPtr, importer) // Library which declares this prefix.
+ VISIT_TO(ObjectPtr, importer)
ObjectPtr* to_snapshot(Snapshot::Kind kind) {
switch (kind) {
case Snapshot::kFullAOT:
@@ -2143,20 +2241,15 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments);
- VISIT_FROM(ObjectPtr, instantiations_)
+ VISIT_FROM(ObjectPtr, instantiations)
// The instantiations_ array remains empty for instantiated type arguments.
- ArrayPtr instantiations_; // Of 3-tuple: 2 instantiators, result.
- SmiPtr length_;
- SmiPtr hash_;
- SmiPtr nullability_;
-
+ POINTER_FIELD(ArrayPtr,
+ instantiations) // Of 3-tuple: 2 instantiators, result.
+ SMI_FIELD(SmiPtr, length)
+ SMI_FIELD(SmiPtr, hash)
+ SMI_FIELD(SmiPtr, nullability)
// Variable length data follows here.
- AbstractTypePtr const* types() const {
- OPEN_ARRAY_START(AbstractTypePtr, AbstractTypePtr);
- }
- AbstractTypePtr* types() {
- OPEN_ARRAY_START(AbstractTypePtr, AbstractTypePtr);
- }
+ VARIABLE_POINTER_FIELDS(AbstractTypePtr, element, types)
ObjectPtr* to(intptr_t length) {
return reinterpret_cast<ObjectPtr*>(&types()[length - 1]);
}
@@ -2179,8 +2272,10 @@
static constexpr intptr_t kTypeStateBitSize = 2;
uword type_test_stub_entry_point_; // Accessed from generated code.
- CodePtr type_test_stub_; // Must be the last field, since subclasses use it
- // in their VISIT_FROM.
+ POINTER_FIELD(
+ CodePtr,
+ type_test_stub) // Must be the last field, since subclasses use it
+ // in their VISIT_FROM.
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(AbstractType);
@@ -2193,14 +2288,15 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(Type);
- VISIT_FROM(ObjectPtr, type_test_stub_)
- SmiPtr type_class_id_;
- TypeArgumentsPtr arguments_;
- SmiPtr hash_;
+ VISIT_FROM(ObjectPtr, type_test_stub)
+ POINTER_FIELD(SmiPtr, type_class_id)
+ POINTER_FIELD(TypeArgumentsPtr, arguments)
+ POINTER_FIELD(SmiPtr, hash)
// This type object represents a function type if its signature field is a
// non-null function object.
- FunctionPtr signature_; // If not null, this type is a function type.
- VISIT_TO(ObjectPtr, signature_)
+ POINTER_FIELD(FunctionPtr,
+ signature) // If not null, this type is a function type.
+ VISIT_TO(ObjectPtr, signature)
TokenPosition token_pos_;
int8_t type_state_;
int8_t nullability_;
@@ -2215,9 +2311,9 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef);
- VISIT_FROM(ObjectPtr, type_test_stub_)
- AbstractTypePtr type_; // The referenced type.
- VISIT_TO(ObjectPtr, type_)
+ VISIT_FROM(ObjectPtr, type_test_stub)
+ POINTER_FIELD(AbstractTypePtr, type) // The referenced type.
+ VISIT_TO(ObjectPtr, type)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
};
@@ -2225,17 +2321,18 @@
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter);
- VISIT_FROM(ObjectPtr, type_test_stub_)
- StringPtr name_;
- SmiPtr hash_;
- AbstractTypePtr bound_; // ObjectType if no explicit bound specified.
+ VISIT_FROM(ObjectPtr, type_test_stub)
+ POINTER_FIELD(StringPtr, name)
+ POINTER_FIELD(SmiPtr, hash)
+ POINTER_FIELD(AbstractTypePtr,
+ bound) // ObjectType if no explicit bound specified.
// The instantiation to bounds of this parameter as calculated by the CFE.
//
// TODO(dartbug.com/43901): Once a separate TypeParameters class has been
// added, move these there and remove them from TypeParameter objects.
- AbstractTypePtr default_argument_;
- FunctionPtr parameterized_function_;
- VISIT_TO(ObjectPtr, parameterized_function_)
+ POINTER_FIELD(AbstractTypePtr, default_argument)
+ POINTER_FIELD(FunctionPtr, parameterized_function)
+ VISIT_TO(ObjectPtr, parameterized_function)
ClassIdTagType parameterized_class_id_;
TokenPosition token_pos_;
int16_t index_;
@@ -2265,15 +2362,15 @@
// The following fields are also declared in the Dart source of class
// _Closure.
- VISIT_FROM(RawCompressed, instantiator_type_arguments_)
- TypeArgumentsPtr instantiator_type_arguments_;
- TypeArgumentsPtr function_type_arguments_;
- TypeArgumentsPtr delayed_type_arguments_;
- FunctionPtr function_;
- ContextPtr context_;
- SmiPtr hash_;
+ VISIT_FROM(RawCompressed, instantiator_type_arguments)
+ POINTER_FIELD(TypeArgumentsPtr, instantiator_type_arguments)
+ POINTER_FIELD(TypeArgumentsPtr, function_type_arguments)
+ POINTER_FIELD(TypeArgumentsPtr, delayed_type_arguments)
+ POINTER_FIELD(FunctionPtr, function)
+ POINTER_FIELD(ContextPtr, context)
+ POINTER_FIELD(SmiPtr, hash)
- VISIT_TO(RawCompressed, hash_)
+ VISIT_TO(RawCompressed, hash)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
@@ -2342,13 +2439,13 @@
RAW_HEAP_OBJECT_IMPLEMENTATION(String);
protected:
- VISIT_FROM(ObjectPtr, length_)
- SmiPtr length_;
+ VISIT_FROM(ObjectPtr, length)
+ SMI_FIELD(SmiPtr, length)
#if !defined(HASH_IN_OBJECT_HEADER)
- SmiPtr hash_;
- VISIT_TO(ObjectPtr, hash_)
+ SMI_FIELD(SmiPtr, hash)
+ VISIT_TO(ObjectPtr, hash)
#else
- VISIT_TO(ObjectPtr, length_)
+ VISIT_TO(ObjectPtr, length)
#endif
private:
@@ -2417,7 +2514,7 @@
protected:
// The length of the view in element sizes (obtainable via
// [TypedDataBase::ElementSizeInBytes]).
- SmiPtr length_;
+ SMI_FIELD(SmiPtr, length);
private:
friend class TypedDataViewLayout;
@@ -2436,7 +2533,7 @@
void RecomputeDataField() { data_ = internal_data(); }
protected:
- VISIT_FROM(RawCompressed, length_)
+ VISIT_FROM(RawCompressed, length)
VISIT_TO_LENGTH(RawCompressed, &length_)
// Variable length data follows here.
@@ -2472,7 +2569,7 @@
// Recompute [data_] based on internal/external [typed_data_].
void RecomputeDataField() {
const intptr_t offset_in_bytes = RawSmiValue(offset_in_bytes_);
- uint8_t* payload = typed_data_->ptr()->data_;
+ uint8_t* payload = typed_data()->ptr()->data_;
data_ = payload + offset_in_bytes;
}
@@ -2485,12 +2582,12 @@
void RecomputeDataFieldForInternalTypedData() {
const intptr_t offset_in_bytes = RawSmiValue(offset_in_bytes_);
uint8_t* payload = reinterpret_cast<uint8_t*>(
- ObjectLayout::ToAddr(typed_data_) + TypedDataLayout::payload_offset());
+ ObjectLayout::ToAddr(typed_data()) + TypedDataLayout::payload_offset());
data_ = payload + offset_in_bytes;
}
void ValidateInnerPointer() {
- if (typed_data_->ptr()->GetClassId() == kNullCid) {
+ if (typed_data()->ptr()->GetClassId() == kNullCid) {
// The view object must have gotten just initialized.
if (data_ != nullptr || RawSmiValue(offset_in_bytes_) != 0 ||
RawSmiValue(length_) != 0) {
@@ -2498,7 +2595,7 @@
}
} else {
const intptr_t offset_in_bytes = RawSmiValue(offset_in_bytes_);
- uint8_t* payload = typed_data_->ptr()->data_;
+ uint8_t* payload = typed_data()->ptr()->data_;
if ((payload + offset_in_bytes) != data_) {
FATAL("RawTypedDataView has invalid inner pointer.");
}
@@ -2506,10 +2603,10 @@
}
protected:
- VISIT_FROM(ObjectPtr, length_)
- TypedDataBasePtr typed_data_;
- SmiPtr offset_in_bytes_;
- VISIT_TO(ObjectPtr, offset_in_bytes_)
+ VISIT_FROM(ObjectPtr, length)
+ POINTER_FIELD(TypedDataBasePtr, typed_data)
+ SMI_FIELD(SmiPtr, offset_in_bytes)
+ VISIT_TO(ObjectPtr, offset_in_bytes)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
friend class Api;
@@ -2553,12 +2650,11 @@
class ArrayLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(Array);
- VISIT_FROM(RawCompressed, type_arguments_)
- TypeArgumentsPtr type_arguments_;
- SmiPtr length_;
+ VISIT_FROM(RawCompressed, type_arguments)
+ ARRAY_POINTER_FIELD(TypeArgumentsPtr, type_arguments)
+ SMI_FIELD(SmiPtr, length)
// Variable length data follows here.
- ObjectPtr* data() { OPEN_ARRAY_START(ObjectPtr, ObjectPtr); }
- ObjectPtr const* data() const { OPEN_ARRAY_START(ObjectPtr, ObjectPtr); }
+ VARIABLE_POINTER_FIELDS(ObjectPtr, element, data)
VISIT_TO_LENGTH(RawCompressed, &data()[length - 1])
friend class LinkedHashMapSerializationCluster;
@@ -2589,11 +2685,11 @@
class GrowableObjectArrayLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray);
- VISIT_FROM(RawCompressed, type_arguments_)
- TypeArgumentsPtr type_arguments_;
- SmiPtr length_;
- ArrayPtr data_;
- VISIT_TO(RawCompressed, data_)
+ VISIT_FROM(RawCompressed, type_arguments)
+ POINTER_FIELD(TypeArgumentsPtr, type_arguments)
+ SMI_FIELD(SmiPtr, length)
+ POINTER_FIELD(ArrayPtr, data)
+ VISIT_TO(RawCompressed, data)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
friend class SnapshotReader;
@@ -2603,14 +2699,14 @@
class LinkedHashMapLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap);
- VISIT_FROM(RawCompressed, type_arguments_)
- TypeArgumentsPtr type_arguments_;
- TypedDataPtr index_;
- SmiPtr hash_mask_;
- ArrayPtr data_;
- SmiPtr used_data_;
- SmiPtr deleted_keys_;
- VISIT_TO(RawCompressed, deleted_keys_)
+ VISIT_FROM(RawCompressed, type_arguments)
+ POINTER_FIELD(TypeArgumentsPtr, type_arguments)
+ POINTER_FIELD(TypedDataPtr, index)
+ POINTER_FIELD(SmiPtr, hash_mask)
+ POINTER_FIELD(ArrayPtr, data)
+ POINTER_FIELD(SmiPtr, used_data)
+ POINTER_FIELD(SmiPtr, deleted_keys)
+ VISIT_TO(RawCompressed, deleted_keys)
friend class SnapshotReader;
};
@@ -2678,16 +2774,16 @@
RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData);
protected:
- VISIT_FROM(RawCompressed, length_)
- VISIT_TO(RawCompressed, length_)
+ VISIT_FROM(RawCompressed, length)
+ VISIT_TO(RawCompressed, length)
};
class PointerLayout : public PointerBaseLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(Pointer);
- VISIT_FROM(RawCompressed, type_arguments_)
- TypeArgumentsPtr type_arguments_;
- VISIT_TO(RawCompressed, type_arguments_)
+ VISIT_FROM(RawCompressed, type_arguments)
+ POINTER_FIELD(TypeArgumentsPtr, type_arguments)
+ VISIT_TO(RawCompressed, type_arguments)
friend class Pointer;
};
@@ -2719,15 +2815,15 @@
class ReceivePortLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(ReceivePort);
- VISIT_FROM(ObjectPtr, send_port_)
- SendPortPtr send_port_;
- InstancePtr handler_;
+ VISIT_FROM(ObjectPtr, send_port)
+ POINTER_FIELD(SendPortPtr, send_port)
+ POINTER_FIELD(InstancePtr, handler)
#if !defined(PRODUCT)
- StringPtr debug_name_;
- StackTracePtr allocation_location_;
- VISIT_TO(ObjectPtr, allocation_location_)
+ POINTER_FIELD(StringPtr, debug_name)
+ POINTER_FIELD(StackTracePtr, allocation_location)
+ VISIT_TO(ObjectPtr, allocation_location)
#else
- VISIT_TO(ObjectPtr, handler_);
+ VISIT_TO(ObjectPtr, handler)
#endif // !defined(PRODUCT)
};
@@ -2743,11 +2839,13 @@
class StackTraceLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(StackTrace);
- VISIT_FROM(ObjectPtr, async_link_)
- StackTracePtr async_link_; // Link to parent async stack trace.
- ArrayPtr code_array_; // Code object for each frame in the stack trace.
- ArrayPtr pc_offset_array_; // Offset of PC for each frame.
- VISIT_TO(ObjectPtr, pc_offset_array_)
+ VISIT_FROM(ObjectPtr, async_link)
+ POINTER_FIELD(StackTracePtr,
+ async_link); // Link to parent async stack trace.
+ POINTER_FIELD(ArrayPtr,
+ code_array); // Code object for each frame in the stack trace.
+ POINTER_FIELD(ArrayPtr, pc_offset_array); // Offset of PC for each frame.
+ VISIT_TO(ObjectPtr, pc_offset_array)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
// False for pre-allocated stack trace (used in OOM and Stack overflow).
@@ -2762,31 +2860,19 @@
class RegExpLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(RegExp);
- VISIT_FROM(ObjectPtr, num_bracket_expressions_)
- SmiPtr num_bracket_expressions_;
- ArrayPtr capture_name_map_;
- StringPtr pattern_; // Pattern to be used for matching.
- union {
- FunctionPtr function_;
- TypedDataPtr bytecode_;
- } one_byte_;
- union {
- FunctionPtr function_;
- TypedDataPtr bytecode_;
- } two_byte_;
- FunctionPtr external_one_byte_function_;
- FunctionPtr external_two_byte_function_;
- union {
- FunctionPtr function_;
- TypedDataPtr bytecode_;
- } one_byte_sticky_;
- union {
- FunctionPtr function_;
- TypedDataPtr bytecode_;
- } two_byte_sticky_;
- FunctionPtr external_one_byte_sticky_function_;
- FunctionPtr external_two_byte_sticky_function_;
- VISIT_TO(ObjectPtr, external_two_byte_sticky_function_)
+ VISIT_FROM(ObjectPtr, num_bracket_expressions)
+ POINTER_FIELD(SmiPtr, num_bracket_expressions)
+ POINTER_FIELD(ArrayPtr, capture_name_map)
+ POINTER_FIELD(StringPtr, pattern) // Pattern to be used for matching.
+ POINTER_FIELD(ObjectPtr, one_byte) // FunctionPtr or TypedDataPtr
+ POINTER_FIELD(ObjectPtr, two_byte)
+ POINTER_FIELD(ObjectPtr, external_one_byte)
+ POINTER_FIELD(ObjectPtr, external_two_byte)
+ POINTER_FIELD(ObjectPtr, one_byte_sticky)
+ POINTER_FIELD(ObjectPtr, two_byte_sticky)
+ POINTER_FIELD(ObjectPtr, external_one_byte_sticky)
+ POINTER_FIELD(ObjectPtr, external_two_byte_sticky)
+ VISIT_TO(ObjectPtr, external_two_byte_sticky)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
// The same pattern may use different amount of registers if compiled
@@ -2806,10 +2892,10 @@
class WeakPropertyLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty);
- VISIT_FROM(ObjectPtr, key_)
- ObjectPtr key_;
- ObjectPtr value_;
- VISIT_TO(ObjectPtr, value_)
+ VISIT_FROM(ObjectPtr, key)
+ POINTER_FIELD(ObjectPtr, key)
+ POINTER_FIELD(ObjectPtr, value)
+ VISIT_TO(ObjectPtr, value)
ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); }
// Linked list is chaining all pending weak properties.
@@ -2829,18 +2915,18 @@
class MirrorReferenceLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(MirrorReference);
- VISIT_FROM(ObjectPtr, referent_)
- ObjectPtr referent_;
- VISIT_TO(ObjectPtr, referent_)
+ VISIT_FROM(ObjectPtr, referent)
+ POINTER_FIELD(ObjectPtr, referent)
+ VISIT_TO(ObjectPtr, referent)
};
// UserTag are used by the profiler to track Dart script state.
class UserTagLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(UserTag);
- VISIT_FROM(ObjectPtr, label_)
- StringPtr label_;
- VISIT_TO(ObjectPtr, label_)
+ VISIT_FROM(ObjectPtr, label)
+ POINTER_FIELD(StringPtr, label)
+ VISIT_TO(ObjectPtr, label)
// Isolate unique tag.
uword tag_;
@@ -2855,9 +2941,9 @@
class FutureOrLayout : public InstanceLayout {
RAW_HEAP_OBJECT_IMPLEMENTATION(FutureOr);
- VISIT_FROM(RawCompressed, type_arguments_)
- TypeArgumentsPtr type_arguments_;
- VISIT_TO(RawCompressed, type_arguments_)
+ VISIT_FROM(RawCompressed, type_arguments)
+ POINTER_FIELD(TypeArgumentsPtr, type_arguments)
+ VISIT_TO(RawCompressed, type_arguments)
friend class SnapshotReader;
};
diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc
index 94d167c..cf5625b 100644
--- a/runtime/vm/raw_object_fields.cc
+++ b/runtime/vm/raw_object_fields.cc
@@ -173,10 +173,14 @@
F(RegExp, num_bracket_expressions_) \
F(RegExp, capture_name_map_) \
F(RegExp, pattern_) \
- F(RegExp, external_one_byte_function_) \
- F(RegExp, external_two_byte_function_) \
- F(RegExp, external_one_byte_sticky_function_) \
- F(RegExp, external_two_byte_sticky_function_) \
+ F(RegExp, one_byte_) \
+ F(RegExp, two_byte_) \
+ F(RegExp, external_one_byte_) \
+ F(RegExp, external_two_byte_) \
+ F(RegExp, one_byte_sticky_) \
+ F(RegExp, two_byte_sticky_) \
+ F(RegExp, external_one_byte_sticky_) \
+ F(RegExp, external_two_byte_sticky_) \
F(WeakProperty, key_) \
F(WeakProperty, value_) \
F(MirrorReference, referent_) \
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 674307f..853c1cac 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -61,7 +61,7 @@
writer->WriteTags(writer->GetObjectTags(this));
if (writer->can_send_any_object() ||
- writer->AllowObjectsInDartLibrary(library_)) {
+ writer->AllowObjectsInDartLibrary(library())) {
writer->WriteClassId(this);
} else {
// We do not allow regular dart instances in isolate messages.
@@ -122,7 +122,7 @@
bool as_reference) {
ASSERT(writer != NULL);
- if (signature_ != Function::null()) {
+ if (signature() != Function::null()) {
writer->SetWriteException(Exceptions::kArgument,
"Illegal argument in isolate message"
" : (function types are not supported yet)");
@@ -132,7 +132,7 @@
// Only resolved and finalized types should be written to a snapshot.
ASSERT((type_state_ == TypeLayout::kFinalizedInstantiated) ||
(type_state_ == TypeLayout::kFinalizedUninstantiated));
- ASSERT(type_class_id_ != Object::null());
+ ASSERT(type_class_id() != Object::null());
// Write out the serialization header value for this object.
writer->WriteInlinedObjectHeader(object_id);
@@ -141,13 +141,13 @@
writer->WriteIndexedObject(kTypeCid);
writer->WriteTags(writer->GetObjectTags(this));
- if (type_class_id_->IsHeapObject()) {
+ if (type_class_id()->IsHeapObject()) {
// Type class is still an unresolved class.
UNREACHABLE();
}
// Lookup the type class.
- SmiPtr raw_type_class_id = Smi::RawCast(type_class_id_);
+ SmiPtr raw_type_class_id = Smi::RawCast(type_class_id());
ClassPtr type_class =
writer->isolate()->class_table()->At(Smi::Value(raw_type_class_id));
@@ -167,7 +167,7 @@
writer->Write<uint8_t>(combined);
// Write out all the object pointer fields.
- ASSERT(type_class_id_ != Object::null());
+ ASSERT(type_class_id() != Object::null());
SnapshotWriterVisitor visitor(writer, as_reference);
visitor.VisitPointers(from(), to());
@@ -297,13 +297,13 @@
visitor.VisitPointers(from(), to());
if (parameterized_class_id_ != kFunctionCid) {
- ASSERT(parameterized_function_ == Function::null());
+ ASSERT(parameterized_function() == Function::null());
// Write out the parameterized class.
ClassPtr param_class =
writer->isolate()->class_table()->At(parameterized_class_id_);
writer->WriteObjectImpl(param_class, kAsReference);
} else {
- ASSERT(parameterized_function_ != Function::null());
+ ASSERT(parameterized_function() != Function::null());
}
}
@@ -353,10 +353,10 @@
writer->WriteTags(writer->GetObjectTags(this));
// Write out the length field.
- writer->Write<ObjectPtr>(length_);
+ writer->Write<ObjectPtr>(length());
// Write out the individual types.
- intptr_t len = Smi::Value(length_);
+ intptr_t len = Smi::Value(length());
for (intptr_t i = 0; i < len; i++) {
// The Dart VM reuses type argument lists across instances in order
// to reduce memory footprint, this can sometimes lead to a type from
@@ -366,10 +366,10 @@
if (!writer->can_send_any_object()) {
// Lookup the type class.
TypePtr raw_type = Type::RawCast(types()[i]);
- SmiPtr raw_type_class_id = Smi::RawCast(raw_type->ptr()->type_class_id_);
+ SmiPtr raw_type_class_id = Smi::RawCast(raw_type->ptr()->type_class_id());
ClassPtr type_class =
writer->isolate()->class_table()->At(Smi::Value(raw_type_class_id));
- if (!writer->AllowObjectsInDartLibrary(type_class->ptr()->library_)) {
+ if (!writer->AllowObjectsInDartLibrary(type_class->ptr()->library())) {
writer->WriteVMIsolateObject(kDynamicType);
} else {
writer->WriteObjectImpl(types()[i], as_reference);
@@ -400,7 +400,7 @@
FunctionPtr func = writer->IsSerializableClosure(ClosurePtr(this));
if (func != Function::null()) {
writer->WriteStaticImplicitClosure(
- object_id, func, writer->GetObjectTags(this), delayed_type_arguments_);
+ object_id, func, writer->GetObjectTags(this), delayed_type_arguments());
return;
}
@@ -933,7 +933,7 @@
Snapshot::Kind kind,
bool as_reference) {
StringWriteTo(writer, object_id, kind, kOneByteStringCid,
- writer->GetObjectTags(this), length_, data());
+ writer->GetObjectTags(this), length(), data());
}
void TwoByteStringLayout::WriteTo(SnapshotWriter* writer,
@@ -941,7 +941,7 @@
Snapshot::Kind kind,
bool as_reference) {
StringWriteTo(writer, object_id, kind, kTwoByteStringCid,
- writer->GetObjectTags(this), length_, data());
+ writer->GetObjectTags(this), length(), data());
}
ExternalOneByteStringPtr ExternalOneByteString::ReadFrom(SnapshotReader* reader,
@@ -968,7 +968,7 @@
bool as_reference) {
// Serialize as a non-external one byte string.
StringWriteTo(writer, object_id, kind, kOneByteStringCid,
- writer->GetObjectTags(this), length_, external_data_);
+ writer->GetObjectTags(this), length(), external_data_);
}
void ExternalTwoByteStringLayout::WriteTo(SnapshotWriter* writer,
@@ -977,7 +977,7 @@
bool as_reference) {
// Serialize as a non-external two byte string.
StringWriteTo(writer, object_id, kind, kTwoByteStringCid,
- writer->GetObjectTags(this), length_, external_data_);
+ writer->GetObjectTags(this), length(), external_data_);
}
ArrayPtr Array::ReadFrom(SnapshotReader* reader,
@@ -1046,7 +1046,7 @@
bool as_reference) {
ASSERT(!this->IsCanonical());
writer->ArrayWriteTo(object_id, kArrayCid, writer->GetObjectTags(this),
- length_, type_arguments_, data(), as_reference);
+ length(), type_arguments(), data(), as_reference);
}
void ImmutableArrayLayout::WriteTo(SnapshotWriter* writer,
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 0a6c2b8..6655cbe 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -1323,10 +1323,10 @@
ASSERT(!IsSingletonClassId(class_id) && !IsBootstrapedClassId(class_id));
// Write out the library url and class name.
- LibraryPtr library = cls->library_;
+ LibraryPtr library = cls->library();
ASSERT(library != Library::null());
WriteObjectImpl(library->ptr()->url_, kAsInlinedObject);
- WriteObjectImpl(cls->name_, kAsInlinedObject);
+ WriteObjectImpl(cls->name(), kAsInlinedObject);
}
void SnapshotWriter::WriteStaticImplicitClosure(
@@ -1346,11 +1346,11 @@
// Write out the library url, class name and signature function name.
ClassPtr cls = GetFunctionOwner(func);
ASSERT(cls != Class::null());
- LibraryPtr library = cls->ptr()->library_;
+ LibraryPtr library = cls->ptr()->library();
ASSERT(library != Library::null());
- WriteObjectImpl(library->ptr()->url_, kAsInlinedObject);
- WriteObjectImpl(cls->ptr()->name_, kAsInlinedObject);
- WriteObjectImpl(func->ptr()->name_, kAsInlinedObject);
+ WriteObjectImpl(library->ptr()->url(), kAsInlinedObject);
+ WriteObjectImpl(cls->ptr()->name(), kAsInlinedObject);
+ WriteObjectImpl(func->ptr()->name(), kAsInlinedObject);
WriteObjectImpl(delayed_type_arguments, kAsInlinedObject);
}
@@ -1398,7 +1398,7 @@
FunctionPtr SnapshotWriter::IsSerializableClosure(ClosurePtr closure) {
// Extract the function object to check if this closure
// can be sent in an isolate message.
- FunctionPtr func = closure->ptr()->function_;
+ FunctionPtr func = closure->ptr()->function();
// We only allow closure of top level methods or static functions in a
// class to be sent in isolate messages.
if (can_send_any_object() &&
@@ -1422,7 +1422,7 @@
}
ClassPtr SnapshotWriter::GetFunctionOwner(FunctionPtr func) {
- ObjectPtr owner = func->ptr()->owner_;
+ ObjectPtr owner = func->ptr()->owner();
uword tags = GetObjectTags(owner);
intptr_t class_id = ObjectLayout::ClassIdTag::decode(tags);
if (class_id == kClassCid) {