#include <cha.h>
Definition at line 25 of file cha.h.
◆ CHA()
dart::CHA::CHA |
( |
Thread * |
thread | ) |
|
|
inlineexplicit |
Definition at line 27 of file cha.h.
28 : thread_(thread), guarded_classes_(thread->zone(), 1) {}
◆ AddToGuardedClassesForImplementorCid()
void dart::CHA::AddToGuardedClassesForImplementorCid |
( |
const Class & |
cls, |
|
|
intptr_t |
implementor_cid |
|
) |
| |
Definition at line 46 of file cha.cc.
47 {
50 AddToGuardedClasses(cls, -1, implementor_cid, false);
51}
◆ AddToGuardedClassesForSubclassCount()
void dart::CHA::AddToGuardedClassesForSubclassCount |
( |
const Class & |
cls, |
|
|
intptr_t |
subclass_count |
|
) |
| |
Definition at line 40 of file cha.cc.
41 {
42 ASSERT(subclass_count >= 0);
43 AddToGuardedClasses(cls, subclass_count,
kIllegalCid,
false);
44}
◆ AddToGuardedClassesToTrackFuture()
void dart::CHA::AddToGuardedClassesToTrackFuture |
( |
const Class & |
cls | ) |
|
◆ ClassCanBeFuture()
bool dart::CHA::ClassCanBeFuture |
( |
const Class & |
cls | ) |
|
|
static |
Definition at line 160 of file cha.cc.
160 {
161 if (cls.can_be_future()) {
162 return true;
163 }
164
165
166
167
168
169
171 if (FLAG_use_cha_deopt || thread->isolate_group()->all_classes_finalized()) {
172 if (FLAG_use_cha_deopt) {
173 CHA& cha = thread->compiler_state().cha();
174 cha.AddToGuardedClassesToTrackFuture(cls);
175 }
176 return false;
177 }
178
179
180 return true;
181}
static Thread * Current()
◆ ConcreteSubclasses()
bool dart::CHA::ConcreteSubclasses |
( |
const Class & |
cls, |
|
|
GrowableArray< intptr_t > * |
class_ids |
|
) |
| |
|
static |
Definition at line 93 of file cha.cc.
94 {
95 if (cls.InVMIsolateHeap()) return false;
96 if (cls.IsObjectClass()) return false;
97 if (cls.has_dynamically_extendable_subtypes()) return false;
98
99 if (!cls.is_abstract()) {
100 class_ids->
Add(cls.id());
101 }
102
103
104
105 ASSERT(FLAG_precompiled_mode);
106 const GrowableObjectArray& direct_subclasses =
108 if (direct_subclasses.IsNull()) {
109 return true;
110 }
112 for (intptr_t
i = 0;
i < direct_subclasses.Length();
i++) {
113 subclass ^= direct_subclasses.At(
i);
115 return false;
116 }
117 }
118 return true;
119}
static bool ConcreteSubclasses(const Class &cls, GrowableArray< intptr_t > *class_ids)
◆ HasOverride()
bool dart::CHA::HasOverride |
( |
const Class & |
cls, |
|
|
const String & |
function_name, |
|
|
intptr_t * |
subclass_count |
|
) |
| |
Definition at line 227 of file cha.cc.
229 {
230
231
232
233
234 if (cls.InVMIsolateHeap()) return true;
235
236
237
238 if (cls.IsObjectClass()) {
239 return true;
240 }
241
243 const GrowableObjectArray& cls_direct_subclasses =
245 if (cls_direct_subclasses.IsNull()) {
246 return false;
247 }
249 for (intptr_t
i = 0;
i < cls_direct_subclasses.Length();
i++) {
250 direct_subclass ^= cls_direct_subclasses.At(
i);
251
252
253 if (!direct_subclass.is_finalized()) {
254 continue;
255 }
256
257 if (direct_subclass.LookupDynamicFunctionUnsafe(
function_name) !=
259 return true;
260 }
261
263 return true;
264 }
265
266 (*subclasses_count)++;
267 }
268
269 return false;
270}
bool HasOverride(const Class &cls, const String &function_name, intptr_t *subclass_count)
SafepointRwLock * program_lock()
IsolateGroup * isolate_group() const
const char *const function_name
◆ HasSingleConcreteImplementation()
bool dart::CHA::HasSingleConcreteImplementation |
( |
const Class & |
interface, |
|
|
intptr_t * |
implementation_cid |
|
) |
| |
|
static |
Definition at line 132 of file cha.cc.
133 {
134 intptr_t
cid = interface.implementor_cid();
136 interface.has_dynamically_extendable_subtypes()) {
137
139 return false;
140 }
141
143 if (FLAG_use_cha_deopt || thread->isolate_group()->all_classes_finalized()) {
144 if (FLAG_trace_cha) {
145 THR_Print(
" **(CHA) Type has one implementation: %s\n",
146 interface.ToCString());
147 }
148 if (FLAG_use_cha_deopt) {
149 CHA& cha = thread->compiler_state().cha();
150 cha.AddToGuardedClassesForImplementorCid(interface,
cid);
151 }
152 *implementation_cid =
cid;
153 return true;
154 } else {
156 return false;
157 }
158}
#define THR_Print(format,...)
◆ HasSubclasses() [1/2]
bool dart::CHA::HasSubclasses |
( |
const Class & |
cls | ) |
|
|
static |
Definition at line 64 of file cha.cc.
64 {
67
68
69
70
71 if (cls.InVMIsolateHeap()) return true;
72
73 if (cls.IsObjectClass()) {
74
75 return true;
76 }
77
78 if (cls.has_dynamically_extendable_subtypes()) return true;
79
81 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
82 const GrowableObjectArray& direct_subclasses =
84 return !direct_subclasses.IsNull() && (direct_subclasses.Length() > 0);
85}
bool IsInternalOnlyClassId(intptr_t index)
◆ HasSubclasses() [2/2]
bool dart::CHA::HasSubclasses |
( |
intptr_t |
cid | ) |
const |
Definition at line 87 of file cha.cc.
87 {
91}
static bool HasSubclasses(const Class &cls)
ClassTable * class_table() const
◆ IsConsistentWithCurrentHierarchy()
bool dart::CHA::IsConsistentWithCurrentHierarchy |
( |
| ) |
const |
Definition at line 202 of file cha.cc.
202 {
203 for (intptr_t
i = 0;
i < guarded_classes_.
length();
i++) {
204 if (guarded_classes_[
i].subclass_count != -1) {
205 intptr_t current_subclass_count =
207 if (guarded_classes_[
i].subclass_count != current_subclass_count) {
208 return false;
209 }
210 }
211 if (guarded_classes_[
i].implementor_cid !=
kIllegalCid) {
212 intptr_t current_implementor_cid =
213 guarded_classes_[
i].cls->implementor_cid();
214 if (guarded_classes_[
i].implementor_cid != current_implementor_cid) {
215 return false;
216 }
217 }
218 if (guarded_classes_[
i].track_future) {
219 if (guarded_classes_[
i].cls->can_be_future()) {
220 return false;
221 }
222 }
223 }
224 return true;
225}
static intptr_t CountFinalizedSubclasses(Thread *thread, const Class &cls)
◆ IsGuardedClass()
bool dart::CHA::IsGuardedClass |
( |
intptr_t |
cid | ) |
const |
Definition at line 57 of file cha.cc.
57 {
58 for (intptr_t
i = 0;
i < guarded_classes_.
length(); ++
i) {
59 if (guarded_classes_[
i].cls->id() ==
cid)
return true;
60 }
61 return false;
62}
◆ IsImplemented()
bool dart::CHA::IsImplemented |
( |
const Class & |
cls | ) |
|
|
static |
Definition at line 121 of file cha.cc.
121 {
122
123
124
125
126 if (cls.InVMIsolateHeap()) return true;
127 if (cls.has_dynamically_extendable_subtypes()) return true;
128
129 return cls.is_implemented();
130}
◆ RegisterDependencies()
void dart::CHA::RegisterDependencies |
( |
const Code & |
code | ) |
const |
Definition at line 272 of file cha.cc.
272 {
273 for (intptr_t
i = 0;
i < guarded_classes_.
length(); ++
i) {
274 guarded_classes_[
i].cls->RegisterCHACode(
code);
275 }
276}
The documentation for this class was generated from the following files:
- third_party/dart-lang/sdk/runtime/vm/compiler/cha.h
- third_party/dart-lang/sdk/runtime/vm/compiler/cha.cc