@typeberry/jam 0.1.2-b7cae5d → 0.1.2-dd9b0e2
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.
- package/block-generator/index.js +18 -6
- package/block-generator/index.js.map +1 -1
- package/importer/index.js +18 -6
- package/importer/index.js.map +1 -1
- package/index.js +18 -6
- package/index.js.map +1 -1
- package/jam-network/index.js +2 -2
- package/jam-network/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -35190,8 +35190,8 @@ function print(level, levelAndName, strings, data) {
|
|
|
35190
35190
|
return;
|
|
35191
35191
|
}
|
|
35192
35192
|
const lvlText = Level[level].padEnd(5);
|
|
35193
|
-
const val = strings.map((v, idx) => `${v}${data[idx]}`);
|
|
35194
|
-
const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
|
|
35193
|
+
const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
|
|
35194
|
+
const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
|
|
35195
35195
|
if (level === Level.WARN) {
|
|
35196
35196
|
console.warn(msg);
|
|
35197
35197
|
}
|
|
@@ -42027,6 +42027,17 @@ class PageRange {
|
|
|
42027
42027
|
}
|
|
42028
42028
|
return new PageRange(start, length);
|
|
42029
42029
|
}
|
|
42030
|
+
/** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
|
|
42031
|
+
isWrapped() {
|
|
42032
|
+
return this.start >= this.end && !this.isEmpty();
|
|
42033
|
+
}
|
|
42034
|
+
/** Checks if given page number is within the range */
|
|
42035
|
+
isInRange(page) {
|
|
42036
|
+
if (this.isWrapped()) {
|
|
42037
|
+
return page >= this.start || page < this.end;
|
|
42038
|
+
}
|
|
42039
|
+
return page >= this.start && page < this.end;
|
|
42040
|
+
}
|
|
42030
42041
|
/** Checks if a range is empty (`length === 0`) */
|
|
42031
42042
|
isEmpty() {
|
|
42032
42043
|
return this.length === 0;
|
|
@@ -42406,10 +42417,11 @@ class MemoryBuilder {
|
|
|
42406
42417
|
startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
|
|
42407
42418
|
`;
|
|
42408
42419
|
this.ensureNotFinalized();
|
|
42409
|
-
const
|
|
42410
|
-
const
|
|
42411
|
-
|
|
42412
|
-
|
|
42420
|
+
const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
42421
|
+
const heapPagesRange = PageRange.fromMemoryRange(heapRange);
|
|
42422
|
+
const initializedPageNumbers = Array.from(this.initialMemory.keys());
|
|
42423
|
+
for (const pageNumber of initializedPageNumbers) {
|
|
42424
|
+
if (heapPagesRange.isInRange(pageNumber)) {
|
|
42413
42425
|
throw new IncorrectSbrkIndex();
|
|
42414
42426
|
}
|
|
42415
42427
|
}
|