[java-wasm] Allow serialize to be called separately from serializeParse.#3537
Merged
Conversation
JRuby internally uses loader differently and also encodes options differently. Also added MemoryPages options since in testing one file complained about memory usage.
andreaTP
reviewed
Apr 2, 2025
| wasi = WasiPreview1.builder().withOptions(wasiOpts).build(); | ||
| instance = Instance.builder(PrismModule.load()) | ||
| .withMemoryFactory(ByteArrayMemory::new) | ||
| .withMemoryFactory(limits -> new ByteArrayMemory(new MemoryLimits(10, MemoryLimits.MAX_PAGES))) |
Contributor
There was a problem hiding this comment.
- nitpick - it will be good if the memory limits can be tuned when creating the object.
Maybe in the next iteration we can make use of a Builder to lock the constructor down.
Collaborator
Author
There was a problem hiding this comment.
@andreaTP yeah I think we definitely need to be able to configure. This just allowed basic parsing in JRuby to not warn for now.
Collaborator
Author
|
@eregon Any chance for an approval on this? We are working towards pure-Java webasm build for platforms where foreign call access does not exist (this is WIP). This likely will be expanded beyond serialization to general gem as well. |
kddnewton
approved these changes
Apr 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JRuby internally uses loader differently and also encodes options differently.
Also added MemoryPages options since in testing one file complained about memory usage.
Lastly, original method was making a String from bytes so allow serialize to accept bytes and
sourceLength since sometimes you have source smaller than the byte[] backing store.