-
Notifications
You must be signed in to change notification settings - Fork 716
add wasm_runtime_get_cur_local_obj_ref API support and change wasm runtime APIs name. #3117
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
add wasm_runtime_get_cur_local_obj_ref API support and change wasm runtime APIs name. #3117
Conversation
core/iwasm/common/gc/gc_common.c
Outdated
@@ -892,6 +892,15 @@ wasm_runtime_pop_local_object_refs(WASMExecEnv *exec_env, uint32 n) | |||
} while (--n > 0); | |||
} | |||
|
|||
WASMLocalObjectRef * | |||
wasm_runtime_get_current_local_object_ref(WASMExecEnv *exec_env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current
in function name seems unnecessary. How about rename it as wasm_runtime_get_local_object_ref
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And do you want to get non-first ref?
e.g.
wasm_runtime_get_local_object_ref(exec_env, 0);
wasm_runtime_get_local_object_ref(exec_env, 1);
wasm_runtime_get_local_object_ref(exec_env, 2);
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasm_runtime_get_local_object_ref
the name is ok. I just need to get the current ref, as I continue to push into ref, when I need to pop, I can continue to move the pointer until it is consistent with the current pointer I obtained before, which means that I have popped all the obj that I pushed before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage of this is that you only need to move the pointer and do not need to record how many objs were pushed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is OK to me. BTW, should we shorten the function names, like:
wasm_runtime_push_local_obj_ref
wasm_runtime_pop_local_obj_ref
wasm_runtime_pop_local_obj_refs
wasm_runtime_get_cur_local_obj_ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is OK to me. BTW, should we shorten the function names, like:
wasm_runtime_push_local_obj_ref wasm_runtime_pop_local_obj_ref wasm_runtime_pop_local_obj_refs wasm_runtime_get_cur_local_obj_ref
These names seems better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LevelCA could you also change wasm_runtime_push_local_object_ref/wasm_runtime_pop_local_object_ref/wasm_runtime_pop_local_object_refs to wasm_runtime_push_local_obj_ref/wasm_runtime_pop_local_obj_ref/wasm_runtime_pop_local_obj_refs, and the related codes in core/iwasm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wenyongh e. it's my fault. All have been modified. thks
Signed-off-by: zhangliangyu3 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor comment
core/iwasm/include/gc_export.h
Outdated
wasm_runtime_pop_local_obj_refs(wasm_exec_env_t exec_env, uint32_t n); | ||
|
||
/** | ||
* get current local object ref from stack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change to Get
as it is upper case in other places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aha, OK, done!
…and. Signed-off-by: zhangliangyu3 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.