Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 16 | |
| 17 | #ifndef ART_SRC_RUNTIME_H_ |
| 18 | #define ART_SRC_RUNTIME_H_ |
| 19 | |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 20 | #include <stdio.h> |
| 21 | |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 22 | #include <iosfwd> |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 23 | #include <map> |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 24 | #include <string> |
Carl Shapiro | fc322c7 | 2011-07-27 00:20:01 -0700 | [diff] [blame] | 25 | #include <utility> |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 26 | #include <vector> |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 27 | |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 28 | #include <jni.h> |
| 29 | |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 30 | #include "constants.h" |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 31 | #include "heap.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 32 | #include "globals.h" |
| 33 | #include "macros.h" |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 34 | #include "runtime_stats.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 35 | #include "stringpiece.h" |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 36 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 37 | namespace art { |
| 38 | |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 39 | template<class T> class PrimitiveArray; |
| 40 | typedef PrimitiveArray<int8_t> ByteArray; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 41 | class ClassLinker; |
Brian Carlstrom | aded5f7 | 2011-10-07 17:15:04 -0700 | [diff] [blame] | 42 | class ClassLoader; |
Carl Shapiro | fc322c7 | 2011-07-27 00:20:01 -0700 | [diff] [blame] | 43 | class DexFile; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 44 | class Heap; |
Elliott Hughes | cf4c6c4 | 2011-09-01 15:16:42 -0700 | [diff] [blame] | 45 | class InternTable; |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 46 | class JavaVMExt; |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 47 | class Method; |
Elliott Hughes | c33a32b | 2011-10-11 18:18:07 -0700 | [diff] [blame] | 48 | class MonitorList; |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 49 | class SignalCatcher; |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 50 | class String; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 51 | class ThreadList; |
jeffhao | 2692b57 | 2011-12-16 15:42:28 -0800 | [diff] [blame] | 52 | class Trace; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 53 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 54 | class Runtime { |
| 55 | public: |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 56 | |
Elliott Hughes | f1a5adc | 2012-02-10 18:09:35 -0800 | [diff] [blame] | 57 | typedef std::vector<std::pair<std::string, const void*> > Options; |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 58 | |
| 59 | class ParsedOptions { |
| 60 | public: |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 61 | // returns null if problem parsing and ignore_unrecognized is false |
| 62 | static ParsedOptions* Create(const Options& options, bool ignore_unrecognized); |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 63 | |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 64 | const std::vector<const DexFile*>* boot_class_path_; |
| 65 | std::string boot_class_path_string_; |
| 66 | std::string class_path_string_; |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 67 | std::string host_prefix_; |
Brian Carlstrom | 223f20f | 2012-02-04 23:06:55 -0800 | [diff] [blame] | 68 | std::string image_; |
Elliott Hughes | 515a5bc | 2011-08-17 11:08:34 -0700 | [diff] [blame] | 69 | bool check_jni_; |
Elliott Hughes | a095764 | 2011-09-02 14:27:33 -0700 | [diff] [blame] | 70 | std::string jni_trace_; |
Elliott Hughes | d9c67be | 2012-02-02 19:54:06 -0800 | [diff] [blame] | 71 | bool is_compiler_; |
Elliott Hughes | 9ca7a1f | 2011-10-11 14:29:52 -0700 | [diff] [blame] | 72 | bool is_zygote_; |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 73 | size_t heap_initial_size_; |
| 74 | size_t heap_maximum_size_; |
jeffhao | c116070 | 2011-10-27 15:48:45 -0700 | [diff] [blame] | 75 | size_t heap_growth_limit_; |
Brian Carlstrom | f734cf5 | 2011-08-17 16:28:14 -0700 | [diff] [blame] | 76 | size_t stack_size_; |
Elliott Hughes | bb1e8f0 | 2011-10-18 14:14:25 -0700 | [diff] [blame] | 77 | size_t jni_globals_max_; |
| 78 | size_t lock_profiling_threshold_; |
Elliott Hughes | 94ce37a | 2011-10-18 15:07:48 -0700 | [diff] [blame] | 79 | std::string stack_trace_file_; |
jeffhao | b5e8185 | 2012-03-12 11:15:45 -0700 | [diff] [blame] | 80 | bool method_trace_; |
| 81 | std::string method_trace_file_; |
| 82 | size_t method_trace_file_size_; |
Elliott Hughes | fc86162 | 2011-10-17 17:57:47 -0700 | [diff] [blame] | 83 | bool (*hook_is_sensitive_thread_)(); |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 84 | jint (*hook_vfprintf_)(FILE* stream, const char* format, va_list ap); |
| 85 | void (*hook_exit_)(jint status); |
| 86 | void (*hook_abort_)(); |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 87 | std::vector<std::string> properties_; |
| 88 | |
| 89 | private: |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 90 | ParsedOptions() {} |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 91 | }; |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 92 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 93 | // Creates and initializes a new runtime. |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 94 | static Runtime* Create(const Options& options, bool ignore_unrecognized); |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 95 | |
Elliott Hughes | d9c67be | 2012-02-02 19:54:06 -0800 | [diff] [blame] | 96 | bool IsCompiler() const { |
| 97 | return is_compiler_; |
| 98 | } |
| 99 | |
Brian Carlstrom | caabb1b | 2011-10-11 18:09:13 -0700 | [diff] [blame] | 100 | bool IsZygote() const { |
| 101 | return is_zygote_; |
| 102 | } |
| 103 | |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 104 | const std::string& GetHostPrefix() const { |
Elliott Hughes | 307f75d | 2011-10-12 18:04:40 -0700 | [diff] [blame] | 105 | DCHECK(!IsStarted()); |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 106 | return host_prefix_; |
| 107 | } |
| 108 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 109 | // Starts a runtime, which may cause threads to be started and code to run. |
| 110 | void Start(); |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 111 | |
Elliott Hughes | 6b35575 | 2012-01-13 16:49:08 -0800 | [diff] [blame] | 112 | bool IsShuttingDown() const; |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 113 | bool IsStarted() const; |
Elliott Hughes | dcc2474 | 2011-09-07 14:02:44 -0700 | [diff] [blame] | 114 | |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 115 | static Runtime* Current() { |
| 116 | return instance_; |
| 117 | } |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 118 | |
Elliott Hughes | ffe6736 | 2011-07-17 12:09:27 -0700 | [diff] [blame] | 119 | // Aborts semi-cleanly. Used in the implementation of LOG(FATAL), which most |
| 120 | // callers should prefer. |
| 121 | // This isn't marked ((noreturn)) because then gcc will merge multiple calls |
| 122 | // in a single function together. This reduces code size slightly, but means |
| 123 | // that the native stack trace we get may point at the wrong call site. |
| 124 | static void Abort(const char* file, int line); |
| 125 | |
Elliott Hughes | 462c944 | 2012-03-23 18:47:50 -0700 | [diff] [blame^] | 126 | // Attaches the calling native thread to the runtime. |
| 127 | void AttachCurrentThread(const char* thread_name, bool as_daemon, Object* thread_group); |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 128 | |
Elliott Hughes | bf86d04 | 2011-08-31 17:53:14 -0700 | [diff] [blame] | 129 | void CallExitHook(jint status); |
| 130 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 131 | // Detaches the current native thread from the runtime. |
Elliott Hughes | d92bec4 | 2011-09-02 17:04:36 -0700 | [diff] [blame] | 132 | void DetachCurrentThread(); |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 133 | |
Elliott Hughes | 8daa092 | 2011-09-11 13:46:25 -0700 | [diff] [blame] | 134 | void Dump(std::ostream& os); |
Elliott Hughes | 21a5bf2 | 2011-12-07 14:35:20 -0800 | [diff] [blame] | 135 | void DumpLockHolders(std::ostream& os); |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 136 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 137 | ~Runtime(); |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 138 | |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 139 | const std::string& GetBootClassPathString() const { |
| 140 | return boot_class_path_string_; |
| 141 | } |
| 142 | |
| 143 | const std::string& GetClassPathString() const { |
| 144 | return class_path_string_; |
Brian Carlstrom | b765be0 | 2011-08-17 23:54:10 -0700 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | ClassLinker* GetClassLinker() const { |
Carl Shapiro | 7a90959 | 2011-07-24 19:21:59 -0700 | [diff] [blame] | 148 | return class_linker_; |
| 149 | } |
| 150 | |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 151 | size_t GetDefaultStackSize() const { |
| 152 | return default_stack_size_; |
| 153 | } |
| 154 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 155 | Heap* GetHeap() const { |
| 156 | return heap_; |
| 157 | } |
| 158 | |
Elliott Hughes | cf4c6c4 | 2011-09-01 15:16:42 -0700 | [diff] [blame] | 159 | InternTable* GetInternTable() const { |
| 160 | return intern_table_; |
| 161 | } |
| 162 | |
Elliott Hughes | 0af5543 | 2011-08-17 18:37:28 -0700 | [diff] [blame] | 163 | JavaVMExt* GetJavaVM() const { |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 164 | return java_vm_; |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 165 | } |
| 166 | |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 167 | const std::vector<std::string>& GetProperties() const { |
| 168 | return properties_; |
| 169 | } |
| 170 | |
Elliott Hughes | c33a32b | 2011-10-11 18:18:07 -0700 | [diff] [blame] | 171 | MonitorList* GetMonitorList() const { |
| 172 | return monitor_list_; |
| 173 | } |
| 174 | |
Elliott Hughes | d92bec4 | 2011-09-02 17:04:36 -0700 | [diff] [blame] | 175 | ThreadList* GetThreadList() const { |
| 176 | return thread_list_; |
| 177 | } |
| 178 | |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 179 | const char* GetVersion() const { |
| 180 | return "2.0.0"; |
| 181 | } |
| 182 | |
Elliott Hughes | 410c0c8 | 2011-09-01 17:58:25 -0700 | [diff] [blame] | 183 | void VisitRoots(Heap::RootVisitor* visitor, void* arg) const; |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 184 | |
Ian Rogers | 169c9a7 | 2011-11-13 20:13:17 -0800 | [diff] [blame] | 185 | bool HasJniDlsymLookupStub() const; |
| 186 | ByteArray* GetJniDlsymLookupStub() const; |
| 187 | void SetJniDlsymLookupStub(ByteArray* jni_stub_array); |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 188 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 189 | bool HasAbstractMethodErrorStubArray() const; |
| 190 | ByteArray* GetAbstractMethodErrorStubArray() const; |
| 191 | void SetAbstractMethodErrorStubArray(ByteArray* abstract_method_error_stub_array); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 192 | |
Ian Rogers | 1cb0a1d | 2011-10-06 15:24:35 -0700 | [diff] [blame] | 193 | enum TrampolineType { |
Ian Rogers | 1cb0a1d | 2011-10-06 15:24:35 -0700 | [diff] [blame] | 194 | kStaticMethod, |
| 195 | kUnknownMethod, |
Ian Rogers | 4f0d07c | 2011-10-06 23:38:47 -0700 | [diff] [blame] | 196 | kLastTrampolineMethodType // Value used for iteration |
Ian Rogers | 1cb0a1d | 2011-10-06 15:24:35 -0700 | [diff] [blame] | 197 | }; |
| 198 | static TrampolineType GetTrampolineType(Method* method); |
| 199 | bool HasResolutionStubArray(TrampolineType type) const; |
| 200 | ByteArray* GetResolutionStubArray(TrampolineType type) const; |
| 201 | void SetResolutionStubArray(ByteArray* resolution_stub_array, TrampolineType type); |
Ian Rogers | ad25ac5 | 2011-10-04 19:13:33 -0700 | [diff] [blame] | 202 | |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 203 | // Returns a special method to trampoline into runtime resolution |
| 204 | Method* CreateResolutionMethod(); |
| 205 | bool HasResolutionMethod() const; |
| 206 | Method* GetResolutionMethod() const; |
| 207 | void SetResolutionMethod(Method* method); |
| 208 | |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 209 | // 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] | 210 | enum CalleeSaveType { |
| 211 | kSaveAll, |
| 212 | kRefsOnly, |
| 213 | kRefsAndArgs, |
| 214 | kLastCalleeSaveType // Value used for iteration |
| 215 | }; |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 216 | Method* CreateCalleeSaveMethod(InstructionSet instruction_set, CalleeSaveType type); |
Ian Rogers | 4f0d07c | 2011-10-06 23:38:47 -0700 | [diff] [blame] | 217 | bool HasCalleeSaveMethod(CalleeSaveType type) const; |
| 218 | Method* GetCalleeSaveMethod(CalleeSaveType type) const; |
| 219 | void SetCalleeSaveMethod(Method* method, CalleeSaveType type); |
| 220 | |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 221 | Method* CreateRefOnlyCalleeSaveMethod(InstructionSet instruction_set); |
| 222 | Method* CreateRefAndArgsCalleeSaveMethod(InstructionSet instruction_set); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 223 | |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 224 | int32_t GetStat(int kind); |
| 225 | |
| 226 | RuntimeStats* GetStats(); |
| 227 | |
| 228 | bool HasStatsEnabled() const { |
| 229 | return stats_enabled_; |
| 230 | } |
| 231 | |
| 232 | void ResetStats(int kinds); |
| 233 | |
| 234 | void SetStatsEnabled(bool new_state); |
| 235 | |
Brian Carlstrom | caabb1b | 2011-10-11 18:09:13 -0700 | [diff] [blame] | 236 | void DidForkFromZygote(); |
| 237 | |
jeffhao | 2692b57 | 2011-12-16 15:42:28 -0800 | [diff] [blame] | 238 | void EnableMethodTracing(Trace* tracer); |
| 239 | void DisableMethodTracing(); |
| 240 | bool IsMethodTracingActive() const; |
| 241 | Trace* GetTracer() const; |
| 242 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 243 | bool UseCompileTimeClassPath() const { |
| 244 | return use_compile_time_class_path_; |
| 245 | } |
| 246 | const std::vector<const DexFile*>& GetCompileTimeClassPath(const ClassLoader* class_loader); |
| 247 | void SetCompileTimeClassPath(const ClassLoader* class_loader, std::vector<const DexFile*>& class_path); |
| 248 | |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 249 | private: |
Elliott Hughes | ffe6736 | 2011-07-17 12:09:27 -0700 | [diff] [blame] | 250 | static void PlatformAbort(const char*, int); |
| 251 | |
Elliott Hughes | dcc2474 | 2011-09-07 14:02:44 -0700 | [diff] [blame] | 252 | Runtime(); |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 253 | |
Elliott Hughes | c1674ed | 2011-08-25 18:09:09 -0700 | [diff] [blame] | 254 | void BlockSignals(); |
| 255 | |
Brian Carlstrom | 8a43659 | 2011-08-15 21:27:23 -0700 | [diff] [blame] | 256 | bool Init(const Options& options, bool ignore_unrecognized); |
Elliott Hughes | 038a806 | 2011-09-18 14:12:41 -0700 | [diff] [blame] | 257 | void InitNativeMethods(); |
Elliott Hughes | ff17f1f | 2012-01-24 18:12:29 -0800 | [diff] [blame] | 258 | void RegisterRuntimeNativeMethods(JNIEnv* env); |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 259 | |
Elliott Hughes | 85d1545 | 2011-09-16 17:33:01 -0700 | [diff] [blame] | 260 | void StartDaemonThreads(); |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 261 | void StartSignalCatcher(); |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 262 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 263 | // A pointer to the active runtime or NULL. |
| 264 | static Runtime* instance_; |
| 265 | |
Elliott Hughes | d9c67be | 2012-02-02 19:54:06 -0800 | [diff] [blame] | 266 | bool is_compiler_; |
Elliott Hughes | 9ca7a1f | 2011-10-11 14:29:52 -0700 | [diff] [blame] | 267 | bool is_zygote_; |
Brian Carlstrom | 0a5b14d | 2011-09-27 13:29:15 -0700 | [diff] [blame] | 268 | |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 269 | // The host prefix is used during cross compilation. It is removed |
| 270 | // from the start of host paths such as: |
Brian Carlstrom | 29e7ac7 | 2011-12-05 23:42:57 -0800 | [diff] [blame] | 271 | // $ANDROID_PRODUCT_OUT/system/framework/boot.oat |
Brian Carlstrom | 34f426c | 2011-10-04 12:58:02 -0700 | [diff] [blame] | 272 | // to produce target paths such as |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 273 | // /system/framework/boot.oat |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 274 | // Similarly it is prepended to target paths to arrive back at a |
| 275 | // host past. In both cases this is necessary because image and oat |
| 276 | // files embedded expect paths of dependent files (an image points |
| 277 | // to an oat file and an oat files to one or more dex files). These |
| 278 | // files contain the expected target path. |
| 279 | std::string host_prefix_; |
| 280 | |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 281 | std::string boot_class_path_string_; |
| 282 | std::string class_path_string_; |
Elliott Hughes | 7ede61e | 2011-09-14 18:18:06 -0700 | [diff] [blame] | 283 | std::vector<std::string> properties_; |
| 284 | |
Brian Carlstrom | b765be0 | 2011-08-17 23:54:10 -0700 | [diff] [blame] | 285 | // The default stack size for managed threads created by the runtime. |
Elliott Hughes | be759c6 | 2011-09-08 19:38:21 -0700 | [diff] [blame] | 286 | size_t default_stack_size_; |
Brian Carlstrom | b765be0 | 2011-08-17 23:54:10 -0700 | [diff] [blame] | 287 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 288 | Heap* heap_; |
| 289 | |
Elliott Hughes | c33a32b | 2011-10-11 18:18:07 -0700 | [diff] [blame] | 290 | MonitorList* monitor_list_; |
| 291 | |
Carl Shapiro | b557353 | 2011-07-12 18:22:59 -0700 | [diff] [blame] | 292 | ThreadList* thread_list_; |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 293 | |
Elliott Hughes | cf4c6c4 | 2011-09-01 15:16:42 -0700 | [diff] [blame] | 294 | InternTable* intern_table_; |
| 295 | |
Brian Carlstrom | b0460ea | 2011-07-29 10:08:05 -0700 | [diff] [blame] | 296 | ClassLinker* class_linker_; |
| 297 | |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 298 | SignalCatcher* signal_catcher_; |
Elliott Hughes | 94ce37a | 2011-10-18 15:07:48 -0700 | [diff] [blame] | 299 | std::string stack_trace_file_; |
Elliott Hughes | e27955c | 2011-08-26 15:21:24 -0700 | [diff] [blame] | 300 | |
Elliott Hughes | c5f7c91 | 2011-08-18 14:00:42 -0700 | [diff] [blame] | 301 | JavaVMExt* java_vm_; |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 302 | |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 303 | ByteArray* jni_stub_array_; |
| 304 | |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 305 | ByteArray* abstract_method_error_stub_array_; |
| 306 | |
Ian Rogers | 4f0d07c | 2011-10-06 23:38:47 -0700 | [diff] [blame] | 307 | ByteArray* resolution_stub_array_[kLastTrampolineMethodType]; |
Ian Rogers | ad25ac5 | 2011-10-04 19:13:33 -0700 | [diff] [blame] | 308 | |
Ian Rogers | 4f0d07c | 2011-10-06 23:38:47 -0700 | [diff] [blame] | 309 | Method* callee_save_method_[kLastCalleeSaveType]; |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 310 | |
Ian Rogers | 1984651 | 2012-02-24 11:42:47 -0800 | [diff] [blame] | 311 | Method* resolution_method_; |
| 312 | |
Brian Carlstrom | aded5f7 | 2011-10-07 17:15:04 -0700 | [diff] [blame] | 313 | // As returned by ClassLoader.getSystemClassLoader() |
| 314 | ClassLoader* system_class_loader_; |
| 315 | |
Elliott Hughes | 6b35575 | 2012-01-13 16:49:08 -0800 | [diff] [blame] | 316 | bool shutting_down_; |
Elliott Hughes | dcc2474 | 2011-09-07 14:02:44 -0700 | [diff] [blame] | 317 | bool started_; |
| 318 | |
Brian Carlstrom | 6ea095a | 2011-08-16 15:26:54 -0700 | [diff] [blame] | 319 | // Hooks supported by JNI_CreateJavaVM |
| 320 | jint (*vfprintf_)(FILE* stream, const char* format, va_list ap); |
| 321 | void (*exit_)(jint status); |
| 322 | void (*abort_)(); |
| 323 | |
Elliott Hughes | 9d5ccec | 2011-09-19 13:19:50 -0700 | [diff] [blame] | 324 | bool stats_enabled_; |
| 325 | RuntimeStats stats_; |
| 326 | |
jeffhao | b5e8185 | 2012-03-12 11:15:45 -0700 | [diff] [blame] | 327 | bool method_trace_; |
| 328 | std::string method_trace_file_; |
| 329 | size_t method_trace_file_size_; |
jeffhao | 2692b57 | 2011-12-16 15:42:28 -0800 | [diff] [blame] | 330 | Trace* tracer_; |
| 331 | |
Elliott Hughes | b3bd5f0 | 2012-03-08 21:05:27 -0800 | [diff] [blame] | 332 | typedef std::map<const ClassLoader*, std::vector<const DexFile*> > CompileTimeClassPaths; |
| 333 | CompileTimeClassPaths compile_time_class_paths_; |
| 334 | bool use_compile_time_class_path_; |
Elliott Hughes | 131aef8 | 2012-01-27 11:53:35 -0800 | [diff] [blame] | 335 | |
Carl Shapiro | 61e019d | 2011-07-14 16:53:09 -0700 | [diff] [blame] | 336 | DISALLOW_COPY_AND_ASSIGN(Runtime); |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 337 | }; |
| 338 | |
| 339 | } // namespace art |
| 340 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 341 | #endif // ART_SRC_RUNTIME_H_ |