Implement reference counting (#592)

This commit is contained in:
Daniel Wirtz
2019-06-05 23:15:39 +02:00
committed by GitHub
parent 3ed76a97f0
commit 0484a6b740
601 changed files with 261645 additions and 146131 deletions

View File

@@ -1,5 +1,3 @@
import "allocator/arena";
// From The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org
@@ -96,7 +94,7 @@ class NBodySystem {
py += b.vy * m;
pz += b.vz * m;
}
bodies[0].offsetMomentum(px, py, pz);
unchecked(bodies[0]).offsetMomentum(px, py, pz);
}
advance(dt: float): void {
@@ -206,5 +204,5 @@ export function bench(steps: u32): void {
export function getBody(index: i32): Body | null {
var bodies = system.bodies;
return <u32>index < <u32>bodies.length ? bodies[index] : null;
return <u32>index < <u32>bodies.length ? unchecked(bodies[index]) : null;
}