diff options
author | Ian Rogers <irogers@google.com> | 2014-06-06 15:58:22 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-06-06 16:27:45 -0700 |
commit | 576ca0cd692c0b6ae70e776de91015b8ff000a08 (patch) | |
tree | de632fae7ee9f096e7a2c54a7fcdace8f6ae7106 | |
parent | e21bf0099117b82963cdf7f95a1b8dabfcf29397 (diff) | |
download | art-576ca0cd692c0b6ae70e776de91015b8ff000a08.zip art-576ca0cd692c0b6ae70e776de91015b8ff000a08.tar.gz art-576ca0cd692c0b6ae70e776de91015b8ff000a08.tar.bz2 |
Reduce header files including header files.
Main focus is getting heap.h out of runtime.h.
Change-Id: I8d13dce8512816db2820a27b24f5866cc871a04b
32 files changed, 122 insertions, 68 deletions
diff --git a/compiler/dex/quick/arm/call_arm.cc b/compiler/dex/quick/arm/call_arm.cc index 9f9e618..db0731f 100644 --- a/compiler/dex/quick/arm/call_arm.cc +++ b/compiler/dex/quick/arm/call_arm.cc @@ -19,6 +19,7 @@ #include "arm_lir.h" #include "codegen_arm.h" #include "dex/quick/mir_to_lir-inl.h" +#include "gc/accounting/card_table.h" #include "entrypoints/quick/quick_entrypoints.h" namespace art { diff --git a/compiler/dex/quick/arm64/call_arm64.cc b/compiler/dex/quick/arm64/call_arm64.cc index d0f8e74..b80938a 100644 --- a/compiler/dex/quick/arm64/call_arm64.cc +++ b/compiler/dex/quick/arm64/call_arm64.cc @@ -19,6 +19,7 @@ #include "arm64_lir.h" #include "codegen_arm64.h" #include "dex/quick/mir_to_lir-inl.h" +#include "gc/accounting/card_table.h" #include "entrypoints/quick/quick_entrypoints.h" namespace art { diff --git a/compiler/dex/quick/mips/call_mips.cc b/compiler/dex/quick/mips/call_mips.cc index e1bdb2e..c734202 100644 --- a/compiler/dex/quick/mips/call_mips.cc +++ b/compiler/dex/quick/mips/call_mips.cc @@ -19,6 +19,7 @@ #include "codegen_mips.h" #include "dex/quick/mir_to_lir-inl.h" #include "entrypoints/quick/quick_entrypoints.h" +#include "gc/accounting/card_table.h" #include "mips_lir.h" namespace art { diff --git a/compiler/dex/quick/x86/call_x86.cc b/compiler/dex/quick/x86/call_x86.cc index f363eb3..fc0b305 100644 --- a/compiler/dex/quick/x86/call_x86.cc +++ b/compiler/dex/quick/x86/call_x86.cc @@ -18,6 +18,7 @@ #include "codegen_x86.h" #include "dex/quick/mir_to_lir-inl.h" +#include "gc/accounting/card_table.h" #include "x86_lir.h" namespace art { diff --git a/compiler/elf_stripper.cc b/compiler/elf_stripper.cc index 8c06c9f..0b86ad0 100644 --- a/compiler/elf_stripper.cc +++ b/compiler/elf_stripper.cc @@ -22,6 +22,7 @@ #include <vector> #include "base/logging.h" +#include "base/stringprintf.h" #include "elf_file.h" #include "elf_utils.h" #include "utils.h" diff --git a/compiler/optimizing/pretty_printer.h b/compiler/optimizing/pretty_printer.h index a7727c0..2c8166e 100644 --- a/compiler/optimizing/pretty_printer.h +++ b/compiler/optimizing/pretty_printer.h @@ -17,6 +17,7 @@ #ifndef ART_COMPILER_OPTIMIZING_PRETTY_PRINTER_H_ #define ART_COMPILER_OPTIMIZING_PRETTY_PRINTER_H_ +#include "base/stringprintf.h" #include "nodes.h" namespace art { diff --git a/runtime/arch/arm/quick_method_frame_info_arm.h b/runtime/arch/arm/quick_method_frame_info_arm.h index 8d08190..83cacac 100644 --- a/runtime/arch/arm/quick_method_frame_info_arm.h +++ b/runtime/arch/arm/quick_method_frame_info_arm.h @@ -20,6 +20,7 @@ #include "quick/quick_method_frame_info.h" #include "registers_arm.h" #include "runtime.h" // for Runtime::CalleeSaveType. +#include "utils.h" namespace art { namespace arm { diff --git a/runtime/base/mutex-inl.h b/runtime/base/mutex-inl.h index a9472f7..d20eb17 100644 --- a/runtime/base/mutex-inl.h +++ b/runtime/base/mutex-inl.h @@ -25,6 +25,8 @@ #include "cutils/atomic-inline.h" #include "cutils/trace.h" + +#include "base/stringprintf.h" #include "runtime.h" #include "thread.h" diff --git a/runtime/dex_file.h b/runtime/dex_file.h index 1d5032d..8270a2b 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -26,7 +26,6 @@ #include "globals.h" #include "invoke_type.h" #include "jni.h" -#include "mem_map.h" #include "modifiers.h" #include "safe_map.h" @@ -41,6 +40,7 @@ namespace mirror { class DexCache; } // namespace mirror class ClassLinker; +class MemMap; class Signature; template<class T> class Handle; class StringPiece; diff --git a/runtime/dex_instruction.cc b/runtime/dex_instruction.cc index 0494f22..0a71d62 100644 --- a/runtime/dex_instruction.cc +++ b/runtime/dex_instruction.cc @@ -20,6 +20,7 @@ #include <iomanip> +#include "base/stringprintf.h" #include "dex_file-inl.h" #include "utils.h" diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc index 5d20096..0df8211 100644 --- a/runtime/elf_file.cc +++ b/runtime/elf_file.cc @@ -20,6 +20,7 @@ #include <unistd.h> #include "base/logging.h" +#include "base/stringprintf.h" #include "base/stl_util.h" #include "utils.h" #include "instruction_set.h" diff --git a/runtime/fault_handler.h b/runtime/fault_handler.h index 97d3c2f..026f5b9 100644 --- a/runtime/fault_handler.h +++ b/runtime/fault_handler.h @@ -29,7 +29,7 @@ namespace art { namespace mirror { class ArtMethod; -} // namespace mirror +} // namespace mirror class FaultHandler; diff --git a/runtime/gc/accounting/space_bitmap.cc b/runtime/gc/accounting/space_bitmap.cc index 3cb8d94..436a5b5 100644 --- a/runtime/gc/accounting/space_bitmap.cc +++ b/runtime/gc/accounting/space_bitmap.cc @@ -72,6 +72,12 @@ void SpaceBitmap<kAlignment>::SetHeapLimit(uintptr_t new_end) { } template<size_t kAlignment> +std::string SpaceBitmap<kAlignment>::Dump() const { + return StringPrintf("%s: %p-%p", name_.c_str(), reinterpret_cast<void*>(HeapBegin()), + reinterpret_cast<void*>(HeapLimit())); +} + +template<size_t kAlignment> void SpaceBitmap<kAlignment>::Clear() { if (bitmap_begin_ != NULL) { // This returns the memory to the system. Successive page faults will return zeroed memory. diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h index 50d15c6..0849171 100644 --- a/runtime/gc/accounting/space_bitmap.h +++ b/runtime/gc/accounting/space_bitmap.h @@ -26,7 +26,6 @@ #include "base/mutex.h" #include "gc_allocator.h" #include "globals.h" -#include "mem_map.h" #include "object_callbacks.h" namespace art { @@ -34,6 +33,7 @@ namespace art { namespace mirror { class Object; } // namespace mirror +class MemMap; namespace gc { namespace accounting { @@ -183,10 +183,7 @@ class SpaceBitmap { name_ = name; } - std::string Dump() const { - return StringPrintf("%s: %p-%p", name_.c_str(), reinterpret_cast<void*>(HeapBegin()), - reinterpret_cast<void*>(HeapLimit())); - } + std::string Dump() const; const void* GetObjectWordAddress(const mirror::Object* obj) const { uintptr_t addr = reinterpret_cast<uintptr_t>(obj); diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h index 5630862..2dd2cd7 100644 --- a/runtime/instrumentation.h +++ b/runtime/instrumentation.h @@ -17,15 +17,15 @@ #ifndef ART_RUNTIME_INSTRUMENTATION_H_ #define ART_RUNTIME_INSTRUMENTATION_H_ +#include <stdint.h> +#include <set> +#include <list> + #include "atomic.h" #include "base/macros.h" #include "base/mutex.h" #include "object_callbacks.h" -#include <stdint.h> -#include <set> -#include <list> - namespace art { namespace mirror { class ArtField; diff --git a/runtime/jni_internal-inl.h b/runtime/jni_internal-inl.h new file mode 100644 index 0000000..6cf9a61 --- /dev/null +++ b/runtime/jni_internal-inl.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 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_JNI_INTERNAL_INL_H_ +#define ART_RUNTIME_JNI_INTERNAL_INL_H_ + +#include "jni_internal.h" + +#include "utils.h" + +namespace art { + +template<typename T> +inline T JNIEnvExt::AddLocalReference(mirror::Object* obj) { + IndirectRef ref = locals.Add(local_ref_cookie, obj); + + // TODO: fix this to understand PushLocalFrame, so we can turn it on. + if (false) { + if (check_jni) { + size_t entry_count = locals.Capacity(); + if (entry_count > 16) { + locals.Dump(LOG(WARNING) << "Warning: more than 16 JNI local references: " + << entry_count << " (most recent was a " << PrettyTypeOf(obj) << ")\n"); + // TODO: LOG(FATAL) in a later release? + } + } + } + + return reinterpret_cast<T>(ref); +} + +} // namespace art + +#endif // ART_RUNTIME_JNI_INTERNAL_INL_H_ diff --git a/runtime/jni_internal.h b/runtime/jni_internal.h index 4072da4..abb71b7 100644 --- a/runtime/jni_internal.h +++ b/runtime/jni_internal.h @@ -24,7 +24,6 @@ #include "indirect_reference_table.h" #include "object_callbacks.h" #include "reference_table.h" -#include "runtime.h" #include <iosfwd> #include <string> @@ -45,6 +44,7 @@ namespace mirror { union JValue; class Libraries; class ParsedOptions; +class Runtime; class ScopedObjectAccess; template<class T> class Handle; class Thread; @@ -216,25 +216,6 @@ class ScopedJniEnvLocalRefState { DISALLOW_COPY_AND_ASSIGN(ScopedJniEnvLocalRefState); }; -template<typename T> -inline T JNIEnvExt::AddLocalReference(mirror::Object* obj) { - IndirectRef ref = locals.Add(local_ref_cookie, obj); - - // TODO: fix this to understand PushLocalFrame, so we can turn it on. - if (false) { - if (check_jni) { - size_t entry_count = locals.Capacity(); - if (entry_count > 16) { - locals.Dump(LOG(WARNING) << "Warning: more than 16 JNI local references: " - << entry_count << " (most recent was a " << PrettyTypeOf(obj) << ")\n"); - // TODO: LOG(FATAL) in a later release? - } - } - } - - return reinterpret_cast<T>(ref); -} - } // namespace art std::ostream& operator<<(std::ostream& os, const jobjectRefType& rhs); diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h index 9b6e901..c7540dc 100644 --- a/runtime/mirror/object_array-inl.h +++ b/runtime/mirror/object_array-inl.h @@ -19,6 +19,7 @@ #include "object_array.h" +#include "base/stringprintf.h" #include "gc/heap.h" #include "mirror/art_field.h" #include "mirror/class.h" diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index 29868e3..cff5ec3 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -15,13 +15,16 @@ */ #include "parsed_options.h" -#include "utils.h" + #ifdef HAVE_ANDROID_OS #include "cutils/properties.h" #endif +#include "base/stringpiece.h" #include "debugger.h" +#include "gc/heap.h" #include "monitor.h" +#include "utils.h" namespace art { diff --git a/runtime/parsed_options.h b/runtime/parsed_options.h index a27eec6..d0f3c12 100644 --- a/runtime/parsed_options.h +++ b/runtime/parsed_options.h @@ -19,6 +19,7 @@ #include <string> +#include "gc/collector_type.h" #include "runtime.h" #include "trace.h" diff --git a/runtime/runtime.cc b/runtime/runtime.cc index f16eddf..89058c8 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -44,6 +44,7 @@ #include "atomic.h" #include "class_linker.h" #include "debugger.h" +#include "fault_handler.h" #include "gc/accounting/card_table-inl.h" #include "gc/heap.h" #include "gc/space/space.h" diff --git a/runtime/runtime.h b/runtime/runtime.h index 808d706..8776a59 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -25,26 +25,21 @@ #include <utility> #include <vector> -#include "base/macros.h" -#include "base/stringpiece.h" -#include "gc/collector_type.h" -#include "gc/heap.h" -#include "globals.h" -#include "instruction_set.h" #include "instrumentation.h" +#include "instruction_set.h" #include "jobject_comparator.h" #include "object_callbacks.h" +#include "offsets.h" #include "profiler_options.h" #include "quick/quick_method_frame_info.h" #include "runtime_stats.h" #include "safe_map.h" -#include "fault_handler.h" namespace art { namespace gc { class Heap; -} +} // namespace gc namespace mirror { class ArtMethod; class ClassLoader; @@ -65,7 +60,10 @@ class InternTable; class JavaVMExt; class MonitorList; class MonitorPool; +class NullPointerHandler; class SignalCatcher; +class StackOverflowHandler; +class SuspensionHandler; class ThreadList; class Trace; class Transaction; diff --git a/runtime/scoped_thread_state_change.h b/runtime/scoped_thread_state_change.h index d56495e..7ce68c6 100644 --- a/runtime/scoped_thread_state_change.h +++ b/runtime/scoped_thread_state_change.h @@ -18,6 +18,7 @@ #define ART_RUNTIME_SCOPED_THREAD_STATE_CHANGE_H_ #include "base/casts.h" +#include "jni_internal-inl.h" #include "thread-inl.h" #include "verify_object.h" diff --git a/runtime/thread-inl.h b/runtime/thread-inl.h index fc886d5..b1180bd 100644 --- a/runtime/thread-inl.h +++ b/runtime/thread-inl.h @@ -21,9 +21,11 @@ #include <pthread.h> +#include "cutils/atomic-inline.h" + #include "base/casts.h" #include "base/mutex-inl.h" -#include "cutils/atomic-inline.h" +#include "gc/heap.h" #include "jni_internal.h" namespace art { diff --git a/runtime/utils.cc b/runtime/utils.cc index f562252..dd64e52 100644 --- a/runtime/utils.cc +++ b/runtime/utils.cc @@ -552,6 +552,18 @@ std::string FormatDuration(uint64_t nano_duration, TimeUnit time_unit) { } } +std::string PrintableChar(uint16_t ch) { + std::string result; + result += '\''; + if (NeedsEscaping(ch)) { + StringAppendF(&result, "\\u%04x", ch); + } else { + result += ch; + } + result += '\''; + return result; +} + std::string PrintableString(const std::string& utf) { std::string result; result += '"'; diff --git a/runtime/utils.h b/runtime/utils.h index 7be5d44..6a4198f 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -23,7 +23,6 @@ #include <vector> #include "base/logging.h" -#include "base/stringprintf.h" #include "globals.h" #include "instruction_set.h" #include "primitive.h" @@ -205,17 +204,7 @@ static inline bool NeedsEscaping(uint16_t ch) { return (ch < ' ' || ch > '~'); } -static inline std::string PrintableChar(uint16_t ch) { - std::string result; - result += '\''; - if (NeedsEscaping(ch)) { - StringAppendF(&result, "\\u%04x", ch); - } else { - result += ch; - } - result += '\''; - return result; -} +std::string PrintableChar(uint16_t ch); // Returns an ASCII string corresponding to the given UTF-8 string. // Java escapes are used for non-ASCII characters. diff --git a/runtime/verifier/instruction_flags.h b/runtime/verifier/instruction_flags.h index e50ba13..f8abca0 100644 --- a/runtime/verifier/instruction_flags.h +++ b/runtime/verifier/instruction_flags.h @@ -17,11 +17,11 @@ #ifndef ART_RUNTIME_VERIFIER_INSTRUCTION_FLAGS_H_ #define ART_RUNTIME_VERIFIER_INSTRUCTION_FLAGS_H_ -#include "base/logging.h" - #include <stdint.h> #include <string> +#include "base/logging.h" + namespace art { namespace verifier { diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index b5c07aa..8d46812 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -507,6 +507,11 @@ std::ostream& MethodVerifier::Fail(VerifyError error) { return *failure_message; } +std::ostream& MethodVerifier::LogVerifyInfo() { + return info_messages_ << "VFY: " << PrettyMethod(dex_method_idx_, *dex_file_) + << '[' << reinterpret_cast<void*>(work_insn_idx_) << "] : "; +} + void MethodVerifier::PrependToLastFailMessage(std::string prepend) { size_t failure_num = failure_messages_.size(); DCHECK_NE(failure_num, 0U); diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index a23e80d..451c9e2 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -29,9 +29,8 @@ #include "dex_instruction.h" #include "instruction_flags.h" #include "method_reference.h" -#include "mirror/object.h" #include "reg_type.h" -#include "reg_type_cache-inl.h" +#include "reg_type_cache.h" #include "register_line.h" #include "safe_map.h" @@ -170,10 +169,7 @@ class MethodVerifier { std::ostream& Fail(VerifyError error); // Log for verification information. - std::ostream& LogVerifyInfo() { - return info_messages_ << "VFY: " << PrettyMethod(dex_method_idx_, *dex_file_) - << '[' << reinterpret_cast<void*>(work_insn_idx_) << "] : "; - } + std::ostream& LogVerifyInfo(); // Dump the failures encountered by the verifier. std::ostream& DumpFailures(std::ostream& os); diff --git a/runtime/verifier/reg_type.h b/runtime/verifier/reg_type.h index a23b8c4..64001d3 100644 --- a/runtime/verifier/reg_type.h +++ b/runtime/verifier/reg_type.h @@ -17,18 +17,18 @@ #ifndef ART_RUNTIME_VERIFIER_REG_TYPE_H_ #define ART_RUNTIME_VERIFIER_REG_TYPE_H_ -#include "base/macros.h" -#include "globals.h" -#include "object_callbacks.h" -#include "primitive.h" - -#include "jni.h" - #include <limits> #include <stdint.h> #include <set> #include <string> +#include "jni.h" + +#include "base/macros.h" +#include "globals.h" +#include "object_callbacks.h" +#include "primitive.h" + namespace art { namespace mirror { class Class; diff --git a/runtime/verifier/register_line-inl.h b/runtime/verifier/register_line-inl.h index b3a2847..0989cd0 100644 --- a/runtime/verifier/register_line-inl.h +++ b/runtime/verifier/register_line-inl.h @@ -18,7 +18,9 @@ #define ART_RUNTIME_VERIFIER_REGISTER_LINE_INL_H_ #include "register_line.h" + #include "method_verifier.h" +#include "reg_type_cache-inl.h" namespace art { namespace verifier { diff --git a/runtime/verifier/register_line.cc b/runtime/verifier/register_line.cc index a3e3e3b..d21f39b 100644 --- a/runtime/verifier/register_line.cc +++ b/runtime/verifier/register_line.cc @@ -16,6 +16,7 @@ #include "register_line.h" +#include "base/stringprintf.h" #include "dex_instruction-inl.h" #include "method_verifier.h" #include "register_line-inl.h" |