SharedTypedArrays are gone from SpiderMonkey

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

SharedTypedArrays are gone from SpiderMonkey

Lars Hansen
The current draft spec for JS shared memory [1] uses the existing
TypedArray types (Int32Array and so on) on SharedArrayBuffer to implement
arrays in shared memory.  SpiderMonkey, which previously had a separate
hierarchy of SharedTypedArrays (SharedInt32Array and so on) now conforms to
the spec; the separate hierarchy has been removed.  The change should show
up in a Nightly build within a day or two.

The shared memory feature is Nightly-only and anyway this will not affect
too many of you, but some will be affected:

   - those who have been experimenting with the feature in their own code
   - those who have been using Emscripten [2] to compile multi-threaded C
   and C++ to asm.js for Firefox, or running such code
   - those who maintain Emscripten

Emscripten needs to be updated (I know it will be though I don't know the
timeline for that) and multi-threaded code must be recompiled to asm.js to
continue to run in new Nightly builds.

As for the experimenters, a few changes to your programs are necessary.
There are basically two cases.  The easy one is this:

  new SharedInt32Array(sab, ...) // sab is a SharedArrayBuffer

which will need to be rewritten like this:

  new Int32Array(sab, ...)

The harder case is code like this:

  new SharedInt32Array(size) // size is the array length

which will need to be rewritten like the following, since the Int32Array
constructor will otherwise allocate an underlying ArrayBuffer, not a

  new Int32Array(new SharedArrayBuffer(size*Int32Array.BYTES_PER_ELEMENT))


dev-tech-js-engine mailing list
[hidden email]