diff options
author | 2018-04-05 11:02:03 -0700 | |
---|---|---|
committer | 2018-04-05 11:07:59 -0700 | |
commit | 1ce2b3b76d121a765212d69399241843951973ae (patch) | |
tree | 6f2bb0191c869e79891df3151d6faba3a297b9a8 | |
parent | 281c99864f635ef4fd005dba4ba0c750cb9a6143 (diff) |
Move remaining runtime/base stuff to libartbase
Move the remainder of the Arena stuff, plus dumpable and
runtime/*memory_region* to libartbase. More preparation to build
profiling library.
Bug: 22322814
Test: make -j 50 checkbuild
Change-Id: Iaf26d310c89bc58846553281576c18102f5e4122
-rw-r--r-- | compiler/jni/quick/jni_compiler.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/code_generator.h | 2 | ||||
-rw-r--r-- | compiler/optimizing/stack_map_stream.h | 2 | ||||
-rw-r--r-- | compiler/utils/assembler.cc | 2 | ||||
-rw-r--r-- | compiler/utils/assembler.h | 2 | ||||
-rw-r--r-- | compiler/utils/jni_macro_assembler.cc | 2 | ||||
-rw-r--r-- | compiler/utils/mips/assembler_mips.cc | 2 | ||||
-rw-r--r-- | compiler/utils/mips64/assembler_mips64.cc | 2 | ||||
-rw-r--r-- | compiler/utils/x86/assembler_x86.cc | 2 | ||||
-rw-r--r-- | compiler/utils/x86_64/assembler_x86_64.cc | 2 | ||||
-rw-r--r-- | compiler/utils/x86_64/jni_macro_assembler_x86_64.cc | 2 | ||||
-rw-r--r-- | libartbase/Android.bp | 7 | ||||
-rw-r--r-- | libartbase/base/arena_allocator-inl.h (renamed from runtime/base/arena_allocator-inl.h) | 6 | ||||
-rw-r--r-- | libartbase/base/arena_allocator.cc (renamed from runtime/base/arena_allocator.cc) | 0 | ||||
-rw-r--r-- | libartbase/base/arena_allocator.h (renamed from runtime/base/arena_allocator.h) | 6 | ||||
-rw-r--r-- | libartbase/base/arena_allocator_test.cc (renamed from runtime/base/arena_allocator_test.cc) | 0 | ||||
-rw-r--r-- | libartbase/base/arena_bit_vector.cc (renamed from runtime/base/arena_bit_vector.cc) | 0 | ||||
-rw-r--r-- | libartbase/base/arena_bit_vector.h (renamed from runtime/base/arena_bit_vector.h) | 6 | ||||
-rw-r--r-- | libartbase/base/arena_containers.h (renamed from runtime/base/arena_containers.h) | 6 | ||||
-rw-r--r-- | libartbase/base/arena_object.h (renamed from runtime/base/arena_object.h) | 6 | ||||
-rw-r--r-- | libartbase/base/bit_memory_region.h (renamed from runtime/bit_memory_region.h) | 6 | ||||
-rw-r--r-- | libartbase/base/dumpable.h (renamed from runtime/base/dumpable.h) | 28 | ||||
-rw-r--r-- | libartbase/base/malloc_arena_pool.cc (renamed from runtime/base/malloc_arena_pool.cc) | 0 | ||||
-rw-r--r-- | libartbase/base/malloc_arena_pool.h (renamed from runtime/base/malloc_arena_pool.h) | 6 | ||||
-rw-r--r-- | libartbase/base/memory_region.cc (renamed from runtime/memory_region.cc) | 0 | ||||
-rw-r--r-- | libartbase/base/memory_region.h (renamed from runtime/memory_region.h) | 13 | ||||
-rw-r--r-- | libartbase/base/memory_region_test.cc (renamed from runtime/memory_region_test.cc) | 0 | ||||
-rw-r--r-- | libartbase/base/scoped_arena_allocator.cc (renamed from runtime/base/scoped_arena_allocator.cc) | 0 | ||||
-rw-r--r-- | libartbase/base/scoped_arena_allocator.h (renamed from runtime/base/scoped_arena_allocator.h) | 6 | ||||
-rw-r--r-- | libartbase/base/scoped_arena_containers.h (renamed from runtime/base/scoped_arena_containers.h) | 6 | ||||
-rw-r--r-- | runtime/Android.bp | 7 | ||||
-rw-r--r-- | runtime/base/mutator_locked_dumpable.h (renamed from runtime/base/dumpable-inl.h) | 31 | ||||
-rw-r--r-- | runtime/indirect_reference_table.cc | 2 | ||||
-rw-r--r-- | runtime/jit/profile_compilation_info.cc | 2 | ||||
-rw-r--r-- | runtime/jit/profile_compilation_info.h | 2 | ||||
-rw-r--r-- | runtime/method_info.h | 2 | ||||
-rw-r--r-- | runtime/stack_map.h | 4 |
37 files changed, 85 insertions, 89 deletions
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc index 9ccdff3a17..8cb1998f7f 100644 --- a/compiler/jni/quick/jni_compiler.cc +++ b/compiler/jni/quick/jni_compiler.cc @@ -28,6 +28,7 @@ #include "base/logging.h" // For VLOG. #include "base/macros.h" #include "base/malloc_arena_pool.h" +#include "base/memory_region.h" #include "base/utils.h" #include "calling_convention.h" #include "class_linker.h" @@ -37,7 +38,6 @@ #include "driver/compiler_options.h" #include "entrypoints/quick/quick_entrypoints.h" #include "jni_env_ext.h" -#include "memory_region.h" #include "thread.h" #include "utils/arm/managed_register_arm.h" #include "utils/arm64/managed_register_arm64.h" diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 3bd5e14539..e1f680fb99 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -24,12 +24,12 @@ #include "base/bit_field.h" #include "base/bit_utils.h" #include "base/enums.h" +#include "base/memory_region.h" #include "dex/string_reference.h" #include "dex/type_reference.h" #include "globals.h" #include "graph_visualizer.h" #include "locations.h" -#include "memory_region.h" #include "nodes.h" #include "optimizing_compiler_stats.h" #include "read_barrier_option.h" diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h index 579aabdb5f..268e9bd6e0 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -19,9 +19,9 @@ #include "base/bit_vector-inl.h" #include "base/hash_map.h" +#include "base/memory_region.h" #include "base/scoped_arena_containers.h" #include "base/value_object.h" -#include "memory_region.h" #include "method_info.h" #include "nodes.h" #include "stack_map.h" diff --git a/compiler/utils/assembler.cc b/compiler/utils/assembler.cc index 944c64b591..421c1b6089 100644 --- a/compiler/utils/assembler.cc +++ b/compiler/utils/assembler.cc @@ -20,8 +20,8 @@ #include <vector> #include "base/casts.h" +#include "base/memory_region.h" #include "globals.h" -#include "memory_region.h" namespace art { diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h index 5b0cd6baa8..379a6396eb 100644 --- a/compiler/utils/assembler.h +++ b/compiler/utils/assembler.h @@ -29,10 +29,10 @@ #include "base/array_ref.h" #include "base/enums.h" #include "base/macros.h" +#include "base/memory_region.h" #include "debug/dwarf/debug_frame_opcode_writer.h" #include "label.h" #include "managed_register.h" -#include "memory_region.h" #include "mips/constants_mips.h" #include "offsets.h" #include "x86/constants_x86.h" diff --git a/compiler/utils/jni_macro_assembler.cc b/compiler/utils/jni_macro_assembler.cc index 3f7691b6a8..0c34aa4f1d 100644 --- a/compiler/utils/jni_macro_assembler.cc +++ b/compiler/utils/jni_macro_assembler.cc @@ -38,8 +38,8 @@ #include "x86_64/jni_macro_assembler_x86_64.h" #endif #include "base/casts.h" +#include "base/memory_region.h" #include "globals.h" -#include "memory_region.h" namespace art { diff --git a/compiler/utils/mips/assembler_mips.cc b/compiler/utils/mips/assembler_mips.cc index b2ad490a57..dce5b95fec 100644 --- a/compiler/utils/mips/assembler_mips.cc +++ b/compiler/utils/mips/assembler_mips.cc @@ -18,9 +18,9 @@ #include "base/bit_utils.h" #include "base/casts.h" +#include "base/memory_region.h" #include "entrypoints/quick/quick_entrypoints.h" #include "entrypoints/quick/quick_entrypoints_enum.h" -#include "memory_region.h" #include "thread.h" namespace art { diff --git a/compiler/utils/mips64/assembler_mips64.cc b/compiler/utils/mips64/assembler_mips64.cc index 5a817fa960..bb1bb82fa5 100644 --- a/compiler/utils/mips64/assembler_mips64.cc +++ b/compiler/utils/mips64/assembler_mips64.cc @@ -18,9 +18,9 @@ #include "base/bit_utils.h" #include "base/casts.h" +#include "base/memory_region.h" #include "entrypoints/quick/quick_entrypoints.h" #include "entrypoints/quick/quick_entrypoints_enum.h" -#include "memory_region.h" #include "thread.h" namespace art { diff --git a/compiler/utils/x86/assembler_x86.cc b/compiler/utils/x86/assembler_x86.cc index 42c2541421..86f9010ea3 100644 --- a/compiler/utils/x86/assembler_x86.cc +++ b/compiler/utils/x86/assembler_x86.cc @@ -17,8 +17,8 @@ #include "assembler_x86.h" #include "base/casts.h" +#include "base/memory_region.h" #include "entrypoints/quick/quick_entrypoints.h" -#include "memory_region.h" #include "thread.h" namespace art { diff --git a/compiler/utils/x86_64/assembler_x86_64.cc b/compiler/utils/x86_64/assembler_x86_64.cc index c6e16e754c..bd31561937 100644 --- a/compiler/utils/x86_64/assembler_x86_64.cc +++ b/compiler/utils/x86_64/assembler_x86_64.cc @@ -17,8 +17,8 @@ #include "assembler_x86_64.h" #include "base/casts.h" +#include "base/memory_region.h" #include "entrypoints/quick/quick_entrypoints.h" -#include "memory_region.h" #include "thread.h" namespace art { diff --git a/compiler/utils/x86_64/jni_macro_assembler_x86_64.cc b/compiler/utils/x86_64/jni_macro_assembler_x86_64.cc index 5766f9d44b..9486cb44c5 100644 --- a/compiler/utils/x86_64/jni_macro_assembler_x86_64.cc +++ b/compiler/utils/x86_64/jni_macro_assembler_x86_64.cc @@ -17,8 +17,8 @@ #include "jni_macro_assembler_x86_64.h" #include "base/casts.h" +#include "base/memory_region.h" #include "entrypoints/quick/quick_entrypoints.h" -#include "memory_region.h" #include "thread.h" namespace art { diff --git a/libartbase/Android.bp b/libartbase/Android.bp index 3c61944477..62157e196d 100644 --- a/libartbase/Android.bp +++ b/libartbase/Android.bp @@ -20,13 +20,18 @@ cc_defaults { host_supported: true, srcs: [ "base/allocator.cc", + "base/arena_allocator.cc", + "base/arena_bit_vector.cc", "base/bit_vector.cc", "base/file_magic.cc", "base/hex_dump.cc", "base/logging.cc", + "base/malloc_arena_pool.cc", + "base/memory_region.cc", "base/os_linux.cc", "base/runtime_debug.cc", "base/safe_copy.cc", + "base/scoped_arena_allocator.cc", "base/scoped_flock.cc", "base/time_utils.cc", "base/unix_file/fd_file.cc", @@ -90,6 +95,7 @@ art_cc_test { "art_gtest_defaults", ], srcs: [ + "base/arena_allocator_test.cc", "base/bit_field_test.cc", "base/bit_string_test.cc", "base/bit_struct_test.cc", @@ -100,6 +106,7 @@ art_cc_test { "base/histogram_test.cc", "base/leb128_test.cc", "base/logging_test.cc", + "base/memory_region_test.cc", "base/safe_copy_test.cc", "base/scoped_flock_test.cc", "base/time_utils_test.cc", diff --git a/runtime/base/arena_allocator-inl.h b/libartbase/base/arena_allocator-inl.h index 0e4383741e..a03e9df3fe 100644 --- a/runtime/base/arena_allocator-inl.h +++ b/libartbase/base/arena_allocator-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_ARENA_ALLOCATOR_INL_H_ -#define ART_RUNTIME_BASE_ARENA_ALLOCATOR_INL_H_ +#ifndef ART_LIBARTBASE_BASE_ARENA_ALLOCATOR_INL_H_ +#define ART_LIBARTBASE_BASE_ARENA_ALLOCATOR_INL_H_ #include "arena_allocator.h" @@ -31,4 +31,4 @@ static constexpr size_t kArenaDefaultSize = kArenaAllocatorPreciseTracking } // namespace arena_allocator } // namespace art -#endif // ART_RUNTIME_BASE_ARENA_ALLOCATOR_INL_H_ +#endif // ART_LIBARTBASE_BASE_ARENA_ALLOCATOR_INL_H_ diff --git a/runtime/base/arena_allocator.cc b/libartbase/base/arena_allocator.cc index 348a812e44..348a812e44 100644 --- a/runtime/base/arena_allocator.cc +++ b/libartbase/base/arena_allocator.cc diff --git a/runtime/base/arena_allocator.h b/libartbase/base/arena_allocator.h index f59cfdd69d..3143fbac4c 100644 --- a/runtime/base/arena_allocator.h +++ b/libartbase/base/arena_allocator.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_ARENA_ALLOCATOR_H_ -#define ART_RUNTIME_BASE_ARENA_ALLOCATOR_H_ +#ifndef ART_LIBARTBASE_BASE_ARENA_ALLOCATOR_H_ +#define ART_LIBARTBASE_BASE_ARENA_ALLOCATOR_H_ #include <stddef.h> #include <stdint.h> @@ -423,4 +423,4 @@ class MemStats { } // namespace art -#endif // ART_RUNTIME_BASE_ARENA_ALLOCATOR_H_ +#endif // ART_LIBARTBASE_BASE_ARENA_ALLOCATOR_H_ diff --git a/runtime/base/arena_allocator_test.cc b/libartbase/base/arena_allocator_test.cc index 68e99f4be0..68e99f4be0 100644 --- a/runtime/base/arena_allocator_test.cc +++ b/libartbase/base/arena_allocator_test.cc diff --git a/runtime/base/arena_bit_vector.cc b/libartbase/base/arena_bit_vector.cc index 1542e9d5f7..1542e9d5f7 100644 --- a/runtime/base/arena_bit_vector.cc +++ b/libartbase/base/arena_bit_vector.cc diff --git a/runtime/base/arena_bit_vector.h b/libartbase/base/arena_bit_vector.h index ca1d5b1d66..2b2322e74f 100644 --- a/runtime/base/arena_bit_vector.h +++ b/libartbase/base/arena_bit_vector.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_ARENA_BIT_VECTOR_H_ -#define ART_RUNTIME_BASE_ARENA_BIT_VECTOR_H_ +#ifndef ART_LIBARTBASE_BASE_ARENA_BIT_VECTOR_H_ +#define ART_LIBARTBASE_BASE_ARENA_BIT_VECTOR_H_ #include "base/arena_object.h" #include "base/bit_vector.h" @@ -55,4 +55,4 @@ class ArenaBitVector : public BitVector, public ArenaObject<kArenaAllocGrowableB } // namespace art -#endif // ART_RUNTIME_BASE_ARENA_BIT_VECTOR_H_ +#endif // ART_LIBARTBASE_BASE_ARENA_BIT_VECTOR_H_ diff --git a/runtime/base/arena_containers.h b/libartbase/base/arena_containers.h index 4f572120ba..40cf23c9fb 100644 --- a/runtime/base/arena_containers.h +++ b/libartbase/base/arena_containers.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_ARENA_CONTAINERS_H_ -#define ART_RUNTIME_BASE_ARENA_CONTAINERS_H_ +#ifndef ART_LIBARTBASE_BASE_ARENA_CONTAINERS_H_ +#define ART_LIBARTBASE_BASE_ARENA_CONTAINERS_H_ #include <deque> #include <queue> @@ -241,4 +241,4 @@ inline ArenaAllocatorAdapter<void> ArenaAllocator::Adapter(ArenaAllocKind kind) } // namespace art -#endif // ART_RUNTIME_BASE_ARENA_CONTAINERS_H_ +#endif // ART_LIBARTBASE_BASE_ARENA_CONTAINERS_H_ diff --git a/runtime/base/arena_object.h b/libartbase/base/arena_object.h index d01e346f7a..de7cb64a75 100644 --- a/runtime/base/arena_object.h +++ b/libartbase/base/arena_object.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_ARENA_OBJECT_H_ -#define ART_RUNTIME_BASE_ARENA_OBJECT_H_ +#ifndef ART_LIBARTBASE_BASE_ARENA_OBJECT_H_ +#define ART_LIBARTBASE_BASE_ARENA_OBJECT_H_ #include <android-base/logging.h> @@ -69,4 +69,4 @@ class DeletableArenaObject { } // namespace art -#endif // ART_RUNTIME_BASE_ARENA_OBJECT_H_ +#endif // ART_LIBARTBASE_BASE_ARENA_OBJECT_H_ diff --git a/runtime/bit_memory_region.h b/libartbase/base/bit_memory_region.h index 3a696f1969..f3926bc9d8 100644 --- a/runtime/bit_memory_region.h +++ b/libartbase/base/bit_memory_region.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BIT_MEMORY_REGION_H_ -#define ART_RUNTIME_BIT_MEMORY_REGION_H_ +#ifndef ART_LIBARTBASE_BASE_BIT_MEMORY_REGION_H_ +#define ART_LIBARTBASE_BASE_BIT_MEMORY_REGION_H_ #include "memory_region.h" @@ -70,4 +70,4 @@ class BitMemoryRegion FINAL : public ValueObject { } // namespace art -#endif // ART_RUNTIME_BIT_MEMORY_REGION_H_ +#endif // ART_LIBARTBASE_BASE_BIT_MEMORY_REGION_H_ diff --git a/runtime/base/dumpable.h b/libartbase/base/dumpable.h index 9ef8d69b48..66213972f7 100644 --- a/runtime/base/dumpable.h +++ b/libartbase/base/dumpable.h @@ -14,13 +14,12 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_DUMPABLE_H_ -#define ART_RUNTIME_BASE_DUMPABLE_H_ +#ifndef ART_LIBARTBASE_BASE_DUMPABLE_H_ +#define ART_LIBARTBASE_BASE_DUMPABLE_H_ #include <ostream> #include "base/macros.h" -#include "base/mutex.h" namespace art { @@ -51,27 +50,6 @@ std::ostream& operator<<(std::ostream& os, const Dumpable<T>& rhs) { return os; } -template<typename T> -class MutatorLockedDumpable { - public: - explicit MutatorLockedDumpable(T& value) REQUIRES_SHARED(Locks::mutator_lock_) : value_(value) {} - - void Dump(std::ostream& os) const REQUIRES_SHARED(Locks::mutator_lock_) { - value_.Dump(os); - } - - private: - const T& value_; - - DISALLOW_COPY_AND_ASSIGN(MutatorLockedDumpable); -}; - -template<typename T> -std::ostream& operator<<(std::ostream& os, const MutatorLockedDumpable<T>& rhs) - // TODO: should be REQUIRES_SHARED(Locks::mutator_lock_) however annotalysis - // currently fails for this. - NO_THREAD_SAFETY_ANALYSIS; - } // namespace art -#endif // ART_RUNTIME_BASE_DUMPABLE_H_ +#endif // ART_LIBARTBASE_BASE_DUMPABLE_H_ diff --git a/runtime/base/malloc_arena_pool.cc b/libartbase/base/malloc_arena_pool.cc index 7df4aef25b..7df4aef25b 100644 --- a/runtime/base/malloc_arena_pool.cc +++ b/libartbase/base/malloc_arena_pool.cc diff --git a/runtime/base/malloc_arena_pool.h b/libartbase/base/malloc_arena_pool.h index 9cd2572411..8720189343 100644 --- a/runtime/base/malloc_arena_pool.h +++ b/libartbase/base/malloc_arena_pool.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_MALLOC_ARENA_POOL_H_ -#define ART_RUNTIME_BASE_MALLOC_ARENA_POOL_H_ +#ifndef ART_LIBARTBASE_BASE_MALLOC_ARENA_POOL_H_ +#define ART_LIBARTBASE_BASE_MALLOC_ARENA_POOL_H_ #include <mutex> @@ -45,4 +45,4 @@ class MallocArenaPool FINAL : public ArenaPool { } // namespace art -#endif // ART_RUNTIME_BASE_MALLOC_ARENA_POOL_H_ +#endif // ART_LIBARTBASE_BASE_MALLOC_ARENA_POOL_H_ diff --git a/runtime/memory_region.cc b/libartbase/base/memory_region.cc index 862ff73639..862ff73639 100644 --- a/runtime/memory_region.cc +++ b/libartbase/base/memory_region.cc diff --git a/runtime/memory_region.h b/libartbase/base/memory_region.h index 23e0aecbda..7add466cc7 100644 --- a/runtime/memory_region.h +++ b/libartbase/base/memory_region.h @@ -14,17 +14,17 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_MEMORY_REGION_H_ -#define ART_RUNTIME_MEMORY_REGION_H_ +#ifndef ART_LIBARTBASE_BASE_MEMORY_REGION_H_ +#define ART_LIBARTBASE_BASE_MEMORY_REGION_H_ #include <stdint.h> #include <type_traits> #include <android-base/logging.h> -#include "arch/instruction_set.h" #include "base/bit_utils.h" #include "base/casts.h" +#include "base/enums.h" #include "base/macros.h" #include "base/value_object.h" #include "globals.h" @@ -211,9 +211,8 @@ class MemoryRegion FINAL : public ValueObject { // Is `address` aligned on a machine word? template<typename T> static constexpr bool IsWordAligned(const T* address) { - // Word alignment in bytes. - size_t kWordAlignment = static_cast<size_t>(GetInstructionSetPointerSize(kRuntimeISA)); - return IsAlignedParam(address, kWordAlignment); + // Word alignment in bytes. Determined from pointer size. + return IsAligned<kRuntimePointerSize>(address); } void* pointer_; @@ -222,4 +221,4 @@ class MemoryRegion FINAL : public ValueObject { } // namespace art -#endif // ART_RUNTIME_MEMORY_REGION_H_ +#endif // ART_LIBARTBASE_BASE_MEMORY_REGION_H_ diff --git a/runtime/memory_region_test.cc b/libartbase/base/memory_region_test.cc index e3aead47fa..e3aead47fa 100644 --- a/runtime/memory_region_test.cc +++ b/libartbase/base/memory_region_test.cc diff --git a/runtime/base/scoped_arena_allocator.cc b/libartbase/base/scoped_arena_allocator.cc index 7240842d55..7240842d55 100644 --- a/runtime/base/scoped_arena_allocator.cc +++ b/libartbase/base/scoped_arena_allocator.cc diff --git a/runtime/base/scoped_arena_allocator.h b/libartbase/base/scoped_arena_allocator.h index a253e2f535..d5f6df82cc 100644 --- a/runtime/base/scoped_arena_allocator.h +++ b/libartbase/base/scoped_arena_allocator.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_SCOPED_ARENA_ALLOCATOR_H_ -#define ART_RUNTIME_BASE_SCOPED_ARENA_ALLOCATOR_H_ +#ifndef ART_LIBARTBASE_BASE_SCOPED_ARENA_ALLOCATOR_H_ +#define ART_LIBARTBASE_BASE_SCOPED_ARENA_ALLOCATOR_H_ #include <android-base/logging.h> @@ -185,4 +185,4 @@ class ScopedArenaAllocator } // namespace art -#endif // ART_RUNTIME_BASE_SCOPED_ARENA_ALLOCATOR_H_ +#endif // ART_LIBARTBASE_BASE_SCOPED_ARENA_ALLOCATOR_H_ diff --git a/runtime/base/scoped_arena_containers.h b/libartbase/base/scoped_arena_containers.h index f8ee3f33af..4df02b6205 100644 --- a/runtime/base/scoped_arena_containers.h +++ b/libartbase/base/scoped_arena_containers.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_SCOPED_ARENA_CONTAINERS_H_ -#define ART_RUNTIME_BASE_SCOPED_ARENA_CONTAINERS_H_ +#ifndef ART_LIBARTBASE_BASE_SCOPED_ARENA_CONTAINERS_H_ +#define ART_LIBARTBASE_BASE_SCOPED_ARENA_CONTAINERS_H_ #include <deque> #include <queue> @@ -272,4 +272,4 @@ using ArenaUniquePtr = std::unique_ptr<T, ArenaDelete<T>>; } // namespace art -#endif // ART_RUNTIME_BASE_SCOPED_ARENA_CONTAINERS_H_ +#endif // ART_LIBARTBASE_BASE_SCOPED_ARENA_CONTAINERS_H_ diff --git a/runtime/Android.bp b/runtime/Android.bp index b380dab187..7126687a00 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -32,14 +32,10 @@ cc_defaults { "art_field.cc", "art_method.cc", "barrier.cc", - "base/arena_allocator.cc", - "base/arena_bit_vector.cc", "base/file_utils.cc", - "base/malloc_arena_pool.cc", "base/mem_map_arena_pool.cc", "base/mutex.cc", "base/quasi_atomic.cc", - "base/scoped_arena_allocator.cc", "base/timing_logger.cc", "cha.cc", "check_jni.cc", @@ -124,7 +120,6 @@ cc_defaults { "linear_alloc.cc", "managed_stack.cc", "mem_map.cc", - "memory_region.cc", "method_handles.cc", "mirror/array.cc", "mirror/call_site.cc", @@ -543,7 +538,6 @@ art_cc_test { "arch/x86/instruction_set_features_x86_test.cc", "arch/x86_64/instruction_set_features_x86_64_test.cc", "barrier_test.cc", - "base/arena_allocator_test.cc", "base/file_utils_test.cc", "base/mutex_test.cc", "base/timing_logger_test.cc", @@ -587,7 +581,6 @@ art_cc_test { "java_vm_ext_test.cc", "jit/profile_compilation_info_test.cc", "mem_map_test.cc", - "memory_region_test.cc", "method_handles_test.cc", "mirror/dex_cache_test.cc", "mirror/method_type_test.cc", diff --git a/runtime/base/dumpable-inl.h b/runtime/base/mutator_locked_dumpable.h index 9d7fc39093..cf2199c100 100644 --- a/runtime/base/dumpable-inl.h +++ b/runtime/base/mutator_locked_dumpable.h @@ -14,17 +14,38 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_BASE_DUMPABLE_INL_H_ -#define ART_RUNTIME_BASE_DUMPABLE_INL_H_ +#ifndef ART_RUNTIME_BASE_MUTATOR_LOCKED_DUMPABLE_H_ +#define ART_RUNTIME_BASE_MUTATOR_LOCKED_DUMPABLE_H_ -#include "base/dumpable.h" #include "base/mutex.h" #include "thread-current-inl.h" namespace art { template<typename T> -inline std::ostream& operator<<(std::ostream& os, const MutatorLockedDumpable<T>& rhs) { +class MutatorLockedDumpable { + public: + explicit MutatorLockedDumpable(T& value) REQUIRES_SHARED(Locks::mutator_lock_) : value_(value) {} + + void Dump(std::ostream& os) const REQUIRES_SHARED(Locks::mutator_lock_) { + value_.Dump(os); + } + + private: + const T& value_; + + DISALLOW_COPY_AND_ASSIGN(MutatorLockedDumpable); +}; + +// template<typename T> +// std::ostream& operator<<(std::ostream& os, const MutatorLockedDumpable<T>& rhs) +// // TODO: should be REQUIRES_SHARED(Locks::mutator_lock_) however annotalysis +// // currently fails for this. +// NO_THREAD_SAFETY_ANALYSIS; + +template<typename T> +inline std::ostream& operator<<(std::ostream& os, const MutatorLockedDumpable<T>& rhs) + NO_THREAD_SAFETY_ANALYSIS { Locks::mutator_lock_->AssertSharedHeld(Thread::Current()); rhs.Dump(os); return os; @@ -32,4 +53,4 @@ inline std::ostream& operator<<(std::ostream& os, const MutatorLockedDumpable<T> } // namespace art -#endif // ART_RUNTIME_BASE_DUMPABLE_INL_H_ +#endif // ART_RUNTIME_BASE_MUTATOR_LOCKED_DUMPABLE_H_ diff --git a/runtime/indirect_reference_table.cc b/runtime/indirect_reference_table.cc index 3b9cc0f946..6143ba6fd4 100644 --- a/runtime/indirect_reference_table.cc +++ b/runtime/indirect_reference_table.cc @@ -16,7 +16,7 @@ #include "indirect_reference_table-inl.h" -#include "base/dumpable-inl.h" +#include "base/mutator_locked_dumpable.h" #include "base/systrace.h" #include "base/utils.h" #include "java_vm_ext.h" diff --git a/runtime/jit/profile_compilation_info.cc b/runtime/jit/profile_compilation_info.cc index f4132c2343..6bbe78f3fd 100644 --- a/runtime/jit/profile_compilation_info.cc +++ b/runtime/jit/profile_compilation_info.cc @@ -34,10 +34,8 @@ #include "base/arena_allocator.h" #include "base/dumpable.h" -#include "base/file_utils.h" #include "base/logging.h" // For VLOG. #include "base/malloc_arena_pool.h" -#include "base/mutex.h" #include "base/os.h" #include "base/safe_map.h" #include "base/scoped_flock.h" diff --git a/runtime/jit/profile_compilation_info.h b/runtime/jit/profile_compilation_info.h index 4ac8c612e0..f8334cea4f 100644 --- a/runtime/jit/profile_compilation_info.h +++ b/runtime/jit/profile_compilation_info.h @@ -23,9 +23,9 @@ #include "base/arena_containers.h" #include "base/arena_object.h" #include "base/atomic.h" +#include "base/bit_memory_region.h" #include "base/malloc_arena_pool.h" #include "base/safe_map.h" -#include "bit_memory_region.h" #include "dex/dex_cache_resolved_classes.h" #include "dex/dex_file.h" #include "dex/dex_file_types.h" diff --git a/runtime/method_info.h b/runtime/method_info.h index fe062564f1..b00ddc660f 100644 --- a/runtime/method_info.h +++ b/runtime/method_info.h @@ -21,7 +21,7 @@ #include "base/leb128.h" #include "base/macros.h" -#include "memory_region.h" +#include "base/memory_region.h" namespace art { diff --git a/runtime/stack_map.h b/runtime/stack_map.h index bde3462437..38397643b6 100644 --- a/runtime/stack_map.h +++ b/runtime/stack_map.h @@ -20,12 +20,12 @@ #include <limits> #include "arch/code_offset.h" +#include "base/bit_memory_region.h" #include "base/bit_utils.h" #include "base/bit_vector.h" #include "base/leb128.h" -#include "bit_memory_region.h" +#include "base/memory_region.h" #include "dex/dex_file_types.h" -#include "memory_region.h" #include "method_info.h" namespace art { |