Questions tagged [asm.js]

An strict subset of JavaScript that can be used as a low-level, efficient target language for compilers.

asm.js is a strict subset of JavaScript that can be used as a low-level, efficient target language for compilers. This sublanguage effectively describes a safe virtual machine for memory-unsafe languages like C or C++. A combination of static and dynamic validation allows JavaScript engines to employ an ahead-of-time (AOT) optimizing compilation strategy for valid asm.js code.

Resources

134 questions
6
votes
5 answers

"emcc" command does not recognized

I'm having issue with building this demo. https://github.com/kakukogou/opencvjs_demo_segmentation When i cd into this folder and run make command i get this error message: /bin/sh: 1: emcc: not found make: *** [segmentation] Error 127 This is how…
HarshaXsoad
  • 776
  • 9
  • 30
6
votes
1 answer

How does asm.js handle divide-by-zero?

In javascript, division by zero with "integer" arguments acts like floating points should: 1/0; // Infinity -1/0; // -Infinity 0/0; // NaN The asm.js spec says that division with integer arguments returns intish, which must be…
Francis Avila
  • 31,233
  • 6
  • 58
  • 96
6
votes
1 answer

How can I check if Firefox uses asm.js code?

So how can I check if it's executed like normal Javascript via for example Google's V8 engine or executed with near native performance using assembly?
I LOVE YOU
  • 81
  • 7
5
votes
1 answer

Why is WebAssembly safe and what is linear memory model

(1) I heard WebAssembly's safety by providing a linear memory. I wonder what does this linear memory contain? does wasm stack and heap locate in this memory space? If yes, I think the stack of wasm and stack of glue code (e.g., js python etc) are…
yeehaw
  • 159
  • 2
  • 11
5
votes
2 answers

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 described in the given link and used generated asm.js…
mysterious
  • 51
  • 1
  • 4
5
votes
4 answers

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 best attempt so far has been: emcc simple.c -s…
James Gilles
  • 674
  • 6
  • 12
5
votes
0 answers

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
goo
  • 2,230
  • 4
  • 32
  • 53
5
votes
1 answer

How to pass canvas imageData to emscripten c++ program without copying it?

I have Image data of the canvas: myImage = ctx.getImageData(0, 0, 640, 480); I figured out, that i can create new Uint8Array and use set() to copy imagedata. This is working example: var numBytes = width * height * 4; var ptr=…
Lukasz B
  • 303
  • 4
  • 15
4
votes
1 answer

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?
Nelson Teixeira
  • 6,297
  • 5
  • 36
  • 73
4
votes
1 answer

Emscripten can't find path to cmake

I've gone over the instructions several times, looked in countless forums, and still can't resolve this issue. I'm running Windows 10, and simply trying to install Emscripten. I've got Emscripten installed: I run # Fetch the latest registry of…
Dave Voyles
  • 4,495
  • 7
  • 33
  • 44
4
votes
1 answer

How do I compile swift without any dynamic libraries?

Tring to make a "hello, world" style program to see if I can use Swift on the web by running it through emscripten to get asm.js output. The problem is that when I compile it, its bitcode tries to link dynamic libraries. It doesn't seem like it…
Joshua Cheek
  • 30,436
  • 16
  • 74
  • 83
4
votes
1 answer

Why is asm.js project running faster in Chrome then FireFox?

I have ported a game engine project for my university course from C/C++ to JavaScript using emscripten. The asm.js optimization flag is set and I have been measuring the performance. But what is puzzling is that the performance in Firefox is bad.…
Culzean
  • 349
  • 3
  • 13
4
votes
1 answer

Is it practical to do high-precision calculations with asm.js?

I've been working on an HTML5 application that draws fractal images defined by iterating functions, such as the famous Mandelbrot fractal. http://en.wikipedia.org/wiki/Mandelbrot_set My understanding is that Javascript uses only a single data type…
Vivian River
  • 31,198
  • 62
  • 198
  • 313
4
votes
3 answers

asm.js - How should function pointers be implemented

Note: This question is purely about asm.js not about C++ nor any other programming language. As the title already says: How should a function pointer be implemented in a efficient way? I couldn't find anything on the web, so I figured asking it…
Tim
  • 5,521
  • 8
  • 36
  • 69
4
votes
2 answers

Is it possible to create 2 loops in javascript where one loop will be prioritized in case of resource deficiency?(both handle game ticks)

The problem is as such: In a js and asm.js based multiplayer game I've got two loops. One handles the actual game ticks, like unit position, velocity and combat. The other handles rendering of this world onto the canvas for the user to see. What…
Cookie
  • 73
  • 1
  • 5
1 2
3
8 9