| OLD | NEW |
| 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_VM_PROGRAM_H_ | 5 #ifndef SRC_VM_PROGRAM_H_ |
| 6 #define SRC_VM_PROGRAM_H_ | 6 #define SRC_VM_PROGRAM_H_ |
| 7 | 7 |
| 8 #include "src/shared/globals.h" | 8 #include "src/shared/globals.h" |
| 9 #include "src/shared/random.h" | 9 #include "src/shared/random.h" |
| 10 #include "src/vm/debug_info.h" | 10 #include "src/vm/debug_info.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class ProgramTableRewriter; | 28 class ProgramTableRewriter; |
| 29 class Scheduler; | 29 class Scheduler; |
| 30 class Session; | 30 class Session; |
| 31 | 31 |
| 32 // Defines all the roots in the program heap. | 32 // Defines all the roots in the program heap. |
| 33 #define ROOTS_DO(V) \ | 33 #define ROOTS_DO(V) \ |
| 34 V(Instance, null_object, NullObject) \ | 34 V(Instance, null_object, NullObject) \ |
| 35 V(Instance, false_object, FalseObject) \ | 35 V(Instance, false_object, FalseObject) \ |
| 36 V(Instance, true_object, TrueObject) \ | 36 V(Instance, true_object, TrueObject) \ |
| 37 /* Global literals up to this line */ \ | 37 /* Global literals up to this line */ \ |
| 38 V(Class, smi_class, SmiClass) \ |
| 39 /* The order of null, false, true and smi_class is used by */ \ |
| 40 /* the ARM interpreter. */ \ |
| 38 V(Array, empty_array, EmptyArray) \ | 41 V(Array, empty_array, EmptyArray) \ |
| 39 V(OneByteString, empty_string, EmptyString) \ | 42 V(OneByteString, empty_string, EmptyString) \ |
| 40 V(Class, meta_class, MetaClass) \ | 43 V(Class, meta_class, MetaClass) \ |
| 41 V(Class, smi_class, SmiClass) \ | |
| 42 V(Class, boxed_class, BoxedClass) \ | 44 V(Class, boxed_class, BoxedClass) \ |
| 43 V(Class, large_integer_class, LargeIntegerClass) \ | 45 V(Class, large_integer_class, LargeIntegerClass) \ |
| 44 V(Class, num_class, NumClass) \ | 46 V(Class, num_class, NumClass) \ |
| 45 V(Class, bool_class, BoolClass) \ | 47 V(Class, bool_class, BoolClass) \ |
| 46 V(Class, int_class, IntClass) \ | 48 V(Class, int_class, IntClass) \ |
| 47 V(Class, one_byte_string_class, OneByteStringClass) \ | 49 V(Class, one_byte_string_class, OneByteStringClass) \ |
| 48 V(Class, two_byte_string_class, TwoByteStringClass) \ | 50 V(Class, two_byte_string_class, TwoByteStringClass) \ |
| 49 V(Class, object_class, ObjectClass) \ | 51 V(Class, object_class, ObjectClass) \ |
| 50 V(Class, array_class, ArrayClass) \ | 52 V(Class, array_class, ArrayClass) \ |
| 51 V(Class, function_class, FunctionClass) \ | 53 V(Class, function_class, FunctionClass) \ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 68 V(Class, stack_overflow_error_class, StackOverflowErrorClass) \ | 70 V(Class, stack_overflow_error_class, StackOverflowErrorClass) \ |
| 69 V(HeapObject, stack_overflow_error, StackOverflowError) \ | 71 V(HeapObject, stack_overflow_error, StackOverflowError) \ |
| 70 V(HeapObject, raw_retry_after_gc, RawRetryAfterGc) \ | 72 V(HeapObject, raw_retry_after_gc, RawRetryAfterGc) \ |
| 71 V(HeapObject, raw_wrong_argument_type, RawWrongArgumentType) \ | 73 V(HeapObject, raw_wrong_argument_type, RawWrongArgumentType) \ |
| 72 V(HeapObject, raw_index_out_of_bounds, RawIndexOutOfBounds) \ | 74 V(HeapObject, raw_index_out_of_bounds, RawIndexOutOfBounds) \ |
| 73 V(HeapObject, raw_illegal_state, RawIllegalState) \ | 75 V(HeapObject, raw_illegal_state, RawIllegalState) \ |
| 74 V(Object, native_failure_result, NativeFailureResult) \ | 76 V(Object, native_failure_result, NativeFailureResult) \ |
| 75 V(Array, static_fields, StaticFields) \ | 77 V(Array, static_fields, StaticFields) \ |
| 76 V(Array, dispatch_table, DispatchTable) | 78 V(Array, dispatch_table, DispatchTable) |
| 77 | 79 |
| 78 | |
| 79 typedef DoubleList<Process> ProcessList; | 80 typedef DoubleList<Process> ProcessList; |
| 80 typedef DoubleList<Process, 2> ProcessQueueList; | 81 typedef DoubleList<Process, 2> ProcessQueueList; |
| 81 typedef DoubleList<Program> ProgramList; | 82 typedef DoubleList<Program> ProgramList; |
| 82 | 83 |
| 83 const int kCompileTimeErrorExitCode = 254; | 84 const int kCompileTimeErrorExitCode = 254; |
| 84 const int kUncaughtExceptionExitCode = 255; | 85 const int kUncaughtExceptionExitCode = 255; |
| 85 | 86 |
| 86 // This state information is managed by the scheduler. | 87 // This state information is managed by the scheduler. |
| 87 class ProgramState { | 88 class ProgramState { |
| 88 public: | 89 public: |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 void CollectOldSpace(); | 292 void CollectOldSpace(); |
| 292 void CollectOldSpaceIfNeeded(); | 293 void CollectOldSpaceIfNeeded(); |
| 293 void CollectNewSpace(); | 294 void CollectNewSpace(); |
| 294 void PerformSharedGarbageCollection(); | 295 void PerformSharedGarbageCollection(); |
| 295 | 296 |
| 296 void PrintStatistics(); | 297 void PrintStatistics(); |
| 297 | 298 |
| 298 // Iterates over all roots in the program. | 299 // Iterates over all roots in the program. |
| 299 void IterateRoots(PointerVisitor* visitor); | 300 void IterateRoots(PointerVisitor* visitor); |
| 300 void IterateRootsIgnoringSession(PointerVisitor* visitor); | 301 void IterateRootsIgnoringSession(PointerVisitor* visitor); |
| 302 void VerifyObjectPlacements(); |
| 301 | 303 |
| 302 // Dispatch table support. | 304 // Dispatch table support. |
| 303 void ClearDispatchTableIntrinsics(); | 305 void ClearDispatchTableIntrinsics(); |
| 304 void SetupDispatchTableIntrinsics( | 306 void SetupDispatchTableIntrinsics( |
| 305 IntrinsicsTable* table = IntrinsicsTable::GetDefault(), | 307 IntrinsicsTable* table = IntrinsicsTable::GetDefault(), |
| 306 void* method_entry = reinterpret_cast<void*>(InterpreterMethodEntry)); | 308 void* method_entry = reinterpret_cast<void*>(InterpreterMethodEntry)); |
| 307 | 309 |
| 308 // Root objects. | 310 // Root objects. |
| 309 private: | 311 private: |
| 310 #define DECLARE_ENUM(type, name, CamelName) k##CamelName##Index, | 312 #define DECLARE_ENUM(type, name, CamelName) k##CamelName##Index, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 LookupCache* cache_; | 422 LookupCache* cache_; |
| 421 | 423 |
| 422 ProgramDebugInfo* debug_info_; | 424 ProgramDebugInfo* debug_info_; |
| 423 | 425 |
| 424 uword group_mask_; | 426 uword group_mask_; |
| 425 }; | 427 }; |
| 426 | 428 |
| 427 } // namespace dartino | 429 } // namespace dartino |
| 428 | 430 |
| 429 #endif // SRC_VM_PROGRAM_H_ | 431 #endif // SRC_VM_PROGRAM_H_ |
| OLD | NEW |