-
Notifications
You must be signed in to change notification settings - Fork 4
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
Custom command semantics #105
Comments
This would be very useful in the MCS queue (see #133) where we need a compareAndSet operation over Starling variables. I want to write something like the following:
The only way to do this at the moment is (I think) to piggyback on GRASShopper's if statement, which is dumb:
I think @MattWindsor91 also ran into this when he was trying to encode the Treiber stack. |
Theoretically, atomic branches should be possible: they're supported in In practice, I'm not sure if the framing system will handle them properly. I think it will? |
If we can implement branches without the custom command syntax, that means that all we need to do for the custom command syntax itself is lambda abstraction. At this stage I'd honestly propose getting rid of the |
Yeah, I think |
I don't understand your first point: does this mean that branches are supported internally but aren't exposed by syntax? |
PRQ #99 adds a new mid-level semantics for commands. This issue proposes opening up this mid-level semantics as a mini-language for adding custom commands.
Why? Because this will allow us to express symbolic commands easier, mainly. It also boosts our expressiveness story by allowing the user to 'choose' their atomic command set (while, at the Views level, the atomic commands are always fixed).
One possible syntax, shown in #104, is
where
where lvalue and expr are exercises left to the reader.
The idea is that if a parameter has a
&
before its name, it's restricted to being an lvalue, and appears in the write-to of the custom command. Each possible path through the command must assign or forget the parameter. The delimiter between microcode commands is,
because it isn't sequential composition.These atomic commands would only be allowed in angle brackets, to distinguish them from function calls (which might end up in Starling in the distant future).
Thus, CAS would become
and heap assignments from the LC list would become
The syntax can be tweaked around a lot though.
The text was updated successfully, but these errors were encountered: