Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: runtime/vm/raw_object.h

Issue 328893002: Begins removing intptr_t from raw object fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 // or the canonical type. 500 // or the canonical type.
501 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. 501 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions.
502 RawArray* cha_codes_; // CHA optimized codes. 502 RawArray* cha_codes_; // CHA optimized codes.
503 RawCode* allocation_stub_; // Stub code for allocation of instances. 503 RawCode* allocation_stub_; // Stub code for allocation of instances.
504 RawObject** to() { 504 RawObject** to() {
505 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); 505 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_);
506 } 506 }
507 507
508 cpp_vtable handle_vtable_; 508 cpp_vtable handle_vtable_;
509 intptr_t id_; // Class Id, also index in the class table. 509 intptr_t id_; // Class Id, also index in the class table.
510 intptr_t token_pos_; 510 int32_t token_pos_;
511 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. 511 int32_t instance_size_in_words_; // Size if fixed len or 0 if variable len.
512 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. 512 int32_t type_arguments_field_offset_in_words_; // Offset of type args fld.
513 intptr_t next_field_offset_in_words_; // Offset of the next instance field. 513 int32_t next_field_offset_in_words_; // Offset of the next instance field.
514 int16_t num_type_arguments_; // Number of type arguments in flatten vector. 514 int16_t num_type_arguments_; // Number of type arguments in flatten vector.
515 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments. 515 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments.
516 uint16_t num_native_fields_; // Number of native fields in class. 516 uint16_t num_native_fields_; // Number of native fields in class.
517 uint16_t state_bits_; 517 uint16_t state_bits_;
518 518
519 friend class Instance; 519 friend class Instance;
520 friend class Object; 520 friend class Object;
521 friend class RawInstance; 521 friend class RawInstance;
522 friend class RawInstructions; 522 friend class RawInstructions;
523 friend class SnapshotReader; 523 friend class SnapshotReader;
524 }; 524 };
525 525
526 526
527 class RawUnresolvedClass : public RawObject { 527 class RawUnresolvedClass : public RawObject {
528 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); 528 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass);
529 529
530 RawObject** from() { 530 RawObject** from() {
531 return reinterpret_cast<RawObject**>(&ptr()->library_prefix_); 531 return reinterpret_cast<RawObject**>(&ptr()->library_prefix_);
532 } 532 }
533 RawLibraryPrefix* library_prefix_; // Library prefix qualifier for the ident. 533 RawLibraryPrefix* library_prefix_; // Library prefix qualifier for the ident.
534 RawString* ident_; // Name of the unresolved identifier. 534 RawString* ident_; // Name of the unresolved identifier.
535 RawObject** to() { 535 RawObject** to() {
536 return reinterpret_cast<RawObject**>(&ptr()->ident_); 536 return reinterpret_cast<RawObject**>(&ptr()->ident_);
537 } 537 }
538 intptr_t token_pos_; 538 int32_t token_pos_;
539 }; 539 };
540 540
541 541
542 class RawTypeArguments : public RawObject { 542 class RawTypeArguments : public RawObject {
543 private: 543 private:
544 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments); 544 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments);
545 545
546 RawObject** from() { 546 RawObject** from() {
547 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); 547 return reinterpret_cast<RawObject**>(&ptr()->instantiations_);
548 } 548 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 RawObject** to() { 617 RawObject** to() {
618 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); 618 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_);
619 } 619 }
620 RawObject** to_no_code() { 620 RawObject** to_no_code() {
621 return reinterpret_cast<RawObject**>(&ptr()->data_); 621 return reinterpret_cast<RawObject**>(&ptr()->data_);
622 } 622 }
623 RawObject** to_snapshot() { 623 RawObject** to_snapshot() {
624 return reinterpret_cast<RawObject**>(&ptr()->data_); 624 return reinterpret_cast<RawObject**>(&ptr()->data_);
625 } 625 }
626 626
627 intptr_t token_pos_; 627 int32_t token_pos_;
628 intptr_t end_token_pos_; 628 int32_t end_token_pos_;
629 intptr_t usage_counter_; // Incremented while function is running. 629 int32_t usage_counter_; // Incremented while function is running.
630 int16_t num_fixed_parameters_; 630 int16_t num_fixed_parameters_;
631 int16_t num_optional_parameters_; // > 0: positional; < 0: named. 631 int16_t num_optional_parameters_; // > 0: positional; < 0: named.
632 int16_t deoptimization_counter_; 632 int16_t deoptimization_counter_;
633 uint16_t kind_tag_; // See Function::KindTagBits. 633 uint16_t kind_tag_; // See Function::KindTagBits.
634 uint16_t optimized_instruction_count_; 634 uint16_t optimized_instruction_count_;
635 uint16_t optimized_call_site_count_; 635 uint16_t optimized_call_site_count_;
636 }; 636 };
637 637
638 638
639 class RawClosureData : public RawObject { 639 class RawClosureData : public RawObject {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 RawObject* owner_; // Class or patch class or mixin class 677 RawObject* owner_; // Class or patch class or mixin class
678 // where this field is defined. 678 // where this field is defined.
679 RawAbstractType* type_; 679 RawAbstractType* type_;
680 RawInstance* value_; // Offset in words for instance and value for static. 680 RawInstance* value_; // Offset in words for instance and value for static.
681 RawArray* dependent_code_; 681 RawArray* dependent_code_;
682 RawSmi* guarded_list_length_; 682 RawSmi* guarded_list_length_;
683 RawObject** to() { 683 RawObject** to() {
684 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_); 684 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_);
685 } 685 }
686 686
687 intptr_t token_pos_; 687 int32_t token_pos_;
688 intptr_t guarded_cid_; 688 int32_t guarded_cid_;
689 intptr_t is_nullable_; // kNullCid if field can contain null value and 689 int32_t is_nullable_; // kNullCid if field can contain null value and
690 // any other value otherwise. 690 // any other value otherwise.
691 // Offset to the guarded length field inside an instance of class matching 691 // Offset to the guarded length field inside an instance of class matching
692 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code 692 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code
693 // generated on platforms with weak addressing modes (ARM, MIPS). 693 // generated on platforms with weak addressing modes (ARM, MIPS).
694 int8_t guarded_list_length_in_object_offset_; 694 int8_t guarded_list_length_in_object_offset_;
695 695
696 uint8_t kind_bits_; // static, final, const, has initializer. 696 uint8_t kind_bits_; // static, final, const, has initializer.
697 }; 697 };
698 698
699 699
700 class RawLiteralToken : public RawObject { 700 class RawLiteralToken : public RawObject {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 742
743 private: 743 private:
744 RAW_HEAP_OBJECT_IMPLEMENTATION(Script); 744 RAW_HEAP_OBJECT_IMPLEMENTATION(Script);
745 745
746 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->url_); } 746 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->url_); }
747 RawString* url_; 747 RawString* url_;
748 RawString* source_; 748 RawString* source_;
749 RawTokenStream* tokens_; 749 RawTokenStream* tokens_;
750 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->tokens_); } 750 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->tokens_); }
751 751
752 intptr_t line_offset_; 752 int32_t line_offset_;
753 intptr_t col_offset_; 753 int32_t col_offset_;
754 int8_t kind_; // Of type Kind. 754 int8_t kind_; // Of type Kind.
755 }; 755 };
756 756
757 757
758 class RawLibrary : public RawObject { 758 class RawLibrary : public RawObject {
759 enum LibraryState { 759 enum LibraryState {
760 kAllocated, // Initial state. 760 kAllocated, // Initial state.
761 kLoadInProgress, // Library is in the process of being loaded. 761 kLoadInProgress, // Library is in the process of being loaded.
762 kLoaded, // Library is loaded. 762 kLoaded, // Library is loaded.
763 kLoadError, // Error occurred during load of the Library. 763 kLoadError, // Error occurred during load of the Library.
(...skipping 10 matching lines...) Expand all
774 RawArray* resolved_names_; // Cache of resolved names in library scope. 774 RawArray* resolved_names_; // Cache of resolved names in library scope.
775 RawGrowableObjectArray* metadata_; // Metadata on classes, methods etc. 775 RawGrowableObjectArray* metadata_; // Metadata on classes, methods etc.
776 RawArray* anonymous_classes_; // Classes containing top-level elements. 776 RawArray* anonymous_classes_; // Classes containing top-level elements.
777 RawArray* imports_; // List of Namespaces imported without prefix. 777 RawArray* imports_; // List of Namespaces imported without prefix.
778 RawArray* exports_; // List of re-exported Namespaces. 778 RawArray* exports_; // List of re-exported Namespaces.
779 RawArray* loaded_scripts_; // Array of scripts loaded in this library. 779 RawArray* loaded_scripts_; // Array of scripts loaded in this library.
780 RawObject** to() { 780 RawObject** to() {
781 return reinterpret_cast<RawObject**>(&ptr()->loaded_scripts_); 781 return reinterpret_cast<RawObject**>(&ptr()->loaded_scripts_);
782 } 782 }
783 783
784 intptr_t index_; // Library id number. 784 int32_t index_; // Library id number.
785 intptr_t num_imports_; // Number of entries in imports_. 785 int32_t num_imports_; // Number of entries in imports_.
786 intptr_t num_anonymous_; // Number of entries in anonymous_classes_. 786 int32_t num_anonymous_; // Number of entries in anonymous_classes_.
787 Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives. 787 Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives.
788 Dart_NativeEntrySymbol native_entry_symbol_resolver_; 788 Dart_NativeEntrySymbol native_entry_symbol_resolver_;
789 bool corelib_imported_; 789 bool corelib_imported_;
790 bool is_dart_scheme_; 790 bool is_dart_scheme_;
791 bool debuggable_; // True if debugger can stop in library. 791 bool debuggable_; // True if debugger can stop in library.
792 int8_t load_state_; // Of type LibraryState. 792 int8_t load_state_; // Of type LibraryState.
793 793
794 friend class Isolate; 794 friend class Isolate;
795 }; 795 };
796 796
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 1059
1060 RawObject** from() { 1060 RawObject** from() {
1061 return reinterpret_cast<RawObject**>(&ptr()->buckets_); 1061 return reinterpret_cast<RawObject**>(&ptr()->buckets_);
1062 } 1062 }
1063 RawArray* buckets_; 1063 RawArray* buckets_;
1064 RawSmi* mask_; 1064 RawSmi* mask_;
1065 RawObject** to() { 1065 RawObject** to() {
1066 return reinterpret_cast<RawObject**>(&ptr()->mask_); 1066 return reinterpret_cast<RawObject**>(&ptr()->mask_);
1067 } 1067 }
1068 1068
1069 intptr_t filled_entry_count_; 1069 int32_t filled_entry_count_;
1070 }; 1070 };
1071 1071
1072 1072
1073 class RawSubtypeTestCache : public RawObject { 1073 class RawSubtypeTestCache : public RawObject {
1074 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache); 1074 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache);
1075 RawArray* cache_; 1075 RawArray* cache_;
1076 }; 1076 };
1077 1077
1078 1078
1079 class RawError : public RawObject { 1079 class RawError : public RawObject {
(...skipping 20 matching lines...) Expand all
1100 RawObject** from() { 1100 RawObject** from() {
1101 return reinterpret_cast<RawObject**>(&ptr()->previous_error_); 1101 return reinterpret_cast<RawObject**>(&ptr()->previous_error_);
1102 } 1102 }
1103 RawError* previous_error_; // May be null. 1103 RawError* previous_error_; // May be null.
1104 RawScript* script_; 1104 RawScript* script_;
1105 RawString* message_; 1105 RawString* message_;
1106 RawString* formatted_message_; // Incl. previous error's formatted message. 1106 RawString* formatted_message_; // Incl. previous error's formatted message.
1107 RawObject** to() { 1107 RawObject** to() {
1108 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_); 1108 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_);
1109 } 1109 }
1110 intptr_t token_pos_; // Source position in script_. 1110 int32_t token_pos_; // Source position in script_.
1111 int8_t kind_; // Of type LanguageError::Kind. 1111 int8_t kind_; // Of type LanguageError::Kind.
1112 }; 1112 };
1113 1113
1114 1114
1115 class RawUnhandledException : public RawError { 1115 class RawUnhandledException : public RawError {
1116 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException); 1116 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException);
1117 1117
1118 RawObject** from() { 1118 RawObject** from() {
1119 return reinterpret_cast<RawObject**>(&ptr()->exception_); 1119 return reinterpret_cast<RawObject**>(&ptr()->exception_);
1120 } 1120 }
(...skipping 27 matching lines...) Expand all
1148 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); 1148 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix);
1149 1149
1150 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 1150 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
1151 RawString* name_; // Library prefix name. 1151 RawString* name_; // Library prefix name.
1152 RawArray* imports_; // Libraries imported with this prefix. 1152 RawArray* imports_; // Libraries imported with this prefix.
1153 RawArray* dependent_code_; // Code that refers to deferred, unloaded 1153 RawArray* dependent_code_; // Code that refers to deferred, unloaded
1154 // library prefix. 1154 // library prefix.
1155 RawObject** to() { 1155 RawObject** to() {
1156 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); 1156 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_);
1157 } 1157 }
1158 intptr_t num_imports_; // Number of library entries in libraries_. 1158 int32_t num_imports_; // Number of library entries in libraries_.
1159 bool is_deferred_load_; 1159 bool is_deferred_load_;
1160 bool is_loaded_; 1160 bool is_loaded_;
1161 }; 1161 };
1162 1162
1163 1163
1164 class RawAbstractType : public RawInstance { 1164 class RawAbstractType : public RawInstance {
1165 protected: 1165 protected:
1166 enum TypeState { 1166 enum TypeState {
1167 kAllocated, // Initial state. 1167 kAllocated, // Initial state.
1168 kResolved, // Type class and type arguments resolved. 1168 kResolved, // Type class and type arguments resolved.
(...skipping 15 matching lines...) Expand all
1184 1184
1185 RawObject** from() { 1185 RawObject** from() {
1186 return reinterpret_cast<RawObject**>(&ptr()->type_class_); 1186 return reinterpret_cast<RawObject**>(&ptr()->type_class_);
1187 } 1187 }
1188 RawObject* type_class_; // Either resolved class or unresolved class. 1188 RawObject* type_class_; // Either resolved class or unresolved class.
1189 RawTypeArguments* arguments_; 1189 RawTypeArguments* arguments_;
1190 RawLanguageError* error_; // Error object if type is malformed or malbounded. 1190 RawLanguageError* error_; // Error object if type is malformed or malbounded.
1191 RawObject** to() { 1191 RawObject** to() {
1192 return reinterpret_cast<RawObject**>(&ptr()->error_); 1192 return reinterpret_cast<RawObject**>(&ptr()->error_);
1193 } 1193 }
1194 intptr_t token_pos_; 1194 int32_t token_pos_;
1195 int8_t type_state_; 1195 int8_t type_state_;
1196 }; 1196 };
1197 1197
1198 1198
1199 class RawTypeRef : public RawAbstractType { 1199 class RawTypeRef : public RawAbstractType {
1200 private: 1200 private:
1201 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); 1201 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef);
1202 1202
1203 RawObject** from() { 1203 RawObject** from() {
1204 return reinterpret_cast<RawObject**>(&ptr()->type_); 1204 return reinterpret_cast<RawObject**>(&ptr()->type_);
1205 } 1205 }
1206 RawAbstractType* type_; // The referenced type. 1206 RawAbstractType* type_; // The referenced type.
1207 RawObject** to() { 1207 RawObject** to() {
1208 return reinterpret_cast<RawObject**>(&ptr()->type_); 1208 return reinterpret_cast<RawObject**>(&ptr()->type_);
1209 } 1209 }
1210 }; 1210 };
1211 1211
1212 1212
1213 class RawTypeParameter : public RawAbstractType { 1213 class RawTypeParameter : public RawAbstractType {
1214 private: 1214 private:
1215 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); 1215 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter);
1216 1216
1217 RawObject** from() { 1217 RawObject** from() {
1218 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_); 1218 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_);
1219 } 1219 }
1220 RawClass* parameterized_class_; 1220 RawClass* parameterized_class_;
1221 RawString* name_; 1221 RawString* name_;
1222 RawAbstractType* bound_; // ObjectType if no explicit bound specified. 1222 RawAbstractType* bound_; // ObjectType if no explicit bound specified.
1223 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); } 1223 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); }
1224 intptr_t index_; 1224 int32_t index_;
1225 intptr_t token_pos_; 1225 int32_t token_pos_;
1226 int8_t type_state_; 1226 int8_t type_state_;
1227 }; 1227 };
1228 1228
1229 1229
1230 class RawBoundedType : public RawAbstractType { 1230 class RawBoundedType : public RawAbstractType {
1231 private: 1231 private:
1232 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); 1232 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType);
1233 1233
1234 RawObject** from() { 1234 RawObject** from() {
1235 return reinterpret_cast<RawObject**>(&ptr()->type_); 1235 return reinterpret_cast<RawObject**>(&ptr()->type_);
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); 1859 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14);
1860 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 1860 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
1861 kTypedDataInt8ArrayViewCid + 15); 1861 kTypedDataInt8ArrayViewCid + 15);
1862 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); 1862 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14);
1863 return (kNullCid - kTypedDataInt8ArrayCid); 1863 return (kNullCid - kTypedDataInt8ArrayCid);
1864 } 1864 }
1865 1865
1866 } // namespace dart 1866 } // namespace dart
1867 1867
1868 #endif // VM_RAW_OBJECT_H_ 1868 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698