rails / execjs

Run JavaScript code from Ruby
MIT License
539 stars 282 forks source link

Add runtime using GraalJS on TruffleRuby #107

Closed eregon closed 3 years ago

eregon commented 3 years ago

This PR adds a new runtime for ExecJS when running on TruffleRuby in JVM mode and Graal.js is available. So it needs truffleruby+graalvm and also export TRUFFLERUBYOPT=--jvm --polyglot. The standalone truffleruby does not include Graal.js.

This new backend evaluates everything in-process much like the mini_racer backend. ExecJS's Context are correctly isolated by using Truffle inner contexts. All tests pass: https://github.com/eregon/execjs/runs/3688209195?check_suite_focus=true#step:9:72

eregon commented 3 years ago

This PR is ready now. @pixeltrix @byroot Could you review/merge this PR? (or who may I ping for review?)

byroot commented 3 years ago

I'll try to find some time today.

eregon commented 3 years ago

I'm not a fan to have to include a -head version on CI because GitHub Actions have no proper "allow failures" feature, but I suppose that's ok.

I could switch to the the non-head version when 21.3 is released on October 19. I'd suggest to merge the PR before though, and I can replace when released.

byroot commented 3 years ago

I could switch to the the non-head version when 21.3 is released on October 19.

Sounds good.

byroot commented 3 years ago

@eregon could you rebase? I fixed the jscore test suite on master.

byroot commented 3 years ago

And sorry for the delay, this slipped my mind.

eregon commented 3 years ago

@byroot Will do, but I'll wait for the release which should come later today, so then we can test against a release in CI :)

eregon commented 3 years ago

@byroot All good now, and the CI passes on my fork: https://github.com/eregon/execjs/runs/3942801077?check_suite_focus=true#step:9:21