Index: runtime/vm/object.h |
diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
index eed376be2152b218585740f514db5420dd8771de..6b029709f3c456eec7c624ad6a76f4700ede3fc2 100644 |
--- a/runtime/vm/object.h |
+++ b/runtime/vm/object.h |
@@ -901,6 +901,10 @@ class PassiveObject : public Object { |
}; |
+typedef ZoneGrowableHandlePtrArray<const AbstractType> Trail; |
+typedef ZoneGrowableHandlePtrArray<const AbstractType>* TrailPtr; |
+ |
+ |
class Class : public Object { |
public: |
intptr_t instance_size() const { |
@@ -1122,12 +1126,14 @@ class Class : public Object { |
const Class& other, |
const TypeArguments& other_type_arguments, |
Error* bound_error, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const { |
return TypeTest(kIsSubtypeOf, |
type_arguments, |
other, |
other_type_arguments, |
bound_error, |
+ bound_trail, |
space); |
} |
@@ -1136,12 +1142,14 @@ class Class : public Object { |
const Class& other, |
const TypeArguments& other_type_arguments, |
Error* bound_error, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const { |
return TypeTest(kIsMoreSpecificThan, |
type_arguments, |
other, |
other_type_arguments, |
bound_error, |
+ bound_trail, |
space); |
} |
@@ -1464,6 +1472,7 @@ class Class : public Object { |
const Class& other, |
const TypeArguments& other_type_arguments, |
Error* bound_error, |
+ TrailPtr bound_trail, |
Heap::Space space) const; |
static bool TypeTestNonRecursive( |
@@ -1473,6 +1482,7 @@ class Class : public Object { |
const Class& other, |
const TypeArguments& other_type_arguments, |
Error* bound_error, |
+ TrailPtr bound_trail, |
Heap::Space space); |
FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object); |
@@ -1518,9 +1528,6 @@ class UnresolvedClass : public Object { |
}; |
-typedef ZoneGrowableHandlePtrArray<const AbstractType> Trail; |
-typedef ZoneGrowableHandlePtrArray<const AbstractType>* TrailPtr; |
- |
// A TypeArguments is an array of AbstractType. |
class TypeArguments : public Object { |
public: |
@@ -1569,8 +1576,10 @@ class TypeArguments : public Object { |
intptr_t from_index, |
intptr_t len, |
Error* bound_error, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const { |
- return TypeTest(kIsSubtypeOf, other, from_index, len, bound_error, space); |
+ return TypeTest(kIsSubtypeOf, other, from_index, len, |
+ bound_error, bound_trail, space); |
} |
// Check the 'more specific' relationship, considering only a subvector of |
@@ -1579,9 +1588,10 @@ class TypeArguments : public Object { |
intptr_t from_index, |
intptr_t len, |
Error* bound_error, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const { |
- return TypeTest(kIsMoreSpecificThan, |
- other, from_index, len, bound_error, space); |
+ return TypeTest(kIsMoreSpecificThan, other, from_index, len, |
+ bound_error, bound_trail, space); |
} |
// Check if the vectors are equal (they may be null). |
@@ -1637,7 +1647,8 @@ class TypeArguments : public Object { |
RawTypeArguments* InstantiateFrom( |
const TypeArguments& instantiator_type_arguments, |
Error* bound_error, |
- TrailPtr trail = NULL, |
+ TrailPtr instantiation_trail = NULL, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const; |
// Runtime instantiation with canonicalization. Not to be used during type |
@@ -1694,6 +1705,7 @@ class TypeArguments : public Object { |
intptr_t from_index, |
intptr_t len, |
Error* bound_error, |
+ TrailPtr bound_trail, |
Heap::Space space) const; |
// Return the internal or public name of a subvector of this type argument |
@@ -2498,7 +2510,7 @@ class Function : public Object { |
const Function& other, |
const TypeArguments& other_type_arguments, |
Error* bound_error, |
- Heap::Space space = Heap::kNew) const { |
+ Heap::Space space = Heap::kNew) const { |
return TypeTest(kIsMoreSpecificThan, |
type_arguments, |
other, |
@@ -5266,7 +5278,8 @@ class AbstractType : public Instance { |
virtual RawAbstractType* InstantiateFrom( |
const TypeArguments& instantiator_type_arguments, |
Error* bound_error, |
- TrailPtr trail = NULL, |
+ TrailPtr instantiation_trail = NULL, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const; |
// Return a clone of this unfinalized type or the type itself if it is |
@@ -5297,6 +5310,17 @@ class AbstractType : public Instance { |
// the trail. The receiver may only be added once with its only buddy. |
void AddOnlyBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const; |
+ // Return true if the receiver is contained in the trail. |
+ // Otherwise, if the trail is null, allocate a trail, then add the receiver to |
+ // the trail and return false. |
+ bool TestAndAddToTrail(TrailPtr* trail) const; |
+ |
+ // Return true if the pair <receiver, buddy> is contained in the trail. |
+ // Otherwise, if the trail is null, allocate a trail, add the pair <receiver, |
+ // buddy> to the trail and return false. |
+ // The receiver may be added several times, each time with a different buddy. |
+ bool TestAndAddBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const; |
+ |
// The name of this type, including the names of its type arguments, if any. |
virtual RawString* Name() const { |
return BuildName(kInternalName); |
@@ -5369,15 +5393,18 @@ class AbstractType : public Instance { |
// Check the subtype relationship. |
bool IsSubtypeOf(const AbstractType& other, |
Error* bound_error, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const { |
- return TypeTest(kIsSubtypeOf, other, bound_error, space); |
+ return TypeTest(kIsSubtypeOf, other, bound_error, bound_trail, space); |
} |
// Check the 'more specific' relationship. |
bool IsMoreSpecificThan(const AbstractType& other, |
Error* bound_error, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const { |
- return TypeTest(kIsMoreSpecificThan, other, bound_error, space); |
+ return TypeTest(kIsMoreSpecificThan, other, |
+ bound_error, bound_trail, space); |
} |
private: |
@@ -5385,6 +5412,7 @@ class AbstractType : public Instance { |
bool TypeTest(TypeTestKind test_kind, |
const AbstractType& other, |
Error* bound_error, |
+ TrailPtr bound_trail, |
Heap::Space space) const; |
// Return the internal or public name of this type, including the names of its |
@@ -5443,7 +5471,8 @@ class Type : public AbstractType { |
virtual RawAbstractType* InstantiateFrom( |
const TypeArguments& instantiator_type_arguments, |
Error* bound_error, |
- TrailPtr trail = NULL, |
+ TrailPtr instantiation_trail = NULL, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const; |
virtual RawAbstractType* CloneUnfinalized() const; |
virtual RawAbstractType* CloneUninstantiated( |
@@ -5590,7 +5619,8 @@ class FunctionType : public AbstractType { |
virtual RawAbstractType* InstantiateFrom( |
const TypeArguments& instantiator_type_arguments, |
Error* malformed_error, |
- TrailPtr trail = NULL, |
+ TrailPtr instantiation_trail = NULL, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const; |
virtual RawAbstractType* CloneUnfinalized() const; |
virtual RawAbstractType* CloneUninstantiated( |
@@ -5666,7 +5696,8 @@ class TypeRef : public AbstractType { |
virtual RawTypeRef* InstantiateFrom( |
const TypeArguments& instantiator_type_arguments, |
Error* bound_error, |
- TrailPtr trail = NULL, |
+ TrailPtr instantiation_trail = NULL, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const; |
virtual RawTypeRef* CloneUninstantiated( |
const Class& new_owner, |
@@ -5675,17 +5706,6 @@ class TypeRef : public AbstractType { |
virtual intptr_t Hash() const; |
- // Return true if the receiver is contained in the trail. |
- // Otherwise, if the trail is null, allocate a trail, then add the receiver to |
- // the trail and return false. |
- bool TestAndAddToTrail(TrailPtr* trail) const; |
- |
- // Return true if the pair <receiver, buddy> is contained in the trail. |
- // Otherwise, if the trail is null, allocate a trail, add the pair <receiver, |
- // buddy> to the trail and return false. |
- // The receiver may be added several times, each time with a different buddy. |
- bool TestAndAddBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const; |
- |
static intptr_t InstanceSize() { |
return RoundedAllocationSize(sizeof(RawTypeRef)); |
} |
@@ -5738,6 +5758,7 @@ class TypeParameter : public AbstractType { |
bool CheckBound(const AbstractType& bounded_type, |
const AbstractType& upper_bound, |
Error* bound_error, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const; |
virtual TokenPosition token_pos() const { return raw_ptr()->token_pos_; } |
virtual bool IsInstantiated(TrailPtr trail = NULL) const { |
@@ -5748,7 +5769,8 @@ class TypeParameter : public AbstractType { |
virtual RawAbstractType* InstantiateFrom( |
const TypeArguments& instantiator_type_arguments, |
Error* bound_error, |
- TrailPtr trail = NULL, |
+ TrailPtr instantiation_trail = NULL, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const; |
virtual RawAbstractType* CloneUnfinalized() const; |
virtual RawAbstractType* CloneUninstantiated( |
@@ -5833,7 +5855,8 @@ class BoundedType : public AbstractType { |
virtual RawAbstractType* InstantiateFrom( |
const TypeArguments& instantiator_type_arguments, |
Error* bound_error, |
- TrailPtr trail = NULL, |
+ TrailPtr instantiation_trail = NULL, |
+ TrailPtr bound_trail = NULL, |
Heap::Space space = Heap::kNew) const; |
virtual RawAbstractType* CloneUnfinalized() const; |
virtual RawAbstractType* CloneUninstantiated( |