Don't pre-allocate one OOME per thread.
There's no associated stack trace, so we can share one between all
threads, saving a little memory and thread start-up time. Speaking
of stack traces: dump the stack to the log at the point where we
realize we're not going to be able to throw an exception with a
stack, so the developer has _something_ to work with.
Change-Id: I2246d291855bd9b9ee13f2be5b1ce14f669e9410
diff --git a/src/runtime.h b/src/runtime.h
index d80f1c9..9181f1f 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -48,6 +48,7 @@
class SignalCatcher;
class String;
class ThreadList;
+class Throwable;
class Trace;
class Runtime {
@@ -172,14 +173,18 @@
return java_vm_;
}
- const std::vector<std::string>& GetProperties() const {
- return properties_;
- }
-
MonitorList* GetMonitorList() const {
return monitor_list_;
}
+ Throwable* GetPreAllocatedOutOfMemoryError() {
+ return pre_allocated_OutOfMemoryError_;
+ }
+
+ const std::vector<std::string>& GetProperties() const {
+ return properties_;
+ }
+
ThreadList* GetThreadList() const {
return thread_list_;
}
@@ -255,12 +260,12 @@
};
bool HasCalleeSaveMethod(CalleeSaveType type) const {
- return callee_save_method_[type] != NULL;
+ return callee_save_methods_[type] != NULL;
}
Method* GetCalleeSaveMethod(CalleeSaveType type) const {
CHECK(HasCalleeSaveMethod(type));
- return callee_save_method_[type];
+ return callee_save_methods_[type];
}
void SetCalleeSaveMethod(Method* method, CalleeSaveType type);
@@ -359,13 +364,15 @@
JavaVMExt* java_vm_;
+ Throwable* pre_allocated_OutOfMemoryError_;
+
ByteArray* jni_stub_array_;
ByteArray* abstract_method_error_stub_array_;
ByteArray* resolution_stub_array_[kLastTrampolineMethodType];
- Method* callee_save_method_[kLastCalleeSaveType];
+ Method* callee_save_methods_[kLastCalleeSaveType];
Method* resolution_method_;