Skip to content

Commit

Permalink
Fixed off by one error in mark
Browse files Browse the repository at this point in the history
  • Loading branch information
JothamWong committed Apr 15, 2024
1 parent 27b0203 commit 0984cc4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/vm/oogavm-heap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1186,17 +1186,20 @@ function mark(addr) {
case Tag.STRUCT:
const numChildren = getSize(addr) - headerSize;
for (let i = 0; i < numChildren; i++) {
mark(getWord(addr + i + 1));
// no size variable in 3rd word
mark(getWord(addr + i + headerSize));
}
break;
case Tag.UNBUFFERED:
for (let i = 0; i < getUnBufferChannelLength(addr); i++) {
// will only loop once
// 1 for size
mark(getWord(addr + headerSize + 1 + i));
}
break;
case Tag.BUFFERED:
for (let i = 0; i < getBufferChannelLength(addr); i++) {
// 1 for size
mark(getWord(addr + headerSize + 1 + i));
}
break;
Expand Down

0 comments on commit 0984cc4

Please sign in to comment.