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

Allow values that aren't exactly 8 bytes #147

Open
iafisher opened this issue Aug 28, 2022 · 0 comments
Open

Allow values that aren't exactly 8 bytes #147

iafisher opened this issue Aug 28, 2022 · 0 comments
Labels
internal Issues which do not affect end users suggestion Suggested change

Comments

@iafisher
Copy link
Owner

Right now the code generator does everything with 8-byte registers and stack locations. This is inefficient in a couple of ways:

  • For values that fit in fewer bytes, like booleans, it wastes a lot of space.
  • Values that are larger than 8 bytes must be heap-allocated even if they are small enough to fit comfortably on the stack, e.g. strings which have an 8 byte length and an 8 byte pointer. This requires both an extra heap allocation (on top of the necessary allocation for the actual string data) and an extra layer of indirection whenever the value is used.

On the other hand, storing everything as 8 bytes makes both the code generator and the runtime library simpler (the latter mainly because it's easier to implement a generic list in C if every value has the same type).

@iafisher iafisher added internal Issues which do not affect end users suggestion Suggested change labels Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issues which do not affect end users suggestion Suggested change
Projects
None yet
Development

No branches or pull requests

1 participant