summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-05-29 17:40:41 +0100
committer Vladimir Marko <vmarko@google.com> 2018-05-30 12:50:37 +0100
commit5924a4a73f1a2dcf83877062d67c297a9496b326 (patch)
tree3517a1809ecbdc85533e1a8c5a0a9610cdc36005
parent2cffc5d2807096c0b7a07b89f5dda6920c6429f5 (diff)
Move String::SizeOf<> to string.h .
string.h was already indirectly (through class.h) including everything needed for String::SizeOf<>, so move it to the string.h and make those includes direct. Then we can change the object-inl.h to include only string.h, reducing the number of indirectly included files. Test: m test-art-host-gtest Test: m testrunner.py --host --optimizing Change-Id: I51c462c034f205498c539abe6d888be9738d4a6e
-rw-r--r--compiler/optimizing/intrinsics_arm_vixl.cc2
-rw-r--r--openjdkjvmti/ti_class.cc2
-rw-r--r--openjdkjvmti/ti_class_loader.h33
-rw-r--r--openjdkjvmti/ti_redefine.cc3
-rw-r--r--openjdkjvmti/ti_redefine.h18
-rw-r--r--runtime/entrypoints/quick/quick_alloc_entrypoints.cc1
-rw-r--r--runtime/mirror/class.cc1
-rw-r--r--runtime/mirror/object-inl.h2
-rw-r--r--runtime/mirror/string-inl.h15
-rw-r--r--runtime/mirror/string.h16
-rw-r--r--runtime/native/java_lang_StringFactory.cc2
-rw-r--r--runtime/native/java_lang_VMClassLoader.cc1
12 files changed, 37 insertions, 59 deletions
diff --git a/compiler/optimizing/intrinsics_arm_vixl.cc b/compiler/optimizing/intrinsics_arm_vixl.cc
index 5287b4b2fa..fecf1ccbfa 100644
--- a/compiler/optimizing/intrinsics_arm_vixl.cc
+++ b/compiler/optimizing/intrinsics_arm_vixl.cc
@@ -25,7 +25,7 @@
#include "mirror/array-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/reference.h"
-#include "mirror/string.h"
+#include "mirror/string-inl.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index 726e47ed5f..16970921ab 100644
--- a/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
@@ -71,9 +71,11 @@
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
#include "thread_list.h"
+#include "ti_class_definition.h"
#include "ti_class_loader-inl.h"
#include "ti_phase.h"
#include "ti_redefine.h"
+#include "transform.h"
#include "well_known_classes.h"
namespace openjdkjvmti {
diff --git a/openjdkjvmti/ti_class_loader.h b/openjdkjvmti/ti_class_loader.h
index a3857e595a..577c28585e 100644
--- a/openjdkjvmti/ti_class_loader.h
+++ b/openjdkjvmti/ti_class_loader.h
@@ -36,32 +36,19 @@
#include <jni.h>
-#include "art_jvmti.h"
-#include "art_method.h"
-#include "base/array_slice.h"
#include "base/globals.h"
-#include "base/mem_map.h"
-#include "class_linker.h"
-#include "dex/dex_file.h"
-#include "dex/utf.h"
-#include "gc_root-inl.h"
-#include "jni/jni_env_ext-inl.h"
+#include "base/mutex.h"
#include "jvmti.h"
-#include "linear_alloc.h"
-#include "mirror/array-inl.h"
#include "mirror/array.h"
-#include "mirror/class-inl.h"
-#include "mirror/class.h"
-#include "mirror/class_loader-inl.h"
-#include "mirror/string-inl.h"
-#include "oat_file.h"
-#include "obj_ptr.h"
-#include "scoped_thread_state_change-inl.h"
-#include "stack.h"
-#include "thread_list.h"
-#include "ti_class_definition.h"
-#include "transform.h"
-#include "utils/dex_cache_arrays_layout-inl.h"
+
+namespace art {
+
+class DexFile;
+template <class MirrorType> class Handle;
+template <class MirrorType> class ObjPtr;
+class Thread;
+
+} // namespace art
namespace openjdkjvmti {
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index 48e2958773..73e37199ed 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -61,6 +61,7 @@
#include "jit/jit_code_cache.h"
#include "jni/jni_env_ext-inl.h"
#include "jvmti_allocator.h"
+#include "linear_alloc.h"
#include "mirror/class-inl.h"
#include "mirror/class_ext.h"
#include "mirror/object.h"
@@ -68,6 +69,8 @@
#include "non_debuggable_classes.h"
#include "object_lock.h"
#include "runtime.h"
+#include "stack.h"
+#include "thread_list.h"
#include "ti_breakpoint.h"
#include "ti_class_loader.h"
#include "transform.h"
diff --git a/openjdkjvmti/ti_redefine.h b/openjdkjvmti/ti_redefine.h
index 227eacd180..e337491ae3 100644
--- a/openjdkjvmti/ti_redefine.h
+++ b/openjdkjvmti/ti_redefine.h
@@ -37,34 +37,18 @@
#include <jni.h>
#include "art_jvmti.h"
-#include "art_method.h"
#include "base/array_ref.h"
#include "base/globals.h"
-#include "base/mem_map.h"
-#include "class_linker.h"
#include "dex/dex_file.h"
-#include "dex/utf.h"
-#include "gc_root-inl.h"
#include "jni/jni_env_ext-inl.h"
#include "jvmti.h"
-#include "linear_alloc.h"
-#include "mirror/array-inl.h"
#include "mirror/array.h"
-#include "mirror/class-inl.h"
#include "mirror/class.h"
-#include "mirror/class_loader-inl.h"
-#include "mirror/string-inl.h"
-#include "oat_file.h"
#include "obj_ptr.h"
-#include "scoped_thread_state_change-inl.h"
-#include "stack.h"
-#include "thread_list.h"
-#include "ti_class_definition.h"
-#include "transform.h"
-#include "utils/dex_cache_arrays_layout-inl.h"
namespace openjdkjvmti {
+class ArtClassDefinition;
class RedefinitionDataHolder;
class RedefinitionDataIter;
diff --git a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
index ed5885f224..5f7594c68d 100644
--- a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
@@ -25,6 +25,7 @@
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
+#include "mirror/string-inl.h"
namespace art {
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index ad6b37b86a..e6bfe5551a 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -39,6 +39,7 @@
#include "object-refvisitor-inl.h"
#include "object_array-inl.h"
#include "object_lock.h"
+#include "string-inl.h"
#include "runtime.h"
#include "thread.h"
#include "throwable.h"
diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h
index c7561f4278..bfebd5d365 100644
--- a/runtime/mirror/object-inl.h
+++ b/runtime/mirror/object-inl.h
@@ -37,7 +37,7 @@
#include "read_barrier-inl.h"
#include "reference.h"
#include "runtime.h"
-#include "string-inl.h"
+#include "string.h"
#include "throwable.h"
namespace art {
diff --git a/runtime/mirror/string-inl.h b/runtime/mirror/string-inl.h
index a60861cc28..e6079c0cba 100644
--- a/runtime/mirror/string-inl.h
+++ b/runtime/mirror/string-inl.h
@@ -194,21 +194,6 @@ int32_t String::FastIndexOf(MemoryType* chars, int32_t ch, int32_t start) {
return -1;
}
-template<VerifyObjectFlags kVerifyFlags>
-inline size_t String::SizeOf() {
- size_t size = sizeof(String);
- if (IsCompressed()) {
- size += (sizeof(uint8_t) * GetLength<kVerifyFlags>());
- } else {
- size += (sizeof(uint16_t) * GetLength<kVerifyFlags>());
- }
- // String.equals() intrinsics assume zero-padding up to kObjectAlignment,
- // so make sure the zero-padding is actually copied around if GC compaction
- // chooses to copy only SizeOf() bytes.
- // http://b/23528461
- return RoundUp(size, kObjectAlignment);
-}
-
template <bool kIsInstrumented, typename PreFenceVisitor>
inline String* String::Alloc(Thread* self, int32_t utf16_length_with_flag,
gc::AllocatorType allocator_type,
diff --git a/runtime/mirror/string.h b/runtime/mirror/string.h
index c45dc499e5..270ace1036 100644
--- a/runtime/mirror/string.h
+++ b/runtime/mirror/string.h
@@ -17,6 +17,8 @@
#ifndef ART_RUNTIME_MIRROR_STRING_H_
#define ART_RUNTIME_MIRROR_STRING_H_
+#include "base/bit_utils.h"
+#include "base/globals.h"
#include "gc/allocator_type.h"
#include "gc_root-inl.h"
#include "class.h"
@@ -66,7 +68,19 @@ class MANAGED String FINAL : public Object {
}
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
- size_t SizeOf() REQUIRES_SHARED(Locks::mutator_lock_);
+ size_t SizeOf() REQUIRES_SHARED(Locks::mutator_lock_) {
+ size_t size = sizeof(String);
+ if (IsCompressed()) {
+ size += (sizeof(uint8_t) * GetLength<kVerifyFlags>());
+ } else {
+ size += (sizeof(uint16_t) * GetLength<kVerifyFlags>());
+ }
+ // String.equals() intrinsics assume zero-padding up to kObjectAlignment,
+ // so make sure the zero-padding is actually copied around if GC compaction
+ // chooses to copy only SizeOf() bytes.
+ // http://b/23528461
+ return RoundUp(size, kObjectAlignment);
+ }
// Taking out the first/uppermost bit because it is not part of actual length value
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
index 07e875efcb..3978ca8a36 100644
--- a/runtime/native/java_lang_StringFactory.cc
+++ b/runtime/native/java_lang_StringFactory.cc
@@ -19,7 +19,7 @@
#include "common_throws.h"
#include "jni/jni_internal.h"
#include "mirror/object-inl.h"
-#include "mirror/string.h"
+#include "mirror/string-inl.h"
#include "native_util.h"
#include "nativehelper/jni_macros.h"
#include "nativehelper/scoped_local_ref.h"
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index 0630737d29..b1511c0d88 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -20,6 +20,7 @@
#include "class_linker.h"
#include "dex/descriptors_names.h"
#include "dex/dex_file_loader.h"
+#include "dex/utf.h"
#include "jni/jni_internal.h"
#include "mirror/class_loader.h"
#include "mirror/object-inl.h"