Skip to content

Commit

Permalink
Avoid nil-ing out VMArrays twice
Browse files Browse the repository at this point in the history
It’s done in VMObject already

Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Aug 12, 2024
1 parent 76da6a0 commit 1e17f76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 0 additions & 8 deletions src/vmobjects/VMArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
7 changes: 6 additions & 1 deletion src/vmobjects/VMArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1e17f76

Please sign in to comment.