Skip to content

Commit 8418df7

Browse files
zherczegksh8281
authored andcommitted
Use a vector with fixed size to store the byte code
Byte code buffers are never over-allocated. Signed-off-by: Zoltan Herczeg [email protected]
1 parent 6df6615 commit 8418df7

File tree

4 files changed

+122
-116
lines changed

4 files changed

+122
-116
lines changed

src/jit/ByteCodeParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ static void compileFunction(JITCompiler* compiler)
544544
{
545545
size_t idx = 0;
546546
ModuleFunction* function = compiler->moduleFunction();
547-
size_t endIdx = function->currentByteCodeSize();
547+
size_t endIdx = function->byteCodeSize();
548548

549549
if (endIdx == 0) {
550550
// If a function has no End opcode, it is an imported function.
@@ -555,7 +555,7 @@ static void compileFunction(JITCompiler* compiler)
555555

556556
// Construct labels first
557557
while (idx < endIdx) {
558-
ByteCode* byteCode = function->peekByteCode<ByteCode>(idx);
558+
ByteCode* byteCode = function->getByteCode<ByteCode>(idx);
559559
ByteCode::Opcode opcode = byteCode->opcode();
560560

561561
switch (opcode) {
@@ -630,7 +630,7 @@ static void compileFunction(JITCompiler* compiler)
630630
}
631631
}
632632

633-
ByteCode* byteCode = function->peekByteCode<ByteCode>(idx);
633+
ByteCode* byteCode = function->getByteCode<ByteCode>(idx);
634634
ByteCode::Opcode opcode = byteCode->opcode();
635635
Instruction::Group group = Instruction::Any;
636636
uint8_t paramType = ParamTypes::NoParam;

0 commit comments

Comments
 (0)