Bug 1992130 - Fix arguments types for std::copy. a=pascalc

Differential Revision: https://phabricator.services.mozilla.com/D268882
This commit is contained in:
Yury Delendik
2025-10-21 09:11:39 +00:00
committed by pchevrel@mozilla.com
parent 39315e05a8
commit d4a199cc60

View File

@@ -176,6 +176,13 @@ class WasmArrayObject : public WasmGcObject,
return offsetToPointer<uint8_t>(offsetOfInlineStorage()); return offsetToPointer<uint8_t>(offsetOfInlineStorage());
} }
// Actual array data that follows DataHeader. The array data is a part of the
// `inlineStorage`.
template <typename T>
T* inlineArrayElements() {
return offsetToPointer<T>(offsetOfInlineArrayData());
}
// This tells us how big the object is if we know the number of inline bytes // This tells us how big the object is if we know the number of inline bytes
// it was created with. // it was created with.
static inline constexpr size_t sizeOfIncludingInlineStorage( static inline constexpr size_t sizeOfIncludingInlineStorage(
@@ -537,9 +544,8 @@ class MOZ_RAII StableWasmArrayObjectElements {
// elements. // elements.
MOZ_CRASH(); MOZ_CRASH();
} }
std::copy(array->inlineStorage(), const T* src = array->inlineArrayElements<T>();
array->inlineStorage() + array->numElements_ * sizeof(T), std::copy(src, src + array->numElements_, ownElements_->begin());
ownElements_->begin());
elements_ = ownElements_->begin(); elements_ = ownElements_->begin();
} else { } else {
elements_ = reinterpret_cast<T*>(array->data_); elements_ = reinterpret_cast<T*>(array->data_);