diff options
author | 2016-09-02 12:38:38 +0100 | |
---|---|---|
committer | 2016-09-02 15:15:28 +0100 | |
commit | 3a21e386fa55a8b86dffa5250985b263fcfd2155 (patch) | |
tree | ce6fecaae067f86e094ae7844ee5fa4ae8ee63e8 | |
parent | f94a4cf18946bda4a4f19378436d2bf131a492ca (diff) |
Clean up some includes.
Remove some unnecessary includes from header files, replace
others with forward references and add includes to source
files as needed. Reduce dependency on stack.h by pulling
StackReference<> out to its own file.
Test: m test-art-host
Change-Id: I0fb182145e328870cbd918b0ef6ae2950223c1b2
28 files changed, 78 insertions, 37 deletions
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index fd396c474c..78a8afb156 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -23,8 +23,6 @@ #include "base/arena_object.h" #include "base/bit_field.h" #include "base/enums.h" -#include "compiled_method.h" -#include "driver/compiler_options.h" #include "globals.h" #include "graph_visualizer.h" #include "locations.h" @@ -54,6 +52,7 @@ static int64_t constexpr kPrimLongMax = INT64_C(0x7fffffffffffffff); class Assembler; class CodeGenerator; class CompilerDriver; +class CompilerOptions; class LinkerPatch; class ParallelMoveResolver; diff --git a/compiler/optimizing/code_generator_mips.cc b/compiler/optimizing/code_generator_mips.cc index e0de03bf8f..8f2fc2687e 100644 --- a/compiler/optimizing/code_generator_mips.cc +++ b/compiler/optimizing/code_generator_mips.cc @@ -20,6 +20,7 @@ #include "arch/mips/instruction_set_features_mips.h" #include "art_method.h" #include "code_generator_utils.h" +#include "compiled_method.h" #include "entrypoints/quick/quick_entrypoints.h" #include "entrypoints/quick/quick_entrypoints_enum.h" #include "gc/accounting/card_table.h" diff --git a/compiler/optimizing/optimizing_cfi_test.cc b/compiler/optimizing/optimizing_cfi_test.cc index 8c0231e1aa..a1e923bd73 100644 --- a/compiler/optimizing/optimizing_cfi_test.cc +++ b/compiler/optimizing/optimizing_cfi_test.cc @@ -19,6 +19,7 @@ #include "arch/instruction_set.h" #include "cfi_test.h" +#include "driver/compiler_options.h" #include "gtest/gtest.h" #include "optimizing/code_generator.h" #include "optimizing/optimizing_unit_test.h" diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc index 6effc306dc..81163e296e 100644 --- a/compiler/optimizing/sharpening.cc +++ b/compiler/optimizing/sharpening.cc @@ -20,6 +20,7 @@ #include "base/enums.h" #include "class_linker.h" #include "code_generator.h" +#include "driver/compiler_options.h" #include "driver/dex_compilation_unit.h" #include "utils/dex_cache_arrays_layout-inl.h" #include "driver/compiler_driver.h" diff --git a/compiler/optimizing/x86_memory_gen.cc b/compiler/optimizing/x86_memory_gen.cc index 8aa315a7e3..4e256832a2 100644 --- a/compiler/optimizing/x86_memory_gen.cc +++ b/compiler/optimizing/x86_memory_gen.cc @@ -16,6 +16,7 @@ #include "x86_memory_gen.h" #include "code_generator.h" +#include "driver/compiler_options.h" namespace art { namespace x86 { diff --git a/runtime/arch/arm/entrypoints_init_arm.cc b/runtime/arch/arm/entrypoints_init_arm.cc index 492a12d02b..cb8edffb94 100644 --- a/runtime/arch/arm/entrypoints_init_arm.cc +++ b/runtime/arch/arm/entrypoints_init_arm.cc @@ -14,6 +14,9 @@ * limitations under the License. */ +#include <math.h> +#include <string.h> + #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" diff --git a/runtime/arch/arm64/entrypoints_init_arm64.cc b/runtime/arch/arm64/entrypoints_init_arm64.cc index 55b09c318c..c2078f02c1 100644 --- a/runtime/arch/arm64/entrypoints_init_arm64.cc +++ b/runtime/arch/arm64/entrypoints_init_arm64.cc @@ -14,6 +14,9 @@ * limitations under the License. */ +#include <math.h> +#include <string.h> + #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" diff --git a/runtime/arch/mips/entrypoints_init_mips.cc b/runtime/arch/mips/entrypoints_init_mips.cc index 09f8849e1a..38aa67c12f 100644 --- a/runtime/arch/mips/entrypoints_init_mips.cc +++ b/runtime/arch/mips/entrypoints_init_mips.cc @@ -14,6 +14,8 @@ * limitations under the License. */ +#include <string.h> + #include "atomic.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" diff --git a/runtime/arch/mips64/entrypoints_init_mips64.cc b/runtime/arch/mips64/entrypoints_init_mips64.cc index 34b0638332..a0379053bc 100644 --- a/runtime/arch/mips64/entrypoints_init_mips64.cc +++ b/runtime/arch/mips64/entrypoints_init_mips64.cc @@ -14,6 +14,8 @@ * limitations under the License. */ +#include <string.h> + #include "atomic.h" #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" diff --git a/runtime/arch/x86/entrypoints_init_x86.cc b/runtime/arch/x86/entrypoints_init_x86.cc index bdf11dab9a..0a10a3cceb 100644 --- a/runtime/arch/x86/entrypoints_init_x86.cc +++ b/runtime/arch/x86/entrypoints_init_x86.cc @@ -14,6 +14,8 @@ * limitations under the License. */ +#include <math.h> + #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" diff --git a/runtime/arch/x86_64/entrypoints_init_x86_64.cc b/runtime/arch/x86_64/entrypoints_init_x86_64.cc index 42b9699122..8c425d53d3 100644 --- a/runtime/arch/x86_64/entrypoints_init_x86_64.cc +++ b/runtime/arch/x86_64/entrypoints_init_x86_64.cc @@ -14,6 +14,8 @@ * limitations under the License. */ +#include <math.h> + #include "entrypoints/jni/jni_entrypoints.h" #include "entrypoints/quick/quick_alloc_entrypoints.h" #include "entrypoints/quick/quick_default_externs.h" diff --git a/runtime/art_method.h b/runtime/art_method.h index 62b88a2af0..b25087cc21 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -29,7 +29,6 @@ #include "modifiers.h" #include "mirror/object.h" #include "read_barrier_option.h" -#include "stack.h" #include "utils.h" namespace art { diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index 90c678c1a8..24d73eff27 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -42,6 +42,7 @@ #include "dex_file_verifier.h" #include "globals.h" #include "handle_scope-inl.h" +#include "jvalue.h" #include "leb128.h" #include "mirror/field.h" #include "mirror/method.h" @@ -68,6 +69,11 @@ const uint8_t DexFile::kDexMagicVersions[DexFile::kNumDexVersions][DexFile::kDex {'0', '3', '8', '\0'} }; +struct DexFile::AnnotationValue { + JValue value_; + uint8_t type_; +}; + bool DexFile::GetChecksum(const char* filename, uint32_t* checksum, std::string* error_msg) { CHECK(checksum != nullptr); uint32_t magic; diff --git a/runtime/dex_file.h b/runtime/dex_file.h index 767f9217d8..56e5eccd6f 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -19,7 +19,6 @@ #include <memory> #include <string> -#include <unordered_map> #include <vector> #include "base/logging.h" @@ -28,7 +27,6 @@ #include "globals.h" #include "invoke_type.h" #include "jni.h" -#include "jvalue.h" #include "mirror/object_array.h" #include "modifiers.h" #include "utf.h" @@ -398,11 +396,6 @@ class DexFile { DISALLOW_COPY_AND_ASSIGN(AnnotationItem); }; - struct AnnotationValue { - JValue value_; - uint8_t type_; - }; - enum AnnotationResultStyle { // private kAllObjects, kPrimitivesOrObjects, @@ -1022,10 +1015,6 @@ class DexFile { mirror::ObjectArray<mirror::Object>* ProcessAnnotationSetRefList(Handle<mirror::Class> klass, const AnnotationSetRefList* set_ref_list, uint32_t size) const REQUIRES_SHARED(Locks::mutator_lock_); - bool ProcessAnnotationValue(Handle<mirror::Class> klass, const uint8_t** annotation_ptr, - AnnotationValue* annotation_value, Handle<mirror::Class> return_class, - DexFile::AnnotationResultStyle result_style) const - REQUIRES_SHARED(Locks::mutator_lock_); mirror::Object* ProcessEncodedAnnotation(Handle<mirror::Class> klass, const uint8_t** annotation) const REQUIRES_SHARED(Locks::mutator_lock_); @@ -1203,6 +1192,12 @@ class DexFile { // whether the string contains the separator character. static bool IsMultiDexLocation(const char* location); + struct AnnotationValue; + + bool ProcessAnnotationValue(Handle<mirror::Class> klass, const uint8_t** annotation_ptr, + AnnotationValue* annotation_value, Handle<mirror::Class> return_class, + DexFile::AnnotationResultStyle result_style) const + REQUIRES_SHARED(Locks::mutator_lock_); // The base address of the memory mapping. const uint8_t* const begin_; diff --git a/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc index d680c5d634..5b9d03b7fa 100644 --- a/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc @@ -23,7 +23,6 @@ #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" #include "quick_exception_handler.h" -#include "stack.h" #include "thread.h" #include "verifier/method_verifier.h" diff --git a/runtime/handle.h b/runtime/handle.h index 69f8ef0ada..d4c13d4676 100644 --- a/runtime/handle.h +++ b/runtime/handle.h @@ -20,8 +20,10 @@ #include "base/casts.h" #include "base/logging.h" #include "base/macros.h" +#include "base/mutex.h" #include "base/value_object.h" -#include "stack.h" +#include "jni.h" +#include "stack_reference.h" namespace art { diff --git a/runtime/handle_scope.h b/runtime/handle_scope.h index ff36571b57..37eed993ea 100644 --- a/runtime/handle_scope.h +++ b/runtime/handle_scope.h @@ -22,8 +22,9 @@ #include "base/enums.h" #include "base/logging.h" #include "base/macros.h" +#include "base/mutex.h" #include "handle.h" -#include "stack.h" +#include "stack_reference.h" #include "verify_object.h" namespace art { diff --git a/runtime/image-inl.h b/runtime/image-inl.h index 28620db22e..669649efde 100644 --- a/runtime/image-inl.h +++ b/runtime/image-inl.h @@ -21,6 +21,7 @@ #include "art_method.h" #include "imtable.h" +#include "read_barrier-inl.h" namespace art { diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h index 44e0e2a567..417a185853 100644 --- a/runtime/jit/jit.h +++ b/runtime/jit/jit.h @@ -31,6 +31,7 @@ namespace art { class ArtMethod; struct RuntimeArgumentMap; +union JValue; namespace jit { diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc index 9ce4a02f1b..9ed0e7eacc 100644 --- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc +++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc @@ -23,7 +23,6 @@ #include "scoped_fast_native_object_access.h" #include "ScopedLocalRef.h" #include "ScopedPrimitiveArray.h" -#include "stack.h" #include "thread_list.h" namespace art { diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 9e1109ea85..55aba2befa 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -30,6 +30,7 @@ #include "mirror/class_loader.h" #include "mirror/throwable.h" #include "oat_quick_method_header.h" +#include "stack.h" #include "stack_map.h" #include "verifier/method_verifier.h" diff --git a/runtime/quick_exception_handler.h b/runtime/quick_exception_handler.h index 9d16eadcc0..5592126a61 100644 --- a/runtime/quick_exception_handler.h +++ b/runtime/quick_exception_handler.h @@ -20,7 +20,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/mutex.h" -#include "stack.h" // StackReference +#include "stack_reference.h" namespace art { @@ -29,8 +29,10 @@ class Throwable; } // namespace mirror class ArtMethod; class Context; +class OatQuickMethodHeader; class Thread; class ShadowFrame; +class StackVisitor; // Manages exception delivery for Quick backend. class QuickExceptionHandler { diff --git a/runtime/reflection.cc b/runtime/reflection.cc index 44e9bf542f..f2af3da6e4 100644 --- a/runtime/reflection.cc +++ b/runtime/reflection.cc @@ -29,7 +29,7 @@ #include "mirror/object_array-inl.h" #include "nth_caller_visitor.h" #include "scoped_thread_state_change.h" -#include "stack.h" +#include "stack_reference.h" #include "well_known_classes.h" namespace art { diff --git a/runtime/stack.h b/runtime/stack.h index 5dee147d6f..e9ed497094 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -25,9 +25,9 @@ #include "base/mutex.h" #include "dex_file.h" #include "gc_root.h" -#include "mirror/object_reference.h" #include "quick/quick_method_frame_info.h" #include "read_barrier.h" +#include "stack_reference.h" #include "verify_object.h" namespace art { @@ -45,6 +45,7 @@ class ScopedObjectAccess; class ShadowFrame; class StackVisitor; class Thread; +union JValue; // The kind of vreg being accessed in calls to Set/GetVReg. enum VRegKind { @@ -61,11 +62,6 @@ enum VRegKind { }; std::ostream& operator<<(std::ostream& os, const VRegKind& rhs); -// A reference from the shadow stack to a MirrorType object within the Java heap. -template<class MirrorType> -class MANAGED StackReference : public mirror::CompressedReference<MirrorType> { -}; - // Forward declaration. Just calls the destructor. struct ShadowFrameDeleter; using ShadowFrameAllocaUniquePtr = std::unique_ptr<ShadowFrame, ShadowFrameDeleter>; diff --git a/runtime/stack_reference.h b/runtime/stack_reference.h new file mode 100644 index 0000000000..3d37b764be --- /dev/null +++ b/runtime/stack_reference.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ART_RUNTIME_STACK_REFERENCE_H_ +#define ART_RUNTIME_STACK_REFERENCE_H_ + +#include "base/macros.h" +#include "mirror/object_reference.h" + +namespace art { + +// A reference from the shadow stack to a MirrorType object within the Java heap. +template<class MirrorType> +class PACKED(4) StackReference : public mirror::CompressedReference<MirrorType> { +}; + +} // namespace art + +#endif // ART_RUNTIME_STACK_REFERENCE_H_ diff --git a/runtime/utf.h b/runtime/utf.h index 51a6ade65f..cbb32fa6cd 100644 --- a/runtime/utf.h +++ b/runtime/utf.h @@ -18,7 +18,6 @@ #define ART_RUNTIME_UTF_H_ #include "base/macros.h" -#include "base/mutex.h" #include <stddef.h> #include <stdint.h> @@ -31,11 +30,6 @@ */ namespace art { -namespace mirror { - template<class T> class PrimitiveArray; - typedef PrimitiveArray<uint16_t> CharArray; -} // namespace mirror - /* * Returns the number of UTF-16 characters in the given modified UTF-8 string. */ @@ -80,9 +74,6 @@ void ConvertUtf16ToModifiedUtf8(char* utf8_out, size_t byte_count, /* * The java.lang.String hashCode() algorithm. */ -int32_t ComputeUtf16Hash(mirror::CharArray* chars, int32_t offset, size_t char_count) - REQUIRES_SHARED(Locks::mutator_lock_); - template<typename MemoryType> int32_t ComputeUtf16Hash(const MemoryType* chars, size_t char_count) { uint32_t hash = 0; diff --git a/runtime/verifier/reg_type.h b/runtime/verifier/reg_type.h index 00635a801d..c3ed77a962 100644 --- a/runtime/verifier/reg_type.h +++ b/runtime/verifier/reg_type.h @@ -35,6 +35,7 @@ namespace art { namespace mirror { class Class; +class ClassLoader; } // namespace mirror class ArenaBitVector; diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc index ee2ee1a36a..fd1ba020dd 100644 --- a/test/common/runtime_state.cc +++ b/test/common/runtime_state.cc @@ -22,12 +22,10 @@ #include "jit/jit.h" #include "jit/jit_code_cache.h" #include "mirror/class-inl.h" -#include "nth_caller_visitor.h" #include "oat_quick_method_header.h" #include "runtime.h" #include "scoped_thread_state_change.h" #include "ScopedUtfChars.h" -#include "stack.h" #include "thread-inl.h" namespace art { |