Re:Simple – Sea of Nodes
by cliffc on Saturday September 21, 2024 @07:59PM
(#41613551)
C2/HotSpot uses a MemBarrier / MemFence node type for these. Serializes the memory ops as needed. Used to implement the Java memory model on all hardware. Sometimes (x86) the ops encode as (empty), sometimes its a Real Fence op.
Re:Simple – Sea of Nodes
by fuhsnn on Sunday September 22, 2024 @09:15AM
(#41616843)
Thanks for the info. So in practice there are node types that encode sequential flow as needed. I wonder if the other way around works: keep the CFG form for side effects and only promote SSA values to be "floating".
Re:Simple – Sea of Nodes
by fuhsnn on Saturday September 21, 2024 @07:14PM
(#41613353)
I'm currently pondering an IR format for a mildly optimizing C23 implementation, and am curious how C11 atomic operations would look like in sea-of-nodes. The representation seems to be completely opposite to the programming model, where strict ordering and memory fencing are required. libFirm[0] is probably the most sophisticated sea-of-nodes based AOT compilers I'm aware of, it's a shame they ceased development before implementing atomics.
Re:Simple – Sea of Nodes
by cliffc on Saturday September 21, 2024 @04:30PM
(#41612487)
Simple (https://github.com/SeaOfNodes) is a compiler tutorial featuring the Sea-of-Nodes IR, with ports in Java (@cliffclick), Go (@yardenlaif), Rust (@RobertObkircher), and C++ (@Hels15), with help from @XmiliaH, @ThaliaArchi. If you'd like to help reach out to [email protected] or on GitHub.
[0] https://pp.ipd.kit.edu/firm/Features.html