From 1e17f763dd1f34d0f99c14eb403d0eedd6e27452 Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Mon, 12 Aug 2024 10:17:59 +0100 Subject: [PATCH] Avoid nil-ing out VMArrays twice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s done in VMObject already Signed-off-by: Stefan Marr --- src/vmobjects/VMArray.cpp | 8 -------- src/vmobjects/VMArray.h | 7 ++++++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/vmobjects/VMArray.cpp b/src/vmobjects/VMArray.cpp index 210eede8..b94c7cd3 100644 --- a/src/vmobjects/VMArray.cpp +++ b/src/vmobjects/VMArray.cpp @@ -40,14 +40,6 @@ const size_t VMArray::VMArrayNumberOfFields = 0; -VMArray::VMArray(size_t arraySize, size_t additionalBytes) - : VMObject( - arraySize + 0 /* VMArray is not allowed to have any fields itself */, - additionalBytes + sizeof(VMArray)) { - assert(VMArrayNumberOfFields == 0); - nilInitializeFields(); -} - VMArray* VMArray::Copy() const { VMArray* copy = Universe::NewArray(GetNumberOfIndexableFields()); diff --git a/src/vmobjects/VMArray.h b/src/vmobjects/VMArray.h index 1467e95f..37f08121 100644 --- a/src/vmobjects/VMArray.h +++ b/src/vmobjects/VMArray.h @@ -39,7 +39,12 @@ class VMArray : public VMObject { public: typedef GCArray Stored; - explicit VMArray(size_t arraySize, size_t additionalBytes); + explicit VMArray(size_t arraySize, size_t additionalBytes) + : VMObject(arraySize + + 0 /* VMArray is not allowed to have any fields itself */, + additionalBytes + sizeof(VMArray)) { + assert(VMArrayNumberOfFields == 0); + } // VMArray doesn't need to customize `void WalkObjects(walk_heap_fn)`, // because it doesn't need anything special.