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

Massively simplify and equalise primitive commands #150

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

MattWindsor91
Copy link
Collaborator

NOTE: In typical me fashion, this is based on a previous pull request (#142), and shouldn't be merged (or really looked at in detail) until that one is up.

This is a fairly heavy PRQ (got a bit carried away with simplification, as usual) that does a lot of simplifying and expressivity-boosting changes to the primitive commands (assignment, postfix, assume, etc).

What does this do?

  • Atomic assignments and postfixes can now mention thread-local variables anywhere. (I think they're still restricted inside indices to only using thread-local variables, but I didn't check as this isn't a problem yet.)
  • Microcode and PrimCommands have been merged (sort of): Microcode can now contain stored commands (atomic function calls), and does so until the point where we used to expand out PrimCommands. PrimCommand is now a type alias for a certain type of Microcode. This makes Microcode the only internal representation of Starling's command language.
  • Internally, every stored command other than BCAS and ICAS is gone, and the modeller models postfixes, assumes, and id-transitions directly as microcode.
  • Local commands now use the exact same AST and internal representation as atomics. The only difference between the two, now, is that local commands can only name thread-local variables. This means commands like {| foo() |} local++ {| bar() |} are now possible.
  • Added a load more tests.
  • Fixed the weirdly specified CAS in Branches in atomic sections, and simplified atomic syntax #142.

@MattWindsor91
Copy link
Collaborator Author

@septract I've rebased this onto master now, so it should be ok to look at. Less priority than the last PRQ though.

(Also, I wonder if Travis will work today…)

We now instead check the arguments directly to see if an assignment
is local or not.

This is in preparation for eliminating intrinsic and symbolic
PrimCommands.
Microcode can now contain stored commands, which are removed during
processing.

PrimCommands are now just a specialisation of Microcode to use StoredCommand
as the stored command type.
This is to make sure the local command restrictions are not
thwarted when I generalise atomics.
This fixes #147 and does a bit more, getting rid of some now-unnecessary
stored commands.
This rather large refactor means that the only difference between assignments
etc. in <| atomic brackets |> and outside them is scoping: atomic bracket
commands can use shared variables.

This also, in principle, means that CAS and ++/-- are available for use
outside of atomic brackets.  This has not been rigorously tested yet.
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