-
Notifications
You must be signed in to change notification settings - Fork 1
Tweaks to WASM-based build for JVM #1
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
base: topic/javawasm_changes
Are you sure you want to change the base?
Tweaks to WASM-based build for JVM #1
Conversation
…ring Reject `def f a, (b) = 1`
See ruby/ruby@6d81969 It leaves the old variant around. RuboCop for examples accesses `Prism::Translation::Parser35` to test against ruby-head. For now I left these simply as an alias
While the latter creates an intermediate array of all method names including all ancestors, the former just traverse the inheritance chain and can stop if found once.
Update the 3.5 Gemfile
Use `method_defined?` instead of `instance_methods.include?`
Move gemfiles for 3.5 to 4.0
Bumps the java-deps group in /java-wasm with 3 updates: [com.dylibso.chicory:bom](https://github.com/dylibso/chicory), com.dylibso.chicory:annotations-processor and [com.dylibso.chicory:chicory-compiler-maven-plugin](https://github.com/dylibso/chicory). Updates `com.dylibso.chicory:bom` from 1.5.3 to 1.6.0 - [Release notes](https://github.com/dylibso/chicory/releases) - [Commits](dylibso/chicory@1.5.3...1.6.0) Updates `com.dylibso.chicory:annotations-processor` from 1.5.3 to 1.6.0 Updates `com.dylibso.chicory:chicory-compiler-maven-plugin` from 1.5.3 to 1.6.0 - [Release notes](https://github.com/dylibso/chicory/releases) - [Commits](dylibso/chicory@1.5.3...1.6.0) Updates `com.dylibso.chicory:annotations-processor` from 1.5.3 to 1.6.0 Updates `com.dylibso.chicory:chicory-compiler-maven-plugin` from 1.5.3 to 1.6.0 - [Release notes](https://github.com/dylibso/chicory/releases) - [Commits](dylibso/chicory@1.5.3...1.6.0) --- updated-dependencies: - dependency-name: com.dylibso.chicory:bom dependency-version: 1.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: java-deps - dependency-name: com.dylibso.chicory:annotations-processor dependency-version: 1.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: java-deps - dependency-name: com.dylibso.chicory:chicory-compiler-maven-plugin dependency-version: 1.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: java-deps - dependency-name: com.dylibso.chicory:annotations-processor dependency-version: 1.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: java-deps - dependency-name: com.dylibso.chicory:chicory-compiler-maven-plugin dependency-version: 1.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: java-deps ... Signed-off-by: dependabot[bot] <support@github.com>
…a-deps-48b38cc957 Bump the java-deps group in /java-wasm with 3 updates
`gemfiles/3.5/Gemfile` has been updated to `gemfiles/4.0/Gemfile` by ruby#3715.
Fixes [Bug #21661]
Reject endless method as a block parameter default
Reverse sync from upstream
Bump ruby deps for typecheck
Reenable windows CI that were disabled because of fiddle
When we know we are in an alternation, and we know we have captured variables, add a syntax error by visiting the pattern subtree and finding the local variable target nodes and adding an error.
Revisit variable capture syntax error
Remove now obsolete todos
Respect parse.y excludes in CI
…a-deps-7f33173740 Bump org.codehaus.mojo:templating-maven-plugin from 3.0.0 to 3.1.0 in /java-wasm in the java-deps group
…7/ruby-deps-961cfbabc9 Bump the ruby-deps group across 9 directories with 1 update
Optimize ripper translator
…:Ripper * Handle line continuations. * Handle space at the end of file in LexCompat. Co-authored-by: Earlopain <14981592+Earlopain@users.noreply.github.com>
Add Ripper :on_sp events for Prism.lex_compat and Prism::Translation::Ripper
You're supposed to return the first argument. ```rb # Before [[:stmts_new], [:rescue_mod, nil, nil], [:stmts_add, nil, nil], [:program, nil]] # After [[:stmts_new], [:rescue_mod, "1", "2"], [:stmts_add, nil, "1"], [:program, nil]] ``` The correct result would be: `[[:rescue_mod, "1", "2"], [:stmts_new], [:stmts_add, nil, "1"], [:program, nil]]` But the order depends on the prism AST so it seems very difficult to match.
Fix `on_*` return value of ripper translator
… translator * We don't know what `on_*` events might return so we cannot assume it's an Array. * See ruby#3838 (comment)
We should touch these as little as possible and just pass them along
Add `license` identifier to Rust crates
…g-any Check using Prism nodes if a command call has any arguments in Ripper translator
org.jruby:chicory-prism
Nodes need access to RubySymbol and support APIs at least.
* It is a resource used as source code (in wasm) that is compiled for the project artifact. * Added to Rake CLOBBER
| with: | ||
| name: prism.wasm | ||
| path: java-wasm/src/test/resources/prism.wasm | ||
| path: java-wasm/src/main/resources/prism.wasm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prism.wasm file was very intentionally placed in test so that it doesn't get included in the resulting jar (it's redundant).
The Chicory compiler already generates a org/prism/PrismParser.meta file that is smaller and contains everything needed for execution.
| instance = Instance.builder(module) | ||
| .withMemoryFactory(limits -> new ByteArrayMemory(new MemoryLimits(10, MemoryLimits.MAX_PAGES))) | ||
| .withMachineFactory(PrismModule::create) | ||
| .withMachineFactory(parser.machineFactory()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: .withMachineFactory(PrismParser::create)
| @@ -1,11 +1,12 @@ | |||
| package org.prism; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal, but you might want to align the package name to the new groupId.
Allow the buffer functions to manage the internal pointer and use consistent argument order for calloc.
We need to free the current_block_exits in parse_program when we're done
with it to prevent memory leaks. This fixes the following memory leak detected
when running Ruby using `RUBY_FREE_AT_EXIT=1 ruby -nc -e "break"`:
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x5bd3c5bc66c8 in realloc (miniruby+0x616c8) (BuildId: ba6a96e5a060aec6fd9f05ed7e95d9627e1dbd74)
#1 0x5bd3c5f91fd9 in pm_node_list_grow prism/templates/src/node.c.erb:35:40
#2 0x5bd3c5f91e9d in pm_node_list_append prism/templates/src/node.c.erb:48:9
ruby#3 0x5bd3c6001fa0 in parse_block_exit prism/prism.c:15788:17
ruby#4 0x5bd3c5fee155 in parse_expression_prefix prism/prism.c:19221:50
ruby#5 0x5bd3c5fe9970 in parse_expression prism/prism.c:22235:23
ruby#6 0x5bd3c5fe0586 in parse_statements prism/prism.c:13976:27
ruby#7 0x5bd3c5fd6792 in parse_program prism/prism.c:22508:40
Primarily for testing purposes.
This is not all of the boot files but is sufficient to demonstrate a memory fault in the AOT WASM parser.
Fix the memory leak
Cleanup and improvements
Bit of cleanup and documentation here mostly.
org.jruby.chicory-prism.RubySymbol.java-wasmbuild output tojava-wasm/src/main/resources.