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
11
votes
0 answers

What languages compile to the most efficient Javascript code? (besides C & C++)

There are lots of languages that compile to javascript these days, with C & C++ compiled to asm.js being touted as the fastest. I was wondering what other candidates exist for efficient, compiled Javascript/asm.js. I'd to find a nice language that…
pixelmike
  • 1,973
  • 1
  • 19
  • 31
11
votes
2 answers

asm.js type error: arguments to a comparison must both be signed, unsigned or doubles

I'm just learning the basics of asmjs, but I've got an error. I have no idea what did I wrong. TypeError: asm.js type error: arguments to a comparison must both be signed, unsigned or doubles; int and int are given code: window.onload =…
don kaka
  • 1,179
  • 2
  • 12
  • 28
11
votes
1 answer

what is the c/c++ virtual machine referred to in the asm.js spec

In the spec for asm.js (at http://asmjs.org/spec/latest/ ) in the introduction section it says "The asm.js language provides an abstraction similar to the C/C++ virtual machine" ..but I can't find any information on 'the C/C++ virtual machine' by…
James Cat
  • 432
  • 2
  • 12
10
votes
3 answers

Emscripten application not executing

When running my asmjs\emscripten application, compiled from C++, it has suddenly started to log: "run() called, but dependencies remain, so not running" to the web console, and nothing more happens. I've added some cout's at the absolute start of my…
Viktor Sehr
  • 12,825
  • 5
  • 58
  • 90
10
votes
1 answer

When asm.js is faster than normal JS code, why should I write new code in JS?

Emscripten could generate faster code from C/C++ than JS code wrote by hands, so is that means we should write new code in C/C++ and compile them to run on Web? I read the Emscripten FAQ, it says "By all means write new JavaScript code.", why is…
allfox
  • 103
  • 1
  • 4
9
votes
1 answer

TypeError: asm.js type error: Disabled by debugger

I'm trying to run a asm.js code in Firefox 29 but I get this warning from debugger console: TypeError: asm.js type error: Disabled by debugger Here is the code: function boo() { "use asm"; var result = 0; for (var i = 0; i <…
Afshin Mehrabani
  • 33,262
  • 29
  • 136
  • 201
8
votes
2 answers

Compile C# → LLVM → ASM.JS?

From my understanding I can compile C++ to LLVM, then use Emscripten which outputs to JavaScript. From http://kripken.github.io/mloc_emscripten_talk/#/11: C/C++ → LLVM → Emscripten → JavaScript How might I generate asm.js via Emscripten (I believe…
user34537
7
votes
1 answer

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 a very helpful error message: abort("Cannot…
imichaelmiers
  • 3,449
  • 2
  • 19
  • 25
7
votes
1 answer

How does assembly (asm.js) work in the browser?

Asm.js comes from a new category of JavaScript apps: C/C++ applications that’ve been compiled into JavaScript. It’s a subset of JavaScript that’s been spawned by Mozilla’s Emscripten project. But how does it work, and why would I use it?
Dave Voyles
  • 4,495
  • 7
  • 33
  • 44
7
votes
1 answer

Converting between int[ish] and double[ish] in asm.js

If I need to, say, find the the integer part and the fractional part of a number within an asm.js module, how do I do it? None of the standard operators convert between intish and doubleish types; even Math.floor returns a double, and its result…
ZachB
  • 13,051
  • 4
  • 61
  • 89
7
votes
2 answers

How to test and develop with asm.js?

Recently I read asm.js spec and it seems cool but is there any environment/tool to develop and test this tool or not? Is that still on spec phase only?
Afshin Mehrabani
  • 33,262
  • 29
  • 136
  • 201
6
votes
1 answer

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 candlesticks plus other lines/arrows/images…
DutchKevv
  • 1,659
  • 2
  • 22
  • 39
6
votes
1 answer

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 directory under target called…
user1935361
  • 442
  • 3
  • 15
6
votes
3 answers

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 steps, because when I do it, I get this. bitcode…
Flarp
  • 139
  • 1
  • 10
6
votes
2 answers

Emscripten Uncaught RangeError: Source is too large, multiple Float32Arrays

I'm trying to run a C++ function for 4x4 matrices multiplying. After 2 days it finally works, but not as expected. Often parameters are being fed back to the function and then this line: dataHeap2.set( new Uint8Array(data2.buffer) ); produces an…
Pawel
  • 16,093
  • 5
  • 70
  • 73
1
2
3
8 9