Closed chrisseaton closed 4 years ago
The classic clamp
benchmark would work fantastically for this - Graal successfully compiles it to equivalent if
code, which would render perfectly as runnable Ruby code!
def clamp(min, max, value)
[min, max, value].sort[0]
end
loop do
clamp(1, 3, 4)
clamp(2, 2, 7)
clamp(5, 1, 8)
clamp(2, 4, 9)
end
$ bundle exec bin/seafoam render clamp.bgv:8 -o clamp.png
@XrXr made initial progress on this in the past. I've pushed something working fairly well to master now.
Reading and understanding graphs is hard - maybe reading pseudo-Ruby code would be easier.
Related work we can build from is this old Graal to JS backend https://www.davidleopoldseder.com/publications/aotjs_dsl_paper_authorversion.pdf.
I'd focus on Java graphs when getting started, as they're simpler.