mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-05-01 01:42:14 +00:00
more general gc hooks?
This commit is contained in:
parent
658a380786
commit
3fc9f550ad
@ -4287,13 +4287,12 @@ export function compileBuiltinArraySetWithValue(
|
||||
}
|
||||
}
|
||||
|
||||
// handle Array<Ref>: value = LINK<T, TArray>(value, this)
|
||||
// handle Array<Ref>: value = RETAIN<T, TArray>(value, this)
|
||||
if (isManaged) {
|
||||
let program = compiler.program;
|
||||
let linkPrototype = assert(program.linkPrototype);
|
||||
let linkInstance = compiler.resolver.resolveFunction(linkPrototype, [ type, target.type ]);
|
||||
if (!linkInstance) return module.createUnreachable();
|
||||
valueExpr = compiler.makeCallInlinePrechecked(linkInstance, [
|
||||
let retainInstance = compiler.resolver.resolveFunction(assert(program.retainPrototype), [ type, target.type ]);
|
||||
if (!retainInstance) return module.createUnreachable();
|
||||
valueExpr = compiler.makeCallInlinePrechecked(retainInstance, [
|
||||
valueExpr,
|
||||
module.createGetLocal(assert(tempThis).index, nativeSizeType)
|
||||
], 0, true);
|
||||
|
@ -187,7 +187,8 @@ export namespace LibrarySymbols {
|
||||
export const REALLOCATE = "REALLOCATE";
|
||||
export const DISCARD = "DISCARD";
|
||||
export const REGISTER = "REGISTER";
|
||||
export const LINK = "LINK";
|
||||
export const RETAIN = "RETAIN";
|
||||
export const RELEASE = "RELEASE";
|
||||
export const WRAPARRAY = "WRAPARRAY";
|
||||
// other
|
||||
export const length = "length";
|
||||
|
@ -4870,16 +4870,16 @@ export class Compiler extends DiagnosticEmitter {
|
||||
let program = this.program;
|
||||
let tempThis: Local | null = null;
|
||||
if (type.isManaged(program) && thisType.isManaged(program)) {
|
||||
let linkInstance = this.resolver.resolveFunction(assert(program.linkPrototype), [ type, thisType ]);
|
||||
if (!linkInstance) {
|
||||
let retainInstance = this.resolver.resolveFunction(assert(program.retainPrototype), [ type, thisType ]);
|
||||
if (!retainInstance) {
|
||||
this.currentType = tee ? type : Type.void;
|
||||
return module.createUnreachable();
|
||||
}
|
||||
tempThis = this.currentFlow.getTempLocal(thisType, false);
|
||||
// this = (tempThis = this)
|
||||
thisExpr = module.createTeeLocal(tempThis.index, thisExpr);
|
||||
// value = LINK(value, tempThis)
|
||||
valueWithCorrectType = this.makeCallInlinePrechecked(linkInstance, [
|
||||
// value = RETAIN(value, tempThis)
|
||||
valueWithCorrectType = this.makeCallInlinePrechecked(retainInstance, [
|
||||
valueWithCorrectType,
|
||||
module.createGetLocal(tempThis.index, this.options.nativeSizeType)
|
||||
], 0, true);
|
||||
@ -6795,8 +6795,8 @@ export class Compiler extends DiagnosticEmitter {
|
||||
)
|
||||
);
|
||||
var isManaged = elementType.isManaged(program) && arrayType.isManaged(program);
|
||||
var linkInstance = isManaged
|
||||
? this.resolver.resolveFunction(assert(program.linkPrototype), [ elementType, arrayType ])
|
||||
var retainInstance = isManaged
|
||||
? this.resolver.resolveFunction(assert(program.retainPrototype), [ elementType, arrayType ])
|
||||
: null;
|
||||
for (let i = 0, alignLog2 = elementType.alignLog2; i < length; ++i) {
|
||||
let valueExpression = expressions[i];
|
||||
@ -6804,11 +6804,11 @@ export class Compiler extends DiagnosticEmitter {
|
||||
? this.compileExpression(valueExpression, elementType, ConversionKind.IMPLICIT, WrapMode.NONE)
|
||||
: elementType.toNativeZero(module);
|
||||
if (isManaged) {
|
||||
if (!linkInstance) {
|
||||
if (!retainInstance) {
|
||||
valueExpr = module.createUnreachable();
|
||||
} else {
|
||||
// value = LINK(value, tempThis)
|
||||
valueExpr = this.makeCallInlinePrechecked(linkInstance, [
|
||||
// value = RETAIN(value, tempThis)
|
||||
valueExpr = this.makeCallInlinePrechecked(retainInstance, [
|
||||
valueExpr,
|
||||
module.createGetLocal(tempThis.index, nativeArrayType)
|
||||
], 0, true);
|
||||
|
@ -364,8 +364,10 @@ export class Program extends DiagnosticEmitter {
|
||||
discardInstance: Function | null = null;
|
||||
/** Runtime register function. */
|
||||
registerPrototype: FunctionPrototype | null = null;
|
||||
/** Runtime link function. */
|
||||
linkPrototype: FunctionPrototype | null = null;
|
||||
/** Runtime retain function. */
|
||||
retainPrototype: FunctionPrototype | null = null;
|
||||
/** Runtime release function. */
|
||||
releasePrototype: FunctionPrototype | null = null;
|
||||
/** Runtime wrap array function. */
|
||||
wrapArrayPrototype: FunctionPrototype | null = null;
|
||||
|
||||
@ -828,9 +830,13 @@ export class Program extends DiagnosticEmitter {
|
||||
assert(element.kind == ElementKind.FUNCTION_PROTOTYPE);
|
||||
this.registerPrototype = <FunctionPrototype>element;
|
||||
}
|
||||
if (element = this.lookupGlobal(LibrarySymbols.LINK)) {
|
||||
if (element = this.lookupGlobal(LibrarySymbols.RETAIN)) {
|
||||
assert(element.kind == ElementKind.FUNCTION_PROTOTYPE);
|
||||
this.linkPrototype = <FunctionPrototype>element;
|
||||
this.retainPrototype = <FunctionPrototype>element;
|
||||
}
|
||||
if (element = this.lookupGlobal(LibrarySymbols.RELEASE)) {
|
||||
assert(element.kind == ElementKind.FUNCTION_PROTOTYPE);
|
||||
this.releasePrototype = <FunctionPrototype>element;
|
||||
}
|
||||
if (element = this.lookupGlobal(LibrarySymbols.WRAPARRAY)) {
|
||||
assert(element.kind == ElementKind.FUNCTION_PROTOTYPE);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ALLOCATE, REALLOCATE, DISCARD, LINK, REGISTER, MAX_BYTELENGTH, ArrayBufferView, UNLINK } from "./runtime";
|
||||
import { ALLOCATE, REALLOCATE, DISCARD, RETAIN, RELEASE, REGISTER, MAX_BYTELENGTH, ArrayBufferView } from "./runtime";
|
||||
import { ArrayBuffer } from "./arraybuffer";
|
||||
import { COMPARATOR, SORT } from "./util/sort";
|
||||
import { itoa, dtoa, itoa_stream, dtoa_stream, MAX_DOUBLE_LENGTH } from "./util/number";
|
||||
@ -76,8 +76,8 @@ export class Array<T> extends ArrayBufferView {
|
||||
if (isManaged<T>()) {
|
||||
let offset = this.dataStart + (<usize>index << alignof<T>());
|
||||
let oldValue = load<T>(offset);
|
||||
store<T>(offset, LINK<T,this>(value, this));
|
||||
UNLINK<T,this>(oldValue, this); // order is important
|
||||
store<T>(offset, RETAIN<T,this>(value, this));
|
||||
RELEASE<T,this>(oldValue, this); // order is important
|
||||
} else {
|
||||
store<T>(this.dataStart + (<usize>index << alignof<T>()), value);
|
||||
}
|
||||
@ -140,7 +140,7 @@ export class Array<T> extends ArrayBufferView {
|
||||
this.length_ = newLength;
|
||||
store<T>(this.dataStart + (<usize>(newLength - 1) << alignof<T>()),
|
||||
isManaged<T>()
|
||||
? LINK<T,this>(element, this)
|
||||
? RETAIN<T,this>(element, this)
|
||||
: element
|
||||
);
|
||||
return newLength;
|
||||
@ -156,13 +156,13 @@ export class Array<T> extends ArrayBufferView {
|
||||
let thisStart = this.dataStart;
|
||||
for (let offset: usize = 0; offset < thisSize; offset += sizeof<T>()) {
|
||||
let element = load<T>(thisStart + offset);
|
||||
store<T>(outStart + offset, LINK<T,Array<T>>(element, out));
|
||||
store<T>(outStart + offset, RETAIN<T,Array<T>>(element, out));
|
||||
}
|
||||
let otherStart = other.dataStart;
|
||||
let otherSize = <usize>otherLen << alignof<T>();
|
||||
for (let offset: usize = 0; offset < otherSize; offset += sizeof<T>()) {
|
||||
let element = load<T>(otherStart + offset);
|
||||
store<T>(outStart + thisSize + offset, LINK<T,Array<T>>(element, out));
|
||||
store<T>(outStart + thisSize + offset, RETAIN<T,Array<T>>(element, out));
|
||||
}
|
||||
} else {
|
||||
memory.copy(outStart, this.dataStart, thisSize);
|
||||
@ -221,7 +221,7 @@ export class Array<T> extends ArrayBufferView {
|
||||
let result = callbackfn(value, index, this);
|
||||
store<U>(outStart + (<usize>index << alignof<U>()),
|
||||
isManaged<U>()
|
||||
? LINK<U,Array<U>>(result, out)
|
||||
? RETAIN<U,Array<U>>(result, out)
|
||||
: result
|
||||
);
|
||||
}
|
||||
@ -296,7 +296,7 @@ export class Array<T> extends ArrayBufferView {
|
||||
);
|
||||
store<T>(base,
|
||||
isManaged<T>()
|
||||
? LINK<T,this>(element, this)
|
||||
? RETAIN<T,this>(element, this)
|
||||
: element
|
||||
);
|
||||
this.length_ = newLength;
|
||||
@ -316,7 +316,7 @@ export class Array<T> extends ArrayBufferView {
|
||||
let element = load<T>(thisBase + offset);
|
||||
store<T>(sliceBase + offset,
|
||||
isManaged<T>()
|
||||
? LINK<T,Array<T>>(element, slice)
|
||||
? RETAIN<T,Array<T>>(element, slice)
|
||||
: element
|
||||
);
|
||||
}
|
||||
@ -334,8 +334,8 @@ export class Array<T> extends ArrayBufferView {
|
||||
for (let i = 0; i < deleteCount; ++i) {
|
||||
let deleted = load<T>(thisBase + (<usize>i << alignof<T>()));
|
||||
if (isManaged<T>()) {
|
||||
store<T>(resultStart + (<usize>i << alignof<T>()), LINK<T,Array<T>>(deleted, result));
|
||||
UNLINK<T,this>(deleted, this); // order is important
|
||||
store<T>(resultStart + (<usize>i << alignof<T>()), RETAIN<T,Array<T>>(deleted, result));
|
||||
RELEASE<T,this>(deleted, this); // order is important
|
||||
} else {
|
||||
store<T>(resultStart + (<usize>i << alignof<T>()), deleted);
|
||||
}
|
||||
@ -655,16 +655,17 @@ export class Array<T> extends ArrayBufferView {
|
||||
return this.join();
|
||||
}
|
||||
|
||||
// private __gc(): void {
|
||||
// var buffer = this.buffer_;
|
||||
// __gc_mark(changetype<usize>(buffer)); // tslint:disable-line
|
||||
// if (isManaged<T>()) {
|
||||
// let offset: usize = 0;
|
||||
// let end = <usize>this.length_ << alignof<usize>();
|
||||
// while (offset < end) {
|
||||
// __gc_mark(load<usize>(changetype<usize>(buffer) + offset, HEADER_SIZE)); // tslint:disable-line
|
||||
// offset += sizeof<usize>();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// GC integration
|
||||
|
||||
@unsafe private __iter(fn: (ref: usize) => void): void {
|
||||
fn(changetype<usize>(this.data));
|
||||
if (isManaged<T>()) {
|
||||
let cur = this.dataStart;
|
||||
let end = cur + <usize>this.dataLength;
|
||||
while (cur < end) {
|
||||
fn(load<usize>(cur));
|
||||
cur += sizeof<usize>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
// A Pure Reference Counting Garbage Collector
|
||||
//
|
||||
// After the paper by DAVID F. BACON, CLEMENT R. ATTANASIO, V.T. RAJAN, STEPHEN E. SMITH
|
||||
// D. Bacon, IBM T.J. Watson Research Center
|
||||
// 2001 ACM 0164-0925/99/0100-0111 $00.75
|
||||
// After the paper by D. Bacon et al., 2001, IBM T.J. Watson Research Center
|
||||
// https://researcher.watson.ibm.com/researcher/files/us-bacon/Bacon03Pure.pdf
|
||||
|
||||
import { HEADER, HEADER_SIZE } from "../runtime";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ALLOCATE, REGISTER, MAX_BYTELENGTH, HEADER, HEADER_SIZE, LINK, UNLINK } from "./runtime";
|
||||
import { ALLOCATE, REGISTER, MAX_BYTELENGTH, HEADER, HEADER_SIZE, RETAIN, RELEASE } from "./runtime";
|
||||
|
||||
// NOTE: DO NOT USE YET!
|
||||
|
||||
@ -38,10 +38,23 @@ export class FixedArray<T> {
|
||||
if (isManaged<T>()) {
|
||||
let offset = changetype<usize>(this) + (<usize>index << alignof<T>());
|
||||
let oldValue = load<T>(offset);
|
||||
store<T>(offset, LINK<T,this>(value, this));
|
||||
UNLINK<T,this>(oldValue, this); // order is important
|
||||
store<T>(offset, RETAIN<T,this>(value, this));
|
||||
RELEASE<T,this>(oldValue, this); // order is important
|
||||
} else {
|
||||
store<T>(changetype<usize>(this) + (<usize>index << alignof<T>()), value);
|
||||
}
|
||||
}
|
||||
|
||||
// GC integration
|
||||
|
||||
@unsafe private __iter(fn: (ref: usize) => void): void {
|
||||
if (isManaged<T>()) {
|
||||
let cur = changetype<usize>(this);
|
||||
let end = cur + changetype<HEADER>(changetype<usize>(this) - HEADER_SIZE).payloadSize;
|
||||
while (cur < end) {
|
||||
fn(load<usize>(cur));
|
||||
cur += sizeof<usize>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { LINK, UNLINK } from "./runtime";
|
||||
import { RETAIN, RELEASE, HEADER } from "./runtime";
|
||||
import { HASH } from "./util/hash";
|
||||
|
||||
// A deterministic hash map based on CloseTable from https://github.com/jorendorff/dht
|
||||
@ -106,8 +106,8 @@ export class Map<K,V> {
|
||||
if (entry) {
|
||||
if (isManaged<V>()) {
|
||||
let oldValue = entry.value;
|
||||
entry.value = LINK<V,this>(value, this);
|
||||
UNLINK<V,this>(oldValue, this); // order is important
|
||||
entry.value = RETAIN<V,this>(value, this);
|
||||
RELEASE<V,this>(oldValue, this); // order is important
|
||||
} else {
|
||||
entry.value = value;
|
||||
}
|
||||
@ -126,8 +126,8 @@ export class Map<K,V> {
|
||||
changetype<usize>(entries) + this.entriesOffset++ * ENTRY_SIZE<K,V>()
|
||||
);
|
||||
// link with the map
|
||||
entry.key = isManaged<K>() ? LINK<K,this>(key, this) : key;
|
||||
entry.value = isManaged<V>() ? LINK<V,this>(value, this) : value;
|
||||
entry.key = isManaged<K>() ? RETAIN<K,this>(key, this) : key;
|
||||
entry.value = isManaged<V>() ? RETAIN<V,this>(value, this) : value;
|
||||
++this.entriesCount;
|
||||
// link with previous entry in bucket
|
||||
let bucketPtrBase = changetype<usize>(this.buckets) + <usize>(hashCode & this.bucketsMask) * BUCKET_SIZE;
|
||||
@ -139,8 +139,8 @@ export class Map<K,V> {
|
||||
delete(key: K): bool {
|
||||
var entry = this.find(key, HASH<K>(key));
|
||||
if (!entry) return false;
|
||||
if (isManaged<K>()) UNLINK<K,this>(entry.key, this);
|
||||
if (isManaged<V>()) UNLINK<V,this>(entry.value, this);
|
||||
if (isManaged<K>()) RELEASE<K,this>(entry.key, this);
|
||||
if (isManaged<V>()) RELEASE<V,this>(entry.value, this);
|
||||
entry.taggedNext |= EMPTY;
|
||||
--this.entriesCount;
|
||||
// check if rehashing is appropriate
|
||||
@ -188,23 +188,23 @@ export class Map<K,V> {
|
||||
return "[object Map]";
|
||||
}
|
||||
|
||||
// private __gc(): void {
|
||||
// __gc_mark(changetype<usize>(this.buckets)); // tslint:disable-line
|
||||
// var entries = this.entries;
|
||||
// __gc_mark(changetype<usize>(entries)); // tslint:disable-line
|
||||
// if (isManaged<K>() || isManaged<V>()) {
|
||||
// let offset: usize = 0;
|
||||
// let end: usize = this.entriesOffset * ENTRY_SIZE<K,V>();
|
||||
// while (offset < end) {
|
||||
// let entry = changetype<MapEntry<K,V>>(
|
||||
// changetype<usize>(entries) + HEADER_SIZE_AB + offset * ENTRY_SIZE<K,V>()
|
||||
// );
|
||||
// if (!(entry.taggedNext & EMPTY)) {
|
||||
// if (isManaged<K>()) __gc_mark(changetype<usize>(entry.key)); // tslint:disable-line
|
||||
// if (isManaged<V>()) __gc_mark(changetype<usize>(entry.value)); // tslint:disable-line
|
||||
// }
|
||||
// offset += ENTRY_SIZE<K,V>();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// GC integration
|
||||
|
||||
@unsafe private __iter(fn: (ref: usize) => void): void {
|
||||
fn(changetype<usize>(this.buckets));
|
||||
var entries = this.entries;
|
||||
fn(changetype<usize>(entries));
|
||||
if (isManaged<K>() || isManaged<V>()) {
|
||||
let cur = changetype<usize>(entries);
|
||||
let end = cur + <usize>this.entriesOffset * ENTRY_SIZE<K,V>();
|
||||
while (cur < end) {
|
||||
let entry = changetype<MapEntry<K,V>>(cur);
|
||||
if (!(entry.taggedNext & EMPTY)) {
|
||||
if (isManaged<K>()) fn(changetype<usize>(entry.key));
|
||||
if (isManaged<V>()) fn(changetype<usize>(entry.value));
|
||||
}
|
||||
cur += ENTRY_SIZE<K,V>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,17 +141,17 @@ function doRegister(ref: usize, classId: u32): usize {
|
||||
return ref;
|
||||
}
|
||||
|
||||
/** Links a registered object with an object that is now referencing it. */
|
||||
/** Retains a registered object. */
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @inline
|
||||
export function LINK<T,TParent>(ref: T, parentRef: TParent): T {
|
||||
export function RETAIN<T,TParent>(ref: T, parentRef: TParent): T {
|
||||
if (!isManaged<T>()) ERROR("managed reference expected");
|
||||
if (!isManaged<TParent>()) ERROR("managed reference expected");
|
||||
doLink(changetype<usize>(ref), changetype<usize>(parentRef));
|
||||
doRetain(changetype<usize>(ref), changetype<usize>(parentRef));
|
||||
return ref;
|
||||
}
|
||||
|
||||
function doLink(ref: usize, parentRef: usize): void {
|
||||
function doRetain(ref: usize, parentRef: usize): void {
|
||||
if (!ASC_NO_ASSERT) {
|
||||
assertRegistered(ref);
|
||||
assertRegistered(parentRef);
|
||||
@ -160,16 +160,16 @@ function doLink(ref: usize, parentRef: usize): void {
|
||||
if (GC_IMPLEMENTED) __gc_link(changetype<usize>(ref), changetype<usize>(parentRef));
|
||||
}
|
||||
|
||||
/** Unlinks a registered object from an object that was referencing it. */
|
||||
/** Releases a registered object. */
|
||||
// @ts-ignore: decorator
|
||||
@unsafe @inline
|
||||
export function UNLINK<T,TParent>(ref: T, parentRef: TParent): void {
|
||||
export function RELEASE<T,TParent>(ref: T, parentRef: TParent): void {
|
||||
if (!isManaged<T>()) ERROR("managed reference expected");
|
||||
if (!isManaged<TParent>()) ERROR("managed reference expected");
|
||||
doUnlink(changetype<usize>(ref), changetype<usize>(parentRef));
|
||||
doRelease(changetype<usize>(ref), changetype<usize>(parentRef));
|
||||
}
|
||||
|
||||
function doUnlink(ref: usize, parentRef: usize): void {
|
||||
function doRelease(ref: usize, parentRef: usize): void {
|
||||
if (!ASC_NO_ASSERT) {
|
||||
assertRegistered(ref);
|
||||
assertRegistered(parentRef);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { LINK, UNLINK } from "./runtime";
|
||||
import { RETAIN, RELEASE } from "./runtime";
|
||||
import { HASH } from "./util/hash";
|
||||
|
||||
// A deterministic hash set based on CloseTable from https://github.com/jorendorff/dht
|
||||
@ -109,7 +109,7 @@ export class Set<K> {
|
||||
changetype<usize>(entries) + this.entriesOffset++ * ENTRY_SIZE<K>()
|
||||
);
|
||||
// link with the set
|
||||
entry.key = isManaged<K>() ? LINK<K,this>(key, this) : key;
|
||||
entry.key = isManaged<K>() ? RETAIN<K,this>(key, this) : key;
|
||||
++this.entriesCount;
|
||||
// link with previous entry in bucket
|
||||
let bucketPtrBase = changetype<usize>(this.buckets) + <usize>(hashCode & this.bucketsMask) * BUCKET_SIZE;
|
||||
@ -121,7 +121,7 @@ export class Set<K> {
|
||||
delete(key: K): bool {
|
||||
var entry = this.find(key, HASH<K>(key));
|
||||
if (!entry) return false;
|
||||
if (isManaged<K>()) UNLINK<K,this>(entry.key, this);
|
||||
if (isManaged<K>()) RELEASE<K,this>(entry.key, this);
|
||||
entry.taggedNext |= EMPTY;
|
||||
--this.entriesCount;
|
||||
// check if rehashing is appropriate
|
||||
@ -168,20 +168,20 @@ export class Set<K> {
|
||||
return "[object Set]";
|
||||
}
|
||||
|
||||
// private __gc(): void {
|
||||
// __gc_mark(changetype<usize>(this.buckets)); // tslint:disable-line
|
||||
// var entries = this.entries;
|
||||
// __gc_mark(changetype<usize>(entries)); // tslint:disable-line
|
||||
// if (isManaged<K>()) {
|
||||
// let offset: usize = 0;
|
||||
// let end: usize = this.entriesOffset * ENTRY_SIZE<K>();
|
||||
// while (offset < end) {
|
||||
// let entry = changetype<SetEntry<K>>(
|
||||
// changetype<usize>(entries) + HEADER_SIZE_AB + offset * ENTRY_SIZE<K>()
|
||||
// );
|
||||
// if (!(entry.taggedNext & EMPTY)) __gc_mark(changetype<usize>(entry.key)); // tslint:disable-line
|
||||
// offset += ENTRY_SIZE<K>();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// GC integration
|
||||
|
||||
@unsafe private __iter(fn: (ref: usize) => void): void {
|
||||
fn(changetype<usize>(this.buckets));
|
||||
var entries = this.entries;
|
||||
fn(changetype<usize>(entries));
|
||||
if (isManaged<K>()) {
|
||||
let cur = changetype<usize>(entries);
|
||||
let end = cur + <usize>this.entriesOffset * ENTRY_SIZE<K>();
|
||||
while (cur < end) {
|
||||
let entry = changetype<SetEntry<K>>(cur);
|
||||
if (!(entry.taggedNext & EMPTY)) fn(changetype<usize>(entry.key));
|
||||
cur += ENTRY_SIZE<K>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ALLOCATE, REGISTER, HEADER, HEADER_SIZE, ArrayBufferView, LINK } from "./runtime";
|
||||
import { ALLOCATE, REGISTER, HEADER, HEADER_SIZE, ArrayBufferView, RETAIN } from "./runtime";
|
||||
import { MAX_SIZE_32 } from "./util/allocator";
|
||||
import { compareImpl, parse, CharCode, isWhiteSpaceOrLineTerminator } from "./util/string";
|
||||
|
||||
@ -365,7 +365,7 @@ import { compareImpl, parse, CharCode, isWhiteSpaceOrLineTerminator } from "./ut
|
||||
// result[i] = charStr
|
||||
store<String>(resultStart + (<usize>i << alignof<usize>()),
|
||||
isManaged<String>()
|
||||
? LINK<String,Array<String>>(REGISTER<String>(charStr), result)
|
||||
? RETAIN<String,Array<String>>(REGISTER<String>(charStr), result)
|
||||
: REGISTER<String>(charStr)
|
||||
);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 130
|
||||
i32.const 135
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -70,7 +70,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 153
|
||||
i32.const 158
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -81,7 +81,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 154
|
||||
i32.const 159
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -107,7 +107,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 76
|
||||
i32.const 81
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -125,7 +125,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 77
|
||||
i32.const 82
|
||||
i32.const 11
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -138,7 +138,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 414
|
||||
i32.const 419
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -155,7 +155,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 144
|
||||
i32.const 149
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -166,7 +166,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 145
|
||||
i32.const 150
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -189,7 +189,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 124
|
||||
i32.const 129
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -215,7 +215,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 244
|
||||
i32.const 249
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -238,7 +238,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 246
|
||||
i32.const 251
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -339,7 +339,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 68
|
||||
i32.const 73
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -353,7 +353,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 69
|
||||
i32.const 74
|
||||
i32.const 11
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -369,7 +369,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 320
|
||||
i32.const 325
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -381,7 +381,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 321
|
||||
i32.const 326
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -394,7 +394,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 322
|
||||
i32.const 327
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -416,7 +416,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 175
|
||||
i32.const 180
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -430,7 +430,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 177
|
||||
i32.const 182
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -454,7 +454,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 179
|
||||
i32.const 184
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -466,7 +466,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 183
|
||||
i32.const 188
|
||||
i32.const 23
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -508,7 +508,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 197
|
||||
i32.const 202
|
||||
i32.const 24
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -522,7 +522,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 199
|
||||
i32.const 204
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -571,7 +571,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 212
|
||||
i32.const 217
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -650,7 +650,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 363
|
||||
i32.const 368
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -661,7 +661,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 364
|
||||
i32.const 369
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -672,7 +672,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 365
|
||||
i32.const 370
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -689,7 +689,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 370
|
||||
i32.const 375
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -717,7 +717,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 379
|
||||
i32.const 384
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -770,7 +770,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 408
|
||||
i32.const 413
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -795,7 +795,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 282
|
||||
i32.const 287
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -875,7 +875,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 309
|
||||
i32.const 314
|
||||
i32.const 16
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -903,7 +903,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 334
|
||||
i32.const 339
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -923,7 +923,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 335
|
||||
i32.const 340
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -934,7 +934,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 336
|
||||
i32.const 341
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -986,7 +986,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 354
|
||||
i32.const 359
|
||||
i32.const 25
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1149,7 +1149,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 467
|
||||
i32.const 472
|
||||
i32.const 12
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1164,7 +1164,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 470
|
||||
i32.const 475
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -2523,7 +2523,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 483
|
||||
i32.const 488
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
|
@ -70,7 +70,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 109
|
||||
i32.const 114
|
||||
i32.const 0
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -119,7 +119,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 130
|
||||
i32.const 135
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -140,7 +140,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 153
|
||||
i32.const 158
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -152,7 +152,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 154
|
||||
i32.const 159
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -185,7 +185,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 76
|
||||
i32.const 81
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -205,7 +205,7 @@
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 77
|
||||
i32.const 82
|
||||
i32.const 11
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -221,7 +221,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 414
|
||||
i32.const 419
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -239,7 +239,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 144
|
||||
i32.const 149
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -251,7 +251,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 145
|
||||
i32.const 150
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -275,7 +275,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 124
|
||||
i32.const 129
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -305,7 +305,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 244
|
||||
i32.const 249
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -331,7 +331,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 246
|
||||
i32.const 251
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -442,7 +442,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 68
|
||||
i32.const 73
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -456,7 +456,7 @@
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 69
|
||||
i32.const 74
|
||||
i32.const 11
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -473,7 +473,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 320
|
||||
i32.const 325
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -486,7 +486,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 321
|
||||
i32.const 326
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -499,7 +499,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 322
|
||||
i32.const 327
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -525,7 +525,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 175
|
||||
i32.const 180
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -540,7 +540,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 177
|
||||
i32.const 182
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -566,7 +566,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 179
|
||||
i32.const 184
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -578,7 +578,7 @@
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 183
|
||||
i32.const 188
|
||||
i32.const 23
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -626,7 +626,7 @@
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 197
|
||||
i32.const 202
|
||||
i32.const 24
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -644,7 +644,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 199
|
||||
i32.const 204
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -699,7 +699,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 212
|
||||
i32.const 217
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -790,7 +790,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 363
|
||||
i32.const 368
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -803,7 +803,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 364
|
||||
i32.const 369
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -816,7 +816,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 365
|
||||
i32.const 370
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -837,7 +837,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 370
|
||||
i32.const 375
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -866,7 +866,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 379
|
||||
i32.const 384
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -937,7 +937,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 408
|
||||
i32.const 413
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -953,7 +953,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 408
|
||||
i32.const 413
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -983,7 +983,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 282
|
||||
i32.const 287
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1079,7 +1079,7 @@
|
||||
else
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 309
|
||||
i32.const 314
|
||||
i32.const 16
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1116,7 +1116,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 334
|
||||
i32.const 339
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1136,7 +1136,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 335
|
||||
i32.const 340
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1149,7 +1149,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 336
|
||||
i32.const 341
|
||||
i32.const 4
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1209,7 +1209,7 @@
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 354
|
||||
i32.const 359
|
||||
i32.const 25
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1439,7 +1439,7 @@
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 467
|
||||
i32.const 472
|
||||
i32.const 12
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -1460,7 +1460,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 470
|
||||
i32.const 475
|
||||
i32.const 2
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
@ -3211,7 +3211,7 @@
|
||||
if
|
||||
i32.const 0
|
||||
i32.const 24
|
||||
i32.const 483
|
||||
i32.const 488
|
||||
i32.const 6
|
||||
call $~lib/env/abort
|
||||
unreachable
|
||||
|
Loading…
x
Reference in New Issue
Block a user