Flutter Engine
The Flutter Engine
kernel_translation_helper.h
Go to the documentation of this file.
1// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_COMPILER_FRONTEND_KERNEL_TRANSLATION_HELPER_H_
6#define RUNTIME_VM_COMPILER_FRONTEND_KERNEL_TRANSLATION_HELPER_H_
7
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
10#endif // defined(DART_PRECOMPILED_RUNTIME)
11
12#include "vm/compiler/backend/il.h" // For CompileType.
13#include "vm/kernel.h"
14#include "vm/kernel_binary.h"
15#include "vm/object.h"
16
17namespace dart {
18
19namespace kernel {
20
21class ConstantReader;
22class KernelReaderHelper;
23class TypeTranslator;
24
26 public:
28
30
31 virtual ~TranslationHelper() {}
32
33 void Reset();
34
36
37 Thread* thread() { return thread_; }
38
39 Zone* zone() { return zone_; }
40
41 IsolateGroup* isolate_group() { return isolate_group_; }
42
43 Heap::Space allocation_space() { return allocation_space_; }
44
45 // Access to strings.
46 const TypedData& string_offsets() const { return string_offsets_; }
48
49 const TypedDataView& string_data() const { return string_data_; }
51
52 const TypedData& canonical_names() const { return canonical_names_; }
54
55 const TypedDataView& metadata_payloads() const { return metadata_payloads_; }
57
58 const TypedDataView& metadata_mappings() const { return metadata_mappings_; }
60
61 // Access to previously evaluated constants from the constants table.
62 const Array& constants() { return constants_; }
63 void SetConstants(const Array& constants);
64
65 // Access to the raw bytes of the constants table.
66 const TypedDataView& constants_table() const { return constants_table_; }
68
70 const KernelProgramInfo& GetKernelProgramInfo() const { return info_; }
71
72 intptr_t StringOffset(StringIndex index) const;
73 intptr_t StringSize(StringIndex index) const;
74
75 // The address of the backing store of the string with a given index. If the
76 // backing store is in the VM's heap this address is not safe for GC (call the
77 // function and use the result within a NoSafepointScope).
78 uint8_t* StringBuffer(StringIndex index) const;
79
80 uint8_t CharacterAt(StringIndex string_index, intptr_t index);
81 bool StringEquals(StringIndex string_index, const char* other);
82
83 // Accessors and predicates for canonical names.
88 bool IsRoot(NameIndex name);
99
100 // For a member (field, constructor, or procedure) return the canonical name
101 // of the enclosing class or library.
103
104 InstancePtr Canonicalize(const Instance& instance);
105
106 const String& DartString(const char* content) {
107 return DartString(content, allocation_space_);
108 }
109 const String& DartString(const char* content, Heap::Space space);
110
112 return DartString(index, allocation_space_);
113 }
114 String& DartString(StringIndex string_index, Heap::Space space);
115
116 String& DartString(const uint8_t* utf8_array,
117 intptr_t len,
118 Heap::Space space);
119
121
122 const String& DartSymbolPlain(const char* content) const;
123 String& DartSymbolPlain(StringIndex string_index) const;
124 const String& DartSymbolObfuscate(const char* content) const;
125 String& DartSymbolObfuscate(StringIndex string_index) const;
126
127 String& DartIdentifier(const Library& lib, StringIndex string_index);
128
129 const String& DartClassName(NameIndex kernel_class);
130
131 const String& DartConstructorName(NameIndex constructor);
132
133 const String& DartProcedureName(NameIndex procedure);
134
135 const String& DartSetterName(NameIndex setter);
136 const String& DartSetterName(NameIndex parent, StringIndex setter);
137
138 const String& DartGetterName(NameIndex getter);
139 const String& DartGetterName(NameIndex parent, StringIndex getter);
140
141 const String& DartFieldName(NameIndex field);
142 const String& DartFieldName(NameIndex parent, StringIndex field);
143
144 const String& DartMethodName(NameIndex method);
145 const String& DartMethodName(NameIndex parent, StringIndex method);
146
147 const String& DartFactoryName(NameIndex factory);
148
149 DART_NORETURN void LookupFailed(NameIndex name);
150 DART_NORETURN void LookupFailed(StringIndex name);
151
152 // A subclass overrides these when reading in the Kernel program in order to
153 // support recursive type expressions (e.g. for "implements X" ...
154 // annotations).
155 virtual LibraryPtr LookupLibraryByKernelLibrary(NameIndex library,
156 bool required = true);
157 virtual ClassPtr LookupClassByKernelClass(NameIndex klass,
158 bool required = true);
159 ClassPtr LookupClassByKernelClassOrLibrary(NameIndex kernel_name,
160 bool required = true);
161
162 FieldPtr LookupFieldByKernelField(NameIndex field, bool required = true);
164 bool required = true);
166 bool required = true);
167 FunctionPtr LookupConstructorByKernelConstructor(NameIndex constructor,
168 bool required = true);
169 FunctionPtr LookupConstructorByKernelConstructor(const Class& owner,
170 NameIndex constructor,
171 bool required = true);
172 FunctionPtr LookupConstructorByKernelConstructor(const Class& owner,
173 StringIndex constructor_name,
174 bool required = true);
176 const String& method_name,
177 bool required = true);
178 ObjectPtr LookupMemberByMember(NameIndex kernel_name, bool required = true);
179 FunctionPtr LookupDynamicFunction(const Class& klass, const String& name);
180
181 Type& GetDeclarationType(const Class& klass);
182
183 void SetupFieldAccessorFunction(const Class& klass,
184 const Function& function,
185 const AbstractType& field_type);
186
187 void ReportError(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
188 void ReportError(const Script& script,
189 const TokenPosition position,
190 const char* format,
191 ...) PRINTF_ATTRIBUTE(4, 5);
192 void ReportError(const Error& prev_error, const char* format, ...)
193 PRINTF_ATTRIBUTE(3, 4);
194 void ReportError(const Error& prev_error,
195 const Script& script,
196 const TokenPosition position,
197 const char* format,
198 ...) PRINTF_ATTRIBUTE(5, 6);
199
201 ASSERT(expression_evaluation_function_ == nullptr);
202 expression_evaluation_function_ = &Function::Handle(zone_, function.ptr());
203 }
205 if (expression_evaluation_function_ == nullptr) {
206 return Function::null_function();
207 }
208 return *expression_evaluation_function_;
209 }
211 ASSERT(expression_evaluation_class_ == nullptr);
212 ASSERT(!cls.IsNull());
213 expression_evaluation_class_ = &Class::Handle(zone_, cls.ptr());
214 }
216 if (expression_evaluation_class_ == nullptr) {
217 return Class::null_class();
218 }
219 return *expression_evaluation_class_;
220 }
221 void SetExpressionEvaluationRealClass(const Class& real_class) {
222 ASSERT(expression_evaluation_real_class_ == nullptr);
223 ASSERT(!real_class.IsNull());
224 expression_evaluation_real_class_ = &Class::Handle(zone_, real_class.ptr());
225 }
227 if (expression_evaluation_real_class_ == nullptr) {
228 return Class::null_class();
229 }
230 return *expression_evaluation_real_class_;
231 }
232
233 private:
234 // This will mangle [name_to_modify] if necessary and make the result a symbol
235 // if asked. The result will be available in [name_to_modify] and it is also
236 // returned. If the name is private, the canonical name [parent] will be used
237 // to get the import URI of the library where the name is visible.
238 String& ManglePrivateName(NameIndex parent,
239 String* name_to_modify,
240 bool symbolize = true,
241 bool obfuscate = true);
242 String& ManglePrivateName(const Library& library,
243 String* name_to_modify,
244 bool symbolize = true,
245 bool obfuscate = true);
246
247 Thread* thread_;
248 Zone* zone_;
249 IsolateGroup* isolate_group_;
250 Heap::Space allocation_space_;
251
252 TypedData& string_offsets_;
253 TypedDataView& string_data_;
254 TypedData& canonical_names_;
255 TypedDataView& metadata_payloads_;
256 TypedDataView& metadata_mappings_;
257 Array& constants_;
258 TypedDataView& constants_table_;
259 KernelProgramInfo& info_;
260 Smi& name_index_handle_;
261 GrowableObjectArray* potential_extension_libraries_ = nullptr;
262 Function* expression_evaluation_function_ = nullptr;
263
264 // A temporary class needed to contain the function to which an eval
265 // expression is compiled. This is a fresh class so loading the kernel
266 // isn't a no-op. It should be unreachable after the eval function is loaded.
267 Class* expression_evaluation_class_ = nullptr;
268
269 // The original class that is the scope in which the eval expression is
270 // evaluated.
271 Class* expression_evaluation_real_class_ = nullptr;
272
273 DISALLOW_COPY_AND_ASSIGN(TranslationHelper);
274};
275
276// Helper class that reads a kernel FunctionNode from binary.
277//
278// Use ReadUntilExcluding to read up to but not including a field.
279// One can then for instance read the field from the call-site (and remember to
280// call SetAt to inform this helper class), and then use this to read more.
281// Simple fields are stored (e.g. integers) and can be fetched from this class.
282// If asked to read a compound field (e.g. an expression) it will be skipped.
284 public:
285 enum Field {
286 kStart, // tag.
301 };
302
303 enum AsyncMarker : intptr_t {
304 kSync = 0,
308 };
309
311 helper_ = helper;
312 next_read_ = kStart;
313 }
314
316 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
317 }
318
319 void ReadUntilExcluding(Field field);
320
321 void SetNext(Field field) { next_read_ = field; }
322 void SetJustRead(Field field) { next_read_ = field + 1; }
323
324 TokenPosition position_ = TokenPosition::kNoSource;
325 TokenPosition end_position_ = TokenPosition::kNoSource;
330
331 private:
332 KernelReaderHelper* helper_;
333 intptr_t next_read_;
334
335 DISALLOW_COPY_AND_ASSIGN(FunctionNodeHelper);
336};
337
339 public:
340 enum Field {
341 kStart, // tag.
349 };
350
351 enum Flag {
353 };
354
356 helper_ = helper;
357 next_read_ = kStart;
358 }
359
361 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
362 }
363
364 void ReadUntilExcluding(Field field);
365
366 void SetNext(Field field) { next_read_ = field; }
367 void SetJustRead(Field field) { next_read_ = field + 1; }
368
370 ReadUntilExcluding(field);
371 SetJustRead(field);
372 }
373
375
377 return (flags_ & kIsGenericCovariantImpl) != 0;
378 }
379
380 TokenPosition position_ = TokenPosition::kNoSource;
381 uint8_t flags_ = 0;
383
384 private:
385 KernelReaderHelper* helper_;
386 intptr_t next_read_;
387
388 DISALLOW_COPY_AND_ASSIGN(TypeParameterHelper);
389};
390
391// Helper class that reads a kernel VariableDeclaration from binary.
392//
393// Use ReadUntilExcluding to read up to but not including a field.
394// One can then for instance read the field from the call-site (and remember to
395// call SetAt to inform this helper class), and then use this to read more.
396// Simple fields are stored (e.g. integers) and can be fetched from this class.
397// If asked to read a compound field (e.g. an expression) it will be skipped.
399 public:
400 enum Field {
409 };
410
411 enum Flag {
412 kFinal = 1 << 0,
413 kConst = 1 << 1,
416 kLate = 1 << 5,
417 kRequired = 1 << 6,
418 kCovariant = 1 << 7,
419 kLowered = 1 << 8,
420 kSynthesized = 1 << 9,
421 kHoisted = 1 << 10,
422 kWildcard = 1 << 11,
423 };
424
426 : annotation_count_(0), helper_(helper), next_read_(kPosition) {}
427
429 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
430 }
431
432 void ReadUntilExcluding(Field field);
433
434 void SetNext(Field field) { next_read_ = field; }
435 void SetJustRead(Field field) { next_read_ = field + 1; }
436
437 bool IsConst() const { return (flags_ & kConst) != 0; }
438 bool IsFinal() const { return (flags_ & kFinal) != 0; }
439 bool IsCovariant() const { return (flags_ & kCovariant) != 0; }
440 bool IsLate() const { return (flags_ & kLate) != 0; }
441 bool IsRequired() const { return (flags_ & kRequired) != 0; }
442 bool IsSynthesized() const { return (flags_ & kSynthesized) != 0; }
443 bool IsHoisted() const { return (flags_ & kHoisted) != 0; }
444 bool IsWildcard() const { return (flags_ & kWildcard) != 0; }
446 return (flags_ & kHasDeclaredInitializer) != 0;
447 }
448
450 return (flags_ & kIsGenericCovariantImpl) != 0;
451 }
452
453 TokenPosition position_ = TokenPosition::kNoSource;
454 TokenPosition equals_position_ = TokenPosition::kNoSource;
455 uint32_t flags_ = 0;
457 intptr_t annotation_count_ = 0;
458
459 private:
460 KernelReaderHelper* helper_;
461 intptr_t next_read_;
462
463 DISALLOW_COPY_AND_ASSIGN(VariableDeclarationHelper);
464};
465
466// Helper class that reads a kernel Field from binary.
467//
468// Use ReadUntilExcluding to read up to but not including a field.
469// One can then for instance read the field from the call-site (and remember to
470// call SetAt to inform this helper class), and then use this to read more.
471// Simple fields are stored (e.g. integers) and can be fetched from this class.
472// If asked to read a compound field (e.g. an expression) it will be skipped.
474 public:
475 enum Field {
476 kStart, // tag.
489 };
490
491 enum Flag {
492 kFinal = 1 << 0,
493 kConst = 1 << 1,
494 kStatic = 1 << 2,
495 kIsCovariant = 1 << 3,
497 kIsLate = 1 << 5,
500 kEnumElement = 1 << 8,
502 };
503
505 : helper_(helper), next_read_(kStart) {}
506
507 FieldHelper(KernelReaderHelper* helper, intptr_t offset);
508
510 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
511 }
512
513 void ReadUntilExcluding(Field field);
514
515 void SetNext(Field field) { next_read_ = field; }
516 void SetJustRead(Field field) { next_read_ = field + 1; }
517
518 bool IsConst() { return (flags_ & kConst) != 0; }
519 bool IsFinal() { return (flags_ & kFinal) != 0; }
520 bool IsStatic() { return (flags_ & kStatic) != 0; }
521 bool IsCovariant() const { return (flags_ & kIsCovariant) != 0; }
523 return (flags_ & kIsGenericCovariantImpl) != 0;
524 }
525 bool IsLate() const { return (flags_ & kIsLate) != 0; }
526 bool IsExtensionMember() const { return (flags_ & kExtensionMember) != 0; }
528 return (flags_ & kExtensionTypeMember) != 0;
529 }
530
534 TokenPosition position_ = TokenPosition::kNoSource;
535 TokenPosition end_position_ = TokenPosition::kNoSource;
536 uint32_t flags_ = 0;
537 intptr_t source_uri_index_ = 0;
538 intptr_t annotation_count_ = 0;
539
540 private:
541 KernelReaderHelper* helper_;
542 intptr_t next_read_;
543
544 DISALLOW_COPY_AND_ASSIGN(FieldHelper);
545};
546
547// Helper class that reads a kernel Procedure from binary.
548//
549// Use ReadUntilExcluding to read up to but not including a field.
550// One can then for instance read the field from the call-site (and remember to
551// call SetAt to inform this helper class), and then use this to read more.
552// Simple fields are stored (e.g. integers) and can be fetched from this class.
553// If asked to read a compound field (e.g. an expression) it will be skipped.
555 public:
556 enum Field {
557 kStart, // tag.
572 };
573
574 enum Kind {
580 };
581
582 enum StubKind {
590 };
591
592 enum Flag {
593 kStatic = 1 << 0,
594 kAbstract = 1 << 1,
595 kExternal = 1 << 2,
596 kConst = 1 << 3, // Only for external const factories.
602 };
603
605 : helper_(helper), next_read_(kStart) {}
606
608 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
609 }
610
611 void ReadUntilExcluding(Field field);
612
613 void SetNext(Field field) { next_read_ = field; }
614 void SetJustRead(Field field) { next_read_ = field + 1; }
615
616 bool IsStatic() const { return (flags_ & kStatic) != 0; }
617 bool IsAbstract() const { return (flags_ & kAbstract) != 0; }
618 bool IsExternal() const { return (flags_ & kExternal) != 0; }
619 bool IsConst() const { return (flags_ & kConst) != 0; }
620 bool IsSynthetic() const { return (flags_ & kSyntheticProcedure) != 0; }
622 return (flags_ & kInternalImplementation) != 0;
623 }
624 bool IsForwardingStub() const {
627 }
630 }
631 bool IsExtensionMember() const { return (flags_ & kExtensionMember) != 0; }
633 return (flags_ & kExtensionTypeMember) != 0;
634 }
635 bool IsMemberSignature() const {
637 }
638
640 TokenPosition start_position_ = TokenPosition::kNoSource;
641 TokenPosition position_ = TokenPosition::kNoSource;
642 TokenPosition end_position_ = TokenPosition::kNoSource;
644 uint32_t flags_ = 0;
645 intptr_t source_uri_index_ = 0;
646 intptr_t annotation_count_ = 0;
648
649 // Only valid if the 'isForwardingStub' flag is set.
651
652 private:
653 KernelReaderHelper* helper_;
654 intptr_t next_read_;
655
656 DISALLOW_COPY_AND_ASSIGN(ProcedureHelper);
657};
658
659// Helper class that reads a kernel Constructor from binary.
660//
661// Use ReadUntilExcluding to read up to but not including a field.
662// One can then for instance read the field from the call-site (and remember to
663// call SetAt to inform this helper class), and then use this to read more.
664// Simple fields are stored (e.g. integers) and can be fetched from this class.
665// If asked to read a compound field (e.g. an expression) it will be skipped.
667 public:
668 enum Field {
669 kStart, // tag.
681 };
682
683 enum Flag {
684 kConst = 1 << 0,
685 kExternal = 1 << 1,
686 kSynthetic = 1 << 2,
687 };
688
690 : helper_(helper), next_read_(kStart) {}
691
693 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
694 }
695
696 void ReadUntilExcluding(Field field);
697
698 void SetNext(Field field) { next_read_ = field; }
699 void SetJustRead(Field field) { next_read_ = field + 1; }
700
701 bool IsExternal() { return (flags_ & kExternal) != 0; }
702 bool IsConst() { return (flags_ & kConst) != 0; }
703 bool IsSynthetic() { return (flags_ & kSynthetic) != 0; }
704
706 TokenPosition start_position_ = TokenPosition::kNoSource;
707 TokenPosition position_ = TokenPosition::kNoSource;
708 TokenPosition end_position_ = TokenPosition::kNoSource;
709 uint8_t flags_ = 0;
710 intptr_t source_uri_index_ = 0;
711 intptr_t annotation_count_ = 0;
712
713 private:
714 KernelReaderHelper* helper_;
715 intptr_t next_read_;
716
717 DISALLOW_COPY_AND_ASSIGN(ConstructorHelper);
718};
719
720// Helper class that reads a kernel Class from binary.
721//
722// Use ReadUntilExcluding to read up to but not including a field.
723// One can then for instance read the field from the call-site (and remember to
724// call SetAt to inform this helper class), and then use this to read more.
725// Simple fields are stored (e.g. integers) and can be fetched from this class.
726// If asked to read a compound field (e.g. an expression) it will be skipped.
728 public:
729 enum Field {
730 kStart, // tag.
748 };
749
750 enum Flag {
751 kIsAbstract = 1 << 0,
752 kIsEnumClass = 1 << 1,
757 kIsMacro = 1 << 6,
758 kIsSealed = 1 << 7,
760 kIsBase = 1 << 9,
761 kIsInterface = 1 << 10,
762 kIsFinal = 1 << 11,
763 };
764
766 : helper_(helper), next_read_(kStart) {}
767
769 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
770 }
771
772 void ReadUntilExcluding(Field field);
773
774 void SetNext(Field field) { next_read_ = field; }
775 void SetJustRead(Field field) { next_read_ = field + 1; }
776
777 bool is_abstract() const { return (flags_ & Flag::kIsAbstract) != 0; }
778
779 bool is_enum_class() const { return (flags_ & Flag::kIsEnumClass) != 0; }
780
782 return (flags_ & Flag::kIsEliminatedMixin) != 0;
783 }
784
786 return (flags_ & Flag::kHasConstConstructor) != 0;
787 }
788
789 bool is_sealed() const { return (flags_ & Flag::kIsSealed) != 0; }
790
791 bool is_mixin_class() const { return (flags_ & Flag::kIsMixinClass) != 0; }
792
793 bool is_base() const { return (flags_ & Flag::kIsBase) != 0; }
794
795 bool is_interface() const { return (flags_ & Flag::kIsInterface) != 0; }
796
797 bool is_final() const { return (flags_ & Flag::kIsFinal) != 0; }
798
800 TokenPosition start_position_ = TokenPosition::kNoSource;
801 TokenPosition position_ = TokenPosition::kNoSource;
802 TokenPosition end_position_ = TokenPosition::kNoSource;
804 intptr_t source_uri_index_ = 0;
805 intptr_t annotation_count_ = 0;
806 intptr_t procedure_count_ = 0;
807 uint32_t flags_ = 0;
808
809 private:
810 KernelReaderHelper* helper_;
811 intptr_t next_read_;
812
813 DISALLOW_COPY_AND_ASSIGN(ClassHelper);
814};
815
816// Helper class that reads a kernel Library from binary.
817//
818// Use ReadUntilExcluding to read up to but not including a field.
819// One can then for instance read the field from the call-site (and remember to
820// call SetAt to inform this helper class), and then use this to read more.
821// Simple fields are stored (e.g. integers) and can be fetched from this class.
822// If asked to read a compound field (e.g. an expression) it will be skipped.
824 public:
825 enum Field {
827 kLanguageVersion /* from binary version 27 */,
834 // There are other fields in a library:
835 // * kAdditionalExports
836 // * kParts
837 // * kTypedefs
838 // * kClasses
839 // * kExtensions
840 // * kExtensionTypeDeclarations
841 // * kToplevelField
842 // * kToplevelProcedures
843 // * kSourceReferences
844 // * kLibraryIndex
845 // but we never read them via this helper and it makes extending the format
846 // harder to keep the code around.
847 };
848
849 enum Flag {
850 kSynthetic = 1 << 0,
853 kUnsupported = 1 << 3,
854 };
855
857 : helper_(helper), next_read_(kFlags) {}
858
860 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
861 }
862
863 void ReadUntilExcluding(Field field);
864
865 void SetNext(Field field) { next_read_ = field; }
866 void SetJustRead(Field field) { next_read_ = field + 1; }
867
868 bool IsSynthetic() const { return (flags_ & kSynthetic) != 0; }
872 if (!bit1 && !bit2) return NNBDCompiledMode::kStrong;
873 if (bit1 && !bit2) return NNBDCompiledMode::kWeak;
874 if (bit1 && bit2) return NNBDCompiledMode::kAgnostic;
875 if (!bit1 && bit2) return NNBDCompiledMode::kInvalid;
876 UNREACHABLE();
877 }
878
879 uint8_t flags_ = 0;
882 intptr_t source_uri_index_ = 0;
883
884 private:
885 KernelReaderHelper* helper_;
886 intptr_t next_read_;
887
888 DISALLOW_COPY_AND_ASSIGN(LibraryHelper);
889};
890
892 public:
893 enum Field {
901 };
902
903 enum Flag {
904 Export = 1 << 0,
905 Deferred = 1 << 1,
906 };
907
909 Show = 1 << 0,
910 };
911
913 : helper_(helper), next_read_(kFileOffset) {}
914
916 ReadUntilExcluding(static_cast<Field>(static_cast<int>(field) + 1));
917 }
918
919 void ReadUntilExcluding(Field field);
920
921 uint8_t flags_ = 0;
924 intptr_t annotation_count_ = 0;
925
926 private:
927 KernelReaderHelper* helper_;
928 intptr_t next_read_;
929
930 DISALLOW_COPY_AND_ASSIGN(LibraryDependencyHelper);
931};
932
933// Base class for helpers accessing metadata of a certain kind.
934// Assumes that metadata is accessed in linear order.
936 public:
938 const char* tag,
939 bool precompiler_only);
940
941#if defined(DEBUG)
942 static void VerifyMetadataMappings(const TypedDataView& metadata_mappings);
943#endif
944
945 protected:
946 // Look for metadata mapping with node offset greater or equal than the given.
947 intptr_t FindMetadataMapping(intptr_t node_offset);
948
949 // Return offset of the metadata payload corresponding to the given node,
950 // or -1 if there is no metadata.
951 // Assumes metadata is accesses for nodes in linear order most of the time.
952 intptr_t GetNextMetadataPayloadOffset(intptr_t node_offset);
953
954 // Returns metadata associated with component.
956
959
960 private:
962
963 void SetMetadataMappings(intptr_t mappings_offset, intptr_t mappings_num);
964 void ScanMetadataMappings();
965
966 const char* tag_;
967 bool mappings_scanned_;
968 bool precompiler_only_;
969 intptr_t mappings_offset_;
970 intptr_t mappings_num_;
971 intptr_t last_node_offset_;
972 intptr_t last_mapping_index_;
973
974 DISALLOW_COPY_AND_ASSIGN(MetadataHelper);
975};
976
978 enum Flag {
980 kFlagClosure = 1 << 1,
981 };
982
983 DirectCallMetadata(const Function& target, bool check_receiver_for_null)
984 : target_(target), check_receiver_for_null_(check_receiver_for_null) {}
985
988};
989
990// Helper class which provides access to direct call metadata.
992 public:
993 static const char* tag() { return "vm.direct-call.metadata"; }
994
996
1001
1002 private:
1003 bool ReadMetadata(intptr_t node_offset,
1004 NameIndex* target_name,
1005 bool* check_receiver_for_null,
1006 intptr_t* closure_id = nullptr);
1007
1008 DISALLOW_COPY_AND_ASSIGN(DirectCallMetadataHelper);
1009};
1010
1012 enum Flag {
1014 kFlagInt = 1 << 1,
1018 };
1019
1020 // Mask of flags which participate in CompileType computation.
1021 static constexpr intptr_t kCompileTypeFlagsMask = kFlagNullable | kFlagInt;
1022
1024 uint8_t flags_,
1025 const Object& constant_value_ = Object::null_object())
1026 : cid(cid_), flags(flags_), constant_value(constant_value_) {}
1027
1028 const intptr_t cid;
1029 const uint8_t flags;
1031
1032 bool IsTrivial() const {
1033 return (cid == kDynamicCid) &&
1035 }
1036 bool IsNullable() const { return (flags & kFlagNullable) != 0; }
1037 bool IsInt() const {
1038 return (flags & kFlagInt) != 0 || cid == kMintCid || cid == kSmiCid;
1039 }
1040 bool IsSkipCheck() const { return (flags & kFlagSkipCheck) != 0; }
1041 bool IsConstant() const { return (flags & kFlagConstant) != 0; }
1042 bool ReceiverNotInt() const { return (flags & kFlagReceiverNotInt) != 0; }
1043
1044 // Note: when updating this function to use some previously unused flags
1045 // make sure to update |kCompileTypeFlagsMask| above.
1047 const AbstractType* static_type = nullptr,
1048 bool can_be_sentinel = false) const {
1049 if (IsInt() && cid == kDynamicCid) {
1053 IsNullable(), can_be_sentinel);
1054 } else {
1055 return CompileType(IsNullable(), can_be_sentinel, cid, static_type);
1056 }
1057 }
1058};
1059
1060// Helper class which provides access to inferred type metadata.
1062 public:
1063 enum class Kind {
1064 Type, // Inferred type of a call, field or variable.
1065 ArgType, // Inferred incoming argument type.
1066 };
1067
1068 static const char* tag(Kind kind) {
1069 switch (kind) {
1070 case Kind::Type:
1071 return "vm.inferred-type.metadata";
1072 case Kind::ArgType:
1073 return "vm.inferred-arg-type.metadata";
1074 }
1075 UNREACHABLE();
1076 return nullptr;
1077 }
1078
1080 ConstantReader* constant_reader,
1081 Kind kind = Kind::Type);
1082
1083 InferredTypeMetadata GetInferredType(intptr_t node_offset,
1084 bool read_constant = true);
1085
1086 private:
1087 ConstantReader* constant_reader_;
1088
1089 DISALLOW_COPY_AND_ASSIGN(InferredTypeMetadataHelper);
1090};
1091
1093 static constexpr int32_t kInvalidSelectorId = 0;
1094
1097 bool has_this_uses = true;
1099 bool has_tearoff_uses = true;
1102
1103 void InitializeFromFlags(uint8_t flags);
1104};
1105
1106// Helper class which provides access to direct call metadata.
1108 public:
1109 static const char* tag() { return "vm.procedure-attributes.metadata"; }
1110
1112
1114
1115 private:
1116 bool ReadMetadata(intptr_t node_offset,
1117 ProcedureAttributesMetadata* metadata);
1118
1119 DISALLOW_COPY_AND_ASSIGN(ProcedureAttributesMetadataHelper);
1120};
1121
1123 public:
1124 static const char* tag() { return "vm.obfuscation-prohibitions.metadata"; }
1125
1127
1128 void ReadProhibitions() { ReadMetadata(0); }
1129
1130 private:
1131 void ReadMetadata(intptr_t node_offset);
1132
1133 DISALLOW_COPY_AND_ASSIGN(ObfuscationProhibitionsMetadataHelper);
1134};
1135
1137 public:
1138 static const char* tag() { return "vm.loading-units.metadata"; }
1139
1141
1142 void ReadLoadingUnits() { ReadMetadata(0); }
1143
1144 private:
1145 void ReadMetadata(intptr_t node_offset);
1146
1147 DISALLOW_COPY_AND_ASSIGN(LoadingUnitsMetadataHelper);
1148};
1149
1151 const AbstractType* receiver_type = nullptr;
1152};
1153
1154// Helper class which provides access to direct call metadata.
1156 public:
1157 static const char* tag() { return "vm.call-site-attributes.metadata"; }
1158
1160 TypeTranslator* type_translator);
1161
1163
1164 private:
1165 bool ReadMetadata(intptr_t node_offset, CallSiteAttributesMetadata* metadata);
1166
1167 TypeTranslator& type_translator_;
1168
1169 DISALLOW_COPY_AND_ASSIGN(CallSiteAttributesMetadataHelper);
1170};
1171
1172// Information about a table selector computed by the TFA.
1174 int call_count = 0;
1175 bool called_on_null = true;
1176 bool torn_off = true;
1177};
1178
1179// Collection of table selector information for all selectors in the program.
1181 public:
1182 explicit TableSelectorMetadata(intptr_t num_selectors)
1183 : selectors(num_selectors) {
1184 selectors.FillWith(TableSelectorInfo(), 0, num_selectors);
1185 }
1186
1188
1190};
1191
1192// Helper class which provides access to table selector metadata.
1194 public:
1195 static const char* tag() { return "vm.table-selector.metadata"; }
1196
1198
1200
1201 private:
1202 static constexpr uint8_t kCalledOnNullBit = 1 << 0;
1203 static constexpr uint8_t kTornOffBit = 1 << 1;
1204
1205 void ReadTableSelectorInfo(TableSelectorInfo* info);
1206
1207 DISALLOW_COPY_AND_ASSIGN(TableSelectorMetadataHelper);
1208};
1209
1210// Information about a function regarding unboxed parameters and return value.
1212 public:
1213 // Should match UnboxingKind in pkg/vm/lib/metadata/unboxing_info.dart.
1220 };
1221
1225 };
1226
1227 static constexpr uint8_t kMustUseStackCallingConventionFlag = 1 << 0;
1228 static constexpr uint8_t kHasUnboxedParameterOrReturnValueFlag = 1 << 1;
1229 static constexpr uint8_t kHasOverridesWithLessDirectParametersFlag = 1 << 2;
1230
1232
1233 void SetArgsCount(intptr_t num_args) {
1234 ASSERT(unboxed_args_info.is_empty());
1235 unboxed_args_info.SetLength(num_args);
1236 unboxed_args_info.FillWith(UnboxingType(), 0, num_args);
1237 }
1238
1239 // Caveat: this array does not cover receiver (`this`) which is always
1240 // assumed to be boxed.
1245
1247};
1248
1249// Helper class which provides access to unboxing information metadata.
1251 public:
1252 static const char* tag() { return "vm.unboxing-info.metadata"; }
1253
1255
1256 UnboxingInfoMetadata* GetUnboxingInfoMetadata(intptr_t node_offset);
1257
1258 private:
1259 UnboxingInfoMetadata::UnboxingType ReadUnboxingType() const;
1260
1261 DISALLOW_COPY_AND_ASSIGN(UnboxingInfoMetadataHelper);
1262};
1263
1265 public:
1267 TranslationHelper* translation_helper,
1268 const TypedDataBase& data,
1269 intptr_t data_program_offset)
1270 : zone_(zone),
1271 translation_helper_(*translation_helper),
1272 reader_(data),
1273 data_program_offset_(data_program_offset) {}
1274
1275 virtual ~KernelReaderHelper() = default;
1276
1277 void SetOffset(intptr_t offset);
1278
1279 intptr_t ReadListLength();
1281
1282 virtual void ReportUnexpectedTag(const char* variant, Tag tag);
1283
1284 void ReadUntilFunctionNode();
1285
1286 Tag PeekTag(uint8_t* payload = nullptr);
1287
1288 protected:
1289 virtual void set_current_script_id(intptr_t id) {
1290 // Do nothing by default.
1291 // This is overridden in KernelTokenPositionCollector.
1292 USE(id);
1293 }
1294
1295 virtual void RecordTokenPosition(TokenPosition position) {
1296 // Do nothing by default.
1297 // This is overridden in KernelTokenPositionCollector.
1298 USE(position);
1299 }
1300
1301 intptr_t ReaderOffset() const;
1302 intptr_t ReaderSize() const;
1303 void SkipBytes(intptr_t skip);
1304 bool ReadBool();
1305 uint8_t ReadByte();
1306 uint32_t ReadUInt();
1307 uint32_t ReadUInt32();
1308 uint32_t PeekUInt();
1309 double ReadDouble();
1310 uint32_t PeekListLength();
1317 const String& ReadNameAsFieldName();
1318 void SkipFlags();
1319 void SkipStringReference();
1320 void SkipConstantReference();
1323 void SkipDartType();
1324 void SkipOptionalDartType();
1325 void SkipInterfaceType(bool simple);
1326 void SkipFunctionType(bool simple);
1327 void SkipStatementList();
1328 void SkipListOfExpressions();
1330 void SkipListOfDartTypes();
1331 void SkipListOfStrings();
1335 void SkipInitializer();
1336 void SkipExpression();
1337 void SkipStatement();
1338 void SkipFunctionNode();
1339 void SkipName();
1340 void SkipArguments();
1342 void SkipLibraryCombinator();
1343 void SkipLibraryDependency();
1345 Tag ReadTag(uint8_t* payload = nullptr);
1346 uint8_t ReadFlags() { return reader_.ReadFlags(); }
1349
1350 intptr_t SourceTableSize();
1351 intptr_t GetOffsetForSourceInfo(intptr_t index);
1352 String& SourceTableUriFor(intptr_t index);
1353 const String& GetSourceFor(intptr_t index);
1354 TypedDataPtr GetLineStartsFor(intptr_t index);
1355 String& SourceTableImportUriFor(intptr_t index);
1356 TypedDataViewPtr GetConstantCoverageFor(intptr_t index);
1357
1361 // Some items like variables are specified in the kernel binary as
1362 // absolute offsets (as in, offsets within the whole kernel program)
1363 // of their declaration nodes. Hence, to cache and/or access them
1364 // uniquely from within a function's kernel data, we need to
1365 // add/subtract the offset of the kernel data in the over all
1366 // kernel program.
1368
1369 friend class ClassHelper;
1371 friend class ConstantReader;
1372 friend class ConstantHelper;
1373 friend class ConstructorHelper;
1375 friend class FieldHelper;
1378 friend class KernelLoader;
1380 friend class LibraryHelper;
1381 friend class MetadataHelper;
1383 friend class ProcedureHelper;
1385 friend class ScopeBuilder;
1388 friend class TypeTranslator;
1395 const Script& interesting_script);
1396
1397 private:
1399};
1400
1402 public:
1404 : klass(nullptr),
1405 member(nullptr),
1406 enclosing(nullptr),
1407 local_type_parameters(nullptr) {}
1408
1409 bool HasMember() { return member != nullptr; }
1410
1412 ASSERT(member != nullptr);
1413 UntaggedFunction::Kind function_kind = member->kind();
1414 return function_kind == UntaggedFunction::kRegularFunction ||
1415 function_kind == UntaggedFunction::kGetterFunction ||
1416 function_kind == UntaggedFunction::kSetterFunction ||
1417 function_kind == UntaggedFunction::kMethodExtractor ||
1418 function_kind == UntaggedFunction::kDynamicInvocationForwarder ||
1419 member->IsFactory();
1420 }
1421
1423 ASSERT(member != nullptr);
1424 return member->IsFactory();
1425 }
1426
1427 intptr_t MemberTypeParameterCount(Zone* zone);
1428
1430 ASSERT(klass != nullptr);
1431 return klass->NumTypeArguments();
1432 }
1433
1434 const char* ToCString() {
1435 return member != nullptr ? member->ToCString() : klass->ToCString();
1436 }
1437
1438 ScriptPtr ActiveScript() {
1439 if (member != nullptr && !member->IsNull()) {
1440 return member->script();
1441 }
1442 if (klass != nullptr && !klass->IsNull()) {
1443 return klass->script();
1444 }
1445 return Script::null();
1446 }
1447
1448 // The current enclosing class (or the library top-level class).
1449 const Class* klass;
1450
1452
1453 // The innermost enclosing signature. This is used for building types, as a
1454 // parent for function types.
1456
1458};
1459
1461 public:
1462 ActiveClassScope(ActiveClass* active_class, const Class* klass)
1463 : active_class_(active_class), saved_(*active_class) {
1464 active_class_->klass = klass;
1465 }
1466
1467 ~ActiveClassScope() { *active_class_ = saved_; }
1468
1469 private:
1470 ActiveClass* active_class_;
1471 ActiveClass saved_;
1472
1473 DISALLOW_COPY_AND_ASSIGN(ActiveClassScope);
1474};
1475
1477 public:
1478 ActiveMemberScope(ActiveClass* active_class, const Function* member)
1479 : active_class_(active_class), saved_(*active_class) {
1480 // The class is inherited.
1481 active_class_->member = member;
1482 }
1483
1484 ~ActiveMemberScope() { *active_class_ = saved_; }
1485
1486 private:
1487 ActiveClass* active_class_;
1488 ActiveClass saved_;
1489
1490 DISALLOW_COPY_AND_ASSIGN(ActiveMemberScope);
1491};
1492
1494 public:
1496 const FunctionType* enclosing_signature)
1497 : active_class_(active_class), saved_(*active_class) {
1498 active_class_->enclosing = enclosing_signature;
1499 }
1500
1501 ~ActiveEnclosingFunctionScope() { *active_class_ = saved_; }
1502
1503 private:
1504 ActiveClass* active_class_;
1505 ActiveClass saved_;
1506
1507 DISALLOW_COPY_AND_ASSIGN(ActiveEnclosingFunctionScope);
1508};
1509
1511 public:
1512 // Set the local type parameters of the ActiveClass to be exactly all type
1513 // parameters defined by 'innermost' and any enclosing *closures* (but not
1514 // enclosing methods/top-level functions/classes).
1515 //
1516 // Also, the enclosing signature is set to innermost's signature.
1518 const Function& innermost,
1519 const FunctionType* innermost_signature,
1520 Zone* Z);
1521
1522 // Append the list of the local type parameters to the list in ActiveClass.
1523 //
1524 // Also, the enclosing signature is set to 'signature'.
1526 const FunctionType* innermost_signature,
1527 Zone* Z);
1528
1530
1531 private:
1532 ActiveClass* active_class_;
1533 ActiveClass saved_;
1534 Zone* zone_;
1535
1536 DISALLOW_COPY_AND_ASSIGN(ActiveTypeParametersScope);
1537};
1538
1540 public:
1542 ConstantReader* constant_reader,
1543 ActiveClass* active_class,
1544 bool finalize = false,
1545 bool in_constant_context = false);
1546
1549
1550 const TypeArguments& BuildTypeArguments(intptr_t length);
1551
1553 const Class& receiver_class,
1554 intptr_t length);
1555
1556 void LoadAndSetupTypeParameters(ActiveClass* active_class,
1557 const Function& function,
1558 const Class& parameterized_class,
1559 const FunctionType& parameterized_signature,
1560 intptr_t type_parameter_count);
1561
1562 void LoadAndSetupBounds(ActiveClass* active_class,
1563 const Function& function,
1564 const Class& parameterized_class,
1565 const FunctionType& parameterized_signature,
1566 intptr_t type_parameter_count);
1567
1568 const Type& ReceiverType(const Class& klass);
1569
1570 void SetupFunctionParameters(const Class& klass,
1571 const Function& function,
1572 bool is_method,
1573 bool is_closure,
1574 FunctionNodeHelper* function_node_helper);
1575
1576 private:
1577 void SetupUnboxingInfoMetadata(const Function& function,
1578 intptr_t library_kernel_offset);
1579 void SetupUnboxingInfoMetadataForFieldAccessors(
1580 const Function& field_accessor,
1581 intptr_t library_kernel_offset);
1582
1583 void BuildTypeInternal();
1584 void BuildInterfaceType(bool simple);
1585 void BuildFunctionType(bool simple);
1586 void BuildRecordType();
1587 void BuildTypeParameterType();
1588 void BuildIntersectionType();
1589 void BuildExtensionType();
1590 void BuildFutureOrType();
1591
1592 ScriptPtr Script() {
1593 if (active_class_ != nullptr) {
1594 return active_class_->ActiveScript();
1595 }
1596 return Script::null();
1597 }
1598
1599 class TypeParameterScope {
1600 public:
1601 TypeParameterScope(TypeTranslator* translator, intptr_t parameter_count)
1602 : parameter_count_(parameter_count),
1603 outer_(translator->type_parameter_scope_),
1604 translator_(translator) {
1605 outer_parameter_count_ = 0;
1606 if (outer_ != nullptr) {
1607 outer_parameter_count_ =
1608 outer_->outer_parameter_count_ + outer_->parameter_count_;
1609 }
1610 translator_->type_parameter_scope_ = this;
1611 }
1612 ~TypeParameterScope() { translator_->type_parameter_scope_ = outer_; }
1613
1614 TypeParameterScope* outer() const { return outer_; }
1615 intptr_t parameter_count() const { return parameter_count_; }
1616 intptr_t outer_parameter_count() const { return outer_parameter_count_; }
1617
1618 private:
1619 intptr_t parameter_count_;
1620 intptr_t outer_parameter_count_;
1621 TypeParameterScope* outer_;
1622 TypeTranslator* translator_;
1623 };
1624
1625 KernelReaderHelper* helper_;
1626 ConstantReader* constant_reader_;
1627 TranslationHelper& translation_helper_;
1628 ActiveClass* const active_class_;
1629 TypeParameterScope* type_parameter_scope_;
1630 InferredTypeMetadataHelper inferred_type_metadata_helper_;
1631 UnboxingInfoMetadataHelper unboxing_info_metadata_helper_;
1632 Zone* zone_;
1633 AbstractType& result_;
1634 bool finalize_;
1635 const bool in_constant_context_;
1636
1637 friend class ScopeBuilder;
1638 friend class KernelLoader;
1639
1641};
1642
1643} // namespace kernel
1644} // namespace dart
1645
1646#endif // RUNTIME_VM_COMPILER_FRONTEND_KERNEL_TRANSLATION_HELPER_H_
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static bool skip(SkStream *stream, size_t amount)
#define UNREACHABLE()
Definition: assert.h:248
#define Z
intptr_t NumTypeArguments() const
Definition: object.cc:3640
ScriptPtr script() const
Definition: object.h:1272
static CompileType FromAbstractType(const AbstractType &type, bool can_be_null, bool can_be_sentinel)
ScriptPtr script() const
Definition: object.cc:10881
bool IsFactory() const
Definition: object.h:3367
UntaggedFunction::Kind kind() const
Definition: object.h:3349
static ObjectPtr null()
Definition: object.h:433
ObjectPtr ptr() const
Definition: object.h:332
virtual const char * ToCString() const
Definition: object.h:366
bool IsNull() const
Definition: object.h:363
static Object & Handle()
Definition: object.h:407
static Object & ZoneHandle()
Definition: object.h:419
static RecordShape ForUnnamed(intptr_t num_fields)
Definition: object.h:11308
static TypePtr IntType()
static TypePtr NullableIntType()
ActiveClassScope(ActiveClass *active_class, const Class *klass)
const TypeArguments * local_type_parameters
intptr_t MemberTypeParameterCount(Zone *zone)
ActiveEnclosingFunctionScope(ActiveClass *active_class, const FunctionType *enclosing_signature)
ActiveMemberScope(ActiveClass *active_class, const Function *member)
ActiveTypeParametersScope(ActiveClass *active_class, const Function &innermost, const FunctionType *innermost_signature, Zone *Z)
CallSiteAttributesMetadataHelper(KernelReaderHelper *helper, TypeTranslator *type_translator)
CallSiteAttributesMetadata GetCallSiteAttributes(intptr_t node_offset)
ClassHelper(KernelReaderHelper *helper)
ConstructorHelper(KernelReaderHelper *helper)
DirectCallMetadata GetDirectTargetForPropertyGet(intptr_t node_offset)
DirectCallMetadata GetDirectTargetForFunctionInvocation(intptr_t node_offset)
DirectCallMetadata GetDirectTargetForMethodInvocation(intptr_t node_offset)
DirectCallMetadata GetDirectTargetForPropertySet(intptr_t node_offset)
FieldHelper(KernelReaderHelper *helper)
FunctionNodeHelper(KernelReaderHelper *helper)
InferredTypeMetadataHelper(KernelReaderHelper *helper, ConstantReader *constant_reader, Kind kind=Kind::Type)
InferredTypeMetadata GetInferredType(intptr_t node_offset, bool read_constant=true)
const String & GetSourceFor(intptr_t index)
friend ArrayPtr CollectConstConstructorCoverageFrom(const Script &interesting_script)
friend bool NeedsDynamicInvocationForwarder(const Function &function)
Definition: kernel.cc:657
KernelReaderHelper(Zone *zone, TranslationHelper *translation_helper, const TypedDataBase &data, intptr_t data_program_offset)
virtual ~KernelReaderHelper()=default
Tag ReadTag(uint8_t *payload=nullptr)
virtual void set_current_script_id(intptr_t id)
virtual void ReportUnexpectedTag(const char *variant, Tag tag)
Tag PeekTag(uint8_t *payload=nullptr)
virtual void RecordTokenPosition(TokenPosition position)
String & SourceTableImportUriFor(intptr_t index)
TypedDataViewPtr GetConstantCoverageFor(intptr_t index)
TypedDataPtr GetLineStartsFor(intptr_t index)
LibraryDependencyHelper(KernelReaderHelper *helper)
LibraryHelper(KernelReaderHelper *helper)
NNBDCompiledMode GetNonNullableByDefaultCompiledMode() const
intptr_t FindMetadataMapping(intptr_t node_offset)
intptr_t GetNextMetadataPayloadOffset(intptr_t node_offset)
ProcedureAttributesMetadata GetProcedureAttributes(intptr_t node_offset)
ProcedureHelper(KernelReaderHelper *helper)
TableSelectorMetadata * GetTableSelectorMetadata(Zone *zone)
DISALLOW_COPY_AND_ASSIGN(TableSelectorMetadata)
GrowableArray< TableSelectorInfo > selectors
const String & DartProcedureName(NameIndex procedure)
Type & GetDeclarationType(const Class &klass)
void SetConstantsTable(const TypedDataView &constants_table)
InstancePtr Canonicalize(const Instance &instance)
FunctionPtr LookupStaticMethodByKernelProcedure(NameIndex procedure, bool required=true)
const TypedDataView & string_data() const
FunctionPtr LookupDynamicFunction(const Class &klass, const String &name)
const TypedDataView & metadata_mappings() const
const String & DartSetterName(NameIndex setter)
FieldPtr LookupFieldByKernelGetterOrSetter(NameIndex field, bool required=true)
String & DartString(StringIndex index)
intptr_t StringSize(StringIndex index) const
void SetCanonicalNames(const TypedData &canonical_names)
const TypedDataView & constants_table() const
intptr_t StringOffset(StringIndex index) const
void ReportError(const char *format,...) PRINTF_ATTRIBUTE(2
const String & DartClassName(NameIndex kernel_class)
uint8_t * StringBuffer(StringIndex index) const
const String & DartString(const char *content)
FunctionPtr LookupMethodByMember(NameIndex target, const String &method_name, bool required=true)
const String & DartConstructorName(NameIndex constructor)
NameIndex CanonicalNameParent(NameIndex name)
FieldPtr LookupFieldByKernelField(NameIndex field, bool required=true)
void SetMetadataMappings(const TypedDataView &metadata_mappings)
const KernelProgramInfo & GetKernelProgramInfo() const
void SetKernelProgramInfo(const KernelProgramInfo &info)
void InitFromKernelProgramInfo(const KernelProgramInfo &info)
ClassPtr LookupClassByKernelClassOrLibrary(NameIndex kernel_name, bool required=true)
uint8_t CharacterAt(StringIndex string_index, intptr_t index)
String & DartIdentifier(const Library &lib, StringIndex string_index)
const TypedData & canonical_names() const
const String & DartFactoryName(NameIndex factory)
void SetExpressionEvaluationClass(const Class &cls)
const TypedData & string_offsets() const
const String & DartMethodName(NameIndex method)
const TypedDataView & metadata_payloads() const
const String & DartSymbolPlain(const char *content) const
DART_NORETURN void LookupFailed(NameIndex name)
virtual LibraryPtr LookupLibraryByKernelLibrary(NameIndex library, bool required=true)
FunctionPtr LookupConstructorByKernelConstructor(NameIndex constructor, bool required=true)
const String & DartGetterName(NameIndex getter)
void SetupFieldAccessorFunction(const Class &klass, const Function &function, const AbstractType &field_type)
const String & DartSymbolObfuscate(const char *content) const
bool StringEquals(StringIndex string_index, const char *other)
StringIndex CanonicalNameString(NameIndex name)
void SetExpressionEvaluationRealClass(const Class &real_class)
void SetStringOffsets(const TypedData &string_offsets)
const String & DartFieldName(NameIndex field)
void SetConstants(const Array &constants)
void SetStringData(const TypedDataView &string_data)
ObjectPtr LookupMemberByMember(NameIndex kernel_name, bool required=true)
void SetMetadataPayloads(const TypedDataView &metadata_payloads)
void void void void void SetExpressionEvaluationFunction(const Function &function)
virtual ClassPtr LookupClassByKernelClass(NameIndex klass, bool required=true)
TypeParameterHelper(KernelReaderHelper *helper)
TypeTranslator(KernelReaderHelper *helper, ConstantReader *constant_reader, ActiveClass *active_class, bool finalize=false, bool in_constant_context=false)
const TypeArguments & BuildTypeArguments(intptr_t length)
void SetupFunctionParameters(const Class &klass, const Function &function, bool is_method, bool is_closure, FunctionNodeHelper *function_node_helper)
const Type & ReceiverType(const Class &klass)
void LoadAndSetupTypeParameters(ActiveClass *active_class, const Function &function, const Class &parameterized_class, const FunctionType &parameterized_signature, intptr_t type_parameter_count)
const TypeArguments & BuildInstantiatedTypeArguments(const Class &receiver_class, intptr_t length)
void LoadAndSetupBounds(ActiveClass *active_class, const Function &function, const Class &parameterized_class, const FunctionType &parameterized_signature, intptr_t type_parameter_count)
UnboxingInfoMetadata * GetUnboxingInfoMetadata(intptr_t node_offset)
static constexpr uint8_t kMustUseStackCallingConventionFlag
static constexpr uint8_t kHasUnboxedParameterOrReturnValueFlag
static constexpr uint8_t kHasOverridesWithLessDirectParametersFlag
DISALLOW_COPY_AND_ASSIGN(UnboxingInfoMetadata)
GrowableArray< UnboxingType > unboxed_args_info
VariableDeclarationHelper(KernelReaderHelper *helper)
#define ASSERT(E)
VkInstance instance
Definition: main.cc:48
FlutterSemanticsFlag flags
uint32_t uint32_t * format
uint32_t * target
Dart_NativeFunction function
Definition: fuchsia.cc:51
size_t length
union flutter::testing::@2836::KeyboardChange::@76 content
Definition: dart_vm.cc:33
const char *const name
Nullability
Definition: object.h:1112
@ kDynamicCid
Definition: class_id.h:253
static void USE(T &&)
Definition: globals.h:618
NNBDCompiledMode
Definition: object.h:1126
static int8_t data[kExtLength]
#define PRINTF_ATTRIBUTE(string_index, first_to_check)
Definition: globals.h:697
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: globals.h:581
SeparatedVector2 offset
DirectCallMetadata(const Function &target, bool check_receiver_for_null)
InferredTypeMetadata(intptr_t cid_, uint8_t flags_, const Object &constant_value_=Object::null_object())
CompileType ToCompileType(Zone *zone, const AbstractType *static_type=nullptr, bool can_be_sentinel=false) const