summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2018-02-27 20:02:17 +0000
committer Roland Levillain <rpl@google.com> 2018-02-27 20:02:17 +0000
commitaf290318c31180148bab64038d66a6059a1a89d5 (patch)
treef5369e0be49f4599ada2a1d70cd564dbe5ba5ff5
parentcc4e7b7c7b37d9f7bd6e2bfe22e36308150dddad (diff)
Small documentation and stylistic changes.
Test: art/test.py Change-Id: Ibc74ee4783314266bf1d027811715058626c57c8
-rw-r--r--compiler/driver/compiler_driver.cc2
-rw-r--r--dex2oat/dex2oat.cc2
-rw-r--r--dex2oat/linker/image_writer.cc2
-rw-r--r--openjdkjvm/OpenjdkJvm.cc2
-rw-r--r--openjdkjvmti/ti_heap.cc2
-rw-r--r--runtime/debugger.cc6
-rw-r--r--runtime/gc/allocation_record.cc2
-rw-r--r--runtime/gc/collector/concurrent_copying.cc5
-rw-r--r--runtime/gc/heap.cc2
-rw-r--r--runtime/gc/heap_test.cc2
-rw-r--r--runtime/gc/system_weak_test.cc8
-rw-r--r--runtime/jni_internal_test.cc3
-rw-r--r--runtime/signal_catcher.cc2
-rw-r--r--runtime/thread_list.h4
14 files changed, 23 insertions, 21 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index a6681ec1ef..8a604db59e 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -2678,7 +2678,7 @@ void CompilerDriver::InitializeClasses(jobject class_loader,
}
if (GetCompilerOptions().IsBootImage()) {
// Prune garbage objects created during aborted transactions.
- Runtime::Current()->GetHeap()->CollectGarbage(true);
+ Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ true);
}
}
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 37d1317e32..3732b17de5 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -1748,7 +1748,7 @@ class Dex2Oat FINAL {
soa.Self(),
soa.Decode<mirror::ClassLoader>(class_loader));
soa.Env()->GetVm()->DeleteGlobalRef(soa.Self(), class_loader);
- runtime_->GetHeap()->CollectGarbage(/*clear_soft_references*/ true);
+ runtime_->GetHeap()->CollectGarbage(/* clear_soft_references */ true);
ObjPtr<mirror::ClassLoader> decoded_weak = soa.Decode<mirror::ClassLoader>(weak_class_loader);
if (decoded_weak != nullptr) {
LOG(FATAL) << "Failed to unload class loader, path from root set: "
diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc
index 42d228078c..a2ba816f6c 100644
--- a/dex2oat/linker/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -149,7 +149,7 @@ bool ImageWriter::PrepareImageAddressSpace() {
ComputeLazyFieldsForImageClasses(); // Add useful information
}
}
- heap->CollectGarbage(false); // Remove garbage.
+ heap->CollectGarbage(/* clear_soft_references */ false); // Remove garbage.
if (kIsDebugBuild) {
ScopedObjectAccess soa(Thread::Current());
diff --git a/openjdkjvm/OpenjdkJvm.cc b/openjdkjvm/OpenjdkJvm.cc
index 3c87fe2303..975d1948fe 100644
--- a/openjdkjvm/OpenjdkJvm.cc
+++ b/openjdkjvm/OpenjdkJvm.cc
@@ -311,7 +311,7 @@ JNIEXPORT void JVM_GC(void) {
LOG(INFO) << "Explicit GC skipped.";
return;
}
- art::Runtime::Current()->GetHeap()->CollectGarbage(false);
+ art::Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
}
JNIEXPORT __attribute__((noreturn)) void JVM_Exit(jint status) {
diff --git a/openjdkjvmti/ti_heap.cc b/openjdkjvmti/ti_heap.cc
index 3397210151..aaa9ab451b 100644
--- a/openjdkjvmti/ti_heap.cc
+++ b/openjdkjvmti/ti_heap.cc
@@ -1383,7 +1383,7 @@ jvmtiError HeapUtil::GetLoadedClasses(jvmtiEnv* env,
}
jvmtiError HeapUtil::ForceGarbageCollection(jvmtiEnv* env ATTRIBUTE_UNUSED) {
- art::Runtime::Current()->GetHeap()->CollectGarbage(false);
+ art::Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
return ERR(NONE);
}
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 602e094e39..5066385ee6 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -949,7 +949,7 @@ JDWP::JdwpError Dbg::GetContendedMonitor(JDWP::ObjectId thread_id,
JDWP::JdwpError Dbg::GetInstanceCounts(const std::vector<JDWP::RefTypeId>& class_ids,
std::vector<uint64_t>* counts) {
gc::Heap* heap = Runtime::Current()->GetHeap();
- heap->CollectGarbage(false, gc::GcCause::kGcCauseDebugger);
+ heap->CollectGarbage(/* clear_soft_references */ false, gc::GcCause::kGcCauseDebugger);
VariableSizedHandleScope hs(Thread::Current());
std::vector<Handle<mirror::Class>> classes;
counts->clear();
@@ -970,7 +970,7 @@ JDWP::JdwpError Dbg::GetInstances(JDWP::RefTypeId class_id, int32_t max_count,
std::vector<JDWP::ObjectId>* instances) {
gc::Heap* heap = Runtime::Current()->GetHeap();
// We only want reachable instances, so do a GC.
- heap->CollectGarbage(false, gc::GcCause::kGcCauseDebugger);
+ heap->CollectGarbage(/* clear_soft_references */ false, gc::GcCause::kGcCauseDebugger);
JDWP::JdwpError error;
ObjPtr<mirror::Class> c = DecodeClass(class_id, &error);
if (c == nullptr) {
@@ -992,7 +992,7 @@ JDWP::JdwpError Dbg::GetInstances(JDWP::RefTypeId class_id, int32_t max_count,
JDWP::JdwpError Dbg::GetReferringObjects(JDWP::ObjectId object_id, int32_t max_count,
std::vector<JDWP::ObjectId>* referring_objects) {
gc::Heap* heap = Runtime::Current()->GetHeap();
- heap->CollectGarbage(false, gc::GcCause::kGcCauseDebugger);
+ heap->CollectGarbage(/* clear_soft_references */ false, gc::GcCause::kGcCauseDebugger);
JDWP::JdwpError error;
ObjPtr<mirror::Object> o = gRegistry->Get<mirror::Object*>(object_id, &error);
if (o == nullptr) {
diff --git a/runtime/gc/allocation_record.cc b/runtime/gc/allocation_record.cc
index 2ee4239e8a..a1d198652e 100644
--- a/runtime/gc/allocation_record.cc
+++ b/runtime/gc/allocation_record.cc
@@ -289,7 +289,7 @@ void AllocRecordObjectMap::RecordAllocation(Thread* self,
return;
}
- // Wait for GC's sweeping to complete and allow new records
+ // Wait for GC's sweeping to complete and allow new records.
while (UNLIKELY((!kUseReadBarrier && !allow_new_record_) ||
(kUseReadBarrier && !self->GetWeakRefAccessEnabled()))) {
// Check and run the empty checkpoint before blocking so the empty checkpoint will work in the
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index 3770085c07..7304697188 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -1414,7 +1414,8 @@ bool ConcurrentCopying::ProcessMarkStackOnce() {
MarkStackMode mark_stack_mode = mark_stack_mode_.LoadRelaxed();
if (mark_stack_mode == kMarkStackModeThreadLocal) {
// Process the thread-local mark stacks and the GC mark stack.
- count += ProcessThreadLocalMarkStacks(false, nullptr);
+ count += ProcessThreadLocalMarkStacks(/* disable_weak_ref_access */ false,
+ /* checkpoint_callback */ nullptr);
while (!gc_mark_stack_->IsEmpty()) {
mirror::Object* to_ref = gc_mark_stack_->PopBack();
ProcessMarkStackRef(to_ref);
@@ -1602,7 +1603,7 @@ void ConcurrentCopying::SwitchToSharedMarkStackMode() {
DisableWeakRefAccessCallback dwrac(this);
// Process the thread local mark stacks one last time after switching to the shared mark stack
// mode and disable weak ref accesses.
- ProcessThreadLocalMarkStacks(true, &dwrac);
+ ProcessThreadLocalMarkStacks(/* disable_weak_ref_access */ true, &dwrac);
if (kVerboseMode) {
LOG(INFO) << "Switched to shared mark stack mode and disabled weak ref access";
}
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index cb4360171a..19b4acd836 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -3931,7 +3931,7 @@ void Heap::CheckGcStressMode(Thread* self, ObjPtr<mirror::Object>* obj) {
if (new_backtrace) {
StackHandleScope<1> hs(self);
auto h = hs.NewHandleWrapper(obj);
- CollectGarbage(false);
+ CollectGarbage(/* clear_soft_references */ false);
unique_backtrace_count_.FetchAndAddSequentiallyConsistent(1);
} else {
seen_backtrace_count_.FetchAndAddSequentiallyConsistent(1);
diff --git a/runtime/gc/heap_test.cc b/runtime/gc/heap_test.cc
index 6d426c2dd0..2def52450b 100644
--- a/runtime/gc/heap_test.cc
+++ b/runtime/gc/heap_test.cc
@@ -59,7 +59,7 @@ TEST_F(HeapTest, GarbageCollectClassLinkerInit) {
}
}
}
- Runtime::Current()->GetHeap()->CollectGarbage(false);
+ Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
}
TEST_F(HeapTest, HeapBitmapCapacityTest) {
diff --git a/runtime/gc/system_weak_test.cc b/runtime/gc/system_weak_test.cc
index dfbbd2a0c1..21f511702e 100644
--- a/runtime/gc/system_weak_test.cc
+++ b/runtime/gc/system_weak_test.cc
@@ -142,7 +142,7 @@ TEST_F(SystemWeakTest, Keep) {
cswh.Set(GcRoot<mirror::Object>(s.Get()));
// Trigger a GC.
- Runtime::Current()->GetHeap()->CollectGarbage(false);
+ Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
// Expect the holder to have been called.
EXPECT_EQ(CollectorDoesAllowOrBroadcast() ? 1U : 0U, cswh.allow_count_);
@@ -163,7 +163,7 @@ TEST_F(SystemWeakTest, Discard) {
cswh.Set(GcRoot<mirror::Object>(mirror::String::AllocFromModifiedUtf8(soa.Self(), "ABC")));
// Trigger a GC.
- Runtime::Current()->GetHeap()->CollectGarbage(false);
+ Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
// Expect the holder to have been called.
EXPECT_EQ(CollectorDoesAllowOrBroadcast() ? 1U : 0U, cswh.allow_count_);
@@ -187,7 +187,7 @@ TEST_F(SystemWeakTest, Remove) {
cswh.Set(GcRoot<mirror::Object>(s.Get()));
// Trigger a GC.
- Runtime::Current()->GetHeap()->CollectGarbage(false);
+ Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
// Expect the holder to have been called.
ASSERT_EQ(CollectorDoesAllowOrBroadcast() ? 1U : 0U, cswh.allow_count_);
@@ -202,7 +202,7 @@ TEST_F(SystemWeakTest, Remove) {
Runtime::Current()->RemoveSystemWeakHolder(&cswh);
// Trigger another GC.
- Runtime::Current()->GetHeap()->CollectGarbage(false);
+ Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
// Expectation: no change in the numbers.
EXPECT_EQ(CollectorDoesAllowOrBroadcast() ? 1U : 0U, cswh.allow_count_);
diff --git a/runtime/jni_internal_test.cc b/runtime/jni_internal_test.cc
index 63000383a4..293e18a5b5 100644
--- a/runtime/jni_internal_test.cc
+++ b/runtime/jni_internal_test.cc
@@ -1484,7 +1484,8 @@ TEST_F(JniInternalTest, StaleWeakGlobal) {
jweak weak_global = env_->NewWeakGlobalRef(local_ref);
ASSERT_NE(weak_global, nullptr);
env_->DeleteLocalRef(local_ref);
- Runtime::Current()->GetHeap()->CollectGarbage(false); // GC should clear the weak global.
+ // GC should clear the weak global.
+ Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
jobject new_global_ref = env_->NewGlobalRef(weak_global);
EXPECT_EQ(new_global_ref, nullptr);
jobject new_local_ref = env_->NewLocalRef(weak_global);
diff --git a/runtime/signal_catcher.cc b/runtime/signal_catcher.cc
index d9c4da9b96..9c3afbb133 100644
--- a/runtime/signal_catcher.cc
+++ b/runtime/signal_catcher.cc
@@ -207,7 +207,7 @@ void SignalCatcher::HandleSigQuit() {
void SignalCatcher::HandleSigUsr1() {
LOG(INFO) << "SIGUSR1 forcing GC (no HPROF) and profile save";
- Runtime::Current()->GetHeap()->CollectGarbage(false);
+ Runtime::Current()->GetHeap()->CollectGarbage(/* clear_soft_references */ false);
ProfileSaver::ForceProcessProfiles();
}
diff --git a/runtime/thread_list.h b/runtime/thread_list.h
index 7657fa805f..895c1a41ce 100644
--- a/runtime/thread_list.h
+++ b/runtime/thread_list.h
@@ -68,7 +68,7 @@ class ThreadList {
bool Resume(Thread* thread, SuspendReason reason = SuspendReason::kInternal)
REQUIRES(!Locks::thread_suspend_count_lock_) WARN_UNUSED;
- // Suspends all threads and gets exclusive access to the mutator_lock_.
+ // Suspends all threads and gets exclusive access to the mutator lock.
// If long_suspend is true, then other threads who try to suspend will never timeout.
// long_suspend is currenly used for hprof since large heaps take a long time.
void SuspendAll(const char* cause, bool long_suspend = false)
@@ -240,7 +240,7 @@ class ThreadList {
DISALLOW_COPY_AND_ASSIGN(ThreadList);
};
-// Helper for suspending all threads and
+// Helper for suspending all threads and getting exclusive access to the mutator lock.
class ScopedSuspendAll : public ValueObject {
public:
explicit ScopedSuspendAll(const char* cause, bool long_suspend = false)