Skip to content

Commit 3fcc8c1

Browse files
committed
fix: improve comments and logging in branch hint handling
1 parent f31e5d3 commit 3fcc8c1

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

core/iwasm/interpreter/wasm_loader.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5623,7 +5623,8 @@ handle_branch_hint_section(const uint8 *buf, const uint8 *buf_end,
56235623
uint32 num_hints;
56245624
read_leb_uint32(buf, buf_end, num_hints);
56255625

5626-
/* Ensure that num_hints doesn't exceed the actual number of branch instructions */
5626+
/* Ensure that num_hints doesn't exceed the actual number of branch
5627+
* instructions */
56275628
WASMFunction *func =
56285629
module->functions[func_idx - module->import_function_count];
56295630
uint32 max_branch_instructions =
@@ -5650,10 +5651,11 @@ handle_branch_hint_section(const uint8 *buf, const uint8 *buf_end,
56505651

56515652
/* Validate offset is within the function's code bounds */
56525653
if (new_hint->offset >= func->code_size) {
5653-
set_error_buf_v(error_buf, error_buf_size,
5654-
"invalid branch hint offset: %u exceeds function "
5655-
"code size %u",
5656-
new_hint->offset, func->code_size);
5654+
set_error_buf_v(
5655+
error_buf, error_buf_size,
5656+
"invalid branch hint offset: %u exceeds function "
5657+
"code size %u",
5658+
new_hint->offset, func->code_size);
56575659
goto fail;
56585660
}
56595661

@@ -5761,7 +5763,7 @@ load_user_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
57615763
#else
57625764
if (name_len == 25
57635765
&& memcmp((const char *)p, "metadata.code.branch_hint", 25) == 0) {
5764-
LOG_VERBOSE("Found branch hint section, but branch hints are disabled "
5766+
LOG_WARNING("Found branch hint section, but branch hints are disabled "
57655767
"in this build, skipping.");
57665768
}
57675769
#endif

0 commit comments

Comments
 (0)