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

Remove shared state from IR #2

Merged
merged 4 commits into from
Apr 8, 2020
Merged

Remove shared state from IR #2

merged 4 commits into from
Apr 8, 2020

Conversation

phase
Copy link
Member

@phase phase commented Apr 8, 2020

This PR removes all shared state between structs in the IR by removing Arcs and Mutexes and replacing them with constant IDs for declarations, blocks, & instructions. This method is much nicer to use in Rust since Rust demands many things when using pointers.

The tests are working but there are still a few spots using unsafe to copy mutable references which can be improved. I was just writing crap code until it compiled.

Closes #1 because I have decided using Zig wouldn't be the best decision. The language is too new and even starting out with a basic AST showed issues in the compiler. It's a lovely language but it's not ready yet.

I'm starting to refactor the IR by replacing all the double pointers
with declaration IDs, removing the shared state.

There are a few spots that use unsafe and they immediately gave me a
big segfault! Still a bit of work to do but at least it compiles!

Signed-off-by: Jadon Fowler <j@jadon.io>
Instead of having blocks and instructions reference each other in the IR,
everything has been changed to use stateless "IDs". This removes all
pointers from structures and clears up a lot of the lifetime issues I
was dealing with as well as ugly pointer casting.

Signed-off-by: Jadon Fowler <j@jadon.io>
Signed-off-by: Jadon Fowler <j@jadon.io>
Signed-off-by: Jadon Fowler <j@jadon.io>
@phase phase marked this pull request as ready for review April 8, 2020 15:23
@phase phase merged commit 9977234 into master Apr 8, 2020
@phase phase deleted the no-arc branch April 20, 2020 05:57
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

Successfully merging this pull request may close these issues.

1 participant