[vm] Fix gcc build.

TEST=local build
Change-Id: Ia4c28bda4b353e9f353ddbbf854df085adf831c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175562
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2020-12-10 20:10:07 +00:00
committed by commit-bot@chromium.org
parent fc80294c89
commit e2b88eea95
2 changed files with 32 additions and 41 deletions
+32 -34
View File
@@ -568,6 +568,38 @@ class ObjectLayout {
}
}
template <typename type, std::memory_order order = std::memory_order_relaxed>
void StoreArrayPointer(type const* addr, type value) {
reinterpret_cast<std::atomic<type>*>(const_cast<type*>(addr))
->store(value, order);
if (value->IsHeapObject()) {
CheckArrayPointerStore(addr, value, Thread::Current());
}
}
template <typename type>
void StoreArrayPointer(type const* addr, type value, Thread* thread) {
*const_cast<type*>(addr) = value;
if (value->IsHeapObject()) {
CheckArrayPointerStore(addr, value, thread);
}
}
template <typename type, std::memory_order order = std::memory_order_relaxed>
type LoadSmi(type const* addr) const {
return reinterpret_cast<std::atomic<type>*>(const_cast<type*>(addr))
->load(order);
}
// Use for storing into an explicitly Smi-typed field of an object
// (i.e., both the previous and new value are Smis).
template <std::memory_order order = std::memory_order_relaxed>
void StoreSmi(SmiPtr const* addr, SmiPtr value) {
// Can't use Contains, as array length is initialized through this method.
ASSERT(reinterpret_cast<uword>(addr) >= ObjectLayout::ToAddr(this));
reinterpret_cast<std::atomic<SmiPtr>*>(const_cast<SmiPtr*>(addr))
->store(value, order);
}
private:
DART_FORCE_INLINE
void CheckHeapPointerStore(ObjectPtr value, Thread* thread) {
@@ -597,23 +629,6 @@ class ObjectLayout {
}
}
template <typename type, std::memory_order order = std::memory_order_relaxed>
void StoreArrayPointer(type const* addr, type value) {
reinterpret_cast<std::atomic<type>*>(const_cast<type*>(addr))
->store(value, order);
if (value->IsHeapObject()) {
CheckArrayPointerStore(addr, value, Thread::Current());
}
}
template <typename type>
void StoreArrayPointer(type const* addr, type value, Thread* thread) {
*const_cast<type*>(addr) = value;
if (value->IsHeapObject()) {
CheckArrayPointerStore(addr, value, thread);
}
}
template <typename type>
DART_FORCE_INLINE void CheckArrayPointerStore(type const* addr,
ObjectPtr value,
@@ -650,26 +665,9 @@ class ObjectLayout {
}
}
protected:
template <typename type, std::memory_order order = std::memory_order_relaxed>
type LoadSmi(type const* addr) const {
return reinterpret_cast<std::atomic<type>*>(const_cast<type*>(addr))
->load(order);
}
// Use for storing into an explicitly Smi-typed field of an object
// (i.e., both the previous and new value are Smis).
template <std::memory_order order = std::memory_order_relaxed>
void StoreSmi(SmiPtr const* addr, SmiPtr value) {
// Can't use Contains, as array length is initialized through this method.
ASSERT(reinterpret_cast<uword>(addr) >= ObjectLayout::ToAddr(this));
reinterpret_cast<std::atomic<SmiPtr>*>(const_cast<SmiPtr*>(addr))
->store(value, order);
}
friend class StoreBufferUpdateVisitor; // RememberCard
void RememberCard(ObjectPtr const* slot);
private:
friend class Array;
friend class ByteBuffer;
friend class CidRewriteVisitor;
-7
View File
@@ -634,13 +634,6 @@ void SourceReport::CollectConstConstructorCoverageFromScripts(
// Now output the wanted constant coverage.
for (intptr_t i = 0; i < local_script_table_entries->length(); i++) {
const Script* script = local_script_table_entries->At(i)->script;
bool script_ok = true;
if (script_ != NULL && !script_->IsNull()) {
if (script->raw() != script_->raw()) {
// This is the wrong script.
script_ok = false;
}
}
// Whether we want *this* script or not we need to look at the constant
// constructor coverage. Any of those could be in a script we *do* want.