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

PoC for JSR223 script-engine #314

Closed
wants to merge 1 commit into from

Conversation

thomasdarimont
Copy link
Collaborator

Initial attempt for implementing a JSR223 compatible script-engine based on chicory.

Fixes #149

Copy link

github-actions bot commented May 7, 2024

Test Results

27 725 tests  +3   25 585 ✅ +3   9s ⏱️ -1s
   100 suites +1    2 140 💤 ±0 
   100 files   +1        0 ❌ ±0 

Results for commit 4a8f35a. ± Comparison against base commit 41fe972.

♻️ This comment has been updated with latest results.

@thomasdarimont thomasdarimont force-pushed the issue/gh-149-jsr223-scriptengine branch from 911d3be to 4a8f35a Compare May 7, 2024 21:12
@andreaTP
Copy link
Collaborator

I'm doing some autumn cleanup of the repo 😅
@thomasdarimont any interest in moving this forward or we can close and re-open when necessary?

@thomasdarimont
Copy link
Collaborator Author

Hi @andreaTP unfortunately, I don't have time to work on this at the moment.

I still think it would be useful to have wasm support per ScriptEngine I had the impression that the JSR223 API is not meant to be used with "binary" scripts as most ways to supply a script only offer string based methods. That's why I resorted to provide the wasm as base64 encoded string.

Of course we could also support WAT here, but that might be quite inefficient.

While thinking about it, another (crazy) idea came to my mind:

We could just add wasm support to Nashorn via chicory :)

We could provide a small JS wrapper that provides the minimal JavaScript web assembly API core which uses chicory underneath to load and execute the webasebly.
See: https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API

This would allow us to leverage the ScriptEngine Bindings support of Nashorn and would work nicely with the scripting support in existing Frameworks :)

@andreaTP
Copy link
Collaborator

Thanks for getting back @thomasdarimont !
Even if we compromise on performance, maybe having Wat support in the script engine is the most compelling integration.

Talking about the other idea on Nashorn, totally, I have been exploring it in Rhino: rhino/rhino-wasm#1
but it requires more work than I anticipated (the API surface is big enough) and it's up for grabs if anyone wants.

@andreaTP
Copy link
Collaborator

Let me close this PR for now, @thomasdarimont feel free to re-open it or open an alternative one.

I'm fully supportive in making Chicory available through JSR223 by embedding it(or having it as an optional extension) in JS runtimes like Nashorn and Rhino.

At the moment I don't have the bandwidth and a clear use case to push this forward myself either, but if anyone reading this thread is interested I'll be happy to assist.

@andreaTP andreaTP closed this Oct 30, 2024
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.

Implement a compatibility layer for JSR 223
2 participants