Skip to content

cgen: optimise the generated code for returning literal values and option/result values#22622

Merged
spytheman merged 3 commits intovlang:masterfrom
felipensp:opt_tail_call
Oct 23, 2024
Merged

cgen: optimise the generated code for returning literal values and option/result values#22622
spytheman merged 3 commits intovlang:masterfrom
felipensp:opt_tail_call

Conversation

@felipensp
Copy link
Copy Markdown
Member

@felipensp felipensp commented Oct 22, 2024

This PR improves the code generated by not using stack to alloc option struct to its immediate return and by returning literal values directly.

image

image

image

image

Huly®: V_0.6-21071

@felipensp felipensp changed the title cgen: tail call optimization option fn cgen: tail call optimization option/result fn Oct 22, 2024
@felipensp felipensp changed the title cgen: tail call optimization option/result fn cgen: tail call optimization option/result fn and literal values Oct 22, 2024
@felipensp felipensp changed the title cgen: tail call optimization option/result fn and literal values cgen: tail call optimization option/result fn and direct return for literal values Oct 22, 2024
@spytheman spytheman changed the title cgen: tail call optimization option/result fn and direct return for literal values cgen: optimise the generated code for returning literal values and option/result values Oct 22, 2024
@spytheman
Copy link
Copy Markdown
Contributor

Would that interfere with -autofree ?

@felipensp
Copy link
Copy Markdown
Member Author

Would that interfere with -autofree ?

Currently autofree already have not been take account on this returning part.

@felipensp felipensp marked this pull request as ready for review October 22, 2024 21:26
Copy link
Copy Markdown
Contributor

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit 4a2210f into vlang:master Oct 23, 2024
@felipensp felipensp deleted the opt_tail_call branch November 19, 2024 11:49
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