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

add wasm_runtime_get_cur_local_obj_ref API support and change wasm runtime APIs name. #3117

Merged
merged 2 commits into from
Feb 4, 2024

Conversation

LevelCA
Copy link
Contributor

@LevelCA LevelCA commented Feb 2, 2024

No description provided.

@LevelCA LevelCA force-pushed the dev/gc_refactor branch 2 times, most recently from 69e09c1 to e6be5df Compare February 2, 2024 08:48
@@ -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)
Copy link
Collaborator

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?

Copy link
Collaborator

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);
...

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

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

@xujuntwt95329

Copy link
Collaborator

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

@xujuntwt95329

These names seems better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, thanks, done

Copy link
Contributor

@wenyongh wenyongh Feb 4, 2024

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?

Copy link
Contributor Author

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

@LevelCA LevelCA changed the title add wasm_runtime_get_current_local_object_ref API support. add wasm_runtime_get_cur_local_object_ref API support. Feb 2, 2024
Signed-off-by: zhangliangyu3 <zhangliangyu3@xiaomi.com>
@LevelCA LevelCA changed the title add wasm_runtime_get_cur_local_object_ref API support. add wasm_runtime_get_cur_local_obj_ref API support. Feb 4, 2024
@LevelCA LevelCA changed the title add wasm_runtime_get_cur_local_obj_ref API support. add wasm_runtime_get_cur_local_obj_ref API support and change wasm runtime APIs name. Feb 4, 2024
Copy link
Contributor

@wenyongh wenyongh left a 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

wasm_runtime_pop_local_obj_refs(wasm_exec_env_t exec_env, uint32_t n);

/**
* get current local object ref from stack
Copy link
Contributor

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?

Copy link
Contributor Author

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>
Copy link
Collaborator

@xujuntwt95329 xujuntwt95329 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 dcde455 into bytecodealliance:dev/gc_refactor Feb 4, 2024
416 checks passed
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.

3 participants