Skip to content

fix: remove non-zero check before __visit #2933

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

Conversation

HerrCai0907
Copy link
Member

In the implementation of __visit, we will do non-zero check, so in visitMemberOf, we don't need to emit non-zero check.
Emit them both maybe have some performance benefit (I don't do bench for it), but at least for -Oz target, we should remove it.

export function __visit(ptr: usize, cookie: i32): void {
  if (!ptr) return;
...

@HerrCai0907 HerrCai0907 force-pushed the avoid-meaningless-check-before-visit branch from 51537b4 to 0adf149 Compare July 10, 2025 10:43
Copy link
Member

@CountBleck CountBleck left a comment

Choose a reason for hiding this comment

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

Looks great! How'd you notice this?

@HerrCai0907
Copy link
Member Author

HerrCai0907 commented Jul 11, 2025

I am improving the runtime performance and reviewing generated code line by line. 😅

@HerrCai0907 HerrCai0907 merged commit ef01f2b into AssemblyScript:main Jul 11, 2025
14 checks passed
@HerrCai0907 HerrCai0907 deleted the avoid-meaningless-check-before-visit branch July 11, 2025 02:10
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.

2 participants