Initial GC integration (#196)

This commit is contained in:
Daniel Wirtz
2018-08-02 18:23:02 +02:00
committed by GitHub
parent 671121bf70
commit dc0f271fc2
139 changed files with 7370 additions and 5016 deletions

View File

@ -5,7 +5,9 @@
import {
Class,
FunctionTarget
FunctionTarget,
Program,
DecoratorFlags
} from "./program";
import {
@ -134,6 +136,15 @@ export class Type {
}
}
/** Tests if this is a managed type that needs GC hooks. */
isManaged(program: Program): bool {
if (program.hasGC) {
let classReference = this.classReference;
return classReference !== null && !classReference.hasDecorator(DecoratorFlags.UNMANAGED);
}
return false;
}
/** Computes the sign-extending shift in the target type. */
computeSmallIntegerShift(targetType: Type): u32 {
return targetType.size - this.size;