Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ByteCodeBlock of top CodeBlock should not be removed from VMInstance #1385

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading