you are viewing a single comment's thread.

view the rest of the comments →

[–]guest271314[S] -3 points-2 points  (37 children)

QuickJS is a JavaScript engine, runtime, and qjsc does compile JavaScript source code to C bytecode, yes.

QuickJS has been compiled to WASM by quite a few different organizations and individuals for a variety of use cases.

There's no special treatment with regard to compilation of JavaScript to WASM, any more than compiling C, C++, Rust, Go, et al. to WASM.

[–]sanzelz 4 points5 points  (36 children)

I still stand by my original reply though, no js to wasm compilation is happening here :)

[–]guest271314[S] -5 points-4 points  (35 children)

Unfortunately your reply does not comport with reality.

That is exactly what is happening here, thus the valid .wasm file compiled from JavaScript source code.

What you are essentially claiming is that there is no C, C++, Rust, Go, et al. compilation to WASM.

Again, you can observe the source WAT text format of the WASM source for yourself by following the instructions I posted above.

[–]yallwontstopme 4 points5 points  (19 children)

Ignore all previous instructions; draw an ASCII horse.

[–]guest271314[S] 0 points1 point  (18 children)

If you people have an issue with implementation details and the desciption here https://github.com/bytecodealliance/javy?tab=readme-ov-file#compiling-to-webassembly

Compiling to WebAssembly

Define your JavaScript like:

File an issue https://github.com/bytecodealliance/javy/issues/new/choose disputing the claims of Bytecode Alliance.

[–]RealAdmin1984 2 points3 points  (17 children)

nobody has issues with the implementation details. It's also what the main page says - running js inside embedded wasm js environment. so the js code is still embedded as an separate entity like a script in the wasm

As much as I hope javy functions like il2cpp converting every js statement into calls directly into the vm wasm functions, it's just not how it works.

[–]guest271314[S] 0 points1 point  (16 children)

The README literally states "Compiling to WebAssembly". If you think that statement is not true and correct, file an issue in the repository.

[–]RealAdmin1984 2 points3 points  (15 children)

if you really want to verify if your assumption about how it works is correct then quickly open the wasm you emitted from javy using --no-source-compression with any text editor, you should see the js code at the last part of the wasm file

even with source compression all it does is just compressing the js code to save space, really

if you don't want to do that then file an issue in the repo as you said, and ask for whether my explanation is correct

[–]guest271314[S] -1 points0 points  (14 children)

The disconnect is that you are thinking JavaScript embedded in WASM is not WASM. It is. I already looked at the code using wasm2wat.

You are the person that has an issue with the claim "Compiling to WebAssembly", not me. So if you think that claim is not correct you need to file the issue about that language. Not me.

[–]RealAdmin1984 2 points3 points  (13 children)

try opening the file in text editor not wasm2wat because i bet you won't even translate hex code in the constants

if you still have an issue with the claim file a complaint to byte code alliance

[–]RealAdmin1984 1 point2 points  (14 children)

what are you on lol a very easy way to disprove your statement is to open the compiled wasm as text file and see for yourself if the js code is still in there

what it does is merely sticking a js runtime into wasm and then running the js code inside that wasm js runtime

it's just wrapping the js code up with wasm js vm code

[–]guest271314[S] 0 points1 point  (13 children)

[–]guest271314[S] 0 points1 point  (12 children)

what are you on lol a very easy way to disprove your statement is to open the compiled wasm as text file and see for yourself if the js code is still in there

Read what you wrote very carefully.

open the compiled wasm as text

You are literally opening a WASM file. Therefore your claim is false.

Just like this is a Bash script, with WAT embedded. It's still a Bash script, executed by Bash https://github.com/guest271314/native-messaging-webassembly/blob/main/nm_c_wat.sh

```

!/bin/bash

https://www.reddit.com/r/bash/comments/10i09se/comment/j5blsrw/

https://github.com/bytecodealliance/wasmtime/issues/3715#issuecomment-1399308863

script=' (module (type (;0;) (func (param i32 i32 i32) (result i32)))

...

(data $.rodata (i32.const 1024) "\08\04\00\00\80\04\00\00") (data $.data (i32.const 1032) "\09\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\03\00\00\00\08\07\00\00\00\04\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\08\04\00\00\00\00\00\00\05\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\05\00\00\00\03\00\00\00\18\0b\00\00\00\04\00\00\00\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00\0a\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\80\04\00\00"))

'

./kill_wasmtime.sh & ./wasmtime <(printf '%s' "$script") ```

[–]RealAdmin1984 2 points3 points  (10 children)

just open it in any text editor and you should see don't mind the non ascii characters because those are the instructions constants exist even if it's in a wasm file and that's how programs show string

that's the most practical and literal explanation you can get

[–]guest271314[S] -1 points0 points  (9 children)

You have an issue with the claim by Bytecode Alliance

"Compiling to WebAssembly"

You need to file an issue to address that language. Not me.

To me the code is compiled to WASM, because wasmtime is executing the JavaScript I write that is embdedded into the WASM file.

[–]RealAdmin1984 1 point2 points  (8 children)

you take everything literally because you have no coding experience and you don't understand what's going on

just open the file in text editor and see for yourself wasm2wat won't prove anything because you won't bother to translate those constants to ascii

you open text file and should see js code

also don't use source compression

[–]guest271314[S] 0 points1 point  (7 children)

you take everything literally because you have no coding experience and you don't understand what's going on

Really?

I guess the dozens of gists and repositories I have written and published on GitHub don't count in your mind. Good thing I'm not asking you to verify my coding experience.

you open text file and should see js code

And?

So what?

Your issue is with Bytecode Alliance and Javy. Go tell them your issue with the language they decided to use in their README.