diff options
author | 2018-01-23 16:11:38 -0800 | |
---|---|---|
committer | 2018-01-24 09:24:29 -0800 | |
commit | 8c0961f9e061ee4b04c1c4ba8ad5cca13bcf884d (patch) | |
tree | f6e5a970a6bcc0935e150cb6c28a520bf31ba964 | |
parent | 2b1a21ed3581f77f34d582507177ebce33565534 (diff) |
Move missed files to libdexfile
Reduce the dependencies on utf and utils in preparation for separate
directory.
Bug: 22322814
Test: make -j 50 test-art-host
make -j 50 dexdump2 dexlist
Change-Id: Icdecf895dafec63ef903514eef79d459abc14925
30 files changed, 115 insertions, 90 deletions
diff --git a/compiler/dex/dex_to_dex_compiler.h b/compiler/dex/dex_to_dex_compiler.h index abd048167c..2105a9ded4 100644 --- a/compiler/dex/dex_to_dex_compiler.h +++ b/compiler/dex/dex_to_dex_compiler.h @@ -23,8 +23,8 @@ #include "base/bit_vector.h" #include "dex/dex_file.h" +#include "dex/invoke_type.h" #include "handle.h" -#include "invoke_type.h" #include "method_reference.h" #include "quicken_info.h" diff --git a/compiler/optimizing/inliner.h b/compiler/optimizing/inliner.h index e81d97b0a8..02465d37ba 100644 --- a/compiler/optimizing/inliner.h +++ b/compiler/optimizing/inliner.h @@ -18,7 +18,7 @@ #define ART_COMPILER_OPTIMIZING_INLINER_H_ #include "dex/dex_file_types.h" -#include "invoke_type.h" +#include "dex/invoke_type.h" #include "jit/profile_compilation_info.h" #include "optimization.h" diff --git a/compiler/optimizing/intrinsics.cc b/compiler/optimizing/intrinsics.cc index 6928b70df7..acb830e524 100644 --- a/compiler/optimizing/intrinsics.cc +++ b/compiler/optimizing/intrinsics.cc @@ -19,9 +19,9 @@ #include "art_field-inl.h" #include "art_method-inl.h" #include "class_linker.h" +#include "dex/invoke_type.h" #include "driver/compiler_driver.h" #include "driver/compiler_options.h" -#include "invoke_type.h" #include "mirror/dex_cache-inl.h" #include "nodes.h" #include "scoped_thread_state_change-inl.h" diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index b0657d6f1c..a9782a6afd 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -32,11 +32,11 @@ #include "deoptimization_kind.h" #include "dex/dex_file.h" #include "dex/dex_file_types.h" +#include "dex/invoke_type.h" #include "entrypoints/quick/quick_entrypoints_enum.h" #include "handle.h" #include "handle_scope.h" #include "intrinsics_enum.h" -#include "invoke_type.h" #include "locations.h" #include "method_reference.h" #include "mirror/class.h" diff --git a/openjdkjvmti/deopt_manager.cc b/openjdkjvmti/deopt_manager.cc index 53d84836fc..9e11a25e58 100644 --- a/openjdkjvmti/deopt_manager.cc +++ b/openjdkjvmti/deopt_manager.cc @@ -38,11 +38,11 @@ #include "base/enums.h" #include "base/mutex-inl.h" #include "dex/dex_file_annotations.h" +#include "dex/modifiers.h" #include "events-inl.h" #include "jni_internal.h" #include "mirror/class-inl.h" #include "mirror/object_array-inl.h" -#include "modifiers.h" #include "nativehelper/scoped_local_ref.h" #include "runtime_callbacks.h" #include "scoped_thread_state_change-inl.h" diff --git a/openjdkjvmti/ti_breakpoint.cc b/openjdkjvmti/ti_breakpoint.cc index fa7a34401d..d5fffdf439 100644 --- a/openjdkjvmti/ti_breakpoint.cc +++ b/openjdkjvmti/ti_breakpoint.cc @@ -39,11 +39,11 @@ #include "base/mutex-inl.h" #include "deopt_manager.h" #include "dex/dex_file_annotations.h" +#include "dex/modifiers.h" #include "events-inl.h" #include "jni_internal.h" #include "mirror/class-inl.h" #include "mirror/object_array-inl.h" -#include "modifiers.h" #include "nativehelper/scoped_local_ref.h" #include "runtime_callbacks.h" #include "scoped_thread_state_change-inl.h" diff --git a/openjdkjvmti/ti_field.cc b/openjdkjvmti/ti_field.cc index db5c31c43d..c016966d21 100644 --- a/openjdkjvmti/ti_field.cc +++ b/openjdkjvmti/ti_field.cc @@ -35,9 +35,9 @@ #include "art_jvmti.h" #include "base/enums.h" #include "dex/dex_file_annotations.h" +#include "dex/modifiers.h" #include "jni_internal.h" #include "mirror/object_array-inl.h" -#include "modifiers.h" #include "scoped_thread_state_change-inl.h" #include "thread-current-inl.h" diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc index 57fb699435..3f144c8f0f 100644 --- a/openjdkjvmti/ti_method.cc +++ b/openjdkjvmti/ti_method.cc @@ -40,6 +40,7 @@ #include "dex/code_item_accessors-inl.h" #include "dex/dex_file_annotations.h" #include "dex/dex_file_types.h" +#include "dex/modifiers.h" #include "events-inl.h" #include "jit/jit.h" #include "jni_internal.h" @@ -47,7 +48,6 @@ #include "mirror/class_loader.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" -#include "modifiers.h" #include "nativehelper/scoped_local_ref.h" #include "oat_file.h" #include "runtime_callbacks.h" diff --git a/runtime/Android.bp b/runtime/Android.bp index aba2b0e2a0..f2f7c3e3d0 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -14,12 +14,6 @@ // limitations under the License. // -// Keep the __jit_debug_register_code symbol as a unique symbol during ICF for architectures where -// we use gold as the linker (arm, x86, x86_64). The symbol is used by the debuggers to detect when -// new jit code is generated. We don't want it to be called when a different function with the same -// (empty) body is called. -JIT_DEBUG_REGISTER_CODE_LDFLAGS = ["-Wl,--keep-unique,__jit_debug_register_code"] - cc_defaults { name: "libdexfile_defaults", defaults: ["art_defaults"], @@ -33,6 +27,7 @@ cc_defaults { "dex/dex_file_tracking_registrar.cc", "dex/dex_file_verifier.cc", "dex/dex_instruction.cc", + "dex/modifiers.cc", "dex/standard_dex_file.cc", "utf.cc", "utils.cc", @@ -56,16 +51,8 @@ cc_defaults { ], }, }, - header_libs: [ - "jni_headers", - ], generated_sources: ["art_operator_srcs"], - // asm_support_gen.h (used by asm_support.h) is generated with cpp-define-generator - generated_headers: ["cpp-define-generator-asm-support"], - // export our headers so the libart-gtest targets can use it as well. - export_generated_headers: ["cpp-define-generator-asm-support"], include_dirs: [ - "external/icu/icu4c/source/common", "external/zlib", ], shared_libs: [ @@ -78,11 +65,20 @@ cc_defaults { // Exporting "." would shadow the system elf.h with our elf.h, // which in turn breaks any tools that reference this library. // export_include_dirs: ["."], +} - // ART's macros.h depends on libbase's macros.h. - // Note: runtime_options.h depends on cmdline. But we don't really want to export this - // generically. dex2oat takes care of it itself. - export_shared_lib_headers: ["libbase"], +gensrcs { + name: "dexfile_operator_srcs", + cmd: "$(location generate-operator-out.py) art/runtime $(in) > $(out)", + tool_files: ["generate-operator-out.py"], + srcs: [ + "dex/dex_file.h", + "dex/dex_file_layout.h", + "dex/dex_instruction.h", + "dex/dex_instruction_utils.h", + "dex/invoke_type.h", + ], + output_extension: "operator_out.cc", } art_cc_library { @@ -95,6 +91,12 @@ art_cc_library { }, } +// Keep the __jit_debug_register_code symbol as a unique symbol during ICF for architectures where +// we use gold as the linker (arm, x86, x86_64). The symbol is used by the debuggers to detect when +// new jit code is generated. We don't want it to be called when a different function with the same +// (empty) body is called. +JIT_DEBUG_REGISTER_CODE_LDFLAGS = ["-Wl,--keep-unique,__jit_debug_register_code"] + cc_defaults { name: "libart_defaults", defaults: ["art_defaults"], @@ -142,6 +144,7 @@ cc_defaults { "dex/dex_file_tracking_registrar.cc", "dex/dex_file_verifier.cc", "dex/dex_instruction.cc", + "dex/modifiers.cc", "dex/standard_dex_file.cc", "dex_to_dex_decompiler.cc", "elf_file.cc", @@ -535,6 +538,7 @@ gensrcs { "dex/dex_file_layout.h", "dex/dex_instruction.h", "dex/dex_instruction_utils.h", + "dex/invoke_type.h", "gc_root.h", "gc/allocator_type.h", "gc/allocator/rosalloc.h", @@ -547,7 +551,6 @@ gensrcs { "image.h", "instrumentation.h", "indirect_reference_table.h", - "invoke_type.h", "jdwp_provider.h", "jdwp/jdwp.h", "jdwp/jdwp_constants.h", diff --git a/runtime/art_field.h b/runtime/art_field.h index 46b013da7e..0eeeef2f2f 100644 --- a/runtime/art_field.h +++ b/runtime/art_field.h @@ -20,8 +20,8 @@ #include <jni.h> #include "dex/dex_file_types.h" +#include "dex/modifiers.h" #include "gc_root.h" -#include "modifiers.h" #include "obj_ptr.h" #include "offsets.h" #include "primitive.h" diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h index 88051c245d..65bacd8237 100644 --- a/runtime/art_method-inl.h +++ b/runtime/art_method-inl.h @@ -27,8 +27,8 @@ #include "dex/dex_file-inl.h" #include "dex/dex_file_annotations.h" #include "dex/dex_file_types.h" +#include "dex/invoke_type.h" #include "gc_root-inl.h" -#include "invoke_type.h" #include "intrinsics_enum.h" #include "jit/profiling_info.h" #include "mirror/class-inl.h" diff --git a/runtime/art_method.h b/runtime/art_method.h index 4501450e05..ce8e8ac612 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -31,8 +31,8 @@ #include "dex/code_item_accessors.h" #include "dex/dex_file.h" #include "dex/dex_instruction_iterator.h" +#include "dex/modifiers.h" #include "gc_root.h" -#include "modifiers.h" #include "obj_ptr.h" #include "offsets.h" #include "primitive.h" diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc index 92d86519dc..03774f45cd 100644 --- a/runtime/common_throws.cc +++ b/runtime/common_throws.cc @@ -26,7 +26,7 @@ #include "class_linker-inl.h" #include "dex/dex_file-inl.h" #include "dex/dex_instruction-inl.h" -#include "invoke_type.h" +#include "dex/invoke_type.h" #include "mirror/class-inl.h" #include "mirror/method_type.h" #include "mirror/object-inl.h" diff --git a/runtime/dex/dex_file_verifier.cc b/runtime/dex/dex_file_verifier.cc index 5800bb1006..f7fdbb027c 100644 --- a/runtime/dex/dex_file_verifier.cc +++ b/runtime/dex/dex_file_verifier.cc @@ -27,6 +27,7 @@ #include "dex_file-inl.h" #include "experimental_flags.h" #include "leb128.h" +#include "modifiers.h" #include "safe_map.h" #include "utf-inl.h" #include "utils.h" diff --git a/runtime/invoke_type.h b/runtime/dex/invoke_type.h index 2b877e6f51..726d269a3e 100644 --- a/runtime/invoke_type.h +++ b/runtime/dex/invoke_type.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_INVOKE_TYPE_H_ -#define ART_RUNTIME_INVOKE_TYPE_H_ +#ifndef ART_RUNTIME_DEX_INVOKE_TYPE_H_ +#define ART_RUNTIME_DEX_INVOKE_TYPE_H_ #include <iosfwd> @@ -35,4 +35,4 @@ std::ostream& operator<<(std::ostream& os, const InvokeType& rhs); } // namespace art -#endif // ART_RUNTIME_INVOKE_TYPE_H_ +#endif // ART_RUNTIME_DEX_INVOKE_TYPE_H_ diff --git a/runtime/dex/modifiers.cc b/runtime/dex/modifiers.cc new file mode 100644 index 0000000000..30daefb172 --- /dev/null +++ b/runtime/dex/modifiers.cc @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#include <string> + +#include "modifiers.h" + +namespace art { + +std::string PrettyJavaAccessFlags(uint32_t access_flags) { + std::string result; + if ((access_flags & kAccPublic) != 0) { + result += "public "; + } + if ((access_flags & kAccProtected) != 0) { + result += "protected "; + } + if ((access_flags & kAccPrivate) != 0) { + result += "private "; + } + if ((access_flags & kAccFinal) != 0) { + result += "final "; + } + if ((access_flags & kAccStatic) != 0) { + result += "static "; + } + if ((access_flags & kAccAbstract) != 0) { + result += "abstract "; + } + if ((access_flags & kAccInterface) != 0) { + result += "interface "; + } + if ((access_flags & kAccTransient) != 0) { + result += "transient "; + } + if ((access_flags & kAccVolatile) != 0) { + result += "volatile "; + } + if ((access_flags & kAccSynchronized) != 0) { + result += "synchronized "; + } + return result; +} + +} // namespace art diff --git a/runtime/modifiers.h b/runtime/dex/modifiers.h index 0e2db932bb..2998f602d4 100644 --- a/runtime/modifiers.h +++ b/runtime/dex/modifiers.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_RUNTIME_MODIFIERS_H_ -#define ART_RUNTIME_MODIFIERS_H_ +#ifndef ART_RUNTIME_DEX_MODIFIERS_H_ +#define ART_RUNTIME_DEX_MODIFIERS_H_ #include <stdint.h> @@ -138,7 +138,11 @@ static constexpr uint32_t kAccValidInterfaceFlags = kAccPublic | kAccInterface | static constexpr uint32_t kAccVisibilityFlags = kAccPublic | kAccPrivate | kAccProtected; +// Returns a human-readable version of the Java part of the access flags, e.g., "private static " +// (note the trailing whitespace). +std::string PrettyJavaAccessFlags(uint32_t access_flags); + } // namespace art -#endif // ART_RUNTIME_MODIFIERS_H_ +#endif // ART_RUNTIME_DEX_MODIFIERS_H_ diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index 3048f45f30..9ef7d426df 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -25,12 +25,12 @@ #include "class_linker-inl.h" #include "common_throws.h" #include "dex/dex_file.h" +#include "dex/invoke_type.h" #include "entrypoints/quick/callee_save_frame.h" #include "handle_scope-inl.h" #include "imt_conflict_table.h" #include "imtable-inl.h" #include "indirect_reference_table.h" -#include "invoke_type.h" #include "jni_internal.h" #include "mirror/array.h" #include "mirror/class-inl.h" diff --git a/runtime/hidden_api_access_flags.h b/runtime/hidden_api_access_flags.h index 80a002d96e..c328f965d2 100644 --- a/runtime/hidden_api_access_flags.h +++ b/runtime/hidden_api_access_flags.h @@ -18,7 +18,7 @@ #define ART_RUNTIME_HIDDEN_API_ACCESS_FLAGS_H_ #include "base/bit_utils.h" -#include "modifiers.h" +#include "dex/modifiers.h" namespace art { diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h index 302a5e622e..cd313b32ab 100644 --- a/runtime/mirror/class-inl.h +++ b/runtime/mirror/class-inl.h @@ -26,11 +26,11 @@ #include "class_linker.h" #include "class_loader.h" #include "common_throws.h" -#include "dex_cache.h" #include "dex/dex_file-inl.h" +#include "dex/invoke_type.h" +#include "dex_cache.h" #include "gc/heap-inl.h" #include "iftable.h" -#include "invoke_type.h" #include "subtype_check.h" #include "object-inl.h" #include "object_array.h" diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h index 84b032620f..ced7c7c908 100644 --- a/runtime/mirror/class.h +++ b/runtime/mirror/class.h @@ -25,10 +25,10 @@ #include "class_status.h" #include "dex/dex_file.h" #include "dex/dex_file_types.h" +#include "dex/modifiers.h" #include "gc/allocator_type.h" #include "gc_root.h" #include "imtable.h" -#include "modifiers.h" #include "object.h" #include "object_array.h" #include "primitive.h" diff --git a/runtime/mirror/field.h b/runtime/mirror/field.h index 6845575d18..dd09be331a 100644 --- a/runtime/mirror/field.h +++ b/runtime/mirror/field.h @@ -19,8 +19,8 @@ #include "accessible_object.h" #include "base/enums.h" +#include "dex/modifiers.h" #include "gc_root.h" -#include "modifiers.h" #include "obj_ptr.h" #include "object.h" #include "primitive.h" diff --git a/runtime/mirror/method_handles_lookup.cc b/runtime/mirror/method_handles_lookup.cc index a390a2ef53..039bbf2932 100644 --- a/runtime/mirror/method_handles_lookup.cc +++ b/runtime/mirror/method_handles_lookup.cc @@ -17,11 +17,11 @@ #include "method_handles_lookup.h" #include "class-inl.h" +#include "dex/modifiers.h" #include "gc_root-inl.h" #include "handle_scope.h" #include "jni_internal.h" #include "mirror/method_handle_impl.h" -#include "modifiers.h" #include "object-inl.h" #include "well_known_classes.h" diff --git a/runtime/runtime_intrinsics.cc b/runtime/runtime_intrinsics.cc index f710ebeb4c..3295a86e59 100644 --- a/runtime/runtime_intrinsics.cc +++ b/runtime/runtime_intrinsics.cc @@ -18,8 +18,8 @@ #include "art_method-inl.h" #include "class_linker.h" +#include "dex/invoke_type.h" #include "intrinsics_enum.h" -#include "invoke_type.h" #include "mirror/class.h" #include "runtime.h" #include "scoped_thread_state_change-inl.h" diff --git a/runtime/utf.cc b/runtime/utf.cc index 93fcb32136..32ae187297 100644 --- a/runtime/utf.cc +++ b/runtime/utf.cc @@ -18,8 +18,7 @@ #include <android-base/logging.h> -#include "mirror/array.h" -#include "mirror/object-inl.h" +#include "base/casts.h" #include "utf-inl.h" namespace art { diff --git a/runtime/utils.cc b/runtime/utils.cc index 79ddcb9bff..b2ec669f32 100644 --- a/runtime/utils.cc +++ b/runtime/utils.cc @@ -30,7 +30,6 @@ #include "android-base/stringprintf.h" #include "android-base/strings.h" -#include "dex/dex_file-inl.h" #include "os.h" #include "utf-inl.h" @@ -126,41 +125,6 @@ std::string PrettyDescriptor(const char* descriptor) { return result; } -std::string PrettyJavaAccessFlags(uint32_t access_flags) { - std::string result; - if ((access_flags & kAccPublic) != 0) { - result += "public "; - } - if ((access_flags & kAccProtected) != 0) { - result += "protected "; - } - if ((access_flags & kAccPrivate) != 0) { - result += "private "; - } - if ((access_flags & kAccFinal) != 0) { - result += "final "; - } - if ((access_flags & kAccStatic) != 0) { - result += "static "; - } - if ((access_flags & kAccAbstract) != 0) { - result += "abstract "; - } - if ((access_flags & kAccInterface) != 0) { - result += "interface "; - } - if ((access_flags & kAccTransient) != 0) { - result += "transient "; - } - if ((access_flags & kAccVolatile) != 0) { - result += "volatile "; - } - if ((access_flags & kAccSynchronized) != 0) { - result += "synchronized "; - } - return result; -} - std::string PrettySize(int64_t byte_count) { // The byte thresholds at which we display amounts. A byte count is displayed // in unit U when kUnitThresholds[U] <= bytes < kUnitThresholds[U+1]. diff --git a/runtime/utils.h b/runtime/utils.h index 7402c12280..abdafcc9f7 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -82,10 +82,6 @@ void AppendPrettyDescriptor(const char* descriptor, std::string* result); std::string PrettyDescriptor(const char* descriptor); std::string PrettyDescriptor(Primitive::Type type); -// Returns a human-readable version of the Java part of the access flags, e.g., "private static " -// (note the trailing whitespace). -std::string PrettyJavaAccessFlags(uint32_t access_flags); - // Returns a human-readable size string such as "1MB". std::string PrettySize(int64_t size_in_bytes); diff --git a/test/ti-agent/common_helper.h b/test/ti-agent/common_helper.h index fafa1afcda..e46abb6f5a 100644 --- a/test/ti-agent/common_helper.h +++ b/test/ti-agent/common_helper.h @@ -22,7 +22,7 @@ namespace art { -// Taken from art/runtime/modifiers.h +// Taken from art/runtime/dex/modifiers.h static constexpr uint32_t kAccStatic = 0x0008; // field, method, ic jobject GetJavaField(jvmtiEnv* jvmti, JNIEnv* env, jclass field_klass, jfieldID f); diff --git a/tools/cpp-define-generator/constant_class.def b/tools/cpp-define-generator/constant_class.def index 4f1d875e5a..1310103ab7 100644 --- a/tools/cpp-define-generator/constant_class.def +++ b/tools/cpp-define-generator/constant_class.def @@ -15,8 +15,8 @@ */ #if defined(DEFINE_INCLUDE_DEPENDENCIES) -#include "modifiers.h" // kAccClassIsFinalizable #include "base/bit_utils.h" // MostSignificantBit +#include "dex/modifiers.h" // kAccClassIsFinalizable #endif #define DEFINE_FLAG_OFFSET(type_name, field_name, expr) \ diff --git a/tools/cpp-define-generator/constant_globals.def b/tools/cpp-define-generator/constant_globals.def index 5018f52937..539633e0b3 100644 --- a/tools/cpp-define-generator/constant_globals.def +++ b/tools/cpp-define-generator/constant_globals.def @@ -18,8 +18,8 @@ #if defined(DEFINE_INCLUDE_DEPENDENCIES) #include <atomic> // std::memory_order_relaxed +#include "dex/modifiers.h" #include "globals.h" // art::kObjectAlignment -#include "modifiers.h" #endif DEFINE_EXPR(STD_MEMORY_ORDER_RELAXED, int32_t, std::memory_order_relaxed) |