Skip to content

Commit

Permalink
Make VMString invalidation more general
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Jul 26, 2024
1 parent 3bcb176 commit 4f7e0e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions src/vmobjects/VMString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,11 @@ void VMString::MarkObjectAsInvalid() {
for (size_t i = 0; i < length; i++) {
chars[i] = 'z';
}
chars = (char*) INVALID_GC_POINTER;
}

bool VMString::IsMarkedInvalid() const {
if (length == 0) {
return false;
}

for (size_t i = 0; i < length; i++) {
if (chars[i] != 'z') {
return false;
}
}
return true;
return chars == (char*) INVALID_GC_POINTER;
}

void VMString::WalkObjects(walk_heap_fn) {
Expand Down
2 changes: 1 addition & 1 deletion src/vmobjects/VMString.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class VMString: public AbstractVMObject {
//this could be replaced by the CHARS macro in VMString.cpp
//in order to decrease the object size
const size_t length;
char* const chars;
char* chars;
protected:
VMString(char* const adaptedCharsPointer, const size_t length) :
// set the chars-pointer to point at the position of the first character
Expand Down

0 comments on commit 4f7e0e4

Please sign in to comment.