Skip to content

Commit 28575c1

Browse files
lum1n0ussrberard
authored andcommitted
fix: improve comments and logging in branch hint handling
1 parent 2b294fc commit 28575c1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

core/iwasm/interpreter/wasm_loader.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5633,7 +5633,8 @@ handle_branch_hint_section(const uint8 *buf, const uint8 *buf_end,
56335633
uint32 num_hints;
56345634
read_leb_uint32(buf, buf_end, num_hints);
56355635

5636-
/* Ensure that num_hints doesn't exceed the actual number of branch instructions */
5636+
/* Ensure that num_hints doesn't exceed the actual number of branch
5637+
* instructions */
56375638
WASMFunction *func =
56385639
module->functions[func_idx - module->import_function_count];
56395640
uint32 max_branch_instructions =
@@ -5660,10 +5661,11 @@ handle_branch_hint_section(const uint8 *buf, const uint8 *buf_end,
56605661

56615662
/* Validate offset is within the function's code bounds */
56625663
if (new_hint->offset >= func->code_size) {
5663-
set_error_buf_v(error_buf, error_buf_size,
5664-
"invalid branch hint offset: %u exceeds function "
5665-
"code size %u",
5666-
new_hint->offset, func->code_size);
5664+
set_error_buf_v(
5665+
error_buf, error_buf_size,
5666+
"invalid branch hint offset: %u exceeds function "
5667+
"code size %u",
5668+
new_hint->offset, func->code_size);
56675669
goto fail;
56685670
}
56695671

@@ -5771,7 +5773,7 @@ load_user_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
57715773
#else
57725774
if (name_len == 25
57735775
&& memcmp((const char *)p, "metadata.code.branch_hint", 25) == 0) {
5774-
LOG_VERBOSE("Found branch hint section, but branch hints are disabled "
5776+
LOG_WARNING("Found branch hint section, but branch hints are disabled "
57755777
"in this build, skipping.");
57765778
}
57775779
#endif

0 commit comments

Comments
 (0)