GC clean up.
Greater use of directories and namespaces.
Fix bugs that cause verify options to fail.
Address numerous other issues:
GC barrier wait occurring holding locks:
GC barrier waits occur when we wait for threads to run the check point function
on themselves. This is happening with the heap bitmap and mutator lock held
meaning that a thread that tries to take either lock exclusively will block
waiting on a thread that is waiting. If this thread is the thread we're waiting
to run the check point then the VM will deadlock.
This deadlock occurred unnoticed as the call to check for wait safety was
removed in: https://googleplex-android-review.googlesource.com/#/c/249423/1.
NewTimingLogger:
Existing timing log states when a split ends but not when it begins. This isn't
good for systrace, in the context of GC it means that races between mutators
and the GC are hard to discover what phase the GC is in, we know what phase it
just finished and derive but that's not ideal.
Support for only 1 discontinuous space:
Code special cases continuous and large object space, rather than assuming we
can have a collection of both.
Sorted atomic stacks:
Used to improve verification performance. Simplify their use and add extra
checks.
Simplify mod-union table abstractions.
Reduce use of std::strings and their associated overhead in hot code.
Make time units of fields explicit.
Reduce confusion that IsAllocSpace is really IsDlMallocSpace.
Make GetTotalMemory (exposed via System) equal to the footprint (as in Dalvik)
rather than the max memory footprint.
Change-Id: Ie87067140fa4499b15edab691fe6565d79599812
diff --git a/src/runtime.h b/src/runtime.h
index 1b0c437..dfcd647 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -27,8 +27,8 @@
#include "base/macros.h"
#include "base/stringpiece.h"
+#include "gc/heap.h"
#include "globals.h"
-#include "heap.h"
#include "instruction_set.h"
#include "instrumentation.h"
#include "jobject_comparator.h"
@@ -39,17 +39,19 @@
namespace art {
+namespace gc {
+ class Heap;
+}
namespace mirror {
-class AbstractMethod;
-class ClassLoader;
-template<class T> class PrimitiveArray;
-typedef PrimitiveArray<int8_t> ByteArray;
-class String;
-class Throwable;
+ class AbstractMethod;
+ class ClassLoader;
+ template<class T> class PrimitiveArray;
+ typedef PrimitiveArray<int8_t> ByteArray;
+ class String;
+ class Throwable;
} // namespace mirror
class ClassLinker;
class DexFile;
-class Heap;
class InternTable;
struct JavaVMExt;
class MonitorList;
@@ -224,7 +226,7 @@
return default_stack_size_;
}
- Heap* GetHeap() const {
+ gc::Heap* GetHeap() const {
return heap_;
}
@@ -256,14 +258,13 @@
return "2.0.0";
}
- // Force all the roots which can be marked concurrently to be dirty.
- void DirtyRoots();
-
- // Visit all the roots.
- void VisitRoots(RootVisitor* visitor, void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ // Visit all the roots. If only_dirty is true then non-dirty roots won't be visited. If
+ // clean_dirty is true then dirty roots will be marked as non-dirty after visiting.
+ void VisitRoots(RootVisitor* visitor, void* arg, bool only_dirty, bool clean_dirty)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Visit all of the roots we can do safely do concurrently.
- void VisitConcurrentRoots(RootVisitor* visitor, void* arg);
+ void VisitConcurrentRoots(RootVisitor* visitor, void* arg, bool only_dirty, bool clean_dirty);
// Visit all of the non thread roots, we can do this with mutators unpaused.
void VisitNonThreadRoots(RootVisitor* visitor, void* arg);
@@ -392,7 +393,7 @@
// The default stack size for managed threads created by the runtime.
size_t default_stack_size_;
- Heap* heap_;
+ gc::Heap* heap_;
MonitorList* monitor_list_;