Skip to content

Commit

Permalink
ByteCodeBlock of top CodeBlock should not be removed from VMInstance
Browse files Browse the repository at this point in the history
* If there is GC jobs from Script init to Script execution, the ByteCode can be remove by ByteCode prunning. this is wrong

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
  • Loading branch information
ksh8281 authored and clover2123 committed Sep 10, 2024
1 parent 6a0087c commit 55d3c17
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/runtime/VMInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ void vmMarkStartCallback(void* data)

auto& v = self->compiledByteCodeBlocks();
for (size_t i = 0; i < v.size(); i++) {
v[i]->m_codeBlock->setByteCodeBlock(nullptr);
// ByteCodeBlock of top CodeBlock should be remove by Script class
if (v[i]->m_codeBlock->parent()) {
v[i]->m_codeBlock->setByteCodeBlock(nullptr);
}
}
}
#endif
Expand Down Expand Up @@ -245,8 +248,10 @@ void vmReclaimEndCallback(void* data)
currentCodeSizeTotal = 0;
auto& v = self->compiledByteCodeBlocks();
for (size_t i = 0; i < v.size(); i++) {
v[i]->m_codeBlock->setByteCodeBlock(v[i]);
ASSERT(v[i]->m_codeBlock->byteCodeBlock() == v[i]);
if (v[i]->m_codeBlock->parent()) {
v[i]->m_codeBlock->setByteCodeBlock(v[i]);
ASSERT(v[i]->m_codeBlock->byteCodeBlock() == v[i]);
}

currentCodeSizeTotal += v[i]->memoryAllocatedSize();
}
Expand Down

0 comments on commit 55d3c17

Please sign in to comment.