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

Structs can now pass into and be returned from functions + Easy struct reassignment #17

Merged
merged 3 commits into from
Nov 20, 2023

Conversation

DerelictDrone
Copy link
Member

Solves part of #4, as this PR doesn't touch array access

Partially adds compiler support for what I'm calling "large variables" for the moment, you can explicit assign a large variable of the same size to another large variable to copy all of its parameters to the left hand, as well, putting large variables as parameters for a function now pushes x number of bytes to the stack

Functions that return large variables will return a pointer to the variable, and assignment to another large variable generates a constant number of mov and inc instructions to fill the large variable on the left hand

Currently "large variables" only encompass structs, but hopefully I've left things flexible enough for future expansion (not that I really know what else to add past this)

See image for working code using struct functions and struct var reassignment w/ outputs
structs

@DerelictDrone
Copy link
Member Author

Going to work on making the default vectors capable of using these features as well if I can, but that'll be a different PR that's partially dependent on this one

@thegrb93 thegrb93 merged commit 95578a1 into wiremod:master Nov 20, 2023
1 check failed
@DerelictDrone DerelictDrone deleted the pass-structs-to-funcs branch November 25, 2023 09:16
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