Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_RUNTIME_H_ |
| 4 | #define ART_SRC_RUNTIME_H_ |
| 5 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame^] | 6 | #include "src/globals.h" |
| 7 | #include "src/macros.h" |
| 8 | #include "src/stringpiece.h" |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 9 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 10 | namespace art { |
| 11 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame^] | 12 | class ClassLinker; |
| 13 | class Heap; |
| 14 | class ThreadList; |
| 15 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 16 | class Runtime { |
| 17 | public: |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame^] | 18 | // Creates and initializes a new runtime. |
| 19 | static Runtime* Create(); |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 20 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame^] | 21 | // Compiles a dex file. |
| 22 | static void Compile(const StringPiece& filename); |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 23 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame^] | 24 | // Attaches the current native thread to the runtime. |
| 25 | bool AttachCurrentThread(); |
| 26 | |
| 27 | // Detaches the current native thread from the runtime. |
| 28 | bool DetachCurrentThread(); |
| 29 | |
| 30 | ~Runtime(); |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 31 | |
| 32 | private: |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame^] | 33 | Runtime() : class_linker_(NULL), heap_(NULL), thread_list_(NULL) {} |
| 34 | |
| 35 | // Initializes a new uninitialized runtime. |
| 36 | bool Init(); |
| 37 | |
| 38 | ClassLinker* class_linker_; |
| 39 | |
| 40 | Heap* heap_; |
| 41 | |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 42 | ThreadList* thread_list_; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame^] | 43 | |
| 44 | DISALLOW_COPY_AND_ASSIGN(Runtime); |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | } // namespace art |
| 48 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 49 | #endif // ART_SRC_RUNTIME_H_ |