Skip to content

Comments

Merge in WASM support#2

Open
headius wants to merge 22 commits intomainfrom
topic/chicory
Open

Merge in WASM support#2
headius wants to merge 22 commits intomainfrom
topic/chicory

Conversation

@headius
Copy link
Member

@headius headius commented Feb 23, 2026

WASM support is ready to land and the upstream PR ruby/prism#3902 has been merged into prism itself.

There will be additional tweaks but we can start moving forward with wasm support in the jruby-prism artifact.

enebo and others added 22 commits March 27, 2025 10:25
If gpg fails you can't install locally, and the rest are not
interesting for local builds.
Both forms are still in the same provider, but separated into two
classes. The ParserProvider logic for JRuby may need some tweaks
to support two separate SPIs so this is a first step to isolating
them.

The native parser will be returned if:

* A dynamic library file provided to initialize exists, and
* the wasm parser has not been specifically requested.

The wasm parser will be returned if:

* It was specifically requested, or
* a dynamic library that exists has not been provided to
  initialize.

In the future this selection should happen closer to the JRuby
level so we can use either or both more easily.
The native and wasm versions were split off into separate classes,
so most of these imports are only needed in the base class now.
The parser should be stateless and a new machine is constructed for
each call, so we should be able to reuse the same Prism instance
across parses.
This will primarily be used with JRuby 10+, which requires Java 21.
WASM is inherently single-threaded, so we cannot allow multiple
threads to be parsing with a single chicory-prism instance at the
same time. For now, we synchronize that access. A pool of instances
or a soft thread-local could be used in the future if that becomes
a bottleneck.
Formally add WASM support with Chicory
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.

2 participants