Skip to content

Conversation

@qmuntal
Copy link
Contributor

@qmuntal qmuntal commented Dec 17, 2025

What issue is this addressing?

Updates #343

What type of issue is this addressing?

Refactor

What this PR does | solves

A function called using a JMP instruction doesn't return to the instruction that follows the JMP, but to the JMP parent frame. This means that there is no need to follow that instruction with a RET, it will not be reached. Also, the Go assembler is smart enough to not add function frame when the function doesn't contain CALL instructions, so we don't need to mark them as NOFRAME.

Copy link
Collaborator

@TotallyGamerJet TotallyGamerJet left a comment

Choose a reason for hiding this comment

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

I'm okay with removing the RETs but I think keeping the NOFRAME is helpful since without it you need intimate knowledge of Go's assembler to know there is no frame added. I for sure didn't know that

@qmuntal
Copy link
Contributor Author

qmuntal commented Dec 17, 2025

I have a personal crusade against NOFRAME, as it breaks stack unwinding. The NOFRAMEs in here are no-op, so they don't hurt, but I'm sure someone will copy this code for other purposes and will carry over the NOFRAME, because why not?

Anyway, I also see your point. Will add the NOFRAME back.

Copy link
Collaborator

@TotallyGamerJet TotallyGamerJet left a comment

Choose a reason for hiding this comment

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

LGTM

@hajimehoshi hajimehoshi merged commit 58d7177 into ebitengine:main Dec 17, 2025
41 checks passed
@qmuntal qmuntal deleted the noret branch December 17, 2025 14:28
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