forked from scala-js/scala-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Towards Wasm Component Model #5
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
Closed
Closed
Conversation
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
e5d5a37
to
5730e9c
Compare
To enable running `println("Hello world")` on stand-alone Wasm with WASIp2, commented out the transformation cases for IR nodes related to JS interop in `wasmemitter` so that any JS-related IR would result in a linking error. Additionally, converted several standard library implementations with JS dependencies into pure Scala.
Also removed js-string-builtins imports concat is so slow, we need to make string concat to be just pointer moving
Now, there's no global imports - Derive boxed float/double/boolean/integer - Derive boxed unit (for undef) - Stub idHashCode (we need a proper impl)
This fmod implementation doesn't conform the spec
fbfbd5c
to
87d20ad
Compare
549c0ab
to
bc75715
Compare
- Swap the arguments of `==` in `TestImports`. It seems we encountered a cast failure when casting the itables of `Variants`. This needs to be fixed later. - Add a function to dump memory content for debugging. - Fix `relloc` to prevent freeing memory when `newSize <= 0`. We shouldn't free the memory segment, for example, when the host tries to allocate an empty string. - `genLoadMemory` now no longer moves `ptr`; it simply copies the pointer value and moves it locally. Moving the pointer globally was error-prone. - Avoid storing `VoidType` in variants.
Instead of using malloc/free for dynamic memory allocation, this change introduces a simple and efficient memory management model based on a global stack pointer. - Memory allocation is done by incrementing `stackPointer` by the requested size, (ensuring 8-byte alignment for now). - Memory deallocation is performed by restoring `stackPointer` to its previous value. This approach avoids fragmentation and simplifies memory management.
Represents bitflags in the Component Model using a final case class where all fields are of type `Boolean`. For example: ```scala @ComponentFlags final case class F1( b0: Boolean, b1: Boolean, b2: Boolean, b3: Boolean, b4: Boolean, b5: Boolean, b6: Boolean, b7: Boolean ) ``` Is there a better alternative bitflags representation in Scala? Note that these interfaces must also be usable in `javalib`, meaning Scala libs (e.g. Scala's `Enumeration`) cannot be used. A possible workaround is to define a type alias: ```scala type Flags = Int ``` This allows function signatures to use `Flags`, which will be interpreted as a flag in the Component Model. For example: ```scala def roundtripFlags(a: Flags): Flags = cm.native ``` When an `Int` is passed as an argument, it will be serialized/deserialized as a flag according to the Component Model's specifications.
Enabling GC causes an illegal instruction error, bytecodealliance/wasmtime#10181 and in rare cases, the content of array/struct changes unexpectedly during execution (though I haven't been able to create a reproducible test case for this). For now, continue development with `-C collector=null`.
Still, methods on Long needs to use non-RuntimeLong methods though
constructor - `apply` method in companion object static methods - methods in companion object
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.
WIT support progress (for myself)
roundtrip
tupled values
roundtirp
tupled values
roundtrip
tupled values
roundtirp
tupled values
roundtrip
tupled values
roundtirp
tupled values
roundtrip
tupled values
roundtirp
tupled values
roundtrip
tupled values
roundtirp
tupled values
roundtrip
tupled values
roundtirp
tupled values
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
roundtrip
tupled values
roundtirp
tupled values
roundtrip
roundtirp