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

Feature/newhash #3829

Merged
merged 15 commits into from Aug 20, 2022
Merged

Feature/newhash #3829

merged 15 commits into from Aug 20, 2022

Conversation

jimidle
Copy link
Collaborator

@jimidle jimidle commented Aug 20, 2022

fix: #3718 Rework of all Hash() and Equals() methods, and replace broken collections with generics

  • Implement new collections using generics that implement the functionality
       required by the Java runtime in a more idiomatic Go way.
  • Fix Hash() and Equals() for all objects in the runtime
  • Fix getConflictingAlts so that it behaves the same way as Java, using a
       new generic collection
  • Replaces the use of the array2DHashSet, which was causing unneeded memory
       allocations. Replaced with generic collection that allocates minimally
       (though, I think I can improve on that with a little analysis).

This PR fixes quite a few hidden bugs that were only exposed after replacing the various
implementations of collections with the new generic implementations.

Jim Idle - jimi@idle.ws

Signed-off-by: Jim.Idle jimi@gatherstars.com

Jim.Idle and others added 14 commits August 13, 2022 18:20
  o Implement collections with generics to solve hash collisions
  o Fix type casting in LL start parser simulation optimization
  o General minor tidy ups

Acknowledgements to @kaby76 for help with tracing errors

Signed-off-by: Jim.Idle <jimi@gatherstars.com>
Signed-off-by: Jim.Idle <jimi@gatherstars.com>
Signed-off-by: Jim.Idle <jimi@gatherstars.com>
With older versions of go, there was no good way to tell the compiler to use your local
development copy of a particular package instead of the one installed in GOPATH/src/...

However, we are now using modules, which allows us to tell the compiler that instead of
a module downloaded to GOPATH/pkg, to use a local copy on disk.

Hence this change removes the need to copy the whole of the go installation to a
tempoorary location, then put the antlr go runtime in to the go installation as if it was
part of the compiler. Hence the execution time for the go tests is now faster than before.

This works because when the generated code is placed in the temporary location, we create
a go.mod file for it, tell the module to replace the online module for the go runtime with
the local copy on disk, then ro a go mod tidy to add the dependencies from the code (which
avoids network access, so it is instant), which adds the ANTLR dependency itself (which is
then replaced at compile time).

All go runtime tests now pass.

Signed-off-by: Jim.Idle <jimi@gatherstars.com>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
cpp builds using actions/ccache.

Builds are more reliable (avoids the archive.apache server which
intermittently reports timeouts) and also significantly improves the
overall builds times (down from 46 mins to 28 mins).

The slowest part of the build now is the Windows+cpp builds because
there is no reliable cache implementation yet. MacOS+cpp (65% cache hit) is
also relatively slow compared to Ubuntu+cpp (99% cache hit).

Signed-off-by: HS <hs@apotell.com>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
Signed-off-by: Terence Parr <parrt@antlr.org>
…llections

 - Implement new collections using generics that implement the functionality
   required by the Java runtime in a more idiomatic Go way.
 - Fix Hash() and Equals() for all objects in the runtime
 - Fix getConflictingAlts so that it behaves the same way as Java, using a
   new generic collection
 - Replaces the use of the array2DHashSet, which was causing unneeded memory
   allocations. Replaced with generic collection that allocates minimally
   (though, I think I can improve on that with a little analysis).

Jim Idle - jimi@idle.ws

Signed-off-by: Jim.Idle <jimi@gatherstars.com>
@jimidle
Copy link
Collaborator Author

jimidle commented Aug 20, 2022

I am not sure why there were merge conflicts from dev. I resolved them, but I guess my rebase and the original merge didn't quite work. Anyway, I will lose this branch once you merge it in to dev, and start with a new feature branch for a few improvements I have in mind.

Signed-off-by: Jim.Idle <jimi@gatherstars.com>
@parrt parrt added this to the 4.10.2 milestone Aug 20, 2022
@parrt parrt merged commit 36e5469 into antlr:dev Aug 20, 2022
@jimidle jimidle deleted the feature/newhash branch August 21, 2022 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants