From 7754576b8e8199fc4f30cede6399215127d23a1c Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 18 Mar 2024 07:56:34 +0900 Subject: [PATCH 1/3] Add bindings to updated ArrayBuffer, SharedArrayBuffer, and Atomics --- jscomp/others/js.ml | 9 + jscomp/others/js_array_buffer.res | 34 ++++ jscomp/others/js_atomics.res | 56 ++++++ jscomp/others/js_shared_array_buffer.res | 29 +++ jscomp/others/js_typed_array.res | 13 +- jscomp/others/js_typed_array2.res | 246 ++++++++++++++++++----- jscomp/others/release.ninja | 7 +- jscomp/runtime/js.ml | 55 +++-- jscomp/runtime/release.ninja | 6 +- lib/es6/js.js | 9 + lib/es6/js_array_buffer.js | 13 ++ lib/es6/js_atomics.js | 40 ++++ lib/es6/js_shared_array_buffer.js | 13 ++ lib/es6/js_typed_array2.js | 3 +- lib/js/js.js | 9 + lib/js/js_array_buffer.js | 11 + lib/js/js_atomics.js | 38 ++++ lib/js/js_shared_array_buffer.js | 11 + lib/js/js_typed_array2.js | 3 +- packages/artifacts.txt | 18 ++ 20 files changed, 528 insertions(+), 95 deletions(-) create mode 100644 jscomp/others/js_array_buffer.res create mode 100644 jscomp/others/js_atomics.res create mode 100644 jscomp/others/js_shared_array_buffer.res create mode 100644 lib/es6/js_array_buffer.js create mode 100644 lib/es6/js_atomics.js create mode 100644 lib/es6/js_shared_array_buffer.js create mode 100644 lib/js/js_array_buffer.js create mode 100644 lib/js/js_atomics.js create mode 100644 lib/js/js_shared_array_buffer.js diff --git a/jscomp/others/js.ml b/jscomp/others/js.ml index 7c41df8859..aeb5e3a838 100644 --- a/jscomp/others/js.ml +++ b/jscomp/others/js.ml @@ -244,12 +244,21 @@ module Math = Js_math module Obj = Js_obj (** Provide utilities for `Js.t` *) +module ArrayBuffer = Js_array_buffer +(** Provide utilities for `ArrayBuffer` object *) + +module SharedArrayBuffer = Js_shared_array_buffer +(** Provide utilities for `SharedArrayBuffer` object *) + module Typed_array = Js_typed_array (** Provide bindings for JS typed array *) module TypedArray2 = Js_typed_array2 (** Provide bindings for JS typed array *) +module Atomics = Js_atomics +(** Provide bindings for JS `Atomics` utilities *) + module Types = Js_types (** Provide utilities for manipulating JS types *) diff --git a/jscomp/others/js_array_buffer.res b/jscomp/others/js_array_buffer.res new file mode 100644 index 0000000000..8d73a8f473 --- /dev/null +++ b/jscomp/others/js_array_buffer.res @@ -0,0 +1,34 @@ +@@uncurried + +/*** +The underlying buffer that the typed arrays provide views of + +**see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) +*/ +type t = { + byteLength: int, + maxByteLength: int, + detached: bool, + resizable: bool, +} + +type makeOptions = { + maxByteLength?: int +} + +@new /** takes length. initializes elements to 0 */ +external make: (int, makeOptions) => t = "ArrayBuffer" +let make = (length, ~maxByteLength=?) => make(length, { maxByteLength: ?maxByteLength }) + +/* ArrayBuffer.isView: seems pointless with a type system */ + +@get external byteLength: t => int = "byteLength" +@get external maxByteLength: t => int = "maxByteLength" +@get external detached: t => bool = "detached" +@get external resizable: t => bool = "resizable" + +@send external slice: (t, ~start: int, ~end_: int) => t = "slice" +@send external sliceFrom: (t, int) => t = "slice" + +@send external transfer: (t, ~newByteLength: int=?) => t = "transfer" +@send external transferToFixedLength: (t, ~newByteLength: int=?) => t = "transferToFixedLength" diff --git a/jscomp/others/js_atomics.res b/jscomp/others/js_atomics.res new file mode 100644 index 0000000000..70259643b2 --- /dev/null +++ b/jscomp/others/js_atomics.res @@ -0,0 +1,56 @@ +@@uncurried + +@scope("Atomics") external isLockFree: int => bool = "isLockFree" + +module MakeOps = (TA: Js_typed_array2.S) => { + @scope("Atomics") external add: (TA.t, int, int) => TA.elt = "add" + @scope("Atomics") external sub: (TA.t, int, int) => TA.elt = "sub" + @scope("Atomics") external and_: (TA.t, int, int) => TA.elt = "and" + @scope("Atomics") external or_: (TA.t, int, int) => TA.elt = "or" + @scope("Atomics") external xor: (TA.t, int, int) => TA.elt = "xor" + @scope("Atomics") external load: (TA.t, ~index: int) => TA.elt = "load" + @scope("Atomics") external store: (TA.t, ~index: int, ~value: TA.elt) => TA.elt = "store" + @scope("Atomics") external exchange: (TA.t, ~index: int, ~value: TA.elt) => TA.elt = "exchange" + @scope("Atomics") external compareExchange: (TA.t, ~index: int, ~expectedValue: TA.elt, ~replacementValue: TA.elt) => TA.elt = "compareExchange" +} + +module MakeFutex = (TA: Js_typed_array2.S) => { + // These operations are supported only when TA is Int32Array or BigInt64Array, and also underlying buffer is SharedArrayBuffer + + @scope("Atomics") external wait: (TA.t, ~index: int, ~value: TA.elt) => [#ok | #"not-equal"] = "wait" + @scope("Atomics") external waitWithTimeout: (TA.t, ~index: int, ~value: TA.elt, ~timeout: int) => [#ok | #"not-equal" | #"timed-out"] = "wait" + + @scope("Atomics") external waitAsync: (TA.t, ~index: int, ~value: TA.elt) => promise<[#ok | #"not-equal"]> = "waitAsync" + @scope("Atomics") external waitAsyncWithTimeout: (TA.t, ~index: int, ~value: TA.elt, ~timeout: int) => promise<[#ok | #"not-equal" | #"timed-out"]> = "waitAsync" + + @scope("Atomics") external notify: (TA.t, ~index: int) => int = "notify" + @scope("Atomics") external notifyForCount: (TA.t, ~index: int, ~count: int) => int = "notify" +} + +module Int8Array = MakeOps(Js_typed_array2.Int8Array) + +module Uint8Array = MakeOps(Js_typed_array2.Uint8Array) + +module Int16Array = MakeOps(Js_typed_array2.Int16Array) + +module Uint16Array = MakeOps(Js_typed_array2.Uint16Array) + +module Int32Array = { + include MakeOps(Js_typed_array2.Int32Array) + include MakeFutex(Js_typed_array2.Int32Array) +} + +module Uint32Array = MakeOps(Js_typed_array2.Uint32Array) + +/** TODO: uncomment this when ready +module BigInt64Array = { + include MakeOps(Js_typed_array2.BigInt64Array) + include MakeFutex(Js_typed_array2.BigInt64Array) +} + +module BigUint64Array = MakeOps(Js_typed_array2.BigUint64Array) +*/ + +module Float32Array = MakeOps(Js_typed_array2.Float32Array) + +module Float64Array = MakeOps(Js_typed_array2.Float64Array) diff --git a/jscomp/others/js_shared_array_buffer.res b/jscomp/others/js_shared_array_buffer.res new file mode 100644 index 0000000000..73669e113a --- /dev/null +++ b/jscomp/others/js_shared_array_buffer.res @@ -0,0 +1,29 @@ +@@uncurried + +/*** +The underlying buffer that the typed arrays provide views of + +**see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) +*/ +type t = { + byteLength: int, + maxByteLength: int, + growable: bool, +} + +type makeOptions = { + maxByteLength?: int +} + +@new /** takes length. initializes elements to 0 */ +external make: (int, makeOptions) => t = "SharedArrayBuffer" +let make = (length, ~maxByteLength=?) => make(length, { maxByteLength: ?maxByteLength }) + +/* ArrayBuffer.isView: seems pointless with a type system */ + +@get external byteLength: t => int = "byteLength" +@get external maxByteLength: t => int = "maxByteLength" +@get external growable: t => bool = "growable" + +@send external slice: (t, ~start: int, ~end_: int) => t = "slice" +@send external sliceFrom: (t, int) => t = "slice" diff --git a/jscomp/others/js_typed_array.res b/jscomp/others/js_typed_array.res index 21b010b1a0..8bab4e68cf 100644 --- a/jscomp/others/js_typed_array.res +++ b/jscomp/others/js_typed_array.res @@ -59,11 +59,13 @@ module ArrayBuffer = { @bs.send.pipe(: t) external slice: (~start: int, ~end_: int) => array_buffer = "slice" /* FIXME */ @bs.send.pipe(: t) external sliceFrom: int => array_buffer = "slice" } + +type typed_array<'a> + module type S = { /*** Implements functionality common to all the typed arrays */ type elt - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -173,7 +175,6 @@ module type S = { module Int8Array = { /** */ type elt = int - type typed_array<'a> = Js_typed_array2.Int8Array.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -296,7 +297,6 @@ module Int8Array = { module Uint8Array = { /** */ type elt = int - type typed_array<'a> = Js_typed_array2.Uint8Array.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -419,7 +419,6 @@ module Uint8Array = { module Uint8ClampedArray = { /** */ type elt = int - type typed_array<'a> = Js_typed_array2.Uint8ClampedArray.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -542,7 +541,6 @@ module Uint8ClampedArray = { module Int16Array = { /** */ type elt = int - type typed_array<'a> = Js_typed_array2.Int16Array.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -665,7 +663,6 @@ module Int16Array = { module Uint16Array = { /** */ type elt = int - type typed_array<'a> = Js_typed_array2.Uint16Array.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -788,7 +785,6 @@ module Uint16Array = { module Int32Array = { /** */ type elt = int - type typed_array<'a> = Js_typed_array2.Int32Array.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -914,7 +910,6 @@ module Int32_array = Int32Array module Uint32Array = { /** */ type elt = int - type typed_array<'a> = Js_typed_array2.Uint32Array.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -1040,7 +1035,6 @@ module Uint32Array = { module Float32Array = { /** */ type elt = float - type typed_array<'a> = Js_typed_array2.Float32Array.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @@ -1167,7 +1161,6 @@ module Float32_array = Float32Array module Float64Array = { /** */ type elt = float - type typed_array<'a> = Js_typed_array2.Float64Array.typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" diff --git a/jscomp/others/js_typed_array2.res b/jscomp/others/js_typed_array2.res index 93bae0e0bc..e237cff4cc 100644 --- a/jscomp/others/js_typed_array2.res +++ b/jscomp/others/js_typed_array2.res @@ -28,31 +28,21 @@ JavaScript Typed Array API **see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) */ -type array_buffer -type array_like<'a> /* should be shared with js_array */ +type array_buffer = Js_array_buffer.t +type shared_array_buffer = Js_shared_array_buffer.t -module ArrayBuffer = { - /*** - The underlying buffer that the typed arrays provide views of - - **see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) - */ +type array_like<'a> = Js_array2.array_like<'a> - type t = array_buffer - - @new /** takes length. initializes elements to 0 */ - external make: int => t = "ArrayBuffer" - - /* ArrayBuffer.isView: seems pointless with a type system */ - /* experimental - external transfer : array_buffer -> t = "ArrayBuffer.transfer" [@@bs.val] - external transferWithLength : array_buffer -> int -> t = "ArrayBuffer.transfer" [@@bs.val] - */ +@depreacted("Use `Js.ArrayBuffer` instead.") +module ArrayBuffer = { + include Js_array_buffer +} - @get external byteLength: t => int = "byteLength" +type typed_array<'a> - @send external slice: (t, ~start: int, ~end_: int) => array_buffer = "slice" - @send external sliceFrom: (t, int) => array_buffer = "slice" +module type S = { + type elt + type t = typed_array } /* commented out until bs has a plan for iterators @@ -62,13 +52,14 @@ module ArrayBuffer = { module Int8Array = { /** */ type elt = int - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -157,9 +148,9 @@ module Int8Array = { @val external _BYTES_PER_ELEMENT: int = "Int8Array.BYTES_PER_ELEMENT" @new external make: array => t = "Int8Array" + @new /** can throw */ external fromBuffer: array_buffer => t = "Int8Array" - @new /** **raise** Js.Exn.Error raise Js exception @@ -167,7 +158,6 @@ module Int8Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Int8Array" - @new /** **raise** Js.Exn.Error raises Js exception @@ -176,6 +166,23 @@ module Int8Array = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int8Array" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Int8Array" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Int8Array" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Int8Array" + @new external fromLength: int => t = "Int8Array" @val external from: array_like => t = "Int8Array.from" /* *Array.of is redundant, use make */ @@ -184,13 +191,14 @@ module Int8Array = { module Uint8Array = { /** */ type elt = int - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -279,9 +287,9 @@ module Uint8Array = { @val external _BYTES_PER_ELEMENT: int = "Uint8Array.BYTES_PER_ELEMENT" @new external make: array => t = "Uint8Array" + @new /** can throw */ external fromBuffer: array_buffer => t = "Uint8Array" - @new /** **raise** Js.Exn.Error raise Js exception @@ -289,7 +297,6 @@ module Uint8Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Uint8Array" - @new /** **raise** Js.Exn.Error raises Js exception @@ -298,6 +305,23 @@ module Uint8Array = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint8Array" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Uint8Array" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromShraedBufferOffset: (shared_array_buffer, int) => t = "Uint8Array" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Uint8Array" + @new external fromLength: int => t = "Uint8Array" @val external from: array_like => t = "Uint8Array.from" /* *Array.of is redundant, use make */ @@ -306,13 +330,14 @@ module Uint8Array = { module Uint8ClampedArray = { /** */ type elt = int - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -401,9 +426,9 @@ module Uint8ClampedArray = { @val external _BYTES_PER_ELEMENT: int = "Uint8ClampedArray.BYTES_PER_ELEMENT" @new external make: array => t = "Uint8ClampedArray" + @new /** can throw */ external fromBuffer: array_buffer => t = "Uint8ClampedArray" - @new /** **raise** Js.Exn.Error raise Js exception @@ -411,7 +436,6 @@ module Uint8ClampedArray = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Uint8ClampedArray" - @new /** **raise** Js.Exn.Error raises Js exception @@ -420,6 +444,23 @@ module Uint8ClampedArray = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint8ClampedArray" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Uint8ClampedArray" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Uint8ClampedArray" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Uint8ClampedArray" + @new external fromLength: int => t = "Uint8ClampedArray" @val external from: array_like => t = "Uint8ClampedArray.from" /* *Array.of is redundant, use make */ @@ -428,13 +469,14 @@ module Uint8ClampedArray = { module Int16Array = { /** */ type elt = int - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -523,9 +565,9 @@ module Int16Array = { @val external _BYTES_PER_ELEMENT: int = "Int16Array.BYTES_PER_ELEMENT" @new external make: array => t = "Int16Array" + @new /** can throw */ external fromBuffer: array_buffer => t = "Int16Array" - @new /** **raise** Js.Exn.Error raise Js exception @@ -533,7 +575,6 @@ module Int16Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Int16Array" - @new /** **raise** Js.Exn.Error raises Js exception @@ -542,6 +583,23 @@ module Int16Array = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int16Array" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Int16Array" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Int16Array" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Int16Array" + @new external fromLength: int => t = "Int16Array" @val external from: array_like => t = "Int16Array.from" /* *Array.of is redundant, use make */ @@ -550,13 +608,14 @@ module Int16Array = { module Uint16Array = { /** */ type elt = int - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -645,9 +704,9 @@ module Uint16Array = { @val external _BYTES_PER_ELEMENT: int = "Uint16Array.BYTES_PER_ELEMENT" @new external make: array => t = "Uint16Array" + @new /** can throw */ external fromBuffer: array_buffer => t = "Uint16Array" - @new /** **raise** Js.Exn.Error raise Js exception @@ -655,7 +714,6 @@ module Uint16Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Uint16Array" - @new /** **raise** Js.Exn.Error raises Js exception @@ -664,6 +722,23 @@ module Uint16Array = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint16Array" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Uint16Array" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Uint16Array" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Uint16Array" + @new external fromLength: int => t = "Uint16Array" @val external from: array_like => t = "Uint16Array.from" /* *Array.of is redundant, use make */ @@ -672,13 +747,14 @@ module Uint16Array = { module Int32Array = { /** */ type elt = int - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -767,9 +843,9 @@ module Int32Array = { @val external _BYTES_PER_ELEMENT: int = "Int32Array.BYTES_PER_ELEMENT" @new external make: array => t = "Int32Array" + @new /** can throw */ external fromBuffer: array_buffer => t = "Int32Array" - @new /** **raise** Js.Exn.Error raise Js exception @@ -777,7 +853,6 @@ module Int32Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Int32Array" - @new /** **raise** Js.Exn.Error raises Js exception @@ -786,6 +861,23 @@ module Int32Array = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int32Array" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Int32Array" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Int32Array" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Int32Array" + @new external fromLength: int => t = "Int32Array" @val external from: array_like => t = "Int32Array.from" /* *Array.of is redundant, use make */ @@ -794,13 +886,14 @@ module Int32Array = { module Uint32Array = { /** */ type elt = int - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -889,9 +982,9 @@ module Uint32Array = { @val external _BYTES_PER_ELEMENT: int = "Uint32Array.BYTES_PER_ELEMENT" @new external make: array => t = "Uint32Array" + @new /** can throw */ external fromBuffer: array_buffer => t = "Uint32Array" - @new /** **raise** Js.Exn.Error raise Js exception @@ -899,7 +992,6 @@ module Uint32Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Uint32Array" - @new /** **raise** Js.Exn.Error raises Js exception @@ -908,6 +1000,23 @@ module Uint32Array = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint32Array" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Uint32Array" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Uint32Array" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Uint32Array" + @new external fromLength: int => t = "Uint32Array" @val external from: array_like => t = "Uint32Array.from" /* *Array.of is redundant, use make */ @@ -919,13 +1028,14 @@ module Uint32Array = { module Float32Array = { /** */ type elt = float - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -1014,9 +1124,9 @@ module Float32Array = { @val external _BYTES_PER_ELEMENT: int = "Float32Array.BYTES_PER_ELEMENT" @new external make: array => t = "Float32Array" + @new /** can throw */ external fromBuffer: array_buffer => t = "Float32Array" - @new /** **raise** Js.Exn.Error raise Js exception @@ -1024,7 +1134,6 @@ module Float32Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Float32Array" - @new /** **raise** Js.Exn.Error raises Js exception @@ -1033,6 +1142,23 @@ module Float32Array = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Float32Array" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Float32Array" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Float32Array" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Float32Array" + @new external fromLength: int => t = "Float32Array" @val external from: array_like => t = "Float32Array.from" /* *Array.of is redundant, use make */ @@ -1041,13 +1167,14 @@ module Float32Array = { module Float64Array = { /** */ type elt = float - type typed_array<'a> type t = typed_array @get_index external unsafe_get: (t, int) => elt = "" @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -1136,9 +1263,9 @@ module Float64Array = { @val external _BYTES_PER_ELEMENT: int = "Float64Array.BYTES_PER_ELEMENT" @new external make: array => t = "Float64Array" + @new /** can throw */ external fromBuffer: array_buffer => t = "Float64Array" - @new /** **raise** Js.Exn.Error raise Js exception @@ -1146,7 +1273,6 @@ module Float64Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Float64Array" - @new /** **raise** Js.Exn.Error raises Js exception @@ -1155,6 +1281,23 @@ module Float64Array = { */ external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Float64Array" + @new /** can throw */ + external fromSharedBuffer: shared_array_buffer => t = "Float64Array" + @new + /** + **raise** Js.Exn.Error raise Js exception + + **param** offset is in bytes + */ + external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Float64Array" + @new + /** + **raise** Js.Exn.Error raises Js exception + + **param** offset is in bytes, length in elements + */ + external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Float64Array" + @new external fromLength: int => t = "Float64Array" @val external from: array_like => t = "Float64Array.from" /* *Array.of is redundant, use make */ @@ -1170,11 +1313,18 @@ module DataView = { type t @new external make: array_buffer => t = "DataView" + @new external fromBuffer: array_buffer => t = "DataView" @new external fromBufferOffset: (array_buffer, int) => t = "DataView" @new external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "DataView" + @new external fromSharedBuffer: shared_array_buffer => t = "DataView" + @new external fromSharedBufferOffset: (shared_array_buffer, int) => t = "DataView" + @new external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "DataView" + @get external buffer: t => array_buffer = "buffer" + @get external sharedBuffer: t => shared_array_buffer = "buffer" + @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" diff --git a/jscomp/others/release.ninja b/jscomp/others/release.ninja index 116df80fef..ee0eb9b55e 100644 --- a/jscomp/others/release.ninja +++ b/jscomp/others/release.ninja @@ -18,6 +18,8 @@ o others/belt_internals.cmi : cc others/belt_internals.resi | $bsc o others/js_OO.cmi others/js_OO.cmj : cc others/js_OO.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_array.cmi others/js_array.cmj : cc others/js_array.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj $bsc o others/js_array2.cmi others/js_array2.cmj : cc others/js_array2.res | others/belt_internals.cmi others/js.cmi $bsc +o others/js_array_buffer.cmi others/js_array_buffer.cmj : cc others/js_array_buffer.res | others/belt_internals.cmi others/js.cmi $bsc +o others/js_atomics.cmi others/js_atomics.cmj : cc others/js_atomics.res | others/belt_internals.cmi others/js.cmi others/js_typed_array2.cmj $bsc o others/js_bigint.cmi others/js_bigint.cmj : cc others/js_bigint.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_blob.cmi others/js_blob.cmj : cc others/js_blob.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_cast.cmj : cc_cmi others/js_cast.res | others/belt_internals.cmi others/js.cmi others/js_cast.cmi $bsc @@ -53,10 +55,11 @@ o others/js_re.cmi others/js_re.cmj : cc others/js_re.res | others/belt_internal o others/js_result.cmj : cc_cmi others/js_result.res | others/belt_internals.cmi others/js.cmi others/js_result.cmi $bsc o others/js_result.cmi : cc others/js_result.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_set.cmi others/js_set.cmj : cc others/js_set.res | others/belt_internals.cmi others/js.cmi $bsc +o others/js_shared_array_buffer.cmi others/js_shared_array_buffer.cmj : cc others/js_shared_array_buffer.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_string.cmi others/js_string.cmj : cc others/js_string.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_re.cmj $bsc o others/js_string2.cmi others/js_string2.cmj : cc others/js_string2.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_re.cmj $bsc o others/js_typed_array.cmi others/js_typed_array.cmj : cc others/js_typed_array.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_typed_array2.cmj $bsc -o others/js_typed_array2.cmi others/js_typed_array2.cmj : cc others/js_typed_array2.res | others/belt_internals.cmi others/js.cmi others/js.cmj $bsc +o others/js_typed_array2.cmi others/js_typed_array2.cmj : cc others/js_typed_array2.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_array2.cmj others/js_array_buffer.cmj others/js_shared_array_buffer.cmj $bsc o others/js_types.cmj : cc_cmi others/js_types.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_bigint.cmj others/js_null.cmj others/js_types.cmi $bsc o others/js_types.cmi : cc others/js_types.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_undefined.cmj : cc_cmi others/js_undefined.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_exn.cmj others/js_undefined.cmi $bsc @@ -74,7 +77,7 @@ o others/jsxEventU.cmi others/jsxEventU.cmj : cc others/jsxEventU.res | others/b o others/jsxPPXReactSupportC.cmi others/jsxPPXReactSupportC.cmj : cc others/jsxPPXReactSupportC.res | others/belt_internals.cmi others/js.cmi others/jsxC.cmj $bsc o others/jsxPPXReactSupportU.cmi others/jsxPPXReactSupportU.cmj : cc others/jsxPPXReactSupportU.res | others/belt_internals.cmi others/js.cmi others/jsxU.cmj $bsc o others/jsxU.cmi others/jsxU.cmj : cc others/jsxU.res | others/belt_internals.cmi others/js.cmi $bsc -o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_blob.cmi others/js_blob.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_file.cmi others/js_file.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_map.cmi others/js_map.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_promise2.cmi others/js_promise2.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_set.cmi others/js_set.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/js_weakmap.cmi others/js_weakmap.cmj others/js_weakset.cmi others/js_weakset.cmj others/jsxC.cmi others/jsxC.cmj others/jsxDOMC.cmi others/jsxDOMC.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxDOMU.cmi others/jsxDOMU.cmj others/jsxEventC.cmi others/jsxEventC.cmj others/jsxEventU.cmi others/jsxEventU.cmj others/jsxPPXReactSupportC.cmi others/jsxPPXReactSupportC.cmj others/jsxPPXReactSupportU.cmi others/jsxPPXReactSupportU.cmj others/jsxU.cmi others/jsxU.cmj +o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_array_buffer.cmi others/js_array_buffer.cmj others/js_atomics.cmi others/js_atomics.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_blob.cmi others/js_blob.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_file.cmi others/js_file.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_map.cmi others/js_map.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_promise2.cmi others/js_promise2.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_set.cmi others/js_set.cmj others/js_shared_array_buffer.cmi others/js_shared_array_buffer.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/js_weakmap.cmi others/js_weakmap.cmj others/js_weakset.cmi others/js_weakset.cmj others/jsxC.cmi others/jsxC.cmj others/jsxDOMC.cmi others/jsxDOMC.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxDOMU.cmi others/jsxDOMU.cmj others/jsxEventC.cmi others/jsxEventC.cmj others/jsxEventU.cmi others/jsxEventU.cmj others/jsxPPXReactSupportC.cmi others/jsxPPXReactSupportC.cmj others/jsxPPXReactSupportU.cmi others/jsxPPXReactSupportU.cmj others/jsxU.cmi others/jsxU.cmj o others/belt_Array.cmj : cc_cmi others/belt_Array.res | others/belt.cmi others/belt_Array.cmi others/belt_internals.cmi others/js.cmi others/js.cmj others/js_math.cmj $bsc js_pkg o others/belt_Array.cmi : cc others/belt_Array.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg o others/belt_Float.cmj : cc_cmi others/belt_Float.res | others/belt.cmi others/belt_Float.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg diff --git a/jscomp/runtime/js.ml b/jscomp/runtime/js.ml index d92826849f..19ec786722 100644 --- a/jscomp/runtime/js.ml +++ b/jscomp/runtime/js.ml @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -[@@@bs.config {flags = [|"-unboxed-types";"-w" ;"-49"|]}] +[@@@bs.config {flags = [|"-unboxed-types"; "-w"; "-49"|]}] (* DESIGN: - It does not have any code, all its code will be inlined so that there will never be @@ -42,44 +42,38 @@ *) (**/**) -(** Types for JS objects *) + type 'a t = < .. > as 'a +(** Types for JS objects *) module MapperRt = Js_mapperRt -module Internal = struct +module Internal = struct external opaqueFullApply : 'a -> 'a = "%uncurried_apply" (* Use opaque instead of [._n] to prevent some optimizations happening *) - external run : (unit -> 'a [@bs]) -> 'a = "#run" + external run : ((unit -> 'a)[@bs]) -> 'a = "#run" external opaque : 'a -> 'a = "%opaque" +end -end (**/**) - -type + 'a null = - | Value of 'a - | Null [@as null] -[@@unboxed] (** nullable, value of this type can be either [null] or ['a] this type is the same as type [t] in {!Null} *) +type +'a null = Value of 'a | Null [@as null] [@@unboxed] -type + 'a undefined +type +'a undefined (** value of this type can be either [undefined] or ['a] this type is the same as type [t] in {!Undefined} *) -type + 'a nullable = - | Value of 'a - | Null [@as null] - | Undefined [@as undefined] -[@@unboxed] (** value of this type can be [undefined], [null] or ['a] this type is the same as type [t] n {!Null_undefined} *) +type +'a nullable = Value of 'a | Null [@as null] | Undefined [@as undefined] +[@@unboxed] -type + 'a null_undefined = 'a nullable +type +'a null_undefined = 'a nullable -external toOption : 'a nullable -> 'a option = "#nullable_to_opt" +external toOption : 'a nullable -> 'a option = "#nullable_to_opt" external undefinedToOption : 'a undefined -> 'a option = "#undefined_to_opt" external nullToOption : 'a null -> 'a option = "#null_to_opt" @@ -87,9 +81,8 @@ external isNullable : 'a nullable -> bool = "#is_nullable" external import : 'a -> 'a promise = "#import" -(** The same as {!test} except that it is more permissive on the types of input *) external testAny : 'a -> bool = "#is_nullable" - +(** The same as {!test} except that it is more permissive on the types of input *) type (+'a, +'e) promise (** The promise type, defined here for interoperation across packages @@ -102,8 +95,6 @@ external null : 'a null = "#null" external undefined : 'a undefined = "#undefined" (** The same as [empty] {!Js.Undefined} will be compiled as [undefined]*) - - external typeof : 'a -> string = "#typeof" (** [typeof x] will be compiled as [typeof x] in JS Please consider functions in {!Types} for a type safe way of reflection @@ -113,10 +104,8 @@ external log : 'a -> unit = "log" [@@val] [@@scope "console"] (** A convenience function to log everything *) -external log2 : 'a -> 'b -> unit = "log" -[@@bs.val] [@@bs.scope "console"] -external log3 : 'a -> 'b -> 'c -> unit = "log" -[@@bs.val] [@@bs.scope "console"] +external log2 : 'a -> 'b -> unit = "log" [@@bs.val] [@@bs.scope "console"] +external log3 : 'a -> 'b -> 'c -> unit = "log" [@@bs.val] [@@bs.scope "console"] external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log" [@@bs.val] [@@bs.scope "console"] @@ -136,13 +125,11 @@ external unsafe_lt : 'a -> 'a -> bool = "#unsafe_lt" to give a proper semantics for comparision which applies to any type *) - external unsafe_le : 'a -> 'a -> bool = "#unsafe_le" (** [unsafe_le a b] will be compiled as [a <= b]. See also {!unsafe_lt} *) - external unsafe_gt : 'a -> 'a -> bool = "#unsafe_gt" (** [unsafe_gt a b] will be compiled as [a > b]. See also {!unsafe_lt} @@ -153,7 +140,6 @@ external unsafe_ge : 'a -> 'a -> bool = "#unsafe_ge" See also {!unsafe_lt} *) - (** {12 nested modules}*) module Null = Js_null @@ -207,15 +193,24 @@ module Json = Js_json module Math = Js_math (** Provide bindings for JS [Math] object *) -module Obj = Js_obj +module Obj = Js_obj (** Provide utilities for {!Js.t} *) +module ArrayBuffer = Js_array_buffer +(** Provide utilities for `ArrayBuffer` object *) + +module SharedArrayBuffer = Js_shared_array_buffer +(** Provide utilities for `SharedArrayBuffer` object *) + module Typed_array = Js_typed_array (** Provide bindings for JS typed array *) module TypedArray2 = Js_typed_array2 (** Provide bindings for JS typed array *) +module Atomics = Js_atomics +(** Provide bindings for JS `Atomics` utilities *) + module Types = Js_types (** Provide utilities for manipulating JS types *) diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja index 864f9c5a77..ea8ecb3b33 100644 --- a/jscomp/runtime/release.ninja +++ b/jscomp/runtime/release.ninja @@ -23,7 +23,7 @@ o runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.res | runtime/cam o runtime/caml_exceptions.cmi : cc runtime/caml_exceptions.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_float.cmj : cc_cmi runtime/caml_float.res | runtime/caml_float.cmi runtime/caml_float_extern.cmj o runtime/caml_float.cmi : cc runtime/caml_float.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj +o runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj o runtime/caml_format.cmi : cc runtime/caml_format.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_hash.cmj : cc_cmi runtime/caml_hash.res | runtime/caml_hash.cmi runtime/caml_hash_primitive.cmj runtime/caml_nativeint_extern.cmj runtime/js.cmj o runtime/caml_hash.cmi : cc runtime/caml_hash.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj @@ -39,7 +39,7 @@ o runtime/caml_md5.cmj : cc_cmi runtime/caml_md5.res | runtime/caml_array_extern o runtime/caml_md5.cmi : cc runtime/caml_md5.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_module.cmj : cc_cmi runtime/caml_module.res | runtime/caml_array_extern.cmj runtime/caml_module.cmi runtime/caml_obj.cmj o runtime/caml_module.cmi : cc runtime/caml_module.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_obj.cmj : cc_cmi runtime/caml_obj.res | runtime/caml.cmj runtime/caml_array_extern.cmj runtime/caml_obj.cmi runtime/caml_option.cmj runtime/js.cmj +o runtime/caml_obj.cmj : cc_cmi runtime/caml_obj.res | runtime/caml_array_extern.cmj runtime/caml_obj.cmi runtime/caml_option.cmj runtime/js.cmj o runtime/caml_obj.cmi : cc runtime/caml_obj.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_option.cmj : cc_cmi runtime/caml_option.res | runtime/caml_option.cmi runtime/caml_undefined_extern.cmj runtime/js.cmj o runtime/caml_option.cmi : cc runtime/caml_option.resi | runtime/bs_stdlib_mini.cmi runtime/caml_undefined_extern.cmj runtime/js.cmi runtime/js.cmj @@ -55,7 +55,7 @@ o runtime/caml_array_extern.cmi runtime/caml_array_extern.cmj : cc runtime/caml_ o runtime/caml_external_polyfill.cmi runtime/caml_external_polyfill.cmj : cc runtime/caml_external_polyfill.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_float_extern.cmi runtime/caml_float_extern.cmj : cc runtime/caml_float_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_int64_extern.cmi runtime/caml_int64_extern.cmj : cc runtime/caml_int64_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj -o runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj : cc runtime/caml_js_exceptions.res | runtime/bs_stdlib_mini.cmi runtime/caml_exceptions.cmj runtime/caml_option.cmj runtime/js.cmi runtime/js.cmj +o runtime/caml_js_exceptions.cmi runtime/caml_js_exceptions.cmj : cc runtime/caml_js_exceptions.res | runtime/bs_stdlib_mini.cmi runtime/caml_exceptions.cmj runtime/js.cmi runtime/js.cmj o runtime/caml_nativeint_extern.cmi runtime/caml_nativeint_extern.cmj : cc runtime/caml_nativeint_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_string_extern.cmi runtime/caml_string_extern.cmj : cc runtime/caml_string_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj o runtime/caml_undefined_extern.cmi runtime/caml_undefined_extern.cmj : cc runtime/caml_undefined_extern.res | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj diff --git a/lib/es6/js.js b/lib/es6/js.js index bdf0d39a2b..0c5c1b0525 100644 --- a/lib/es6/js.js +++ b/lib/es6/js.js @@ -41,10 +41,16 @@ var $$Math; var Obj; +var $$ArrayBuffer; + +var SharedArrayBuffer; + var Typed_array; var TypedArray2; +var $$Atomics; + var Types; var Float; @@ -96,8 +102,11 @@ export { Json , $$Math , Obj , + $$ArrayBuffer , + SharedArrayBuffer , Typed_array , TypedArray2 , + $$Atomics , Types , Float , Int , diff --git a/lib/es6/js_array_buffer.js b/lib/es6/js_array_buffer.js new file mode 100644 index 0000000000..370b1e4116 --- /dev/null +++ b/lib/es6/js_array_buffer.js @@ -0,0 +1,13 @@ + + + +function make(length, maxByteLength) { + return new ArrayBuffer(length, { + maxByteLength: maxByteLength + }); +} + +export { + make , +} +/* No side effect */ diff --git a/lib/es6/js_atomics.js b/lib/es6/js_atomics.js new file mode 100644 index 0000000000..e4de6df701 --- /dev/null +++ b/lib/es6/js_atomics.js @@ -0,0 +1,40 @@ + + + +function MakeOps(TA) { + return {}; +} + +function MakeFutex(TA) { + return {}; +} + +var $$Int8Array = {}; + +var $$Uint8Array = {}; + +var $$Int16Array = {}; + +var $$Uint16Array = {}; + +var $$Int32Array = {}; + +var $$Uint32Array = {}; + +var $$Float32Array = {}; + +var $$Float64Array = {}; + +export { + MakeOps , + MakeFutex , + $$Int8Array , + $$Uint8Array , + $$Int16Array , + $$Uint16Array , + $$Int32Array , + $$Uint32Array , + $$Float32Array , + $$Float64Array , +} +/* No side effect */ diff --git a/lib/es6/js_shared_array_buffer.js b/lib/es6/js_shared_array_buffer.js new file mode 100644 index 0000000000..24556578a8 --- /dev/null +++ b/lib/es6/js_shared_array_buffer.js @@ -0,0 +1,13 @@ + + + +function make(length, maxByteLength) { + return new SharedArrayBuffer(length, { + maxByteLength: maxByteLength + }); +} + +export { + make , +} +/* No side effect */ diff --git a/lib/es6/js_typed_array2.js b/lib/es6/js_typed_array2.js index dc062b00a1..0435de254c 100644 --- a/lib/es6/js_typed_array2.js +++ b/lib/es6/js_typed_array2.js @@ -1,7 +1,8 @@ +import * as Js_array_buffer from "./js_array_buffer.js"; -var $$ArrayBuffer = {}; +var $$ArrayBuffer = Js_array_buffer; var $$Int8Array = {}; diff --git a/lib/js/js.js b/lib/js/js.js index 02aee0d3ba..2943f63934 100644 --- a/lib/js/js.js +++ b/lib/js/js.js @@ -41,10 +41,16 @@ var $$Math; var Obj; +var $$ArrayBuffer; + +var SharedArrayBuffer; + var Typed_array; var TypedArray2; +var $$Atomics; + var Types; var Float; @@ -95,8 +101,11 @@ exports.Global = Global; exports.Json = Json; exports.$$Math = $$Math; exports.Obj = Obj; +exports.$$ArrayBuffer = $$ArrayBuffer; +exports.SharedArrayBuffer = SharedArrayBuffer; exports.Typed_array = Typed_array; exports.TypedArray2 = TypedArray2; +exports.$$Atomics = $$Atomics; exports.Types = Types; exports.Float = Float; exports.Int = Int; diff --git a/lib/js/js_array_buffer.js b/lib/js/js_array_buffer.js new file mode 100644 index 0000000000..386a49df21 --- /dev/null +++ b/lib/js/js_array_buffer.js @@ -0,0 +1,11 @@ +'use strict'; + + +function make(length, maxByteLength) { + return new ArrayBuffer(length, { + maxByteLength: maxByteLength + }); +} + +exports.make = make; +/* No side effect */ diff --git a/lib/js/js_atomics.js b/lib/js/js_atomics.js new file mode 100644 index 0000000000..39e1daf5e8 --- /dev/null +++ b/lib/js/js_atomics.js @@ -0,0 +1,38 @@ +'use strict'; + + +function MakeOps(TA) { + return {}; +} + +function MakeFutex(TA) { + return {}; +} + +var $$Int8Array = {}; + +var $$Uint8Array = {}; + +var $$Int16Array = {}; + +var $$Uint16Array = {}; + +var $$Int32Array = {}; + +var $$Uint32Array = {}; + +var $$Float32Array = {}; + +var $$Float64Array = {}; + +exports.MakeOps = MakeOps; +exports.MakeFutex = MakeFutex; +exports.$$Int8Array = $$Int8Array; +exports.$$Uint8Array = $$Uint8Array; +exports.$$Int16Array = $$Int16Array; +exports.$$Uint16Array = $$Uint16Array; +exports.$$Int32Array = $$Int32Array; +exports.$$Uint32Array = $$Uint32Array; +exports.$$Float32Array = $$Float32Array; +exports.$$Float64Array = $$Float64Array; +/* No side effect */ diff --git a/lib/js/js_shared_array_buffer.js b/lib/js/js_shared_array_buffer.js new file mode 100644 index 0000000000..d6d812e614 --- /dev/null +++ b/lib/js/js_shared_array_buffer.js @@ -0,0 +1,11 @@ +'use strict'; + + +function make(length, maxByteLength) { + return new SharedArrayBuffer(length, { + maxByteLength: maxByteLength + }); +} + +exports.make = make; +/* No side effect */ diff --git a/lib/js/js_typed_array2.js b/lib/js/js_typed_array2.js index 73050c540d..d319a0056d 100644 --- a/lib/js/js_typed_array2.js +++ b/lib/js/js_typed_array2.js @@ -1,7 +1,8 @@ 'use strict'; +var Js_array_buffer = require("./js_array_buffer.js"); -var $$ArrayBuffer = {}; +var $$ArrayBuffer = Js_array_buffer; var $$Int8Array = {}; diff --git a/packages/artifacts.txt b/packages/artifacts.txt index 0fbc2e7676..ad145bfdca 100644 --- a/packages/artifacts.txt +++ b/packages/artifacts.txt @@ -111,6 +111,8 @@ lib/es6/js.js lib/es6/js_OO.js lib/es6/js_array.js lib/es6/js_array2.js +lib/es6/js_array_buffer.js +lib/es6/js_atomics.js lib/es6/js_bigint.js lib/es6/js_blob.js lib/es6/js_cast.js @@ -136,6 +138,7 @@ lib/es6/js_promise2.js lib/es6/js_re.js lib/es6/js_result.js lib/es6/js_set.js +lib/es6/js_shared_array_buffer.js lib/es6/js_string.js lib/es6/js_string2.js lib/es6/js_typed_array.js @@ -274,6 +277,8 @@ lib/js/js.js lib/js/js_OO.js lib/js/js_array.js lib/js/js_array2.js +lib/js/js_array_buffer.js +lib/js/js_atomics.js lib/js/js_bigint.js lib/js/js_blob.js lib/js/js_cast.js @@ -299,6 +304,7 @@ lib/js/js_promise2.js lib/js/js_re.js lib/js/js_result.js lib/js/js_set.js +lib/js/js_shared_array_buffer.js lib/js/js_string.js lib/js/js_string2.js lib/js/js_typed_array.js @@ -716,6 +722,14 @@ lib/ocaml/js_array2.cmi lib/ocaml/js_array2.cmj lib/ocaml/js_array2.cmt lib/ocaml/js_array2.res +lib/ocaml/js_array_buffer.cmi +lib/ocaml/js_array_buffer.cmj +lib/ocaml/js_array_buffer.cmt +lib/ocaml/js_array_buffer.res +lib/ocaml/js_atomics.cmi +lib/ocaml/js_atomics.cmj +lib/ocaml/js_atomics.cmt +lib/ocaml/js_atomics.res lib/ocaml/js_bigint.cmi lib/ocaml/js_bigint.cmj lib/ocaml/js_bigint.cmt @@ -836,6 +850,10 @@ lib/ocaml/js_set.cmi lib/ocaml/js_set.cmj lib/ocaml/js_set.cmt lib/ocaml/js_set.res +lib/ocaml/js_shared_array_buffer.cmi +lib/ocaml/js_shared_array_buffer.cmj +lib/ocaml/js_shared_array_buffer.cmt +lib/ocaml/js_shared_array_buffer.res lib/ocaml/js_string.cmi lib/ocaml/js_string.cmj lib/ocaml/js_string.cmt From 91d29ccf6db9ae90fd75b83d1d0838c6a04b14a3 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 18 Mar 2024 21:22:28 +0900 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce537b34cd..9e46e1b71e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ # 11.1.0-rc.5 (Unreleased) +#### :rocket: New Feature + +- Add bindings to `ArrayBuffer`, `SharedArrayBuffer` and `Atomics`. https://github.com/rescript-lang/rescript-compiler/pull/6683 + # 11.1.0-rc.4 #### :bug: Bug Fix From 33ce3d948196be6dea2e1ab41a9d194c2d2ea531 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 18 Mar 2024 23:49:16 +0900 Subject: [PATCH 3/3] reduce changed surfaces --- CHANGELOG.md | 4 +- jscomp/others/js.ml | 34 +--- jscomp/others/js_array_buffer.res | 28 --- jscomp/others/js_atomics.res | 56 ------ jscomp/others/js_shared_array_buffer.res | 24 --- jscomp/others/js_typed_array2.res | 230 ++++------------------- jscomp/others/release.ninja | 5 +- jscomp/runtime/js.ml | 9 - lib/es6/js.js | 9 - lib/es6/js_array_buffer.js | 14 +- lib/es6/js_atomics.js | 40 ---- lib/es6/js_shared_array_buffer.js | 14 +- lib/es6/js_typed_array2.js | 3 +- lib/js/js.js | 9 - lib/js/js_array_buffer.js | 12 +- lib/js/js_atomics.js | 38 ---- lib/js/js_shared_array_buffer.js | 12 +- lib/js/js_typed_array2.js | 3 +- packages/artifacts.txt | 6 - 19 files changed, 55 insertions(+), 495 deletions(-) delete mode 100644 jscomp/others/js_atomics.res delete mode 100644 lib/es6/js_atomics.js delete mode 100644 lib/js/js_atomics.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e46e1b71e..8fdb2471e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,9 +12,9 @@ # 11.1.0-rc.5 (Unreleased) -#### :rocket: New Feature +#### :nail_care: Polish -- Add bindings to `ArrayBuffer`, `SharedArrayBuffer` and `Atomics`. https://github.com/rescript-lang/rescript-compiler/pull/6683 +- Add `ArrayBuffer.t` and `SharedArrayBuffer.t` to be base types of the Core bindings. https://github.com/rescript-lang/rescript-compiler/pull/6683 # 11.1.0-rc.4 diff --git a/jscomp/others/js.ml b/jscomp/others/js.ml index aeb5e3a838..46a56c19fc 100644 --- a/jscomp/others/js.ml +++ b/jscomp/others/js.ml @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -[@@@bs.config { flags = [| "-unboxed-types"; "-w"; "-49" |] }] +[@@@bs.config {flags = [|"-unboxed-types"; "-w"; "-49"|]}] (* DESIGN: - It does not have any code, all its code will be inlined so that there will never be @@ -82,29 +82,23 @@ module Internal = struct external opaqueFullApply : 'a -> 'a = "%uncurried_apply" (* Use opaque instead of [._n] to prevent some optimizations happening *) - external run : (unit -> 'a [@bs]) -> 'a = "#run" + external run : ((unit -> 'a)[@bs]) -> 'a = "#run" external opaque : 'a -> 'a = "%opaque" end (**/**) -type +'a null = - | Value of 'a - | Null [@as null] -[@@unboxed] (** Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t. *) +type +'a null = Value of 'a | Null [@as null] [@@unboxed] type +'a undefined (** A value of this type can be either undefined or 'a. This type is equivalent to Js.Undefined.t. *) -type +'a nullable = - | Value of 'a - | Null [@as null] - | Undefined [@as undefined] +type +'a nullable = Value of 'a | Null [@as null] | Undefined [@as undefined] [@@unboxed] (** @@ -144,17 +138,17 @@ external typeof : 'a -> string = "#typeof" *) external log : 'a -> unit = "log" - [@@val] [@@scope "console"] +[@@val] [@@scope "console"] (** Equivalent to console.log any value. *) external log2 : 'a -> 'b -> unit = "log" [@@bs.val] [@@bs.scope "console"] external log3 : 'a -> 'b -> 'c -> unit = "log" [@@bs.val] [@@bs.scope "console"] external log4 : 'a -> 'b -> 'c -> 'd -> unit = "log" - [@@bs.val] [@@bs.scope "console"] +[@@bs.val] [@@bs.scope "console"] external logMany : 'a array -> unit = "log" - [@@bs.val] [@@bs.scope "console"] [@@bs.splice] +[@@bs.val] [@@bs.scope "console"] [@@bs.splice] (** A convenience function to console.log more than 4 arguments *) external eqNull : 'a -> 'a null -> bool = "%bs_equal_null" @@ -199,8 +193,9 @@ module Undefined = Js_undefined module Nullable = Js_null_undefined (** Provide utilities for `Js.null_undefined` *) -module Null_undefined = Js_null_undefined -[@deprecated "Please use `Js.Nullable`"] +module Null_undefined = + Js_null_undefined + [@deprecated "Please use `Js.Nullable`"] module Exn = Js_exn (** Provide utilities for dealing with Js exceptions *) @@ -244,21 +239,12 @@ module Math = Js_math module Obj = Js_obj (** Provide utilities for `Js.t` *) -module ArrayBuffer = Js_array_buffer -(** Provide utilities for `ArrayBuffer` object *) - -module SharedArrayBuffer = Js_shared_array_buffer -(** Provide utilities for `SharedArrayBuffer` object *) - module Typed_array = Js_typed_array (** Provide bindings for JS typed array *) module TypedArray2 = Js_typed_array2 (** Provide bindings for JS typed array *) -module Atomics = Js_atomics -(** Provide bindings for JS `Atomics` utilities *) - module Types = Js_types (** Provide utilities for manipulating JS types *) diff --git a/jscomp/others/js_array_buffer.res b/jscomp/others/js_array_buffer.res index 8d73a8f473..280833a44e 100644 --- a/jscomp/others/js_array_buffer.res +++ b/jscomp/others/js_array_buffer.res @@ -1,34 +1,6 @@ -@@uncurried - -/*** -The underlying buffer that the typed arrays provide views of - -**see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) -*/ type t = { byteLength: int, maxByteLength: int, detached: bool, resizable: bool, } - -type makeOptions = { - maxByteLength?: int -} - -@new /** takes length. initializes elements to 0 */ -external make: (int, makeOptions) => t = "ArrayBuffer" -let make = (length, ~maxByteLength=?) => make(length, { maxByteLength: ?maxByteLength }) - -/* ArrayBuffer.isView: seems pointless with a type system */ - -@get external byteLength: t => int = "byteLength" -@get external maxByteLength: t => int = "maxByteLength" -@get external detached: t => bool = "detached" -@get external resizable: t => bool = "resizable" - -@send external slice: (t, ~start: int, ~end_: int) => t = "slice" -@send external sliceFrom: (t, int) => t = "slice" - -@send external transfer: (t, ~newByteLength: int=?) => t = "transfer" -@send external transferToFixedLength: (t, ~newByteLength: int=?) => t = "transferToFixedLength" diff --git a/jscomp/others/js_atomics.res b/jscomp/others/js_atomics.res deleted file mode 100644 index 70259643b2..0000000000 --- a/jscomp/others/js_atomics.res +++ /dev/null @@ -1,56 +0,0 @@ -@@uncurried - -@scope("Atomics") external isLockFree: int => bool = "isLockFree" - -module MakeOps = (TA: Js_typed_array2.S) => { - @scope("Atomics") external add: (TA.t, int, int) => TA.elt = "add" - @scope("Atomics") external sub: (TA.t, int, int) => TA.elt = "sub" - @scope("Atomics") external and_: (TA.t, int, int) => TA.elt = "and" - @scope("Atomics") external or_: (TA.t, int, int) => TA.elt = "or" - @scope("Atomics") external xor: (TA.t, int, int) => TA.elt = "xor" - @scope("Atomics") external load: (TA.t, ~index: int) => TA.elt = "load" - @scope("Atomics") external store: (TA.t, ~index: int, ~value: TA.elt) => TA.elt = "store" - @scope("Atomics") external exchange: (TA.t, ~index: int, ~value: TA.elt) => TA.elt = "exchange" - @scope("Atomics") external compareExchange: (TA.t, ~index: int, ~expectedValue: TA.elt, ~replacementValue: TA.elt) => TA.elt = "compareExchange" -} - -module MakeFutex = (TA: Js_typed_array2.S) => { - // These operations are supported only when TA is Int32Array or BigInt64Array, and also underlying buffer is SharedArrayBuffer - - @scope("Atomics") external wait: (TA.t, ~index: int, ~value: TA.elt) => [#ok | #"not-equal"] = "wait" - @scope("Atomics") external waitWithTimeout: (TA.t, ~index: int, ~value: TA.elt, ~timeout: int) => [#ok | #"not-equal" | #"timed-out"] = "wait" - - @scope("Atomics") external waitAsync: (TA.t, ~index: int, ~value: TA.elt) => promise<[#ok | #"not-equal"]> = "waitAsync" - @scope("Atomics") external waitAsyncWithTimeout: (TA.t, ~index: int, ~value: TA.elt, ~timeout: int) => promise<[#ok | #"not-equal" | #"timed-out"]> = "waitAsync" - - @scope("Atomics") external notify: (TA.t, ~index: int) => int = "notify" - @scope("Atomics") external notifyForCount: (TA.t, ~index: int, ~count: int) => int = "notify" -} - -module Int8Array = MakeOps(Js_typed_array2.Int8Array) - -module Uint8Array = MakeOps(Js_typed_array2.Uint8Array) - -module Int16Array = MakeOps(Js_typed_array2.Int16Array) - -module Uint16Array = MakeOps(Js_typed_array2.Uint16Array) - -module Int32Array = { - include MakeOps(Js_typed_array2.Int32Array) - include MakeFutex(Js_typed_array2.Int32Array) -} - -module Uint32Array = MakeOps(Js_typed_array2.Uint32Array) - -/** TODO: uncomment this when ready -module BigInt64Array = { - include MakeOps(Js_typed_array2.BigInt64Array) - include MakeFutex(Js_typed_array2.BigInt64Array) -} - -module BigUint64Array = MakeOps(Js_typed_array2.BigUint64Array) -*/ - -module Float32Array = MakeOps(Js_typed_array2.Float32Array) - -module Float64Array = MakeOps(Js_typed_array2.Float64Array) diff --git a/jscomp/others/js_shared_array_buffer.res b/jscomp/others/js_shared_array_buffer.res index 73669e113a..6768de396d 100644 --- a/jscomp/others/js_shared_array_buffer.res +++ b/jscomp/others/js_shared_array_buffer.res @@ -1,29 +1,5 @@ -@@uncurried - -/*** -The underlying buffer that the typed arrays provide views of - -**see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) -*/ type t = { byteLength: int, maxByteLength: int, growable: bool, } - -type makeOptions = { - maxByteLength?: int -} - -@new /** takes length. initializes elements to 0 */ -external make: (int, makeOptions) => t = "SharedArrayBuffer" -let make = (length, ~maxByteLength=?) => make(length, { maxByteLength: ?maxByteLength }) - -/* ArrayBuffer.isView: seems pointless with a type system */ - -@get external byteLength: t => int = "byteLength" -@get external maxByteLength: t => int = "maxByteLength" -@get external growable: t => bool = "growable" - -@send external slice: (t, ~start: int, ~end_: int) => t = "slice" -@send external sliceFrom: (t, int) => t = "slice" diff --git a/jscomp/others/js_typed_array2.res b/jscomp/others/js_typed_array2.res index e237cff4cc..b1ccfc9c69 100644 --- a/jscomp/others/js_typed_array2.res +++ b/jscomp/others/js_typed_array2.res @@ -29,22 +29,30 @@ JavaScript Typed Array API */ type array_buffer = Js_array_buffer.t -type shared_array_buffer = Js_shared_array_buffer.t - type array_like<'a> = Js_array2.array_like<'a> -@depreacted("Use `Js.ArrayBuffer` instead.") module ArrayBuffer = { - include Js_array_buffer -} + /*** + The underlying buffer that the typed arrays provide views of -type typed_array<'a> + **see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) + */ -module type S = { - type elt - type t = typed_array + type t = array_buffer + + @new /** takes length. initializes elements to 0 */ + external make: int => t = "ArrayBuffer" + + /* ArrayBuffer.isView: seems pointless with a type system */ + + @get external byteLength: t => int = "byteLength" + + @send external slice: (t, ~start: int, ~end_: int) => array_buffer = "slice" + @send external sliceFrom: (t, int) => array_buffer = "slice" } +type typed_array<'a> + /* commented out until bs has a plan for iterators external values : t -> elt array_iter = "" [@@bs.send] */ @@ -58,8 +66,6 @@ module Int8Array = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -148,9 +154,9 @@ module Int8Array = { @val external _BYTES_PER_ELEMENT: int = "Int8Array.BYTES_PER_ELEMENT" @new external make: array => t = "Int8Array" - @new /** can throw */ external fromBuffer: array_buffer => t = "Int8Array" + @new /** **raise** Js.Exn.Error raise Js exception @@ -158,30 +164,14 @@ module Int8Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Int8Array" - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int8Array" - - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Int8Array" - @new - /** - **raise** Js.Exn.Error raise Js exception - **param** offset is in bytes - */ - external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Int8Array" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Int8Array" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int8Array" @new external fromLength: int => t = "Int8Array" @val external from: array_like => t = "Int8Array.from" @@ -197,8 +187,6 @@ module Uint8Array = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -287,9 +275,9 @@ module Uint8Array = { @val external _BYTES_PER_ELEMENT: int = "Uint8Array.BYTES_PER_ELEMENT" @new external make: array => t = "Uint8Array" - @new /** can throw */ external fromBuffer: array_buffer => t = "Uint8Array" + @new /** **raise** Js.Exn.Error raise Js exception @@ -297,30 +285,14 @@ module Uint8Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Uint8Array" - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint8Array" - - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Uint8Array" - @new - /** - **raise** Js.Exn.Error raise Js exception - **param** offset is in bytes - */ - external fromShraedBufferOffset: (shared_array_buffer, int) => t = "Uint8Array" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Uint8Array" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint8Array" @new external fromLength: int => t = "Uint8Array" @val external from: array_like => t = "Uint8Array.from" @@ -336,8 +308,6 @@ module Uint8ClampedArray = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -426,9 +396,9 @@ module Uint8ClampedArray = { @val external _BYTES_PER_ELEMENT: int = "Uint8ClampedArray.BYTES_PER_ELEMENT" @new external make: array => t = "Uint8ClampedArray" - @new /** can throw */ external fromBuffer: array_buffer => t = "Uint8ClampedArray" + @new /** **raise** Js.Exn.Error raise Js exception @@ -436,30 +406,14 @@ module Uint8ClampedArray = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Uint8ClampedArray" - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint8ClampedArray" - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Uint8ClampedArray" - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Uint8ClampedArray" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Uint8ClampedArray" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint8ClampedArray" @new external fromLength: int => t = "Uint8ClampedArray" @val external from: array_like => t = "Uint8ClampedArray.from" @@ -475,8 +429,6 @@ module Int16Array = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -565,9 +517,9 @@ module Int16Array = { @val external _BYTES_PER_ELEMENT: int = "Int16Array.BYTES_PER_ELEMENT" @new external make: array => t = "Int16Array" - @new /** can throw */ external fromBuffer: array_buffer => t = "Int16Array" + @new /** **raise** Js.Exn.Error raise Js exception @@ -575,30 +527,14 @@ module Int16Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Int16Array" - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int16Array" - - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Int16Array" - @new - /** - **raise** Js.Exn.Error raise Js exception - **param** offset is in bytes - */ - external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Int16Array" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Int16Array" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int16Array" @new external fromLength: int => t = "Int16Array" @val external from: array_like => t = "Int16Array.from" @@ -614,8 +550,6 @@ module Uint16Array = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -704,9 +638,9 @@ module Uint16Array = { @val external _BYTES_PER_ELEMENT: int = "Uint16Array.BYTES_PER_ELEMENT" @new external make: array => t = "Uint16Array" - @new /** can throw */ external fromBuffer: array_buffer => t = "Uint16Array" + @new /** **raise** Js.Exn.Error raise Js exception @@ -714,30 +648,14 @@ module Uint16Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Uint16Array" - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint16Array" - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Uint16Array" - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Uint16Array" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Uint16Array" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint16Array" @new external fromLength: int => t = "Uint16Array" @val external from: array_like => t = "Uint16Array.from" @@ -753,8 +671,6 @@ module Int32Array = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -843,9 +759,9 @@ module Int32Array = { @val external _BYTES_PER_ELEMENT: int = "Int32Array.BYTES_PER_ELEMENT" @new external make: array => t = "Int32Array" - @new /** can throw */ external fromBuffer: array_buffer => t = "Int32Array" + @new /** **raise** Js.Exn.Error raise Js exception @@ -853,30 +769,14 @@ module Int32Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Int32Array" - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int32Array" - - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Int32Array" - @new - /** - **raise** Js.Exn.Error raise Js exception - **param** offset is in bytes - */ - external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Int32Array" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Int32Array" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Int32Array" @new external fromLength: int => t = "Int32Array" @val external from: array_like => t = "Int32Array.from" @@ -892,8 +792,6 @@ module Uint32Array = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -982,9 +880,9 @@ module Uint32Array = { @val external _BYTES_PER_ELEMENT: int = "Uint32Array.BYTES_PER_ELEMENT" @new external make: array => t = "Uint32Array" - @new /** can throw */ external fromBuffer: array_buffer => t = "Uint32Array" + @new /** **raise** Js.Exn.Error raise Js exception @@ -992,30 +890,14 @@ module Uint32Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Uint32Array" - @new - /** - **raise** Js.Exn.Error raises Js exception - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint32Array" - - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Uint32Array" - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Uint32Array" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Uint32Array" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Uint32Array" @new external fromLength: int => t = "Uint32Array" @val external from: array_like => t = "Uint32Array.from" @@ -1034,8 +916,6 @@ module Float32Array = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -1124,9 +1004,9 @@ module Float32Array = { @val external _BYTES_PER_ELEMENT: int = "Float32Array.BYTES_PER_ELEMENT" @new external make: array => t = "Float32Array" - @new /** can throw */ external fromBuffer: array_buffer => t = "Float32Array" + @new /** **raise** Js.Exn.Error raise Js exception @@ -1134,30 +1014,14 @@ module Float32Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Float32Array" - @new - /** - **raise** Js.Exn.Error raises Js exception - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Float32Array" - - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Float32Array" - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Float32Array" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Float32Array" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Float32Array" @new external fromLength: int => t = "Float32Array" @val external from: array_like => t = "Float32Array.from" @@ -1173,8 +1037,6 @@ module Float64Array = { @set_index external unsafe_set: (t, int, elt) => unit = "" @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" @@ -1263,9 +1125,9 @@ module Float64Array = { @val external _BYTES_PER_ELEMENT: int = "Float64Array.BYTES_PER_ELEMENT" @new external make: array => t = "Float64Array" - @new /** can throw */ external fromBuffer: array_buffer => t = "Float64Array" + @new /** **raise** Js.Exn.Error raise Js exception @@ -1273,30 +1135,14 @@ module Float64Array = { **param** offset is in bytes */ external fromBufferOffset: (array_buffer, int) => t = "Float64Array" - @new - /** - **raise** Js.Exn.Error raises Js exception - - **param** offset is in bytes, length in elements - */ - external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Float64Array" - @new /** can throw */ - external fromSharedBuffer: shared_array_buffer => t = "Float64Array" - @new - /** - **raise** Js.Exn.Error raise Js exception - - **param** offset is in bytes - */ - external fromSharedBufferOffset: (shared_array_buffer, int) => t = "Float64Array" @new /** **raise** Js.Exn.Error raises Js exception **param** offset is in bytes, length in elements */ - external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "Float64Array" + external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "Float64Array" @new external fromLength: int => t = "Float64Array" @val external from: array_like => t = "Float64Array.from" @@ -1318,13 +1164,7 @@ module DataView = { @new external fromBufferOffset: (array_buffer, int) => t = "DataView" @new external fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t = "DataView" - @new external fromSharedBuffer: shared_array_buffer => t = "DataView" - @new external fromSharedBufferOffset: (shared_array_buffer, int) => t = "DataView" - @new external fromSharedBufferRange: (shared_array_buffer, ~offset: int, ~length: int) => t = "DataView" - @get external buffer: t => array_buffer = "buffer" - @get external sharedBuffer: t => shared_array_buffer = "buffer" - @get external byteLength: t => int = "byteLength" @get external byteOffset: t => int = "byteOffset" diff --git a/jscomp/others/release.ninja b/jscomp/others/release.ninja index ee0eb9b55e..f86fc884d0 100644 --- a/jscomp/others/release.ninja +++ b/jscomp/others/release.ninja @@ -19,7 +19,6 @@ o others/js_OO.cmi others/js_OO.cmj : cc others/js_OO.res | others/belt_internal o others/js_array.cmi others/js_array.cmj : cc others/js_array.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj $bsc o others/js_array2.cmi others/js_array2.cmj : cc others/js_array2.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_array_buffer.cmi others/js_array_buffer.cmj : cc others/js_array_buffer.res | others/belt_internals.cmi others/js.cmi $bsc -o others/js_atomics.cmi others/js_atomics.cmj : cc others/js_atomics.res | others/belt_internals.cmi others/js.cmi others/js_typed_array2.cmj $bsc o others/js_bigint.cmi others/js_bigint.cmj : cc others/js_bigint.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_blob.cmi others/js_blob.cmj : cc others/js_blob.res | others/belt_internals.cmi others/js.cmi $bsc o others/js_cast.cmj : cc_cmi others/js_cast.res | others/belt_internals.cmi others/js.cmi others/js_cast.cmi $bsc @@ -59,7 +58,7 @@ o others/js_shared_array_buffer.cmi others/js_shared_array_buffer.cmj : cc other o others/js_string.cmi others/js_string.cmj : cc others/js_string.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_re.cmj $bsc o others/js_string2.cmi others/js_string2.cmj : cc others/js_string2.res | others/belt_internals.cmi others/js.cmi others/js_array2.cmj others/js_re.cmj $bsc o others/js_typed_array.cmi others/js_typed_array.cmj : cc others/js_typed_array.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_typed_array2.cmj $bsc -o others/js_typed_array2.cmi others/js_typed_array2.cmj : cc others/js_typed_array2.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_array2.cmj others/js_array_buffer.cmj others/js_shared_array_buffer.cmj $bsc +o others/js_typed_array2.cmi others/js_typed_array2.cmj : cc others/js_typed_array2.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_array2.cmj others/js_array_buffer.cmj $bsc o others/js_types.cmj : cc_cmi others/js_types.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_bigint.cmj others/js_null.cmj others/js_types.cmi $bsc o others/js_types.cmi : cc others/js_types.resi | others/belt_internals.cmi others/js.cmi $bsc o others/js_undefined.cmj : cc_cmi others/js_undefined.res | others/belt_internals.cmi others/js.cmi others/js.cmj others/js_exn.cmj others/js_undefined.cmi $bsc @@ -77,7 +76,7 @@ o others/jsxEventU.cmi others/jsxEventU.cmj : cc others/jsxEventU.res | others/b o others/jsxPPXReactSupportC.cmi others/jsxPPXReactSupportC.cmj : cc others/jsxPPXReactSupportC.res | others/belt_internals.cmi others/js.cmi others/jsxC.cmj $bsc o others/jsxPPXReactSupportU.cmi others/jsxPPXReactSupportU.cmj : cc others/jsxPPXReactSupportU.res | others/belt_internals.cmi others/js.cmi others/jsxU.cmj $bsc o others/jsxU.cmi others/jsxU.cmj : cc others/jsxU.res | others/belt_internals.cmi others/js.cmi $bsc -o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_array_buffer.cmi others/js_array_buffer.cmj others/js_atomics.cmi others/js_atomics.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_blob.cmi others/js_blob.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_file.cmi others/js_file.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_map.cmi others/js_map.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_promise2.cmi others/js_promise2.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_set.cmi others/js_set.cmj others/js_shared_array_buffer.cmi others/js_shared_array_buffer.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/js_weakmap.cmi others/js_weakmap.cmj others/js_weakset.cmi others/js_weakset.cmj others/jsxC.cmi others/jsxC.cmj others/jsxDOMC.cmi others/jsxDOMC.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxDOMU.cmi others/jsxDOMU.cmj others/jsxEventC.cmi others/jsxEventC.cmj others/jsxEventU.cmi others/jsxEventU.cmj others/jsxPPXReactSupportC.cmi others/jsxPPXReactSupportC.cmj others/jsxPPXReactSupportU.cmi others/jsxPPXReactSupportU.cmj others/jsxU.cmi others/jsxU.cmj +o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_array_buffer.cmi others/js_array_buffer.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_blob.cmi others/js_blob.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_file.cmi others/js_file.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_map.cmi others/js_map.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_promise2.cmi others/js_promise2.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_set.cmi others/js_set.cmj others/js_shared_array_buffer.cmi others/js_shared_array_buffer.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/js_weakmap.cmi others/js_weakmap.cmj others/js_weakset.cmi others/js_weakset.cmj others/jsxC.cmi others/jsxC.cmj others/jsxDOMC.cmi others/jsxDOMC.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxDOMU.cmi others/jsxDOMU.cmj others/jsxEventC.cmi others/jsxEventC.cmj others/jsxEventU.cmi others/jsxEventU.cmj others/jsxPPXReactSupportC.cmi others/jsxPPXReactSupportC.cmj others/jsxPPXReactSupportU.cmi others/jsxPPXReactSupportU.cmj others/jsxU.cmi others/jsxU.cmj o others/belt_Array.cmj : cc_cmi others/belt_Array.res | others/belt.cmi others/belt_Array.cmi others/belt_internals.cmi others/js.cmi others/js.cmj others/js_math.cmj $bsc js_pkg o others/belt_Array.cmi : cc others/belt_Array.resi | others/belt.cmi others/belt_internals.cmi others/js.cmi others/js.cmj $bsc js_pkg o others/belt_Float.cmj : cc_cmi others/belt_Float.res | others/belt.cmi others/belt_Float.cmi others/belt_internals.cmi others/js.cmi $bsc js_pkg diff --git a/jscomp/runtime/js.ml b/jscomp/runtime/js.ml index 19ec786722..100c5ecdc7 100644 --- a/jscomp/runtime/js.ml +++ b/jscomp/runtime/js.ml @@ -196,21 +196,12 @@ module Math = Js_math module Obj = Js_obj (** Provide utilities for {!Js.t} *) -module ArrayBuffer = Js_array_buffer -(** Provide utilities for `ArrayBuffer` object *) - -module SharedArrayBuffer = Js_shared_array_buffer -(** Provide utilities for `SharedArrayBuffer` object *) - module Typed_array = Js_typed_array (** Provide bindings for JS typed array *) module TypedArray2 = Js_typed_array2 (** Provide bindings for JS typed array *) -module Atomics = Js_atomics -(** Provide bindings for JS `Atomics` utilities *) - module Types = Js_types (** Provide utilities for manipulating JS types *) diff --git a/lib/es6/js.js b/lib/es6/js.js index 0c5c1b0525..bdf0d39a2b 100644 --- a/lib/es6/js.js +++ b/lib/es6/js.js @@ -41,16 +41,10 @@ var $$Math; var Obj; -var $$ArrayBuffer; - -var SharedArrayBuffer; - var Typed_array; var TypedArray2; -var $$Atomics; - var Types; var Float; @@ -102,11 +96,8 @@ export { Json , $$Math , Obj , - $$ArrayBuffer , - SharedArrayBuffer , Typed_array , TypedArray2 , - $$Atomics , Types , Float , Int , diff --git a/lib/es6/js_array_buffer.js b/lib/es6/js_array_buffer.js index 370b1e4116..ae1b9f17e6 100644 --- a/lib/es6/js_array_buffer.js +++ b/lib/es6/js_array_buffer.js @@ -1,13 +1 @@ - - - -function make(length, maxByteLength) { - return new ArrayBuffer(length, { - maxByteLength: maxByteLength - }); -} - -export { - make , -} -/* No side effect */ +/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/es6/js_atomics.js b/lib/es6/js_atomics.js deleted file mode 100644 index e4de6df701..0000000000 --- a/lib/es6/js_atomics.js +++ /dev/null @@ -1,40 +0,0 @@ - - - -function MakeOps(TA) { - return {}; -} - -function MakeFutex(TA) { - return {}; -} - -var $$Int8Array = {}; - -var $$Uint8Array = {}; - -var $$Int16Array = {}; - -var $$Uint16Array = {}; - -var $$Int32Array = {}; - -var $$Uint32Array = {}; - -var $$Float32Array = {}; - -var $$Float64Array = {}; - -export { - MakeOps , - MakeFutex , - $$Int8Array , - $$Uint8Array , - $$Int16Array , - $$Uint16Array , - $$Int32Array , - $$Uint32Array , - $$Float32Array , - $$Float64Array , -} -/* No side effect */ diff --git a/lib/es6/js_shared_array_buffer.js b/lib/es6/js_shared_array_buffer.js index 24556578a8..ae1b9f17e6 100644 --- a/lib/es6/js_shared_array_buffer.js +++ b/lib/es6/js_shared_array_buffer.js @@ -1,13 +1 @@ - - - -function make(length, maxByteLength) { - return new SharedArrayBuffer(length, { - maxByteLength: maxByteLength - }); -} - -export { - make , -} -/* No side effect */ +/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/es6/js_typed_array2.js b/lib/es6/js_typed_array2.js index 0435de254c..dc062b00a1 100644 --- a/lib/es6/js_typed_array2.js +++ b/lib/es6/js_typed_array2.js @@ -1,8 +1,7 @@ -import * as Js_array_buffer from "./js_array_buffer.js"; -var $$ArrayBuffer = Js_array_buffer; +var $$ArrayBuffer = {}; var $$Int8Array = {}; diff --git a/lib/js/js.js b/lib/js/js.js index 2943f63934..02aee0d3ba 100644 --- a/lib/js/js.js +++ b/lib/js/js.js @@ -41,16 +41,10 @@ var $$Math; var Obj; -var $$ArrayBuffer; - -var SharedArrayBuffer; - var Typed_array; var TypedArray2; -var $$Atomics; - var Types; var Float; @@ -101,11 +95,8 @@ exports.Global = Global; exports.Json = Json; exports.$$Math = $$Math; exports.Obj = Obj; -exports.$$ArrayBuffer = $$ArrayBuffer; -exports.SharedArrayBuffer = SharedArrayBuffer; exports.Typed_array = Typed_array; exports.TypedArray2 = TypedArray2; -exports.$$Atomics = $$Atomics; exports.Types = Types; exports.Float = Float; exports.Int = Int; diff --git a/lib/js/js_array_buffer.js b/lib/js/js_array_buffer.js index 386a49df21..ae1b9f17e6 100644 --- a/lib/js/js_array_buffer.js +++ b/lib/js/js_array_buffer.js @@ -1,11 +1 @@ -'use strict'; - - -function make(length, maxByteLength) { - return new ArrayBuffer(length, { - maxByteLength: maxByteLength - }); -} - -exports.make = make; -/* No side effect */ +/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/js/js_atomics.js b/lib/js/js_atomics.js deleted file mode 100644 index 39e1daf5e8..0000000000 --- a/lib/js/js_atomics.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - - -function MakeOps(TA) { - return {}; -} - -function MakeFutex(TA) { - return {}; -} - -var $$Int8Array = {}; - -var $$Uint8Array = {}; - -var $$Int16Array = {}; - -var $$Uint16Array = {}; - -var $$Int32Array = {}; - -var $$Uint32Array = {}; - -var $$Float32Array = {}; - -var $$Float64Array = {}; - -exports.MakeOps = MakeOps; -exports.MakeFutex = MakeFutex; -exports.$$Int8Array = $$Int8Array; -exports.$$Uint8Array = $$Uint8Array; -exports.$$Int16Array = $$Int16Array; -exports.$$Uint16Array = $$Uint16Array; -exports.$$Int32Array = $$Int32Array; -exports.$$Uint32Array = $$Uint32Array; -exports.$$Float32Array = $$Float32Array; -exports.$$Float64Array = $$Float64Array; -/* No side effect */ diff --git a/lib/js/js_shared_array_buffer.js b/lib/js/js_shared_array_buffer.js index d6d812e614..ae1b9f17e6 100644 --- a/lib/js/js_shared_array_buffer.js +++ b/lib/js/js_shared_array_buffer.js @@ -1,11 +1 @@ -'use strict'; - - -function make(length, maxByteLength) { - return new SharedArrayBuffer(length, { - maxByteLength: maxByteLength - }); -} - -exports.make = make; -/* No side effect */ +/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/js/js_typed_array2.js b/lib/js/js_typed_array2.js index d319a0056d..73050c540d 100644 --- a/lib/js/js_typed_array2.js +++ b/lib/js/js_typed_array2.js @@ -1,8 +1,7 @@ 'use strict'; -var Js_array_buffer = require("./js_array_buffer.js"); -var $$ArrayBuffer = Js_array_buffer; +var $$ArrayBuffer = {}; var $$Int8Array = {}; diff --git a/packages/artifacts.txt b/packages/artifacts.txt index ad145bfdca..266eb3a77e 100644 --- a/packages/artifacts.txt +++ b/packages/artifacts.txt @@ -112,7 +112,6 @@ lib/es6/js_OO.js lib/es6/js_array.js lib/es6/js_array2.js lib/es6/js_array_buffer.js -lib/es6/js_atomics.js lib/es6/js_bigint.js lib/es6/js_blob.js lib/es6/js_cast.js @@ -278,7 +277,6 @@ lib/js/js_OO.js lib/js/js_array.js lib/js/js_array2.js lib/js/js_array_buffer.js -lib/js/js_atomics.js lib/js/js_bigint.js lib/js/js_blob.js lib/js/js_cast.js @@ -726,10 +724,6 @@ lib/ocaml/js_array_buffer.cmi lib/ocaml/js_array_buffer.cmj lib/ocaml/js_array_buffer.cmt lib/ocaml/js_array_buffer.res -lib/ocaml/js_atomics.cmi -lib/ocaml/js_atomics.cmj -lib/ocaml/js_atomics.cmt -lib/ocaml/js_atomics.res lib/ocaml/js_bigint.cmi lib/ocaml/js_bigint.cmj lib/ocaml/js_bigint.cmt