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

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
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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 RawObject* canonical_types_; // An array of canonicalized types of this class 499 RawObject* canonical_types_; // An array of canonicalized types of this class
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 int32_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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 RawObject* data_; // Additional data specific to the function kind. 614 RawObject* data_; // Additional data specific to the function kind.
615 RawInstructions* instructions_; // Instructions of currently active code. 615 RawInstructions* instructions_; // Instructions of currently active code.
616 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. 616 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization.
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 623
624 intptr_t token_pos_; 624 int32_t token_pos_;
625 intptr_t end_token_pos_; 625 int32_t end_token_pos_;
626 intptr_t usage_counter_; // Incremented while function is running. 626 int32_t usage_counter_; // Incremented while function is running.
627 int16_t num_fixed_parameters_; 627 int16_t num_fixed_parameters_;
628 int16_t num_optional_parameters_; // > 0: positional; < 0: named. 628 int16_t num_optional_parameters_; // > 0: positional; < 0: named.
629 int16_t deoptimization_counter_; 629 int16_t deoptimization_counter_;
630 uint16_t kind_tag_; // See Function::KindTagBits. 630 uint16_t kind_tag_; // See Function::KindTagBits.
631 uint16_t optimized_instruction_count_; 631 uint16_t optimized_instruction_count_;
632 uint16_t optimized_call_site_count_; 632 uint16_t optimized_call_site_count_;
633 }; 633 };
634 634
635 635
636 class RawClosureData : public RawObject { 636 class RawClosureData : public RawObject {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 RawObject* owner_; // Class or patch class or mixin class 674 RawObject* owner_; // Class or patch class or mixin class
675 // where this field is defined. 675 // where this field is defined.
676 RawAbstractType* type_; 676 RawAbstractType* type_;
677 RawInstance* value_; // Offset in words for instance and value for static. 677 RawInstance* value_; // Offset in words for instance and value for static.
678 RawArray* dependent_code_; 678 RawArray* dependent_code_;
679 RawSmi* guarded_list_length_; 679 RawSmi* guarded_list_length_;
680 RawObject** to() { 680 RawObject** to() {
681 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_); 681 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_);
682 } 682 }
683 683
684 intptr_t token_pos_; 684 int32_t token_pos_;
685 intptr_t guarded_cid_; 685 int32_t guarded_cid_;
686 intptr_t is_nullable_; // kNullCid if field can contain null value and 686 int32_t is_nullable_; // kNullCid if field can contain null value and
687 // any other value otherwise. 687 // any other value otherwise.
688 // Offset to the guarded length field inside an instance of class matching 688 // Offset to the guarded length field inside an instance of class matching
689 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code 689 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code
690 // generated on platforms with weak addressing modes (ARM, MIPS). 690 // generated on platforms with weak addressing modes (ARM, MIPS).
691 int8_t guarded_list_length_in_object_offset_; 691 int8_t guarded_list_length_in_object_offset_;
692 692
693 uint8_t kind_bits_; // static, final, const, has initializer. 693 uint8_t kind_bits_; // static, final, const, has initializer.
694 }; 694 };
695 695
696 696
697 class RawLiteralToken : public RawObject { 697 class RawLiteralToken : public RawObject {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 739
740 private: 740 private:
741 RAW_HEAP_OBJECT_IMPLEMENTATION(Script); 741 RAW_HEAP_OBJECT_IMPLEMENTATION(Script);
742 742
743 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->url_); } 743 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->url_); }
744 RawString* url_; 744 RawString* url_;
745 RawString* source_; 745 RawString* source_;
746 RawTokenStream* tokens_; 746 RawTokenStream* tokens_;
747 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->tokens_); } 747 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->tokens_); }
748 748
749 intptr_t line_offset_; 749 int32_t line_offset_;
750 intptr_t col_offset_; 750 int32_t col_offset_;
751 int8_t kind_; // Of type Kind. 751 int8_t kind_; // Of type Kind.
752 }; 752 };
753 753
754 754
755 class RawLibrary : public RawObject { 755 class RawLibrary : public RawObject {
756 enum LibraryState { 756 enum LibraryState {
757 kAllocated, // Initial state. 757 kAllocated, // Initial state.
758 kLoadInProgress, // Library is in the process of being loaded. 758 kLoadInProgress, // Library is in the process of being loaded.
759 kLoaded, // Library is loaded. 759 kLoaded, // Library is loaded.
760 kLoadError, // Error occurred during load of the Library. 760 kLoadError, // Error occurred during load of the Library.
(...skipping 10 matching lines...) Expand all
771 RawArray* resolved_names_; // Cache of resolved names in library scope. 771 RawArray* resolved_names_; // Cache of resolved names in library scope.
772 RawGrowableObjectArray* metadata_; // Metadata on classes, methods etc. 772 RawGrowableObjectArray* metadata_; // Metadata on classes, methods etc.
773 RawArray* anonymous_classes_; // Classes containing top-level elements. 773 RawArray* anonymous_classes_; // Classes containing top-level elements.
774 RawArray* imports_; // List of Namespaces imported without prefix. 774 RawArray* imports_; // List of Namespaces imported without prefix.
775 RawArray* exports_; // List of re-exported Namespaces. 775 RawArray* exports_; // List of re-exported Namespaces.
776 RawArray* loaded_scripts_; // Array of scripts loaded in this library. 776 RawArray* loaded_scripts_; // Array of scripts loaded in this library.
777 RawObject** to() { 777 RawObject** to() {
778 return reinterpret_cast<RawObject**>(&ptr()->loaded_scripts_); 778 return reinterpret_cast<RawObject**>(&ptr()->loaded_scripts_);
779 } 779 }
780 780
781 intptr_t index_; // Library id number. 781 int32_t index_; // Library id number.
782 intptr_t num_imports_; // Number of entries in imports_. 782 int32_t num_imports_; // Number of entries in imports_.
783 intptr_t num_anonymous_; // Number of entries in anonymous_classes_. 783 int32_t num_anonymous_; // Number of entries in anonymous_classes_.
784 Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives. 784 Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives.
785 Dart_NativeEntrySymbol native_entry_symbol_resolver_; 785 Dart_NativeEntrySymbol native_entry_symbol_resolver_;
786 bool corelib_imported_; 786 bool corelib_imported_;
787 bool is_dart_scheme_; 787 bool is_dart_scheme_;
788 bool debuggable_; // True if debugger can stop in library. 788 bool debuggable_; // True if debugger can stop in library.
789 int8_t load_state_; // Of type LibraryState. 789 int8_t load_state_; // Of type LibraryState.
790 790
791 friend class Isolate; 791 friend class Isolate;
792 }; 792 };
793 793
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1056
1057 RawObject** from() { 1057 RawObject** from() {
1058 return reinterpret_cast<RawObject**>(&ptr()->buckets_); 1058 return reinterpret_cast<RawObject**>(&ptr()->buckets_);
1059 } 1059 }
1060 RawArray* buckets_; 1060 RawArray* buckets_;
1061 RawSmi* mask_; 1061 RawSmi* mask_;
1062 RawObject** to() { 1062 RawObject** to() {
1063 return reinterpret_cast<RawObject**>(&ptr()->mask_); 1063 return reinterpret_cast<RawObject**>(&ptr()->mask_);
1064 } 1064 }
1065 1065
1066 intptr_t filled_entry_count_; 1066 int32_t filled_entry_count_;
1067 }; 1067 };
1068 1068
1069 1069
1070 class RawSubtypeTestCache : public RawObject { 1070 class RawSubtypeTestCache : public RawObject {
1071 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache); 1071 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache);
1072 RawArray* cache_; 1072 RawArray* cache_;
1073 }; 1073 };
1074 1074
1075 1075
1076 class RawError : public RawObject { 1076 class RawError : public RawObject {
(...skipping 20 matching lines...) Expand all
1097 RawObject** from() { 1097 RawObject** from() {
1098 return reinterpret_cast<RawObject**>(&ptr()->previous_error_); 1098 return reinterpret_cast<RawObject**>(&ptr()->previous_error_);
1099 } 1099 }
1100 RawError* previous_error_; // May be null. 1100 RawError* previous_error_; // May be null.
1101 RawScript* script_; 1101 RawScript* script_;
1102 RawString* message_; 1102 RawString* message_;
1103 RawString* formatted_message_; // Incl. previous error's formatted message. 1103 RawString* formatted_message_; // Incl. previous error's formatted message.
1104 RawObject** to() { 1104 RawObject** to() {
1105 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_); 1105 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_);
1106 } 1106 }
1107 intptr_t token_pos_; // Source position in script_. 1107 int32_t token_pos_; // Source position in script_.
1108 int8_t kind_; // Of type LanguageError::Kind. 1108 int8_t kind_; // Of type LanguageError::Kind.
1109 }; 1109 };
1110 1110
1111 1111
1112 class RawUnhandledException : public RawError { 1112 class RawUnhandledException : public RawError {
1113 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException); 1113 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException);
1114 1114
1115 RawObject** from() { 1115 RawObject** from() {
1116 return reinterpret_cast<RawObject**>(&ptr()->exception_); 1116 return reinterpret_cast<RawObject**>(&ptr()->exception_);
1117 } 1117 }
(...skipping 27 matching lines...) Expand all
1145 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); 1145 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix);
1146 1146
1147 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 1147 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
1148 RawString* name_; // Library prefix name. 1148 RawString* name_; // Library prefix name.
1149 RawArray* imports_; // Libraries imported with this prefix. 1149 RawArray* imports_; // Libraries imported with this prefix.
1150 RawArray* dependent_code_; // Code that refers to deferred, unloaded 1150 RawArray* dependent_code_; // Code that refers to deferred, unloaded
1151 // library prefix. 1151 // library prefix.
1152 RawObject** to() { 1152 RawObject** to() {
1153 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); 1153 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_);
1154 } 1154 }
1155 intptr_t num_imports_; // Number of library entries in libraries_. 1155 int32_t num_imports_; // Number of library entries in libraries_.
1156 bool is_deferred_load_; 1156 bool is_deferred_load_;
1157 bool is_loaded_; 1157 bool is_loaded_;
1158 }; 1158 };
1159 1159
1160 1160
1161 class RawAbstractType : public RawInstance { 1161 class RawAbstractType : public RawInstance {
1162 protected: 1162 protected:
1163 enum TypeState { 1163 enum TypeState {
1164 kAllocated, // Initial state. 1164 kAllocated, // Initial state.
1165 kResolved, // Type class and type arguments resolved. 1165 kResolved, // Type class and type arguments resolved.
(...skipping 15 matching lines...) Expand all
1181 1181
1182 RawObject** from() { 1182 RawObject** from() {
1183 return reinterpret_cast<RawObject**>(&ptr()->type_class_); 1183 return reinterpret_cast<RawObject**>(&ptr()->type_class_);
1184 } 1184 }
1185 RawObject* type_class_; // Either resolved class or unresolved class. 1185 RawObject* type_class_; // Either resolved class or unresolved class.
1186 RawTypeArguments* arguments_; 1186 RawTypeArguments* arguments_;
1187 RawLanguageError* error_; // Error object if type is malformed or malbounded. 1187 RawLanguageError* error_; // Error object if type is malformed or malbounded.
1188 RawObject** to() { 1188 RawObject** to() {
1189 return reinterpret_cast<RawObject**>(&ptr()->error_); 1189 return reinterpret_cast<RawObject**>(&ptr()->error_);
1190 } 1190 }
1191 intptr_t token_pos_; 1191 int32_t token_pos_;
1192 int8_t type_state_; 1192 int8_t type_state_;
1193 }; 1193 };
1194 1194
1195 1195
1196 class RawTypeRef : public RawAbstractType { 1196 class RawTypeRef : public RawAbstractType {
1197 private: 1197 private:
1198 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); 1198 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef);
1199 1199
1200 RawObject** from() { 1200 RawObject** from() {
1201 return reinterpret_cast<RawObject**>(&ptr()->type_); 1201 return reinterpret_cast<RawObject**>(&ptr()->type_);
1202 } 1202 }
1203 RawAbstractType* type_; // The referenced type. 1203 RawAbstractType* type_; // The referenced type.
1204 RawObject** to() { 1204 RawObject** to() {
1205 return reinterpret_cast<RawObject**>(&ptr()->type_); 1205 return reinterpret_cast<RawObject**>(&ptr()->type_);
1206 } 1206 }
1207 }; 1207 };
1208 1208
1209 1209
1210 class RawTypeParameter : public RawAbstractType { 1210 class RawTypeParameter : public RawAbstractType {
1211 private: 1211 private:
1212 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); 1212 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter);
1213 1213
1214 RawObject** from() { 1214 RawObject** from() {
1215 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_); 1215 return reinterpret_cast<RawObject**>(&ptr()->parameterized_class_);
1216 } 1216 }
1217 RawClass* parameterized_class_; 1217 RawClass* parameterized_class_;
1218 RawString* name_; 1218 RawString* name_;
1219 RawAbstractType* bound_; // ObjectType if no explicit bound specified. 1219 RawAbstractType* bound_; // ObjectType if no explicit bound specified.
1220 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); } 1220 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); }
1221 intptr_t index_; 1221 int32_t index_;
1222 intptr_t token_pos_; 1222 int32_t token_pos_;
1223 int8_t type_state_; 1223 int8_t type_state_;
1224 }; 1224 };
1225 1225
1226 1226
1227 class RawBoundedType : public RawAbstractType { 1227 class RawBoundedType : public RawAbstractType {
1228 private: 1228 private:
1229 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); 1229 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType);
1230 1230
1231 RawObject** from() { 1231 RawObject** from() {
1232 return reinterpret_cast<RawObject**>(&ptr()->type_); 1232 return reinterpret_cast<RawObject**>(&ptr()->type_);
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); 1856 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14);
1857 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 1857 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
1858 kTypedDataInt8ArrayViewCid + 15); 1858 kTypedDataInt8ArrayViewCid + 15);
1859 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); 1859 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14);
1860 return (kNullCid - kTypedDataInt8ArrayCid); 1860 return (kNullCid - kTypedDataInt8ArrayCid);
1861 } 1861 }
1862 1862
1863 } // namespace dart 1863 } // namespace dart
1864 1864
1865 #endif // VM_RAW_OBJECT_H_ 1865 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698