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

Use only uint32_t to immediates items #376

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/fizzy/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace fizzy
namespace
{
// code_offset + imm_offset + stack_height + arity
constexpr auto BranchImmediateSize = 3 * sizeof(uint32_t) + sizeof(uint8_t);
constexpr auto BranchImmediateSize = 4 * sizeof(uint32_t);

void match_imported_functions(const std::vector<FuncType>& module_imported_types,
const std::vector<ExternalFunction>& imported_functions)
Expand Down Expand Up @@ -249,7 +249,7 @@ void branch(
const auto code_offset = read<uint32_t>(immediates);
const auto imm_offset = read<uint32_t>(immediates);
const auto stack_height = static_cast<size_t>(read<uint32_t>(immediates));
const auto arity = read<uint8_t>(immediates);
const auto arity = read<uint32_t>(immediates);

pc = code.instructions.data() + code_offset;
immediates = code.immediates.data() + imm_offset;
Expand Down
2 changes: 1 addition & 1 deletion lib/fizzy/parser_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void push_branch_immediates(const ControlFrame& frame, bytes& immediates)
push(immediates, static_cast<uint32_t>(frame.code_offset));
push(immediates, static_cast<uint32_t>(frame.immediates_offset));
push(immediates, static_cast<uint32_t>(frame.parent_stack_height));
push(immediates, get_branch_arity(frame));
push(immediates, uint32_t{get_branch_arity(frame)});
}

} // namespace
Expand Down