Announcement

Collapse
No announcement yet.

W3C Posts Initial WebAssembly 2.0 Working Drafts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by NobodyXu View Post

    Nobody with the right mind would write entire software in wasm, just like nobody would write it in assembly.

    The greatest advantage of wasm is that you can compile (existing) C/C++/Rust/Java to wasm and run on any platform (potentially browser).
    It provides benefits similar to JVM with Java Bytecode.

    That's why having exception handling and GC in wasm runtime is important.
    Ah, so you haven't played with it...
    When you compile Go, for example, to wasm, the GC part is also compiled. Makes a tiny function call a 5MB wasm code in the process. So for your needs, support is not needed, it works the other way around.

    Comment


    • #22
      Originally posted by ssokolow View Post

      My understanding is that it's currently achieved by performing what's effectively message-passing IPC to control a JavaScript shim.
      I honestly don't remember how it works (haven't played with it for a while), but as long as it's achievable, I would say "problem solved".

      Comment


      • #23
        Originally posted by bug77 View Post

        I honestly don't remember how it works (haven't played with it for a while), but as long as it's achievable, I would say "problem solved".
        The current approach makes WebAssembly unavoidably slower than JavaScript for tasks that involve DOM manipulation due to the overhead of that. It's the same problem that makes microkernels worse in practice than in theory.

        Comment


        • #24
          Originally posted by bug77 View Post

          Ah, so you haven't played with it...
          When you compile Go, for example, to wasm, the GC part is also compiled. Makes a tiny function call a 5MB wasm code in the process. So for your needs, support is not needed, it works the other way around.
          It definitely can be compiled to wasm, but it is going to be slow compared to native support of GC in wasm.

          Comment


          • #25
            Originally posted by NobodyXu View Post

            It definitely can be compiled to wasm, but it is going to be slow compared to native support of GC in wasm.
            What does "native support of GC in wasm" even mean? Bridging every garbage collector under the sun into whatever garbage collector your browser happens to be running? Giving the ability to run on alternate garbage collectors to each and every garbage collected programming language?

            Comment


            • #26
              Originally posted by bug77 View Post

              What does "native support of GC in wasm" even mean? Bridging every garbage collector under the sun into whatever garbage collector your browser happens to be running? Giving the ability to run on alternate garbage collectors to each and every garbage collected programming language?
              I haven't looked at the wasm 2.0 proposal in detail, but I imagine it would expose an API for allocating an object that is tracked by GC in wasm interpreter, and then return a cloneable handle to it that can be stored on stack/another struct which is also tracked by the GC?

              I will admit, I am expecting an alternative GC implementation for these languages.
              Last edited by NobodyXu; 23 April 2022, 11:33 AM.

              Comment


              • #27
                Originally posted by NobodyXu View Post

                I haven't looked at the wasm 2.0 proposal in detail, but I imagine it would expose an API for allocating an object that is tracked by GC in wasm interpreter, and then return a cloneable handle to it that can be stored on stack/another struct which is also tracked by the GC?

                I will admit, I am expecting an alternative GC implementation for these languages.
                Let's take one more look at what Wasm is supposed to be: "WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine." - https://webassembly.org/

                Comment


                • #28
                  Originally posted by bug77 View Post

                  Let's take one more look at what Wasm is supposed to be: "WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine." - https://webassembly.org/
                  According to https://en.wikipedia.org/wiki/Java_virtual_machine, JVM is also a stack based and register based virtual machine.

                  And according to https://en.wikipedia.org/wiki/Stack_machine, stack based (virtual) machine is:

                  a stack machine is a computer processor or a virtual machine in which the primary interaction is moving short-lived temporary values to and from a push down stack. In the case of a hardware processor, a hardware stack is used. The use of a stack significantly reduces the required number of processor registers. Stack machines extend push-down automaton with additional load/store operations or multiple stacks and hence are Turing-complete.
                  which is essentially referring to any modern CPU, which provides a stack where the short-lived temporary values is pushed to and constantly moved around.

                  That doesn't prevent use of heap, nor does it prevent use of GC.

                  Comment

                  Working...
                  X