diff --git a/lib/fizzy/parser_expr.cpp b/lib/fizzy/parser_expr.cpp index a7a50798d5..dd8c25f1f1 100644 --- a/lib/fizzy/parser_expr.cpp +++ b/lib/fizzy/parser_expr.cpp @@ -20,7 +20,7 @@ inline void store(uint8_t* dst, T value) noexcept } template -inline void push(std::vector& b, T value) +inline void push(bytes& b, T value) { uint8_t storage[sizeof(T)]; store(storage, value); @@ -198,8 +198,7 @@ inline void update_branch_stack(const ControlFrame& current_frame, const Control drop_operand(current_frame, operand_stack, from_valtype(*branch_frame_type)); } -void push_branch_immediates( - const ControlFrame& branch_frame, int stack_height, std::vector& instructions) +void push_branch_immediates(const ControlFrame& branch_frame, int stack_height, bytes& instructions) { // How many stack items to drop when taking the branch. const auto stack_drop = stack_height - branch_frame.parent_stack_height; @@ -872,7 +871,7 @@ parser_result parse_expr(const uint8_t* pos, const uint8_t* end, FuncIdx f break; } } - code.instructions.emplace_back(opcode); + code.instructions.push_back(opcode); } assert(control_stack.empty()); return {code, pos}; diff --git a/lib/fizzy/types.hpp b/lib/fizzy/types.hpp index 4485754142..bb25b6d5cd 100644 --- a/lib/fizzy/types.hpp +++ b/lib/fizzy/types.hpp @@ -362,7 +362,7 @@ struct Code // The instructions bytecode without immediate values. // https://webassembly.github.io/spec/core/binary/instructions.html - std::vector instructions; + bytes instructions; }; /// The reference to the `code` in the wasm binary. diff --git a/test/unittests/execute_death_test.cpp b/test/unittests/execute_death_test.cpp index 51539671bd..16b8bb6669 100644 --- a/test/unittests/execute_death_test.cpp +++ b/test/unittests/execute_death_test.cpp @@ -14,8 +14,8 @@ TEST(execute_death, malformed_instruction_opcode) constexpr uint8_t malformed_opcode = 6; Code code; - code.instructions.emplace_back(malformed_opcode); - code.instructions.emplace_back(static_cast(Instr::end)); + code.instructions.push_back(malformed_opcode); + code.instructions.push_back(static_cast(Instr::end)); auto module = std::make_unique(); module->typesec.emplace_back(FuncType{});