deno_core icon indicating copy to clipboard operation
deno_core copied to clipboard

WeakRef, FinalizationRegistry, and SharedArrayBuffer are not available during snapshotting

Open lucacasonato opened this issue 3 years ago • 4 comments

cc @bnoordhuis @piscisaureus

lucacasonato avatar Jul 02 '21 11:07 lucacasonato

Not sure. How can I test?

FinalizationRegistry is not supposed to be used during snapshotting so perhaps that's why it's not visible.

SharedArrayBuffer won't be visible when --enable_sharedarraybuffer_per_context is set but I don't think that's the case.

bnoordhuis avatar Jul 02 '21 12:07 bnoordhuis

Add this to the top of 01_core.js and compile:

  if (typeof SharedArrayBuffer === "undefined") {
    throw new TypeError("SharedArrayBuffer is not available");
  }

lucacasonato avatar Jul 02 '21 12:07 lucacasonato

FinalizationRegistry is not supposed to be used during snapshotting so perhaps that's why it's not visible.

I understand that it shouldn't be used, but I still need access to the prototype to be able to create primordials for it.

lucacasonato avatar Jul 02 '21 14:07 lucacasonato

I just tried it and FinalizationRegistry and WeakRef are there, just not SharedArrayBuffer. I'll investigate that last one.

edit: interestingly, Atomics is missing too.

bnoordhuis avatar Jul 02 '21 14:07 bnoordhuis