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

Fix printing of external reference addresses in wasm_application.c #2774

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

no1wudi
Copy link
Collaborator

@no1wudi no1wudi commented Nov 16, 2023

No description provided.

@@ -613,7 +613,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
u.parts[1] = argv1[k + 1];
k += 2;
if (u.val && u.val != (uintptr_t)-1LL)
os_printf("0x%" PRIxPTR ":ref.extern", (void *)u.val);
os_printf("%p:ref.extern", (void *)u.val);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u.val is uintptr_t. why don't you remove the cast instead?

@@ -600,7 +600,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
{
#if UINTPTR_MAX == UINT32_MAX
if (argv1[k] != 0 && argv1[k] != (uint32)-1)
os_printf("0x%" PRIxPTR ":ref.extern", (void *)argv1[k]);
os_printf("%p:ref.extern", (void *)argv1[k]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc, how %p converts is implementation-defined.
isn't it a problem for repl?

@no1wudi
Copy link
Collaborator Author

no1wudi commented Nov 16, 2023

@yamt In fact I'm fine to cast them to uintptr_t but it's from stdint.h, but other type such as uint32 is defined internally, mix usage of them looks a little strange.

wasm_application.c

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
@no1wudi no1wudi changed the title Refactor print statements to use %p format specifier for pointer Fix printing of external reference addresses in wasm_application.c Nov 16, 2023
@no1wudi no1wudi requested a review from yamt November 16, 2023 06:34
Copy link
Collaborator

@yamt yamt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@wenyongh wenyongh merged commit b929064 into bytecodealliance:main Nov 16, 2023
383 checks passed
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants