summaryrefslogtreecommitdiffstats
path: root/runtime/runtime.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r--runtime/runtime.cc97
1 files changed, 57 insertions, 40 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 86fae82..d8f9ca3 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -375,10 +375,11 @@ static double ParseDoubleOrDie(const std::string& option, char after_char, doubl
return value;
}
-void Runtime::SweepSystemWeaks(RootVisitor* visitor, void* arg) {
+void Runtime::SweepSystemWeaks(IsMarkedCallback* visitor, void* arg) {
GetInternTable()->SweepInternTableWeaks(visitor, arg);
GetMonitorList()->SweepMonitorList(visitor, arg);
GetJavaVM()->SweepJniWeakGlobals(visitor, arg);
+ Dbg::UpdateObjectPointers(visitor, arg);
}
static gc::CollectorType ParseCollectorType(const std::string& option) {
@@ -429,6 +430,8 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b
parsed->use_tlab_ = false;
parsed->verify_pre_gc_heap_ = false;
parsed->verify_post_gc_heap_ = kIsDebugBuild;
+ parsed->verify_pre_gc_rosalloc_ = kIsDebugBuild;
+ parsed->verify_post_gc_rosalloc_ = false;
parsed->compiler_callbacks_ = nullptr;
parsed->is_zygote_ = false;
@@ -615,12 +618,20 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b
parsed->collector_type_ = collector_type;
} else if (gc_option == "preverify") {
parsed->verify_pre_gc_heap_ = true;
- } else if (gc_option == "nopreverify") {
+ } else if (gc_option == "nopreverify") {
parsed->verify_pre_gc_heap_ = false;
} else if (gc_option == "postverify") {
parsed->verify_post_gc_heap_ = true;
} else if (gc_option == "nopostverify") {
parsed->verify_post_gc_heap_ = false;
+ } else if (gc_option == "preverify_rosalloc") {
+ parsed->verify_pre_gc_rosalloc_ = true;
+ } else if (gc_option == "nopreverify_rosalloc") {
+ parsed->verify_pre_gc_rosalloc_ = false;
+ } else if (gc_option == "postverify_rosalloc") {
+ parsed->verify_post_gc_rosalloc_ = true;
+ } else if (gc_option == "nopostverify_rosalloc") {
+ parsed->verify_post_gc_rosalloc_ = false;
} else {
LOG(WARNING) << "Ignoring unknown -Xgc option: " << gc_option;
}
@@ -802,7 +813,7 @@ jobject CreateSystemClassLoader() {
JValue result;
ArgArray arg_array(nullptr, 0);
- InvokeWithArgArray(soa, getSystemClassLoader, &arg_array, &result, 'L');
+ InvokeWithArgArray(soa, getSystemClassLoader, &arg_array, &result, "L");
SirtRef<mirror::ClassLoader> class_loader(soa.Self(),
down_cast<mirror::ClassLoader*>(result.GetL()));
CHECK(class_loader.get() != nullptr);
@@ -1024,7 +1035,9 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) {
options->ignore_max_footprint_,
options->use_tlab_,
options->verify_pre_gc_heap_,
- options->verify_post_gc_heap_);
+ options->verify_post_gc_heap_,
+ options->verify_pre_gc_rosalloc_,
+ options->verify_post_gc_rosalloc_);
dump_gc_performance_on_shutdown_ = options->dump_gc_performance_on_shutdown_;
@@ -1294,66 +1307,69 @@ void Runtime::DetachCurrentThread() {
return pre_allocated_OutOfMemoryError_;
}
-void Runtime::VisitConcurrentRoots(RootVisitor* visitor, void* arg, bool only_dirty,
+void Runtime::VisitConcurrentRoots(RootCallback* callback, void* arg, bool only_dirty,
bool clean_dirty) {
- intern_table_->VisitRoots(visitor, arg, only_dirty, clean_dirty);
- class_linker_->VisitRoots(visitor, arg, only_dirty, clean_dirty);
+ intern_table_->VisitRoots(callback, arg, only_dirty, clean_dirty);
+ class_linker_->VisitRoots(callback, arg, only_dirty, clean_dirty);
}
-void Runtime::VisitNonThreadRoots(RootVisitor* visitor, void* arg) {
+void Runtime::VisitNonThreadRoots(RootCallback* callback, void* arg) {
// Visit the classes held as static in mirror classes.
- mirror::ArtField::VisitRoots(visitor, arg);
- mirror::ArtMethod::VisitRoots(visitor, arg);
- mirror::Class::VisitRoots(visitor, arg);
- mirror::StackTraceElement::VisitRoots(visitor, arg);
- mirror::String::VisitRoots(visitor, arg);
- mirror::Throwable::VisitRoots(visitor, arg);
+ mirror::ArtField::VisitRoots(callback, arg);
+ mirror::ArtMethod::VisitRoots(callback, arg);
+ mirror::Class::VisitRoots(callback, arg);
+ mirror::StackTraceElement::VisitRoots(callback, arg);
+ mirror::String::VisitRoots(callback, arg);
+ mirror::Throwable::VisitRoots(callback, arg);
// Visit all the primitive array types classes.
- mirror::PrimitiveArray<uint8_t>::VisitRoots(visitor, arg); // BooleanArray
- mirror::PrimitiveArray<int8_t>::VisitRoots(visitor, arg); // ByteArray
- mirror::PrimitiveArray<uint16_t>::VisitRoots(visitor, arg); // CharArray
- mirror::PrimitiveArray<double>::VisitRoots(visitor, arg); // DoubleArray
- mirror::PrimitiveArray<float>::VisitRoots(visitor, arg); // FloatArray
- mirror::PrimitiveArray<int32_t>::VisitRoots(visitor, arg); // IntArray
- mirror::PrimitiveArray<int64_t>::VisitRoots(visitor, arg); // LongArray
- mirror::PrimitiveArray<int16_t>::VisitRoots(visitor, arg); // ShortArray
- java_vm_->VisitRoots(visitor, arg);
+ mirror::PrimitiveArray<uint8_t>::VisitRoots(callback, arg); // BooleanArray
+ mirror::PrimitiveArray<int8_t>::VisitRoots(callback, arg); // ByteArray
+ mirror::PrimitiveArray<uint16_t>::VisitRoots(callback, arg); // CharArray
+ mirror::PrimitiveArray<double>::VisitRoots(callback, arg); // DoubleArray
+ mirror::PrimitiveArray<float>::VisitRoots(callback, arg); // FloatArray
+ mirror::PrimitiveArray<int32_t>::VisitRoots(callback, arg); // IntArray
+ mirror::PrimitiveArray<int64_t>::VisitRoots(callback, arg); // LongArray
+ mirror::PrimitiveArray<int16_t>::VisitRoots(callback, arg); // ShortArray
+ java_vm_->VisitRoots(callback, arg);
if (pre_allocated_OutOfMemoryError_ != nullptr) {
pre_allocated_OutOfMemoryError_ = down_cast<mirror::Throwable*>(
- visitor(pre_allocated_OutOfMemoryError_, arg));
+ callback(pre_allocated_OutOfMemoryError_, arg, 0, kRootVMInternal));
DCHECK(pre_allocated_OutOfMemoryError_ != nullptr);
}
- resolution_method_ = down_cast<mirror::ArtMethod*>(visitor(resolution_method_, arg));
+ resolution_method_ = down_cast<mirror::ArtMethod*>(callback(resolution_method_, arg, 0,
+ kRootVMInternal));
DCHECK(resolution_method_ != nullptr);
if (HasImtConflictMethod()) {
- imt_conflict_method_ = down_cast<mirror::ArtMethod*>(visitor(imt_conflict_method_, arg));
+ imt_conflict_method_ = down_cast<mirror::ArtMethod*>(callback(imt_conflict_method_, arg, 0,
+ kRootVMInternal));
}
if (HasDefaultImt()) {
- default_imt_ = down_cast<mirror::ObjectArray<mirror::ArtMethod>*>(visitor(default_imt_, arg));
+ default_imt_ = down_cast<mirror::ObjectArray<mirror::ArtMethod>*>(callback(default_imt_, arg,
+ 0, kRootVMInternal));
}
for (int i = 0; i < Runtime::kLastCalleeSaveType; i++) {
if (callee_save_methods_[i] != nullptr) {
callee_save_methods_[i] = down_cast<mirror::ArtMethod*>(
- visitor(callee_save_methods_[i], arg));
+ callback(callee_save_methods_[i], arg, 0, kRootVMInternal));
}
}
{
MutexLock mu(Thread::Current(), method_verifiers_lock_);
for (verifier::MethodVerifier* verifier : method_verifiers_) {
- verifier->VisitRoots(visitor, arg);
+ verifier->VisitRoots(callback, arg);
}
}
}
-void Runtime::VisitNonConcurrentRoots(RootVisitor* visitor, void* arg) {
- thread_list_->VisitRoots(visitor, arg);
- VisitNonThreadRoots(visitor, arg);
+void Runtime::VisitNonConcurrentRoots(RootCallback* callback, void* arg) {
+ thread_list_->VisitRoots(callback, arg);
+ VisitNonThreadRoots(callback, arg);
}
-void Runtime::VisitRoots(RootVisitor* visitor, void* arg, bool only_dirty, bool clean_dirty) {
- VisitConcurrentRoots(visitor, arg, only_dirty, clean_dirty);
- VisitNonConcurrentRoots(visitor, arg);
+void Runtime::VisitRoots(RootCallback* callback, void* arg, bool only_dirty, bool clean_dirty) {
+ VisitConcurrentRoots(callback, arg, only_dirty, clean_dirty);
+ VisitNonConcurrentRoots(callback, arg);
}
mirror::ObjectArray<mirror::ArtMethod>* Runtime::CreateDefaultImt(ClassLinker* cl) {
@@ -1466,12 +1482,11 @@ mirror::ArtMethod* Runtime::CreateCalleeSaveMethod(InstructionSet instruction_se
method->SetFpSpillMask(0);
} else if (instruction_set == kX86_64) {
uint32_t ref_spills =
- (1 << art::x86_64::RBP) | (1 << art::x86_64::RSI) | (1 << art::x86_64::RDI) |
- (1 << art::x86_64::R8) | (1 << art::x86_64::R9) | (1 << art::x86_64::R10) |
- (1 << art::x86_64::R11) | (1 << art::x86_64::R12) | (1 << art::x86_64::R13) |
- (1 << art::x86_64::R14) | (1 << art::x86_64::R15);
+ (1 << art::x86_64::RBX) | (1 << art::x86_64::RBP) | (1 << art::x86_64::R12) |
+ (1 << art::x86_64::R13) | (1 << art::x86_64::R14) | (1 << art::x86_64::R15);
uint32_t arg_spills =
- (1 << art::x86_64::RCX) | (1 << art::x86_64::RDX) | (1 << art::x86_64::RBX);
+ (1 << art::x86_64::RSI) | (1 << art::x86_64::RDX) | (1 << art::x86_64::RCX) |
+ (1 << art::x86_64::R8) | (1 << art::x86_64::R9);
uint32_t core_spills = ref_spills | (type == kRefsAndArgs ? arg_spills : 0) |
(1 << art::x86::kNumberOfCpuRegisters); // fake return address callee save
size_t frame_size = RoundUp((__builtin_popcount(core_spills) /* gprs */ +
@@ -1489,12 +1504,14 @@ void Runtime::DisallowNewSystemWeaks() {
monitor_list_->DisallowNewMonitors();
intern_table_->DisallowNewInterns();
java_vm_->DisallowNewWeakGlobals();
+ Dbg::DisallowNewObjectRegistryObjects();
}
void Runtime::AllowNewSystemWeaks() {
monitor_list_->AllowNewMonitors();
intern_table_->AllowNewInterns();
java_vm_->AllowNewWeakGlobals();
+ Dbg::AllowNewObjectRegistryObjects();
}
void Runtime::SetCalleeSaveMethod(mirror::ArtMethod* method, CalleeSaveType type) {