This commit is contained in:
dcode
2019-03-14 12:46:36 +01:00
parent cdf3e2cf12
commit 3a60638f72
12 changed files with 627 additions and 662 deletions

View File

@ -1,4 +1,4 @@
import { runtime } from "./runtime";
import { gc } from "./gc";
import { HASH } from "./util/hash";
// A deterministic hash map based on CloseTable from https://github.com/jorendorff/dht
@ -124,8 +124,8 @@ export class Map<K,V> {
let bucketPtrBase = changetype<usize>(this.buckets) + <usize>(hashCode & this.bucketsMask) * BUCKET_SIZE;
entry.taggedNext = load<usize>(bucketPtrBase);
store<usize>(bucketPtrBase, changetype<usize>(entry));
if (isManaged<K>()) runtime.link(changetype<usize>(key), changetype<usize>(this));
if (isManaged<V>()) runtime.link(changetype<usize>(value), changetype<usize>(this));
if (isManaged<K>()) gc.link(key, this);
if (isManaged<V>()) gc.link(value, this);
}
}