diff --git a/runtime/lib/regexp.cc b/runtime/lib/regexp.cc index 3e0e33734bf..6c10d7dba26 100644 --- a/runtime/lib/regexp.cc +++ b/runtime/lib/regexp.cc @@ -85,7 +85,7 @@ DEFINE_NATIVE_ENTRY(RegExp_getGroupCount, 0, 1) { const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0)); ASSERT(!regexp.IsNull()); if (regexp.is_initialized()) { - return regexp.num_bracket_expressions(); + return Smi::New(regexp.num_bracket_expressions()); } const String& pattern = String::Handle(regexp.pattern()); const String& errmsg = diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc index 60736953132..9d182edab17 100644 --- a/runtime/vm/class_finalizer.cc +++ b/runtime/vm/class_finalizer.cc @@ -1432,10 +1432,10 @@ class CidRewriteVisitor : public ObjectVisitor { Map(param->untag()->parameterized_class_id_); } else if (obj->IsType()) { TypePtr type = Type::RawCast(obj); - ObjectPtr id = type->untag()->type_class_id_; + ObjectPtr id = type->untag()->type_class_id(); if (!id->IsHeapObject()) { - type->untag()->type_class_id_ = - Smi::New(Map(Smi::Value(Smi::RawCast(id)))); + type->untag()->set_type_class_id( + Smi::New(Map(Smi::Value(Smi::RawCast(id))))); } } else { intptr_t old_cid = obj->GetClassId(); diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc index 4a638434506..a94e18ab4c5 100644 --- a/runtime/vm/clustered_snapshot.cc +++ b/runtime/vm/clustered_snapshot.cc @@ -3804,12 +3804,12 @@ class TypeSerializationCluster PushFromTo(type); - if (type->untag()->type_class_id_->IsHeapObject()) { + if (type->untag()->type_class_id()->IsHeapObject()) { // Type class is still an unresolved class. UNREACHABLE(); } - SmiPtr raw_type_class_id = Smi::RawCast(type->untag()->type_class_id_); + SmiPtr raw_type_class_id = Smi::RawCast(type->untag()->type_class_id()); ClassPtr type_class = s->isolate_group()->class_table()->At(Smi::Value(raw_type_class_id)); s->Push(type_class); @@ -3844,7 +3844,7 @@ class TypeSerializationCluster // inserted into the canonical_types set. // Keep in sync with Type::Canonicalize. virtual bool IsInCanonicalSet(Serializer* s, TypePtr type) { - SmiPtr raw_type_class_id = Smi::RawCast(type->untag()->type_class_id_); + SmiPtr raw_type_class_id = Smi::RawCast(type->untag()->type_class_id()); ClassPtr type_class = s->isolate_group()->class_table()->At(Smi::Value(raw_type_class_id)); if (type_class->untag()->declaration_type() != type) { @@ -4627,7 +4627,7 @@ class TypedDataSerializationCluster : public SerializationCluster { TypedDataPtr data = objects_[i]; s->AssignRef(data); AutoTraceObject(data); - const intptr_t length = Smi::Value(data->untag()->length_); + const intptr_t length = Smi::Value(data->untag()->length()); s->WriteUnsigned(length); target_memory_size_ += compiler::target::TypedData::InstanceSize(length * element_size); @@ -4640,7 +4640,7 @@ class TypedDataSerializationCluster : public SerializationCluster { for (intptr_t i = 0; i < count; i++) { TypedDataPtr data = objects_[i]; AutoTraceObject(data); - const intptr_t length = Smi::Value(data->untag()->length_); + const intptr_t length = Smi::Value(data->untag()->length()); s->WriteUnsigned(length); uint8_t* cdata = reinterpret_cast(data->untag()->data()); s->WriteBytes(cdata, length * element_size); @@ -4805,7 +4805,7 @@ class ExternalTypedDataSerializationCluster : public SerializationCluster { for (intptr_t i = 0; i < count; i++) { ExternalTypedDataPtr data = objects_[i]; AutoTraceObject(data); - const intptr_t length = Smi::Value(data->untag()->length_); + const intptr_t length = Smi::Value(data->untag()->length()); s->WriteUnsigned(length); uint8_t* cdata = reinterpret_cast(data->untag()->data_); s->Align(ExternalTypedData::kDataSerializationAlignment); @@ -5296,7 +5296,7 @@ class OneByteStringSerializationCluster : public SerializationCluster { OneByteStringPtr str = objects_[i]; s->AssignRef(str); AutoTraceObject(str); - const intptr_t length = Smi::Value(str->untag()->length_); + const intptr_t length = Smi::Value(str->untag()->length()); s->WriteUnsigned(length); target_memory_size_ += compiler::target::OneByteString::InstanceSize(length); @@ -5308,7 +5308,7 @@ class OneByteStringSerializationCluster : public SerializationCluster { for (intptr_t i = 0; i < count; i++) { OneByteStringPtr str = objects_[i]; AutoTraceObject(str); - const intptr_t length = Smi::Value(str->untag()->length_); + const intptr_t length = Smi::Value(str->untag()->length()); ASSERT(length <= compiler::target::kSmiMax); s->WriteUnsigned(length); s->WriteBytes(str->untag()->data(), length); @@ -5406,7 +5406,7 @@ class TwoByteStringSerializationCluster : public SerializationCluster { TwoByteStringPtr str = objects_[i]; s->AssignRef(str); AutoTraceObject(str); - const intptr_t length = Smi::Value(str->untag()->length_); + const intptr_t length = Smi::Value(str->untag()->length()); s->WriteUnsigned(length); target_memory_size_ += compiler::target::TwoByteString::InstanceSize(length); @@ -5418,7 +5418,7 @@ class TwoByteStringSerializationCluster : public SerializationCluster { for (intptr_t i = 0; i < count; i++) { TwoByteStringPtr str = objects_[i]; AutoTraceObject(str); - const intptr_t length = Smi::Value(str->untag()->length_); + const intptr_t length = Smi::Value(str->untag()->length()); ASSERT(length <= (compiler::target::kSmiMax / 2)); s->WriteUnsigned(length); s->WriteBytes(reinterpret_cast(str->untag()->data()), diff --git a/runtime/vm/compiler/asm_intrinsifier_arm64.cc b/runtime/vm/compiler/asm_intrinsifier_arm64.cc index eede391d6be..91c8e5413d8 100644 --- a/runtime/vm/compiler/asm_intrinsifier_arm64.cc +++ b/runtime/vm/compiler/asm_intrinsifier_arm64.cc @@ -1457,7 +1457,7 @@ void AsmIntrinsifier::String_getHashCode(Assembler* assembler, void AsmIntrinsifier::Type_getHashCode(Assembler* assembler, Label* normal_ir_body) { __ ldr(R0, Address(SP, 0 * target::kWordSize)); - __ ldr(R0, FieldAddress(R0, target::Type::hash_offset())); + __ LoadCompressed(R0, FieldAddress(R0, target::Type::hash_offset())); __ cbz(normal_ir_body, R0); __ ret(); // Hash not yet computed. @@ -1479,9 +1479,11 @@ void AsmIntrinsifier::Type_equality(Assembler* assembler, __ b(normal_ir_body, NE); // Check if types are syntactically equal. - __ ldr(R3, FieldAddress(R1, target::Type::type_class_id_offset())); + __ LoadCompressedSmi(R3, + FieldAddress(R1, target::Type::type_class_id_offset())); __ SmiUntag(R3); - __ ldr(R4, FieldAddress(R2, target::Type::type_class_id_offset())); + __ LoadCompressedSmi(R4, + FieldAddress(R2, target::Type::type_class_id_offset())); __ SmiUntag(R4); EquivalentClassIds(assembler, normal_ir_body, &equiv_cids, ¬_equal, R3, R4, R0); @@ -1521,7 +1523,7 @@ void AsmIntrinsifier::Type_equality(Assembler* assembler, void AsmIntrinsifier::FunctionType_getHashCode(Assembler* assembler, Label* normal_ir_body) { __ ldr(R0, Address(SP, 0 * target::kWordSize)); - __ ldr(R0, FieldAddress(R0, target::FunctionType::hash_offset())); + __ LoadCompressed(R0, FieldAddress(R0, target::FunctionType::hash_offset())); __ cbz(normal_ir_body, R0); __ ret(); // Hash not yet computed. @@ -1572,10 +1574,11 @@ void GenerateSubstringMatchesSpecialization(Assembler* assembler, Label* return_true, Label* return_false) { __ SmiUntag(R1); - __ ldr(R8, FieldAddress(R0, target::String::length_offset())); // this.length + __ LoadCompressedSmi( + R8, FieldAddress(R0, target::String::length_offset())); // this.length __ SmiUntag(R8); - __ ldr(R9, - FieldAddress(R2, target::String::length_offset())); // other.length + __ LoadCompressedSmi( + R9, FieldAddress(R2, target::String::length_offset())); // other.length __ SmiUntag(R9); // if (other.length == 0) return true; @@ -1682,7 +1685,7 @@ void AsmIntrinsifier::StringBaseCharAt(Assembler* assembler, __ ldr(R0, Address(SP, 1 * target::kWordSize)); // String. __ BranchIfNotSmi(R1, normal_ir_body); // Index is not a Smi. // Range check. - __ ldr(R2, FieldAddress(R0, target::String::length_offset())); + __ LoadCompressedSmi(R2, FieldAddress(R0, target::String::length_offset())); __ cmp(R1, Operand(R2)); __ b(normal_ir_body, CS); // Runtime throws exception. @@ -1719,7 +1722,7 @@ void AsmIntrinsifier::StringBaseCharAt(Assembler* assembler, void AsmIntrinsifier::StringBaseIsEmpty(Assembler* assembler, Label* normal_ir_body) { __ ldr(R0, Address(SP, 0 * target::kWordSize)); - __ ldr(R0, FieldAddress(R0, target::String::length_offset())); + __ LoadCompressedSmi(R0, FieldAddress(R0, target::String::length_offset())); __ cmp(R0, Operand(target::ToRawSmi(0)), kObjectBytes); __ LoadObject(R0, CastHandle(TrueObject())); __ LoadObject(TMP, CastHandle(FalseObject())); @@ -1738,7 +1741,7 @@ void AsmIntrinsifier::OneByteString_getHashCode(Assembler* assembler, __ ret(); // Return if already computed. __ Bind(&compute_hash); - __ ldr(R2, FieldAddress(R1, target::String::length_offset())); + __ LoadCompressedSmi(R2, FieldAddress(R1, target::String::length_offset())); __ SmiUntag(R2); Label done; @@ -1873,7 +1876,7 @@ static void TryAllocateString(Assembler* assembler, } // Set the length field using the saved length (R6). - __ StoreIntoObjectNoBarrier( + __ StoreCompressedIntoObjectNoBarrier( R0, FieldAddress(R0, target::String::length_offset()), R6); __ b(ok); } @@ -2008,8 +2011,8 @@ static void StringEquality(Assembler* assembler, __ b(normal_ir_body, NE); // Have same length? - __ ldr(R2, FieldAddress(R0, target::String::length_offset())); - __ ldr(R3, FieldAddress(R1, target::String::length_offset())); + __ LoadCompressedSmi(R2, FieldAddress(R0, target::String::length_offset())); + __ LoadCompressedSmi(R3, FieldAddress(R1, target::String::length_offset())); __ CompareObjectRegisters(R2, R3); __ b(&is_false, NE); @@ -2085,9 +2088,13 @@ void AsmIntrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, __ ldr(R1, Address(SP, kStringParamOffset)); __ LoadClassId(R1, R1); __ AddImmediate(R1, -kOneByteStringCid); +#if !defined(DART_COMPRESSED_POINTERS) __ add(R1, R2, Operand(R1, LSL, target::kWordSizeLog2)); - __ ldr(R0, FieldAddress(R1, target::RegExp::function_offset(kOneByteStringCid, - sticky))); +#else + __ add(R1, R2, Operand(R1, LSL, target::kWordSizeLog2 - 1)); +#endif + __ LoadCompressed(R0, FieldAddress(R1, target::RegExp::function_offset( + kOneByteStringCid, sticky))); // Registers are now set up for the lazy compile stub. It expects the function // in R0, the argument descriptor in R4, and IC-Data in R5. diff --git a/runtime/vm/compiler/asm_intrinsifier_x64.cc b/runtime/vm/compiler/asm_intrinsifier_x64.cc index cf4fcb326db..c47d30703ca 100644 --- a/runtime/vm/compiler/asm_intrinsifier_x64.cc +++ b/runtime/vm/compiler/asm_intrinsifier_x64.cc @@ -1308,7 +1308,7 @@ void AsmIntrinsifier::String_getHashCode(Assembler* assembler, void AsmIntrinsifier::Type_getHashCode(Assembler* assembler, Label* normal_ir_body) { __ movq(RAX, Address(RSP, +1 * target::kWordSize)); // Type object. - __ movq(RAX, FieldAddress(RAX, target::Type::hash_offset())); + __ LoadCompressed(RAX, FieldAddress(RAX, target::Type::hash_offset())); ASSERT(kSmiTag == 0); ASSERT(kSmiTagShift == 1); __ testq(RAX, RAX); @@ -1334,9 +1334,11 @@ void AsmIntrinsifier::Type_equality(Assembler* assembler, __ j(NOT_EQUAL, normal_ir_body); // Check if types are syntactically equal. - __ movq(RDI, FieldAddress(RCX, target::Type::type_class_id_offset())); + __ LoadCompressedSmi(RDI, + FieldAddress(RCX, target::Type::type_class_id_offset())); __ SmiUntag(RDI); - __ movq(RSI, FieldAddress(RDX, target::Type::type_class_id_offset())); + __ LoadCompressedSmi(RSI, + FieldAddress(RDX, target::Type::type_class_id_offset())); __ SmiUntag(RSI); EquivalentClassIds(assembler, normal_ir_body, &equiv_cids, ¬_equal, RDI, RSI, RAX); @@ -1374,7 +1376,8 @@ void AsmIntrinsifier::Type_equality(Assembler* assembler, void AsmIntrinsifier::FunctionType_getHashCode(Assembler* assembler, Label* normal_ir_body) { __ movq(RAX, Address(RSP, +1 * target::kWordSize)); // FunctionType object. - __ movq(RAX, FieldAddress(RAX, target::FunctionType::hash_offset())); + __ LoadCompressed(RAX, + FieldAddress(RAX, target::FunctionType::hash_offset())); ASSERT(kSmiTag == 0); ASSERT(kSmiTagShift == 1); __ testq(RAX, RAX); @@ -1423,9 +1426,9 @@ void GenerateSubstringMatchesSpecialization(Assembler* assembler, Label* return_true, Label* return_false) { __ SmiUntag(RBX); - __ movq(R8, FieldAddress(RAX, target::String::length_offset())); + __ LoadCompressedSmi(R8, FieldAddress(RAX, target::String::length_offset())); __ SmiUntag(R8); - __ movq(R9, FieldAddress(RCX, target::String::length_offset())); + __ LoadCompressedSmi(R9, FieldAddress(RCX, target::String::length_offset())); __ SmiUntag(R9); // if (other.length == 0) return true; @@ -1530,7 +1533,7 @@ void AsmIntrinsifier::StringBaseCharAt(Assembler* assembler, __ testq(RCX, Immediate(kSmiTagMask)); __ j(NOT_ZERO, normal_ir_body); // Non-smi index. // Range check. - __ cmpq(RCX, FieldAddress(RAX, target::String::length_offset())); + __ OBJ(cmp)(RCX, FieldAddress(RAX, target::String::length_offset())); // Runtime throws exception. __ j(ABOVE_EQUAL, normal_ir_body); __ CompareClassId(RAX, kOneByteStringCid); @@ -1570,7 +1573,7 @@ void AsmIntrinsifier::StringBaseIsEmpty(Assembler* assembler, Label is_true; // Get length. __ movq(RAX, Address(RSP, +1 * target::kWordSize)); // String object. - __ movq(RAX, FieldAddress(RAX, target::String::length_offset())); + __ LoadCompressedSmi(RAX, FieldAddress(RAX, target::String::length_offset())); __ OBJ(cmp)(RAX, Immediate(target::ToRawSmi(0))); __ j(EQUAL, &is_true, Assembler::kNearJump); __ LoadObject(RAX, CastHandle(FalseObject())); @@ -1594,7 +1597,7 @@ void AsmIntrinsifier::OneByteString_getHashCode(Assembler* assembler, __ Bind(&compute_hash); // Hash not yet computed, use algorithm of class StringHasher. - __ movq(RCX, FieldAddress(RBX, target::String::length_offset())); + __ LoadCompressedSmi(RCX, FieldAddress(RBX, target::String::length_offset())); __ SmiUntag(RCX); __ xorq(RAX, RAX); __ xorq(RDI, RDI); @@ -1736,7 +1739,7 @@ static void TryAllocateString(Assembler* assembler, // Set the length field. __ popq(RDI); - __ StoreIntoObjectNoBarrier( + __ StoreCompressedIntoObjectNoBarrier( RAX, FieldAddress(RAX, target::String::length_offset()), RDI); __ jmp(ok, Assembler::kNearJump); @@ -1865,7 +1868,7 @@ static void StringEquality(Assembler* assembler, __ j(NOT_EQUAL, normal_ir_body, Assembler::kNearJump); // Have same length? - __ movq(RDI, FieldAddress(RAX, target::String::length_offset())); + __ LoadCompressedSmi(RDI, FieldAddress(RAX, target::String::length_offset())); __ OBJ(cmp)(RDI, FieldAddress(RCX, target::String::length_offset())); __ j(NOT_EQUAL, &is_false, Assembler::kNearJump); @@ -1934,9 +1937,15 @@ void AsmIntrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler, __ movq(RDI, Address(RSP, kStringParamOffset)); __ LoadClassId(RDI, RDI); __ SubImmediate(RDI, Immediate(kOneByteStringCid)); +#if !defined(DART_COMPRESSED_POINTERS) __ movq(RAX, FieldAddress( RBX, RDI, TIMES_8, target::RegExp::function_offset(kOneByteStringCid, sticky))); +#else + __ LoadCompressed(RAX, FieldAddress(RBX, RDI, TIMES_4, + target::RegExp::function_offset( + kOneByteStringCid, sticky))); +#endif // Registers are now set up for the lazy compile stub. It expects the function // in RAX, the argument descriptor in R10, and IC-Data in RCX. diff --git a/runtime/vm/compiler/assembler/assembler_arm.h b/runtime/vm/compiler/assembler/assembler_arm.h index 3a221a59c0e..68bcae06650 100644 --- a/runtime/vm/compiler/assembler/assembler_arm.h +++ b/runtime/vm/compiler/assembler/assembler_arm.h @@ -389,6 +389,9 @@ class Assembler : public AssemblerBase { void Jump(const Address& address) { Branch(address); } void LoadField(Register dst, FieldAddress address) { ldr(dst, address); } + void LoadCompressedField(Register dst, FieldAddress address) { + LoadField(dst, address); + } void LoadMemoryValue(Register dst, Register base, int32_t offset) { LoadFromOffset(dst, base, offset); } @@ -1026,6 +1029,9 @@ class Assembler : public AssemblerBase { void PopNativeCalleeSavedRegisters(); void CompareRegisters(Register rn, Register rm) { cmp(rn, Operand(rm)); } + void CompareObjectRegisters(Register rn, Register rm) { + CompareRegisters(rn, rm); + } // Branches to the given label if the condition holds. // [distance] is ignored on ARM. void BranchIf(Condition condition, diff --git a/runtime/vm/compiler/assembler/assembler_arm64.cc b/runtime/vm/compiler/assembler/assembler_arm64.cc index ff0820b7a6b..c54c8163ad6 100644 --- a/runtime/vm/compiler/assembler/assembler_arm64.cc +++ b/runtime/vm/compiler/assembler/assembler_arm64.cc @@ -924,9 +924,7 @@ void Assembler::VRSqrts(VRegister vd, VRegister vn) { vmuls(vd, vd, VTMP); } -void Assembler::LoadCompressed(Register dest, - const Address& slot, - CanBeSmi can_value_be_smi) { +void Assembler::LoadCompressed(Register dest, const Address& slot) { #if !defined(DART_COMPRESSED_POINTERS) ldr(dest, slot); #else @@ -935,6 +933,20 @@ void Assembler::LoadCompressed(Register dest, #endif } +void Assembler::LoadCompressedSmi(Register dest, const Address& slot) { +#if !defined(DART_COMPRESSED_POINTERS) + ldr(dest, slot); +#else + ldr(dest, slot, kUnsignedFourBytes); // Zero-extension. +#endif +#if defined(DEBUG) + Label done; + BranchIfSmi(dest, &done); + Stop("Expected Smi"); + Bind(&done); +#endif +} + // Preserves object and value registers. void Assembler::StoreIntoObjectFilter(Register object, Register value, @@ -985,10 +997,38 @@ void Assembler::StoreIntoObjectOffset(Register object, } } +void Assembler::StoreCompressedIntoObjectOffset(Register object, + int32_t offset, + Register value, + CanBeSmi value_can_be_smi) { + if (Address::CanHoldOffset(offset - kHeapObjectTag)) { + StoreCompressedIntoObject(object, FieldAddress(object, offset), value, + value_can_be_smi); + } else { + AddImmediate(TMP, object, offset - kHeapObjectTag); + StoreCompressedIntoObject(object, Address(TMP), value, value_can_be_smi); + } +} + void Assembler::StoreIntoObject(Register object, const Address& dest, Register value, CanBeSmi can_be_smi) { + str(value, dest); + StoreBarrier(object, value, can_be_smi); +} + +void Assembler::StoreCompressedIntoObject(Register object, + const Address& dest, + Register value, + CanBeSmi can_be_smi) { + str(value, dest, kObjectBytes); + StoreBarrier(object, value, can_be_smi); +} + +void Assembler::StoreBarrier(Register object, + Register value, + CanBeSmi can_be_smi) { const bool spill_lr = lr_state().LRContainsReturnAddress(); // x.slot = x. Barrier should have be removed at the IL level. ASSERT(object != value); @@ -999,8 +1039,6 @@ void Assembler::StoreIntoObject(Register object, ASSERT(value != TMP); ASSERT(value != TMP2); - str(value, dest); - // In parallel, test whether // - object is old and not remembered and value is new, or // - object is old and value is old and not marked and concurrent marking is @@ -1124,6 +1162,25 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, // No store buffer update. } +void Assembler::StoreCompressedIntoObjectNoBarrier(Register object, + const Address& dest, + Register value) { + str(value, dest, kObjectBytes); +#if defined(DEBUG) + Label done; + StoreIntoObjectFilter(object, value, &done, kValueCanBeSmi, kJumpToNoUpdate); + + ldr(TMP, FieldAddress(object, target::Object::tags_offset(), kByte), + kUnsignedByte); + tsti(TMP, Immediate(1 << target::UntaggedObject::kOldAndNotRememberedBit)); + b(&done, ZERO); + + Stop("Store buffer update is required"); + Bind(&done); +#endif // defined(DEBUG) + // No store buffer update. +} + void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, int32_t offset, Register value) { @@ -1135,6 +1192,18 @@ void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, } } +void Assembler::StoreCompressedIntoObjectOffsetNoBarrier(Register object, + int32_t offset, + Register value) { + if (Address::CanHoldOffset(offset - kHeapObjectTag)) { + StoreCompressedIntoObjectNoBarrier(object, FieldAddress(object, offset), + value); + } else { + AddImmediate(TMP, object, offset - kHeapObjectTag); + StoreCompressedIntoObjectNoBarrier(object, Address(TMP), value); + } +} + void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, const Object& value) { @@ -1149,6 +1218,20 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, } } +void Assembler::StoreCompressedIntoObjectNoBarrier(Register object, + const Address& dest, + const Object& value) { + ASSERT(IsOriginalObject(value)); + ASSERT(IsNotTemporaryScopedHandle(value)); + // No store buffer update. + if (IsSameObject(compiler::NullObject(), value)) { + str(NULL_REG, dest, kObjectBytes); + } else { + LoadObject(TMP2, value); + str(TMP2, dest, kObjectBytes); + } +} + void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, int32_t offset, const Object& value) { @@ -1160,6 +1243,18 @@ void Assembler::StoreIntoObjectOffsetNoBarrier(Register object, } } +void Assembler::StoreCompressedIntoObjectOffsetNoBarrier(Register object, + int32_t offset, + const Object& value) { + if (Address::CanHoldOffset(offset - kHeapObjectTag)) { + StoreCompressedIntoObjectNoBarrier(object, FieldAddress(object, offset), + value); + } else { + AddImmediate(TMP, object, offset - kHeapObjectTag); + StoreCompressedIntoObjectNoBarrier(object, Address(TMP), value); + } +} + void Assembler::StoreInternalPointer(Register object, const Address& dest, Register value) { diff --git a/runtime/vm/compiler/assembler/assembler_arm64.h b/runtime/vm/compiler/assembler/assembler_arm64.h index 1682a6996b6..fdfe351beef 100644 --- a/runtime/vm/compiler/assembler/assembler_arm64.h +++ b/runtime/vm/compiler/assembler/assembler_arm64.h @@ -547,6 +547,9 @@ class Assembler : public AssemblerBase { } void LoadField(Register dst, FieldAddress address) { ldr(dst, address); } + void LoadCompressedField(Register dst, FieldAddress address) { + LoadCompressed(dst, address); + } void LoadMemoryValue(Register dst, Register base, int32_t offset) { LoadFromOffset(dst, base, offset, kEightBytes); } @@ -1744,9 +1747,8 @@ class Assembler : public AssemblerBase { kValueCanBeSmi, }; - void LoadCompressed(Register dest, - const Address& slot, - CanBeSmi can_value_be_smi = kValueCanBeSmi); + void LoadCompressed(Register dest, const Address& slot); + void LoadCompressedSmi(Register dest, const Address& slot); // Store into a heap object and apply the generational and incremental write // barriers. All stores into heap objects must pass through this function or, @@ -1757,6 +1759,11 @@ class Assembler : public AssemblerBase { const Address& dest, Register value, CanBeSmi can_value_be_smi = kValueCanBeSmi); + void StoreCompressedIntoObject(Register object, + const Address& dest, + Register value, + CanBeSmi can_value_be_smi = kValueCanBeSmi); + void StoreBarrier(Register object, Register value, CanBeSmi can_value_be_smi); void StoreIntoArray(Register object, Register slot, Register value, @@ -1766,18 +1773,35 @@ class Assembler : public AssemblerBase { int32_t offset, Register value, CanBeSmi can_value_be_smi = kValueCanBeSmi); + void StoreCompressedIntoObjectOffset( + Register object, + int32_t offset, + Register value, + CanBeSmi can_value_be_smi = kValueCanBeSmi); void StoreIntoObjectNoBarrier(Register object, const Address& dest, Register value); + void StoreCompressedIntoObjectNoBarrier(Register object, + const Address& dest, + Register value); void StoreIntoObjectOffsetNoBarrier(Register object, int32_t offset, Register value); + void StoreCompressedIntoObjectOffsetNoBarrier(Register object, + int32_t offset, + Register value); void StoreIntoObjectNoBarrier(Register object, const Address& dest, const Object& value); + void StoreCompressedIntoObjectNoBarrier(Register object, + const Address& dest, + const Object& value); void StoreIntoObjectOffsetNoBarrier(Register object, int32_t offset, const Object& value); + void StoreCompressedIntoObjectOffsetNoBarrier(Register object, + int32_t offset, + const Object& value); // Stores a non-tagged value into a heap object. void StoreInternalPointer(Register object, diff --git a/runtime/vm/compiler/assembler/assembler_ia32.h b/runtime/vm/compiler/assembler/assembler_ia32.h index fecfe5a1cad..a46152cbd65 100644 --- a/runtime/vm/compiler/assembler/assembler_ia32.h +++ b/runtime/vm/compiler/assembler/assembler_ia32.h @@ -572,6 +572,9 @@ class Assembler : public AssemblerBase { void Ret() { ret(); } void CompareRegisters(Register a, Register b); + void CompareObjectRegisters(Register a, Register b) { + CompareRegisters(a, b); + } void BranchIf(Condition condition, Label* label, JumpDistance distance = kFarJump) { @@ -599,6 +602,9 @@ class Assembler : public AssemblerBase { OperandSize sz = kFourBytes) { LoadFromOffset(dst, address, sz); } + void LoadCompressedField(Register dst, const FieldAddress& address) { + LoadField(dst, address); + } void LoadFieldFromOffset(Register reg, Register base, int32_t offset, @@ -607,9 +613,8 @@ class Assembler : public AssemblerBase { } void LoadCompressedFieldFromOffset(Register reg, Register base, - int32_t offset, - OperandSize sz = kFourBytes) { - LoadFieldFromOffset(reg, base, offset, sz); + int32_t offset) { + LoadFieldFromOffset(reg, base, offset); } void LoadIndexedPayload(Register dst, Register base, diff --git a/runtime/vm/compiler/assembler/assembler_x64.cc b/runtime/vm/compiler/assembler/assembler_x64.cc index d1ab4a7e173..274a5d8790d 100644 --- a/runtime/vm/compiler/assembler/assembler_x64.cc +++ b/runtime/vm/compiler/assembler/assembler_x64.cc @@ -1360,9 +1360,7 @@ void Assembler::MoveImmediate(const Address& dst, const Immediate& imm) { } } -void Assembler::LoadCompressed(Register dest, - const Address& slot, - CanBeSmi can_value_be_smi) { +void Assembler::LoadCompressed(Register dest, const Address& slot) { #if !defined(DART_COMPRESSED_POINTERS) movq(dest, slot); #else @@ -1371,6 +1369,20 @@ void Assembler::LoadCompressed(Register dest, #endif } +void Assembler::LoadCompressedSmi(Register dest, const Address& slot) { +#if !defined(DART_COMPRESSED_POINTERS) + movq(dest, slot); +#else + movl(dest, slot); // Zero-extension. +#endif +#if defined(DEBUG) + Label done; + BranchIfSmi(dest, &done); + Stop("Expected Smi"); + Bind(&done); +#endif +} + // Destroys the value register. void Assembler::StoreIntoObjectFilter(Register object, Register value, @@ -1413,13 +1425,26 @@ void Assembler::StoreIntoObject(Register object, const Address& dest, Register value, CanBeSmi can_be_smi) { + movq(dest, value); + StoreBarrier(object, value, can_be_smi); +} + +void Assembler::StoreCompressedIntoObject(Register object, + const Address& dest, + Register value, + CanBeSmi can_be_smi) { + OBJ(mov)(dest, value); + StoreBarrier(object, value, can_be_smi); +} + +void Assembler::StoreBarrier(Register object, + Register value, + CanBeSmi can_be_smi) { // x.slot = x. Barrier should have be removed at the IL level. ASSERT(object != value); ASSERT(object != TMP); ASSERT(value != TMP); - movq(dest, value); - // In parallel, test whether // - object is old and not remembered and value is new, or // - object is old and value is old and not marked and concurrent marking is @@ -1523,12 +1548,39 @@ void Assembler::StoreIntoObjectNoBarrier(Register object, // No store buffer update. } +void Assembler::StoreCompressedIntoObjectNoBarrier(Register object, + const Address& dest, + Register value) { + OBJ(mov)(dest, value); +#if defined(DEBUG) + Label done; + pushq(value); + StoreIntoObjectFilter(object, value, &done, kValueCanBeSmi, kJumpToNoUpdate); + + testb(FieldAddress(object, target::Object::tags_offset()), + Immediate(1 << target::UntaggedObject::kOldAndNotRememberedBit)); + j(ZERO, &done, Assembler::kNearJump); + + Stop("Store buffer update is required"); + Bind(&done); + popq(value); +#endif // defined(DEBUG) + // No store buffer update. +} + void Assembler::StoreIntoObjectNoBarrier(Register object, const Address& dest, const Object& value) { StoreObject(dest, value); } +void Assembler::StoreCompressedIntoObjectNoBarrier(Register object, + const Address& dest, + const Object& value) { + LoadObject(TMP, value); + StoreCompressedIntoObjectNoBarrier(object, dest, TMP); +} + void Assembler::StoreInternalPointer(Register object, const Address& dest, Register value) { @@ -1551,6 +1603,11 @@ void Assembler::ZeroInitSmiField(const Address& dest) { movq(dest, zero); } +void Assembler::ZeroInitCompressedSmiField(const Address& dest) { + Immediate zero(target::ToRawSmi(0)); + OBJ(mov)(dest, zero); +} + void Assembler::IncrementSmiField(const Address& dest, int64_t increment) { // Note: FlowGraphCompiler::EdgeCounterIncrementSizeInBytes depends on // the length of this instruction sequence. diff --git a/runtime/vm/compiler/assembler/assembler_x64.h b/runtime/vm/compiler/assembler/assembler_x64.h index a855106b666..75822c0098c 100644 --- a/runtime/vm/compiler/assembler/assembler_x64.h +++ b/runtime/vm/compiler/assembler/assembler_x64.h @@ -782,9 +782,8 @@ class Assembler : public AssemblerBase { kValueCanBeSmi, }; - void LoadCompressed(Register dest, - const Address& slot, - CanBeSmi can_value_be_smi = kValueCanBeSmi); + void LoadCompressed(Register dest, const Address& slot); + void LoadCompressedSmi(Register dest, const Address& slot); // Store into a heap object and apply the generational and incremental write // barriers. All stores into heap objects must pass through this function or, @@ -795,6 +794,14 @@ class Assembler : public AssemblerBase { const Address& dest, // Where we are storing into. Register value, // Value we are storing. CanBeSmi can_be_smi = kValueCanBeSmi); + void StoreCompressedIntoObject( + Register object, // Object we are storing into. + const Address& dest, // Where we are storing into. + Register value, // Value we are storing. + CanBeSmi can_be_smi = kValueCanBeSmi); + void StoreBarrier(Register object, // Object we are storing into. + Register value, // Value we are storing. + CanBeSmi can_be_smi); void StoreIntoArray(Register object, // Object we are storing into. Register slot, // Where we are storing into. Register value, // Value we are storing. @@ -803,9 +810,15 @@ class Assembler : public AssemblerBase { void StoreIntoObjectNoBarrier(Register object, const Address& dest, Register value); + void StoreCompressedIntoObjectNoBarrier(Register object, + const Address& dest, + Register value); void StoreIntoObjectNoBarrier(Register object, const Address& dest, const Object& value); + void StoreCompressedIntoObjectNoBarrier(Register object, + const Address& dest, + const Object& value); // Stores a non-tagged value into a heap object. void StoreInternalPointer(Register object, @@ -815,6 +828,7 @@ class Assembler : public AssemblerBase { // Stores a Smi value into a heap object field that always contains a Smi. void StoreIntoSmiField(const Address& dest, Register value); void ZeroInitSmiField(const Address& dest); + void ZeroInitCompressedSmiField(const Address& dest); // Increments a Smi field. Leaves flags in same state as an 'addq'. void IncrementSmiField(const Address& dest, int64_t increment); @@ -933,6 +947,9 @@ class Assembler : public AssemblerBase { OperandSize sz = kEightBytes) { LoadFromOffset(dst, address, sz); } + void LoadCompressedField(Register dst, FieldAddress address) { + LoadCompressed(dst, address); + } void LoadFieldFromOffset(Register dst, Register base, int32_t offset, diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc index 0a08391a1c4..da51b204802 100644 --- a/runtime/vm/compiler/backend/flow_graph_compiler.cc +++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc @@ -2543,8 +2543,9 @@ SubtypeTestCachePtr FlowGraphCompiler::GenerateSubtype1TestCacheLookup( __ LoadCompressedFieldFromOffset( kScratch1Reg, kScratch1Reg, compiler::target::Class::super_type_offset()); - __ LoadFieldFromOffset(kScratch1Reg, kScratch1Reg, - compiler::target::Type::type_class_id_offset()); + __ LoadCompressedFieldFromOffset( + kScratch1Reg, kScratch1Reg, + compiler::target::Type::type_class_id_offset()); __ CompareImmediate(kScratch1Reg, Smi::RawValue(type_class.id())); __ BranchIf(EQUAL, is_instance_lbl); } diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc b/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc index 0f32cf27817..888f4f1897e 100644 --- a/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc +++ b/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc @@ -751,7 +751,7 @@ Condition FlowGraphCompiler::EmitEqualityRegRegCompare( // Stub returns result in flags (result of a cmp, we need Z computed). __ PopPair(right, left); } else { - __ CompareRegisters(left, right); + __ CompareObjectRegisters(left, right); } return EQ; } diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc b/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc index e0b9329927a..11cfcb66e1c 100644 --- a/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc +++ b/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc @@ -744,7 +744,7 @@ Condition FlowGraphCompiler::EmitEqualityRegRegCompare( __ popq(right); __ popq(left); } else { - __ CompareRegisters(left, right); + __ CompareObjectRegisters(left, right); } return EQUAL; } diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc index 40f38ab1046..9b15447445c 100644 --- a/runtime/vm/compiler/backend/il.cc +++ b/runtime/vm/compiler/backend/il.cc @@ -5539,10 +5539,11 @@ void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { if (index_cid != kSmiCid) { __ BranchIfNotSmi(index, slow_path->entry_label()); } + __ CompareObjectRegisters(index, length); } else { ASSERT(representation() == kUnboxedInt64); + __ CompareRegisters(index, length); } - __ CompareRegisters(index, length); __ BranchIf(UNSIGNED_GREATER_EQUAL, slow_path->entry_label()); } diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc index 84bcb800c20..3bab3560c9b 100644 --- a/runtime/vm/compiler/backend/il_arm64.cc +++ b/runtime/vm/compiler/backend/il_arm64.cc @@ -1511,7 +1511,8 @@ void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { ASSERT(cid_ == kOneByteStringCid); const Register str = locs()->in(0).reg(); const Register result = locs()->out(0).reg(); - __ LoadFieldFromOffset(result, str, String::length_offset()); + __ LoadCompressedSmi(result, + compiler::FieldAddress(str, String::length_offset())); __ ldr(TMP, compiler::FieldAddress(str, OneByteString::data_offset(), compiler::kByte), @@ -2364,7 +2365,7 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // offset_reg contains offset already corrected by -kHeapObjectTag that is // why we use Address instead of FieldAddress. __ ldr(TMP, compiler::Address(value_reg, offset_reg)); - __ CompareRegisters(length_reg, TMP); + __ CompareObjectRegisters(length_reg, TMP); if (deopt == NULL) { __ b(&ok, EQ); @@ -2665,19 +2666,34 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&store_pointer); } - ASSERT(!slot().is_compressed()); // Unimplemented. + const bool compressed = slot().is_compressed(); if (ShouldEmitStoreBarrier()) { const Register value_reg = locs()->in(1).reg(); - __ StoreIntoObjectOffset(instance_reg, offset_in_bytes, value_reg, - CanValueBeSmi()); + if (!compressed) { + __ StoreIntoObjectOffset(instance_reg, offset_in_bytes, value_reg, + CanValueBeSmi()); + } else { + __ StoreCompressedIntoObjectOffset(instance_reg, offset_in_bytes, + value_reg, CanValueBeSmi()); + } } else { if (locs()->in(1).IsConstant()) { - __ StoreIntoObjectOffsetNoBarrier(instance_reg, offset_in_bytes, - locs()->in(1).constant()); + if (!compressed) { + __ StoreIntoObjectOffsetNoBarrier(instance_reg, offset_in_bytes, + locs()->in(1).constant()); + } else { + __ StoreCompressedIntoObjectOffsetNoBarrier( + instance_reg, offset_in_bytes, locs()->in(1).constant()); + } } else { const Register value_reg = locs()->in(1).reg(); - __ StoreIntoObjectOffsetNoBarrier(instance_reg, offset_in_bytes, - value_reg); + if (!compressed) { + __ StoreIntoObjectOffsetNoBarrier(instance_reg, offset_in_bytes, + value_reg); + } else { + __ StoreCompressedIntoObjectOffsetNoBarrier(instance_reg, + offset_in_bytes, value_reg); + } } } __ Bind(&skip_store); diff --git a/runtime/vm/compiler/backend/il_x64.cc b/runtime/vm/compiler/backend/il_x64.cc index ed081c78bb0..da435ce3f1d 100644 --- a/runtime/vm/compiler/backend/il_x64.cc +++ b/runtime/vm/compiler/backend/il_x64.cc @@ -1391,6 +1391,15 @@ void OneByteStringFromCharCodeInstr::EmitNativeCode( Register char_code = locs()->in(0).reg(); Register result = locs()->out(0).reg(); +#if defined(DART_COMPRESSED_POINTERS) + // The upper half of a compressed Smi contains undefined bits, but no x64 + // addressing mode will ignore these bits. Assume that the index is + // non-negative and clear the upper bits, which is shorter than + // sign-extension (movsxd). Note: we don't bother to ensure index is a + // writable input because any other instructions using it must also not + // rely on the upper bits. + __ orl(char_code, char_code); +#endif __ movq(result, compiler::Address(THR, Thread::predefined_symbols_address_offset())); __ movq(result, @@ -1411,7 +1420,8 @@ void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { Register str = locs()->in(0).reg(); Register result = locs()->out(0).reg(); compiler::Label is_one, done; - __ movq(result, compiler::FieldAddress(str, String::length_offset())); + __ LoadCompressedSmi(result, + compiler::FieldAddress(str, String::length_offset())); __ cmpq(result, compiler::Immediate(Smi::RawValue(1))); __ j(EQUAL, &is_one, compiler::Assembler::kNearJump); __ movq(result, compiler::Immediate(Smi::RawValue(-1))); @@ -2392,7 +2402,8 @@ void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // value's class matches guarded class id of the field. // offset_reg contains offset already corrected by -kHeapObjectTag that is // why we use Address instead of FieldAddress. - __ cmpq(length_reg, compiler::Address(value_reg, offset_reg, TIMES_1, 0)); + __ OBJ(cmp)(length_reg, + compiler::Address(value_reg, offset_reg, TIMES_1, 0)); if (deopt == NULL) { __ j(EQUAL, &ok); @@ -2735,22 +2746,40 @@ void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(&store_pointer); } - ASSERT(!slot().is_compressed()); // Unimplemented. + const bool compressed = slot().is_compressed(); if (ShouldEmitStoreBarrier()) { Register value_reg = locs()->in(1).reg(); - __ StoreIntoObject(instance_reg, - compiler::FieldAddress(instance_reg, offset_in_bytes), - value_reg, CanValueBeSmi()); + if (!compressed) { + __ StoreIntoObject(instance_reg, + compiler::FieldAddress(instance_reg, offset_in_bytes), + value_reg, CanValueBeSmi()); + } else { + __ StoreCompressedIntoObject( + instance_reg, compiler::FieldAddress(instance_reg, offset_in_bytes), + value_reg, CanValueBeSmi()); + } } else { if (locs()->in(1).IsConstant()) { - __ StoreIntoObjectNoBarrier( - instance_reg, compiler::FieldAddress(instance_reg, offset_in_bytes), - locs()->in(1).constant()); + if (!compressed) { + __ StoreIntoObjectNoBarrier( + instance_reg, compiler::FieldAddress(instance_reg, offset_in_bytes), + locs()->in(1).constant()); + } else { + __ StoreCompressedIntoObjectNoBarrier( + instance_reg, compiler::FieldAddress(instance_reg, offset_in_bytes), + locs()->in(1).constant()); + } } else { Register value_reg = locs()->in(1).reg(); - __ StoreIntoObjectNoBarrier( - instance_reg, compiler::FieldAddress(instance_reg, offset_in_bytes), - value_reg); + if (!compressed) { + __ StoreIntoObjectNoBarrier( + instance_reg, compiler::FieldAddress(instance_reg, offset_in_bytes), + value_reg); + } else { + __ StoreCompressedIntoObjectNoBarrier( + instance_reg, compiler::FieldAddress(instance_reg, offset_in_bytes), + value_reg); + } } } __ Bind(&skip_store); diff --git a/runtime/vm/compiler/backend/slot.cc b/runtime/vm/compiler/backend/slot.cc index 7c169448094..75fccf8b0b0 100644 --- a/runtime/vm/compiler/backend/slot.cc +++ b/runtime/vm/compiler/backend/slot.cc @@ -128,6 +128,8 @@ const Slot& Slot::GetNativeSlot(Kind kind) { (IsNullableBit::encode(true) | IsImmutableBit::encode(true) | \ IsCompressedBit::encode(true)) #define NULLABLE_FIELD_VAR (IsNullableBit::encode(true)) +#define NULLABLE_FIELD_VAR_COMPRESSED \ + (IsNullableBit::encode(true) | IsCompressedBit::encode(true)) #define DEFINE_NULLABLE_BOXED_NATIVE_FIELD(ClassName, UnderlyingType, \ FieldName, cid, mutability) \ Slot(Kind::k##ClassName##_##FieldName, NULLABLE_FIELD_##mutability, \ @@ -144,6 +146,7 @@ const Slot& Slot::GetNativeSlot(Kind kind) { #define NONNULLABLE_FIELD_FINAL_COMPRESSED \ (Slot::IsImmutableBit::encode(true) | Slot::IsCompressedBit::encode(true)) #define NONNULLABLE_FIELD_VAR (0) +#define NONNULLABLE_FIELD_VAR_COMPRESSED (Slot::IsCompressedBit::encode(true)) #define DEFINE_NONNULLABLE_BOXED_NATIVE_FIELD(ClassName, UnderlyingType, \ FieldName, cid, mutability) \ Slot(Kind::k##ClassName##_##FieldName, NONNULLABLE_FIELD_##mutability, \ @@ -208,9 +211,10 @@ const Slot& Slot::GetLengthFieldForArrayCid(intptr_t array_cid) { const Slot& Slot::GetTypeArgumentsSlotAt(Thread* thread, intptr_t offset) { ASSERT(offset != Class::kNoTypeArguments); - return SlotCache::Instance(thread).Canonicalize(Slot( - Kind::kTypeArguments, IsImmutableBit::encode(true), kTypeArgumentsCid, - offset, ":type_arguments", /*static_type=*/nullptr, kTagged)); + return SlotCache::Instance(thread).Canonicalize( + Slot(Kind::kTypeArguments, IsImmutableBit::encode(true), + kTypeArgumentsCid, offset, ":type_arguments", + /*static_type=*/nullptr, kTagged)); } const Slot& Slot::GetTypeArgumentsSlotFor(Thread* thread, const Class& cls) { diff --git a/runtime/vm/compiler/backend/slot.h b/runtime/vm/compiler/backend/slot.h index 655b10c0842..8a776de5d45 100644 --- a/runtime/vm/compiler/backend/slot.h +++ b/runtime/vm/compiler/backend/slot.h @@ -60,8 +60,9 @@ class ParsedFunction; V(Closure, UntaggedClosure, function_type_arguments, TypeArguments, FINAL) \ V(ClosureData, UntaggedClosureData, default_type_arguments, TypeArguments, \ FINAL_COMPRESSED) \ - V(Type, UntaggedType, arguments, TypeArguments, FINAL) \ - V(FunctionType, UntaggedFunctionType, type_parameters, TypeArguments, FINAL) \ + V(Type, UntaggedType, arguments, TypeArguments, FINAL_COMPRESSED) \ + V(FunctionType, UntaggedFunctionType, type_parameters, TypeArguments, \ + FINAL_COMPRESSED) \ V(WeakProperty, UntaggedWeakProperty, key, Dynamic, VAR) \ V(WeakProperty, UntaggedWeakProperty, value, Dynamic, VAR) @@ -84,14 +85,17 @@ class ParsedFunction; V(Closure, UntaggedClosure, context, Context, FINAL) \ V(Closure, UntaggedClosure, hash, Context, VAR) \ V(Function, UntaggedFunction, data, Dynamic, FINAL_COMPRESSED) \ - V(FunctionType, UntaggedFunctionType, parameter_names, Array, FINAL) \ - V(FunctionType, UntaggedFunctionType, parameter_types, Array, FINAL) \ + V(FunctionType, UntaggedFunctionType, parameter_names, Array, \ + FINAL_COMPRESSED) \ + V(FunctionType, UntaggedFunctionType, parameter_types, Array, \ + FINAL_COMPRESSED) \ V(GrowableObjectArray, UntaggedGrowableObjectArray, length, Smi, VAR) \ V(GrowableObjectArray, UntaggedGrowableObjectArray, data, Array, VAR) \ - V(TypedDataBase, UntaggedTypedDataBase, length, Smi, FINAL) \ - V(TypedDataView, UntaggedTypedDataView, offset_in_bytes, Smi, FINAL) \ - V(TypedDataView, UntaggedTypedDataView, data, Dynamic, FINAL) \ - V(String, UntaggedString, length, Smi, FINAL) \ + V(TypedDataBase, UntaggedTypedDataBase, length, Smi, FINAL_COMPRESSED) \ + V(TypedDataView, UntaggedTypedDataView, offset_in_bytes, Smi, \ + FINAL_COMPRESSED) \ + V(TypedDataView, UntaggedTypedDataView, data, Dynamic, FINAL_COMPRESSED) \ + V(String, UntaggedString, length, Smi, FINAL_COMPRESSED) \ V(LinkedHashMap, UntaggedLinkedHashMap, index, TypedDataUint32Array, VAR) \ V(LinkedHashMap, UntaggedLinkedHashMap, data, Array, VAR) \ V(LinkedHashMap, UntaggedLinkedHashMap, hash_mask, Smi, VAR) \ @@ -103,10 +107,12 @@ class ParsedFunction; V(ArgumentsDescriptor, UntaggedArray, size, Smi, FINAL) \ V(PointerBase, UntaggedPointerBase, data_field, Dynamic, FINAL) \ V(TypeArguments, UntaggedTypeArguments, length, Smi, FINAL) \ - V(TypeParameter, UntaggedTypeParameter, bound, Dynamic, FINAL) \ - V(TypeParameter, UntaggedTypeParameter, name, Dynamic, FINAL) \ - V(UnhandledException, UntaggedUnhandledException, exception, Dynamic, FINAL) \ - V(UnhandledException, UntaggedUnhandledException, stacktrace, Dynamic, FINAL) + V(TypeParameter, UntaggedTypeParameter, bound, Dynamic, FINAL_COMPRESSED) \ + V(TypeParameter, UntaggedTypeParameter, name, Dynamic, FINAL_COMPRESSED) \ + V(UnhandledException, UntaggedUnhandledException, exception, Dynamic, \ + FINAL_COMPRESSED) \ + V(UnhandledException, UntaggedUnhandledException, stacktrace, Dynamic, \ + FINAL_COMPRESSED) // List of slots that correspond to unboxed fields of native objects in the // following format: diff --git a/runtime/vm/compiler/runtime_api.cc b/runtime/vm/compiler/runtime_api.cc index 63fa7d6b81c..4db6350c480 100644 --- a/runtime/vm/compiler/runtime_api.cc +++ b/runtime/vm/compiler/runtime_api.cc @@ -816,7 +816,13 @@ word ToRawPointer(const dart::Object& a) { #endif // defined(TARGET_ARCH_IA32) word RegExp::function_offset(classid_t cid, bool sticky) { +#if !defined(DART_COMPRESSED_POINTERS) return TranslateOffsetInWords(dart::RegExp::function_offset(cid, sticky)); +#else + // TODO(rmacnak): TranslateOffsetInWords doesn't account for, say, header + // being 1 word and slots being half words. + return dart::RegExp::function_offset(cid, sticky); +#endif } const word Symbols::kNumberOfOneCharCodeSymbols = diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h index 3b346df294e..0f372454814 100644 --- a/runtime/vm/compiler/runtime_offsets_extracted.h +++ b/runtime/vm/compiler/runtime_offsets_extracted.h @@ -2540,39 +2540,39 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; -static constexpr dart::compiler::target::word Type_arguments_offset = 32; -static constexpr dart::compiler::target::word Type_hash_offset = 40; -static constexpr dart::compiler::target::word Type_type_class_id_offset = 24; -static constexpr dart::compiler::target::word Type_type_state_offset = 48; -static constexpr dart::compiler::target::word Type_nullability_offset = 49; -static constexpr dart::compiler::target::word FunctionType_hash_offset = 56; +static constexpr dart::compiler::target::word Type_arguments_offset = 24; +static constexpr dart::compiler::target::word Type_hash_offset = 28; +static constexpr dart::compiler::target::word Type_type_class_id_offset = 20; +static constexpr dart::compiler::target::word Type_type_state_offset = 32; +static constexpr dart::compiler::target::word Type_nullability_offset = 33; +static constexpr dart::compiler::target::word FunctionType_hash_offset = 36; static constexpr dart::compiler::target::word - FunctionType_packed_fields_offset = 64; + FunctionType_packed_fields_offset = 40; static constexpr dart::compiler::target::word - FunctionType_parameter_types_offset = 40; + FunctionType_parameter_types_offset = 28; static constexpr dart::compiler::target::word - FunctionType_parameter_names_offset = 48; + FunctionType_parameter_names_offset = 32; static constexpr dart::compiler::target::word - FunctionType_type_parameters_offset = 24; + FunctionType_type_parameters_offset = 20; static constexpr dart::compiler::target::word - TypeParameter_parameterized_class_id_offset = 56; -static constexpr dart::compiler::target::word TypeParameter_index_offset = 60; + TypeParameter_parameterized_class_id_offset = 36; +static constexpr dart::compiler::target::word TypeParameter_index_offset = 40; static constexpr dart::compiler::target::word TypeParameter_nullability_offset = - 63; + 43; static constexpr dart::compiler::target::word TypeArguments_instantiations_offset = 8; static constexpr dart::compiler::target::word TypeArguments_length_offset = 16; static constexpr dart::compiler::target::word TypeArguments_nullability_offset = 32; static constexpr dart::compiler::target::word TypeArguments_types_offset = 40; -static constexpr dart::compiler::target::word TypeParameter_bound_offset = 40; -static constexpr dart::compiler::target::word TypeParameter_flags_offset = 62; -static constexpr dart::compiler::target::word TypeParameter_name_offset = 24; -static constexpr dart::compiler::target::word TypeRef_type_offset = 24; +static constexpr dart::compiler::target::word TypeParameter_bound_offset = 28; +static constexpr dart::compiler::target::word TypeParameter_flags_offset = 42; +static constexpr dart::compiler::target::word TypeParameter_name_offset = 20; +static constexpr dart::compiler::target::word TypeRef_type_offset = 20; static constexpr dart::compiler::target::word TypedDataBase_length_offset = 16; -static constexpr dart::compiler::target::word TypedDataView_data_offset = 24; +static constexpr dart::compiler::target::word TypedDataView_data_offset = 20; static constexpr dart::compiler::target::word - TypedDataView_offset_in_bytes_offset = 32; + TypedDataView_offset_in_bytes_offset = 24; static constexpr dart::compiler::target::word TypedData_data_offset = 24; static constexpr dart::compiler::target::word UnhandledException_exception_offset = 8; @@ -2633,7 +2633,7 @@ static constexpr dart::compiler::target::word Field_InstanceSize = 64; static constexpr dart::compiler::target::word Float32x4_InstanceSize = 24; static constexpr dart::compiler::target::word Float64x2_InstanceSize = 24; static constexpr dart::compiler::target::word Function_InstanceSize = 96; -static constexpr dart::compiler::target::word FunctionType_InstanceSize = 72; +static constexpr dart::compiler::target::word FunctionType_InstanceSize = 48; static constexpr dart::compiler::target::word FutureOr_InstanceSize = 16; static constexpr dart::compiler::target::word GrowableObjectArray_InstanceSize = 32; @@ -2649,7 +2649,7 @@ static constexpr dart::compiler::target::word KernelProgramInfo_InstanceSize = 64; static constexpr dart::compiler::target::word LanguageError_InstanceSize = 32; static constexpr dart::compiler::target::word Library_InstanceSize = 104; -static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 40; +static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 24; static constexpr dart::compiler::target::word LinkedHashMap_InstanceSize = 56; static constexpr dart::compiler::target::word LocalVarDescriptors_InstanceSize = 16; @@ -2668,14 +2668,14 @@ static constexpr dart::compiler::target::word OneByteString_InstanceSize = 16; static constexpr dart::compiler::target::word PatchClass_InstanceSize = 32; static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16; static constexpr dart::compiler::target::word Pointer_InstanceSize = 24; -static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 40; -static constexpr dart::compiler::target::word RegExp_InstanceSize = 120; +static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24; +static constexpr dart::compiler::target::word RegExp_InstanceSize = 80; static constexpr dart::compiler::target::word Script_InstanceSize = 72; static constexpr dart::compiler::target::word SendPort_InstanceSize = 24; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 32; static constexpr dart::compiler::target::word Smi_InstanceSize = 8; -static constexpr dart::compiler::target::word StackTrace_InstanceSize = 40; +static constexpr dart::compiler::target::word StackTrace_InstanceSize = 24; static constexpr dart::compiler::target::word String_InstanceSize = 16; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 16; @@ -2683,13 +2683,13 @@ static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 24; static constexpr dart::compiler::target::word TransferableTypedData_InstanceSize = 8; static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16; -static constexpr dart::compiler::target::word Type_InstanceSize = 56; +static constexpr dart::compiler::target::word Type_InstanceSize = 40; static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40; -static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 64; -static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32; +static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 48; +static constexpr dart::compiler::target::word TypeRef_InstanceSize = 24; static constexpr dart::compiler::target::word TypedData_InstanceSize = 24; static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24; -static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 40; +static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 32; static constexpr dart::compiler::target::word UnhandledException_InstanceSize = 16; static constexpr dart::compiler::target::word UnlinkedCall_InstanceSize = 32; @@ -3079,39 +3079,39 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; -static constexpr dart::compiler::target::word Type_arguments_offset = 32; -static constexpr dart::compiler::target::word Type_hash_offset = 40; -static constexpr dart::compiler::target::word Type_type_class_id_offset = 24; -static constexpr dart::compiler::target::word Type_type_state_offset = 48; -static constexpr dart::compiler::target::word Type_nullability_offset = 49; -static constexpr dart::compiler::target::word FunctionType_hash_offset = 56; +static constexpr dart::compiler::target::word Type_arguments_offset = 24; +static constexpr dart::compiler::target::word Type_hash_offset = 28; +static constexpr dart::compiler::target::word Type_type_class_id_offset = 20; +static constexpr dart::compiler::target::word Type_type_state_offset = 32; +static constexpr dart::compiler::target::word Type_nullability_offset = 33; +static constexpr dart::compiler::target::word FunctionType_hash_offset = 36; static constexpr dart::compiler::target::word - FunctionType_packed_fields_offset = 64; + FunctionType_packed_fields_offset = 40; static constexpr dart::compiler::target::word - FunctionType_parameter_types_offset = 40; + FunctionType_parameter_types_offset = 28; static constexpr dart::compiler::target::word - FunctionType_parameter_names_offset = 48; + FunctionType_parameter_names_offset = 32; static constexpr dart::compiler::target::word - FunctionType_type_parameters_offset = 24; + FunctionType_type_parameters_offset = 20; static constexpr dart::compiler::target::word - TypeParameter_parameterized_class_id_offset = 56; -static constexpr dart::compiler::target::word TypeParameter_index_offset = 60; + TypeParameter_parameterized_class_id_offset = 36; +static constexpr dart::compiler::target::word TypeParameter_index_offset = 40; static constexpr dart::compiler::target::word TypeParameter_nullability_offset = - 63; + 43; static constexpr dart::compiler::target::word TypeArguments_instantiations_offset = 8; static constexpr dart::compiler::target::word TypeArguments_length_offset = 16; static constexpr dart::compiler::target::word TypeArguments_nullability_offset = 32; static constexpr dart::compiler::target::word TypeArguments_types_offset = 40; -static constexpr dart::compiler::target::word TypeParameter_bound_offset = 40; -static constexpr dart::compiler::target::word TypeParameter_flags_offset = 62; -static constexpr dart::compiler::target::word TypeParameter_name_offset = 24; -static constexpr dart::compiler::target::word TypeRef_type_offset = 24; +static constexpr dart::compiler::target::word TypeParameter_bound_offset = 28; +static constexpr dart::compiler::target::word TypeParameter_flags_offset = 42; +static constexpr dart::compiler::target::word TypeParameter_name_offset = 20; +static constexpr dart::compiler::target::word TypeRef_type_offset = 20; static constexpr dart::compiler::target::word TypedDataBase_length_offset = 16; -static constexpr dart::compiler::target::word TypedDataView_data_offset = 24; +static constexpr dart::compiler::target::word TypedDataView_data_offset = 20; static constexpr dart::compiler::target::word - TypedDataView_offset_in_bytes_offset = 32; + TypedDataView_offset_in_bytes_offset = 24; static constexpr dart::compiler::target::word TypedData_data_offset = 24; static constexpr dart::compiler::target::word UnhandledException_exception_offset = 8; @@ -3173,7 +3173,7 @@ static constexpr dart::compiler::target::word Field_InstanceSize = 64; static constexpr dart::compiler::target::word Float32x4_InstanceSize = 24; static constexpr dart::compiler::target::word Float64x2_InstanceSize = 24; static constexpr dart::compiler::target::word Function_InstanceSize = 96; -static constexpr dart::compiler::target::word FunctionType_InstanceSize = 72; +static constexpr dart::compiler::target::word FunctionType_InstanceSize = 48; static constexpr dart::compiler::target::word FutureOr_InstanceSize = 16; static constexpr dart::compiler::target::word GrowableObjectArray_InstanceSize = 32; @@ -3189,7 +3189,7 @@ static constexpr dart::compiler::target::word KernelProgramInfo_InstanceSize = 64; static constexpr dart::compiler::target::word LanguageError_InstanceSize = 32; static constexpr dart::compiler::target::word Library_InstanceSize = 104; -static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 40; +static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 24; static constexpr dart::compiler::target::word LinkedHashMap_InstanceSize = 56; static constexpr dart::compiler::target::word LocalVarDescriptors_InstanceSize = 16; @@ -3208,14 +3208,14 @@ static constexpr dart::compiler::target::word OneByteString_InstanceSize = 16; static constexpr dart::compiler::target::word PatchClass_InstanceSize = 32; static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16; static constexpr dart::compiler::target::word Pointer_InstanceSize = 24; -static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 40; -static constexpr dart::compiler::target::word RegExp_InstanceSize = 120; +static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24; +static constexpr dart::compiler::target::word RegExp_InstanceSize = 80; static constexpr dart::compiler::target::word Script_InstanceSize = 72; static constexpr dart::compiler::target::word SendPort_InstanceSize = 24; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 32; static constexpr dart::compiler::target::word Smi_InstanceSize = 8; -static constexpr dart::compiler::target::word StackTrace_InstanceSize = 40; +static constexpr dart::compiler::target::word StackTrace_InstanceSize = 24; static constexpr dart::compiler::target::word String_InstanceSize = 16; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 16; @@ -3223,13 +3223,13 @@ static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 24; static constexpr dart::compiler::target::word TransferableTypedData_InstanceSize = 8; static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16; -static constexpr dart::compiler::target::word Type_InstanceSize = 56; +static constexpr dart::compiler::target::word Type_InstanceSize = 40; static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40; -static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 64; -static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32; +static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 48; +static constexpr dart::compiler::target::word TypeRef_InstanceSize = 24; static constexpr dart::compiler::target::word TypedData_InstanceSize = 24; static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24; -static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 40; +static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 32; static constexpr dart::compiler::target::word UnhandledException_InstanceSize = 16; static constexpr dart::compiler::target::word UnlinkedCall_InstanceSize = 32; @@ -5738,39 +5738,39 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; -static constexpr dart::compiler::target::word Type_arguments_offset = 32; -static constexpr dart::compiler::target::word Type_hash_offset = 40; -static constexpr dart::compiler::target::word Type_type_class_id_offset = 24; -static constexpr dart::compiler::target::word Type_type_state_offset = 48; -static constexpr dart::compiler::target::word Type_nullability_offset = 49; -static constexpr dart::compiler::target::word FunctionType_hash_offset = 56; +static constexpr dart::compiler::target::word Type_arguments_offset = 24; +static constexpr dart::compiler::target::word Type_hash_offset = 28; +static constexpr dart::compiler::target::word Type_type_class_id_offset = 20; +static constexpr dart::compiler::target::word Type_type_state_offset = 32; +static constexpr dart::compiler::target::word Type_nullability_offset = 33; +static constexpr dart::compiler::target::word FunctionType_hash_offset = 36; static constexpr dart::compiler::target::word - FunctionType_packed_fields_offset = 64; + FunctionType_packed_fields_offset = 40; static constexpr dart::compiler::target::word - FunctionType_parameter_types_offset = 40; + FunctionType_parameter_types_offset = 28; static constexpr dart::compiler::target::word - FunctionType_parameter_names_offset = 48; + FunctionType_parameter_names_offset = 32; static constexpr dart::compiler::target::word - FunctionType_type_parameters_offset = 24; + FunctionType_type_parameters_offset = 20; static constexpr dart::compiler::target::word - TypeParameter_parameterized_class_id_offset = 56; -static constexpr dart::compiler::target::word TypeParameter_index_offset = 60; + TypeParameter_parameterized_class_id_offset = 36; +static constexpr dart::compiler::target::word TypeParameter_index_offset = 40; static constexpr dart::compiler::target::word TypeParameter_nullability_offset = - 63; + 43; static constexpr dart::compiler::target::word TypeArguments_instantiations_offset = 8; static constexpr dart::compiler::target::word TypeArguments_length_offset = 16; static constexpr dart::compiler::target::word TypeArguments_nullability_offset = 32; static constexpr dart::compiler::target::word TypeArguments_types_offset = 40; -static constexpr dart::compiler::target::word TypeParameter_bound_offset = 40; -static constexpr dart::compiler::target::word TypeParameter_flags_offset = 62; -static constexpr dart::compiler::target::word TypeParameter_name_offset = 24; -static constexpr dart::compiler::target::word TypeRef_type_offset = 24; +static constexpr dart::compiler::target::word TypeParameter_bound_offset = 28; +static constexpr dart::compiler::target::word TypeParameter_flags_offset = 42; +static constexpr dart::compiler::target::word TypeParameter_name_offset = 20; +static constexpr dart::compiler::target::word TypeRef_type_offset = 20; static constexpr dart::compiler::target::word TypedDataBase_length_offset = 16; -static constexpr dart::compiler::target::word TypedDataView_data_offset = 24; +static constexpr dart::compiler::target::word TypedDataView_data_offset = 20; static constexpr dart::compiler::target::word - TypedDataView_offset_in_bytes_offset = 32; + TypedDataView_offset_in_bytes_offset = 24; static constexpr dart::compiler::target::word TypedData_data_offset = 24; static constexpr dart::compiler::target::word UnhandledException_exception_offset = 8; @@ -5828,7 +5828,7 @@ static constexpr dart::compiler::target::word Field_InstanceSize = 64; static constexpr dart::compiler::target::word Float32x4_InstanceSize = 24; static constexpr dart::compiler::target::word Float64x2_InstanceSize = 24; static constexpr dart::compiler::target::word Function_InstanceSize = 96; -static constexpr dart::compiler::target::word FunctionType_InstanceSize = 72; +static constexpr dart::compiler::target::word FunctionType_InstanceSize = 48; static constexpr dart::compiler::target::word FutureOr_InstanceSize = 16; static constexpr dart::compiler::target::word GrowableObjectArray_InstanceSize = 32; @@ -5844,7 +5844,7 @@ static constexpr dart::compiler::target::word KernelProgramInfo_InstanceSize = 64; static constexpr dart::compiler::target::word LanguageError_InstanceSize = 32; static constexpr dart::compiler::target::word Library_InstanceSize = 104; -static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 40; +static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 24; static constexpr dart::compiler::target::word LinkedHashMap_InstanceSize = 56; static constexpr dart::compiler::target::word LocalVarDescriptors_InstanceSize = 16; @@ -5863,14 +5863,14 @@ static constexpr dart::compiler::target::word OneByteString_InstanceSize = 16; static constexpr dart::compiler::target::word PatchClass_InstanceSize = 32; static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16; static constexpr dart::compiler::target::word Pointer_InstanceSize = 24; -static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24; -static constexpr dart::compiler::target::word RegExp_InstanceSize = 120; +static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 16; +static constexpr dart::compiler::target::word RegExp_InstanceSize = 80; static constexpr dart::compiler::target::word Script_InstanceSize = 64; static constexpr dart::compiler::target::word SendPort_InstanceSize = 24; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 32; static constexpr dart::compiler::target::word Smi_InstanceSize = 8; -static constexpr dart::compiler::target::word StackTrace_InstanceSize = 40; +static constexpr dart::compiler::target::word StackTrace_InstanceSize = 24; static constexpr dart::compiler::target::word String_InstanceSize = 16; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 16; @@ -5878,13 +5878,13 @@ static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 24; static constexpr dart::compiler::target::word TransferableTypedData_InstanceSize = 8; static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16; -static constexpr dart::compiler::target::word Type_InstanceSize = 56; +static constexpr dart::compiler::target::word Type_InstanceSize = 40; static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40; -static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 64; -static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32; +static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 48; +static constexpr dart::compiler::target::word TypeRef_InstanceSize = 24; static constexpr dart::compiler::target::word TypedData_InstanceSize = 24; static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24; -static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 40; +static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 32; static constexpr dart::compiler::target::word UnhandledException_InstanceSize = 16; static constexpr dart::compiler::target::word UnlinkedCall_InstanceSize = 32; @@ -6271,39 +6271,39 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; -static constexpr dart::compiler::target::word Type_arguments_offset = 32; -static constexpr dart::compiler::target::word Type_hash_offset = 40; -static constexpr dart::compiler::target::word Type_type_class_id_offset = 24; -static constexpr dart::compiler::target::word Type_type_state_offset = 48; -static constexpr dart::compiler::target::word Type_nullability_offset = 49; -static constexpr dart::compiler::target::word FunctionType_hash_offset = 56; +static constexpr dart::compiler::target::word Type_arguments_offset = 24; +static constexpr dart::compiler::target::word Type_hash_offset = 28; +static constexpr dart::compiler::target::word Type_type_class_id_offset = 20; +static constexpr dart::compiler::target::word Type_type_state_offset = 32; +static constexpr dart::compiler::target::word Type_nullability_offset = 33; +static constexpr dart::compiler::target::word FunctionType_hash_offset = 36; static constexpr dart::compiler::target::word - FunctionType_packed_fields_offset = 64; + FunctionType_packed_fields_offset = 40; static constexpr dart::compiler::target::word - FunctionType_parameter_types_offset = 40; + FunctionType_parameter_types_offset = 28; static constexpr dart::compiler::target::word - FunctionType_parameter_names_offset = 48; + FunctionType_parameter_names_offset = 32; static constexpr dart::compiler::target::word - FunctionType_type_parameters_offset = 24; + FunctionType_type_parameters_offset = 20; static constexpr dart::compiler::target::word - TypeParameter_parameterized_class_id_offset = 56; -static constexpr dart::compiler::target::word TypeParameter_index_offset = 60; + TypeParameter_parameterized_class_id_offset = 36; +static constexpr dart::compiler::target::word TypeParameter_index_offset = 40; static constexpr dart::compiler::target::word TypeParameter_nullability_offset = - 63; + 43; static constexpr dart::compiler::target::word TypeArguments_instantiations_offset = 8; static constexpr dart::compiler::target::word TypeArguments_length_offset = 16; static constexpr dart::compiler::target::word TypeArguments_nullability_offset = 32; static constexpr dart::compiler::target::word TypeArguments_types_offset = 40; -static constexpr dart::compiler::target::word TypeParameter_bound_offset = 40; -static constexpr dart::compiler::target::word TypeParameter_flags_offset = 62; -static constexpr dart::compiler::target::word TypeParameter_name_offset = 24; -static constexpr dart::compiler::target::word TypeRef_type_offset = 24; +static constexpr dart::compiler::target::word TypeParameter_bound_offset = 28; +static constexpr dart::compiler::target::word TypeParameter_flags_offset = 42; +static constexpr dart::compiler::target::word TypeParameter_name_offset = 20; +static constexpr dart::compiler::target::word TypeRef_type_offset = 20; static constexpr dart::compiler::target::word TypedDataBase_length_offset = 16; -static constexpr dart::compiler::target::word TypedDataView_data_offset = 24; +static constexpr dart::compiler::target::word TypedDataView_data_offset = 20; static constexpr dart::compiler::target::word - TypedDataView_offset_in_bytes_offset = 32; + TypedDataView_offset_in_bytes_offset = 24; static constexpr dart::compiler::target::word TypedData_data_offset = 24; static constexpr dart::compiler::target::word UnhandledException_exception_offset = 8; @@ -6362,7 +6362,7 @@ static constexpr dart::compiler::target::word Field_InstanceSize = 64; static constexpr dart::compiler::target::word Float32x4_InstanceSize = 24; static constexpr dart::compiler::target::word Float64x2_InstanceSize = 24; static constexpr dart::compiler::target::word Function_InstanceSize = 96; -static constexpr dart::compiler::target::word FunctionType_InstanceSize = 72; +static constexpr dart::compiler::target::word FunctionType_InstanceSize = 48; static constexpr dart::compiler::target::word FutureOr_InstanceSize = 16; static constexpr dart::compiler::target::word GrowableObjectArray_InstanceSize = 32; @@ -6378,7 +6378,7 @@ static constexpr dart::compiler::target::word KernelProgramInfo_InstanceSize = 64; static constexpr dart::compiler::target::word LanguageError_InstanceSize = 32; static constexpr dart::compiler::target::word Library_InstanceSize = 104; -static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 40; +static constexpr dart::compiler::target::word LibraryPrefix_InstanceSize = 24; static constexpr dart::compiler::target::word LinkedHashMap_InstanceSize = 56; static constexpr dart::compiler::target::word LocalVarDescriptors_InstanceSize = 16; @@ -6397,14 +6397,14 @@ static constexpr dart::compiler::target::word OneByteString_InstanceSize = 16; static constexpr dart::compiler::target::word PatchClass_InstanceSize = 32; static constexpr dart::compiler::target::word PcDescriptors_HeaderSize = 16; static constexpr dart::compiler::target::word Pointer_InstanceSize = 24; -static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 24; -static constexpr dart::compiler::target::word RegExp_InstanceSize = 120; +static constexpr dart::compiler::target::word ReceivePort_InstanceSize = 16; +static constexpr dart::compiler::target::word RegExp_InstanceSize = 80; static constexpr dart::compiler::target::word Script_InstanceSize = 64; static constexpr dart::compiler::target::word SendPort_InstanceSize = 24; static constexpr dart::compiler::target::word SingleTargetCache_InstanceSize = 32; static constexpr dart::compiler::target::word Smi_InstanceSize = 8; -static constexpr dart::compiler::target::word StackTrace_InstanceSize = 40; +static constexpr dart::compiler::target::word StackTrace_InstanceSize = 24; static constexpr dart::compiler::target::word String_InstanceSize = 16; static constexpr dart::compiler::target::word SubtypeTestCache_InstanceSize = 16; @@ -6412,13 +6412,13 @@ static constexpr dart::compiler::target::word LoadingUnit_InstanceSize = 24; static constexpr dart::compiler::target::word TransferableTypedData_InstanceSize = 8; static constexpr dart::compiler::target::word TwoByteString_InstanceSize = 16; -static constexpr dart::compiler::target::word Type_InstanceSize = 56; +static constexpr dart::compiler::target::word Type_InstanceSize = 40; static constexpr dart::compiler::target::word TypeArguments_InstanceSize = 40; -static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 64; -static constexpr dart::compiler::target::word TypeRef_InstanceSize = 32; +static constexpr dart::compiler::target::word TypeParameter_InstanceSize = 48; +static constexpr dart::compiler::target::word TypeRef_InstanceSize = 24; static constexpr dart::compiler::target::word TypedData_InstanceSize = 24; static constexpr dart::compiler::target::word TypedDataBase_InstanceSize = 24; -static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 40; +static constexpr dart::compiler::target::word TypedDataView_InstanceSize = 32; static constexpr dart::compiler::target::word UnhandledException_InstanceSize = 16; static constexpr dart::compiler::target::word UnlinkedCall_InstanceSize = 32; @@ -8636,27 +8636,27 @@ static constexpr dart::compiler::target::word AOT_TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset = 16; -static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 32; -static constexpr dart::compiler::target::word AOT_Type_hash_offset = 40; +static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 24; +static constexpr dart::compiler::target::word AOT_Type_hash_offset = 28; static constexpr dart::compiler::target::word AOT_Type_type_class_id_offset = - 24; -static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 48; -static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 49; -static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 56; + 20; +static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 32; +static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 33; +static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 36; static constexpr dart::compiler::target::word - AOT_FunctionType_packed_fields_offset = 64; + AOT_FunctionType_packed_fields_offset = 40; static constexpr dart::compiler::target::word - AOT_FunctionType_parameter_types_offset = 40; + AOT_FunctionType_parameter_types_offset = 28; static constexpr dart::compiler::target::word - AOT_FunctionType_parameter_names_offset = 48; + AOT_FunctionType_parameter_names_offset = 32; static constexpr dart::compiler::target::word - AOT_FunctionType_type_parameters_offset = 24; + AOT_FunctionType_type_parameters_offset = 20; static constexpr dart::compiler::target::word - AOT_TypeParameter_parameterized_class_id_offset = 56; + AOT_TypeParameter_parameterized_class_id_offset = 36; static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset = - 60; + 40; static constexpr dart::compiler::target::word - AOT_TypeParameter_nullability_offset = 63; + AOT_TypeParameter_nullability_offset = 43; static constexpr dart::compiler::target::word AOT_TypeArguments_instantiations_offset = 8; static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset = @@ -8666,18 +8666,18 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_TypeArguments_types_offset = 40; static constexpr dart::compiler::target::word AOT_TypeParameter_bound_offset = - 40; + 28; static constexpr dart::compiler::target::word AOT_TypeParameter_flags_offset = - 62; + 42; static constexpr dart::compiler::target::word AOT_TypeParameter_name_offset = - 24; -static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 24; + 20; +static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 20; static constexpr dart::compiler::target::word AOT_TypedDataBase_length_offset = 16; static constexpr dart::compiler::target::word AOT_TypedDataView_data_offset = - 24; + 20; static constexpr dart::compiler::target::word - AOT_TypedDataView_offset_in_bytes_offset = 32; + AOT_TypedDataView_offset_in_bytes_offset = 24; static constexpr dart::compiler::target::word AOT_TypedData_data_offset = 24; static constexpr dart::compiler::target::word AOT_UnhandledException_exception_offset = 8; @@ -8745,7 +8745,7 @@ static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 64; static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize = - 72; + 48; static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_GrowableObjectArray_InstanceSize = 32; @@ -8763,7 +8763,7 @@ static constexpr dart::compiler::target::word AOT_LanguageError_InstanceSize = 32; static constexpr dart::compiler::target::word AOT_Library_InstanceSize = 96; static constexpr dart::compiler::target::word AOT_LibraryPrefix_InstanceSize = - 40; + 24; static constexpr dart::compiler::target::word AOT_LinkedHashMap_InstanceSize = 56; static constexpr dart::compiler::target::word @@ -8786,14 +8786,14 @@ static constexpr dart::compiler::target::word AOT_OneByteString_InstanceSize = static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16; static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24; -static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 40; -static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120; +static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24; +static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 80; static constexpr dart::compiler::target::word AOT_Script_InstanceSize = 56; static constexpr dart::compiler::target::word AOT_SendPort_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 32; static constexpr dart::compiler::target::word AOT_Smi_InstanceSize = 8; -static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 40; +static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 16; @@ -8802,17 +8802,17 @@ static constexpr dart::compiler::target::word AOT_TransferableTypedData_InstanceSize = 8; static constexpr dart::compiler::target::word AOT_TwoByteString_InstanceSize = 16; -static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 56; +static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 40; static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize = 40; static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize = - 64; -static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32; + 48; +static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedDataView_InstanceSize = - 40; + 32; static constexpr dart::compiler::target::word AOT_UnhandledException_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_UnlinkedCall_InstanceSize = @@ -9234,27 +9234,27 @@ static constexpr dart::compiler::target::word AOT_TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset = 16; -static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 32; -static constexpr dart::compiler::target::word AOT_Type_hash_offset = 40; +static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 24; +static constexpr dart::compiler::target::word AOT_Type_hash_offset = 28; static constexpr dart::compiler::target::word AOT_Type_type_class_id_offset = - 24; -static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 48; -static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 49; -static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 56; + 20; +static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 32; +static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 33; +static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 36; static constexpr dart::compiler::target::word - AOT_FunctionType_packed_fields_offset = 64; + AOT_FunctionType_packed_fields_offset = 40; static constexpr dart::compiler::target::word - AOT_FunctionType_parameter_types_offset = 40; + AOT_FunctionType_parameter_types_offset = 28; static constexpr dart::compiler::target::word - AOT_FunctionType_parameter_names_offset = 48; + AOT_FunctionType_parameter_names_offset = 32; static constexpr dart::compiler::target::word - AOT_FunctionType_type_parameters_offset = 24; + AOT_FunctionType_type_parameters_offset = 20; static constexpr dart::compiler::target::word - AOT_TypeParameter_parameterized_class_id_offset = 56; + AOT_TypeParameter_parameterized_class_id_offset = 36; static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset = - 60; + 40; static constexpr dart::compiler::target::word - AOT_TypeParameter_nullability_offset = 63; + AOT_TypeParameter_nullability_offset = 43; static constexpr dart::compiler::target::word AOT_TypeArguments_instantiations_offset = 8; static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset = @@ -9264,18 +9264,18 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_TypeArguments_types_offset = 40; static constexpr dart::compiler::target::word AOT_TypeParameter_bound_offset = - 40; + 28; static constexpr dart::compiler::target::word AOT_TypeParameter_flags_offset = - 62; + 42; static constexpr dart::compiler::target::word AOT_TypeParameter_name_offset = - 24; -static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 24; + 20; +static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 20; static constexpr dart::compiler::target::word AOT_TypedDataBase_length_offset = 16; static constexpr dart::compiler::target::word AOT_TypedDataView_data_offset = - 24; + 20; static constexpr dart::compiler::target::word - AOT_TypedDataView_offset_in_bytes_offset = 32; + AOT_TypedDataView_offset_in_bytes_offset = 24; static constexpr dart::compiler::target::word AOT_TypedData_data_offset = 24; static constexpr dart::compiler::target::word AOT_UnhandledException_exception_offset = 8; @@ -9344,7 +9344,7 @@ static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 64; static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize = - 72; + 48; static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_GrowableObjectArray_InstanceSize = 32; @@ -9362,7 +9362,7 @@ static constexpr dart::compiler::target::word AOT_LanguageError_InstanceSize = 32; static constexpr dart::compiler::target::word AOT_Library_InstanceSize = 96; static constexpr dart::compiler::target::word AOT_LibraryPrefix_InstanceSize = - 40; + 24; static constexpr dart::compiler::target::word AOT_LinkedHashMap_InstanceSize = 56; static constexpr dart::compiler::target::word @@ -9385,14 +9385,14 @@ static constexpr dart::compiler::target::word AOT_OneByteString_InstanceSize = static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16; static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24; -static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 40; -static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120; +static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24; +static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 80; static constexpr dart::compiler::target::word AOT_Script_InstanceSize = 56; static constexpr dart::compiler::target::word AOT_SendPort_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 32; static constexpr dart::compiler::target::word AOT_Smi_InstanceSize = 8; -static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 40; +static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 16; @@ -9401,17 +9401,17 @@ static constexpr dart::compiler::target::word AOT_TransferableTypedData_InstanceSize = 8; static constexpr dart::compiler::target::word AOT_TwoByteString_InstanceSize = 16; -static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 56; +static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 40; static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize = 40; static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize = - 64; -static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32; + 48; +static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedDataView_InstanceSize = - 40; + 32; static constexpr dart::compiler::target::word AOT_UnhandledException_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_UnlinkedCall_InstanceSize = @@ -11604,27 +11604,27 @@ static constexpr dart::compiler::target::word AOT_TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset = 16; -static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 32; -static constexpr dart::compiler::target::word AOT_Type_hash_offset = 40; +static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 24; +static constexpr dart::compiler::target::word AOT_Type_hash_offset = 28; static constexpr dart::compiler::target::word AOT_Type_type_class_id_offset = - 24; -static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 48; -static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 49; -static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 56; + 20; +static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 32; +static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 33; +static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 36; static constexpr dart::compiler::target::word - AOT_FunctionType_packed_fields_offset = 64; + AOT_FunctionType_packed_fields_offset = 40; static constexpr dart::compiler::target::word - AOT_FunctionType_parameter_types_offset = 40; + AOT_FunctionType_parameter_types_offset = 28; static constexpr dart::compiler::target::word - AOT_FunctionType_parameter_names_offset = 48; + AOT_FunctionType_parameter_names_offset = 32; static constexpr dart::compiler::target::word - AOT_FunctionType_type_parameters_offset = 24; + AOT_FunctionType_type_parameters_offset = 20; static constexpr dart::compiler::target::word - AOT_TypeParameter_parameterized_class_id_offset = 56; + AOT_TypeParameter_parameterized_class_id_offset = 36; static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset = - 60; + 40; static constexpr dart::compiler::target::word - AOT_TypeParameter_nullability_offset = 63; + AOT_TypeParameter_nullability_offset = 43; static constexpr dart::compiler::target::word AOT_TypeArguments_instantiations_offset = 8; static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset = @@ -11634,18 +11634,18 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_TypeArguments_types_offset = 40; static constexpr dart::compiler::target::word AOT_TypeParameter_bound_offset = - 40; + 28; static constexpr dart::compiler::target::word AOT_TypeParameter_flags_offset = - 62; + 42; static constexpr dart::compiler::target::word AOT_TypeParameter_name_offset = - 24; -static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 24; + 20; +static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 20; static constexpr dart::compiler::target::word AOT_TypedDataBase_length_offset = 16; static constexpr dart::compiler::target::word AOT_TypedDataView_data_offset = - 24; + 20; static constexpr dart::compiler::target::word - AOT_TypedDataView_offset_in_bytes_offset = 32; + AOT_TypedDataView_offset_in_bytes_offset = 24; static constexpr dart::compiler::target::word AOT_TypedData_data_offset = 24; static constexpr dart::compiler::target::word AOT_UnhandledException_exception_offset = 8; @@ -11710,7 +11710,7 @@ static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 64; static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize = - 72; + 48; static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_GrowableObjectArray_InstanceSize = 32; @@ -11728,7 +11728,7 @@ static constexpr dart::compiler::target::word AOT_LanguageError_InstanceSize = 32; static constexpr dart::compiler::target::word AOT_Library_InstanceSize = 96; static constexpr dart::compiler::target::word AOT_LibraryPrefix_InstanceSize = - 40; + 24; static constexpr dart::compiler::target::word AOT_LinkedHashMap_InstanceSize = 56; static constexpr dart::compiler::target::word @@ -11751,14 +11751,14 @@ static constexpr dart::compiler::target::word AOT_OneByteString_InstanceSize = static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16; static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24; -static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24; -static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120; +static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 16; +static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 80; static constexpr dart::compiler::target::word AOT_Script_InstanceSize = 56; static constexpr dart::compiler::target::word AOT_SendPort_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 32; static constexpr dart::compiler::target::word AOT_Smi_InstanceSize = 8; -static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 40; +static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 16; @@ -11767,17 +11767,17 @@ static constexpr dart::compiler::target::word AOT_TransferableTypedData_InstanceSize = 8; static constexpr dart::compiler::target::word AOT_TwoByteString_InstanceSize = 16; -static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 56; +static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 40; static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize = 40; static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize = - 64; -static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32; + 48; +static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedDataView_InstanceSize = - 40; + 32; static constexpr dart::compiler::target::word AOT_UnhandledException_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_UnlinkedCall_InstanceSize = @@ -12195,27 +12195,27 @@ static constexpr dart::compiler::target::word AOT_TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word AOT_TwoByteString_data_offset = 16; -static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 32; -static constexpr dart::compiler::target::word AOT_Type_hash_offset = 40; +static constexpr dart::compiler::target::word AOT_Type_arguments_offset = 24; +static constexpr dart::compiler::target::word AOT_Type_hash_offset = 28; static constexpr dart::compiler::target::word AOT_Type_type_class_id_offset = - 24; -static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 48; -static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 49; -static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 56; + 20; +static constexpr dart::compiler::target::word AOT_Type_type_state_offset = 32; +static constexpr dart::compiler::target::word AOT_Type_nullability_offset = 33; +static constexpr dart::compiler::target::word AOT_FunctionType_hash_offset = 36; static constexpr dart::compiler::target::word - AOT_FunctionType_packed_fields_offset = 64; + AOT_FunctionType_packed_fields_offset = 40; static constexpr dart::compiler::target::word - AOT_FunctionType_parameter_types_offset = 40; + AOT_FunctionType_parameter_types_offset = 28; static constexpr dart::compiler::target::word - AOT_FunctionType_parameter_names_offset = 48; + AOT_FunctionType_parameter_names_offset = 32; static constexpr dart::compiler::target::word - AOT_FunctionType_type_parameters_offset = 24; + AOT_FunctionType_type_parameters_offset = 20; static constexpr dart::compiler::target::word - AOT_TypeParameter_parameterized_class_id_offset = 56; + AOT_TypeParameter_parameterized_class_id_offset = 36; static constexpr dart::compiler::target::word AOT_TypeParameter_index_offset = - 60; + 40; static constexpr dart::compiler::target::word - AOT_TypeParameter_nullability_offset = 63; + AOT_TypeParameter_nullability_offset = 43; static constexpr dart::compiler::target::word AOT_TypeArguments_instantiations_offset = 8; static constexpr dart::compiler::target::word AOT_TypeArguments_length_offset = @@ -12225,18 +12225,18 @@ static constexpr dart::compiler::target::word static constexpr dart::compiler::target::word AOT_TypeArguments_types_offset = 40; static constexpr dart::compiler::target::word AOT_TypeParameter_bound_offset = - 40; + 28; static constexpr dart::compiler::target::word AOT_TypeParameter_flags_offset = - 62; + 42; static constexpr dart::compiler::target::word AOT_TypeParameter_name_offset = - 24; -static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 24; + 20; +static constexpr dart::compiler::target::word AOT_TypeRef_type_offset = 20; static constexpr dart::compiler::target::word AOT_TypedDataBase_length_offset = 16; static constexpr dart::compiler::target::word AOT_TypedDataView_data_offset = - 24; + 20; static constexpr dart::compiler::target::word - AOT_TypedDataView_offset_in_bytes_offset = 32; + AOT_TypedDataView_offset_in_bytes_offset = 24; static constexpr dart::compiler::target::word AOT_TypedData_data_offset = 24; static constexpr dart::compiler::target::word AOT_UnhandledException_exception_offset = 8; @@ -12302,7 +12302,7 @@ static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 64; static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize = - 72; + 48; static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_GrowableObjectArray_InstanceSize = 32; @@ -12320,7 +12320,7 @@ static constexpr dart::compiler::target::word AOT_LanguageError_InstanceSize = 32; static constexpr dart::compiler::target::word AOT_Library_InstanceSize = 96; static constexpr dart::compiler::target::word AOT_LibraryPrefix_InstanceSize = - 40; + 24; static constexpr dart::compiler::target::word AOT_LinkedHashMap_InstanceSize = 56; static constexpr dart::compiler::target::word @@ -12343,14 +12343,14 @@ static constexpr dart::compiler::target::word AOT_OneByteString_InstanceSize = static constexpr dart::compiler::target::word AOT_PatchClass_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_PcDescriptors_HeaderSize = 16; static constexpr dart::compiler::target::word AOT_Pointer_InstanceSize = 24; -static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 24; -static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 120; +static constexpr dart::compiler::target::word AOT_ReceivePort_InstanceSize = 16; +static constexpr dart::compiler::target::word AOT_RegExp_InstanceSize = 80; static constexpr dart::compiler::target::word AOT_Script_InstanceSize = 56; static constexpr dart::compiler::target::word AOT_SendPort_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_SingleTargetCache_InstanceSize = 32; static constexpr dart::compiler::target::word AOT_Smi_InstanceSize = 8; -static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 40; +static constexpr dart::compiler::target::word AOT_StackTrace_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_String_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_SubtypeTestCache_InstanceSize = 16; @@ -12359,17 +12359,17 @@ static constexpr dart::compiler::target::word AOT_TransferableTypedData_InstanceSize = 8; static constexpr dart::compiler::target::word AOT_TwoByteString_InstanceSize = 16; -static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 56; +static constexpr dart::compiler::target::word AOT_Type_InstanceSize = 40; static constexpr dart::compiler::target::word AOT_TypeArguments_InstanceSize = 40; static constexpr dart::compiler::target::word AOT_TypeParameter_InstanceSize = - 64; -static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 32; + 48; +static constexpr dart::compiler::target::word AOT_TypeRef_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedData_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedDataBase_InstanceSize = 24; static constexpr dart::compiler::target::word AOT_TypedDataView_InstanceSize = - 40; + 32; static constexpr dart::compiler::target::word AOT_UnhandledException_InstanceSize = 16; static constexpr dart::compiler::target::word AOT_UnlinkedCall_InstanceSize = diff --git a/runtime/vm/compiler/stub_code_compiler.cc b/runtime/vm/compiler/stub_code_compiler.cc index b41e1f9db1b..bbcdc8c827a 100644 --- a/runtime/vm/compiler/stub_code_compiler.cc +++ b/runtime/vm/compiler/stub_code_compiler.cc @@ -321,7 +321,7 @@ static void GenerateTypeIsTopTypeForSubtyping(Assembler* assembler, // instantiation may result in a top type. // Function types cannot be top types. __ BranchIf(NOT_EQUAL, &done); - __ LoadField( + __ LoadCompressedField( scratch2_reg, compiler::FieldAddress(scratch1_reg, compiler::target::Type::type_class_id_offset())); @@ -351,9 +351,10 @@ static void GenerateTypeIsTopTypeForSubtyping(Assembler* assembler, __ Ret(); // An uncommon case, so off the main trunk of the function. __ Bind(&unwrap_future_or); - __ LoadField(scratch2_reg, - compiler::FieldAddress( - scratch1_reg, compiler::target::Type::arguments_offset())); + __ LoadCompressedField( + scratch2_reg, + compiler::FieldAddress(scratch1_reg, + compiler::target::Type::arguments_offset())); __ CompareObject(scratch2_reg, Object::null_object()); // If the arguments are null, then unwrapping gives dynamic, a top type. __ BranchIf(EQUAL, &is_top_type, compiler::Assembler::kNearJump); @@ -441,16 +442,17 @@ static void GenerateNullIsAssignableToType(Assembler* assembler, // FutureOr is a special case because it may have the non-nullable bit set, // but FutureOr functions as the union of T and Future, so it must be // unwrapped to see if T is nullable. - __ LoadField( + __ LoadCompressedField( kScratchReg, compiler::FieldAddress(kCurrentTypeReg, compiler::target::Type::type_class_id_offset())); __ SmiUntag(kScratchReg); __ CompareImmediate(kScratchReg, kFutureOrCid); __ BranchIf(NOT_EQUAL, &done); - __ LoadField(kScratchReg, compiler::FieldAddress( - kCurrentTypeReg, - compiler::target::Type::arguments_offset())); + __ LoadCompressedField( + kScratchReg, + compiler::FieldAddress(kCurrentTypeReg, + compiler::target::Type::arguments_offset())); __ CompareObject(kScratchReg, Object::null_object()); // If the arguments are null, then unwrapping gives the dynamic type, // which can take null. diff --git a/runtime/vm/compiler/stub_code_compiler_arm64.cc b/runtime/vm/compiler/stub_code_compiler_arm64.cc index e6f79d98017..bc5eb6ae8a0 100644 --- a/runtime/vm/compiler/stub_code_compiler_arm64.cc +++ b/runtime/vm/compiler/stub_code_compiler_arm64.cc @@ -3638,7 +3638,7 @@ void StubCodeCompiler::GenerateAllocateTypedDataArrayStub(Assembler* assembler, /* R0: new object start as a tagged pointer. */ /* R1: new object end address. */ __ mov(R2, AllocateTypedDataArrayABI::kLengthReg); /* Array length. */ - __ StoreIntoObjectNoBarrier( + __ StoreCompressedIntoObjectNoBarrier( R0, FieldAddress(R0, target::TypedDataBase::length_offset()), R2); /* Initialize all array elements to 0. */ /* R0: new object start as a tagged pointer. */ diff --git a/runtime/vm/compiler/stub_code_compiler_x64.cc b/runtime/vm/compiler/stub_code_compiler_x64.cc index a6425ad3656..8d2987a7360 100644 --- a/runtime/vm/compiler/stub_code_compiler_x64.cc +++ b/runtime/vm/compiler/stub_code_compiler_x64.cc @@ -2380,7 +2380,7 @@ void StubCodeCompiler::GenerateNArgsCheckInlineCacheStub( // because we only emit calls to this stub when it is not null. __ movq(RCX, FieldAddress(RBX, target::ICData::receivers_static_type_offset())); - __ movq(RCX, FieldAddress(RCX, target::Type::arguments_offset())); + __ LoadCompressed(RCX, FieldAddress(RCX, target::Type::arguments_offset())); // RAX contains an offset to type arguments in words as a smi, // hence TIMES_4. RDX is guaranteed to be non-smi because it is expected // to have type arguments. @@ -3593,7 +3593,7 @@ void StubCodeCompiler::GenerateAllocateTypedDataArrayStub(Assembler* assembler, /* RAX: new object start as a tagged pointer. */ /* RCX: new object end address. */ __ popq(RDI); /* Array length. */ - __ StoreIntoObjectNoBarrier( + __ StoreCompressedIntoObjectNoBarrier( RAX, FieldAddress(RAX, target::TypedDataBase::length_offset()), RDI); /* Initialize all array elements to 0. */ /* RAX: new object start as a tagged pointer. */ diff --git a/runtime/vm/heap/compactor.cc b/runtime/vm/heap/compactor.cc index 7006f3ecff1..462a9d24655 100644 --- a/runtime/vm/heap/compactor.cc +++ b/runtime/vm/heap/compactor.cc @@ -275,7 +275,7 @@ void GCCompactor::Compact(OldPage* pages, for (intptr_t i = 0; i < length; ++i) { auto raw_view = typed_data_views_[i]; const classid_t cid = - raw_view->untag()->typed_data_->GetClassIdMayBeSmi(); + raw_view->untag()->typed_data()->GetClassIdMayBeSmi(); // If we have external typed data we can simply return, since the backing // store lives in C-heap and will not move. Otherwise we have to update @@ -668,12 +668,12 @@ void GCCompactor::ForwardCompressedPointer(uword heap_base, } void GCCompactor::VisitTypedDataViewPointers(TypedDataViewPtr view, - ObjectPtr* first, - ObjectPtr* last) { + CompressedObjectPtr* first, + CompressedObjectPtr* last) { // First we forward all fields of the typed data view. - ObjectPtr old_backing = view->untag()->typed_data_; - VisitPointers(first, last); - ObjectPtr new_backing = view->untag()->typed_data_; + ObjectPtr old_backing = view->untag()->typed_data(); + VisitCompressedPointers(view->heap_base(), first, last); + ObjectPtr new_backing = view->untag()->typed_data(); const bool backing_moved = old_backing != new_backing; if (backing_moved) { @@ -694,9 +694,9 @@ void GCCompactor::VisitTypedDataViewPointers(TypedDataViewPtr view, // The backing store didn't move, we therefore don't need to update the // inner pointer. if (view->untag()->data_ == 0) { - ASSERT(RawSmiValue(view->untag()->offset_in_bytes_) == 0 && - RawSmiValue(view->untag()->length_) == 0 && - view->untag()->typed_data_ == Object::null()); + ASSERT(RawSmiValue(view->untag()->offset_in_bytes()) == 0 && + RawSmiValue(view->untag()->length()) == 0 && + view->untag()->typed_data() == Object::null()); } } } diff --git a/runtime/vm/heap/compactor.h b/runtime/vm/heap/compactor.h index 9dfa96d3590..164c21404be 100644 --- a/runtime/vm/heap/compactor.h +++ b/runtime/vm/heap/compactor.h @@ -40,8 +40,8 @@ class GCCompactor : public ValueObject, void ForwardPointer(ObjectPtr* ptr); void ForwardCompressedPointer(uword heap_base, CompressedObjectPtr* ptr); void VisitTypedDataViewPointers(TypedDataViewPtr view, - ObjectPtr* first, - ObjectPtr* last); + CompressedObjectPtr* first, + CompressedObjectPtr* last); void VisitPointers(ObjectPtr* first, ObjectPtr* last); void VisitCompressedPointers(uword heap_base, CompressedObjectPtr* first, diff --git a/runtime/vm/heap/scavenger.cc b/runtime/vm/heap/scavenger.cc index 6f0b4c33255..bdc785c6aad 100644 --- a/runtime/vm/heap/scavenger.cc +++ b/runtime/vm/heap/scavenger.cc @@ -122,8 +122,8 @@ class ScavengerVisitorBase : public ObjectPointerVisitor { delayed_weak_properties_(WeakProperty::null()) {} virtual void VisitTypedDataViewPointers(TypedDataViewPtr view, - ObjectPtr* first, - ObjectPtr* last) { + CompressedObjectPtr* first, + CompressedObjectPtr* last) { // TypedDataViews require extra processing to update their // PointerBase::data_ pointer. If the underlying typed data is external, no // update is needed. If the underlying typed data is internal, the pointer @@ -140,11 +140,11 @@ class ScavengerVisitorBase : public ObjectPointerVisitor { view->untag()->data_ != view->untag()->DataFieldForInternalTypedData(); // Forward all fields of the typed data view. - VisitPointers(first, last); + VisitCompressedPointers(view->heap_base(), first, last); if (view->untag()->data_ == nullptr) { - ASSERT(RawSmiValue(view->untag()->offset_in_bytes_) == 0 && - RawSmiValue(view->untag()->length_) == 0); + ASSERT(RawSmiValue(view->untag()->offset_in_bytes()) == 0 && + RawSmiValue(view->untag()->length()) == 0); ASSERT(is_external); return; } @@ -156,7 +156,7 @@ class ScavengerVisitorBase : public ObjectPointerVisitor { ASSERT(IsTypedDataViewClassId(view->GetClassIdMayBeSmi())); // Validate that the backing store is not a forwarding word. - TypedDataBasePtr td = view->untag()->typed_data_; + TypedDataBasePtr td = view->untag()->typed_data(); ASSERT(td->IsHeapObject()); const uword td_header = *reinterpret_cast(UntaggedObject::ToAddr(td)); diff --git a/runtime/vm/image_snapshot.cc b/runtime/vm/image_snapshot.cc index 25ace1d7580..f20022eb7da 100644 --- a/runtime/vm/image_snapshot.cc +++ b/runtime/vm/image_snapshot.cc @@ -535,9 +535,9 @@ void ImageWriter::WriteROData(NonStreamingWriteStream* stream, bool vm) { RELEASE_ASSERT(String::GetCachedHash(str.ptr()) != 0); RELEASE_ASSERT(str.IsOneByteString() || str.IsTwoByteString()); - stream->WriteTargetWord(static_cast(str.ptr()->untag()->length_)); + stream->WriteTargetWord(static_cast(str.ptr()->untag()->length())); #if !defined(HASH_IN_OBJECT_HEADER) - stream->WriteTargetWord(static_cast(str.ptr()->untag()->hash_)); + stream->WriteTargetWord(static_cast(str.ptr()->untag()->hash())); #endif ASSERT_EQUAL(stream->Position() - object_start, compiler::target::String::InstanceSize()); diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 9cf9ba70a5a..6eff1b432da 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -9994,7 +9994,7 @@ void FunctionType::SetNumOptionalParameters( FunctionTypePtr FunctionType::New(Heap::Space space) { ObjectPtr raw = Object::Allocate(FunctionType::kClassId, FunctionType::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); return static_cast(raw); } @@ -20616,7 +20616,7 @@ void Type::set_arguments(const TypeArguments& value) const { TypePtr Type::New(Heap::Space space) { ObjectPtr raw = Object::Allocate(Type::kClassId, Type::InstanceSize(), space, - /*compressed*/ false); + /*compressed*/ true); return static_cast(raw); } @@ -21011,7 +21011,7 @@ intptr_t TypeRef::Hash() const { TypeRefPtr TypeRef::New() { ObjectPtr raw = Object::Allocate(TypeRef::kClassId, TypeRef::InstanceSize(), - Heap::kOld, /*compressed*/ false); + Heap::kOld, /*compressed*/ true); return static_cast(raw); } @@ -21518,7 +21518,7 @@ intptr_t TypeParameter::ComputeHash() const { TypeParameterPtr TypeParameter::New() { ObjectPtr raw = Object::Allocate(TypeParameter::kClassId, TypeParameter::InstanceSize(), - Heap::kOld, /*compressed*/ false); + Heap::kOld, /*compressed*/ true); return static_cast(raw); } @@ -23190,7 +23190,7 @@ OneByteStringPtr OneByteString::New(intptr_t len, Heap::Space space) { { ObjectPtr raw = Object::Allocate(OneByteString::kClassId, OneByteString::InstanceSize(len), space, - /*compressed*/ false); + /*compressed*/ true); NoSafepointScope no_safepoint; OneByteStringPtr result = static_cast(raw); result->untag()->set_length(Smi::New(len)); @@ -23398,7 +23398,7 @@ TwoByteStringPtr TwoByteString::New(intptr_t len, Heap::Space space) { { ObjectPtr raw = Object::Allocate(TwoByteString::kClassId, TwoByteString::InstanceSize(len), space, - /*compressed*/ false); + /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; result.SetLength(len); @@ -23555,7 +23555,7 @@ ExternalOneByteStringPtr ExternalOneByteString::New( { ObjectPtr raw = Object::Allocate(ExternalOneByteString::kClassId, ExternalOneByteString::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; result.SetLength(len); @@ -23585,7 +23585,7 @@ ExternalTwoByteStringPtr ExternalTwoByteString::New( { ObjectPtr raw = Object::Allocate(ExternalTwoByteString::kClassId, ExternalTwoByteString::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; result.SetLength(len); @@ -24306,7 +24306,7 @@ TypedDataPtr TypedData::New(intptr_t class_id, const intptr_t length_in_bytes = len * ElementSizeInBytes(class_id); ObjectPtr raw = Object::Allocate(class_id, TypedData::InstanceSize(length_in_bytes), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; result.SetLength(len); @@ -24353,7 +24353,7 @@ ExternalTypedDataPtr ExternalTypedData::New( { ObjectPtr raw = Object::Allocate(class_id, ExternalTypedData::InstanceSize(), space, - /*compressed*/ false); + /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; result.SetLength(len); @@ -24375,7 +24375,7 @@ TypedDataViewPtr TypedDataView::New(intptr_t class_id, Heap::Space space) { auto& result = TypedDataView::Handle(); { ObjectPtr raw = Object::Allocate(class_id, TypedDataView::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; result.Clear(); @@ -24497,7 +24497,7 @@ ReceivePortPtr ReceivePort::New(Dart_Port id, { ObjectPtr raw = Object::Allocate(ReceivePort::kClassId, ReceivePort::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; result.untag()->set_send_port(send_port.ptr()); @@ -24802,7 +24802,7 @@ StackTracePtr StackTrace::New(const Array& code_array, { ObjectPtr raw = Object::Allocate(StackTrace::kClassId, StackTrace::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; } @@ -24822,7 +24822,7 @@ StackTracePtr StackTrace::New(const Array& code_array, { ObjectPtr raw = Object::Allocate(StackTrace::kClassId, StackTrace::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; } @@ -25128,7 +25128,29 @@ void RegExp::set_pattern(const String& pattern) const { void RegExp::set_function(intptr_t cid, bool sticky, const Function& value) const { - StorePointer(FunctionAddr(cid, sticky), value.ptr()); + if (sticky) { + switch (cid) { + case kOneByteStringCid: + return untag()->set_one_byte_sticky(value.ptr()); + case kTwoByteStringCid: + return untag()->set_two_byte_sticky(value.ptr()); + case kExternalOneByteStringCid: + return untag()->set_external_one_byte_sticky(value.ptr()); + case kExternalTwoByteStringCid: + return untag()->set_external_two_byte_sticky(value.ptr()); + } + } else { + switch (cid) { + case kOneByteStringCid: + return untag()->set_one_byte(value.ptr()); + case kTwoByteStringCid: + return untag()->set_two_byte(value.ptr()); + case kExternalOneByteStringCid: + return untag()->set_external_one_byte(value.ptr()); + case kExternalTwoByteStringCid: + return untag()->set_external_two_byte(value.ptr()); + } + } } void RegExp::set_bytecode(bool is_one_byte, @@ -25149,16 +25171,8 @@ void RegExp::set_bytecode(bool is_one_byte, } } -void RegExp::set_num_bracket_expressions(SmiPtr value) const { - untag()->set_num_bracket_expressions(value); -} - -void RegExp::set_num_bracket_expressions(const Smi& value) const { - untag()->set_num_bracket_expressions(value.ptr()); -} - void RegExp::set_num_bracket_expressions(intptr_t value) const { - untag()->set_num_bracket_expressions(Smi::New(value)); + untag()->num_bracket_expressions_ = value; } void RegExp::set_capture_name_map(const Array& array) const { @@ -25169,11 +25183,12 @@ RegExpPtr RegExp::New(Heap::Space space) { RegExp& result = RegExp::Handle(); { ObjectPtr raw = Object::Allocate(RegExp::kClassId, RegExp::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; result.set_type(kUninitialized); result.set_flags(RegExpFlags()); + result.set_num_bracket_expressions(-1); result.set_num_registers(/*is_one_byte=*/false, -1); result.set_num_registers(/*is_one_byte=*/true, -1); } @@ -25299,7 +25314,7 @@ MirrorReferencePtr MirrorReference::New(const Object& referent, { ObjectPtr raw = Object::Allocate(MirrorReference::kClassId, MirrorReference::InstanceSize(), space, - /*compressed*/ false); + /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; } @@ -25337,7 +25352,7 @@ UserTagPtr UserTag::New(const String& label, Heap::Space space) { // No tag with label exists, create and register with isolate tag table. { ObjectPtr raw = Object::Allocate(UserTag::kClassId, UserTag::InstanceSize(), - space, /*compressed*/ false); + space, /*compressed*/ true); NoSafepointScope no_safepoint; result ^= raw; } diff --git a/runtime/vm/object.h b/runtime/vm/object.h index 6848241eb5a..4f4fb6cebe2 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -10982,18 +10982,18 @@ class RegExp : public Instance { } StringPtr pattern() const { return untag()->pattern(); } - SmiPtr num_bracket_expressions() const { - return untag()->num_bracket_expressions(); + intptr_t num_bracket_expressions() const { + return untag()->num_bracket_expressions_; } ArrayPtr capture_name_map() const { return untag()->capture_name_map(); } TypedDataPtr bytecode(bool is_one_byte, bool sticky) const { if (sticky) { - return TypedData::RawCast(is_one_byte ? untag()->one_byte_sticky_ - : untag()->two_byte_sticky_); + return TypedData::RawCast(is_one_byte ? untag()->one_byte_sticky() + : untag()->two_byte_sticky()); } else { - return TypedData::RawCast(is_one_byte ? untag()->one_byte_ - : untag()->two_byte_); + return TypedData::RawCast(is_one_byte ? untag()->one_byte() + : untag()->two_byte()); } } @@ -11026,13 +11026,33 @@ class RegExp : public Instance { return -1; } - FunctionPtr* FunctionAddr(intptr_t cid, bool sticky) const { - return reinterpret_cast( - FieldAddrAtOffset(function_offset(cid, sticky))); - } - FunctionPtr function(intptr_t cid, bool sticky) const { - return *FunctionAddr(cid, sticky); + if (sticky) { + switch (cid) { + case kOneByteStringCid: + return static_cast(untag()->one_byte_sticky()); + case kTwoByteStringCid: + return static_cast(untag()->two_byte_sticky()); + case kExternalOneByteStringCid: + return static_cast(untag()->external_one_byte_sticky()); + case kExternalTwoByteStringCid: + return static_cast(untag()->external_two_byte_sticky()); + } + } else { + switch (cid) { + case kOneByteStringCid: + return static_cast(untag()->one_byte()); + case kTwoByteStringCid: + return static_cast(untag()->two_byte()); + case kExternalOneByteStringCid: + return static_cast(untag()->external_one_byte()); + case kExternalTwoByteStringCid: + return static_cast(untag()->external_two_byte()); + } + } + + UNREACHABLE(); + return Function::null(); } void set_pattern(const String& pattern) const; @@ -11426,7 +11446,7 @@ inline void Type::SetHash(intptr_t value) const { inline intptr_t FunctionType::Hash() const { ASSERT(IsFinalized()); - intptr_t result = Smi::Value(untag()->hash_); + intptr_t result = Smi::Value(untag()->hash()); if (result != 0) { return result; } diff --git a/runtime/vm/object_graph.cc b/runtime/vm/object_graph.cc index 4963b0733e1..c9b0bf3afdb 100644 --- a/runtime/vm/object_graph.cc +++ b/runtime/vm/object_graph.cc @@ -905,7 +905,7 @@ class Pass2Visitor : public ObjectVisitor, sizeof(double)); } else if (cid == kOneByteStringCid) { OneByteStringPtr str = static_cast(obj); - intptr_t len = Smi::Value(str->untag()->length_); + intptr_t len = Smi::Value(str->untag()->length()); intptr_t trunc_len = Utils::Minimum(len, kMaxStringElements); writer_->WriteUnsigned(kLatin1Data); writer_->WriteUnsigned(len); @@ -913,7 +913,7 @@ class Pass2Visitor : public ObjectVisitor, writer_->WriteBytes(&str->untag()->data()[0], trunc_len); } else if (cid == kExternalOneByteStringCid) { ExternalOneByteStringPtr str = static_cast(obj); - intptr_t len = Smi::Value(str->untag()->length_); + intptr_t len = Smi::Value(str->untag()->length()); intptr_t trunc_len = Utils::Minimum(len, kMaxStringElements); writer_->WriteUnsigned(kLatin1Data); writer_->WriteUnsigned(len); @@ -921,7 +921,7 @@ class Pass2Visitor : public ObjectVisitor, writer_->WriteBytes(&str->untag()->external_data_[0], trunc_len); } else if (cid == kTwoByteStringCid) { TwoByteStringPtr str = static_cast(obj); - intptr_t len = Smi::Value(str->untag()->length_); + intptr_t len = Smi::Value(str->untag()->length()); intptr_t trunc_len = Utils::Minimum(len, kMaxStringElements); writer_->WriteUnsigned(kUTF16Data); writer_->WriteUnsigned(len); @@ -929,7 +929,7 @@ class Pass2Visitor : public ObjectVisitor, writer_->WriteBytes(&str->untag()->data()[0], trunc_len * 2); } else if (cid == kExternalTwoByteStringCid) { ExternalTwoByteStringPtr str = static_cast(obj); - intptr_t len = Smi::Value(str->untag()->length_); + intptr_t len = Smi::Value(str->untag()->length()); intptr_t trunc_len = Utils::Minimum(len, kMaxStringElements); writer_->WriteUnsigned(kUTF16Data); writer_->WriteUnsigned(len); @@ -953,11 +953,11 @@ class Pass2Visitor : public ObjectVisitor, } else if (IsTypedDataClassId(cid)) { writer_->WriteUnsigned(kLengthData); writer_->WriteUnsigned( - Smi::Value(static_cast(obj)->untag()->length_)); + Smi::Value(static_cast(obj)->untag()->length())); } else if (IsExternalTypedDataClassId(cid)) { writer_->WriteUnsigned(kLengthData); - writer_->WriteUnsigned( - Smi::Value(static_cast(obj)->untag()->length_)); + writer_->WriteUnsigned(Smi::Value( + static_cast(obj)->untag()->length())); } else if (cid == kFunctionCid) { writer_->WriteUnsigned(kNameData); ScrubAndWriteUtf8(static_cast(obj)->untag()->name()); diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc index 18db2fdf815..7fb0ce7d811 100644 --- a/runtime/vm/raw_object.cc +++ b/runtime/vm/raw_object.cc @@ -131,14 +131,14 @@ intptr_t UntaggedObject::HeapSizeFromClass(uword tags) const { case kOneByteStringCid: { const OneByteStringPtr raw_string = static_cast(this); - intptr_t string_length = Smi::Value(raw_string->untag()->length_); + intptr_t string_length = Smi::Value(raw_string->untag()->length()); instance_size = OneByteString::InstanceSize(string_length); break; } case kTwoByteStringCid: { const TwoByteStringPtr raw_string = static_cast(this); - intptr_t string_length = Smi::Value(raw_string->untag()->length_); + intptr_t string_length = Smi::Value(raw_string->untag()->length()); instance_size = TwoByteString::InstanceSize(string_length); break; } @@ -160,7 +160,7 @@ intptr_t UntaggedObject::HeapSizeFromClass(uword tags) const { #define SIZE_FROM_CLASS(clazz) case kTypedData##clazz##Cid: CLASS_LIST_TYPED_DATA(SIZE_FROM_CLASS) { const TypedDataPtr raw_obj = static_cast(this); - intptr_t array_len = Smi::Value(raw_obj->untag()->length_); + intptr_t array_len = Smi::Value(raw_obj->untag()->length()); intptr_t lengthInBytes = array_len * TypedData::ElementSizeInBytes(class_id); instance_size = TypedData::InstanceSize(lengthInBytes); @@ -460,7 +460,7 @@ bool UntaggedObject::FindObject(FindObjectVisitor* visitor) { Type##Ptr raw_obj, ObjectPointerVisitor* visitor) { \ /* Make sure that we got here with the tagged pointer as this. */ \ ASSERT(raw_obj->IsHeapObject()); \ - ASSERT_UNCOMPRESSED(Type); \ + ASSERT_COMPRESSED(Type); \ visitor->VisitTypedDataViewPointers(raw_obj, raw_obj->untag()->from(), \ raw_obj->untag()->to()); \ return Type::InstanceSize(); \ @@ -535,13 +535,13 @@ COMPRESSED_VISITOR(Library) COMPRESSED_VISITOR(Namespace) COMPRESSED_VISITOR(KernelProgramInfo) COMPRESSED_VISITOR(WeakSerializationReference) -REGULAR_VISITOR(Type) -REGULAR_VISITOR(FunctionType) -REGULAR_VISITOR(TypeRef) -REGULAR_VISITOR(TypeParameter) +COMPRESSED_VISITOR(Type) +COMPRESSED_VISITOR(FunctionType) +COMPRESSED_VISITOR(TypeRef) +COMPRESSED_VISITOR(TypeParameter) COMPRESSED_VISITOR(Function) REGULAR_VISITOR(Closure) -REGULAR_VISITOR(LibraryPrefix) +COMPRESSED_VISITOR(LibraryPrefix) REGULAR_VISITOR(SingleTargetCache) REGULAR_VISITOR(UnlinkedCall) REGULAR_VISITOR(MonomorphicSmiableCall) @@ -551,18 +551,18 @@ COMPRESSED_VISITOR(ApiError) COMPRESSED_VISITOR(LanguageError) COMPRESSED_VISITOR(UnhandledException) COMPRESSED_VISITOR(UnwindError) -REGULAR_VISITOR(ExternalOneByteString) -REGULAR_VISITOR(ExternalTwoByteString) +COMPRESSED_VISITOR(ExternalOneByteString) +COMPRESSED_VISITOR(ExternalTwoByteString) REGULAR_VISITOR(GrowableObjectArray) REGULAR_VISITOR(LinkedHashMap) -REGULAR_VISITOR(ExternalTypedData) +COMPRESSED_VISITOR(ExternalTypedData) TYPED_DATA_VIEW_VISITOR(TypedDataView) -REGULAR_VISITOR(ReceivePort) -REGULAR_VISITOR(StackTrace) -REGULAR_VISITOR(RegExp) +COMPRESSED_VISITOR(ReceivePort) +COMPRESSED_VISITOR(StackTrace) +COMPRESSED_VISITOR(RegExp) REGULAR_VISITOR(WeakProperty) -REGULAR_VISITOR(MirrorReference) -REGULAR_VISITOR(UserTag) +COMPRESSED_VISITOR(MirrorReference) +COMPRESSED_VISITOR(UserTag) REGULAR_VISITOR(SubtypeTestCache) COMPRESSED_VISITOR(LoadingUnit) VARIABLE_VISITOR(TypeArguments, Smi::Value(raw_obj->untag()->length_)) @@ -570,9 +570,10 @@ VARIABLE_COMPRESSED_VISITOR(LocalVarDescriptors, raw_obj->untag()->num_entries_) VARIABLE_COMPRESSED_VISITOR(ExceptionHandlers, raw_obj->untag()->num_entries_) VARIABLE_VISITOR(Context, raw_obj->untag()->num_variables_) VARIABLE_VISITOR(Array, Smi::Value(raw_obj->untag()->length())) -VARIABLE_VISITOR(TypedData, - TypedData::ElementSizeInBytes(raw_obj->GetClassId()) * - Smi::Value(raw_obj->untag()->length_)) +VARIABLE_COMPRESSED_VISITOR( + TypedData, + TypedData::ElementSizeInBytes(raw_obj->GetClassId()) * + Smi::Value(raw_obj->untag()->length())) VARIABLE_COMPRESSED_VISITOR(ContextScope, raw_obj->untag()->num_variables_) NULL_VISITOR(Mint) NULL_VISITOR(Double) @@ -583,7 +584,7 @@ NULL_VISITOR(Bool) NULL_VISITOR(Capability) NULL_VISITOR(SendPort) NULL_VISITOR(TransferableTypedData) -REGULAR_VISITOR(Pointer) +COMPRESSED_VISITOR(Pointer) NULL_VISITOR(DynamicLibrary) VARIABLE_NULL_VISITOR(Instructions, Instructions::Size(raw_obj)) VARIABLE_NULL_VISITOR(InstructionsSection, InstructionsSection::Size(raw_obj)) @@ -591,8 +592,8 @@ VARIABLE_NULL_VISITOR(PcDescriptors, raw_obj->untag()->length_) VARIABLE_NULL_VISITOR(CodeSourceMap, raw_obj->untag()->length_) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) -VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag()->length_)) -VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag()->length_)) +VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag()->length())) +VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag()->length())) // Abstract types don't have their visitor called. UNREACHABLE_VISITOR(AbstractType) UNREACHABLE_VISITOR(CallSiteData) diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h index 5776c386533..b24f93e1b06 100644 --- a/runtime/vm/raw_object.h +++ b/runtime/vm/raw_object.h @@ -2368,19 +2368,22 @@ class UntaggedInstance : public UntaggedObject { class UntaggedLibraryPrefix : public UntaggedInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); - 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) { + VISIT_FROM(CompressedObjectPtr, name) + // Library prefix name. + COMPRESSED_POINTER_FIELD(StringPtr, name) + // Libraries imported with this prefix. + COMPRESSED_POINTER_FIELD(ArrayPtr, imports) + // Library which declares this prefix. + COMPRESSED_POINTER_FIELD(LibraryPtr, importer) + VISIT_TO(CompressedObjectPtr, importer) + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { switch (kind) { case Snapshot::kFullAOT: - return reinterpret_cast(&imports_); + return reinterpret_cast(&imports_); case Snapshot::kFull: case Snapshot::kFullCore: case Snapshot::kFullJIT: - return reinterpret_cast(&importer_); + return reinterpret_cast(&importer_); case Snapshot::kMessage: case Snapshot::kNone: case Snapshot::kInvalid: @@ -2428,7 +2431,7 @@ class UntaggedAbstractType : public UntaggedInstance { static constexpr intptr_t kTypeStateBitSize = 2; uword type_test_stub_entry_point_; // Accessed from generated code. - POINTER_FIELD( + COMPRESSED_POINTER_FIELD( CodePtr, type_test_stub) // Must be the last field, since subclasses use it // in their VISIT_FROM. @@ -2444,15 +2447,15 @@ class UntaggedType : public UntaggedAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(Type); - VISIT_FROM(ObjectPtr, type_test_stub) - POINTER_FIELD(SmiPtr, type_class_id) - POINTER_FIELD(TypeArgumentsPtr, arguments) - POINTER_FIELD(SmiPtr, hash) - VISIT_TO(ObjectPtr, hash) + VISIT_FROM(CompressedObjectPtr, type_test_stub) + COMPRESSED_POINTER_FIELD(SmiPtr, type_class_id) + COMPRESSED_POINTER_FIELD(TypeArgumentsPtr, arguments) + COMPRESSED_POINTER_FIELD(SmiPtr, hash) + VISIT_TO(CompressedObjectPtr, hash) uint8_t type_state_; uint8_t nullability_; - ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } friend class CidRewriteVisitor; friend class UntaggedTypeArguments; @@ -2462,13 +2465,14 @@ class UntaggedFunctionType : public UntaggedAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(FunctionType); - VISIT_FROM(ObjectPtr, type_test_stub) - POINTER_FIELD(TypeArgumentsPtr, type_parameters) // Array of TypeParameter. - POINTER_FIELD(AbstractTypePtr, result_type) - POINTER_FIELD(ArrayPtr, parameter_types) - POINTER_FIELD(ArrayPtr, parameter_names); - POINTER_FIELD(SmiPtr, hash) - VISIT_TO(ObjectPtr, hash) + VISIT_FROM(CompressedObjectPtr, type_test_stub) + // Array of TypeParameter. + COMPRESSED_POINTER_FIELD(TypeArgumentsPtr, type_parameters) + COMPRESSED_POINTER_FIELD(AbstractTypePtr, result_type) + COMPRESSED_POINTER_FIELD(ArrayPtr, parameter_types) + COMPRESSED_POINTER_FIELD(ArrayPtr, parameter_names); + COMPRESSED_POINTER_FIELD(SmiPtr, hash) + VISIT_TO(CompressedObjectPtr, hash) uint32_t packed_fields_; // Number of parent type args and own parameters. uint8_t type_state_; uint8_t nullability_; @@ -2515,7 +2519,7 @@ class UntaggedFunctionType : public UntaggedAbstractType { "a Smi on the target architecture"); private: - ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } friend class Function; }; @@ -2524,27 +2528,27 @@ class UntaggedTypeRef : public UntaggedAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); - 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(); } + VISIT_FROM(CompressedObjectPtr, type_test_stub) + COMPRESSED_POINTER_FIELD(AbstractTypePtr, type) // The referenced type. + VISIT_TO(CompressedObjectPtr, type) + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } }; class UntaggedTypeParameter : public UntaggedAbstractType { private: RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); - VISIT_FROM(ObjectPtr, type_test_stub) - POINTER_FIELD(StringPtr, name) - POINTER_FIELD(SmiPtr, hash) - POINTER_FIELD(AbstractTypePtr, - bound) // ObjectType if no explicit bound specified. + VISIT_FROM(CompressedObjectPtr, type_test_stub) + COMPRESSED_POINTER_FIELD(StringPtr, name) + COMPRESSED_POINTER_FIELD(SmiPtr, hash) + // ObjectType if no explicit bound specified. + COMPRESSED_POINTER_FIELD(AbstractTypePtr, bound) // 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. - POINTER_FIELD(AbstractTypePtr, default_argument) - VISIT_TO(ObjectPtr, default_argument) + COMPRESSED_POINTER_FIELD(AbstractTypePtr, default_argument) + VISIT_TO(CompressedObjectPtr, default_argument) ClassIdTagType parameterized_class_id_; // Or kFunctionCid for function tp. // TODO(regis): Can we use uint8_t twice below? Or keep uint16_t? // Warning: BuildTypeParameterTypeTestStub assumes uint16_t. @@ -2562,7 +2566,7 @@ class UntaggedTypeParameter : public UntaggedAbstractType { static constexpr intptr_t kFlagsBitSize = GenericCovariantImplBit::kNextBit; private: - ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } friend class CidRewriteVisitor; }; @@ -2653,13 +2657,13 @@ class UntaggedString : public UntaggedInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(String); protected: - VISIT_FROM(ObjectPtr, length) - SMI_FIELD(SmiPtr, length) + VISIT_FROM(CompressedObjectPtr, length) + COMPRESSED_SMI_FIELD(SmiPtr, length) #if !defined(HASH_IN_OBJECT_HEADER) - SMI_FIELD(SmiPtr, hash) - VISIT_TO(ObjectPtr, hash) + COMPRESSED_SMI_FIELD(SmiPtr, hash) + VISIT_TO(CompressedObjectPtr, hash) #else - VISIT_TO(ObjectPtr, length) + VISIT_TO(CompressedObjectPtr, length) #endif private: @@ -2728,7 +2732,7 @@ class UntaggedTypedDataBase : public UntaggedPointerBase { protected: // The length of the view in element sizes (obtainable via // [TypedDataBase::ElementSizeInBytes]). - SMI_FIELD(SmiPtr, length); + COMPRESSED_SMI_FIELD(SmiPtr, length); private: friend class UntaggedTypedDataView; @@ -2747,8 +2751,8 @@ class UntaggedTypedData : public UntaggedTypedDataBase { void RecomputeDataField() { data_ = internal_data(); } protected: - VISIT_FROM(ObjectPtr, length) - VISIT_TO_LENGTH(ObjectPtr, &length_) + VISIT_FROM(CompressedObjectPtr, length) + VISIT_TO_LENGTH(CompressedObjectPtr, &length_) // Variable length data follows here. @@ -2782,7 +2786,7 @@ class UntaggedTypedDataView : public UntaggedTypedDataBase { public: // Recompute [data_] based on internal/external [typed_data_]. void RecomputeDataField() { - const intptr_t offset_in_bytes = RawSmiValue(offset_in_bytes_); + const intptr_t offset_in_bytes = RawSmiValue(this->offset_in_bytes()); uint8_t* payload = typed_data()->untag()->data_; data_ = payload + offset_in_bytes; } @@ -2798,7 +2802,7 @@ class UntaggedTypedDataView : public UntaggedTypedDataBase { } uint8_t* DataFieldForInternalTypedData() const { - const intptr_t offset_in_bytes = RawSmiValue(offset_in_bytes_); + const intptr_t offset_in_bytes = RawSmiValue(this->offset_in_bytes()); uint8_t* payload = reinterpret_cast(UntaggedObject::ToAddr(typed_data()) + UntaggedTypedData::payload_offset()); @@ -2808,12 +2812,12 @@ class UntaggedTypedDataView : public UntaggedTypedDataBase { void ValidateInnerPointer() { if (typed_data()->untag()->GetClassId() == kNullCid) { // The view object must have gotten just initialized. - if (data_ != nullptr || RawSmiValue(offset_in_bytes_) != 0 || - RawSmiValue(length_) != 0) { + if (data_ != nullptr || RawSmiValue(offset_in_bytes()) != 0 || + RawSmiValue(length()) != 0) { FATAL("RawTypedDataView has invalid inner pointer."); } } else { - const intptr_t offset_in_bytes = RawSmiValue(offset_in_bytes_); + const intptr_t offset_in_bytes = RawSmiValue(this->offset_in_bytes()); uint8_t* payload = typed_data()->untag()->data_; if ((payload + offset_in_bytes) != data_) { FATAL("RawTypedDataView has invalid inner pointer."); @@ -2822,11 +2826,11 @@ class UntaggedTypedDataView : public UntaggedTypedDataBase { } protected: - 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(); } + VISIT_FROM(CompressedObjectPtr, length) + COMPRESSED_POINTER_FIELD(TypedDataBasePtr, typed_data) + COMPRESSED_SMI_FIELD(SmiPtr, offset_in_bytes) + VISIT_TO(CompressedObjectPtr, offset_in_bytes) + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } friend class Api; friend class Object; @@ -3002,16 +3006,16 @@ class UntaggedExternalTypedData : public UntaggedTypedDataBase { RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData); protected: - VISIT_FROM(ObjectPtr, length) - VISIT_TO(ObjectPtr, length) + VISIT_FROM(CompressedObjectPtr, length) + VISIT_TO(CompressedObjectPtr, length) }; class UntaggedPointer : public UntaggedPointerBase { RAW_HEAP_OBJECT_IMPLEMENTATION(Pointer); - VISIT_FROM(ObjectPtr, type_arguments) - POINTER_FIELD(TypeArgumentsPtr, type_arguments) - VISIT_TO(ObjectPtr, type_arguments) + VISIT_FROM(CompressedObjectPtr, type_arguments) + COMPRESSED_POINTER_FIELD(TypeArgumentsPtr, type_arguments) + VISIT_TO(CompressedObjectPtr, type_arguments) friend class Pointer; }; @@ -3043,15 +3047,15 @@ class alignas(8) UntaggedSendPort : public UntaggedInstance { class UntaggedReceivePort : public UntaggedInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(ReceivePort); - VISIT_FROM(ObjectPtr, send_port) - POINTER_FIELD(SendPortPtr, send_port) - POINTER_FIELD(InstancePtr, handler) + VISIT_FROM(CompressedObjectPtr, send_port) + COMPRESSED_POINTER_FIELD(SendPortPtr, send_port) + COMPRESSED_POINTER_FIELD(InstancePtr, handler) #if !defined(PRODUCT) - POINTER_FIELD(StringPtr, debug_name) - POINTER_FIELD(StackTracePtr, allocation_location) - VISIT_TO(ObjectPtr, allocation_location) + COMPRESSED_POINTER_FIELD(StringPtr, debug_name) + COMPRESSED_POINTER_FIELD(StackTracePtr, allocation_location) + VISIT_TO(CompressedObjectPtr, allocation_location) #else - VISIT_TO(ObjectPtr, handler) + VISIT_TO(CompressedObjectPtr, handler) #endif // !defined(PRODUCT) }; @@ -3067,15 +3071,16 @@ class UntaggedTransferableTypedData : public UntaggedInstance { class UntaggedStackTrace : public UntaggedInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(StackTrace); - 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(TypedDataPtr, pc_offset_array); // Offset of PC for each frame. + VISIT_FROM(CompressedObjectPtr, async_link) + // Link to parent async stack trace. + COMPRESSED_POINTER_FIELD(StackTracePtr, async_link); + // Code object for each frame in the stack trace. + COMPRESSED_POINTER_FIELD(ArrayPtr, code_array); + // Offset of PC for each frame. + COMPRESSED_POINTER_FIELD(TypedDataPtr, pc_offset_array); - VISIT_TO(ObjectPtr, pc_offset_array) - ObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } + VISIT_TO(CompressedObjectPtr, pc_offset_array) + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } // False for pre-allocated stack trace (used in OOM and Stack overflow). bool expand_inlined_; @@ -3089,20 +3094,22 @@ class UntaggedStackTrace : public UntaggedInstance { class UntaggedRegExp : public UntaggedInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(RegExp); - 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(); } + VISIT_FROM(CompressedObjectPtr, capture_name_map) + COMPRESSED_POINTER_FIELD(ArrayPtr, capture_name_map) + // Pattern to be used for matching. + COMPRESSED_POINTER_FIELD(StringPtr, pattern) + COMPRESSED_POINTER_FIELD(ObjectPtr, one_byte) // FunctionPtr or TypedDataPtr + COMPRESSED_POINTER_FIELD(ObjectPtr, two_byte) + COMPRESSED_POINTER_FIELD(ObjectPtr, external_one_byte) + COMPRESSED_POINTER_FIELD(ObjectPtr, external_two_byte) + COMPRESSED_POINTER_FIELD(ObjectPtr, one_byte_sticky) + COMPRESSED_POINTER_FIELD(ObjectPtr, two_byte_sticky) + COMPRESSED_POINTER_FIELD(ObjectPtr, external_one_byte_sticky) + COMPRESSED_POINTER_FIELD(ObjectPtr, external_two_byte_sticky) + VISIT_TO(CompressedObjectPtr, external_two_byte_sticky) + CompressedObjectPtr* to_snapshot(Snapshot::Kind kind) { return to(); } + + intptr_t num_bracket_expressions_; // The same pattern may use different amount of registers if compiled // for a one-byte target than a two-byte target. For example, we do not @@ -3144,18 +3151,18 @@ class UntaggedWeakProperty : public UntaggedInstance { class UntaggedMirrorReference : public UntaggedInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(MirrorReference); - VISIT_FROM(ObjectPtr, referent) - POINTER_FIELD(ObjectPtr, referent) - VISIT_TO(ObjectPtr, referent) + VISIT_FROM(CompressedObjectPtr, referent) + COMPRESSED_POINTER_FIELD(ObjectPtr, referent) + VISIT_TO(CompressedObjectPtr, referent) }; // UserTag are used by the profiler to track Dart script state. class UntaggedUserTag : public UntaggedInstance { RAW_HEAP_OBJECT_IMPLEMENTATION(UserTag); - VISIT_FROM(ObjectPtr, label) - POINTER_FIELD(StringPtr, label) - VISIT_TO(ObjectPtr, label) + VISIT_FROM(CompressedObjectPtr, label) + COMPRESSED_POINTER_FIELD(StringPtr, label) + VISIT_TO(CompressedObjectPtr, label) // Isolate unique tag. uword tag_; diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc index c6c8955d8a2..414430b7729 100644 --- a/runtime/vm/raw_object_snapshot.cc +++ b/runtime/vm/raw_object_snapshot.cc @@ -101,8 +101,8 @@ TypePtr Type::ReadFrom(SnapshotReader* reader, reader->EnqueueTypePostprocessing(type); // Set all the object fields. - READ_OBJECT_FIELDS(type, type.ptr()->untag()->from(), - type.ptr()->untag()->to(), as_reference); + READ_COMPRESSED_OBJECT_FIELDS(type, type.ptr()->untag()->from(), + type.ptr()->untag()->to(), as_reference); // Read in the type class. (*reader->ClassHandle()) = @@ -166,7 +166,7 @@ void UntaggedType::WriteTo(SnapshotWriter* writer, // Write out all the object pointer fields. ASSERT(type_class_id() != Object::null()); SnapshotWriterVisitor visitor(writer, as_reference); - visitor.VisitPointers(from(), to()); + visitor.VisitCompressedPointers(heap_base(), from(), to()); // Write out the type class. writer->WriteObjectImpl(type_class, as_reference); @@ -187,8 +187,8 @@ TypeRefPtr TypeRef::ReadFrom(SnapshotReader* reader, reader->EnqueueTypePostprocessing(type_ref); // Set all the object fields. - READ_OBJECT_FIELDS(type_ref, type_ref.ptr()->untag()->from(), - type_ref.ptr()->untag()->to(), kAsReference); + READ_COMPRESSED_OBJECT_FIELDS(type_ref, type_ref.ptr()->untag()->from(), + type_ref.ptr()->untag()->to(), kAsReference); // Fill in the type testing stub. Code& code = *reader->CodeHandle(); @@ -213,7 +213,7 @@ void UntaggedTypeRef::WriteTo(SnapshotWriter* writer, // Write out all the object pointer fields. SnapshotWriterVisitor visitor(writer, kAsReference); - visitor.VisitPointers(from(), to()); + visitor.VisitCompressedPointers(heap_base(), from(), to()); } TypeParameterPtr TypeParameter::ReadFrom(SnapshotReader* reader, @@ -238,8 +238,9 @@ TypeParameterPtr TypeParameter::ReadFrom(SnapshotReader* reader, reader->EnqueueTypePostprocessing(type_parameter); // Set all the object fields. - READ_OBJECT_FIELDS(type_parameter, type_parameter.ptr()->untag()->from(), - type_parameter.ptr()->untag()->to(), kAsReference); + READ_COMPRESSED_OBJECT_FIELDS( + type_parameter, type_parameter.ptr()->untag()->from(), + type_parameter.ptr()->untag()->to(), kAsReference); // Read in the parameterized class. (*reader->ClassHandle()) = @@ -287,7 +288,7 @@ void UntaggedTypeParameter::WriteTo(SnapshotWriter* writer, // Write out all the object pointer fields. SnapshotWriterVisitor visitor(writer, kAsReference); - visitor.VisitPointers(from(), to()); + visitor.VisitCompressedPointers(heap_base(), from(), to()); // Write out the parameterized class (or Function if cid == kFunctionCid). ClassPtr param_class = @@ -1375,7 +1376,7 @@ void UntaggedTypedData::WriteTo(SnapshotWriter* writer, bool as_reference) { ASSERT(writer != NULL); intptr_t cid = this->GetClassId(); - intptr_t length = Smi::Value(length_); // In elements. + intptr_t length = Smi::Value(this->length()); // In elements. intptr_t external_cid; intptr_t bytes; switch (cid) { @@ -1449,7 +1450,7 @@ void UntaggedTypedData::WriteTo(SnapshotWriter* writer, // Write as external. writer->WriteIndexedObject(external_cid); writer->WriteTags(writer->GetObjectTags(this)); - writer->Write(length_); + writer->Write(this->length()); uint8_t* data = reinterpret_cast(this->data()); void* passed_data = malloc(bytes); memmove(passed_data, data, bytes); @@ -1462,7 +1463,7 @@ void UntaggedTypedData::WriteTo(SnapshotWriter* writer, // Write as internal. writer->WriteIndexedObject(cid); writer->WriteTags(writer->GetObjectTags(this)); - writer->Write(length_); + writer->Write(this->length()); uint8_t* data = reinterpret_cast(this->data()); writer->Align(Zone::kAlignment); writer->WriteBytes(data, bytes); @@ -1475,7 +1476,7 @@ void UntaggedExternalTypedData::WriteTo(SnapshotWriter* writer, bool as_reference) { ASSERT(writer != NULL); intptr_t cid = this->GetClassId(); - intptr_t length = Smi::Value(length_); // In elements. + intptr_t length = Smi::Value(this->length()); // In elements. intptr_t bytes; switch (cid) { case kExternalTypedDataInt8ArrayCid: @@ -1531,7 +1532,7 @@ void UntaggedExternalTypedData::WriteTo(SnapshotWriter* writer, // Write as external. writer->WriteIndexedObject(cid); writer->WriteTags(writer->GetObjectTags(this)); - writer->Write(length_); + writer->Write(this->length()); uint8_t* data = reinterpret_cast(data_); void* passed_data = malloc(bytes); memmove(passed_data, data, bytes); @@ -1547,7 +1548,7 @@ void UntaggedTypedDataView::WriteTo(SnapshotWriter* writer, Snapshot::Kind kind, bool as_reference) { // Views have always a backing store. - ASSERT(typed_data_ != Object::null()); + ASSERT(typed_data() != Object::null()); // Write out the serialization header value for this object. writer->WriteInlinedObjectHeader(object_id); @@ -1557,9 +1558,9 @@ void UntaggedTypedDataView::WriteTo(SnapshotWriter* writer, writer->WriteTags(writer->GetObjectTags(this)); // Write members. - writer->Write(offset_in_bytes_); - writer->Write(length_); - writer->WriteObjectImpl(typed_data_, as_reference); + writer->Write(offset_in_bytes()); + writer->Write(length()); + writer->WriteObjectImpl(typed_data(), as_reference); } TypedDataViewPtr TypedDataView::ReadFrom(SnapshotReader* reader, @@ -1713,14 +1714,13 @@ RegExpPtr RegExp::ReadFrom(SnapshotReader* reader, reader->AddBackRef(object_id, ®ex, kIsDeserialized); // Read and Set all the other fields. - *reader->SmiHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); - regex.set_num_bracket_expressions(*reader->SmiHandle()); - *reader->ArrayHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); regex.set_capture_name_map(*reader->ArrayHandle()); *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); regex.set_pattern(*reader->StringHandle()); + regex.StoreNonPointer(®ex.untag()->num_bracket_expressions_, + reader->Read()); regex.StoreNonPointer(®ex.untag()->num_one_byte_registers_, reader->Read()); regex.StoreNonPointer(®ex.untag()->num_two_byte_registers_, @@ -1751,9 +1751,9 @@ void UntaggedRegExp::WriteTo(SnapshotWriter* writer, writer->WriteTags(writer->GetObjectTags(this)); // Write out all the other fields. - writer->WriteObjectImpl(num_bracket_expressions_, kAsInlinedObject); - writer->WriteObjectImpl(capture_name_map_, kAsInlinedObject); - writer->WriteObjectImpl(pattern_, kAsInlinedObject); + writer->WriteObjectImpl(capture_name_map(), kAsInlinedObject); + writer->WriteObjectImpl(pattern(), kAsInlinedObject); + writer->Write(num_bracket_expressions_); writer->Write(num_one_byte_registers_); writer->Write(num_two_byte_registers_); writer->Write(type_flags_); diff --git a/runtime/vm/regexp_assembler_bytecode.cc b/runtime/vm/regexp_assembler_bytecode.cc index 4d8841f046c..708297a845b 100644 --- a/runtime/vm/regexp_assembler_bytecode.cc +++ b/runtime/vm/regexp_assembler_bytecode.cc @@ -465,7 +465,7 @@ static intptr_t Prepare(const RegExp& regexp, ASSERT(regexp.num_registers(is_one_byte) != -1); return regexp.num_registers(is_one_byte) + - (Smi::Value(regexp.num_bracket_expressions()) + 1) * 2; + (regexp.num_bracket_expressions() + 1) * 2; } static IrregexpInterpreter::IrregexpResult ExecRaw(const RegExp& regexp, @@ -478,12 +478,9 @@ static IrregexpInterpreter::IrregexpResult ExecRaw(const RegExp& regexp, bool is_one_byte = subject.IsOneByteString() || subject.IsExternalOneByteString(); - ASSERT(regexp.num_bracket_expressions() != Smi::null()); - // We must have done EnsureCompiledIrregexp, so we can get the number of // registers. - int number_of_capture_registers = - (Smi::Value(regexp.num_bracket_expressions()) + 1) * 2; + int number_of_capture_registers = (regexp.num_bracket_expressions() + 1) * 2; int32_t* raw_output = &output[number_of_capture_registers]; // We do not touch the actual capture result registers until we know there @@ -533,7 +530,7 @@ InstancePtr BytecodeRegExpMacroAssembler::Interpret(const RegExp& regexp, required_registers, zone); if (result == IrregexpInterpreter::RE_SUCCESS) { - intptr_t capture_count = Smi::Value(regexp.num_bracket_expressions()); + intptr_t capture_count = regexp.num_bracket_expressions(); intptr_t capture_register_count = (capture_count + 1) * 2; ASSERT(required_registers >= capture_register_count); diff --git a/runtime/vm/tagged_pointer.h b/runtime/vm/tagged_pointer.h index 8c11bf8d61b..b0cb20d0539 100644 --- a/runtime/vm/tagged_pointer.h +++ b/runtime/vm/tagged_pointer.h @@ -191,9 +191,13 @@ class ObjectPtr { ObjectPtr Decompress(uword heap_base) const { return *this; } ObjectPtr DecompressSmi() const { return *this; } uword heap_base() const { + // TODO(rmacnak): Why does Windows have trouble linking GetClassId used + // here? +#if !defined(HOST_OS_WINDOWS) ASSERT(IsHeapObject()); ASSERT(!IsInstructions()); ASSERT(!IsInstructionsSection()); +#endif return tagged_pointer_ & kHeapBaseMask; } diff --git a/runtime/vm/visitor.h b/runtime/vm/visitor.h index 83654187b8d..fd2a78c4b69 100644 --- a/runtime/vm/visitor.h +++ b/runtime/vm/visitor.h @@ -28,9 +28,9 @@ class ObjectPointerVisitor { // // Range of pointers to visit 'first' <= pointer <= 'last'. virtual void VisitTypedDataViewPointers(TypedDataViewPtr view, - ObjectPtr* first, - ObjectPtr* last) { - VisitPointers(first, last); + CompressedObjectPtr* first, + CompressedObjectPtr* last) { + VisitCompressedPointers(view->heap_base(), first, last); } // Range of pointers to visit 'first' <= pointer <= 'last'.