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

Fix bugs in name mangling #1816

Merged
merged 19 commits into from
Jun 5, 2023
Merged

Conversation

petervdonovan
Copy link
Collaborator

@petervdonovan petervdonovan commented Jun 4, 2023

The assignment of mangled names is too complex when compiling several distinct programs in the same JAR execution because it causes the different programs to interact with each other by changing the number of reactors that have the same name. We can patch this up (by parameterizing the uniqueName function by the current FileConfig, for example), but it is safer and easier to just eliminate the global variables. It will make the generated code uglier, but maybe life is too short to worry about that.

This PR fixes the assignment of unique names mechanism so that it does not use global variables, which could result in interactions between multiple distinct compilation processes that affect the names used in generated code. This ensures that if one compilation only uses one reactor class with a certain name, then no numbers will be appended to the reactor class's name. It also appends the concrete types used to the reactor class's name, which may be useful for debugging.

The order in which reactor classes with the same name are numbered is based on the alphabetical ordering of the string representations of their URIs. Since different reactor classes with the same name cannot appear in the same file, I believe that this should work properly.

Here are some examples of unique names produced by the method implemented in this PR:

_superlong_double_char_int_float
_modal
_modal1

@petervdonovan petervdonovan changed the title Make name mangling stateless again. Make name mangling stateless again Jun 4, 2023
@petervdonovan petervdonovan added the exclude Exclude from change log label Jun 4, 2023
The assignment of mangled names is too complex when compiling several
distinct programs in the same JAR execution because it causes them to
interact with each other by changing the number of reactors that have
the same name. We can patch this up, but it is safer and easier to just
eliminate the global variables. It will make the generated code uglier,
but maybe life is too short to worry about that.
@petervdonovan petervdonovan force-pushed the make-name-mangling-stateless branch from cd4b98b to c3e69e1 Compare June 4, 2023 01:38
@petervdonovan petervdonovan changed the title Make name mangling stateless again Fix bugs in name mangling Jun 4, 2023
@petervdonovan petervdonovan marked this pull request as draft June 4, 2023 04:21
I do not want to stop running tests when one category fails. I would
also like to experiment with increasing the amount of parallelism.
@petervdonovan petervdonovan force-pushed the make-name-mangling-stateless branch 2 times, most recently from 4514374 to 091f995 Compare June 4, 2023 21:25
@petervdonovan petervdonovan force-pushed the make-name-mangling-stateless branch from 091f995 to 79fe178 Compare June 4, 2023 21:26
@petervdonovan petervdonovan marked this pull request as ready for review June 4, 2023 22:37
@petervdonovan
Copy link
Collaborator Author

This PR includes some changes in CI that were necessary in order to make CI output more useful. I can move them into a separate PR if needed, but this is not a big PR anyway so maybe it is OK. Note that there is a commit cherry-picked between this and #1814.

@lhstrh
Copy link
Member

lhstrh commented Jun 4, 2023

This PR includes some changes in CI that were necessary in order to make CI output more useful. I can move them into a separate PR if needed, but this is not a big PR anyway so maybe it is OK. Note that there is a commit cherry-picked between this and #1814.

I'm not sure I agree those CI changes are a good idea. What motives them?

@petervdonovan
Copy link
Collaborator Author

  • Currently the tests stop running when one test category fails. This prevents CI from uncovering all of the errors that it could uncover.
  • Often I find that I am the only person submitting tasks to the GH actions queue. Therefore, it is in fact useful to increase the amount of parallelism in the workflow. With this change, many of the test categories which might fail complete their tests within 3 minutes.
  • It is easy to find which test categories are failing by just looking at the list of jobs (on the left). Otherwise, you have to search the log, the interface to which is quite laggy.

@petervdonovan
Copy link
Collaborator Author

I realize that if we want these changes, we would need to update the "required jobs" in the repo settings, which can be done.

@petervdonovan
Copy link
Collaborator Author

The CI changes are too controversial and do not belong in this PR, so I reverted them. @lhstrh, I think we should merge this soon so that master does not continue to be broken.

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

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

This generally looks good and I agree we should merge it. Please add the missing JavaDoc and this should be ready to to go...

Copy link
Member

Choose a reason for hiding this comment

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

This file has some undocumented methods.

@petervdonovan petervdonovan enabled auto-merge June 5, 2023 16:58
The intent is to reduce confusion with the language feature "generics."
Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

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

LGTM!

@petervdonovan
Copy link
Collaborator Author

There is something wacky happening in the Rust tests. The test framework is throwing an NPE and I am not sure why.

@petervdonovan petervdonovan disabled auto-merge June 5, 2023 17:54
@petervdonovan petervdonovan force-pushed the make-name-mangling-stateless branch from 3ecf820 to cae0d1e Compare June 5, 2023 18:16
@petervdonovan
Copy link
Collaborator Author

OK, fixed. The problem was that there already was a test for generics, but it was called runTypeParameterTests.

@petervdonovan petervdonovan enabled auto-merge June 5, 2023 18:30
@petervdonovan petervdonovan merged commit 6e1e6b8 into master Jun 5, 2023
@cmnrd cmnrd deleted the make-name-mangling-stateless branch June 8, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude Exclude from change log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants