-
Notifications
You must be signed in to change notification settings - Fork 624
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
add wasm_runtime_get_cur_local_obj_ref API support and change wasm runtime APIs name. #3117
Conversation
69e09c1
to
e6be5df
Compare
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
e6be5df
to
9bef844
Compare
9bef844
to
3cbed27
Compare
Signed-off-by: zhangliangyu3 <zhangliangyu3@xiaomi.com>
3cbed27
to
858609f
Compare
4459f4a
to
2e03bc7
Compare
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 <zhangliangyu3@xiaomi.com>
2e03bc7
to
98f2472
Compare
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.