eliminate retainRelease and skippedRelease

This commit is contained in:
dcode
2019-05-25 19:16:09 +02:00
parent bd9d77e151
commit 3224925e47
37 changed files with 8521 additions and 5537 deletions

View File

@ -255,21 +255,3 @@ export function __retain(ref: usize): usize {
export function __release(ref: usize): void {
if (ref > HEAP_BASE) decrement(changetype<Block>(ref - BLOCK_OVERHEAD));
}
// @ts-ignore: decorator
@global @unsafe
export function __retainRelease(oldRef: usize, newRef: usize): usize {
if (newRef != oldRef) {
let heapBase = HEAP_BASE;
if (newRef > heapBase) increment(changetype<Block>(newRef - BLOCK_OVERHEAD));
if (oldRef > heapBase) decrement(changetype<Block>(oldRef - BLOCK_OVERHEAD));
}
return newRef;
}
// @ts-ignore: decorator
@global @unsafe
export function __skippedRelease(oldRef: usize, newRef: usize): usize {
if (oldRef > HEAP_BASE) decrement(changetype<Block>(oldRef - BLOCK_OVERHEAD));
return newRef;
}