@litert-lm/core 0.17.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -572,8 +572,8 @@ var Browser = {
572
572
  var ret = "";
573
573
  var leftchar = 0;
574
574
  var leftbits = 0;
575
- for (var i = 0; i < data.length; i++) {
576
- leftchar = (leftchar << 8) | data[i];
575
+ for (var byte of data) {
576
+ leftchar = (leftchar << 8) | byte;
577
577
  leftbits += 8;
578
578
  while (leftbits >= 6) {
579
579
  var curr = (leftchar >> (leftbits - 6)) & 63;
@@ -930,76 +930,9 @@ var stackRestore = val => __emscripten_stack_restore(val);
930
930
 
931
931
  var stackSave = () => _emscripten_stack_get_current();
932
932
 
933
- class ExceptionInfo {
934
- // excPtr - Thrown object pointer to wrap. Metadata pointer is calculated from it.
935
- constructor(excPtr) {
936
- this.excPtr = excPtr;
937
- this.ptr = excPtr - 24;
938
- }
939
- set_type(type) {
940
- HEAPU32[(((this.ptr) + (4)) >>> 2) >>> 0] = type;
941
- }
942
- get_type() {
943
- return HEAPU32[(((this.ptr) + (4)) >>> 2) >>> 0];
944
- }
945
- set_destructor(destructor) {
946
- HEAPU32[(((this.ptr) + (8)) >>> 2) >>> 0] = destructor;
947
- }
948
- get_destructor() {
949
- return HEAPU32[(((this.ptr) + (8)) >>> 2) >>> 0];
950
- }
951
- set_caught(caught) {
952
- caught = caught ? 1 : 0;
953
- HEAP8[(this.ptr) + (12) >>> 0] = caught;
954
- }
955
- get_caught() {
956
- return HEAP8[(this.ptr) + (12) >>> 0] != 0;
957
- }
958
- set_rethrown(rethrown) {
959
- rethrown = rethrown ? 1 : 0;
960
- HEAP8[(this.ptr) + (13) >>> 0] = rethrown;
961
- }
962
- get_rethrown() {
963
- return HEAP8[(this.ptr) + (13) >>> 0] != 0;
964
- }
965
- // Initialize native structure fields. Should be called once after allocated.
966
- init(type, destructor) {
967
- this.set_adjusted_ptr(0);
968
- this.set_type(type);
969
- this.set_destructor(destructor);
970
- }
971
- set_adjusted_ptr(adjustedPtr) {
972
- HEAPU32[(((this.ptr) + (16)) >>> 2) >>> 0] = adjustedPtr;
973
- }
974
- get_adjusted_ptr() {
975
- return HEAPU32[(((this.ptr) + (16)) >>> 2) >>> 0];
976
- }
977
- }
978
-
979
- var uncaughtExceptionCount = 0;
980
-
981
- var INT53_MAX = 9007199254740992;
982
-
983
- var INT53_MIN = -9007199254740992;
984
-
985
- var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num);
986
-
987
- function ___cxa_throw(ptr, type, destructor) {
988
- ptr >>>= 0;
989
- type >>>= 0;
990
- destructor >>>= 0;
991
- var info = new ExceptionInfo(ptr);
992
- // Initialize ExceptionInfo content after it was allocated in __cxa_allocate_exception.
993
- info.init(type, destructor);
994
- uncaughtExceptionCount++;
933
+ var __Unwind_RaiseException = ex => {
995
934
  abort();
996
- }
997
-
998
- function __Unwind_RaiseException(ex) {
999
- ex >>>= 0;
1000
- err("Warning: _Unwind_RaiseException is not correctly implemented");
1001
- return ___cxa_throw(ex, 0, 0);
1002
- }
935
+ };
1003
936
 
1004
937
  var PATH = {
1005
938
  isAbs: path => path.charAt(0) === "/",
@@ -1313,12 +1246,15 @@ var TTY = {
1313
1246
  } catch (e) {
1314
1247
  throw new FS.ErrnoError(29);
1315
1248
  }
1316
- if (result === undefined && bytesRead === 0) {
1249
+ if (result === undefined && !bytesRead) {
1317
1250
  throw new FS.ErrnoError(6);
1318
1251
  }
1319
1252
  if (result === null || result === undefined) break;
1320
1253
  bytesRead++;
1321
1254
  buffer[offset + i] = result;
1255
+ // We currently only support canonical mode (ICANON), where
1256
+ // read(2) returns as soon as a line delimiter is read.
1257
+ if (result === 10) break;
1322
1258
  }
1323
1259
  if (bytesRead) {
1324
1260
  stream.node.atime = Date.now();
@@ -1646,7 +1582,7 @@ var MEMFS = {
1646
1582
  if (canOwn) {
1647
1583
  node.contents = buffer.subarray(offset, offset + length);
1648
1584
  node.usedBytes = length;
1649
- } else if (node.usedBytes === 0 && position === 0) {
1585
+ } else if (!node.usedBytes && !position) {
1650
1586
  // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data.
1651
1587
  node.contents = buffer.slice(offset, offset + length);
1652
1588
  node.usedBytes = length;
@@ -2987,7 +2923,7 @@ var FS = {
2987
2923
  // to write to file opened in read-only mode with MAP_PRIVATE flag,
2988
2924
  // as all modifications will be visible only in the memory of
2989
2925
  // the current process.
2990
- if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) {
2926
+ if ((prot & 2) && !(flags & 2) && (stream.flags & 2097155) !== 2) {
2991
2927
  throw new FS.ErrnoError(2);
2992
2928
  }
2993
2929
  if ((stream.flags & 2097155) === 1) {
@@ -3080,7 +3016,7 @@ var FS = {
3080
3016
  // use a buffer to avoid overhead of individual crypto calls per byte
3081
3017
  var randomBuffer = new Uint8Array(1024), randomLeft = 0;
3082
3018
  var randomByte = () => {
3083
- if (randomLeft === 0) {
3019
+ if (!randomLeft) {
3084
3020
  randomFill(randomBuffer);
3085
3021
  randomLeft = randomBuffer.byteLength;
3086
3022
  }
@@ -3299,7 +3235,7 @@ var FS = {
3299
3235
  } catch (e) {
3300
3236
  throw new FS.ErrnoError(29);
3301
3237
  }
3302
- if (result === undefined && bytesRead === 0) {
3238
+ if (result === undefined && !bytesRead) {
3303
3239
  throw new FS.ErrnoError(6);
3304
3240
  }
3305
3241
  if (result === null || result === undefined) break;
@@ -3618,6 +3554,12 @@ function ___syscall_dup(fd) {
3618
3554
  }
3619
3555
  }
3620
3556
 
3557
+ var INT53_MAX = 9007199254740992;
3558
+
3559
+ var INT53_MIN = -9007199254740992;
3560
+
3561
+ var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num);
3562
+
3621
3563
  function ___syscall_faccessat(dirfd, path, amode, flags) {
3622
3564
  path >>>= 0;
3623
3565
  try {
@@ -3747,7 +3689,7 @@ function ___syscall_getcwd(buf, size) {
3747
3689
  buf >>>= 0;
3748
3690
  size >>>= 0;
3749
3691
  try {
3750
- if (size === 0) return -28;
3692
+ if (!size) return -28;
3751
3693
  var cwd = FS.cwd();
3752
3694
  var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1;
3753
3695
  if (size < cwdLengthInBytes) return -68;
@@ -5381,7 +5323,7 @@ var enumReadValueFromPointer = (name, width, signed) => {
5381
5323
 
5382
5324
  function getEnumValueType(rawValueType) {
5383
5325
  // This must match the values of enum_value_type in wire.h
5384
- return rawValueType === 0 ? "object" : (rawValueType === 1 ? "number" : "string");
5326
+ return !rawValueType ? "object" : (rawValueType === 1 ? "number" : "string");
5385
5327
  }
5386
5328
 
5387
5329
  /** @suppress {globalThis} */ function __embind_register_enum(rawType, name, size, isSigned, rawValueType) {
@@ -7508,7 +7450,7 @@ function _fd_seek(fd, offset, whence, newOffset) {
7508
7450
  var stream = SYSCALLS.getStreamFromFD(fd);
7509
7451
  FS.llseek(stream, offset, whence);
7510
7452
  HEAP64[((newOffset) >>> 3) >>> 0] = BigInt(stream.position);
7511
- if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
7453
+ if (stream.getdents && !offset && whence === 0) stream.getdents = null;
7512
7454
  // reset readdir state
7513
7455
  return 0;
7514
7456
  } catch (e) {
@@ -8113,8 +8055,8 @@ Module["WebGPU"] = WebGPU;
8113
8055
  // End JS library exports
8114
8056
  // end include: postlibrary.js
8115
8057
  var ASM_CONSTS = {
8116
- 2318761: () => !!Module["preinitializedWebGPUDevice"],
8117
- 2318812: $0 => {
8058
+ 2342457: () => !!Module["preinitializedWebGPUDevice"],
8059
+ 2342508: $0 => {
8118
8060
  const device = WebGPU.getJsObject($0);
8119
8061
  return device.features.has("subgroups");
8120
8062
  }
@@ -572,8 +572,8 @@ var Browser = {
572
572
  var ret = "";
573
573
  var leftchar = 0;
574
574
  var leftbits = 0;
575
- for (var i = 0; i < data.length; i++) {
576
- leftchar = (leftchar << 8) | data[i];
575
+ for (var byte of data) {
576
+ leftchar = (leftchar << 8) | byte;
577
577
  leftbits += 8;
578
578
  while (leftbits >= 6) {
579
579
  var curr = (leftchar >> (leftbits - 6)) & 63;
@@ -930,76 +930,9 @@ var stackRestore = val => __emscripten_stack_restore(val);
930
930
 
931
931
  var stackSave = () => _emscripten_stack_get_current();
932
932
 
933
- class ExceptionInfo {
934
- // excPtr - Thrown object pointer to wrap. Metadata pointer is calculated from it.
935
- constructor(excPtr) {
936
- this.excPtr = excPtr;
937
- this.ptr = excPtr - 24;
938
- }
939
- set_type(type) {
940
- HEAPU32[(((this.ptr) + (4)) >>> 2) >>> 0] = type;
941
- }
942
- get_type() {
943
- return HEAPU32[(((this.ptr) + (4)) >>> 2) >>> 0];
944
- }
945
- set_destructor(destructor) {
946
- HEAPU32[(((this.ptr) + (8)) >>> 2) >>> 0] = destructor;
947
- }
948
- get_destructor() {
949
- return HEAPU32[(((this.ptr) + (8)) >>> 2) >>> 0];
950
- }
951
- set_caught(caught) {
952
- caught = caught ? 1 : 0;
953
- HEAP8[(this.ptr) + (12) >>> 0] = caught;
954
- }
955
- get_caught() {
956
- return HEAP8[(this.ptr) + (12) >>> 0] != 0;
957
- }
958
- set_rethrown(rethrown) {
959
- rethrown = rethrown ? 1 : 0;
960
- HEAP8[(this.ptr) + (13) >>> 0] = rethrown;
961
- }
962
- get_rethrown() {
963
- return HEAP8[(this.ptr) + (13) >>> 0] != 0;
964
- }
965
- // Initialize native structure fields. Should be called once after allocated.
966
- init(type, destructor) {
967
- this.set_adjusted_ptr(0);
968
- this.set_type(type);
969
- this.set_destructor(destructor);
970
- }
971
- set_adjusted_ptr(adjustedPtr) {
972
- HEAPU32[(((this.ptr) + (16)) >>> 2) >>> 0] = adjustedPtr;
973
- }
974
- get_adjusted_ptr() {
975
- return HEAPU32[(((this.ptr) + (16)) >>> 2) >>> 0];
976
- }
977
- }
978
-
979
- var uncaughtExceptionCount = 0;
980
-
981
- var INT53_MAX = 9007199254740992;
982
-
983
- var INT53_MIN = -9007199254740992;
984
-
985
- var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num);
986
-
987
- function ___cxa_throw(ptr, type, destructor) {
988
- ptr >>>= 0;
989
- type >>>= 0;
990
- destructor >>>= 0;
991
- var info = new ExceptionInfo(ptr);
992
- // Initialize ExceptionInfo content after it was allocated in __cxa_allocate_exception.
993
- info.init(type, destructor);
994
- uncaughtExceptionCount++;
933
+ var __Unwind_RaiseException = ex => {
995
934
  abort();
996
- }
997
-
998
- function __Unwind_RaiseException(ex) {
999
- ex >>>= 0;
1000
- err("Warning: _Unwind_RaiseException is not correctly implemented");
1001
- return ___cxa_throw(ex, 0, 0);
1002
- }
935
+ };
1003
936
 
1004
937
  var PATH = {
1005
938
  isAbs: path => path.charAt(0) === "/",
@@ -1313,12 +1246,15 @@ var TTY = {
1313
1246
  } catch (e) {
1314
1247
  throw new FS.ErrnoError(29);
1315
1248
  }
1316
- if (result === undefined && bytesRead === 0) {
1249
+ if (result === undefined && !bytesRead) {
1317
1250
  throw new FS.ErrnoError(6);
1318
1251
  }
1319
1252
  if (result === null || result === undefined) break;
1320
1253
  bytesRead++;
1321
1254
  buffer[offset + i] = result;
1255
+ // We currently only support canonical mode (ICANON), where
1256
+ // read(2) returns as soon as a line delimiter is read.
1257
+ if (result === 10) break;
1322
1258
  }
1323
1259
  if (bytesRead) {
1324
1260
  stream.node.atime = Date.now();
@@ -1646,7 +1582,7 @@ var MEMFS = {
1646
1582
  if (canOwn) {
1647
1583
  node.contents = buffer.subarray(offset, offset + length);
1648
1584
  node.usedBytes = length;
1649
- } else if (node.usedBytes === 0 && position === 0) {
1585
+ } else if (!node.usedBytes && !position) {
1650
1586
  // If this is a simple first write to an empty file, do a fast set since we don't need to care about old data.
1651
1587
  node.contents = buffer.slice(offset, offset + length);
1652
1588
  node.usedBytes = length;
@@ -2987,7 +2923,7 @@ var FS = {
2987
2923
  // to write to file opened in read-only mode with MAP_PRIVATE flag,
2988
2924
  // as all modifications will be visible only in the memory of
2989
2925
  // the current process.
2990
- if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) {
2926
+ if ((prot & 2) && !(flags & 2) && (stream.flags & 2097155) !== 2) {
2991
2927
  throw new FS.ErrnoError(2);
2992
2928
  }
2993
2929
  if ((stream.flags & 2097155) === 1) {
@@ -3080,7 +3016,7 @@ var FS = {
3080
3016
  // use a buffer to avoid overhead of individual crypto calls per byte
3081
3017
  var randomBuffer = new Uint8Array(1024), randomLeft = 0;
3082
3018
  var randomByte = () => {
3083
- if (randomLeft === 0) {
3019
+ if (!randomLeft) {
3084
3020
  randomFill(randomBuffer);
3085
3021
  randomLeft = randomBuffer.byteLength;
3086
3022
  }
@@ -3299,7 +3235,7 @@ var FS = {
3299
3235
  } catch (e) {
3300
3236
  throw new FS.ErrnoError(29);
3301
3237
  }
3302
- if (result === undefined && bytesRead === 0) {
3238
+ if (result === undefined && !bytesRead) {
3303
3239
  throw new FS.ErrnoError(6);
3304
3240
  }
3305
3241
  if (result === null || result === undefined) break;
@@ -3618,6 +3554,12 @@ function ___syscall_dup(fd) {
3618
3554
  }
3619
3555
  }
3620
3556
 
3557
+ var INT53_MAX = 9007199254740992;
3558
+
3559
+ var INT53_MIN = -9007199254740992;
3560
+
3561
+ var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num);
3562
+
3621
3563
  function ___syscall_faccessat(dirfd, path, amode, flags) {
3622
3564
  path >>>= 0;
3623
3565
  try {
@@ -3747,7 +3689,7 @@ function ___syscall_getcwd(buf, size) {
3747
3689
  buf >>>= 0;
3748
3690
  size >>>= 0;
3749
3691
  try {
3750
- if (size === 0) return -28;
3692
+ if (!size) return -28;
3751
3693
  var cwd = FS.cwd();
3752
3694
  var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1;
3753
3695
  if (size < cwdLengthInBytes) return -68;
@@ -5381,7 +5323,7 @@ var enumReadValueFromPointer = (name, width, signed) => {
5381
5323
 
5382
5324
  function getEnumValueType(rawValueType) {
5383
5325
  // This must match the values of enum_value_type in wire.h
5384
- return rawValueType === 0 ? "object" : (rawValueType === 1 ? "number" : "string");
5326
+ return !rawValueType ? "object" : (rawValueType === 1 ? "number" : "string");
5385
5327
  }
5386
5328
 
5387
5329
  /** @suppress {globalThis} */ function __embind_register_enum(rawType, name, size, isSigned, rawValueType) {
@@ -7508,7 +7450,7 @@ function _fd_seek(fd, offset, whence, newOffset) {
7508
7450
  var stream = SYSCALLS.getStreamFromFD(fd);
7509
7451
  FS.llseek(stream, offset, whence);
7510
7452
  HEAP64[((newOffset) >>> 3) >>> 0] = BigInt(stream.position);
7511
- if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
7453
+ if (stream.getdents && !offset && whence === 0) stream.getdents = null;
7512
7454
  // reset readdir state
7513
7455
  return 0;
7514
7456
  } catch (e) {
@@ -8113,8 +8055,8 @@ Module["WebGPU"] = WebGPU;
8113
8055
  // End JS library exports
8114
8056
  // end include: postlibrary.js
8115
8057
  var ASM_CONSTS = {
8116
- 2318649: () => !!Module["preinitializedWebGPUDevice"],
8117
- 2318700: $0 => {
8058
+ 2342345: () => !!Module["preinitializedWebGPUDevice"],
8059
+ 2342396: $0 => {
8118
8060
  const device = WebGPU.getJsObject($0);
8119
8061
  return device.features.has("subgroups");
8120
8062
  }
Binary file