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

Combine automatically generated boolean variables #78

Open
n1kPLV opened this issue Jan 14, 2023 · 1 comment
Open

Combine automatically generated boolean variables #78

n1kPLV opened this issue Jan 14, 2023 · 1 comment

Comments

@n1kPLV
Copy link

n1kPLV commented Jan 14, 2023

The Netlist-based Compilation will generate excessive amounts of boolean variables with names like _g119 or _cg105. In generated Java code, each of these variables is declared a public boolean. While the amount of memory occupied by a public boolean variable is jvm specific, I doubt that many implementations will actually use less than one byte per boolean. As there are platforms with strict limits on the number of permitted fields (like the NXJ/leJOS platform) it might be sensible to try to combine these booleans for example into one java.util.BitSet.

Some of these generated fields may actually be redundant. (As in: are set to the same value a few codelines apart in which the value is not mutated and the values are not mutated at all.) These fields could probably be removed entirely without changing the program execution.

@a-sr
Copy link
Member

a-sr commented Jan 16, 2023

That is a good suggestion.
The NXTs are always a bit problematic due to their variable limitation but you are right there is optimization potential in the code generation.

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

No branches or pull requests

2 participants