-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Calyx-utils] Overhaul GlobalPositionTable
+ a bunch of CI nonsense
#2377
Conversation
…ather than using the one packaged with the docker container
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty elegant!
Couple of small nits, then you can just go ahead and merge it.
.github/workflows/rust.yml
Outdated
rust-toolchain.toml | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: Install Rust stable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it stable rust or the rust version from rust-toolchain.toml?
.github/workflows/rust.yml
Outdated
@@ -226,6 +240,16 @@ jobs: | |||
git checkout -f $GITHUB_SHA | |||
git clean -fd | |||
|
|||
- name: Checkout toolchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't actually checking out the toolchain, tough, correct? Only the toolchain configuration.
@@ -57,16 +57,17 @@ impl CalyxParser { | |||
})?; | |||
// Add a new file to the position table | |||
let string_content = std::str::from_utf8(content)?.to_string(); | |||
let file = GlobalPositionTable::as_mut() | |||
.add_file(path.to_string_lossy().to_string(), string_content); | |||
let file = GlobalPositionTable::add_file( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now! Do you want to merge it or wait for Adrian's review?
I think it's fine to merge probably! |
A quick touch up of the
GlobalPositionTable
to avoid UB without getting too fancy. Main changes are use ofboxcar::Vec
instead of the standard library Vec, so that we can now have lock-free concurrent appends and accesses. This fits our use-case since we never de-allocate files & positions and frees us from all the issues associated with using locks. Since we're not using locks, we also don't need any unsafe to extend lifetimes, and sinceboxcar::Vec
doesn't reallocate stored elements, we don't need to box the stored stuff.I also use
LazyLock
instead oflazy_static!
which is easier to deal with.The end result is a global position table that can be accessed through associated functions on the
GlobalPositionTable
type, rather than methods on an instance. I also changed theString
s stored byFile
toBox<str>
, because we don't ever mutate them.In the process of this, I ran face first in CI issues. Turns out that because some of the tests run in the docker container, they aren't actually building using the version of rust in
rust-toolchain.toml
and instead were using the version of rust from the container (1.76). This broke things sinceLazyLock
was only stabilized in 1.80. I had a real fight with the CI because it turns out that using the standard actions in the docker container is not a straightforward as one would like. I'll skip a recount of the entire ordeal---peruse the commits to witness my pain---but I resolved things and made these tests consistent with the rest of CI by specifically pulling the toolchain file before running the rust install action. The end result is that even the docker container tests do respect the indicated rust version, and we should be able to bump the version of rust used by EVERYTHING (if this isn't true I may scream) by updating the file.