Skip to content

Conflicting requirements between Ruby and Java builds #3962

@headius

Description

@headius

I'm very close to having the JVM WASM-based library hooked up to the Ruby code, but I've run into some conflicting requirements.

The current Java Loader class requires that the serialized content have no location fields:

java.lang.Error: Deserialization error: Loader.java requires no location fields in the serialized output (expected 1 but was 0 at position 9)
	at org.ruby_lang.prism.Loader.expect(Loader.java:773)
	at org.ruby_lang.prism.Loader.load(Loader.java:107)
	at org.ruby_lang.prism.Loader.load(Loader.java:26)
	at org.ruby_lang.prism.wasm.Prism.serializeParse(Prism.java:151)
	at org.jruby.parser.prism.WASMTest.test1Aot(WASMTest.java:51)

But the deserializer in the Ruby code requires that content have those location fields:

$ jruby -Ilib -e 'require "prism"; p Prism.parse("def foo; 1; end")'
RuntimeError: Invalid serialization (location fields must be included but are not)
  load_header at /Users/headius/work/prism/lib/prism/serialize.rb:289
   load_parse at /Users/headius/work/prism/lib/prism/serialize.rb:39
        parse at /Users/headius/work/prism/lib/prism/wasm.rb:60
       <main> at -e:1

I would rather not ship two different WASM builds to satisfy both. Why does the Loader not handle location fields?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions