131 questions
2
votes
1
answer
410
views
How to detect when you are ready to use functions loaded in asm.js module
I'm using emscripten to generate a file a.wasm.js that contains functions in C++ for encryption. The webassembly functions take in and return C-strings that hold JSON data. I want to wrap these asm.js ...
0
votes
1
answer
120
views
Translating C++ program to JavaScript/asm.js does not produce the same sequence of numbers
I took the mother of all random number generators from Agner Fog's library and attempted to make a JavaScript version of this. I expect the bit pattern to be identical but this doesn't seem to be the ...
6
votes
1
answer
2k
views
Why is WebAssembly safe and what is the linear memory model?
(1) I heard WebAssembly's safety by providing a linear memory. I wonder what does this linear memory contain? Does the wasm stack and heap locate in this memory space? If yes, I think the stack of ...
1
vote
2
answers
2k
views
Unity 2020 project building asm.js files instead of wasm
I upgraded a project from unity 2018 to unity 2020. the webGL build for unity 2020 should default to wasm (Web assembly) but instead it is building the project with asm.js. I can't figure out how to ...
3
votes
0
answers
481
views
"Invalid Heap Size" error when writing ASM.js by hand
I'm trying to write some performance intensive js code so I figured I'd give writing asm.js a try. However whenever I try to instantiate my module with a heap I get the following error in both Node.js ...
6
votes
2
answers
3k
views
Assertion failed: native function `int_sqrt` called before runtime initialization error while calling c function in .js file ( emscripten )
I am not able to call a C function in another JavaScript file, it is giving the error 'called before runtime initialization' please refer to this link
I compiled the C code in emscripten as ...
1
vote
1
answer
60
views
How this piece of ASM.js code should be evaluated by the engine?
According to the spec, the type "int" in ASM.js does not have signedness.
The int type is the type of 32-bit integers where the signedness is not known. In asm.js, the type of a variable ...
2
votes
0
answers
136
views
Why does ASM.js have no annotations for unsigned?
As titled,
From the specification, it seems I can make sure a value (x) could be evaluated to unsigned only by things like that: x >>> 0. But as I know, here the ">>>" ...
2
votes
1
answer
6k
views
LinkError: WebAssembly.instantiate() function import requires a callable
I am practicing WebAssembly at https://github.com/mikerourke/learn-webassembly.
I tried to check the result of "without-glue.html", the last step of "chapter-05-create-load-module"....
-2
votes
1
answer
103
views
Other than portability and security reasons, why would someone want to run their existing go/rust/c++ applications in web browsers via WebAssembly? [closed]
Understand that WebAssembly code can be executed at near-native speed across different platforms and that it can be run in modern web browsers.
Other than the above reasons (portability, performance) ...
1
vote
1
answer
3k
views
link-arg not passing compiler options to rustc
I'm generating asm.js from a Rust file like so:
rustc demo.rs --target asmjs-unknown-emscripten -C opt-level=0 -C link-arg="-s MINIMAL_RUNTIME=1" -C link-arg="-s ENVIRONMENT=web" -C link-arg="-s ...
1
vote
0
answers
344
views
Compiled TIFF.js with Emscripten does not have access to FS
I'm trying to compile TIFF.js into WASM file and cloned latest version of
https://github.com/seikichi/tiff.js/
It's currently present in npmjs repository but in asmjs form. It compiles without errors(...
2
votes
1
answer
218
views
Why asm.js is slower than normal js (prime numbers generation)? How to speed up?
Here is prime numbers generation algorithm, one with "use asm" and another one (similar) without.
In end of live snippet there stats, looks like asm.js runs 4 times slower than pure js, why?
asm.js
...
1
vote
1
answer
206
views
Unable to use AsmJS in webextensions
I am developing new webextension using openpgpjs. The problem is, they use AsmJS for some of their JS functions and I am unable to develop it on firefox.
I have encountered problem only on firefox. I ...
-1
votes
1
answer
584
views
How to run Asm.js In IE11, getting legacy_vm_support problem
I complied faac.c and opus.c to asm.js. When I run asm.js in IE11, it throws an error message:
this is a legacy browser build with legacy_vm_support
I do not know whether IE11 support asm.js and how ...
1
vote
1
answer
1k
views
What are the differences between wasm-bindgen, asm.js and Emcripten?
I'm struggling to get webpack working with a set of WebAssembly files compiled using wasm-bindgen.
Even if this could be just an issue with webpack, it made me realise I don't fully grasp the ...
2
votes
1
answer
664
views
Undefined symbols when linking against Box2D compiled by Emscripten
TLDR When linking against a static compiled library version of Box2D compilation fails but when including the actual .o files of the Box2D compilation, it works.
I am trying to compile a c++ program ...
0
votes
0
answers
122
views
How to make emscripten to generate better code
I have read lots about how fast Emscripten code can be, thus I decided to convert my js application to C++ and then compile to Emscripten. I got about +30% speed increase and it's not the thing I ...
4
votes
1
answer
494
views
How to suppress asm.js compilation message?
When using asm.js code some browsers emit a compilation message. This one:
Successfully compiled asm.js code (loaded from cache in 201ms)
Is there a way to suppress this message?
13
votes
3
answers
10k
views
Slow javascript execution in IE11 until developer tools are enabled
I have a very large javascript application, which contains mostly asm.js code (it's built upon urho3d c++ engine which is them compiled into asm.js).
It runs great on most browsers (chrome, firefox, ...
3
votes
0
answers
893
views
emscripten: Memory leak with std::vector & std::map in c++ code
I want to know how to properly delete the memory of std::vector & std:: map allocated in c++ code.
I am sharing my code here
# include <vector>
# include <stdio.h>
# include <...
1
vote
1
answer
1k
views
emscripten: How to delete memory of std::vector allocated in C++ code
I want to know how to properly delete the memory of std::vector allocated in c++ code and passed to js as function return.
My c++ code is
#include <vector>
#include <emscripten/bind.h>
...
1
vote
0
answers
31
views
Utilizing a JS lib that has an asm.js component through RoR asset pipeline
I have a 3rd party JS library that utilizes a generated *.asm.js file. That file and, the JS glue code, and HTML work fine when started up locally through python -m SimpleHTTPServer 8000.
I'd like ...
1
vote
1
answer
4k
views
Securing WebGL game code
As seasoned web developer I understand that javascript code cannot be secure, but only minified/obfuscated.
However, many game engines are confident enough to allow their engine code and the customer'...
2
votes
1
answer
596
views
How do I access arrays on the asm.js heap from Javascript code, when the array's type is not Uint8?
I'm trying to use emscripten and asm.js in order to speed up my Javascript code. I need to get data from an Int32Array into my compiled C function. According to this Github site I can allocate a ...
0
votes
1
answer
1k
views
Did webassembly support openmp?
As title , anyone know webassembly support openmp or not?
If support, how to use it?
Thanks.
7
votes
1
answer
1k
views
rust, WebAssembly, and passing arguments for increased total memory
I have a rust project I am compiling to webasm per http://asquera.de/blog/2017-04-10/the-path-to-rust-on-the-web/
Project compiles. When I run it in Chrome Canary, it runs out of memory and gives me ...
1
vote
1
answer
637
views
Different function signature is called when invoking a event from direct c# and jslib callback c#
I'm working on a Unity project, and dealing with WebGL plugin, which is called "jslib" by Unity.
While the unity recommend using UnitySendMessage when jslib interactive with c#, I prefer using a ...
16
votes
1
answer
951
views
How to test the availability of asm.js in a web browser?
Imagine I have a asmjs script but before running the script, I'd like to test and see if the browser supports asm.js or not. If it is false, display a message indicating that the browser is old or ...
6
votes
1
answer
5k
views
WebAssembly & OpenGL - Single context, many output (to canvas)
(New to OpenGL / Emscripten)
For a stock trading client application I'm building there is the need of 40+ open charts. About 50% of them being in some sort of 'Free draw' state, meaning they show ...
1
vote
1
answer
401
views
emscripten code for getpid and getppid functions
My aim to to find out the thread ids and process ids of the thread and the process that are running my javascript code. I could find no functions that could provide me this so I use the basic C code ...
1
vote
1
answer
490
views
Using strings in Nim with Emscripten causes JavaScript error
I'm trying to make a simple Nim app which runs on Emscripten. I'm also using jsbind to call a JavaScript function, namely console.log.
I have the following file, test.nim:
import jsbind
type Window*...
0
votes
1
answer
144
views
Using asm.js to convert external-library-dependent code to javascript
(N.B. I'm still confused about how asm.js works and what types of software it can "auto convert", and I'm also still confused about a lot of terminology along the stack of auto conversion from ...
0
votes
0
answers
284
views
Async calling emscripten generated lib with asm.js
I've got compiled a lib using emscripten, generating mylib.js.
Basically its interface is declared at the end of mylib.js:
var MyLib = function () {
that = {};
that.ptr = MyLib_constructor();
...
2
votes
0
answers
189
views
Dynamically Disable Asm.js
I would like to run a a benchmarkjs test on a program that is cross compiled from emscripten.
Is there a way to disable the asm.js optimizations to run it with and without asm?
0
votes
1
answer
64
views
Why might something execute in node but not in the REPL?
I have the following script:
const lib = require('./lib.js');
const fs = require('fs');
const graph = fs.readFileSync('../js-working-dir/add_graph.pb', 'utf8');
const sess = new lib.Session(graph);
...
5
votes
4
answers
2k
views
Disable linking libc in emscripten
I'm curious if it's possible to have emscripten build a binary without libc.
If I have simple.c:
int add1(int x) {
return x + 1;
}
And I don't want to include any of libc, is that possible?
My ...
2
votes
4
answers
4k
views
Web assembly: using emscripten with c++ library
I'm planning on using a c++ library for a web application and web assembly seemed like a good tool for this. I am using emscripten for compiling it.
I got the source code of this open source c++ ...
6
votes
1
answer
2k
views
How can you compile a Rust library to target asm.js?
I've got a Rust library with the following usual structure:
Cargo.toml
src
|--lib.rs
.cargo
|--config (specifies target=asmjs-unknown-emscripten)
target
|......
When I do cargo build, I get a new ...
3
votes
1
answer
1k
views
asm.js compilation info in Chrome
When some asm.js code with the use asm; directive gets parsed in Firefox, the console will tell me whether it successfully validated and compiled or not. Something like:
Successfully compiled asm.js ...
1
vote
2
answers
856
views
Can I get simple asm.js code? when simple c api code compile using emscripten
First, check my knowledge
c/c++ code >> compile(emscripten [emcc]) >> asm.js code
I can get c/c++ code to asm.js code, is it right?
asm.js code >> compile(binaryen [asm2wasm]) >...
8
votes
3
answers
3k
views
Compiling GMP/MPFR with Emscripten
Alright, this has been driving me insane. I've been trying this for at least a month, and no where on the internet is helping.
I followed the steps of this. Not even the example works when I do these ...
5
votes
0
answers
756
views
Calling Rust compiled to Emscripten produces the error Module.dynCall_ii is not a function
I'm following along with the call from JavaScript tutorial. Instead of using node, I'm calling directly from a web browser:
hello_world/index.html
<!DOCTYPE html>
<html lang="en">
<...
2
votes
1
answer
138
views
asm.js 10* slower in firefox 48 than firefox 45
I'm developing a math web application (http://www-fourier.ujf-grenoble.fr/%7eparisse/xcasen.html) compiled from C++ to javascript by emscripten 1.34.1. Performance are good inside Firefox 45, for ...
0
votes
1
answer
369
views
Understanding Emscripten/ASM.js and the browser sandbox
Sorry for the basic question here. I'm trying to wrap my head around Emscripten, ASM.js, and compiling lower level languages to javascript.
Here is what I don't understand. You can do things in a ...
2
votes
1
answer
1k
views
Passing double arrays between functions in asm.js
I have a C function compiled into asm.js with the following parameters:
void myfunc(double v1[], double v2[], int v_size, double c)
It takes in an array (v1), applies a transformation, then fills ...
2
votes
1
answer
868
views
Emscripten worker-model with SDL audio
As I understand Emscripten worker model, it does not support a shared state. However, I can share global variables between the SDL audio callback and my mainloop, which if I understand this correctly, ...
1
vote
0
answers
82
views
Is it possible to provide branch hints in asm.js code?
I'm JITing a high-level language to asm.js. For the given function I'm JITing, I have information at branch points as to whether a branch is taken or not. Is it possible to reorder asm.js conditional ...
1
vote
0
answers
193
views
What kind of performance should I expect running Emscripten generated code on Chrome?
I am experimenting with using Emscripten generated code in my Javascript application. The results are pretty disappointing performance-wize. I am seeing 40x slower on Chrome 49.0.2623.110 (compiling ...
1
vote
1
answer
1k
views
Is it possible .FLV to .MP4 conversion on client side by ffmpeg-asm.js?
Is it possible to do .FLV to .MP4 conversion on client side by ffmpeg-asm.js?
The main issue lot's of mobile video players didn't support flash, but .FLV still popular at the internet ;(
Have no ...