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 | |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 6 | #include <stdio.h> |
| 7 | |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 8 | #include <iosfwd> |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 9 | #include <string> |
Carl Shapiro | fc322c7 | 2011-07-27 00:20:01 -0700 | [diff] [blame] | 10 | #include <utility> |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 11 | #include <vector> |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 12 | |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 13 | #include <jni.h> |
| 14 | |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 15 | #include "constants.h" |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 16 | #include "heap.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 17 | #include "globals.h" |
| 18 | #include "macros.h" |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 19 | #include "runtime_stats.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 20 | #include "stringpiece.h" |
Brian Carlstrom | 44753c3 | 2011-08-17 22:22:11 -0700 | [diff] [blame] | 21 | #include "unordered_set.h" |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 22 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 23 | namespace art { |
| 24 | |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 25 | template<class T> class PrimitiveArray; |
| 26 | typedef PrimitiveArray<int8_t> ByteArray; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 27 | class ClassLinker; |
Brian Carlstrom | aded5f7 | 2011-10-07 17:15:04 -0700 | [diff] [blame] | 28 | class ClassLoader; |
Carl Shapiro | fc322c7 | 2011-07-27 00:20:01 -0700 | [diff] [blame] | 29 | class DexFile; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 30 | class Heap; |
Elliott Hughes | cf4c6c4 | 2011-09-01 15:16:42 -0700 | [diff] [blame] | 31 | class InternTable; |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 32 | class JavaVMExt; |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 33 | class Method; |
Elliott Hughes | c33a32b | 2011-10-11 18:18:07 -0700 | [diff] [blame] | 34 | class MonitorList; |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 35 | class SignalCatcher; |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 36 | class String; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 37 | class ThreadList; |
| 38 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 39 | class Runtime { |
| 40 | public: |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 41 | |
| 42 | typedef std::vector<std::pair<StringPiece, const void*> > Options; |
| 43 | |
| 44 | class ParsedOptions { |
| 45 | public: |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 46 | // returns null if problem parsing and ignore_unrecognized is false |
| 47 | static ParsedOptions* Create(const Options& options, bool ignore_unrecognized); |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 48 | |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 49 | std::string boot_class_path_; |
| 50 | std::string class_path_; |
| 51 | std::string host_prefix_; |
| 52 | std::vector<std::string> images_; |
Elliott Hughes | 515a5bc | 2011-08-17 11:08:34 -0700 | [diff] [blame] | 53 | bool check_jni_; |
Elliott Hughes | a095764 | 2011-09-02 14:27:33 -0700 | [diff] [blame] | 54 | std::string jni_trace_; |
Elliott Hughes | 9ca7a1f | 2011-10-11 14:29:52 -0700 | [diff] [blame] | 55 | bool is_zygote_; |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 56 | size_t heap_initial_size_; |
| 57 | size_t heap_maximum_size_; |
jeffhao | c116070 | 2011-10-27 15:48:45 -0700 | [diff] [blame] | 58 | size_t heap_growth_limit_; |
Brian Carlstrom | f734cf5 | 2011-08-17 16:28:14 -0700 | [diff] [blame] | 59 | size_t stack_size_; |
Elliott Hughes | bb1e8f0 | 2011-10-18 14:14:25 -0700 | [diff] [blame] | 60 | size_t jni_globals_max_; |
| 61 | size_t lock_profiling_threshold_; |
Elliott Hughes | 94ce37a | 2011-10-18 15:07:48 -0700 | [diff] [blame] | 62 | std::string stack_trace_file_; |
Elliott Hughes | fc86162 | 2011-10-17 17:57:47 -0700 | [diff] [blame] | 63 | bool (*hook_is_sensitive_thread_)(); |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 64 | jint (*hook_vfprintf_)(FILE* stream, const char* format, va_list ap); |
| 65 | void (*hook_exit_)(jint status); |
| 66 | void (*hook_abort_)(); |
Brian Carlstrom | 44753c3 | 2011-08-17 22:22:11 -0700 | [diff] [blame] | 67 | std::tr1::unordered_set<std::string> verbose_; |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 68 | std::vector<std::string> properties_; |
| 69 | |
Elliott Hughes | a095764 | 2011-09-02 14:27:33 -0700 | [diff] [blame] | 70 | bool IsVerbose(const std::string& key) const { |
| 71 | return verbose_.find(key) != verbose_.end(); |
| 72 | } |
| 73 | |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 74 | private: |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 75 | ParsedOptions() {} |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 76 | }; |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 77 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 78 | // Creates and initializes a new runtime. |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 79 | static Runtime* Create(const Options& options, bool ignore_unrecognized); |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 80 | |
Brian Carlstrom | 0a5b14d | 2011-09-27 13:29:15 -0700 | [diff] [blame] | 81 | bool IsVerboseStartup() const { |
| 82 | return verbose_startup_; |
| 83 | } |
| 84 | |
Brian Carlstrom | caabb1b | 2011-10-11 18:09:13 -0700 | [diff] [blame] | 85 | bool IsZygote() const { |
| 86 | return is_zygote_; |
| 87 | } |
| 88 | |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 89 | const std::string& GetHostPrefix() const { |
Elliott Hughes | 307f75d | 2011-10-12 18:04:40 -0700 | [diff] [blame] | 90 | DCHECK(!IsStarted()); |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 91 | return host_prefix_; |
| 92 | } |
| 93 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 94 | // Starts a runtime, which may cause threads to be started and code to run. |
| 95 | void Start(); |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 96 | |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 97 | bool IsStarted() const; |
Elliott Hughes | dcc2474 | 2011-09-07 14:02:44 -0700 | [diff] [blame] | 98 | |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 99 | static Runtime* Current() { |
| 100 | return instance_; |
| 101 | } |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 102 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 103 | // Compiles a dex file. |
| 104 | static void Compile(const StringPiece& filename); |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 105 | |
Elliott Hughes | ffe6736 | 2011-07-17 12:09:27 -0700 | [diff] [blame] | 106 | // Aborts semi-cleanly. Used in the implementation of LOG(FATAL), which most |
| 107 | // callers should prefer. |
| 108 | // This isn't marked ((noreturn)) because then gcc will merge multiple calls |
| 109 | // in a single function together. This reduces code size slightly, but means |
| 110 | // that the native stack trace we get may point at the wrong call site. |
| 111 | static void Abort(const char* file, int line); |
| 112 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 113 | // Attaches the current native thread to the runtime. |
Elliott Hughes | 5fe594f | 2011-09-08 12:33:17 -0700 | [diff] [blame] | 114 | void AttachCurrentThread(const char* name, bool as_daemon); |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 115 | |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 116 | void CallExitHook(jint status); |
| 117 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 118 | // Detaches the current native thread from the runtime. |
Elliott Hughes | d92bec4 | 2011-09-02 17:04:36 -0700 | [diff] [blame] | 119 | void DetachCurrentThread(); |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 120 | |
Elliott Hughes | 8daa092 | 2011-09-11 13:46:25 -0700 | [diff] [blame] | 121 | void Dump(std::ostream& os); |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 122 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 123 | ~Runtime(); |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 124 | |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 125 | const std::string& GetBootClassPath() const { |
| 126 | return boot_class_path_; |
Brian Carlstrom | b765be0 | 2011-08-17 23:54:10 -0700 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | ClassLinker* GetClassLinker() const { |
Carl Shapiro | 7a90959 | 2011-07-24 19:21:59 -0700 | [diff] [blame] | 130 | return class_linker_; |
| 131 | } |
| 132 | |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 133 | const std::string& GetClassPath() const { |
| 134 | return class_path_; |
| 135 | } |
| 136 | |
| 137 | size_t GetDefaultStackSize() const { |
| 138 | return default_stack_size_; |
| 139 | } |
| 140 | |
Elliott Hughes | cf4c6c4 | 2011-09-01 15:16:42 -0700 | [diff] [blame] | 141 | InternTable* GetInternTable() const { |
| 142 | return intern_table_; |
| 143 | } |
| 144 | |
Elliott Hughes | 0af5543 | 2011-08-17 18:37:28 -0700 | [diff] [blame] | 145 | JavaVMExt* GetJavaVM() const { |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 146 | return java_vm_; |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 147 | } |
| 148 | |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 149 | const std::vector<std::string>& GetProperties() const { |
| 150 | return properties_; |
| 151 | } |
| 152 | |
Elliott Hughes | c33a32b | 2011-10-11 18:18:07 -0700 | [diff] [blame] | 153 | MonitorList* GetMonitorList() const { |
| 154 | return monitor_list_; |
| 155 | } |
| 156 | |
Elliott Hughes | d92bec4 | 2011-09-02 17:04:36 -0700 | [diff] [blame] | 157 | ThreadList* GetThreadList() const { |
| 158 | return thread_list_; |
| 159 | } |
| 160 | |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 161 | const char* GetVersion() const { |
| 162 | return "2.0.0"; |
| 163 | } |
| 164 | |
Elliott Hughes | 410c0c8 | 2011-09-01 17:58:25 -0700 | [diff] [blame] | 165 | void VisitRoots(Heap::RootVisitor* visitor, void* arg) const; |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 166 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 167 | bool HasJniStubArray() const; |
| 168 | ByteArray* GetJniStubArray() const; |
| 169 | void SetJniStubArray(ByteArray* jni_stub_array); |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 170 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 171 | bool HasAbstractMethodErrorStubArray() const; |
| 172 | ByteArray* GetAbstractMethodErrorStubArray() const; |
| 173 | void SetAbstractMethodErrorStubArray(ByteArray* abstract_method_error_stub_array); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 174 | |
Ian Rogers | 1cb0a1d | 2011-10-06 15:24:35 -0700 | [diff] [blame] | 175 | enum TrampolineType { |
| 176 | kInstanceMethod, |
| 177 | kStaticMethod, |
| 178 | kUnknownMethod, |
Ian Rogers | 4f0d07c | 2011-10-06 23:38:47 -0700 | [diff] [blame] | 179 | kLastTrampolineMethodType // Value used for iteration |
Ian Rogers | 1cb0a1d | 2011-10-06 15:24:35 -0700 | [diff] [blame] | 180 | }; |
| 181 | static TrampolineType GetTrampolineType(Method* method); |
| 182 | bool HasResolutionStubArray(TrampolineType type) const; |
| 183 | ByteArray* GetResolutionStubArray(TrampolineType type) const; |
| 184 | void SetResolutionStubArray(ByteArray* resolution_stub_array, TrampolineType type); |
Ian Rogers | ad25ac5 | 2011-10-04 19:13:33 -0700 | [diff] [blame] | 185 | |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 186 | // Returns a special method that describes all callee saves being spilled to the stack. |
Ian Rogers | 4f0d07c | 2011-10-06 23:38:47 -0700 | [diff] [blame] | 187 | enum CalleeSaveType { |
| 188 | kSaveAll, |
| 189 | kRefsOnly, |
| 190 | kRefsAndArgs, |
| 191 | kLastCalleeSaveType // Value used for iteration |
| 192 | }; |
| 193 | Method* CreateCalleeSaveMethod(InstructionSet insns, CalleeSaveType type); |
| 194 | bool HasCalleeSaveMethod(CalleeSaveType type) const; |
| 195 | Method* GetCalleeSaveMethod(CalleeSaveType type) const; |
| 196 | void SetCalleeSaveMethod(Method* method, CalleeSaveType type); |
| 197 | |
| 198 | Method* CreateRefOnlyCalleeSaveMethod(InstructionSet insns); |
| 199 | Method* CreateRefAndArgsCalleeSaveMethod(InstructionSet insns); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 200 | |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 201 | int32_t GetStat(int kind); |
| 202 | |
| 203 | RuntimeStats* GetStats(); |
| 204 | |
| 205 | bool HasStatsEnabled() const { |
| 206 | return stats_enabled_; |
| 207 | } |
| 208 | |
| 209 | void ResetStats(int kinds); |
| 210 | |
| 211 | void SetStatsEnabled(bool new_state); |
| 212 | |
Brian Carlstrom | caabb1b | 2011-10-11 18:09:13 -0700 | [diff] [blame] | 213 | void DidForkFromZygote(); |
| 214 | |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 215 | private: |
Elliott Hughes | ffe6736 | 2011-07-17 12:09:27 -0700 | [diff] [blame] | 216 | static void PlatformAbort(const char*, int); |
| 217 | |
Elliott Hughes | dcc2474 | 2011-09-07 14:02:44 -0700 | [diff] [blame] | 218 | Runtime(); |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 219 | |
Elliott Hughes | c1674ed | 2011-08-25 18:09:09 -0700 | [diff] [blame] | 220 | void BlockSignals(); |
| 221 | |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 222 | bool Init(const Options& options, bool ignore_unrecognized); |
Elliott Hughes | 038a806 | 2011-09-18 14:12:41 -0700 | [diff] [blame] | 223 | void InitNativeMethods(); |
Elliott Hughes | ad7c2a3 | 2011-08-31 11:58:10 -0700 | [diff] [blame] | 224 | void RegisterRuntimeNativeMethods(JNIEnv*); |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 225 | |
Elliott Hughes | 85d1545 | 2011-09-16 17:33:01 -0700 | [diff] [blame] | 226 | void StartDaemonThreads(); |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 227 | void StartSignalCatcher(); |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 228 | |
Brian Carlstrom | 0a5b14d | 2011-09-27 13:29:15 -0700 | [diff] [blame] | 229 | bool verbose_startup_; |
Elliott Hughes | 9ca7a1f | 2011-10-11 14:29:52 -0700 | [diff] [blame] | 230 | bool is_zygote_; |
Brian Carlstrom | 0a5b14d | 2011-09-27 13:29:15 -0700 | [diff] [blame] | 231 | |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 232 | // The host prefix is used during cross compilation. It is removed |
| 233 | // from the start of host paths such as: |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 234 | // $ANDROID_PRODUCT_OUT/data/art-cache/boot.oat |
Brian Carlstrom | 34f426c | 2011-10-04 12:58:02 -0700 | [diff] [blame] | 235 | // to produce target paths such as |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 236 | // /system/framework/boot.oat |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 237 | // Similarly it is prepended to target paths to arrive back at a |
| 238 | // host past. In both cases this is necessary because image and oat |
| 239 | // files embedded expect paths of dependent files (an image points |
| 240 | // to an oat file and an oat files to one or more dex files). These |
| 241 | // files contain the expected target path. |
| 242 | std::string host_prefix_; |
| 243 | |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 244 | std::string boot_class_path_; |
| 245 | std::string class_path_; |
| 246 | std::vector<std::string> properties_; |
| 247 | |
Brian Carlstrom | b765be0 | 2011-08-17 23:54:10 -0700 | [diff] [blame] | 248 | // The default stack size for managed threads created by the runtime. |
Elliott Hughes | be759c6 | 2011-09-08 19:38:21 -0700 | [diff] [blame] | 249 | size_t default_stack_size_; |
Brian Carlstrom | b765be0 | 2011-08-17 23:54:10 -0700 | [diff] [blame] | 250 | |
Elliott Hughes | c33a32b | 2011-10-11 18:18:07 -0700 | [diff] [blame] | 251 | MonitorList* monitor_list_; |
| 252 | |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 253 | ThreadList* thread_list_; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 254 | |
Elliott Hughes | cf4c6c4 | 2011-09-01 15:16:42 -0700 | [diff] [blame] | 255 | InternTable* intern_table_; |
| 256 | |
Brian Carlstrom | b0460ea | 2011-07-29 10:08:05 -0700 | [diff] [blame] | 257 | ClassLinker* class_linker_; |
| 258 | |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 259 | SignalCatcher* signal_catcher_; |
Elliott Hughes | 94ce37a | 2011-10-18 15:07:48 -0700 | [diff] [blame] | 260 | std::string stack_trace_file_; |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 261 | |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 262 | JavaVMExt* java_vm_; |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 263 | |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 264 | ByteArray* jni_stub_array_; |
| 265 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 266 | ByteArray* abstract_method_error_stub_array_; |
| 267 | |
Ian Rogers | 4f0d07c | 2011-10-06 23:38:47 -0700 | [diff] [blame] | 268 | ByteArray* resolution_stub_array_[kLastTrampolineMethodType]; |
Ian Rogers | ad25ac5 | 2011-10-04 19:13:33 -0700 | [diff] [blame] | 269 | |
Ian Rogers | 4f0d07c | 2011-10-06 23:38:47 -0700 | [diff] [blame] | 270 | Method* callee_save_method_[kLastCalleeSaveType]; |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 271 | |
Brian Carlstrom | aded5f7 | 2011-10-07 17:15:04 -0700 | [diff] [blame] | 272 | // As returned by ClassLoader.getSystemClassLoader() |
| 273 | ClassLoader* system_class_loader_; |
| 274 | |
Elliott Hughes | dcc2474 | 2011-09-07 14:02:44 -0700 | [diff] [blame] | 275 | bool started_; |
| 276 | |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 277 | // Hooks supported by JNI_CreateJavaVM |
| 278 | jint (*vfprintf_)(FILE* stream, const char* format, va_list ap); |
| 279 | void (*exit_)(jint status); |
| 280 | void (*abort_)(); |
| 281 | |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 282 | bool stats_enabled_; |
| 283 | RuntimeStats stats_; |
| 284 | |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 285 | // A pointer to the active runtime or NULL. |
| 286 | static Runtime* instance_; |
| 287 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 288 | DISALLOW_COPY_AND_ASSIGN(Runtime); |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 289 | }; |
| 290 | |
| 291 | } // namespace art |
| 292 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 293 | #endif // ART_SRC_RUNTIME_H_ |