blob: 6cde08227b45c956252716dcd67a3a1808545361 [file] [log] [blame]
Carl Shapiro1fb86202011-06-27 17:43:13 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
Brian Carlstrom578bbdc2011-07-21 14:07:47 -07003#include "runtime.h"
Carl Shapiro1fb86202011-06-27 17:43:13 -07004
Elliott Hughesffe67362011-07-17 12:09:27 -07005#include <cstdio>
6#include <cstdlib>
Brian Carlstrom8a436592011-08-15 21:27:23 -07007#include <limits>
Carl Shapiro2ed144c2011-07-26 16:52:08 -07008#include <vector>
Elliott Hughesffe67362011-07-17 12:09:27 -07009
Elliott Hughes90a33692011-08-30 13:27:07 -070010#include "UniquePtr.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070011#include "class_linker.h"
12#include "heap.h"
Brian Carlstrome24fa612011-09-29 00:53:55 -070013#include "image.h"
Elliott Hughescf4c6c42011-09-01 15:16:42 -070014#include "intern_table.h"
Elliott Hughesc5f7c912011-08-18 14:00:42 -070015#include "jni_internal.h"
Brian Carlstrome24fa612011-09-29 00:53:55 -070016#include "oat_file.h"
Elliott Hughese27955c2011-08-26 15:21:24 -070017#include "signal_catcher.h"
Brian Carlstrome24fa612011-09-29 00:53:55 -070018#include "space.h"
19#include "stl_util.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070020#include "thread.h"
Elliott Hughes8daa0922011-09-11 13:46:25 -070021#include "thread_list.h"
Carl Shapiro61e019d2011-07-14 16:53:09 -070022
Elliott Hughes90a33692011-08-30 13:27:07 -070023// TODO: this drags in cutil/log.h, which conflicts with our logging.h.
24#include "JniConstants.h"
25
Carl Shapiro1fb86202011-06-27 17:43:13 -070026namespace art {
27
Carl Shapiro2ed144c2011-07-26 16:52:08 -070028Runtime* Runtime::instance_ = NULL;
29
Elliott Hughesdcc24742011-09-07 14:02:44 -070030Runtime::Runtime()
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -070031 : verbose_startup_(false),
32 default_stack_size_(Thread::kDefaultStackSize),
Elliott Hughesdcc24742011-09-07 14:02:44 -070033 thread_list_(NULL),
34 intern_table_(NULL),
35 class_linker_(NULL),
36 signal_catcher_(NULL),
37 java_vm_(NULL),
Brian Carlstrom16192862011-09-12 17:50:06 -070038 jni_stub_array_(NULL),
Brian Carlstrome24fa612011-09-29 00:53:55 -070039 abstract_method_error_stub_array_(NULL),
Ian Rogersff1ed472011-09-20 13:46:24 -070040 callee_save_method_(NULL),
Elliott Hughesdcc24742011-09-07 14:02:44 -070041 started_(false),
42 vfprintf_(NULL),
43 exit_(NULL),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070044 abort_(NULL),
45 stats_enabled_(false) {
Elliott Hughesdcc24742011-09-07 14:02:44 -070046}
47
Carl Shapiro61e019d2011-07-14 16:53:09 -070048Runtime::~Runtime() {
Elliott Hughes5fe594f2011-09-08 12:33:17 -070049 // Make sure our internal threads are dead before we start tearing down things they're using.
50 delete signal_catcher_;
Elliott Hughes038a8062011-09-18 14:12:41 -070051 // TODO: GC thread.
Elliott Hughes5fe594f2011-09-08 12:33:17 -070052
Elliott Hughes038a8062011-09-18 14:12:41 -070053 // Make sure all other non-daemon threads have terminated, and all daemon threads are suspended.
Elliott Hughes93e74e82011-09-13 11:07:03 -070054 delete thread_list_;
55
Brian Carlstrome24fa612011-09-29 00:53:55 -070056 STLDeleteElements(&oat_files_);
Carl Shapiro61e019d2011-07-14 16:53:09 -070057 delete class_linker_;
Carl Shapiro69759ea2011-07-21 18:13:35 -070058 Heap::Destroy();
Elliott Hughescf4c6c42011-09-01 15:16:42 -070059 delete intern_table_;
Elliott Hughesc5f7c912011-08-18 14:00:42 -070060 delete java_vm_;
Elliott Hughesc1674ed2011-08-25 18:09:09 -070061 Thread::Shutdown();
Carl Shapiro4acf4642011-07-26 18:54:13 -070062 // TODO: acquire a static mutex on Runtime to avoid racing.
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070063 CHECK(instance_ == NULL || instance_ == this);
Carl Shapiro4acf4642011-07-26 18:54:13 -070064 instance_ = NULL;
Carl Shapiro61e019d2011-07-14 16:53:09 -070065}
66
Elliott Hughesffe67362011-07-17 12:09:27 -070067void Runtime::Abort(const char* file, int line) {
68 // Get any pending output out of the way.
69 fflush(NULL);
70
71 // Many people have difficulty distinguish aborts from crashes,
72 // so be explicit.
73 LogMessage(file, line, ERROR, -1).stream() << "Runtime aborting...";
74
Elliott Hughesffe67362011-07-17 12:09:27 -070075 // Perform any platform-specific pre-abort actions.
76 PlatformAbort(file, line);
77
Brian Carlstrom6ea095a2011-08-16 15:26:54 -070078 // use abort hook if we have one
79 if (Runtime::Current() != NULL && Runtime::Current()->abort_ != NULL) {
80 Runtime::Current()->abort_();
81 // notreached
82 }
83
Elliott Hughesffe67362011-07-17 12:09:27 -070084 // If we call abort(3) on a device, all threads in the process
Carl Shapiro69759ea2011-07-21 18:13:35 -070085 // receive SIGABRT. debuggerd dumps the stack trace of the main
86 // thread, whether or not that was the thread that failed. By
87 // stuffing a value into a bogus address, we cause a segmentation
Elliott Hughesffe67362011-07-17 12:09:27 -070088 // fault in the current thread, and get a useful log from debuggerd.
89 // We can also trivially tell the difference between a VM crash and
90 // a deliberate abort by looking at the fault address.
91 *reinterpret_cast<char*>(0xdeadd00d) = 38;
92 abort();
Elliott Hughesffe67362011-07-17 12:09:27 -070093 // notreached
94}
95
Elliott Hughesbf86d042011-08-31 17:53:14 -070096void Runtime::CallExitHook(jint status) {
97 if (exit_ != NULL) {
98 ScopedThreadStateChange tsc(Thread::Current(), Thread::kNative);
99 exit_(status);
100 LOG(WARNING) << "Exit hook returned instead of exiting!";
101 }
102}
103
Brian Carlstrom8a436592011-08-15 21:27:23 -0700104// Parse a string of the form /[0-9]+[kKmMgG]?/, which is used to specify
105// memory sizes. [kK] indicates kilobytes, [mM] megabytes, and
106// [gG] gigabytes.
107//
108// "s" should point just past the "-Xm?" part of the string.
Brian Carlstrom8a436592011-08-15 21:27:23 -0700109// "div" specifies a divisor, e.g. 1024 if the value must be a multiple
110// of 1024.
111//
112// The spec says the -Xmx and -Xms options must be multiples of 1024. It
113// doesn't say anything about -Xss.
114//
115// Returns 0 (a useless size) if "s" is malformed or specifies a low or
116// non-evenly-divisible value.
117//
118size_t ParseMemoryOption(const char *s, size_t div) {
119 // strtoul accepts a leading [+-], which we don't want,
120 // so make sure our string starts with a decimal digit.
121 if (isdigit(*s)) {
122 const char *s2;
123 size_t val = strtoul(s, (char **)&s2, 10);
124 if (s2 != s) {
125 // s2 should be pointing just after the number.
126 // If this is the end of the string, the user
127 // has specified a number of bytes. Otherwise,
128 // there should be exactly one more character
129 // that specifies a multiplier.
130 if (*s2 != '\0') {
Brian Carlstromf734cf52011-08-17 16:28:14 -0700131 // The remainder of the string is either a single multiplier
132 // character, or nothing to indicate that the value is in
133 // bytes.
134 char c = *s2++;
135 if (*s2 == '\0') {
136 size_t mul;
137 if (c == '\0') {
138 mul = 1;
139 } else if (c == 'k' || c == 'K') {
140 mul = KB;
141 } else if (c == 'm' || c == 'M') {
142 mul = MB;
143 } else if (c == 'g' || c == 'G') {
144 mul = GB;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700145 } else {
Brian Carlstromf734cf52011-08-17 16:28:14 -0700146 // Unknown multiplier character.
Brian Carlstrom8a436592011-08-15 21:27:23 -0700147 return 0;
148 }
Brian Carlstromf734cf52011-08-17 16:28:14 -0700149
150 if (val <= std::numeric_limits<size_t>::max() / mul) {
151 val *= mul;
152 } else {
153 // Clamp to a multiple of 1024.
154 val = std::numeric_limits<size_t>::max() & ~(1024-1);
155 }
156 } else {
157 // There's more than one character after the numeric part.
158 return 0;
159 }
Brian Carlstrom8a436592011-08-15 21:27:23 -0700160 }
161 // The man page says that a -Xm value must be a multiple of 1024.
162 if (val % div == 0) {
163 return val;
164 }
Carl Shapirofc322c72011-07-27 00:20:01 -0700165 }
166 }
Brian Carlstrom8a436592011-08-15 21:27:23 -0700167 return 0;
Carl Shapirofc322c72011-07-27 00:20:01 -0700168}
169
Elliott Hughes0af55432011-08-17 18:37:28 -0700170void LoadJniLibrary(JavaVMExt* vm, const char* name) {
171 // TODO: OS_SHARED_LIB_FORMAT_STR
172 std::string mapped_name(StringPrintf("lib%s.so", name));
Elliott Hughes75770752011-08-24 17:52:38 -0700173 std::string reason;
174 if (!vm->LoadNativeLibrary(mapped_name, NULL, reason)) {
Elliott Hughes0af55432011-08-17 18:37:28 -0700175 LOG(FATAL) << "LoadNativeLibrary failed for \"" << mapped_name << "\": "
176 << reason;
177 }
178}
179
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700180void CreateClassPath(const std::string& class_path,
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700181 std::vector<const DexFile*>& class_path_vector) {
Carl Shapirofc322c72011-07-27 00:20:01 -0700182 std::vector<std::string> parsed;
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700183 Split(class_path, ':', parsed);
Carl Shapirofc322c72011-07-27 00:20:01 -0700184 for (size_t i = 0; i < parsed.size(); ++i) {
Brian Carlstrom16192862011-09-12 17:50:06 -0700185 const DexFile* dex_file = DexFile::Open(parsed[i], "");
Carl Shapirofc322c72011-07-27 00:20:01 -0700186 if (dex_file != NULL) {
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700187 class_path_vector.push_back(dex_file);
Carl Shapirofc322c72011-07-27 00:20:01 -0700188 }
189 }
190}
191
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700192Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, bool ignore_unrecognized) {
Elliott Hughes90a33692011-08-30 13:27:07 -0700193 UniquePtr<ParsedOptions> parsed(new ParsedOptions());
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700194 parsed->boot_image_ = NULL;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700195 parsed->boot_oat_ = NULL;
Elliott Hughes515a5bc2011-08-17 11:08:34 -0700196#ifdef NDEBUG
Elliott Hughes5174fe62011-08-23 15:12:35 -0700197 // -Xcheck:jni is off by default for regular builds...
Elliott Hughes515a5bc2011-08-17 11:08:34 -0700198 parsed->check_jni_ = false;
199#else
200 // ...but on by default in debug builds.
201 parsed->check_jni_ = true;
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700202#endif
Elliott Hughes85d15452011-09-16 17:33:01 -0700203
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700204 parsed->heap_initial_size_ = Heap::kInitialSize;
205 parsed->heap_maximum_size_ = Heap::kMaximumSize;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700206 parsed->stack_size_ = Thread::kDefaultStackSize;
207
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700208 parsed->hook_vfprintf_ = vfprintf;
209 parsed->hook_exit_ = exit;
210 parsed->hook_abort_ = abort;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700211
212 for (size_t i = 0; i < options.size(); ++i) {
213 const StringPiece& option = options[i].first;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700214 if (option.starts_with("-Xbootclasspath:")) {
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700215 parsed->boot_class_path_string_ = option.substr(strlen("-Xbootclasspath:")).data();
Brian Carlstrom8a436592011-08-15 21:27:23 -0700216 } else if (option == "bootclasspath") {
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700217 UNIMPLEMENTED(WARNING) << "what should VMRuntime.getBootClassPath return here?";
Brian Carlstromf734cf52011-08-17 16:28:14 -0700218 const void* dex_vector = options[i].second;
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700219 const std::vector<const DexFile*>* v
220 = reinterpret_cast<const std::vector<const DexFile*>*>(dex_vector);
Brian Carlstromf734cf52011-08-17 16:28:14 -0700221 if (v == NULL) {
222 if (ignore_unrecognized) {
223 continue;
224 }
225 // TODO: usage
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700226 LOG(FATAL) << "Failed to parse " << option;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700227 return NULL;
228 }
229 parsed->boot_class_path_ = *v;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700230 } else if (option == "classpath") {
231 const void* dex_vector = options[i].second;
232 const std::vector<const DexFile*>* v
233 = reinterpret_cast<const std::vector<const DexFile*>*>(dex_vector);
234 if (v == NULL) {
235 if (ignore_unrecognized) {
236 continue;
237 }
238 // TODO: usage
239 LOG(FATAL) << "Failed to parse " << option;
240 return NULL;
241 }
242 parsed->class_path_ = *v;
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700243 } else if (option == "-classpath" || option == "-cp") {
244 // TODO: support -Djava.class.path
245 i++;
246 if (i == options.size()) {
247 // TODO: usage
248 LOG(FATAL) << "Missing required class path value for " << option;
249 return NULL;
250 }
251 const StringPiece& value = options[i].first;
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700252 parsed->class_path_string_ = value.data();
Brian Carlstrom8a436592011-08-15 21:27:23 -0700253 } else if (option.starts_with("-Xbootimage:")) {
Brian Carlstrome24fa612011-09-29 00:53:55 -0700254 // TODO: remove and just use -Ximage:
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700255 parsed->boot_image_ = option.substr(strlen("-Xbootimage:")).data();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700256 } else if (option.starts_with("-Xbootoat:")) {
257 // TODO: remove and just use -Xoat:
258 parsed->boot_oat_ = option.substr(strlen("-Xbootoat:")).data();
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700259 } else if (option.starts_with("-Ximage:")) {
260 parsed->images_.push_back(option.substr(strlen("-Ximage:")).data());
Brian Carlstrome24fa612011-09-29 00:53:55 -0700261 } else if (option.starts_with("-Xoat:")) {
262 parsed->oats_.push_back(option.substr(strlen("-Xoat:")).data());
Elliott Hughes515a5bc2011-08-17 11:08:34 -0700263 } else if (option.starts_with("-Xcheck:jni")) {
264 parsed->check_jni_ = true;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700265 } else if (option.starts_with("-Xms")) {
Brian Carlstromf734cf52011-08-17 16:28:14 -0700266 size_t size = ParseMemoryOption(option.substr(strlen("-Xms")).data(), 1024);
267 if (size == 0) {
268 if (ignore_unrecognized) {
269 continue;
270 }
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700271 // TODO: usage
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700272 LOG(FATAL) << "Failed to parse " << option;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700273 return NULL;
274 }
275 parsed->heap_initial_size_ = size;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700276 } else if (option.starts_with("-Xmx")) {
Brian Carlstromf734cf52011-08-17 16:28:14 -0700277 size_t size = ParseMemoryOption(option.substr(strlen("-Xmx")).data(), 1024);
278 if (size == 0) {
279 if (ignore_unrecognized) {
280 continue;
281 }
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700282 // TODO: usage
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700283 LOG(FATAL) << "Failed to parse " << option;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700284 return NULL;
285 }
286 parsed->heap_maximum_size_ = size;
287 } else if (option.starts_with("-Xss")) {
288 size_t size = ParseMemoryOption(option.substr(strlen("-Xss")).data(), 1);
289 if (size == 0) {
290 if (ignore_unrecognized) {
291 continue;
292 }
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700293 // TODO: usage
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700294 LOG(FATAL) << "Failed to parse " << option;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700295 return NULL;
296 }
297 parsed->stack_size_ = size;
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700298 } else if (option.starts_with("-D")) {
299 parsed->properties_.push_back(option.substr(strlen("-D")).data());
Elliott Hughesa0957642011-09-02 14:27:33 -0700300 } else if (option.starts_with("-Xjnitrace:")) {
301 parsed->jni_trace_ = option.substr(strlen("-Xjnitrace:")).data();
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700302 } else if (option.starts_with("-verbose:")) {
Elliott Hughes0af55432011-08-17 18:37:28 -0700303 std::vector<std::string> verbose_options;
Elliott Hughes34023802011-08-30 12:06:17 -0700304 Split(option.substr(strlen("-verbose:")).data(), ',', verbose_options);
Elliott Hughes0af55432011-08-17 18:37:28 -0700305 for (size_t i = 0; i < verbose_options.size(); ++i) {
306 parsed->verbose_.insert(verbose_options[i]);
307 }
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700308 } else if (option == "vfprintf") {
309 parsed->hook_vfprintf_ = reinterpret_cast<int (*)(FILE *, const char*, va_list)>(options[i].second);
310 } else if (option == "exit") {
311 parsed->hook_exit_ = reinterpret_cast<void(*)(jint)>(options[i].second);
312 } else if (option == "abort") {
313 parsed->hook_abort_ = reinterpret_cast<void(*)()>(options[i].second);
Brian Carlstrom8a436592011-08-15 21:27:23 -0700314 } else {
315 if (!ignore_unrecognized) {
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700316 // TODO: print usage via vfprintf
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700317 LOG(ERROR) << "Unrecognized option " << option;
318 // TODO: this should exit, but for now tolerate unknown options
319 //return NULL;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700320 }
321 }
322 }
323
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700324 // Consider it an error if both bootclasspath and -Xbootclasspath: are supplied.
Brian Carlstrom78128a62011-09-15 17:21:19 -0700325 // TODO: remove bootclasspath and classpath which are mostly just used by tests?
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700326 if (!parsed->boot_class_path_.empty() && !parsed->boot_class_path_string_.empty()) {
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700327 // TODO: usage
328 LOG(FATAL) << "bootclasspath and -Xbootclasspath: are mutually exclusive options.";
329 return NULL;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700330 }
Brian Carlstrom78128a62011-09-15 17:21:19 -0700331 if (!parsed->class_path_.empty() && !parsed->class_path_string_.empty()) {
332 // TODO: usage
333 LOG(FATAL) << "bootclasspath and -Xbootclasspath: are mutually exclusive options.";
334 return NULL;
335 }
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700336 if (parsed->boot_class_path_.empty()) {
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700337 if (parsed->boot_class_path_string_ == NULL) {
338 const char* BOOTCLASSPATH = getenv("BOOTCLASSPATH");
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700339 if (BOOTCLASSPATH != NULL) {
340 parsed->boot_class_path_string_ = BOOTCLASSPATH;
341 }
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700342 }
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700343 CreateClassPath(parsed->boot_class_path_string_, parsed->boot_class_path_);
Brian Carlstrom8a436592011-08-15 21:27:23 -0700344 }
Carl Shapiro2ed144c2011-07-26 16:52:08 -0700345
Brian Carlstrom78128a62011-09-15 17:21:19 -0700346 if (parsed->class_path_.empty()) {
347 if (parsed->class_path_string_ == NULL) {
348 const char* CLASSPATH = getenv("CLASSPATH");
349 if (CLASSPATH != NULL) {
350 parsed->class_path_string_ = CLASSPATH;
351 }
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700352 }
Brian Carlstrom78128a62011-09-15 17:21:19 -0700353 CreateClassPath(parsed->class_path_string_, parsed->class_path_);
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700354 }
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700355
Elliott Hughes85d15452011-09-16 17:33:01 -0700356 LOG(INFO) << "CheckJNI is " << (parsed->check_jni_ ? "on" : "off");
357
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700358 return parsed.release();
Brian Carlstrom8a436592011-08-15 21:27:23 -0700359}
360
361Runtime* Runtime::Create(const Options& options, bool ignore_unrecognized) {
Carl Shapiro2ed144c2011-07-26 16:52:08 -0700362 // TODO: acquire a static mutex on Runtime to avoid racing.
363 if (Runtime::instance_ != NULL) {
364 return NULL;
365 }
Elliott Hughesdcc24742011-09-07 14:02:44 -0700366 instance_ = new Runtime;
367 if (!instance_->Init(options, ignore_unrecognized)) {
368 delete instance_;
369 instance_ = NULL;
Carl Shapiro61e019d2011-07-14 16:53:09 -0700370 }
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700371 return instance_;
372}
Elliott Hughes0af55432011-08-17 18:37:28 -0700373
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700374void Runtime::Start() {
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700375 if (IsVerboseStartup()) {
376 LOG(INFO) << "Runtime::Start entering";
377 }
Elliott Hughes038a8062011-09-18 14:12:41 -0700378 InitNativeMethods();
Elliott Hughes85d15452011-09-16 17:33:01 -0700379
Elliott Hughes038a8062011-09-18 14:12:41 -0700380 Thread::FinishStartup();
Elliott Hughes85d15452011-09-16 17:33:01 -0700381
Elliott Hughes2a20cfd2011-09-23 19:30:41 -0700382 class_linker_->RunRootClinits();
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700383
Brian Carlstrom5d40f182011-09-26 22:29:18 -0700384 // Class::AllocObject asserts that all objects allocated better be
385 // initialized after Runtime::IsStarted is true, so this needs to
386 // come after ClassLinker::RunRootClinits.
387 started_ = true;
388
Elliott Hughes85d15452011-09-16 17:33:01 -0700389 StartDaemonThreads();
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700390
391 if (IsVerboseStartup()) {
392 LOG(INFO) << "Runtime::Start exiting";
393 }
Elliott Hughes85d15452011-09-16 17:33:01 -0700394}
395
396void Runtime::StartDaemonThreads() {
397 signal_catcher_ = new SignalCatcher;
398
Elliott Hughes719b3232011-09-25 17:42:19 -0700399 Thread* self = Thread::Current();
400 JNIEnv* env = self->GetJniEnv();
401 jclass c = env->FindClass("java/lang/Daemons");
Elliott Hughes85d15452011-09-16 17:33:01 -0700402 CHECK(c != NULL);
Elliott Hughes719b3232011-09-25 17:42:19 -0700403 jmethodID mid = env->GetStaticMethodID(c, "start", "()V");
404 CHECK(mid != NULL);
405 env->CallStaticVoidMethod(c, mid);
Carl Shapiro61e019d2011-07-14 16:53:09 -0700406}
407
Elliott Hughesdcc24742011-09-07 14:02:44 -0700408bool Runtime::IsStarted() {
409 return started_;
410}
411
Elliott Hughes0af55432011-08-17 18:37:28 -0700412bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) {
Elliott Hughesc1674ed2011-08-25 18:09:09 -0700413 CHECK_EQ(sysconf(_SC_PAGE_SIZE), kPageSize);
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700414
Elliott Hughes90a33692011-08-30 13:27:07 -0700415 UniquePtr<ParsedOptions> options(ParsedOptions::Create(raw_options, ignore_unrecognized));
416 if (options.get() == NULL) {
Brian Carlstrome24fa612011-09-29 00:53:55 -0700417 LOG(ERROR) << "Failed to parse options";
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700418 return false;
419 }
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700420 verbose_startup_ = options->IsVerbose("startup");
421 if (IsVerboseStartup()) {
422 LOG(INFO) << "Runtime::Init -verbose:startup enabled";
423 }
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700424
425 boot_class_path_ = options->boot_class_path_string_;
426 class_path_ = options->class_path_string_;
427 properties_ = options->properties_;
428
Elliott Hughes0af55432011-08-17 18:37:28 -0700429 vfprintf_ = options->hook_vfprintf_;
430 exit_ = options->hook_exit_;
431 abort_ = options->hook_abort_;
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700432
Elliott Hughesbe759c62011-09-08 19:38:21 -0700433 default_stack_size_ = options->stack_size_;
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700434
Elliott Hughes14357e82011-09-26 10:42:15 -0700435 thread_list_ = new ThreadList(options->IsVerbose("thread"));
Elliott Hughescf4c6c42011-09-01 15:16:42 -0700436 intern_table_ = new InternTable;
437
Elliott Hughesbe759c62011-09-08 19:38:21 -0700438 Heap::Init(options->heap_initial_size_, options->heap_maximum_size_,
Brian Carlstrome24fa612011-09-29 00:53:55 -0700439 options->boot_image_, options->images_);
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700440
Elliott Hughesc1674ed2011-08-25 18:09:09 -0700441 BlockSignals();
442
Elliott Hughesa0957642011-09-02 14:27:33 -0700443 java_vm_ = new JavaVMExt(this, options.get());
Elliott Hughes515a5bc2011-08-17 11:08:34 -0700444
Elliott Hughesbe759c62011-09-08 19:38:21 -0700445 Thread::Startup();
Elliott Hughesd92bec42011-09-02 17:04:36 -0700446
Elliott Hughes5fe594f2011-09-08 12:33:17 -0700447 // ClassLinker needs an attached thread, but we can't fully attach a thread
448 // without creating objects.
449 Thread::Attach(this, "main", false);
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700450
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700451 class_linker_ = ClassLinker::Create(options->boot_class_path_,
452 options->class_path_,
453 intern_table_,
Brian Carlstrome24fa612011-09-29 00:53:55 -0700454 Heap::GetBootSpace() != NULL);
455 if (Heap::GetBootSpace() != NULL) {
456 if (!OpenOat(Heap::GetBootSpace(), options->boot_oat_)) {
457 LOG(ERROR) << "Failed to open boot oat " << options->boot_oat_;
458 return false;
459 }
460 }
461 for (size_t i = 0; i < options->oats_.size(); i++) {
462 if (!OpenOat(Heap::GetSpaces()[i+1], options->oats_[i])) {
463 LOG(ERROR) << "Failed to open oat " << options->oats_[i];
464 return false;
465 }
466 }
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700467
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700468 if (IsVerboseStartup()) {
469 LOG(INFO) << "Runtime::Init exiting";
470 }
Carl Shapiro1fb86202011-06-27 17:43:13 -0700471 return true;
472}
473
Brian Carlstrome24fa612011-09-29 00:53:55 -0700474bool Runtime::OpenOat(const Space* space, const char* oat) {
475 if (IsVerboseStartup()) {
476 LOG(INFO) << "Runtime::OpenOat entering " << oat;
477 }
478 // TODO: check in ParsedOptions?
479 if (space == NULL) {
480 LOG(ERROR) << "oat specified without image";
481 return false;
482 }
483 if (oat == NULL) {
484 LOG(ERROR) << "image specified without oat";
485 return false;
486 }
487 const ImageHeader& image_header = space->GetImageHeader();
488 String* oat_location = image_header.GetImageRoot(ImageHeader::kOatLocation)->AsString();
489 std::string oat_filename = oat_location->ToModifiedUtf8();
490 if (!StringPiece(oat).ends_with(oat_filename)) {
491 LOG(ERROR) << "oat file name " << oat
492 << " does not match value found in image: " << oat_filename;
493 return false;
494 }
495 // TODO: we should be able to just use oat_filename instead of oat
496 // if we passed the prefix argument to find it on the host during cross compilation.
497 OatFile* oat_file = OatFile::Open(std::string(oat), "", image_header.GetOatBaseAddr());
498 if (oat_file == NULL) {
499 LOG(ERROR) << "Failed to open oat file " << oat_filename << " referenced from image";
500 return false;
501 }
502 uint32_t oat_checksum = oat_file->GetOatHeader().GetChecksum();
503 uint32_t image_oat_checksum = image_header.GetOatChecksum();
504 if (oat_checksum != image_oat_checksum) {
505 LOG(ERROR) << "Failed to match oat filechecksum " << std::hex << oat_checksum
506 << " to expected oat checksum " << std::hex << oat_checksum
507 << " in image";
508 return false;
509 }
510 oat_files_.push_back(oat_file);
511 if (IsVerboseStartup()) {
512 LOG(INFO) << "Runtime::OpenOat exiting";
513 }
514 return true;
515}
516
Elliott Hughes038a8062011-09-18 14:12:41 -0700517void Runtime::InitNativeMethods() {
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700518 if (IsVerboseStartup()) {
519 LOG(INFO) << "Runtime::InitNativeMethods entering";
520 }
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700521 Thread* self = Thread::Current();
522 JNIEnv* env = self->GetJniEnv();
523
Elliott Hughes418d20f2011-09-22 14:00:39 -0700524 // Must be in the kNative state for calling native methods (JNI_OnLoad code).
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700525 ScopedThreadStateChange tsc(self, Thread::kNative);
526
Elliott Hughes418d20f2011-09-22 14:00:39 -0700527 // First set up JniConstants, which is used by both the runtime's built-in native
528 // methods and libcore.
Elliott Hughesfea966e2011-09-22 10:26:20 -0700529 JniConstants::init(env);
530
Elliott Hughes418d20f2011-09-22 14:00:39 -0700531 // Then set up the native methods provided by the runtime itself.
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700532 RegisterRuntimeNativeMethods(env);
533
Elliott Hughes418d20f2011-09-22 14:00:39 -0700534 // Then set up libcore, which is just a regular JNI library with a regular JNI_OnLoad.
535 // Most JNI libraries can just use System.loadLibrary, but libcore can't because it's
536 // the library that implements System.loadLibrary!
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700537 LoadJniLibrary(instance_->GetJavaVM(), "javacore");
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700538 if (IsVerboseStartup()) {
539 LOG(INFO) << "Runtime::InitNativeMethods exiting";
540 }
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700541}
542
543void Runtime::RegisterRuntimeNativeMethods(JNIEnv* env) {
544#define REGISTER(FN) extern void FN(JNIEnv*); FN(env)
Brian Carlstromf91c8c32011-09-21 17:30:34 -0700545 REGISTER(register_dalvik_system_DexFile);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700546 REGISTER(register_dalvik_system_VMDebug);
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700547 REGISTER(register_dalvik_system_VMRuntime);
Elliott Hughes8daa0922011-09-11 13:46:25 -0700548 REGISTER(register_dalvik_system_VMStack);
Elliott Hughes01158d72011-09-19 19:47:10 -0700549 REGISTER(register_dalvik_system_Zygote);
Elliott Hughesd369bb72011-09-12 14:41:14 -0700550 REGISTER(register_java_lang_Class);
Elliott Hughesbf86d042011-08-31 17:53:14 -0700551 REGISTER(register_java_lang_Object);
552 REGISTER(register_java_lang_Runtime);
553 REGISTER(register_java_lang_String);
554 REGISTER(register_java_lang_System);
Elliott Hughes8daa0922011-09-11 13:46:25 -0700555 REGISTER(register_java_lang_Thread);
Elliott Hughes1240dad2011-09-09 16:24:50 -0700556 REGISTER(register_java_lang_Throwable);
Elliott Hughes64bf5a32011-09-20 14:43:12 -0700557 REGISTER(register_java_lang_VMClassLoader);
Brian Carlstrom5b8e4c82011-09-18 01:38:59 -0700558 REGISTER(register_java_lang_reflect_Array);
Elliott Hughes2a20cfd2011-09-23 19:30:41 -0700559 REGISTER(register_java_lang_reflect_Constructor);
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700560 REGISTER(register_java_lang_reflect_Field);
561 REGISTER(register_java_lang_reflect_Method);
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700562 //REGISTER(register_java_lang_reflect_Proxy);
Elliott Hughesbf86d042011-08-31 17:53:14 -0700563 REGISTER(register_java_util_concurrent_atomic_AtomicLong);
Brian Carlstrom395520e2011-09-25 19:35:00 -0700564 REGISTER(register_org_apache_harmony_dalvik_ddmc_DdmServer);
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700565 //REGISTER(register_org_apache_harmony_dalvik_ddmc_DdmVmInternal);
Elliott Hughes5ee7a8b2011-09-13 16:40:07 -0700566 REGISTER(register_sun_misc_Unsafe);
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700567#undef REGISTER
568}
569
Elliott Hughes8daa0922011-09-11 13:46:25 -0700570void Runtime::Dump(std::ostream& os) {
Elliott Hughese27955c2011-08-26 15:21:24 -0700571 // TODO: dump other runtime statistics?
572 os << "Loaded classes: " << class_linker_->NumLoadedClasses() << "\n";
Elliott Hughescf4c6c42011-09-01 15:16:42 -0700573 os << "Intern table size: " << GetInternTable()->Size() << "\n";
Elliott Hughese27955c2011-08-26 15:21:24 -0700574 // LOGV("VM stats: meth=%d ifld=%d sfld=%d linear=%d",
575 // gDvm.numDeclaredMethods,
576 // gDvm.numDeclaredInstFields,
577 // gDvm.numDeclaredStaticFields,
578 // gDvm.pBootLoaderAlloc->curOffset);
579 // LOGI("GC precise methods: %d", dvmPointerSetGetCount(gDvm.preciseMethods));
Elliott Hughes42ee1422011-09-06 12:33:32 -0700580 os << "\n";
Elliott Hughes8daa0922011-09-11 13:46:25 -0700581
582 thread_list_->Dump(os);
Elliott Hughese27955c2011-08-26 15:21:24 -0700583}
584
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700585void Runtime::SetStatsEnabled(bool new_state) {
586 if (new_state == true) {
587 GetStats()->Clear(~0);
588 // TODO: wouldn't it make more sense to clear _all_ threads' stats?
589 Thread::Current()->GetStats()->Clear(~0);
590 }
591 stats_enabled_ = new_state;
592}
593
594void Runtime::ResetStats(int kinds) {
595 GetStats()->Clear(kinds & 0xffff);
596 // TODO: wouldn't it make more sense to clear _all_ threads' stats?
597 Thread::Current()->GetStats()->Clear(kinds >> 16);
598}
599
600RuntimeStats* Runtime::GetStats() {
601 return &stats_;
602}
603
604int32_t Runtime::GetStat(int kind) {
605 RuntimeStats* stats;
606 if (kind < (1<<16)) {
607 stats = GetStats();
608 } else {
609 stats = Thread::Current()->GetStats();
610 kind >>= 16;
611 }
612 switch (kind) {
613 case KIND_ALLOCATED_OBJECTS:
614 return stats->allocated_objects;
615 case KIND_ALLOCATED_BYTES:
616 return stats->allocated_bytes;
617 case KIND_FREED_OBJECTS:
618 return stats->freed_objects;
619 case KIND_FREED_BYTES:
620 return stats->freed_bytes;
621 case KIND_GC_INVOCATIONS:
622 return stats->gc_for_alloc_count;
623 case KIND_CLASS_INIT_COUNT:
624 return stats->class_init_count;
625 case KIND_CLASS_INIT_TIME:
626 // Convert ns to us, reduce to 32 bits.
627 return (int) (stats->class_init_time_ns / 1000);
628 case KIND_EXT_ALLOCATED_OBJECTS:
629 case KIND_EXT_ALLOCATED_BYTES:
630 case KIND_EXT_FREED_OBJECTS:
631 case KIND_EXT_FREED_BYTES:
632 return 0; // backward compatibility
633 default:
634 CHECK(false);
635 return -1; // unreachable
636 }
637}
638
Elliott Hughesc1674ed2011-08-25 18:09:09 -0700639void Runtime::BlockSignals() {
640 sigset_t sigset;
641 if (sigemptyset(&sigset) == -1) {
642 PLOG(FATAL) << "sigemptyset failed";
643 }
644 if (sigaddset(&sigset, SIGPIPE) == -1) {
645 PLOG(ERROR) << "sigaddset SIGPIPE failed";
646 }
647 // SIGQUIT is used to dump the runtime's state (including stack traces).
648 if (sigaddset(&sigset, SIGQUIT) == -1) {
649 PLOG(ERROR) << "sigaddset SIGQUIT failed";
650 }
651 // SIGUSR1 is used to initiate a heap dump.
652 if (sigaddset(&sigset, SIGUSR1) == -1) {
653 PLOG(ERROR) << "sigaddset SIGUSR1 failed";
654 }
655 CHECK_EQ(sigprocmask(SIG_BLOCK, &sigset, NULL), 0);
656}
657
Elliott Hughes5fe594f2011-09-08 12:33:17 -0700658void Runtime::AttachCurrentThread(const char* name, bool as_daemon) {
659 Thread::Attach(instance_, name, as_daemon);
Carl Shapiro61e019d2011-07-14 16:53:09 -0700660}
661
Elliott Hughesd92bec42011-09-02 17:04:36 -0700662void Runtime::DetachCurrentThread() {
Elliott Hughes038a8062011-09-18 14:12:41 -0700663 // TODO: check we're not calling DetachCurrentThread from a call stack that
664 // includes managed frames. (It's only valid if the stack is all-native.)
Elliott Hughes02b48d12011-09-07 17:15:51 -0700665 thread_list_->Unregister();
Carl Shapiro1fb86202011-06-27 17:43:13 -0700666}
667
Brian Carlstrome24fa612011-09-29 00:53:55 -0700668void Runtime::VisitRoots(Heap::RootVisitor* visitor, void* arg) const {
669 class_linker_->VisitRoots(visitor, arg);
670 intern_table_->VisitRoots(visitor, arg);
671 java_vm_->VisitRoots(visitor, arg);
672 thread_list_->VisitRoots(visitor, arg);
673 visitor(jni_stub_array_, arg);
674 visitor(abstract_method_error_stub_array_, arg);
675 visitor(callee_save_method_, arg);
676
677 //(*visitor)(&gDvm.outOfMemoryObj, 0, ROOT_VM_INTERNAL, arg);
678 //(*visitor)(&gDvm.internalErrorObj, 0, ROOT_VM_INTERNAL, arg);
679 //(*visitor)(&gDvm.noClassDefFoundErrorObj, 0, ROOT_VM_INTERNAL, arg);
680 UNIMPLEMENTED(WARNING) << "some roots not marked";
681}
682
683bool Runtime::HasJniStubArray() const {
684 return jni_stub_array_ != NULL;
685}
686
687ByteArray* Runtime::GetJniStubArray() const {
688 CHECK(jni_stub_array_ != NULL);
689 return jni_stub_array_;
690}
691
692void Runtime::SetJniStubArray(ByteArray* jni_stub_array) {
693 CHECK(jni_stub_array != NULL);
694 CHECK(jni_stub_array_ == NULL || jni_stub_array_ == jni_stub_array);
695 jni_stub_array_ = jni_stub_array;
696}
697
698bool Runtime::HasAbstractMethodErrorStubArray() const {
699 return abstract_method_error_stub_array_ != NULL;
700}
701
702ByteArray* Runtime::GetAbstractMethodErrorStubArray() const {
703 CHECK(abstract_method_error_stub_array_ != NULL);
704 return abstract_method_error_stub_array_;
705}
706
707void Runtime::SetAbstractMethodErrorStubArray(ByteArray* abstract_method_error_stub_array) {
708 CHECK(abstract_method_error_stub_array != NULL);
709 CHECK(abstract_method_error_stub_array_ == NULL || abstract_method_error_stub_array_ == abstract_method_error_stub_array);
710 abstract_method_error_stub_array_ = abstract_method_error_stub_array;
711}
712
Ian Rogersff1ed472011-09-20 13:46:24 -0700713Method* Runtime::CreateCalleeSaveMethod(InstructionSet insns) {
714 Class* method_class = Method::GetMethodClass();
715 Method* method = down_cast<Method*>(method_class->AllocObject());
716 method->SetDeclaringClass(method_class);
717 method->SetName(intern_table_->InternStrong("$$$callee_save_method$$$"));
718 method->SetSignature(intern_table_->InternStrong("()V"));
Brian Carlstrome24fa612011-09-29 00:53:55 -0700719 method->SetCodeArray(NULL, insns);
Ian Rogersff1ed472011-09-20 13:46:24 -0700720 if ((insns == kThumb2) || (insns == kArm)) {
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700721 size_t frame_size = (12 /* gprs */ + 32 /* fprs */ + 4 /* data */) * kPointerSize;
722 method->SetFrameSizeInBytes(frame_size);
723 method->SetReturnPcOffsetInBytes(frame_size - kPointerSize);
Ian Rogersff1ed472011-09-20 13:46:24 -0700724 method->SetCoreSpillMask((1 << art::arm::R1) |
725 (1 << art::arm::R2) |
726 (1 << art::arm::R3) |
727 (1 << art::arm::R4) |
728 (1 << art::arm::R5) |
729 (1 << art::arm::R6) |
730 (1 << art::arm::R7) |
731 (1 << art::arm::R8) |
732 (1 << art::arm::R9) |
733 (1 << art::arm::R10) |
734 (1 << art::arm::R11) |
735 (1 << art::arm::LR));
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700736 method->SetFpSpillMask((1 << art::arm::S0) |
737 (1 << art::arm::S1) |
738 (1 << art::arm::S2) |
739 (1 << art::arm::S3) |
740 (1 << art::arm::S4) |
741 (1 << art::arm::S5) |
742 (1 << art::arm::S6) |
743 (1 << art::arm::S7) |
744 (1 << art::arm::S8) |
745 (1 << art::arm::S9) |
746 (1 << art::arm::S10) |
747 (1 << art::arm::S11) |
748 (1 << art::arm::S12) |
749 (1 << art::arm::S13) |
750 (1 << art::arm::S14) |
751 (1 << art::arm::S15) |
752 (1 << art::arm::S16) |
753 (1 << art::arm::S17) |
754 (1 << art::arm::S18) |
755 (1 << art::arm::S19) |
756 (1 << art::arm::S20) |
757 (1 << art::arm::S21) |
758 (1 << art::arm::S22) |
759 (1 << art::arm::S23) |
760 (1 << art::arm::S24) |
761 (1 << art::arm::S25) |
762 (1 << art::arm::S26) |
763 (1 << art::arm::S27) |
764 (1 << art::arm::S28) |
765 (1 << art::arm::S29) |
766 (1 << art::arm::S30) |
767 (1 << art::arm::S31));
Ian Rogersff1ed472011-09-20 13:46:24 -0700768 } else if (insns == kX86) {
769 method->SetFrameSizeInBytes(32);
770 method->SetReturnPcOffsetInBytes(28);
771 method->SetCoreSpillMask((1 << art::x86::EBX) |
772 (1 << art::x86::EBP) |
773 (1 << art::x86::ESI) |
774 (1 << art::x86::EDI));
775 method->SetFpSpillMask(0);
776 } else {
777 UNIMPLEMENTED(FATAL);
778 }
779 return method;
780}
781
Brian Carlstrome24fa612011-09-29 00:53:55 -0700782bool Runtime::HasCalleeSaveMethod() const {
783 return callee_save_method_ != NULL;
Brian Carlstrom1f870082011-08-23 16:02:11 -0700784}
785
Brian Carlstrome24fa612011-09-29 00:53:55 -0700786// Returns a special method that describes all callee saves being spilled to the stack.
787Method* Runtime::GetCalleeSaveMethod() const {
788 CHECK(callee_save_method_ != NULL);
789 return callee_save_method_;
790}
791
792void Runtime::SetCalleeSaveMethod(Method* method) {
793 callee_save_method_ = method;
794}
795
796
Carl Shapiro1fb86202011-06-27 17:43:13 -0700797} // namespace art