blob: 4f463e539b61f4e45a2508ee0c6f4662295ea557 [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
Brian Carlstromaded5f72011-10-07 17:15:04 -070010#include "ScopedLocalRef.h"
Elliott Hughes90a33692011-08-30 13:27:07 -070011#include "UniquePtr.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070012#include "class_linker.h"
Brian Carlstromaded5f72011-10-07 17:15:04 -070013#include "class_loader.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070014#include "heap.h"
Brian Carlstrome24fa612011-09-29 00:53:55 -070015#include "image.h"
Elliott Hughescf4c6c42011-09-01 15:16:42 -070016#include "intern_table.h"
Elliott Hughesc5f7c912011-08-18 14:00:42 -070017#include "jni_internal.h"
Brian Carlstrome24fa612011-09-29 00:53:55 -070018#include "oat_file.h"
Elliott Hughes726079d2011-10-07 18:43:44 -070019#include "ScopedLocalRef.h"
Elliott Hughese27955c2011-08-26 15:21:24 -070020#include "signal_catcher.h"
Brian Carlstrome24fa612011-09-29 00:53:55 -070021#include "space.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070022#include "thread.h"
Elliott Hughes8daa0922011-09-11 13:46:25 -070023#include "thread_list.h"
Carl Shapiro61e019d2011-07-14 16:53:09 -070024
Elliott Hughes90a33692011-08-30 13:27:07 -070025// TODO: this drags in cutil/log.h, which conflicts with our logging.h.
26#include "JniConstants.h"
27
Carl Shapiro1fb86202011-06-27 17:43:13 -070028namespace art {
29
Carl Shapiro2ed144c2011-07-26 16:52:08 -070030Runtime* Runtime::instance_ = NULL;
31
Elliott Hughesdcc24742011-09-07 14:02:44 -070032Runtime::Runtime()
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -070033 : verbose_startup_(false),
Elliott Hughes9ca7a1f2011-10-11 14:29:52 -070034 is_zygote_(false),
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -070035 default_stack_size_(Thread::kDefaultStackSize),
Elliott Hughesdcc24742011-09-07 14:02:44 -070036 thread_list_(NULL),
37 intern_table_(NULL),
38 class_linker_(NULL),
39 signal_catcher_(NULL),
40 java_vm_(NULL),
Brian Carlstrom16192862011-09-12 17:50:06 -070041 jni_stub_array_(NULL),
Brian Carlstrome24fa612011-09-29 00:53:55 -070042 abstract_method_error_stub_array_(NULL),
Elliott Hughesdcc24742011-09-07 14:02:44 -070043 started_(false),
44 vfprintf_(NULL),
45 exit_(NULL),
Elliott Hughes9d5ccec2011-09-19 13:19:50 -070046 abort_(NULL),
47 stats_enabled_(false) {
Ian Rogers4f0d07c2011-10-06 23:38:47 -070048 for (int i = 0; i < Runtime::kLastTrampolineMethodType; i++) {
49 resolution_stub_array_[i] = NULL;
50 }
51 for (int i = 0; i < Runtime::kLastCalleeSaveType; i++) {
52 callee_save_method_[i] = NULL;
53 }
Elliott Hughesdcc24742011-09-07 14:02:44 -070054}
55
Carl Shapiro61e019d2011-07-14 16:53:09 -070056Runtime::~Runtime() {
Elliott Hughes5fe594f2011-09-08 12:33:17 -070057 // Make sure our internal threads are dead before we start tearing down things they're using.
58 delete signal_catcher_;
Elliott Hughes038a8062011-09-18 14:12:41 -070059 // TODO: GC thread.
Elliott Hughes5fe594f2011-09-08 12:33:17 -070060
Elliott Hughes038a8062011-09-18 14:12:41 -070061 // Make sure all other non-daemon threads have terminated, and all daemon threads are suspended.
Elliott Hughes93e74e82011-09-13 11:07:03 -070062 delete thread_list_;
63
Carl Shapiro61e019d2011-07-14 16:53:09 -070064 delete class_linker_;
Carl Shapiro69759ea2011-07-21 18:13:35 -070065 Heap::Destroy();
Elliott Hughescf4c6c42011-09-01 15:16:42 -070066 delete intern_table_;
Elliott Hughesc5f7c912011-08-18 14:00:42 -070067 delete java_vm_;
Elliott Hughesc1674ed2011-08-25 18:09:09 -070068 Thread::Shutdown();
Carl Shapiro4acf4642011-07-26 18:54:13 -070069 // TODO: acquire a static mutex on Runtime to avoid racing.
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070070 CHECK(instance_ == NULL || instance_ == this);
Carl Shapiro4acf4642011-07-26 18:54:13 -070071 instance_ = NULL;
Carl Shapiro61e019d2011-07-14 16:53:09 -070072}
73
Elliott Hughesffe67362011-07-17 12:09:27 -070074void Runtime::Abort(const char* file, int line) {
75 // Get any pending output out of the way.
76 fflush(NULL);
77
78 // Many people have difficulty distinguish aborts from crashes,
79 // so be explicit.
80 LogMessage(file, line, ERROR, -1).stream() << "Runtime aborting...";
81
Elliott Hughesffe67362011-07-17 12:09:27 -070082 // Perform any platform-specific pre-abort actions.
83 PlatformAbort(file, line);
84
Brian Carlstrom6ea095a2011-08-16 15:26:54 -070085 // use abort hook if we have one
86 if (Runtime::Current() != NULL && Runtime::Current()->abort_ != NULL) {
87 Runtime::Current()->abort_();
88 // notreached
89 }
90
Elliott Hughesffe67362011-07-17 12:09:27 -070091 // If we call abort(3) on a device, all threads in the process
Carl Shapiro69759ea2011-07-21 18:13:35 -070092 // receive SIGABRT. debuggerd dumps the stack trace of the main
93 // thread, whether or not that was the thread that failed. By
94 // stuffing a value into a bogus address, we cause a segmentation
Elliott Hughesffe67362011-07-17 12:09:27 -070095 // fault in the current thread, and get a useful log from debuggerd.
96 // We can also trivially tell the difference between a VM crash and
97 // a deliberate abort by looking at the fault address.
98 *reinterpret_cast<char*>(0xdeadd00d) = 38;
99 abort();
Elliott Hughesffe67362011-07-17 12:09:27 -0700100 // notreached
101}
102
Elliott Hughesbf86d042011-08-31 17:53:14 -0700103void Runtime::CallExitHook(jint status) {
104 if (exit_ != NULL) {
105 ScopedThreadStateChange tsc(Thread::Current(), Thread::kNative);
106 exit_(status);
107 LOG(WARNING) << "Exit hook returned instead of exiting!";
108 }
109}
110
Brian Carlstrom8a436592011-08-15 21:27:23 -0700111// Parse a string of the form /[0-9]+[kKmMgG]?/, which is used to specify
112// memory sizes. [kK] indicates kilobytes, [mM] megabytes, and
113// [gG] gigabytes.
114//
115// "s" should point just past the "-Xm?" part of the string.
Brian Carlstrom8a436592011-08-15 21:27:23 -0700116// "div" specifies a divisor, e.g. 1024 if the value must be a multiple
117// of 1024.
118//
119// The spec says the -Xmx and -Xms options must be multiples of 1024. It
120// doesn't say anything about -Xss.
121//
122// Returns 0 (a useless size) if "s" is malformed or specifies a low or
123// non-evenly-divisible value.
124//
125size_t ParseMemoryOption(const char *s, size_t div) {
126 // strtoul accepts a leading [+-], which we don't want,
127 // so make sure our string starts with a decimal digit.
128 if (isdigit(*s)) {
129 const char *s2;
130 size_t val = strtoul(s, (char **)&s2, 10);
131 if (s2 != s) {
132 // s2 should be pointing just after the number.
133 // If this is the end of the string, the user
134 // has specified a number of bytes. Otherwise,
135 // there should be exactly one more character
136 // that specifies a multiplier.
137 if (*s2 != '\0') {
Brian Carlstromf734cf52011-08-17 16:28:14 -0700138 // The remainder of the string is either a single multiplier
139 // character, or nothing to indicate that the value is in
140 // bytes.
141 char c = *s2++;
142 if (*s2 == '\0') {
143 size_t mul;
144 if (c == '\0') {
145 mul = 1;
146 } else if (c == 'k' || c == 'K') {
147 mul = KB;
148 } else if (c == 'm' || c == 'M') {
149 mul = MB;
150 } else if (c == 'g' || c == 'G') {
151 mul = GB;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700152 } else {
Brian Carlstromf734cf52011-08-17 16:28:14 -0700153 // Unknown multiplier character.
Brian Carlstrom8a436592011-08-15 21:27:23 -0700154 return 0;
155 }
Brian Carlstromf734cf52011-08-17 16:28:14 -0700156
157 if (val <= std::numeric_limits<size_t>::max() / mul) {
158 val *= mul;
159 } else {
160 // Clamp to a multiple of 1024.
161 val = std::numeric_limits<size_t>::max() & ~(1024-1);
162 }
163 } else {
164 // There's more than one character after the numeric part.
165 return 0;
166 }
Brian Carlstrom8a436592011-08-15 21:27:23 -0700167 }
168 // The man page says that a -Xm value must be a multiple of 1024.
169 if (val % div == 0) {
170 return val;
171 }
Carl Shapirofc322c72011-07-27 00:20:01 -0700172 }
173 }
Brian Carlstrom8a436592011-08-15 21:27:23 -0700174 return 0;
Carl Shapirofc322c72011-07-27 00:20:01 -0700175}
176
Elliott Hughes0af55432011-08-17 18:37:28 -0700177void LoadJniLibrary(JavaVMExt* vm, const char* name) {
178 // TODO: OS_SHARED_LIB_FORMAT_STR
179 std::string mapped_name(StringPrintf("lib%s.so", name));
Elliott Hughes75770752011-08-24 17:52:38 -0700180 std::string reason;
181 if (!vm->LoadNativeLibrary(mapped_name, NULL, reason)) {
Elliott Hughes0af55432011-08-17 18:37:28 -0700182 LOG(FATAL) << "LoadNativeLibrary failed for \"" << mapped_name << "\": "
183 << reason;
184 }
185}
186
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700187Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, bool ignore_unrecognized) {
Elliott Hughes90a33692011-08-30 13:27:07 -0700188 UniquePtr<ParsedOptions> parsed(new ParsedOptions());
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700189 const char* boot_class_path = getenv("BOOTCLASSPATH");
190 if (boot_class_path != NULL) {
191 parsed->boot_class_path_ = getenv("BOOTCLASSPATH");
192 }
193 const char* class_path = getenv("CLASSPATH");
194 if (class_path != NULL) {
195 parsed->class_path_ = getenv("CLASSPATH");
196 }
Elliott Hughes515a5bc2011-08-17 11:08:34 -0700197#ifdef NDEBUG
Elliott Hughes5174fe62011-08-23 15:12:35 -0700198 // -Xcheck:jni is off by default for regular builds...
Elliott Hughes515a5bc2011-08-17 11:08:34 -0700199 parsed->check_jni_ = false;
200#else
201 // ...but on by default in debug builds.
202 parsed->check_jni_ = true;
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700203#endif
Elliott Hughes85d15452011-09-16 17:33:01 -0700204
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700205 parsed->heap_initial_size_ = Heap::kInitialSize;
206 parsed->heap_maximum_size_ = Heap::kMaximumSize;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700207 parsed->stack_size_ = Thread::kDefaultStackSize;
208
Elliott Hughes9ca7a1f2011-10-11 14:29:52 -0700209 parsed->is_zygote_ = false;
210
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700211 parsed->hook_vfprintf_ = vfprintf;
212 parsed->hook_exit_ = exit;
213 parsed->hook_abort_ = abort;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700214
215 for (size_t i = 0; i < options.size(); ++i) {
216 const StringPiece& option = options[i].first;
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700217 if (false) {
218 LOG(INFO) << "option[" << i << "]=" << option;
219 }
Brian Carlstrom8a436592011-08-15 21:27:23 -0700220 if (option.starts_with("-Xbootclasspath:")) {
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700221 parsed->boot_class_path_ = option.substr(strlen("-Xbootclasspath:")).data();
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700222 } else if (option == "-classpath" || option == "-cp") {
223 // TODO: support -Djava.class.path
224 i++;
225 if (i == options.size()) {
226 // TODO: usage
227 LOG(FATAL) << "Missing required class path value for " << option;
228 return NULL;
229 }
230 const StringPiece& value = options[i].first;
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700231 parsed->class_path_ = value.data();
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700232 } else if (option.starts_with("-Ximage:")) {
233 parsed->images_.push_back(option.substr(strlen("-Ximage:")).data());
Elliott Hughes515a5bc2011-08-17 11:08:34 -0700234 } else if (option.starts_with("-Xcheck:jni")) {
235 parsed->check_jni_ = true;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700236 } else if (option.starts_with("-Xms")) {
Brian Carlstromf734cf52011-08-17 16:28:14 -0700237 size_t size = ParseMemoryOption(option.substr(strlen("-Xms")).data(), 1024);
238 if (size == 0) {
239 if (ignore_unrecognized) {
240 continue;
241 }
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700242 // TODO: usage
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700243 LOG(FATAL) << "Failed to parse " << option;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700244 return NULL;
245 }
246 parsed->heap_initial_size_ = size;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700247 } else if (option.starts_with("-Xmx")) {
Brian Carlstromf734cf52011-08-17 16:28:14 -0700248 size_t size = ParseMemoryOption(option.substr(strlen("-Xmx")).data(), 1024);
249 if (size == 0) {
250 if (ignore_unrecognized) {
251 continue;
252 }
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700253 // TODO: usage
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700254 LOG(FATAL) << "Failed to parse " << option;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700255 return NULL;
256 }
257 parsed->heap_maximum_size_ = size;
258 } else if (option.starts_with("-Xss")) {
259 size_t size = ParseMemoryOption(option.substr(strlen("-Xss")).data(), 1);
260 if (size == 0) {
261 if (ignore_unrecognized) {
262 continue;
263 }
Brian Carlstrom4a289ed2011-08-16 17:17:49 -0700264 // TODO: usage
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700265 LOG(FATAL) << "Failed to parse " << option;
Brian Carlstromf734cf52011-08-17 16:28:14 -0700266 return NULL;
267 }
268 parsed->stack_size_ = size;
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700269 } else if (option.starts_with("-D")) {
270 parsed->properties_.push_back(option.substr(strlen("-D")).data());
Elliott Hughesa0957642011-09-02 14:27:33 -0700271 } else if (option.starts_with("-Xjnitrace:")) {
272 parsed->jni_trace_ = option.substr(strlen("-Xjnitrace:")).data();
Elliott Hughes9ca7a1f2011-10-11 14:29:52 -0700273 } else if (option == "-Xzygote") {
274 parsed->is_zygote_ = true;
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700275 } else if (option.starts_with("-verbose:")) {
Elliott Hughes0af55432011-08-17 18:37:28 -0700276 std::vector<std::string> verbose_options;
Elliott Hughes34023802011-08-30 12:06:17 -0700277 Split(option.substr(strlen("-verbose:")).data(), ',', verbose_options);
Elliott Hughes0af55432011-08-17 18:37:28 -0700278 for (size_t i = 0; i < verbose_options.size(); ++i) {
279 parsed->verbose_.insert(verbose_options[i]);
280 }
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700281 } else if (option == "vfprintf") {
282 parsed->hook_vfprintf_ = reinterpret_cast<int (*)(FILE *, const char*, va_list)>(options[i].second);
283 } else if (option == "exit") {
284 parsed->hook_exit_ = reinterpret_cast<void(*)(jint)>(options[i].second);
285 } else if (option == "abort") {
286 parsed->hook_abort_ = reinterpret_cast<void(*)()>(options[i].second);
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700287 } else if (option == "host-prefix") {
288 parsed->host_prefix_ = reinterpret_cast<const char*>(options[i].second);
Brian Carlstrom8a436592011-08-15 21:27:23 -0700289 } else {
290 if (!ignore_unrecognized) {
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700291 // TODO: print usage via vfprintf
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700292 LOG(ERROR) << "Unrecognized option " << option;
293 // TODO: this should exit, but for now tolerate unknown options
294 //return NULL;
Brian Carlstrom8a436592011-08-15 21:27:23 -0700295 }
296 }
297 }
298
Elliott Hughes85d15452011-09-16 17:33:01 -0700299 LOG(INFO) << "CheckJNI is " << (parsed->check_jni_ ? "on" : "off");
300
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700301 return parsed.release();
Brian Carlstrom8a436592011-08-15 21:27:23 -0700302}
303
304Runtime* Runtime::Create(const Options& options, bool ignore_unrecognized) {
Carl Shapiro2ed144c2011-07-26 16:52:08 -0700305 // TODO: acquire a static mutex on Runtime to avoid racing.
306 if (Runtime::instance_ != NULL) {
307 return NULL;
308 }
Elliott Hughesdcc24742011-09-07 14:02:44 -0700309 instance_ = new Runtime;
310 if (!instance_->Init(options, ignore_unrecognized)) {
311 delete instance_;
312 instance_ = NULL;
Carl Shapiro61e019d2011-07-14 16:53:09 -0700313 }
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700314 return instance_;
315}
Elliott Hughes0af55432011-08-17 18:37:28 -0700316
Brian Carlstromaded5f72011-10-07 17:15:04 -0700317void CreateSystemClassLoader() {
318 if (ClassLoader::UseCompileTimeClassPath()) {
319 return;
320 }
321
322 Thread* self = Thread::Current();
323
324 // Must be in the kNative state for calling native methods.
325 CHECK_EQ(self->GetState(), Thread::kNative);
326
327 JNIEnv* env = self->GetJniEnv();
Brian Carlstromdf143242011-10-10 18:05:34 -0700328 ScopedLocalRef<jclass> ClassLoader_class(env, env->FindClass("java/lang/ClassLoader"));
329 CHECK(ClassLoader_class.get() != NULL);
330 jmethodID getSystemClassLoader = env->GetStaticMethodID(ClassLoader_class.get(),
331 "getSystemClassLoader",
332 "()Ljava/lang/ClassLoader;");
333 CHECK(getSystemClassLoader != NULL);
334 ScopedLocalRef<jobject> class_loader(env, env->CallStaticObjectMethod(ClassLoader_class.get(),
335 getSystemClassLoader));
336 CHECK(class_loader.get() != NULL);
Brian Carlstromaded5f72011-10-07 17:15:04 -0700337
Brian Carlstromdf143242011-10-10 18:05:34 -0700338 Thread::Current()->SetClassLoaderOverride(Decode<ClassLoader*>(env, class_loader.get()));
Brian Carlstromaded5f72011-10-07 17:15:04 -0700339}
340
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700341void Runtime::Start() {
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700342 if (IsVerboseStartup()) {
343 LOG(INFO) << "Runtime::Start entering";
344 }
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700345
346 CHECK(host_prefix_.empty()) << host_prefix_;
347
Elliott Hughes038a8062011-09-18 14:12:41 -0700348 InitNativeMethods();
Elliott Hughes85d15452011-09-16 17:33:01 -0700349
Elliott Hughes038a8062011-09-18 14:12:41 -0700350 Thread::FinishStartup();
Elliott Hughes85d15452011-09-16 17:33:01 -0700351
Elliott Hughes2a20cfd2011-09-23 19:30:41 -0700352 class_linker_->RunRootClinits();
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700353
Brian Carlstrom5d40f182011-09-26 22:29:18 -0700354 // Class::AllocObject asserts that all objects allocated better be
355 // initialized after Runtime::IsStarted is true, so this needs to
356 // come after ClassLinker::RunRootClinits.
357 started_ = true;
358
Elliott Hughes9ca7a1f2011-10-11 14:29:52 -0700359 if (!is_zygote_) {
360 signal_catcher_ = new SignalCatcher;
361 }
362
Elliott Hughes85d15452011-09-16 17:33:01 -0700363 StartDaemonThreads();
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700364
Brian Carlstromaded5f72011-10-07 17:15:04 -0700365 CreateSystemClassLoader();
366
Elliott Hughes726079d2011-10-07 18:43:44 -0700367 Thread::Current()->GetJniEnv()->locals.AssertEmpty();
368
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700369 if (IsVerboseStartup()) {
370 LOG(INFO) << "Runtime::Start exiting";
371 }
Elliott Hughes85d15452011-09-16 17:33:01 -0700372}
373
374void Runtime::StartDaemonThreads() {
Elliott Hughes9ca7a1f2011-10-11 14:29:52 -0700375 if (IsVerboseStartup()) {
376 LOG(INFO) << "Runtime::StartDaemonThreads entering";
377 }
Elliott Hughes85d15452011-09-16 17:33:01 -0700378
Elliott Hughes719b3232011-09-25 17:42:19 -0700379 Thread* self = Thread::Current();
Brian Carlstromaded5f72011-10-07 17:15:04 -0700380
381 // Must be in the kNative state for calling native methods.
382 CHECK_EQ(self->GetState(), Thread::kNative);
383
Elliott Hughes719b3232011-09-25 17:42:19 -0700384 JNIEnv* env = self->GetJniEnv();
Elliott Hughes726079d2011-10-07 18:43:44 -0700385 ScopedLocalRef<jclass> c(env, env->FindClass("java/lang/Daemons"));
386 CHECK(c.get() != NULL);
387 jmethodID mid = env->GetStaticMethodID(c.get(), "start", "()V");
Elliott Hughes719b3232011-09-25 17:42:19 -0700388 CHECK(mid != NULL);
Elliott Hughes726079d2011-10-07 18:43:44 -0700389 env->CallStaticVoidMethod(c.get(), mid);
Elliott Hughes9ca7a1f2011-10-11 14:29:52 -0700390
391 if (IsVerboseStartup()) {
392 LOG(INFO) << "Runtime::StartDaemonThreads exiting";
393 }
Carl Shapiro61e019d2011-07-14 16:53:09 -0700394}
395
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700396bool Runtime::IsStarted() const {
Elliott Hughesdcc24742011-09-07 14:02:44 -0700397 return started_;
398}
399
Elliott Hughes0af55432011-08-17 18:37:28 -0700400bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) {
Elliott Hughesc1674ed2011-08-25 18:09:09 -0700401 CHECK_EQ(sysconf(_SC_PAGE_SIZE), kPageSize);
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700402
Elliott Hughes90a33692011-08-30 13:27:07 -0700403 UniquePtr<ParsedOptions> options(ParsedOptions::Create(raw_options, ignore_unrecognized));
404 if (options.get() == NULL) {
Brian Carlstrome24fa612011-09-29 00:53:55 -0700405 LOG(ERROR) << "Failed to parse options";
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700406 return false;
407 }
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700408 verbose_startup_ = options->IsVerbose("startup");
409 if (IsVerboseStartup()) {
410 LOG(INFO) << "Runtime::Init -verbose:startup enabled";
411 }
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700412
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700413 host_prefix_ = options->host_prefix_;
414 boot_class_path_ = options->boot_class_path_;
415 class_path_ = options->class_path_;
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700416 properties_ = options->properties_;
417
Elliott Hughes9ca7a1f2011-10-11 14:29:52 -0700418 is_zygote_ = options->is_zygote_;
419
Elliott Hughes0af55432011-08-17 18:37:28 -0700420 vfprintf_ = options->hook_vfprintf_;
421 exit_ = options->hook_exit_;
422 abort_ = options->hook_abort_;
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700423
Elliott Hughesbe759c62011-09-08 19:38:21 -0700424 default_stack_size_ = options->stack_size_;
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700425
Elliott Hughes14357e82011-09-26 10:42:15 -0700426 thread_list_ = new ThreadList(options->IsVerbose("thread"));
Elliott Hughescf4c6c42011-09-01 15:16:42 -0700427 intern_table_ = new InternTable;
428
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700429 Heap::Init(options->heap_initial_size_, options->heap_maximum_size_, options->images_);
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700430
Elliott Hughesc1674ed2011-08-25 18:09:09 -0700431 BlockSignals();
432
Elliott Hughesa0957642011-09-02 14:27:33 -0700433 java_vm_ = new JavaVMExt(this, options.get());
Elliott Hughes515a5bc2011-08-17 11:08:34 -0700434
Elliott Hughesbe759c62011-09-08 19:38:21 -0700435 Thread::Startup();
Elliott Hughesd92bec42011-09-02 17:04:36 -0700436
Elliott Hughes5fe594f2011-09-08 12:33:17 -0700437 // ClassLinker needs an attached thread, but we can't fully attach a thread
438 // without creating objects.
439 Thread::Attach(this, "main", false);
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700440
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700441 CHECK_GE(Heap::GetSpaces().size(), 1U);
442 class_linker_ = ((Heap::GetSpaces()[0]->IsImageSpace())
443 ? ClassLinker::Create(intern_table_)
444 : ClassLinker::Create(options->boot_class_path_, intern_table_));
Brian Carlstrom6ea095a2011-08-16 15:26:54 -0700445
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700446 if (IsVerboseStartup()) {
447 LOG(INFO) << "Runtime::Init exiting";
448 }
Carl Shapiro1fb86202011-06-27 17:43:13 -0700449 return true;
450}
451
Elliott Hughes038a8062011-09-18 14:12:41 -0700452void Runtime::InitNativeMethods() {
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700453 if (IsVerboseStartup()) {
454 LOG(INFO) << "Runtime::InitNativeMethods entering";
455 }
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700456 Thread* self = Thread::Current();
457 JNIEnv* env = self->GetJniEnv();
458
Elliott Hughes418d20f2011-09-22 14:00:39 -0700459 // Must be in the kNative state for calling native methods (JNI_OnLoad code).
Brian Carlstromaded5f72011-10-07 17:15:04 -0700460 CHECK_EQ(self->GetState(), Thread::kNative);
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700461
Elliott Hughes418d20f2011-09-22 14:00:39 -0700462 // First set up JniConstants, which is used by both the runtime's built-in native
463 // methods and libcore.
Elliott Hughesfea966e2011-09-22 10:26:20 -0700464 JniConstants::init(env);
465
Elliott Hughes418d20f2011-09-22 14:00:39 -0700466 // Then set up the native methods provided by the runtime itself.
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700467 RegisterRuntimeNativeMethods(env);
468
Elliott Hughes418d20f2011-09-22 14:00:39 -0700469 // Then set up libcore, which is just a regular JNI library with a regular JNI_OnLoad.
470 // Most JNI libraries can just use System.loadLibrary, but libcore can't because it's
471 // the library that implements System.loadLibrary!
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700472 LoadJniLibrary(instance_->GetJavaVM(), "javacore");
Brian Carlstrom0a5b14d2011-09-27 13:29:15 -0700473 if (IsVerboseStartup()) {
474 LOG(INFO) << "Runtime::InitNativeMethods exiting";
475 }
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700476}
477
478void Runtime::RegisterRuntimeNativeMethods(JNIEnv* env) {
479#define REGISTER(FN) extern void FN(JNIEnv*); FN(env)
Brian Carlstromf91c8c32011-09-21 17:30:34 -0700480 REGISTER(register_dalvik_system_DexFile);
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700481 REGISTER(register_dalvik_system_VMDebug);
Elliott Hughes7ede61e2011-09-14 18:18:06 -0700482 REGISTER(register_dalvik_system_VMRuntime);
Elliott Hughes8daa0922011-09-11 13:46:25 -0700483 REGISTER(register_dalvik_system_VMStack);
Elliott Hughes01158d72011-09-19 19:47:10 -0700484 REGISTER(register_dalvik_system_Zygote);
Elliott Hughesd369bb72011-09-12 14:41:14 -0700485 REGISTER(register_java_lang_Class);
Elliott Hughesbf86d042011-08-31 17:53:14 -0700486 REGISTER(register_java_lang_Object);
487 REGISTER(register_java_lang_Runtime);
488 REGISTER(register_java_lang_String);
489 REGISTER(register_java_lang_System);
Elliott Hughes8daa0922011-09-11 13:46:25 -0700490 REGISTER(register_java_lang_Thread);
Elliott Hughes1240dad2011-09-09 16:24:50 -0700491 REGISTER(register_java_lang_Throwable);
Elliott Hughes64bf5a32011-09-20 14:43:12 -0700492 REGISTER(register_java_lang_VMClassLoader);
Brian Carlstrom5b8e4c82011-09-18 01:38:59 -0700493 REGISTER(register_java_lang_reflect_Array);
Elliott Hughes2a20cfd2011-09-23 19:30:41 -0700494 REGISTER(register_java_lang_reflect_Constructor);
Brian Carlstromf867b6f2011-09-16 12:17:25 -0700495 REGISTER(register_java_lang_reflect_Field);
496 REGISTER(register_java_lang_reflect_Method);
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700497 //REGISTER(register_java_lang_reflect_Proxy);
Elliott Hughesbf86d042011-08-31 17:53:14 -0700498 REGISTER(register_java_util_concurrent_atomic_AtomicLong);
Brian Carlstrom395520e2011-09-25 19:35:00 -0700499 REGISTER(register_org_apache_harmony_dalvik_ddmc_DdmServer);
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700500 //REGISTER(register_org_apache_harmony_dalvik_ddmc_DdmVmInternal);
Elliott Hughes5ee7a8b2011-09-13 16:40:07 -0700501 REGISTER(register_sun_misc_Unsafe);
Elliott Hughesad7c2a32011-08-31 11:58:10 -0700502#undef REGISTER
503}
504
Elliott Hughes8daa0922011-09-11 13:46:25 -0700505void Runtime::Dump(std::ostream& os) {
Elliott Hughese27955c2011-08-26 15:21:24 -0700506 // TODO: dump other runtime statistics?
507 os << "Loaded classes: " << class_linker_->NumLoadedClasses() << "\n";
Elliott Hughescf4c6c42011-09-01 15:16:42 -0700508 os << "Intern table size: " << GetInternTable()->Size() << "\n";
Elliott Hughese27955c2011-08-26 15:21:24 -0700509 // LOGV("VM stats: meth=%d ifld=%d sfld=%d linear=%d",
510 // gDvm.numDeclaredMethods,
511 // gDvm.numDeclaredInstFields,
512 // gDvm.numDeclaredStaticFields,
513 // gDvm.pBootLoaderAlloc->curOffset);
514 // LOGI("GC precise methods: %d", dvmPointerSetGetCount(gDvm.preciseMethods));
Elliott Hughes42ee1422011-09-06 12:33:32 -0700515 os << "\n";
Elliott Hughes8daa0922011-09-11 13:46:25 -0700516
517 thread_list_->Dump(os);
Elliott Hughese27955c2011-08-26 15:21:24 -0700518}
519
Elliott Hughes9d5ccec2011-09-19 13:19:50 -0700520void Runtime::SetStatsEnabled(bool new_state) {
521 if (new_state == true) {
522 GetStats()->Clear(~0);
523 // TODO: wouldn't it make more sense to clear _all_ threads' stats?
524 Thread::Current()->GetStats()->Clear(~0);
525 }
526 stats_enabled_ = new_state;
527}
528
529void Runtime::ResetStats(int kinds) {
530 GetStats()->Clear(kinds & 0xffff);
531 // TODO: wouldn't it make more sense to clear _all_ threads' stats?
532 Thread::Current()->GetStats()->Clear(kinds >> 16);
533}
534
535RuntimeStats* Runtime::GetStats() {
536 return &stats_;
537}
538
539int32_t Runtime::GetStat(int kind) {
540 RuntimeStats* stats;
541 if (kind < (1<<16)) {
542 stats = GetStats();
543 } else {
544 stats = Thread::Current()->GetStats();
545 kind >>= 16;
546 }
547 switch (kind) {
548 case KIND_ALLOCATED_OBJECTS:
549 return stats->allocated_objects;
550 case KIND_ALLOCATED_BYTES:
551 return stats->allocated_bytes;
552 case KIND_FREED_OBJECTS:
553 return stats->freed_objects;
554 case KIND_FREED_BYTES:
555 return stats->freed_bytes;
556 case KIND_GC_INVOCATIONS:
557 return stats->gc_for_alloc_count;
558 case KIND_CLASS_INIT_COUNT:
559 return stats->class_init_count;
560 case KIND_CLASS_INIT_TIME:
561 // Convert ns to us, reduce to 32 bits.
562 return (int) (stats->class_init_time_ns / 1000);
563 case KIND_EXT_ALLOCATED_OBJECTS:
564 case KIND_EXT_ALLOCATED_BYTES:
565 case KIND_EXT_FREED_OBJECTS:
566 case KIND_EXT_FREED_BYTES:
567 return 0; // backward compatibility
568 default:
569 CHECK(false);
570 return -1; // unreachable
571 }
572}
573
Elliott Hughesc1674ed2011-08-25 18:09:09 -0700574void Runtime::BlockSignals() {
575 sigset_t sigset;
576 if (sigemptyset(&sigset) == -1) {
577 PLOG(FATAL) << "sigemptyset failed";
578 }
579 if (sigaddset(&sigset, SIGPIPE) == -1) {
580 PLOG(ERROR) << "sigaddset SIGPIPE failed";
581 }
582 // SIGQUIT is used to dump the runtime's state (including stack traces).
583 if (sigaddset(&sigset, SIGQUIT) == -1) {
584 PLOG(ERROR) << "sigaddset SIGQUIT failed";
585 }
586 // SIGUSR1 is used to initiate a heap dump.
587 if (sigaddset(&sigset, SIGUSR1) == -1) {
588 PLOG(ERROR) << "sigaddset SIGUSR1 failed";
589 }
590 CHECK_EQ(sigprocmask(SIG_BLOCK, &sigset, NULL), 0);
591}
592
Elliott Hughes5fe594f2011-09-08 12:33:17 -0700593void Runtime::AttachCurrentThread(const char* name, bool as_daemon) {
594 Thread::Attach(instance_, name, as_daemon);
Carl Shapiro61e019d2011-07-14 16:53:09 -0700595}
596
Elliott Hughesd92bec42011-09-02 17:04:36 -0700597void Runtime::DetachCurrentThread() {
Elliott Hughes038a8062011-09-18 14:12:41 -0700598 // TODO: check we're not calling DetachCurrentThread from a call stack that
599 // includes managed frames. (It's only valid if the stack is all-native.)
Elliott Hughes02b48d12011-09-07 17:15:51 -0700600 thread_list_->Unregister();
Carl Shapiro1fb86202011-06-27 17:43:13 -0700601}
602
Brian Carlstrome24fa612011-09-29 00:53:55 -0700603void Runtime::VisitRoots(Heap::RootVisitor* visitor, void* arg) const {
604 class_linker_->VisitRoots(visitor, arg);
605 intern_table_->VisitRoots(visitor, arg);
606 java_vm_->VisitRoots(visitor, arg);
607 thread_list_->VisitRoots(visitor, arg);
608 visitor(jni_stub_array_, arg);
609 visitor(abstract_method_error_stub_array_, arg);
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700610 for (int i = 0; i < Runtime::kLastTrampolineMethodType; i++) {
611 visitor(resolution_stub_array_[i], arg);
612 }
613 for (int i = 0; i < Runtime::kLastCalleeSaveType; i++) {
614 visitor(callee_save_method_[i], arg);
615 }
Brian Carlstrome24fa612011-09-29 00:53:55 -0700616
617 //(*visitor)(&gDvm.outOfMemoryObj, 0, ROOT_VM_INTERNAL, arg);
618 //(*visitor)(&gDvm.internalErrorObj, 0, ROOT_VM_INTERNAL, arg);
619 //(*visitor)(&gDvm.noClassDefFoundErrorObj, 0, ROOT_VM_INTERNAL, arg);
620 UNIMPLEMENTED(WARNING) << "some roots not marked";
621}
622
623bool Runtime::HasJniStubArray() const {
624 return jni_stub_array_ != NULL;
625}
626
627ByteArray* Runtime::GetJniStubArray() const {
628 CHECK(jni_stub_array_ != NULL);
629 return jni_stub_array_;
630}
631
632void Runtime::SetJniStubArray(ByteArray* jni_stub_array) {
Brian Carlstromaded5f72011-10-07 17:15:04 -0700633 CHECK(jni_stub_array != NULL) << " jni_stub_array=" << jni_stub_array;
634 CHECK(jni_stub_array_ == NULL || jni_stub_array_ == jni_stub_array)
635 << "jni_stub_array_=" << jni_stub_array_ << " jni_stub_array=" << jni_stub_array;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700636 jni_stub_array_ = jni_stub_array;
637}
638
639bool Runtime::HasAbstractMethodErrorStubArray() const {
640 return abstract_method_error_stub_array_ != NULL;
641}
642
643ByteArray* Runtime::GetAbstractMethodErrorStubArray() const {
644 CHECK(abstract_method_error_stub_array_ != NULL);
645 return abstract_method_error_stub_array_;
646}
647
648void Runtime::SetAbstractMethodErrorStubArray(ByteArray* abstract_method_error_stub_array) {
649 CHECK(abstract_method_error_stub_array != NULL);
650 CHECK(abstract_method_error_stub_array_ == NULL || abstract_method_error_stub_array_ == abstract_method_error_stub_array);
651 abstract_method_error_stub_array_ = abstract_method_error_stub_array;
652}
653
Ian Rogers1cb0a1d2011-10-06 15:24:35 -0700654
655Runtime::TrampolineType Runtime::GetTrampolineType(Method* method) {
656 if (method == NULL) {
657 return Runtime::kUnknownMethod;
658 } else if (method->IsStatic()) {
659 return Runtime::kStaticMethod;
660 } else {
661 return Runtime::kInstanceMethod;
662 }
Ian Rogersad25ac52011-10-04 19:13:33 -0700663}
664
Ian Rogers1cb0a1d2011-10-06 15:24:35 -0700665bool Runtime::HasResolutionStubArray(TrampolineType type) const {
666 return resolution_stub_array_[type] != NULL;
Ian Rogersad25ac52011-10-04 19:13:33 -0700667}
668
Ian Rogers1cb0a1d2011-10-06 15:24:35 -0700669ByteArray* Runtime::GetResolutionStubArray(TrampolineType type) const {
670 CHECK(HasResolutionStubArray(type));
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700671 DCHECK_LT(static_cast<int>(type), static_cast<int>(kLastTrampolineMethodType));
Ian Rogers1cb0a1d2011-10-06 15:24:35 -0700672 return resolution_stub_array_[type];
673}
674
675void Runtime::SetResolutionStubArray(ByteArray* resolution_stub_array, TrampolineType type) {
Ian Rogersad25ac52011-10-04 19:13:33 -0700676 CHECK(resolution_stub_array != NULL);
Ian Rogers1cb0a1d2011-10-06 15:24:35 -0700677 CHECK(!HasResolutionStubArray(type) || resolution_stub_array_[type] == resolution_stub_array);
678 resolution_stub_array_[type] = resolution_stub_array;
Ian Rogersad25ac52011-10-04 19:13:33 -0700679}
680
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700681Method* Runtime::CreateCalleeSaveMethod(InstructionSet insns, CalleeSaveType type) {
Ian Rogersff1ed472011-09-20 13:46:24 -0700682 Class* method_class = Method::GetMethodClass();
683 Method* method = down_cast<Method*>(method_class->AllocObject());
684 method->SetDeclaringClass(method_class);
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700685 const char* name;
686 if (type == kSaveAll) {
687 name = "$$$callee_save_method$$$";
688 } else if (type == kRefsOnly) {
689 name = "$$$refs_only_callee_save_method$$$";
690 } else {
691 DCHECK(type == kRefsAndArgs);
692 name = "$$$refs_and_args_callee_save_method$$$";
693 }
694 method->SetName(intern_table_->InternStrong(name));
Ian Rogersff1ed472011-09-20 13:46:24 -0700695 method->SetSignature(intern_table_->InternStrong("()V"));
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700696 method->SetCode(NULL);
Ian Rogersff1ed472011-09-20 13:46:24 -0700697 if ((insns == kThumb2) || (insns == kArm)) {
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700698 uint32_t ref_spills = (1 << art::arm::R5) | (1 << art::arm::R6) | (1 << art::arm::R7) |
699 (1 << art::arm::R8) | (1 << art::arm::R10) | (1 << art::arm::R11);
700 uint32_t arg_spills = (1 << art::arm::R1) | (1 << art::arm::R2) | (1 << art::arm::R3);
701 uint32_t all_spills = (1 << art::arm::R4) | (1 << art::arm::R9);
702 uint32_t core_spills = ref_spills | (type == kRefsAndArgs ? arg_spills :0) |
703 (type == kSaveAll ? all_spills :0) | (1 << art::arm::LR);
704 uint32_t fp_all_spills = (1 << art::arm::S0) | (1 << art::arm::S1) | (1 << art::arm::S2) |
705 (1 << art::arm::S3) | (1 << art::arm::S4) | (1 << art::arm::S5) |
706 (1 << art::arm::S6) | (1 << art::arm::S7) | (1 << art::arm::S8) |
707 (1 << art::arm::S9) | (1 << art::arm::S10) | (1 << art::arm::S11) |
708 (1 << art::arm::S12) | (1 << art::arm::S13) | (1 << art::arm::S14) |
709 (1 << art::arm::S15) | (1 << art::arm::S16) | (1 << art::arm::S17) |
710 (1 << art::arm::S18) | (1 << art::arm::S19) | (1 << art::arm::S20) |
711 (1 << art::arm::S21) | (1 << art::arm::S22) | (1 << art::arm::S23) |
712 (1 << art::arm::S24) | (1 << art::arm::S25) | (1 << art::arm::S26) |
713 (1 << art::arm::S27) | (1 << art::arm::S28) | (1 << art::arm::S29) |
714 (1 << art::arm::S30) | (1 << art::arm::S31);
715 uint32_t fp_spills = type == kSaveAll ? fp_all_spills : 0;
716 size_t frame_size = RoundUp((__builtin_popcount(core_spills) /* gprs */ +
717 __builtin_popcount(fp_spills) /* fprs */ +
718 1 /* Method* */) * kPointerSize, kStackAlignment);
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700719 method->SetFrameSizeInBytes(frame_size);
720 method->SetReturnPcOffsetInBytes(frame_size - kPointerSize);
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700721 method->SetCoreSpillMask(core_spills);
722 method->SetFpSpillMask(fp_spills);
Ian Rogersff1ed472011-09-20 13:46:24 -0700723 } else if (insns == kX86) {
724 method->SetFrameSizeInBytes(32);
725 method->SetReturnPcOffsetInBytes(28);
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700726 method->SetCoreSpillMask((1 << art::x86::EBX) | (1 << art::x86::EBP) | (1 << art::x86::ESI) |
Ian Rogersff1ed472011-09-20 13:46:24 -0700727 (1 << art::x86::EDI));
728 method->SetFpSpillMask(0);
729 } else {
730 UNIMPLEMENTED(FATAL);
731 }
732 return method;
733}
734
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700735bool Runtime::HasCalleeSaveMethod(CalleeSaveType type) const {
736 return callee_save_method_[type] != NULL;
Brian Carlstrom1f870082011-08-23 16:02:11 -0700737}
738
Brian Carlstrome24fa612011-09-29 00:53:55 -0700739// Returns a special method that describes all callee saves being spilled to the stack.
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700740Method* Runtime::GetCalleeSaveMethod(CalleeSaveType type) const {
741 CHECK(HasCalleeSaveMethod(type));
742 return callee_save_method_[type];
Brian Carlstrome24fa612011-09-29 00:53:55 -0700743}
744
Ian Rogers4f0d07c2011-10-06 23:38:47 -0700745void Runtime::SetCalleeSaveMethod(Method* method, CalleeSaveType type) {
746 DCHECK_LT(static_cast<int>(type), static_cast<int>(kLastCalleeSaveType));
747 callee_save_method_[type] = method;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700748}
749
Carl Shapiro1fb86202011-06-27 17:43:13 -0700750} // namespace art