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

@ -27,12 +27,6 @@ Interface
### Internals
* **__retainRelease**(oldRef: `usize`, newRef: `usize`): `usize`<br />
Retains a reference to a new object type while releasing the reference it replaces. Returns the retained reference. This is a workaround.
* **__skippedRelease**(oldRef: `usize`, newRef: `usize`): `usize`<br />
Ignores a reference to a new object type while releasing the reference it replaces. Returns the ignored reference. This is a workaround.
* **__visit**(ref: `usize`, cookie: `u32`): `void`<br />
Concrete visitor implementation called during traversal. Cookie can be used to indicate one of multiple operations.

View File

@ -3,8 +3,6 @@ declare function __realloc(ref: usize, size: usize): usize;
declare function __free(ref: usize): void;
declare function __retain(ref: usize): void;
declare function __release(ref: usize): void;
declare function __retainRelease(oldRef: usize, newRef: usize): usize;
declare function __skippedRelease(oldRef: usize, newRef: usize): usize;
declare function __collect(): void;
declare function __typeinfo(id: u32): u32;
declare function __instanceof(ref: usize, superId: u32): bool;

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;
}

View File

@ -71,18 +71,6 @@ export function __release(ref: usize): void {
export function __visit(ref: usize, cookie: u32): void {
}
// @ts-ignore: decorator
@global @unsafe
export function __retainRelease(oldRef: usize, newRef: usize): usize {
return newRef;
}
// @ts-ignore: decorator
@global @unsafe
export function __skippedRelease(oldRef: usize, newRef: usize): usize {
return newRef;
}
// @ts-ignore: decorator
@global @unsafe
export function __collect(): void {