From 52c7b0169c73ff1351582d2b02b2adb52bc0d20c Mon Sep 17 00:00:00 2001 From: mikebarnett Date: Thu, 24 Feb 2011 16:28:46 +0000 Subject: Added a new type, Type, that represents runtime types. The Heap interface now provides a way to declare a new user-defined type and to represent the expressions "typeof(T)" or "o.Type" in the BPL program using a new function $DynamicType. Added a method to the Sink so that any of the translation visitors can find or declare a new type. When an object is allocated, an assumption is generated that gives its dynamic type. Fixed the dynamic dispatch inlining so that the $DynamicType of the object is used to decide which override to call. --- BCT/RegressionTests/TranslationTest/GeneralHeapInput.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'BCT/RegressionTests') diff --git a/BCT/RegressionTests/TranslationTest/GeneralHeapInput.txt b/BCT/RegressionTests/TranslationTest/GeneralHeapInput.txt index ea98c61b..d200d8d8 100644 --- a/BCT/RegressionTests/TranslationTest/GeneralHeapInput.txt +++ b/BCT/RegressionTests/TranslationTest/GeneralHeapInput.txt @@ -31,6 +31,8 @@ implementation Alloc() returns (x: ref) +type Type; + type Field; var $Heap: HeapType where IsGoodHeap($Heap); @@ -53,6 +55,10 @@ function {:inline true} Write(H: HeapType, o: ref, f: Field, v: box) : HeapType H[o, f := v] } +function $DynamicType(ref) : Type; + +const unique RegressionTestInput.AsyncAttribute: Type; + procedure RegressionTestInput.AsyncAttribute.#ctor(this: int); @@ -64,6 +70,8 @@ implementation RegressionTestInput.AsyncAttribute.#ctor(this: int) +const unique RegressionTestInput.ClassWithBoolTypes: Type; + var RegressionTestInput.ClassWithBoolTypes.staticB: bool; const unique RegressionTestInput.ClassWithBoolTypes.b: Field; @@ -132,6 +140,8 @@ implementation RegressionTestInput.ClassWithBoolTypes.Main() +const unique RegressionTestInput.ClassWithArrayTypes: Type; + var RegressionTestInput.ClassWithArrayTypes.s: int; const unique RegressionTestInput.ClassWithArrayTypes.a: Field; @@ -257,6 +267,8 @@ implementation RegressionTestInput.ClassWithArrayTypes.#ctor(this: int) +const unique RegressionTestInput.Class0: Type; + var RegressionTestInput.Class0.StaticInt: int; procedure RegressionTestInput.Class0.StaticMethod$System.Int32(x$in: int) returns ($result: int); -- cgit v1.2.3