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

Name Mangling fixes and centralization #152

Merged
merged 7 commits into from
Jun 7, 2024

Conversation

TheSilkMiner
Copy link
Member

Various changes made to name mangling in order to avoid conflicts with other ZenCode constructs (such as class names or functions).
Moreover, all name mangling has been centralized into a single JavaMangler class to ensure that any changes propagate to all relevant places at once if needed.
Also, a name mangling scheme that is consistent and (somewhat) human-readable has been attempted; due to counter non-determinism this is still not fully achieved, but this should still provide better information than a single ID.

Additionally, every counter has been split into separate counters to allow for higher flexibility. Granted, I don't think anyone will manage to create more than 2 billion lambdas, but now we can have 2 billion lambdas per class, so potentially infinite lambdas. Note that currently lambda generation is still broken with respect to packages, but fixing this is a non-goal for this PR.

This PR also adds some more tests: mangling tests relate to testing that some names are properly mangled to avoid conflicts (they both pass), whereas the capturing_lambda tests both fail due to issues with captures. capturing-lambda-2 is particularly hilarious.

This should provide additional information on which expansion is which,
allowing for easier debugging of scripts when multiple expansions are
involved.

Note that complex types might lead to some ambiguity when reading.

Signed-off-by: TheSilkMiner <[email protected]>
Note: function mangling still isn't supported, so the test will fail

Signed-off-by: TheSilkMiner <[email protected]>
@TheSilkMiner TheSilkMiner force-pushed the feature/refactor-mangling branch from 44396df to ca203fa Compare June 7, 2024 20:23
@kindlich kindlich added enhancement New feature or request bytecode All issues that relate to the generation of Java Bytecode tests Issues that are about creating/fixing test cases or the test runner JavaIntegration All issues that relate to integrating ZenCode with existing Java Code labels Jun 7, 2024
@kindlich kindlich added this to the Refactor milestone Jun 7, 2024
@stanhebben stanhebben merged commit 470b9c9 into feature/refactor Jun 7, 2024
0 of 2 checks passed
@TheSilkMiner TheSilkMiner deleted the feature/refactor-mangling branch June 7, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bytecode All issues that relate to the generation of Java Bytecode enhancement New feature or request JavaIntegration All issues that relate to integrating ZenCode with existing Java Code tests Issues that are about creating/fixing test cases or the test runner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants