Skip to content

Commit

Permalink
Fix potitial defact
Browse files Browse the repository at this point in the history
Force ByteCodeBlock* pointer in calling function routine.
Some compiler don't keep pointer of ByteCodeBlock* in stack when calling function
If don't keep the pointer, we can lose the ByteCodeBlock while GC

Signed-off-by: Seonghyun Kim <[email protected]>
  • Loading branch information
ksh8281 committed Jan 29, 2024
1 parent ca59f64 commit 322ea2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/runtime/FunctionObjectInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class FunctionObjectProcessCallGenerator {
}

ByteCodeBlock* blk = codeBlock->byteCodeBlock();
volatile ByteCodeBlock* rootedBlk = blk;
Context* ctx = codeBlock->context();
bool isStrict = codeBlock->isStrict();
const size_t registerFileSize = blk->m_requiredTotalRegisterNumber;
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/ScriptSimpleFunctionObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ScriptSimpleFunctionObject : public ScriptFunctionObject {
}

ByteCodeBlock* blk = codeBlock->byteCodeBlock();
volatile ByteCodeBlock* rootedBlk = blk;
Context* ctx = codeBlock->context();
const size_t registerSize = blk->m_requiredOperandRegisterNumber;
const size_t programStart = reinterpret_cast<const size_t>(blk->m_code.data());
Expand Down Expand Up @@ -132,6 +133,7 @@ class ScriptSimpleFunctionObject : public ScriptFunctionObject {
}

ByteCodeBlock* blk = codeBlock->byteCodeBlock();
volatile ByteCodeBlock* rootedBlk = blk;
Context* ctx = codeBlock->context();
const size_t registerSize = blk->m_requiredOperandRegisterNumber;

Expand Down

0 comments on commit 322ea2a

Please sign in to comment.